summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2015-09-18 18:39:08 +0200
committerOlivier Bertrand <bertrandop@gmail.com>2015-09-18 18:39:08 +0200
commit9c6405fefaf7311b31591ab445660e8f34d64295 (patch)
tree87aa09ef6a2f9d33d2d19ef56d3e76e57114d361
parentf4fe138321092c8dcd02caf22bdbad9698ee6829 (diff)
parent79140b03839a6b46a92736bd2ce03cefd43a5058 (diff)
downloadmariadb-git-9c6405fefaf7311b31591ab445660e8f34d64295.tar.gz
Commit resolved conflicts
-rw-r--r--.gitattributes3
-rw-r--r--CMakeLists.txt1
-rw-r--r--VERSION2
-rw-r--r--client/mysql_upgrade.c3
-rw-r--r--client/mysqlbinlog.cc11
-rw-r--r--client/mysqlcheck.c41
-rw-r--r--client/mysqldump.c19
-rw-r--r--client/mysqlimport.c7
-rw-r--r--client/mysqlslap.c49
-rw-r--r--client/mysqltest.cc41
-rw-r--r--cmake/abi_check.cmake2
-rw-r--r--cmake/check_compiler_flag.cmake14
-rw-r--r--cmake/cpack_rpm.cmake3
-rw-r--r--cmake/do_abi_check.cmake2
-rw-r--r--cmake/libutils.cmake8
-rw-r--r--cmake/maintainer.cmake8
-rw-r--r--cmake/make_dist.cmake.in10
-rw-r--r--cmake/os/WindowsCache.cmake5
-rw-r--r--cmake/ssl.cmake1
-rw-r--r--config.h.cmake27
-rw-r--r--configure.cmake21
-rw-r--r--debian/additions/mysqld_safe_syslog.cnf1
-rw-r--r--debian/dist/Debian/control67
-rw-r--r--debian/dist/Ubuntu/control59
-rw-r--r--extra/yassl/CMakeLists.txt9
-rw-r--r--include/atomic/gcc_builtins.h4
-rw-r--r--include/m_ctype.h20
-rw-r--r--include/my_base.h4
-rw-r--r--include/my_crypt.h82
-rw-r--r--include/my_getopt.h6
-rw-r--r--include/my_global.h13
-rw-r--r--include/my_handler_errors.h3
-rw-r--r--include/my_stacktrace.h3
-rw-r--r--include/my_sys.h23
-rw-r--r--include/mysql.h.pp13
-rw-r--r--include/mysql/client_plugin.h.pp2
-rw-r--r--include/mysql/plugin_audit.h.pp69
-rw-r--r--include/mysql/plugin_auth.h.pp70
-rw-r--r--include/mysql/plugin_encryption.h51
-rw-r--r--include/mysql/plugin_encryption.h.pp80
-rw-r--r--include/mysql/plugin_ftparser.h.pp68
-rw-r--r--include/mysql/plugin_password_validation.h.pp69
-rw-r--r--include/mysql/psi/mysql_socket.h28
-rw-r--r--include/mysql/psi/mysql_table.h14
-rw-r--r--include/mysql/psi/psi_abi_v1.h.pp1
-rw-r--r--include/mysql/psi/psi_abi_v2.h.pp1
-rw-r--r--include/mysql/service_encryption.h84
-rw-r--r--include/mysql/service_wsrep.h14
-rw-r--r--include/mysql_com.h9
-rw-r--r--include/service_versions.h2
-rw-r--r--libmysql/CMakeLists.txt2
-rw-r--r--libmysql/libmysql.c14
-rw-r--r--libservices/HOWTO2
-rw-r--r--mysql-test/disabled.def1
-rw-r--r--mysql-test/extra/binlog_tests/database.test2
-rw-r--r--mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test2
-rw-r--r--mysql-test/extra/binlog_tests/mysqlbinlog_row_engine.inc1
-rw-r--r--mysql-test/extra/rpl_tests/rpl_ddl.test4
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_img.test241
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_img_blobs.test179
-rw-r--r--mysql-test/include/binlog_start_pos.inc10
-rw-r--r--mysql-test/include/check-warnings.test4
-rw-r--r--mysql-test/include/concurrent.inc2
-rw-r--r--mysql-test/include/ctype_innodb_like.inc7
-rw-r--r--mysql-test/include/ctype_like_cond_propagation.inc16
-rw-r--r--mysql-test/include/ctype_utf8_ilseq.inc18
-rw-r--r--mysql-test/include/ctype_utf8mb4.inc37
-rw-r--r--mysql-test/include/default_mysqld.cnf1
-rw-r--r--mysql-test/include/equal_fields_propagation_datetime.inc64
-rw-r--r--mysql-test/include/explain_non_select.inc2
-rw-r--r--mysql-test/include/grant_cache.inc8
-rw-r--r--mysql-test/include/have_ipv6.inc20
-rw-r--r--mysql-test/include/icp_tests.inc14
-rw-r--r--mysql-test/include/no_protocol.inc (renamed from mysql-test/suite/perfschema/include/no_protocol.inc)2
-rw-r--r--mysql-test/include/query_cache.inc4
-rw-r--r--mysql-test/include/query_cache_partitions.inc3
-rw-r--r--mysql-test/include/query_cache_sql_prepare.inc3
-rw-r--r--mysql-test/include/rpl_row_img_general_loop.inc42
-rw-r--r--mysql-test/include/rpl_row_img_set.inc55
-rw-r--r--mysql-test/include/show_binlog_events2.inc2
-rw-r--r--mysql-test/include/show_events.inc16
-rw-r--r--mysql-test/include/show_relaylog_events.inc3
-rw-r--r--mysql-test/include/sync_with_master_gtid.inc4
-rw-r--r--mysql-test/include/type_temporal_zero_default.inc75
-rw-r--r--mysql-test/include/wait_until_ready.inc34
-rw-r--r--mysql-test/lib/My/SafeProcess/safe_process.cc22
-rwxr-xr-xmysql-test/mysql-test-run.pl45
-rw-r--r--mysql-test/r/alter_table.result24
-rw-r--r--mysql-test/r/analyze_format_json.result4
-rw-r--r--mysql-test/r/analyze_stmt_orderby.result267
-rw-r--r--mysql-test/r/analyze_stmt_privileges.result1
-rw-r--r--mysql-test/r/analyze_stmt_privileges2.result3
-rw-r--r--mysql-test/r/bigint.result8
-rw-r--r--mysql-test/r/blackhole_plugin.result4
-rw-r--r--mysql-test/r/bug13633383.result61
-rw-r--r--mysql-test/r/cache_innodb.result3
-rw-r--r--mysql-test/r/case.result171
-rw-r--r--mysql-test/r/cast.result38
-rw-r--r--mysql-test/r/change_user.result9
-rw-r--r--mysql-test/r/compare.result2
-rw-r--r--mysql-test/r/compound.result2
-rw-r--r--mysql-test/r/concurrent_innodb_safelog.result2
-rw-r--r--mysql-test/r/concurrent_innodb_unsafelog.result2
-rw-r--r--mysql-test/r/connect.result3
-rw-r--r--mysql-test/r/create-big.result12
-rw-r--r--mysql-test/r/create.result30
-rw-r--r--mysql-test/r/create_drop_binlog.result20
-rw-r--r--mysql-test/r/create_drop_function.result2
-rw-r--r--mysql-test/r/create_drop_role.result8
-rw-r--r--mysql-test/r/create_drop_user.result6
-rw-r--r--mysql-test/r/create_or_replace.result4
-rw-r--r--mysql-test/r/create_or_replace_permission.result3
-rw-r--r--mysql-test/r/ctype_big5.result302
-rw-r--r--mysql-test/r/ctype_binary.result373
-rw-r--r--mysql-test/r/ctype_collate.result2
-rw-r--r--mysql-test/r/ctype_cp1250_ch.result124
-rw-r--r--mysql-test/r/ctype_cp1251.result305
-rw-r--r--mysql-test/r/ctype_cp932_binlog_stm.result404
-rw-r--r--mysql-test/r/ctype_eucjpms.result472
-rw-r--r--mysql-test/r/ctype_euckr.result290
-rw-r--r--mysql-test/r/ctype_gb2312.result290
-rw-r--r--mysql-test/r/ctype_gbk.result302
-rw-r--r--mysql-test/r/ctype_latin1.result531
-rw-r--r--mysql-test/r/ctype_latin1_de.result8
-rw-r--r--mysql-test/r/ctype_latin2.result10
-rw-r--r--mysql-test/r/ctype_latin2_ch.result125
-rw-r--r--mysql-test/r/ctype_many.result22
-rw-r--r--mysql-test/r/ctype_mb.result8
-rw-r--r--mysql-test/r/ctype_sjis.result434
-rw-r--r--mysql-test/r/ctype_tis620.result248
-rw-r--r--mysql-test/r/ctype_uca.result201
-rw-r--r--mysql-test/r/ctype_uca_innodb.result38
-rw-r--r--mysql-test/r/ctype_ucs.result360
-rw-r--r--mysql-test/r/ctype_ujis.result474
-rw-r--r--mysql-test/r/ctype_utf16.result85
-rw-r--r--mysql-test/r/ctype_utf16_uca.result16
-rw-r--r--mysql-test/r/ctype_utf16le.result85
-rw-r--r--mysql-test/r/ctype_utf32.result42
-rw-r--r--mysql-test/r/ctype_utf32_uca.result16
-rw-r--r--mysql-test/r/ctype_utf8.result518
-rw-r--r--mysql-test/r/ctype_utf8mb4.result20
-rw-r--r--mysql-test/r/ctype_utf8mb4_heap.result73
-rw-r--r--mysql-test/r/ctype_utf8mb4_innodb.result73
-rw-r--r--mysql-test/r/ctype_utf8mb4_myisam.result73
-rw-r--r--mysql-test/r/ctype_utf8mb4_uca.result2
-rw-r--r--mysql-test/r/ddl_i18n_koi8r.result1
-rw-r--r--mysql-test/r/ddl_i18n_utf8.result1
-rw-r--r--mysql-test/r/default.result2
-rw-r--r--mysql-test/r/delete_returning_grant.result3
-rw-r--r--mysql-test/r/derived.result72
-rw-r--r--mysql-test/r/derived_view.result10
-rw-r--r--mysql-test/r/distinct.result2
-rw-r--r--mysql-test/r/dyncol.result6
-rw-r--r--mysql-test/r/empty_server_name-8224.result2
-rw-r--r--mysql-test/r/enforce_storage_engine.result54
-rw-r--r--mysql-test/r/enforce_storage_engine_opt.result1
-rw-r--r--mysql-test/r/events_1.result1
-rw-r--r--mysql-test/r/events_2.result1
-rw-r--r--mysql-test/r/events_bugs.result1
-rw-r--r--mysql-test/r/events_trans.result1
-rw-r--r--mysql-test/r/events_trans_notembedded.result1
-rw-r--r--mysql-test/r/explain_json.result90
-rw-r--r--mysql-test/r/features.result1
-rw-r--r--mysql-test/r/fix_priv_tables.result1
-rw-r--r--mysql-test/r/flush-innodb-notembedded.result1
-rw-r--r--mysql-test/r/flush2.result22
-rw-r--r--mysql-test/r/flush_read_lock.result3
-rw-r--r--mysql-test/r/func_compress.result5
-rw-r--r--mysql-test/r/func_encrypt.result18
-rw-r--r--mysql-test/r/func_gconcat.result16
-rw-r--r--mysql-test/r/func_group.result2
-rw-r--r--mysql-test/r/func_in.result24
-rw-r--r--mysql-test/r/func_like.result25
-rw-r--r--mysql-test/r/func_math.result9
-rw-r--r--mysql-test/r/func_misc.result22
-rw-r--r--mysql-test/r/func_regexp_pcre.result35
-rw-r--r--mysql-test/r/func_regexp_pcre_debug.result10
-rw-r--r--mysql-test/r/func_str.result220
-rw-r--r--mysql-test/r/func_system.result6
-rw-r--r--mysql-test/r/func_test.result42
-rw-r--r--mysql-test/r/func_time.result49
-rw-r--r--mysql-test/r/func_time_hires.result16
-rw-r--r--mysql-test/r/func_weight_string.result50
-rw-r--r--mysql-test/r/gis-debug.result2
-rw-r--r--mysql-test/r/gis-precise.result17
-rw-r--r--mysql-test/r/gis-rtree.result48
-rw-r--r--mysql-test/r/gis.result28
-rw-r--r--mysql-test/r/grant.result26
-rw-r--r--mysql-test/r/grant2.result3
-rw-r--r--mysql-test/r/grant3.result3
-rw-r--r--mysql-test/r/grant4.result3
-rw-r--r--mysql-test/r/grant_4332.result3
-rw-r--r--mysql-test/r/grant_cache_no_prot.result8
-rw-r--r--mysql-test/r/grant_cache_ps_prot.result8
-rw-r--r--mysql-test/r/grant_explain_non_select.result4
-rw-r--r--mysql-test/r/grant_lowercase.result7
-rw-r--r--mysql-test/r/grant_lowercase_fs.result2
-rw-r--r--mysql-test/r/group_by.result94
-rw-r--r--mysql-test/r/group_min_max.result106
-rw-r--r--mysql-test/r/help.result2
-rw-r--r--mysql-test/r/host_cache_size_functionality.result2
-rw-r--r--mysql-test/r/implicit_commit.result1
-rw-r--r--mysql-test/r/index_intersect.result5
-rw-r--r--mysql-test/r/index_intersect_innodb.result2
-rw-r--r--mysql-test/r/information_schema.result13
-rw-r--r--mysql-test/r/information_schema2.result12
-rw-r--r--mysql-test/r/information_schema_db.result3
-rw-r--r--mysql-test/r/information_schema_linux.result7
-rw-r--r--mysql-test/r/information_schema_routines.result2
-rw-r--r--mysql-test/r/innodb_icp.result14
-rw-r--r--mysql-test/r/innodb_load_xa.result2
-rw-r--r--mysql-test/r/innodb_mrr_cpk.result2
-rw-r--r--mysql-test/r/insert.result32
-rw-r--r--mysql-test/r/insert_notembedded.result4
-rw-r--r--mysql-test/r/join_cache.result65
-rw-r--r--mysql-test/r/key.result10
-rw-r--r--mysql-test/r/kill.result15
-rw-r--r--mysql-test/r/loaddata.result24
-rw-r--r--mysql-test/r/lock_multi.result2
-rw-r--r--mysql-test/r/log_tables.result1
-rw-r--r--mysql-test/r/lowercase_fs_off.result3
-rw-r--r--mysql-test/r/lowercase_table_grant.result1
-rw-r--r--mysql-test/r/lowercase_table_qcache.result5
-rw-r--r--mysql-test/r/max_statement_time.result6
-rw-r--r--mysql-test/r/mdev-504.result2
-rw-r--r--mysql-test/r/merge.result13
-rw-r--r--mysql-test/r/multi_update.result1
-rw-r--r--mysql-test/r/myisam-optimize.result69
-rw-r--r--mysql-test/r/myisam-system.result6
-rw-r--r--mysql-test/r/myisam.result11
-rw-r--r--mysql-test/r/myisam_explain_non_select_all.result5
-rw-r--r--mysql-test/r/myisam_icp.result20
-rw-r--r--mysql-test/r/myisam_recover.result (renamed from mysql-test/r/merge_recover.result)57
-rw-r--r--mysql-test/r/mysql.result3
-rw-r--r--mysql-test/r/mysql_comments.result2
-rw-r--r--mysql-test/r/mysql_tzinfo_to_sql_symlink.result13
-rw-r--r--mysql-test/r/mysql_upgrade.result62
-rw-r--r--mysql-test/r/mysql_upgrade_view.result35
-rw-r--r--mysql-test/r/mysqlbinlog-innodb.result4
-rw-r--r--mysql-test/r/mysqlbinlog.result20
-rw-r--r--mysql-test/r/mysqlbinlog_row_big.result2
-rw-r--r--mysql-test/r/mysqlcheck.result23
-rw-r--r--mysql-test/r/mysqld--help.result65
-rw-r--r--mysql-test/r/mysqldump-max.result10
-rw-r--r--mysql-test/r/mysqldump.result38
-rw-r--r--mysql-test/r/null.result81
-rw-r--r--mysql-test/r/openssl_1.result3
-rw-r--r--mysql-test/r/openssl_6975,tlsv10.result2
-rw-r--r--mysql-test/r/openssl_6975,tlsv12.result2
-rw-r--r--mysql-test/r/order_by.result2
-rw-r--r--mysql-test/r/parser.result7
-rw-r--r--mysql-test/r/partition.result13
-rw-r--r--mysql-test/r/partition_cache.result3
-rw-r--r--mysql-test/r/partition_cache_innodb.result3
-rw-r--r--mysql-test/r/partition_cache_myisam.result3
-rw-r--r--mysql-test/r/partition_datatype.result2
-rw-r--r--mysql-test/r/partition_exchange.result62
-rw-r--r--mysql-test/r/partition_grant.result1
-rw-r--r--mysql-test/r/partition_hash.result2
-rw-r--r--mysql-test/r/partition_innodb.result25
-rw-r--r--mysql-test/r/partition_innodb_plugin.result2
-rw-r--r--mysql-test/r/partition_myisam.result2
-rw-r--r--mysql-test/r/partition_not_blackhole.result2
-rw-r--r--mysql-test/r/plugin.result20
-rw-r--r--mysql-test/r/plugin_auth.result5
-rw-r--r--mysql-test/r/plugin_auth_qa.result1
-rw-r--r--mysql-test/r/plugin_not_embedded.result1
-rw-r--r--mysql-test/r/ps.result52
-rw-r--r--mysql-test/r/ps_1general.result2
-rw-r--r--mysql-test/r/ps_2myisam.result30
-rw-r--r--mysql-test/r/ps_3innodb.result30
-rw-r--r--mysql-test/r/ps_4heap.result30
-rw-r--r--mysql-test/r/ps_5merge.result60
-rw-r--r--mysql-test/r/query_cache.result15
-rw-r--r--mysql-test/r/query_cache_debug.result1
-rw-r--r--mysql-test/r/query_cache_merge.result5
-rw-r--r--mysql-test/r/query_cache_notembedded.result12
-rw-r--r--mysql-test/r/query_cache_ps_no_prot.result3
-rw-r--r--mysql-test/r/query_cache_ps_ps_prot.result3
-rw-r--r--mysql-test/r/query_cache_with_views.result3
-rw-r--r--mysql-test/r/range.result36
-rw-r--r--mysql-test/r/range_innodb.result39
-rw-r--r--mysql-test/r/range_mrr_icp.result36
-rw-r--r--mysql-test/r/read_only.result2
-rw-r--r--mysql-test/r/read_only_innodb.result2
-rw-r--r--mysql-test/r/repair_symlink-5543.result7
-rw-r--r--mysql-test/r/row.result22
-rw-r--r--mysql-test/r/select.result7
-rw-r--r--mysql-test/r/select_jcl6.result7
-rw-r--r--mysql-test/r/select_pkeycache.result7
-rw-r--r--mysql-test/r/selectivity.result18
-rw-r--r--mysql-test/r/selectivity_innodb.result12
-rw-r--r--mysql-test/r/servers.result1
-rw-r--r--mysql-test/r/set_statement.result12
-rw-r--r--mysql-test/r/show_check.result88
-rw-r--r--mysql-test/r/show_explain.result1
-rw-r--r--mysql-test/r/single_delete_update.result32
-rw-r--r--mysql-test/r/single_delete_update_innodb.result32
-rw-r--r--mysql-test/r/skip_grants.result15
-rw-r--r--mysql-test/r/skip_name_resolve.result1
-rw-r--r--mysql-test/r/sp-error.result24
-rw-r--r--mysql-test/r/sp-group.result156
-rw-r--r--mysql-test/r/sp-lock.result2
-rw-r--r--mysql-test/r/sp-security.result23
-rw-r--r--mysql-test/r/sp-ucs2.result12
-rw-r--r--mysql-test/r/sp.result68
-rw-r--r--mysql-test/r/sp_notembedded.result3
-rw-r--r--mysql-test/r/sp_trans.result1
-rw-r--r--mysql-test/r/ssl_7937,nossl.result15
-rw-r--r--mysql-test/r/ssl_7937.result16
-rw-r--r--mysql-test/r/stack-crash.result10
-rw-r--r--mysql-test/r/stat_tables_rbr.result25
-rw-r--r--mysql-test/r/status.result1
-rw-r--r--mysql-test/r/strict.result20
-rw-r--r--mysql-test/r/subselect.result16
-rw-r--r--mysql-test/r/subselect_cache.result225
-rw-r--r--mysql-test/r/subselect_mat.result36
-rw-r--r--mysql-test/r/subselect_no_exists_to_in.result16
-rw-r--r--mysql-test/r/subselect_no_mat.result16
-rw-r--r--mysql-test/r/subselect_no_opts.result16
-rw-r--r--mysql-test/r/subselect_no_scache.result16
-rw-r--r--mysql-test/r/subselect_no_semijoin.result16
-rw-r--r--mysql-test/r/subselect_sj.result5
-rw-r--r--mysql-test/r/subselect_sj2.result56
-rw-r--r--mysql-test/r/subselect_sj2_jcl6.result56
-rw-r--r--mysql-test/r/subselect_sj2_mat.result56
-rw-r--r--mysql-test/r/subselect_sj_jcl6.result5
-rw-r--r--mysql-test/r/subselect_sj_mat.result36
-rw-r--r--mysql-test/r/table_elim.result10
-rw-r--r--mysql-test/r/temp_table.result19
-rw-r--r--mysql-test/r/temporal_literal.result68
-rw-r--r--mysql-test/r/timezone_grant.result2
-rw-r--r--mysql-test/r/trigger-compat.result4
-rw-r--r--mysql-test/r/trigger.result7
-rw-r--r--mysql-test/r/trigger_notembedded.result15
-rw-r--r--mysql-test/r/truncate-stale-6500.result33
-rw-r--r--mysql-test/r/truncate.result2
-rw-r--r--mysql-test/r/type_binary.result34
-rw-r--r--mysql-test/r/type_blob.result8
-rw-r--r--mysql-test/r/type_date.result323
-rw-r--r--mysql-test/r/type_datetime.result262
-rw-r--r--mysql-test/r/type_decimal.result30
-rw-r--r--mysql-test/r/type_enum.result52
-rw-r--r--mysql-test/r/type_float.result116
-rw-r--r--mysql-test/r/type_int.result38
-rw-r--r--mysql-test/r/type_newdecimal.result140
-rw-r--r--mysql-test/r/type_num.result1222
-rw-r--r--mysql-test/r/type_ranges.result19
-rw-r--r--mysql-test/r/type_set.result52
-rw-r--r--mysql-test/r/type_time.result762
-rw-r--r--mysql-test/r/type_time_hires.result4
-rw-r--r--mysql-test/r/type_timestamp.result193
-rw-r--r--mysql-test/r/type_timestamp_hires.result6
-rw-r--r--mysql-test/r/type_varchar.result2
-rw-r--r--mysql-test/r/type_year.result44
-rw-r--r--mysql-test/r/union.result2
-rw-r--r--mysql-test/r/update_innodb.result31
-rw-r--r--mysql-test/r/user_limits.result5
-rw-r--r--mysql-test/r/user_var-binlog.result2
-rw-r--r--mysql-test/r/varbinary.result2
-rw-r--r--mysql-test/r/variables-notembedded.result43
-rw-r--r--mysql-test/r/variables.result10
-rw-r--r--mysql-test/r/view.result153
-rw-r--r--mysql-test/r/view_grant.result34
-rw-r--r--mysql-test/r/warnings_engine_disabled.result2
-rw-r--r--mysql-test/r/xml.result2
-rw-r--r--mysql-test/std_data/galera-cert.pem20
-rw-r--r--mysql-test/std_data/galera-key.pem28
-rw-r--r--mysql-test/std_data/old_decimal/t1dec102.MYD1
-rw-r--r--mysql-test/std_data/old_decimal/t1dec102.MYIbin0 -> 1024 bytes
-rw-r--r--mysql-test/std_data/old_decimal/t1dec102.frmbin0 -> 8554 bytes
-rwxr-xr-xmysql-test/std_data/wsrep_notify.sh99
-rw-r--r--mysql-test/suite/archive/archive_gis.result6
-rw-r--r--mysql-test/suite/archive/archive_plugin.result7
-rw-r--r--mysql-test/suite/archive/archive_plugin.test4
-rw-r--r--mysql-test/suite/archive/discover_5438.result1
-rw-r--r--mysql-test/suite/archive/discover_5438.test1
-rw-r--r--mysql-test/suite/binlog/r/binlog_grant.result1
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result1
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result70
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result10
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result10
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_ctype_cp932.result24
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result4
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result24
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result4
-rw-r--r--mysql-test/suite/binlog/r/binlog_variables_log_bin.result9
-rw-r--r--mysql-test/suite/binlog/r/binlog_variables_log_bin_index.result9
-rw-r--r--mysql-test/suite/binlog/r/binlog_variables_relay_log.result15
-rw-r--r--mysql-test/suite/binlog/r/binlog_variables_relay_log_index.result15
-rw-r--r--mysql-test/suite/binlog/t/binlog_grant.test1
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test1
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test13
-rw-r--r--mysql-test/suite/binlog/t/binlog_row_annotate.test2
-rw-r--r--mysql-test/suite/binlog/t/binlog_variables_log_bin-master.opt1
-rw-r--r--mysql-test/suite/binlog/t/binlog_variables_log_bin.test4
-rw-r--r--mysql-test/suite/binlog/t/binlog_variables_log_bin_index-master.opt2
-rw-r--r--mysql-test/suite/binlog/t/binlog_variables_log_bin_index.test4
-rw-r--r--mysql-test/suite/binlog/t/binlog_variables_relay_log-master.opt1
-rw-r--r--mysql-test/suite/binlog/t/binlog_variables_relay_log.test4
-rw-r--r--mysql-test/suite/binlog/t/binlog_variables_relay_log_index-master.opt2
-rw-r--r--mysql-test/suite/binlog/t/binlog_variables_relay_log_index.test4
-rw-r--r--mysql-test/suite/encryption/disabled.def2
-rw-r--r--mysql-test/suite/encryption/include/have_file_key_management_plugin.inc4
-rw-r--r--mysql-test/suite/encryption/r/create_or_replace.result (renamed from mysql-test/suite/encryption/r/encryption_create_or_replace.result)4
-rw-r--r--mysql-test/suite/encryption/r/innodb-bad-key-change.result137
-rw-r--r--mysql-test/suite/encryption/r/innodb-bad-key-change2.result26
-rw-r--r--mysql-test/suite/encryption/r/innodb-bad-key-change3.result44
-rw-r--r--mysql-test/suite/encryption/r/innodb-bad-key-change4.result20
-rw-r--r--mysql-test/suite/encryption/r/innodb-bad-key-change5.result28
-rw-r--r--mysql-test/suite/encryption/r/innodb-page_encryption.result27
-rw-r--r--mysql-test/suite/encryption/r/innodb-page_encryption_compression.result28
-rw-r--r--mysql-test/suite/encryption/r/innodb-page_encryption_log_encryption.result22
-rw-r--r--mysql-test/suite/encryption/r/innodb_encryption-page-compression.result26
-rw-r--r--mysql-test/suite/encryption/r/innodb_encryption_discard_import.result136
-rw-r--r--mysql-test/suite/encryption/r/innodb_encryption_tables.result16
-rw-r--r--mysql-test/suite/encryption/r/innodb_onlinealter_encryption.result176
-rw-r--r--mysql-test/suite/encryption/r/innodb_page_encryption_key_change.result26
-rw-r--r--mysql-test/suite/encryption/t/create_or_replace.opt1
-rw-r--r--mysql-test/suite/encryption/t/create_or_replace.test (renamed from mysql-test/suite/encryption/t/encryption_create_or_replace.test)33
-rw-r--r--mysql-test/suite/encryption/t/encryption_create_or_replace.opt3
-rw-r--r--mysql-test/suite/encryption/t/filekeys_plugin.inc2
-rw-r--r--mysql-test/suite/encryption/t/filekeys_plugin_exists.inc4
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change.test121
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change2.test59
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change3.test114
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change4.test89
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change5.opt4
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change5.test88
-rw-r--r--mysql-test/suite/encryption/t/innodb-page_encryption.test18
-rw-r--r--mysql-test/suite/encryption/t/innodb-page_encryption_compression.test26
-rw-r--r--mysql-test/suite/encryption/t/innodb-page_encryption_log_encryption.test17
-rw-r--r--mysql-test/suite/encryption/t/innodb_encryption-page-compression.test30
-rw-r--r--mysql-test/suite/encryption/t/innodb_encryption_discard_import.opt8
-rw-r--r--mysql-test/suite/encryption/t/innodb_encryption_discard_import.test211
-rw-r--r--mysql-test/suite/encryption/t/innodb_encryption_tables.test16
-rw-r--r--mysql-test/suite/encryption/t/innodb_first_page.test2
-rw-r--r--mysql-test/suite/encryption/t/innodb_onlinealter_encryption.opt8
-rw-r--r--mysql-test/suite/encryption/t/innodb_onlinealter_encryption.test191
-rw-r--r--mysql-test/suite/encryption/t/innodb_page_encryption_key_change.test21
-rw-r--r--mysql-test/suite/federated/federated_bug_35333.result2
-rw-r--r--mysql-test/suite/federated/federatedx.result7
-rw-r--r--mysql-test/suite/federated/federatedx.test2
-rw-r--r--mysql-test/suite/funcs_1/datadict/datadict_priv.inc4
-rw-r--r--mysql-test/suite/funcs_1/datadict/is_routines.inc1
-rw-r--r--mysql-test/suite/funcs_1/datadict/is_triggers.inc2
-rw-r--r--mysql-test/suite/funcs_1/datadict/processlist_priv.inc31
-rw-r--r--mysql-test/suite/funcs_1/datadict/processlist_val.inc14
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_func_view.result76
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_storedproc_06.result3
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_storedproc_08.result1
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_03.result1
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_03e.result4
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_0407.result3
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_08.result3
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_views.result2
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns.result12
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_is.result30
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_is_embedded.result28
-rw-r--r--mysql-test/suite/funcs_1/r/is_routines.result1
-rw-r--r--mysql-test/suite/funcs_1/r/is_triggers.result2
-rw-r--r--mysql-test/suite/funcs_1/r/memory_func_view.result76
-rw-r--r--mysql-test/suite/funcs_1/r/memory_storedproc_06.result2
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_03e.result4
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_0407.result2
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_08.result2
-rw-r--r--mysql-test/suite/funcs_1/r/memory_views.result2
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_func_view.result76
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_storedproc_06.result2
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_03e.result4
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_0407.result2
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_08.result2
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_views-big.result2
-rw-r--r--mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result151
-rw-r--r--mysql-test/suite/funcs_1/r/processlist_priv_ps.result1
-rw-r--r--mysql-test/suite/funcs_1/r/processlist_val_no_prot.result47
-rw-r--r--mysql-test/suite/funcs_1/r/storedproc.result3
-rw-r--r--mysql-test/suite/funcs_1/storedproc/storedproc_06.inc3
-rw-r--r--mysql-test/suite/funcs_1/t/innodb_storedproc_06.test1
-rw-r--r--mysql-test/suite/funcs_1/t/innodb_storedproc_08.test1
-rw-r--r--mysql-test/suite/funcs_1/t/innodb_trig_03.test1
-rw-r--r--mysql-test/suite/funcs_1/t/innodb_trig_0407.test1
-rw-r--r--mysql-test/suite/funcs_1/t/innodb_trig_08.test1
-rw-r--r--mysql-test/suite/funcs_1/t/processlist_priv_no_prot.test6
-rw-r--r--mysql-test/suite/funcs_1/t/processlist_val_no_prot.test6
-rw-r--r--mysql-test/suite/funcs_1/t/storedproc.test1
-rw-r--r--mysql-test/suite/funcs_1/triggers/triggers_0407.inc4
-rw-r--r--mysql-test/suite/funcs_1/triggers/triggers_08.inc2
-rw-r--r--mysql-test/suite/funcs_1/views/func_view.inc2
-rw-r--r--mysql-test/suite/funcs_1/views/views_master.inc2
-rw-r--r--mysql-test/suite/galera/disabled.def21
-rw-r--r--mysql-test/suite/galera/galera_2nodes.cnf12
-rw-r--r--mysql-test/suite/galera/galera_2nodes_as_master.cnf70
-rw-r--r--mysql-test/suite/galera/galera_2nodes_as_slave.cnf69
-rw-r--r--mysql-test/suite/galera/galera_4nodes.cnf74
-rw-r--r--mysql-test/suite/galera/include/galera_have_debug_sync.inc9
-rw-r--r--mysql-test/suite/galera/include/galera_load_provider.inc10
-rw-r--r--mysql-test/suite/galera/include/galera_reset_cluster_address.inc12
-rw-r--r--mysql-test/suite/galera/include/galera_resume.inc9
-rw-r--r--mysql-test/suite/galera/include/galera_sst_restore.inc29
-rw-r--r--mysql-test/suite/galera/include/galera_sst_set_mysqldump.inc22
-rw-r--r--mysql-test/suite/galera/include/galera_st_clean_slave.inc113
-rw-r--r--mysql-test/suite/galera/include/galera_st_disconnect_slave.inc105
-rw-r--r--mysql-test/suite/galera/include/galera_st_kill_slave.inc108
-rw-r--r--mysql-test/suite/galera/include/galera_st_kill_slave_ddl.inc123
-rw-r--r--mysql-test/suite/galera/include/galera_st_shutdown_slave.inc105
-rw-r--r--mysql-test/suite/galera/include/galera_unload_provider.inc7
-rw-r--r--mysql-test/suite/galera/include/galera_wsrep_recover.inc23
-rw-r--r--mysql-test/suite/galera/include/kill_galera.inc20
-rw-r--r--mysql-test/suite/galera/include/shutdown_mysqld.inc18
-rw-r--r--mysql-test/suite/galera/include/start_mysqld.inc22
-rw-r--r--mysql-test/suite/galera/r/binlog_checksum.result36
-rw-r--r--mysql-test/suite/galera/r/create.result38
-rw-r--r--mysql-test/suite/galera/r/galera_account_management.result40
-rw-r--r--mysql-test/suite/galera/r/galera_alter_engine_innodb.result10
-rw-r--r--mysql-test/suite/galera/r/galera_alter_engine_myisam.result11
-rw-r--r--mysql-test/suite/galera/r/galera_alter_table_force.result10
-rw-r--r--mysql-test/suite/galera/r/galera_as_master.result48
-rw-r--r--mysql-test/suite/galera/r/galera_as_master_gtid.result59
-rw-r--r--mysql-test/suite/galera/r/galera_as_master_gtid_change_master.result15
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave.result14
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave_gtid.result16
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort.result10
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_for_update.result10
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_ftwrl.result8
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_get_lock.result12
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_lock_table.result8
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_sleep.result9
-rw-r--r--mysql-test/suite/galera/r/galera_binlog_cache_size.result12
-rw-r--r--mysql-test/suite/galera/r/galera_binlog_checksum.result10
-rw-r--r--mysql-test/suite/galera/r/galera_binlog_event_max_size_max.result9
-rw-r--r--mysql-test/suite/galera/r/galera_binlog_event_max_size_min.result6
-rw-r--r--mysql-test/suite/galera/r/galera_binlog_row_image.result79
-rw-r--r--mysql-test/suite/galera/r/galera_binlog_rows_query_log_events.result12
-rw-r--r--mysql-test/suite/galera/r/galera_concurrent_ctas.result1
-rw-r--r--mysql-test/suite/galera/r/galera_create_function.result55
-rw-r--r--mysql-test/suite/galera/r/galera_create_procedure.result53
-rw-r--r--mysql-test/suite/galera/r/galera_create_table_like.result47
-rw-r--r--mysql-test/suite/galera/r/galera_create_trigger.result42
-rw-r--r--mysql-test/suite/galera/r/galera_defaults.result120
-rw-r--r--mysql-test/suite/galera/r/galera_delete_limit.result19
-rw-r--r--mysql-test/suite/galera/r/galera_enum.result37
-rw-r--r--mysql-test/suite/galera/r/galera_events.result18
-rw-r--r--mysql-test/suite/galera/r/galera_fk_multicolumn.result6
-rw-r--r--mysql-test/suite/galera/r/galera_fk_multitable.result4
-rw-r--r--mysql-test/suite/galera/r/galera_flush.result32
-rw-r--r--mysql-test/suite/galera/r/galera_ftwrl.result16
-rw-r--r--mysql-test/suite/galera/r/galera_fulltext.result26
-rw-r--r--mysql-test/suite/galera/r/galera_gcs_fc_limit.result17
-rw-r--r--mysql-test/suite/galera/r/galera_gcs_max_packet_size.result15
-rw-r--r--mysql-test/suite/galera/r/galera_gtid.result12
-rw-r--r--mysql-test/suite/galera/r/galera_insert_ignore.result52
-rw-r--r--mysql-test/suite/galera/r/galera_insert_multi.result58
-rw-r--r--mysql-test/suite/galera/r/galera_ist_innodb_flush_logs.result184
-rw-r--r--mysql-test/suite/galera/r/galera_ist_mysqldump.result284
-rw-r--r--mysql-test/suite/galera/r/galera_ist_restart_joiner.result43
-rw-r--r--mysql-test/suite/galera/r/galera_ist_rsync.result358
-rw-r--r--mysql-test/suite/galera/r/galera_ist_xtrabackup-v2.result357
-rw-r--r--mysql-test/suite/galera/r/galera_kill_ddl.result11
-rw-r--r--mysql-test/suite/galera/r/galera_kill_largechanges.result14
-rw-r--r--mysql-test/suite/galera/r/galera_kill_nochanges.result10
-rw-r--r--mysql-test/suite/galera/r/galera_kill_smallchanges.result11
-rw-r--r--mysql-test/suite/galera/r/galera_lock_table.result21
-rw-r--r--mysql-test/suite/galera/r/galera_log_bin.result58
-rw-r--r--mysql-test/suite/galera/r/galera_log_output_csv.result21
-rw-r--r--mysql-test/suite/galera/r/galera_many_columns.result1018
-rw-r--r--mysql-test/suite/galera/r/galera_many_rows.result2
-rw-r--r--mysql-test/suite/galera/r/galera_many_tables_nopk.result17
-rw-r--r--mysql-test/suite/galera/r/galera_many_tables_pk.result20
-rw-r--r--mysql-test/suite/galera/r/galera_migrate.result79
-rw-r--r--mysql-test/suite/galera/r/galera_multi_database.result28
-rw-r--r--mysql-test/suite/galera/r/galera_myisam_autocommit.result24
-rw-r--r--mysql-test/suite/galera/r/galera_myisam_transactions.result34
-rw-r--r--mysql-test/suite/galera/r/galera_nopk_unicode.result24
-rw-r--r--mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result33
-rw-r--r--mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result18
-rw-r--r--mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result15
-rw-r--r--mysql-test/suite/galera/r/galera_parallel_simple.result27
-rw-r--r--mysql-test/suite/galera/r/galera_pc_ignore_sb.result12
-rw-r--r--mysql-test/suite/galera/r/galera_pk_bigint_signed.result26
-rw-r--r--mysql-test/suite/galera/r/galera_pk_bigint_unsigned.result23
-rw-r--r--mysql-test/suite/galera/r/galera_query_cache.result57
-rw-r--r--mysql-test/suite/galera/r/galera_read_only.result8
-rw-r--r--mysql-test/suite/galera/r/galera_repl_key_format_flat16.result18
-rw-r--r--mysql-test/suite/galera/r/galera_repl_max_ws_size.result8
-rw-r--r--mysql-test/suite/galera/r/galera_restart_nochanges.result9
-rw-r--r--mysql-test/suite/galera/r/galera_roles.result156
-rw-r--r--mysql-test/suite/galera/r/galera_rsu_add_pk.result26
-rw-r--r--mysql-test/suite/galera/r/galera_rsu_drop_pk.result42
-rw-r--r--mysql-test/suite/galera/r/galera_rsu_error.result21
-rw-r--r--mysql-test/suite/galera/r/galera_rsu_simple.result21
-rw-r--r--mysql-test/suite/galera/r/galera_sbr.result14
-rw-r--r--mysql-test/suite/galera/r/galera_sbr_binlog.result14
-rw-r--r--mysql-test/suite/galera/r/galera_split_brain.result5
-rw-r--r--mysql-test/suite/galera/r/galera_sql_log_bin_zero.result12
-rw-r--r--mysql-test/suite/galera/r/galera_ssl.result18
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mysqldump.result459
-rw-r--r--mysql-test/suite/galera/r/galera_sst_rsync.result359
-rw-r--r--mysql-test/suite/galera/r/galera_sst_xtrabackup-v2.result358
-rw-r--r--mysql-test/suite/galera/r/galera_status_cluster.result12
-rw-r--r--mysql-test/suite/galera/r/galera_status_local_state.result14
-rw-r--r--mysql-test/suite/galera/r/galera_suspend_slave.result10
-rw-r--r--mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result42
-rw-r--r--mysql-test/suite/galera/r/galera_toi_ddl_error.result19
-rw-r--r--mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result31
-rw-r--r--mysql-test/suite/galera/r/galera_toi_ddl_locking.result41
-rw-r--r--mysql-test/suite/galera/r/galera_toi_ddl_nonconflicting.result23
-rw-r--r--mysql-test/suite/galera/r/galera_toi_ddl_sequential.result35
-rw-r--r--mysql-test/suite/galera/r/galera_toi_ftwrl.result12
-rw-r--r--mysql-test/suite/galera/r/galera_toi_lock_exclusive.result17
-rw-r--r--mysql-test/suite/galera/r/galera_toi_lock_shared.result12
-rw-r--r--mysql-test/suite/galera/r/galera_transaction_read_only.result21
-rw-r--r--mysql-test/suite/galera/r/galera_transaction_replay.result30
-rw-r--r--mysql-test/suite/galera/r/galera_truncate.result29
-rw-r--r--mysql-test/suite/galera/r/galera_truncate_temporary.result63
-rw-r--r--mysql-test/suite/galera/r/galera_unicode_identifiers.result20
-rw-r--r--mysql-test/suite/galera/r/galera_unicode_pk.result31
-rw-r--r--mysql-test/suite/galera/r/galera_update_limit.result17
-rw-r--r--mysql-test/suite/galera/r/galera_v1_row_events.result10
-rw-r--r--mysql-test/suite/galera/r/galera_var_OSU_method.result16
-rw-r--r--mysql-test/suite/galera/r/galera_var_OSU_method2.result19
-rw-r--r--mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result6
-rw-r--r--mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result22
-rw-r--r--mysql-test/suite/galera/r/galera_var_certify_nonPK_off.result2
-rw-r--r--mysql-test/suite/galera/r/galera_var_cluster_address.result51
-rw-r--r--mysql-test/suite/galera/r/galera_var_desync_on.result29
-rw-r--r--mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result12
-rw-r--r--mysql-test/suite/galera/r/galera_var_load_data_splitting.result9
-rw-r--r--mysql-test/suite/galera/r/galera_var_max_ws_size.result8
-rw-r--r--mysql-test/suite/galera/r/galera_var_notify_cmd.result10
-rw-r--r--mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result72
-rw-r--r--mysql-test/suite/galera/r/galera_var_slave_threads.result106
-rw-r--r--mysql-test/suite/galera/r/galera_var_wsrep_on_off.result19
-rw-r--r--mysql-test/suite/galera/r/galera_wan.result14
-rw-r--r--mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result33
-rw-r--r--mysql-test/suite/galera/r/galera_wsrep_new_cluster.result36
-rw-r--r--mysql-test/suite/galera/r/galera_wsrep_provider_unset_set.result13
-rw-r--r--mysql-test/suite/galera/r/galera_zero_length_column.result38
-rw-r--r--mysql-test/suite/galera/r/lp1276424.result11
-rw-r--r--mysql-test/suite/galera/r/lp1347768.result17
-rw-r--r--mysql-test/suite/galera/r/lp959512.result24
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#33.result103
-rw-r--r--mysql-test/suite/galera/r/partition.result117
-rw-r--r--mysql-test/suite/galera/r/rename.result39
-rw-r--r--mysql-test/suite/galera/r/rpl_row_annotate.result66
-rw-r--r--mysql-test/suite/galera/r/sql_log_bin.result52
-rw-r--r--mysql-test/suite/galera/r/view.result45
-rw-r--r--mysql-test/suite/galera/suite.pm33
-rw-r--r--mysql-test/suite/galera/t/binlog_checksum.test36
-rw-r--r--mysql-test/suite/galera/t/create.test32
-rw-r--r--mysql-test/suite/galera/t/galera_account_management.test101
-rw-r--r--mysql-test/suite/galera/t/galera_alter_engine_innodb.test17
-rw-r--r--mysql-test/suite/galera/t/galera_alter_engine_myisam.test25
-rw-r--r--mysql-test/suite/galera/t/galera_alter_table_force.test17
-rw-r--r--mysql-test/suite/galera/t/galera_as_master.cnf1
-rw-r--r--mysql-test/suite/galera/t/galera_as_master.test62
-rw-r--r--mysql-test/suite/galera/t/galera_as_master_gtid.cnf8
-rw-r--r--mysql-test/suite/galera/t/galera_as_master_gtid.test70
-rw-r--r--mysql-test/suite/galera/t/galera_as_master_gtid_change_master.cnf8
-rw-r--r--mysql-test/suite/galera/t/galera_as_master_gtid_change_master.test54
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave.cnf1
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave.test47
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave_gtid.cnf6
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave_gtid.test67
-rw-r--r--mysql-test/suite/galera/t/galera_bf_abort.test29
-rw-r--r--mysql-test/suite/galera/t/galera_bf_abort_for_update.test29
-rw-r--r--mysql-test/suite/galera/t/galera_bf_abort_ftwrl.test30
-rw-r--r--mysql-test/suite/galera/t/galera_bf_abort_get_lock.test36
-rw-r--r--mysql-test/suite/galera/t/galera_bf_abort_lock_table.test33
-rw-r--r--mysql-test/suite/galera/t/galera_bf_abort_sleep.test30
-rw-r--r--mysql-test/suite/galera/t/galera_binlog_cache_size.test35
-rw-r--r--mysql-test/suite/galera/t/galera_binlog_checksum-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_binlog_checksum.test22
-rw-r--r--mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_binlog_event_max_size_max.test20
-rw-r--r--mysql-test/suite/galera/t/galera_binlog_event_max_size_min-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_binlog_event_max_size_min.test15
-rw-r--r--mysql-test/suite/galera/t/galera_binlog_row_image.test100
-rw-r--r--mysql-test/suite/galera/t/galera_binlog_rows_query_log_events.test28
-rw-r--r--mysql-test/suite/galera/t/galera_concurrent_ctas.test57
-rw-r--r--mysql-test/suite/galera/t/galera_create_function.test57
-rw-r--r--mysql-test/suite/galera/t/galera_create_procedure.test52
-rw-r--r--mysql-test/suite/galera/t/galera_create_table_like.test50
-rw-r--r--mysql-test/suite/galera/t/galera_create_trigger.test43
-rw-r--r--mysql-test/suite/galera/t/galera_defaults.test70
-rw-r--r--mysql-test/suite/galera/t/galera_delete_limit.test52
-rw-r--r--mysql-test/suite/galera/t/galera_enum.test62
-rw-r--r--mysql-test/suite/galera/t/galera_events.test53
-rw-r--r--mysql-test/suite/galera/t/galera_fk_multicolumn.test6
-rw-r--r--mysql-test/suite/galera/t/galera_fk_multitable.test4
-rw-r--r--mysql-test/suite/galera/t/galera_flush-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_flush.test107
-rw-r--r--mysql-test/suite/galera/t/galera_ftwrl.test39
-rw-r--r--mysql-test/suite/galera/t/galera_fulltext.test62
-rw-r--r--mysql-test/suite/galera/t/galera_gcs_fc_limit.test52
-rw-r--r--mysql-test/suite/galera/t/galera_gcs_max_packet_size.cnf5
-rw-r--r--mysql-test/suite/galera/t/galera_gcs_max_packet_size.test25
-rw-r--r--mysql-test/suite/galera/t/galera_gtid-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_gtid.test27
-rw-r--r--mysql-test/suite/galera/t/galera_insert_ignore.test60
-rw-r--r--mysql-test/suite/galera/t/galera_insert_multi.test122
-rw-r--r--mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.cnf12
-rw-r--r--mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.test12
-rw-r--r--mysql-test/suite/galera/t/galera_ist_mysqldump.cnf11
-rw-r--r--mysql-test/suite/galera/t/galera_ist_mysqldump.test17
-rw-r--r--mysql-test/suite/galera/t/galera_ist_restart_joiner.cnf4
-rw-r--r--mysql-test/suite/galera/t/galera_ist_restart_joiner.test106
-rw-r--r--mysql-test/suite/galera/t/galera_ist_rsync.cnf11
-rw-r--r--mysql-test/suite/galera/t/galera_ist_rsync.test8
-rw-r--r--mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.cnf11
-rw-r--r--mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.test9
-rw-r--r--mysql-test/suite/galera/t/galera_kill_ddl.test39
-rw-r--r--mysql-test/suite/galera/t/galera_kill_largechanges.test43
-rw-r--r--mysql-test/suite/galera/t/galera_kill_nochanges.test24
-rw-r--r--mysql-test/suite/galera/t/galera_kill_smallchanges.test39
-rw-r--r--mysql-test/suite/galera/t/galera_lock_table.test43
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin.test35
-rw-r--r--mysql-test/suite/galera/t/galera_log_output_csv-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_log_output_csv.test27
-rw-r--r--mysql-test/suite/galera/t/galera_many_columns.test16
-rw-r--r--mysql-test/suite/galera/t/galera_many_rows.test2
-rw-r--r--mysql-test/suite/galera/t/galera_many_tables_nopk.test103
-rw-r--r--mysql-test/suite/galera/t/galera_many_tables_pk.test98
-rw-r--r--mysql-test/suite/galera/t/galera_migrate.cnf59
-rw-r--r--mysql-test/suite/galera/t/galera_migrate.test204
-rw-r--r--mysql-test/suite/galera/t/galera_multi_database.test43
-rw-r--r--mysql-test/suite/galera/t/galera_myisam_autocommit.test45
-rw-r--r--mysql-test/suite/galera/t/galera_myisam_transactions.test36
-rw-r--r--mysql-test/suite/galera/t/galera_nopk_unicode.test43
-rw-r--r--mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test51
-rw-r--r--mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test50
-rw-r--r--mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test53
-rw-r--r--mysql-test/suite/galera/t/galera_parallel_simple.test45
-rw-r--r--mysql-test/suite/galera/t/galera_pc_ignore_sb.test49
-rw-r--r--mysql-test/suite/galera/t/galera_pk_bigint_signed.test46
-rw-r--r--mysql-test/suite/galera/t/galera_pk_bigint_unsigned.test45
-rw-r--r--mysql-test/suite/galera/t/galera_query_cache-master.opt3
-rw-r--r--mysql-test/suite/galera/t/galera_query_cache.test67
-rw-r--r--mysql-test/suite/galera/t/galera_read_only.test23
-rw-r--r--mysql-test/suite/galera/t/galera_repl_key_format_flat16.test34
-rw-r--r--mysql-test/suite/galera/t/galera_repl_max_ws_size.test25
-rw-r--r--mysql-test/suite/galera/t/galera_restart_nochanges.test38
-rw-r--r--mysql-test/suite/galera/t/galera_roles.test167
-rw-r--r--mysql-test/suite/galera/t/galera_rsu_add_pk.test43
-rw-r--r--mysql-test/suite/galera/t/galera_rsu_drop_pk.test58
-rw-r--r--mysql-test/suite/galera/t/galera_rsu_error.test31
-rw-r--r--mysql-test/suite/galera/t/galera_rsu_simple.test34
-rw-r--r--mysql-test/suite/galera/t/galera_sbr.test27
-rw-r--r--mysql-test/suite/galera/t/galera_sbr_binlog-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_sbr_binlog.test28
-rw-r--r--mysql-test/suite/galera/t/galera_split_brain.test53
-rw-r--r--mysql-test/suite/galera/t/galera_sql_log_bin_zero.test26
-rw-r--r--mysql-test/suite/galera/t/galera_ssl.cnf7
-rw-r--r--mysql-test/suite/galera/t/galera_ssl.test24
-rw-r--r--mysql-test/suite/galera/t/galera_sst_mysqldump.cnf11
-rw-r--r--mysql-test/suite/galera/t/galera_sst_mysqldump.test18
-rw-r--r--mysql-test/suite/galera/t/galera_sst_rsync.cnf11
-rw-r--r--mysql-test/suite/galera/t/galera_sst_rsync.test9
-rw-r--r--mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.cnf13
-rw-r--r--mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.test9
-rw-r--r--mysql-test/suite/galera/t/galera_status_cluster.test18
-rw-r--r--mysql-test/suite/galera/t/galera_status_local_state.test28
-rw-r--r--mysql-test/suite/galera/t/galera_suspend_slave.test66
-rw-r--r--mysql-test/suite/galera/t/galera_toi_alter_auto_increment.test120
-rw-r--r--mysql-test/suite/galera/t/galera_toi_ddl_error.test29
-rw-r--r--mysql-test/suite/galera/t/galera_toi_ddl_fk_insert.test70
-rw-r--r--mysql-test/suite/galera/t/galera_toi_ddl_locking.test76
-rw-r--r--mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test30
-rw-r--r--mysql-test/suite/galera/t/galera_toi_ddl_sequential.test29
-rw-r--r--mysql-test/suite/galera/t/galera_toi_ftwrl.test22
-rw-r--r--mysql-test/suite/galera/t/galera_toi_lock_exclusive.test38
-rw-r--r--mysql-test/suite/galera/t/galera_toi_lock_shared.test23
-rw-r--r--mysql-test/suite/galera/t/galera_transaction_read_only.test58
-rw-r--r--mysql-test/suite/galera/t/galera_transaction_replay.test63
-rw-r--r--mysql-test/suite/galera/t/galera_truncate.test57
-rw-r--r--mysql-test/suite/galera/t/galera_truncate_temporary.test82
-rw-r--r--mysql-test/suite/galera/t/galera_udf-master.opt2
-rw-r--r--mysql-test/suite/galera/t/galera_unicode_identifiers.test12
-rw-r--r--mysql-test/suite/galera/t/galera_unicode_pk.test64
-rw-r--r--mysql-test/suite/galera/t/galera_update_limit.test55
-rw-r--r--mysql-test/suite/galera/t/galera_v1_row_events-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_v1_row_events.test21
-rw-r--r--mysql-test/suite/galera/t/galera_var_OSU_method.test45
-rw-r--r--mysql-test/suite/galera/t/galera_var_OSU_method2.test47
-rw-r--r--mysql-test/suite/galera/t/galera_var_auto_inc_control_off.test4
-rw-r--r--mysql-test/suite/galera/t/galera_var_auto_inc_control_on.test7
-rw-r--r--mysql-test/suite/galera/t/galera_var_certify_nonPK_off.test2
-rw-r--r--mysql-test/suite/galera/t/galera_var_cluster_address.test110
-rw-r--r--mysql-test/suite/galera/t/galera_var_desync_on.test58
-rw-r--r--mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test33
-rw-r--r--mysql-test/suite/galera/t/galera_var_load_data_splitting.test38
-rw-r--r--mysql-test/suite/galera/t/galera_var_max_ws_size.test23
-rw-r--r--mysql-test/suite/galera/t/galera_var_notify_cmd-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_var_notify_cmd.test14
-rw-r--r--mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test120
-rw-r--r--mysql-test/suite/galera/t/galera_var_slave_threads.test70
-rw-r--r--mysql-test/suite/galera/t/galera_var_wsrep_on_off.test32
-rw-r--r--mysql-test/suite/galera/t/galera_wan.cnf14
-rw-r--r--mysql-test/suite/galera/t/galera_wan.test30
-rw-r--r--mysql-test/suite/galera/t/galera_wsrep_desync_wsrep_on.test57
-rw-r--r--mysql-test/suite/galera/t/galera_wsrep_new_cluster-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_wsrep_new_cluster.test24
-rw-r--r--mysql-test/suite/galera/t/galera_wsrep_provider_unset_set.test41
-rw-r--r--mysql-test/suite/galera/t/galera_zero_length_column.test41
-rw-r--r--mysql-test/suite/galera/t/lp1276424.test17
-rw-r--r--mysql-test/suite/galera/t/lp1347768.test24
-rw-r--r--mysql-test/suite/galera/t/lp959512.test26
-rw-r--r--mysql-test/suite/galera/t/mysql-wsrep#33.cnf8
-rw-r--r--mysql-test/suite/galera/t/mysql-wsrep#33.test18
-rw-r--r--mysql-test/suite/galera/t/partition.test176
-rw-r--r--mysql-test/suite/galera/t/rename.test53
-rw-r--r--mysql-test/suite/galera/t/rpl_row_annotate.cnf6
-rw-r--r--mysql-test/suite/galera/t/rpl_row_annotate.test42
-rw-r--r--mysql-test/suite/galera/t/sql_log_bin.test44
-rw-r--r--mysql-test/suite/galera/t/view.test39
-rw-r--r--mysql-test/suite/galera_3nodes/disabled.def2
-rw-r--r--mysql-test/suite/galera_3nodes/galera_3nodes.cnf60
-rw-r--r--mysql-test/suite/galera_3nodes/include/galera_suspend.inc14
-rw-r--r--mysql-test/suite/galera_3nodes/my.cnf1
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_certification_ccc.result17
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_certification_double_failure.result12
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result19
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_garbd.result14
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_ist_gcache_rollover.result46
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result13
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_pc_weight.result118
-rw-r--r--mysql-test/suite/galera_3nodes/suite.pm52
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_certification_ccc.test60
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_certification_double_failure.test33
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test67
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_garbd.test50
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.cnf11
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test98
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test38
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_pc_weight.test110
-rw-r--r--mysql-test/suite/innodb/r/add_constraint.result13
-rw-r--r--mysql-test/suite/innodb/r/binlog_consistent.result75
-rw-r--r--mysql-test/suite/innodb/r/group_commit_binlog_pos.result2
-rw-r--r--mysql-test/suite/innodb/r/group_commit_binlog_pos_no_optimize_thread.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb-16k.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter-table.result45
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter-timestamp.result29
-rw-r--r--mysql-test/suite/innodb/r/innodb-autoinc.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb-fk-warnings.result112
-rw-r--r--mysql-test/suite/innodb/r/innodb-fk.result3
-rw-r--r--mysql-test/suite/innodb/r/innodb-flush-changed-page-bitmaps.result4
-rw-r--r--mysql-test/suite/innodb/r/innodb-index.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_blob_unrecoverable_crash.result23
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug14147491.result11
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug21704.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb_defrag_binlog.result34
-rw-r--r--mysql-test/suite/innodb/r/innodb_force_pk.result12
-rw-r--r--mysql-test/suite/innodb/r/innodb_gis.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb_monitor.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_mysql.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_simulate_comp_failures.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_uninstall.result26
-rw-r--r--mysql-test/suite/innodb/r/xa_recovery.result17
-rw-r--r--mysql-test/suite/innodb/t/add_constraint.test21
-rw-r--r--mysql-test/suite/innodb/t/binlog_consistent.test17
-rw-r--r--mysql-test/suite/innodb/t/foreign-keys.test5
-rw-r--r--mysql-test/suite/innodb/t/group_commit_binlog_pos.test3
-rw-r--r--mysql-test/suite/innodb/t/group_commit_binlog_pos_no_optimize_thread.test4
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter-table.test59
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter-timestamp.test27
-rw-r--r--mysql-test/suite/innodb/t/innodb-autoinc.test7
-rw-r--r--mysql-test/suite/innodb/t/innodb-fk-warnings.test145
-rw-r--r--mysql-test/suite/innodb/t/innodb-flush-changed-page-bitmaps.opt2
-rw-r--r--mysql-test/suite/innodb/t/innodb-flush-changed-page-bitmaps.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb_blob_unrecoverable_crash.test55
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug14147491.test13
-rw-r--r--mysql-test/suite/innodb/t/innodb_defrag_binlog.test3
-rw-r--r--mysql-test/suite/innodb/t/innodb_force_pk.test11
-rw-r--r--mysql-test/suite/innodb/t/innodb_simulate_comp_failures.test4
-rw-r--r--mysql-test/suite/innodb/t/innodb_uninstall.opt3
-rw-r--r--mysql-test/suite/innodb/t/innodb_uninstall.test58
-rw-r--r--mysql-test/suite/innodb/t/insert_debug.test5
-rw-r--r--mysql-test/suite/innodb/t/sp_temp_table.test5
-rw-r--r--mysql-test/suite/innodb/t/strict_mode.test5
-rw-r--r--mysql-test/suite/innodb/t/xa_recovery.test47
-rw-r--r--mysql-test/suite/innodb_zip/r/innodb_prefix_index_liftedlimit.result2
-rw-r--r--mysql-test/suite/jp/r/jp_alter_sjis.result72
-rw-r--r--mysql-test/suite/jp/r/jp_alter_ucs2.result72
-rw-r--r--mysql-test/suite/jp/r/jp_alter_ujis.result72
-rw-r--r--mysql-test/suite/jp/r/jp_alter_utf8.result72
-rw-r--r--mysql-test/suite/jp/r/jp_convert_ucs2.result42
-rw-r--r--mysql-test/suite/jp/r/jp_convert_ujis.result186
-rw-r--r--mysql-test/suite/jp/r/jp_convert_utf8.result204
-rw-r--r--mysql-test/suite/maria/icp.result20
-rw-r--r--mysql-test/suite/maria/maria2.result10
-rw-r--r--mysql-test/suite/maria/optimize.result11
-rw-r--r--mysql-test/suite/maria/optimize.test10
-rw-r--r--mysql-test/suite/maria/ps_maria.result30
-rw-r--r--mysql-test/suite/multi_source/gtid_ignore_duplicates.cnf4
-rw-r--r--mysql-test/suite/multi_source/gtid_ignore_duplicates.result172
-rw-r--r--mysql-test/suite/multi_source/gtid_ignore_duplicates.test142
-rw-r--r--mysql-test/suite/multi_source/info_logs.result8
-rw-r--r--mysql-test/suite/multi_source/info_logs.test13
-rw-r--r--mysql-test/suite/multi_source/multisource.result78
-rw-r--r--mysql-test/suite/multi_source/multisource.test21
-rw-r--r--mysql-test/suite/multi_source/my.cnf1
-rw-r--r--mysql-test/suite/multi_source/relaylog_events.result26
-rw-r--r--mysql-test/suite/multi_source/relaylog_events.test9
-rw-r--r--mysql-test/suite/multi_source/reset_slave.result4
-rw-r--r--mysql-test/suite/multi_source/reset_slave.test8
-rw-r--r--mysql-test/suite/multi_source/simple.result20
-rw-r--r--mysql-test/suite/multi_source/simple.test15
-rw-r--r--mysql-test/suite/ndb/r/ndb_restore_discover.result33
-rw-r--r--mysql-test/suite/ndb/t/ndb_restore_discover.test70
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result6
-rw-r--r--mysql-test/suite/parts/inc/partition.pre4
-rw-r--r--mysql-test/suite/parts/inc/partition_auto_increment.inc3
-rw-r--r--mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result296
-rw-r--r--mysql-test/suite/parts/r/partition_alter1_1_2_myisam.result136
-rw-r--r--mysql-test/suite/parts/r/partition_alter1_1_innodb.result264
-rw-r--r--mysql-test/suite/parts/r/partition_alter1_1_myisam.result168
-rw-r--r--mysql-test/suite/parts/r/partition_alter1_2_innodb.result456
-rw-r--r--mysql-test/suite/parts/r/partition_alter1_2_myisam.result264
-rw-r--r--mysql-test/suite/parts/r/partition_alter2_1_1_innodb.result280
-rw-r--r--mysql-test/suite/parts/r/partition_alter2_1_2_innodb.result280
-rw-r--r--mysql-test/suite/parts/r/partition_alter2_1_maria.result248
-rw-r--r--mysql-test/suite/parts/r/partition_alter2_1_myisam.result248
-rw-r--r--mysql-test/suite/parts/r/partition_alter2_2_1_innodb.result280
-rw-r--r--mysql-test/suite/parts/r/partition_alter2_2_2_innodb.result280
-rw-r--r--mysql-test/suite/parts/r/partition_alter2_2_maria.result248
-rw-r--r--mysql-test/suite/parts/r/partition_alter2_2_myisam.result248
-rw-r--r--mysql-test/suite/parts/r/partition_alter3_innodb.result64
-rw-r--r--mysql-test/suite/parts/r/partition_alter3_myisam.result64
-rw-r--r--mysql-test/suite/parts/r/partition_alter4_innodb.result1608
-rw-r--r--mysql-test/suite/parts/r/partition_alter4_myisam.result1608
-rw-r--r--mysql-test/suite/parts/r/partition_basic_innodb.result392
-rw-r--r--mysql-test/suite/parts/r/partition_basic_myisam.result264
-rw-r--r--mysql-test/suite/parts/r/partition_basic_symlink_myisam.result320
-rw-r--r--mysql-test/suite/parts/r/partition_bit_innodb.result18
-rw-r--r--mysql-test/suite/parts/r/partition_bit_myisam.result18
-rw-r--r--mysql-test/suite/parts/r/partition_debug_sync_innodb.result11
-rw-r--r--mysql-test/suite/parts/r/partition_engine_innodb.result120
-rw-r--r--mysql-test/suite/parts/r/partition_engine_myisam.result120
-rw-r--r--mysql-test/suite/parts/r/partition_exch_qa_1_innodb.result8
-rw-r--r--mysql-test/suite/parts/r/partition_exch_qa_1_myisam.result8
-rw-r--r--mysql-test/suite/parts/r/partition_exchange_innodb.result16
-rw-r--r--mysql-test/suite/parts/r/partition_exchange_memory.result16
-rw-r--r--mysql-test/suite/parts/r/partition_exchange_myisam.result16
-rw-r--r--mysql-test/suite/parts/r/partition_special_innodb.result2
-rw-r--r--mysql-test/suite/parts/r/partition_special_myisam.result2
-rw-r--r--mysql-test/suite/parts/r/partition_syntax_innodb.result588
-rw-r--r--mysql-test/suite/parts/r/partition_syntax_myisam.result588
-rw-r--r--mysql-test/suite/parts/t/partition_debug_sync_innodb.test5
-rw-r--r--mysql-test/suite/percona/percona_innodb_fake_changes.result2
-rw-r--r--mysql-test/suite/percona/percona_innodb_fake_changes.test2
-rw-r--r--mysql-test/suite/perfschema/include/connection_setup.inc7
-rw-r--r--mysql-test/suite/perfschema/include/digest_setup.inc2
-rw-r--r--mysql-test/suite/perfschema/include/event_aggregate_setup.inc7
-rw-r--r--mysql-test/suite/perfschema/include/stage_setup.inc6
-rw-r--r--mysql-test/suite/perfschema/include/table_aggregate_setup.inc6
-rw-r--r--mysql-test/suite/perfschema/r/column_privilege.result1
-rw-r--r--mysql-test/suite/perfschema/r/digest_null_literal.result6
-rw-r--r--mysql-test/suite/perfschema/r/digest_table_full.result2
-rw-r--r--mysql-test/suite/perfschema/r/dml_setup_objects.result2
-rw-r--r--mysql-test/suite/perfschema/r/global_read_lock.result7
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_allow.result1
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_allow.result1
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_allow.result1
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_allow.result2
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_blocked.result1
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_allow.result2
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_allow.result1
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_allow.result1
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_allow.result1
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_allow.result1
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_allow.result2
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_blocked.result1
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_allow.result2
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_allow.result1
-rw-r--r--mysql-test/suite/perfschema/r/nesting.result233
-rw-r--r--mysql-test/suite/perfschema/r/ortho_iter.result1
-rw-r--r--mysql-test/suite/perfschema/r/privilege.result3
-rw-r--r--mysql-test/suite/perfschema/r/privilege_table_io.result1
-rw-r--r--mysql-test/suite/perfschema/r/read_only.result1
-rw-r--r--mysql-test/suite/perfschema/r/rpl_gtid_func.result4
-rw-r--r--mysql-test/suite/perfschema/r/rpl_statements.result81
-rw-r--r--mysql-test/suite/perfschema/r/setup_actors.result5
-rw-r--r--mysql-test/suite/perfschema/r/setup_objects.result16
-rw-r--r--mysql-test/suite/perfschema/r/sizing_default.result1
-rw-r--r--mysql-test/suite/perfschema/r/sizing_high.result1
-rw-r--r--mysql-test/suite/perfschema/r/sizing_low.result1
-rw-r--r--mysql-test/suite/perfschema/r/sizing_med.result1
-rw-r--r--mysql-test/suite/perfschema/r/sizing_off.result1
-rw-r--r--mysql-test/suite/perfschema/r/socket_summary_by_instance_func.result2
-rw-r--r--mysql-test/suite/perfschema/r/stage_mdl_global.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_disable_idle.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_disable_stages.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_disable_statements.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_disable_waits.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_innodb.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_account.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_cond_class.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_cond_inst.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_file_class.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_file_inst.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_host.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_mutex_class.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_setup_actors.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_setup_objects.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_socket_class.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_socket_inst.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_stage_class.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_stages_history.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_statement_class.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_statements_history.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_table_hdl.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_table_inst.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_thread_class.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_thread_inst.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_user.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_waits_history.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_nothing.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_off.result1
-rw-r--r--mysql-test/suite/perfschema/r/start_server_on.result1
-rw-r--r--mysql-test/suite/perfschema/r/statement_digest.result65
-rw-r--r--mysql-test/suite/perfschema/r/statement_digest_consumers.result65
-rw-r--r--mysql-test/suite/perfschema/r/statement_digest_long_query.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_off.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result1
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result1
-rw-r--r--mysql-test/suite/perfschema/r/threads_mysql.result2
-rw-r--r--mysql-test/suite/perfschema/r/unary_digest.result12
-rw-r--r--mysql-test/suite/perfschema/t/column_privilege.test1
-rw-r--r--mysql-test/suite/perfschema/t/digest_null_literal.test2
-rw-r--r--mysql-test/suite/perfschema/t/global_read_lock.test5
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_allow.test1
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_allow.test1
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_allow.test1
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_allow.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test1
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_allow.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_allow.test1
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test4
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test4
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_passwd.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_ssl.test2
-rw-r--r--mysql-test/suite/perfschema/t/nesting.test3
-rw-r--r--mysql-test/suite/perfschema/t/privilege.test4
-rw-r--r--mysql-test/suite/perfschema/t/read_only.test1
-rw-r--r--mysql-test/suite/perfschema/t/rpl_gtid_func.test2
-rw-r--r--mysql-test/suite/perfschema/t/rpl_statements.test2
-rw-r--r--mysql-test/suite/perfschema/t/setup_actors.test5
-rw-r--r--mysql-test/suite/perfschema/t/socket_instances_func-master.opt2
-rw-r--r--mysql-test/suite/perfschema/t/socket_summary_by_event_name_func.test2
-rw-r--r--mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test4
-rw-r--r--mysql-test/suite/perfschema/t/socket_summary_by_instance_func_win.test2
-rw-r--r--mysql-test/suite/perfschema/t/start_server_low_digest.test2
-rw-r--r--mysql-test/suite/perfschema/t/statement_digest_long_query.test2
-rw-r--r--mysql-test/suite/perfschema/t/unary_digest.test2
-rw-r--r--mysql-test/suite/plugins/r/audit_null.result1
-rw-r--r--mysql-test/suite/plugins/r/auth_v0100.result1
-rw-r--r--mysql-test/suite/plugins/r/qc_info.result3
-rw-r--r--mysql-test/suite/plugins/r/qc_info_priv.result3
-rw-r--r--mysql-test/suite/plugins/r/server_audit.result9
-rw-r--r--mysql-test/suite/plugins/r/thread_pool_server_audit.result367
-rw-r--r--mysql-test/suite/plugins/t/audit_null.test1
-rw-r--r--mysql-test/suite/plugins/t/auth_v0100.test1
-rw-r--r--mysql-test/suite/plugins/t/qc_info.test1
-rw-r--r--mysql-test/suite/plugins/t/qc_info_init.inc2
-rw-r--r--mysql-test/suite/plugins/t/qc_info_priv.test2
-rw-r--r--mysql-test/suite/plugins/t/server_audit.test6
-rw-r--r--mysql-test/suite/plugins/t/thread_pool_server_audit.opt2
-rw-r--r--mysql-test/suite/plugins/t/thread_pool_server_audit.test144
-rw-r--r--mysql-test/suite/roles/admin.result1
-rw-r--r--mysql-test/suite/roles/admin.test2
-rw-r--r--mysql-test/suite/roles/create_and_drop_current.result1
-rw-r--r--mysql-test/suite/roles/create_and_drop_current.test1
-rw-r--r--mysql-test/suite/roles/definer.result52
-rw-r--r--mysql-test/suite/roles/definer.test2
-rw-r--r--mysql-test/suite/roles/drop_current_user-5176.result1
-rw-r--r--mysql-test/suite/roles/drop_current_user-5176.test1
-rw-r--r--mysql-test/suite/roles/grant-5771.result1
-rw-r--r--mysql-test/suite/roles/grant-5771.test1
-rw-r--r--mysql-test/suite/roles/grant_role_auto_create_user.result6
-rw-r--r--mysql-test/suite/roles/grant_role_auto_create_user.test8
-rw-r--r--mysql-test/suite/roles/password.result1
-rw-r--r--mysql-test/suite/roles/password.test1
-rw-r--r--mysql-test/suite/roles/rpl_definer.result16
-rw-r--r--mysql-test/suite/rpl/r/create_or_replace_row.result8
-rw-r--r--mysql-test/suite/rpl/r/create_select.result30
-rw-r--r--mysql-test/suite/rpl/r/rpl_EE_err.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_alter.result105
-rw-r--r--mysql-test/suite/rpl/r/rpl_binlog_grant.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_checksum.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_create_drop_function.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_create_drop_role.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_create_drop_user.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_current_user.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_ddl.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_do_grant.result7
-rw-r--r--mysql-test/suite/rpl/r/rpl_domain_id_filter.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_flushlog_loop.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_hrtime.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_ignore_grant.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_ignore_table.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_mdev382.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_mdev8193.result24
-rw-r--r--mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result80
-rw-r--r--mysql-test/suite/rpl/r/rpl_old_decimal.result9
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel.result58
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel2.result17
-rw-r--r--mysql-test/suite/rpl/r/rpl_replicate_do.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_rewrt_db.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_USER.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_UUID.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_basic_8partition.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_create_table.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_img_blobs.result4733
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_img_eng_min.result3516
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_img_eng_noblob.result3516
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_mixing_engines.result80
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_sp012.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_until.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_set_statement.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_sp.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_ssl.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_ssl1.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_until.result10
-rw-r--r--mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_variables.result28
-rw-r--r--mysql-test/suite/rpl/r/show_status_stop_slave_race-7126.result2
-rw-r--r--mysql-test/suite/rpl/t/create_select.cnf16
-rw-r--r--mysql-test/suite/rpl/t/create_select.test41
-rw-r--r--mysql-test/suite/rpl/t/rpl_000011.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_alter.test53
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_grant.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_current_user.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_do_grant.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_domain_id_filter.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_drop_db_fail.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_ignore_grant.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_ignore_table.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_mdev8193.test56
-rw-r--r--mysql-test/suite/rpl/t/rpl_old_decimal.test25
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel.test76
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel2.test42
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_USER.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_img.cnf21
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_img_blobs.cnf1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_img_blobs.test59
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_img_eng_min.cnf1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_img_eng_min.test39
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_img_eng_noblob.cnf1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_img_eng_noblob.test39
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp012.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_until.test15
-rw-r--r--mysql-test/suite/rpl/t/rpl_set_statement.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_ssl.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_ssl1.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_until.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test10
-rw-r--r--mysql-test/suite/rpl/t/rpl_variables.test24
-rw-r--r--mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test7
-rw-r--r--mysql-test/suite/storage_engine/foreign_keys.test4
-rw-r--r--mysql-test/suite/storage_engine/select.result5
-rw-r--r--mysql-test/suite/storage_engine/select.test6
-rw-r--r--mysql-test/suite/storage_engine/type_spatial.result4
-rw-r--r--mysql-test/suite/storage_engine/type_spatial_indexes.result8
-rw-r--r--mysql-test/suite/stress/t/ddl_archive.test5
-rw-r--r--mysql-test/suite/stress/t/ddl_csv.test5
-rw-r--r--mysql-test/suite/stress/t/ddl_innodb.test5
-rw-r--r--mysql-test/suite/stress/t/ddl_memory.test5
-rw-r--r--mysql-test/suite/stress/t/ddl_myisam.test5
-rw-r--r--mysql-test/suite/sys_vars/disabled.def1
-rw-r--r--mysql-test/suite/sys_vars/inc/bin_relay_log_basename_index.inc55
-rw-r--r--mysql-test/suite/sys_vars/r/all_vars.result1
-rw-r--r--mysql-test/suite/sys_vars/r/back_log_basic.result10
-rw-r--r--mysql-test/suite/sys_vars/r/binlog_row_image_basic.result100
-rw-r--r--mysql-test/suite/sys_vars/r/debug_crc_break_basic.result39
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_buf_dump_status_frequency_basic.result42
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result2
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result2
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result2
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result2
-rw-r--r--mysql-test/suite/sys_vars/r/join_buffer_size_basic.result12
-rw-r--r--mysql-test/suite/sys_vars/r/log_bin_basename_basic.result21
-rw-r--r--mysql-test/suite/sys_vars/r/log_bin_index_basic.result21
-rw-r--r--mysql-test/suite/sys_vars/r/max_allowed_packet_basic.result34
-rw-r--r--mysql-test/suite/sys_vars/r/max_allowed_packet_func.result2
-rw-r--r--mysql-test/suite/sys_vars/r/max_user_connections_func.result1
-rw-r--r--mysql-test/suite/sys_vars/r/query_cache_limit_func.result2
-rw-r--r--mysql-test/suite/sys_vars/r/query_cache_size_basic.result2
-rw-r--r--mysql-test/suite/sys_vars/r/query_cache_type_basic.result12
-rw-r--r--mysql-test/suite/sys_vars/r/query_cache_type_func.result7
-rw-r--r--mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result3
-rw-r--r--mysql-test/suite/sys_vars/r/relay_log_basename_basic.result24
-rw-r--r--mysql-test/suite/sys_vars/r/relay_log_index_basic.result34
-rw-r--r--mysql-test/suite/sys_vars/r/secure_auth_basic.result8
-rw-r--r--mysql-test/suite/sys_vars/r/sql_mode_basic.result12
-rw-r--r--mysql-test/suite/sys_vars/r/sync_master_info_basic.result14
-rw-r--r--mysql-test/suite/sys_vars/r/sync_relay_log_basic.result14
-rw-r--r--mysql-test/suite/sys_vars/r/sync_relay_log_info_basic.result14
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_debug.result14
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff148
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff113
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff46
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb.result18
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff282
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_embedded.result136
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff288
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result204
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_wsrep.result4
-rw-r--r--mysql-test/suite/sys_vars/r/table_open_cache_basic.result8
-rw-r--r--mysql-test/suite/sys_vars/r/wsrep_desync_basic.result8
-rw-r--r--mysql-test/suite/sys_vars/r/wsrep_osu_method_basic.result3
-rw-r--r--mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result2
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_row_image_basic.test129
-rw-r--r--mysql-test/suite/sys_vars/t/debug_crc_break_basic.test46
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buf_dump_status_frequency_basic.test39
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test5
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_thread_sleep_delay_basic.test5
-rw-r--r--mysql-test/suite/sys_vars/t/log_bin_basename_basic.test13
-rw-r--r--mysql-test/suite/sys_vars/t/log_bin_index_basic.test13
-rw-r--r--mysql-test/suite/sys_vars/t/max_user_connections_func.test1
-rw-r--r--mysql-test/suite/sys_vars/t/query_cache_limit_func.test3
-rw-r--r--mysql-test/suite/sys_vars/t/query_cache_type_func.test5
-rw-r--r--mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test5
-rw-r--r--mysql-test/suite/sys_vars/t/relay_log_basename_basic.test16
-rw-r--r--mysql-test/suite/sys_vars/t/relay_log_index_basic.test14
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_cluster_address_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_desync_basic.test12
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_osu_method_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test7
-rw-r--r--mysql-test/suite/vcol/inc/vcol_blocked_sql_funcs_main.inc12
-rw-r--r--mysql-test/suite/vcol/inc/vcol_supported_sql_funcs_main.inc18
-rw-r--r--mysql-test/suite/vcol/r/load_data.result20
-rw-r--r--mysql-test/suite/vcol/r/vcol_blocked_sql_funcs_innodb.result9
-rw-r--r--mysql-test/suite/vcol/r/vcol_blocked_sql_funcs_myisam.result9
-rw-r--r--mysql-test/suite/vcol/r/vcol_misc.result26
-rw-r--r--mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result49
-rw-r--r--mysql-test/suite/vcol/r/vcol_supported_sql_funcs_myisam.result49
-rw-r--r--mysql-test/suite/vcol/t/load_data.test13
-rw-r--r--mysql-test/suite/vcol/t/vcol_misc.test22
-rw-r--r--mysql-test/suite/wsrep/disabled.def1
-rw-r--r--mysql-test/suite/wsrep/my.cnf2
-rw-r--r--mysql-test/suite/wsrep/r/mdev_7798.result13
-rw-r--r--mysql-test/suite/wsrep/r/variables.result8
-rw-r--r--mysql-test/suite/wsrep/suite.pm6
-rw-r--r--mysql-test/suite/wsrep/t/mdev_7798.opt1
-rw-r--r--mysql-test/suite/wsrep/t/mdev_7798.test17
-rw-r--r--mysql-test/suite/wsrep/t/variables.test2
-rw-r--r--mysql-test/t/alter_table.test12
-rw-r--r--mysql-test/t/analyze_stmt_orderby.test106
-rw-r--r--mysql-test/t/analyze_stmt_privileges.test1
-rw-r--r--mysql-test/t/analyze_stmt_privileges2.test3
-rw-r--r--mysql-test/t/blackhole_plugin.test5
-rw-r--r--mysql-test/t/bootstrap.test1
-rw-r--r--mysql-test/t/case.test72
-rw-r--r--mysql-test/t/change_user.test12
-rw-r--r--mysql-test/t/connect.test5
-rw-r--r--mysql-test/t/create_drop_binlog.test15
-rw-r--r--mysql-test/t/create_or_replace_permission.test5
-rw-r--r--mysql-test/t/ctype_binary.test47
-rw-r--r--mysql-test/t/ctype_cp1250_ch.test1
-rw-r--r--mysql-test/t/ctype_cp1251.test35
-rw-r--r--mysql-test/t/ctype_eucjpms.test25
-rw-r--r--mysql-test/t/ctype_latin1.test118
-rw-r--r--mysql-test/t/ctype_latin2_ch.test3
-rw-r--r--mysql-test/t/ctype_many.test19
-rw-r--r--mysql-test/t/ctype_tis620.test2
-rw-r--r--mysql-test/t/ctype_uca.test26
-rw-r--r--mysql-test/t/ctype_ucs.test4
-rw-r--r--mysql-test/t/ctype_ujis.test27
-rw-r--r--mysql-test/t/ctype_utf16.test28
-rw-r--r--mysql-test/t/ctype_utf16le.test28
-rw-r--r--mysql-test/t/ctype_utf32.test17
-rw-r--r--mysql-test/t/ctype_utf8.test44
-rw-r--r--mysql-test/t/ddl_i18n_koi8r.test2
-rw-r--r--mysql-test/t/ddl_i18n_utf8.test2
-rw-r--r--mysql-test/t/default.test2
-rw-r--r--mysql-test/t/delete_returning_grant.test4
-rw-r--r--mysql-test/t/derived.test69
-rw-r--r--mysql-test/t/derived_view.test4
-rw-r--r--mysql-test/t/distinct.test2
-rw-r--r--mysql-test/t/dyncol.test7
-rw-r--r--mysql-test/t/empty_server_name-8224.test13
-rw-r--r--mysql-test/t/enforce_storage_engine.test40
-rw-r--r--mysql-test/t/enforce_storage_engine_opt.test1
-rw-r--r--mysql-test/t/events_1.test2
-rw-r--r--mysql-test/t/events_2.test2
-rw-r--r--mysql-test/t/events_bugs.test2
-rw-r--r--mysql-test/t/events_trans.test2
-rw-r--r--mysql-test/t/events_trans_notembedded.test1
-rw-r--r--mysql-test/t/explain_json.test15
-rw-r--r--mysql-test/t/features.test2
-rw-r--r--mysql-test/t/fix_priv_tables.test2
-rw-r--r--mysql-test/t/flush-innodb-notembedded.test2
-rw-r--r--mysql-test/t/flush2.test7
-rw-r--r--mysql-test/t/flush_read_lock.test3
-rw-r--r--mysql-test/t/func_compress.test7
-rw-r--r--mysql-test/t/func_encrypt.test18
-rw-r--r--mysql-test/t/func_gconcat.test11
-rw-r--r--mysql-test/t/func_in.test13
-rw-r--r--mysql-test/t/func_like.test19
-rw-r--r--mysql-test/t/func_math.test2
-rw-r--r--mysql-test/t/func_misc.test7
-rw-r--r--mysql-test/t/func_regexp_pcre.test24
-rw-r--r--mysql-test/t/func_regexp_pcre_debug.test6
-rw-r--r--mysql-test/t/func_str.test31
-rw-r--r--mysql-test/t/func_test.test29
-rw-r--r--mysql-test/t/func_time.test41
-rw-r--r--mysql-test/t/func_weight_string.test36
-rw-r--r--mysql-test/t/gis-precise.test5
-rw-r--r--mysql-test/t/gis-rtree.test34
-rw-r--r--mysql-test/t/gis.test14
-rw-r--r--mysql-test/t/grant.test28
-rw-r--r--mysql-test/t/grant2.test3
-rw-r--r--mysql-test/t/grant3.test3
-rw-r--r--mysql-test/t/grant4.test5
-rw-r--r--mysql-test/t/grant_4332.test3
-rw-r--r--mysql-test/t/grant_explain_non_select.test5
-rw-r--r--mysql-test/t/grant_lowercase.test9
-rw-r--r--mysql-test/t/grant_lowercase_fs.test2
-rw-r--r--mysql-test/t/group_by.test32
-rw-r--r--mysql-test/t/group_min_max.test51
-rw-r--r--mysql-test/t/help.test2
-rw-r--r--mysql-test/t/host_cache_size_functionality.test2
-rw-r--r--mysql-test/t/implicit_commit.test2
-rw-r--r--mysql-test/t/index_intersect.test2
-rw-r--r--mysql-test/t/information_schema.test3
-rw-r--r--mysql-test/t/information_schema2.test13
-rw-r--r--mysql-test/t/information_schema_db.test5
-rw-r--r--mysql-test/t/information_schema_linux.test10
-rw-r--r--mysql-test/t/information_schema_routines.test2
-rw-r--r--mysql-test/t/innodb_load_xa.test3
-rw-r--r--mysql-test/t/insert_notembedded.test6
-rw-r--r--mysql-test/t/join_cache.test34
-rw-r--r--mysql-test/t/kill.test30
-rw-r--r--mysql-test/t/lock_multi.test2
-rw-r--r--mysql-test/t/log_tables.test1
-rw-r--r--mysql-test/t/lowercase_fs_off.test4
-rw-r--r--mysql-test/t/lowercase_table_grant.test1
-rw-r--r--mysql-test/t/lowercase_table_qcache.test5
-rw-r--r--mysql-test/t/max_statement_time.test6
-rw-r--r--mysql-test/t/mdev-504.test4
-rw-r--r--mysql-test/t/merge.test13
-rw-r--r--mysql-test/t/multi_update.test1
-rw-r--r--mysql-test/t/myisam-optimize.test58
-rw-r--r--mysql-test/t/myisam.test10
-rw-r--r--mysql-test/t/myisam_recover-master.opt (renamed from mysql-test/t/merge_recover-master.opt)0
-rw-r--r--mysql-test/t/myisam_recover.test (renamed from mysql-test/t/merge_recover.test)77
-rw-r--r--mysql-test/t/mysql.test3
-rw-r--r--mysql-test/t/mysql_comments.test4
-rw-r--r--mysql-test/t/mysql_tzinfo_to_sql_symlink.test11
-rw-r--r--mysql-test/t/mysql_upgrade.test27
-rw-r--r--mysql-test/t/mysql_upgrade_view.test29
-rw-r--r--mysql-test/t/mysqlbinlog-innodb.test1
-rw-r--r--mysql-test/t/mysqlcheck.test45
-rw-r--r--mysql-test/t/mysqldump-max.test8
-rw-r--r--mysql-test/t/mysqldump.test7
-rw-r--r--mysql-test/t/null.test41
-rw-r--r--mysql-test/t/openssl_1.test3
-rw-r--r--mysql-test/t/openssl_6975.test2
-rw-r--r--mysql-test/t/parser.test7
-rw-r--r--mysql-test/t/partition.test14
-rw-r--r--mysql-test/t/partition_grant.test1
-rw-r--r--mysql-test/t/partition_hash.test2
-rw-r--r--mysql-test/t/partition_innodb.test30
-rw-r--r--mysql-test/t/partition_myisam.test2
-rw-r--r--mysql-test/t/partition_not_blackhole.test2
-rw-r--r--mysql-test/t/plugin.test17
-rw-r--r--mysql-test/t/plugin_auth.test6
-rw-r--r--mysql-test/t/plugin_auth_qa.test3
-rw-r--r--mysql-test/t/plugin_not_embedded.test2
-rw-r--r--mysql-test/t/ps.test1
-rw-r--r--mysql-test/t/query_cache.test14
-rw-r--r--mysql-test/t/query_cache_debug.test1
-rw-r--r--mysql-test/t/query_cache_merge.test6
-rw-r--r--mysql-test/t/query_cache_notembedded-master.opt1
-rw-r--r--mysql-test/t/query_cache_notembedded.test14
-rw-r--r--mysql-test/t/query_cache_ps_no_prot.test7
-rw-r--r--mysql-test/t/query_cache_with_views.test4
-rw-r--r--mysql-test/t/range.test30
-rw-r--r--mysql-test/t/range_innodb.test47
-rw-r--r--mysql-test/t/read_only.test4
-rw-r--r--mysql-test/t/read_only_innodb.test3
-rw-r--r--mysql-test/t/repair_symlink-5543.test1
-rw-r--r--mysql-test/t/row.test18
-rw-r--r--mysql-test/t/selectivity.test6
-rw-r--r--mysql-test/t/servers.test3
-rw-r--r--mysql-test/t/show_check.test4
-rw-r--r--mysql-test/t/show_explain.test2
-rw-r--r--mysql-test/t/single_delete_update.test27
-rw-r--r--mysql-test/t/single_delete_update_innodb.test30
-rw-r--r--mysql-test/t/skip_grants.test5
-rw-r--r--mysql-test/t/skip_name_resolve.test1
-rw-r--r--mysql-test/t/sp-error.test4
-rw-r--r--mysql-test/t/sp-group.test187
-rw-r--r--mysql-test/t/sp-security.test13
-rw-r--r--mysql-test/t/sp.test70
-rw-r--r--mysql-test/t/sp_notembedded.test2
-rw-r--r--mysql-test/t/sp_trans.test2
-rw-r--r--mysql-test/t/ssl_7937.combinations5
-rw-r--r--mysql-test/t/ssl_7937.test35
-rw-r--r--mysql-test/t/stack-crash.test4
-rw-r--r--mysql-test/t/stat_tables_rbr.test3
-rw-r--r--mysql-test/t/status.test1
-rw-r--r--mysql-test/t/strict.test12
-rw-r--r--mysql-test/t/subselect_cache.test10
-rw-r--r--mysql-test/t/subselect_sj.test2
-rw-r--r--mysql-test/t/subselect_sj2.test58
-rw-r--r--mysql-test/t/subselect_sj_mat.test42
-rw-r--r--mysql-test/t/table_elim.test4
-rw-r--r--mysql-test/t/temp_table.test19
-rw-r--r--mysql-test/t/timezone_grant.test2
-rw-r--r--mysql-test/t/trigger-compat.test1
-rw-r--r--mysql-test/t/trigger_notembedded.test2
-rw-r--r--mysql-test/t/truncate-stale-6500.test32
-rw-r--r--mysql-test/t/type_binary.test26
-rw-r--r--mysql-test/t/type_date.test158
-rw-r--r--mysql-test/t/type_datetime.test53
-rw-r--r--mysql-test/t/type_decimal.test24
-rw-r--r--mysql-test/t/type_enum.test31
-rw-r--r--mysql-test/t/type_float.test73
-rw-r--r--mysql-test/t/type_int.test28
-rw-r--r--mysql-test/t/type_newdecimal.test56
-rw-r--r--mysql-test/t/type_num.test683
-rw-r--r--mysql-test/t/type_set.test32
-rw-r--r--mysql-test/t/type_time.test415
-rw-r--r--mysql-test/t/type_timestamp.test10
-rw-r--r--mysql-test/t/type_year.test22
-rw-r--r--mysql-test/t/update_innodb.test39
-rw-r--r--mysql-test/t/user_limits.test5
-rw-r--r--mysql-test/t/variables-notembedded.test34
-rw-r--r--mysql-test/t/variables.test2
-rw-r--r--mysql-test/t/view.test112
-rw-r--r--mysql-test/t/view_grant.test34
-rw-r--r--mysql-test/t/warnings_engine_disabled.test2
-rw-r--r--mysql-test/valgrind.supp11
-rw-r--r--mysys/checksum.c4
-rw-r--r--mysys/ma_dyncol.c7
-rw-r--r--mysys/mf_iocache.c2
-rw-r--r--mysys/mf_keycache.c38
-rw-r--r--mysys/mulalloc.c44
-rw-r--r--mysys/my_create.c2
-rw-r--r--mysys/my_fopen.c8
-rw-r--r--mysys/my_getopt.c59
-rw-r--r--mysys/my_open.c4
-rw-r--r--mysys/my_rdtsc.c7
-rw-r--r--mysys/my_thr_init.c2
-rw-r--r--mysys/ptr_cmp.c3
-rw-r--r--mysys/thr_alarm.c12
-rw-r--r--mysys/thr_lock.c18
-rw-r--r--mysys_ssl/my_crypt.cc449
-rw-r--r--mysys_ssl/yassl.cc194
-rw-r--r--packaging/WiX/AdminBackground.jpgbin20557 -> 0 bytes
-rw-r--r--packaging/WiX/AdminHeader.jpgbin3469 -> 0 bytes
-rw-r--r--packaging/WiX/CMakeLists.txt119
-rw-r--r--packaging/WiX/CPackWixConfig.cmake119
-rw-r--r--packaging/WiX/MySQLServer.icobin22486 -> 0 bytes
-rw-r--r--packaging/WiX/ca/CMakeLists.txt55
-rw-r--r--packaging/WiX/ca/CustomAction.cpp188
-rw-r--r--packaging/WiX/ca/CustomAction.def8
-rw-r--r--packaging/WiX/create_msi.cmake.in398
-rw-r--r--packaging/WiX/custom_ui.wxs115
-rw-r--r--packaging/WiX/extra.wxs.in81
-rw-r--r--packaging/WiX/mysql_server.wxs.in196
-rw-r--r--packaging/solaris/CMakeLists.txt35
-rw-r--r--packaging/solaris/postinstall-solaris.sh123
-rw-r--r--pcre/RunTest.bat1232
-rw-r--r--plugin/auth_dialog/CMakeLists.txt2
-rw-r--r--plugin/auth_dialog/dialog.c2
-rw-r--r--plugin/auth_examples/CMakeLists.txt2
-rw-r--r--plugin/auth_pam/auth_pam.c3
-rw-r--r--plugin/debug_key_management/debug_key_management_plugin.cc3
-rw-r--r--plugin/example_key_management/example_key_management_plugin.cc35
-rw-r--r--plugin/feedback/feedback.cc15
-rw-r--r--plugin/file_key_management/file_key_management_plugin.cc92
-rw-r--r--plugin/file_key_management/parser.cc9
-rw-r--r--plugin/handler_socket/CMakeLists.txt4
-rw-r--r--plugin/handler_socket/handlersocket/database.cpp8
-rw-r--r--plugin/server_audit/server_audit.c14
-rw-r--r--plugin/win_auth_client/CMakeLists.txt2
-rw-r--r--scripts/CMakeLists.txt26
-rw-r--r--scripts/fill_help_tables.sql1014
-rw-r--r--scripts/mysql_install_db.pl.in1
-rw-r--r--scripts/mysql_install_db.sh2
-rw-r--r--scripts/mysql_secure_installation.sh22
-rw-r--r--scripts/mysqld_safe.sh15
-rw-r--r--scripts/wsrep_sst_common.sh34
-rw-r--r--scripts/wsrep_sst_mysqldump.sh10
-rw-r--r--scripts/wsrep_sst_rsync.sh2
-rw-r--r--scripts/wsrep_sst_xtrabackup-v2.sh17
-rw-r--r--scripts/wsrep_sst_xtrabackup.sh10
-rw-r--r--sql-common/client.c28
-rw-r--r--sql-common/my_time.c12
-rw-r--r--sql/CMakeLists.txt3
-rw-r--r--sql/create_options.cc5
-rw-r--r--sql/debug_sync.cc3
-rw-r--r--sql/derror.cc30
-rw-r--r--sql/encryption.cc70
-rw-r--r--sql/event_data_objects.cc2
-rw-r--r--sql/event_db_repository.cc5
-rw-r--r--sql/event_parse_data.cc4
-rw-r--r--sql/event_scheduler.cc2
-rw-r--r--sql/events.cc35
-rw-r--r--sql/field.cc1454
-rw-r--r--sql/field.h564
-rw-r--r--sql/field_conv.cc3
-rw-r--r--sql/filesort.cc30
-rw-r--r--sql/gcalc_tools.cc79
-rw-r--r--sql/gcalc_tools.h8
-rw-r--r--sql/gen_lex_token.cc6
-rw-r--r--sql/ha_partition.cc22
-rw-r--r--sql/handler.cc272
-rw-r--r--sql/handler.h4
-rw-r--r--sql/hostname.cc2
-rw-r--r--sql/item.cc1253
-rw-r--r--sql/item.h747
-rw-r--r--sql/item_cmpfunc.cc982
-rw-r--r--sql/item_cmpfunc.h759
-rw-r--r--sql/item_create.cc530
-rw-r--r--sql/item_func.cc234
-rw-r--r--sql/item_func.h450
-rw-r--r--sql/item_geofunc.cc310
-rw-r--r--sql/item_geofunc.h148
-rw-r--r--sql/item_inetfunc.h37
-rw-r--r--sql/item_row.cc13
-rw-r--r--sql/item_row.h12
-rw-r--r--sql/item_strfunc.cc403
-rw-r--r--sql/item_strfunc.h305
-rw-r--r--sql/item_subselect.cc401
-rw-r--r--sql/item_subselect.h25
-rw-r--r--sql/item_sum.cc173
-rw-r--r--sql/item_sum.h172
-rw-r--r--sql/item_timefunc.cc59
-rw-r--r--sql/item_timefunc.h165
-rw-r--r--sql/item_xmlfunc.cc370
-rw-r--r--sql/item_xmlfunc.h21
-rw-r--r--sql/lock.cc4
-rw-r--r--sql/log.cc781
-rw-r--r--sql/log.h40
-rw-r--r--sql/log_event.cc1515
-rw-r--r--sql/log_event.h593
-rw-r--r--sql/log_event_old.cc15
-rw-r--r--sql/log_event_old.h14
-rw-r--r--sql/mdl.cc20
-rw-r--r--sql/mdl.h13
-rw-r--r--sql/message.rc4
-rw-r--r--sql/mf_iocache_encr.cc47
-rw-r--r--sql/multi_range_read.cc6
-rw-r--r--sql/my_apc.cc39
-rw-r--r--sql/my_apc.h27
-rw-r--r--sql/my_decimal.cc52
-rw-r--r--sql/my_decimal.h14
-rw-r--r--sql/mysqld.cc332
-rw-r--r--sql/mysqld.h33
-rw-r--r--sql/net_serv.cc17
-rw-r--r--sql/opt_index_cond_pushdown.cc42
-rw-r--r--sql/opt_range.cc1628
-rw-r--r--sql/opt_range.h623
-rw-r--r--sql/opt_subselect.cc226
-rw-r--r--sql/opt_subselect.h26
-rw-r--r--sql/opt_sum.cc2
-rw-r--r--sql/opt_table_elimination.cc42
-rw-r--r--sql/parse_file.cc45
-rw-r--r--sql/partition_info.cc91
-rw-r--r--sql/partition_info.h12
-rw-r--r--sql/procedure.h13
-rw-r--r--sql/protocol.cc6
-rw-r--r--sql/protocol.h4
-rw-r--r--sql/repl_failsafe.cc26
-rw-r--r--sql/rpl_constants.h40
-rw-r--r--sql/rpl_gtid.cc2
-rw-r--r--sql/rpl_handler.cc54
-rw-r--r--sql/rpl_injector.cc56
-rw-r--r--sql/rpl_injector.h25
-rw-r--r--sql/rpl_mi.cc38
-rw-r--r--sql/rpl_mi.h2
-rw-r--r--sql/rpl_parallel.cc96
-rw-r--r--sql/rpl_record.cc22
-rw-r--r--sql/rpl_rli.cc128
-rw-r--r--sql/rpl_rli.h2
-rw-r--r--sql/rpl_utility.cc47
-rw-r--r--sql/set_var.cc57
-rw-r--r--sql/set_var.h34
-rw-r--r--sql/share/errmsg-utf8.txt9
-rw-r--r--sql/signal_handler.cc41
-rw-r--r--sql/slave.cc634
-rw-r--r--sql/slave.h5
-rw-r--r--sql/sp.cc39
-rw-r--r--sql/sp.h2
-rw-r--r--sql/sp_head.cc51
-rw-r--r--sql/sp_pcontext.cc2
-rw-r--r--sql/sp_rcontext.cc19
-rw-r--r--sql/spatial.h6
-rw-r--r--sql/sql_acl.cc151
-rw-r--r--sql/sql_admin.cc40
-rw-r--r--sql/sql_alter.cc4
-rw-r--r--sql/sql_analyse.cc28
-rw-r--r--sql/sql_analyse.h2
-rw-r--r--sql/sql_analyze_stmt.cc93
-rw-r--r--sql/sql_analyze_stmt.h153
-rw-r--r--sql/sql_array.h10
-rw-r--r--sql/sql_base.cc127
-rw-r--r--sql/sql_bitmap.h2
-rw-r--r--sql/sql_cache.cc46
-rw-r--r--sql/sql_cache.h10
-rw-r--r--sql/sql_class.cc351
-rw-r--r--sql/sql_class.h111
-rw-r--r--sql/sql_cmd.h2
-rw-r--r--sql/sql_connect.cc15
-rw-r--r--sql/sql_const.h2
-rw-r--r--sql/sql_cursor.cc37
-rw-r--r--sql/sql_db.cc18
-rw-r--r--sql/sql_delete.cc9
-rw-r--r--sql/sql_derived.cc2
-rw-r--r--sql/sql_digest.cc17
-rw-r--r--sql/sql_error.cc31
-rw-r--r--sql/sql_error.h17
-rw-r--r--sql/sql_explain.cc384
-rw-r--r--sql/sql_explain.h28
-rw-r--r--sql/sql_expression_cache.cc18
-rw-r--r--sql/sql_expression_cache.h50
-rw-r--r--sql/sql_get_diagnostics.cc8
-rw-r--r--sql/sql_help.cc70
-rw-r--r--sql/sql_insert.cc134
-rw-r--r--sql/sql_join_cache.cc8
-rw-r--r--sql/sql_lex.cc43
-rw-r--r--sql/sql_lex.h22
-rw-r--r--sql/sql_list.h4
-rw-r--r--sql/sql_load.cc63
-rw-r--r--sql/sql_locale.cc3
-rw-r--r--sql/sql_parse.cc283
-rw-r--r--sql/sql_parse.h8
-rw-r--r--sql/sql_partition.cc28
-rw-r--r--sql/sql_partition.h2
-rw-r--r--sql/sql_partition_admin.cc34
-rw-r--r--sql/sql_plugin.cc48
-rw-r--r--sql/sql_plugin_services.ic (renamed from sql/sql_plugin_services.h)1
-rw-r--r--sql/sql_prepare.cc22
-rw-r--r--sql/sql_priv.h17
-rw-r--r--sql/sql_profile.cc35
-rw-r--r--sql/sql_reload.cc2
-rw-r--r--sql/sql_rename.cc11
-rw-r--r--sql/sql_repl.cc516
-rw-r--r--sql/sql_repl.h3
-rw-r--r--sql/sql_select.cc1218
-rw-r--r--sql/sql_select.h20
-rw-r--r--sql/sql_servers.cc5
-rw-r--r--sql/sql_show.cc469
-rw-r--r--sql/sql_show.h2
-rw-r--r--sql/sql_signal.cc12
-rw-r--r--sql/sql_string.cc8
-rw-r--r--sql/sql_string.h72
-rw-r--r--sql/sql_table.cc262
-rw-r--r--sql/sql_tablespace.cc4
-rw-r--r--sql/sql_test.cc7
-rw-r--r--sql/sql_time.cc68
-rw-r--r--sql/sql_time.h76
-rw-r--r--sql/sql_trigger.cc33
-rw-r--r--sql/sql_udf.cc27
-rw-r--r--sql/sql_union.cc13
-rw-r--r--sql/sql_update.cc39
-rw-r--r--sql/sql_view.cc24
-rw-r--r--sql/sql_yacc.yy1371
-rw-r--r--sql/sys_vars.cc175
-rw-r--r--sql/sys_vars.ic (renamed from sql/sys_vars.h)45
-rw-r--r--sql/table.cc203
-rw-r--r--sql/table.h5
-rw-r--r--sql/table_cache.h8
-rw-r--r--sql/thr_malloc.cc3
-rw-r--r--sql/transaction.cc2
-rw-r--r--sql/tztime.cc3
-rw-r--r--sql/unireg.cc30
-rw-r--r--sql/unireg.h6
-rw-r--r--sql/winservice.h80
-rw-r--r--sql/wsrep_applier.cc53
-rw-r--r--sql/wsrep_applier.h3
-rw-r--r--sql/wsrep_binlog.cc33
-rw-r--r--sql/wsrep_dummy.cc3
-rw-r--r--sql/wsrep_hton.cc36
-rw-r--r--sql/wsrep_mysqld.cc344
-rw-r--r--sql/wsrep_mysqld.h21
-rw-r--r--sql/wsrep_priv.h12
-rw-r--r--sql/wsrep_sst.cc121
-rw-r--r--sql/wsrep_thd.cc26
-rw-r--r--sql/wsrep_utils.cc161
-rw-r--r--sql/wsrep_utils.h144
-rw-r--r--sql/wsrep_var.cc94
-rw-r--r--sql/wsrep_xid.cc147
-rw-r--r--sql/wsrep_xid.h36
-rw-r--r--storage/archive/ha_archive.cc2
-rw-r--r--storage/cassandra/ha_cassandra.cc2
-rw-r--r--storage/connect/CMakeLists.txt4
-rw-r--r--storage/connect/filamzip.cpp2
-rw-r--r--storage/connect/ha_connect.cc38
-rw-r--r--storage/connect/jsonudf.cpp5
-rw-r--r--storage/connect/mycat.h1
-rw-r--r--storage/connect/mysql-test/connect/r/grant.result19
-rw-r--r--storage/connect/mysql-test/connect/r/grant2.result691
-rw-r--r--storage/connect/mysql-test/connect/r/ini_grant.result4
-rw-r--r--storage/connect/mysql-test/connect/r/mysql_grant.result4
-rw-r--r--storage/connect/mysql-test/connect/r/odbc_sqlite3_grant.result16
-rw-r--r--storage/connect/mysql-test/connect/r/xml_grant.result3
-rw-r--r--storage/connect/mysql-test/connect/t/grant.inc3
-rw-r--r--storage/connect/mysql-test/connect/t/grant.test5
-rw-r--r--storage/connect/mysql-test/connect/t/grant2.test869
-rw-r--r--storage/connect/mysql-test/connect/t/ini_grant.test4
-rw-r--r--storage/connect/mysql-test/connect/t/mysql_grant.test4
-rw-r--r--storage/connect/mysql-test/connect/t/odbc_postgresql.test9
-rw-r--r--storage/connect/mysql-test/connect/t/odbc_sqlite3_grant.test14
-rw-r--r--storage/connect/reldef.cpp1
-rw-r--r--storage/connect/xobject.cpp1
-rw-r--r--storage/csv/ha_tina.cc2
-rw-r--r--storage/federatedx/README.windows46
-rw-r--r--storage/federatedx/federatedx_io_mysql.cc1
-rw-r--r--storage/federatedx/ha_federatedx.cc2
-rw-r--r--storage/innobase/api/api0api.cc27
-rw-r--r--storage/innobase/btr/btr0btr.cc79
-rw-r--r--storage/innobase/btr/btr0cur.cc108
-rw-r--r--storage/innobase/btr/btr0defragment.cc25
-rw-r--r--storage/innobase/btr/btr0scrub.cc17
-rw-r--r--storage/innobase/buf/buf0buf.cc768
-rw-r--r--storage/innobase/buf/buf0checksum.cc11
-rw-r--r--storage/innobase/buf/buf0dblwr.cc12
-rw-r--r--storage/innobase/buf/buf0dump.cc18
-rw-r--r--storage/innobase/buf/buf0flu.cc10
-rw-r--r--storage/innobase/buf/buf0rea.cc56
-rw-r--r--storage/innobase/dict/dict0crea.cc154
-rw-r--r--storage/innobase/dict/dict0dict.cc639
-rw-r--r--storage/innobase/dict/dict0load.cc4
-rw-r--r--storage/innobase/dict/dict0mem.cc3
-rw-r--r--storage/innobase/fil/fil0crypt.cc261
-rw-r--r--storage/innobase/fil/fil0fil.cc179
-rw-r--r--storage/innobase/fil/fil0pagecompress.cc10
-rw-r--r--storage/innobase/fsp/fsp0fsp.cc14
-rw-r--r--storage/innobase/fts/fts0fts.cc2
-rw-r--r--storage/innobase/handler/ha_innodb.cc426
-rw-r--r--storage/innobase/handler/ha_innodb.h24
-rw-r--r--storage/innobase/handler/handler0alter.cc227
-rw-r--r--storage/innobase/include/api0api.h10
-rw-r--r--storage/innobase/include/btr0btr.h25
-rw-r--r--storage/innobase/include/btr0btr.ic22
-rw-r--r--storage/innobase/include/btr0cur.h4
-rw-r--r--storage/innobase/include/btr0defragment.h5
-rw-r--r--storage/innobase/include/btr0pcur.h4
-rw-r--r--storage/innobase/include/btr0pcur.ic20
-rw-r--r--storage/innobase/include/buf0buf.h19
-rw-r--r--storage/innobase/include/buf0buf.ic7
-rw-r--r--storage/innobase/include/buf0rea.h4
-rw-r--r--storage/innobase/include/db0err.h6
-rw-r--r--storage/innobase/include/dict0crea.h29
-rw-r--r--storage/innobase/include/dict0dict.h46
-rw-r--r--storage/innobase/include/dict0dict.ic4
-rw-r--r--storage/innobase/include/dict0mem.h8
-rw-r--r--storage/innobase/include/fil0crypt.h106
-rw-r--r--storage/innobase/include/fil0fil.h15
-rw-r--r--storage/innobase/include/fts0fts.h2
-rw-r--r--storage/innobase/include/ha_prototypes.h19
-rw-r--r--storage/innobase/include/log0crypt.h72
-rw-r--r--storage/innobase/include/os0file.h8
-rw-r--r--storage/innobase/include/os0sync.h2
-rw-r--r--storage/innobase/include/page0cur.ic17
-rw-r--r--storage/innobase/include/page0page.h16
-rw-r--r--storage/innobase/include/page0zip.h15
-rw-r--r--storage/innobase/include/row0ftsort.h6
-rw-r--r--storage/innobase/include/row0merge.h27
-rw-r--r--storage/innobase/include/row0mysql.h5
-rw-r--r--storage/innobase/include/row0purge.h12
-rw-r--r--storage/innobase/include/srv0mon.h2
-rw-r--r--storage/innobase/include/srv0srv.h3
-rw-r--r--storage/innobase/include/sync0rw.h2
-rw-r--r--storage/innobase/include/sync0sync.h2
-rw-r--r--storage/innobase/include/univ.i2
-rw-r--r--storage/innobase/lock/lock0lock.cc34
-rw-r--r--storage/innobase/log/log0crypt.cc170
-rw-r--r--storage/innobase/log/log0recv.cc55
-rw-r--r--storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff4
-rw-r--r--storage/innobase/os/os0file.cc29
-rw-r--r--storage/innobase/page/page0page.cc44
-rw-r--r--storage/innobase/page/page0zip.cc102
-rw-r--r--storage/innobase/pars/pars0pars.cc3
-rw-r--r--storage/innobase/row/row0ftsort.cc84
-rw-r--r--storage/innobase/row/row0import.cc121
-rw-r--r--storage/innobase/row/row0ins.cc32
-rw-r--r--storage/innobase/row/row0merge.cc380
-rw-r--r--storage/innobase/row/row0mysql.cc147
-rw-r--r--storage/innobase/row/row0purge.cc79
-rw-r--r--storage/innobase/row/row0sel.cc43
-rw-r--r--storage/innobase/srv/srv0mon.cc10
-rw-r--r--storage/innobase/srv/srv0srv.cc13
-rw-r--r--storage/innobase/srv/srv0start.cc52
-rw-r--r--storage/innobase/sync/sync0arr.cc8
-rw-r--r--storage/innobase/trx/trx0sys.cc4
-rw-r--r--storage/innobase/trx/trx0trx.cc5
-rw-r--r--storage/innobase/ut/ut0ut.cc2
-rw-r--r--storage/maria/ha_maria.cc6
-rw-r--r--storage/maria/ma_blockrec.c13
-rw-r--r--storage/maria/ma_check.c6
-rw-r--r--storage/maria/ma_check_standalone.h2
-rw-r--r--storage/maria/ma_crypt.c4
-rw-r--r--storage/maria/ma_dynrec.c21
-rw-r--r--storage/maria/ma_pagecache.c28
-rw-r--r--storage/maria/maria_pack.c10
-rw-r--r--storage/mroonga/CMakeLists.txt97
-rw-r--r--storage/mroonga/appveyor.yml10
-rw-r--r--storage/mroonga/build/makefiles/gettext.am21
-rw-r--r--storage/mroonga/build/makefiles/sphinx.am2
-rw-r--r--storage/mroonga/configure.ac24
-rw-r--r--storage/mroonga/ha_mroonga.cpp1759
-rw-r--r--storage/mroonga/ha_mroonga.hpp102
-rw-r--r--storage/mroonga/lib/mrn_condition_converter.cpp4
-rw-r--r--storage/mroonga/lib/mrn_condition_converter.hpp3
-rw-r--r--storage/mroonga/lib/mrn_database_manager.cpp15
-rw-r--r--storage/mroonga/lib/mrn_database_repairer.cpp2
-rw-r--r--storage/mroonga/lib/mrn_encoding.cpp1
-rw-r--r--storage/mroonga/lib/mrn_encoding.hpp6
-rw-r--r--storage/mroonga/lib/mrn_field_normalizer.cpp2
-rw-r--r--storage/mroonga/lib/mrn_field_normalizer.hpp6
-rw-r--r--storage/mroonga/lib/mrn_index_table_name.cpp31
-rw-r--r--storage/mroonga/lib/mrn_index_table_name.hpp7
-rw-r--r--storage/mroonga/lib/mrn_lock.cpp15
-rw-r--r--storage/mroonga/lib/mrn_lock.hpp5
-rw-r--r--storage/mroonga/lib/mrn_multiple_column_key_codec.cpp311
-rw-r--r--storage/mroonga/lib/mrn_multiple_column_key_codec.hpp46
-rw-r--r--storage/mroonga/lib/mrn_mysqlservices.cpp4
-rw-r--r--storage/mroonga/lib/mrn_smart_grn_obj.cpp6
-rw-r--r--storage/mroonga/lib/mrn_smart_grn_obj.hpp1
-rw-r--r--storage/mroonga/lib/mrn_time_converter.cpp45
-rw-r--r--storage/mroonga/lib/mrn_time_converter.hpp8
-rw-r--r--storage/mroonga/lib/mrn_value_decoder.cpp11
-rw-r--r--storage/mroonga/lib/mrn_value_decoder.hpp1
-rw-r--r--storage/mroonga/mrn_constants.hpp4
-rw-r--r--storage/mroonga/mrn_err.h6
-rw-r--r--storage/mroonga/mrn_mysql_compat.h67
-rw-r--r--storage/mroonga/mrn_table.cpp104
-rw-r--r--storage/mroonga/mrn_table.hpp18
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_embedded.inc19
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/have_groonga_plugin_register.inc22
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/have_mariadb.inc (renamed from storage/mroonga/mysql-test/mroonga/include/mroonga/have_fulltext_index_comment.inc)12
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga.inc3
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_flags_comment.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_with_flags.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_flags_parameter.result17
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_groonga_type_comment.result18
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_groonga_type_parameter.result26
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_type_comment.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_with_type.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_token_filters_one_token_filter.result4
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_multiple.result4
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_token_filter.result4
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_date_strict.result23
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_flags_comment.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/create_table_vector.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_flags_parameter.result17
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_groonga_type_comment.result18
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_groonga_type_nonexistent.result6
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_groonga_type_parameter.result26
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_type_comment.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/create_table_reference_type.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_type_nonexistent.result6
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_comment.result9
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_none.result2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_parameter.result15
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_index_flags_none.result9
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_index_flags_with_position_and_with_weight.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_with_position_and_with_weight.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_comment.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_fulltext_index_comment.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_no_utf8_charset_with_utf8_normalizer.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_fulltext_index_no_utf8_charset_with_utf8_normalizer.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_none.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_fulltext_index_none.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_parameter.result21
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_comment.result31
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_default.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/fulltext_parser_default.result)24
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_off.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/fulltext_parser_off.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_multiple_token_filters.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_index_comment_multiple_token_filters.result)4
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_one_token_filter.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_index_comment_one_token_filter.result)4
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_parameter.result23
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_comment.result31
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_default.result33
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_off.result42
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_parameter.result30
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_normalizer_default.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_primary_key_table_comment.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_normalizer_hash.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_primary_key_table_comment_with_using_hash.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_multiple_token_filters.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_table_comment_multiple_token_filters.result)4
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_one_token_filter.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_table_comment_one_token_filter.result)4
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_stop_word.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/fulltext_token_filters_skip.result)4
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result5
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result5
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result5
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.result14
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/fulltext_not_match_against.result20
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/fulltext_parser_comment.result29
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.result21
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/replace_select_varchar.result3
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/replace_without_key.result2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/truncate.result13
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/suite.pm7
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_with_flags.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test41
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test44
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test47
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_with_type.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test3
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test3
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date_strict.test41
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_flags_comment.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/create_table_vector.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_flags_parameter.test39
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_comment.test42
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_nonexistent.test29
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_parameter.test45
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_type_comment.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/create_table_reference_type.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_type_nonexistent.test29
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_comment.test39
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_none.test3
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_parameter.test41
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_none.test38
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_with_position_and_with_weight.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_with_position_and_with_weight.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_comment.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_fulltext_index_comment.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_no_utf8_charset_with_utf8_normalizer.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_fulltext_index_no_utf8_charset_with_utf8_normalizer.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_none.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_fulltext_index_none.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_parameter.test40
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_comment.test42
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_default.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/fulltext_parser_default.test)12
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_off.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/fulltext_parser_off.test)1
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_index_comment_multiple_token_filters.test)3
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_index_comment_one_token_filter.test)3
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test44
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_comment.test42
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_default.test41
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_off.test47
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_parameter.test42
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_default.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_primary_key_table_comment.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_hash.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_primary_key_table_comment_with_using_hash.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_table_comment_multiple_token_filters.test)3
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_table_comment_one_token_filter.test)3
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_stop_word.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/fulltext_token_filters_skip.test)3
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test5
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test5
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test5
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.test38
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_not_match_against.test21
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.test39
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/replace_select_varchar.test3
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/replace_without_key.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/truncate.test14
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_global.test1
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_session.test1
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_comment.result9
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_none.result9
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_parameter.result16
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_comment.result21
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_fulltext_index.result16
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_parameter.result21
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_parser_comment.result (renamed from storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_parser_comment.result)20
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_multiple_token_filters.result (renamed from storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_comment_multiple_token_filters.result)4
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_one_token_filter.result (renamed from storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_comment_one_token_filter.result)4
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_parameter.result25
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_tokenizer_comment.result29
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_tokenizer_parameter.result30
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result5
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result3
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result3
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_select.result4
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_many_records.result2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_have_where_matched_order.result26
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_have_where_no_order.result24
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_no_where_both_order.result26
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_myisam.result18
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_not_match_against.result20
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_TODO_SPLIT_ME.result18
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/truncate.result13
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/suite.pm7
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_with_index.test1
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_comment.test40
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_none.test40
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_parameter.test42
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_comment.test40
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_parameter.test41
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_parser_comment.test (renamed from storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_parser_comment.test)11
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test (renamed from storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_comment_multiple_token_filters.test)3
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test (renamed from storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_comment_one_token_filter.test)3
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test46
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_comment.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/fulltext_parser_comment.test)16
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_parameter.test (renamed from storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_fulltext_index.test)26
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test5
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test5
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test5
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_select.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_many_records.test4
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_matched_order.test50
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_no_order.test48
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_no_where_both_order.test50
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_myisam.test16
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_not_match_against.test22
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_TODO_SPLIT_ME.test4
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema-master.opt2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/truncate.test14
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_global.test1
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_session.test1
-rwxr-xr-xstorage/mroonga/packages/apt/build-deb.sh6
-rw-r--r--storage/mroonga/packages/debian/changelog12
-rw-r--r--storage/mroonga/packages/rpm/centos/mariadb-mroonga.spec.in6
-rw-r--r--storage/mroonga/packages/rpm/centos/mysql55-mroonga.spec.in6
-rw-r--r--storage/mroonga/packages/rpm/centos/mysql56-community-mroonga.spec.in44
-rw-r--r--storage/mroonga/packages/rpm/centos/percona-server-56-mroonga.spec.in26
-rw-r--r--storage/mroonga/packages/source/Makefile.am6
-rwxr-xr-xstorage/mroonga/packages/ubuntu/upload.rb4
-rwxr-xr-xstorage/mroonga/packages/yum/sign-rpm.sh2
-rw-r--r--storage/mroonga/plugin_version2
-rwxr-xr-xstorage/mroonga/tools/travis/before_script.sh29
-rwxr-xr-xstorage/mroonga/tools/travis/script.sh14
-rw-r--r--storage/mroonga/vendor/groonga/CMakeLists.txt91
-rw-r--r--storage/mroonga/vendor/groonga/base_version2
-rw-r--r--storage/mroonga/vendor/groonga/bindings/php/groonga.c3
-rw-r--r--storage/mroonga/vendor/groonga/build/ac_macros/check_headers.m45
-rw-r--r--storage/mroonga/vendor/groonga/config.h.cmake7
-rw-r--r--storage/mroonga/vendor/groonga/configure.ac4
-rwxr-xr-xstorage/mroonga/vendor/groonga/examples/dictionary/edict/edict2grn.rb56
-rwxr-xr-xstorage/mroonga/vendor/groonga/examples/dictionary/gene95/gene2grn.rb63
-rw-r--r--storage/mroonga/vendor/groonga/groonga-httpd-conf.sh.in2
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/command.h2
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/groonga.h2
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/plugin.h5
-rw-r--r--storage/mroonga/vendor/groonga/lib/CMakeLists.txt9
-rw-r--r--storage/mroonga/vendor/groonga/lib/com.c27
-rw-r--r--storage/mroonga/vendor/groonga/lib/command.c8
-rw-r--r--storage/mroonga/vendor/groonga/lib/ctx.c57
-rw-r--r--storage/mroonga/vendor/groonga/lib/ctx_impl_mrb.c36
-rw-r--r--storage/mroonga/vendor/groonga/lib/dat.cpp32
-rw-r--r--storage/mroonga/vendor/groonga/lib/dat/file-impl.cpp20
-rw-r--r--storage/mroonga/vendor/groonga/lib/dat/file-impl.hpp4
-rw-r--r--storage/mroonga/vendor/groonga/lib/dat/file.cpp8
-rw-r--r--storage/mroonga/vendor/groonga/lib/dat/file.hpp4
-rw-r--r--storage/mroonga/vendor/groonga/lib/dat/trie.cpp6
-rw-r--r--storage/mroonga/vendor/groonga/lib/dat/trie.hpp4
-rw-r--r--storage/mroonga/vendor/groonga/lib/db.c439
-rw-r--r--storage/mroonga/vendor/groonga/lib/egn.cpp3245
-rw-r--r--storage/mroonga/vendor/groonga/lib/error.c14
-rw-r--r--storage/mroonga/vendor/groonga/lib/expr.c284
-rw-r--r--storage/mroonga/vendor/groonga/lib/expr_code.c71
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn.h8
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_ctx.h5
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_ctx_impl_mrb.h3
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_dat.h4
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_db.h2
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_egn.h90
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_egn.hpp318
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_error.h1
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_expr_code.h37
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_ii.h5
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_io.h5
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_mrb.h2
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_plugin.h1
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_proc.h4
-rw-r--r--storage/mroonga/vendor/groonga/lib/ii.c152
-rw-r--r--storage/mroonga/vendor/groonga/lib/io.c197
-rw-r--r--storage/mroonga/vendor/groonga/lib/logger.c4
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb.c21
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_array.c32
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_bulk.c51
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_column.c19
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_command_input.c17
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_converter.c2
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_index_column.c21
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_object.c23
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_object.h2
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_table.c202
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_table_group_flags.c48
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_table_group_flags.h34
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_table_group_result.c250
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_table_group_result.h34
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_table_sort_flags.c42
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_table_sort_flags.h34
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_table_sort_key.c157
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_table_sort_key.h34
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_size_estimator.rb7
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/post.rb1
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/sources.am1
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/table.rb90
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/sources.am8
-rw-r--r--storage/mroonga/vendor/groonga/lib/operator.c66
-rw-r--r--storage/mroonga/vendor/groonga/lib/output.c70
-rw-r--r--storage/mroonga/vendor/groonga/lib/plugin.c19
-rw-r--r--storage/mroonga/vendor/groonga/lib/proc.c160
-rw-r--r--storage/mroonga/vendor/groonga/lib/sources.am5
-rw-r--r--storage/mroonga/vendor/groonga/lib/store.c7
-rw-r--r--storage/mroonga/vendor/groonga/lib/token_cursor.c2
-rw-r--r--storage/mroonga/vendor/groonga/lib/tokenizers.c203
-rw-r--r--storage/mroonga/vendor/groonga/plugins/CMakeLists.txt10
-rw-r--r--storage/mroonga/vendor/groonga/plugins/functions/CMakeLists.txt18
-rw-r--r--storage/mroonga/vendor/groonga/plugins/functions/vector.c4
-rw-r--r--storage/mroonga/vendor/groonga/plugins/query_expanders/CMakeLists.txt18
-rw-r--r--storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c4
-rw-r--r--storage/mroonga/vendor/groonga/plugins/ruby/CMakeLists.txt36
-rw-r--r--storage/mroonga/vendor/groonga/plugins/ruby/eval.c4
-rw-r--r--storage/mroonga/vendor/groonga/plugins/ruby/load.c4
-rw-r--r--storage/mroonga/vendor/groonga/plugins/sharding.rb2
-rw-r--r--storage/mroonga/vendor/groonga/plugins/sharding/CMakeLists.txt12
-rw-r--r--storage/mroonga/vendor/groonga/plugins/sharding/logical_enumerator.rb156
-rw-r--r--storage/mroonga/vendor/groonga/plugins/sharding/logical_select.rb332
-rw-r--r--storage/mroonga/vendor/groonga/plugins/sharding/logical_table_remove.rb70
-rw-r--r--storage/mroonga/vendor/groonga/plugins/sharding/sources.am2
-rw-r--r--storage/mroonga/vendor/groonga/plugins/suggest/CMakeLists.txt14
-rw-r--r--storage/mroonga/vendor/groonga/plugins/suggest/suggest.c4
-rw-r--r--storage/mroonga/vendor/groonga/plugins/table/CMakeLists.txt16
-rw-r--r--storage/mroonga/vendor/groonga/plugins/token_filters/CMakeLists.txt36
-rw-r--r--storage/mroonga/vendor/groonga/plugins/token_filters/stem.c4
-rw-r--r--storage/mroonga/vendor/groonga/plugins/token_filters/stop_word.c4
-rw-r--r--storage/mroonga/vendor/groonga/plugins/tokenizers/CMakeLists.txt36
-rw-r--r--storage/mroonga/vendor/groonga/plugins/tokenizers/kytea.cpp4
-rw-r--r--storage/mroonga/vendor/groonga/plugins/tokenizers/mecab.c20
-rwxr-xr-xstorage/mroonga/vendor/groonga/ra.rb12
-rw-r--r--storage/mroonga/vendor/groonga/src/grndb.c2
-rw-r--r--storage/mroonga/vendor/groonga/src/grnslap.c10
-rw-r--r--storage/mroonga/vendor/groonga/src/groonga.c13
-rw-r--r--storage/mroonga/vendor/groonga/src/groonga_benchmark.c12
-rw-r--r--storage/mroonga/vendor/groonga/src/groonga_mruby.c2
-rw-r--r--storage/mroonga/vendor/groonga/src/httpd/nginx-module/config8
-rw-r--r--storage/mroonga/vendor/groonga/src/httpd/nginx-module/ngx_http_groonga_module.c32
-rwxr-xr-xstorage/mroonga/vendor/groonga/tools/install/install-for-debian-jessie.sh17
-rw-r--r--storage/mroonga/vendor/groonga/vendor/mruby/CMakeLists.txt1
-rw-r--r--storage/mroonga/vendor/groonga/vendor/mruby/Makefile.am11
-rw-r--r--storage/mroonga/vendor/groonga/vendor/mruby/build_config.rb1
-rw-r--r--storage/mroonga/vendor/groonga/vendor/mruby/built_sources.am2
-rwxr-xr-xstorage/mroonga/vendor/groonga/vendor/mruby/mruby_build.rb6
-rw-r--r--storage/mroonga/vendor/groonga/vendor/mruby/sources.am6
-rw-r--r--storage/mroonga/vendor/groonga/vendor/onigmo/CMakeLists.txt13
-rw-r--r--storage/mroonga/vendor/groonga/vendor/onigmo/Makefile.am1
-rw-r--r--storage/mroonga/vendor/groonga/vendor/onigmo/config.h.cmake1
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/doc/text/news.md11
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/CMakeLists.txt14
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql.c53
-rwxr-xr-xstorage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/apt/build-deb.sh6
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/changelog6
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/centos/groonga-normalizer-mysql.spec.in3
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/fedora/groonga-normalizer-mysql.spec.in3
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/version2
-rw-r--r--storage/mroonga/version2
-rw-r--r--storage/mroonga/version_in_hex2
-rw-r--r--storage/mroonga/version_micro2
-rw-r--r--storage/myisam/ha_myisam.cc57
-rw-r--r--storage/myisam/mi_check.c12
-rw-r--r--storage/myisam/myisamdef.h2
-rw-r--r--storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff2
-rw-r--r--storage/myisam/rt_split.c9
-rw-r--r--storage/myisammrg/ha_myisammrg.cc2
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff2
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff4
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff8
-rw-r--r--storage/oqgraph/CMakeLists.txt20
-rw-r--r--storage/perfschema/ha_perfschema.cc2
-rw-r--r--storage/perfschema/pfs_account.cc4
-rw-r--r--storage/perfschema/pfs_con_slice.cc11
-rw-r--r--storage/perfschema/pfs_digest.cc17
-rw-r--r--storage/perfschema/pfs_digest.h2
-rw-r--r--storage/perfschema/pfs_events_stages.cc6
-rw-r--r--storage/perfschema/pfs_events_statements.cc16
-rw-r--r--storage/perfschema/pfs_events_statements.h4
-rw-r--r--storage/perfschema/pfs_events_waits.cc6
-rw-r--r--storage/perfschema/pfs_global.cc38
-rw-r--r--storage/perfschema/pfs_global.h18
-rw-r--r--storage/perfschema/pfs_host.cc2
-rw-r--r--storage/perfschema/pfs_instr.cc40
-rw-r--r--storage/perfschema/pfs_instr.h2
-rw-r--r--storage/perfschema/pfs_instr_class.cc38
-rw-r--r--storage/perfschema/pfs_server.h2
-rw-r--r--storage/perfschema/pfs_setup_actor.cc6
-rw-r--r--storage/perfschema/pfs_setup_object.cc6
-rw-r--r--storage/perfschema/pfs_user.cc2
-rw-r--r--storage/perfschema/table_events_stages.cc14
-rw-r--r--storage/perfschema/table_events_statements.cc24
-rw-r--r--storage/perfschema/table_events_waits.cc17
-rw-r--r--storage/perfschema/table_helper.cc2
-rw-r--r--storage/perfschema/unittest/CMakeLists.txt2
-rw-r--r--storage/perfschema/unittest/pfs_misc-t.cc72
-rw-r--r--storage/perfschema/unittest/pfs_server_stubs.cc6
-rw-r--r--storage/perfschema/unittest/stub_pfs_global.h24
-rw-r--r--storage/perfschema/unittest/stub_print_error.h19
-rw-r--r--storage/sphinx/ha_sphinx.cc11
-rw-r--r--storage/sphinx/mysql-test/sphinx/my.cnf3
-rw-r--r--storage/spider/CMakeLists.txt5
-rw-r--r--storage/spider/spd_sys_table.cc12
-rw-r--r--storage/tokudb/CMakeLists.txt41
-rw-r--r--storage/tokudb/ft-index/buildheader/make_tdb.cc3
-rw-r--r--storage/tokudb/ft-index/cmake_modules/TokuSetupCompiler.cmake73
-rw-r--r--storage/tokudb/ft-index/ft/ft-verify.cc20
-rw-r--r--storage/tokudb/ft-index/ft/logger/recover.cc62
-rw-r--r--storage/tokudb/ft-index/ft/txn/txn.cc5
-rw-r--r--storage/tokudb/ft-index/ft/txn/txn.h3
-rw-r--r--storage/tokudb/ft-index/src/tests/test_iterate_live_transactions.cc4
-rw-r--r--storage/tokudb/ft-index/src/tests/test_stress0.cc4
-rw-r--r--storage/tokudb/ft-index/src/ydb.cc21
-rw-r--r--storage/tokudb/ft-index/src/ydb_txn.cc6
-rw-r--r--storage/tokudb/ft-index/tools/CMakeLists.txt9
-rw-r--r--storage/tokudb/ft-index/tools/tokuft_logprint.cc (renamed from storage/tokudb/ft-index/tools/tdb_logprint.cc)2
-rw-r--r--storage/tokudb/ft-index/tools/tokuftdump.cc6
-rw-r--r--storage/tokudb/ft-index/util/scoped_malloc.cc25
-rw-r--r--storage/tokudb/ft-index/util/scoped_malloc.h4
-rw-r--r--storage/tokudb/ft-index/util/tests/sm-basic.cc127
-rw-r--r--storage/tokudb/ft-index/util/tests/sm-crash-double-free.cc128
-rw-r--r--storage/tokudb/ha_tokudb.cc69
-rw-r--r--storage/tokudb/ha_tokudb_admin.cc18
-rw-r--r--storage/tokudb/ha_tokudb_alter_56.cc15
-rw-r--r--storage/tokudb/hatoku_defines.h1
-rw-r--r--storage/tokudb/hatoku_hton.cc18
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/cluster_create_table.result12
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_released.result10
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_timeout.result6
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_trx.result10
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/mvcc-10.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/mvcc-21.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/mvcc-22.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/mvcc-23.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/mvcc-25.result4
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/mvcc-3.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/mvcc-33.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/mvcc-34.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/mvcc-35.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/mvcc-36.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/mvcc-37.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/mvcc-38.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/mvcc-4.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/mvcc-5.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/mvcc-6.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/mvcc-7.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/mvcc-8.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/mvcc-9.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/rows-32m-rand-insert.result1
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/rows-32m-seq-insert.result1
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/type_blob.result6
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/type_decimal.result9
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/type_float.result8
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/type_newdecimal.result60
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/type_varchar.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test10
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_timeout.test6
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_trx.test10
-rw-r--r--storage/tokudb/mysql-test/tokudb_alter_table/r/ai_part.result4
-rw-r--r--storage/tokudb/mysql-test/tokudb_alter_table/r/hcad_part.result4
-rw-r--r--storage/tokudb/mysql-test/tokudb_alter_table/r/hcr3.result6
-rw-r--r--storage/tokudb/mysql-test/tokudb_alter_table/r/other_alter.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb_alter_table/r/other_alter2.result4
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/db805.result18
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/db806.result9
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/db811.result14
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/db811s.result14
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/db823.result11
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/dict_leak_3518.result8
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/frm_store3.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/tokudb718.result5
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/t/db805.test17
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/t/db806.test13
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/t/db811.test22
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/t/db811s.test22
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/t/db823.test16
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/t/tokudb718.test3
-rw-r--r--storage/xtradb/CMakeLists.txt8
-rw-r--r--storage/xtradb/api/api0api.cc223
-rw-r--r--storage/xtradb/btr/btr0btr.cc80
-rw-r--r--storage/xtradb/btr/btr0cur.cc106
-rw-r--r--storage/xtradb/btr/btr0defragment.cc25
-rw-r--r--storage/xtradb/btr/btr0scrub.cc17
-rw-r--r--storage/xtradb/buf/buf0buf.cc769
-rw-r--r--storage/xtradb/buf/buf0checksum.cc21
-rw-r--r--storage/xtradb/buf/buf0dblwr.cc12
-rw-r--r--storage/xtradb/buf/buf0dump.cc18
-rw-r--r--storage/xtradb/buf/buf0flu.cc10
-rw-r--r--storage/xtradb/buf/buf0rea.cc35
-rw-r--r--storage/xtradb/dict/dict0boot.cc12
-rw-r--r--storage/xtradb/dict/dict0crea.cc153
-rw-r--r--storage/xtradb/dict/dict0dict.cc662
-rw-r--r--storage/xtradb/dict/dict0load.cc7
-rw-r--r--storage/xtradb/dict/dict0mem.cc34
-rw-r--r--storage/xtradb/fil/fil0crypt.cc256
-rw-r--r--storage/xtradb/fil/fil0fil.cc168
-rw-r--r--storage/xtradb/fil/fil0pagecompress.cc9
-rw-r--r--storage/xtradb/fsp/fsp0fsp.cc56
-rw-r--r--storage/xtradb/fts/fts0fts.cc113
-rw-r--r--storage/xtradb/fts/fts0opt.cc9
-rw-r--r--storage/xtradb/fts/fts0que.cc5
-rw-r--r--storage/xtradb/handler/ha_innodb.cc445
-rw-r--r--storage/xtradb/handler/ha_innodb.h24
-rw-r--r--storage/xtradb/handler/handler0alter.cc65
-rw-r--r--storage/xtradb/handler/i_s.cc136
-rw-r--r--storage/xtradb/handler/i_s.h1
-rw-r--r--storage/xtradb/ibuf/ibuf0ibuf.cc5
-rw-r--r--storage/xtradb/include/api0api.h10
-rw-r--r--storage/xtradb/include/btr0btr.h25
-rw-r--r--storage/xtradb/include/btr0btr.ic22
-rw-r--r--storage/xtradb/include/btr0cur.h4
-rw-r--r--storage/xtradb/include/btr0defragment.h5
-rw-r--r--storage/xtradb/include/btr0pcur.h4
-rw-r--r--storage/xtradb/include/btr0pcur.ic20
-rw-r--r--storage/xtradb/include/buf0buf.h22
-rw-r--r--storage/xtradb/include/buf0buf.ic7
-rw-r--r--storage/xtradb/include/buf0checksum.h9
-rw-r--r--storage/xtradb/include/buf0lru.h2
-rw-r--r--storage/xtradb/include/buf0rea.h11
-rw-r--r--storage/xtradb/include/db0err.h6
-rw-r--r--storage/xtradb/include/dict0crea.h19
-rw-r--r--storage/xtradb/include/dict0dict.h19
-rw-r--r--storage/xtradb/include/dict0mem.h144
-rw-r--r--storage/xtradb/include/fil0crypt.h108
-rw-r--r--storage/xtradb/include/fil0fil.h13
-rw-r--r--storage/xtradb/include/ha_prototypes.h30
-rw-r--r--storage/xtradb/include/log0crypt.h72
-rw-r--r--storage/xtradb/include/os0file.h8
-rw-r--r--storage/xtradb/include/os0sync.h2
-rw-r--r--storage/xtradb/include/page0cur.ic17
-rw-r--r--storage/xtradb/include/page0page.h26
-rw-r--r--storage/xtradb/include/page0types.h4
-rw-r--r--storage/xtradb/include/page0zip.h21
-rw-r--r--storage/xtradb/include/row0ftsort.h6
-rw-r--r--storage/xtradb/include/row0merge.h27
-rw-r--r--storage/xtradb/include/row0mysql.h5
-rw-r--r--storage/xtradb/include/srv0mon.h2
-rw-r--r--storage/xtradb/include/srv0srv.h4
-rw-r--r--storage/xtradb/include/sync0rw.h2
-rw-r--r--storage/xtradb/include/sync0sync.h2
-rw-r--r--storage/xtradb/include/univ.i4
-rw-r--r--storage/xtradb/lock/lock0lock.cc39
-rw-r--r--storage/xtradb/log/log0crypt.cc168
-rw-r--r--storage/xtradb/log/log0log.cc8
-rw-r--r--storage/xtradb/log/log0recv.cc59
-rw-r--r--storage/xtradb/mtr/mtr0log.cc2
-rw-r--r--storage/xtradb/mysql-test/storage_engine/type_spatial_indexes.rdiff4
-rw-r--r--storage/xtradb/os/os0file.cc11
-rw-r--r--storage/xtradb/os/os0sync.cc20
-rw-r--r--storage/xtradb/page/page0page.cc55
-rw-r--r--storage/xtradb/page/page0zip.cc128
-rw-r--r--storage/xtradb/pars/pars0pars.cc5
-rw-r--r--storage/xtradb/que/que0que.cc28
-rw-r--r--storage/xtradb/row/row0ftsort.cc84
-rw-r--r--storage/xtradb/row/row0import.cc14
-rw-r--r--storage/xtradb/row/row0ins.cc32
-rw-r--r--storage/xtradb/row/row0log.cc23
-rw-r--r--storage/xtradb/row/row0merge.cc531
-rw-r--r--storage/xtradb/row/row0mysql.cc218
-rw-r--r--storage/xtradb/row/row0sel.cc40
-rw-r--r--storage/xtradb/srv/srv0mon.cc10
-rw-r--r--storage/xtradb/srv/srv0srv.cc13
-rw-r--r--storage/xtradb/srv/srv0start.cc52
-rw-r--r--storage/xtradb/sync/sync0arr.cc8
-rw-r--r--storage/xtradb/sync/sync0sync.cc2
-rw-r--r--storage/xtradb/trx/trx0sys.cc4
-rw-r--r--storage/xtradb/trx/trx0trx.cc7
-rw-r--r--storage/xtradb/ut/ut0ut.cc2
-rw-r--r--strings/CMakeLists.txt2
-rw-r--r--strings/ctype-big5.c124
-rw-r--r--strings/ctype-bin.c9
-rw-r--r--strings/ctype-cp932.c137
-rw-r--r--strings/ctype-czech.c3
-rw-r--r--strings/ctype-euc_kr.c50
-rw-r--r--strings/ctype-eucjpms.c46
-rw-r--r--strings/ctype-gb2312.c46
-rw-r--r--strings/ctype-gbk.c125
-rw-r--r--strings/ctype-latin1.c3
-rw-r--r--strings/ctype-mb.c37
-rw-r--r--strings/ctype-mb.ic66
-rw-r--r--strings/ctype-simple.c29
-rw-r--r--strings/ctype-sjis.c137
-rw-r--r--strings/ctype-tis620.c3
-rw-r--r--strings/ctype-uca.c66
-rw-r--r--strings/ctype-ucs2.c827
-rw-r--r--strings/ctype-ujis.c46
-rw-r--r--strings/ctype-utf8.c717
-rw-r--r--strings/ctype-win1250ch.c3
-rw-r--r--strings/strcoll.ic275
-rw-r--r--support-files/CMakeLists.txt4
-rw-r--r--support-files/RHEL4-SElinux/mysql.fc41
-rw-r--r--support-files/RHEL4-SElinux/mysql.te147
-rw-r--r--support-files/compiler_warnings.supp17
-rw-r--r--support-files/policy/apparmor/README5
-rw-r--r--support-files/policy/apparmor/usr.sbin.mysqld150
-rw-r--r--support-files/policy/apparmor/usr.sbin.mysqld.local4
-rw-r--r--support-files/policy/selinux/README20
-rw-r--r--support-files/policy/selinux/mariadb-server.fc10
-rw-r--r--support-files/policy/selinux/mariadb-server.te99
-rw-r--r--support-files/rpm/enable_encryption.preset16
-rw-r--r--tests/mysql_client_test.c22
-rw-r--r--unittest/mysys/CMakeLists.txt5
-rw-r--r--unittest/mysys/aes-t.c99
-rw-r--r--unittest/mysys/my_getopt-t.c356
-rw-r--r--unittest/sql/CMakeLists.txt6
-rw-r--r--unittest/sql/mf_iocache-t.cc166
-rw-r--r--unittest/strings/strings-t.c670
-rw-r--r--vio/viosslfactories.c47
-rw-r--r--win/packaging/CMakeLists.txt1
-rw-r--r--win/packaging/CPackWixConfig.cmake1
-rw-r--r--win/packaging/ca/CMakeLists.txt6
2447 files changed, 98159 insertions, 33331 deletions
diff --git a/.gitattributes b/.gitattributes
index e2d8e1a836c..8aedbaa83d7 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -20,6 +20,9 @@ storage/connect/mysql-test/connect/std_data/*.dat binary
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
+*.frm binary
+*.MYD binary
+*.MYI binary
*.c diff=cpp
*.h diff=cpp
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d86004daa9c..6df6e736bbd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -401,7 +401,6 @@ IF(WIN32)
ADD_SUBDIRECTORY(win/upgrade_wizard)
ADD_SUBDIRECTORY(win/packaging)
ENDIF()
-ADD_SUBDIRECTORY(packaging/solaris)
INCLUDE(for_clients)
diff --git a/VERSION b/VERSION
index e5695b642a1..9188c7ea1d5 100644
--- a/VERSION
+++ b/VERSION
@@ -1,4 +1,4 @@
MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=1
-MYSQL_VERSION_PATCH=5
+MYSQL_VERSION_PATCH=8
MYSQL_VERSION_EXTRA=
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index c9045b6b41b..27b969f1036 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -1109,7 +1109,7 @@ int main(int argc, char **argv)
printf("This installation of MySQL is already upgraded to %s, "
"use --force if you still need to run mysql_upgrade\n",
MYSQL_SERVER_VERSION);
- die(NULL);
+ goto end;
}
if (opt_version_check && check_version_match())
@@ -1138,6 +1138,7 @@ int main(int argc, char **argv)
DBUG_ASSERT(phase == phases_total);
+end:
free_used_memory();
my_end(my_end_arg);
exit(0);
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 7a54a693cb4..587e5389860 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -2240,7 +2240,7 @@ static Exit_status check_header(IO_CACHE* file,
Format_description_log_event *new_description_event;
my_b_seek(file, tmp_pos); /* seek back to event's start */
if (!(new_description_event= (Format_description_log_event*)
- Log_event::read_log_event(file, glob_description_event,
+ Log_event::read_log_event(file, 0, glob_description_event,
opt_verify_binlog_checksum)))
/* EOF can't be hit here normally, so it's a real error */
{
@@ -2274,7 +2274,7 @@ static Exit_status check_header(IO_CACHE* file,
{
Log_event *ev;
my_b_seek(file, tmp_pos); /* seek back to event's start */
- if (!(ev= Log_event::read_log_event(file, glob_description_event,
+ if (!(ev= Log_event::read_log_event(file, 0, glob_description_event,
opt_verify_binlog_checksum)))
{
/* EOF can't be hit here normally, so it's a real error */
@@ -2388,7 +2388,7 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
char llbuff[21];
my_off_t old_off = my_b_tell(file);
- Log_event* ev = Log_event::read_log_event(file, glob_description_event,
+ Log_event* ev = Log_event::read_log_event(file, 0, glob_description_event,
opt_verify_binlog_checksum);
if (!ev)
{
@@ -2575,6 +2575,11 @@ void *sql_alloc(size_t size)
return alloc_root(&s_mem_root, size);
}
+struct encryption_service_st encryption_handler=
+{
+ 0, 0, 0, 0, 0, 0, 0
+};
+
/*
We must include this here as it's compiled with different options for
the server
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index 777790696ba..7fe38fba53e 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -54,6 +54,7 @@ static char *opt_plugin_dir= 0, *opt_default_auth= 0;
static int first_error = 0;
static char *opt_skip_database;
DYNAMIC_ARRAY tables4repair, tables4rebuild, alter_table_cmds;
+DYNAMIC_ARRAY views4repair;
static char *shared_memory_base_name=0;
static uint opt_protocol=0;
@@ -878,11 +879,19 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view)
switch (what_to_do) {
case DO_CHECK:
op = "CHECK";
- if (opt_quick) end = strmov(end, " QUICK");
- if (opt_fast) end = strmov(end, " FAST");
- if (opt_medium_check) end = strmov(end, " MEDIUM"); /* Default */
- if (opt_extended) end = strmov(end, " EXTENDED");
- if (opt_check_only_changed) end = strmov(end, " CHANGED");
+ if (view)
+ {
+ if (opt_fast || opt_check_only_changed)
+ DBUG_RETURN(0);
+ }
+ else
+ {
+ if (opt_quick) end = strmov(end, " QUICK");
+ if (opt_fast) end = strmov(end, " FAST");
+ if (opt_extended) end = strmov(end, " EXTENDED");
+ if (opt_medium_check) end = strmov(end, " MEDIUM"); /* Default */
+ if (opt_check_only_changed) end = strmov(end, " CHANGED");
+ }
if (opt_upgrade) end = strmov(end, " FOR UPGRADE");
break;
case DO_REPAIR:
@@ -967,6 +976,7 @@ static void print_result()
uint length_of_db;
uint i;
my_bool found_error=0, table_rebuild=0;
+ DYNAMIC_ARRAY *array4repair= &tables4repair;
DBUG_ENTER("print_result");
res = mysql_use_result(sock);
@@ -1003,9 +1013,10 @@ static void print_result()
else
{
char *table_name= prev + (length_of_db+1);
- insert_dynamic(&tables4repair, table_name);
+ insert_dynamic(array4repair, table_name);
}
}
+ array4repair= &tables4repair;
found_error=0;
table_rebuild=0;
prev_alter[0]= 0;
@@ -1021,8 +1032,11 @@ static void print_result()
we have to run upgrade on it. In this case we write a nicer message
than "Please do "REPAIR TABLE""...
*/
- if (!strcmp(row[2],"error") && strstr(row[3],"REPAIR TABLE"))
+ if (!strcmp(row[2],"error") && strstr(row[3],"REPAIR "))
+ {
printf("%-50s %s", row[0], "Needs upgrade");
+ array4repair= strstr(row[3], "VIEW") ? &views4repair : &tables4repair;
+ }
else
printf("%s\n%-9s: %s", row[0], row[2], row[3]);
if (opt_auto_repair && strcmp(row[2],"note"))
@@ -1053,7 +1067,7 @@ static void print_result()
else
{
char *table_name= prev + (length_of_db+1);
- insert_dynamic(&tables4repair, table_name);
+ insert_dynamic(array4repair, table_name);
}
}
mysql_free_result(res);
@@ -1173,6 +1187,8 @@ int main(int argc, char **argv)
if (opt_auto_repair &&
(my_init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16,
64, MYF(0)) ||
+ my_init_dynamic_array(&views4repair, sizeof(char)*(NAME_LEN*2+2),16,
+ 64, MYF(0)) ||
my_init_dynamic_array(&tables4rebuild, sizeof(char)*(NAME_LEN*2+2),16,
64, MYF(0)) ||
my_init_dynamic_array(&alter_table_cmds, MAX_ALTER_STR_SIZE, 0, 1,
@@ -1203,6 +1219,13 @@ int main(int argc, char **argv)
rebuild_table((char*) dynamic_array_ptr(&tables4rebuild, i));
for (i = 0; i < alter_table_cmds.elements ; i++)
run_query((char*) dynamic_array_ptr(&alter_table_cmds, i), 1);
+ if (!opt_silent && views4repair.elements)
+ puts("\nRepairing views");
+ for (i = 0; i < views4repair.elements ; i++)
+ {
+ char *name= (char*) dynamic_array_ptr(&views4repair, i);
+ handle_request_for_tables(name, fixed_name_length(name), TRUE);
+ }
}
ret= MY_TEST(first_error);
@@ -1210,8 +1233,10 @@ int main(int argc, char **argv)
dbDisconnect(current_host);
if (opt_auto_repair)
{
+ delete_dynamic(&views4repair);
delete_dynamic(&tables4repair);
delete_dynamic(&tables4rebuild);
+ delete_dynamic(&alter_table_cmds);
}
end1:
my_free(opt_password);
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 62515161e30..05ef70a9fa4 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -97,7 +97,7 @@ static ulong find_set(TYPELIB *lib, const char *x, uint length,
static char *alloc_query_str(ulong size);
static void field_escape(DYNAMIC_STRING* in, const char *from);
-static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0,
+static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0, opt_no_data_med= 1,
quick= 1, extended_insert= 1,
lock_tables=1,ignore_errors=0,flush_logs=0,flush_privileges=0,
opt_drop=1,opt_keywords=0,opt_lock=1,opt_compress=0,
@@ -203,6 +203,8 @@ const char *compatible_mode_names[]=
TYPELIB compatible_mode_typelib= {array_elements(compatible_mode_names) - 1,
"", compatible_mode_names, NULL};
+#define MED_ENGINES "MRG_MyISAM, MRG_ISAM, CONNECT, OQGRAPH, SPIDER, VP, FEDERATED"
+
HASH ignore_table;
static struct my_option my_long_options[] =
@@ -431,6 +433,9 @@ static struct my_option my_long_options[] =
NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-data", 'd', "No row information.", &opt_no_data,
&opt_no_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"no-data-med", 0, "No row information for engines that "
+ "Manage External Data (" MED_ENGINES ").", &opt_no_data_med,
+ &opt_no_data_med, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"no-set-names", 'N', "Same as --skip-set-charset.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"opt", OPT_OPTIMIZE,
@@ -5506,12 +5511,12 @@ char check_if_ignore_table(const char *table_name, char *table_type)
/*
If these two types, we do want to skip dumping the table
*/
- if (!opt_no_data &&
- (!my_strcasecmp(&my_charset_latin1, table_type, "MRG_MyISAM") ||
- !strcmp(table_type,"MRG_ISAM") ||
- !strcmp(table_type,"CONNECT") ||
- !strcmp(table_type,"FEDERATED")))
- result= IGNORE_DATA;
+ if (!opt_no_data && opt_no_data_med)
+ {
+ const char *found= strstr(" " MED_ENGINES ",", table_type);
+ if (found && found[-1] == ' ' && found[strlen(table_type)] == ',')
+ result= IGNORE_DATA;
+ }
}
mysql_free_result(res);
DBUG_RETURN(result);
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index 0d4ee549c4f..cf1df1e95d8 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -36,7 +36,7 @@
/* Global Thread counter */
-uint counter;
+uint counter= 0;
pthread_mutex_t counter_mutex;
pthread_cond_t count_threshhold;
@@ -489,6 +489,11 @@ static void safe_exit(int error, MYSQL *mysql)
{
if (error && ignore_errors)
return;
+
+ /* in multi-threaded mode protect from concurrent safe_exit's */
+ if (counter)
+ pthread_mutex_lock(&counter_mutex);
+
if (mysql)
mysql_close(mysql);
diff --git a/client/mysqlslap.c b/client/mysqlslap.c
index b67e409ef0b..f12ea4c2086 100644
--- a/client/mysqlslap.c
+++ b/client/mysqlslap.c
@@ -1,5 +1,6 @@
/*
- Copyright (c) 2005, 2012, Oracle and/or its affiliates.
+ Copyright (c) 2005, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2010, 2015, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -242,7 +243,7 @@ void print_conclusions_csv(conclusions *con);
void generate_stats(conclusions *con, option_string *eng, stats *sptr);
uint parse_comma(const char *string, uint **range);
uint parse_delimiter(const char *script, statement **stmt, char delm);
-uint parse_option(const char *origin, option_string **stmt, char delm);
+int parse_option(const char *origin, option_string **stmt, char delm);
static int drop_schema(MYSQL *mysql, const char *db);
uint get_random_string(char *buf);
static statement *build_table_string(void);
@@ -1264,7 +1265,13 @@ get_options(int *argc,char ***argv)
if (num_int_cols_opt)
{
option_string *str;
- parse_option(num_int_cols_opt, &str, ',');
+ if(parse_option(num_int_cols_opt, &str, ',') == -1)
+ {
+ fprintf(stderr, "Invalid value specified for the option "
+ "'number-int-cols'\n");
+ option_cleanup(str);
+ return 1;
+ }
num_int_cols= atoi(str->string);
if (str->option)
num_int_cols_index= atoi(str->option);
@@ -1275,7 +1282,13 @@ get_options(int *argc,char ***argv)
if (num_char_cols_opt)
{
option_string *str;
- parse_option(num_char_cols_opt, &str, ',');
+ if(parse_option(num_char_cols_opt, &str, ',') == -1)
+ {
+ fprintf(stderr, "Invalid value specified for the option "
+ "'number-char-cols'\n");
+ option_cleanup(str);
+ return 1;
+ }
num_char_cols= atoi(str->string);
if (str->option)
num_char_cols_index= atoi(str->option);
@@ -1512,7 +1525,13 @@ get_options(int *argc,char ***argv)
printf("Parsing engines to use.\n");
if (default_engine)
- parse_option(default_engine, &engine_options, ',');
+ {
+ if(parse_option(default_engine, &engine_options, ',') == -1)
+ {
+ fprintf(stderr, "Invalid value specified for the option 'engine'\n");
+ return 1;
+ }
+ }
if (tty_password)
opt_password= get_tty_password(NullS);
@@ -1989,7 +2008,7 @@ end:
DBUG_RETURN(0);
}
-uint
+int
parse_option(const char *origin, option_string **stmt, char delm)
{
char *retstr;
@@ -2014,6 +2033,13 @@ parse_option(const char *origin, option_string **stmt, char delm)
char buffer[HUGE_STRING_LENGTH]= "";
char *buffer_ptr;
+ /*
+ Return an error if the length of the any of the comma seprated value
+ exceeds HUGE_STRING_LENGTH.
+ */
+ if ((size_t)(retstr - ptr) > HUGE_STRING_LENGTH)
+ return -1;
+
count++;
strncpy(buffer, ptr, (size_t)(retstr - ptr));
/*
@@ -2053,6 +2079,13 @@ parse_option(const char *origin, option_string **stmt, char delm)
{
char *origin_ptr;
+ /*
+ Return an error if the length of the any of the comma seprated value
+ exceeds HUGE_STRING_LENGTH.
+ */
+ if (strlen(ptr) > HUGE_STRING_LENGTH)
+ return -1;
+
if ((origin_ptr= strchr(ptr, ':')))
{
char *option_ptr;
@@ -2063,13 +2096,13 @@ parse_option(const char *origin, option_string **stmt, char delm)
option_ptr= (char *)ptr + 1 + tmp->length;
/* Move past the : and the first string */
- tmp->option_length= (size_t)((ptr + length) - option_ptr);
+ tmp->option_length= strlen(option_ptr);
tmp->option= my_strndup(option_ptr, tmp->option_length,
MYF(MY_FAE));
}
else
{
- tmp->length= (size_t)((ptr + length) - ptr);
+ tmp->length= strlen(ptr);
tmp->string= my_strndup(ptr, tmp->length, MYF(MY_FAE));
}
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index cc4f32c9370..c6144d9c5e4 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -33,7 +33,7 @@
And many others
*/
-#define MTEST_VERSION "3.4"
+#define MTEST_VERSION "3.5"
#include "client_priv.h"
#include <mysql_version.h>
@@ -121,7 +121,7 @@ static my_bool tty_password= 0;
static my_bool opt_mark_progress= 0;
static my_bool ps_protocol= 0, ps_protocol_enabled= 0;
static my_bool sp_protocol= 0, sp_protocol_enabled= 0;
-static my_bool view_protocol= 0, view_protocol_enabled= 0;
+static my_bool view_protocol= 0, view_protocol_enabled= 0, wait_longer= 0;
static my_bool cursor_protocol= 0, cursor_protocol_enabled= 0;
static my_bool parsing_disabled= 0;
static my_bool display_result_vertically= FALSE, display_result_lower= FALSE,
@@ -839,6 +839,7 @@ static void handle_no_active_connection(struct st_command* command,
#define EMB_END_CONNECTION 3
#define EMB_PREPARE_STMT 4
#define EMB_EXECUTE_STMT 5
+#define EMB_CLOSE_STMT 6
/* workaround for MySQL BUG#57491 */
#undef MY_WME
@@ -887,6 +888,9 @@ pthread_handler_t connection_thread(void *arg)
case EMB_EXECUTE_STMT:
cn->result= mysql_stmt_execute(cn->stmt);
break;
+ case EMB_CLOSE_STMT:
+ cn->result= mysql_stmt_close(cn->stmt);
+ break;
default:
DBUG_ASSERT(0);
}
@@ -984,6 +988,17 @@ static int do_stmt_execute(struct st_connection *cn)
}
+static int do_stmt_close(struct st_connection *cn)
+{
+ /* The cn->stmt is already set. */
+ if (!cn->has_thread)
+ return mysql_stmt_close(cn->stmt);
+ signal_connection_thd(cn, EMB_CLOSE_STMT);
+ wait_query_thread_done(cn);
+ return cn->result;
+}
+
+
static void emb_close_connection(struct st_connection *cn)
{
if (!cn->has_thread)
@@ -1019,6 +1034,7 @@ static void init_connection_thd(struct st_connection *cn)
#define do_read_query_result(cn) mysql_read_query_result(cn->mysql)
#define do_stmt_prepare(cn, q, q_len) mysql_stmt_prepare(cn->stmt, q, q_len)
#define do_stmt_execute(cn) mysql_stmt_execute(cn->stmt)
+#define do_stmt_close(cn) mysql_stmt_close(cn->stmt)
#endif /*EMBEDDED_LIBRARY*/
@@ -1378,11 +1394,11 @@ void close_connections()
DBUG_ENTER("close_connections");
for (--next_con; next_con >= connections; --next_con)
{
+ if (next_con->stmt)
+ do_stmt_close(next_con);
#ifdef EMBEDDED_LIBRARY
emb_close_connection(next_con);
#endif
- if (next_con->stmt)
- mysql_stmt_close(next_con->stmt);
next_con->stmt= 0;
mysql_close(next_con->mysql);
next_con->mysql= 0;
@@ -4641,7 +4657,7 @@ void do_sync_with_master2(struct st_command *command, long offset,
MYSQL_ROW row;
MYSQL *mysql= cur_con->mysql;
char query_buf[FN_REFLEN+128];
- int timeout= 300; /* seconds */
+ int timeout= wait_longer ? 1500 : 300; /* seconds */
if (!master_pos.file[0])
die("Calling 'sync_with_master' without calling 'save_master_pos'");
@@ -4995,7 +5011,7 @@ static int my_kill(int pid, int sig)
void do_shutdown_server(struct st_command *command)
{
- long timeout=60;
+ long timeout= wait_longer ? 60*5 : 60;
int pid;
DYNAMIC_STRING ds_pidfile_name;
MYSQL* mysql = cur_con->mysql;
@@ -5064,7 +5080,6 @@ void do_shutdown_server(struct st_command *command)
(void)my_kill(pid, 9);
DBUG_VOID_RETURN;
-
}
@@ -5491,7 +5506,11 @@ void do_close_connection(struct st_command *command)
con->mysql->net.vio = 0;
}
}
-#else
+#endif /*!EMBEDDED_LIBRARY*/
+ if (con->stmt)
+ do_stmt_close(con);
+ con->stmt= 0;
+#ifdef EMBEDDED_LIBRARY
/*
As query could be still executed in a separate theread
we need to check if the query's thread was finished and probably wait
@@ -5499,9 +5518,6 @@ void do_close_connection(struct st_command *command)
*/
emb_close_connection(con);
#endif /*EMBEDDED_LIBRARY*/
- if (con->stmt)
- mysql_stmt_close(con->stmt);
- con->stmt= 0;
mysql_close(con->mysql);
con->mysql= 0;
@@ -6936,6 +6952,9 @@ static struct my_option my_long_options[] =
"Number of seconds before connection timeout.",
&opt_connect_timeout, &opt_connect_timeout, 0, GET_UINT, REQUIRED_ARG,
120, 0, 3600 * 12, 0, 0, 0},
+ {"wait-longer-for-timeouts", 0,
+ "Wait longer for timeouts. Useful when running under valgrind",
+ &wait_longer, &wait_longer, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"plugin_dir", 0, "Directory for client-side plugins.",
&opt_plugin_dir, &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
diff --git a/cmake/abi_check.cmake b/cmake/abi_check.cmake
index 8a7e14b6f2d..02124ae7ba1 100644
--- a/cmake/abi_check.cmake
+++ b/cmake/abi_check.cmake
@@ -28,7 +28,7 @@ ELSE()
SET(RUN_ABI_CHECK 0)
ENDIF()
-IF(CMAKE_COMPILER_IS_GNUCC AND RUN_ABI_CHECK)
+IF(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang" AND RUN_ABI_CHECK)
IF(CMAKE_C_COMPILER MATCHES "ccache$")
SET(COMPILER ${CMAKE_C_COMPILER_ARG1})
STRING(REGEX REPLACE "^ " "" COMPILER ${COMPILER})
diff --git a/cmake/check_compiler_flag.cmake b/cmake/check_compiler_flag.cmake
index 4a029659f43..303d5d8d3c8 100644
--- a/cmake/check_compiler_flag.cmake
+++ b/cmake/check_compiler_flag.cmake
@@ -9,11 +9,13 @@ SET(fail_patterns
FAIL_REGEX "unrecognized .*option"
FAIL_REGEX "ignoring unknown option"
FAIL_REGEX "warning:.*ignored"
+ FAIL_REGEX "warning:.*is valid for.*but not for"
FAIL_REGEX "warning:.*redefined"
FAIL_REGEX "[Ww]arning: [Oo]ption"
)
-MACRO (MY_CHECK_C_COMPILER_FLAG flag result)
+MACRO (MY_CHECK_C_COMPILER_FLAG flag)
+ STRING(REGEX REPLACE "[-,= ]" "_" result "HAVE_C_${flag}")
SET(SAVE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}")
CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${result}
@@ -21,7 +23,8 @@ MACRO (MY_CHECK_C_COMPILER_FLAG flag result)
SET(CMAKE_REQUIRED_FLAGS "${SAVE_CMAKE_REQUIRED_FLAGS}")
ENDMACRO()
-MACRO (MY_CHECK_CXX_COMPILER_FLAG flag result)
+MACRO (MY_CHECK_CXX_COMPILER_FLAG flag)
+ STRING(REGEX REPLACE "[-,= ]" "_" result "HAVE_CXX_${flag}")
SET(SAVE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}")
CHECK_CXX_SOURCE_COMPILES("int main(void) { return 0; }" ${result}
@@ -35,10 +38,11 @@ FUNCTION(MY_CHECK_AND_SET_COMPILER_FLAG flag)
IF(WIN32)
RETURN()
ENDIF()
- MY_CHECK_C_COMPILER_FLAG(${flag} HAVE_C_${flag})
- MY_CHECK_CXX_COMPILER_FLAG(${flag} HAVE_CXX_${flag})
+ MY_CHECK_C_COMPILER_FLAG(${flag})
+ MY_CHECK_CXX_COMPILER_FLAG(${flag})
+ STRING(REGEX REPLACE "[-,= ]" "_" result "${flag}")
FOREACH(lang C CXX)
- IF (HAVE_${lang}_${flag})
+ IF (HAVE_${lang}_${result})
IF(ARGN)
FOREACH(type ${ARGN})
SET(CMAKE_${lang}_FLAGS_${type} "${CMAKE_${lang}_FLAGS_${type}} ${flag}" PARENT_SCOPE)
diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake
index 4ca5863c6a7..1b5183345f6 100644
--- a/cmake/cpack_rpm.cmake
+++ b/cmake/cpack_rpm.cmake
@@ -21,11 +21,12 @@ SET(CPACK_COMPONENT_MANPAGESCLIENT_GROUP "client")
SET(CPACK_COMPONENT_README_GROUP "server")
SET(CPACK_COMPONENT_SHAREDLIBRARIES_GROUP "shared")
SET(CPACK_COMPONENT_COMMON_GROUP "common")
+SET(CPACK_COMPONENT_CLIENTPLUGINS_GROUP "common")
SET(CPACK_COMPONENT_COMPAT_GROUP "compat")
SET(CPACK_COMPONENTS_ALL Server ManPagesServer IniFiles Server_Scripts
SupportFiles Development ManPagesDevelopment
ManPagesTest Readme ManPagesClient Test
- Common Client SharedLibraries)
+ Common Client SharedLibraries ClientPlugins)
SET(CPACK_RPM_PACKAGE_NAME ${CPACK_PACKAGE_NAME})
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${VERSION}-${RPM}-${CMAKE_SYSTEM_PROCESSOR}")
diff --git a/cmake/do_abi_check.cmake b/cmake/do_abi_check.cmake
index c831aaf8b52..c0ffce353f3 100644
--- a/cmake/do_abi_check.cmake
+++ b/cmake/do_abi_check.cmake
@@ -58,7 +58,7 @@ FOREACH(file ${ABI_HEADERS})
EXECUTE_PROCESS(
COMMAND ${COMPILER}
- -E -nostdinc -dI -DMYSQL_ABI_CHECK -I${SOURCE_DIR}/include
+ -E -nostdinc -DMYSQL_ABI_CHECK -I${SOURCE_DIR}/include
-I${BINARY_DIR}/include -I${SOURCE_DIR}/include/mysql -I${SOURCE_DIR}/sql
${file}
ERROR_QUIET OUTPUT_FILE ${tmpfile})
diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake
index 8fcfe294f17..636737b2083 100644
--- a/cmake/libutils.cmake
+++ b/cmake/libutils.cmake
@@ -308,17 +308,15 @@ INCLUDE(CheckCCompilerFlag)
SET(VISIBILITY_HIDDEN_FLAG)
-IF(CMAKE_COMPILER_IS_GNUCXX AND UNIX)
+IF(CMAKE_C_COMPILER_ID MATCHES "SunPro")
+ SET(VISIBILITY_HIDDEN_FLAG "-xldscope=hidden")
+ELSEIF(UNIX)
CHECK_C_COMPILER_FLAG("-fvisibility=hidden" HAVE_VISIBILITY_HIDDEN)
IF(HAVE_VISIBILITY_HIDDEN)
SET(VISIBILITY_HIDDEN_FLAG "-fvisibility=hidden")
ENDIF()
ENDIF()
-IF(CMAKE_C_COMPILER_ID MATCHES "SunPro")
- SET(VISIBILITY_HIDDEN_FLAG "-xldscope=hidden")
-ENDIF()
-
# We try to hide the symbols in yassl/zlib to avoid name clashes with
# other libraries like openssl.
FUNCTION(RESTRICT_SYMBOL_EXPORTS target)
diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake
index d905ec189ae..24547103b63 100644
--- a/cmake/maintainer.cmake
+++ b/cmake/maintainer.cmake
@@ -15,8 +15,8 @@
# Common warning flags for GCC, G++, Clang and Clang++
SET(MY_WARNING_FLAGS "-Wall -Wextra -Wformat-security -Wno-init-self")
-MY_CHECK_C_COMPILER_FLAG("-Wvla" HAVE_WVLA) # Requires GCC 4.3+ or Clang
-IF(HAVE_WVLA)
+MY_CHECK_C_COMPILER_FLAG("-Wvla") # Requires GCC 4.3+ or Clang
+IF(HAVE_C__Wvla)
SET(MY_WARNING_FLAGS "${MY_WARNING_FLAGS} -Wvla")
ENDIF()
@@ -41,11 +41,11 @@ IF(MYSQL_MAINTAINER_MODE MATCHES "ERR")
ENDIF()
# Set warning flags for GCC/Clang
-IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
+IF(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
SET(MY_MAINTAINER_C_WARNINGS "${MY_C_WARNING_FLAGS}")
ENDIF()
# Set warning flags for G++/Clang++
-IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
SET(MY_MAINTAINER_CXX_WARNINGS "${MY_CXX_WARNING_FLAGS}")
ENDIF()
diff --git a/cmake/make_dist.cmake.in b/cmake/make_dist.cmake.in
index c561baaa415..f35d16834b6 100644
--- a/cmake/make_dist.cmake.in
+++ b/cmake/make_dist.cmake.in
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2015, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -60,9 +60,9 @@ IF(NOT GIT_EXECUTABLE)
# Save bison output first.
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.cc
- ${CMAKE_BINARY_DIR}/sql_yacc.cc COPY_ONLY)
+ ${CMAKE_BINARY_DIR}/sql_yacc.cc COPYONLY)
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.h
- ${CMAKE_BINARY_DIR}/sql_yacc.h COPY_ONLY)
+ ${CMAKE_BINARY_DIR}/sql_yacc.h COPYONLY)
IF(CMAKE_GENERATOR MATCHES "Makefiles")
# make clean
@@ -74,9 +74,9 @@ IF(NOT GIT_EXECUTABLE)
# Restore bison output
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql_yacc.cc
- ${CMAKE_BINARY_DIR}/sql/sql_yacc.cc COPY_ONLY)
+ ${CMAKE_BINARY_DIR}/sql/sql_yacc.cc COPYONLY)
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql_yacc.h
- ${CMAKE_BINARY_DIR}/sql/sql_yacc.h COPY_ONLY)
+ ${CMAKE_BINARY_DIR}/sql/sql_yacc.h COPYONLY)
FILE(REMOVE ${CMAKE_BINARY_DIR}/sql_yacc.cc)
FILE(REMOVE ${CMAKE_BINARY_DIR}/sql_yacc.h)
ENDIF()
diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake
index c47cacbd9a5..b043b174e78 100644
--- a/cmake/os/WindowsCache.cmake
+++ b/cmake/os/WindowsCache.cmake
@@ -352,7 +352,6 @@ SET(C_HAS___inline 1 CACHE INTERNAL "")
SET(FIONREAD_IN_SYS_IOCTL CACHE INTERNAL "")
SET(FIONREAD_IN_SYS_FILIO CACHE INTERNAL "")
SET(GWINSZ_IN_SYS_IOCTL CACHE INTERNAL "")
-SET(HAVE_CXXABI_H CACHE INTERNAL "")
SET(HAVE_NDIR_H CACHE INTERNAL "")
SET(HAVE_SYS_NDIR_H CACHE INTERNAL "")
SET(HAVE_SYS_NDIR_H CACHE INTERNAL "")
@@ -371,4 +370,8 @@ SET(HAVE_SYS_UTSNAME_H CACHE INTERNAL "")
SET(HAVE_PTHREAD_ATTR_GETGUARDSIZE CACHE INTERNAL "")
SET(HAVE_UCONTEXT_H CACHE INTERNAL "")
SET(HAVE_SOCKPEERCRED CACHE INTERNAL "")
+SET(HAVE_ABI_CXA_DEMANGLE CACHE INTERNAL "")
+SET(HAVE_GCC_ATOMIC_BUILTINS CACHE INTERNAL "")
+SET(HAVE_GCC_C11_ATOMICS CACHE INTERNAL "")
+SET(HAVE_VISIBILITY_HIDDEN CACHE INTERNAL "")
ENDIF(MSVC)
diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake
index 1926f8b1b8e..802cc2c32ee 100644
--- a/cmake/ssl.cmake
+++ b/cmake/ssl.cmake
@@ -147,7 +147,6 @@ MACRO (MYSQL_CHECK_SSL)
IF (WITH_SSL_PATH)
LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
ENDIF()
- MESSAGE(STATUS "suffixes <${CMAKE_FIND_LIBRARY_SUFFIXES}>")
FIND_LIBRARY(OPENSSL_LIBRARIES
NAMES ssl ssleay32 ssleay32MD
HINTS ${OPENSSL_ROOT_DIR}/lib)
diff --git a/config.h.cmake b/config.h.cmake
index 6d90bf565c6..066ddacfbf3 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -27,7 +27,6 @@
#cmakedefine HAVE_BSEARCH 1
#cmakedefine HAVE_CRYPT_H 1
#cmakedefine HAVE_CURSES_H 1
-#cmakedefine HAVE_CXXABI_H 1
#cmakedefine HAVE_BFD_H 1
#cmakedefine HAVE_NCURSES_H 1
#cmakedefine HAVE_NDIR_H 1
@@ -88,6 +87,7 @@
#cmakedefine HAVE_SYS_UTSNAME_H 1
#cmakedefine HAVE_SYS_STAT_H 1
#cmakedefine HAVE_SYS_STREAM_H 1
+#cmakedefine HAVE_SYS_SYSCALL_H 1
#cmakedefine HAVE_SYS_TERMCAP_H 1
#cmakedefine HAVE_SYS_TIMEB_H 1
#cmakedefine HAVE_SYS_TIMES_H 1
@@ -205,7 +205,7 @@
#cmakedefine HAVE_MADVISE 1
#cmakedefine HAVE_DECL_MADVISE 1
#cmakedefine HAVE_DECL_TGOTO 1
-#cmakedefine HAVE_DECL_MHA_MAPSIZE_VA
+#cmakedefine HAVE_DECL_MHA_MAPSIZE_VA 1
#cmakedefine HAVE_MALLINFO 1
#cmakedefine HAVE_MEMCPY 1
#cmakedefine HAVE_MEMMOVE 1
@@ -400,7 +400,7 @@
#cmakedefine SOCKET_SIZE_TYPE @SOCKET_SIZE_TYPE@
-#cmakedefine HAVE_MBSTATE_T
+#cmakedefine HAVE_MBSTATE_T 1
#define MAX_INDEXES 64
@@ -435,15 +435,15 @@
#cmakedefine HAVE_WCTYPE_H 1
#cmakedefine HAVE_WCHAR_H 1
#cmakedefine HAVE_LANGINFO_H 1
-#cmakedefine HAVE_MBRLEN
-#cmakedefine HAVE_MBSCMP
-#cmakedefine HAVE_MBSRTOWCS
-#cmakedefine HAVE_WCRTOMB
-#cmakedefine HAVE_MBRTOWC
-#cmakedefine HAVE_WCSCOLL
-#cmakedefine HAVE_WCSDUP
-#cmakedefine HAVE_WCWIDTH
-#cmakedefine HAVE_WCTYPE
+#cmakedefine HAVE_MBRLEN 1
+#cmakedefine HAVE_MBSCMP 1
+#cmakedefine HAVE_MBSRTOWCS 1
+#cmakedefine HAVE_WCRTOMB 1
+#cmakedefine HAVE_MBRTOWC 1
+#cmakedefine HAVE_WCSCOLL 1
+#cmakedefine HAVE_WCSDUP 1
+#cmakedefine HAVE_WCWIDTH 1
+#cmakedefine HAVE_WCTYPE 1
#cmakedefine HAVE_ISWLOWER 1
#cmakedefine HAVE_ISWUPPER 1
#cmakedefine HAVE_TOWLOWER 1
@@ -457,7 +457,7 @@
#cmakedefine HAVE_STRCASECMP 1
#cmakedefine HAVE_STRNCASECMP 1
#cmakedefine HAVE_STRDUP 1
-#cmakedefine HAVE_LANGINFO_CODESET
+#cmakedefine HAVE_LANGINFO_CODESET 1
#cmakedefine HAVE_TCGETATTR 1
#cmakedefine HAVE_FLOCKFILE 1
@@ -475,6 +475,7 @@
#cmakedefine MY_ATOMIC_MODE_DUMMY 1
#cmakedefine HAVE_GCC_ATOMIC_BUILTINS 1
+#cmakedefine HAVE_GCC_C11_ATOMICS 1
#cmakedefine HAVE_SOLARIS_ATOMIC 1
#cmakedefine HAVE_DECL_SHM_HUGETLB 1
#cmakedefine HAVE_LARGE_PAGES 1
diff --git a/configure.cmake b/configure.cmake
index 22a5d59bfb1..5efd0f5c14b 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -52,7 +52,7 @@ IF(NOT SYSTEM_TYPE)
ENDIF()
ENDIF()
-IF(CMAKE_COMPILER_IS_GNUCXX)
+IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
# MySQL "canonical" GCC flags. At least -fno-rtti flag affects
# ABI and cannot be simply removed.
SET(CMAKE_CXX_FLAGS
@@ -175,7 +175,6 @@ CHECK_INCLUDE_FILES (alloca.h HAVE_ALLOCA_H)
CHECK_INCLUDE_FILES (aio.h HAVE_AIO_H)
CHECK_INCLUDE_FILES (arpa/inet.h HAVE_ARPA_INET_H)
CHECK_INCLUDE_FILES (crypt.h HAVE_CRYPT_H)
-CHECK_INCLUDE_FILE_CXX (cxxabi.h HAVE_CXXABI_H)
CHECK_INCLUDE_FILES (dirent.h HAVE_DIRENT_H)
CHECK_INCLUDE_FILES (dlfcn.h HAVE_DLFCN_H)
CHECK_INCLUDE_FILES (execinfo.h HAVE_EXECINFO_H)
@@ -229,6 +228,7 @@ CHECK_INCLUDE_FILES ("sys/types.h;sys/shm.h" HAVE_SYS_SHM_H)
CHECK_INCLUDE_FILES (sys/socket.h HAVE_SYS_SOCKET_H)
CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILES (sys/stream.h HAVE_SYS_STREAM_H)
+CHECK_INCLUDE_FILES (sys/syscall.h HAVE_SYS_SYSCALL_H)
CHECK_INCLUDE_FILES (sys/termcap.h HAVE_SYS_TERMCAP_H)
CHECK_INCLUDE_FILES ("curses.h;term.h" HAVE_TERM_H)
CHECK_INCLUDE_FILES (asm/termbits.h HAVE_ASM_TERMBITS_H)
@@ -275,8 +275,8 @@ ENDIF()
FIND_PACKAGE (Threads)
FUNCTION(MY_CHECK_PTHREAD_ONCE_INIT)
- CHECK_C_COMPILER_FLAG("-Werror" HAVE_WERROR_FLAG)
- IF(NOT HAVE_WERROR_FLAG)
+ MY_CHECK_C_COMPILER_FLAG("-Werror")
+ IF(NOT HAVE_C__Werror)
RETURN()
ENDIF()
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror")
@@ -320,6 +320,7 @@ ENDIF()
#
# Tests for functions
#
+CHECK_FUNCTION_EXISTS (accept4 HAVE_ACCEPT4)
CHECK_FUNCTION_EXISTS (access HAVE_ACCESS)
#CHECK_FUNCTION_EXISTS (aiowait HAVE_AIOWAIT)
CHECK_FUNCTION_EXISTS (aio_read HAVE_AIO_READ)
@@ -880,7 +881,7 @@ ENDIF(NOT HAVE_POSIX_SIGNALS)
# Assume regular sprintf
SET(SPRINTFS_RETURNS_INT 1)
-IF(CMAKE_COMPILER_IS_GNUCXX AND HAVE_CXXABI_H)
+IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
CHECK_CXX_SOURCE_COMPILES("
#include <cxxabi.h>
int main(int argc, char **argv)
@@ -952,7 +953,6 @@ SET(SIGNAL_WITH_VIO_CLOSE 1)
MARK_AS_ADVANCED(NO_ALARM)
-IF(CMAKE_COMPILER_IS_GNUCXX)
IF(WITH_ATOMIC_OPS STREQUAL "up")
SET(MY_ATOMIC_MODE_DUMMY 1 CACHE BOOL "Assume single-CPU mode, no concurrency")
ELSEIF(WITH_ATOMIC_OPS STREQUAL "smp")
@@ -981,10 +981,17 @@ ELSEIF(NOT WITH_ATOMIC_OPS)
return 0;
}"
HAVE_GCC_ATOMIC_BUILTINS)
+ CHECK_CXX_SOURCE_COMPILES("
+ int main()
+ {
+ long long int var= 1;
+ long long int *ptr= &var;
+ return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST);
+ }"
+ HAVE_GCC_C11_ATOMICS)
ELSE()
MESSAGE(FATAL_ERROR "${WITH_ATOMIC_OPS} is not a valid value for WITH_ATOMIC_OPS!")
ENDIF()
-ENDIF()
SET(WITH_ATOMIC_OPS "${WITH_ATOMIC_OPS}" CACHE STRING "Implement atomic operations using atomic CPU instructions for multi-processor (smp) or uniprocessor (up) configuration. By default gcc built-in sync functions are used, if available and 'smp' configuration otherwise.")
MARK_AS_ADVANCED(WITH_ATOMIC_OPS MY_ATOMIC_MODE_DUMMY)
diff --git a/debian/additions/mysqld_safe_syslog.cnf b/debian/additions/mysqld_safe_syslog.cnf
index 3b0445d6bd8..08984c1716b 100644
--- a/debian/additions/mysqld_safe_syslog.cnf
+++ b/debian/additions/mysqld_safe_syslog.cnf
@@ -1,2 +1,3 @@
[mysqld_safe]
+skip_log_error
syslog
diff --git a/debian/dist/Debian/control b/debian/dist/Debian/control
index 9e8091f7158..3c481a2ac61 100644
--- a/debian/dist/Debian/control
+++ b/debian/dist/Debian/control
@@ -4,7 +4,13 @@ Priority: optional
Maintainer: MariaDB Developers <maria-developers@lists.launchpad.net>
XSBC-Original-Maintainer: Maria Developers <maria-developers@lists.launchpad.net>
Uploaders: MariaDB Developers <maria-developers@lists.launchpad.net>
-Build-Depends: libtool (>= 1.4.2-7), procps | hurd, debhelper, file (>= 3.28), libncurses5-dev (>= 5.0-6), perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV}, libssl-dev, libpam0g-dev, psmisc, po-debconf, chrpath, automake1.9, doxygen, texlive-latex-base, ghostscript | gs-gpl, dpatch, gawk, bison, lsb-release, hardening-wrapper, cmake (>= 2.7), libaio-dev, ${MAYBE_LIBCRACK} libjemalloc-dev (>= 3.0.0)
+Build-Depends: procps | hurd, debhelper, libncurses5-dev (>= 5.0-6),
+ perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3),
+ zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV}, libssl-dev,
+ libpam0g-dev, psmisc, po-debconf, chrpath,
+ dpatch, gawk, bison, lsb-release, hardening-wrapper,
+ cmake (>= 2.7), libaio-dev, ${MAYBE_LIBCRACK}
+ libjemalloc-dev (>= 3.0.0)
Standards-Version: 3.8.3
Homepage: http://mariadb.org/
Vcs-Browser: https://github.com/MariaDB/server/tree/10.1/
@@ -16,7 +22,9 @@ Architecture: any
Depends: mariadb-common, libmysqlclient18 (= ${source:Version}), ${shlibs:Depends}, ${misc:Depends}
Conflicts: mariadb-server-10.0 (<< 10.0.5), mariadb-galera-server-10.0 (<< 10.0.5),
mariadb-server-5.5 (<< 5.5.33), mariadb-galera-server-5.5 (<< 5.5.33),
- mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3
+ mariadb-server-5.1,
+ mariadb-server-5.2,
+ mariadb-server-5.3
Description: MariaDB database client library
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
@@ -105,13 +113,15 @@ Conflicts: mysql-client (<< 5.0.51), mysql-client-5.0,
mysql-client-core-5.1, mysql-client-core-5.5,
mariadb-client-5.1, mariadb-client-core-5.1,
mariadb-client-5.2, mariadb-client-core-5.2,
- mariadb-client-5.3, mariadb-client-core-5.3
+ mariadb-client-5.3, mariadb-client-core-5.3,
+ mariadb-client-5.5, mariadb-client-core-5.5
Replaces: mysql-client (<< 5.0.51), mysql-client-5.0,
mysql-client-5.1, mysql-client-5.5,
mysql-client-core-5.1, mysql-client-core-5.5,
mariadb-client-5.1, mariadb-client-core-5.1,
mariadb-client-5.2, mariadb-client-core-5.2,
- mariadb-client-5.3, mariadb-client-core-5.3
+ mariadb-client-5.3, mariadb-client-core-5.3,
+ mariadb-client-5.5, mariadb-client-core-5.5
Description: MariaDB database core client binaries
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
@@ -131,11 +141,16 @@ Provides: virtual-mysql-client, mysql-client,
mysql-client-4.1, mysql-client-5.1, mysql-client-5.5
Conflicts: mysql-client (<< 5.0.51), mysql-client-5.0, mysql-client-5.1,
mariadb-client (<< ${source:Version}),
- mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3, mysql-client-5.5
+ mariadb-client-5.1,
+ mariadb-client-5.2,
+ mariadb-client-5.3,
+ mariadb-client-5.5, mysql-client-5.5
Replaces: mysql-client (<< 5.0.51), mysql-client-5.0, mysql-client-5.1,
- mysql-client-5.5,
mariadb-client (<< ${source:Version}),
- mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3
+ mariadb-client-5.1,
+ mariadb-client-5.2,
+ mariadb-client-5.3,
+ mariadb-client-5.5, mysql-client-5.5
Description: MariaDB database client binaries
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
@@ -149,18 +164,16 @@ Package: mariadb-server-core-10.1
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libmariadbclient18 (>= ${binary:Version})
Provides: mysql-server-core, mysql-server-core-5.1, mysql-server-core-5.5
-Conflicts: mariadb-server-5.1 (<< 5.1.60),
- mariadb-server-5.2 (<< 5.2.10),
- mariadb-server-5.3 (<< 5.3.3),
- mysql-server-5.0,
- mysql-server-core-5.0, mysql-server-core-5.1, mysql-server-core-5.5,
- mariadb-server-core-5.1, mariadb-server-core-5.2, mariadb-server-core-5.5
-Replaces: mariadb-server-5.1 (<< 5.1.60),
- mariadb-server-5.2 (<< 5.2.10),
- mariadb-server-5.3 (<< 5.3.3),
- mysql-server-5.0,
- mysql-server-core-5.0, mysql-server-core-5.1, mysql-server-core-5.5,
- mariadb-server-core-5.1, mariadb-server-core-5.2, mariadb-server-core-5.5
+Conflicts: mysql-server-5.0, mysql-server-core-5.0,
+ mariadb-server-core-5.1, mysql-server-core-5.1,
+ mariadb-server-core-5.2,
+ mariadb-server-core-5.3,
+ mariadb-server-core-5.5, mysql-server-core-5.5
+Replaces: mysql-server-5.0, mysql-server-core-5.0,
+ mariadb-server-core-5.1, mysql-server-core-5.1,
+ mariadb-server-core-5.2,
+ mariadb-server-core-5.3,
+ mariadb-server-core-5.5, mysql-server-core-5.5
Description: MariaDB database core server files
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
@@ -173,10 +186,10 @@ Package: mariadb-test-10.1
Section: database
Architecture: any
Depends: mariadb-server-10.1 (= ${source:Version}), mariadb-client-10.1 (= ${source:Version})
+Suggests: patch
Conflicts: mariadb-test (<< ${source:Version}),
mariadb-test-5.1, mariadb-test-5.2, mariadb-test-5.3,
mariadb-server-5.5 (<< 5.5.33), mariadb-galera-server-5.5 (<< 5.5.33)
-Suggests: patch
Replaces: mariadb-test (<< ${source:Version}),
mariadb-test-5.1, mariadb-test-5.2, mariadb-test-5.3
Description: MariaDB database regression test suite
@@ -199,12 +212,18 @@ Depends: mariadb-client-10.1 (>= ${source:Version}), libdbi-perl,
coreutils, bsdutils, findutils, tar
Provides: mariadb-server, mysql-server, virtual-mysql-server
Conflicts: mariadb-server (<< ${source:Version}), mysql-server (<< ${source:Version}),
- mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, mysql-server-5.5,
- mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3,
+ mysql-server-4.1, mysql-server-5.0,
+ mariadb-server-5.1, mysql-server-5.1,
+ mariadb-server-5.2,
+ mariadb-server-5.3,
+ mariadb-server-5.5, mysql-server-5.5,
mariadb-tokudb-engine-5.5, mariadb-tokudb-engine-10.0
Replaces: mariadb-server (<< ${source:Version}), mysql-server (<< ${source:Version}),
- mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, mysql-server-5.5,
- mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3,
+ mysql-server-4.1, mysql-server-5.0,
+ mariadb-server-5.1, mysql-server-5.1,
+ mariadb-server-5.2,
+ mariadb-server-5.3,
+ mariadb-server-5.5, mysql-server-5.5,
libmariadbclient16 (<< 5.3.4), libmariadbclient-dev (<< 5.5.0),
mariadb-tokudb-engine-5.5, mariadb-tokudb-engine-10.0
Description: MariaDB database server binaries
diff --git a/debian/dist/Ubuntu/control b/debian/dist/Ubuntu/control
index 1c555ecef30..ebb34de1761 100644
--- a/debian/dist/Ubuntu/control
+++ b/debian/dist/Ubuntu/control
@@ -4,7 +4,13 @@ Priority: optional
Maintainer: MariaDB Developers <maria-developers@lists.launchpad.net>
XSBC-Original-Maintainer: Maria Developers <maria-developers@lists.launchpad.net>
Uploaders: MariaDB Developers <maria-developers@lists.launchpad.net>
-Build-Depends: libtool (>= 1.4.2-7), procps | hurd, debhelper, file (>= 3.28), libncurses5-dev (>= 5.0-6), perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV}, libssl-dev, libpam0g-dev, psmisc, po-debconf, chrpath, automake1.9, doxygen, texlive-latex-base, ghostscript | gs-gpl, dpatch, gawk, bison, lsb-release, hardening-wrapper, cmake (>= 2.7), libaio-dev, ${MAYBE_LIBCRACK} libjemalloc-dev (>= 3.0.0)
+Build-Depends: procps | hurd, debhelper, libncurses5-dev (>= 5.0-6),
+ perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3),
+ zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV}, libssl-dev,
+ libpam0g-dev, psmisc, po-debconf, chrpath,
+ dpatch, gawk, bison, lsb-release, hardening-wrapper,
+ cmake (>= 2.7), libaio-dev, ${MAYBE_LIBCRACK}
+ libjemalloc-dev (>= 3.0.0)
Standards-Version: 3.8.2
Homepage: http://mariadb.org/
Vcs-Browser: http://bazaar.launchpad.net/~maria-captains/maria/10.1/files
@@ -16,7 +22,9 @@ Architecture: any
Depends: mariadb-common, libmysqlclient18 (= ${source:Version}), ${shlibs:Depends}, ${misc:Depends}
Conflicts: mariadb-server-10.0 (<< 10.0.5), mariadb-galera-server-10.0 (<< 10.0.5),
mariadb-server-5.5 (<< 5.5.33), mariadb-galera-server-5.5 (<< 5.5.33),
- mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3
+ mariadb-server-5.1,
+ mariadb-server-5.2,
+ mariadb-server-5.3
Description: MariaDB database client library
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
@@ -105,13 +113,15 @@ Conflicts: mysql-client (<< 5.0.51), mysql-client-5.0,
mysql-client-core-5.1, mysql-client-core-5.5,
mariadb-client-5.1, mariadb-client-core-5.1,
mariadb-client-5.2, mariadb-client-core-5.2,
- mariadb-client-5.3, mariadb-client-core-5.3
+ mariadb-client-5.3, mariadb-client-core-5.3,
+ mariadb-client-5.5, mariadb-client-core-5.5
Replaces: mysql-client (<< 5.0.51), mysql-client-5.0,
mysql-client-5.1, mysql-client-5.5,
mysql-client-core-5.1, mysql-client-core-5.5,
mariadb-client-5.1, mariadb-client-core-5.1,
mariadb-client-5.2, mariadb-client-core-5.2,
- mariadb-client-5.3, mariadb-client-core-5.3
+ mariadb-client-5.3, mariadb-client-core-5.3,
+ mariadb-client-5.5, mariadb-client-core-5.5
Description: MariaDB database core client binaries
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
@@ -131,11 +141,16 @@ Provides: virtual-mysql-client, mysql-client,
mysql-client-4.1, mysql-client-5.1, mysql-client-5.5
Conflicts: mysql-client (<< 5.0.51), mysql-client-5.0, mysql-client-5.1,
mariadb-client (<< ${source:Version}),
- mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3, mysql-client-5.5
+ mariadb-client-5.1,
+ mariadb-client-5.2,
+ mariadb-client-5.3,
+ mariadb-client-5.5, mysql-client-5.5
Replaces: mysql-client (<< 5.0.51), mysql-client-5.0, mysql-client-5.1,
- mysql-client-5.5,
mariadb-client (<< ${source:Version}),
- mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3
+ mariadb-client-5.1,
+ mariadb-client-5.2,
+ mariadb-client-5.3,
+ mariadb-client-5.5, mysql-client-5.5
Description: MariaDB database client binaries
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
@@ -149,12 +164,16 @@ Package: mariadb-server-core-10.1
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libmariadbclient18 (>= ${binary:Version})
Provides: mysql-server-core, mysql-server-core-5.1, mysql-server-core-5.5
-Conflicts: mysql-server-5.0,
- mysql-server-core-5.0, mysql-server-core-5.1, mysql-server-core-5.5,
- mariadb-server-core-5.1, mariadb-server-core-5.2, mariadb-server-core-5.5
-Replaces: mysql-server-5.0,
- mysql-server-core-5.0, mysql-server-core-5.1, mysql-server-core-5.5,
- mariadb-server-core-5.1, mariadb-server-core-5.2, mariadb-server-core-5.5
+Conflicts: mysql-server-5.0, mysql-server-core-5.0,
+ mariadb-server-core-5.1, mysql-server-core-5.1,
+ mariadb-server-core-5.2,
+ mariadb-server-core-5.3,
+ mariadb-server-core-5.5, mysql-server-core-5.5
+Replaces: mysql-server-5.0, mysql-server-core-5.0,
+ mariadb-server-core-5.1, mysql-server-core-5.1,
+ mariadb-server-core-5.2,
+ mariadb-server-core-5.3,
+ mariadb-server-core-5.5, mysql-server-core-5.5
Description: MariaDB database core server files
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
@@ -193,12 +212,18 @@ Depends: mariadb-client-10.1 (>= ${source:Version}), libdbi-perl,
coreutils, bsdutils, findutils, tar
Provides: mariadb-server, mysql-server, virtual-mysql-server
Conflicts: mariadb-server (<< ${source:Version}), mysql-server (<< ${source:Version}),
- mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, mysql-server-5.5,
- mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3,
+ mysql-server-4.1, mysql-server-5.0,
+ mariadb-server-5.1, mysql-server-5.1,
+ mariadb-server-5.2,
+ mariadb-server-5.3,
+ mariadb-server-5.5, mysql-server-5.5,
mariadb-tokudb-engine-5.5, mariadb-tokudb-engine-10.0
Replaces: mariadb-server (<< ${source:Version}), mysql-server (<< ${source:Version}),
- mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, mysql-server-5.5,
- mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3,
+ mysql-server-4.1, mysql-server-5.0,
+ mariadb-server-5.1, mysql-server-5.1,
+ mariadb-server-5.2,
+ mariadb-server-5.3,
+ mariadb-server-5.5, mysql-server-5.5,
libmariadbclient16 (<< 5.3.4), libmariadbclient-dev (<< 5.5.0),
mariadb-tokudb-engine-5.5, mariadb-tokudb-engine-10.0
Description: MariaDB database server binaries
diff --git a/extra/yassl/CMakeLists.txt b/extra/yassl/CMakeLists.txt
index 23404a661d6..f3232896c6a 100644
--- a/extra/yassl/CMakeLists.txt
+++ b/extra/yassl/CMakeLists.txt
@@ -20,12 +20,9 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL)
ADD_DEFINITIONS(${SSL_DEFINES})
-IF(CMAKE_COMPILER_IS_GNUXX)
- #Remove -fno-implicit-templates
- #(yassl sources cannot be compiled with it)
- STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS
-${CMAKE_CXX_FLAGS})
-ENDIF()
+#Remove -fno-implicit-templates
+#(yassl sources cannot be compiled with it)
+STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
SET(YASSL_SOURCES src/buffer.cpp src/cert_wrapper.cpp src/crypto_wrapper.cpp src/handshake.cpp src/lock.cpp
src/log.cpp src/socket_wrapper.cpp src/ssl.cpp src/timer.cpp src/yassl_error.cpp
src/yassl_imp.cpp src/yassl_int.cpp)
diff --git a/include/atomic/gcc_builtins.h b/include/atomic/gcc_builtins.h
index 6e807b3c51c..56a0323aedf 100644
--- a/include/atomic/gcc_builtins.h
+++ b/include/atomic/gcc_builtins.h
@@ -31,8 +31,8 @@
#define make_atomic_store_body(S) *a= v
#define MY_ATOMIC_MODE "gcc-builtins-up"
-#elif defined(__ATOMIC_SEQ_CST)
-#define MY_ATOMIC_MODE "gcc-builtins-smp"
+#elif defined(HAVE_GCC_C11_ATOMICS)
+#define MY_ATOMIC_MODE "gcc-atomics-smp"
#define make_atomic_load_body(S) \
ret= __atomic_load_n(a, __ATOMIC_SEQ_CST)
#define make_atomic_store_body(S) \
diff --git a/include/m_ctype.h b/include/m_ctype.h
index 8300619d5c7..a55222682b0 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -201,6 +201,10 @@ extern MY_UNI_CTYPE my_uni_ctype[256];
#define MY_CS_UNICODE_SUPPLEMENT 16384 /* Non-BMP Unicode characters */
#define MY_CS_LOWER_SORT 32768 /* If use lower case as weight */
#define MY_CS_STRNXFRM_BAD_NWEIGHTS 0x10000 /* strnxfrm ignores "nweights" */
+#define MY_CS_NOPAD 0x20000 /* if does not ignore trailing spaces */
+#define MY_CS_NON1TO1 0x40000 /* Has a complex mapping from characters
+ to weights, e.g. contractions, expansions,
+ ignorable characters */
#define MY_CHARSET_UNDEFINED 0
/* Character repertoire flags */
@@ -351,7 +355,6 @@ struct my_collation_handler_st
my_bool (*propagate)(CHARSET_INFO *cs, const uchar *str, size_t len);
};
-extern MY_COLLATION_HANDLER my_collation_mb_bin_handler;
extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler;
extern MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler;
extern MY_COLLATION_HANDLER my_collation_ucs2_uca_handler;
@@ -512,6 +515,20 @@ struct my_charset_handler_st
char *dst, size_t dst_length,
const char *src, size_t src_length,
size_t nchars, MY_STRCOPY_STATUS *status);
+ /**
+ Write a character to the target string, using its native code.
+ For Unicode character sets (utf8, ucs2, utf16, utf16le, utf32, filename)
+ native codes are equvalent to Unicode code points.
+ For 8bit character sets the native code is just the byte value.
+ For Asian characters sets:
+ - MB1 native code is just the byte value (e.g. on the ASCII range)
+ - MB2 native code is ((b0 << 8) + b1).
+ - MB3 native code is ((b0 <<16) + (b1 << 8) + b2)
+ Note, CHARSET_INFO::min_sort_char and CHARSET_INFO::max_sort_char
+ are defined in native notation and should be written using
+ cs->cset->native_to_mb() rather than cs->cset->wc_mb().
+ */
+ my_charset_conv_wc_mb native_to_mb;
};
extern MY_CHARSET_HANDLER my_charset_8bit_handler;
@@ -665,6 +682,7 @@ extern int my_strcasecmp_8bit(CHARSET_INFO * cs, const char *, const char *);
int my_mb_wc_8bit(CHARSET_INFO *cs,my_wc_t *wc, const uchar *s,const uchar *e);
int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e);
+int my_wc_mb_bin(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e);
int my_mb_ctype_8bit(CHARSET_INFO *,int *, const uchar *,const uchar *);
int my_mb_ctype_mb(CHARSET_INFO *,int *, const uchar *,const uchar *);
diff --git a/include/my_base.h b/include/my_base.h
index a52ad51485e..91a26f316a7 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -501,7 +501,9 @@ enum ha_base_keytype {
#define HA_ERR_DISK_FULL 189
#define HA_ERR_INCOMPATIBLE_DEFINITION 190
#define HA_ERR_FTS_TOO_MANY_WORDS_IN_PHRASE 191 /* Too many words in a phrase */
-#define HA_ERR_LAST 191 /* Copy of last error nr */
+#define HA_ERR_DECRYPTION_FAILED 192 /* Table encrypted but
+ decypt failed */
+#define HA_ERR_LAST 192 /* Copy of last error nr */
/* Number of different errors */
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)
diff --git a/include/my_crypt.h b/include/my_crypt.h
index 3e6da6aa212..e1e94c9bd9d 100644
--- a/include/my_crypt.h
+++ b/include/my_crypt.h
@@ -36,58 +36,54 @@ extern "C" {
/* The max key length of all supported algorithms */
#define MY_AES_MAX_KEY_LENGTH 32
-#ifdef HAVE_EncryptAes128Ctr
-
-int my_aes_encrypt_ctr(const uchar* source, uint source_length,
- uchar* dest, uint* dest_length,
- const uchar* key, uint key_length,
- const uchar* iv, uint iv_length);
-
-#define my_aes_decrypt_ctr my_aes_encrypt_ctr
+#define MY_AES_CTX_SIZE 512
+enum my_aes_mode {
+ MY_AES_ECB, MY_AES_CBC
+#ifdef HAVE_EncryptAes128Ctr
+ , MY_AES_CTR
#endif
-
#ifdef HAVE_EncryptAes128Gcm
+ , MY_AES_GCM
+#endif
+};
+
+int my_aes_crypt_init(void *ctx, enum my_aes_mode mode, int flags,
+ const unsigned char* key, unsigned int klen,
+ const unsigned char* iv, unsigned int ivlen);
+int my_aes_crypt_update(void *ctx, const uchar *src, uint slen,
+ uchar *dst, uint *dlen);
+int my_aes_crypt_finish(void *ctx, uchar *dst, uint *dlen);
+int my_aes_crypt(enum my_aes_mode mode, int flags,
+ const uchar *src, uint slen, uchar *dst, uint *dlen,
+ const uchar *key, uint klen, const uchar *iv, uint ivlen);
-int my_aes_encrypt_gcm(const uchar* source, uint source_length,
- uchar* dest, uint* dest_length,
- const uchar* key, uint key_length,
- const uchar* iv, uint iv_length);
-
-int my_aes_decrypt_gcm(const uchar* source, uint source_length,
- uchar* dest, uint* dest_length,
- const uchar* key, uint key_length,
- const uchar* iv, uint iv_length);
+/*
+ calculate the length of the cyphertext from the length of the plaintext
+ for different AES encryption modes with padding enabled.
+ Without padding (ENCRYPTION_FLAG_NOPAD) cyphertext has the same length
+ as the plaintext
+*/
+static inline uint my_aes_get_size(enum my_aes_mode mode __attribute__((unused)), uint source_length)
+{
+#ifdef HAVE_EncryptAes128Ctr
+ if (mode == MY_AES_CTR)
+ return source_length;
+#ifdef HAVE_EncryptAes128Gcm
+ if (mode == MY_AES_GCM)
+ return source_length + MY_AES_BLOCK_SIZE;
+#endif
#endif
+ return (source_length / MY_AES_BLOCK_SIZE + 1) * MY_AES_BLOCK_SIZE;
+}
-int my_aes_encrypt_cbc(const uchar* source, uint source_length,
- uchar* dest, uint* dest_length,
- const uchar* key, uint key_length,
- const uchar* iv, uint iv_length,
- int no_padding);
-
-int my_aes_decrypt_cbc(const uchar* source, uint source_length,
- uchar* dest, uint* dest_length,
- const uchar* key, uint key_length,
- const uchar* iv, uint iv_length,
- int no_padding);
-
-int my_aes_encrypt_ecb(const uchar* source, uint source_length,
- uchar* dest, uint* dest_length,
- const uchar* key, uint key_length,
- const uchar* iv, uint iv_length,
- int no_padding);
-
-int my_aes_decrypt_ecb(const uchar* source, uint source_length,
- uchar* dest, uint* dest_length,
- const uchar* key, uint key_length,
- const uchar* iv, uint iv_length,
- int no_padding);
+static inline uint my_aes_ctx_size(enum my_aes_mode mode __attribute__((unused)))
+{
+ return MY_AES_CTX_SIZE;
+}
int my_random_bytes(uchar* buf, int num);
-uint my_aes_get_size(uint source_length);
-
#ifdef __cplusplus
}
#endif
diff --git a/include/my_getopt.h b/include/my_getopt.h
index 499cefd93d6..584c009464d 100644
--- a/include/my_getopt.h
+++ b/include/my_getopt.h
@@ -39,8 +39,9 @@ C_MODE_START
#define GET_DOUBLE 14
#define GET_FLAGSET 15
-#define GET_ASK_ADDR 128
-#define GET_TYPE_MASK 127
+#define GET_ASK_ADDR 128
+#define GET_AUTO 64
+#define GET_TYPE_MASK 63
/**
Enumeration of the my_option::arg_type attributes.
@@ -100,6 +101,7 @@ typedef void *(*my_getopt_value)(const char *, uint, const struct my_option *,
extern char *disabled_my_option;
+extern char *autoset_my_option;
extern my_bool my_getopt_print_errors;
extern my_bool my_getopt_skip_unknown;
extern my_bool my_getopt_prefix_matching;
diff --git a/include/my_global.h b/include/my_global.h
index e026f8a66a9..f7d8f795051 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -477,6 +477,13 @@ extern "C" int madvise(void *addr, size_t len, int behav);
#define UNINIT_VAR(x) x
#endif
+/* This is only to be used when reseting variables in a class constructor */
+#if defined(_lint) || defined(FORCE_INIT_OF_VARS)
+#define LINT_INIT(x) x= 0
+#else
+#define LINT_INIT(x)
+#endif
+
#if !defined(HAVE_UINT)
#undef HAVE_UINT
#define HAVE_UINT
@@ -594,6 +601,12 @@ typedef SOCKET_SIZE_TYPE size_socket;
#ifndef O_NOFOLLOW
#define O_NOFOLLOW 0
#endif
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
+#ifndef SOCK_CLOEXEC
+#define SOCK_CLOEXEC 0
+#endif
/* additional file share flags for win32 */
#ifdef __WIN__
diff --git a/include/my_handler_errors.h b/include/my_handler_errors.h
index a7afcfe93a3..5af6a359348 100644
--- a/include/my_handler_errors.h
+++ b/include/my_handler_errors.h
@@ -94,7 +94,8 @@ static const char *handler_error_messages[]=
"Operation was interrupted by end user (probably kill command?)",
"Disk full",
"Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You have to dump and restore the table to fix this",
- "Too many words in a FTS phrase or proximity search"
+ "Too many words in a FTS phrase or proximity search",
+ "Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match."
};
#endif /* MYSYS_MY_HANDLER_ERRORS_INCLUDED */
diff --git a/include/my_stacktrace.h b/include/my_stacktrace.h
index ad05a7df9ab..fb2525e3a12 100644
--- a/include/my_stacktrace.h
+++ b/include/my_stacktrace.h
@@ -35,8 +35,7 @@
#define HAVE_WRITE_CORE
-#if HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS && \
- HAVE_CXXABI_H && HAVE_ABI_CXA_DEMANGLE && \
+#if HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS && HAVE_ABI_CXA_DEMANGLE && \
HAVE_WEAK_SYMBOL
#define BACKTRACE_DEMANGLE 1
#endif
diff --git a/include/my_sys.h b/include/my_sys.h
index 0aaf4e90ea8..31d4ffd7667 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -175,6 +175,7 @@ extern void set_malloc_size_cb(MALLOC_SIZE_CB func);
/* defines when allocating data */
extern void *my_malloc(size_t Size,myf MyFlags);
extern void *my_multi_malloc(myf MyFlags, ...);
+extern void *my_multi_malloc_large(myf MyFlags, ...);
extern void *my_realloc(void *oldpoint, size_t Size, myf MyFlags);
extern void my_free(void *ptr);
extern void *my_memdup(const void *from,size_t length,myf MyFlags);
@@ -204,16 +205,17 @@ extern void my_large_free(uchar *ptr);
#endif /* GNUC */
#define my_alloca(SZ) alloca((size_t) (SZ))
#define my_afree(PTR) ((void)0)
-#define my_safe_alloca(size, max_alloca_sz) ((size <= max_alloca_sz) ? \
- my_alloca(size) : \
- my_malloc(size, MYF(0)))
-#define my_safe_afree(ptr, size, max_alloca_sz) if (size > max_alloca_sz) \
- my_free(ptr)
+#define MAX_ALLOCA_SZ 4096
+#define my_safe_alloca(size) (((size) <= MAX_ALLOCA_SZ) ? \
+ my_alloca(size) : \
+ my_malloc((size), MYF(MY_THREAD_SPECIFIC|MY_WME)))
+#define my_safe_afree(ptr, size) \
+ do { if ((size) > MAX_ALLOCA_SZ) my_free(ptr); } while(0)
#else
#define my_alloca(SZ) my_malloc(SZ,MYF(MY_FAE))
#define my_afree(PTR) my_free(PTR)
-#define my_safe_alloca(size, max_alloca_sz) my_alloca(size)
-#define my_safe_afree(ptr, size, max_alloca_sz) my_afree(ptr)
+#define my_safe_alloca(size) my_alloca(size)
+#define my_safe_afree(ptr, size) my_afree(ptr)
#endif /* HAVE_ALLOCA */
#ifndef errno /* did we already get it? */
@@ -613,7 +615,6 @@ my_off_t my_b_safe_tell(IO_CACHE* info); /* picks the correct tell() */
int my_b_pread(IO_CACHE *info, uchar *Buffer, size_t Count, my_off_t pos);
typedef uint32 ha_checksum;
-extern ulong my_crc_dbug_check;
#include <my_alloc.h>
@@ -1028,9 +1029,9 @@ extern size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info,
char *to, size_t to_length,
const char *from, size_t length);
-extern void thd_increment_bytes_sent(ulong length);
-extern void thd_increment_bytes_received(ulong length);
-extern void thd_increment_net_big_packet_count(ulong length);
+extern void thd_increment_bytes_sent(void *thd, ulong length);
+extern void thd_increment_bytes_received(void *thd, ulong length);
+extern void thd_increment_net_big_packet_count(void *thd, ulong length);
#ifdef __WIN__
extern my_bool have_tcpip; /* Is set if tcpip is used */
diff --git a/include/mysql.h.pp b/include/mysql.h.pp
index 8ad94a03056..5c3a9210ce8 100644
--- a/include/mysql.h.pp
+++ b/include/mysql.h.pp
@@ -1,7 +1,5 @@
typedef char my_bool;
typedef int my_socket;
-#include "mysql_version.h"
-#include "mysql_com.h"
enum enum_server_command
{
COM_SLEEP, COM_QUIT, COM_INIT_DB, COM_QUERY, COM_FIELD_LIST,
@@ -31,7 +29,7 @@ typedef struct st_net {
my_bool thread_specific_malloc;
my_bool compress;
my_bool unused3;
- unsigned char *unused;
+ void *thd;
unsigned int last_errno;
unsigned char error;
my_bool unused4;
@@ -83,7 +81,7 @@ enum enum_mysql_set_option
MYSQL_OPTION_MULTI_STATEMENTS_ON,
MYSQL_OPTION_MULTI_STATEMENTS_OFF
};
-my_bool my_net_init(NET *net, Vio* vio, unsigned int my_flags);
+my_bool my_net_init(NET *net, Vio* vio, void *thd, unsigned int my_flags);
void my_net_local_init(NET *net);
void net_end(NET *net);
void net_clear(NET *net, my_bool clear_buffer);
@@ -102,7 +100,7 @@ struct my_rnd_struct;
enum Item_result
{
STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT, DECIMAL_RESULT,
- TIME_RESULT,IMPOSSIBLE_RESULT
+ TIME_RESULT
};
typedef struct st_udf_args
{
@@ -143,7 +141,6 @@ void get_tty_password_buff(const char *opt_message, char *to, size_t length);
const char *mysql_errno_to_sqlstate(unsigned int mysql_errno);
my_bool my_thread_init(void);
void my_thread_end(void);
-#include "mysql_time.h"
typedef long my_time_t;
enum enum_mysql_timestamp_type
{
@@ -157,7 +154,6 @@ typedef struct st_mysql_time
my_bool neg;
enum enum_mysql_timestamp_type time_type;
} MYSQL_TIME;
-#include "my_list.h"
typedef struct st_list {
struct st_list *prev,*next;
void *data;
@@ -199,8 +195,6 @@ typedef struct st_mysql_field {
typedef char **MYSQL_ROW;
typedef unsigned int MYSQL_FIELD_OFFSET;
typedef unsigned long long my_ulonglong;
-#include "typelib.h"
-#include "my_alloc.h"
typedef struct st_used_mem
{
struct st_used_mem *next;
@@ -244,7 +238,6 @@ typedef struct st_mysql_rows {
unsigned long length;
} MYSQL_ROWS;
typedef MYSQL_ROWS *MYSQL_ROW_OFFSET;
-#include "my_alloc.h"
typedef struct embedded_query_result EMBEDDED_QUERY_RESULT;
typedef struct st_mysql_data {
MYSQL_ROWS *data;
diff --git a/include/mysql/client_plugin.h.pp b/include/mysql/client_plugin.h.pp
index f3a0b5769df..b6ba9cf08ad 100644
--- a/include/mysql/client_plugin.h.pp
+++ b/include/mysql/client_plugin.h.pp
@@ -3,7 +3,6 @@ struct st_mysql_client_plugin
int type; unsigned int interface_version; const char *name; const char *author; const char *desc; unsigned int version[3]; const char *license; void *mysql_api; int (*init)(char *, size_t, int, va_list); int (*deinit)(); int (*options)(const char *option, const void *);
};
struct st_mysql;
-#include <mysql/plugin_auth_common.h>
typedef struct st_plugin_vio_info
{
enum { MYSQL_VIO_INVALID, MYSQL_VIO_TCP, MYSQL_VIO_SOCKET,
@@ -24,7 +23,6 @@ struct st_mysql_client_plugin_AUTHENTICATION
int type; unsigned int interface_version; const char *name; const char *author; const char *desc; unsigned int version[3]; const char *license; void *mysql_api; int (*init)(char *, size_t, int, va_list); int (*deinit)(); int (*options)(const char *option, const void *);
int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, struct st_mysql *mysql);
};
-#include <mysql/auth_dialog_client.h>
struct st_mysql;
typedef char *(*mysql_authentication_dialog_ask_t)(struct st_mysql *mysql,
int type, const char *prompt, char *buf, int buf_len);
diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp
index 669be094542..f4df16afa67 100644
--- a/include/mysql/plugin_audit.h.pp
+++ b/include/mysql/plugin_audit.h.pp
@@ -1,15 +1,11 @@
-#include "plugin.h"
typedef char my_bool;
typedef void * MYSQL_PLUGIN;
-#include <mysql/services.h>
-#include <mysql/service_my_snprintf.h>
extern struct my_snprintf_service_st {
size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
} *my_snprintf_service;
size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
-#include <mysql/service_thd_alloc.h>
struct st_mysql_lex_string
{
char *str;
@@ -33,7 +29,6 @@ void *thd_memdup(void* thd, const void* str, unsigned int size);
MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
-#include <mysql/service_thd_wait.h>
typedef enum _thd_wait_type_e {
THD_WAIT_SLEEP= 1,
THD_WAIT_DISKIO= 2,
@@ -54,7 +49,6 @@ extern struct thd_wait_service_st {
} *thd_wait_service;
void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
-#include <mysql/service_progress_report.h>
extern struct progress_report_service_st {
void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
void (*thd_progress_report_func)(void* thd,
@@ -75,9 +69,7 @@ void thd_progress_next_stage(void* thd);
void thd_progress_end(void* thd);
const char *set_thd_proc_info(void*, const char * info, const char *func,
const char *file, unsigned int line);
-#include <mysql/service_debug_sync.h>
extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
-#include <mysql/service_kill_statement.h>
enum thd_kill_levels {
THD_IS_NOT_KILLED=0,
THD_ABORT_SOFTLY=50,
@@ -87,8 +79,6 @@ extern struct kill_statement_service_st {
enum thd_kill_levels (*thd_kill_level_func)(const void*);
} *thd_kill_statement_service;
enum thd_kill_levels thd_kill_level(const void*);
-#include <mysql/service_thd_timezone.h>
-#include "mysql_time.h"
typedef long my_time_t;
enum enum_mysql_timestamp_type
{
@@ -108,7 +98,6 @@ extern struct thd_timezone_service_st {
} *thd_timezone_service;
my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
-#include <mysql/service_sha1.h>
extern struct my_sha1_service_st {
void (*my_sha1_type)(unsigned char*, const char*, size_t);
void (*my_sha1_multi_type)(unsigned char*, ...);
@@ -123,7 +112,6 @@ size_t my_sha1_context_size();
void my_sha1_init(void *context);
void my_sha1_input(void *context, const unsigned char *buf, size_t len);
void my_sha1_result(void *context, unsigned char *digest);
-#include <mysql/service_md5.h>
extern struct my_md5_service_st {
void (*my_md5_type)(unsigned char*, const char*, size_t);
void (*my_md5_multi_type)(unsigned char*, ...);
@@ -138,7 +126,6 @@ size_t my_md5_context_size();
void my_md5_init(void *context);
void my_md5_input(void *context, const unsigned char *buf, size_t len);
void my_md5_result(void *context, unsigned char *digest);
-#include <mysql/service_logger.h>
typedef struct logger_handle_st LOGGER_HANDLE;
extern struct logger_service_st {
void (*logger_init_mutexes)();
@@ -160,14 +147,12 @@ extern struct logger_service_st {
int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...);
int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size);
int logger_rotate(LOGGER_HANDLE *log);
-#include <mysql/service_thd_autoinc.h>
extern struct thd_autoinc_service_st {
void (*thd_get_autoinc_func)(const void* thd,
unsigned long* off, unsigned long* inc);
} *thd_autoinc_service;
void thd_get_autoinc(const void* thd,
unsigned long* off, unsigned long* inc);
-#include <mysql/service_thd_error_context.h>
extern struct thd_error_context_service_st {
const char *(*thd_get_error_message_func)(const void* thd);
unsigned int (*thd_get_error_number_func)(const void* thd);
@@ -185,7 +170,6 @@ void thd_inc_error_row(void* thd);
char *thd_get_error_context_description(void* thd,
char *buffer, unsigned int length,
unsigned int max_query_length);
-#include <mysql/service_thd_specifics.h>
typedef int MYSQL_THD_KEY_T;
extern struct thd_specifics_service_st {
int (*thd_key_create_func)(MYSQL_THD_KEY_T *key);
@@ -197,23 +181,46 @@ int thd_key_create(MYSQL_THD_KEY_T *key);
void thd_key_delete(MYSQL_THD_KEY_T *key);
void* thd_getspecific(void* thd, MYSQL_THD_KEY_T key);
int thd_setspecific(void* thd, MYSQL_THD_KEY_T key, void *value);
-#include <mysql/service_encryption.h>
-typedef int (*encrypt_decrypt_func)(const unsigned char* src, unsigned int slen,
- unsigned char* dst, unsigned int* dlen,
- const unsigned char* key, unsigned int klen,
- const unsigned char* iv, unsigned int ivlen,
- int no_padding, unsigned int key_id,
- unsigned int key_version);
struct encryption_service_st {
- unsigned int (*encryption_key_get_latest_version_func)(unsigned int);
- unsigned int (*encryption_key_id_exists_func)(unsigned int);
- unsigned int (*encryption_key_version_exists_func)(unsigned int, unsigned int);
- unsigned int (*encryption_key_get_func)(unsigned int, unsigned int, unsigned char*, unsigned int*);
- encrypt_decrypt_func encryption_encrypt_func;
- encrypt_decrypt_func encryption_decrypt_func;
+ unsigned int (*encryption_key_get_latest_version_func)(unsigned int key_id);
+ unsigned int (*encryption_key_get_func)(unsigned int key_id, unsigned int key_version,
+ unsigned char* buffer, unsigned int* length);
+ unsigned int (*encryption_ctx_size_func)(unsigned int key_id, unsigned int key_version);
+ int (*encryption_ctx_init_func)(void *ctx, const unsigned char* key, unsigned int klen,
+ const unsigned char* iv, unsigned int ivlen,
+ int flags, unsigned int key_id,
+ unsigned int key_version);
+ int (*encryption_ctx_update_func)(void *ctx, const unsigned char* src, unsigned int slen,
+ unsigned char* dst, unsigned int* dlen);
+ int (*encryption_ctx_finish_func)(void *ctx, unsigned char* dst, unsigned int* dlen);
+ unsigned int (*encryption_encrypted_length_func)(unsigned int slen, unsigned int key_id, unsigned int key_version);
};
extern struct encryption_service_st encryption_handler;
-#include <mysql/service_encryption_scheme.h>
+static inline unsigned int encryption_key_id_exists(unsigned int id)
+{
+ return encryption_handler.encryption_key_get_latest_version_func(id) != (~(unsigned int)0);
+}
+static inline unsigned int encryption_key_version_exists(unsigned int id, unsigned int version)
+{
+ unsigned int unused;
+ return encryption_handler.encryption_key_get_func((id),(version),(NULL),(&unused)) != (~(unsigned int)0);
+}
+static inline int encryption_crypt(const unsigned char* src, unsigned int slen,
+ unsigned char* dst, unsigned int* dlen,
+ const unsigned char* key, unsigned int klen,
+ const unsigned char* iv, unsigned int ivlen,
+ int flags, unsigned int key_id, unsigned int key_version)
+{
+ void *ctx= alloca(encryption_handler.encryption_ctx_size_func((key_id),(key_version)));
+ int res1, res2;
+ unsigned int d1, d2;
+ if ((res1= encryption_handler.encryption_ctx_init_func((ctx),(key),(klen),(iv),(ivlen),(flags),(key_id),(key_version))))
+ return res1;
+ res1= encryption_handler.encryption_ctx_update_func((ctx),(src),(slen),(dst),(&d1));
+ res2= encryption_handler.encryption_ctx_finish_func((ctx),(dst + d1),(&d2));
+ *dlen= d1 + d2;
+ return res1 ? res1 : res2;
+}
struct st_encryption_scheme_key {
unsigned int version;
unsigned char key[16];
@@ -315,8 +322,6 @@ struct st_maria_plugin
const char *version_info;
unsigned int maturity;
};
-#include "plugin_ftparser.h"
-#include "plugin.h"
enum enum_ftparser_mode
{
MYSQL_FTPARSER_SIMPLE_MODE= 0,
diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp
index 1b795079c22..046f92b5ab8 100644
--- a/include/mysql/plugin_auth.h.pp
+++ b/include/mysql/plugin_auth.h.pp
@@ -1,15 +1,11 @@
-#include <mysql/plugin.h>
typedef char my_bool;
typedef void * MYSQL_PLUGIN;
-#include <mysql/services.h>
-#include <mysql/service_my_snprintf.h>
extern struct my_snprintf_service_st {
size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
} *my_snprintf_service;
size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
-#include <mysql/service_thd_alloc.h>
struct st_mysql_lex_string
{
char *str;
@@ -33,7 +29,6 @@ void *thd_memdup(void* thd, const void* str, unsigned int size);
MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
-#include <mysql/service_thd_wait.h>
typedef enum _thd_wait_type_e {
THD_WAIT_SLEEP= 1,
THD_WAIT_DISKIO= 2,
@@ -54,7 +49,6 @@ extern struct thd_wait_service_st {
} *thd_wait_service;
void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
-#include <mysql/service_progress_report.h>
extern struct progress_report_service_st {
void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
void (*thd_progress_report_func)(void* thd,
@@ -75,9 +69,7 @@ void thd_progress_next_stage(void* thd);
void thd_progress_end(void* thd);
const char *set_thd_proc_info(void*, const char * info, const char *func,
const char *file, unsigned int line);
-#include <mysql/service_debug_sync.h>
extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
-#include <mysql/service_kill_statement.h>
enum thd_kill_levels {
THD_IS_NOT_KILLED=0,
THD_ABORT_SOFTLY=50,
@@ -87,8 +79,6 @@ extern struct kill_statement_service_st {
enum thd_kill_levels (*thd_kill_level_func)(const void*);
} *thd_kill_statement_service;
enum thd_kill_levels thd_kill_level(const void*);
-#include <mysql/service_thd_timezone.h>
-#include "mysql_time.h"
typedef long my_time_t;
enum enum_mysql_timestamp_type
{
@@ -108,7 +98,6 @@ extern struct thd_timezone_service_st {
} *thd_timezone_service;
my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
-#include <mysql/service_sha1.h>
extern struct my_sha1_service_st {
void (*my_sha1_type)(unsigned char*, const char*, size_t);
void (*my_sha1_multi_type)(unsigned char*, ...);
@@ -123,7 +112,6 @@ size_t my_sha1_context_size();
void my_sha1_init(void *context);
void my_sha1_input(void *context, const unsigned char *buf, size_t len);
void my_sha1_result(void *context, unsigned char *digest);
-#include <mysql/service_md5.h>
extern struct my_md5_service_st {
void (*my_md5_type)(unsigned char*, const char*, size_t);
void (*my_md5_multi_type)(unsigned char*, ...);
@@ -138,7 +126,6 @@ size_t my_md5_context_size();
void my_md5_init(void *context);
void my_md5_input(void *context, const unsigned char *buf, size_t len);
void my_md5_result(void *context, unsigned char *digest);
-#include <mysql/service_logger.h>
typedef struct logger_handle_st LOGGER_HANDLE;
extern struct logger_service_st {
void (*logger_init_mutexes)();
@@ -160,14 +147,12 @@ extern struct logger_service_st {
int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...);
int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size);
int logger_rotate(LOGGER_HANDLE *log);
-#include <mysql/service_thd_autoinc.h>
extern struct thd_autoinc_service_st {
void (*thd_get_autoinc_func)(const void* thd,
unsigned long* off, unsigned long* inc);
} *thd_autoinc_service;
void thd_get_autoinc(const void* thd,
unsigned long* off, unsigned long* inc);
-#include <mysql/service_thd_error_context.h>
extern struct thd_error_context_service_st {
const char *(*thd_get_error_message_func)(const void* thd);
unsigned int (*thd_get_error_number_func)(const void* thd);
@@ -185,7 +170,6 @@ void thd_inc_error_row(void* thd);
char *thd_get_error_context_description(void* thd,
char *buffer, unsigned int length,
unsigned int max_query_length);
-#include <mysql/service_thd_specifics.h>
typedef int MYSQL_THD_KEY_T;
extern struct thd_specifics_service_st {
int (*thd_key_create_func)(MYSQL_THD_KEY_T *key);
@@ -197,23 +181,46 @@ int thd_key_create(MYSQL_THD_KEY_T *key);
void thd_key_delete(MYSQL_THD_KEY_T *key);
void* thd_getspecific(void* thd, MYSQL_THD_KEY_T key);
int thd_setspecific(void* thd, MYSQL_THD_KEY_T key, void *value);
-#include <mysql/service_encryption.h>
-typedef int (*encrypt_decrypt_func)(const unsigned char* src, unsigned int slen,
- unsigned char* dst, unsigned int* dlen,
- const unsigned char* key, unsigned int klen,
- const unsigned char* iv, unsigned int ivlen,
- int no_padding, unsigned int key_id,
- unsigned int key_version);
struct encryption_service_st {
- unsigned int (*encryption_key_get_latest_version_func)(unsigned int);
- unsigned int (*encryption_key_id_exists_func)(unsigned int);
- unsigned int (*encryption_key_version_exists_func)(unsigned int, unsigned int);
- unsigned int (*encryption_key_get_func)(unsigned int, unsigned int, unsigned char*, unsigned int*);
- encrypt_decrypt_func encryption_encrypt_func;
- encrypt_decrypt_func encryption_decrypt_func;
+ unsigned int (*encryption_key_get_latest_version_func)(unsigned int key_id);
+ unsigned int (*encryption_key_get_func)(unsigned int key_id, unsigned int key_version,
+ unsigned char* buffer, unsigned int* length);
+ unsigned int (*encryption_ctx_size_func)(unsigned int key_id, unsigned int key_version);
+ int (*encryption_ctx_init_func)(void *ctx, const unsigned char* key, unsigned int klen,
+ const unsigned char* iv, unsigned int ivlen,
+ int flags, unsigned int key_id,
+ unsigned int key_version);
+ int (*encryption_ctx_update_func)(void *ctx, const unsigned char* src, unsigned int slen,
+ unsigned char* dst, unsigned int* dlen);
+ int (*encryption_ctx_finish_func)(void *ctx, unsigned char* dst, unsigned int* dlen);
+ unsigned int (*encryption_encrypted_length_func)(unsigned int slen, unsigned int key_id, unsigned int key_version);
};
extern struct encryption_service_st encryption_handler;
-#include <mysql/service_encryption_scheme.h>
+static inline unsigned int encryption_key_id_exists(unsigned int id)
+{
+ return encryption_handler.encryption_key_get_latest_version_func(id) != (~(unsigned int)0);
+}
+static inline unsigned int encryption_key_version_exists(unsigned int id, unsigned int version)
+{
+ unsigned int unused;
+ return encryption_handler.encryption_key_get_func((id),(version),(NULL),(&unused)) != (~(unsigned int)0);
+}
+static inline int encryption_crypt(const unsigned char* src, unsigned int slen,
+ unsigned char* dst, unsigned int* dlen,
+ const unsigned char* key, unsigned int klen,
+ const unsigned char* iv, unsigned int ivlen,
+ int flags, unsigned int key_id, unsigned int key_version)
+{
+ void *ctx= alloca(encryption_handler.encryption_ctx_size_func((key_id),(key_version)));
+ int res1, res2;
+ unsigned int d1, d2;
+ if ((res1= encryption_handler.encryption_ctx_init_func((ctx),(key),(klen),(iv),(ivlen),(flags),(key_id),(key_version))))
+ return res1;
+ res1= encryption_handler.encryption_ctx_update_func((ctx),(src),(slen),(dst),(&d1));
+ res2= encryption_handler.encryption_ctx_finish_func((ctx),(dst + d1),(&d2));
+ *dlen= d1 + d2;
+ return res1 ? res1 : res2;
+}
struct st_encryption_scheme_key {
unsigned int version;
unsigned char key[16];
@@ -315,8 +322,6 @@ struct st_maria_plugin
const char *version_info;
unsigned int maturity;
};
-#include "plugin_ftparser.h"
-#include "plugin.h"
enum enum_ftparser_mode
{
MYSQL_FTPARSER_SIMPLE_MODE= 0,
@@ -406,7 +411,6 @@ void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
void thd_set_ha_data(void* thd, const struct handlerton *hton,
const void *ha_data);
void thd_wakeup_subsequent_commits(void* thd, int wakeup_error);
-#include <mysql/plugin_auth_common.h>
typedef struct st_plugin_vio_info
{
enum { MYSQL_VIO_INVALID, MYSQL_VIO_TCP, MYSQL_VIO_SOCKET,
diff --git a/include/mysql/plugin_encryption.h b/include/mysql/plugin_encryption.h
index 90979017101..3f35c2bcf80 100644
--- a/include/mysql/plugin_encryption.h
+++ b/include/mysql/plugin_encryption.h
@@ -27,7 +27,7 @@
#include <mysql/plugin.h>
-#define MariaDB_ENCRYPTION_INTERFACE_VERSION 0x0200
+#define MariaDB_ENCRYPTION_INTERFACE_VERSION 0x0300
/**
Encryption plugin descriptor
@@ -36,6 +36,8 @@ struct st_mariadb_encryption
{
int interface_version; /**< version plugin uses */
+ /*********** KEY MANAGEMENT ********************************************/
+
/**
function returning latest key version for a given key id
@@ -66,8 +68,51 @@ struct st_mariadb_encryption
unsigned int (*get_key)(unsigned int key_id, unsigned int version,
unsigned char *key, unsigned int *key_length);
- encrypt_decrypt_func encrypt;
- encrypt_decrypt_func decrypt;
+ /*********** ENCRYPTION ************************************************/
+ /*
+ the caller uses encryption as follows:
+ 1. create the encryption context object of the crypt_ctx_size() bytes.
+ 2. initialize it with crypt_ctx_init().
+ 3. repeat crypt_ctx_update() until there are no more data to encrypt.
+ 4. write the remaining output bytes and destroy the context object
+ with crypt_ctx_finish().
+ */
+
+ /**
+ returns the size of the encryption context object in bytes
+ */
+ unsigned int (*crypt_ctx_size)(unsigned int key_id, unsigned int key_version);
+ /**
+ initializes the encryption context object.
+ */
+ int (*crypt_ctx_init)(void *ctx, const unsigned char* key, unsigned int klen,
+ const unsigned char* iv, unsigned int ivlen,
+ int flags, unsigned int key_id,
+ unsigned int key_version);
+ /**
+ processes (encrypts or decrypts) a chunk of data
+
+ writes the output to th dst buffer. note that it might write
+ more bytes that were in the input. or less. or none at all.
+ */
+ int (*crypt_ctx_update)(void *ctx, const unsigned char* src, unsigned int slen,
+ unsigned char* dst, unsigned int* dlen);
+ /**
+ writes the remaining output bytes and destroys the encryption context
+
+ crypt_ctx_update might've cached part of the output in the context,
+ this method will flush these data out.
+ */
+ int (*crypt_ctx_finish)(void *ctx, unsigned char* dst, unsigned int* dlen);
+ /**
+ returns the length of the encrypted data
+
+ it returns the exact length, given only the source length.
+ which means, this API only supports encryption algorithms where
+ the length of the encrypted data only depends on the length of the
+ input (a.k.a. compression is not supported).
+ */
+ unsigned int (*encrypted_length)(unsigned int slen, unsigned int key_id, unsigned int key_version);
};
#endif
diff --git a/include/mysql/plugin_encryption.h.pp b/include/mysql/plugin_encryption.h.pp
index 56cad7ab716..850dbf05a58 100644
--- a/include/mysql/plugin_encryption.h.pp
+++ b/include/mysql/plugin_encryption.h.pp
@@ -1,15 +1,11 @@
-#include <mysql/plugin.h>
typedef char my_bool;
typedef void * MYSQL_PLUGIN;
-#include <mysql/services.h>
-#include <mysql/service_my_snprintf.h>
extern struct my_snprintf_service_st {
size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
} *my_snprintf_service;
size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
-#include <mysql/service_thd_alloc.h>
struct st_mysql_lex_string
{
char *str;
@@ -33,7 +29,6 @@ void *thd_memdup(void* thd, const void* str, unsigned int size);
MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
-#include <mysql/service_thd_wait.h>
typedef enum _thd_wait_type_e {
THD_WAIT_SLEEP= 1,
THD_WAIT_DISKIO= 2,
@@ -54,7 +49,6 @@ extern struct thd_wait_service_st {
} *thd_wait_service;
void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
-#include <mysql/service_progress_report.h>
extern struct progress_report_service_st {
void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
void (*thd_progress_report_func)(void* thd,
@@ -75,9 +69,7 @@ void thd_progress_next_stage(void* thd);
void thd_progress_end(void* thd);
const char *set_thd_proc_info(void*, const char * info, const char *func,
const char *file, unsigned int line);
-#include <mysql/service_debug_sync.h>
extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
-#include <mysql/service_kill_statement.h>
enum thd_kill_levels {
THD_IS_NOT_KILLED=0,
THD_ABORT_SOFTLY=50,
@@ -87,8 +79,6 @@ extern struct kill_statement_service_st {
enum thd_kill_levels (*thd_kill_level_func)(const void*);
} *thd_kill_statement_service;
enum thd_kill_levels thd_kill_level(const void*);
-#include <mysql/service_thd_timezone.h>
-#include "mysql_time.h"
typedef long my_time_t;
enum enum_mysql_timestamp_type
{
@@ -108,7 +98,6 @@ extern struct thd_timezone_service_st {
} *thd_timezone_service;
my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
-#include <mysql/service_sha1.h>
extern struct my_sha1_service_st {
void (*my_sha1_type)(unsigned char*, const char*, size_t);
void (*my_sha1_multi_type)(unsigned char*, ...);
@@ -123,7 +112,6 @@ size_t my_sha1_context_size();
void my_sha1_init(void *context);
void my_sha1_input(void *context, const unsigned char *buf, size_t len);
void my_sha1_result(void *context, unsigned char *digest);
-#include <mysql/service_md5.h>
extern struct my_md5_service_st {
void (*my_md5_type)(unsigned char*, const char*, size_t);
void (*my_md5_multi_type)(unsigned char*, ...);
@@ -138,7 +126,6 @@ size_t my_md5_context_size();
void my_md5_init(void *context);
void my_md5_input(void *context, const unsigned char *buf, size_t len);
void my_md5_result(void *context, unsigned char *digest);
-#include <mysql/service_logger.h>
typedef struct logger_handle_st LOGGER_HANDLE;
extern struct logger_service_st {
void (*logger_init_mutexes)();
@@ -160,14 +147,12 @@ extern struct logger_service_st {
int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...);
int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size);
int logger_rotate(LOGGER_HANDLE *log);
-#include <mysql/service_thd_autoinc.h>
extern struct thd_autoinc_service_st {
void (*thd_get_autoinc_func)(const void* thd,
unsigned long* off, unsigned long* inc);
} *thd_autoinc_service;
void thd_get_autoinc(const void* thd,
unsigned long* off, unsigned long* inc);
-#include <mysql/service_thd_error_context.h>
extern struct thd_error_context_service_st {
const char *(*thd_get_error_message_func)(const void* thd);
unsigned int (*thd_get_error_number_func)(const void* thd);
@@ -185,7 +170,6 @@ void thd_inc_error_row(void* thd);
char *thd_get_error_context_description(void* thd,
char *buffer, unsigned int length,
unsigned int max_query_length);
-#include <mysql/service_thd_specifics.h>
typedef int MYSQL_THD_KEY_T;
extern struct thd_specifics_service_st {
int (*thd_key_create_func)(MYSQL_THD_KEY_T *key);
@@ -197,23 +181,46 @@ int thd_key_create(MYSQL_THD_KEY_T *key);
void thd_key_delete(MYSQL_THD_KEY_T *key);
void* thd_getspecific(void* thd, MYSQL_THD_KEY_T key);
int thd_setspecific(void* thd, MYSQL_THD_KEY_T key, void *value);
-#include <mysql/service_encryption.h>
-typedef int (*encrypt_decrypt_func)(const unsigned char* src, unsigned int slen,
- unsigned char* dst, unsigned int* dlen,
- const unsigned char* key, unsigned int klen,
- const unsigned char* iv, unsigned int ivlen,
- int no_padding, unsigned int key_id,
- unsigned int key_version);
struct encryption_service_st {
- unsigned int (*encryption_key_get_latest_version_func)(unsigned int);
- unsigned int (*encryption_key_id_exists_func)(unsigned int);
- unsigned int (*encryption_key_version_exists_func)(unsigned int, unsigned int);
- unsigned int (*encryption_key_get_func)(unsigned int, unsigned int, unsigned char*, unsigned int*);
- encrypt_decrypt_func encryption_encrypt_func;
- encrypt_decrypt_func encryption_decrypt_func;
+ unsigned int (*encryption_key_get_latest_version_func)(unsigned int key_id);
+ unsigned int (*encryption_key_get_func)(unsigned int key_id, unsigned int key_version,
+ unsigned char* buffer, unsigned int* length);
+ unsigned int (*encryption_ctx_size_func)(unsigned int key_id, unsigned int key_version);
+ int (*encryption_ctx_init_func)(void *ctx, const unsigned char* key, unsigned int klen,
+ const unsigned char* iv, unsigned int ivlen,
+ int flags, unsigned int key_id,
+ unsigned int key_version);
+ int (*encryption_ctx_update_func)(void *ctx, const unsigned char* src, unsigned int slen,
+ unsigned char* dst, unsigned int* dlen);
+ int (*encryption_ctx_finish_func)(void *ctx, unsigned char* dst, unsigned int* dlen);
+ unsigned int (*encryption_encrypted_length_func)(unsigned int slen, unsigned int key_id, unsigned int key_version);
};
extern struct encryption_service_st encryption_handler;
-#include <mysql/service_encryption_scheme.h>
+static inline unsigned int encryption_key_id_exists(unsigned int id)
+{
+ return encryption_handler.encryption_key_get_latest_version_func(id) != (~(unsigned int)0);
+}
+static inline unsigned int encryption_key_version_exists(unsigned int id, unsigned int version)
+{
+ unsigned int unused;
+ return encryption_handler.encryption_key_get_func((id),(version),(NULL),(&unused)) != (~(unsigned int)0);
+}
+static inline int encryption_crypt(const unsigned char* src, unsigned int slen,
+ unsigned char* dst, unsigned int* dlen,
+ const unsigned char* key, unsigned int klen,
+ const unsigned char* iv, unsigned int ivlen,
+ int flags, unsigned int key_id, unsigned int key_version)
+{
+ void *ctx= alloca(encryption_handler.encryption_ctx_size_func((key_id),(key_version)));
+ int res1, res2;
+ unsigned int d1, d2;
+ if ((res1= encryption_handler.encryption_ctx_init_func((ctx),(key),(klen),(iv),(ivlen),(flags),(key_id),(key_version))))
+ return res1;
+ res1= encryption_handler.encryption_ctx_update_func((ctx),(src),(slen),(dst),(&d1));
+ res2= encryption_handler.encryption_ctx_finish_func((ctx),(dst + d1),(&d2));
+ *dlen= d1 + d2;
+ return res1 ? res1 : res2;
+}
struct st_encryption_scheme_key {
unsigned int version;
unsigned char key[16];
@@ -315,8 +322,6 @@ struct st_maria_plugin
const char *version_info;
unsigned int maturity;
};
-#include "plugin_ftparser.h"
-#include "plugin.h"
enum enum_ftparser_mode
{
MYSQL_FTPARSER_SIMPLE_MODE= 0,
@@ -412,6 +417,13 @@ struct st_mariadb_encryption
unsigned int (*get_latest_key_version)(unsigned int key_id);
unsigned int (*get_key)(unsigned int key_id, unsigned int version,
unsigned char *key, unsigned int *key_length);
- encrypt_decrypt_func encrypt;
- encrypt_decrypt_func decrypt;
+ unsigned int (*crypt_ctx_size)(unsigned int key_id, unsigned int key_version);
+ int (*crypt_ctx_init)(void *ctx, const unsigned char* key, unsigned int klen,
+ const unsigned char* iv, unsigned int ivlen,
+ int flags, unsigned int key_id,
+ unsigned int key_version);
+ int (*crypt_ctx_update)(void *ctx, const unsigned char* src, unsigned int slen,
+ unsigned char* dst, unsigned int* dlen);
+ int (*crypt_ctx_finish)(void *ctx, unsigned char* dst, unsigned int* dlen);
+ unsigned int (*encrypted_length)(unsigned int slen, unsigned int key_id, unsigned int key_version);
};
diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp
index 3c07800a656..ee1056a36d7 100644
--- a/include/mysql/plugin_ftparser.h.pp
+++ b/include/mysql/plugin_ftparser.h.pp
@@ -1,15 +1,11 @@
-#include "plugin.h"
typedef char my_bool;
typedef void * MYSQL_PLUGIN;
-#include <mysql/services.h>
-#include <mysql/service_my_snprintf.h>
extern struct my_snprintf_service_st {
size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
} *my_snprintf_service;
size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
-#include <mysql/service_thd_alloc.h>
struct st_mysql_lex_string
{
char *str;
@@ -33,7 +29,6 @@ void *thd_memdup(void* thd, const void* str, unsigned int size);
MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
-#include <mysql/service_thd_wait.h>
typedef enum _thd_wait_type_e {
THD_WAIT_SLEEP= 1,
THD_WAIT_DISKIO= 2,
@@ -54,7 +49,6 @@ extern struct thd_wait_service_st {
} *thd_wait_service;
void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
-#include <mysql/service_progress_report.h>
extern struct progress_report_service_st {
void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
void (*thd_progress_report_func)(void* thd,
@@ -75,9 +69,7 @@ void thd_progress_next_stage(void* thd);
void thd_progress_end(void* thd);
const char *set_thd_proc_info(void*, const char * info, const char *func,
const char *file, unsigned int line);
-#include <mysql/service_debug_sync.h>
extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
-#include <mysql/service_kill_statement.h>
enum thd_kill_levels {
THD_IS_NOT_KILLED=0,
THD_ABORT_SOFTLY=50,
@@ -87,8 +79,6 @@ extern struct kill_statement_service_st {
enum thd_kill_levels (*thd_kill_level_func)(const void*);
} *thd_kill_statement_service;
enum thd_kill_levels thd_kill_level(const void*);
-#include <mysql/service_thd_timezone.h>
-#include "mysql_time.h"
typedef long my_time_t;
enum enum_mysql_timestamp_type
{
@@ -108,7 +98,6 @@ extern struct thd_timezone_service_st {
} *thd_timezone_service;
my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
-#include <mysql/service_sha1.h>
extern struct my_sha1_service_st {
void (*my_sha1_type)(unsigned char*, const char*, size_t);
void (*my_sha1_multi_type)(unsigned char*, ...);
@@ -123,7 +112,6 @@ size_t my_sha1_context_size();
void my_sha1_init(void *context);
void my_sha1_input(void *context, const unsigned char *buf, size_t len);
void my_sha1_result(void *context, unsigned char *digest);
-#include <mysql/service_md5.h>
extern struct my_md5_service_st {
void (*my_md5_type)(unsigned char*, const char*, size_t);
void (*my_md5_multi_type)(unsigned char*, ...);
@@ -138,7 +126,6 @@ size_t my_md5_context_size();
void my_md5_init(void *context);
void my_md5_input(void *context, const unsigned char *buf, size_t len);
void my_md5_result(void *context, unsigned char *digest);
-#include <mysql/service_logger.h>
typedef struct logger_handle_st LOGGER_HANDLE;
extern struct logger_service_st {
void (*logger_init_mutexes)();
@@ -160,14 +147,12 @@ extern struct logger_service_st {
int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...);
int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size);
int logger_rotate(LOGGER_HANDLE *log);
-#include <mysql/service_thd_autoinc.h>
extern struct thd_autoinc_service_st {
void (*thd_get_autoinc_func)(const void* thd,
unsigned long* off, unsigned long* inc);
} *thd_autoinc_service;
void thd_get_autoinc(const void* thd,
unsigned long* off, unsigned long* inc);
-#include <mysql/service_thd_error_context.h>
extern struct thd_error_context_service_st {
const char *(*thd_get_error_message_func)(const void* thd);
unsigned int (*thd_get_error_number_func)(const void* thd);
@@ -185,7 +170,6 @@ void thd_inc_error_row(void* thd);
char *thd_get_error_context_description(void* thd,
char *buffer, unsigned int length,
unsigned int max_query_length);
-#include <mysql/service_thd_specifics.h>
typedef int MYSQL_THD_KEY_T;
extern struct thd_specifics_service_st {
int (*thd_key_create_func)(MYSQL_THD_KEY_T *key);
@@ -197,23 +181,46 @@ int thd_key_create(MYSQL_THD_KEY_T *key);
void thd_key_delete(MYSQL_THD_KEY_T *key);
void* thd_getspecific(void* thd, MYSQL_THD_KEY_T key);
int thd_setspecific(void* thd, MYSQL_THD_KEY_T key, void *value);
-#include <mysql/service_encryption.h>
-typedef int (*encrypt_decrypt_func)(const unsigned char* src, unsigned int slen,
- unsigned char* dst, unsigned int* dlen,
- const unsigned char* key, unsigned int klen,
- const unsigned char* iv, unsigned int ivlen,
- int no_padding, unsigned int key_id,
- unsigned int key_version);
struct encryption_service_st {
- unsigned int (*encryption_key_get_latest_version_func)(unsigned int);
- unsigned int (*encryption_key_id_exists_func)(unsigned int);
- unsigned int (*encryption_key_version_exists_func)(unsigned int, unsigned int);
- unsigned int (*encryption_key_get_func)(unsigned int, unsigned int, unsigned char*, unsigned int*);
- encrypt_decrypt_func encryption_encrypt_func;
- encrypt_decrypt_func encryption_decrypt_func;
+ unsigned int (*encryption_key_get_latest_version_func)(unsigned int key_id);
+ unsigned int (*encryption_key_get_func)(unsigned int key_id, unsigned int key_version,
+ unsigned char* buffer, unsigned int* length);
+ unsigned int (*encryption_ctx_size_func)(unsigned int key_id, unsigned int key_version);
+ int (*encryption_ctx_init_func)(void *ctx, const unsigned char* key, unsigned int klen,
+ const unsigned char* iv, unsigned int ivlen,
+ int flags, unsigned int key_id,
+ unsigned int key_version);
+ int (*encryption_ctx_update_func)(void *ctx, const unsigned char* src, unsigned int slen,
+ unsigned char* dst, unsigned int* dlen);
+ int (*encryption_ctx_finish_func)(void *ctx, unsigned char* dst, unsigned int* dlen);
+ unsigned int (*encryption_encrypted_length_func)(unsigned int slen, unsigned int key_id, unsigned int key_version);
};
extern struct encryption_service_st encryption_handler;
-#include <mysql/service_encryption_scheme.h>
+static inline unsigned int encryption_key_id_exists(unsigned int id)
+{
+ return encryption_handler.encryption_key_get_latest_version_func(id) != (~(unsigned int)0);
+}
+static inline unsigned int encryption_key_version_exists(unsigned int id, unsigned int version)
+{
+ unsigned int unused;
+ return encryption_handler.encryption_key_get_func((id),(version),(NULL),(&unused)) != (~(unsigned int)0);
+}
+static inline int encryption_crypt(const unsigned char* src, unsigned int slen,
+ unsigned char* dst, unsigned int* dlen,
+ const unsigned char* key, unsigned int klen,
+ const unsigned char* iv, unsigned int ivlen,
+ int flags, unsigned int key_id, unsigned int key_version)
+{
+ void *ctx= alloca(encryption_handler.encryption_ctx_size_func((key_id),(key_version)));
+ int res1, res2;
+ unsigned int d1, d2;
+ if ((res1= encryption_handler.encryption_ctx_init_func((ctx),(key),(klen),(iv),(ivlen),(flags),(key_id),(key_version))))
+ return res1;
+ res1= encryption_handler.encryption_ctx_update_func((ctx),(src),(slen),(dst),(&d1));
+ res2= encryption_handler.encryption_ctx_finish_func((ctx),(dst + d1),(&d2));
+ *dlen= d1 + d2;
+ return res1 ? res1 : res2;
+}
struct st_encryption_scheme_key {
unsigned int version;
unsigned char key[16];
@@ -315,7 +322,6 @@ struct st_maria_plugin
const char *version_info;
unsigned int maturity;
};
-#include "plugin_ftparser.h"
struct st_mysql_daemon
{
int interface_version;
diff --git a/include/mysql/plugin_password_validation.h.pp b/include/mysql/plugin_password_validation.h.pp
index 6b8a886dc25..0f14ac1eb53 100644
--- a/include/mysql/plugin_password_validation.h.pp
+++ b/include/mysql/plugin_password_validation.h.pp
@@ -1,15 +1,11 @@
-#include <mysql/plugin.h>
typedef char my_bool;
typedef void * MYSQL_PLUGIN;
-#include <mysql/services.h>
-#include <mysql/service_my_snprintf.h>
extern struct my_snprintf_service_st {
size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
} *my_snprintf_service;
size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
-#include <mysql/service_thd_alloc.h>
struct st_mysql_lex_string
{
char *str;
@@ -33,7 +29,6 @@ void *thd_memdup(void* thd, const void* str, unsigned int size);
MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
-#include <mysql/service_thd_wait.h>
typedef enum _thd_wait_type_e {
THD_WAIT_SLEEP= 1,
THD_WAIT_DISKIO= 2,
@@ -54,7 +49,6 @@ extern struct thd_wait_service_st {
} *thd_wait_service;
void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
-#include <mysql/service_progress_report.h>
extern struct progress_report_service_st {
void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
void (*thd_progress_report_func)(void* thd,
@@ -75,9 +69,7 @@ void thd_progress_next_stage(void* thd);
void thd_progress_end(void* thd);
const char *set_thd_proc_info(void*, const char * info, const char *func,
const char *file, unsigned int line);
-#include <mysql/service_debug_sync.h>
extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
-#include <mysql/service_kill_statement.h>
enum thd_kill_levels {
THD_IS_NOT_KILLED=0,
THD_ABORT_SOFTLY=50,
@@ -87,8 +79,6 @@ extern struct kill_statement_service_st {
enum thd_kill_levels (*thd_kill_level_func)(const void*);
} *thd_kill_statement_service;
enum thd_kill_levels thd_kill_level(const void*);
-#include <mysql/service_thd_timezone.h>
-#include "mysql_time.h"
typedef long my_time_t;
enum enum_mysql_timestamp_type
{
@@ -108,7 +98,6 @@ extern struct thd_timezone_service_st {
} *thd_timezone_service;
my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
-#include <mysql/service_sha1.h>
extern struct my_sha1_service_st {
void (*my_sha1_type)(unsigned char*, const char*, size_t);
void (*my_sha1_multi_type)(unsigned char*, ...);
@@ -123,7 +112,6 @@ size_t my_sha1_context_size();
void my_sha1_init(void *context);
void my_sha1_input(void *context, const unsigned char *buf, size_t len);
void my_sha1_result(void *context, unsigned char *digest);
-#include <mysql/service_md5.h>
extern struct my_md5_service_st {
void (*my_md5_type)(unsigned char*, const char*, size_t);
void (*my_md5_multi_type)(unsigned char*, ...);
@@ -138,7 +126,6 @@ size_t my_md5_context_size();
void my_md5_init(void *context);
void my_md5_input(void *context, const unsigned char *buf, size_t len);
void my_md5_result(void *context, unsigned char *digest);
-#include <mysql/service_logger.h>
typedef struct logger_handle_st LOGGER_HANDLE;
extern struct logger_service_st {
void (*logger_init_mutexes)();
@@ -160,14 +147,12 @@ extern struct logger_service_st {
int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...);
int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size);
int logger_rotate(LOGGER_HANDLE *log);
-#include <mysql/service_thd_autoinc.h>
extern struct thd_autoinc_service_st {
void (*thd_get_autoinc_func)(const void* thd,
unsigned long* off, unsigned long* inc);
} *thd_autoinc_service;
void thd_get_autoinc(const void* thd,
unsigned long* off, unsigned long* inc);
-#include <mysql/service_thd_error_context.h>
extern struct thd_error_context_service_st {
const char *(*thd_get_error_message_func)(const void* thd);
unsigned int (*thd_get_error_number_func)(const void* thd);
@@ -185,7 +170,6 @@ void thd_inc_error_row(void* thd);
char *thd_get_error_context_description(void* thd,
char *buffer, unsigned int length,
unsigned int max_query_length);
-#include <mysql/service_thd_specifics.h>
typedef int MYSQL_THD_KEY_T;
extern struct thd_specifics_service_st {
int (*thd_key_create_func)(MYSQL_THD_KEY_T *key);
@@ -197,23 +181,46 @@ int thd_key_create(MYSQL_THD_KEY_T *key);
void thd_key_delete(MYSQL_THD_KEY_T *key);
void* thd_getspecific(void* thd, MYSQL_THD_KEY_T key);
int thd_setspecific(void* thd, MYSQL_THD_KEY_T key, void *value);
-#include <mysql/service_encryption.h>
-typedef int (*encrypt_decrypt_func)(const unsigned char* src, unsigned int slen,
- unsigned char* dst, unsigned int* dlen,
- const unsigned char* key, unsigned int klen,
- const unsigned char* iv, unsigned int ivlen,
- int no_padding, unsigned int key_id,
- unsigned int key_version);
struct encryption_service_st {
- unsigned int (*encryption_key_get_latest_version_func)(unsigned int);
- unsigned int (*encryption_key_id_exists_func)(unsigned int);
- unsigned int (*encryption_key_version_exists_func)(unsigned int, unsigned int);
- unsigned int (*encryption_key_get_func)(unsigned int, unsigned int, unsigned char*, unsigned int*);
- encrypt_decrypt_func encryption_encrypt_func;
- encrypt_decrypt_func encryption_decrypt_func;
+ unsigned int (*encryption_key_get_latest_version_func)(unsigned int key_id);
+ unsigned int (*encryption_key_get_func)(unsigned int key_id, unsigned int key_version,
+ unsigned char* buffer, unsigned int* length);
+ unsigned int (*encryption_ctx_size_func)(unsigned int key_id, unsigned int key_version);
+ int (*encryption_ctx_init_func)(void *ctx, const unsigned char* key, unsigned int klen,
+ const unsigned char* iv, unsigned int ivlen,
+ int flags, unsigned int key_id,
+ unsigned int key_version);
+ int (*encryption_ctx_update_func)(void *ctx, const unsigned char* src, unsigned int slen,
+ unsigned char* dst, unsigned int* dlen);
+ int (*encryption_ctx_finish_func)(void *ctx, unsigned char* dst, unsigned int* dlen);
+ unsigned int (*encryption_encrypted_length_func)(unsigned int slen, unsigned int key_id, unsigned int key_version);
};
extern struct encryption_service_st encryption_handler;
-#include <mysql/service_encryption_scheme.h>
+static inline unsigned int encryption_key_id_exists(unsigned int id)
+{
+ return encryption_handler.encryption_key_get_latest_version_func(id) != (~(unsigned int)0);
+}
+static inline unsigned int encryption_key_version_exists(unsigned int id, unsigned int version)
+{
+ unsigned int unused;
+ return encryption_handler.encryption_key_get_func((id),(version),(NULL),(&unused)) != (~(unsigned int)0);
+}
+static inline int encryption_crypt(const unsigned char* src, unsigned int slen,
+ unsigned char* dst, unsigned int* dlen,
+ const unsigned char* key, unsigned int klen,
+ const unsigned char* iv, unsigned int ivlen,
+ int flags, unsigned int key_id, unsigned int key_version)
+{
+ void *ctx= alloca(encryption_handler.encryption_ctx_size_func((key_id),(key_version)));
+ int res1, res2;
+ unsigned int d1, d2;
+ if ((res1= encryption_handler.encryption_ctx_init_func((ctx),(key),(klen),(iv),(ivlen),(flags),(key_id),(key_version))))
+ return res1;
+ res1= encryption_handler.encryption_ctx_update_func((ctx),(src),(slen),(dst),(&d1));
+ res2= encryption_handler.encryption_ctx_finish_func((ctx),(dst + d1),(&d2));
+ *dlen= d1 + d2;
+ return res1 ? res1 : res2;
+}
struct st_encryption_scheme_key {
unsigned int version;
unsigned char key[16];
@@ -315,8 +322,6 @@ struct st_maria_plugin
const char *version_info;
unsigned int maturity;
};
-#include "plugin_ftparser.h"
-#include "plugin.h"
enum enum_ftparser_mode
{
MYSQL_FTPARSER_SIMPLE_MODE= 0,
diff --git a/include/mysql/psi/mysql_socket.h b/include/mysql/psi/mysql_socket.h
index e1d56539f85..33768b20fa8 100644
--- a/include/mysql/psi/mysql_socket.h
+++ b/include/mysql/psi/mysql_socket.h
@@ -553,7 +553,7 @@ inline_mysql_socket_socket
int domain, int type, int protocol)
{
MYSQL_SOCKET mysql_socket= MYSQL_INVALID_SOCKET;
- mysql_socket.fd= socket(domain, type, protocol);
+ mysql_socket.fd= socket(domain, type | SOCK_CLOEXEC, protocol);
#ifdef HAVE_PSI_SOCKET_INTERFACE
if (likely(mysql_socket.fd != INVALID_SOCKET))
@@ -1013,6 +1013,8 @@ inline_mysql_socket_accept
#endif
MYSQL_SOCKET socket_listen, struct sockaddr *addr, socklen_t *addr_len)
{
+ int flags;
+
MYSQL_SOCKET socket_accept= MYSQL_INVALID_SOCKET;
socklen_t addr_length= (addr_len != NULL) ? *addr_len : 0;
@@ -1026,7 +1028,19 @@ inline_mysql_socket_accept
(&state, socket_listen.m_psi, PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line);
/* Instrumented code */
+#ifdef HAVE_ACCEPT4
+ socket_accept.fd= accept4(socket_listen.fd, addr, &addr_length,
+ SOCK_CLOEXEC);
+#else
socket_accept.fd= accept(socket_listen.fd, addr, &addr_length);
+#ifdef FD_CLOEXEC
+ flags= fcntl(socket_accept.fd, F_GETFD);
+ if (flags != -1) {
+ flags |= FD_CLOEXEC;
+ fcntl(socket_accept.fd, F_SETFD, flags);
+ }
+#endif
+#endif
/* Instrumentation end */
if (locker != NULL)
@@ -1036,7 +1050,19 @@ inline_mysql_socket_accept
#endif
{
/* Non instrumented code */
+#ifdef HAVE_ACCEPT4
+ socket_accept.fd= accept4(socket_listen.fd, addr, &addr_length,
+ SOCK_CLOEXEC);
+#else
socket_accept.fd= accept(socket_listen.fd, addr, &addr_length);
+#ifdef FD_CLOEXEC
+ flags= fcntl(socket_accept.fd, F_GETFD);
+ if (flags != -1) {
+ flags |= FD_CLOEXEC;
+ fcntl(socket_accept.fd, F_SETFD, flags);
+ }
+#endif
+#endif
}
#ifdef HAVE_PSI_SOCKET_INTERFACE
diff --git a/include/mysql/psi/mysql_table.h b/include/mysql/psi/mysql_table.h
index bd703d75e1f..74217a32b13 100644
--- a/include/mysql/psi/mysql_table.h
+++ b/include/mysql/psi/mysql_table.h
@@ -30,6 +30,9 @@
*/
#ifdef HAVE_PSI_TABLE_INTERFACE
+#define MYSQL_UNBIND_TABLE(handler) (handler)->unbind_psi()
+#define MYSQL_REBIND_TABLE(handler) (handler)->rebind_psi()
+
#define PSI_CALL_unbind_table PSI_TABLE_CALL(unbind_table)
#define PSI_CALL_rebind_table PSI_TABLE_CALL(rebind_table)
#define PSI_CALL_open_table PSI_TABLE_CALL(open_table)
@@ -38,13 +41,16 @@
#define PSI_CALL_release_table_share PSI_TABLE_CALL(release_table_share)
#define PSI_CALL_drop_table_share PSI_TABLE_CALL(drop_table_share)
#else
-#define PSI_CALL_unbind_table(A1) /* no-op */
+#define MYSQL_UNBIND_TABLE(handler) do { } while(0)
+#define MYSQL_REBIND_TABLE(handler) do { } while(0)
+
+#define PSI_CALL_unbind_table(A1) do { } while(0)
#define PSI_CALL_rebind_table(A1,A2,A3) NULL
-#define PSI_CALL_close_table(A1) /* no-op */
+#define PSI_CALL_close_table(A1) do { } while(0)
#define PSI_CALL_open_table(A1,A2) NULL
#define PSI_CALL_get_table_share(A1,A2) NULL
-#define PSI_CALL_release_table_share(A1) /* no-op */
-#define PSI_CALL_drop_table_share(A1,A2,A3,A4,A5) /* no-op */
+#define PSI_CALL_release_table_share(A1) do { } while(0)
+#define PSI_CALL_drop_table_share(A1,A2,A3,A4,A5) do { } while(0)
#endif
/**
diff --git a/include/mysql/psi/psi_abi_v1.h.pp b/include/mysql/psi/psi_abi_v1.h.pp
index 898b9871d2e..e9b514feb8a 100644
--- a/include/mysql/psi/psi_abi_v1.h.pp
+++ b/include/mysql/psi/psi_abi_v1.h.pp
@@ -1,4 +1,3 @@
-#include "mysql/psi/psi.h"
C_MODE_START
struct TABLE_SHARE;
struct sql_digest_storage;
diff --git a/include/mysql/psi/psi_abi_v2.h.pp b/include/mysql/psi/psi_abi_v2.h.pp
index c3dba0a9b76..4e81fd66ca4 100644
--- a/include/mysql/psi/psi_abi_v2.h.pp
+++ b/include/mysql/psi/psi_abi_v2.h.pp
@@ -1,4 +1,3 @@
-#include "mysql/psi/psi.h"
C_MODE_START
struct TABLE_SHARE;
struct sql_digest_storage;
diff --git a/include/mysql/service_encryption.h b/include/mysql/service_encryption.h
index 2b79e00fa40..eb1a6b0e629 100644
--- a/include/mysql/service_encryption.h
+++ b/include/mysql/service_encryption.h
@@ -20,7 +20,7 @@
Functions to support data encryption and encryption key management.
They are normally implemented in an encryption plugin, so this service
- connects encryption *consumers* (storage engines) to the encryption
+ connects encryption *consumers* (e.g. storage engines) to the encryption
*provider* (encryption plugin).
*/
@@ -28,6 +28,15 @@
extern "C" {
#endif
+#ifndef MYSQL_ABI_CHECK
+#ifdef _WIN32
+#include <malloc.h>
+#define inline __inline
+#else
+#include <alloca.h>
+#endif
+#endif
+
/* returned from encryption_key_get_latest_version() */
#define ENCRYPTION_KEY_VERSION_INVALID (~(unsigned int)0)
#define ENCRYPTION_KEY_NOT_ENCRYPTED (0)
@@ -38,20 +47,23 @@ extern "C" {
/* returned from encryption_key_get() */
#define ENCRYPTION_KEY_BUFFER_TOO_SMALL (100)
-typedef int (*encrypt_decrypt_func)(const unsigned char* src, unsigned int slen,
- unsigned char* dst, unsigned int* dlen,
- const unsigned char* key, unsigned int klen,
- const unsigned char* iv, unsigned int ivlen,
- int no_padding, unsigned int key_id,
- unsigned int key_version);
+#define ENCRYPTION_FLAG_DECRYPT 0
+#define ENCRYPTION_FLAG_ENCRYPT 1
+#define ENCRYPTION_FLAG_NOPAD 2
struct encryption_service_st {
- unsigned int (*encryption_key_get_latest_version_func)(unsigned int);
- unsigned int (*encryption_key_id_exists_func)(unsigned int);
- unsigned int (*encryption_key_version_exists_func)(unsigned int, unsigned int);
- unsigned int (*encryption_key_get_func)(unsigned int, unsigned int, unsigned char*, unsigned int*);
- encrypt_decrypt_func encryption_encrypt_func;
- encrypt_decrypt_func encryption_decrypt_func;
+ unsigned int (*encryption_key_get_latest_version_func)(unsigned int key_id);
+ unsigned int (*encryption_key_get_func)(unsigned int key_id, unsigned int key_version,
+ unsigned char* buffer, unsigned int* length);
+ unsigned int (*encryption_ctx_size_func)(unsigned int key_id, unsigned int key_version);
+ int (*encryption_ctx_init_func)(void *ctx, const unsigned char* key, unsigned int klen,
+ const unsigned char* iv, unsigned int ivlen,
+ int flags, unsigned int key_id,
+ unsigned int key_version);
+ int (*encryption_ctx_update_func)(void *ctx, const unsigned char* src, unsigned int slen,
+ unsigned char* dst, unsigned int* dlen);
+ int (*encryption_ctx_finish_func)(void *ctx, unsigned char* dst, unsigned int* dlen);
+ unsigned int (*encryption_encrypted_length_func)(unsigned int slen, unsigned int key_id, unsigned int key_version);
};
#ifdef MYSQL_DYNAMIC_PLUGIN
@@ -59,23 +71,53 @@ struct encryption_service_st {
extern struct encryption_service_st *encryption_service;
#define encryption_key_get_latest_version(KI) encryption_service->encryption_key_get_latest_version_func(KI)
-#define encryption_key_id_exists(KI) encryption_service->encryption_key_id_exists_func((KI))
-#define encryption_key_version_exists(KI,KV) encryption_service->encryption_key_version_exists_func((KI),(KV))
#define encryption_key_get(KI,KV,K,S) encryption_service->encryption_key_get_func((KI),(KV),(K),(S))
-#define encryption_encrypt(S,SL,D,DL,K,KL,I,IL,NP,KI,KV) encryption_service->encryption_encrypt_func((S),(SL),(D),(DL),(K),(KL),(I),(IL),(NP),(KI),(KV))
-#define encryption_decrypt(S,SL,D,DL,K,KL,I,IL,NP,KI,KV) encryption_service->encryption_decrypt_func((S),(SL),(D),(DL),(K),(KL),(I),(IL),(NP),(KI),(KV))
+#define encryption_ctx_size(KI,KV) encryption_service->encryption_ctx_size_func((KI),(KV))
+#define encryption_ctx_init(CTX,K,KL,IV,IVL,F,KI,KV) encryption_service->encryption_ctx_init_func((CTX),(K),(KL),(IV),(IVL),(F),(KI),(KV))
+#define encryption_ctx_update(CTX,S,SL,D,DL) encryption_service->encryption_ctx_update_func((CTX),(S),(SL),(D),(DL))
+#define encryption_ctx_finish(CTX,D,DL) encryption_service->encryption_ctx_finish_func((CTX),(D),(DL))
+#define encryption_encrypted_length(SL,KI,KV) encryption_service->encryption_encrypted_length_func((SL),(KI),(KV))
#else
extern struct encryption_service_st encryption_handler;
#define encryption_key_get_latest_version(KI) encryption_handler.encryption_key_get_latest_version_func(KI)
-#define encryption_key_id_exists(KI) encryption_handler.encryption_key_id_exists_func((KI))
-#define encryption_key_version_exists(KI,KV) encryption_handler.encryption_key_version_exists_func((KI),(KV))
#define encryption_key_get(KI,KV,K,S) encryption_handler.encryption_key_get_func((KI),(KV),(K),(S))
-#define encryption_encrypt(S,SL,D,DL,K,KL,I,IL,NP,KI,KV) encryption_handler.encryption_encrypt_func((S),(SL),(D),(DL),(K),(KL),(I),(IL),(NP),(KI),(KV))
-#define encryption_decrypt(S,SL,D,DL,K,KL,I,IL,NP,KI,KV) encryption_handler.encryption_decrypt_func((S),(SL),(D),(DL),(K),(KL),(I),(IL),(NP),(KI),(KV))
+#define encryption_ctx_size(KI,KV) encryption_handler.encryption_ctx_size_func((KI),(KV))
+#define encryption_ctx_init(CTX,K,KL,IV,IVL,F,KI,KV) encryption_handler.encryption_ctx_init_func((CTX),(K),(KL),(IV),(IVL),(F),(KI),(KV))
+#define encryption_ctx_update(CTX,S,SL,D,DL) encryption_handler.encryption_ctx_update_func((CTX),(S),(SL),(D),(DL))
+#define encryption_ctx_finish(CTX,D,DL) encryption_handler.encryption_ctx_finish_func((CTX),(D),(DL))
+#define encryption_encrypted_length(SL,KI,KV) encryption_handler.encryption_encrypted_length_func((SL),(KI),(KV))
#endif
+static inline unsigned int encryption_key_id_exists(unsigned int id)
+{
+ return encryption_key_get_latest_version(id) != ENCRYPTION_KEY_VERSION_INVALID;
+}
+
+static inline unsigned int encryption_key_version_exists(unsigned int id, unsigned int version)
+{
+ unsigned int unused;
+ return encryption_key_get(id, version, NULL, &unused) != ENCRYPTION_KEY_VERSION_INVALID;
+}
+
+static inline int encryption_crypt(const unsigned char* src, unsigned int slen,
+ unsigned char* dst, unsigned int* dlen,
+ const unsigned char* key, unsigned int klen,
+ const unsigned char* iv, unsigned int ivlen,
+ int flags, unsigned int key_id, unsigned int key_version)
+{
+ void *ctx= alloca(encryption_ctx_size(key_id, key_version));
+ int res1, res2;
+ unsigned int d1, d2;
+ if ((res1= encryption_ctx_init(ctx, key, klen, iv, ivlen, flags, key_id, key_version)))
+ return res1;
+ res1= encryption_ctx_update(ctx, src, slen, dst, &d1);
+ res2= encryption_ctx_finish(ctx, dst + d1, &d2);
+ *dlen= d1 + d2;
+ return res1 ? res1 : res2;
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/include/mysql/service_wsrep.h b/include/mysql/service_wsrep.h
index bc05559064a..93567c1927d 100644
--- a/include/mysql/service_wsrep.h
+++ b/include/mysql/service_wsrep.h
@@ -1,5 +1,5 @@
#ifndef MYSQL_SERVICE_WSREP_INCLUDED
-/* Copyright (c) 2013, Monty Program Ab
+/* Copyright (c) 2015 MariaDB Corporation Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -38,9 +38,16 @@ enum wsrep_conflict_state {
};
enum wsrep_exec_mode {
+ /* Transaction processing before replication. */
LOCAL_STATE,
+ /* Slave thread applying write sets from other nodes or replaying thread. */
REPL_RECV,
+ /* Total-order-isolation mode. */
TOTAL_ORDER,
+ /*
+ Transaction procession after it has been replicated in prepare stage and
+ has passed certification.
+ */
LOCAL_COMMIT
};
@@ -69,6 +76,7 @@ extern struct wsrep_service_st {
my_bool (*get_wsrep_certify_nonPK_func)();
my_bool (*get_wsrep_debug_func)();
my_bool (*get_wsrep_drupal_282555_workaround_func)();
+ my_bool (*get_wsrep_recovery_func)();
my_bool (*get_wsrep_load_data_splitting_func)();
my_bool (*get_wsrep_log_conflicts_func)();
long (*get_wsrep_protocol_version_func)();
@@ -108,6 +116,7 @@ extern struct wsrep_service_st {
#define get_wsrep_certify_nonPK() wsrep_service->get_wsrep_certify_nonPK_func()
#define get_wsrep_debug() wsrep_service->get_wsrep_debug_func()
#define get_wsrep_drupal_282555_workaround() wsrep_service->get_wsrep_drupal_282555_workaround_func()
+#define get_wsrep_recovery() wsrep_service->get_wsrep_recovery_func()
#define get_wsrep_load_data_splitting() wsrep_service->get_wsrep_load_data_splitting_func()
#define get_wsrep_log_conflicts() wsrep_service->get_wsrep_log_conflicts_func()
#define get_wsrep_protocol_version() wsrep_service->get_wsrep_protocol_version_func()
@@ -146,6 +155,7 @@ extern struct wsrep_service_st {
#define wsrep_certify_nonPK get_wsrep_certify_nonPK()
#define wsrep_load_data_splitting get_wsrep_load_data_splitting()
#define wsrep_drupal_282555_workaround get_wsrep_drupal_282555_workaround()
+#define wsrep_recovery get_wsrep_recovery()
#define wsrep_protocol_version get_wsrep_protocol_version()
#else
@@ -155,6 +165,7 @@ extern my_bool wsrep_log_conflicts;
extern my_bool wsrep_certify_nonPK;
extern my_bool wsrep_load_data_splitting;
extern my_bool wsrep_drupal_282555_workaround;
+extern my_bool wsrep_recovery;
extern long wsrep_protocol_version;
bool wsrep_consistency_check(THD *thd);
@@ -178,6 +189,7 @@ long long wsrep_thd_trx_seqno(THD *thd);
my_bool get_wsrep_certify_nonPK();
my_bool get_wsrep_debug();
my_bool get_wsrep_drupal_282555_workaround();
+my_bool get_wsrep_recovery();
my_bool get_wsrep_load_data_splitting();
my_bool get_wsrep_log_conflicts();
my_bool wsrep_aborting_thd_contains(THD *thd);
diff --git a/include/mysql_com.h b/include/mysql_com.h
index fe014233dc7..a226c59bc9b 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -386,10 +386,7 @@ typedef struct st_net {
queries in cache that have not stored its results yet
*/
#endif
- /*
- Unused, please remove with the next incompatible ABI change.
- */
- unsigned char *unused;
+ void *thd; /* Used by MariaDB server to avoid calling current_thd */
unsigned int last_errno;
unsigned char error;
my_bool unused4; /* Please remove with the next incompatible ABI change. */
@@ -517,7 +514,7 @@ enum enum_mysql_set_option
extern "C" {
#endif
-my_bool my_net_init(NET *net, Vio* vio, unsigned int my_flags);
+my_bool my_net_init(NET *net, Vio* vio, void *thd, unsigned int my_flags);
void my_net_local_init(NET *net);
void net_end(NET *net);
void net_clear(NET *net, my_bool clear_buffer);
@@ -550,7 +547,7 @@ struct my_rnd_struct;
enum Item_result
{
STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT, DECIMAL_RESULT,
- TIME_RESULT,IMPOSSIBLE_RESULT
+ TIME_RESULT
};
typedef struct st_udf_args
diff --git a/include/service_versions.h b/include/service_versions.h
index 79b36092a0d..58d5f41c4a3 100644
--- a/include/service_versions.h
+++ b/include/service_versions.h
@@ -35,6 +35,6 @@
#define VERSION_thd_autoinc 0x0100
#define VERSION_thd_error_context 0x0100
#define VERSION_thd_specifics 0x0100
-#define VERSION_encryption 0x0200
+#define VERSION_encryption 0x0300
#define VERSION_encryption_scheme 0x0100
diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt
index 9dd58bebbbe..7dfc572b281 100644
--- a/libmysql/CMakeLists.txt
+++ b/libmysql/CMakeLists.txt
@@ -381,7 +381,7 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
CONFIGURE_FILE(
${VERSION_SCRIPT_TEMPLATE}
${CMAKE_CURRENT_BINARY_DIR}/libmysql_versions.ld
- @ONLY@
+ @ONLY
)
SET(VERSION_SCRIPT_LINK_FLAGS
"-Wl,${CMAKE_CURRENT_BINARY_DIR}/libmysql_versions.ld")
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index caf0309710e..8af5a284b9a 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -1507,6 +1507,12 @@ my_bool cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
memory
*/
+#ifdef EMBEDDED_LIBRARY
+#define STMT_INIT_PREALLOC(S) 0
+#else
+#define STMT_INIT_PREALLOC(S) S
+#endif /*EMBEDDED_LIBRARY*/
+
MYSQL_STMT * STDCALL
mysql_stmt_init(MYSQL *mysql)
{
@@ -1525,8 +1531,10 @@ mysql_stmt_init(MYSQL *mysql)
DBUG_RETURN(NULL);
}
- init_alloc_root(&stmt->mem_root, 2048, 2048, MYF(MY_THREAD_SPECIFIC));
- init_alloc_root(&stmt->result.alloc, 4096, 4096, MYF(MY_THREAD_SPECIFIC));
+ init_alloc_root(&stmt->mem_root, 2048, STMT_INIT_PREALLOC(2048),
+ MYF(MY_THREAD_SPECIFIC));
+ init_alloc_root(&stmt->result.alloc, 4096, STMT_INIT_PREALLOC(4096),
+ MYF(MY_THREAD_SPECIFIC));
stmt->result.alloc.min_malloc= sizeof(MYSQL_ROWS);
mysql->stmts= list_add(mysql->stmts, &stmt->list);
stmt->list.data= stmt;
@@ -1543,6 +1551,8 @@ mysql_stmt_init(MYSQL *mysql)
DBUG_RETURN(stmt);
}
+#undef STMT_INIT_PREALLOC
+
/*
Prepare server side statement with query.
diff --git a/libservices/HOWTO b/libservices/HOWTO
index 9f1fc2dba2b..69d96f8aa25 100644
--- a/libservices/HOWTO
+++ b/libservices/HOWTO
@@ -84,7 +84,7 @@ it should also declare all the accompanying data structures, as necessary
7. add the new file to libservices/CMakeLists.txt (MYSQLSERVICES_SOURCES)
8. Add all new files to repository (bzr add)
9. and finally, register your service for dynamic linking in
- sql/sql_plugin_services.h as follows:
+ sql/sql_plugin_services.ic as follows:
9.1 fill in the service structure:
==================================================================
static struct foo_service_st foo_handler = {
diff --git a/mysql-test/disabled.def b/mysql-test/disabled.def
index c0aed63e8be..555b7177228 100644
--- a/mysql-test/disabled.def
+++ b/mysql-test/disabled.def
@@ -23,3 +23,4 @@ ssl_crl_clrpath : broken upstream
innodb-wl5522-debug-zip : broken upstream
innodb_bug12902967 : broken upstream
file_contents : MDEV-6526 these files are not installed anymore
+max_statement_time : cannot possibly work, depends on timing
diff --git a/mysql-test/extra/binlog_tests/database.test b/mysql-test/extra/binlog_tests/database.test
index cd0266434ff..05a00c58840 100644
--- a/mysql-test/extra/binlog_tests/database.test
+++ b/mysql-test/extra/binlog_tests/database.test
@@ -84,7 +84,7 @@ CREATE TABLE t3 (a INT, KEY (a), FOREIGN KEY(a) REFERENCES db1.t2(b))
engine=innodb;
RESET MASTER;
---error ER_ROW_IS_REFERENCED
+--error ER_ROW_IS_REFERENCED_2
DROP DATABASE db1; # Fails because of the fk
SHOW TABLES FROM db1; # t1 was dropped, t2 remains
--source include/show_binlog_events.inc # Check that the binlog drops t1
diff --git a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
index 48e922d2e67..74fbe6b482a 100644
--- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
+++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
@@ -228,7 +228,7 @@ rollback;
create table t0 (n int);
insert t0 select * from t1;
set autocommit=1;
-insert into t0 select GET_LOCK("lock1",null);
+insert into t0 select GET_LOCK("lock1",0);
set autocommit=0;
create table t2 (n int) engine=innodb;
insert into t2 values (3);
diff --git a/mysql-test/extra/binlog_tests/mysqlbinlog_row_engine.inc b/mysql-test/extra/binlog_tests/mysqlbinlog_row_engine.inc
index 95440ab04a0..c072d503d00 100644
--- a/mysql-test/extra/binlog_tests/mysqlbinlog_row_engine.inc
+++ b/mysql-test/extra/binlog_tests/mysqlbinlog_row_engine.inc
@@ -16,6 +16,7 @@
#
--source include/have_log_bin.inc
+set sql_mode="";
SET NAMES 'utf8';
#SHOW VARIABLES LIKE 'character_set%';
diff --git a/mysql-test/extra/rpl_tests/rpl_ddl.test b/mysql-test/extra/rpl_tests/rpl_ddl.test
index 34897d00733..21778a11df5 100644
--- a/mysql-test/extra/rpl_tests/rpl_ddl.test
+++ b/mysql-test/extra/rpl_tests/rpl_ddl.test
@@ -128,6 +128,8 @@
###############################################################
# Some preparations
###############################################################
+set global sql_mode='';
+set local sql_mode='';
# The sync_slave_with_master is needed to make the xids deterministic.
sync_slave_with_master;
@@ -609,3 +611,5 @@ DROP TEMPORARY TABLE mysqltest1.t22;
DROP DATABASE mysqltest1;
# mysqltest2 was alreday DROPPED some tests before.
DROP DATABASE mysqltest3;
+
+set global sql_mode=default;
diff --git a/mysql-test/extra/rpl_tests/rpl_row_img.test b/mysql-test/extra/rpl_tests/rpl_row_img.test
new file mode 100644
index 00000000000..b905b81c4c6
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_row_img.test
@@ -0,0 +1,241 @@
+# WL#5096
+#
+# Description
+# ===========
+#
+# This test case checks replication between hosts with same index
+# structure but may differ on engines.
+#
+# Usage
+# =====
+#
+# Before including this file the following variables should be set:
+# * $server_1_engine
+# * $server_2_engine
+# * $server_3_engine
+#
+# Example:
+#
+# -- let $server_1_engine= Falcon
+# -- let $server_2_engine= MyISAM
+# -- let $server_3_engine= InnoDB
+#
+# -- source extra/rpl_tests/rpl_row_img.test
+#
+
+-- connection server_1
+
+-- let $diff_table=test.t
+
+let $i= 12;
+while($i)
+{
+ let $step= "";
+
+ -- connection server_1
+ SET SQL_LOG_BIN=0;
+
+ -- connection server_2
+ SET SQL_LOG_BIN=0;
+
+ -- connection server_3
+ SET SQL_LOG_BIN=0;
+
+ if ($i == 1) {
+ let $step= No keys;
+ --echo ******* TEST: $step
+ -- connection server_1
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= $server_1_engine;
+ -- connection server_2
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= $server_2_engine;
+ -- connection server_3
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= $server_3_engine;
+
+ }
+ if ($i == 2)
+ {
+ let $step= One key;
+ --echo ******* TEST: $step
+ -- connection server_1
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= $server_1_engine;
+ -- connection server_2
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= $server_2_engine;
+ -- connection server_3
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= $server_3_engine;
+
+ }
+ if ($i == 3)
+ {
+ let $step= One Composite key;
+ --echo ****** TEST: $step
+ -- connection server_1
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= $server_1_engine;
+ -- connection server_2
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= $server_2_engine;
+ -- connection server_3
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= $server_3_engine;
+ }
+ if ($i == 4)
+ {
+ let $step= One Unique key;
+ --echo ****** TEST: $step
+ -- connection server_1
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= $server_1_engine;
+ -- connection server_2
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= $server_2_engine;
+ -- connection server_3
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= $server_3_engine;
+
+ }
+ if ($i == 5)
+ {
+ let $step= One Composite Unique key;
+ --echo ****** TEST: $step
+ -- connection server_1
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= $server_1_engine;
+ -- connection server_2
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= $server_2_engine;
+ -- connection server_3
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= $server_3_engine;
+
+ }
+ if ($i == 6)
+ {
+ let $step= One Primary key;
+ --echo ****** TEST: $step
+ -- connection server_1
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= $server_1_engine;
+ -- connection server_2
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= $server_2_engine;
+ -- connection server_3
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= $server_3_engine;
+ }
+ if ($i == 7)
+ {
+ let $step= One Composite Primary Key;
+ --echo ****** TEST: $step
+ -- connection server_1
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= $server_1_engine;
+ -- connection server_2
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= $server_2_engine;
+ -- connection server_3
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= $server_3_engine;
+ }
+ if ($i == 8)
+ {
+ let $step= One Composite key with holes;
+ --echo ****** TEST: $step
+ -- connection server_1
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= $server_1_engine;
+ -- connection server_2
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= $server_2_engine;
+ -- connection server_3
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= $server_3_engine;
+ }
+ if ($i == 9)
+ {
+ let $step= One Composite Unique key with holes;
+ --echo ****** TEST: $step
+ -- connection server_1
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= $server_1_engine;
+ -- connection server_2
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= $server_2_engine;
+ -- connection server_3
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= $server_3_engine;
+ }
+ if ($i == 10)
+ {
+ let $step= One Composite Primary Key with holes;
+ --echo ****** TEST: $step
+ -- connection server_1
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= $server_1_engine;
+ -- connection server_2
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= $server_2_engine;
+ -- connection server_3
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= $server_3_engine;
+ }
+ if ($i == 11)
+ {
+ let $step= One Composite NOT NULL Unique key with holes;
+ --echo ****** TEST: $step
+ -- connection server_1
+ --eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_1_engine;
+ -- connection server_2
+ --eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_2_engine;
+ -- connection server_3
+ --eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_3_engine;
+ }
+ if ($i == 12)
+ {
+ let $step= One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave;
+ --echo ****** TEST: $step
+ -- connection server_1
+ --eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_1_engine;
+ -- connection server_2
+ --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= $server_2_engine;
+ -- connection server_3
+ --eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_3_engine;
+ }
+
+ -- connection server_1
+ SET SQL_LOG_BIN=1;
+
+ -- connection server_2
+ SET SQL_LOG_BIN=1;
+
+ -- connection server_3
+ SET SQL_LOG_BIN=1;
+
+ -- connection server_1
+ INSERT INTO t VALUES (1, '1', '1', '1' );
+ INSERT INTO t VALUES (4, '4', '4', '4' );
+ INSERT INTO t VALUES (7, '7', '7', '7' );
+
+ INSERT INTO t VALUES (9, '9', '9', NULL );
+
+ INSERT INTO t VALUES (2, '1', '2', '2' );
+ INSERT INTO t VALUES (3, '1', '3', '2' );
+
+ -- source include/rpl_sync.inc
+
+ -- connection server_1
+ UPDATE t SET c4 = '7';
+
+ UPDATE t SET c4 = '5' WHERE c1 = 1;
+ UPDATE t SET c2 = '5' WHERE c1 = 1;
+ UPDATE t SET c1 = '5' WHERE c1 = 1;
+
+ UPDATE t SET c4 = '8' WHERE c2 = '4';
+ UPDATE t SET c1 = '8' WHERE c2 = '4';
+ UPDATE t SET c2 = '8' WHERE c2 = '4';
+
+ UPDATE t SET c3 = '0' WHERE c4 = NULL;
+ UPDATE t SET c2 = '0' WHERE c4 = '0';
+
+ UPDATE t SET c2 = '2' WHERE c4 = '2';
+
+ -- source include/rpl_sync.inc
+
+ -- let $diff_tables= server_1:$diff_table, server_2:$diff_table, server_3:$diff_table
+ -- source include/diff_tables.inc
+
+
+ -- connection server_1
+
+ DELETE FROM t WHERE c1 = 7;
+ DELETE FROM t WHERE c1 = 8;
+ DELETE FROM t;
+
+ -- source include/rpl_sync.inc
+
+ -- let $diff_tables= server_1:$diff_table, server_2:$diff_table, server_3:$diff_table
+ -- source include/diff_tables.inc
+
+ -- connection server_1
+
+ DROP TABLE t;
+
+ -- source include/rpl_sync.inc
+
+ dec $i;
+}
diff --git a/mysql-test/extra/rpl_tests/rpl_row_img_blobs.test b/mysql-test/extra/rpl_tests/rpl_row_img_blobs.test
new file mode 100644
index 00000000000..9d3a0a593e3
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_row_img_blobs.test
@@ -0,0 +1,179 @@
+# WL#5096
+#
+# Description
+# ===========
+#
+# This test case covers Requirements for replication using different
+# combinations of indexes and blob fields.
+#
+# It acts as a complement for rpl_row_img_sanity tests as it checks
+# that in a chained replication scenario, replication does not break.
+#
+# Usage
+# =====
+#
+# Before including this file the following variables should be set:
+# * $server_1_engine
+# * $server_2_engine
+# * $server_3_engine
+#
+# Example:
+#
+# -- let $server_1_engine= Falcon
+# -- let $server_2_engine= MyISAM
+# -- let $server_3_engine= InnoDB
+#
+# -- source extra/rpl_tests/rpl_row_img_blobs.test
+#
+
+-- connection server_1
+
+-- let $diff_table=test.t
+let $i= 7;
+while($i)
+{
+ -- connection server_1
+ SET SQL_LOG_BIN=0;
+
+ -- connection server_2
+ SET SQL_LOG_BIN=0;
+
+ -- connection server_3
+ SET SQL_LOG_BIN=0;
+
+ #
+ # The comments below (on create table) must be read with the SQL
+ # instructions issued later in mind. Declaring a table obviously is
+ # not enough to assert anything.
+ #
+ # Also, the tests in this file make more sense when performed with
+ # binlog_row_image configured as NOBLOB.
+ #
+
+ if ($i == 1) {
+ -- echo ### Asserts that declaring a blob as part of a primary key does not break replication
+ -- connection server_1
+ --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= $server_1_engine;
+ -- connection server_2
+ --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= $server_2_engine;
+ -- connection server_3
+ --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= $server_3_engine;
+ }
+ if ($i == 2)
+ {
+ -- echo ### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+ -- connection server_1
+ --eval CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= $server_1_engine;
+ -- connection server_2
+ --eval CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= $server_2_engine;
+ -- connection server_3
+ --eval CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= $server_3_engine;
+ }
+ if ($i == 3)
+ {
+ -- echo ### Asserts that declaring a blob in a key does not break replication
+ -- connection server_1
+ --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= $server_1_engine;
+ -- connection server_2
+ --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= $server_2_engine;
+ -- connection server_3
+ --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= $server_3_engine;
+
+ }
+ if ($i == 4) {
+ -- echo ### Asserts that updates without blobs in the BI (PK exists int the table)
+ -- echo ### will not break replication
+ -- connection server_1
+ --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= $server_1_engine;
+ -- connection server_2
+ --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= $server_2_engine;
+ -- connection server_3
+ --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= $server_3_engine;
+
+ }
+ if ($i == 5)
+ {
+ -- echo ### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+ -- echo ### will not break replication
+ -- connection server_1
+ --eval CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= $server_1_engine;
+ -- connection server_2
+ --eval CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= $server_2_engine;
+ -- connection server_3
+ --eval CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= $server_3_engine;
+
+ }
+ if ($i == 6)
+ {
+ -- echo ### Asserts that updates without blobs in the AI (they are not updated)
+ -- echo ### will not break replication (check even if there is a key in the table)
+ -- connection server_1
+ --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= $server_1_engine;
+ -- connection server_2
+ --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= $server_2_engine;
+ -- connection server_3
+ --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= $server_3_engine;
+
+ }
+ if ($i == 7)
+ {
+ -- echo ### Asserts that updates without blobs in the AI (they are not updated)
+ -- echo ### will not break replication (check when there is no key in the table)
+ -- connection server_1
+ --eval CREATE TABLE t (c1 int, c2 blob, c3 int) engine= $server_1_engine;
+ -- connection server_2
+ --eval CREATE TABLE t (c1 int, c2 blob, c3 int) engine= $server_2_engine;
+ -- connection server_3
+ --eval CREATE TABLE t (c1 int, c2 blob, c3 int) engine= $server_3_engine;
+ }
+
+ -- connection server_1
+ SET SQL_LOG_BIN=1;
+
+ -- connection server_2
+ SET SQL_LOG_BIN=1;
+
+ -- connection server_3
+ SET SQL_LOG_BIN=1;
+
+ -- connection server_1
+
+ -- let $blob1= "a"
+ -- let $blob2= "b"
+ -- let $blob3= "c"
+
+ -- eval INSERT INTO t VALUES (1, $blob1, 10)
+ -- eval INSERT INTO t VALUES (2, $blob2, 20)
+ -- eval INSERT INTO t VALUES (3, $blob3, 30)
+
+ -- source include/rpl_sync.inc
+
+ -- connection server_1
+ -- eval UPDATE t SET c1=10 WHERE c2=$blob1
+ -- eval UPDATE t SET c1=20 WHERE c1=2
+ -- eval UPDATE t SET c1=30 WHERE c3=30
+ -- eval UPDATE t SET c3=40 WHERE c1=30
+
+ -- source include/rpl_sync.inc
+
+ -- let $diff_tables= server_1:$diff_table, server_2:$diff_table, server_3:$diff_table
+ -- source include/diff_tables.inc
+
+ -- connection server_1
+ -- eval DELETE FROM t WHERE c2=$blob1
+ -- eval DELETE FROM t WHERE c1=20
+ -- eval DELETE FROM t
+
+ -- source include/rpl_sync.inc
+
+ -- let $diff_tables= server_1:$diff_table, server_2:$diff_table, server_3:$diff_table
+ -- source include/diff_tables.inc
+
+ -- connection server_1
+
+ DROP TABLE t;
+
+ -- source include/rpl_sync.inc
+
+ dec $i;
+}
diff --git a/mysql-test/include/binlog_start_pos.inc b/mysql-test/include/binlog_start_pos.inc
index 7dac1b376ee..a187e18b3a4 100644
--- a/mysql-test/include/binlog_start_pos.inc
+++ b/mysql-test/include/binlog_start_pos.inc
@@ -10,19 +10,19 @@
#
# Format_description_log_event length =
# 19 /* event common header */ +
-# 57 /* misc stuff in the Format description header */ +
+# 58 /* misc stuff in the Format description header */ +
# number of events +
# 1 /* Checksum algorithm */ +
# 4 /* CRC32 length */
#
-# With current number of events = 163,
+# With current number of events = 164,
#
-# binlog_start_pos = 4 + 19 + 57 + 163 + 1 + 4 = 248.
+# binlog_start_pos = 4 + 19 + 57 + 163 + 1 + 4 = 249.
#
##############################################################################
-let $binlog_start_pos=248;
+let $binlog_start_pos=249;
--disable_query_log
-SET @binlog_start_pos=248;
+SET @binlog_start_pos=249;
--enable_query_log
diff --git a/mysql-test/include/check-warnings.test b/mysql-test/include/check-warnings.test
index 9ecf7de419a..b2f73c32e35 100644
--- a/mysql-test/include/check-warnings.test
+++ b/mysql-test/include/check-warnings.test
@@ -11,6 +11,10 @@
# Don't write these queries to binlog
set SQL_LOG_BIN=0;
+# Do not replicate updates to other galera nodes
+--error 0,1193
+set WSREP_ON=0;
+
# Turn off any debug crashes, allow the variable to be
# non existent in release builds
--error 0,1193
diff --git a/mysql-test/include/concurrent.inc b/mysql-test/include/concurrent.inc
index 0b7299a3c34..2912287be8e 100644
--- a/mysql-test/include/concurrent.inc
+++ b/mysql-test/include/concurrent.inc
@@ -26,6 +26,7 @@
#
connection default;
+SET SQL_MODE="";
#
# Show prerequisites for this test.
#
@@ -670,3 +671,4 @@ connection default;
drop table t1;
drop user mysqltest@localhost;
+SET SQL_MODE=default;
diff --git a/mysql-test/include/ctype_innodb_like.inc b/mysql-test/include/ctype_innodb_like.inc
index ae43342885a..4f3201f51fb 100644
--- a/mysql-test/include/ctype_innodb_like.inc
+++ b/mysql-test/include/ctype_innodb_like.inc
@@ -2,6 +2,10 @@
# Bug#11650: LIKE pattern matching using prefix index
# doesn't return correct result
#
+--disable_query_log
+set @ctype_save_sql_mode=@@sql_mode;
+set sql_mode="";
+--enable_query_log
--disable_warnings
#
# This query creates a column using
@@ -10,6 +14,9 @@
#
create table t1 engine=innodb select repeat('a',50) as c1;
--enable_warnings
+--disable_query_log
+set sql_mode=@ctype_save_sql_mode;
+--enable_query_log
alter table t1 add index(c1(5));
insert into t1 values ('abcdefg'),('abcde100'),('abcde110'),('abcde111');
diff --git a/mysql-test/include/ctype_like_cond_propagation.inc b/mysql-test/include/ctype_like_cond_propagation.inc
index 023cf2b1b30..1c6ea04ded2 100644
--- a/mysql-test/include/ctype_like_cond_propagation.inc
+++ b/mysql-test/include/ctype_like_cond_propagation.inc
@@ -37,3 +37,19 @@ SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1);
SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a'
+--echo #
+
+CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
+EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
+DROP TABLE t1;
+
+--echo #
+--echo # End of MDEV-8694
+--echo #
diff --git a/mysql-test/include/ctype_utf8_ilseq.inc b/mysql-test/include/ctype_utf8_ilseq.inc
index c400731c07f..1bb009f2a8b 100644
--- a/mysql-test/include/ctype_utf8_ilseq.inc
+++ b/mysql-test/include/ctype_utf8_ilseq.inc
@@ -28,17 +28,35 @@ INSERT INTO t1 (ch) VALUES (_utf8 0x61D680);
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
+--replace_column 9 #
+EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
+--replace_column 9 #
+EXPLAIN
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
+--replace_column 9 #
+EXPLAIN
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
+--replace_column 9 #
+EXPLAIN
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
+--replace_column 9 #
+EXPLAIN
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
+--replace_column 9 #
+EXPLAIN
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
ALTER TABLE t1 DROP KEY ch;
diff --git a/mysql-test/include/ctype_utf8mb4.inc b/mysql-test/include/ctype_utf8mb4.inc
index 1971cc0c9a1..71993a946b3 100644
--- a/mysql-test/include/ctype_utf8mb4.inc
+++ b/mysql-test/include/ctype_utf8mb4.inc
@@ -688,9 +688,16 @@ eval create table t1 (
insert into t1 values(1,'foo'),(2,'foobar');
--sorted_result
select * from t1 where b like 'foob%';
+--disable_query_log
+set @ctype_save_sql_mode=@@sql_mode;
+set sql_mode="";
+--enable_query_log
--disable_warnings
alter table t1 engine=innodb;
--enable_warnings
+--disable_query_log
+set sql_mode=@ctype_save_sql_mode;
+--enable_query_log
--sorted_result
select * from t1 where b like 'foob%';
drop table t1;
@@ -1802,5 +1809,33 @@ DROP TABLE t1;
--echo #
--echo #
---echo # End of tests
+--echo # ctype_utf8mb4.inc: Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character"
+--echo #
+CREATE TABLE t1 (
+ id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ a VARCHAR(10) CHARACTER SET utf8mb4, KEY(a,id)
+);
+INSERT INTO t1 (a) VALUES (0x61);
+INSERT INTO t1 (a) VALUES (0xC280),(0xDFBF);
+INSERT INTO t1 (a) VALUES (0xE0A080),(0xEFBFBF);
+INSERT INTO t1 (a) VALUES (0xF0908080),(0xF48FBFBF);
+SELECT id,HEX(a) FROM t1 ORDER BY a,id;
+SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
+SELECT COUNT(DISTINCT a) FROM t1;
+ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
+SELECT id,HEX(a) FROM t1 ORDER BY a;
+SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
+SELECT COUNT(DISTINCT a) FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # ctype_utf8mb4.inc: End of 10.1 tests
+--echo #
+
+--echo #
+--echo # End of ctype_utf8mb4.inc
--echo #
diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf
index 1ab9cd9b1e7..a16e82f2364 100644
--- a/mysql-test/include/default_mysqld.cnf
+++ b/mysql-test/include/default_mysqld.cnf
@@ -33,6 +33,7 @@ debug-no-sync
# Retry bind as this may fail on busy server
port-open-timeout=10
+bind-address=127.0.0.1
log-bin-trust-function-creators=1
key_buffer_size= 1M
diff --git a/mysql-test/include/equal_fields_propagation_datetime.inc b/mysql-test/include/equal_fields_propagation_datetime.inc
new file mode 100644
index 00000000000..97a30a83df6
--- /dev/null
+++ b/mysql-test/include/equal_fields_propagation_datetime.inc
@@ -0,0 +1,64 @@
+
+# Trailing garbage in string literals
+--eval CREATE TABLE t1 (a $TYPE);
+INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01');
+SELECT * FROM t1 WHERE a='2001-01-01 00:00:00x';
+SELECT * FROM t1 WHERE LENGTH(a) != 20;
+SELECT * FROM t1 WHERE LENGTH(a) != 20 AND a='2001-01-01 00:00:00x';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a) != 20 AND a='2001-01-01 00:00:00x';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=30+RAND() AND a='2001-01-01 00:00:00x';
+DROP TABLE t1;
+
+# Leading spaces in string literals
+--eval CREATE TABLE t1 (a $TYPE);
+INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01');
+SELECT * FROM t1 WHERE LENGTH(a)=19;
+SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=' 2001-01-01 00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=' 2001-01-01 00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=19+RAND() AND a=' 2001-01-01 00:00:00';
+# This should not propagate
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=' garbage ';
+DROP TABLE t1;
+
+# Trailing fractional digits in temporal literals
+--eval CREATE TABLE t1 (a $TYPE);
+INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01');
+SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 00:00:00.000000';
+SELECT * FROM t1 WHERE LENGTH(a)=19;
+SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIMESTAMP'2001-01-01 00:00:00.000000';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=19 AND 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';
+DROP TABLE t1;
+
+# Trailing fractional digits in temporal literals, the same precision
+--eval CREATE TABLE t1 (a $TYPE(6));
+INSERT INTO t1 VALUES ('2001-01-01 00:00:00.000000'),('2001-01-01 00:00:01.000000');
+SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 00:00:00.000000';
+SELECT * FROM t1 WHERE LENGTH(a)=26;
+SELECT * FROM t1 WHERE LENGTH(a)=26 AND a=TIMESTAMP'2001-01-01 00:00:00.000000';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=26 AND 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';
+DROP TABLE t1;
+
+# DATETIME/TIMESTAMP column vs TIME literal
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30');
+--eval CREATE TABLE t1 (a $TYPE);
+INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01');
+SELECT * FROM t1 WHERE a=TIME'00:00:00';
+SELECT * FROM t1 WHERE LENGTH(a)=19;
+SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIME'00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIME'00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=40+RAND() AND a=TIME'00:00:00';
+DROP TABLE t1;
+
diff --git a/mysql-test/include/explain_non_select.inc b/mysql-test/include/explain_non_select.inc
index a0f86e744b0..57b96994d20 100644
--- a/mysql-test/include/explain_non_select.inc
+++ b/mysql-test/include/explain_non_select.inc
@@ -771,7 +771,7 @@ DROP TABLE t1,t2;
--echo #74
-CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t1(a INT PRIMARY KEY);
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
--echo # used key is modified & Using temporary
diff --git a/mysql-test/include/grant_cache.inc b/mysql-test/include/grant_cache.inc
index 47eef1cdb67..111b35d6940 100644
--- a/mysql-test/include/grant_cache.inc
+++ b/mysql-test/include/grant_cache.inc
@@ -37,12 +37,16 @@
--source include/add_anonymous_users.inc
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
#
--disable_warnings
drop table if exists test.t1,mysqltest.t1,mysqltest.t2;
drop database if exists mysqltest;
--enable_warnings
+set GLOBAL query_cache_type=ON;
+set LOCAL query_cache_type=ON;
set GLOBAL query_cache_size=1355776;
reset query cache;
@@ -214,5 +218,9 @@ drop table test.t1,mysqltest.t1,mysqltest.t2;
drop database mysqltest;
set GLOBAL query_cache_size=default;
+set GLOBAL query_cache_type=ON;
+set LOCAL query_cache_type=ON;
--source include/delete_anonymous_users.inc
+set GLOBAL sql_mode=default;
+set GLOBAL query_cache_type=default;
diff --git a/mysql-test/include/have_ipv6.inc b/mysql-test/include/have_ipv6.inc
deleted file mode 100644
index 752dd0db53e..00000000000
--- a/mysql-test/include/have_ipv6.inc
+++ /dev/null
@@ -1,20 +0,0 @@
-# Check if ipv6 is available.
-#
---disable_query_log
---disable_result_log
---disable_abort_on_error
-connect (checkcon123456789,::1,root,,test);
-if($mysql_errno)
-{
- skip No IPv6 support;
-}
-connection default;
-if(!$mysql_errno)
-{
- disconnect checkcon123456789;
-}
---enable_abort_on_error
---enable_result_log
---enable_query_log
-# end check
-
diff --git a/mysql-test/include/icp_tests.inc b/mysql-test/include/icp_tests.inc
index 7c9feea55c2..88d6923d8f9 100644
--- a/mysql-test/include/icp_tests.inc
+++ b/mysql-test/include/icp_tests.inc
@@ -443,13 +443,13 @@ DROP TABLE t1;
--echo # when ICP is on"
--echo #
-CREATE TABLE t1 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL) ENGINE=InnoDB;
+CREATE TABLE t1 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL);
INSERT INTO t1 VALUES (11,0);
INSERT INTO t1 VALUES (12,5);
INSERT INTO t1 VALUES (15,0);
-CREATE TABLE t2 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL) ENGINE=InnoDB;
+CREATE TABLE t2 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL);
INSERT INTO t2 VALUES (11,1);
INSERT INTO t2 VALUES (12,2);
@@ -639,6 +639,16 @@ SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
WHERE t2.pk <> t1.d1 AND t2.pk = 4;
+# MDEV-8189 field<>const and const<>field are not symmetric
+# Do the same EXPLAIN and SELECT
+# with "t1.d1 <> t2.pk" instead of "t2.pk <> t1.d1"
+
+EXPLAIN
+SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
+ WHERE t1.d1 <> t2.pk AND t2.pk = 4;
+SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
+ WHERE t1.d1 <> t2.pk AND t2.pk = 4;
+
DROP TABLE t1, t2;
--echo #
diff --git a/mysql-test/suite/perfschema/include/no_protocol.inc b/mysql-test/include/no_protocol.inc
index 451c22f62e3..8ffd3509afc 100644
--- a/mysql-test/suite/perfschema/include/no_protocol.inc
+++ b/mysql-test/include/no_protocol.inc
@@ -1,5 +1,3 @@
-# Tests for the performance schema
-
# The file with expected results fits only to a run without
# ps-protocol/sp-protocol/cursor-protocol/view-protocol.
if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL
diff --git a/mysql-test/include/query_cache.inc b/mysql-test/include/query_cache.inc
index 29a82f112c3..56dae83db2f 100644
--- a/mysql-test/include/query_cache.inc
+++ b/mysql-test/include/query_cache.inc
@@ -15,6 +15,8 @@
# main code went into include/query_cache.inc
#
+SET global query_cache_type=ON;
+SET local query_cache_type=ON;
eval SET SESSION STORAGE_ENGINE = $engine_type;
# Initialise
@@ -193,3 +195,5 @@ 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/include/query_cache_partitions.inc b/mysql-test/include/query_cache_partitions.inc
index e5bb7406c10..c69356f907d 100644
--- a/mysql-test/include/query_cache_partitions.inc
+++ b/mysql-test/include/query_cache_partitions.inc
@@ -4,6 +4,8 @@
# $engine_type -- storage engine to be tested
# have to be set before sourcing this script.
+SET global query_cache_type=ON;
+SET local query_cache_type=ON;
eval SET SESSION STORAGE_ENGINE = $engine_type;
# Initialise
@@ -124,3 +126,4 @@ show status like "Qcache_hits";
drop table t1;
set @@global.query_cache_size = @save_query_cache_size;
+SET global query_cache_type=default;
diff --git a/mysql-test/include/query_cache_sql_prepare.inc b/mysql-test/include/query_cache_sql_prepare.inc
index 769cd535f37..41276ed5a79 100644
--- a/mysql-test/include/query_cache_sql_prepare.inc
+++ b/mysql-test/include/query_cache_sql_prepare.inc
@@ -20,6 +20,8 @@
--source include/have_query_cache.inc
# embedded can't make more than one connection, which this test needs
-- source include/not_embedded.inc
+set GLOBAL query_cache_type=ON;
+set LOCAL query_cache_type=ON;
--echo ---- establish connection con1 (root) ----
connect (con1,localhost,root,,test,$MASTER_MYPORT,);
@@ -528,3 +530,4 @@ drop table t1;
set @@global.query_cache_size=@initial_query_cache_size;
flush status; # reset Qcache status variables for next tests
+set GLOBAL query_cache_type=default;
diff --git a/mysql-test/include/rpl_row_img_general_loop.inc b/mysql-test/include/rpl_row_img_general_loop.inc
new file mode 100644
index 00000000000..3c7749e5135
--- /dev/null
+++ b/mysql-test/include/rpl_row_img_general_loop.inc
@@ -0,0 +1,42 @@
+#
+# This is a helper script for rpl_row_img.test. It creates
+# all combinations MyISAM / InnoDB in a three server replication
+# chain. Each engine combination is tested against the current
+# seetings for binlog_row_image (on each server).
+#
+# The test script that is executed on every combination is the
+# only argument to this wrapper script. See below.
+#
+# This script takes one parameter:
+# - $row_img_test_script
+# the name of the test script to include in every combination
+#
+# Sample usage:
+# -- let $row_img_test_script= extra/rpl_tests/rpl_row_img.test
+# -- source include/rpl_row_img_general_loop.test
+
+
+-- let $engine_type_a= 2
+-- let $server_1_engine= MyISAM
+while($engine_type_a)
+{
+ -- let $engine_type_b= 2
+ -- let $server_2_engine= MyISAM
+ while($engine_type_b)
+ {
+ -- let $engine_type_c= 2
+ -- let $server_3_engine= MyISAM
+ while($engine_type_c)
+ {
+ -- echo ### engines: $server_1_engine, $server_2_engine, $server_3_engine
+ -- source $row_img_test_script
+
+ -- let $server_3_engine= InnoDB
+ -- dec $engine_type_c
+ }
+ -- let $server_2_engine= InnoDB
+ -- dec $engine_type_b
+ }
+ -- let $server_1_engine= InnoDB
+ -- dec $engine_type_a
+}
diff --git a/mysql-test/include/rpl_row_img_set.inc b/mysql-test/include/rpl_row_img_set.inc
new file mode 100644
index 00000000000..d998c3f1d6c
--- /dev/null
+++ b/mysql-test/include/rpl_row_img_set.inc
@@ -0,0 +1,55 @@
+#
+# This is an auxiliar script that sets the binlog-row-image
+# on a set of connections. These connections are passed as
+# a parameter to this script. Its format is the following:
+#
+# <conid,value,Y_or_N>:[<conid,value,Y_or_N>:...]
+#
+# In detail:
+#
+# conid -- connection id (eg, master)
+# value -- binlog_row_image value to set (eg, FULL)
+# Y_or_N -- Issue stop and start slave (eg, Y)
+#
+# Sample usage:
+#
+# -- let $row_img_set=master:FULL:N,slave:MINIMAL:Y
+# -- source include/rpl_row_img_set.inc
+#
+# Notes:
+#
+# 1. This script saves and restores the original connection that was
+# in use at the time it was included.
+
+-- let $old_conn= $CURRENT_CONNECTION
+
+while (`SELECT HEX('$row_img_set') != HEX('')`)
+{
+
+ -- let $tuple= `SELECT SUBSTRING_INDEX('$row_img_set', ',', 1)`
+
+ -- let $conn= `SELECT SUBSTRING_INDEX('$tuple', ':', 1)`
+ -- let $rimg= `SELECT SUBSTRING_INDEX(LTRIM(SUBSTRING('$tuple', LENGTH('$conn') + 2)), ':', 1)`
+
+ -- let $is_slave_restart= `SELECT LTRIM(SUBSTRING('$tuple', LENGTH('$conn') + LENGTH('$rimg')+ 3))`
+
+ -- echo CON: '$conn', IMG: '$rimg', RESTART SLAVE: '$is_slave_restart'
+
+ -- connection $conn
+ -- eval SET SESSION binlog_row_image= '$rimg'
+ -- eval SET GLOBAL binlog_row_image= '$rimg'
+
+ if ($is_slave_restart == Y)
+ {
+ -- source include/stop_slave.inc
+ -- source include/start_slave.inc
+ }
+
+ FLUSH TABLES;
+ SHOW VARIABLES LIKE 'binlog_row_image';
+
+ -- let $row_img_set= `SELECT LTRIM(SUBSTRING('$row_img_set', LENGTH('$tuple') + 2 ))`
+
+}
+
+-- connection $old_conn
diff --git a/mysql-test/include/show_binlog_events2.inc b/mysql-test/include/show_binlog_events2.inc
index e72522dc272..356bf6dc727 100644
--- a/mysql-test/include/show_binlog_events2.inc
+++ b/mysql-test/include/show_binlog_events2.inc
@@ -4,7 +4,7 @@ if ($binlog_start)
}
if (!$binlog_start)
{
- --let $_binlog_start=248
+ --let $_binlog_start=249
}
if ($binlog_file)
{
diff --git a/mysql-test/include/show_events.inc b/mysql-test/include/show_events.inc
index 7917b6740cf..368cfc9e3a7 100644
--- a/mysql-test/include/show_events.inc
+++ b/mysql-test/include/show_events.inc
@@ -15,7 +15,19 @@
--let $statement=show BINLOG events
if ($is_relay_log)
{
- --let $statement=show relaylog events
+ if ($master_name)
+ {
+ let _master_name='$master_name';
+ }
+ if (!$master_name)
+ {
+ let _master_name=`select @@default_master_connection`;
+ if ($_master_name)
+ {
+ let _master_name='$_master_name';
+ }
+ }
+ --let $statement=show relaylog $_master_name events
}
if ($binlog_file)
@@ -25,7 +37,7 @@ if ($binlog_file)
{
if ($is_relay_log)
{
- --let $_binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1)
+ --let $_binlog_file= query_get_value(SHOW SLAVE $_master_name STATUS, Relay_Log_File, 1)
}
if (!$is_relay_log)
{
diff --git a/mysql-test/include/show_relaylog_events.inc b/mysql-test/include/show_relaylog_events.inc
index d1bd11f1642..c98e961da76 100644
--- a/mysql-test/include/show_relaylog_events.inc
+++ b/mysql-test/include/show_relaylog_events.inc
@@ -1,10 +1,11 @@
##############################################################################
# Show relay log events
#
-# Useage:
+# Usage:
# let $binlog_file= slave-relay-bin.000002;
# let $binlog_start= 106;
# let $binlog_limit= 1, 3;
+# let $master_name= master1;
# source include/show_relaylog_events.inc;
#
# It shows the first relay log file if $binlog_file is not given.
diff --git a/mysql-test/include/sync_with_master_gtid.inc b/mysql-test/include/sync_with_master_gtid.inc
index 97ada8eea29..777711b979c 100644
--- a/mysql-test/include/sync_with_master_gtid.inc
+++ b/mysql-test/include/sync_with_master_gtid.inc
@@ -34,6 +34,10 @@ let $_slave_timeout= $slave_timeout;
if (!$_slave_timeout)
{
let $_slave_timeout= 120;
+ if ($VALGRIND_TEST)
+ {
+ let $_slave_timeout= 1200;
+ }
}
--let $_result= `SELECT master_gtid_wait('$master_pos', $_slave_timeout)`
diff --git a/mysql-test/include/type_temporal_zero_default.inc b/mysql-test/include/type_temporal_zero_default.inc
new file mode 100644
index 00000000000..500d25ea18f
--- /dev/null
+++ b/mysql-test/include/type_temporal_zero_default.inc
@@ -0,0 +1,75 @@
+--echo #
+--echo # MDEV-7824 [Bug #68041] Zero date can be inserted in strict no-zero mode through a default value
+--echo #
+
+# Testing direct INSERT
+
+SET sql_mode=DEFAULT;
+eval CREATE TABLE t1 (a $type DEFAULT $defval);
+SET sql_mode=TRADITIONAL;
+--error ER_TRUNCATED_WRONG_VALUE
+eval INSERT INTO t1 VALUES ($defval);
+--error ER_INVALID_DEFAULT_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ();
+--error ER_INVALID_DEFAULT_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES (DEFAULT);
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+
+
+# Testing INSERT .. SELECT
+
+eval CREATE TABLE t1 (a $type NOT NULL DEFAULT $defval, b $type NOT NULL DEFAULT $defval);
+eval CREATE TABLE t2 (a $type NOT NULL DEFAULT $defval);
+eval INSERT INTO t2 VALUES ($defval);
+SET sql_mode=TRADITIONAL;
+--error ER_INVALID_DEFAULT_VALUE_FOR_FIELD
+INSERT INTO t1 (a) SELECT a FROM t2;
+DROP TABLE t1, t2;
+SET sql_mode=DEFAULT;
+
+
+# Testing LOAD
+
+--eval CREATE TABLE t1 (a $type DEFAULT $defval, b $type DEFAULT $defval)
+--eval INSERT INTO t1 VALUES (DEFAULT,DEFAULT);
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT a INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/mdev-7824.txt' FROM t1
+DELETE FROM t1;
+SET sql_mode=TRADITIONAL;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--error ER_INVALID_DEFAULT_VALUE_FOR_FIELD
+--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/mdev-7824.txt' INTO TABLE t1 (a)
+--remove_file $MYSQLTEST_VARDIR/tmp/mdev-7824.txt
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+
+# Testing ALTER when an old field default becomes invalid
+# Return an error, even if there is no STRICT_XXX_TABLES set
+--eval CREATE TABLE t1 (a $type DEFAULT $defval);
+SET sql_mode='NO_ZERO_DATE';
+--error ER_INVALID_DEFAULT
+ALTER TABLE t1 ADD b INT NOT NULL;
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+
+
+--echo #
+--echo # End of MDEV-7824 [Bug #68041] Zero date can be inserted in strict no-zero mode through a default value
+--echo #
+
+--echo #
+--echo # MDEV-8373 Zero date can be inserted in strict no-zero mode through CREATE TABLE AS SELECT timestamp_field
+--echo #
+
+SET sql_mode=DEFAULT;
+--eval CREATE TABLE t1 (a $type);
+INSERT INTO t1 VALUES (0);
+SET sql_mode='TRADITIONAL';
+--error ER_TRUNCATED_WRONG_VALUE
+CREATE TABLE t2 AS SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # End of MDEV-8373 Zero date can be inserted in strict no-zero mode through CREATE TABLE AS SELECT timestamp_field
+--echo #
diff --git a/mysql-test/include/wait_until_ready.inc b/mysql-test/include/wait_until_ready.inc
new file mode 100644
index 00000000000..e7a6940975a
--- /dev/null
+++ b/mysql-test/include/wait_until_ready.inc
@@ -0,0 +1,34 @@
+# If wsrep patch is enabled, wait for a minute until node is ready.
+# Note: include/wait_for_status_var.inc cannot be used here, as server rejects
+# all commands except SHOW & SET until its ready. (see wsrep_ready status
+# variable)
+
+--disable_result_log
+--disable_query_log
+--enable_reconnect
+
+let $counter= 600;
+
+# Check if wsrep_ready status variable exists.
+if (`SHOW STATUS LIKE 'wsrep_ready'`)
+{
+ let $wsrep_ready= query_get_value("SHOW STATUS LIKE 'wsrep_ready'", Value, 1);
+
+ while ($wsrep_ready == 'OFF')
+ {
+ if (!$counter)
+ {
+ echo ===============================================;
+ echo Node still not ready after a minute, giving up!;
+ echo ===============================================;
+ die;
+ }
+ dec $counter;
+ sleep 0.1;
+ let $wsrep_ready= query_get_value("SHOW STATUS LIKE 'wsrep_ready'", Value, 1);
+ }
+}
+
+--disable_reconnect
+--enable_query_log
+--enable_result_log
diff --git a/mysql-test/lib/My/SafeProcess/safe_process.cc b/mysql-test/lib/My/SafeProcess/safe_process.cc
index feb3eb4df66..8f18b137b87 100644
--- a/mysql-test/lib/My/SafeProcess/safe_process.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_process.cc
@@ -148,6 +148,14 @@ extern "C" void handle_signal(int sig)
}
+void setlimit(int what, uint soft, uint hard)
+{
+ struct rlimit lim = { soft, hard };
+ if (setrlimit (what, &lim) < 0)
+ message("setrlimit failed, errno=%d", errno);
+}
+
+
int main(int argc, char* const argv[] )
{
char* const* child_argv= 0;
@@ -249,13 +257,13 @@ int main(int argc, char* const argv[] )
signal(SIGCHLD, SIG_DFL);
if (nocore)
- {
- struct rlimit corelim = { 0, 0 };
- if (setrlimit (RLIMIT_CORE, &corelim) < 0)
- {
- message("setrlimit failed, errno=%d", errno);
- }
- }
+ setlimit(RLIMIT_CORE, 0, 0);
+
+ /*
+ mysqld defaults depend on that. make test results stable and independent
+ from the environment
+ */
+ setlimit(RLIMIT_NOFILE, 1024, 1024);
// Signal that child is ready
buf= 37;
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 4bf54171759..04a0887c624 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -2579,15 +2579,18 @@ sub setup_vardir() {
{
$plugindir="$opt_vardir/plugins";
mkpath($plugindir);
- if (IS_WINDOWS && !$opt_embedded_server)
+ if (IS_WINDOWS)
{
- for (<$bindir/storage/*$opt_vs_config/*.dll>,
- <$bindir/plugin/*$opt_vs_config/*.dll>,
- <$bindir/sql$opt_vs_config/*.dll>)
+ if (!$opt_embedded_server)
{
- my $pname=basename($_);
- copy rel2abs($_), "$plugindir/$pname";
- set_plugin_var($pname);
+ for (<$bindir/storage/*$opt_vs_config/*.dll>,
+ <$bindir/plugin/*$opt_vs_config/*.dll>,
+ <$bindir/sql$opt_vs_config/*.dll>)
+ {
+ my $pname=basename($_);
+ copy rel2abs($_), "$plugindir/$pname";
+ set_plugin_var($pname);
+ }
}
}
else
@@ -3338,7 +3341,7 @@ sub do_before_run_mysqltest($)
my $resdir= dirname($resfile);
# we'll use a separate extension for generated result files
# to be able to distinguish them from manually created
- # version-controlled results, and to ignore them in bzr.
+ # version-controlled results, and to ignore them in git.
my $dest = "$base_file$suites.result~";
my @cmd = ($exe_patch, qw/--binary -r - -f -s -o/,
$dest, $base_result, $resfile);
@@ -4374,6 +4377,7 @@ sub extract_warning_lines ($$) {
qr/InnoDB: Redo log crypto: Can't initialize to key version -1u/,
qr/InnoDB: Dumping buffer pool.*/,
qr/InnoDB: Buffer pool.*/,
+ qr/InnoDB: Warning: Writer thread is waiting this semaphore/,
qr/Slave: Unknown table 't1' .* 1051/,
qr/Slave SQL:.*(Internal MariaDB error code: [[:digit:]]+|Query:.*)/,
qr/slave SQL thread aborted/,
@@ -4429,6 +4433,22 @@ sub extract_warning_lines ($$) {
qr|InnoDB: Setting thread \d+ nice to \d+ failed, current nice \d+, errno 13|, # setpriority() fails under valgrind
qr|Failed to setup SSL|,
qr|SSL error: Failed to set ciphers to use|,
+ qr/Plugin 'InnoDB' will be forced to shutdown/,
+ qr|Could not increase number of max_open_files to more than|,
+ qr/InnoDB: Error table encrypted but encryption service not available.*/,
+ qr/InnoDB: Could not find a valid tablespace file for*/,
+ qr/InnoDB: Tablespace open failed for*/,
+ qr/InnoDB: Failed to find tablespace for table*/,
+ qr/InnoDB: Space */,
+ qr|InnoDB: You may have to recover from a backup|,
+ qr|InnoDB: It is also possible that your operatingsystem has corrupted its own file cache|,
+ qr|InnoDB: and rebooting your computer removes the error|,
+ qr|InnoDB: If the corrupt page is an index page you can also try to|,
+ qr|nnoDB: fix the corruption by dumping, dropping, and reimporting|,
+ qr|InnoDB: the corrupt table. You can use CHECK|,
+ qr|InnoDB: TABLE to scan your table for corruption|,
+ qr/InnoDB: See also */
+
);
my $matched_lines= [];
@@ -5471,6 +5491,12 @@ sub start_mysqltest ($) {
mtr_add_arg($args, "--max-connections=%d", $opt_max_connections);
}
+ if ( $opt_valgrind )
+ {
+ # Longer timeouts when running with valgrind
+ mtr_add_arg($args, "--wait-longer-for-timeouts");
+ }
+
if ( $opt_embedded_server )
{
@@ -6028,6 +6054,8 @@ Options to control what test suites or cases to run
skip-test-list=FILE Skip the tests listed in FILE. Each line in the file
is an entry and should be formatted as:
<TESTNAME> : <COMMENT>
+ force-restart Always restart servers between tests. This makes it
+ easier to see from which test warnings may come from.
Options that specify ports
@@ -6145,7 +6173,6 @@ Misc options
servers to exit before finishing the process
fast Run as fast as possible, dont't wait for servers
to shutdown etc.
- force-restart Always restart servers between tests
parallel=N Run tests in N parallel threads (default 1)
Use parallel=auto for auto-setting of N
repeat=N Run each test N number of times
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index 6dae1c2838d..2c2275462cc 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -293,6 +293,15 @@ t2 CREATE TABLE `t2` (
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);
+Warnings:
+Warning 1364 Field 'b' doesn't have a default value
+Warning 1364 Field 'c' doesn't have a default value
+Warning 1364 Field 'd' doesn't have a default value
+Warning 1364 Field 'e' doesn't have a default value
+Warning 1364 Field 'f' doesn't have a default value
+Warning 1364 Field 'g' doesn't have a default value
+Warning 1364 Field 'h' doesn't have a default value
+Warning 1364 Field 'i' doesn't have a default value
show table status like 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 10 Fixed 1 37 X X X X X X X X latin1_swedish_ci NULL
@@ -1488,6 +1497,17 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
DROP TABLE t1;
+CREATE TABLE t1 (
+`transaction_id` int(11) NOT NULL DEFAULT '0',
+KEY `transaction_id` (`transaction_id`));
+ALTER TABLE t1 DROP KEY IF EXISTS transaction_id, ADD PRIMARY KEY IF NOT EXISTS (transaction_id);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `transaction_id` int(11) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`transaction_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
# Bug#11748057 (formerly known as 34972): ALTER TABLE statement doesn't
# identify correct column name.
#
@@ -1762,8 +1782,8 @@ ALTER TABLE tm1 DROP INDEX im3;
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 0
ALTER TABLE ti1 DROP COLUMN d2;
-affected rows: 2
-info: Records: 2 Duplicates: 0 Warnings: 0
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE tm1 DROP COLUMN d2;
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 0
diff --git a/mysql-test/r/analyze_format_json.result b/mysql-test/r/analyze_format_json.result
index 0f747068ebb..f77db650866 100644
--- a/mysql-test/r/analyze_format_json.result
+++ b/mysql-test/r/analyze_format_json.result
@@ -143,7 +143,7 @@ ANALYZE
"attached_condition": "(tbl2.b < 60)"
},
"buffer_type": "flat",
- "buffer_size": "128Kb",
+ "buffer_size": "256Kb",
"join_type": "BNL",
"r_filtered": 100
}
@@ -181,7 +181,7 @@ ANALYZE
"attached_condition": "(tbl2.b < 60)"
},
"buffer_type": "flat",
- "buffer_size": "128Kb",
+ "buffer_size": "256Kb",
"join_type": "BNL",
"attached_condition": "(tbl1.c > tbl2.c)",
"r_filtered": 15.833
diff --git a/mysql-test/r/analyze_stmt_orderby.result b/mysql-test/r/analyze_stmt_orderby.result
index 42a38037a0e..be1f01a2a52 100644
--- a/mysql-test/r/analyze_stmt_orderby.result
+++ b/mysql-test/r/analyze_stmt_orderby.result
@@ -40,6 +40,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filesort": {
"r_loops": 1,
+ "r_total_time_ms": "REPLACED",
"r_limit": 5,
"r_used_priority_queue": true,
"r_output_rows": 6,
@@ -140,6 +141,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filesort": {
"r_loops": 1,
+ "r_total_time_ms": "REPLACED",
"r_used_priority_queue": false,
"r_output_rows": 10000,
"r_buffer_size": "REPLACED",
@@ -203,6 +205,11 @@ ANALYZE
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"filesort": {
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "r_limit": 4,
+ "r_used_priority_queue": true,
+ "r_output_rows": 4,
"temporary_table": {
"table": {
"table_name": "t0",
@@ -284,6 +291,7 @@ ANALYZE
"r_rows": 10,
"filesort": {
"r_loops": 1,
+ "r_total_time_ms": "REPLACED",
"r_used_priority_queue": false,
"r_output_rows": 10,
"r_buffer_size": "REPLACED",
@@ -318,4 +326,261 @@ ANALYZE
}
}
drop table t2;
-drop table t0, t1;
+create table t2 (
+a int,
+b int,
+c int
+);
+insert into t2
+select
+a.a+10*b.a+100*c.a,
+b.a+10*c.a,
+c.a
+from t0 a, t0 b, t0 c;
+analyze format=json
+select MAX(b) from t2 where mod(a,2)=0 group by c;
+ANALYZE
+{
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "filesort": {
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "r_used_priority_queue": false,
+ "r_output_rows": 10,
+ "r_buffer_size": "REPLACED",
+ "temporary_table": {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 1000,
+ "r_rows": 1000,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 50,
+ "attached_condition": "((t2.a % 2) = 0)"
+ }
+ }
+ }
+ }
+}
+drop table t2;
+#
+# MDEV-8282: crash in filesort() with simple ordered delete
+#
+create table t3(a int) engine=innodb;
+delete from t3 order by a;
+# EXPLAIN thinks it will use delete_all_rows():
+explain
+delete from t3 order by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL 1 Deleting all rows
+# ANALYZE shows that delete_all_rows() didn't work and we deleted rows
+# one-by-one:
+analyze
+delete from t3 order by a;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 SIMPLE t3 ALL NULL NULL NULL NULL 1 0.00 100.00 100.00 Using filesort
+drop table t3;
+#
+# A test for duplicate_removal()
+#
+create table t3 (a int, b int);
+insert into t3 select a, 123 from t0;
+analyze format=json
+select distinct max(t3.b) Q from t0, t3 where t0.a=t3.a group by t0.a order by null;
+ANALYZE
+{
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "duplicate_removal": {
+ "temporary_table": {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "(t3.a = t0.a)",
+ "r_filtered": 10
+ }
+ }
+ }
+ }
+}
+#
+# A query with two filesort calls:
+# - first is needed to do group-by-group grouping to calculate COUNT(DISTINCT)
+# - the second is need to produce ORDER BY.
+# (see MDEV-7836 for description of the query plan)
+create table t5 (a int , b int) ;
+create table t6 like t5 ;
+create table t7 like t5 ;
+insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
+(2, -1), (3, 10);
+insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1);
+insert into t7 values (3, 3), (2, 2), (1, 1);
+# TODO: This ANALYZE output doesn't make it clear what is used for what.
+analyze format=json
+select count(distinct t5.b) as sum from t5, t6
+where t5.a=t6.a and t6.b > 0 and t5.a <= 5
+group by t5.a order by sum limit 1;
+ANALYZE
+{
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "filesort": {
+ "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": {
+ "table": {
+ "table_name": "t6",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 5,
+ "r_rows": 5,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 80,
+ "attached_condition": "((t6.b > 0) and (t6.a <= 5))"
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "t5",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 7,
+ "r_rows": 7,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "(t5.a = t6.a)",
+ "r_filtered": 21.429
+ }
+ }
+ }
+ }
+ }
+ }
+}
+explain format=json
+select count(distinct t5.b) as sum from t5, t6
+where t5.a=t6.a and t6.b > 0 and t5.a <= 5
+group by t5.a order by sum limit 1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "filesort": {
+ "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)"
+ }
+ }
+ }
+ }
+}
+drop table t5,t6,t7;
+drop table t3;
+#
+# Tabular ANALYZE must get its data from execution tracker (and not from
+# the query plan)
+#
+CREATE TABLE t2(
+col1 int,
+col2 int,
+UNIQUE INDEX idx (col1, col2)) engine=myisam;
+INSERT INTO t2(col1, col2) VALUES
+(1,20),(2,19),(3,18),(4,17),(5,16),(6,15),(7,14),(8,13),(9,12),(10,11),
+(11,10),(12,9),(13,8),(14,7),(15,6),(16,5),(17,4),(18,3),(19,2),(20,1);
+flush status;
+explain
+select col1 f1, col2 f2, col1 f3 from t2 group by f1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range NULL idx 5 NULL 7 Using index for group-by
+analyze
+select col1 f1, col2 f2, col1 f3 from t2 group by f1;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 SIMPLE t2 range NULL idx 5 NULL 7 20.00 100.00 100.00 Using index for group-by
+analyze format=json
+select col1 f1, col2 f2, col1 f3 from t2 group by f1;
+ANALYZE
+{
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t2",
+ "access_type": "range",
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["col1"],
+ "r_loops": 1,
+ "rows": 7,
+ "r_rows": 20,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "using_index_for_group_by": true
+ }
+ }
+}
+drop table t2;
+drop table t0,t1;
diff --git a/mysql-test/r/analyze_stmt_privileges.result b/mysql-test/r/analyze_stmt_privileges.result
index d382b0b3bb6..d54b5b37863 100644
--- a/mysql-test/r/analyze_stmt_privileges.result
+++ b/mysql-test/r/analyze_stmt_privileges.result
@@ -7,6 +7,7 @@ use db;
create table t1 (i int, c varchar(8));
insert into t1 values (1,'foo'),(2,'bar'),(3,'baz'),(4,'qux');
create view v1 as select * from t1 where i > 1;
+CREATE USER u1@localhost;
grant ALL on db.v1 to u1@localhost;
connect con1,localhost,u1,,;
select * from db.t1;
diff --git a/mysql-test/r/analyze_stmt_privileges2.result b/mysql-test/r/analyze_stmt_privileges2.result
index 3dded4bc7cc..892791dd8f8 100644
--- a/mysql-test/r/analyze_stmt_privileges2.result
+++ b/mysql-test/r/analyze_stmt_privileges2.result
@@ -1,3 +1,5 @@
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
CREATE DATABASE privtest_db;
CREATE TABLE privtest_db.t1 (a INT, b VARCHAR(3)) ENGINE=MyISAM;
CREATE TABLE privtest_db.t2 (a INT, b VARCHAR(3)) ENGINE=MyISAM;
@@ -5232,3 +5234,4 @@ connection default;
DROP USER 'privtest'@localhost;
USE test;
DROP DATABASE privtest_db;
+set GLOBAL sql_mode=default;
diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result
index 505d655b6bb..cc2ab456833 100644
--- a/mysql-test/r/bigint.result
+++ b/mysql-test/r/bigint.result
@@ -180,14 +180,14 @@ create table t1 select 1 as 'a';
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) NOT NULL DEFAULT '0'
+ `a` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 select 9223372036854775809 as 'a';
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bigint(19) unsigned NOT NULL DEFAULT '0'
+ `a` bigint(19) unsigned NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t1;
a
@@ -397,12 +397,12 @@ select -(-9223372036854775808), -(-(-9223372036854775808));
create table t1 select -9223372036854775808 bi;
describe t1;
Field Type Null Key Default Extra
-bi bigint(20) NO 0
+bi bigint(20) NO NULL
drop table t1;
create table t1 select -9223372036854775809 bi;
describe t1;
Field Type Null Key Default Extra
-bi decimal(19,0) NO 0
+bi decimal(19,0) NO NULL
drop table t1;
#
# Bug #45360: wrong results
diff --git a/mysql-test/r/blackhole_plugin.result b/mysql-test/r/blackhole_plugin.result
index 4ef9fa0fa47..2884441056a 100644
--- a/mysql-test/r/blackhole_plugin.result
+++ b/mysql-test/r/blackhole_plugin.result
@@ -1,11 +1,13 @@
+set sql_mode="";
CREATE TABLE t1(a int) ENGINE=BLACKHOLE;
Warnings:
Warning 1286 Unknown storage engine 'BLACKHOLE'
Warning 1266 Using storage engine MyISAM for table 't1'
+set sql_mode=default;
DROP TABLE t1;
INSTALL PLUGIN blackhole SONAME 'ha_blackhole.so';
INSTALL PLUGIN BLACKHOLE SONAME 'ha_blackhole.so';
-ERROR HY000: Function 'BLACKHOLE' already exists
+ERROR HY000: Plugin 'BLACKHOLE' already installed
UNINSTALL PLUGIN blackhole;
INSTALL PLUGIN blackhole SONAME 'ha_blackhole.so';
CREATE TABLE t1(a int) ENGINE=BLACKHOLE;
diff --git a/mysql-test/r/bug13633383.result b/mysql-test/r/bug13633383.result
index 3b533f89df2..a6f5bab5260 100644
--- a/mysql-test/r/bug13633383.result
+++ b/mysql-test/r/bug13633383.result
@@ -49,5 +49,66 @@ col435
0.00000000000000000
0.00000000000000000
0.00000000000000000
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
set session sort_buffer_size= default;
DROP TABLE t1, t2, t3;
diff --git a/mysql-test/r/cache_innodb.result b/mysql-test/r/cache_innodb.result
index 85eef0b3418..971750e3da2 100644
--- a/mysql-test/r/cache_innodb.result
+++ b/mysql-test/r/cache_innodb.result
@@ -1,3 +1,5 @@
+SET global query_cache_type=ON;
+SET local query_cache_type=ON;
SET SESSION STORAGE_ENGINE = InnoDB;
drop table if exists t1,t2,t3;
set @save_query_cache_size = @@global.query_cache_size;
@@ -221,6 +223,7 @@ Variable_name Value
Qcache_hits 1
set @@global.query_cache_size = @save_query_cache_size;
drop table t2;
+SET global query_cache_type=default;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
BEGIN;
INSERT INTO t1 VALUES(1);
diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result
index 3852da5d4b0..b1e928c5e30 100644
--- a/mysql-test/r/case.result
+++ b/mysql-test/r/case.result
@@ -99,18 +99,18 @@ 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 DEFAULT '',
- `c2` varchar(1) CHARACTER SET latin1 COLLATE latin1_danish_ci NOT NULL DEFAULT '',
- `c3` varchar(1) NOT NULL DEFAULT '',
- `c4` varchar(1) NOT NULL DEFAULT '',
- `c5` varchar(4) NOT NULL DEFAULT '',
- `c6` varchar(4) NOT NULL DEFAULT '',
- `c7` decimal(2,1) NOT NULL DEFAULT '0.0',
- `c8` decimal(2,1) NOT NULL DEFAULT '0.0',
+ `c1` varchar(1) CHARACTER SET latin1 COLLATE latin1_danish_ci NOT NULL,
+ `c2` varchar(1) CHARACTER SET latin1 COLLATE latin1_danish_ci NOT NULL,
+ `c3` varchar(1) NOT NULL,
+ `c4` varchar(1) NOT NULL,
+ `c5` varchar(4) NOT NULL,
+ `c6` varchar(4) NOT NULL,
+ `c7` decimal(2,1) NOT NULL,
+ `c8` decimal(2,1) NOT NULL,
`c9` decimal(2,1) DEFAULT NULL,
- `c10` double NOT NULL DEFAULT '0',
- `c11` double NOT NULL DEFAULT '0',
- `c12` varchar(5) NOT NULL DEFAULT ''
+ `c10` double NOT NULL,
+ `c11` double NOT NULL,
+ `c12` varchar(5) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
SELECT CASE
@@ -151,13 +151,13 @@ Note 1003 select coalesce(1) AS `COALESCE(1)`,coalesce(1.0) AS `COALESCE(1.0)`,c
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `COALESCE(1)` int(1) NOT NULL DEFAULT '0',
- `COALESCE(1.0)` decimal(2,1) NOT NULL DEFAULT '0.0',
- `COALESCE('a')` varchar(1) NOT NULL DEFAULT '',
- `COALESCE(1,1.0)` decimal(2,1) NOT NULL DEFAULT '0.0',
- `COALESCE(1,'1')` varchar(1) NOT NULL DEFAULT '',
- `COALESCE(1.1,'1')` varchar(4) NOT NULL DEFAULT '',
- `COALESCE('a' COLLATE latin1_bin,'b')` varchar(1) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT ''
+ `COALESCE(1)` int(1) NOT NULL,
+ `COALESCE(1.0)` decimal(2,1) NOT NULL,
+ `COALESCE('a')` varchar(1) NOT NULL,
+ `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
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 SELECT IFNULL('a' COLLATE latin1_swedish_ci, 'b' COLLATE latin1_bin);
@@ -231,3 +231,138 @@ case t1.f1 when '00:00:00' then 1 end
1
NULL
drop table t1;
+#
+# Start of 10.1 test
+#
+#
+# MDEV-8752 Wrong result for SELECT..WHERE CASE enum_field WHEN 1 THEN 1 ELSE 0 END AND a='5'
+#
+CREATE TABLE t1 (a ENUM('5','6') CHARACTER SET BINARY);
+INSERT INTO t1 VALUES ('5'),('6');
+SELECT * FROM t1 WHERE a='5';
+a
+5
+SELECT * FROM t1 WHERE a=1;
+a
+5
+SELECT * FROM t1 WHERE CASE a WHEN 1 THEN 1 ELSE 0 END;
+a
+5
+SELECT * FROM t1 WHERE CASE a WHEN 1 THEN 1 ELSE 0 END AND a='5';
+a
+5
+# Multiple comparison types in CASE, not Ok to propagate
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE CASE a WHEN 1 THEN 1 ELSE 0 END AND a='5';
+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))
+DROP TABLE t1;
+CREATE TABLE t1 (a ENUM('a','b','100'));
+INSERT INTO t1 VALUES ('a'),('b'),('100');
+SELECT * FROM t1 WHERE a='a';
+a
+a
+SELECT * FROM t1 WHERE CASE a WHEN 'a' THEN 1 ELSE 0 END;
+a
+a
+SELECT * FROM t1 WHERE CASE a WHEN 'a' THEN 1 ELSE 0 END AND a='a';
+a
+a
+# String comparison in CASE and in the equality, ok to propagate
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE CASE a WHEN 'a' THEN 1 ELSE 0 END AND a='a';
+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')
+SELECT * FROM t1 WHERE a=3;
+a
+100
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END;
+a
+100
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END AND a=3;
+a
+100
+# Integer comparison in CASE and in the equality, not ok to propagate
+# ENUM does not support this type of propagation yet.
+# This can change in the future. See MDEV-8748.
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END AND a=3;
+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))
+SELECT * FROM t1 WHERE a=3;
+a
+100
+SELECT * FROM t1 WHERE CASE a WHEN '100' THEN 1 ELSE 0 END;
+a
+100
+SELECT * FROM t1 WHERE CASE a WHEN '100' THEN 1 ELSE 0 END AND a=3;
+a
+100
+# String comparison in CASE, integer comparison in the equality, not Ok to propagate
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE CASE a WHEN '100' THEN 1 ELSE 0 END AND a=3;
+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))
+SELECT * FROM t1 WHERE a='100';
+a
+100
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END;
+a
+100
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END AND a='100';
+a
+100
+# Integer comparison in CASE, string comparison in the equality, not Ok to propagate
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END AND a='100';
+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))
+SELECT * FROM t1 WHERE a='100';
+a
+100
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END;
+a
+100
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END AND a='100';
+a
+100
+# Multiple type comparison in CASE, string comparison in the equality, not Ok to propagate
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END AND a='100';
+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))
+SELECT * FROM t1 WHERE a=3;
+a
+100
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END;
+a
+100
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END AND a=3;
+a
+100
+# Multiple type comparison in CASE, integer comparison in the equality, not Ok to propagate
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END AND a=3;
+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))
+DROP TABLE t1;
+#
+# End of MDEV-8752
+#
+#
+# End of 10.1 test
+#
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index 7d89a476e21..4c9f257fdf2 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -13,7 +13,7 @@ select CAST('10 ' as unsigned integer);
CAST('10 ' as unsigned integer)
10
Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '10 '
+Note 1292 Truncated incorrect INTEGER value: '10 '
select cast(-5 as unsigned) | 1, cast(-5 as unsigned) & -1;
cast(-5 as unsigned) | 1 cast(-5 as unsigned) & -1
18446744073709551611 18446744073709551611
@@ -404,7 +404,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 DEFAULT ''
+ `t` varchar(4) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select
@@ -438,11 +438,11 @@ ab a ab a 6100
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(2) NOT NULL DEFAULT '',
- `c2` varbinary(2) NOT NULL DEFAULT '',
- `c3` varbinary(2) NOT NULL DEFAULT '',
- `c4` varbinary(2) NOT NULL DEFAULT '',
- `c5` varbinary(2) NOT NULL DEFAULT ''
+ `c1` varbinary(2) NOT NULL,
+ `c2` varbinary(2) NOT NULL,
+ `c3` varbinary(2) NOT NULL,
+ `c4` varbinary(2) NOT NULL,
+ `c5` varbinary(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select
@@ -471,11 +471,11 @@ c1 c2 c3 c4 c5
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '',
- `c2` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '',
- `c3` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '',
- `c4` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '',
- `c5` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL,
+ `c2` varchar(2) CHARACTER SET utf8 NOT NULL,
+ `c3` varchar(2) CHARACTER SET utf8 NOT NULL,
+ `c4` varchar(2) CHARACTER SET utf8 NOT NULL,
+ `c5` varchar(2) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a binary(4), b char(4) character set koi8r);
@@ -582,12 +582,12 @@ create table t1 select cast(1 as unsigned), cast(1 as signed), cast(1 as double
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `cast(1 as unsigned)` int(1) unsigned NOT NULL DEFAULT '0',
- `cast(1 as signed)` int(1) NOT NULL DEFAULT '0',
+ `cast(1 as unsigned)` int(1) unsigned NOT NULL,
+ `cast(1 as signed)` int(1) NOT NULL,
`cast(1 as double(5,2))` double(5,2) DEFAULT NULL,
- `cast(1 as decimal(5,3))` decimal(5,3) NOT NULL DEFAULT '0.000',
- `cast("A" as binary)` varbinary(1) NOT NULL DEFAULT '',
- `cast("A" as char(100))` varbinary(100) NOT NULL DEFAULT '',
+ `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("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
@@ -751,8 +751,8 @@ Warning 1292 Truncated incorrect INTEGER value: '9999999999999999999999999999999
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `CONCAT(CAST(REPEAT('9', 1000) AS SIGNED))` varchar(21) NOT NULL DEFAULT '',
- `CONCAT(CAST(REPEAT('9', 1000) AS UNSIGNED))` varchar(21) NOT NULL DEFAULT ''
+ `CONCAT(CAST(REPEAT('9', 1000) AS SIGNED))` varchar(21) NOT NULL,
+ `CONCAT(CAST(REPEAT('9', 1000) AS UNSIGNED))` varchar(21) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
# End of test for Bug#13581962, Bug#14096619
diff --git a/mysql-test/r/change_user.result b/mysql-test/r/change_user.result
index 18c53a5e22b..1de97ed02e6 100644
--- a/mysql-test/r/change_user.result
+++ b/mysql-test/r/change_user.result
@@ -1,6 +1,10 @@
+set global secure_auth=0;
+create user test_nopw;
grant select on test.* to test_nopw;
-grant select on test.* to test_oldpw identified by password "09301740536db389";
-grant select on test.* to test_newpw identified by "newpw";
+create user test_oldpw identified by password "09301740536db389";
+grant select on test.* to test_oldpw;
+create user test_newpw identified by "newpw";
+grant select on test.* to test_newpw;
select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
concat('<', user(), '>') concat('<', current_user(), '>') database()
<root@localhost> <root@localhost> test
@@ -85,3 +89,4 @@ IS_USED_LOCK('bug31418')
NULL
FLUSH STATUS;
Value of com_select did not change
+set global secure_auth=default;
diff --git a/mysql-test/r/compare.result b/mysql-test/r/compare.result
index cdd234f1478..a5654fb3160 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('01',`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
diff --git a/mysql-test/r/compound.result b/mysql-test/r/compound.result
index dc1f33147a0..92d3226ec00 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
create table t1 (a int)|
select a from t1 having a > 1|
a
diff --git a/mysql-test/r/concurrent_innodb_safelog.result b/mysql-test/r/concurrent_innodb_safelog.result
index 24a84afb9ce..03d20f40be3 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;
+SET SQL_MODE="";
SELECT @@global.tx_isolation;
@@global.tx_isolation
REPEATABLE-READ
@@ -790,3 +791,4 @@ eta tipo c
** 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 35fc2d89cfe..4a140d9e610 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;
+SET SQL_MODE="";
SELECT @@global.tx_isolation;
@@global.tx_isolation
REPEATABLE-READ
@@ -786,3 +787,4 @@ eta tipo c
** 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 778219f6ed9..315aea0ef46 100644
--- a/mysql-test/r/connect.result
+++ b/mysql-test/r/connect.result
@@ -1,3 +1,4 @@
+SET global secure_auth=0;
drop table if exists t1,t2;
show tables;
Tables_in_mysql
@@ -143,6 +144,7 @@ drop table t1;
# -- Bug#33507: Event scheduler creates more threads than max_connections
# -- which results in user lockout.
+CREATE USER mysqltest_u1@localhost;
GRANT USAGE ON *.* TO mysqltest_u1@localhost;
SET GLOBAL max_connections = 3;
@@ -313,3 +315,4 @@ test
test
test
drop procedure p1;
+SET global secure_auth=default;
diff --git a/mysql-test/r/create-big.result b/mysql-test/r/create-big.result
index 5aa44c2941d..bb8c62bb25c 100644
--- a/mysql-test/r/create-big.result
+++ b/mysql-test/r/create-big.result
@@ -9,7 +9,7 @@ ERROR 42S01: Table 't1' already exists
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(1) NOT NULL DEFAULT '0'
+ `i` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
@@ -21,7 +21,7 @@ ERROR 42S01: Table 't1' already exists
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(1) NOT NULL DEFAULT '0'
+ `i` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t3 (j char(5));
@@ -34,7 +34,7 @@ ERROR 42S01: Table 't1' already exists
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(1) NOT NULL DEFAULT '0'
+ `i` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
@@ -46,7 +46,7 @@ ERROR 42S01: Table 't1' already exists
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(1) NOT NULL DEFAULT '0'
+ `i` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
@@ -58,7 +58,7 @@ ERROR 42S01: Table 't1' already exists
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(1) NOT NULL DEFAULT '0'
+ `i` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
@@ -70,7 +70,7 @@ ERROR 42S01: Table 't1' already exists
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(1) NOT NULL DEFAULT '0'
+ `i` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1,t3;
set debug_sync='create_table_select_before_open SIGNAL parked WAIT_FOR go';
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index ae8d5bd6442..e5d3e67b3da 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -131,12 +131,12 @@ drop table t2;
create table t2 select now() as a , curtime() as b, curdate() as c , 1+1 as d , 1.0 + 1 as e , 33333333333333333 + 3 as f;
describe t2;
Field Type Null Key Default Extra
-a datetime NO 0000-00-00 00:00:00
-b time NO 00:00:00
-c date NO 0000-00-00
-d int(3) NO 0
-e decimal(3,1) NO 0.0
-f bigint(19) NO 0
+a datetime NO NULL
+b time NO NULL
+c date NO NULL
+d int(3) NO NULL
+e decimal(3,1) NO NULL
+f bigint(19) NO NULL
drop table t2;
create table t2 select CAST("2001-12-29" AS DATE) as d, CAST("20:45:11" AS TIME) as t, CAST("2001-12-29 20:45:11" AS DATETIME) as dt;
describe t2;
@@ -481,10 +481,10 @@ from t1;
explain t2;
Field Type Null Key Default Extra
a int(11) YES NULL
-b bigint(11) NO 0
-c bigint(10) unsigned NO 0
+b bigint(11) NO NULL
+c bigint(10) unsigned NO NULL
d date YES NULL
-e varchar(1) NO
+e varchar(1) NO NULL
f datetime YES NULL
g time YES NULL
h longblob NO NULL
@@ -727,7 +727,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`b` int(11) NOT NULL,
`a` varchar(12) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
- `c` int(1) NOT NULL DEFAULT '0',
+ `c` int(1) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
@@ -740,7 +740,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`b` int(11) DEFAULT NULL,
`a` varchar(12) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
- `c` int(1) NOT NULL DEFAULT '0',
+ `c` int(1) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
@@ -763,7 +763,7 @@ b int not null, primary key (a)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(12) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+ `a` varchar(12) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`b` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -1926,7 +1926,8 @@ t1 CREATE TABLE `t1` (
`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
+ `INFO_BINARY` blob,
+ `TID` bigint(4) NOT NULL DEFAULT '0'
) DEFAULT CHARSET=utf8
drop table t1;
create temporary table t1 like information_schema.processlist;
@@ -1948,7 +1949,8 @@ t1 CREATE TEMPORARY TABLE `t1` (
`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
+ `INFO_BINARY` blob,
+ `TID` bigint(4) NOT NULL DEFAULT '0'
) DEFAULT CHARSET=utf8
drop table t1;
create table t1 like information_schema.character_sets;
diff --git a/mysql-test/r/create_drop_binlog.result b/mysql-test/r/create_drop_binlog.result
index a1108890208..c5d66613aed 100644
--- a/mysql-test/r/create_drop_binlog.result
+++ b/mysql-test/r/create_drop_binlog.result
@@ -187,11 +187,11 @@ DROP ROLE r1;
CREATE ROLE IF NOT EXISTS r1;
CREATE ROLE IF NOT EXISTS r1;
Warnings:
-Note 1974 Can't create role 'r1'; it already exists
+Note 1975 Can't create role 'r1'; it already exists
DROP ROLE IF EXISTS r1;
DROP ROLE IF EXISTS r1;
Warnings:
-Note 1975 Can't drop role 'r1'; it doesn't exist
+Note 1976 Can't drop role 'r1'; it doesn't exist
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
# # Format_desc 1 # VER
@@ -218,11 +218,11 @@ DROP USER u1@localhost;
CREATE USER IF NOT EXISTS u1@localhost;
CREATE USER IF NOT EXISTS u1@localhost;
Warnings:
-Note 1972 Can't create user 'u1'@'localhost'; it already exists
+Note 1973 Can't create user 'u1'@'localhost'; it already exists
DROP USER IF EXISTS u1@localhost;
DROP USER IF EXISTS u1@localhost;
Warnings:
-Note 1973 Can't drop user 'u1'@'localhost'; it doesn't exist
+Note 1974 Can't drop user 'u1'@'localhost'; it doesn't exist
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
# # Format_desc 1 # VER
@@ -333,3 +333,15 @@ Log_name Pos Event_type Server_id End_log_pos Info
# # Gtid 1 # GTID #-#-#
# # Query 1 # use `test`; DROP TABLE `t1` /* generated by server */
RESET MASTER;
+RESET MASTER;
+SHOW MASTER STATUS;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 <pos>
+RESET MASTER TO 100;
+SHOW MASTER STATUS;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000100 <pos>
+RESET MASTER;
+SHOW MASTER STATUS;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 <pos>
diff --git a/mysql-test/r/create_drop_function.result b/mysql-test/r/create_drop_function.result
index f358c24461a..e9db636ab87 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 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 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_role.result b/mysql-test/r/create_drop_role.result
index 7fc969cbe5a..6e05900264d 100644
--- a/mysql-test/r/create_drop_role.result
+++ b/mysql-test/r/create_drop_role.result
@@ -20,7 +20,7 @@ Host User Role Admin_option
CREATE ROLE IF NOT EXISTS role1 WITH ADMIN user4;
Warnings:
Note 1449 The user specified as a definer ('user4'@'%') does not exist
-Note 1974 Can't create role 'role1'; it already exists
+Note 1975 Can't create role 'role1'; it already exists
SELECT * FROM mysql.roles_mapping WHERE Role='role1';
Host User Role Admin_option
% user3 role1 Y
@@ -29,11 +29,11 @@ SELECT * FROM mysql.roles_mapping WHERE Role='role1';
Host User Role Admin_option
DROP ROLE IF EXISTS role1;
Warnings:
-Note 1975 Can't drop role 'role1'; it doesn't exist
+Note 1976 Can't drop role 'role1'; it doesn't exist
CREATE ROLE role_1;
CREATE ROLE IF NOT EXISTS role_1;
Warnings:
-Note 1974 Can't create role 'role_1'; it already exists
+Note 1975 Can't create role 'role_1'; it already exists
CREATE OR REPLACE ROLE role_1;
CREATE OR REPLACE ROLE IF NOT EXISTS role_1;
ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS
@@ -69,7 +69,7 @@ SET ROLE NONE;
DROP ROLE role_1;
DROP ROLE IF EXISTS role_1;
Warnings:
-Note 1975 Can't drop role 'role_1'; it doesn't exist
+Note 1976 Can't drop role 'role_1'; it doesn't exist
DROP ROLE role_1;
ERROR HY000: Operation DROP ROLE failed for 'role_1'
DROP USER u1@localhost;
diff --git a/mysql-test/r/create_drop_user.result b/mysql-test/r/create_drop_user.result
index 3c388545199..dd75d1c257a 100644
--- a/mysql-test/r/create_drop_user.result
+++ b/mysql-test/r/create_drop_user.result
@@ -4,7 +4,7 @@ password
*2B602296A79E0A8784ACC5C88D92E46588CCA3C3
CREATE USER IF NOT EXISTS u1@localhost IDENTIFIED BY 'pw2';
Warnings:
-Note 1972 Can't create user 'u1'@'localhost'; it already exists
+Note 1973 Can't create user 'u1'@'localhost'; it already exists
SELECT password FROM mysql.user WHERE user='u1';
password
*2B602296A79E0A8784ACC5C88D92E46588CCA3C3
@@ -20,7 +20,7 @@ password
DROP USER IF EXISTS u1@localhost;
DROP USER IF EXISTS u1@localhost;
Warnings:
-Note 1973 Can't drop user 'u1'@'localhost'; it doesn't exist
+Note 1974 Can't drop user 'u1'@'localhost'; it doesn't exist
DROP USER u1@localhost;
ERROR HY000: Operation DROP USER failed for 'u1'@'localhost'
CREATE OR REPLACE USER u1@localhost;
@@ -38,6 +38,6 @@ CREATE OR REPLACE USER u1 IDENTIFIED BY PASSWORD 'abcdefghijklmnop', u2;
DROP USER u1;
DROP USER IF EXISTS u1, u2;
Warnings:
-Note 1973 Can't drop user 'u1'@'%'; it doesn't exist
+Note 1974 Can't drop user 'u1'@'%'; it doesn't exist
DROP USER u2;
ERROR HY000: Operation DROP USER failed for 'u2'@'%'
diff --git a/mysql-test/r/create_or_replace.result b/mysql-test/r/create_or_replace.result
index f73943be5c8..ed25fbadf45 100644
--- a/mysql-test/r/create_or_replace.result
+++ b/mysql-test/r/create_or_replace.result
@@ -101,7 +101,7 @@ CREATE OR REPLACE TABLE t1 AS SELECT 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `1` int(1) NOT NULL DEFAULT '0'
+ `1` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
create table t1 (a int);
@@ -142,7 +142,7 @@ CREATE OR REPLACE TABLE t1 AS SELECT 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `1` int(1) NOT NULL DEFAULT '0'
+ `1` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE OR REPLACE TABLE t1 (a int);
diff --git a/mysql-test/r/create_or_replace_permission.result b/mysql-test/r/create_or_replace_permission.result
index d9c5a6f1d64..f662bf1bfd8 100644
--- a/mysql-test/r/create_or_replace_permission.result
+++ b/mysql-test/r/create_or_replace_permission.result
@@ -1,3 +1,5 @@
+set local sql_mode="";
+set global sql_mode="";
#
# Tests for checking permission denied on CREATE OR REPLACE if DROP
# access is revoked
@@ -48,3 +50,4 @@ Warnings:
Note 1008 Can't drop database 'db2'; database doesn't exist
DROP DATABASE db1;
DROP USER mysqltest_1@localhost;
+set global sql_mode=default;
diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result
index a443c6134d1..f97d060d26a 100644
--- a/mysql-test/r/ctype_big5.result
+++ b/mysql-test/r/ctype_big5.result
@@ -224,9 +224,21 @@ 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
@@ -439,9 +451,21 @@ 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
@@ -488,7 +512,7 @@ select hex(convert(_big5 0xC84041 using ucs2));
hex(convert(_big5 0xC84041 using ucs2))
003F0041
Warnings:
-Warning 1976 Cannot convert 'big5' character 0xC840 to 'ucs2'
+Warning 1977 Cannot convert 'big5' character 0xC840 to 'ucs2'
End of 4.1 tests
set names big5;
create table t1 (a blob);
@@ -528,7 +552,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`code` varchar(8) DEFAULT NULL,
- `a` varchar(1) CHARACTER SET big5 NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET big5 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT COUNT(*) FROM t1;
COUNT(*)
@@ -765,70 +789,70 @@ A2C0 â…§
A2C1 â…¨
A2C2 â…©
Warnings:
-Warning 1976 Cannot convert 'big5' character 0xA3C0 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C0 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C1 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C1 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C2 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C2 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C3 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C3 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C4 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C4 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C5 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C5 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C6 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C6 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C7 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C7 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C8 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C8 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C9 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C9 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CA to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CA to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CB to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CB to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CC to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CC to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CD to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CD to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CE to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CE to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CF to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CF to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D0 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D0 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D1 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D1 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D2 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D2 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D3 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D3 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D4 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D4 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D5 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D5 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D6 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D6 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D7 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D7 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D8 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D8 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D9 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D9 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DA to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DA to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DB to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DB to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DC to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DC to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DD to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DD to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DE to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DE to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DF to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DF to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C0 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C0 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C1 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C1 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C2 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C2 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C3 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C3 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C4 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C4 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C5 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C5 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C6 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C6 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C7 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C7 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C8 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C8 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C9 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C9 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CA to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CA to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CB to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CB to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CC to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CC to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CD to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CD to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CE to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CE to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CF to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CF to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D0 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D0 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D1 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D1 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D2 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D2 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D3 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D3 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D4 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D4 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D5 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D5 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D6 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D6 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D7 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D7 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D8 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D8 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D9 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D9 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DA to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DA to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DB to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DB to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DC to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DC to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DD to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DD to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DE to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DE to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DF to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DF to 'utf8'
SELECT * FROM t1
WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <>
HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
@@ -844,70 +868,70 @@ C7D9 р
C7DA Ñ
C7DB Ñ‚
Warnings:
-Warning 1976 Cannot convert 'big5' character 0xA3C0 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C0 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C1 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C1 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C2 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C2 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C3 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C3 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C4 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C4 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C5 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C5 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C6 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C6 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C7 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C7 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C8 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C8 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C9 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3C9 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CA to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CA to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CB to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CB to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CC to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CC to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CD to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CD to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CE to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CE to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CF to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3CF to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D0 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D0 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D1 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D1 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D2 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D2 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D3 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D3 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D4 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D4 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D5 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D5 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D6 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D6 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D7 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D7 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D8 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D8 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D9 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3D9 to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DA to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DA to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DB to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DB to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DC to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DC to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DD to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DD to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DE to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DE to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DF to 'utf8'
-Warning 1976 Cannot convert 'big5' character 0xA3DF to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C0 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C0 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C1 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C1 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C2 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C2 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C3 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C3 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C4 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C4 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C5 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C5 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C6 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C6 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C7 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C7 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C8 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C8 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C9 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3C9 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CA to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CA to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CB to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CB to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CC to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CC to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CD to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CD to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CE to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CE to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CF to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3CF to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D0 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D0 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D1 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D1 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D2 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D2 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D3 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D3 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D4 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D4 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D5 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D5 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D6 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D6 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D7 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D7 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D8 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D8 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D9 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3D9 to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DA to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DA to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DB to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DB to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DC to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DC to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DD to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DD to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DE to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DE to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DF to 'utf8'
+Warning 1977 Cannot convert 'big5' character 0xA3DF to 'utf8'
DROP TABLE t1;
#
# End of 5.5 tests
@@ -926,7 +950,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET big5 NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET big5 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -946,7 +970,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET big5 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -1185,7 +1209,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET big5 COLLATE big5_bin NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET big5 COLLATE big5_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -1205,7 +1229,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET big5 COLLATE big5_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -4548,7 +4572,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 DEFAULT ''
+ `a` varchar(10) CHARACTER SET big5 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('à\'),('à\t');
INSERT INTO t1 VALUES ('\\à\'),('\\à\t'),('\\à\t\t');
@@ -4587,7 +4611,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 DEFAULT ''
+ `a` varchar(10) CHARACTER SET big5 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (BINARY('à\')),(BINARY('à\t'));
INSERT INTO t1 VALUES (BINARY('\\à\')),(BINARY('\\à\t')),(BINARY('\\à\t\t'));
@@ -4626,7 +4650,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 DEFAULT ''
+ `a` varchar(10) CHARACTER SET big5 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_BINARY'à\'),(_BINARY'à\t');
INSERT INTO t1 VALUES (_BINARY'\\à\'),(_BINARY'\\à\t'),(_BINARY'\\à\t\t');
@@ -4672,7 +4696,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 DEFAULT ''
+ `a` varchar(10) CHARACTER SET big5 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('à\['),('\à\[');
SELECT HEX(a) FROM t1;
@@ -4692,7 +4716,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 DEFAULT ''
+ `a` varbinary(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('à\['),('\à\[');
SELECT HEX(a) FROM t1;
diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result
index 7037fc1b383..2dbf783ff27 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 DEFAULT ''
+ `c1` varbinary(1) NOT 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 DEFAULT ''
+ `c1` varbinary(20) NOT 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 DEFAULT ''
+ `c1` varbinary(4) NOT 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 DEFAULT ''
+ `c1` varbinary(3) NOT 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 DEFAULT ''
+ `c1` varbinary(3) NOT 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 DEFAULT ''
+ `c1` varbinary(3) NOT 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 DEFAULT ''
+ `c1` varbinary(2) NOT 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 DEFAULT ''
+ `c1` varbinary(4) NOT 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 DEFAULT ''
+ `c1` varbinary(21) NOT 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 DEFAULT ''
+ `c1` varbinary(21) NOT 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 DEFAULT ''
+ `c1` varbinary(2) NOT 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 DEFAULT ''
+ `c1` varbinary(21) NOT 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 DEFAULT ''
+ `c1` varbinary(21) NOT 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 DEFAULT ''
+ `c1` varbinary(21) NOT 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 DEFAULT ''
+ `c1` varbinary(21) NOT 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 DEFAULT ''
+ `c1` varbinary(2) NOT 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 DEFAULT ''
+ `c1` varbinary(23) NOT 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 DEFAULT ''
+ `c1` varbinary(23) NOT 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 DEFAULT ''
+ `c1` varbinary(4) NOT 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 DEFAULT ''
+ `c1` varbinary(4) NOT 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 DEFAULT ''
+ `c1` varbinary(3) NOT 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 DEFAULT ''
+ `c1` varbinary(21) NOT 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 DEFAULT ''
+ `c1` varbinary(23) NOT 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 DEFAULT ''
+ `c1` varbinary(10) NOT 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 DEFAULT ''
+ `c1` varbinary(10) NOT 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 DEFAULT ''
+ `c1` varbinary(10) NOT 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 DEFAULT ''
+ `c1` varbinary(10) NOT 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 DEFAULT ''
+ `c1` varbinary(11) NOT 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 DEFAULT ''
+ `c1` varbinary(3) NOT 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 DEFAULT ''
+ `c1` varbinary(3) NOT 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 DEFAULT ''
+ `c1` varbinary(21) NOT 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 DEFAULT ''
+ `c1` varbinary(3) NOT 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 DEFAULT ''
+ `c1` varbinary(32) NOT 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 DEFAULT ''
+ `c1` varbinary(16) NOT 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 DEFAULT ''
+ `c1` varbinary(41) NOT 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 DEFAULT ''
+ `c1` varbinary(40) NOT 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 DEFAULT ''
+ `c1` varbinary(40) NOT 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 DEFAULT ''
+ `c1` varbinary(2) NOT 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 DEFAULT ''
+ `c1` varbinary(1) NOT 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 DEFAULT ''
+ `c1` varbinary(2) NOT 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 DEFAULT ''
+ `c1` varbinary(2) NOT 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 DEFAULT ''
+ `c1` varbinary(2) NOT 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 DEFAULT ''
+ `c1` varbinary(1) NOT 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 DEFAULT ''
+ `c1` varbinary(3) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(group_concat(1,2,3));
@@ -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 DEFAULT ''
+ `c1` varbinary(21) NOT 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 DEFAULT ''
+ `c1` varbinary(1) NOT 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 DEFAULT ''
+ `c1` varbinary(21) NOT 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 DEFAULT ''
+ `c1` varbinary(10) NOT 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 DEFAULT ''
+ `c1` varbinary(10) NOT 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 DEFAULT ''
+ `c1` varbinary(21) NOT 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 DEFAULT ''
+ `c1` varbinary(21) NOT 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 DEFAULT ''
+ `c1` varbinary(21) NOT 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 DEFAULT ''
+ `c1` varchar(36) CHARACTER SET utf8 NOT 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 DEFAULT ''
+ `c1` varchar(37) NOT 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,8 +840,8 @@ hex(c1)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL DEFAULT '',
- `c2` int(1) NOT NULL DEFAULT '0'
+ `c1` varbinary(1) NOT NULL,
+ `c2` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @a2=1;
@@ -898,8 +898,8 @@ hex(c1)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(4) NOT NULL DEFAULT '',
- `c2` decimal(2,1) NOT NULL DEFAULT '0.0'
+ `c1` varbinary(4) NOT NULL,
+ `c2` decimal(2,1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @a2=1.1;
@@ -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 DEFAULT ''
+ `c1` varbinary(1) NOT 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 DEFAULT ''
+ `c1` varbinary(1) NOT 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 DEFAULT ''
+ `c1` varbinary(1) NOT 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 DEFAULT ''
+ `c1` varbinary(1) NOT 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 DEFAULT ''
+ `c1` varbinary(1) NOT 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 DEFAULT ''
+ `c1` varbinary(1) NOT 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 DEFAULT ''
+ `c1` varbinary(2) NOT 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 DEFAULT ''
+ `c1` varbinary(1) NOT 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 DEFAULT ''
+ `c1` varbinary(1) NOT 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 DEFAULT ''
+ `c1` varbinary(1) NOT 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 DEFAULT ''
+ `c1` varbinary(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a varchar(10), fulltext key(a));
@@ -1059,7 +1059,7 @@ create table t1 as select ifnull(1,'a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL DEFAULT ''
+ `c1` varbinary(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ifnull(1,1)));
@@ -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 DEFAULT ''
+ `c1` varbinary(1) NOT 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 DEFAULT ''
+ `c1` varbinary(4) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(if(1,'b',1));
@@ -1089,7 +1089,7 @@ create table t1 as select if(1,'b',1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL DEFAULT ''
+ `c1` varbinary(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(if(1,1,'b'));
@@ -1099,7 +1099,7 @@ create table t1 as select if(1,1,'b') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL DEFAULT ''
+ `c1` varbinary(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(if(1,1,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 DEFAULT ''
+ `c1` varbinary(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(nullif(1,2)));
@@ -1189,7 +1189,7 @@ create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(21) DEFAULT NULL
+ `c1` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))));
@@ -1199,7 +1199,7 @@ create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(21) DEFAULT NULL
+ `c1` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))));
@@ -1274,7 +1274,7 @@ 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 DEFAULT ''
+ `c1` varbinary(6) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(period_diff(200902, 200802)));
@@ -1286,7 +1286,7 @@ Warning 1265 Data truncated for column 'c1' at row 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(6) NOT NULL DEFAULT ''
+ `c1` varbinary(6) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(to_days(20090224)));
@@ -1483,21 +1483,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 DEFAULT ''
+ `c1` varbinary(10) NOT 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 DEFAULT ''
+ `c1` varbinary(10) NOT 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 DEFAULT ''
+ `c1` varbinary(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select repeat('a',20) as c1 limit 0;
@@ -1513,7 +1513,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 DEFAULT ''
+ `c1` varbinary(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sec_to_time(2378)));
@@ -1606,21 +1606,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 DEFAULT ''
+ `c1` varbinary(19) NOT 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 DEFAULT ''
+ `c1` varbinary(19) NOT 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 DEFAULT ''
+ `c1` varbinary(19) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(addtime('00:00:00','11:22:33')));
@@ -1660,7 +1660,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 DEFAULT ''
+ `c1` varbinary(127) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(insert(1133,3,0,22));
@@ -1670,7 +1670,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 DEFAULT ''
+ `c1` varbinary(6) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lcase(123));
@@ -1680,7 +1680,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 DEFAULT ''
+ `c1` varbinary(3) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(left(123,1));
@@ -1690,7 +1690,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 DEFAULT ''
+ `c1` varbinary(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lower(123));
@@ -1700,7 +1700,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 DEFAULT ''
+ `c1` varbinary(3) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lpad(1,2,0));
@@ -1710,7 +1710,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 DEFAULT ''
+ `c1` varbinary(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(ltrim(1));
@@ -1720,7 +1720,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 DEFAULT ''
+ `c1` varbinary(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(mid(1,1,1));
@@ -1730,7 +1730,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 DEFAULT ''
+ `c1` varbinary(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(repeat(1,2));
@@ -1740,7 +1740,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 DEFAULT ''
+ `c1` varbinary(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(replace(1,1,2));
@@ -1750,7 +1750,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 DEFAULT ''
+ `c1` varbinary(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(reverse(12));
@@ -1760,7 +1760,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 DEFAULT ''
+ `c1` varbinary(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(right(123,1));
@@ -1770,7 +1770,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 DEFAULT ''
+ `c1` varbinary(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(rpad(1,2,0));
@@ -1780,7 +1780,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 DEFAULT ''
+ `c1` varbinary(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(rtrim(1));
@@ -1790,7 +1790,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 DEFAULT ''
+ `c1` varbinary(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(soundex(1));
@@ -1800,7 +1800,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 DEFAULT ''
+ `c1` varbinary(4) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(substring(1,1,1));
@@ -1810,7 +1810,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 DEFAULT ''
+ `c1` varbinary(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(trim(1));
@@ -1820,7 +1820,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 DEFAULT ''
+ `c1` varbinary(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(ucase(1));
@@ -1830,7 +1830,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 DEFAULT ''
+ `c1` varbinary(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(upper(1));
@@ -1840,14 +1840,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 DEFAULT ''
+ `c1` varbinary(1) NOT 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 DEFAULT ''
+ `a` varbinary(64) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ("1.1"), ("2.1");
select a, hex(a) from t1;
@@ -2097,7 +2097,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 DEFAULT ''
+ `concat(a)` varbinary(19) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1 (a date);
@@ -2637,7 +2637,7 @@ SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`CONCAT(a)` varbinary(9) DEFAULT NULL,
- `IFNULL(a,'')` varbinary(9) NOT NULL DEFAULT '',
+ `IFNULL(a,'')` varbinary(9) NOT NULL,
`IF(a,a,'')` varbinary(9) DEFAULT NULL,
`CASE WHEN a THEN a ELSE '' END` varbinary(9) DEFAULT NULL,
`COALESCE(a,'')` varbinary(9) DEFAULT NULL
@@ -2647,14 +2647,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 DEFAULT ''
+ `CONCAT_WS(1,2,3)` varbinary(3) NOT 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 DEFAULT ''
+ `INSERT(1133,3,0,22)` varbinary(6) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT LCASE(a) FROM t1;
@@ -2675,35 +2675,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 DEFAULT ''
+ `REPEAT(1,2)` varbinary(2) NOT 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 DEFAULT ''
+ `LEFT(123,2)` varbinary(2) NOT 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 DEFAULT ''
+ `RIGHT(123,2)` varbinary(2) NOT 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 DEFAULT ''
+ `LTRIM(123)` varbinary(3) NOT 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 DEFAULT ''
+ `RTRIM(123)` varbinary(3) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1;
@@ -2717,35 +2717,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 DEFAULT ''
+ `REPLACE(111,2,3)` varbinary(3) NOT 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 DEFAULT ''
+ `SUBSTRING_INDEX(111,111,1)` varbinary(3) NOT 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 DEFAULT ''
+ `MAKE_SET(111,222,3)` varbinary(5) NOT 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 DEFAULT ''
+ `SOUNDEX(1)` varbinary(4) NOT 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 DEFAULT ''
+ `EXPORT_SET(1,'Y','N','',8)` varbinary(64) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
DROP TABLE t1;
@@ -2926,7 +2926,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 DEFAULT ''
+ `c1` varbinary(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE CONCAT(c1)='a';
@@ -2947,7 +2947,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 DEFAULT ''
+ `c1` varbinary(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
@@ -2968,7 +2968,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 DEFAULT ''
+ `c1` varbinary(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '% '=CONCAT(c1);
@@ -2989,7 +2989,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 DEFAULT ''
+ `c1` varbinary(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '%'=CONCAT(c1);
@@ -3008,6 +3008,31 @@ Warnings:
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'
+#
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
+a LENGTH(a)
+a 1
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
+a LENGTH(a)
+a 1
+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')
+DROP TABLE t1;
+#
+# End of MDEV-8694
+#
+#
# MDEV-7629 Regression: Bit and hex string literals changed column names in 10.0.14
#
SELECT _binary 0x7E, _binary X'7E', _binary B'01111110';
@@ -3016,3 +3041,103 @@ _binary 0x7E _binary X'7E' _binary B'01111110'
#
# End of 10.0 tests
#
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8695 Wrong result for SELECT..WHERE varchar_column='a' AND CRC32(varchar_column)=3904355907
+#
+CREATE TABLE t1 (a VARBINARY(10));
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE CRC32(a)=3904355907;
+a LENGTH(a) CRC32(a)
+a 1 3904355907
+SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)=3904355907;
+a LENGTH(a) CRC32(a)
+a 1 3904355907
+# Okey to propagate 'a' into CRC32(a)
+EXPLAIN EXTENDED SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)=3904355907;
+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')
+SELECT a, HEX(a) FROM t1 WHERE HEX(a)='61';
+a HEX(a)
+a 61
+SELECT *,HEX(a) FROM t1 WHERE a='a' AND HEX(a)='61';
+a HEX(a)
+a 61
+# Okey to propagate 'a' into HEX(a)
+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')
+SELECT * FROM t1 WHERE a='a';
+a
+a
+SELECT * FROM t1 WHERE LENGTH(a)=2;
+a
+a
+SELECT * FROM t1 WHERE a='a' AND LENGTH(a)=2;
+a
+# Okey to propagate 'a' into LENGTH(a)
+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 NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
+SELECT * FROM t1 WHERE a='a ';
+a
+a
+SELECT * FROM t1 WHERE a='a ' AND LENGTH(a)=2;
+a
+a
+# Okey to propagate 'a ' into LENGTH(a)
+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 ')
+DROP TABLE t1;
+#
+# MDEV-8723 Wrong result for SELECT..WHERE COLLATION(a)='binary' AND a='a'
+#
+CREATE TABLE t1 (a VARBINARY(10));
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT * FROM t1 WHERE COLLATION(a)='binary' AND a='a';
+a
+a
+SELECT * FROM t1 WHERE CHARSET(a)='binary' AND a='a';
+a
+a
+SELECT * FROM t1 WHERE COERCIBILITY(a)=2 AND a='a';
+a
+a
+SELECT * FROM t1 WHERE WEIGHT_STRING(a)='a' AND a='a';
+a
+a
+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')
+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')
+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')
+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'))
+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 6cb1876c3ad..f84613e086f 100644
--- a/mysql-test/r/ctype_collate.result
+++ b/mysql-test/r/ctype_collate.result
@@ -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 DEFAULT ''
+ `f1` varchar(1) CHARACTER SET latin5 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate
diff --git a/mysql-test/r/ctype_cp1250_ch.result b/mysql-test/r/ctype_cp1250_ch.result
index 52c2406ae4d..f2eeb4dda79 100644
--- a/mysql-test/r/ctype_cp1250_ch.result
+++ b/mysql-test/r/ctype_cp1250_ch.result
@@ -105,6 +105,126 @@ SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server;
SET character_set_client= @safe_character_set_client;
SET character_set_results= @safe_character_set_results;
+#
+# MDEV-7149 Constant condition propagation erroneously applied for LIKE
+#
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT * FROM t1 WHERE CONCAT(c1)='a';
+c1
+a
+a
+SELECT * FROM t1 WHERE CONCAT(c1) LIKE 'a ';
+c1
+a
+SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a ';
+c1
+a
+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 '))
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
+c1
+a
+a
+SELECT * FROM t1 WHERE 'a ' LIKE CONCAT(c1);
+c1
+a
+SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1);
+c1
+a
+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`)))
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('%'),('% ');
+SELECT * FROM t1 WHERE '% '=CONCAT(c1);
+c1
+%
+%
+SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1);
+c1
+%
+SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
+c1
+%
+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`)))
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('%'),('% ');
+SELECT * FROM t1 WHERE '%'=CONCAT(c1);
+c1
+%
+%
+SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1);
+c1
+%
+SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
+c1
+%
+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`)))
+DROP TABLE t1;
+#
+# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a'
+#
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
+a LENGTH(a)
+a 1
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
+a LENGTH(a)
+a 1
+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'))
+DROP TABLE t1;
+#
+# End of MDEV-8694
+#
SET @test_character_set= 'cp1250';
SET @test_collation= 'cp1250_czech_cs';
SET @safe_character_set_server= @@character_set_server;
@@ -370,7 +490,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET cp1250 COLLATE cp1250_czech_cs NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET cp1250 COLLATE cp1250_czech_cs NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -390,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET cp1250 COLLATE cp1250_czech_cs NOT 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 385d7c34d6f..c69a56b3b9c 100644
--- a/mysql-test/r/ctype_cp1251.result
+++ b/mysql-test/r/ctype_cp1251.result
@@ -386,7 +386,7 @@ FD FD FD D18D FD
FE FE FE D18E FE
FF FF FF D18F FF
Warnings:
-Warning 1976 Cannot convert 'cp1251' character 0x98 to 'utf8'
+Warning 1977 Cannot convert 'cp1251' character 0x98 to 'utf8'
DROP TABLE t1;
set global LC_TIME_NAMES=convert((-8388608) using cp1251);
ERROR HY000: Unknown locale: '-8388608'
@@ -407,7 +407,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -420,7 +420,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 DEFAULT ''
+ `c1` varchar(20) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -433,7 +433,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 DEFAULT ''
+ `c1` varchar(4) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -446,7 +446,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1-2));
@@ -456,7 +456,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1*2));
@@ -466,7 +466,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1/2));
@@ -506,7 +506,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(-(1+2)));
@@ -516,7 +516,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 DEFAULT ''
+ `c1` varchar(4) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1|2));
@@ -526,7 +526,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1&2));
@@ -536,7 +536,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(bit_count(12)));
@@ -546,7 +546,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(2<<1));
@@ -556,7 +556,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(2>>1));
@@ -566,7 +566,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(~0));
@@ -576,7 +576,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(3^2));
@@ -586,7 +586,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(abs(-2)));
@@ -596,7 +596,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(left(concat(exp(2)),1));
@@ -726,7 +726,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 DEFAULT ''
+ `c1` varchar(23) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(radians(0)));
@@ -736,7 +736,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 DEFAULT ''
+ `c1` varchar(23) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ceiling(0.5)));
@@ -746,7 +746,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 DEFAULT ''
+ `c1` varchar(4) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(floor(0.5)));
@@ -756,7 +756,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 DEFAULT ''
+ `c1` varchar(4) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(round(0.5)));
@@ -766,7 +766,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sign(0.5)));
@@ -776,14 +776,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET cp1251 NOT 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 DEFAULT ''
+ `c1` varchar(23) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(length('a')));
@@ -793,7 +793,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(char_length('a')));
@@ -803,7 +803,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(bit_length('a')));
@@ -813,7 +813,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(coercibility('a')));
@@ -823,7 +823,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(locate('a','a')));
@@ -833,7 +833,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 DEFAULT ''
+ `c1` varchar(11) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(field('c','a','b','c')));
@@ -843,7 +843,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ascii(61)));
@@ -853,7 +853,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ord(61)));
@@ -863,7 +863,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(find_in_set('b','a,b,c,d')));
@@ -873,7 +873,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select md5('a'), hex(md5('a'));
@@ -883,7 +883,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 DEFAULT ''
+ `c1` varchar(32) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select old_password('a'), hex(old_password('a'));
@@ -893,7 +893,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 DEFAULT ''
+ `c1` varchar(16) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select password('a'), hex(password('a'));
@@ -903,7 +903,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 DEFAULT ''
+ `c1` varchar(41) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select sha('a'), hex(sha('a'));
@@ -913,7 +913,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 DEFAULT ''
+ `c1` varchar(40) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select sha1('a'), hex(sha1('a'));
@@ -923,7 +923,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 DEFAULT ''
+ `c1` varchar(40) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast('-1' as signed)));
@@ -933,7 +933,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast('1' as unsigned)));
@@ -943,7 +943,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast(1/2 as decimal(5,5))));
@@ -1002,7 +1002,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(greatest(1,2)));
@@ -1012,7 +1012,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(case when 11 then 22 else 33 end));
@@ -1022,7 +1022,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(coalesce(1,2)));
@@ -1032,7 +1032,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat_ws(1,2,3));
@@ -1042,7 +1042,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(group_concat(1,2,3));
@@ -1070,7 +1070,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(benchmark(0,0)));
@@ -1080,7 +1080,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sleep(0)));
@@ -1090,7 +1090,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(is_free_lock('xxxx')));
@@ -1124,7 +1124,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(uncompressed_length('')));
@@ -1141,7 +1141,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(inet_aton('127.1.1.1')));
@@ -1177,7 +1177,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(found_rows()));
@@ -1187,21 +1187,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET cp1251 NOT 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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET cp1251 NOT 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 DEFAULT ''
+ `c1` varchar(36) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select coercibility(uuid()), coercibility(cast('a' as char character set latin1));
@@ -1214,7 +1214,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 DEFAULT ''
+ `c1` varchar(37) NOT 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,8 +1234,8 @@ hex(c1)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '',
- `c2` int(1) NOT NULL DEFAULT '0'
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL,
+ `c2` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @a2=1;
@@ -1292,8 +1292,8 @@ hex(c1)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET cp1251 NOT NULL DEFAULT '',
- `c2` decimal(2,1) NOT NULL DEFAULT '0.0'
+ `c1` varchar(4) CHARACTER SET cp1251 NOT NULL,
+ `c2` decimal(2,1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @a2=1.1;
@@ -1331,7 +1331,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a'='a' IS NOT TRUE));
@@ -1341,7 +1341,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(NOT 'a'='a'));
@@ -1351,7 +1351,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' IS NULL));
@@ -1361,7 +1361,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' IS NOT NULL));
@@ -1371,7 +1371,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' rlike 'a'));
@@ -1381,7 +1381,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(strcmp('a','b')));
@@ -1391,7 +1391,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' like 'a'));
@@ -1401,7 +1401,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' between 'b' and 'c'));
@@ -1411,7 +1411,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' in ('a','b')));
@@ -1421,7 +1421,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(interval(23, 1, 15, 17, 30, 44, 200)));
@@ -1431,7 +1431,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a varchar(10), fulltext key(a));
@@ -1453,7 +1453,7 @@ create table t1 as select ifnull(1,'a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ifnull(1,1)));
@@ -1463,7 +1463,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ifnull(1.1,1.1)));
@@ -1473,7 +1473,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 DEFAULT ''
+ `c1` varchar(4) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(if(1,'b',1));
@@ -1483,7 +1483,7 @@ create table t1 as select if(1,'b',1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(if(1,1,'b'));
@@ -1493,7 +1493,7 @@ create table t1 as select if(1,1,'b') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(if(1,1,1)));
@@ -1503,7 +1503,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(nullif(1,2)));
@@ -1583,7 +1583,7 @@ create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
+ `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))));
@@ -1593,7 +1593,7 @@ create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
+ `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))));
@@ -1668,7 +1668,7 @@ 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 DEFAULT ''
+ `c1` varchar(6) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(period_diff(200902, 200802)));
@@ -1680,7 +1680,7 @@ Warning 1265 Data truncated for column 'c1' at row 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(6) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+ `c1` varchar(6) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(to_days(20090224)));
@@ -1877,21 +1877,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET cp1251 NOT 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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET cp1251 NOT 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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select repeat('a',20) as c1 limit 0;
@@ -1907,7 +1907,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sec_to_time(2378)));
@@ -2000,21 +2000,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 DEFAULT ''
+ `c1` varchar(19) CHARACTER SET cp1251 NOT 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 DEFAULT ''
+ `c1` varchar(19) CHARACTER SET cp1251 NOT 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 DEFAULT ''
+ `c1` varchar(19) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(addtime('00:00:00','11:22:33')));
@@ -2054,7 +2054,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 DEFAULT ''
+ `c1` varchar(127) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(insert(1133,3,0,22));
@@ -2064,7 +2064,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 DEFAULT ''
+ `c1` varchar(6) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lcase(123));
@@ -2074,7 +2074,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(left(123,1));
@@ -2084,7 +2084,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lower(123));
@@ -2094,7 +2094,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lpad(1,2,0));
@@ -2104,7 +2104,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(ltrim(1));
@@ -2114,7 +2114,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(mid(1,1,1));
@@ -2124,7 +2124,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(repeat(1,2));
@@ -2134,7 +2134,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(replace(1,1,2));
@@ -2144,7 +2144,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(reverse(12));
@@ -2154,7 +2154,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(right(123,1));
@@ -2164,7 +2164,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(rpad(1,2,0));
@@ -2174,7 +2174,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(rtrim(1));
@@ -2184,7 +2184,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(soundex(1));
@@ -2194,7 +2194,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 DEFAULT ''
+ `c1` varchar(4) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(substring(1,1,1));
@@ -2204,7 +2204,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(trim(1));
@@ -2214,7 +2214,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(ucase(1));
@@ -2224,7 +2224,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(upper(1));
@@ -2234,14 +2234,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET cp1251 NOT 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 DEFAULT ''
+ `a` varchar(64) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ("1.1"), ("2.1");
select a, hex(a) from t1;
@@ -2491,7 +2491,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 DEFAULT ''
+ `concat(a)` varchar(19) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1 (a date);
@@ -3031,7 +3031,7 @@ SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`CONCAT(a)` varchar(9) CHARACTER SET cp1251 DEFAULT NULL,
- `IFNULL(a,'')` varchar(9) CHARACTER SET cp1251 NOT NULL DEFAULT '',
+ `IFNULL(a,'')` varchar(9) CHARACTER SET cp1251 NOT NULL,
`IF(a,a,'')` varchar(9) CHARACTER SET cp1251 DEFAULT NULL,
`CASE WHEN a THEN a ELSE '' END` varchar(9) CHARACTER SET cp1251 DEFAULT NULL,
`COALESCE(a,'')` varchar(9) CHARACTER SET cp1251 DEFAULT NULL
@@ -3041,14 +3041,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 DEFAULT ''
+ `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET cp1251 NOT 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 DEFAULT ''
+ `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT LCASE(a) FROM t1;
@@ -3069,35 +3069,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 DEFAULT ''
+ `REPEAT(1,2)` varchar(2) CHARACTER SET cp1251 NOT 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 DEFAULT ''
+ `LEFT(123,2)` varchar(2) CHARACTER SET cp1251 NOT 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 DEFAULT ''
+ `RIGHT(123,2)` varchar(2) CHARACTER SET cp1251 NOT 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 DEFAULT ''
+ `LTRIM(123)` varchar(3) CHARACTER SET cp1251 NOT 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 DEFAULT ''
+ `RTRIM(123)` varchar(3) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1;
@@ -3111,35 +3111,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 DEFAULT ''
+ `REPLACE(111,2,3)` varchar(3) CHARACTER SET cp1251 NOT 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 DEFAULT ''
+ `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET cp1251 NOT 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 DEFAULT ''
+ `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET cp1251 NOT 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 DEFAULT ''
+ `SOUNDEX(1)` varchar(4) CHARACTER SET cp1251 NOT 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 DEFAULT ''
+ `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET cp1251 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
DROP TABLE t1;
@@ -3334,3 +3334,66 @@ DROP TABLE t1;
#
# End of 5.5 tests
#
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8688 Wrong result for SELECT..WHERE varchar_column IN (1,2,3) AND varchar_column=' 1';
+#
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET cp1251 COLLATE cp1251_ukrainian_ci);
+INSERT INTO t1 VALUES (' 1'),('`1');
+SELECT * FROM t1 WHERE a IN (1,2,3);
+a
+ 1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '`1'
+SELECT * FROM t1 WHERE a IN (1,2,3) AND a=' 1';
+a
+ 1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '`1'
+SELECT * FROM t1 WHERE a IN (1,2,3,'4') AND a=' 1';
+a
+ 1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '`1'
+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)))
+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')))
+DROP TABLE t1;
+#
+# MDEV-8671 Wrong result for SELECT..WHERE varchar_column=' 1' AND (varchar_column XOR '1')
+#
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET cp1251 COLLATE cp1251_ukrainian_ci);
+INSERT INTO t1 VALUES (' 1'),('`1');
+SELECT * FROM t1 WHERE a=' 1';
+a
+ 1
+`1
+SELECT * FROM t1 WHERE (a XOR '0');
+a
+ 1
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '`1'
+SELECT * FROM t1 WHERE a=' 1' AND (a XOR '0');
+a
+ 1
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '`1'
+# ' 1' should not be propagated into (a XIR '0')
+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'))
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/ctype_cp932_binlog_stm.result b/mysql-test/r/ctype_cp932_binlog_stm.result
index b07db029588..75d05aa9f0a 100644
--- a/mysql-test/r/ctype_cp932_binlog_stm.result
+++ b/mysql-test/r/ctype_cp932_binlog_stm.result
@@ -94,7 +94,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`code` varchar(8) DEFAULT NULL,
- `a` varchar(1) CHARACTER SET cp932 NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET cp932 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
UPDATE t1 SET a=unhex(code) ORDER BY code;
Warnings:
@@ -387,139 +387,139 @@ HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
code a
81F0 â„«
Warnings:
-Warning 1976 Cannot convert 'cp932' character 0x81AD to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81AD to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81AE to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81AE to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81AF to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81AF to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B0 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B0 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B1 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B1 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B2 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B2 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B3 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B3 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B4 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B4 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B5 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B5 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B6 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B6 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B7 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B7 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C0 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C0 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C1 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C1 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C2 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C2 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C3 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C3 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C4 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C4 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C5 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C5 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C6 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C6 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C7 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C7 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81CF to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81CF to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D0 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D0 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D1 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D1 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D2 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D2 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D3 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D3 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D4 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D4 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D5 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D5 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D6 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D6 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D7 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D7 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D8 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D8 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D9 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D9 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81E9 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81E9 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81EA to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81EA to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81AD to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81AD to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81AE to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81AE to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81AF to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81AF to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B0 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B0 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B1 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B1 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B2 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B2 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B3 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B3 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B4 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B4 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B5 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B5 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B6 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B6 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B7 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B7 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C0 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C0 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C1 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C1 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C2 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C2 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C3 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C3 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C4 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C4 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C5 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C5 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C6 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C6 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C7 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C7 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81CF to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81CF to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D0 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D0 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D1 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D1 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D2 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D2 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D3 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D3 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D4 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D4 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D5 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D5 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D6 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D6 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D7 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D7 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D8 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D8 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D9 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D9 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81E9 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81E9 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81EA to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81EA to 'utf8'
SELECT * FROM t1
WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <>
HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
code a
Warnings:
-Warning 1976 Cannot convert 'cp932' character 0x81AD to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81AD to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81AE to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81AE to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81AF to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81AF to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B0 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B0 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B1 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B1 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B2 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B2 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B3 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B3 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B4 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B4 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B5 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B5 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B6 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B6 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B7 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B7 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C0 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C0 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C1 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C1 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C2 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C2 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C3 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C3 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C4 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C4 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C5 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C5 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C6 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C6 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C7 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C7 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81CF to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81CF to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D0 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D0 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D1 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D1 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D2 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D2 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D3 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D3 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D4 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D4 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D5 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D5 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D6 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D6 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D7 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D7 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D8 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D8 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D9 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D9 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81E9 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81E9 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81EA to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81EA to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81AD to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81AD to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81AE to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81AE to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81AF to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81AF to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B0 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B0 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B1 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B1 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B2 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B2 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B3 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B3 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B4 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B4 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B5 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B5 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B6 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B6 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B7 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B7 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C0 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C0 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C1 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C1 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C2 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C2 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C3 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C3 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C4 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C4 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C5 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C5 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C6 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C6 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C7 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C7 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81CF to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81CF to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D0 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D0 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D1 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D1 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D2 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D2 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D3 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D3 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D4 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D4 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D5 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D5 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D6 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D6 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D7 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D7 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D8 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D8 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D9 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D9 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81E9 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81E9 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81EA to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81EA to 'utf8'
#
# WL#3090 Japanese Character Set adjustments
# Test cp932->Unicode conversion
@@ -10195,70 +10195,70 @@ FC49 EFA8AD
FC4A E9B899
FC4B E9BB91
Warnings:
-Warning 1976 Cannot convert 'cp932' character 0x81AD to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81AE to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81AF to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B0 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B1 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B2 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B3 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B4 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B5 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B6 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81B7 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C0 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C1 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C2 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C3 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C4 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C5 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C6 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81C7 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81CF to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D0 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D1 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D2 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D3 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D4 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D5 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D6 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D7 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D8 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81D9 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81E9 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81EA to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81EB to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81EC to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81ED to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81EE to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81EF to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81F8 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81F9 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81FA to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x81FB to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x8240 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x8241 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x8242 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x8243 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x8244 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x8245 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x8246 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x8247 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x8248 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x8249 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x824A to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x824B to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x824C to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x824D to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x824E to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x8259 to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x825A to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x825B to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x825C to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x825D to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x825E to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x825F to 'utf8'
-Warning 1976 Cannot convert 'cp932' character 0x827A to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81AD to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81AE to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81AF to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B0 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B1 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B2 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B3 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B4 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B5 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B6 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81B7 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C0 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C1 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C2 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C3 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C4 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C5 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C6 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81C7 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81CF to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D0 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D1 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D2 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D3 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D4 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D5 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D6 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D7 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D8 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81D9 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81E9 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81EA to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81EB to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81EC to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81ED to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81EE to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81EF to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81F8 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81F9 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81FA to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x81FB to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x8240 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x8241 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x8242 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x8243 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x8244 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x8245 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x8246 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x8247 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x8248 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x8249 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x824A to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x824B to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x824C to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x824D to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x824E to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x8259 to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x825A to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x825B to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x825C to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x825D to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x825E to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x825F to 'utf8'
+Warning 1977 Cannot convert 'cp932' character 0x827A to 'utf8'
DROP TABLE t1;
#
# WL#3090 Japanese Character Set adjustments
@@ -19742,7 +19742,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET cp932 NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET cp932 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET cp932 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -20001,7 +20001,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET cp932 COLLATE cp932_bin NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET cp932 COLLATE cp932_bin NOT 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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET cp932 COLLATE cp932_bin NOT 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 DEFAULT ''
+ `a` varchar(10) CHARACTER SET cp932 NOT 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 DEFAULT ''
+ `a` varchar(10) CHARACTER SET cp932 NOT 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 DEFAULT ''
+ `a` varchar(10) CHARACTER SET cp932 NOT 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 DEFAULT ''
+ `a` varchar(10) CHARACTER SET cp932 NOT 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 DEFAULT ''
+ `a` varbinary(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('à\['),('\à\[');
SELECT HEX(a) FROM t1;
diff --git a/mysql-test/r/ctype_eucjpms.result b/mysql-test/r/ctype_eucjpms.result
index 131e7043e58..f9cb4f1eecc 100644
--- a/mysql-test/r/ctype_eucjpms.result
+++ b/mysql-test/r/ctype_eucjpms.result
@@ -9881,9 +9881,21 @@ 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
@@ -9976,9 +9988,21 @@ 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
@@ -9993,12 +10017,12 @@ select hex(convert(_eucjpms 0xA5FE41 using ucs2));
hex(convert(_eucjpms 0xA5FE41 using ucs2))
003F0041
Warnings:
-Warning 1976 Cannot convert 'eucjpms' character 0xA5FE to 'ucs2'
+Warning 1977 Cannot convert 'eucjpms' character 0xA5FE to 'ucs2'
select hex(convert(_eucjpms 0x8FABF841 using ucs2));
hex(convert(_eucjpms 0x8FABF841 using ucs2))
003F0041
Warnings:
-Warning 1976 Cannot convert 'eucjpms' character 0x8FABF8 to 'ucs2'
+Warning 1977 Cannot convert 'eucjpms' character 0x8FABF8 to 'ucs2'
set global LC_TIME_NAMES=convert((convert((0x63) using eucjpms)) using utf8);
ERROR HY000: Unknown locale: 'c'
#
@@ -10018,21 +10042,27 @@ 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
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)
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)
FROM head, tail
WHERE (head BETWEEN '80' AND 'FF') AND (tail BETWEEN '20' AND 'FF')
ORDER BY head, tail;
+Warnings:
+Warning 1364 Field 'a' doesn't have a default value
DROP TEMPORARY TABLE head, tail;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `code` varchar(6) CHARACTER SET eucjpms NOT NULL DEFAULT '',
- `a` varchar(1) CHARACTER SET eucjpms NOT NULL DEFAULT ''
+ `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;
Warnings:
@@ -10559,70 +10589,70 @@ HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
code a
8FAABC Ģ
Warnings:
-Warning 1976 Cannot convert 'eucjpms' character 0xA2AF to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2AF to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B0 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B0 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B1 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B1 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B2 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B2 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B3 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B3 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B4 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B4 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B5 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B5 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B6 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B6 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B7 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B7 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B8 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B8 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B9 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B9 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C2 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C2 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C3 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C3 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C4 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C4 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C5 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C5 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C6 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C6 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C7 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C7 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C8 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C8 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C9 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C9 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D1 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D1 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D2 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D2 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D3 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D3 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D4 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D4 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D5 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D5 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D6 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D6 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D7 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D7 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D8 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D8 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D9 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D9 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2DA to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2DA to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2DB to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2DB to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2EB to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2EB to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2EC to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2EC to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2AF to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2AF to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B0 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B0 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B1 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B1 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B2 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B2 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B3 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B3 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B4 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B4 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B5 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B5 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B6 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B6 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B7 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B7 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B8 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B8 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B9 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B9 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C2 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C2 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C3 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C3 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C4 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C4 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C5 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C5 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C6 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C6 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C7 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C7 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C8 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C8 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C9 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C9 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D1 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D1 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D2 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D2 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D3 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D3 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D4 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D4 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D5 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D5 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D6 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D6 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D7 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D7 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D8 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D8 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D9 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D9 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2DA to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2DA to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2DB to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2DB to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2EB to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2EB to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2EC to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2EC to 'utf8'
SELECT * FROM t1
WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <>
HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
@@ -10630,70 +10660,70 @@ code a
8FA9C3 ð
8FABB9 ǵ
Warnings:
-Warning 1976 Cannot convert 'eucjpms' character 0xA2AF to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2AF to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B0 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B0 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B1 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B1 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B2 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B2 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B3 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B3 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B4 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B4 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B5 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B5 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B6 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B6 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B7 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B7 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B8 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B8 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B9 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B9 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C2 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C2 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C3 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C3 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C4 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C4 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C5 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C5 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C6 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C6 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C7 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C7 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C8 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C8 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C9 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C9 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D1 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D1 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D2 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D2 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D3 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D3 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D4 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D4 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D5 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D5 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D6 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D6 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D7 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D7 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D8 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D8 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D9 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D9 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2DA to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2DA to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2DB to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2DB to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2EB to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2EB to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2EC to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2EC to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2AF to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2AF to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B0 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B0 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B1 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B1 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B2 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B2 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B3 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B3 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B4 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B4 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B5 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B5 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B6 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B6 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B7 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B7 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B8 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B8 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B9 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B9 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C2 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C2 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C3 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C3 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C4 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C4 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C5 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C5 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C6 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C6 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C7 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C7 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C8 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C8 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C9 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C9 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D1 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D1 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D2 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D2 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D3 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D3 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D4 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D4 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D5 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D5 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D6 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D6 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D7 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D7 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D8 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D8 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D9 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D9 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2DA to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2DA to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2DB to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2DB to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2EB to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2EB to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2EC to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2EC to 'utf8'
#
# WL#3090 Japanese Character Set adjustments
# Test sjis->Unicode conversion
@@ -25780,70 +25810,70 @@ FEFC EE8EA9
FEFD EE8EAA
FEFE EE8EAB
Warnings:
-Warning 1976 Cannot convert 'eucjpms' character 0xA2AF to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B0 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B1 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B2 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B3 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B4 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B5 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B6 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B7 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B8 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2B9 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C2 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C3 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C4 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C5 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C6 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C7 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C8 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2C9 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D1 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D2 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D3 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D4 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D5 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D6 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D7 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D8 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2D9 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2DA to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2DB to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2EB to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2EC to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2ED to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2EE to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2EF to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2F0 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2F1 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2FA to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2FB to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2FC to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA2FD to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA3A1 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA3A2 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA3A3 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA3A4 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA3A5 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA3A6 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA3A7 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA3A8 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA3A9 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA3AA to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA3AB to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA3AC to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA3AD to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA3AE to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA3AF to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA3BA to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA3BB to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA3BC to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA3BD to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA3BE to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA3BF to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA3C0 to 'utf8'
-Warning 1976 Cannot convert 'eucjpms' character 0xA3DB to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2AF to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B0 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B1 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B2 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B3 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B4 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B5 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B6 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B7 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B8 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2B9 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C2 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C3 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C4 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C5 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C6 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C7 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C8 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2C9 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D1 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D2 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D3 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D4 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D5 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D6 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D7 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D8 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2D9 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2DA to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2DB to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2EB to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2EC to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2ED to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2EE to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2EF to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2F0 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2F1 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2FA to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2FB to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2FC to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA2FD to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA3A1 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA3A2 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA3A3 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA3A4 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA3A5 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA3A6 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA3A7 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA3A8 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA3A9 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA3AA to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA3AB to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA3AC to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA3AD to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA3AE to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA3AF to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA3BA to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA3BB to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA3BC to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA3BD to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA3BE to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA3BF to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA3C0 to 'utf8'
+Warning 1977 Cannot convert 'eucjpms' character 0xA3DB to 'utf8'
DROP TABLE t1;
#
# WL#3090 Japanese Character Set adjustments
@@ -32963,7 +32993,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET eucjpms NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET eucjpms NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -32983,7 +33013,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET eucjpms NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -33396,7 +33426,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET eucjpms COLLATE eucjpms_bin NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET eucjpms COLLATE eucjpms_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -33416,7 +33446,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET eucjpms COLLATE eucjpms_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -33841,3 +33871,45 @@ ERROR HY000: Invalid eucjpms character string: '8EA0'
#
# End of 10.0 tests
#
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8215 Asian MB3 charsets: compare broken bytes as "greater than any non-broken character"
+#
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET eucjpms, KEY(a));
+INSERT INTO t1 VALUES ('a'),(0x7F);
+INSERT INTO t1 VALUES (0x8EA1),(0x8EDF);
+INSERT INTO t1 VALUES (0x8FA1A1),(0x8FFEFE);
+INSERT INTO t1 VALUES (0xA1A1),(0xDEDE),(0xDFDF),(0xE0E0),(0xFEFE);
+SELECT HEX(a) FROM t1 ORDER BY a;
+HEX(a)
+61
+7F
+8EA1
+8EDF
+8FA1A1
+8FFEFE
+A1A1
+DEDE
+DFDF
+E0E0
+FEFE
+ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET eucjpms COLLATE eucjpms_bin;
+SELECT HEX(a) FROM t1 ORDER BY a;
+HEX(a)
+61
+7F
+8EA1
+8EDF
+8FA1A1
+8FFEFE
+A1A1
+DEDE
+DFDF
+E0E0
+FEFE
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/ctype_euckr.result b/mysql-test/r/ctype_euckr.result
index fec3c937ec4..90353c6af2a 100644
--- a/mysql-test/r/ctype_euckr.result
+++ b/mysql-test/r/ctype_euckr.result
@@ -224,9 +224,21 @@ 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
@@ -359,9 +371,21 @@ 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
@@ -24424,7 +24448,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`code` varchar(8) DEFAULT NULL,
- `a` varchar(1) CHARACTER SET euckr NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET euckr NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
UPDATE t1 SET a=unhex(code) ORDER BY code;
Warnings:
@@ -24713,70 +24737,70 @@ HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
code a
A1CA â„«
Warnings:
-Warning 1976 Cannot convert 'euckr' character 0xA2E8 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2E8 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2E9 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2E9 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2EA to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2EA to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2EB to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2EB to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2EC to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2EC to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2ED to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2ED to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2EE to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2EE to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2EF to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2EF to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F0 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F0 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F1 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F1 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F2 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F2 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F3 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F3 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F4 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F4 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F5 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F5 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F6 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F6 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F7 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F7 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F8 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F8 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F9 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F9 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2FA to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2FA to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2FB to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2FB to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2FC to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2FC to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2FD to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2FD to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2FE to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2FE to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5AB to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5AB to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5AC to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5AC to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5AD to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5AD to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5AE to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5AE to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5AF to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5AF to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5BA to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5BA to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5BB to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5BB to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5BC to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5BC to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5BD to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5BD to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2E8 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2E8 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2E9 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2E9 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2EA to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2EA to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2EB to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2EB to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2EC to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2EC to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2ED to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2ED to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2EE to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2EE to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2EF to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2EF to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F0 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F0 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F1 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F1 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F2 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F2 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F3 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F3 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F4 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F4 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F5 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F5 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F6 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F6 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F7 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F7 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F8 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F8 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F9 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F9 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2FA to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2FA to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2FB to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2FB to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2FC to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2FC to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2FD to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2FD to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2FE to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2FE to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5AB to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5AB to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5AC to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5AC to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5AD to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5AD to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5AE to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5AE to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5AF to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5AF to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5BA to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5BA to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5BB to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5BB to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5BC to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5BC to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5BD to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5BD to 'utf8'
SELECT * FROM t1
WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <>
HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
@@ -24809,70 +24833,70 @@ A8E5 ⓨ
A8E6 â“©
A9A2 Ä‘
Warnings:
-Warning 1976 Cannot convert 'euckr' character 0xA2E8 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2E8 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2E9 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2E9 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2EA to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2EA to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2EB to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2EB to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2EC to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2EC to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2ED to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2ED to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2EE to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2EE to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2EF to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2EF to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F0 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F0 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F1 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F1 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F2 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F2 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F3 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F3 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F4 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F4 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F5 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F5 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F6 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F6 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F7 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F7 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F8 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F8 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F9 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2F9 to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2FA to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2FA to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2FB to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2FB to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2FC to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2FC to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2FD to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2FD to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2FE to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA2FE to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5AB to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5AB to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5AC to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5AC to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5AD to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5AD to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5AE to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5AE to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5AF to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5AF to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5BA to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5BA to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5BB to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5BB to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5BC to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5BC to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5BD to 'utf8'
-Warning 1976 Cannot convert 'euckr' character 0xA5BD to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2E8 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2E8 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2E9 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2E9 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2EA to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2EA to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2EB to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2EB to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2EC to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2EC to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2ED to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2ED to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2EE to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2EE to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2EF to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2EF to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F0 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F0 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F1 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F1 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F2 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F2 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F3 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F3 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F4 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F4 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F5 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F5 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F6 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F6 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F7 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F7 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F8 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F8 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F9 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2F9 to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2FA to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2FA to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2FB to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2FB to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2FC to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2FC to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2FD to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2FD to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2FE to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA2FE to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5AB to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5AB to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5AC to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5AC to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5AD to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5AD to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5AE to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5AE to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5AF to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5AF to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5BA to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5BA to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5BB to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5BB to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5BC to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5BC to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5BD to 'utf8'
+Warning 1977 Cannot convert 'euckr' character 0xA5BD to 'utf8'
DROP TABLE t1;
#
# End of 5.5 tests
@@ -24891,7 +24915,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET euckr NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET euckr NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -24911,7 +24935,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET euckr NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -25150,7 +25174,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET euckr COLLATE euckr_bin NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET euckr COLLATE euckr_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -25170,7 +25194,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET euckr COLLATE euckr_bin NOT 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_gb2312.result b/mysql-test/r/ctype_gb2312.result
index a91d0d7d73e..f9f37c00a79 100644
--- a/mysql-test/r/ctype_gb2312.result
+++ b/mysql-test/r/ctype_gb2312.result
@@ -224,9 +224,21 @@ 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
@@ -440,9 +452,21 @@ 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
@@ -485,7 +509,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`code` varchar(8) DEFAULT NULL,
- `a` varchar(1) CHARACTER SET gb2312 NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET gb2312 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
UPDATE t1 SET a=unhex(code) ORDER BY code;
Warnings:
@@ -741,70 +765,70 @@ A2FA â…©
A2FB â…ª
A2FC â…«
Warnings:
-Warning 1976 Cannot convert 'gb2312' character 0xA2A1 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A1 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A2 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A2 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A3 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A3 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A4 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A4 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A5 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A5 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A6 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A6 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A7 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A7 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A8 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A8 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A9 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A9 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AA to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AA to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AB to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AB to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AC to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AC to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AD to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AD to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AE to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AE to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AF to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AF to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2B0 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2B0 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2E3 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2E3 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2E4 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2E4 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2EF to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2EF to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2F0 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2F0 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2FD to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2FD to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2FE to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2FE to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F4 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F4 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F5 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F5 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F6 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F6 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F7 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F7 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F8 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F8 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F9 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F9 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4FA to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4FA to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4FB to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4FB to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4FC to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4FC to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4FD to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4FD to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A1 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A1 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A2 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A2 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A3 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A3 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A4 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A4 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A5 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A5 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A6 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A6 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A7 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A7 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A8 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A8 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A9 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A9 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AA to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AA to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AB to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AB to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AC to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AC to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AD to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AD to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AE to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AE to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AF to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AF to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2B0 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2B0 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2E3 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2E3 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2E4 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2E4 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2EF to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2EF to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2F0 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2F0 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2FD to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2FD to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2FE to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2FE to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F4 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F4 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F5 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F5 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F6 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F6 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F7 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F7 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F8 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F8 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F9 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F9 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4FA to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4FA to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4FB to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4FB to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4FC to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4FC to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4FD to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4FD to 'utf8'
SELECT * FROM t1
WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <>
HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
@@ -836,70 +860,70 @@ A8B8 ǜ
A8B9 ü
A8BA ê
Warnings:
-Warning 1976 Cannot convert 'gb2312' character 0xA2A1 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A1 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A2 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A2 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A3 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A3 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A4 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A4 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A5 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A5 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A6 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A6 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A7 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A7 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A8 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A8 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A9 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2A9 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AA to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AA to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AB to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AB to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AC to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AC to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AD to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AD to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AE to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AE to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AF to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2AF to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2B0 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2B0 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2E3 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2E3 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2E4 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2E4 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2EF to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2EF to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2F0 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2F0 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2FD to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2FD to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2FE to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA2FE to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F4 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F4 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F5 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F5 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F6 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F6 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F7 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F7 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F8 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F8 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F9 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4F9 to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4FA to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4FA to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4FB to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4FB to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4FC to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4FC to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4FD to 'utf8'
-Warning 1976 Cannot convert 'gb2312' character 0xA4FD to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A1 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A1 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A2 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A2 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A3 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A3 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A4 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A4 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A5 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A5 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A6 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A6 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A7 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A7 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A8 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A8 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A9 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2A9 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AA to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AA to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AB to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AB to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AC to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AC to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AD to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AD to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AE to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AE to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AF to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2AF to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2B0 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2B0 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2E3 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2E3 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2E4 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2E4 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2EF to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2EF to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2F0 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2F0 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2FD to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2FD to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2FE to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA2FE to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F4 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F4 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F5 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F5 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F6 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F6 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F7 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F7 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F8 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F8 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F9 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4F9 to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4FA to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4FA to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4FB to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4FB to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4FC to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4FC to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4FD to 'utf8'
+Warning 1977 Cannot convert 'gb2312' character 0xA4FD to 'utf8'
DROP TABLE t1;
#
# End of 5.5 tests
@@ -918,7 +942,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET gb2312 NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET gb2312 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -938,7 +962,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET gb2312 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -1177,7 +1201,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET gb2312 COLLATE gb2312_bin NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET gb2312 COLLATE gb2312_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -1197,7 +1221,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET gb2312 COLLATE gb2312_bin NOT 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_gbk.result b/mysql-test/r/ctype_gbk.result
index 3defbf1e035..b5774548d85 100644
--- a/mysql-test/r/ctype_gbk.result
+++ b/mysql-test/r/ctype_gbk.result
@@ -224,9 +224,21 @@ 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
@@ -440,9 +452,21 @@ 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
@@ -465,7 +489,7 @@ select hex(convert(_gbk 0xA14041 using ucs2));
hex(convert(_gbk 0xA14041 using ucs2))
003F0041
Warnings:
-Warning 1976 Cannot convert 'gbk' character 0xA140 to 'ucs2'
+Warning 1977 Cannot convert 'gbk' character 0xA140 to 'ucs2'
create table t1 (c1 text not null, c2 text not null) character set gbk;
alter table t1 change c1 c1 mediumtext character set gbk not null;
show create table t1;
@@ -507,7 +531,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`code` varchar(8) DEFAULT NULL,
- `a` varchar(1) CHARACTER SET gbk NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET gbk NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
UPDATE t1 SET a=unhex(code) ORDER BY code;
Warnings:
@@ -773,70 +797,70 @@ code a
A2FB â…ª
A2FC â…«
Warnings:
-Warning 1976 Cannot convert 'gbk' character 0xA140 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA140 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA141 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA141 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA142 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA142 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA143 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA143 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA144 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA144 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA145 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA145 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA146 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA146 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA147 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA147 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA148 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA148 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA149 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA149 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14A to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14A to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14B to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14B to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14C to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14C to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14D to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14D to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14E to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14E to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14F to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14F to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA150 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA150 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA151 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA151 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA152 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA152 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA153 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA153 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA154 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA154 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA155 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA155 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA156 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA156 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA157 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA157 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA158 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA158 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA159 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA159 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15A to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15A to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15B to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15B to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15C to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15C to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15D to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15D to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15E to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15E to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15F to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15F to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA140 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA140 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA141 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA141 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA142 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA142 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA143 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA143 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA144 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA144 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA145 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA145 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA146 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA146 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA147 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA147 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA148 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA148 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA149 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA149 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14A to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14A to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14B to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14B to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14C to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14C to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14D to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14D to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14E to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14E to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14F to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14F to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA150 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA150 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA151 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA151 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA152 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA152 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA153 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA153 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA154 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA154 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA155 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA155 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA156 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA156 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA157 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA157 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA158 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA158 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA159 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA159 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15A to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15A to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15B to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15B to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15C to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15C to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15D to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15D to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15E to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15E to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15F to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15F to 'utf8'
SELECT * FROM t1
WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <>
HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
@@ -870,70 +894,70 @@ A8BA ê
A8BD Å„
A8BE ň
Warnings:
-Warning 1976 Cannot convert 'gbk' character 0xA140 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA140 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA141 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA141 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA142 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA142 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA143 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA143 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA144 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA144 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA145 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA145 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA146 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA146 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA147 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA147 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA148 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA148 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA149 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA149 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14A to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14A to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14B to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14B to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14C to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14C to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14D to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14D to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14E to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14E to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14F to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA14F to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA150 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA150 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA151 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA151 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA152 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA152 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA153 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA153 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA154 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA154 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA155 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA155 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA156 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA156 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA157 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA157 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA158 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA158 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA159 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA159 to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15A to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15A to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15B to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15B to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15C to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15C to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15D to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15D to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15E to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15E to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15F to 'utf8'
-Warning 1976 Cannot convert 'gbk' character 0xA15F to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA140 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA140 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA141 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA141 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA142 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA142 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA143 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA143 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA144 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA144 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA145 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA145 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA146 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA146 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA147 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA147 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA148 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA148 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA149 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA149 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14A to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14A to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14B to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14B to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14C to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14C to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14D to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14D to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14E to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14E to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14F to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA14F to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA150 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA150 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA151 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA151 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA152 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA152 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA153 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA153 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA154 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA154 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA155 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA155 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA156 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA156 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA157 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA157 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA158 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA158 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA159 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA159 to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15A to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15A to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15B to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15B to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15C to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15C to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15D to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15D to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15E to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15E to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15F to 'utf8'
+Warning 1977 Cannot convert 'gbk' character 0xA15F to 'utf8'
DROP TABLE t1;
#
# End of 5.5 tests
@@ -952,7 +976,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET gbk NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET gbk NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -972,7 +996,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET gbk NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -1385,7 +1409,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET gbk COLLATE gbk_bin NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET gbk COLLATE gbk_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -1405,7 +1429,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET gbk COLLATE gbk_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -4922,7 +4946,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 DEFAULT ''
+ `a` varchar(10) CHARACTER SET gbk NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('à\'),('à\t');
INSERT INTO t1 VALUES ('\\à\'),('\\à\t'),('\\à\t\t');
@@ -4961,7 +4985,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 DEFAULT ''
+ `a` varchar(10) CHARACTER SET gbk NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (BINARY('à\')),(BINARY('à\t'));
INSERT INTO t1 VALUES (BINARY('\\à\')),(BINARY('\\à\t')),(BINARY('\\à\t\t'));
@@ -5000,7 +5024,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 DEFAULT ''
+ `a` varchar(10) CHARACTER SET gbk NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_BINARY'à\'),(_BINARY'à\t');
INSERT INTO t1 VALUES (_BINARY'\\à\'),(_BINARY'\\à\t'),(_BINARY'\\à\t\t');
@@ -5046,7 +5070,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 DEFAULT ''
+ `a` varchar(10) CHARACTER SET gbk NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('à\['),('\à\[');
SELECT HEX(a) FROM t1;
@@ -5066,7 +5090,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 DEFAULT ''
+ `a` varbinary(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('à\['),('\à\[');
SELECT HEX(a) FROM t1;
diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result
index 339e2e0787d..2d2b3473d57 100644
--- a/mysql-test/r/ctype_latin1.result
+++ b/mysql-test/r/ctype_latin1.result
@@ -518,8 +518,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
-pattern varchar(64) NO
+subject varchar(64) NO NULL
+pattern varchar(64) NO 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)
@@ -689,7 +689,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -702,7 +702,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 DEFAULT ''
+ `c1` varchar(20) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -715,7 +715,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 DEFAULT ''
+ `c1` varchar(4) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -728,7 +728,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 DEFAULT ''
+ `c1` varchar(3) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1-2));
@@ -738,7 +738,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 DEFAULT ''
+ `c1` varchar(3) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1*2));
@@ -748,7 +748,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 DEFAULT ''
+ `c1` varchar(3) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1/2));
@@ -788,7 +788,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 DEFAULT ''
+ `c1` varchar(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(-(1+2)));
@@ -798,7 +798,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 DEFAULT ''
+ `c1` varchar(4) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1|2));
@@ -808,7 +808,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 DEFAULT ''
+ `c1` varchar(21) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1&2));
@@ -818,7 +818,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 DEFAULT ''
+ `c1` varchar(21) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(bit_count(12)));
@@ -828,7 +828,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 DEFAULT ''
+ `c1` varchar(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(2<<1));
@@ -838,7 +838,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 DEFAULT ''
+ `c1` varchar(21) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(2>>1));
@@ -848,7 +848,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 DEFAULT ''
+ `c1` varchar(21) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(~0));
@@ -858,7 +858,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 DEFAULT ''
+ `c1` varchar(21) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(3^2));
@@ -868,7 +868,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 DEFAULT ''
+ `c1` varchar(21) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(abs(-2)));
@@ -878,7 +878,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 DEFAULT ''
+ `c1` varchar(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(left(concat(exp(2)),1));
@@ -1008,7 +1008,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 DEFAULT ''
+ `c1` varchar(23) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(radians(0)));
@@ -1018,7 +1018,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 DEFAULT ''
+ `c1` varchar(23) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ceiling(0.5)));
@@ -1028,7 +1028,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 DEFAULT ''
+ `c1` varchar(4) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(floor(0.5)));
@@ -1038,7 +1038,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 DEFAULT ''
+ `c1` varchar(4) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(round(0.5)));
@@ -1048,7 +1048,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 DEFAULT ''
+ `c1` varchar(3) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sign(0.5)));
@@ -1058,14 +1058,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 DEFAULT ''
+ `c1` varchar(21) NOT 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 DEFAULT ''
+ `c1` varchar(23) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(length('a')));
@@ -1075,7 +1075,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 DEFAULT ''
+ `c1` varchar(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(char_length('a')));
@@ -1085,7 +1085,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 DEFAULT ''
+ `c1` varchar(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(bit_length('a')));
@@ -1095,7 +1095,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 DEFAULT ''
+ `c1` varchar(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(coercibility('a')));
@@ -1105,7 +1105,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 DEFAULT ''
+ `c1` varchar(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(locate('a','a')));
@@ -1115,7 +1115,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 DEFAULT ''
+ `c1` varchar(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(field('c','a','b','c')));
@@ -1125,7 +1125,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 DEFAULT ''
+ `c1` varchar(3) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ascii(61)));
@@ -1135,7 +1135,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 DEFAULT ''
+ `c1` varchar(3) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ord(61)));
@@ -1145,7 +1145,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 DEFAULT ''
+ `c1` varchar(21) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(find_in_set('b','a,b,c,d')));
@@ -1155,7 +1155,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 DEFAULT ''
+ `c1` varchar(3) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select md5('a'), hex(md5('a'));
@@ -1165,7 +1165,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 DEFAULT ''
+ `c1` varchar(32) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select old_password('a'), hex(old_password('a'));
@@ -1175,7 +1175,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 DEFAULT ''
+ `c1` varchar(16) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select password('a'), hex(password('a'));
@@ -1185,7 +1185,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 DEFAULT ''
+ `c1` varchar(41) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select sha('a'), hex(sha('a'));
@@ -1195,7 +1195,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 DEFAULT ''
+ `c1` varchar(40) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select sha1('a'), hex(sha1('a'));
@@ -1205,7 +1205,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 DEFAULT ''
+ `c1` varchar(40) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast('-1' as signed)));
@@ -1215,7 +1215,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 DEFAULT ''
+ `c1` varchar(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast('1' as unsigned)));
@@ -1225,7 +1225,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast(1/2 as decimal(5,5))));
@@ -1284,7 +1284,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 DEFAULT ''
+ `c1` varchar(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(greatest(1,2)));
@@ -1294,7 +1294,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 DEFAULT ''
+ `c1` varchar(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(case when 11 then 22 else 33 end));
@@ -1304,7 +1304,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 DEFAULT ''
+ `c1` varchar(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(coalesce(1,2)));
@@ -1314,7 +1314,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat_ws(1,2,3));
@@ -1324,7 +1324,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 DEFAULT ''
+ `c1` varchar(3) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(group_concat(1,2,3));
@@ -1352,7 +1352,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 DEFAULT ''
+ `c1` varchar(21) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(benchmark(0,0)));
@@ -1362,7 +1362,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sleep(0)));
@@ -1372,7 +1372,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 DEFAULT ''
+ `c1` varchar(21) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(is_free_lock('xxxx')));
@@ -1406,7 +1406,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 DEFAULT ''
+ `c1` varchar(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(uncompressed_length('')));
@@ -1423,7 +1423,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 DEFAULT ''
+ `c1` varchar(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(inet_aton('127.1.1.1')));
@@ -1459,7 +1459,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 DEFAULT ''
+ `c1` varchar(21) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(found_rows()));
@@ -1469,21 +1469,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 DEFAULT ''
+ `c1` varchar(21) NOT 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 DEFAULT ''
+ `c1` varchar(21) NOT 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 DEFAULT ''
+ `c1` varchar(36) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select coercibility(uuid()), coercibility(cast('a' as char character set latin1));
@@ -1496,7 +1496,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 DEFAULT ''
+ `c1` varchar(37) NOT 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,8 +1516,8 @@ hex(c1)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL DEFAULT '',
- `c2` int(1) NOT NULL DEFAULT '0'
+ `c1` varchar(1) NOT NULL,
+ `c2` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @a2=1;
@@ -1574,8 +1574,8 @@ hex(c1)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) NOT NULL DEFAULT '',
- `c2` decimal(2,1) NOT NULL DEFAULT '0.0'
+ `c1` varchar(4) NOT NULL,
+ `c2` decimal(2,1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @a2=1.1;
@@ -1613,7 +1613,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a'='a' IS NOT TRUE));
@@ -1623,7 +1623,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(NOT 'a'='a'));
@@ -1633,7 +1633,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' IS NULL));
@@ -1643,7 +1643,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' IS NOT NULL));
@@ -1653,7 +1653,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' rlike 'a'));
@@ -1663,7 +1663,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(strcmp('a','b')));
@@ -1673,7 +1673,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 DEFAULT ''
+ `c1` varchar(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' like 'a'));
@@ -1683,7 +1683,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' between 'b' and 'c'));
@@ -1693,7 +1693,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' in ('a','b')));
@@ -1703,7 +1703,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(interval(23, 1, 15, 17, 30, 44, 200)));
@@ -1713,7 +1713,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 DEFAULT ''
+ `c1` varchar(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a varchar(10), fulltext key(a));
@@ -1735,7 +1735,7 @@ create table t1 as select ifnull(1,'a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ifnull(1,1)));
@@ -1745,7 +1745,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ifnull(1.1,1.1)));
@@ -1755,7 +1755,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 DEFAULT ''
+ `c1` varchar(4) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(if(1,'b',1));
@@ -1765,7 +1765,7 @@ create table t1 as select if(1,'b',1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(if(1,1,'b'));
@@ -1775,7 +1775,7 @@ create table t1 as select if(1,1,'b') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(if(1,1,1)));
@@ -1785,7 +1785,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(nullif(1,2)));
@@ -1865,7 +1865,7 @@ create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) DEFAULT NULL
+ `c1` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))));
@@ -1875,7 +1875,7 @@ create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) DEFAULT NULL
+ `c1` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))));
@@ -1950,7 +1950,7 @@ 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 DEFAULT ''
+ `c1` varchar(6) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(period_diff(200902, 200802)));
@@ -1962,7 +1962,7 @@ Warning 1265 Data truncated for column 'c1' at row 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(6) NOT NULL DEFAULT ''
+ `c1` varchar(6) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(to_days(20090224)));
@@ -2159,21 +2159,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 DEFAULT ''
+ `c1` varchar(10) NOT 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 DEFAULT ''
+ `c1` varchar(10) NOT 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 DEFAULT ''
+ `c1` varchar(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select repeat('a',20) as c1 limit 0;
@@ -2189,7 +2189,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 DEFAULT ''
+ `c1` varchar(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sec_to_time(2378)));
@@ -2282,21 +2282,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 DEFAULT ''
+ `c1` varchar(19) NOT 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 DEFAULT ''
+ `c1` varchar(19) NOT 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 DEFAULT ''
+ `c1` varchar(19) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(addtime('00:00:00','11:22:33')));
@@ -2336,7 +2336,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 DEFAULT ''
+ `c1` varchar(127) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(insert(1133,3,0,22));
@@ -2346,7 +2346,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 DEFAULT ''
+ `c1` varchar(6) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lcase(123));
@@ -2356,7 +2356,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 DEFAULT ''
+ `c1` varchar(3) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(left(123,1));
@@ -2366,7 +2366,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lower(123));
@@ -2376,7 +2376,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 DEFAULT ''
+ `c1` varchar(3) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lpad(1,2,0));
@@ -2386,7 +2386,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 DEFAULT ''
+ `c1` varchar(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(ltrim(1));
@@ -2396,7 +2396,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(mid(1,1,1));
@@ -2406,7 +2406,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(repeat(1,2));
@@ -2416,7 +2416,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 DEFAULT ''
+ `c1` varchar(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(replace(1,1,2));
@@ -2426,7 +2426,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(reverse(12));
@@ -2436,7 +2436,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 DEFAULT ''
+ `c1` varchar(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(right(123,1));
@@ -2446,7 +2446,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(rpad(1,2,0));
@@ -2456,7 +2456,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 DEFAULT ''
+ `c1` varchar(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(rtrim(1));
@@ -2466,7 +2466,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(soundex(1));
@@ -2476,7 +2476,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 DEFAULT ''
+ `c1` varchar(4) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(substring(1,1,1));
@@ -2486,7 +2486,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(trim(1));
@@ -2496,7 +2496,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(ucase(1));
@@ -2506,7 +2506,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 DEFAULT ''
+ `c1` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(upper(1));
@@ -2516,14 +2516,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 DEFAULT ''
+ `c1` varchar(1) NOT 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 DEFAULT ''
+ `a` varchar(64) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ("1.1"), ("2.1");
select a, hex(a) from t1;
@@ -2773,7 +2773,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 DEFAULT ''
+ `concat(a)` varchar(19) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1 (a date);
@@ -3313,7 +3313,7 @@ SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`CONCAT(a)` varchar(9) DEFAULT NULL,
- `IFNULL(a,'')` varchar(9) NOT NULL DEFAULT '',
+ `IFNULL(a,'')` varchar(9) NOT NULL,
`IF(a,a,'')` varchar(9) DEFAULT NULL,
`CASE WHEN a THEN a ELSE '' END` varchar(9) DEFAULT NULL,
`COALESCE(a,'')` varchar(9) DEFAULT NULL
@@ -3323,14 +3323,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 DEFAULT ''
+ `CONCAT_WS(1,2,3)` varchar(3) NOT 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 DEFAULT ''
+ `INSERT(1133,3,0,22)` varchar(6) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT LCASE(a) FROM t1;
@@ -3351,35 +3351,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 DEFAULT ''
+ `REPEAT(1,2)` varchar(2) NOT 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 DEFAULT ''
+ `LEFT(123,2)` varchar(2) NOT 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 DEFAULT ''
+ `RIGHT(123,2)` varchar(2) NOT 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 DEFAULT ''
+ `LTRIM(123)` varchar(3) NOT 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 DEFAULT ''
+ `RTRIM(123)` varchar(3) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1;
@@ -3393,35 +3393,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 DEFAULT ''
+ `REPLACE(111,2,3)` varchar(3) NOT 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 DEFAULT ''
+ `SUBSTRING_INDEX(111,111,1)` varchar(3) NOT 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 DEFAULT ''
+ `MAKE_SET(111,222,3)` varchar(5) NOT 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 DEFAULT ''
+ `SOUNDEX(1)` varchar(4) NOT 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 DEFAULT ''
+ `EXPORT_SET(1,'Y','N','',8)` varchar(64) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
DROP TABLE t1;
@@ -3620,7 +3620,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) NOT NULL DEFAULT ''
+ `a` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -3640,7 +3640,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 DEFAULT ''
+ `a` varchar(5) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -3864,7 +3864,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -3884,7 +3884,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -4108,7 +4108,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -4128,7 +4128,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -4352,7 +4352,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varbinary(1) NOT NULL DEFAULT ''
+ `a` varbinary(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -4372,7 +4372,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 DEFAULT ''
+ `a` varbinary(5) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -7667,7 +7667,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 DEFAULT ''
+ `c1` varchar(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE CONCAT(c1)='a';
@@ -7690,7 +7690,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 DEFAULT ''
+ `c1` varchar(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
@@ -7713,7 +7713,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 DEFAULT ''
+ `c1` varchar(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '% '=CONCAT(c1);
@@ -7736,7 +7736,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 DEFAULT ''
+ `c1` varchar(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '%'=CONCAT(c1);
@@ -7755,6 +7755,31 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
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'
+#
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
+a LENGTH(a)
+a 1
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
+a LENGTH(a)
+a 1
+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 '))))
+DROP TABLE t1;
+#
+# End of MDEV-8694
+#
SET NAMES latin1 COLLATE latin1_bin;
#
# MDEV-7149 Constant condition propagation erroneously applied for LIKE
@@ -7763,7 +7788,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE CONCAT(c1)='a';
@@ -7786,7 +7811,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
@@ -7809,7 +7834,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '% '=CONCAT(c1);
@@ -7832,7 +7857,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '%'=CONCAT(c1);
@@ -7852,6 +7877,31 @@ Warnings:
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'
+#
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
+a LENGTH(a)
+a 1
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
+a LENGTH(a)
+a 1
+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 '))))
+DROP TABLE t1;
+#
+# End of MDEV-8694
+#
+#
# MDEV-6752 Trailing incomplete characters are not replaced to question marks on conversion
#
SET NAMES utf8, character_set_connection=latin1;
@@ -7915,3 +7965,208 @@ _latin1 0x7E _latin1 X'7E' _latin1 B'01111110'
#
# End of 10.0 tests
#
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8661 Wrong result for SELECT..WHERE a='a' AND a='a' COLLATE latin1_bin
+#
+SET NAMES latin1;
+CREATE TABLE t1 (a CHAR(10));
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT * FROM t1 WHERE a='a' AND a='a' COLLATE latin1_bin;
+a
+a
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci);
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT * FROM t1 WHERE a='a' COLLATE latin1_bin AND a='A' COLLATE latin1_swedish_ci;
+a
+a
+DROP TABLE t1;
+#
+# MDEV-8679 Equal field propagation is not used for VARCHAR when it safely could
+#
+CREATE TABLE t1 (a VARCHAR(10));
+INSERT INTO t1 VALUES ('10'),('11'),('12');
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='10' AND IF(a='10',1,0)=1;
+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')
+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')
+DROP TABLE t1;
+#
+# MDEV-8680 Wrong result for SELECT..WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a'
+#
+SET NAMES latin1;
+CREATE TABLE t1 (a VARCHAR(10));
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b');
+a
+a
+SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a';
+a
+a
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b') 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 (`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;
+#
+SET NAMES latin1;
+CREATE TABLE t1 (a VARCHAR(10));
+INSERT INTO t1 VALUES ('a'),('A'),('b'),('B'),('c'),('C');
+SELECT * FROM t1 WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin;
+a
+a
+b
+c
+SELECT * FROM t1 WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin AND a='a';
+a
+a
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin 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 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))))
+DROP TABLE t1;
+#
+# MDEV-8707 Wrong result for SELECT..WHERE varchar_column=DATE'2001-01-01' AND varchar_column='2001-01-01'
+#
+SET NAMES latin1;
+CREATE TABLE t1 (a VARCHAR(40));
+INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-01x');
+SELECT * FROM t1 WHERE a=DATE'2001-01-01' AND a='2001-01-01';
+a
+2001-01-01
+SELECT * FROM t1 WHERE a='2001-01-01' AND a=DATE'2001-01-01';
+a
+2001-01-01
+SELECT * FROM t1 WHERE (a,a)=('2001-01-01x',DATE'2001-01-01');
+a
+2001-01-01x
+Warnings:
+Warning 1292 Truncated incorrect date value: '2001-01-01x'
+SELECT * FROM t1 WHERE (a,a)=(DATE'2001-01-01','2001-01-01x');
+a
+2001-01-01x
+Warnings:
+Warning 1292 Truncated incorrect date value: '2001-01-01x'
+SELECT * FROM t1 WHERE (a,a)=('2001-01-01',DATE'2001-01-01');
+a
+2001-01-01
+SELECT * FROM t1 WHERE (a,a)=(DATE'2001-01-01','2001-01-01');
+a
+2001-01-01
+DROP TABLE t1;
+CREATE TABLE t1 (a ENUM('2001-01-01','2001-01-01x'));
+INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-01x');
+SELECT * FROM t1 WHERE a=DATE'2001-01-01' AND a='2001-01-01';
+a
+2001-01-01
+SELECT * FROM t1 WHERE a='2001-01-01' AND a=DATE'2001-01-01';
+a
+2001-01-01
+SELECT * FROM t1 WHERE (a,a)=('2001-01-01x',DATE'2001-01-01');
+a
+2001-01-01x
+Warnings:
+Warning 1292 Truncated incorrect date value: '2001-01-01x'
+SELECT * FROM t1 WHERE (a,a)=(DATE'2001-01-01','2001-01-01x');
+a
+2001-01-01x
+Warnings:
+Warning 1292 Truncated incorrect date value: '2001-01-01x'
+SELECT * FROM t1 WHERE (a,a)=('2001-01-01',DATE'2001-01-01');
+a
+2001-01-01
+SELECT * FROM t1 WHERE (a,a)=(DATE'2001-01-01','2001-01-01');
+a
+2001-01-01
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(40),b VARCHAR(40));
+INSERT INTO t1 VALUES ('2001-01-01','2001-01-01x');
+SELECT * FROM t1 WHERE a=b AND a=DATE'2001-01-01';
+a b
+DROP TABLE t1;
+CREATE TABLE t1 (a ENUM('2001-01-01','2001-01-01x'),b ENUM('2001-01-01','2001-01-01x'));
+INSERT INTO t1 VALUES ('2001-01-01','2001-01-01x');
+SELECT * FROM t1 WHERE a=b AND a=DATE'2001-01-01';
+a b
+DROP TABLE t1;
+#
+# MDEV-8695 Wrong result for SELECT..WHERE varchar_column='a' AND CRC32(varchar_column)=3904355907
+#
+CREATE TABLE t1 (a VARCHAR(10) COLLATE latin1_bin);
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE CRC32(a)=3904355907;
+a LENGTH(a) CRC32(a)
+a 1 3904355907
+SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)=3904355907;
+a LENGTH(a) CRC32(a)
+a 1 3904355907
+# 'a' should not be propagated into CRC32(a)
+EXPLAIN EXTENDED SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)=3904355907;
+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))
+SELECT a, HEX(a) FROM t1 WHERE HEX(a)='61';
+a HEX(a)
+a 61
+SELECT *,HEX(a) FROM t1 WHERE a='a' AND HEX(a)='61';
+a HEX(a)
+a 61
+# 'a' should not be propagated into HEX(a)
+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'))
+SELECT * FROM t1 WHERE a='a';
+a
+a
+a
+SELECT * FROM t1 WHERE LENGTH(a)=2;
+a
+a
+SELECT * FROM t1 WHERE a='a' AND LENGTH(a)=2;
+a
+a
+# 'a' should not be propagated into LENGTH(a)
+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))
+DROP TABLE t1;
+#
+# MDEV-8712 Wrong result for SELECT..WHERE latin1_bin_column=_latin1'a' AND latin1_bin_column='A'
+#
+SET NAMES latin1;
+CREATE TABLE t1 (a VARCHAR(20) COLLATE latin1_bin);
+INSERT INTO t1 VALUES ('a'),('b');
+SELECT * FROM t1 WHERE a='A';
+a
+SELECT * FROM t1 WHERE a='A' AND a=_latin1'a';
+a
+SELECT * FROM t1 WHERE a=_latin1'a' AND a='A';
+a
+SELECT * FROM t1 WHERE a=_latin1'A';
+a
+SELECT * FROM t1 WHERE a=_latin1'A' AND a=_latin1'a';
+a
+SELECT * FROM t1 WHERE a=_latin1'a' AND a=_latin1'A';
+a
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/ctype_latin1_de.result b/mysql-test/r/ctype_latin1_de.result
index d20a9c89349..d34d132e3a9 100644
--- a/mysql-test/r/ctype_latin1_de.result
+++ b/mysql-test/r/ctype_latin1_de.result
@@ -490,8 +490,8 @@ 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 DEFAULT '',
- `b` int(1) NOT NULL DEFAULT '0'
+ `a` varchar(1) COLLATE latin1_german2_ci NOT NULL,
+ `b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
SELECT * FROM t1 ORDER BY a, b;
@@ -545,7 +545,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) COLLATE latin1_german2_ci NOT NULL DEFAULT ''
+ `a` varchar(1) COLLATE latin1_german2_ci NOT 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;
@@ -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 DEFAULT ''
+ `a` varchar(5) COLLATE latin1_german2_ci NOT 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 65aa2368ce4..634640cab1d 100644
--- a/mysql-test/r/ctype_latin2.result
+++ b/mysql-test/r/ctype_latin2.result
@@ -396,7 +396,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET latin2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET latin2 NOT 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 DEFAULT ''
+ `a` varchar(64) CHARACTER SET latin2 NOT 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;
@@ -677,7 +677,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET latin2 COLLATE latin2_bin NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET latin2 COLLATE latin2_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET latin2 COLLATE latin2_bin NOT 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 e54522eec9f..da5c8076fca 100644
--- a/mysql-test/r/ctype_latin2_ch.result
+++ b/mysql-test/r/ctype_latin2_ch.result
@@ -45,6 +45,126 @@ strcmp('a\t','a' )
SELECT strcmp('a\t','a ');
strcmp('a\t','a ')
0
+#
+# MDEV-7149 Constant condition propagation erroneously applied for LIKE
+#
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT * FROM t1 WHERE CONCAT(c1)='a';
+c1
+a
+a
+SELECT * FROM t1 WHERE CONCAT(c1) LIKE 'a ';
+c1
+a
+SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a ';
+c1
+a
+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 '))
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
+c1
+a
+a
+SELECT * FROM t1 WHERE 'a ' LIKE CONCAT(c1);
+c1
+a
+SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1);
+c1
+a
+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`)))
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('%'),('% ');
+SELECT * FROM t1 WHERE '% '=CONCAT(c1);
+c1
+%
+%
+SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1);
+c1
+%
+SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
+c1
+%
+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`)))
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('%'),('% ');
+SELECT * FROM t1 WHERE '%'=CONCAT(c1);
+c1
+%
+%
+SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1);
+c1
+%
+SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
+c1
+%
+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`)))
+DROP TABLE t1;
+#
+# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a'
+#
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
+a LENGTH(a)
+a 1
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
+a LENGTH(a)
+a 1
+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 '))))
+DROP TABLE t1;
+#
+# End of MDEV-8694
+#
create table t1 (
a varchar(2) character set latin2 collate latin2_czech_cs,
primary key(a)
@@ -213,6 +333,7 @@ Y
z
Z
DROP TABLE t1;
+set sql_mode="";
CREATE TABLE t1 ENGINE=INNODB AS SELECT repeat('a', 5) AS s1 LIMIT 0;
INSERT INTO t1 VALUES ('x'),('y'),('z'),('X'),('Y'),('Z');
SELECT * FROM t1 GROUP BY s1;
@@ -389,7 +510,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET latin2 COLLATE latin2_czech_cs NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET latin2 COLLATE latin2_czech_cs NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -409,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET latin2 COLLATE latin2_czech_cs NOT 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_many.result b/mysql-test/r/ctype_many.result
index 3c1c96fc47c..59443a3a2d5 100644
--- a/mysql-test/r/ctype_many.result
+++ b/mysql-test/r/ctype_many.result
@@ -1694,6 +1694,7 @@ DO CONVERT(CAST(SUBSTRING_INDEX(FORMAT(1,'1111'), FORMAT('','Zpq'),1)
AS BINARY(0)) USING utf8);
Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'Zpq'
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect BINARY(0) value: '1.'
#
# End of 5.1 tests
@@ -1787,3 +1788,24 @@ SELECT * FROM t2 WHERE a=(SELECT a FROM t1) AND a=_LATIN1'x';
ERROR 21000: Subquery returns more than 1 row
DROP TABLE t2;
DROP TABLE t1;
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8362 dash '-' is not recognized in charset armscii8 on select where query
+#
+CREATE TABLE t1 (a VARCHAR(64) CHARACTER SET armscii8);
+INSERT INTO t1 VALUES ('abc-def');
+SELECT * FROM t1 WHERE a='abc-def';
+a
+abc-def
+SELECT * FROM t1 WHERE a LIKE 'abc%';
+a
+abc-def
+DROP TABLE t1;
+SELECT HEX(CONVERT(_utf8 0x2728292C2D2E USING armscii8));
+HEX(CONVERT(_utf8 0x2728292C2D2E USING armscii8))
+2728292C2D2E
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/ctype_mb.result b/mysql-test/r/ctype_mb.result
index 5c578e3356c..b6e93bae65a 100644
--- a/mysql-test/r/ctype_mb.result
+++ b/mysql-test/r/ctype_mb.result
@@ -3,16 +3,16 @@ CREATE TABLE t1 SELECT _utf8'test' as c1, _utf8'теÑÑ‚' as c2;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '',
- `c2` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT ''
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL,
+ `c2` varchar(4) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DELETE FROM t1;
ALTER TABLE t1 ADD c3 CHAR(4) CHARACTER SET utf8;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '',
- `c2` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL,
+ `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');
diff --git a/mysql-test/r/ctype_sjis.result b/mysql-test/r/ctype_sjis.result
index b2ba9b06b32..46686933298 100644
--- a/mysql-test/r/ctype_sjis.result
+++ b/mysql-test/r/ctype_sjis.result
@@ -193,9 +193,21 @@ 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
@@ -218,8 +230,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
-pattern varchar(64) NO
+subject varchar(64) NO NULL
+pattern varchar(64) NO 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)
@@ -347,9 +359,21 @@ 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
@@ -401,12 +425,14 @@ 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');
+Warnings:
+Warning 1364 Field 'a' doesn't have a default value
DROP TEMPORARY TABLE head, tail;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`code` varchar(8) DEFAULT NULL,
- `a` varchar(1) CHARACTER SET sjis NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET sjis NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
UPDATE t1 SET a=unhex(code) ORDER BY code;
Warnings:
@@ -660,139 +686,139 @@ HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
code a
81F0 â„«
Warnings:
-Warning 1976 Cannot convert 'sjis' character 0x81AD to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81AD to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81AE to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81AE to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81AF to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81AF to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B0 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B0 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B1 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B1 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B2 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B2 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B3 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B3 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B4 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B4 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B5 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B5 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B6 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B6 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B7 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B7 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C0 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C0 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C1 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C1 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C2 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C2 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C3 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C3 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C4 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C4 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C5 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C5 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C6 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C6 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C7 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C7 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81CF to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81CF to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D0 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D0 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D1 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D1 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D2 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D2 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D3 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D3 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D4 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D4 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D5 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D5 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D6 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D6 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D7 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D7 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D8 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D8 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D9 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D9 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81E9 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81E9 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81EA to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81EA to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81AD to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81AD to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81AE to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81AE to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81AF to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81AF to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B0 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B0 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B1 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B1 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B2 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B2 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B3 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B3 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B4 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B4 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B5 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B5 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B6 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B6 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B7 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B7 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C0 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C0 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C1 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C1 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C2 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C2 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C3 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C3 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C4 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C4 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C5 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C5 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C6 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C6 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C7 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C7 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81CF to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81CF to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D0 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D0 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D1 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D1 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D2 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D2 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D3 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D3 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D4 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D4 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D5 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D5 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D6 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D6 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D7 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D7 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D8 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D8 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D9 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D9 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81E9 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81E9 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81EA to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81EA to 'utf8'
SELECT * FROM t1
WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <>
HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
code a
Warnings:
-Warning 1976 Cannot convert 'sjis' character 0x81AD to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81AD to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81AE to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81AE to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81AF to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81AF to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B0 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B0 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B1 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B1 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B2 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B2 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B3 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B3 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B4 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B4 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B5 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B5 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B6 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B6 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B7 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B7 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C0 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C0 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C1 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C1 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C2 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C2 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C3 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C3 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C4 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C4 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C5 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C5 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C6 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C6 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C7 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C7 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81CF to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81CF to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D0 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D0 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D1 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D1 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D2 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D2 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D3 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D3 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D4 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D4 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D5 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D5 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D6 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D6 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D7 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D7 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D8 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D8 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D9 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D9 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81E9 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81E9 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81EA to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81EA to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81AD to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81AD to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81AE to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81AE to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81AF to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81AF to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B0 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B0 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B1 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B1 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B2 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B2 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B3 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B3 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B4 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B4 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B5 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B5 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B6 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B6 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B7 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B7 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C0 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C0 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C1 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C1 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C2 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C2 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C3 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C3 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C4 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C4 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C5 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C5 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C6 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C6 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C7 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C7 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81CF to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81CF to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D0 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D0 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D1 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D1 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D2 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D2 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D3 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D3 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D4 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D4 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D5 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D5 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D6 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D6 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D7 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D7 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D8 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D8 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D9 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D9 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81E9 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81E9 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81EA to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81EA to 'utf8'
#
# WL#3090 Japanese Character Set adjustments
# Test sjis->Unicode conversion
@@ -7743,70 +7769,70 @@ EAA2 E791A4
EAA3 E5879C
EAA4 E78699
Warnings:
-Warning 1976 Cannot convert 'sjis' character 0x81AD to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81AE to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81AF to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B0 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B1 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B2 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B3 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B4 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B5 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B6 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81B7 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C0 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C1 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C2 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C3 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C4 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C5 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C6 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81C7 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81CF to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D0 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D1 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D2 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D3 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D4 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D5 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D6 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D7 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D8 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81D9 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81E9 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81EA to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81EB to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81EC to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81ED to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81EE to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81EF to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81F8 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81F9 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81FA to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x81FB to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x8240 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x8241 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x8242 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x8243 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x8244 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x8245 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x8246 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x8247 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x8248 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x8249 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x824A to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x824B to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x824C to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x824D to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x824E to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x8259 to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x825A to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x825B to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x825C to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x825D to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x825E to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x825F to 'utf8'
-Warning 1976 Cannot convert 'sjis' character 0x827A to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81AD to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81AE to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81AF to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B0 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B1 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B2 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B3 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B4 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B5 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B6 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81B7 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C0 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C1 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C2 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C3 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C4 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C5 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C6 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81C7 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81CF to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D0 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D1 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D2 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D3 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D4 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D5 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D6 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D7 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D8 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81D9 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81E9 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81EA to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81EB to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81EC to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81ED to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81EE to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81EF to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81F8 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81F9 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81FA to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x81FB to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x8240 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x8241 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x8242 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x8243 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x8244 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x8245 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x8246 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x8247 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x8248 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x8249 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x824A to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x824B to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x824C to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x824D to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x824E to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x8259 to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x825A to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x825B to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x825C to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x825D to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x825E to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x825F to 'utf8'
+Warning 1977 Cannot convert 'sjis' character 0x827A to 'utf8'
DROP TABLE t1;
#
# WL#3090 Japanese Character Set adjustments
@@ -14926,7 +14952,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET sjis NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET sjis NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -14946,7 +14972,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET sjis NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -15185,7 +15211,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET sjis COLLATE sjis_bin NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET sjis COLLATE sjis_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -15205,7 +15231,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET sjis COLLATE sjis_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -18548,7 +18574,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 DEFAULT ''
+ `a` varchar(10) CHARACTER SET sjis NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('à\'),('à\t');
INSERT INTO t1 VALUES ('\\à\'),('\\à\t'),('\\à\t\t');
@@ -18587,7 +18613,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 DEFAULT ''
+ `a` varchar(10) CHARACTER SET sjis NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (BINARY('à\')),(BINARY('à\t'));
INSERT INTO t1 VALUES (BINARY('\\à\')),(BINARY('\\à\t')),(BINARY('\\à\t\t'));
@@ -18626,7 +18652,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 DEFAULT ''
+ `a` varchar(10) CHARACTER SET sjis NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_BINARY'à\'),(_BINARY'à\t');
INSERT INTO t1 VALUES (_BINARY'\\à\'),(_BINARY'\\à\t'),(_BINARY'\\à\t\t');
@@ -18672,7 +18698,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 DEFAULT ''
+ `a` varchar(10) CHARACTER SET sjis NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('à\['),('\à\[');
SELECT HEX(a) FROM t1;
@@ -18692,7 +18718,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 DEFAULT ''
+ `a` varbinary(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('à\['),('\à\[');
SELECT HEX(a) FROM t1;
diff --git a/mysql-test/r/ctype_tis620.result b/mysql-test/r/ctype_tis620.result
index 08cf9f1a753..947aeb5ff5b 100644
--- a/mysql-test/r/ctype_tis620.result
+++ b/mysql-test/r/ctype_tis620.result
@@ -3115,6 +3115,126 @@ Zz 5A,7A
~ 7E
 7F
drop table t1;
+#
+# MDEV-7149 Constant condition propagation erroneously applied for LIKE
+#
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT * FROM t1 WHERE CONCAT(c1)='a';
+c1
+a
+a
+SELECT * FROM t1 WHERE CONCAT(c1) LIKE 'a ';
+c1
+a
+SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a ';
+c1
+a
+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 '))
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
+c1
+a
+a
+SELECT * FROM t1 WHERE 'a ' LIKE CONCAT(c1);
+c1
+a
+SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1);
+c1
+a
+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`)))
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('%'),('% ');
+SELECT * FROM t1 WHERE '% '=CONCAT(c1);
+c1
+%
+%
+SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1);
+c1
+%
+SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
+c1
+%
+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`)))
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('%'),('% ');
+SELECT * FROM t1 WHERE '%'=CONCAT(c1);
+c1
+%
+%
+SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1);
+c1
+%
+SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
+c1
+%
+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`)))
+DROP TABLE t1;
+#
+# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a'
+#
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
+a LENGTH(a)
+a 1
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
+a LENGTH(a)
+a 1
+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 '))))
+DROP TABLE t1;
+#
+# End of MDEV-8694
+#
SET collation_connection='tis620_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
@@ -3212,6 +3332,126 @@ c2h
ab_def
drop table t1;
#
+# MDEV-7149 Constant condition propagation erroneously applied for LIKE
+#
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT * FROM t1 WHERE CONCAT(c1)='a';
+c1
+a
+a
+SELECT * FROM t1 WHERE CONCAT(c1) LIKE 'a ';
+c1
+a
+SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a ';
+c1
+a
+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 '))
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
+c1
+a
+a
+SELECT * FROM t1 WHERE 'a ' LIKE CONCAT(c1);
+c1
+a
+SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1);
+c1
+a
+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`)))
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('%'),('% ');
+SELECT * FROM t1 WHERE '% '=CONCAT(c1);
+c1
+%
+%
+SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1);
+c1
+%
+SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
+c1
+%
+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`)))
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('%'),('% ');
+SELECT * FROM t1 WHERE '%'=CONCAT(c1);
+c1
+%
+%
+SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1);
+c1
+%
+SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
+c1
+%
+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`)))
+DROP TABLE t1;
+#
+# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a'
+#
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
+a LENGTH(a)
+a 1
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
+a LENGTH(a)
+a 1
+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 '))))
+DROP TABLE t1;
+#
+# End of MDEV-8694
+#
+#
# Start of 5.6 tests
#
#
@@ -3226,7 +3466,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET tis620 NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET tis620 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -3246,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET tis620 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -3404,7 +3644,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET tis620 COLLATE tis620_bin NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET tis620 COLLATE tis620_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -3424,7 +3664,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET tis620 COLLATE tis620_bin NOT 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_uca.result b/mysql-test/r/ctype_uca.result
index 02809f3be22..2f7cb7156a4 100644
--- a/mysql-test/r/ctype_uca.result
+++ b/mysql-test/r/ctype_uca.result
@@ -6071,8 +6071,8 @@ 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 DEFAULT '',
- `b` int(1) NOT NULL DEFAULT '0'
+ `a` varchar(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
+ `b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
SELECT * FROM t1 ORDER BY a, b;
@@ -6265,9 +6265,21 @@ 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
@@ -6479,7 +6491,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 DEFAULT '',
+ `ch` varchar(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`),
KEY `ch` (`ch`)
@@ -6506,10 +6518,22 @@ SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
ch
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
ch
+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 NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
+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;
ch
Warnings:
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 NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
+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;
ch
Warnings:
@@ -6552,6 +6576,12 @@ ab
az
aЀ
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
+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;
ch
a
@@ -6573,6 +6603,12 @@ aЀ
aÖ€
Warnings:
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
+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;
ch
a
@@ -6600,11 +6636,23 @@ z
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
ch
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
+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;
ch
z
Warnings:
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
+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;
ch
z
@@ -6687,7 +6735,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 DEFAULT '',
+ `ch` varchar(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`),
KEY `ch` (`ch`)
@@ -6714,10 +6762,22 @@ SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
ch
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
ch
+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 NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
+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;
ch
Warnings:
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 NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
+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;
ch
Warnings:
@@ -6760,6 +6820,10 @@ ab
az
aЀ
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 ALL ch NULL NULL NULL # Using where; Using filesort
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
ch
a
@@ -6779,6 +6843,10 @@ ab
az
aЀ
aÖ€
+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 ALL ch NULL NULL NULL # Using where; Using filesort
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
ch
a
@@ -6804,9 +6872,17 @@ z
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
ch
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 ALL ch NULL NULL NULL # Using where; Using filesort
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
ch
z
+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 ALL ch NULL NULL NULL # Using where; Using filesort
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
ch
z
@@ -6894,7 +6970,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -6914,7 +6990,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -7138,7 +7214,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -7158,7 +7234,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -7786,8 +7862,8 @@ 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 DEFAULT '',
- `b` int(1) NOT NULL DEFAULT '0'
+ `a` varchar(1) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL,
+ `b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
SELECT * FROM t1 ORDER BY a, b;
@@ -7816,7 +7892,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 DEFAULT ''
+ `c` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_utf32 0x0180),(_utf32 0x023A);
INSERT INTO t1 VALUES (_utf32 0x023B),(_utf32 0x023C);
@@ -8120,7 +8196,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE CONCAT(c1)='a';
@@ -8143,7 +8219,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
@@ -8166,7 +8242,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '% '=CONCAT(c1);
@@ -8189,7 +8265,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '%'=CONCAT(c1);
@@ -8209,13 +8285,38 @@ Warnings:
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'
+#
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
+a LENGTH(a)
+a 1
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
+a LENGTH(a)
+a 1
+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'))
+DROP TABLE t1;
+#
+# End of MDEV-8694
+#
+#
# MDEV-7149 Constant condition propagation erroneously applied for LIKE
#
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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('ae'),('ä');
SELECT * FROM t1 WHERE c1='ä';
@@ -8253,7 +8354,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE CONCAT(c1)='a';
@@ -8276,7 +8377,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
@@ -8299,7 +8400,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '% '=CONCAT(c1);
@@ -8322,7 +8423,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '%'=CONCAT(c1);
@@ -8342,13 +8443,38 @@ Warnings:
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'
+#
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
+a LENGTH(a)
+a 1
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
+a LENGTH(a)
+a 1
+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'))
+DROP TABLE t1;
+#
+# End of MDEV-8694
+#
+#
# MDEV-7149 Constant condition propagation erroneously applied for LIKE
#
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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('ae'),('ä');
SELECT * FROM t1 WHERE c1='ä';
@@ -8401,7 +8527,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 DEFAULT '',
+ `s1` varchar(64) CHARACTER SET utf8 COLLATE utf8_myanmar_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 (s1) VALUES
@@ -10977,7 +11103,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 DEFAULT '',
+ `s1` varchar(64) CHARACTER SET ucs2 COLLATE ucs2_myanmar_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 (s1) VALUES
@@ -13573,3 +13699,32 @@ DROP TABLE t1;
#
# End of MariaDB-10.0 tests
#
+#
+# Start of MariaDB-10.1 tests
+#
+#
+# MDEV-6973 XOR aggregates argument collations
+#
+SELECT '10' COLLATE utf8_general_ci XOR '20' COLLATE utf8_unicode_ci;
+'10' COLLATE utf8_general_ci XOR '20' COLLATE utf8_unicode_ci
+0
+#
+# MDEV-8705 Wrong result for SELECT..WHERE latin1_bin_column='a' AND latin1_bin_column='A'
+#
+SET NAMES utf8 COLLATE utf8_german2_ci;
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_bin);
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT * FROM t1 WHERE a='a';
+a
+a
+SELECT * FROM t1 WHERE a=_utf8'a';
+a
+a
+SELECT * FROM t1 WHERE a='a' AND a=_utf8'a';
+a
+a
+DROP TABLE t1;
+SET NAMES utf8;
+#
+# End of MariaDB-10.1 tests
+#
diff --git a/mysql-test/r/ctype_uca_innodb.result b/mysql-test/r/ctype_uca_innodb.result
index a4e1ae09130..f189e698da1 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 DEFAULT '',
+ `ch` varchar(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`),
KEY `ch` (`ch`)
@@ -42,10 +42,22 @@ SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
ch
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
ch
+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 NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
+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;
ch
Warnings:
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 NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
+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;
ch
Warnings:
@@ -88,6 +100,12 @@ ab
az
aЀ
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
+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;
ch
a
@@ -109,6 +127,12 @@ aЀ
aÖ€
Warnings:
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
+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;
ch
a
@@ -136,11 +160,23 @@ z
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
ch
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
+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;
ch
z
Warnings:
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
+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;
ch
z
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index 5b4d1320f08..803ca9a048b 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -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 DEFAULT '',
- `r` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+ `l` varchar(10) CHARACTER SET ucs2 NOT NULL,
+ `r` varchar(10) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
@@ -933,8 +933,8 @@ 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 DEFAULT '',
- `b` int(1) NOT NULL DEFAULT '0'
+ `a` varchar(1) CHARACTER SET ucs2 NOT NULL,
+ `b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
SELECT * FROM t1 ORDER BY a, b;
@@ -959,9 +959,21 @@ 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
@@ -984,8 +996,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
-pattern varchar(64) NO
+subject varchar(64) NO NULL
+pattern varchar(64) NO 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)
@@ -1092,9 +1104,21 @@ 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
@@ -1160,7 +1184,9 @@ hex(a)
005B
803D
drop table t1;
+set sql_mode="";
create table t1(f1 varchar(5) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL) engine=InnoDB;
+set sql_mode=default;
insert into t1 values('a');
create index t1f1 on t1(f1);
select f1 from t1 where f1 like 'a%';
@@ -1596,7 +1622,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -1609,7 +1635,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 DEFAULT ''
+ `c1` varchar(20) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -1622,7 +1648,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 DEFAULT ''
+ `c1` varchar(4) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -1635,7 +1661,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1-2));
@@ -1645,7 +1671,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1*2));
@@ -1655,7 +1681,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1/2));
@@ -1695,7 +1721,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(-(1+2)));
@@ -1705,7 +1731,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 DEFAULT ''
+ `c1` varchar(4) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1|2));
@@ -1715,7 +1741,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1&2));
@@ -1725,7 +1751,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(bit_count(12)));
@@ -1735,7 +1761,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(2<<1));
@@ -1745,7 +1771,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(2>>1));
@@ -1755,7 +1781,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(~0));
@@ -1765,7 +1791,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(3^2));
@@ -1775,7 +1801,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(abs(-2)));
@@ -1785,7 +1811,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(left(concat(exp(2)),1));
@@ -1915,7 +1941,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 DEFAULT ''
+ `c1` varchar(23) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(radians(0)));
@@ -1925,7 +1951,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 DEFAULT ''
+ `c1` varchar(23) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ceiling(0.5)));
@@ -1935,7 +1961,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 DEFAULT ''
+ `c1` varchar(4) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(floor(0.5)));
@@ -1945,7 +1971,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 DEFAULT ''
+ `c1` varchar(4) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(round(0.5)));
@@ -1955,7 +1981,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sign(0.5)));
@@ -1965,14 +1991,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET ucs2 NOT 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 DEFAULT ''
+ `c1` varchar(23) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(length('a')));
@@ -1982,7 +2008,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(char_length('a')));
@@ -1992,7 +2018,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(bit_length('a')));
@@ -2002,7 +2028,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(coercibility('a')));
@@ -2012,7 +2038,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(locate('a','a')));
@@ -2022,7 +2048,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 DEFAULT ''
+ `c1` varchar(11) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(field('c','a','b','c')));
@@ -2032,7 +2058,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ascii(61)));
@@ -2042,7 +2068,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ord(61)));
@@ -2052,7 +2078,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(find_in_set('b','a,b,c,d')));
@@ -2062,7 +2088,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select md5('a'), hex(md5('a'));
@@ -2072,7 +2098,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 DEFAULT ''
+ `c1` varchar(32) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select old_password('a'), hex(old_password('a'));
@@ -2082,7 +2108,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 DEFAULT ''
+ `c1` varchar(16) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select password('a'), hex(password('a'));
@@ -2092,7 +2118,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 DEFAULT ''
+ `c1` varchar(41) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select sha('a'), hex(sha('a'));
@@ -2102,7 +2128,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 DEFAULT ''
+ `c1` varchar(40) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select sha1('a'), hex(sha1('a'));
@@ -2112,7 +2138,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 DEFAULT ''
+ `c1` varchar(40) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast('-1' as signed)));
@@ -2122,7 +2148,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast('1' as unsigned)));
@@ -2132,7 +2158,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast(1/2 as decimal(5,5))));
@@ -2191,7 +2217,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(greatest(1,2)));
@@ -2201,7 +2227,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(case when 11 then 22 else 33 end));
@@ -2211,7 +2237,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(coalesce(1,2)));
@@ -2221,7 +2247,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat_ws(1,2,3));
@@ -2231,7 +2257,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(group_concat(1,2,3));
@@ -2259,7 +2285,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(benchmark(0,0)));
@@ -2269,7 +2295,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sleep(0)));
@@ -2279,7 +2305,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(is_free_lock('xxxx')));
@@ -2313,7 +2339,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(uncompressed_length('')));
@@ -2330,7 +2356,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(inet_aton('127.1.1.1')));
@@ -2366,7 +2392,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(found_rows()));
@@ -2376,21 +2402,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET ucs2 NOT 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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET ucs2 NOT 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 DEFAULT ''
+ `c1` varchar(36) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select coercibility(uuid()), coercibility(cast('a' as char character set latin1));
@@ -2403,7 +2429,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 DEFAULT ''
+ `c1` varchar(37) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1;
@@ -2423,8 +2449,8 @@ hex(c1)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '',
- `c2` int(1) NOT NULL DEFAULT '0'
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL,
+ `c2` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @a2=1;
@@ -2481,8 +2507,8 @@ hex(c1)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET ucs2 NOT NULL DEFAULT '',
- `c2` decimal(2,1) NOT NULL DEFAULT '0.0'
+ `c1` varchar(4) CHARACTER SET ucs2 NOT NULL,
+ `c2` decimal(2,1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @a2=1.1;
@@ -2520,7 +2546,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a'='a' IS NOT TRUE));
@@ -2530,7 +2556,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(NOT 'a'='a'));
@@ -2540,7 +2566,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' IS NULL));
@@ -2550,7 +2576,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' IS NOT NULL));
@@ -2560,7 +2586,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' rlike 'a'));
@@ -2570,7 +2596,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(strcmp('a','b')));
@@ -2580,7 +2606,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' like 'a'));
@@ -2590,7 +2616,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' between 'b' and 'c'));
@@ -2600,7 +2626,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' in ('a','b')));
@@ -2610,7 +2636,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(interval(23, 1, 15, 17, 30, 44, 200)));
@@ -2620,7 +2646,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a varchar(10), fulltext key(a));
@@ -2642,7 +2668,7 @@ create table t1 as select ifnull(1,'a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ifnull(1,1)));
@@ -2652,7 +2678,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ifnull(1.1,1.1)));
@@ -2662,7 +2688,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 DEFAULT ''
+ `c1` varchar(4) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(if(1,'b',1));
@@ -2672,7 +2698,7 @@ create table t1 as select if(1,'b',1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(if(1,1,'b'));
@@ -2682,7 +2708,7 @@ create table t1 as select if(1,1,'b') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(if(1,1,1)));
@@ -2692,7 +2718,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(nullif(1,2)));
@@ -2772,7 +2798,7 @@ create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
+ `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))));
@@ -2782,7 +2808,7 @@ create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
+ `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))));
@@ -2857,7 +2883,7 @@ 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 DEFAULT ''
+ `c1` varchar(6) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(period_diff(200902, 200802)));
@@ -2869,7 +2895,7 @@ Warning 1265 Data truncated for column 'c1' at row 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(6) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+ `c1` varchar(6) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(to_days(20090224)));
@@ -3066,21 +3092,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET ucs2 NOT 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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET ucs2 NOT 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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select repeat('a',20) as c1 limit 0;
@@ -3096,7 +3122,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sec_to_time(2378)));
@@ -3189,21 +3215,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 DEFAULT ''
+ `c1` varchar(19) CHARACTER SET ucs2 NOT 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 DEFAULT ''
+ `c1` varchar(19) CHARACTER SET ucs2 NOT 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 DEFAULT ''
+ `c1` varchar(19) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(addtime('00:00:00','11:22:33')));
@@ -3243,7 +3269,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 DEFAULT ''
+ `c1` varchar(127) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(insert(1133,3,0,22));
@@ -3253,7 +3279,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 DEFAULT ''
+ `c1` varchar(6) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lcase(123));
@@ -3263,7 +3289,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(left(123,1));
@@ -3273,7 +3299,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lower(123));
@@ -3283,7 +3309,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lpad(1,2,0));
@@ -3293,7 +3319,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(ltrim(1));
@@ -3303,7 +3329,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(mid(1,1,1));
@@ -3313,7 +3339,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(repeat(1,2));
@@ -3323,7 +3349,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(replace(1,1,2));
@@ -3333,7 +3359,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(reverse(12));
@@ -3343,7 +3369,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(right(123,1));
@@ -3353,7 +3379,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(rpad(1,2,0));
@@ -3363,7 +3389,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(rtrim(1));
@@ -3373,7 +3399,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(soundex(1));
@@ -3383,7 +3409,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 DEFAULT ''
+ `c1` varchar(4) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(substring(1,1,1));
@@ -3393,7 +3419,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(trim(1));
@@ -3403,7 +3429,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(ucase(1));
@@ -3413,7 +3439,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(upper(1));
@@ -3423,14 +3449,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET ucs2 NOT 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 DEFAULT ''
+ `a` varchar(64) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ("1.1"), ("2.1");
select a, hex(a) from t1;
@@ -3680,7 +3706,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 DEFAULT ''
+ `concat(a)` varchar(19) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1 (a date);
@@ -4220,7 +4246,7 @@ SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`CONCAT(a)` varchar(9) CHARACTER SET ucs2 DEFAULT NULL,
- `IFNULL(a,'')` varchar(9) CHARACTER SET ucs2 NOT NULL DEFAULT '',
+ `IFNULL(a,'')` varchar(9) CHARACTER SET ucs2 NOT NULL,
`IF(a,a,'')` varchar(9) CHARACTER SET ucs2 DEFAULT NULL,
`CASE WHEN a THEN a ELSE '' END` varchar(9) CHARACTER SET ucs2 DEFAULT NULL,
`COALESCE(a,'')` varchar(9) CHARACTER SET ucs2 DEFAULT NULL
@@ -4230,14 +4256,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 DEFAULT ''
+ `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET ucs2 NOT 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 DEFAULT ''
+ `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT LCASE(a) FROM t1;
@@ -4258,35 +4284,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 DEFAULT ''
+ `REPEAT(1,2)` varchar(2) CHARACTER SET ucs2 NOT 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 DEFAULT ''
+ `LEFT(123,2)` varchar(2) CHARACTER SET ucs2 NOT 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 DEFAULT ''
+ `RIGHT(123,2)` varchar(2) CHARACTER SET ucs2 NOT 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 DEFAULT ''
+ `LTRIM(123)` varchar(3) CHARACTER SET ucs2 NOT 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 DEFAULT ''
+ `RTRIM(123)` varchar(3) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1;
@@ -4300,35 +4326,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 DEFAULT ''
+ `REPLACE(111,2,3)` varchar(3) CHARACTER SET ucs2 NOT 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 DEFAULT ''
+ `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET ucs2 NOT 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 DEFAULT ''
+ `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET ucs2 NOT 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 DEFAULT ''
+ `SOUNDEX(1)` varchar(4) CHARACTER SET ucs2 NOT 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 DEFAULT ''
+ `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
DROP TABLE t1;
@@ -4557,7 +4583,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -4577,7 +4603,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -4801,7 +4827,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -4821,7 +4847,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -5130,7 +5156,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 DEFAULT ''
+ `a` varchar(64) CHARACTER SET ucs2 NOT 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;
@@ -5273,8 +5299,8 @@ 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 DEFAULT '',
- `b` int(1) NOT NULL DEFAULT '0'
+ `a` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_german2_ci NOT NULL,
+ `b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
SELECT * FROM t1 ORDER BY a, b;
@@ -5314,7 +5340,7 @@ Warning 1292 Truncated incorrect INTEGER value: ''
CREATE TABLE t1 (a DECIMAL(2,0));
SET sql_mode='strict_all_tables';
INSERT INTO t1 VALUES (CONVERT('9e99999999' USING ucs2));
-ERROR 22007: Incorrect decimal value: '9e99999999' for column 'a' at row 1
+ERROR 22003: Out of range value for column 'a' at row 1
SET sql_mode=DEFAULT;
INSERT INTO t1 VALUES (CONVERT('aaa' USING ucs2));
Warnings:
@@ -5334,7 +5360,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE CONCAT(c1)='a';
@@ -5357,7 +5383,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
@@ -5380,7 +5406,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '% '=CONCAT(c1);
@@ -5403,7 +5429,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '%'=CONCAT(c1);
@@ -5422,6 +5448,31 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
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'
+#
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
+a LENGTH(a)
+a 2
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
+a LENGTH(a)
+a 2
+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 '))))
+DROP TABLE t1;
+#
+# End of MDEV-8694
+#
SET NAMES latin1, collation_connection=ucs2_general_ci;
#
# MDEV-7149 Constant condition propagation erroneously applied for LIKE
@@ -5430,7 +5481,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE CONCAT(c1)='a';
@@ -5453,7 +5504,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
@@ -5476,7 +5527,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '% '=CONCAT(c1);
@@ -5499,7 +5550,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '%'=CONCAT(c1);
@@ -5518,6 +5569,31 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
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'
+#
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
+a LENGTH(a)
+a 2
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
+a LENGTH(a)
+a 2
+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 '))))
+DROP TABLE t1;
+#
+# End of MDEV-8694
+#
SET NAMES latin1;
#
# MDEV-6661 PI() does not work well in UCS2/UTF16/UTF32 context
diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result
index 4ad47cbc84a..61541ec7678 100644
--- a/mysql-test/r/ctype_ujis.result
+++ b/mysql-test/r/ctype_ujis.result
@@ -126,6 +126,7 @@ Field Type Null Key Default Extra
a char(1) NO
b enum('¤¢','¤¤') YES NULL
DROP TABLE t1;
+set sql_mode="";
CREATE TABLE t1
(
a INTEGER NOT NULL,
@@ -133,6 +134,7 @@ b VARCHAR(50) NOT NULL DEFAULT '',
PRIMARY KEY (a),
KEY b (b(10))
) ENGINE=InnoDB CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
+set sql_mode=default;
INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
INSERT INTO t1 (a, b) VALUES (2, 'iiijjjkkkl');
@@ -2329,9 +2331,21 @@ 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
@@ -2464,9 +2478,21 @@ 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
@@ -2481,12 +2507,12 @@ select hex(convert(_ujis 0xA5FE41 using ucs2));
hex(convert(_ujis 0xA5FE41 using ucs2))
003F0041
Warnings:
-Warning 1976 Cannot convert 'ujis' character 0xA5FE to 'ucs2'
+Warning 1977 Cannot convert 'ujis' character 0xA5FE to 'ucs2'
select hex(convert(_ujis 0x8FABF841 using ucs2));
hex(convert(_ujis 0x8FABF841 using ucs2))
003F0041
Warnings:
-Warning 1976 Cannot convert 'ujis' character 0x8FABF8 to 'ucs2'
+Warning 1977 Cannot convert 'ujis' character 0x8FABF8 to 'ucs2'
DROP TABLE IF EXISTS t1, t2;
DROP PROCEDURE IF EXISTS sp1;
set names ujis;
@@ -2545,21 +2571,27 @@ 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
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)
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)
FROM head, tail
WHERE (head BETWEEN '80' AND 'FF') AND (tail BETWEEN '80' AND 'FF')
ORDER BY head, tail;
+Warnings:
+Warning 1364 Field 'a' doesn't have a default value
DROP TEMPORARY TABLE head, tail;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `code` varchar(6) CHARACTER SET ujis NOT NULL DEFAULT '',
- `a` varchar(1) CHARACTER SET ujis NOT NULL DEFAULT ''
+ `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;
Warnings:
@@ -3051,70 +3083,70 @@ HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
code a
8FAABC Ģ
Warnings:
-Warning 1976 Cannot convert 'ujis' character 0xA2AF to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2AF to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B0 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B0 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B1 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B1 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B2 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B2 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B3 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B3 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B4 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B4 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B5 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B5 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B6 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B6 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B7 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B7 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B8 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B8 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B9 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B9 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C2 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C2 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C3 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C3 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C4 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C4 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C5 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C5 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C6 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C6 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C7 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C7 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C8 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C8 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C9 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C9 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D1 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D1 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D2 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D2 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D3 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D3 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D4 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D4 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D5 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D5 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D6 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D6 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D7 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D7 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D8 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D8 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D9 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D9 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2DA to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2DA to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2DB to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2DB to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2EB to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2EB to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2EC to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2EC to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2AF to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2AF to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B0 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B0 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B1 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B1 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B2 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B2 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B3 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B3 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B4 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B4 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B5 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B5 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B6 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B6 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B7 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B7 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B8 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B8 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B9 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B9 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C2 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C2 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C3 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C3 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C4 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C4 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C5 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C5 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C6 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C6 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C7 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C7 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C8 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C8 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C9 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C9 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D1 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D1 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D2 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D2 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D3 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D3 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D4 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D4 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D5 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D5 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D6 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D6 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D7 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D7 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D8 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D8 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D9 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D9 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2DA to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2DA to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2DB to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2DB to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2EB to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2EB to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2EC to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2EC to 'utf8'
SELECT * FROM t1
WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <>
HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
@@ -3122,70 +3154,70 @@ code a
8FA9C3 ð
8FABB9 ǵ
Warnings:
-Warning 1976 Cannot convert 'ujis' character 0xA2AF to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2AF to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B0 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B0 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B1 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B1 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B2 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B2 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B3 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B3 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B4 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B4 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B5 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B5 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B6 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B6 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B7 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B7 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B8 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B8 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B9 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B9 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C2 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C2 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C3 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C3 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C4 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C4 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C5 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C5 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C6 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C6 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C7 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C7 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C8 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C8 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C9 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C9 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D1 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D1 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D2 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D2 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D3 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D3 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D4 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D4 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D5 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D5 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D6 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D6 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D7 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D7 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D8 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D8 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D9 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D9 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2DA to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2DA to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2DB to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2DB to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2EB to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2EB to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2EC to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2EC to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2AF to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2AF to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B0 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B0 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B1 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B1 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B2 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B2 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B3 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B3 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B4 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B4 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B5 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B5 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B6 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B6 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B7 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B7 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B8 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B8 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B9 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B9 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C2 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C2 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C3 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C3 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C4 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C4 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C5 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C5 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C6 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C6 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C7 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C7 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C8 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C8 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C9 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C9 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D1 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D1 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D2 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D2 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D3 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D3 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D4 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D4 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D5 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D5 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D6 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D6 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D7 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D7 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D8 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D8 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D9 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D9 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2DA to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2DA to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2DB to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2DB to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2EB to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2EB to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2EC to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2EC to 'utf8'
#
# WL#3090 Japanese Character Set adjustments
# Test sjis->Unicode conversion
@@ -18083,70 +18115,70 @@ FEFC EE8EA9
FEFD EE8EAA
FEFE EE8EAB
Warnings:
-Warning 1976 Cannot convert 'ujis' character 0xA2AF to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B0 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B1 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B2 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B3 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B4 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B5 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B6 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B7 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B8 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2B9 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C2 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C3 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C4 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C5 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C6 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C7 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C8 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2C9 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D1 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D2 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D3 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D4 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D5 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D6 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D7 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D8 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2D9 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2DA to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2DB to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2EB to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2EC to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2ED to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2EE to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2EF to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2F0 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2F1 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2FA to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2FB to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2FC to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA2FD to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA3A1 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA3A2 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA3A3 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA3A4 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA3A5 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA3A6 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA3A7 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA3A8 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA3A9 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA3AA to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA3AB to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA3AC to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA3AD to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA3AE to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA3AF to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA3BA to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA3BB to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA3BC to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA3BD to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA3BE to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA3BF to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA3C0 to 'utf8'
-Warning 1976 Cannot convert 'ujis' character 0xA3DB to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2AF to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B0 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B1 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B2 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B3 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B4 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B5 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B6 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B7 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B8 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2B9 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C2 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C3 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C4 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C5 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C6 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C7 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C8 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2C9 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D1 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D2 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D3 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D4 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D5 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D6 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D7 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D8 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2D9 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2DA to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2DB to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2EB to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2EC to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2ED to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2EE to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2EF to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2F0 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2F1 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2FA to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2FB to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2FC to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA2FD to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA3A1 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA3A2 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA3A3 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA3A4 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA3A5 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA3A6 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA3A7 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA3A8 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA3A9 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA3AA to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA3AB to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA3AC to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA3AD to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA3AE to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA3AF to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA3BA to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA3BB to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA3BC to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA3BD to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA3BE to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA3BF to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA3C0 to 'utf8'
+Warning 1977 Cannot convert 'ujis' character 0xA3DB to 'utf8'
DROP TABLE t1;
#
# WL#3090 Japanese Character Set adjustments
@@ -25266,7 +25298,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET ujis NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET ujis NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -25286,7 +25318,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET ujis NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -25699,7 +25731,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET ujis COLLATE ujis_bin NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET ujis COLLATE ujis_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -25719,7 +25751,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET ujis COLLATE ujis_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -26144,3 +26176,45 @@ ERROR HY000: Invalid ujis character string: '8EA0'
#
# End of 10.0 tests
#
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8215 Asian MB3 charsets: compare broken bytes as "greater than any non-broken character"
+#
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ujis, KEY(a));
+INSERT INTO t1 VALUES ('a'),(0x7F);
+INSERT INTO t1 VALUES (0x8EA1),(0x8EDF);
+INSERT INTO t1 VALUES (0x8FA1A1),(0x8FFEFE);
+INSERT INTO t1 VALUES (0xA1A1),(0xDEDE),(0xDFDF),(0xE0E0),(0xFEFE);
+SELECT HEX(a) FROM t1 ORDER BY a;
+HEX(a)
+61
+7F
+8EA1
+8EDF
+8FA1A1
+8FFEFE
+A1A1
+DEDE
+DFDF
+E0E0
+FEFE
+ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ujis COLLATE ujis_bin;
+SELECT HEX(a) FROM t1 ORDER BY a;
+HEX(a)
+61
+7F
+8EA1
+8EDF
+8FA1A1
+8FFEFE
+A1A1
+DEDE
+DFDF
+E0E0
+FEFE
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result
index 2d91ce3dd6f..77941ab4906 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 DEFAULT '',
- `r` varchar(10) CHARACTER SET utf16 NOT NULL DEFAULT ''
+ `l` varchar(10) CHARACTER SET utf16 NOT NULL,
+ `r` varchar(10) CHARACTER SET utf16 NOT 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 DEFAULT ''
+ `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84);
INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080);
@@ -1254,6 +1254,8 @@ insert into t1 values ('-1234.1e2xxxx');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
insert into t1 values ('-1234.1e2 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
select * from t1;
a
-123410
@@ -1262,6 +1264,8 @@ a
drop table t1;
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');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
@@ -1415,7 +1419,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 DEFAULT ''
+ `a` varchar(64) CHARACTER SET utf16 NOT 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;
@@ -1464,7 +1468,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 DEFAULT ''
+ `s1` varchar(2) CHARACTER SET utf16 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE');
SELECT * FROM t1 ORDER BY s1;
@@ -1549,7 +1553,7 @@ 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 (1048576) - truncated
+Warning 1301 Result of space() was larger than max_allowed_packet (4194304) - truncated
#
# Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT
#
@@ -1596,7 +1600,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf16 NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET utf16 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -1616,7 +1620,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET utf16 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -1846,7 +1850,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_bin NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -1866,7 +1870,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET utf16 COLLATE utf16_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -2127,3 +2131,64 @@ DEALLOCATE PREPARE stmt;
#
# End of 10.0 tests
#
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character"
+#
+CREATE TABLE t1 (
+id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+a VARCHAR(10) CHARACTER SET utf16, KEY(a,id)
+);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0x61);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0xC280),(_utf8mb4 0xDFBF);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0xE0A080),(_utf8mb4 0xEFBFBF);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0xF0908080),(_utf8mb4 0xF48FBFBF);
+SELECT id,HEX(a) FROM t1 ORDER BY a,id;
+id HEX(a)
+1 0061
+2 0080
+3 07FF
+4 0800
+6 D800DC00
+7 DBFFDFFF
+5 FFFF
+SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
+id HEX(a)
+5 FFFF
+7 DBFFDFFF
+6 D800DC00
+4 0800
+3 07FF
+2 0080
+1 0061
+SELECT COUNT(DISTINCT a) FROM t1;
+COUNT(DISTINCT a)
+6
+ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf16 COLLATE utf16_bin;
+SELECT id,HEX(a) FROM t1 ORDER BY a;
+id HEX(a)
+1 0061
+2 0080
+3 07FF
+4 0800
+5 FFFF
+6 D800DC00
+7 DBFFDFFF
+SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
+id HEX(a)
+7 DBFFDFFF
+6 D800DC00
+5 FFFF
+4 0800
+3 07FF
+2 0080
+1 0061
+SELECT COUNT(DISTINCT a) FROM t1;
+COUNT(DISTINCT a)
+7
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/ctype_utf16_uca.result b/mysql-test/r/ctype_utf16_uca.result
index e3ba73a9047..ac2ed9b2c5b 100644
--- a/mysql-test/r/ctype_utf16_uca.result
+++ b/mysql-test/r/ctype_utf16_uca.result
@@ -3045,8 +3045,8 @@ 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 DEFAULT '',
- `b` int(1) NOT NULL DEFAULT '0'
+ `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_unicode_ci NOT NULL,
+ `b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
SELECT * FROM t1 ORDER BY a, b;
@@ -3208,7 +3208,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_unicode_ci NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET utf16 COLLATE utf16_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -3695,8 +3695,8 @@ 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 DEFAULT '',
- `b` int(1) NOT NULL DEFAULT '0'
+ `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_german2_ci NOT NULL,
+ `b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
SELECT * FROM t1 ORDER BY a, b;
@@ -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 DEFAULT ''
+ `c` varchar(10) CHARACTER SET utf16 COLLATE utf16_unicode_520_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_utf32 0x0180),(_utf32 0x023A);
INSERT INTO t1 VALUES (_utf32 0x023B),(_utf32 0x023C);
@@ -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 DEFAULT '',
+ `s1` varchar(64) CHARACTER SET utf16 COLLATE utf16_myanmar_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 (s1) VALUES
diff --git a/mysql-test/r/ctype_utf16le.result b/mysql-test/r/ctype_utf16le.result
index 8098b0d1666..a2d3ffb793f 100644
--- a/mysql-test/r/ctype_utf16le.result
+++ b/mysql-test/r/ctype_utf16le.result
@@ -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 DEFAULT '',
- `r` varchar(10) CHARACTER SET utf16le NOT NULL DEFAULT ''
+ `l` varchar(10) CHARACTER SET utf16le NOT NULL,
+ `r` varchar(10) CHARACTER SET utf16le NOT 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 DEFAULT ''
+ `a` varchar(1) CHARACTER SET utf16le COLLATE utf16le_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84);
INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080);
@@ -1474,6 +1474,8 @@ INSERT INTO t1 VALUES ('-1234.1e2xxxx');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
INSERT INTO t1 VALUES ('-1234.1e2 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
INSERT INTO t1 VALUES ('123');
INSERT INTO t1 VALUES ('-124');
INSERT INTO t1 VALUES ('+125');
@@ -1520,6 +1522,8 @@ DROP TABLE t1;
#
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');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
@@ -1686,7 +1690,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 DEFAULT ''
+ `a` varchar(64) CHARACTER SET utf16le NOT 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;
@@ -1737,7 +1741,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 DEFAULT ''
+ `s1` varchar(2) CHARACTER SET utf16le NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE');
SELECT * FROM t1 ORDER BY s1;
@@ -1809,7 +1813,7 @@ ALTER TABLE t1 ADD PRIMARY KEY(c);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c` varchar(10) CHARACTER SET utf16le COLLATE utf16le_bin NOT NULL DEFAULT '',
+ `c` varchar(10) CHARACTER SET utf16le COLLATE utf16le_bin NOT NULL,
PRIMARY KEY (`c`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('abc'),('zyx'),('acb');
@@ -1830,7 +1834,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf16le NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET utf16le NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -1850,7 +1854,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET utf16le NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -2080,7 +2084,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf16le COLLATE utf16le_bin NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET utf16le COLLATE utf16le_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -2100,7 +2104,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET utf16le COLLATE utf16le_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -2319,3 +2323,64 @@ DFFFFFDFFFFF9CFFFF9DFFFF9EFFFF
#
# End of 5.6 tests
#
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character"
+#
+CREATE TABLE t1 (
+id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+a VARCHAR(10) CHARACTER SET utf16le, KEY(a,id)
+);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0x61);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0xC280),(_utf8mb4 0xDFBF);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0xE0A080),(_utf8mb4 0xEFBFBF);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0xF0908080),(_utf8mb4 0xF48FBFBF);
+SELECT id,HEX(a) FROM t1 ORDER BY a,id;
+id HEX(a)
+1 6100
+2 8000
+3 FF07
+4 0008
+6 00D800DC
+7 FFDBFFDF
+5 FFFF
+SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
+id HEX(a)
+5 FFFF
+7 FFDBFFDF
+6 00D800DC
+4 0008
+3 FF07
+2 8000
+1 6100
+SELECT COUNT(DISTINCT a) FROM t1;
+COUNT(DISTINCT a)
+6
+ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf16le COLLATE utf16le_bin;
+SELECT id,HEX(a) FROM t1 ORDER BY a;
+id HEX(a)
+1 6100
+2 8000
+3 FF07
+4 0008
+5 FFFF
+6 00D800DC
+7 FFDBFFDF
+SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
+id HEX(a)
+7 FFDBFFDF
+6 00D800DC
+5 FFFF
+4 0008
+3 FF07
+2 8000
+1 6100
+SELECT COUNT(DISTINCT a) FROM t1;
+COUNT(DISTINCT a)
+7
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result
index 0ec89a50c0f..16e045d0fbb 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 DEFAULT '',
- `r` varchar(10) CHARACTER SET utf32 NOT NULL DEFAULT ''
+ `l` varchar(10) CHARACTER SET utf32 NOT NULL,
+ `r` varchar(10) CHARACTER SET utf32 NOT 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 DEFAULT ''
+ `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84);
INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080);
@@ -1252,6 +1252,8 @@ insert into t1 values ('-1234.1e2xxxx');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
insert into t1 values ('-1234.1e2 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
select * from t1;
a
-123410
@@ -1260,6 +1262,8 @@ a
drop table t1;
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');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
@@ -1363,7 +1367,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 DEFAULT ''
+ `a` varchar(64) CHARACTER SET utf32 NOT 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;
@@ -1478,7 +1482,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 DEFAULT ''
+ `s1` varchar(2) CHARACTER SET utf32 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE');
SELECT * FROM t1 ORDER BY s1;
@@ -1571,7 +1575,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 DEFAULT ''
+ `format(123,2,'no_NO')` varchar(37) CHARACTER SET utf32 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t1;
format(123,2,'no_NO')
@@ -1675,7 +1679,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf32 NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET utf32 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -1695,7 +1699,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET utf32 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -1925,7 +1929,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_bin NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -1945,7 +1949,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET utf32 COLLATE utf32_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -2206,3 +2210,21 @@ DEALLOCATE PREPARE stmt;
#
# End of 10.0 tests
#
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8419 utf32: compare broken bytes as "greater than any non-broken character"
+#
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf32, KEY(a));
+INSERT INTO t1 VALUES (0x10000),(0x10001),(0x10002);
+SELECT COUNT(DISTINCT a) FROM t1;
+COUNT(DISTINCT a)
+1
+DROP TABLE t1;
+SELECT _utf32 0x10001=_utf32 0x10002;
+_utf32 0x10001=_utf32 0x10002
+1
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/ctype_utf32_uca.result b/mysql-test/r/ctype_utf32_uca.result
index d2032d401df..89a9e23bf45 100644
--- a/mysql-test/r/ctype_utf32_uca.result
+++ b/mysql-test/r/ctype_utf32_uca.result
@@ -3045,8 +3045,8 @@ 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 DEFAULT '',
- `b` int(1) NOT NULL DEFAULT '0'
+ `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL,
+ `b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
SELECT * FROM t1 ORDER BY a, b;
@@ -3228,7 +3228,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -3715,8 +3715,8 @@ 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 DEFAULT '',
- `b` int(1) NOT NULL DEFAULT '0'
+ `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_german2_ci NOT NULL,
+ `b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
SELECT * FROM t1 ORDER BY a, b;
@@ -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 DEFAULT ''
+ `c` varchar(10) CHARACTER SET utf32 COLLATE utf32_unicode_520_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_utf32 0x0180),(_utf32 0x023A);
INSERT INTO t1 VALUES (_utf32 0x023B),(_utf32 0x023C);
@@ -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 DEFAULT '',
+ `s1` varchar(64) CHARACTER SET utf32 COLLATE utf32_myanmar_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 (s1) VALUES
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index 6eae47844ca..3300def3964 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -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 DEFAULT '',
- `b` varchar(15) CHARACTER SET utf8 NOT NULL DEFAULT ''
+ `a` varchar(5) CHARACTER SET utf8 NOT NULL,
+ `b` varchar(15) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2;
drop table t1;
@@ -1126,8 +1126,8 @@ 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 DEFAULT '',
- `b` int(1) NOT NULL DEFAULT '0'
+ `a` varchar(1) CHARACTER SET utf8 NOT NULL,
+ `b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
SELECT * FROM t1 ORDER BY a, b;
@@ -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
-pattern varchar(64) NO
+subject varchar(64) NO NULL
+pattern varchar(64) NO 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)
@@ -2464,7 +2464,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -2477,7 +2477,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 DEFAULT ''
+ `c1` varchar(20) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -2490,7 +2490,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 DEFAULT ''
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -2503,7 +2503,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1-2));
@@ -2513,7 +2513,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1*2));
@@ -2523,7 +2523,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1/2));
@@ -2563,7 +2563,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(-(1+2)));
@@ -2573,7 +2573,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 DEFAULT ''
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1|2));
@@ -2583,7 +2583,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1&2));
@@ -2593,7 +2593,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(bit_count(12)));
@@ -2603,7 +2603,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(2<<1));
@@ -2613,7 +2613,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(2>>1));
@@ -2623,7 +2623,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(~0));
@@ -2633,7 +2633,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(3^2));
@@ -2643,7 +2643,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(abs(-2)));
@@ -2653,7 +2653,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(left(concat(exp(2)),1));
@@ -2783,7 +2783,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 DEFAULT ''
+ `c1` varchar(23) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(radians(0)));
@@ -2793,7 +2793,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 DEFAULT ''
+ `c1` varchar(23) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ceiling(0.5)));
@@ -2803,7 +2803,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 DEFAULT ''
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(floor(0.5)));
@@ -2813,7 +2813,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 DEFAULT ''
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(round(0.5)));
@@ -2823,7 +2823,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sign(0.5)));
@@ -2833,14 +2833,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET utf8 NOT 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 DEFAULT ''
+ `c1` varchar(23) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(length('a')));
@@ -2850,7 +2850,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(char_length('a')));
@@ -2860,7 +2860,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(bit_length('a')));
@@ -2870,7 +2870,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(coercibility('a')));
@@ -2880,7 +2880,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(locate('a','a')));
@@ -2890,7 +2890,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 DEFAULT ''
+ `c1` varchar(11) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(field('c','a','b','c')));
@@ -2900,7 +2900,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ascii(61)));
@@ -2910,7 +2910,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ord(61)));
@@ -2920,7 +2920,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(find_in_set('b','a,b,c,d')));
@@ -2930,7 +2930,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select md5('a'), hex(md5('a'));
@@ -2940,7 +2940,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 DEFAULT ''
+ `c1` varchar(32) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select old_password('a'), hex(old_password('a'));
@@ -2950,7 +2950,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 DEFAULT ''
+ `c1` varchar(16) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select password('a'), hex(password('a'));
@@ -2960,7 +2960,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 DEFAULT ''
+ `c1` varchar(41) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select sha('a'), hex(sha('a'));
@@ -2970,7 +2970,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 DEFAULT ''
+ `c1` varchar(40) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select sha1('a'), hex(sha1('a'));
@@ -2980,7 +2980,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 DEFAULT ''
+ `c1` varchar(40) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast('-1' as signed)));
@@ -2990,7 +2990,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast('1' as unsigned)));
@@ -3000,7 +3000,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast(1/2 as decimal(5,5))));
@@ -3059,7 +3059,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(greatest(1,2)));
@@ -3069,7 +3069,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(case when 11 then 22 else 33 end));
@@ -3079,7 +3079,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(coalesce(1,2)));
@@ -3089,7 +3089,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat_ws(1,2,3));
@@ -3099,7 +3099,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(group_concat(1,2,3));
@@ -3127,7 +3127,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(benchmark(0,0)));
@@ -3137,7 +3137,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sleep(0)));
@@ -3147,7 +3147,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(is_free_lock('xxxx')));
@@ -3181,7 +3181,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(uncompressed_length('')));
@@ -3198,7 +3198,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(inet_aton('127.1.1.1')));
@@ -3234,7 +3234,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(found_rows()));
@@ -3244,21 +3244,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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET utf8 NOT 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 DEFAULT ''
+ `c1` varchar(21) CHARACTER SET utf8 NOT 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 DEFAULT ''
+ `c1` varchar(36) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select coercibility(uuid()), coercibility(cast('a' as char character set latin1));
@@ -3271,7 +3271,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 DEFAULT ''
+ `c1` varchar(37) NOT 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,8 +3291,8 @@ hex(c1)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '',
- `c2` int(1) NOT NULL DEFAULT '0'
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL,
+ `c2` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @a2=1;
@@ -3349,8 +3349,8 @@ hex(c1)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '',
- `c2` decimal(2,1) NOT NULL DEFAULT '0.0'
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL,
+ `c2` decimal(2,1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @a2=1.1;
@@ -3388,7 +3388,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a'='a' IS NOT TRUE));
@@ -3398,7 +3398,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(NOT 'a'='a'));
@@ -3408,7 +3408,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' IS NULL));
@@ -3418,7 +3418,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' IS NOT NULL));
@@ -3428,7 +3428,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' rlike 'a'));
@@ -3438,7 +3438,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(strcmp('a','b')));
@@ -3448,7 +3448,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' like 'a'));
@@ -3458,7 +3458,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' between 'b' and 'c'));
@@ -3468,7 +3468,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' in ('a','b')));
@@ -3478,7 +3478,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(interval(23, 1, 15, 17, 30, 44, 200)));
@@ -3488,7 +3488,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a varchar(10), fulltext key(a));
@@ -3510,7 +3510,7 @@ create table t1 as select ifnull(1,'a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ifnull(1,1)));
@@ -3520,7 +3520,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ifnull(1.1,1.1)));
@@ -3530,7 +3530,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 DEFAULT ''
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(if(1,'b',1));
@@ -3540,7 +3540,7 @@ create table t1 as select if(1,'b',1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(if(1,1,'b'));
@@ -3550,7 +3550,7 @@ create table t1 as select if(1,1,'b') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(if(1,1,1)));
@@ -3560,7 +3560,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(nullif(1,2)));
@@ -3640,7 +3640,7 @@ create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))));
@@ -3650,7 +3650,7 @@ create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))));
@@ -3725,7 +3725,7 @@ 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 DEFAULT ''
+ `c1` varchar(6) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(period_diff(200902, 200802)));
@@ -3737,7 +3737,7 @@ Warning 1265 Data truncated for column 'c1' at row 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(6) CHARACTER SET utf8 NOT NULL DEFAULT ''
+ `c1` varchar(6) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(to_days(20090224)));
@@ -3934,21 +3934,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 NOT 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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 NOT 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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select repeat('a',20) as c1 limit 0;
@@ -3964,7 +3964,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sec_to_time(2378)));
@@ -4057,21 +4057,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 DEFAULT ''
+ `c1` varchar(19) CHARACTER SET utf8 NOT 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 DEFAULT ''
+ `c1` varchar(19) CHARACTER SET utf8 NOT 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 DEFAULT ''
+ `c1` varchar(19) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(addtime('00:00:00','11:22:33')));
@@ -4111,7 +4111,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 DEFAULT ''
+ `c1` varchar(127) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(insert(1133,3,0,22));
@@ -4121,7 +4121,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 DEFAULT ''
+ `c1` varchar(6) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lcase(123));
@@ -4131,7 +4131,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(left(123,1));
@@ -4141,7 +4141,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lower(123));
@@ -4151,7 +4151,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 DEFAULT ''
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lpad(1,2,0));
@@ -4161,7 +4161,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(ltrim(1));
@@ -4171,7 +4171,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(mid(1,1,1));
@@ -4181,7 +4181,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(repeat(1,2));
@@ -4191,7 +4191,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(replace(1,1,2));
@@ -4201,7 +4201,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(reverse(12));
@@ -4211,7 +4211,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(right(123,1));
@@ -4221,7 +4221,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(rpad(1,2,0));
@@ -4231,7 +4231,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 DEFAULT ''
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(rtrim(1));
@@ -4241,7 +4241,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(soundex(1));
@@ -4251,7 +4251,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 DEFAULT ''
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(substring(1,1,1));
@@ -4261,7 +4261,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(trim(1));
@@ -4271,7 +4271,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(ucase(1));
@@ -4281,7 +4281,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(upper(1));
@@ -4291,14 +4291,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 DEFAULT ''
+ `c1` varchar(1) CHARACTER SET utf8 NOT 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 DEFAULT ''
+ `a` varchar(64) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ("1.1"), ("2.1");
select a, hex(a) from t1;
@@ -4548,7 +4548,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 DEFAULT ''
+ `concat(a)` varchar(19) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1 (a date);
@@ -5088,7 +5088,7 @@ SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`CONCAT(a)` varchar(9) CHARACTER SET utf8 DEFAULT NULL,
- `IFNULL(a,'')` varchar(9) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `IFNULL(a,'')` varchar(9) CHARACTER SET utf8 NOT NULL,
`IF(a,a,'')` varchar(9) CHARACTER SET utf8 DEFAULT NULL,
`CASE WHEN a THEN a ELSE '' END` varchar(9) CHARACTER SET utf8 DEFAULT NULL,
`COALESCE(a,'')` varchar(9) CHARACTER SET utf8 DEFAULT NULL
@@ -5098,14 +5098,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 DEFAULT ''
+ `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET utf8 NOT 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 DEFAULT ''
+ `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT LCASE(a) FROM t1;
@@ -5126,35 +5126,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 DEFAULT ''
+ `REPEAT(1,2)` varchar(2) CHARACTER SET utf8 NOT 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 DEFAULT ''
+ `LEFT(123,2)` varchar(2) CHARACTER SET utf8 NOT 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 DEFAULT ''
+ `RIGHT(123,2)` varchar(2) CHARACTER SET utf8 NOT 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 DEFAULT ''
+ `LTRIM(123)` varchar(3) CHARACTER SET utf8 NOT 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 DEFAULT ''
+ `RTRIM(123)` varchar(3) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1;
@@ -5168,35 +5168,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 DEFAULT ''
+ `REPLACE(111,2,3)` varchar(3) CHARACTER SET utf8 NOT 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 DEFAULT ''
+ `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET utf8 NOT 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 DEFAULT ''
+ `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET utf8 NOT 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 DEFAULT ''
+ `SOUNDEX(1)` varchar(4) CHARACTER SET utf8 NOT 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 DEFAULT ''
+ `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
DROP TABLE t1;
@@ -5433,7 +5433,7 @@ ADD KEY(ch);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `ch` varchar(60) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `ch` varchar(60) CHARACTER SET utf8 NOT NULL,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`),
KEY `ch` (`ch`)
@@ -5460,10 +5460,22 @@ SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
ch
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
ch
+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 NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
+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;
ch
Warnings:
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 NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
+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;
ch
Warnings:
@@ -5506,6 +5518,12 @@ ab
az
aЀ
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
+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;
ch
a
@@ -5527,6 +5545,12 @@ aЀ
aÖ€
Warnings:
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
+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;
ch
a
@@ -5554,11 +5578,23 @@ z
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
ch
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
+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;
ch
z
Warnings:
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
+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;
ch
z
@@ -5594,11 +5630,11 @@ a?z
ab
az
aЀ
+aÖ€
SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch');
PREPARE stmt FROM @query;
EXECUTE stmt;
ch
-aÖ€
z
# 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence
SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch');
@@ -5641,7 +5677,7 @@ ADD KEY(ch);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `ch` varchar(60) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `ch` varchar(60) CHARACTER SET utf8 NOT NULL,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`),
KEY `ch` (`ch`)
@@ -5668,10 +5704,22 @@ SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
ch
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
ch
+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 NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
+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;
ch
Warnings:
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 NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
+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;
ch
Warnings:
@@ -5714,6 +5762,12 @@ ab
az
aЀ
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
+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;
ch
a
@@ -5735,6 +5789,12 @@ aЀ
aÖ€
Warnings:
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
+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;
ch
a
@@ -5762,11 +5822,23 @@ z
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
ch
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
+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;
ch
z
Warnings:
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
+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;
ch
z
@@ -5802,11 +5874,11 @@ a?z
ab
az
aЀ
+aÖ€
SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch');
PREPARE stmt FROM @query;
EXECUTE stmt;
ch
-aÖ€
z
# 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence
SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch');
@@ -5849,7 +5921,7 @@ ADD KEY(ch);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `ch` varchar(60) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `ch` varchar(60) CHARACTER SET utf8 NOT NULL,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`),
KEY `ch` (`ch`)
@@ -5876,10 +5948,22 @@ SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
ch
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
ch
+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 NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
+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;
ch
Warnings:
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 NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
+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;
ch
Warnings:
@@ -5922,6 +6006,10 @@ ab
az
aЀ
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 ALL ch NULL NULL NULL # Using where; Using filesort
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
ch
a
@@ -5941,6 +6029,10 @@ ab
az
aЀ
aÖ€
+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 ALL ch NULL NULL NULL # Using where; Using filesort
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
ch
a
@@ -5966,9 +6058,17 @@ z
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
ch
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 ALL ch NULL NULL NULL # Using where; Using filesort
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
ch
z
+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 ALL ch NULL NULL NULL # Using where; Using filesort
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
ch
z
@@ -6002,11 +6102,11 @@ a?z
ab
az
aЀ
+aÖ€
SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch');
PREPARE stmt FROM @query;
EXECUTE stmt;
ch
-aÖ€
z
# 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence
SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch');
@@ -6040,6 +6140,21 @@ DROP TABLE t1;
# End of ctype_utf8_ilseq.inc
#
#
+# MDEV-8067 correct fix for MySQL Bug # 19699237: UNINITIALIZED VARIABLE IN ITEM_FIELD::STR_RESULT
+#
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8);
+CREATE TABLE t2 (a VARCHAR(10) CHARACTER SET latin1);
+INSERT INTO t1 VALUES ('aaa');
+INSERT INTO t2 VALUES ('aaa');
+SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2);
+(SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2)
+1
+INSERT INTO t1 VALUES ('aaa');
+INSERT INTO t2 VALUES ('aaa');
+SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2);
+ERROR 21000: Subquery returns more than 1 row
+DROP TABLE t1, t2;
+#
# End of 5.5 tests
#
#
@@ -6056,7 +6171,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -6076,7 +6191,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -6300,7 +6415,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -6320,7 +6435,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -6572,7 +6687,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE CONCAT(c1)='a';
@@ -6595,7 +6710,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
@@ -6618,7 +6733,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '% '=CONCAT(c1);
@@ -6641,7 +6756,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '%'=CONCAT(c1);
@@ -6660,6 +6775,31 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
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'
+#
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
+a LENGTH(a)
+a 1
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
+a LENGTH(a)
+a 1
+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 '))))
+DROP TABLE t1;
+#
+# End of MDEV-8694
+#
SET NAMES utf8;
#
# MDEV-7149 Constant condition propagation erroneously applied for LIKE
@@ -6668,7 +6808,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE CONCAT(c1)='a';
@@ -6691,7 +6831,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
@@ -6714,7 +6854,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '% '=CONCAT(c1);
@@ -6737,7 +6877,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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '%'=CONCAT(c1);
@@ -6757,13 +6897,38 @@ Warnings:
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'
+#
+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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
+a LENGTH(a)
+a 1
+SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
+a LENGTH(a)
+a 1
+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'))
+DROP TABLE t1;
+#
+# End of MDEV-8694
+#
+#
# MDEV-7149 Constant condition propagation erroneously applied for LIKE
#
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 DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('ae'),('ä');
SELECT * FROM t1 WHERE c1='ä';
@@ -9970,5 +10135,68 @@ SET NAMES utf8;
SELECT * FROM `testðŸ˜ðŸ˜test`;
ERROR HY000: Invalid utf8 character string: 'test\xF0\x9F\x98\x81\xF0\x9F\x98\x81test'
#
+#MDEV-8256 A part of a ROW comparison is erroneously optimized away
+#
+SET NAMES utf8;
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8);
+INSERT INTO t1 VALUES ('1e1'),('1é1');
+SELECT * FROM t1 WHERE a=10;
+a
+1e1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1é1'
+SELECT * FROM t1 WHERE a='1e1';
+a
+1e1
+1é1
+SELECT * FROM t1 WHERE a=10 AND a='1e1';
+a
+1e1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1é1'
+SELECT * FROM t1 WHERE (a,a)=(10,'1e1');
+a
+1e1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1é1'
+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'))
+DROP TABLE t1;
+#
+# MDEV-8688 Wrong result for SELECT..WHERE varchar_column IN (1,2,3) AND varchar_column=' 1';
+#
+SET NAMES utf8;
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
+INSERT INTO t1 VALUES ('1e1'),('1ë1');
+SELECT * FROM t1 WHERE a IN (1,2);
+a
+1ë1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1ë1'
+SELECT * FROM t1 WHERE a IN (1,2) AND a='1ë1';
+a
+1ë1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1ë1'
+SELECT * FROM t1 WHERE a IN (1,2,'x') AND a='1ë1';
+a
+1ë1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1ë1'
+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)))
+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')))
+DROP TABLE IF EXISTS t1;
+#
# End of 10.1 tests
#
diff --git a/mysql-test/r/ctype_utf8mb4.result b/mysql-test/r/ctype_utf8mb4.result
index 3894d58bf23..abdec24bf37 100644
--- a/mysql-test/r/ctype_utf8mb4.result
+++ b/mysql-test/r/ctype_utf8mb4.result
@@ -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 DEFAULT '',
- `b` varchar(15) CHARACTER SET utf8mb4 NOT NULL DEFAULT ''
+ `a` varchar(5) CHARACTER SET utf8mb4 NOT NULL,
+ `b` varchar(15) CHARACTER SET utf8mb4 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2;
drop table t1;
@@ -1126,8 +1126,8 @@ 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 DEFAULT '',
- `b` int(1) NOT NULL DEFAULT '0'
+ `a` varchar(1) CHARACTER SET utf8mb4 NOT NULL,
+ `b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
SELECT * FROM t1 ORDER BY a, b;
@@ -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 DEFAULT ''
+ `a` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84);
INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080);
@@ -2667,7 +2667,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 DEFAULT ''
+ `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TEMPORARY TABLE t3;
SELECT * FROM t1, t2 WHERE t1.utf8mb4 > t2.utf8mb3;
@@ -2822,7 +2822,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf8mb4 NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET utf8mb4 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -2842,7 +2842,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET utf8mb4 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -3066,7 +3066,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT ''
+ `a` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -3086,7 +3086,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 DEFAULT ''
+ `a` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT 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_utf8mb4_heap.result b/mysql-test/r/ctype_utf8mb4_heap.result
index 52030d62047..5f77d417fe5 100644
--- a/mysql-test/r/ctype_utf8mb4_heap.result
+++ b/mysql-test/r/ctype_utf8mb4_heap.result
@@ -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 DEFAULT '',
- `b` varchar(15) CHARACTER SET utf8mb4 NOT NULL DEFAULT ''
+ `a` varchar(5) CHARACTER SET utf8mb4 NOT NULL,
+ `b` varchar(15) CHARACTER SET utf8mb4 NOT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
drop table t2;
drop table t1;
@@ -1065,8 +1065,8 @@ 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 DEFAULT '',
- `b` int(1) NOT NULL DEFAULT '0'
+ `a` varchar(1) CHARACTER SET utf8mb4 NOT NULL,
+ `b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
SELECT * FROM t1 ORDER BY a, b;
@@ -2468,7 +2468,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 DEFAULT ''
+ `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 NOT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
DROP TEMPORARY TABLE t3;
SELECT * FROM t1, t2 WHERE t1.utf8mb4 > t2.utf8mb3;
@@ -2495,5 +2495,66 @@ DROP TABLE t1;
# End of 5.5 tests
#
#
-# End of tests
+# ctype_utf8mb4.inc: Start of 10.1 tests
+#
+#
+# MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character"
+#
+CREATE TABLE t1 (
+id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+a VARCHAR(10) CHARACTER SET utf8mb4, KEY(a,id)
+);
+INSERT INTO t1 (a) VALUES (0x61);
+INSERT INTO t1 (a) VALUES (0xC280),(0xDFBF);
+INSERT INTO t1 (a) VALUES (0xE0A080),(0xEFBFBF);
+INSERT INTO t1 (a) VALUES (0xF0908080),(0xF48FBFBF);
+SELECT id,HEX(a) FROM t1 ORDER BY a,id;
+id HEX(a)
+1 61
+2 C280
+3 DFBF
+4 E0A080
+6 F0908080
+7 F48FBFBF
+5 EFBFBF
+SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
+id HEX(a)
+5 EFBFBF
+7 F48FBFBF
+6 F0908080
+4 E0A080
+3 DFBF
+2 C280
+1 61
+SELECT COUNT(DISTINCT a) FROM t1;
+COUNT(DISTINCT a)
+6
+ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
+SELECT id,HEX(a) FROM t1 ORDER BY a;
+id HEX(a)
+1 61
+2 C280
+3 DFBF
+4 E0A080
+5 EFBFBF
+6 F0908080
+7 F48FBFBF
+SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
+id HEX(a)
+7 F48FBFBF
+6 F0908080
+5 EFBFBF
+4 E0A080
+3 DFBF
+2 C280
+1 61
+SELECT COUNT(DISTINCT a) FROM t1;
+COUNT(DISTINCT a)
+7
+DROP TABLE t1;
+#
+# ctype_utf8mb4.inc: End of 10.1 tests
+#
+#
+# End of ctype_utf8mb4.inc
#
diff --git a/mysql-test/r/ctype_utf8mb4_innodb.result b/mysql-test/r/ctype_utf8mb4_innodb.result
index 243c000b6c4..fc1d2b9d315 100644
--- a/mysql-test/r/ctype_utf8mb4_innodb.result
+++ b/mysql-test/r/ctype_utf8mb4_innodb.result
@@ -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 DEFAULT '',
- `b` varchar(15) CHARACTER SET utf8mb4 NOT NULL DEFAULT ''
+ `a` varchar(5) CHARACTER SET utf8mb4 NOT NULL,
+ `b` varchar(15) CHARACTER SET utf8mb4 NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t2;
drop table t1;
@@ -1126,8 +1126,8 @@ 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 DEFAULT '',
- `b` int(1) NOT NULL DEFAULT '0'
+ `a` varchar(1) CHARACTER SET utf8mb4 NOT NULL,
+ `b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
SELECT * FROM t1 ORDER BY a, b;
@@ -2615,7 +2615,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 DEFAULT ''
+ `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TEMPORARY TABLE t3;
SELECT * FROM t1, t2 WHERE t1.utf8mb4 > t2.utf8mb3;
@@ -2642,5 +2642,66 @@ DROP TABLE t1;
# End of 5.5 tests
#
#
-# End of tests
+# ctype_utf8mb4.inc: Start of 10.1 tests
+#
+#
+# MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character"
+#
+CREATE TABLE t1 (
+id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+a VARCHAR(10) CHARACTER SET utf8mb4, KEY(a,id)
+);
+INSERT INTO t1 (a) VALUES (0x61);
+INSERT INTO t1 (a) VALUES (0xC280),(0xDFBF);
+INSERT INTO t1 (a) VALUES (0xE0A080),(0xEFBFBF);
+INSERT INTO t1 (a) VALUES (0xF0908080),(0xF48FBFBF);
+SELECT id,HEX(a) FROM t1 ORDER BY a,id;
+id HEX(a)
+1 61
+2 C280
+3 DFBF
+4 E0A080
+6 F0908080
+7 F48FBFBF
+5 EFBFBF
+SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
+id HEX(a)
+5 EFBFBF
+7 F48FBFBF
+6 F0908080
+4 E0A080
+3 DFBF
+2 C280
+1 61
+SELECT COUNT(DISTINCT a) FROM t1;
+COUNT(DISTINCT a)
+6
+ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
+SELECT id,HEX(a) FROM t1 ORDER BY a;
+id HEX(a)
+1 61
+2 C280
+3 DFBF
+4 E0A080
+5 EFBFBF
+6 F0908080
+7 F48FBFBF
+SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
+id HEX(a)
+7 F48FBFBF
+6 F0908080
+5 EFBFBF
+4 E0A080
+3 DFBF
+2 C280
+1 61
+SELECT COUNT(DISTINCT a) FROM t1;
+COUNT(DISTINCT a)
+7
+DROP TABLE t1;
+#
+# ctype_utf8mb4.inc: End of 10.1 tests
+#
+#
+# End of ctype_utf8mb4.inc
#
diff --git a/mysql-test/r/ctype_utf8mb4_myisam.result b/mysql-test/r/ctype_utf8mb4_myisam.result
index acdd6d36af7..a033138a6fe 100644
--- a/mysql-test/r/ctype_utf8mb4_myisam.result
+++ b/mysql-test/r/ctype_utf8mb4_myisam.result
@@ -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 DEFAULT '',
- `b` varchar(15) CHARACTER SET utf8mb4 NOT NULL DEFAULT ''
+ `a` varchar(5) CHARACTER SET utf8mb4 NOT NULL,
+ `b` varchar(15) CHARACTER SET utf8mb4 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2;
drop table t1;
@@ -1126,8 +1126,8 @@ 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 DEFAULT '',
- `b` int(1) NOT NULL DEFAULT '0'
+ `a` varchar(1) CHARACTER SET utf8mb4 NOT NULL,
+ `b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
SELECT * FROM t1 ORDER BY a, b;
@@ -2615,7 +2615,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 DEFAULT ''
+ `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TEMPORARY TABLE t3;
SELECT * FROM t1, t2 WHERE t1.utf8mb4 > t2.utf8mb3;
@@ -2642,5 +2642,66 @@ DROP TABLE t1;
# End of 5.5 tests
#
#
-# End of tests
+# ctype_utf8mb4.inc: Start of 10.1 tests
+#
+#
+# MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character"
+#
+CREATE TABLE t1 (
+id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+a VARCHAR(10) CHARACTER SET utf8mb4, KEY(a,id)
+);
+INSERT INTO t1 (a) VALUES (0x61);
+INSERT INTO t1 (a) VALUES (0xC280),(0xDFBF);
+INSERT INTO t1 (a) VALUES (0xE0A080),(0xEFBFBF);
+INSERT INTO t1 (a) VALUES (0xF0908080),(0xF48FBFBF);
+SELECT id,HEX(a) FROM t1 ORDER BY a,id;
+id HEX(a)
+1 61
+2 C280
+3 DFBF
+4 E0A080
+6 F0908080
+7 F48FBFBF
+5 EFBFBF
+SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
+id HEX(a)
+5 EFBFBF
+7 F48FBFBF
+6 F0908080
+4 E0A080
+3 DFBF
+2 C280
+1 61
+SELECT COUNT(DISTINCT a) FROM t1;
+COUNT(DISTINCT a)
+6
+ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
+SELECT id,HEX(a) FROM t1 ORDER BY a;
+id HEX(a)
+1 61
+2 C280
+3 DFBF
+4 E0A080
+5 EFBFBF
+6 F0908080
+7 F48FBFBF
+SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
+id HEX(a)
+7 F48FBFBF
+6 F0908080
+5 EFBFBF
+4 E0A080
+3 DFBF
+2 C280
+1 61
+SELECT COUNT(DISTINCT a) FROM t1;
+COUNT(DISTINCT a)
+7
+DROP TABLE t1;
+#
+# ctype_utf8mb4.inc: End of 10.1 tests
+#
+#
+# End of ctype_utf8mb4.inc
#
diff --git a/mysql-test/r/ctype_utf8mb4_uca.result b/mysql-test/r/ctype_utf8mb4_uca.result
index ef18272ca24..1057b9743f4 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 DEFAULT '',
+ `s1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_myanmar_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 (s1) VALUES
diff --git a/mysql-test/r/ddl_i18n_koi8r.result b/mysql-test/r/ddl_i18n_koi8r.result
index a57b1369d24..d81b6af0aeb 100644
--- a/mysql-test/r/ddl_i18n_koi8r.result
+++ b/mysql-test/r/ddl_i18n_koi8r.result
@@ -1,3 +1,4 @@
+set sql_mode="";
set names koi8r;
-------------------------------------------------------------------
diff --git a/mysql-test/r/ddl_i18n_utf8.result b/mysql-test/r/ddl_i18n_utf8.result
index 5409e58e774..5921a7f538d 100644
--- a/mysql-test/r/ddl_i18n_utf8.result
+++ b/mysql-test/r/ddl_i18n_utf8.result
@@ -1,3 +1,4 @@
+set sql_mode="";
set names utf8;
-------------------------------------------------------------------
diff --git a/mysql-test/r/default.result b/mysql-test/r/default.result
index 2ec961a4ce9..685b534b808 100644
--- a/mysql-test/r/default.result
+++ b/mysql-test/r/default.result
@@ -1,5 +1,6 @@
drop table if exists t1,t2,t3,t4,t5,t6;
drop database if exists mysqltest;
+set sql_mode="";
CREATE TABLE t1 (a varchar(30) binary NOT NULL DEFAULT ' ',
b varchar(1) binary NOT NULL DEFAULT ' ',
c varchar(4) binary NOT NULL DEFAULT '0000',
@@ -29,6 +30,7 @@ z varchar(20) binary NOT NULL DEFAULT ' ',
a1 varchar(30) binary NOT NULL DEFAULT ' ',
b1 tinyblob NULL)
ENGINE=InnoDB DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin;
+set sql_mode=default;
INSERT into t1 (b) values ('1');
SHOW WARNINGS;
Level Code Message
diff --git a/mysql-test/r/delete_returning_grant.result b/mysql-test/r/delete_returning_grant.result
index c15d3627a39..bdd171940ba 100644
--- a/mysql-test/r/delete_returning_grant.result
+++ b/mysql-test/r/delete_returning_grant.result
@@ -1,3 +1,5 @@
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
CREATE TABLE t1 (a int(11), b varchar(32));
INSERT INTO t1 VALUES (7,'ggggggg'),(1,'a'),(3,'ccc'),(4,'dddd'),(1,'A'),
(2,'BB'),(4,'DDDD'),(5,'EEEEE'),(7,'GGGGGGG'),(2,'bb');
@@ -67,3 +69,4 @@ DROP DATABASE mysqltest;
DROP USER mysqltest_1@localhost;
DROP VIEW v1;
DROP TABLE t1;
+set GLOBAL sql_mode=default;
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
index b34415a7822..a59f8a6dfee 100644
--- a/mysql-test/r/derived.result
+++ b/mysql-test/r/derived.result
@@ -566,7 +566,31 @@ insert into t1 (accountId,balance) values
update t1 set balance=(select sum(balance) from (SELECT balance FROM t1 where accountId like 'dealer%') AS copied) where accountId = 'OPERATOR';
set optimizer_switch=@save_derived_optimizer_switch_bug;
drop table t1;
-set optimizer_switch=@save_derived_optimizer_switch;
+#
+# MDEV-6219:Server crashes in Bitmap<64u>::merge
+# (this=0x180, map2=...) on 2nd execution of PS with INSERT .. SELECT,
+# derived_merge
+#
+CREATE TABLE t1 (a VARCHAR(8)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('foo'),('bar');
+create procedure p1()
+INSERT INTO t1 SELECT * FROM (
+SELECT * FROM t1
+) AS sq
+WHERE sq.a IN ( SELECT 'baz' FROM DUAL );
+call p1();
+call p1();
+drop procedure p1;
+PREPARE stmt FROM "
+ INSERT INTO t1 SELECT * FROM (
+ SELECT * FROM t1
+ ) AS sq
+ WHERE sq.a IN ( SELECT 'baz' FROM DUAL )
+";
+EXECUTE stmt;
+EXECUTE stmt;
+deallocate prepare stmt;
+drop table t1;
#
# MDEV-6892: WHERE does not apply
#
@@ -579,3 +603,49 @@ select x.id, message from (select id from t1) x left join
where coalesce(message,0) <> 0;
id message
drop table t1,t2;
+set optimizer_switch=@save_derived_optimizer_switch;
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8747 Wrong result for SELECT..WHERE derived_table_column='a' AND derived_table_column<>_latin1'A' COLLATE latin1_bin
+#
+CREATE TABLE t1 (a VARCHAR(10));
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT * FROM t1 WHERE a='a' AND a <> _latin1'A' COLLATE latin1_bin;
+a
+a
+SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a='a' AND a <> _latin1'A' COLLATE latin1_bin;
+a
+a
+DROP TABLE t1;
+CREATE TABLE t1 (a ENUM('5','6'));
+INSERT INTO t1 VALUES ('5'),('6');
+SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a='5';
+a
+5
+SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a=1;
+a
+5
+SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a='5' AND a=1;
+a
+5
+DROP TABLE t1;
+#
+# MDEV-8749 Wrong result for SELECT..WHERE derived_table_enum_column='number' AND derived_table_enum_column OP number2
+#
+CREATE TABLE t1 (a ENUM('5','6'));
+INSERT INTO t1 VALUES ('5'),('6');
+SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a='5';
+a
+5
+SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a=1;
+a
+5
+SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a='5' AND a=1;
+a
+5
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result
index fa0a69a487d..639942f0da9 100644
--- a/mysql-test/r/derived_view.result
+++ b/mysql-test/r/derived_view.result
@@ -2262,10 +2262,7 @@ CREATE TABLE IF NOT EXISTS `galleries` (
`year` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-Warnings:
-Warning 1286 Unknown storage engine 'InnoDB'
-Warning 1266 Using storage engine MyISAM for table 'galleries'
+) DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `pictures` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
@@ -2278,10 +2275,7 @@ CREATE TABLE IF NOT EXISTS `pictures` (
`type` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `gallery_id` (`gallery_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
-Warnings:
-Warning 1286 Unknown storage engine 'InnoDB'
-Warning 1266 Using storage engine MyISAM for table 'pictures'
+) DEFAULT CHARSET=utf8 ;
ALTER TABLE `pictures`
ADD CONSTRAINT `pictures_ibfk_1` FOREIGN KEY (`gallery_id`) REFERENCES `galleries` (`id`);
INSERT INTO `galleries` (`id`, `name`, `year`) VALUES
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index 34c702e15f3..d6e5a69e217 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -744,7 +744,7 @@ a a b
1 1 3
DROP TABLE t1;
End of 5.0 tests
-CREATE TABLE t1(a INT, b INT, c INT, d INT, e INT,
+CREATE TABLE t1(a INT, b INT, c INT, d INT default 0, e INT default 0,
PRIMARY KEY(a,b,c,d,e),
KEY(a,b,d,c)
);
diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result
index cc4e8074395..04ab385bca6 100644
--- a/mysql-test/r/dyncol.result
+++ b/mysql-test/r/dyncol.result
@@ -1455,6 +1455,12 @@ Warnings:
Warning 1918 Encountered illegal value '18446744073709552001' when converting to INT
Note 1105 Cast to signed converted positive out-of-range integer to it's negative complement
#
+# 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.
+#
# test of symbolic names
#
# creation test (names)
diff --git a/mysql-test/r/empty_server_name-8224.result b/mysql-test/r/empty_server_name-8224.result
new file mode 100644
index 00000000000..4bf592c8932
--- /dev/null
+++ b/mysql-test/r/empty_server_name-8224.result
@@ -0,0 +1,2 @@
+create server '' foreign data wrapper w2 options (host '127.0.0.1');
+drop server '';
diff --git a/mysql-test/r/enforce_storage_engine.result b/mysql-test/r/enforce_storage_engine.result
index 3b29d5ecb09..6b5e1f6958b 100644
--- a/mysql-test/r/enforce_storage_engine.result
+++ b/mysql-test/r/enforce_storage_engine.result
@@ -1,3 +1,5 @@
+set local sql_mode="";
+set global sql_mode="";
drop table if exists t1;
SET SESSION enforce_storage_engine=MyISAM;
select @@session.enforce_storage_engine;
@@ -98,5 +100,55 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`c1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
+SET GLOBAL enforce_storage_engine=Memory;
+SET SESSION sql_mode='';
+select @@session.enforce_storage_engine;
+@@session.enforce_storage_engine
+MEMORY
+select @@global.enforce_storage_engine;
+@@global.enforce_storage_engine
+MEMORY
+CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10));
+Warnings:
+Note 1266 Using storage engine MEMORY for table 't1'
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+DROP TABLE t1;
+set global sql_mode=default;
+SET SESSION enforce_storage_engine=NULL;
+SET GLOBAL enforce_storage_engine=NULL;
+CREATE TABLE t3 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM;
+INSERT INTO t3 values (NULL, 'test');
+SET SESSION enforce_storage_engine=Memory;
+ALTER TABLE t3 ENGINE=MyISAM;
+Warnings:
+Note 1266 Using storage engine MEMORY for table 't3'
+SHOW CREATE TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
+DROP TABLE t3;
+SET SESSION enforce_storage_engine=NULL;
+CREATE TABLE t3 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM;
+INSERT INTO t3 values (NULL, 'test');
+SET SESSION enforce_storage_engine=Memory;
+ALTER TABLE t3 ADD COLUMN c3 INT;
+SHOW CREATE TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ `c3` int(11) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
+DROP TABLE t3;
+SET SESSION enforce_storage_engine=NULL;
SET GLOBAL enforce_storage_engine=NULL;
-ERROR HY000: Variable 'enforce_storage_engine' is a SESSION variable and can't be used with SET GLOBAL
diff --git a/mysql-test/r/enforce_storage_engine_opt.result b/mysql-test/r/enforce_storage_engine_opt.result
index a28461ef091..1b03aa281d9 100644
--- a/mysql-test/r/enforce_storage_engine_opt.result
+++ b/mysql-test/r/enforce_storage_engine_opt.result
@@ -1,3 +1,4 @@
+SET SQL_MODE="";
create table t1 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory;
Warnings:
Note 1266 Using storage engine MyISAM for table 't1'
diff --git a/mysql-test/r/events_1.result b/mysql-test/r/events_1.result
index 5a64cf14ef5..78115497fc6 100644
--- a/mysql-test/r/events_1.result
+++ b/mysql-test/r/events_1.result
@@ -1,3 +1,4 @@
+set sql_mode="";
call mtr.add_suppression("Column count of mysql.event is wrong. Expected .*, found .*\. The table is probably corrupted");
drop database if exists events_test;
drop database if exists db_x;
diff --git a/mysql-test/r/events_2.result b/mysql-test/r/events_2.result
index 3b7f3566cab..9a1f9d954e8 100644
--- a/mysql-test/r/events_2.result
+++ b/mysql-test/r/events_2.result
@@ -1,3 +1,4 @@
+set sql_mode="";
drop database if exists events_test;
create database events_test;
use events_test;
diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result
index 7ce3c740cd4..3de6a6e48fc 100644
--- a/mysql-test/r/events_bugs.result
+++ b/mysql-test/r/events_bugs.result
@@ -1,3 +1,4 @@
+SET SQL_MODE="";
drop database if exists events_test;
drop database if exists mysqltest_db1;
drop database if exists mysqltest_db2;
diff --git a/mysql-test/r/events_trans.result b/mysql-test/r/events_trans.result
index 084587079ba..873f0441089 100644
--- a/mysql-test/r/events_trans.result
+++ b/mysql-test/r/events_trans.result
@@ -1,3 +1,4 @@
+set sql_mode="";
drop database if exists events_test;
drop database if exists mysqltest_no_such_database;
create database events_test;
diff --git a/mysql-test/r/events_trans_notembedded.result b/mysql-test/r/events_trans_notembedded.result
index 1e3dfffe232..fb68bc9ceab 100644
--- a/mysql-test/r/events_trans_notembedded.result
+++ b/mysql-test/r/events_trans_notembedded.result
@@ -2,6 +2,7 @@ drop database if exists events_test;
drop database if exists mysqltest_db2;
create database events_test;
use events_test;
+create user mysqltest_user1@localhost;
grant create, insert, select, delete on mysqltest_db2.*
to mysqltest_user1@localhost;
create database mysqltest_db2;
diff --git a/mysql-test/r/explain_json.result b/mysql-test/r/explain_json.result
index e08cd9780fd..07ff72b4208 100644
--- a/mysql-test/r/explain_json.result
+++ b/mysql-test/r/explain_json.result
@@ -293,14 +293,17 @@ EXPLAIN
},
"subqueries": [
{
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100,
- "attached_condition": "(t1.b = t0.a)"
+ "expression_cache": {
+ "state": "uninitialized",
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "(t1.b = t0.a)"
+ }
}
}
}
@@ -323,14 +326,17 @@ EXPLAIN
},
"subqueries": [
{
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100,
- "attached_condition": "(t1.b = t0.a)"
+ "expression_cache": {
+ "state": "uninitialized",
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "(t1.b = t0.a)"
+ }
}
}
}
@@ -365,7 +371,7 @@ EXPLAIN
"attached_condition": "(tbl2.b < 5)"
},
"buffer_type": "flat",
- "buffer_size": "128Kb",
+ "buffer_size": "256Kb",
"join_type": "BNL",
"attached_condition": "(tbl2.a = tbl1.a)"
}
@@ -632,7 +638,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
- "buffer_size": "128Kb",
+ "buffer_size": "256Kb",
"join_type": "BNL"
}
}
@@ -666,7 +672,7 @@ EXPLAIN
"first_match": "t2"
},
"buffer_type": "flat",
- "buffer_size": "128Kb",
+ "buffer_size": "256Kb",
"join_type": "BNL",
"attached_condition": "((t1.b = t2.b) and (t1.a = t2.a))"
}
@@ -703,7 +709,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
- "buffer_size": "128Kb",
+ "buffer_size": "256Kb",
"join_type": "BNL",
"attached_condition": "((t1.b = t2.b) and (t1.a = t2.a))"
}
@@ -816,7 +822,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
- "buffer_size": "128Kb",
+ "buffer_size": "256Kb",
"join_type": "BNL",
"attached_condition": "((t2.b <> outer_t1.a) and trigcond(((<cache>(outer_t1.a) = t1.a) or isnull(t1.a))))"
}
@@ -867,7 +873,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
- "buffer_size": "128Kb",
+ "buffer_size": "256Kb",
"join_type": "BNL",
"attached_condition": "(tbl2.b = tbl1.b)"
}
@@ -1064,3 +1070,43 @@ EXPLAIN
}
}
drop table t1;
+#
+# MDEV-8786 Wrong result for SELECT FORMAT=JSON * FROM t1 WHERE a=_latin1 0xDF
+#
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
+INSERT INTO t1 VALUES ('a'),('b');
+EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE a=_latin1 0xDF;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "(t1.a = _latin1'\xDF')"
+ }
+ }
+}
+DROP TABLE t1;
+#
+# MDEV-8785 Wrong results for EXPLAIN EXTENDED...WHERE NULLIF(latin1_col, _utf8'a' COLLATE utf8_bin) IS NOT NULL
+#
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
+INSERT INTO t1 VALUES ('a'),('A');
+EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE NULLIF(a,_utf8'a' COLLATE utf8_bin);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "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)"
+ }
+ }
+}
+DROP TABLE t1;
diff --git a/mysql-test/r/features.result b/mysql-test/r/features.result
index 04e0df98ec7..52650d118b3 100644
--- a/mysql-test/r/features.result
+++ b/mysql-test/r/features.result
@@ -1,4 +1,5 @@
drop table if exists t1;
+set sql_mode="";
flush status;
show status like "feature%";
Variable_name Value
diff --git a/mysql-test/r/fix_priv_tables.result b/mysql-test/r/fix_priv_tables.result
index e54330a5520..dea1ccdbd18 100644
--- a/mysql-test/r/fix_priv_tables.result
+++ b/mysql-test/r/fix_priv_tables.result
@@ -1,4 +1,5 @@
drop table if exists t1,t1aa,t2aa;
+set sql_mode="";
DROP DATABASE IF EXISTS testdb;
CREATE DATABASE testdb;
CREATE TABLE testdb.t1 (
diff --git a/mysql-test/r/flush-innodb-notembedded.result b/mysql-test/r/flush-innodb-notembedded.result
index 817d57d9d79..911abfe6daf 100644
--- a/mysql-test/r/flush-innodb-notembedded.result
+++ b/mysql-test/r/flush-innodb-notembedded.result
@@ -1,3 +1,4 @@
+set sql_mode="";
# Test 7: Check privileges required.
#
CREATE DATABASE db1;
diff --git a/mysql-test/r/flush2.result b/mysql-test/r/flush2.result
index 13bcc371ef6..ff5d8755f01 100644
--- a/mysql-test/r/flush2.result
+++ b/mysql-test/r/flush2.result
@@ -3,10 +3,32 @@ set global expire_logs_days = 3;
show variables like 'log_bin%';
Variable_name Value
log_bin OFF
+log_bin_basename
+log_bin_index
log_bin_trust_function_creators ON
+show variables like 'relay_log%';
+Variable_name Value
+relay_log mysqld-relay-bin
+relay_log_basename MYSQLTEST_VARDIR/mysqld.1/data/mysqld-relay-bin
+relay_log_index MYSQLTEST_VARDIR/mysqld.1/data/mysqld-relay-bin.index
+relay_log_info_file relay-log.info
+relay_log_purge ON
+relay_log_recovery OFF
+relay_log_space_limit 0
flush logs;
show variables like 'log_bin%';
Variable_name Value
log_bin OFF
+log_bin_basename
+log_bin_index
log_bin_trust_function_creators ON
+show variables like 'relay_log%';
+Variable_name Value
+relay_log mysqld-relay-bin
+relay_log_basename MYSQLTEST_VARDIR/mysqld.1/data/mysqld-relay-bin
+relay_log_index MYSQLTEST_VARDIR/mysqld.1/data/mysqld-relay-bin.index
+relay_log_info_file relay-log.info
+relay_log_purge ON
+relay_log_recovery OFF
+relay_log_space_limit 0
set global expire_logs_days = 0;
diff --git a/mysql-test/r/flush_read_lock.result b/mysql-test/r/flush_read_lock.result
index c2e8531d01f..260edf8e51d 100644
--- a/mysql-test/r/flush_read_lock.result
+++ b/mysql-test/r/flush_read_lock.result
@@ -1,3 +1,5 @@
+set global sql_mode="";
+set local sql_mode="";
# FTWRL takes two global metadata locks -- a global shared
# metadata lock and the commit blocker lock.
# The first lock prevents DDL from taking place.
@@ -1667,3 +1669,4 @@ drop database `#mysql50#mysqltest-2`;
drop database mysqltest1;
drop temporary tables t1_temp, t2_temp;
drop tables t1_base, t2_base, t3_trans;
+set global sql_mode=default;
diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result
index 9fde006b377..e9c8193685b 100644
--- a/mysql-test/r/func_compress.result
+++ b/mysql-test/r/func_compress.result
@@ -1,3 +1,4 @@
+set global max_allowed_packet=1048576;
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
@@ -72,6 +73,9 @@ set @@global.max_allowed_packet=1048576*100;
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
set @@global.max_allowed_packet=default;
create table t1(a blob);
insert into t1 values(NULL), (compress('a'));
@@ -152,6 +156,7 @@ UNCOMPRESS(CAST(0 AS BINARY(5)))
NULL
Warnings:
Warning 1259 ZLIB: Input data corrupted
+set global max_allowed_packet=default;
#
# End of 5.5 tests
#
diff --git a/mysql-test/r/func_encrypt.result b/mysql-test/r/func_encrypt.result
index 91ff4e218fb..f5e03a90327 100644
--- a/mysql-test/r/func_encrypt.result
+++ b/mysql-test/r/func_encrypt.result
@@ -190,3 +190,21 @@ insert into t1 values (null,'contraction\'s');
insert into t1 values (-15818,'requirement\'s');
select encrypt(f1,f2) as a from t1,(select encrypt(f1,f2) as b from t1) a;
drop table t1;
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8369 Unexpected impossible WHERE for a condition on a ZEROFILL field
+#
+CREATE TABLE t1 (a INT(6) ZEROFILL);
+INSERT INTO t1 VALUES (1),(2);
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE a=1 AND DES_ENCRYPT('test',a)=_latin1 'abc' 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` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and (des_encrypt('test',`test`.`t1`.`a`) = 'abc'))
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index f12a0c1127a..0bc31a5e85b 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -1103,3 +1103,19 @@ ORDER BY field;
field
c,c
drop table t3, t2, t1;
+#
+# MDEV-7821 - Server crashes in Item_func_group_concat::fix_fields on 2nd
+# execution of PS
+#
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES(1),(2);
+PREPARE stmt FROM "SELECT GROUP_CONCAT(t1a.a ORDER BY 1, t1a.a=0) FROM t1 AS t1a, t1 AS t1b GROUP BY t1a.a";
+EXECUTE stmt;
+GROUP_CONCAT(t1a.a ORDER BY 1, t1a.a=0)
+1,1
+2,2
+EXECUTE stmt;
+GROUP_CONCAT(t1a.a ORDER BY 1, t1a.a=0)
+1,1
+2,2
+DROP TABLE t1;
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index ac076ec4348..c407e7bb875 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -787,7 +787,7 @@ drop table t2;
create table t2 select f2 from (select now() f2 from t1) a;
show columns from t2;
Field Type Null Key Default Extra
-f2 datetime NO 0000-00-00 00:00:00
+f2 datetime NO NULL
drop table t2, t1;
CREATE TABLE t1(
id int PRIMARY KEY,
diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result
index 51817c24932..33a997c8004 100644
--- a/mysql-test/r/func_in.result
+++ b/mysql-test/r/func_in.result
@@ -812,3 +812,27 @@ EXECUTE s;
1
DROP TABLE t1;
# End of 5.3 tests
+#
+# MDEV-8755 Equal field propagation is not performed any longer for the IN list when multiple comparison types
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+# Ok to propagate equalities into the left IN argument in case of a single comparison type
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND a IN (1,2,3);
+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)
+# 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)
+# 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')))
+DROP TABLE t1;
diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result
index 2fdcf1226b7..9c8e9727d16 100644
--- a/mysql-test/r/func_like.result
+++ b/mysql-test/r/func_like.result
@@ -227,5 +227,30 @@ 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))
DROP TABLE t1;
#
+# MDEV-8599 "WHERE varchar_field LIKE temporal_const" does not use range optimizer
+#
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1, KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('00:00:00');
+INSERT INTO t1 VALUES ('00:00:01');
+INSERT INTO t1 VALUES ('00:00:02');
+INSERT INTO t1 VALUES ('00:00:03');
+INSERT INTO t1 VALUES ('00:00:04');
+INSERT INTO t1 VALUES ('00:00:05');
+INSERT INTO t1 VALUES ('00:00:06');
+INSERT INTO t1 VALUES ('00:00:07');
+EXPLAIN SELECT * FROM t1 WHERE a LIKE '00:00:00';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 13 NULL 1 Using where; Using index
+EXPLAIN SELECT * FROM t1 WHERE a LIKE TIME'00:00:00';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 13 NULL 1 Using where; Using index
+SELECT * FROM t1 WHERE a LIKE '00:00:00';
+a
+00:00:00
+SELECT * FROM t1 WHERE a LIKE TIME'00:00:00';
+a
+00:00:00
+DROP TABLE t1;
+#
# End of 10.1 tests
#
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index 3631af8a22f..c49e55d503a 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -165,7 +165,7 @@ create table t1 select round(1, 6);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `round(1, 6)` int(1) NOT NULL DEFAULT '0'
+ `round(1, 6)` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t1;
round(1, 6)
@@ -214,7 +214,9 @@ CAST(RAND(2) * 1000 AS UNSIGNED) CAST(RAND(?) * 1000 AS UNSIGNED)
122 122
645 645
DROP TABLE t1;
+set sql_mode="";
create table t1 (a varchar(90), ts datetime not null, index (a)) engine=innodb default charset=utf8;
+set sql_mode=default;
insert into t1 values ('http://www.foo.com/', now());
select a from t1 where a='http://www.foo.com/' order by abs(timediff(ts, 0));
a
@@ -474,8 +476,13 @@ CREATE TABLE t1(f1 LONGTEXT) engine=myisam;
INSERT INTO t1 VALUES ('a');
SELECT 1 FROM (SELECT ROUND(f1) AS a FROM t1) AS s WHERE a LIKE 'a';
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
SELECT 1 FROM (SELECT ROUND(f1, f1) AS a FROM t1) AS s WHERE a LIKE 'a';
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect INTEGER value: 'a'
DROP TABLE t1;
End of 5.0 tests
SELECT 1e308 + 1e308;
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index 7c01c8a0bde..a9548aa70e9 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -100,8 +100,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 DEFAULT '',
- `length(uuid())` int(10) NOT NULL DEFAULT '0'
+ `uuid()` varchar(36) CHARACTER SET utf8 NOT NULL,
+ `length(uuid())` int(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 select INET_ATON('255.255.0.1') as `a`;
@@ -334,10 +334,7 @@ CREATE TABLE t1 (a char(2) not null );
INSERT INTO t1 VALUES (4),(7),(1);
set @optimizer_switch_save= @@optimizer_switch;
set optimizer_switch='materialization=off';
-CREATE TABLE tv (e char(2) not null ) engine=mysql;
-Warnings:
-Warning 1286 Unknown storage engine 'mysql'
-Warning 1266 Using storage engine MyISAM for table 'tv'
+CREATE TABLE tv (e char(2) not null );
INSERT INTO tv VALUES (1);
CREATE ALGORITHM=MERGE VIEW v_merge AS SELECT * FROM tv;
CREATE ALGORITHM=MERGE VIEW vm AS SELECT * FROM tv;
@@ -361,6 +358,19 @@ set optimizer_switch=@optimizer_switch_save;
drop view v_merge, vm;
drop table t1,tv;
#
+# MDEV-4017 - GET_LOCK() with negative timeouts has strange behavior
+#
+SELECT GET_LOCK('ul1', NULL);
+GET_LOCK('ul1', NULL)
+NULL
+Warnings:
+Warning 1411 Incorrect timeout value: 'NULL' for function get_lock
+SELECT GET_LOCK('ul1', -1);
+GET_LOCK('ul1', -1)
+NULL
+Warnings:
+Warning 1411 Incorrect timeout value: '-1' for function get_lock
+#
# GET_LOCK, RELEASE_LOCK, IS_USED_LOCK functions test
#
# IS_USED_LOCK, IS_FREE_LOCK: the lock is not acquired
diff --git a/mysql-test/r/func_regexp_pcre.result b/mysql-test/r/func_regexp_pcre.result
index 641c4fddbf7..d114cccaf72 100644
--- a/mysql-test/r/func_regexp_pcre.result
+++ b/mysql-test/r/func_regexp_pcre.result
@@ -448,7 +448,7 @@ CREATE TABLE t1 AS SELECT REGEXP_REPLACE('abc','b','x')+0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `REGEXP_REPLACE('abc','b','x')+0` double NOT NULL DEFAULT '0'
+ `REGEXP_REPLACE('abc','b','x')+0` double NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
SELECT REGEXP_REPLACE(NULL,'b','c');
@@ -736,7 +736,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 DEFAULT ''
+ `REGEXP_SUBSTR('abc','b')` varchar(3) CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
EXPLAIN EXTENDED SELECT REGEXP_SUBSTR('abc','b');
@@ -748,7 +748,7 @@ CREATE TABLE t1 AS SELECT REGEXP_SUBSTR('abc','b')+0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `REGEXP_SUBSTR('abc','b')+0` double NOT NULL DEFAULT '0'
+ `REGEXP_SUBSTR('abc','b')+0` double NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
SELECT REGEXP_SUBSTR('See https://mariadb.org/en/foundation/ for details', 'https?://[^/]*');
@@ -845,3 +845,32 @@ SET default_regex_flags=DEFAULT;
SELECT REGEXP_REPLACE('1 foo and bar', '(\\d+) foo and (\\d+ )?bar', '\\1 this and \\2that');
REGEXP_REPLACE('1 foo and bar', '(\\d+) foo and (\\d+ )?bar', '\\1 this and \\2that')
1 this and that
+#
+# MDEV-8102 REGEXP function fails to match hex values when expression is stored as a variable
+#
+# Testing a warning
+SET NAMES latin1;
+SET @regCheck= '\\xE0\\x01';
+SELECT 0xE001 REGEXP @regCheck;
+0xE001 REGEXP @regCheck
+0
+Warnings:
+Warning 1139 Got error 'pcre_exec: Invalid utf8 byte sequence in the subject string' from regexp
+# Testing workaround N1: This makes the pattern to be a binary string:
+SET NAMES latin1;
+SET @regCheck= X'E001';
+SELECT 0xE001 REGEXP @regCheck;
+0xE001 REGEXP @regCheck
+1
+# Testing workaround N2: This also makes the pattern to be a binary string, using a different syntax:
+SET NAMES latin1;
+SET @regCheck= _binary '\\xE0\\x01';
+SELECT 0xE001 REGEXP @regCheck;
+0xE001 REGEXP @regCheck
+1
+# Testing workarond N3: This makes derivation of the subject string stronger (IMLICIT instead of COERCIBLE)
+SET NAMES latin1;
+SET @regCheck= '\\xE0\\x01';
+SELECT CAST(0xE001 AS BINARY) REGEXP @regCheck;
+CAST(0xE001 AS BINARY) REGEXP @regCheck
+1
diff --git a/mysql-test/r/func_regexp_pcre_debug.result b/mysql-test/r/func_regexp_pcre_debug.result
new file mode 100644
index 00000000000..e44492fca72
--- /dev/null
+++ b/mysql-test/r/func_regexp_pcre_debug.result
@@ -0,0 +1,10 @@
+SET debug_dbug='+d,pcre_exec_error_123';
+SELECT 'a' RLIKE 'a';
+'a' RLIKE 'a'
+0
+Warnings:
+Warning 1139 Got error 'pcre_exec: Internal error (-123)' from regexp
+SET debug_dbug='';
+SELECT 'a' RLIKE 'a';
+'a' RLIKE 'a'
+1
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index bc5f6951184..d392da84ea7 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -1,4 +1,5 @@
drop table if exists t1,t2;
+set global max_allowed_packet=1048576;
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
@@ -264,6 +265,9 @@ NULL
select aes_decrypt(aes_encrypt("","a"),"a");
aes_decrypt(aes_encrypt("","a"),"a")
+select aes_decrypt("", "a");
+aes_decrypt("", "a")
+NULL
select repeat('monty',5),concat('*',space(5),'*');
repeat('monty',5) concat('*',space(5),'*')
montymontymontymontymonty * *
@@ -723,34 +727,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 DEFAULT '',
- `char(130)` varbinary(4) NOT NULL DEFAULT '',
- `format(130,10)` varchar(37) NOT NULL DEFAULT '',
- `left(_latin2'a',1)` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `right(_latin2'a',1)` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `lcase(_latin2'a')` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `ucase(_latin2'a')` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `substring(_latin2'a',1,1)` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `concat(_latin2'a',_latin2'b')` varchar(2) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `lpad(_latin2'a',4,_latin2'b')` varchar(4) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `rpad(_latin2'a',4,_latin2'b')` varchar(4) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `concat_ws(_latin2'a',_latin2'b')` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `make_set(255,_latin2'a',_latin2'b',_latin2'c')` varchar(5) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `export_set(255,_latin2'y',_latin2'n',_latin2' ')` varchar(127) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `trim(_latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `ltrim(_latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `rtrim(_latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `trim(LEADING _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `trim(TRAILING _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `trim(BOTH _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `repeat(_latin2'a',10)` varchar(10) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `reverse(_latin2'ab')` varchar(2) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `quote(_latin2'ab')` varchar(6) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `soundex(_latin2'ab')` varchar(4) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `substring(_latin2'ab',1)` varchar(2) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `insert(_latin2'abcd',2,3,_latin2'ef')` varchar(6) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `replace(_latin2'abcd',_latin2'b',_latin2'B')` varchar(4) CHARACTER SET latin2 NOT NULL DEFAULT '',
- `encode('abcd','ab')` varbinary(4) NOT NULL DEFAULT ''
+ `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
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a char character set latin2);
@@ -2845,7 +2849,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 DEFAULT ''
+ `format(123,2,'no_NO')` varchar(37) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t1;
format(123,2,'no_NO')
@@ -2889,6 +2893,8 @@ NULL
SELECT ((127.1) not in ((rpad(1.0,2048,1)),(''),(-1.1)));
((127.1) not in ((rpad(1.0,2048,1)),(''),(-1.1)))
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
SELECT ((0xf3) * (rpad(1.0,2048,1)) << (0xcc));
((0xf3) * (rpad(1.0,2048,1)) << (0xcc))
0
@@ -2977,7 +2983,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 DEFAULT ''
+ `to_base64` varchar(85) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -2999,7 +3005,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 DEFAULT ''
+ `to_base64` varchar(85) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3021,7 +3027,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 DEFAULT ''
+ `to_base64` varchar(85) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3043,7 +3049,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 DEFAULT ''
+ `to_base64` varchar(81) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3065,7 +3071,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 DEFAULT ''
+ `to_base64` varchar(81) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3087,7 +3093,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 DEFAULT ''
+ `to_base64` varchar(81) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3109,7 +3115,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 DEFAULT ''
+ `to_base64` varchar(76) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3130,7 +3136,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 DEFAULT ''
+ `to_base64` varchar(76) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3151,7 +3157,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 DEFAULT ''
+ `to_base64` varchar(76) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3172,7 +3178,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 DEFAULT ''
+ `to_base64` varchar(72) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3193,7 +3199,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 DEFAULT ''
+ `to_base64` varchar(72) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3214,7 +3220,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 DEFAULT ''
+ `to_base64` varchar(72) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3235,7 +3241,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 DEFAULT ''
+ `to_base64` varchar(68) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3256,7 +3262,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 DEFAULT ''
+ `to_base64` varchar(68) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3277,7 +3283,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 DEFAULT ''
+ `to_base64` varchar(68) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3298,7 +3304,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 DEFAULT ''
+ `to_base64` varchar(64) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3319,7 +3325,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 DEFAULT ''
+ `to_base64` varchar(64) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3340,7 +3346,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 DEFAULT ''
+ `to_base64` varchar(64) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3361,7 +3367,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 DEFAULT ''
+ `to_base64` varchar(60) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3382,7 +3388,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 DEFAULT ''
+ `to_base64` varchar(60) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3403,7 +3409,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 DEFAULT ''
+ `to_base64` varchar(60) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3424,7 +3430,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 DEFAULT ''
+ `to_base64` varchar(56) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3445,7 +3451,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 DEFAULT ''
+ `to_base64` varchar(56) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3466,7 +3472,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 DEFAULT ''
+ `to_base64` varchar(56) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3487,7 +3493,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 DEFAULT ''
+ `to_base64` varchar(52) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3508,7 +3514,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 DEFAULT ''
+ `to_base64` varchar(52) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3529,7 +3535,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 DEFAULT ''
+ `to_base64` varchar(52) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3550,7 +3556,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 DEFAULT ''
+ `to_base64` varchar(48) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3571,7 +3577,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 DEFAULT ''
+ `to_base64` varchar(48) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3592,7 +3598,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 DEFAULT ''
+ `to_base64` varchar(48) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3613,7 +3619,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 DEFAULT ''
+ `to_base64` varchar(44) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3634,7 +3640,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 DEFAULT ''
+ `to_base64` varchar(44) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3655,7 +3661,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 DEFAULT ''
+ `to_base64` varchar(44) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3676,7 +3682,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 DEFAULT ''
+ `to_base64` varchar(40) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3697,7 +3703,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 DEFAULT ''
+ `to_base64` varchar(40) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3718,7 +3724,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 DEFAULT ''
+ `to_base64` varchar(40) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3739,7 +3745,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 DEFAULT ''
+ `to_base64` varchar(36) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3760,7 +3766,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 DEFAULT ''
+ `to_base64` varchar(36) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3781,7 +3787,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 DEFAULT ''
+ `to_base64` varchar(36) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3802,7 +3808,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 DEFAULT ''
+ `to_base64` varchar(32) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3823,7 +3829,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 DEFAULT ''
+ `to_base64` varchar(32) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3844,7 +3850,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 DEFAULT ''
+ `to_base64` varchar(32) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3865,7 +3871,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 DEFAULT ''
+ `to_base64` varchar(28) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3886,7 +3892,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 DEFAULT ''
+ `to_base64` varchar(28) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3907,7 +3913,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 DEFAULT ''
+ `to_base64` varchar(28) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3928,7 +3934,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 DEFAULT ''
+ `to_base64` varchar(24) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3949,7 +3955,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 DEFAULT ''
+ `to_base64` varchar(24) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3970,7 +3976,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 DEFAULT ''
+ `to_base64` varchar(24) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3991,7 +3997,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 DEFAULT ''
+ `to_base64` varchar(20) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4012,7 +4018,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 DEFAULT ''
+ `to_base64` varchar(20) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4033,7 +4039,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 DEFAULT ''
+ `to_base64` varchar(20) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4054,7 +4060,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 DEFAULT ''
+ `to_base64` varchar(16) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4075,7 +4081,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 DEFAULT ''
+ `to_base64` varchar(16) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4096,7 +4102,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 DEFAULT ''
+ `to_base64` varchar(16) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4117,7 +4123,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 DEFAULT ''
+ `to_base64` varchar(12) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4138,7 +4144,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 DEFAULT ''
+ `to_base64` varchar(12) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4159,7 +4165,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 DEFAULT ''
+ `to_base64` varchar(12) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4180,7 +4186,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 DEFAULT ''
+ `to_base64` varchar(8) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4201,7 +4207,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 DEFAULT ''
+ `to_base64` varchar(8) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4222,7 +4228,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 DEFAULT ''
+ `to_base64` varchar(8) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4243,7 +4249,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 DEFAULT ''
+ `to_base64` varchar(4) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4264,7 +4270,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 DEFAULT ''
+ `to_base64` varchar(4) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4285,7 +4291,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 DEFAULT ''
+ `to_base64` varchar(4) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4306,7 +4312,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 DEFAULT ''
+ `to_base64` char(0) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4527,6 +4533,34 @@ SET NAMES latin2;
EXECUTE stmt;
COLLATION(space(2))
latin2_general_ci
+set global max_allowed_packet=default;
#
# End of 5.6 tests
#
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8369 Unexpected impossible WHERE for a condition on a ZEROFILL field
+#
+CREATE TABLE t1 (a BIGINT(20) ZEROFILL);
+INSERT INTO t1 VALUES (18446744073709551615),(0);
+SELECT * FROM t1 WHERE a=18446744073709551615;
+a
+18446744073709551615
+SELECT * FROM t1 WHERE FORMAT(a,0)='18,446,744,073,709,551,615';
+a
+18446744073709551615
+SELECT * FROM t1 WHERE a=18446744073709551615 AND FORMAT(a,0)='18,446,744,073,709,551,615';
+a
+18446744073709551615
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE a=18446744073709551615 AND FORMAT(a,0)='18,446,744,073,709,551,615';
+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'))
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/func_system.result b/mysql-test/r/func_system.result
index 1452cf7e533..2fc0a59f5d2 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 DEFAULT '',
+ `user()` varchar(141) CHARACTER SET utf8 NOT 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 DEFAULT '',
- `collation(_utf8'a')` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''
+ `charset(_utf8'a')` varchar(64) CHARACTER SET utf8 NOT NULL,
+ `collation(_utf8'a')` varchar(64) CHARACTER SET utf8 NOT 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 97ef61047a5..af52a2b9149 100644
--- a/mysql-test/r/func_test.result
+++ b/mysql-test/r/func_test.result
@@ -337,3 +337,45 @@ Note 1003 select (strcmp('a','b') <> 0) AS `NOT NOT strcmp('a','b')`
#
# End of 10.0 tests
#
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8167 XOR returns bad results for an indexed column
+#
+CREATE TABLE t1 (
+id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
+k INTEGER UNSIGNED DEFAULT '0' NOT NULL,
+c CHAR(120) DEFAULT '' NOT NULL,
+pad CHAR(60) DEFAULT '' NOT NULL,
+PRIMARY KEY (id)
+) ENGINE=MyISAM;
+INSERT INTO t1 (k, c, pad) VALUES (10, 'a', 'xxx');
+INSERT INTO t1 (k, c, pad) VALUES (11, 'a', 'xxx');
+INSERT INTO t1 (k, c, pad) VALUES (12, 'a', 'xxx');
+INSERT INTO t1 (k, c, pad) VALUES (13, 'a', 'xxx');
+INSERT INTO t1 (k, c, pad) VALUES (14, 'a', 'xxx');
+INSERT INTO t1 (k, c, pad) VALUES (15, 'a', 'xxx');
+INSERT INTO t1 (k, c, pad) VALUES (16, 'a', 'xxx');
+SELECT * FROM t1 WHERE id XOR 0;
+id k c pad
+1 10 a xxx
+2 11 a xxx
+3 12 a xxx
+4 13 a xxx
+5 14 a xxx
+6 15 a xxx
+7 16 a xxx
+SELECT * FROM t1 IGNORE KEY(PRIMARY) WHERE id XOR 0;
+id k c pad
+1 10 a xxx
+2 11 a xxx
+3 12 a xxx
+4 13 a xxx
+5 14 a xxx
+6 15 a xxx
+7 16 a xxx
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 1943c511853..043350ce022 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -948,8 +948,8 @@ sec_to_time(1) + 0, from_unixtime(1) + 0;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `now() - now()` bigint(21) NOT NULL DEFAULT '0',
- `curtime() - curtime()` bigint(12) NOT NULL DEFAULT '0',
+ `now() - now()` bigint(21) NOT NULL,
+ `curtime() - curtime()` bigint(12) NOT NULL,
`sec_to_time(1) + 0` bigint(12) DEFAULT NULL,
`from_unixtime(1) + 0` bigint(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -1714,6 +1714,7 @@ min(timestampadd(month, 1>'', from_days('%Z')))
NULL
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '%Z'
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Incorrect datetime value: '0000-00-00'
create table t1(a time);
insert into t1 values ('00:00:00'),('00:01:00');
@@ -1823,8 +1824,6 @@ create table t1 (f1 datetime, key (f1));
insert into t1 values ('2000-09-12 00:00:00'), ('2007-04-25 05:08:49');
select * from t1 where f1 > time('-23:00:06');
f1
-2000-09-12 00:00:00
-2007-04-25 05:08:49
drop table t1;
select maketime(20,61,10)+0;
maketime(20,61,10)+0
@@ -2701,3 +2700,45 @@ id date1 date2 DATE_ADD(a.date1,INTERVAL -10 DAY) TO_DAYS(a.date1)-10
17 NULL NULL NULL NULL
18 2010-10-13 2010-10-03 2010-10-03 734413
DROP TABLE t1;
+#
+# Start of 10.0 tests
+#
+#
+# MDEV-8205 timediff returns null when comparing decimal time to time string value
+#
+SELECT
+TIMEDIFF('2014-01-01 00:00:00' , '2014-01-01 01:00:00' ) AS str_str,
+TIMEDIFF('2014-01-01 00:00:00' , 20140101010000.000 ) AS str_dec,
+TIMEDIFF(20140101000000.000 , 20140101010000.000 ) AS dec_dec,
+TIMEDIFF(20140101000000.000 , '2014-01-01 01:00:00' ) AS dec_str;
+str_str str_dec dec_dec dec_str
+-01:00:00 -01:00:00.000 -01:00:00.000 -01:00:00.000
+SELECT
+TIMEDIFF('2014-01-01 00:00:00' , '2014-01-02 01:00:00' ) AS str_str,
+TIMEDIFF('2014-01-01 00:00:00' , 20140102010000.000 ) AS str_dec,
+TIMEDIFF(20140101000000.000 , 20140102010000.000 ) AS dec_dec,
+TIMEDIFF(20140101000000.000 , '2014-01-02 01:00:00' ) AS dec_str;
+str_str str_dec dec_dec dec_str
+-25:00:00 -25:00:00.000 -25:00:00.000 -25:00:00.000
+SELECT
+TIMEDIFF('2014-01-01 00:00:00' , '2014-02-02 01:00:00' ) AS str_str,
+TIMEDIFF('2014-01-01 00:00:00' , 20140202010000.000 ) AS str_dec,
+TIMEDIFF(20140101000000.000 , 20140202010000.000 ) AS dec_dec,
+TIMEDIFF(20140101000000.000 , '2014-02-02 01:00:00' ) AS dec_str;
+str_str str_dec dec_dec dec_str
+-769:00:00 -769:00:00.000 -769:00:00.000 -769:00:00.000
+SELECT
+TIMEDIFF('2014-01-01 00:00:00' , '2014-03-02 01:00:00' ) AS str_str,
+TIMEDIFF('2014-01-01 00:00:00' , 20140302010000.000 ) AS str_dec,
+TIMEDIFF(20140101000000.000 , 20140302010000.000 ) AS dec_dec,
+TIMEDIFF(20140101000000.000 , '2014-03-02 01:00:00' ) AS dec_str;
+str_str str_dec dec_dec dec_str
+-838:59:59 -838:59:59.999 -838:59:59.999 -838:59:59.999
+Warnings:
+Warning 1292 Truncated incorrect time value: '-1441:00:00'
+Warning 1292 Truncated incorrect time value: '-1441:00:00'
+Warning 1292 Truncated incorrect time value: '-1441:00:00'
+Warning 1292 Truncated incorrect time value: '-1441:00:00'
+#
+# End of 10.0 tests
+#
diff --git a/mysql-test/r/func_time_hires.result b/mysql-test/r/func_time_hires.result
index 62004687c22..baa53b11fd6 100644
--- a/mysql-test/r/func_time_hires.result
+++ b/mysql-test/r/func_time_hires.result
@@ -39,14 +39,14 @@ t1 CREATE TABLE `t1` (
`sec_to_time(12345)` time DEFAULT NULL,
`sec_to_time(12345.6789)` time(4) DEFAULT NULL,
`sec_to_time(1234567e-2)` time(6) DEFAULT NULL,
- `now()` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `curtime(0)` time NOT NULL DEFAULT '00:00:00',
- `utc_timestamp(1)` datetime(1) NOT NULL DEFAULT '0000-00-00 00:00:00.0',
- `utc_time(2)` time(2) NOT NULL DEFAULT '00:00:00.00',
- `current_time(3)` time(3) NOT NULL DEFAULT '00:00:00.000',
- `current_timestamp(4)` datetime(4) NOT NULL DEFAULT '0000-00-00 00:00:00.0000',
- `localtime(5)` datetime(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000',
- `localtimestamp(6)` datetime(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000',
+ `now()` datetime NOT NULL,
+ `curtime(0)` time NOT NULL,
+ `utc_timestamp(1)` datetime(1) NOT NULL,
+ `utc_time(2)` time(2) NOT NULL,
+ `current_time(3)` time(3) NOT NULL,
+ `current_timestamp(4)` datetime(4) NOT NULL,
+ `localtime(5)` datetime(5) NOT NULL,
+ `localtimestamp(6)` datetime(6) NOT NULL,
`time_to_sec(123456)` bigint(17) DEFAULT NULL,
`time_to_sec('12:34:56.789')` decimal(19,3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
diff --git a/mysql-test/r/func_weight_string.result b/mysql-test/r/func_weight_string.result
index 91ca9f68076..e63ee4267ea 100644
--- a/mysql-test/r/func_weight_string.result
+++ b/mysql-test/r/func_weight_string.result
@@ -1,4 +1,5 @@
drop table if exists t1;
+set global max_allowed_packet=1048576;
set names latin1;
select hex(weight_string(0x010203));
hex(weight_string(0x010203))
@@ -90,3 +91,52 @@ 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
+set global max_allowed_packet=default;
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8369 Unexpected impossible WHERE for a condition on a ZEROFILL field
+#
+CREATE TABLE t1 (a INT(6) ZEROFILL);
+INSERT INTO t1 VALUES (1),(2);
+SELECT * FROM t1 WHERE a=1;
+a
+000001
+SELECT * FROM t1 WHERE WEIGHT_STRING(a) IS NULL;
+a
+000001
+000002
+SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
+a
+000001
+EXPLAIN EXTENDED
+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`)))
+ALTER TABLE t1 MODIFY a DOUBLE ZEROFILL;
+SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
+a
+0000000000000000000001
+EXPLAIN EXTENDED
+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`)))
+ALTER TABLE t1 MODIFY a DECIMAL(10,1) ZEROFILL;
+SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
+a
+000000001.0
+EXPLAIN EXTENDED
+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`)))
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/gis-debug.result b/mysql-test/r/gis-debug.result
index 8593f434c2b..5e8b4747f6d 100644
--- a/mysql-test/r/gis-debug.result
+++ b/mysql-test/r/gis-debug.result
@@ -267,6 +267,8 @@ POLYGON
# Bug#13358363 - ASSERTION: N > 0 && N < SINUSES_CALCULATED*2+1 | GET_N_SINCOS/ADD_EDGE_BUFFER
#
DO ST_BUFFER(ST_GEOMCOLLFROMTEXT('linestring(1 1,2 2)'),'');
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
SELECT ST_WITHIN(
LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '),
ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) '),
diff --git a/mysql-test/r/gis-precise.result b/mysql-test/r/gis-precise.result
index 953459d10fc..3824ba6afbb 100644
--- a/mysql-test/r/gis-precise.result
+++ b/mysql-test/r/gis-precise.result
@@ -178,7 +178,7 @@ st_touches(geomfromtext('point(1 1)'), geomfromtext('point(1 1)'))
0
select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 1)'));
st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 1)'))
-0
+1
select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 0)'));
st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 0)'))
0
@@ -187,7 +187,7 @@ st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1
0
select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('polygon((1 1.2, 1 0, 2 0, 1 1.2))'));
st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('polygon((1 1.2, 1 0, 2 0, 1 1.2))'))
-1
+0
select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('polygon((1 1, 1 0, 2 0, 1 1))'));
st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('polygon((1 1, 1 0, 2 0, 1 1))'))
1
@@ -437,7 +437,7 @@ ST_WITHIN( POLYGONFROMTEXT(' POLYGON( (0 5, 3 5, 3 4, 2 0 , 1 0, 2 4 , 0 4, 0 5)
0
SELECT ST_WITHIN( POINTFROMTEXT(' POINT(1 2 ) ') , MULTIPOLYGONFROMTEXT(' MULTIPOLYGON( ( (0 5, 3 5, 3 0, 0 0, 0 5), ( 1 1 , 2 1 , 2 4, 1 4, 1 1 ) ) ) '));
ST_WITHIN( POINTFROMTEXT(' POINT(1 2 ) ') , MULTIPOLYGONFROMTEXT(' MULTIPOLYGON( ( (0 5, 3 5, 3 0, 0 0, 0 5), ( 1 1 , 2 1 , 2 4, 1 4, 1 1 ) ) ) '))
-0
+1
select ST_ASTEXT(envelope(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION EMPTY')));
ST_ASTEXT(envelope(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION EMPTY')))
GEOMETRYCOLLECTION EMPTY
@@ -477,6 +477,15 @@ ST_NUMPOINTS(ST_EXTERIORRING(ST_BUFFER( POLYGONFROMTEXT( 'POLYGON( ( 0.0 -3.0,
select astext(buffer(st_linestringfromwkb(linestring(point(-1,1), point(-1,-2))),-1));
astext(buffer(st_linestringfromwkb(linestring(point(-1,1), point(-1,-2))),-1))
GEOMETRYCOLLECTION EMPTY
+select ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT(0 0)'));
+ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT(0 0)'))
+1
+select ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)'));
+ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)'))
+1
+select ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'));
+ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'))
+0
DROP TABLE IF EXISTS p1;
CREATE PROCEDURE p1(dist DOUBLE, geom TEXT)
BEGIN
@@ -745,6 +754,8 @@ POLYGON
# Bug#13358363 - ASSERTION: N > 0 && N < SINUSES_CALCULATED*2+1 | GET_N_SINCOS/ADD_EDGE_BUFFER
#
DO ST_BUFFER(ST_GEOMCOLLFROMTEXT('linestring(1 1,2 2)'),'');
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
SELECT ST_WITHIN(
LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '),
ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) '),
diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result
index c400ebb39ef..0506a0b2a0a 100644
--- a/mysql-test/r/gis-rtree.result
+++ b/mysql-test/r/gis-rtree.result
@@ -1596,3 +1596,51 @@ SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'
COUNT(*)
1
DROP TABLE t1;
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8239 Reverse spatial operations OP(const, field) do not get optimized
+#
+CREATE TABLE t1 (a GEOMETRY NOT NULL, SPATIAL KEY(a)) ENGINE=MyISAM;
+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
+1 SIMPLE t1 range a a 34 NULL 1 Using where
+EXPLAIN SELECT * FROM t1 WHERE ST_INTERSECTS(a,Point(1,2));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 34 NULL 1 Using where
+EXPLAIN SELECT * FROM t1 WHERE MBRINTERSECTS(Point(1,2),a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 34 NULL 1 Using where
+EXPLAIN SELECT * FROM t1 WHERE ST_INTERSECTS(Point(1,2),a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 34 NULL 1 Using where
+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;
+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
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,1.0);
+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
+EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,1e0);
+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
+EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,TIME'00:00:00');
+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
+EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,DATE'2001-01-01');
+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
+EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,TIMESTAMP'2001-01-01 00:00:00');
+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
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index 3c8adf4aa9c..9e337f6b5aa 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -408,7 +408,7 @@ first second w c o e d t i r
120 122 NULL NULL NULL NULL NULL NULL NULL NULL
120 123 NULL NULL NULL NULL NULL NULL NULL NULL
121 120 0 0 1 0 0 0 1 0
-121 121 1 1 0 1 0 1 1 0
+121 121 1 1 0 1 0 0 1 0
121 122 NULL NULL NULL NULL NULL NULL NULL NULL
121 123 NULL NULL NULL NULL NULL NULL NULL NULL
122 120 NULL NULL NULL NULL NULL NULL NULL NULL
@@ -809,7 +809,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 CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS point
+fn3 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());
@@ -877,7 +877,7 @@ mbroverlaps
down,left,right,up
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrtouches
-big,center,down,down2,left,left2,right,right2,small,up,up2
+down2,left2,right2,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrwithin
big,center
@@ -898,7 +898,7 @@ overlaps
down,left,right,up
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
touches
-big,center,down,down2,left,left2,right,right2,small,up,up2
+down2,left2,right2,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
within
big,center
@@ -1111,7 +1111,7 @@ DROP TABLE t0, t1, t2;
#
SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)));
ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)))
-NULL
+-1
#
# BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN
# GEOMETRY FUNCTION ARGUMENTS
@@ -1810,3 +1810,21 @@ disjoint
select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'FF*FF****') as disjoint;
disjoint
0
+#
+# MDEV-7528 GIS: Functions return NULL instead of specified -1 for NULL arguments.
+#
+select ST_IsRing(NULL);
+ST_IsRing(NULL)
+-1
+#
+# MDEV-8675 Different results of GIS functions on NULL vs NOT NULL columns
+#
+CREATE TABLE t1 (g1 GEOMETRY NOT NULL,g2 GEOMETRY NULL);
+CREATE TABLE t2 AS SELECT WITHIN(g1,g1) as w1,WITHIN(g2,g2) AS w2 FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `w1` int(1) DEFAULT NULL,
+ `w2` int(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 6c769e60780..3020c7deba7 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -1,3 +1,5 @@
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
drop table if exists t1;
@@ -1695,6 +1697,7 @@ Assigning privileges without procs_priv table.
CREATE DATABASE mysqltest1;
CREATE PROCEDURE mysqltest1.test() SQL SECURITY DEFINER
SELECT 1;
+CREATE FUNCTION mysqltest1.test() RETURNS INT RETURN 1;
GRANT EXECUTE ON FUNCTION mysqltest1.test TO mysqltest_1@localhost;
ERROR 42S02: Table 'mysql.procs_priv' doesn't exist
GRANT ALL PRIVILEGES ON test.* TO mysqltest_1@localhost;
@@ -2557,3 +2560,26 @@ ERROR 42000: Access denied for user 'untrusted'@'localhost' to database 'secret'
# Connection default
DROP USER untrusted@localhost;
DROP DATABASE secret;
+#
+# BUG#11759114 - '51401: GRANT TREATS NONEXISTENT FUNCTIONS/PRIVILEGES
+# DIFFERENTLY'.
+#
+drop database if exists mysqltest_db1;
+create database mysqltest_db1;
+create user mysqltest_u1;
+# Both GRANT statements below should fail with the same error.
+grant execute on function mysqltest_db1.f1 to mysqltest_u1;
+ERROR 42000: FUNCTION or PROCEDURE f1 does not exist
+grant execute on procedure mysqltest_db1.p1 to mysqltest_u1;
+ERROR 42000: FUNCTION or PROCEDURE p1 does not exist
+# Let us show that GRANT behaviour for routines is consistent
+# with GRANT behaviour for tables. Attempt to grant privilege
+# on non-existent table also results in an error.
+grant select on mysqltest_db1.t1 to mysqltest_u1;
+ERROR 42S02: Table 'mysqltest_db1.t1' doesn't exist
+show grants for mysqltest_u1;
+Grants for mysqltest_u1@%
+GRANT USAGE ON *.* TO 'mysqltest_u1'@'%'
+drop database mysqltest_db1;
+drop user mysqltest_u1;
+set GLOBAL sql_mode=default;
diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result
index a1cee5741e4..bd14f21010b 100644
--- a/mysql-test/r/grant2.result
+++ b/mysql-test/r/grant2.result
@@ -1,3 +1,5 @@
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
SET NAMES binary;
drop database if exists mysqltest;
drop database if exists mysqltest_1;
@@ -845,3 +847,4 @@ DROP USER mysqltest_u2@localhost;
DROP USER mysqltest_u3@localhost;
DROP USER mysqltest_u4@localhost;
DROP USER mysqltest_u5@localhost;
+set GLOBAL sql_mode=default;
diff --git a/mysql-test/r/grant3.result b/mysql-test/r/grant3.result
index fd51a83d4b2..d1722fc8ea9 100644
--- a/mysql-test/r/grant3.result
+++ b/mysql-test/r/grant3.result
@@ -1,3 +1,5 @@
+set global sql_mode="";
+set local sql_mode="";
SET NAMES binary;
drop table if exists t1;
delete from mysql.user where user like 'mysqltest\_%';
@@ -177,4 +179,5 @@ SELECT b FROM temp.t1;
ERROR 42000: SELECT command denied to user 'user2'@'localhost' for column 'b' in table 't1'
DROP USER 'user2'@'%';
DROP DATABASE temp;
+set global sql_mode=default;
End of 5.0 tests
diff --git a/mysql-test/r/grant4.result b/mysql-test/r/grant4.result
index d96802d105c..5a0032cd338 100644
--- a/mysql-test/r/grant4.result
+++ b/mysql-test/r/grant4.result
@@ -1,4 +1,6 @@
drop database if exists mysqltest_db1;
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
create database mysqltest_db1;
use mysqltest_db1;
create table t_column_priv_only (a int, b int);
@@ -212,3 +214,4 @@ create user foo3 identified via mysql_old_password using '00';
ERROR HY000: Password hash should be a 16-digit hexadecimal number
create user foo4 identified via mysql_old_password using '11111111111111111111111111111111111111111';
ERROR HY000: Password hash should be a 16-digit hexadecimal number
+set GLOBAL sql_mode=default;
diff --git a/mysql-test/r/grant_4332.result b/mysql-test/r/grant_4332.result
index 5a475bed6d8..93c0a24d164 100644
--- a/mysql-test/r/grant_4332.result
+++ b/mysql-test/r/grant_4332.result
@@ -1,3 +1,5 @@
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
alter table mysql.user modify User char(16) binary not null default '';
alter table mysql.db modify User char(16) binary not null default '';
alter table mysql.tables_priv modify User char(16) binary not null default '';
@@ -30,3 +32,4 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def user() 253 141 14 N 1 31 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 777eb10cda6..34abd96f026 100644
--- a/mysql-test/r/grant_cache_no_prot.result
+++ b/mysql-test/r/grant_cache_no_prot.result
@@ -1,5 +1,9 @@
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
drop table if exists test.t1,mysqltest.t1,mysqltest.t2;
drop database if exists mysqltest;
+set GLOBAL query_cache_type=ON;
+set LOCAL query_cache_type=ON;
set GLOBAL query_cache_size=1355776;
reset query cache;
flush status;
@@ -219,3 +223,7 @@ flush privileges;
drop table test.t1,mysqltest.t1,mysqltest.t2;
drop database mysqltest;
set GLOBAL query_cache_size=default;
+set GLOBAL query_cache_type=ON;
+set LOCAL query_cache_type=ON;
+set GLOBAL sql_mode=default;
+set GLOBAL query_cache_type=default;
diff --git a/mysql-test/r/grant_cache_ps_prot.result b/mysql-test/r/grant_cache_ps_prot.result
index b504dc4be35..5fe57c7c35d 100644
--- a/mysql-test/r/grant_cache_ps_prot.result
+++ b/mysql-test/r/grant_cache_ps_prot.result
@@ -1,5 +1,9 @@
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
drop table if exists test.t1,mysqltest.t1,mysqltest.t2;
drop database if exists mysqltest;
+set GLOBAL query_cache_type=ON;
+set LOCAL query_cache_type=ON;
set GLOBAL query_cache_size=1355776;
reset query cache;
flush status;
@@ -219,3 +223,7 @@ flush privileges;
drop table test.t1,mysqltest.t1,mysqltest.t2;
drop database mysqltest;
set GLOBAL query_cache_size=default;
+set GLOBAL query_cache_type=ON;
+set LOCAL query_cache_type=ON;
+set GLOBAL sql_mode=default;
+set GLOBAL query_cache_type=default;
diff --git a/mysql-test/r/grant_explain_non_select.result b/mysql-test/r/grant_explain_non_select.result
index 8bce20f7a95..1dbb5b1e3c0 100644
--- a/mysql-test/r/grant_explain_non_select.result
+++ b/mysql-test/r/grant_explain_non_select.result
@@ -1,3 +1,5 @@
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
CREATE DATABASE privtest_db;
CREATE TABLE privtest_db.t1 (a INT);
CREATE TABLE privtest_db.t2 (a INT);
@@ -176,3 +178,5 @@ DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
DROP USER 'privtest'@localhost;
USE test;
DROP DATABASE privtest_db;
+set GLOBAL sql_mode=default;
+set LOCAL sql_mode=default;
diff --git a/mysql-test/r/grant_lowercase.result b/mysql-test/r/grant_lowercase.result
index f13b077c214..b449453a47a 100644
--- a/mysql-test/r/grant_lowercase.result
+++ b/mysql-test/r/grant_lowercase.result
@@ -1,3 +1,4 @@
+set sql_mode="";
grant file on *.* to user1@localhost with grant option;
grant select on `a%`.* to user1@localhost with grant option;
grant file on aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.* to 'user'@'%' identified by 'secret';
@@ -5,7 +6,7 @@ ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
drop user user1@localhost;
call mtr.add_suppression("Incorrect database name");
alter table mysql.host modify Db varchar(200);
-alter table mysql.db modify User char(16), modify Db varchar(200);
+alter table mysql.db modify User char(16) default "", modify Db varchar(200) default "";
insert mysql.host set db=concat('=>', repeat(_utf8 'й', 200));
Warnings:
Warning 1265 Data truncated for column 'Db' at row 1
@@ -15,6 +16,6 @@ Warning 1265 Data truncated for column 'Db' at row 1
flush privileges;
delete from mysql.host where db like '=>%';
delete from mysql.db where db like '=>%';
-alter table mysql.host modify Db char(64);
-alter table mysql.db modify Db char(64), modify User char(80);
+alter table mysql.host modify Db char(64) default "";
+alter table mysql.db modify Db char(64) default "", modify User char(80) default "";
flush privileges;
diff --git a/mysql-test/r/grant_lowercase_fs.result b/mysql-test/r/grant_lowercase_fs.result
index 5a3087ed5cd..eb27b1d7ea0 100644
--- a/mysql-test/r/grant_lowercase_fs.result
+++ b/mysql-test/r/grant_lowercase_fs.result
@@ -1,4 +1,6 @@
create database db1;
+create user user_1@localhost;
+create user USER_1@localhost;
GRANT CREATE ON db1.* to user_1@localhost;
GRANT SELECT ON db1.* to USER_1@localhost;
CREATE TABLE t1(f1 int);
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 9f5eb053cb7..7f32643b727 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -522,6 +522,7 @@ NULL 9
3
b 1
drop table t1;
+set big_tables=0;
create table t1 (a int not null, b int not null);
insert into t1 values (1,1),(1,2),(3,1),(3,2),(2,2),(2,1);
create table t2 (a int not null, b int not null, key(a));
@@ -659,7 +660,10 @@ insert into t1 (a,b) values (1,2),(1,3),(2,5);
select a, 0.1*0+1 r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2=1;
a r2 r1
1 1.0 2
-select a, round(rand(100)*10) r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2<=2;
+select a, round(rand(100)*10) r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2<=2;
+a r2 r1
+1 2 2
+select a, round(rand(100)*10) r2, sum(1) r1 from t1 group by a having r1>1 and r2<=2;
a r2 r1
1 2 2
select a,sum(b) from t1 where a=1 group by c;
@@ -668,6 +672,12 @@ a sum(b)
select a*sum(b) from t1 where a=1 group by c;
a*sum(b)
5
+select a*sum(b) as f1 from t1 where a=1 group by c having f1 <= 10;
+f1
+5
+select a,a*sum(b) as f1 from t1 where a=1 group by c having a*sum(b)+0 <= 10;
+a f1
+1 5
select sum(a)*sum(b) from t1 where a=1 group by c;
sum(a)*sum(b)
10
@@ -1988,12 +1998,12 @@ SHOW SESSION STATUS LIKE 'Sort_scan%';
Variable_name Value
Sort_scan 0
EXPLAIN SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2
-FROM t1 GROUP BY field1, field2;;
+FROM t1 GROUP BY field1, field2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL idx 5 NULL 20 Using index; Using filesort
FLUSH STATUS;
SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2
-FROM t1 GROUP BY field1, field2;;
+FROM t1 GROUP BY field1, field2;
field1 field2
1 1
2 2
@@ -2082,6 +2092,58 @@ f1 f2
19 19
20 20
explain
+select col1 f1, col1 f2 from t1 group by f1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL idx 5 NULL 20 Using index
+select col1 f1, col1 f2 from t1 group by f1;
+f1 f2
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+13 13
+14 14
+15 15
+16 16
+17 17
+18 18
+19 19
+20 20
+explain
+select col1 f1, col1 f2 from t1 group by f1, f2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL idx 5 NULL 20 Using index
+select col1 f1, col1 f2 from t1 group by f1, f2;
+f1 f2
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+13 13
+14 14
+15 15
+16 16
+17 17
+18 18
+19 19
+20 20
+explain
select col1 f1, col1 f2 from t1 group by f2 order by f2, f1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL idx 5 NULL 20 Using index
@@ -2141,6 +2203,22 @@ INSERT INTO t2(col1, col2) VALUES
(1,20),(2,19),(3,18),(4,17),(5,16),(6,15),(7,14),(8,13),(9,12),(10,11),
(11,10),(12,9),(13,8),(14,7),(15,6),(16,5),(17,4),(18,3),(19,2),(20,1);
explain
+select col1 f1, col2 f2, col1 f3 from t2 group by f1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range NULL idx 5 NULL 7 Using index for group-by
+explain
+select SQL_BIG_RESULT col1 f1, col2 f2, col1 f3 from t2 group by f1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range NULL idx 5 NULL 7 Using index for group-by
+explain
+select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL idx 10 NULL 20 Using index
+explain
+select col1 f1, col1 f2 from t2 group by f1, 1+1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range NULL idx 5 NULL 7 Using index for group-by
+explain
select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3+0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL idx 10 NULL 20 Using index; Using temporary; Using filesort
@@ -2167,6 +2245,10 @@ f1 f2 f3
19 2 19
20 1 20
explain
+select col1 f1, col2 f2, col1 f3 from t2 order by f1,f2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL idx 10 NULL 20 Using index
+explain
select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3+0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL idx 10 NULL 20 Using index; Using filesort
@@ -2207,20 +2289,16 @@ field1 field2
2004-10-11 18:13:00 1
2009-02-19 02:05:00 5
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'g'
Warning 1292 Truncated incorrect DOUBLE value: 'o'
-Warning 1292 Truncated incorrect DOUBLE value: 'g'
Warning 1292 Truncated incorrect DOUBLE value: 'v'
SELECT alias2.f3 AS field1 , alias2.f1 AS field2 FROM t1 AS alias1 JOIN t1 AS alias2 ON alias2.f1 = alias1.f2 AND alias2.f1 != alias1.f4 GROUP BY field1 , field2 ;
field1 field2
2004-10-11 18:13:00 1
2009-02-19 02:05:00 5
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'g'
Warning 1292 Truncated incorrect DOUBLE value: 'o'
-Warning 1292 Truncated incorrect DOUBLE value: 'g'
Warning 1292 Truncated incorrect DOUBLE value: 'v'
SET SESSION SQL_MODE=default;
drop table t1;
@@ -2342,7 +2420,7 @@ DROP TABLE t1;
create table t1 (a int, b int);
insert into t1 values (1,11), (1,12), (2,22),(2,23), (4,44),(4,45);
create table t2 (c int, d int);
-insert into t2 values (1,11), (1,12), (2,22),(2,23), (4,44),(4,45);
+insert into t2 values (1,11), (2,22), (4,44);
select distinct a,sum(b), (select d from t2 where c=a order by max(b) limit 1) from t1 group by a order by max(b);
a sum(b) (select d from t2 where c=a order by max(b) limit 1)
1 23 11
diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result
index 07de4f7ac9d..cf867dd1e18 100644
--- a/mysql-test/r/group_min_max.result
+++ b/mysql-test/r/group_min_max.result
@@ -3779,5 +3779,111 @@ id MIN(a) MAX(a)
4 2001-01-04 2001-01-04
DROP TABLE t1;
#
+# MDEV-8229 GROUP_MIN_MAX is erroneously applied for BETWEEN in some cases
+#
+SET NAMES latin1;
+CREATE TABLE t1 (id INT NOT NULL, a VARCHAR(20)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,'2001-01-01');
+INSERT INTO t1 VALUES (1,'2001-01-02');
+INSERT INTO t1 VALUES (1,'2001-01-03');
+INSERT INTO t1 VALUES (1,' 2001-01-04');
+INSERT INTO t1 VALUES (2,'2001-01-01');
+INSERT INTO t1 VALUES (2,'2001-01-02');
+INSERT INTO t1 VALUES (2,'2001-01-03');
+INSERT INTO t1 VALUES (2,' 2001-01-04');
+INSERT INTO t1 VALUES (3,'2001-01-01');
+INSERT INTO t1 VALUES (3,'2001-01-02');
+INSERT INTO t1 VALUES (3,'2001-01-03');
+INSERT INTO t1 VALUES (3,' 2001-01-04');
+INSERT INTO t1 VALUES (4,'2001-01-01');
+INSERT INTO t1 VALUES (4,'2001-01-02');
+INSERT INTO t1 VALUES (4,'2001-01-03');
+INSERT INTO t1 VALUES (4,' 2001-01-04');
+SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN ' 2001-01-04' AND '2001-01-05' GROUP BY id;
+id MIN(a) MAX(a)
+1 2001-01-04 2001-01-03
+2 2001-01-04 2001-01-03
+3 2001-01-04 2001-01-03
+4 2001-01-04 2001-01-03
+SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND '2001-01-05' GROUP BY id;
+id MIN(a) MAX(a)
+SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND DATE'2001-01-05' GROUP BY id;
+id MIN(a) MAX(a)
+1 2001-01-04 2001-01-04
+2 2001-01-04 2001-01-04
+3 2001-01-04 2001-01-04
+4 2001-01-04 2001-01-04
+SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND '2001-01-05' GROUP BY id;
+id MIN(a) MAX(a)
+1 2001-01-04 2001-01-04
+2 2001-01-04 2001-01-04
+3 2001-01-04 2001-01-04
+4 2001-01-04 2001-01-04
+SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND DATE'2001-01-05' GROUP BY id;
+id MIN(a) MAX(a)
+1 2001-01-04 2001-01-04
+2 2001-01-04 2001-01-04
+3 2001-01-04 2001-01-04
+4 2001-01-04 2001-01-04
+ALTER TABLE t1 ADD KEY(id,a);
+SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN ' 2001-01-04' AND '2001-01-05' GROUP BY id;
+id MIN(a) MAX(a)
+1 2001-01-04 2001-01-03
+2 2001-01-04 2001-01-03
+3 2001-01-04 2001-01-03
+4 2001-01-04 2001-01-03
+SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND '2001-01-05' GROUP BY id;
+id MIN(a) MAX(a)
+SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND DATE'2001-01-05' GROUP BY id;
+id MIN(a) MAX(a)
+1 2001-01-04 2001-01-04
+2 2001-01-04 2001-01-04
+3 2001-01-04 2001-01-04
+4 2001-01-04 2001-01-04
+SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND '2001-01-05' GROUP BY id;
+id MIN(a) MAX(a)
+1 2001-01-04 2001-01-04
+2 2001-01-04 2001-01-04
+3 2001-01-04 2001-01-04
+4 2001-01-04 2001-01-04
+SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND DATE'2001-01-05' GROUP BY id;
+id MIN(a) MAX(a)
+1 2001-01-04 2001-01-04
+2 2001-01-04 2001-01-04
+3 2001-01-04 2001-01-04
+4 2001-01-04 2001-01-04
+EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN ' 2001-01-04' AND '2001-01-05' GROUP BY id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range NULL id 27 NULL 9 Using where; Using index for group-by
+EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND '2001-01-05' GROUP BY id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range NULL id 27 NULL 9 Using where; Using index for group-by
+EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND DATE'2001-01-05' GROUP BY id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL id 27 NULL 16 Using where; Using index
+EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND '2001-01-05' GROUP BY id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL id 27 NULL 16 Using where; Using index
+EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND DATE'2001-01-05' GROUP BY id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL id 27 NULL 16 Using where; Using index
+DROP TABLE t1;
+#
+# MIN() optimization didn't work correctly with BETWEEN when using too
+# long strings.
+#
+create table t1 (a varchar(10), key (a)) engine=myisam;
+insert into t1 values("bar"),("Cafe");
+explain select min(a) from t1 where a between "a" and "Cafe2";
+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
+explain select min(a) from t1 where a between "a" and "Cafeeeeeeeeeeeeeeeeeeeeeeeeee";
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index a a 13 NULL 2 Using where; Using index
+explain select min(a) from t1 where a between "abbbbbbbbbbbbbbbbbbbb" and "Cafe2";
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index a a 13 NULL 2 Using where; Using index
+drop table t1;
+#
# End of 10.1 tests
#
diff --git a/mysql-test/r/help.result b/mysql-test/r/help.result
index 16719cc8193..3a266567175 100644
--- a/mysql-test/r/help.result
+++ b/mysql-test/r/help.result
@@ -148,10 +148,12 @@ help 'impossible_category_1';
source_category_name name is_it_category
impossible_category_1 impossible_function_1 N
impossible_category_1 impossible_function_2 N
+set sql_mode="";
alter table mysql.help_relation engine=innodb;
alter table mysql.help_keyword engine=innodb;
alter table mysql.help_topic engine=innodb;
alter table mysql.help_category engine=innodb;
+set sql_mode=default;
help 'function_of_my_dream';
name is_it_category
help '%possible_f%';
diff --git a/mysql-test/r/host_cache_size_functionality.result b/mysql-test/r/host_cache_size_functionality.result
index e7f9e09fd2f..069cf61bcad 100644
--- a/mysql-test/r/host_cache_size_functionality.result
+++ b/mysql-test/r/host_cache_size_functionality.result
@@ -6,7 +6,7 @@ echo '##'
####################################################################
SELECT COUNT(@@GLOBAL.Host_Cache_Size)
1 Expected
-set @Default_host_cache_size=128;
+set @Default_host_cache_size=279;
select @@global.Host_Cache_Size=@Default_host_cache_size;
@@global.Host_Cache_Size=@Default_host_cache_size
1
diff --git a/mysql-test/r/implicit_commit.result b/mysql-test/r/implicit_commit.result
index d568d05e7b7..07536ab0719 100644
--- a/mysql-test/r/implicit_commit.result
+++ b/mysql-test/r/implicit_commit.result
@@ -1,3 +1,4 @@
+SET SQL_MODE="";
SET GLOBAL EVENT_SCHEDULER = OFF;
SET BINLOG_FORMAT = STATEMENT;
CREATE DATABASE db1;
diff --git a/mysql-test/r/index_intersect.result b/mysql-test/r/index_intersect.result
index 1337c3fac2d..7a0633d4dc8 100644
--- a/mysql-test/r/index_intersect.result
+++ b/mysql-test/r/index_intersect.result
@@ -1013,10 +1013,7 @@ f4 varchar(32),
f5 int,
PRIMARY KEY (f1),
KEY (f4)
-) ENGINE=InnoDB;
-Warnings:
-Warning 1286 Unknown storage engine 'InnoDB'
-Warning 1266 Using storage engine MyISAM for table 't1'
+);
INSERT INTO t1 VALUES
(5,'H',1), (9,'g',0), (527,'i',0), (528,'y',1), (529,'S',6),
(530,'m',7), (531,'b',2), (532,'N',1), (533,'V',NULL), (534,'l',1),
diff --git a/mysql-test/r/index_intersect_innodb.result b/mysql-test/r/index_intersect_innodb.result
index 33f2247e5d1..9c3a501111d 100644
--- a/mysql-test/r/index_intersect_innodb.result
+++ b/mysql-test/r/index_intersect_innodb.result
@@ -1014,7 +1014,7 @@ f4 varchar(32),
f5 int,
PRIMARY KEY (f1),
KEY (f4)
-) ENGINE=InnoDB;
+);
INSERT INTO t1 VALUES
(5,'H',1), (9,'g',0), (527,'i',0), (528,'y',1), (529,'S',6),
(530,'m',7), (531,'b',2), (532,'N',1), (533,'V',NULL), (534,'l',1),
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index 847c959fc59..fa5280df2b4 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -1,3 +1,5 @@
+set global sql_mode="";
+set local sql_mode="";
DROP TABLE IF EXISTS t0,t1,t2,t3,t4,t5;
DROP VIEW IF EXISTS v1;
show variables where variable_name like "skip_show_database";
@@ -488,7 +490,7 @@ Note 1831 Duplicate index 'key_2' defined on the table 'test.t1'. This is deprec
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `constraint_1` (`a`),
UNIQUE KEY `key_1` (`a`),
@@ -1633,9 +1635,7 @@ drop table if exists t1;drop table if exists t1;
drop table if exists t1;drop table if exists t1;
drop table if exists t1;drop table if exists t1;
drop table if exists t1;drop table if exists t1;
-drop table if exists t1;drop table if exists
-Warnings:
-Warning 1265 Data truncated for column 'VARIABLE_VALUE' at row 1
+drop table if exists t1;drop table if exists t1;
select * from information_schema.global_variables where variable_name like 'init%' order by variable_name;
VARIABLE_NAME VARIABLE_VALUE
INIT_CONNECT drop table if exists t1;drop table if exists t1;
@@ -1658,11 +1658,9 @@ drop table if exists t1;drop table if exists t1;
drop table if exists t1;drop table if exists t1;
drop table if exists t1;drop table if exists t1;
drop table if exists t1;drop table if exists t1;
-drop table if exists t1;drop table if exists
+drop table if exists t1;drop table if exists t1;
INIT_FILE
INIT_SLAVE
-Warnings:
-Warning 1265 Data truncated for column 'VARIABLE_VALUE' at row #
set global init_connect="";
create table t0 select * from information_schema.global_status where VARIABLE_NAME='COM_SELECT';
SELECT 1;
@@ -2070,3 +2068,4 @@ Variable_name Value
Opened_tables 3
drop database mysqltest;
drop database db1;
+set global sql_mode=default;
diff --git a/mysql-test/r/information_schema2.result b/mysql-test/r/information_schema2.result
index 60a20944839..f82301699a7 100644
--- a/mysql-test/r/information_schema2.result
+++ b/mysql-test/r/information_schema2.result
@@ -6,3 +6,15 @@ select variable_name from information_schema.session_variables where variable_na
(select variable_name from information_schema.session_variables where variable_name = 'basedir');
variable_name
BASEDIR
+create table t1 (a char);
+insert t1 values ('a'),('t'),('z');
+flush status;
+select a, exists (select 1 from information_schema.columns where table_schema=concat('tes',a)) from t1;
+a exists (select 1 from information_schema.columns where table_schema=concat('tes',a))
+a 0
+t 1
+z 0
+show status like 'created_tmp_tables';
+Variable_name Value
+Created_tmp_tables 43
+drop table t1;
diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result
index 81a17e7ed3b..c09e04f786a 100644
--- a/mysql-test/r/information_schema_db.result
+++ b/mysql-test/r/information_schema_db.result
@@ -1,3 +1,5 @@
+set local sql_mode="";
+set global sql_mode="";
drop table if exists t1,t2;
drop view if exists v1,v2;
drop function if exists f1;
@@ -216,3 +218,4 @@ show create view testdb_1.v1;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v1'
drop user mysqltest_1@localhost;
drop database testdb_1;
+set global sql_mode=default;
diff --git a/mysql-test/r/information_schema_linux.result b/mysql-test/r/information_schema_linux.result
new file mode 100644
index 00000000000..43095b76151
--- /dev/null
+++ b/mysql-test/r/information_schema_linux.result
@@ -0,0 +1,7 @@
+#
+# MDEV-6756: map a linux pid (child pid) to a connection id shown in
+# the output of SHOW PROCESSLIST
+#
+SELECT max(tid) != min(tid) FROM information_schema.processlist;
+max(tid) != min(tid)
+1
diff --git a/mysql-test/r/information_schema_routines.result b/mysql-test/r/information_schema_routines.result
index b8f4fb9b1ef..65e352e3af3 100644
--- a/mysql-test/r/information_schema_routines.result
+++ b/mysql-test/r/information_schema_routines.result
@@ -1,3 +1,5 @@
+set sql_mode="";
+set sql_mode="";
# ========== routines.1 ==========
USE INFORMATION_SCHEMA;
SHOW CREATE TABLE INFORMATION_SCHEMA.ROUTINES;
diff --git a/mysql-test/r/innodb_icp.result b/mysql-test/r/innodb_icp.result
index fb467494525..bc1c24276ed 100644
--- a/mysql-test/r/innodb_icp.result
+++ b/mysql-test/r/innodb_icp.result
@@ -416,11 +416,11 @@ DROP TABLE t1;
# Bug#59259 "Incorrect rows returned for a correlated subquery
# when ICP is on"
#
-CREATE TABLE t1 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL) ENGINE=InnoDB;
+CREATE TABLE t1 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL);
INSERT INTO t1 VALUES (11,0);
INSERT INTO t1 VALUES (12,5);
INSERT INTO t1 VALUES (15,0);
-CREATE TABLE t2 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL) ENGINE=InnoDB;
+CREATE TABLE t2 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL);
INSERT INTO t2 VALUES (11,1);
INSERT INTO t2 VALUES (12,2);
INSERT INTO t2 VALUES (15,4);
@@ -600,6 +600,16 @@ SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
WHERE t2.pk <> t1.d1 AND t2.pk = 4;
d1 pk i1
1 4 1
+EXPLAIN
+SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
+WHERE t1.d1 <> t2.pk AND t2.pk = 4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL k1 9 NULL 3 Using index
+1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using where
+SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
+WHERE t1.d1 <> t2.pk AND t2.pk = 4;
+d1 pk i1
+1 4 1
DROP TABLE t1, t2;
#
# BUG#778434 Wrong result with in_to_exists=on in maria-5.3-mwl89
diff --git a/mysql-test/r/innodb_load_xa.result b/mysql-test/r/innodb_load_xa.result
index bcf1dad6806..515c820b40c 100644
--- a/mysql-test/r/innodb_load_xa.result
+++ b/mysql-test/r/innodb_load_xa.result
@@ -14,3 +14,5 @@ Variable_name Value
Handler_prepare 0
drop table t1;
uninstall plugin innodb;
+Warnings:
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
diff --git a/mysql-test/r/innodb_mrr_cpk.result b/mysql-test/r/innodb_mrr_cpk.result
index 99ed73a3e83..28d7dd51df8 100644
--- a/mysql-test/r/innodb_mrr_cpk.result
+++ b/mysql-test/r/innodb_mrr_cpk.result
@@ -11,7 +11,7 @@ create table t1(a char(8), b char(8), filler char(100), primary key(a));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(8) NOT NULL DEFAULT '',
+ `a` char(8) NOT NULL,
`b` char(8) DEFAULT NULL,
`filler` char(100) DEFAULT NULL,
PRIMARY KEY (`a`)
diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result
index 82f3977e231..b5546202a6e 100644
--- a/mysql-test/r/insert.result
+++ b/mysql-test/r/insert.result
@@ -92,14 +92,14 @@ create table t1(number int auto_increment primary key, original_value varchar(50
set @value= "aa";
insert 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
-Warning 1265 Data truncated for column 'f_double_7_2' at row 1
-Warning 1265 Data truncated for column 'f_float_4_3' at row 1
-Warning 1265 Data truncated for column 'f_double_u' at row 1
-Warning 1265 Data truncated for column 'f_float_u' at row 1
-Warning 1265 Data truncated for column 'f_double_15_1_u' at row 1
-Warning 1265 Data truncated for column 'f_float_3_1_u' at row 1
+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
+Warning 1366 Incorrect double value: 'aa' for column 'f_double_7_2' at row 1
+Warning 1366 Incorrect double value: 'aa' for column 'f_float_4_3' at row 1
+Warning 1366 Incorrect double value: 'aa' for column 'f_double_u' at row 1
+Warning 1366 Incorrect double value: 'aa' for column 'f_float_u' at row 1
+Warning 1366 Incorrect double value: 'aa' for column 'f_double_15_1_u' at row 1
+Warning 1366 Incorrect double value: 'aa' for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 1
original_value aa
@@ -136,14 +136,14 @@ f_float_3_1_u 1.0
set @value= "aa1";
insert 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
-Warning 1265 Data truncated for column 'f_double_7_2' at row 1
-Warning 1265 Data truncated for column 'f_float_4_3' at row 1
-Warning 1265 Data truncated for column 'f_double_u' at row 1
-Warning 1265 Data truncated for column 'f_float_u' at row 1
-Warning 1265 Data truncated for column 'f_double_15_1_u' at row 1
-Warning 1265 Data truncated for column 'f_float_3_1_u' at row 1
+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
+Warning 1366 Incorrect double value: 'aa1' for column 'f_double_7_2' at row 1
+Warning 1366 Incorrect double value: 'aa1' for column 'f_float_4_3' at row 1
+Warning 1366 Incorrect double value: 'aa1' for column 'f_double_u' at row 1
+Warning 1366 Incorrect double value: 'aa1' for column 'f_float_u' at row 1
+Warning 1366 Incorrect double value: 'aa1' for column 'f_double_15_1_u' at row 1
+Warning 1366 Incorrect double value: 'aa1' for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 3
original_value aa1
diff --git a/mysql-test/r/insert_notembedded.result b/mysql-test/r/insert_notembedded.result
index ba3e2221922..41e31508fe0 100644
--- a/mysql-test/r/insert_notembedded.result
+++ b/mysql-test/r/insert_notembedded.result
@@ -1,3 +1,5 @@
+set local sql_mode="";
+set global sql_mode="";
drop table if exists t1;
create table t1 (n int);
create view v1 as select * from t1;
@@ -125,3 +127,5 @@ 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/join_cache.result b/mysql-test/r/join_cache.result
index c1dbef08c04..90d305fb384 100644
--- a/mysql-test/r/join_cache.result
+++ b/mysql-test/r/join_cache.result
@@ -39,7 +39,7 @@ COUNT(*)
984
show variables like 'join_buffer_size';
Variable_name Value
-join_buffer_size 131072
+join_buffer_size 262144
set join_cache_level=1;
show variables like 'join_cache_level';
Variable_name Value
@@ -774,7 +774,7 @@ set join_cache_level=default;
set join_buffer_size=default;
show variables like 'join_buffer_size';
Variable_name Value
-join_buffer_size 131072
+join_buffer_size 262144
show variables like 'join_cache_level';
Variable_name Value
join_cache_level 2
@@ -808,7 +808,7 @@ INDEX (Percentage)
);
show variables like 'join_buffer_size';
Variable_name Value
-join_buffer_size 131072
+join_buffer_size 262144
set join_cache_level=3;
show variables like 'join_cache_level';
Variable_name Value
@@ -1008,7 +1008,7 @@ Russian Federation NULL
Vietnam NULL
show variables like 'join_buffer_size';
Variable_name Value
-join_buffer_size 131072
+join_buffer_size 262144
set join_cache_level=4;
show variables like 'join_cache_level';
Variable_name Value
@@ -1267,7 +1267,7 @@ Czech Republic 10278100 NULL NULL
DROP INDEX City_Name ON City;
show variables like 'join_buffer_size';
Variable_name Value
-join_buffer_size 131072
+join_buffer_size 262144
set join_cache_level=5;
show variables like 'join_cache_level';
Variable_name Value
@@ -2688,7 +2688,7 @@ set join_cache_level=default;
set join_buffer_size=default;
show variables like 'join_buffer_size';
Variable_name Value
-join_buffer_size 131072
+join_buffer_size 262144
show variables like 'join_cache_level';
Variable_name Value
join_cache_level 2
@@ -4321,6 +4321,23 @@ h
n
v
p
+EXPLAIN
+SELECT t2.v FROM t1, t2, t3
+WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
+GROUP BY t2.v ORDER BY t1.pk,t2.v;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort
+1 SIMPLE t3 eq_ref PRIMARY,idx2 PRIMARY 4 test.t2.i 1 Using where
+1 SIMPLE t1 ref idx2 idx2 3 test.t3.v 5 Using where
+SELECT t2.v FROM t1, t2, t3
+WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
+GROUP BY t2.v ORDER BY t1.pk,t2.v;
+v
+b
+h
+n
+v
+p
SET SESSION join_cache_level=6;
EXPLAIN
SELECT t2.v FROM t1, t2, t3
@@ -4339,6 +4356,23 @@ h
n
v
p
+EXPLAIN
+SELECT t2.v FROM t1, t2, t3
+WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
+GROUP BY t2.v ORDER BY t1.pk,t2.v;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort
+1 SIMPLE t3 eq_ref PRIMARY,idx2 PRIMARY 4 test.t2.i 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE t1 ref idx2 idx2 3 test.t3.v 5 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
+SELECT t2.v FROM t1, t2, t3
+WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
+GROUP BY t2.v ORDER BY t1.pk,t2.v;
+v
+b
+h
+n
+v
+p
SET SESSION join_cache_level=4;
EXPLAIN
SELECT t2.v FROM t1, t2, t3
@@ -4357,6 +4391,23 @@ h
n
v
p
+EXPLAIN
+SELECT t2.v FROM t1, t2, t3
+WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
+GROUP BY t2.v ORDER BY t1.pk,t2.v;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort
+1 SIMPLE t3 hash_ALL PRIMARY,idx2 #hash#PRIMARY 4 test.t2.i 20 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE t1 hash_ALL idx2 #hash#idx2 3 test.t3.v 44 Using where; Using join buffer (incremental, BNLH join)
+SELECT t2.v FROM t1, t2, t3
+WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
+GROUP BY t2.v ORDER BY t1.pk,t2.v;
+v
+b
+h
+n
+v
+p
DROP TABLE t1,t2,t3;
SET SESSION join_cache_level=DEFAULT;
#
@@ -5867,7 +5918,7 @@ select @@join_buffer_space_limit;
8192
select @@join_buffer_size;
@@join_buffer_size
-131072
+262144
explain select count(*) from t1, t1 t2 where t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 11
diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result
index a89a79dadbb..bc4d69e72eb 100644
--- a/mysql-test/r/key.result
+++ b/mysql-test/r/key.result
@@ -433,8 +433,8 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) DEFAULT NULL,
- `c2` char(12) NOT NULL DEFAULT '',
- `c3` varchar(123) NOT NULL DEFAULT '',
+ `c2` char(12) NOT NULL,
+ `c3` varchar(123) NOT NULL,
`c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`c2`,`c3`),
UNIQUE KEY `i4` (`c4`),
@@ -471,9 +471,9 @@ ERROR 42000: Can't DROP 'PRIMARY'; check that column/key exists
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` int(11) NOT NULL DEFAULT '0',
- `c2` char(12) NOT NULL DEFAULT '',
- `c3` varchar(123) NOT NULL DEFAULT '',
+ `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,
KEY `i1` (`c1`),
KEY `i5` (`c1`,`c2`,`c3`,`c4`),
diff --git a/mysql-test/r/kill.result b/mysql-test/r/kill.result
index 6e108fda634..d40c4ee758c 100644
--- a/mysql-test/r/kill.result
+++ b/mysql-test/r/kill.result
@@ -1,3 +1,5 @@
+set local sql_mode="";
+set global sql_mode="";
SET DEBUG_SYNC = 'RESET';
DROP TABLE IF EXISTS t1, t2, t3;
DROP FUNCTION IF EXISTS MY_KILL;
@@ -308,5 +310,18 @@ SLEEP(1000)
1
KILL QUERY ID 0;
ERROR HY000: Unknown query id: 0
+#
+# MDEV-5096 - Wrong error message on attempt to kill somebody else's
+# query ID
+#
+CREATE USER u1@localhost;
+SELECT SLEEP(1000);
+KILL QUERY ID ID;
+ERROR HY000: You are not owner of query ID
+KILL QUERY ID @id;
+SLEEP(1000)
+1
+DROP USER u1@localhost;
SET DEBUG_SYNC = 'RESET';
DROP FUNCTION MY_KILL;
+set global sql_mode=default;
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index 2d67d24bedd..8cd3b0a7ac8 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -43,8 +43,11 @@ drop table t1;
create table t1 (a int, b char(10));
load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
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 1262 Row 3 was truncated; it contained more data than there were input columns
+Note 1265 Data truncated for column 'a' at row 4
Warning 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 5
Warning 1262 Row 5 was truncated; it contained more data than there were input columns
select * from t1;
@@ -57,6 +60,9 @@ a b
truncate table t1;
load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'a' at row 2
+Note 1265 Data truncated for column 'a' at row 3
Warning 1366 Incorrect integer value: '
' for column 'a' at row 4
Warning 1261 Row 4 doesn't contain data for all columns
@@ -73,6 +79,8 @@ insert into t1 values(0);
select * from t1;
id
0
+Warnings:
+Note 1265 Data truncated for column 'id' at row 1
select * from t1;
id
0
@@ -180,6 +188,13 @@ NULL 10 10
NULL 15 15
truncate table t1;
load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c="Wow";
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'b' at row 1
+Note 1265 Data truncated for column 'a' at row 2
+Note 1265 Data truncated for column 'b' at row 2
+Note 1265 Data truncated for column 'a' at row 3
+Note 1265 Data truncated for column 'b' at row 3
select * from t1;
a b c
1 2 Wow
@@ -187,6 +202,13 @@ a b c
5 6 Wow
truncate table t1;
load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c=concat(a,"+",b,"+",@c,"+",b,"+",if(c is null,"NIL",c));
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'b' at row 1
+Note 1265 Data truncated for column 'a' at row 2
+Note 1265 Data truncated for column 'b' at row 2
+Note 1265 Data truncated for column 'a' at row 3
+Note 1265 Data truncated for column 'b' at row 3
select * from t1;
a b c
1 2 1+2+123+2+NIL
@@ -234,7 +256,9 @@ f1
2
delete from t1;
Warnings:
+Note 1265 Data truncated for column 'f1' at row 1
Warning 1261 Row 1 doesn't contain data for all columns
+Note 1265 Data truncated for column 'f1' at row 2
Warning 1261 Row 2 doesn't contain data for all columns
select f1 from t1 where f2 <> '0000-00-00 00:00:00' order by f1;
f1
diff --git a/mysql-test/r/lock_multi.result b/mysql-test/r/lock_multi.result
index f9e4a88fe95..12960a4f5f6 100644
--- a/mysql-test/r/lock_multi.result
+++ b/mysql-test/r/lock_multi.result
@@ -115,7 +115,9 @@ ERROR HY000: Can't execute the query because you have a conflicting read lock
UNLOCK TABLES;
DROP DATABASE mysqltest_1;
ERROR HY000: Can't drop database 'mysqltest_1'; database doesn't exist
+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;
alter table t1 auto_increment=0;
alter table t1 auto_increment=0;
diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result
index dd2beb87974..ff5055e1ae4 100644
--- a/mysql-test/r/log_tables.result
+++ b/mysql-test/r/log_tables.result
@@ -1,3 +1,4 @@
+SET SQL_MODE="";
SET @old_general_log_state = @@global.general_log;
SET @old_log_output= @@global.log_output;
SET @old_slow_query_log= @@global.slow_query_log;
diff --git a/mysql-test/r/lowercase_fs_off.result b/mysql-test/r/lowercase_fs_off.result
index 9b819cf3843..4c4cdb76615 100644
--- a/mysql-test/r/lowercase_fs_off.result
+++ b/mysql-test/r/lowercase_fs_off.result
@@ -1,3 +1,5 @@
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
create database d1;
grant all on d1.* to 'sample'@'localhost' identified by 'password';
flush privileges;
@@ -63,3 +65,4 @@ CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a= 1;
RENAME TABLE t1 TO T1;
ALTER TABLE T1 RENAME t1;
DROP TABLE t1;
+set GLOBAL sql_mode=default;
diff --git a/mysql-test/r/lowercase_table_grant.result b/mysql-test/r/lowercase_table_grant.result
index afb54f8c472..009965c0c8e 100644
--- a/mysql-test/r/lowercase_table_grant.result
+++ b/mysql-test/r/lowercase_table_grant.result
@@ -1,4 +1,5 @@
use mysql;
+set sql_mode="";
create database MYSQLtest;
grant all on MySQLtest.* to mysqltest_1@localhost;
show grants for mysqltest_1@localhost;
diff --git a/mysql-test/r/lowercase_table_qcache.result b/mysql-test/r/lowercase_table_qcache.result
index f8d34e0f592..9d7e1007e4c 100644
--- a/mysql-test/r/lowercase_table_qcache.result
+++ b/mysql-test/r/lowercase_table_qcache.result
@@ -1,4 +1,6 @@
set GLOBAL query_cache_size=1355776;
+set GLOBAL query_cache_type=ON;
+set LOCAL query_cache_type=ON;
drop database if exists MySQLtesT;
create database MySQLtesT;
create table MySQLtesT.t1 (a int);
@@ -21,4 +23,5 @@ select * from MySQL.db;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
-set GLOBAL query_cache_size=0;
+set GLOBAL query_cache_size=default;
+set GLOBAL query_cache_type=default;
diff --git a/mysql-test/r/max_statement_time.result b/mysql-test/r/max_statement_time.result
index c0cffb27a37..44ee03b813a 100644
--- a/mysql-test/r/max_statement_time.result
+++ b/mysql-test/r/max_statement_time.result
@@ -52,6 +52,7 @@ DROP TABLE t1;
# MAX_STATEMENT_TIME account resource
+set statement sql_mode="" for
GRANT USAGE ON *.* TO user1@localhost WITH MAX_STATEMENT_TIME 1.005;
# con1
SELECT @@max_statement_time;
@@ -114,7 +115,7 @@ UPDATE t1 SET a = 2;
ERROR 70100: Query execution was interrupted (max_statement_time exceeded)
SHOW WARNINGS;
Level Code Message
-Error 1968 Query execution was interrupted (max_statement_time exceeded)
+Error 1969 Query execution was interrupted (max_statement_time exceeded)
ROLLBACK;
DROP TABLE t1;
@@ -159,17 +160,20 @@ begin
select 1;
select sql_no_cache * from t1 where i > 5;
select sql_no_cache * from t1 where i > 5;
+select sleep(2);
end |
set max_statement_time = 0.001;
call pr();
1
1
ERROR 70100: Query execution was interrupted (max_statement_time exceeded)
+set max_statement_time = 0;
drop procedure pr;
create procedure pr()
begin
select sql_no_cache * from t1 where i > 5;
select sql_no_cache * from t1 where i > 5;
+select sleep(2);
end |
set max_statement_time = 0.001;
call pr();
diff --git a/mysql-test/r/mdev-504.result b/mysql-test/r/mdev-504.result
index e178127cf2a..4d93e77c6e8 100644
--- a/mysql-test/r/mdev-504.result
+++ b/mysql-test/r/mdev-504.result
@@ -1,3 +1,4 @@
+SET GLOBAL net_write_timeout = 900;
CREATE TABLE A (
pk INTEGER AUTO_INCREMENT PRIMARY KEY,
fdate DATE
@@ -19,3 +20,4 @@ DROP TABLE A;
DROP PROCEDURE p_analyze;
DROP FUNCTION rnd3;
SET GLOBAL use_stat_tables = DEFAULT;
+SET GLOBAL net_write_timeout = DEFAULT;
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index 89aaf48219e..804313af701 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -2270,7 +2270,7 @@ 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 CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER INSERT ON t3 FOR EACH ROW CALL foo() latin1 latin1_swedish_ci latin1_swedish_ci
+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
DROP TRIGGER tr1;
DROP TABLE t1, t2, t3;
#
@@ -2545,11 +2545,14 @@ DROP TABLE t1;
# Test merge table with too many merge children.
#
drop table if exists t_parent;
-set @save_table_definition_cache=@@global.table_definition_cache;
+set @save_table_open_cache=@@global.table_open_cache;
#
-# Set @@global.table_definition_cache to minimum
+# Set @@global.table_open_cache to minimum
#
-set @@global.table_definition_cache=400;
+set @@global.table_open_cache=400;
+select @@table_open_cache;
+@@table_open_cache
+400
set @a=null;
#
# Create 400 merge children
@@ -2573,7 +2576,7 @@ deallocate prepare stmt;
# Cleanup
#
drop table t_parent;
-set @@global.table_definition_cache=@save_table_definition_cache;
+set @@global.table_open_cache=@save_table_open_cache;
DROP DATABASE IF EXISTS mysql_test1;
CREATE DATABASE mysql_test1;
CREATE TABLE t1 ... DATA DIRECTORY=... INDEX DIRECTORY=...
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 688184f2f83..b0265119eef 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -422,6 +422,7 @@ create database mysqltest;
create table mysqltest.t1 (a int, b int, primary key (a));
create table mysqltest.t2 (a int, b int, primary key (a));
create table mysqltest.t3 (a int, b int, primary key (a));
+create user mysqltest_1@localhost;
grant select on mysqltest.* to mysqltest_1@localhost;
grant update on mysqltest.t1 to mysqltest_1@localhost;
update t1, t2 set t1.b=1 where t1.a=t2.a;
diff --git a/mysql-test/r/myisam-optimize.result b/mysql-test/r/myisam-optimize.result
new file mode 100644
index 00000000000..9451046fe08
--- /dev/null
+++ b/mysql-test/r/myisam-optimize.result
@@ -0,0 +1,69 @@
+#
+# MDEV-8475 stale .TMM file causes Aria engine to stop serving the table
+#
+create table t1 (pk int primary key, i int) engine=MyISAM;
+insert into t1 values (1,1),(2,2);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `pk` int(11) NOT NULL,
+ `i` int(11) DEFAULT NULL,
+ PRIMARY KEY (`pk`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `pk` int(11) NOT NULL,
+ `i` int(11) DEFAULT NULL,
+ PRIMARY KEY (`pk`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status Table is already up to date
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `pk` int(11) NOT NULL,
+ `i` int(11) DEFAULT NULL,
+ PRIMARY KEY (`pk`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status Table is already up to date
+DROP TABLE t1;
+create table t1 (pk int primary key, i int) engine=aria;
+insert into t1 values (1,1),(2,2);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `pk` int(11) NOT NULL,
+ `i` int(11) DEFAULT NULL,
+ PRIMARY KEY (`pk`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `pk` int(11) NOT NULL,
+ `i` int(11) DEFAULT NULL,
+ PRIMARY KEY (`pk`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status Table is already up to date
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `pk` int(11) NOT NULL,
+ `i` int(11) DEFAULT NULL,
+ PRIMARY KEY (`pk`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status Table is already up to date
+DROP TABLE t1;
diff --git a/mysql-test/r/myisam-system.result b/mysql-test/r/myisam-system.result
index af5de8f2749..e489f87948a 100644
--- a/mysql-test/r/myisam-system.result
+++ b/mysql-test/r/myisam-system.result
@@ -2,18 +2,18 @@ drop table if exists t1,t2;
create table t1 (a int) engine=myisam;
drop table if exists t1;
Warnings:
-Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
+Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
create table t1 (a int) engine=myisam;
select * from t1;
ERROR HY000: Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
drop table t1;
Warnings:
-Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
+Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
create table t1 (a int) engine=myisam;
select * from t1;
ERROR HY000: File './test/t1.MYD' not found (Errcode: 2 "No such file or directory")
drop table t1;
Warnings:
-Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
+Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
drop table t1;
ERROR 42S02: Unknown table 'test.t1'
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index a99aed61cd9..093de1339f3 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -2527,6 +2527,17 @@ test.t1 check error Size of indexfile is: 1024 Should be: 2048
test.t1 check warning Size of datafile is: 14 Should be: 7
test.t1 check error Corrupt
DROP TABLE t1;
+#
+# MDEV-3870 - Valgrind warnings on OPTIMIZE MyISAM or Aria TABLE with
+# disabled keys
+#
+CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4),(3),(1),(0);
+ALTER TABLE t1 DISABLE KEYS;
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+DROP TABLE t1;
show variables like 'myisam_block_size';
Variable_name Value
myisam_block_size 1024
diff --git a/mysql-test/r/myisam_explain_non_select_all.result b/mysql-test/r/myisam_explain_non_select_all.result
index 688c1ccfec1..fc0f54286a1 100644
--- a/mysql-test/r/myisam_explain_non_select_all.result
+++ b/mysql-test/r/myisam_explain_non_select_all.result
@@ -2785,10 +2785,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
DROP TABLE t1,t2;
#74
-CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
-Warnings:
-Warning 1286 Unknown storage engine 'InnoDB'
-Warning 1266 Using storage engine MyISAM for table 't1'
+CREATE TABLE t1(a INT PRIMARY KEY);
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
# used key is modified & Using temporary
#
diff --git a/mysql-test/r/myisam_icp.result b/mysql-test/r/myisam_icp.result
index 49cba60320d..e726a50d89b 100644
--- a/mysql-test/r/myisam_icp.result
+++ b/mysql-test/r/myisam_icp.result
@@ -414,17 +414,11 @@ DROP TABLE t1;
# Bug#59259 "Incorrect rows returned for a correlated subquery
# when ICP is on"
#
-CREATE TABLE t1 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL) ENGINE=InnoDB;
-Warnings:
-Warning 1286 Unknown storage engine 'InnoDB'
-Warning 1266 Using storage engine MyISAM for table 't1'
+CREATE TABLE t1 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL);
INSERT INTO t1 VALUES (11,0);
INSERT INTO t1 VALUES (12,5);
INSERT INTO t1 VALUES (15,0);
-CREATE TABLE t2 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL) ENGINE=InnoDB;
-Warnings:
-Warning 1286 Unknown storage engine 'InnoDB'
-Warning 1266 Using storage engine MyISAM for table 't2'
+CREATE TABLE t2 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL);
INSERT INTO t2 VALUES (11,1);
INSERT INTO t2 VALUES (12,2);
INSERT INTO t2 VALUES (15,4);
@@ -604,6 +598,16 @@ SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
WHERE t2.pk <> t1.d1 AND t2.pk = 4;
d1 pk i1
1 4 1
+EXPLAIN
+SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
+WHERE t1.d1 <> t2.pk AND t2.pk = 4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL k1 9 NULL 3 Using index
+1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using where
+SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
+WHERE t1.d1 <> t2.pk AND t2.pk = 4;
+d1 pk i1
+1 4 1
DROP TABLE t1, t2;
#
# BUG#778434 Wrong result with in_to_exists=on in maria-5.3-mwl89
diff --git a/mysql-test/r/merge_recover.result b/mysql-test/r/myisam_recover.result
index 871c12ca4c0..0829c1e8b82 100644
--- a/mysql-test/r/merge_recover.result
+++ b/mysql-test/r/myisam_recover.result
@@ -1,5 +1,7 @@
#
-# Test of MyISAM MRG tables with corrupted children.
+# Tests for corrupted MyISAM tables and MyISAMMRG tables with corrupted
+# children..
+#
# Run with --myisam-recover=force option.
#
# Preparation: we need to make sure that the merge parent
@@ -44,20 +46,20 @@ drop procedure p_create;
# Switching to connection 'default'
#
#
-# We have to disable the ps-protocol, to avoid
+# We have to disable the ps-protocol, to avoid
# "Prepared statement needs to be re-prepared" errors
# -- table def versions change all the time with full table cache.
-#
+#
drop table if exists t1, t1_mrg, t1_copy;
#
# Prepare a MERGE engine table, that refers to a corrupted
# child.
-#
+#
create table t1 (a int, key(a)) engine=myisam;
create table t1_mrg (a int) union (t1) engine=merge;
#
# Create a table with a corrupted index file:
-# save an old index file, insert more rows,
+# save an old index file, insert more rows,
# overwrite the new index file with the old one.
#
insert into t1 (a) values (1), (2), (3);
@@ -101,3 +103,48 @@ execute stmt;
deallocate prepare stmt;
set @@global.table_definition_cache=default;
set @@global.table_open_cache=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.
+create table t1 (a int, key(a)) engine=myisam;
+create table t2 (a int);
+insert into t2 values (1);
+# Create a table with a corrupted index file:
+# save an old index file, insert more rows,
+# overwrite the new index file with the old one.
+insert into t1 (a) values (1);
+flush table t1;
+insert into t1 (a) values (4);
+flush table t1;
+# Check table is needed to mark the table as crashed.
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check warning Size of datafile is: 14 Should be: 7
+test.t1 check error Record-count is not ok; is 2 Should be: 1
+test.t1 check warning Found 2 key parts. Should be: 1
+test.t1 check error Corrupt
+# At this point we have a corrupt t1
+set autocommit = 0;
+select * from t2;
+a
+1
+# Without fix select from t1 will break the transaction. After the fix
+# transaction should be active and should hold lock on table t2. Alter
+# table from con2 will wait only if the transaction is not broken.
+select * from t1;
+a
+1
+4
+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
+ALTER TABLE t2 ADD val INT;
+# With fix we should have alter table waiting for t2 lock here.
+ROLLBACK;
+SET autocommit = 1;
+# Cleanup
+drop table t1, t2;
diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result
index 82d69557f0d..ca19d2eb98b 100644
--- a/mysql-test/r/mysql.result
+++ b/mysql-test/r/mysql.result
@@ -1,3 +1,5 @@
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
drop table if exists t1,t2,t3;
create table t1(a int);
insert into t1 values(1);
@@ -531,5 +533,6 @@ a
ERROR 1300 (HY000): Invalid utf8 character string: 'test\xF0\x9F\x98\x81 '
ERROR 1300 (HY000): Invalid binary character string: 'test\xF0\x9F\x98\x81 '
ERROR 1300 (HY000) at line 2: Invalid utf8 character string: 'test\xF0\x9F\x98\x81'
+set GLOBAL sql_mode=default;
End of tests
diff --git a/mysql-test/r/mysql_comments.result b/mysql-test/r/mysql_comments.result
index 7f1c0b50c5e..4865c7a7af0 100644
--- a/mysql-test/r/mysql_comments.result
+++ b/mysql-test/r/mysql_comments.result
@@ -1,3 +1,4 @@
+set global sql_mode="";
drop table if exists t1;
drop function if exists foofct;
drop procedure if exists empty;
@@ -59,4 +60,5 @@ Trigger sql_mode SQL Original Statement character_set_client collation_connectio
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
id data
trig 12
+set global sql_mode=default;
End of 5.0 tests
diff --git a/mysql-test/r/mysql_tzinfo_to_sql_symlink.result b/mysql-test/r/mysql_tzinfo_to_sql_symlink.result
index c00a0c73ce3..03543244105 100644
--- a/mysql-test/r/mysql_tzinfo_to_sql_symlink.result
+++ b/mysql-test/r/mysql_tzinfo_to_sql_symlink.result
@@ -76,3 +76,16 @@ set @toggle=1; execute set_wsrep_myisam using @toggle;
TRUNCATE TABLE time_zone_leap_second;
ALTER TABLE time_zone_leap_second ORDER BY Transition_time;
set @toggle=0; execute set_wsrep_myisam using @toggle;
+#
+# MDEV-6236 - [PATCH] mysql_tzinfo_to_sql may produce invalid SQL
+#
+set @prep=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET GLOBAL wsrep_replicate_myisam=?', 'do ?');
+prepare set_wsrep_myisam from @prep;
+set @toggle=1; execute set_wsrep_myisam using @toggle;
+TRUNCATE TABLE time_zone;
+TRUNCATE TABLE time_zone_name;
+TRUNCATE TABLE time_zone_transition;
+TRUNCATE TABLE time_zone_transition_type;
+ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
+ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
+set @toggle=0; execute set_wsrep_myisam using @toggle;
diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result
index 737f8b63783..673c241de11 100644
--- a/mysql-test/r/mysql_upgrade.result
+++ b/mysql-test/r/mysql_upgrade.result
@@ -1,3 +1,4 @@
+set sql_mode="";
Run mysql_upgrade once
Phase 1/6: Checking and upgrading mysql database
Processing databases
@@ -457,4 +458,65 @@ even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@loca
even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@localhost
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;
+set sql_mode=default;
+# Droping the previously created mysql_upgrade_info file..
+create table test.t1(a int) engine=MyISAM;
+# Trying to enforce InnoDB for all tables
+SET GLOBAL enforce_storage_engine=InnoDB;
+Phase 1/6: Checking and upgrading mysql database
+Processing databases
+mysql
+mysql.column_stats OK
+mysql.columns_priv OK
+mysql.db OK
+mysql.event OK
+mysql.func OK
+mysql.gtid_slave_pos OK
+mysql.help_category OK
+mysql.help_keyword OK
+mysql.help_relation OK
+mysql.help_topic OK
+mysql.host OK
+mysql.index_stats OK
+mysql.innodb_index_stats OK
+mysql.innodb_table_stats OK
+mysql.plugin OK
+mysql.proc OK
+mysql.procs_priv OK
+mysql.proxies_priv OK
+mysql.roles_mapping OK
+mysql.servers OK
+mysql.table_stats OK
+mysql.tables_priv OK
+mysql.time_zone OK
+mysql.time_zone_leap_second OK
+mysql.time_zone_name OK
+mysql.time_zone_transition OK
+mysql.time_zone_transition_type OK
+mysql.user OK
+Phase 2/6: Fixing views
+Phase 3/6: Running 'mysql_fix_privilege_tables'
+Phase 4/6: Fixing table and database names
+Phase 5/6: Checking and upgrading tables
+Processing databases
+information_schema
+mtr
+mtr.global_suppressions OK
+mtr.test_suppressions OK
+performance_schema
+test
+test.t1 OK
+Phase 6/6: Running 'FLUSH PRIVILEGES'
+OK
+# Should return 2
+SELECT count(*) FROM information_schema.tables where ENGINE="InnoDB";
+count(*)
+2
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE test.t1;
+SET GLOBAL enforce_storage_engine=NULL;
End of tests
diff --git a/mysql-test/r/mysql_upgrade_view.result b/mysql-test/r/mysql_upgrade_view.result
index 9490544e4d5..ef54ab6c9a5 100644
--- a/mysql-test/r/mysql_upgrade_view.result
+++ b/mysql-test/r/mysql_upgrade_view.result
@@ -3,6 +3,41 @@ drop table if exists t1,v1,v2,v3,v4,v1badcheck;
drop view if exists t1,v1,v2,v3,v4,v1badcheck;
create table t1(a int);
create table kv(k varchar(30) NOT NULL PRIMARY KEY,v varchar(50));
+create view v1 as select 1;
+repair table t1 quick;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+repair table t1 extended;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+repair table t1 use_frm;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+repair table t1 from mysql;
+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 mysql' at line 1
+repair view v1 quick;
+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 'quick' at line 1
+repair view v1 extended;
+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 'extended' at line 1
+repair view v1 use_frm;
+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 'use_frm' at line 1
+repair view v1 from mysql;
+Table Op Msg_type Msg_text
+test.v1 repair status OK
+check view v1 quick;
+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 'quick' at line 1
+check view v1 fast;
+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 'fast' at line 1
+check view v1 medium;
+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 'medium' at line 1
+check view v1 extended;
+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 'extended' at line 1
+check view v1 changed;
+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 'changed' at line 1
+check view v1 for upgrade;
+Table Op Msg_type Msg_text
+test.v1 check status OK
+drop view v1;
flush tables;
check view v1;
Table Op Msg_type Msg_text
diff --git a/mysql-test/r/mysqlbinlog-innodb.result b/mysql-test/r/mysqlbinlog-innodb.result
index f0358928c0e..2704be9e3ed 100644
--- a/mysql-test/r/mysqlbinlog-innodb.result
+++ b/mysql-test/r/mysqlbinlog-innodb.result
@@ -30,7 +30,7 @@ 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=0/*!*/;
+SET @@session.sql_mode=1342177280/*!*/;
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/*!*/;
@@ -61,7 +61,7 @@ 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=0/*!*/;
+SET @@session.sql_mode=1342177280/*!*/;
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 b29fe0b9ec7..94aaee0c574 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -23,7 +23,7 @@ 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=0/*!*/;
+SET @@session.sql_mode=1342177280/*!*/;
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/*!*/;
@@ -103,7 +103,7 @@ 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=0/*!*/;
+SET @@session.sql_mode=1342177280/*!*/;
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/*!*/;
@@ -139,7 +139,7 @@ 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=0/*!*/;
+SET @@session.sql_mode=1342177280/*!*/;
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/*!*/;
@@ -190,7 +190,7 @@ 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=0/*!*/;
+SET @@session.sql_mode=1342177280/*!*/;
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/*!*/;
@@ -217,7 +217,7 @@ 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=0/*!*/;
+SET @@session.sql_mode=1342177280/*!*/;
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/*!*/;
@@ -297,7 +297,7 @@ 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=0/*!*/;
+SET @@session.sql_mode=1342177280/*!*/;
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/*!*/;
@@ -333,7 +333,7 @@ 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=0/*!*/;
+SET @@session.sql_mode=1342177280/*!*/;
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/*!*/;
@@ -384,7 +384,7 @@ 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=0/*!*/;
+SET @@session.sql_mode=1342177280/*!*/;
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/*!*/;
@@ -493,7 +493,7 @@ 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=0/*!*/;
+SET @@session.sql_mode=1342177280/*!*/;
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/*!*/;
@@ -545,7 +545,7 @@ 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=0/*!*/;
+SET @@session.sql_mode=1342177280/*!*/;
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_row_big.result b/mysql-test/r/mysqlbinlog_row_big.result
index 0bdbfdcee3a..70e39266d1d 100644
--- a/mysql-test/r/mysqlbinlog_row_big.result
+++ b/mysql-test/r/mysqlbinlog_row_big.result
@@ -97,6 +97,6 @@ FLUSH LOGS;
# Cleanup.
#
# reset variable value to pass testcase checks
-SET @@global.max_allowed_packet = 1048576;
+SET @@global.max_allowed_packet = 4194304;
DROP TABLE t1;
remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_big_1.out
diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result
index adfc56fcd69..7d646dce596 100644
--- a/mysql-test/r/mysqlcheck.result
+++ b/mysql-test/r/mysqlcheck.result
@@ -347,3 +347,26 @@ CREATE TABLE test.`t.1` (id int);
mysqlcheck test t.1
test.t.1 OK
drop table test.`t.1`;
+create view v1 as select 1;
+mysqlcheck --process-views test
+test.v1 OK
+mysqlcheck --process-views --extended test
+test.v1 OK
+mysqlcheck --process-views --fast test
+mysqlcheck --process-views --quick test
+test.v1 OK
+mysqlcheck --process-views --check-only-changed test
+mysqlcheck --process-views --medium-check test
+test.v1 OK
+mysqlcheck --process-views --check-upgrade test
+test.v1 OK
+drop view v1;
+create table t1(a int);
+mysqlcheck --process-views --check-upgrade --auto-repair test
+test.t1 OK
+test.v1 Needs upgrade
+
+Repairing views
+test.v1 OK
+drop view v1;
+drop table t1;
diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result
index 8abda849494..ca668d135aa 100644
--- a/mysql-test/r/mysqld--help.result
+++ b/mysql-test/r/mysqld--help.result
@@ -21,9 +21,10 @@ The following options may be given as the first argument:
--automatic-sp-privileges
Creating and dropping stored procedures alters ACLs
(Defaults to on; use --skip-automatic-sp-privileges to disable.)
- --back-log=# The number of outstanding connection requests MySQL can
+ --back-log=# The number of outstanding connection requests MariaDB can
have. This comes into play when the main MySQL thread
gets very many connection requests in a very short time
+ (Automatically configured unless set explicitly)
-b, --basedir=name Path to installation directory. All paths are usually
resolved relative to this
--big-tables Allow big result sets by saving all temporary sets on
@@ -87,6 +88,17 @@ The following options may be given as the first argument:
The maximum size of a row-based binary log event in
bytes. Rows will be grouped into events smaller than this
size if possible. The value has to be a multiple of 256.
+ --binlog-row-image=name
+ Controls whether rows should be logged in 'FULL',
+ 'NOBLOB' or 'MINIMAL' formats. 'FULL', means that all
+ columns in the before and after image are logged.
+ 'NOBLOB', means that mysqld avoids logging blob columns
+ whenever possible (eg, blob column was not changed or is
+ not part of primary key). 'MINIMAL', means that a PK
+ equivalent (PK columns or full row if there is no PK in
+ the table) is logged in the before image, and only
+ changed columns are logged in the after image. (Default:
+ FULL).
--binlog-stmt-cache-size=#
The size of the statement cache for updates to
non-transactional engines for the binary log. If you
@@ -96,6 +108,9 @@ The following options may be given as the first argument:
--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.
@@ -162,12 +177,12 @@ The following options may be given as the first argument:
--div-precision-increment=#
Precision of the result of '/' operator will be increased
on that value
+ --encrypt-binlog Encrypt binary logs (including relay logs)
--encrypt-tmp-disk-tables
Encrypt temporary on-disk tables (created as part of
query execution)
--encrypt-tmp-files Encrypt temporary files (created for filesort, binary log
cache, etc)
- (Defaults to on; use --skip-encrypt-tmp-files to disable.)
--enforce-storage-engine=name
Force the use of a storage engine for new tables
--event-scheduler[=name]
@@ -249,6 +264,7 @@ The following options may be given as the first argument:
height-balanced, DOUBLE_PREC_HB - double precision
height-balanced.
--host-cache-size=# How many host names should be cached to avoid resolving.
+ (Automatically configured unless set explicitly)
--ignore-builtin-innodb
Disable initialization of builtin InnoDB plugin
--ignore-db-dirs=name
@@ -653,6 +669,9 @@ The following options may be given as the first argument:
--performance-schema-max-cond-instances=#
Maximum number of instrumented condition objects. Use 0
to disable, -1 for automated sizing.
+ --performance-schema-max-digest-length=#
+ Maximum length considered for digest text, when stored in
+ performance_schema tables.
--performance-schema-max-file-classes=#
Maximum number of file instruments.
--performance-schema-max-file-handles=#
@@ -876,6 +895,7 @@ The following options may be given as the first argument:
write privileges to the mysql.user table.
--secure-auth Disallow authentication for accounts that have old
(pre-4.1) passwords
+ (Defaults to on; use --skip-secure-auth to disable.)
--secure-file-priv=name
Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to
files within specified directory
@@ -1024,13 +1044,12 @@ The following options may be given as the first argument:
(Defaults to on; use --skip-sync-frm to disable.)
--sync-master-info=#
Synchronously flush master info to disk after every #th
- event. Use 0 (default) to disable synchronous flushing
+ event. Use 0 to disable synchronous flushing
--sync-relay-log=# Synchronously flush relay log to disk after every #th
- event. Use 0 (default) to disable synchronous flushing
+ event. Use 0 to disable synchronous flushing
--sync-relay-log-info=#
Synchronously flush relay log info to disk after every
- #th transaction. Use 0 (default) to disable synchronous
- flushing
+ #th transaction. Use 0 to disable synchronous flushing
--sysdate-is-now Non-default option to alias SYSDATE() to NOW() to make it
safe-replicable. Since 5.0, SYSDATE() returns a `dynamic'
value different for different invocations, even within
@@ -1112,7 +1131,7 @@ auto-increment-increment 1
auto-increment-offset 1
autocommit TRUE
automatic-sp-privileges TRUE
-back-log 150
+back-log 80
big-tables FALSE
bind-address (No default value)
binlog-annotate-row-events FALSE
@@ -1124,8 +1143,10 @@ binlog-direct-non-transactional-updates FALSE
binlog-format STATEMENT
binlog-optimize-thread-scheduling TRUE
binlog-row-event-max-size 1024
+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-set-server latin1
@@ -1151,8 +1172,9 @@ delayed-insert-limit 100
delayed-insert-timeout 300
delayed-queue-size 1000
div-precision-increment 4
+encrypt-binlog FALSE
encrypt-tmp-disk-tables FALSE
-encrypt-tmp-files TRUE
+encrypt-tmp-files FALSE
enforce-storage-engine (No default value)
event-scheduler OFF
expensive-subquery-limit 100
@@ -1177,7 +1199,7 @@ gtid-strict-mode FALSE
help TRUE
histogram-size 0
histogram-type SINGLE_PREC_HB
-host-cache-size 128
+host-cache-size 279
ignore-builtin-innodb FALSE
ignore-db-dirs
init-connect
@@ -1185,7 +1207,7 @@ init-file (No default value)
init-rpl-role MASTER
init-slave
interactive-timeout 28800
-join-buffer-size 131072
+join-buffer-size 262144
join-buffer-space-limit 2097152
join-cache-level 2
keep-files-on-create FALSE
@@ -1223,7 +1245,7 @@ lower-case-table-names 1
master-info-file master.info
master-retry-count 86400
master-verify-checksum FALSE
-max-allowed-packet 1048576
+max-allowed-packet 4194304
max-binlog-cache-size 18446744073709547520
max-binlog-size 1073741824
max-binlog-stmt-cache-size 18446744073709547520
@@ -1235,7 +1257,7 @@ max-error-count 64
max-heap-table-size 16777216
max-join-size 18446744073709551615
max-length-for-sort-data 1024
-max-long-data-size 1048576
+max-long-data-size 4194304
max-prepared-stmt-count 16382
max-relay-log-size 1073741824
max-seeks-for-key 18446744073709551615
@@ -1300,6 +1322,7 @@ performance-schema-hosts-size -1
performance-schema-instrument
performance-schema-max-cond-classes 80
performance-schema-max-cond-instances -1
+performance-schema-max-digest-length 1024
performance-schema-max-file-classes 50
performance-schema-max-file-handles 32768
performance-schema-max-file-instances -1
@@ -1329,9 +1352,9 @@ protocol-version 10
query-alloc-block-size 16384
query-cache-limit 1048576
query-cache-min-res-unit 4096
-query-cache-size 0
+query-cache-size 1048576
query-cache-strip-comments FALSE
-query-cache-type ON
+query-cache-type OFF
query-cache-wlock-invalidate FALSE
query-prealloc-size 24576
range-alloc-block-size 4096
@@ -1353,7 +1376,7 @@ report-port 0
report-user (No default value)
rowid-merge-buff-size 8388608
safe-user-create FALSE
-secure-auth FALSE
+secure-auth TRUE
secure-file-priv (No default value)
server-id 0
show-slave-auth-info FALSE
@@ -1379,20 +1402,20 @@ slave-type-conversions
slow-launch-time 2
slow-query-log FALSE
sort-buffer-size 2097152
-sql-mode
+sql-mode NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
stack-trace TRUE
stored-program-cache 256
strict-password-validation TRUE
symbolic-links FALSE
sync-binlog 0
sync-frm FALSE
-sync-master-info 0
-sync-relay-log 0
-sync-relay-log-info 0
+sync-master-info 10000
+sync-relay-log 10000
+sync-relay-log-info 10000
sysdate-is-now FALSE
-table-cache 400
+table-cache 431
table-definition-cache 400
-table-open-cache 400
+table-open-cache 431
tc-heuristic-recover COMMIT
thread-cache-size 0
thread-pool-idle-timeout 60
diff --git a/mysql-test/r/mysqldump-max.result b/mysql-test/r/mysqldump-max.result
index 8d5ab551bee..5eff7a41abd 100644
--- a/mysql-test/r/mysqldump-max.result
+++ b/mysql-test/r/mysqldump-max.result
@@ -332,12 +332,12 @@ a b
2 1
DROP TABLE t1;
DROP TABLE t2;
-SHOW BINLOG EVENTS LIMIT 7,3;
+include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 593 Xid 1 620 COMMIT /* XID */
-master-bin.000001 620 Gtid 1 658 GTID 0-1-3
-master-bin.000001 658 Query 1 777 use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB
--- CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=939;
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES (1,0), (2,0)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-- CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=<pos>;
SELECT * FROM t1 ORDER BY a;
a
1
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index a967af77a8d..ae4377533cc 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -418,7 +418,7 @@ UNLOCK TABLES;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-set global sql_mode='';
+set global sql_mode=default;
drop table t1;
#
# Bug#2705 mysqldump --tab extra output
@@ -1970,9 +1970,9 @@ DROP TABLE IF EXISTS "t1";
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE "t1" (
- "a b" int(11) NOT NULL DEFAULT '0',
- "c""d" int(11) NOT NULL DEFAULT '0',
- "e`f" int(11) NOT NULL DEFAULT '0',
+ "a b" int(11) NOT NULL,
+ "c""d" int(11) NOT NULL,
+ "e`f" int(11) NOT NULL,
PRIMARY KEY ("a b","c""d","e`f")
);
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -2004,9 +2004,9 @@ DROP TABLE IF EXISTS `t1`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
- `a b` int(11) NOT NULL DEFAULT '0',
- `c"d` int(11) NOT NULL DEFAULT '0',
- `e``f` int(11) NOT NULL DEFAULT '0',
+ `a b` int(11) NOT NULL,
+ `c"d` int(11) NOT NULL,
+ `e``f` int(11) NOT NULL,
PRIMARY KEY (`a b`,`c"d`,`e``f`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -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 root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+end BEFORE 0000-00-00 00:00:00 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 root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+end BEFORE 0000-00-00 00:00:00 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 = '' */ ;
+/*!50003 SET sql_mode = '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 = '' */ ;
+/*!50003 SET sql_mode = '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 # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+end BEFORE # 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 # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+end BEFORE # 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 root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+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
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 = '' */ ;
+/*!50003 SET sql_mode = '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 = '' */ ;
+/*!50003 SET sql_mode = '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 = '' */ ;
+/*!50003 SET sql_mode = '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 = '' */ ;
+/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `bug9056_proc2`(OUT a INT)
BEGIN
@@ -3849,7 +3849,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 = '' */ ;
+/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`user1`@`%` PROCEDURE `sp1`()
select 'hello' ;;
diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result
index 93f3ac4ab7b..b4cebac661f 100644
--- a/mysql-test/r/null.result
+++ b/mysql-test/r/null.result
@@ -230,7 +230,7 @@ t1 CREATE TABLE `t1` (
`c00` binary(0) DEFAULT NULL,
`c01` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
`c02` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
- `c03` varchar(6) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `c03` varchar(6) CHARACTER SET latin2 NOT NULL,
`c04` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
`c05` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
`c06` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
@@ -1369,7 +1369,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) and 1)
+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,7 +1377,7 @@ 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) and 1)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010)
DROP TABLE t1;
# Two warnings expected
CREATE TABLE t1 AS SELECT
@@ -1390,5 +1390,80 @@ Warning 1292 Incorrect datetime value: '1'
Warning 1292 Incorrect datetime value: '1'
DROP TABLE t1;
#
+# MDEV-8785 Wrong results for EXPLAIN EXTENDED...WHERE NULLIF(latin1_col, _utf8'a' COLLATE utf8_bin) IS NOT NULL
+#
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT a, NULLIF(a,_utf8'a' COLLATE utf8_bin) IS NULL FROM t1;
+a NULLIF(a,_utf8'a' COLLATE utf8_bin) IS NULL
+a 1
+A 0
+SELECT CHARSET(NULLIF(a,_utf8'a' COLLATE utf8_bin)) FROM t1;
+CHARSET(NULLIF(a,_utf8'a' COLLATE utf8_bin))
+latin1
+latin1
+EXPLAIN EXTENDED SELECT NULLIF(a,_utf8'a' COLLATE utf8_bin) IS NULL AS expr FROM t1;
+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`
+DROP TABLE t1;
+#
+# MDEV-8740 Wrong result for SELECT..WHERE year_field=10 AND NULLIF(year_field,2011.1)='2011'
+#
+CREATE TABLE t1 (a YEAR);
+INSERT INTO t1 VALUES (2010),(2011);
+SELECT a=10 AND NULLIF(a,2011.1)='2011' AS cond FROM t1;
+cond
+0
+0
+SELECT * FROM t1 WHERE a=10;
+a
+2010
+SELECT * FROM t1 WHERE NULLIF(a,2011.1)='2011';
+a
+SELECT * FROM t1 WHERE a=10 AND NULLIF(a,2011.1)='2011';
+a
+EXPLAIN EXTENDED
+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'))
+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())))
+DROP TABLE t1;
+#
+# MDEV-8754 Wrong result for SELECT..WHERE year_field=2020 AND NULLIF(year_field,2010)='2020'
+#
+CREATE TABLE t1 (a YEAR);
+INSERT INTO t1 VALUES (2010),(2020);
+SELECT * FROM t1 WHERE a=2020;
+a
+2020
+SELECT * FROM t1 WHERE NULLIF(a,2010)='2020';
+a
+2020
+SELECT * FROM t1 WHERE a=2020 AND NULLIF(a,2010)='2020';
+a
+2020
+EXPLAIN EXTENDED
+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'))
+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())))
+DROP TABLE t1;
+#
# End of 10.1 tests
#
diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result
index c5dd1500110..1d5c6d179df 100644
--- a/mysql-test/r/openssl_1.result
+++ b/mysql-test/r/openssl_1.result
@@ -1,3 +1,5 @@
+set local sql_mode="";
+set global sql_mode="";
drop table if exists t1;
create table t1(f1 int);
insert into t1 values (5);
@@ -206,4 +208,5 @@ SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value
Ssl_cipher DHE-RSA-AES256-SHA
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 52d5978749e..6285faa0143 100644
--- a/mysql-test/r/openssl_6975,tlsv10.result
+++ b/mysql-test/r/openssl_6975,tlsv10.result
@@ -1,4 +1,6 @@
+create user ssl_sslv3@localhost;
grant select on test.* to ssl_sslv3@localhost require cipher "RC4-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
diff --git a/mysql-test/r/openssl_6975,tlsv12.result b/mysql-test/r/openssl_6975,tlsv12.result
index 033220427be..31d2658c829 100644
--- a/mysql-test/r/openssl_6975,tlsv12.result
+++ b/mysql-test/r/openssl_6975,tlsv12.result
@@ -1,4 +1,6 @@
+create user ssl_sslv3@localhost;
grant select on test.* to ssl_sslv3@localhost require cipher "RC4-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
Variable_name Value
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index d5b25534de0..a015819e480 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -287,6 +287,8 @@ PRIMARY KEY (member_id)
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
diff --git a/mysql-test/r/parser.result b/mysql-test/r/parser.result
index 5b0fbbcbe87..1d29f2c4a0e 100644
--- a/mysql-test/r/parser.result
+++ b/mysql-test/r/parser.result
@@ -643,3 +643,10 @@ CREATE TRIGGER trigger1 BEFORE INSERT ON t1 FOR EACH ROW
SET default_storage_engine = NEW.INNODB;
ERROR 42S22: Unknown column 'INNODB' in 'NEW'
DROP TABLE t1;
+#
+# MDEV-7792 - SQL Parsing Error - UNION AND ORDER BY WITH JOIN
+#
+CREATE TABLE t1(a INT);
+SELECT * FROM t1 JOIN ((SELECT 1 AS b) UNION ALL (SELECT 2 AS b) ORDER BY b DESC) s1 WHERE a=1;
+a b
+DROP TABLE t1;
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index 233494238a5..71adc194693 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -2628,3 +2628,16 @@ alter table t1 drop partition if exists p5;
Warnings:
Note 1507 Error in list of partitions to DROP
DROP TABLE t1;
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8283 crash in get_mm_leaf with xor on binary col
+#
+CREATE TABLE t1(a BINARY(80)) PARTITION BY KEY(a) PARTITIONS 3;
+SELECT 1 FROM t1 WHERE a XOR 'a';
+1
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/partition_cache.result b/mysql-test/r/partition_cache.result
index cd579d00952..39ba4841337 100644
--- a/mysql-test/r/partition_cache.result
+++ b/mysql-test/r/partition_cache.result
@@ -1,3 +1,5 @@
+SET global query_cache_type=ON;
+SET local query_cache_type=ON;
SET SESSION STORAGE_ENGINE = InnoDB;
drop table if exists t1,t2,t3;
set @save_query_cache_size = @@global.query_cache_size;
@@ -203,3 +205,4 @@ Variable_name Value
Qcache_hits 1
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 0d0abbb096c..271b23eed92 100644
--- a/mysql-test/r/partition_cache_innodb.result
+++ b/mysql-test/r/partition_cache_innodb.result
@@ -1,3 +1,5 @@
+SET global query_cache_type=ON;
+SET local query_cache_type=ON;
SET SESSION STORAGE_ENGINE = innodb;
drop table if exists t1;
set @save_query_cache_size = @@global.query_cache_size;
@@ -149,3 +151,4 @@ Variable_name Value
Qcache_hits 1
drop table t1;
set @@global.query_cache_size = @save_query_cache_size;
+SET global query_cache_type=default;
diff --git a/mysql-test/r/partition_cache_myisam.result b/mysql-test/r/partition_cache_myisam.result
index 0b617c03590..b7d3dc53599 100644
--- a/mysql-test/r/partition_cache_myisam.result
+++ b/mysql-test/r/partition_cache_myisam.result
@@ -1,3 +1,5 @@
+SET global query_cache_type=ON;
+SET local query_cache_type=ON;
SET SESSION STORAGE_ENGINE = myisam;
drop table if exists t1;
set @save_query_cache_size = @@global.query_cache_size;
@@ -151,3 +153,4 @@ Variable_name Value
Qcache_hits 2
drop table t1;
set @@global.query_cache_size = @save_query_cache_size;
+SET global query_cache_type=default;
diff --git a/mysql-test/r/partition_datatype.result b/mysql-test/r/partition_datatype.result
index 080b008c690..fa58df3dec3 100644
--- a/mysql-test/r/partition_datatype.result
+++ b/mysql-test/r/partition_datatype.result
@@ -326,7 +326,7 @@ partition by hash (a)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bit(27) NOT NULL DEFAULT b'0',
+ `a` bit(27) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (a)
diff --git a/mysql-test/r/partition_exchange.result b/mysql-test/r/partition_exchange.result
index fec08e99c72..0f6ac2cf480 100644
--- a/mysql-test/r/partition_exchange.result
+++ b/mysql-test/r/partition_exchange.result
@@ -485,14 +485,14 @@ INSERT INTO tsp VALUES (2, "First value"), (10, "Ten"), (50, "Fifty"), (200, "Tw
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -523,14 +523,14 @@ ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -583,14 +583,14 @@ ERROR HY000: Found a row that does not match the partition
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -639,14 +639,14 @@ ERROR HY000: Table to exchange with partition is partitioned: 'tp'
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -656,7 +656,7 @@ tp CREATE TABLE `tp` (
SHOW CREATE TABLE tsp;
Table Create Table
tsp CREATE TABLE `tsp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -693,14 +693,14 @@ ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -731,14 +731,14 @@ ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -770,14 +770,14 @@ ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE tsp;
Table Create Table
tsp CREATE TABLE `tsp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -815,14 +815,14 @@ ALTER TABLE tp ENGINE = InnoDB;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
@@ -853,14 +853,14 @@ ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
@@ -894,14 +894,14 @@ ALTER TABLE tp ENGINE = InnoDB;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
@@ -913,14 +913,14 @@ ERROR HY000: The mix of handlers in the partitions is not allowed in this versio
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
@@ -946,14 +946,14 @@ INSERT INTO t SELECT * FROM tmp2;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=1000 MAX_ROWS=100000
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -975,7 +975,7 @@ ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `ba_key` (`b`,`a`)
@@ -983,7 +983,7 @@ t CREATE TABLE `t` (
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `ba_key` (`b`,`a`)
@@ -1034,7 +1034,7 @@ ALTER TABLE tmp RENAME TO t;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TEMPORARY TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `ba_key` (`b`,`a`)
@@ -1042,7 +1042,7 @@ t CREATE TEMPORARY TABLE `t` (
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `ba_key` (`b`,`a`)
@@ -1055,7 +1055,7 @@ ERROR HY000: Table to exchange with partition is temporary: 't'
SHOW CREATE TABLE t;
Table Create Table
t CREATE TEMPORARY TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `ba_key` (`b`,`a`)
@@ -1063,7 +1063,7 @@ t CREATE TEMPORARY TABLE `t` (
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `ba_key` (`b`,`a`)
diff --git a/mysql-test/r/partition_grant.result b/mysql-test/r/partition_grant.result
index c334a473a2a..f036b0bcc28 100644
--- a/mysql-test/r/partition_grant.result
+++ b/mysql-test/r/partition_grant.result
@@ -3,6 +3,7 @@ create schema mysqltest_1;
use mysqltest_1;
create table t1 (a int) partition by list (a) (partition p1 values in (1), partition p2 values in (2), partition p3 values in (3));
insert into t1 values (1),(2);
+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;
diff --git a/mysql-test/r/partition_hash.result b/mysql-test/r/partition_hash.result
index 90126bdd4fd..9a63db3f974 100644
--- a/mysql-test/r/partition_hash.result
+++ b/mysql-test/r/partition_hash.result
@@ -166,9 +166,11 @@ select * from t1;
f1 f2
-1 #######
drop table t1;
+set sql_mode="";
CREATE TABLE t1 (s1 int) ENGINE=BLACKHOLE PARTITION BY HASH (s1);
INSERT INTO t1 VALUES (0);
DROP TABLE t1;
+set sql_mode=default;
create table t1 (c1 int DEFAULT NULL,
c2 varchar (30) DEFAULT NULL,
c3 date DEFAULT NULL)
diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result
index 92c9c01db2d..8a72d5fe3b1 100644
--- a/mysql-test/r/partition_innodb.result
+++ b/mysql-test/r/partition_innodb.result
@@ -380,33 +380,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 NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Compact 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 NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Compact 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 NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Compact 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 NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Compact 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 NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Compact 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 NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Compact 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)
@@ -429,6 +429,7 @@ where a between '2006-01-01' and '2007-06-01';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where
drop table t1;
+SET SQL_MODE="";
create table t1 (a int)
engine = x
partition by key (a);
@@ -457,6 +458,7 @@ t1 CREATE TABLE `t1` (
/*!50100 PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0) ENGINE = InnoDB) */
drop table t1;
+SET SQL_MODE=default;
create table t1
(
id int unsigned auto_increment,
@@ -588,6 +590,17 @@ a b
0 1
DROP TABLE t1;
#
+# Bug #17299181 CREATE_TIME AND UPDATE_TIME ARE
+# WRONG FOR PARTITIONED TABLES
+#
+CREATE TABLE t1 (a int, PRIMARY KEY (a)) ENGINE=InnoDB
+PARTITION BY HASH (a) PARTITIONS 2;
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE
+CREATE_TIME IS NOT NULL AND TABLE_NAME='t1';
+COUNT(*)
+1
+DROP TABLE t1;
+#
# BUG#12912171 - ASSERTION FAILED: QUICK->HEAD->READ_SET ==
# SAVE_READ_SET
#
diff --git a/mysql-test/r/partition_innodb_plugin.result b/mysql-test/r/partition_innodb_plugin.result
index 7057bb0a55b..63c9da69955 100644
--- a/mysql-test/r/partition_innodb_plugin.result
+++ b/mysql-test/r/partition_innodb_plugin.result
@@ -24,7 +24,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
- `time` date NOT NULL DEFAULT '0000-00-00',
+ `time` date NOT NULL,
`id2` bigint(20) NOT NULL,
PRIMARY KEY (`id`,`time`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8
diff --git a/mysql-test/r/partition_myisam.result b/mysql-test/r/partition_myisam.result
index 80b3a9511ea..bb1a7b19a9d 100644
--- a/mysql-test/r/partition_myisam.result
+++ b/mysql-test/r/partition_myisam.result
@@ -90,7 +90,7 @@ ERROR HY000: Failed to read from the .par file
# Note that it is currently impossible to drop a partitioned table
# without the .par file
DROP TABLE t1;
-ERROR 42S02: Unknown table 'test.t1'
+ERROR HY000: Got error 1 "Operation not permitted" from storage engine partition
#
# Bug#50392: insert_id is not reset for partitioned tables
# auto_increment on duplicate entry
diff --git a/mysql-test/r/partition_not_blackhole.result b/mysql-test/r/partition_not_blackhole.result
index c5832d66da4..ff1e51df892 100644
--- a/mysql-test/r/partition_not_blackhole.result
+++ b/mysql-test/r/partition_not_blackhole.result
@@ -11,6 +11,6 @@ t1
SHOW CREATE TABLE t1;
ERROR HY000: Failed to read from the .par file
DROP TABLE t1;
-ERROR 42S02: Unknown table 'test.t1'
+ERROR HY000: Got error 1 "Operation not permitted" from storage engine partition
t1.frm
t1.par
diff --git a/mysql-test/r/plugin.result b/mysql-test/r/plugin.result
index 42a29f25432..c23c4f2d8a2 100644
--- a/mysql-test/r/plugin.result
+++ b/mysql-test/r/plugin.result
@@ -1,11 +1,8 @@
CREATE TABLE t1(a int) ENGINE=EXAMPLE;
-Warnings:
-Warning 1286 Unknown storage engine 'EXAMPLE'
-Warning 1266 Using storage engine MyISAM for table 't1'
-DROP TABLE t1;
+ERROR 42000: Unknown storage engine 'EXAMPLE'
INSTALL PLUGIN example SONAME 'ha_example';
INSTALL PLUGIN EXAMPLE SONAME 'ha_example';
-ERROR HY000: Function 'EXAMPLE' already exists
+ERROR HY000: Plugin 'EXAMPLE' already installed
UNINSTALL PLUGIN example;
INSTALL SONAME 'ha_example';
select * from information_schema.plugins where plugin_library like 'ha_example%';
@@ -321,3 +318,16 @@ UNUSABLE
uninstall soname 'ha_example';
select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
plugin_name
+#
+# MDEV-5309 - RENAME TABLE does not check for existence of the table's
+# engine
+#
+INSTALL PLUGIN example SONAME 'ha_example';
+CREATE TABLE t1(a INT) ENGINE=EXAMPLE;
+SELECT * FROM t1;
+a
+FLUSH TABLES;
+UNINSTALL PLUGIN example;
+RENAME TABLE t1 TO t2;
+ERROR 42S02: Table 'test.t1' doesn't exist
+DROP TABLE t1;
diff --git a/mysql-test/r/plugin_auth.result b/mysql-test/r/plugin_auth.result
index 0d3948dd313..626722f9dd1 100644
--- a/mysql-test/r/plugin_auth.result
+++ b/mysql-test/r/plugin_auth.result
@@ -1,3 +1,5 @@
+SET GLOBAL SQL_MODE="";
+SET LOCAL SQL_MODE="";
SELECT PLUGIN_STATUS, PLUGIN_TYPE, PLUGIN_DESCRIPTION
FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME='test_plugin_server';
PLUGIN_STATUS ACTIVE
@@ -44,7 +46,7 @@ plug@localhost plug_dest@%
## test no_auto_create_user sql mode with plugin users
SET @@sql_mode=no_auto_create_user;
GRANT INSERT ON TEST.* TO grant_user IDENTIFIED WITH 'test_plugin_server';
-SET @@sql_mode=default;
+SET @@sql_mode="";
DROP USER grant_user;
## test utf-8 user name
CREATE USER `Ÿ` IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
@@ -426,4 +428,5 @@ USER() CURRENT_USER()
bug12818542@localhost bug12818542_dest@localhost
DROP USER bug12818542@localhost;
DROP USER bug12818542_dest@localhost;
+SET GLOBAL SQL_MODE=default;
End of 5.5 tests
diff --git a/mysql-test/r/plugin_auth_qa.result b/mysql-test/r/plugin_auth_qa.result
index b86a01f6b52..4f274c45971 100644
--- a/mysql-test/r/plugin_auth_qa.result
+++ b/mysql-test/r/plugin_auth_qa.result
@@ -1,3 +1,4 @@
+set sql_mode="";
CREATE DATABASE test_user_db;
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
user plugin authentication_string
diff --git a/mysql-test/r/plugin_not_embedded.result b/mysql-test/r/plugin_not_embedded.result
index 27553366660..8106abc497f 100644
--- a/mysql-test/r/plugin_not_embedded.result
+++ b/mysql-test/r/plugin_not_embedded.result
@@ -1,6 +1,7 @@
#
# Bug#51770: UNINSTALL PLUGIN requires no privileges
#
+CREATE USER bug51770@localhost;
GRANT INSERT ON mysql.plugin TO bug51770@localhost;
INSTALL PLUGIN example SONAME 'ha_example.so';
UNINSTALL PLUGIN example;
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 95a9a299bb5..1bdfaa7cc70 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -1106,7 +1106,7 @@ t1 CREATE TABLE `t1` (
show create table mysqltest.t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `test` varchar(4) CHARACTER SET latin1 NOT NULL DEFAULT ''
+ `test` varchar(4) CHARACTER SET latin1 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8
drop table mysqltest.t1;
drop table mysqltest.t2;
@@ -1121,7 +1121,7 @@ t1 CREATE TABLE `t1` (
show create table mysqltest.t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `test` varchar(4) NOT NULL DEFAULT ''
+ `test` varchar(4) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop database mysqltest;
deallocate prepare stmt1;
@@ -2390,15 +2390,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 CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
+a 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 CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
+a 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 CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
+a 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|
@@ -2410,15 +2410,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 CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
+a 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 CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
+a 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 CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
+a 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;
@@ -2427,15 +2427,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 CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
+a 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 CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
+a 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 CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
+a 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|
@@ -2447,15 +2447,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 CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
+a 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 CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
+a 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 CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
+a 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;
@@ -2465,22 +2465,22 @@ create procedure proc_1() show create table tab1;
call proc_1();
Table Create Table
tab1 CREATE TABLE `tab1` (
- `a` int(11) NOT NULL DEFAULT '0',
- `b` char(1) NOT NULL DEFAULT '',
+ `a` int(11) NOT NULL,
+ `b` char(1) NOT NULL,
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
call proc_1();
Table Create Table
tab1 CREATE TABLE `tab1` (
- `a` int(11) NOT NULL DEFAULT '0',
- `b` char(1) NOT NULL DEFAULT '',
+ `a` int(11) NOT NULL,
+ `b` char(1) NOT NULL,
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
call proc_1();
Table Create Table
tab1 CREATE TABLE `tab1` (
- `a` int(11) NOT NULL DEFAULT '0',
- `b` char(1) NOT NULL DEFAULT '',
+ `a` int(11) NOT NULL,
+ `b` char(1) NOT NULL,
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop procedure proc_1;
@@ -2494,22 +2494,22 @@ prepare abc from "show create table tab1";
execute abc;
Table Create Table
tab1 CREATE TABLE `tab1` (
- `a` int(11) NOT NULL DEFAULT '0',
- `b` char(1) NOT NULL DEFAULT '',
+ `a` int(11) NOT NULL,
+ `b` char(1) NOT NULL,
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
execute abc;
Table Create Table
tab1 CREATE TABLE `tab1` (
- `a` int(11) NOT NULL DEFAULT '0',
- `b` char(1) NOT NULL DEFAULT '',
+ `a` int(11) NOT NULL,
+ `b` char(1) NOT NULL,
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
execute abc;
Table Create Table
tab1 CREATE TABLE `tab1` (
- `a` int(11) NOT NULL DEFAULT '0',
- `b` char(1) NOT NULL DEFAULT '',
+ `a` int(11) NOT NULL,
+ `b` char(1) NOT NULL,
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
deallocate prepare abc;
diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result
index 3ce52cb1595..2ed38dc5c11 100644
--- a/mysql-test/r/ps_1general.result
+++ b/mysql-test/r/ps_1general.result
@@ -308,7 +308,7 @@ Threads_running #
prepare stmt4 from ' show variables like ''sql_mode'' ';
execute stmt4;
Variable_name Value
-sql_mode
+sql_mode NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
prepare stmt4 from ' show engine myisam logs ';
execute stmt4;
Type Name Status
diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result
index 6ca76191db5..194d61aaaf8 100644
--- a/mysql-test/r/ps_2myisam.result
+++ b/mysql-test/r/ps_2myisam.result
@@ -49,7 +49,7 @@ test_sequence
prepare stmt1 from ' select * from t9 order by c1 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def test t9 t9 c1 c1 1 4 1 N 49155 0 63
+def test t9 t9 c1 c1 1 4 1 N 53251 0 63
def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
@@ -1775,21 +1775,21 @@ NULL as const12, @arg12 as param12,
show create table t5 ;
Table Create Table
t5 CREATE TABLE `t5` (
- `const01` int(1) NOT NULL DEFAULT '0',
+ `const01` int(1) NOT NULL,
`param01` bigint(20) DEFAULT NULL,
- `const02` decimal(2,1) NOT NULL DEFAULT '0.0',
+ `const02` decimal(2,1) NOT NULL,
`param02` decimal(65,30) DEFAULT NULL,
- `const03` double NOT NULL DEFAULT '0',
+ `const03` double NOT NULL,
`param03` double DEFAULT NULL,
- `const04` varchar(3) NOT NULL DEFAULT '',
+ `const04` varchar(3) NOT NULL,
`param04` longtext,
- `const05` varbinary(3) NOT NULL DEFAULT '',
+ `const05` varbinary(3) NOT NULL,
`param05` longblob,
- `const06` varchar(10) NOT NULL DEFAULT '',
+ `const06` varchar(10) NOT NULL,
`param06` longtext,
`const07` date DEFAULT NULL,
`param07` longtext,
- `const08` varchar(19) NOT NULL DEFAULT '',
+ `const08` varchar(19) NOT NULL,
`param08` longtext,
`const09` datetime DEFAULT NULL,
`param09` longtext,
@@ -1805,21 +1805,21 @@ t5 CREATE TABLE `t5` (
) 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 32769 0 63
+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 32769 1 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 const03 const03 5 17 1 N 32769 31 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 1 0 8
+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 129 0 63
+def test t5 t5 const05 const05 253 3 3 N 4225 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 1 0 8
+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
def test t5 t5 const07 const07 10 10 10 Y 128 0 63
def test t5 t5 param07 param07 252 4294967295 10 Y 16 0 8
-def test t5 t5 const08 const08 253 19 19 N 1 0 8
+def test t5 t5 const08 const08 253 19 19 N 4097 0 8
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8
diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result
index 47237790ae5..c9e7d042508 100644
--- a/mysql-test/r/ps_3innodb.result
+++ b/mysql-test/r/ps_3innodb.result
@@ -49,7 +49,7 @@ test_sequence
prepare stmt1 from ' select * from t9 order by c1 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def test t9 t9 c1 c1 1 4 1 N 49155 0 63
+def test t9 t9 c1 c1 1 4 1 N 53251 0 63
def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
@@ -1758,21 +1758,21 @@ NULL as const12, @arg12 as param12,
show create table t5 ;
Table Create Table
t5 CREATE TABLE `t5` (
- `const01` int(1) NOT NULL DEFAULT '0',
+ `const01` int(1) NOT NULL,
`param01` bigint(20) DEFAULT NULL,
- `const02` decimal(2,1) NOT NULL DEFAULT '0.0',
+ `const02` decimal(2,1) NOT NULL,
`param02` decimal(65,30) DEFAULT NULL,
- `const03` double NOT NULL DEFAULT '0',
+ `const03` double NOT NULL,
`param03` double DEFAULT NULL,
- `const04` varchar(3) NOT NULL DEFAULT '',
+ `const04` varchar(3) NOT NULL,
`param04` longtext,
- `const05` varbinary(3) NOT NULL DEFAULT '',
+ `const05` varbinary(3) NOT NULL,
`param05` longblob,
- `const06` varchar(10) NOT NULL DEFAULT '',
+ `const06` varchar(10) NOT NULL,
`param06` longtext,
`const07` date DEFAULT NULL,
`param07` longtext,
- `const08` varchar(19) NOT NULL DEFAULT '',
+ `const08` varchar(19) NOT NULL,
`param08` longtext,
`const09` datetime DEFAULT NULL,
`param09` longtext,
@@ -1788,21 +1788,21 @@ t5 CREATE TABLE `t5` (
) 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 32769 0 63
+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 32769 1 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 const03 const03 5 17 1 N 32769 31 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 1 0 8
+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 129 0 63
+def test t5 t5 const05 const05 253 3 3 N 4225 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 1 0 8
+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
def test t5 t5 const07 const07 10 10 10 Y 128 0 63
def test t5 t5 param07 param07 252 4294967295 10 Y 16 0 8
-def test t5 t5 const08 const08 253 19 19 N 1 0 8
+def test t5 t5 const08 const08 253 19 19 N 4097 0 8
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8
diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result
index 57532797dd7..5549446d85e 100644
--- a/mysql-test/r/ps_4heap.result
+++ b/mysql-test/r/ps_4heap.result
@@ -50,7 +50,7 @@ test_sequence
prepare stmt1 from ' select * from t9 order by c1 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def test t9 t9 c1 c1 1 4 1 N 49155 0 63
+def test t9 t9 c1 c1 1 4 1 N 53251 0 63
def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
@@ -1759,21 +1759,21 @@ NULL as const12, @arg12 as param12,
show create table t5 ;
Table Create Table
t5 CREATE TABLE `t5` (
- `const01` int(1) NOT NULL DEFAULT '0',
+ `const01` int(1) NOT NULL,
`param01` bigint(20) DEFAULT NULL,
- `const02` decimal(2,1) NOT NULL DEFAULT '0.0',
+ `const02` decimal(2,1) NOT NULL,
`param02` decimal(65,30) DEFAULT NULL,
- `const03` double NOT NULL DEFAULT '0',
+ `const03` double NOT NULL,
`param03` double DEFAULT NULL,
- `const04` varchar(3) NOT NULL DEFAULT '',
+ `const04` varchar(3) NOT NULL,
`param04` longtext,
- `const05` varbinary(3) NOT NULL DEFAULT '',
+ `const05` varbinary(3) NOT NULL,
`param05` longblob,
- `const06` varchar(10) NOT NULL DEFAULT '',
+ `const06` varchar(10) NOT NULL,
`param06` longtext,
`const07` date DEFAULT NULL,
`param07` longtext,
- `const08` varchar(19) NOT NULL DEFAULT '',
+ `const08` varchar(19) NOT NULL,
`param08` longtext,
`const09` datetime DEFAULT NULL,
`param09` longtext,
@@ -1789,21 +1789,21 @@ t5 CREATE TABLE `t5` (
) 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 32769 0 63
+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 32769 1 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 const03 const03 5 17 1 N 32769 31 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 1 0 8
+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 129 0 63
+def test t5 t5 const05 const05 253 3 3 N 4225 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 1 0 8
+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
def test t5 t5 const07 const07 10 10 10 Y 128 0 63
def test t5 t5 param07 param07 252 4294967295 10 Y 16 0 8
-def test t5 t5 const08 const08 253 19 19 N 1 0 8
+def test t5 t5 const08 const08 253 19 19 N 4097 0 8
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8
diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result
index 9a9f457a212..059d4e6e6ab 100644
--- a/mysql-test/r/ps_5merge.result
+++ b/mysql-test/r/ps_5merge.result
@@ -92,7 +92,7 @@ test_sequence
prepare stmt1 from ' select * from t9 order by c1 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def test t9 t9 c1 c1 1 4 1 N 49155 0 63
+def test t9 t9 c1 c1 1 4 1 N 53251 0 63
def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
@@ -1695,21 +1695,21 @@ NULL as const12, @arg12 as param12,
show create table t5 ;
Table Create Table
t5 CREATE TABLE `t5` (
- `const01` int(1) NOT NULL DEFAULT '0',
+ `const01` int(1) NOT NULL,
`param01` bigint(20) DEFAULT NULL,
- `const02` decimal(2,1) NOT NULL DEFAULT '0.0',
+ `const02` decimal(2,1) NOT NULL,
`param02` decimal(65,30) DEFAULT NULL,
- `const03` double NOT NULL DEFAULT '0',
+ `const03` double NOT NULL,
`param03` double DEFAULT NULL,
- `const04` varchar(3) NOT NULL DEFAULT '',
+ `const04` varchar(3) NOT NULL,
`param04` longtext,
- `const05` varbinary(3) NOT NULL DEFAULT '',
+ `const05` varbinary(3) NOT NULL,
`param05` longblob,
- `const06` varchar(10) NOT NULL DEFAULT '',
+ `const06` varchar(10) NOT NULL,
`param06` longtext,
`const07` date DEFAULT NULL,
`param07` longtext,
- `const08` varchar(19) NOT NULL DEFAULT '',
+ `const08` varchar(19) NOT NULL,
`param08` longtext,
`const09` datetime DEFAULT NULL,
`param09` longtext,
@@ -1725,21 +1725,21 @@ t5 CREATE TABLE `t5` (
) 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 32769 0 63
+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 32769 1 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 const03 const03 5 17 1 N 32769 31 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 1 0 8
+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 129 0 63
+def test t5 t5 const05 const05 253 3 3 N 4225 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 1 0 8
+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
def test t5 t5 const07 const07 10 10 10 Y 128 0 63
def test t5 t5 param07 param07 252 4294967295 10 Y 16 0 8
-def test t5 t5 const08 const08 253 19 19 N 1 0 8
+def test t5 t5 const08 const08 253 19 19 N 4097 0 8
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8
@@ -3446,7 +3446,7 @@ test_sequence
prepare stmt1 from ' select * from t9 order by c1 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def test t9 t9 c1 c1 1 4 1 N 49155 0 63
+def test t9 t9 c1 c1 1 4 1 N 53251 0 63
def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
@@ -5049,21 +5049,21 @@ NULL as const12, @arg12 as param12,
show create table t5 ;
Table Create Table
t5 CREATE TABLE `t5` (
- `const01` int(1) NOT NULL DEFAULT '0',
+ `const01` int(1) NOT NULL,
`param01` bigint(20) DEFAULT NULL,
- `const02` decimal(2,1) NOT NULL DEFAULT '0.0',
+ `const02` decimal(2,1) NOT NULL,
`param02` decimal(65,30) DEFAULT NULL,
- `const03` double NOT NULL DEFAULT '0',
+ `const03` double NOT NULL,
`param03` double DEFAULT NULL,
- `const04` varchar(3) NOT NULL DEFAULT '',
+ `const04` varchar(3) NOT NULL,
`param04` longtext,
- `const05` varbinary(3) NOT NULL DEFAULT '',
+ `const05` varbinary(3) NOT NULL,
`param05` longblob,
- `const06` varchar(10) NOT NULL DEFAULT '',
+ `const06` varchar(10) NOT NULL,
`param06` longtext,
`const07` date DEFAULT NULL,
`param07` longtext,
- `const08` varchar(19) NOT NULL DEFAULT '',
+ `const08` varchar(19) NOT NULL,
`param08` longtext,
`const09` datetime DEFAULT NULL,
`param09` longtext,
@@ -5079,21 +5079,21 @@ t5 CREATE TABLE `t5` (
) 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 32769 0 63
+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 32769 1 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 const03 const03 5 17 1 N 32769 31 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 1 0 8
+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 129 0 63
+def test t5 t5 const05 const05 253 3 3 N 4225 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 1 0 8
+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
def test t5 t5 const07 const07 10 10 10 Y 128 0 63
def test t5 t5 param07 param07 252 4294967295 10 Y 16 0 8
-def test t5 t5 const08 const08 253 19 19 N 1 0 8
+def test t5 t5 const08 const08 253 19 19 N 4097 0 8
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index 118c6785136..d34c96cd568 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -1,4 +1,13 @@
+SET GLOBAL query_cache_type= Off;
+SET LOCAL query_cache_type= Off;
+SET LOCAL query_cache_type= 0;
+SET LOCAL query_cache_type= on;
+ERROR HY000: Query cache is globally disabled and you can't enable it only for this session
+SET LOCAL query_cache_type= 1;
+ERROR HY000: Query cache is globally disabled and you can't enable it only for this session
set GLOBAL query_cache_size=1355776;
+SET GLOBAL query_cache_type= ON;
+SET LOCAL query_cache_type= ON;
flush query cache;
flush query cache;
reset query cache;
@@ -1599,7 +1608,9 @@ show status like 'Qcache_free_blocks';
Variable_name Value
Qcache_free_blocks 0
set global query_cache_size=102400;
-ERROR HY000: Query cache is disabled; set query_cache_type to ON or DEMAND to enable it
+show status like 'Qcache_free_blocks';
+Variable_name Value
+Qcache_free_blocks 1
set global query_cache_type=on;
set session query_cache_type=on;
Restore default values.
@@ -1660,6 +1671,8 @@ set GLOBAL query_cache_limit=default;
set GLOBAL query_cache_min_res_unit=default;
set GLOBAL query_cache_size=default;
set local query_cache_type=default;
+set GLOBAL query_cache_type=on;
+set local query_cache_type=on;
FLUSH STATUS;
SET GLOBAL query_cache_size=10*1024*1024;
SET @save_concurrent_insert= @@concurrent_insert;
diff --git a/mysql-test/r/query_cache_debug.result b/mysql-test/r/query_cache_debug.result
index 50a3a02fe4d..01c642b325b 100644
--- a/mysql-test/r/query_cache_debug.result
+++ b/mysql-test/r/query_cache_debug.result
@@ -1,3 +1,4 @@
+set global query_cache_type= ON;
flush status;
set query_cache_type=DEMAND;
set global query_cache_size= 1024*768;
diff --git a/mysql-test/r/query_cache_merge.result b/mysql-test/r/query_cache_merge.result
index c324df65f77..e31ab05b396 100644
--- a/mysql-test/r/query_cache_merge.result
+++ b/mysql-test/r/query_cache_merge.result
@@ -1,3 +1,5 @@
+SET GLOBAL query_cache_type=ON;
+SET LOCAL query_cache_type=ON;
SET @@global.query_cache_size=1355776;
flush status;
select count(*) from t00;
@@ -1690,6 +1692,7 @@ DROP TABLE t4;
DROP TABLE t3;
DROP TABLE t2;
DROP TABLE t1;
-SET @@global.query_cache_size = 0;
+SET @@global.query_cache_size = default;
SET @@global.table_definition_cache = @save_table_definition_cache;
+SET GLOBAL query_cache_type=default;
End of 5.1 tests
diff --git a/mysql-test/r/query_cache_notembedded.result b/mysql-test/r/query_cache_notembedded.result
index f2021f9d2e7..400ac2b2718 100644
--- a/mysql-test/r/query_cache_notembedded.result
+++ b/mysql-test/r/query_cache_notembedded.result
@@ -1,4 +1,8 @@
-set GLOBAL query_cache_size=1355776;
+set @sql_mode_save=@@global.sql_mode;
+set @query_cache_type_save=@@global.query_cache_type;
+set @query_cache_size_save=@@global.query_cache_size;
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
flush query cache;
flush query cache;
reset query cache;
@@ -379,7 +383,8 @@ Qcache_queries_in_cache 1
USE test;
DROP DATABASE bug30269;
DROP USER 'bug30269'@'localhost';
-set GLOBAL query_cache_type=default;
+set GLOBAL query_cache_type=ON;
+set LOCAL query_cache_type=ON;
set GLOBAL query_cache_limit=default;
set GLOBAL query_cache_min_res_unit=default;
set GLOBAL query_cache_size=default;
@@ -435,3 +440,6 @@ flush query cache|
delete from t1|
drop procedure bug3583|
drop table t1|
+SET GLOBAL query_cache_size=@query_cache_size_save;
+SET GLOBAL query_cache_type=@query_cache_type_save;
+set GLOBAL sql_mode=@sql_mode_save;
diff --git a/mysql-test/r/query_cache_ps_no_prot.result b/mysql-test/r/query_cache_ps_no_prot.result
index 02e660450d1..5076003a7fb 100644
--- a/mysql-test/r/query_cache_ps_no_prot.result
+++ b/mysql-test/r/query_cache_ps_no_prot.result
@@ -1,3 +1,5 @@
+set GLOBAL query_cache_type=ON;
+set LOCAL query_cache_type=ON;
---- establish connection con1 (root) ----
---- switch to connection default ----
set @initial_query_cache_size = @@global.query_cache_size;
@@ -572,3 +574,4 @@ deallocate prepare stmt;
drop table t1;
set @@global.query_cache_size=@initial_query_cache_size;
flush status;
+set GLOBAL query_cache_type=default;
diff --git a/mysql-test/r/query_cache_ps_ps_prot.result b/mysql-test/r/query_cache_ps_ps_prot.result
index 2115ecc62ff..4105bc40f94 100644
--- a/mysql-test/r/query_cache_ps_ps_prot.result
+++ b/mysql-test/r/query_cache_ps_ps_prot.result
@@ -1,3 +1,5 @@
+set GLOBAL query_cache_type=ON;
+set LOCAL query_cache_type=ON;
---- establish connection con1 (root) ----
---- switch to connection default ----
set @initial_query_cache_size = @@global.query_cache_size;
@@ -572,3 +574,4 @@ deallocate prepare stmt;
drop table t1;
set @@global.query_cache_size=@initial_query_cache_size;
flush status;
+set GLOBAL query_cache_type=default;
diff --git a/mysql-test/r/query_cache_with_views.result b/mysql-test/r/query_cache_with_views.result
index 7f0417a60c7..763113dbac3 100644
--- a/mysql-test/r/query_cache_with_views.result
+++ b/mysql-test/r/query_cache_with_views.result
@@ -1,5 +1,7 @@
drop table if exists t1,t2,v1,v2,v3;
drop view if exists t1,t2,v1,v2,v3;
+set GLOBAL query_cache_type=ON;
+set LOCAL query_cache_type=ON;
set GLOBAL query_cache_size=1355776;
flush status;
create table t1 (a int, b int);
@@ -207,3 +209,4 @@ DROP TABLE t2;
DROP VIEW t1_view;
SET AUTOCOMMIT=DEFAULT;
set GLOBAL query_cache_size=default;
+set GLOBAL query_cache_type=default;
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index 78a224b1439..a7fb28c988a 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -2241,3 +2241,39 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where 0
drop table t1,t2;
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8189 field<>const and const<>field are not symmetric
+#
+CREATE TABLE t1 (a INT, b INT, KEY(a));
+INSERT INTO t1 (a) VALUES (10),(10),(10),(10),(10),(10),(10),(10),(10),(10),(70);
+EXPLAIN SELECT * FROM t1 WHERE a<>10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 3 Using index condition
+EXPLAIN SELECT * FROM t1 WHERE 10<>a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 3 Using index condition
+SELECT * FROM t1 WHERE a<>10;
+a b
+70 NULL
+SELECT * FROM t1 WHERE 10<>a;
+a b
+70 NULL
+DROP TABLE t1;
+#
+# MDEV-8613 Full table scan for WHERE indexed_varchar_column <=> 'bad-character'
+#
+SET NAMES utf8;
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8, KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('a'),('b'),('c'),('d'),('e');
+EXPLAIN SELECT * FROM t1 WHERE a<=>'😎';
+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
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column 'a' at row 1
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/range_innodb.result b/mysql-test/r/range_innodb.result
new file mode 100644
index 00000000000..794e6c7b3cc
--- /dev/null
+++ b/mysql-test/r/range_innodb.result
@@ -0,0 +1,39 @@
+#
+# Range optimizer (and related) tests that need InnoDB.
+#
+drop table if exists t0, t1, t2;
+#
+# MDEV-6735: Range checked for each record used with key
+#
+create table t0(a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1(a int);
+insert into t1 select A.a + B.a* 10 + C.a * 100 + D.a * 1000
+from t0 A, t0 B, t0 C, t0 D;
+create table t2 (
+a int,
+b int,
+filler1 char(100),
+filler2 char(100),
+filler3 char(100),
+filler4 char(100),
+key(a),
+key(b)
+) engine=innodb;
+insert into t2
+select
+a,a,
+repeat('0123456789', 10),
+repeat('0123456789', 10),
+repeat('0123456789', 10),
+repeat('0123456789', 10)
+from t1;
+analyze table t2;
+Table Op Msg_type Msg_text
+test.t2 analyze status OK
+# The following must not use "Range checked for each record":
+explain select * from t0 left join t2 on t2.a <t0.a and t2.b between 50 and 250;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 10
+1 SIMPLE t2 range a,b b 5 NULL 201 Using where; Using join buffer (flat, BNL join)
+drop table t0,t1,t2;
diff --git a/mysql-test/r/range_mrr_icp.result b/mysql-test/r/range_mrr_icp.result
index 1b6e4cb9fe8..54dd3008c7a 100644
--- a/mysql-test/r/range_mrr_icp.result
+++ b/mysql-test/r/range_mrr_icp.result
@@ -2243,4 +2243,40 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where 0
drop table t1,t2;
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8189 field<>const and const<>field are not symmetric
+#
+CREATE TABLE t1 (a INT, b INT, KEY(a));
+INSERT INTO t1 (a) VALUES (10),(10),(10),(10),(10),(10),(10),(10),(10),(10),(70);
+EXPLAIN SELECT * FROM t1 WHERE a<>10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 3 Using index condition; Rowid-ordered scan
+EXPLAIN SELECT * FROM t1 WHERE 10<>a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 3 Using index condition; Rowid-ordered scan
+SELECT * FROM t1 WHERE a<>10;
+a b
+70 NULL
+SELECT * FROM t1 WHERE 10<>a;
+a b
+70 NULL
+DROP TABLE t1;
+#
+# MDEV-8613 Full table scan for WHERE indexed_varchar_column <=> 'bad-character'
+#
+SET NAMES utf8;
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8, KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('a'),('b'),('c'),('d'),('e');
+EXPLAIN SELECT * FROM t1 WHERE a<=>'😎';
+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
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column 'a' at row 1
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
set optimizer_switch=@mrr_icp_extra_tmp;
diff --git a/mysql-test/r/read_only.result b/mysql-test/r/read_only.result
index ae92d39a916..964c259ebf8 100644
--- a/mysql-test/r/read_only.result
+++ b/mysql-test/r/read_only.result
@@ -1,5 +1,6 @@
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);
connection default;
@@ -139,6 +140,7 @@ delete from mysql.db where User like 'mysqltest_%';
delete from mysql.tables_priv where User like 'mysqltest_%';
delete from mysql.columns_priv where User like 'mysqltest_%';
flush privileges;
+create user `mysqltest_u1`@`%`;
grant all on mysqltest_db2.* to `mysqltest_u1`@`%`;
create database mysqltest_db1;
grant all on mysqltest_db1.* to `mysqltest_u1`@`%`;
diff --git a/mysql-test/r/read_only_innodb.result b/mysql-test/r/read_only_innodb.result
index 1e041395d3c..a276e6cbc19 100644
--- a/mysql-test/r/read_only_innodb.result
+++ b/mysql-test/r/read_only_innodb.result
@@ -1,4 +1,5 @@
DROP TABLE IF EXISTS table_11733 ;
+create user test@localhost;
grant CREATE, SELECT, DROP on *.* to test@localhost;
set global read_only=0;
create table table_11733 (a int) engine=InnoDb;
@@ -16,6 +17,7 @@ ERROR HY000: The MariaDB server is running with the --read-only option so it can
set global read_only=0;
drop table table_11733 ;
drop user test@localhost;
+create user test@localhost;
GRANT CREATE, SELECT, DROP ON *.* TO test@localhost;
CREATE TABLE t1(a INT) ENGINE=INNODB;
INSERT INTO t1 VALUES (0), (1);
diff --git a/mysql-test/r/repair_symlink-5543.result b/mysql-test/r/repair_symlink-5543.result
index 051c9ca3472..98ded32686e 100644
--- a/mysql-test/r/repair_symlink-5543.result
+++ b/mysql-test/r/repair_symlink-5543.result
@@ -2,13 +2,12 @@ create table t1 (a int) engine=myisam data directory='MYSQL_TMP_DIR';
insert t1 values (1);
repair table t1;
Table Op Msg_type Msg_text
-test.t1 repair error Can't create new tempfile: 'MYSQL_TMP_DIR/t1.TMD'
-test.t1 repair status Operation failed
+test.t1 repair status OK
drop table t1;
create table t2 (a int) engine=aria data directory='MYSQL_TMP_DIR';
insert t2 values (1);
repair table t2;
Table Op Msg_type Msg_text
-test.t2 repair error Can't create new tempfile: 'MYSQL_TMP_DIR/t2.TMD'
-test.t2 repair status Operation failed
+test.t2 repair status OK
drop table t2;
+foobar5543
diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result
index f94c958a1be..59a606128f5 100644
--- a/mysql-test/r/row.result
+++ b/mysql-test/r/row.result
@@ -489,3 +489,25 @@ SELECT i FROM t1 WHERE ROW(1,2) = (SELECT 1,3 FROM DUAL WHERE 1 = 0);
i
DROP TABLE t1;
End of 5.1 tests
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8709 Row equality elements do not get propagated
+#
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (10,10),(20,20);
+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))
+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))
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 7219a9c4462..97ab9173c2d 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -3784,9 +3784,9 @@ coalesce(9223372036854775808, 1) co;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` decimal(19,0) NOT NULL DEFAULT '0',
- `c` decimal(19,0) NOT NULL DEFAULT '0',
- `co` decimal(19,0) NOT NULL DEFAULT '0'
+ `i` decimal(19,0) NOT NULL,
+ `c` decimal(19,0) NOT NULL,
+ `co` decimal(19,0) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select
@@ -5301,7 +5301,6 @@ f1
Warnings:
Warning 1292 Incorrect datetime value: 'zz'
Warning 1292 Incorrect datetime value: 'aa'
-Warning 1292 Incorrect datetime value: 'zz'
SELECT * FROM v1 HAVING f1 = 'zz' AND f1 <= 'aa' ;
f1
0000-00-00
diff --git a/mysql-test/r/select_jcl6.result b/mysql-test/r/select_jcl6.result
index 3c62d0676ae..601fcc116b7 100644
--- a/mysql-test/r/select_jcl6.result
+++ b/mysql-test/r/select_jcl6.result
@@ -3795,9 +3795,9 @@ coalesce(9223372036854775808, 1) co;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` decimal(19,0) NOT NULL DEFAULT '0',
- `c` decimal(19,0) NOT NULL DEFAULT '0',
- `co` decimal(19,0) NOT NULL DEFAULT '0'
+ `i` decimal(19,0) NOT NULL,
+ `c` decimal(19,0) NOT NULL,
+ `co` decimal(19,0) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select
@@ -5312,7 +5312,6 @@ f1
Warnings:
Warning 1292 Incorrect datetime value: 'zz'
Warning 1292 Incorrect datetime value: 'aa'
-Warning 1292 Incorrect datetime value: 'zz'
SELECT * FROM v1 HAVING f1 = 'zz' AND f1 <= 'aa' ;
f1
0000-00-00
diff --git a/mysql-test/r/select_pkeycache.result b/mysql-test/r/select_pkeycache.result
index 7219a9c4462..97ab9173c2d 100644
--- a/mysql-test/r/select_pkeycache.result
+++ b/mysql-test/r/select_pkeycache.result
@@ -3784,9 +3784,9 @@ coalesce(9223372036854775808, 1) co;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` decimal(19,0) NOT NULL DEFAULT '0',
- `c` decimal(19,0) NOT NULL DEFAULT '0',
- `co` decimal(19,0) NOT NULL DEFAULT '0'
+ `i` decimal(19,0) NOT NULL,
+ `c` decimal(19,0) NOT NULL,
+ `co` decimal(19,0) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select
@@ -5301,7 +5301,6 @@ f1
Warnings:
Warning 1292 Incorrect datetime value: 'zz'
Warning 1292 Incorrect datetime value: 'aa'
-Warning 1292 Incorrect datetime value: 'zz'
SELECT * FROM v1 HAVING f1 = 'zz' AND f1 <= 'aa' ;
f1
0000-00-00
diff --git a/mysql-test/r/selectivity.result b/mysql-test/r/selectivity.result
index 620bdc6bd50..4238359c201 100644
--- a/mysql-test/r/selectivity.result
+++ b/mysql-test/r/selectivity.result
@@ -1298,10 +1298,10 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` A
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
-1495 89366 89366 28296 28296 3
-961 24512 24512 85239 85239 4
1063 89366 89366 28296 28296 3
+1495 89366 89366 28296 28296 3
221 56120 56120 28296 28296 3
+961 24512 24512 85239 85239 4
set optimizer_use_condition_selectivity=3;
explain extended
select * from t1, t2, t1 as t3
@@ -1315,10 +1315,10 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` A
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
-961 24512 24512 85239 85239 4
-1495 89366 89366 28296 28296 3
1063 89366 89366 28296 28296 3
+1495 89366 89366 28296 28296 3
221 56120 56120 28296 28296 3
+961 24512 24512 85239 85239 4
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
drop table t1,t2;
set histogram_type=@save_histogram_type;
@@ -1412,16 +1412,10 @@ drop table t0,t1,t2;
#
# Bug mdev-7316: a conjunct in WHERE with selectivity == 0
#
-CREATE TABLE t1 (a varchar(16), b int, PRIMARY KEY(a), KEY(b)) ENGINE=INNODB;
-Warnings:
-Warning 1286 Unknown storage engine 'INNODB'
-Warning 1266 Using storage engine MyISAM for table 't1'
+CREATE TABLE t1 (a varchar(16), b int, PRIMARY KEY(a), KEY(b));
INSERT INTO t1 VALUES
('USAChinese',10), ('USAEnglish',20), ('USAFrench',30);
-CREATE TABLE t2 (i int) ENGINE=INNODB;
-Warnings:
-Warning 1286 Unknown storage engine 'INNODB'
-Warning 1266 Using storage engine MyISAM for table 't2'
+CREATE TABLE t2 (i int);
INSERT INTO t2 VALUES
(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(1),(2),(3),(4);
ANALYZE TABLE t1, t2;
diff --git a/mysql-test/r/selectivity_innodb.result b/mysql-test/r/selectivity_innodb.result
index 0acbb465ba8..daf28073cf1 100644
--- a/mysql-test/r/selectivity_innodb.result
+++ b/mysql-test/r/selectivity_innodb.result
@@ -1308,10 +1308,10 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` A
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
-1495 89366 89366 28296 28296 3
-961 24512 24512 85239 85239 4
1063 89366 89366 28296 28296 3
+1495 89366 89366 28296 28296 3
221 56120 56120 28296 28296 3
+961 24512 24512 85239 85239 4
set optimizer_use_condition_selectivity=3;
explain extended
select * from t1, t2, t1 as t3
@@ -1325,10 +1325,10 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` A
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
-961 24512 24512 85239 85239 4
-1495 89366 89366 28296 28296 3
1063 89366 89366 28296 28296 3
+1495 89366 89366 28296 28296 3
221 56120 56120 28296 28296 3
+961 24512 24512 85239 85239 4
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
drop table t1,t2;
set histogram_type=@save_histogram_type;
@@ -1422,10 +1422,10 @@ drop table t0,t1,t2;
#
# Bug mdev-7316: a conjunct in WHERE with selectivity == 0
#
-CREATE TABLE t1 (a varchar(16), b int, PRIMARY KEY(a), KEY(b)) ENGINE=INNODB;
+CREATE TABLE t1 (a varchar(16), b int, PRIMARY KEY(a), KEY(b));
INSERT INTO t1 VALUES
('USAChinese',10), ('USAEnglish',20), ('USAFrench',30);
-CREATE TABLE t2 (i int) ENGINE=INNODB;
+CREATE TABLE t2 (i int);
INSERT INTO t2 VALUES
(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(1),(2),(3),(4);
ANALYZE TABLE t1, t2;
diff --git a/mysql-test/r/servers.result b/mysql-test/r/servers.result
index ab5e444b134..585f0f62af0 100644
--- a/mysql-test/r/servers.result
+++ b/mysql-test/r/servers.result
@@ -1,3 +1,4 @@
+set sql_mode="";
#
# MDEV-4594 - CREATE SERVER crashes embedded
#
diff --git a/mysql-test/r/set_statement.result b/mysql-test/r/set_statement.result
index 08072fccba5..2b557de8e05 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
''
''
SET STATEMENT sql_mode='ansi' FOR PREPARE stmt FROM 'SELECT "t1".* FROM t1';
@@ -659,7 +659,7 @@ deallocate prepare stmt;
'# Post-STATEMENT
SELECT @@sql_mode;
@@sql_mode
-
+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';
@@ -675,7 +675,7 @@ ALTER TABLE t1 drop COLUMN v3;
deallocate prepare stmt;
SELECT @@sql_mode;
@@sql_mode
-
+NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
SET sql_mode='ansi';
SELECT @@sql_mode;
@@sql_mode
@@ -704,7 +704,7 @@ ALTER TABLE t1 drop COLUMN v3;
drop procedure p6;
SELECT @@sql_mode;
@@sql_mode
-
+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 +715,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
SET sql_mode='ansi';
SELECT @@sql_mode;
@@sql_mode
@@ -732,7 +732,7 @@ v1 v2
SET sql_mode=default;
SELECT @@sql_mode;
@@sql_mode
-
+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
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 60879086c62..c281650ecf5 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -101,19 +101,19 @@ drop table t1;
show variables like "wait_timeout%";
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8
-def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 1024 5 N 1 0 8
+def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 5 N 1 0 8
Variable_name Value
wait_timeout 28800
show variables like "WAIT_timeout%";
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8
-def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 1024 5 N 1 0 8
+def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 5 N 1 0 8
Variable_name Value
wait_timeout 28800
show variables like "this_doesn't_exists%";
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 0 N 1 0 8
-def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 1024 0 N 1 0 8
+def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 0 N 1 0 8
Variable_name Value
show table status from test like "this_doesn't_exists%";
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
@@ -518,8 +518,11 @@ Database Create Database
mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */
create table mysqltest.t1(a int);
insert into mysqltest.t1 values(1);
+create user mysqltest_1@localhost;
grant select on `mysqltest`.* to mysqltest_1@localhost;
+create user mysqltest_2@localhost;
grant usage on `mysqltest`.* to mysqltest_2@localhost;
+create user mysqltest_3@localhost;
grant drop on `mysqltest`.* to mysqltest_3@localhost;
select * from t1;
a
@@ -997,13 +1000,13 @@ def information_schema TRIGGERS TRIGGERS EVENT_OBJECT_TABLE Table 253 192 2 N 1
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 0 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 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 root@localhost binary binary latin1_swedish_ci
+t1_bi INSERT t1 SET @a = 1 BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost binary binary latin1_swedish_ci
----------------------------------------------------------------
SELECT
TRIGGER_CATALOG,
@@ -1041,10 +1044,10 @@ 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 0 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 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 root@localhost
+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
----------------------------------------------------------------
SHOW CREATE VIEW v1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
@@ -1076,13 +1079,13 @@ 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 0 0 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
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+p1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
SELECT 1 binary binary latin1_swedish_ci
----------------------------------------------------------------
SELECT
@@ -1122,22 +1125,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 0 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 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 root@localhost
+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
----------------------------------------------------------------
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 0 0 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
Function sql_mode Create Function character_set_client collation_connection Database Collation
-f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+f1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
RETURN 1 binary binary latin1_swedish_ci
----------------------------------------------------------------
SELECT
@@ -1177,11 +1180,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 0 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 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 root@localhost
+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
----------------------------------------------------------------
DROP DATABASE mysqltest1;
DROP TABLE t1;
@@ -1279,6 +1282,7 @@ Database Create Database
mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */
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;
show create database mysqltest;
Database Create Database
@@ -1346,69 +1350,69 @@ 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 CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+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
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 CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+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
CALL p1();
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 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+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
CALL p1();
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 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+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
CALL p1();
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 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+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
CALL p1();
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 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+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
CALL p1();
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 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+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
CALL p1();
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 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+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
CALL p1();
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 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+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
CALL p1();
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 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+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
CALL p1();
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 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+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
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 CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+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
EXECUTE stmt1;
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 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+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
EXECUTE stmt1;
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 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+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
EXECUTE stmt1;
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 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+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
EXECUTE stmt1;
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 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+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
EXECUTE stmt1;
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 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+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
EXECUTE stmt1;
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 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+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
EXECUTE stmt1;
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 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+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
EXECUTE stmt1;
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 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+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
EXECUTE stmt1;
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 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+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
DROP TABLE t1;
DROP PROCEDURE p1;
DEALLOCATE PREPARE stmt1;
@@ -1432,20 +1436,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 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+p1 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 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS char(10) CHARSET latin1
+f1 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 CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1
+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.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 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 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;
@@ -1508,7 +1512,7 @@ LOCK TABLE t1 WRITE;
# Connection default
SHOW CREATE TRIGGER t1_bi;
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 FOR EACH ROW SET new.a = 1 utf8 utf8_general_ci latin1_swedish_ci
+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
UNLOCK TABLES;
# Test 2: ALTER TABLE with SHOW CREATE TRIGGER in transaction
@@ -1516,7 +1520,7 @@ UNLOCK TABLES;
START TRANSACTION;
SHOW CREATE TRIGGER t1_bi;
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 FOR EACH ROW SET new.a = 1 utf8 utf8_general_ci latin1_swedish_ci
+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
ALTER TABLE t1 CHARACTER SET = utf8;
# Connection default
diff --git a/mysql-test/r/show_explain.result b/mysql-test/r/show_explain.result
index 8aefb552d57..0dc6f2b28ac 100644
--- a/mysql-test/r/show_explain.result
+++ b/mysql-test/r/show_explain.result
@@ -782,6 +782,7 @@ drop table t1,t3,t4;
#
# ---------- SHOW EXPLAIN and permissions -----------------
#
+create user test2@localhost;
grant ALL on test.* to test2@localhost;
grant super on *.* to test2@localhost;
#
diff --git a/mysql-test/r/single_delete_update.result b/mysql-test/r/single_delete_update.result
index 9332effeb56..cdf97e20238 100644
--- a/mysql-test/r/single_delete_update.result
+++ b/mysql-test/r/single_delete_update.result
@@ -1166,35 +1166,3 @@ a b c
25 25 10
25 25 10
DROP TABLE t1, t2;
-#
-# Bug #53742: UPDATEs have no effect after applying patch for bug 36569
-#
-CREATE TABLE t1 (
-pk INT NOT NULL AUTO_INCREMENT,
-c1_idx CHAR(1) DEFAULT 'y',
-c2 INT,
-PRIMARY KEY (pk),
-INDEX c1_idx (c1_idx)
-) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (), (), (), ();
-SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
-pk c1_idx c2
-4 y NULL
-3 y NULL
-UPDATE t1 SET c2 = 0 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
-SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
-pk c1_idx c2
-4 y 0
-3 y 0
-SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC;
-pk c1_idx c2
-4 y 0
-3 y 0
-2 y NULL
-1 y NULL
-DELETE FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
-SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC;
-pk c1_idx c2
-2 y NULL
-1 y NULL
-DROP TABLE t1;
diff --git a/mysql-test/r/single_delete_update_innodb.result b/mysql-test/r/single_delete_update_innodb.result
new file mode 100644
index 00000000000..aca40974054
--- /dev/null
+++ b/mysql-test/r/single_delete_update_innodb.result
@@ -0,0 +1,32 @@
+#
+# Bug #53742: UPDATEs have no effect after applying patch for bug 36569
+#
+CREATE TABLE t1 (
+pk INT NOT NULL AUTO_INCREMENT,
+c1_idx CHAR(1) DEFAULT 'y',
+c2 INT,
+PRIMARY KEY (pk),
+INDEX c1_idx (c1_idx)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (), (), (), ();
+SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
+pk c1_idx c2
+4 y NULL
+3 y NULL
+UPDATE t1 SET c2 = 0 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
+SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
+pk c1_idx c2
+4 y 0
+3 y 0
+SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC;
+pk c1_idx c2
+4 y 0
+3 y 0
+2 y NULL
+1 y NULL
+DELETE FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
+SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC;
+pk c1_idx c2
+2 y NULL
+1 y NULL
+DROP TABLE t1;
diff --git a/mysql-test/r/skip_grants.result b/mysql-test/r/skip_grants.result
index b178e0ecfa7..9852d6d12c1 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 CREATE DEFINER=`a`@`%` PROCEDURE `p3`()
+p3 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 CREATE DEFINER=`a`@`%` FUNCTION `f3`() RETURNS int(11)
+f3 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;
@@ -80,3 +80,14 @@ End of 5.0 tests
select no_such_function(1);
ERROR 42000: FUNCTION test.no_such_function does not exist
End of 5.1 tests
+show global status like 'Acl%';
+Variable_name Value
+Acl_column_grants 0
+Acl_database_grants 0
+Acl_function_grants 0
+Acl_procedure_grants 0
+Acl_proxy_users 0
+Acl_role_grants 0
+Acl_roles 0
+Acl_table_grants 0
+Acl_users 0
diff --git a/mysql-test/r/skip_name_resolve.result b/mysql-test/r/skip_name_resolve.result
index 1d92d52110d..b2230ccbd91 100644
--- a/mysql-test/r/skip_name_resolve.result
+++ b/mysql-test/r/skip_name_resolve.result
@@ -1,3 +1,4 @@
+CREATE USER mysqltest_1@'127.0.0.1/255.255.255.255';
GRANT ALL ON test.* TO mysqltest_1@'127.0.0.1/255.255.255.255';
SHOW GRANTS FOR mysqltest_1@'127.0.0.1/255.255.255.255';
Grants for mysqltest_1@127.0.0.1/255.255.255.255
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result
index 4373925b8ac..1f38e3888a0 100644
--- a/mysql-test/r/sp-error.result
+++ b/mysql-test/r/sp-error.result
@@ -1758,7 +1758,7 @@ CAST('10 ' as unsigned integer)
CAST('10 ' as unsigned integer)
10
Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '10 '
+Note 1292 Truncated incorrect INTEGER value: '10 '
DROP PROCEDURE p1;
DROP PROCEDURE p2;
@@ -1767,7 +1767,7 @@ DROP PROCEDURE p2;
CREATE PROCEDURE p1()
BEGIN
DECLARE c INT DEFAULT 0;
-DECLARE CONTINUE HANDLER FOR SQLWARNING SET c = c + 1;
+DECLARE CONTINUE HANDLER FOR SQLSTATE '22007' SET c = c + 1;
CALL p2();
CALL p3();
CALL p4();
@@ -1797,7 +1797,7 @@ END|
CREATE PROCEDURE P6()
BEGIN
DECLARE c INT DEFAULT 0;
-DECLARE CONTINUE HANDLER FOR SQLWARNING SET c = c + 1;
+DECLARE CONTINUE HANDLER FOR SQLSTATE '22007' SET c = c + 1;
CALL p5();
SELECT c;
END|
@@ -1821,7 +1821,7 @@ CALL p6();
CAST('10 ' as unsigned integer)
10
Level Code Message
-Warning 1292 Truncated incorrect INTEGER value: '10 '
+Note 1292 Truncated incorrect INTEGER value: '10 '
c
1
DROP PROCEDURE p1;
@@ -1982,9 +1982,9 @@ Level Code Message
Warning 1264 Out of range value for column 'x' at row 1
Warning 1264 Out of range value for column 'y' at row 1
Warning 1264 Out of range value for column 'z' at row 1
-Warning 1292 Truncated incorrect INTEGER value: '111111 '
+Note 1292 Truncated incorrect INTEGER value: '111111 '
Warning 1264 Out of range value for column 'a' at row 1
-Warning 1292 Truncated incorrect INTEGER value: '222222 '
+Note 1292 Truncated incorrect INTEGER value: '222222 '
Warning 1264 Out of range value for column 'b' at row 1
Error 1048 Column 'c' cannot be null
@@ -2744,14 +2744,14 @@ END|
CALL p6()|
Level Code Message
-Warning 1292 Truncated incorrect INTEGER value: '1 '
-Warning 1292 Truncated incorrect INTEGER value: '1999999 '
+Note 1292 Truncated incorrect INTEGER value: '1 '
+Note 1292 Truncated incorrect INTEGER value: '1999999 '
Warning 1264 Out of range value for column 'a' at row 1
-Warning 1292 Truncated incorrect INTEGER value: '2 '
-Warning 1292 Truncated incorrect INTEGER value: '2999999 '
+Note 1292 Truncated incorrect INTEGER value: '2 '
+Note 1292 Truncated incorrect INTEGER value: '2999999 '
Warning 1264 Out of range value for column 'b' at row 1
-Warning 1292 Truncated incorrect INTEGER value: '3 '
-Warning 1292 Truncated incorrect INTEGER value: '3999999 '
+Note 1292 Truncated incorrect INTEGER value: '3 '
+Note 1292 Truncated incorrect INTEGER value: '3999999 '
Warning 1264 Out of range value for column 'c' at row 1
Msg
Handler for 1292
diff --git a/mysql-test/r/sp-group.result b/mysql-test/r/sp-group.result
new file mode 100644
index 00000000000..2e30b697103
--- /dev/null
+++ b/mysql-test/r/sp-group.result
@@ -0,0 +1,156 @@
+drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 'test.t1'
+drop view if exists view_t1;
+Warnings:
+Note 1051 Unknown table 'test.view_t1'
+SET sql_mode=ONLY_FULL_GROUP_BY;
+CREATE TABLE t1 (
+pk INT,
+f0 INT, f1 INT, f2 INT, f3 INT, f4 INT,
+f5 INT, f6 INT, f7 INT, f8 INT, f9 INT,
+PRIMARY KEY (pk)
+);
+CREATE VIEW view_t1 AS SELECT * FROM t1;
+CREATE PROCEDURE s1()
+SELECT * FROM (
+INFORMATION_SCHEMA.`INNODB_BUFFER_PAGE_LRU` AS table1
+LEFT JOIN test.view_t1 AS table2
+ON ( table2.`f6` = table1.FREE_PAGE_CLOCK)
+)
+ORDER BY table1.NUMBER_RECORDS
+LIMIT 0
+;
+CALL s1;
+POOL_ID LRU_POSITION SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE COMPRESSED IO_FIX IS_OLD FREE_PAGE_CLOCK pk f0 f1 f2 f3 f4 f5 f6 f7 f8 f9
+CALL s1;
+POOL_ID LRU_POSITION SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE COMPRESSED IO_FIX IS_OLD FREE_PAGE_CLOCK pk f0 f1 f2 f3 f4 f5 f6 f7 f8 f9
+drop table t1;
+drop view view_t1;
+drop procedure s1;
+CREATE TABLE A (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_varchar_key VARCHAR(1),
+PRIMARY KEY (pk)
+) ENGINE=MyISAM;
+CREATE VIEW view_A AS SELECT * FROM A;
+CREATE TABLE C (
+pk INTEGER AUTO_INCREMENT,
+col_int_nokey INTEGER,
+col_int_key INTEGER,
+col_date_key DATE,
+col_date_nokey DATE,
+col_time_key TIME,
+col_time_nokey TIME,
+col_datetime_key DATETIME,
+col_datetime_nokey DATETIME,
+col_varchar_key VARCHAR(1),
+col_varchar_nokey VARCHAR(1),
+PRIMARY KEY (pk)
+) ENGINE=MyISAM;
+CREATE VIEW view_C AS SELECT * FROM C;
+CREATE TABLE AA (
+pk INTEGER AUTO_INCREMENT,
+col_int_nokey INTEGER,
+col_int_key INTEGER,
+col_date_key DATE,
+col_date_nokey DATE,
+col_time_key TIME,
+col_time_nokey TIME,
+col_datetime_key DATETIME,
+col_datetime_nokey DATETIME,
+col_varchar_key VARCHAR(1),
+col_varchar_nokey VARCHAR(1),
+PRIMARY KEY (pk),
+KEY (col_varchar_key, col_int_key)
+) ENGINE=MyISAM;
+CREATE VIEW view_AA AS SELECT * FROM AA;
+CREATE TABLE BB (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_varchar_key VARCHAR(1),
+col_varchar_nokey VARCHAR(1),
+PRIMARY KEY (pk),
+KEY (col_varchar_key, col_int_key)
+) ENGINE=MyISAM;
+CREATE VIEW view_BB AS SELECT * FROM BB;
+CREATE TABLE DD (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_date_key DATE,
+col_time_key TIME,
+col_datetime_key DATETIME,
+col_varchar_key VARCHAR(1),
+PRIMARY KEY (pk),
+KEY (col_varchar_key, col_int_key)
+) ENGINE=MyISAM;
+CREATE VIEW view_DD AS SELECT * FROM DD;
+CREATE TRIGGER k BEFORE INSERT ON `DD` FOR EACH ROW INSERT INTO `view_BB` SELECT * FROM `view_A` LIMIT 0 ;
+CREATE TRIGGER r BEFORE INSERT ON `A` FOR EACH ROW INSERT INTO `view_AA` SELECT * FROM `view_C` LIMIT 0 ;
+ALTER TABLE `DD` DROP PRIMARY KEY;
+ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
+INSERT INTO `view_A` ( `pk` ) VALUES (NULL);
+INSERT INTO `DD` ( `pk` ) VALUES (NULL);
+INSERT INTO `A` ( `pk` ) VALUES (NULL);
+INSERT INTO `view_DD` ( `pk` ) VALUES (NULL);
+drop trigger r;
+drop trigger k;
+drop view view_A,view_AA,view_C,view_BB,view_DD;
+drop table A,C,AA,BB,DD;
+CREATE TABLE A (
+i INT,
+i1 INT,
+i2 INT,
+d1 DATE,
+d2 DATE,
+col_time_nokey1 TIME,
+col_time_nokey2 TIME,
+col_datetime_nokey1 DATETIME,
+col_datetime_nokey2 DATETIME,
+col_varchar_nokey1 VARCHAR(1),
+col_varchar_nokey2 VARCHAR(1)
+) ENGINE=MyISAM;
+CREATE VIEW view_A AS SELECT * FROM A;
+CREATE TABLE B (
+col_varchar_nokey VARCHAR(1)
+) ENGINE=MyISAM;
+CREATE TABLE AA (
+i INT,
+i1 INT,
+i2 INT,
+d1 DATE,
+d2 DATE,
+col_time_nokey1 TIME,
+col_time_nokey2 TIME,
+col_datetime_nokey1 DATETIME,
+col_datetime_nokey2 DATETIME,
+col_varchar_nokey1 VARCHAR(1),
+col_varchar_nokey2 VARCHAR(1)
+) ENGINE=MyISAM;
+CREATE VIEW view_AA AS SELECT * FROM AA;
+CREATE TABLE DD (
+i INT,
+i1 INT,
+i2 INT,
+d1 DATE,
+d2 DATE,
+col_time_nokey1 TIME,
+col_time_nokey2 TIME,
+col_datetime_nokey1 DATETIME,
+col_datetime_nokey2 DATETIME,
+col_varchar_nokey1 VARCHAR(1),
+col_varchar_nokey2 VARCHAR(1)
+) ENGINE=MyISAM;
+CREATE VIEW view_DD AS SELECT * FROM DD;
+CREATE TRIGGER tr1 BEFORE INSERT ON `AA` FOR EACH ROW INSERT INTO `view_A` SELECT * FROM `view_AA` LIMIT 0 ;
+CREATE TRIGGER tr2 BEFORE INSERT ON `B` FOR EACH ROW INSERT INTO `D` SELECT * FROM `A` LIMIT 0 ;
+INSERT INTO `view_AA` ( `i` ) VALUES (1);
+INSERT INTO `AA` ( `i` ) VALUES (2);
+DELETE FROM `B`;
+INSERT INTO `view_DD` ( `i` ) VALUES (1);
+INSERT INTO `view_AA` ( `i` ) VALUES (3);
+drop trigger tr1;
+drop trigger tr2;
+drop view view_A, view_AA,view_DD;
+drop table A,B,AA,DD;
diff --git a/mysql-test/r/sp-lock.result b/mysql-test/r/sp-lock.result
index 860312dca3e..49ff0c7ba58 100644
--- a/mysql-test/r/sp-lock.result
+++ b/mysql-test/r/sp-lock.result
@@ -725,7 +725,7 @@ release_lock("test")
get_lock("test", 10)
1
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+p1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
BEGIN
SELECT get_lock("test", 10);
SHOW CREATE PROCEDURE p1;
diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result
index 7e89867963a..276da41a0fe 100644
--- a/mysql-test/r/sp-security.result
+++ b/mysql-test/r/sp-security.result
@@ -1,4 +1,5 @@
use test;
+create user user1@localhost;
grant usage on *.* to user1@localhost;
flush privileges;
drop table if exists t1;
@@ -31,10 +32,13 @@ root@localhost 1
select db();
db()
test
+create user user1@'%';
grant execute on procedure db1_secret.stamp to user1@'%';
grant execute on function db1_secret.db to user1@'%';
+set sql_mode='';
grant execute on procedure db1_secret.stamp to ''@'%';
grant execute on function db1_secret.db to ''@'%';
+set sql_mode=default;
call db1_secret.stamp(2);
select db1_secret.db();
db1_secret.db()
@@ -103,6 +107,7 @@ create table t2 (s1 int);
insert into t2 values (0);
grant usage on db2.* to user1@localhost;
grant select on db2.* to user1@localhost;
+create user user2@localhost;
grant usage on db2.* to user2@localhost;
grant select,insert,update,delete,create routine on db2.* to user2@localhost;
grant create routine on db2.* to user1@localhost;
@@ -156,8 +161,11 @@ delete from mysql.procs_priv where user='user1' or user='user2';
delete from mysql.procs_priv where user='' and host='%';
delete from mysql.db where user='user2';
flush privileges;
+create user usera@localhost;
grant usage on *.* to usera@localhost;
+create user userb@localhost;
grant usage on *.* to userb@localhost;
+create user userc@localhost;
grant usage on *.* to userc@localhost;
create database sptest;
create table t1 ( u varchar(64), i int );
@@ -220,9 +228,11 @@ delete from mysql.tables_priv where user='usera';
flush privileges;
drop table t1;
drop function if exists bug_9503;
+drop user if exists user1@localhost;
create database mysqltest//
use mysqltest//
create table t1 (s1 int)//
+create user user1@localhost//
grant select on t1 to user1@localhost//
create function bug_9503 () returns int sql security invoker begin declare v int;
select min(s1) into v from t1; return v; end//
@@ -266,6 +276,7 @@ create procedure mysqltest_1.p1()
begin
select 1 from dual;
end//
+create user mysqltest_1@localhost;
grant usage on *.* to mysqltest_1@localhost;
call mysqltest_1.p1();
ERROR 42000: execute command denied to user 'mysqltest_1'@'localhost' for routine 'mysqltest_1.p1'
@@ -366,19 +377,19 @@ Note 1449 The user specified as a definer ('a @ b @ c'@'localhost') does not exi
USE mysqltest;
SHOW CREATE PROCEDURE wl2897_p1;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-wl2897_p1 CREATE DEFINER=`mysqltest_2`@`localhost` PROCEDURE `wl2897_p1`()
+wl2897_p1 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 CREATE DEFINER=`a @ b @ c`@`localhost` PROCEDURE `wl2897_p3`()
+wl2897_p3 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 CREATE DEFINER=`mysqltest_2`@`localhost` FUNCTION `wl2897_f1`() RETURNS int(11)
+wl2897_f1 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 CREATE DEFINER=`a @ b @ c`@`localhost` FUNCTION `wl2897_f3`() RETURNS int(11)
+wl2897_f3 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;
@@ -444,7 +455,7 @@ SELECT a;
END //
SHOW CREATE PROCEDURE test.sp19857;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-sp19857 CREATE DEFINER=`user19857`@`localhost` PROCEDURE `sp19857`()
+sp19857 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`user19857`@`localhost` PROCEDURE `sp19857`()
DETERMINISTIC
BEGIN
DECLARE a INT;
@@ -612,7 +623,7 @@ GRANT SELECT ON mysql.proc TO user2@localhost;
# This should work
SHOW CREATE PROCEDURE db1.p1;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+p1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci
# Connection default
DROP USER user2@localhost;
diff --git a/mysql-test/r/sp-ucs2.result b/mysql-test/r/sp-ucs2.result
index c7a3ed6e46a..3c444ad97de 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 CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET ucs2 COLLATE ucs2_bin
+f 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 CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET ucs2 COLLATE ucs2_bin
+f 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 CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET latin1 COLLATE latin1_bin
+f 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 CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET latin1 COLLATE latin1_bin
+f 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 CREATE DEFINER=`root`@`localhost` FUNCTION `bug48766`() RETURNS enum('w') CHARSET ucs2
+bug48766 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 CREATE DEFINER=`root`@`localhost` FUNCTION `bug48766`() RETURNS enum('а','б','в','г') CHARSET ucs2
+bug48766 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 3f28df927b8..51c1b1924d1 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 CREATE DEFINER=`root`@`localhost` PROCEDURE `chistics`()
+chistics 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 CREATE DEFINER=`root`@`localhost` PROCEDURE `chistics`()
+chistics 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 CREATE DEFINER=`root`@`localhost` FUNCTION `chistics`() RETURNS int(11)
+chistics 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 CREATE DEFINER=`root`@`localhost` FUNCTION `chistics`() RETURNS int(11)
+chistics NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `chistics`() RETURNS int(11)
NO SQL
DETERMINISTIC
SQL SECURITY INVOKER
@@ -6072,7 +6072,7 @@ insert into examplebug20777 values (1, 9223372036854775806, 9223372036854775807,
show create table examplebug20777;
Table Create Table
examplebug20777 CREATE TABLE `examplebug20777` (
- `i` int(1) NOT NULL DEFAULT '0',
+ `i` int(1) NOT NULL,
`2**63-2` bigint(20) unsigned DEFAULT NULL,
`2**63-1` bigint(20) unsigned DEFAULT NULL,
`2**63` bigint(20) unsigned DEFAULT NULL,
@@ -7102,7 +7102,7 @@ CAST('10 ' as UNSIGNED INTEGER)
1
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
-Warning 1292 Truncated incorrect INTEGER value: '10 '
+Note 1292 Truncated incorrect INTEGER value: '10 '
DROP PROCEDURE p1;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
@@ -7128,7 +7128,7 @@ CAST('10 ' as UNSIGNED INTEGER)
2
2
Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '10 '
+Note 1292 Truncated incorrect INTEGER value: '10 '
DROP PROCEDURE p1;
DROP PROCEDURE p2;
DROP PROCEDURE p3;
@@ -7861,6 +7861,60 @@ v1
DROP PROCEDURE p1;
DROP TABLE t1;
# End of 5.5 test
+#
+# MDEV-7040: Crash in field_conv, memcpy_field_possible, part#2
+#
+create table t1 (
+col1 bigint(20),
+col2 char(1),
+col3 char(2)
+);
+insert into t1 values (1,'a','a'), (2,'b','b');
+create table t2 as select * from t1;
+create table t3 as select * from t1;
+create table t4 as select * from t1;
+create table t5 as select * from t1;
+create table t6 as select * from t1;
+flush tables;
+CREATE PROCEDURE p1()
+begin
+DECLARE _var1 bigint(20) UNSIGNED;
+DECLARE _var2 CHAR(1) DEFAULT NULL;
+DECLARE _var3 CHAR(1) DEFAULT NULL;
+DECLARE _done BOOLEAN DEFAULT 0;
+declare cur1 cursor for
+select col1, col2, col3
+from t1
+where
+col1 in (select t2.col1 from t2 where t2.col2=t1.col2) or
+col2 in (select t3.col3 from t3 where t3.col3=t1.col2) ;
+DECLARE CONTINUE HANDLER FOR NOT FOUND SET _done = 1;
+OPEN cur1;
+set _var1 = (select _var1 from t4 limit 1);
+set _var1 = (select _var1 from t5 limit 1);
+set _var1 = (select _var1 from t6 limit 1);
+label1:
+LOOP
+SET _done = 0;
+FETCH cur1 INTO _var1, _var2, _var3;
+IF _done THEN
+LEAVE label1;
+END IF;
+END LOOP label1;
+CLOSE cur1;
+end|
+set @tmp_toc= @@table_open_cache;
+set @tmp_tdc= @@table_definition_cache;
+set global table_open_cache=1;
+set global table_definition_cache=1;
+Warnings:
+Warning 1292 Truncated incorrect table_definition_cache value: '1'
+call p1();
+set global table_open_cache= @tmp_toc;
+set global table_definition_cache= @tmp_tdc;
+drop procedure p1;
+drop table t1,t2,t3,t4,t5,t6;
+# End of 10.0 test
CREATE FUNCTION f(f1 VARCHAR(64) COLLATE latin1_german2_ci)
RETURNS VARCHAR(64)
BEGIN
diff --git a/mysql-test/r/sp_notembedded.result b/mysql-test/r/sp_notembedded.result
index 3cc4ff4238b..40a06d312a0 100644
--- a/mysql-test/r/sp_notembedded.result
+++ b/mysql-test/r/sp_notembedded.result
@@ -150,6 +150,7 @@ drop view v1|
drop table t3|
drop procedure if exists bug15298_1;
drop procedure if exists bug15298_2;
+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;
@@ -203,6 +204,8 @@ Warnings:
Warning 1364 Field 'authentication_string' doesn't have a default value
FLUSH PRIVILEGES;
CREATE PROCEDURE p1(i INT) BEGIN END;
+Warnings:
+Warning 1404 Failed to grant EXECUTE and ALTER ROUTINE privileges
DROP PROCEDURE p1;
DELETE FROM mysql.user WHERE User='mysqltest_1';
FLUSH PRIVILEGES;
diff --git a/mysql-test/r/sp_trans.result b/mysql-test/r/sp_trans.result
index 5526fc19aae..c76615d644f 100644
--- a/mysql-test/r/sp_trans.result
+++ b/mysql-test/r/sp_trans.result
@@ -1,3 +1,4 @@
+set SQL_MODE="";
drop table if exists t1, t2, t3;
drop procedure if exists bug8850|
create table t1 (a int) engine=innodb|
diff --git a/mysql-test/r/ssl_7937,nossl.result b/mysql-test/r/ssl_7937,nossl.result
new file mode 100644
index 00000000000..72693233bc8
--- /dev/null
+++ b/mysql-test/r/ssl_7937,nossl.result
@@ -0,0 +1,15 @@
+create procedure have_ssl()
+select if(variable_value > '','yes','no') as 'have_ssl'
+ from information_schema.session_status
+where variable_name='ssl_cipher';
+mysql --ssl-ca=cacert.pem -e "call test.have_ssl()"
+have_ssl
+no
+mysql --ssl -e "call test.have_ssl()"
+have_ssl
+no
+mysql --ssl-ca=cacert.pem --ssl-verify-server-cert -e "call test.have_ssl()"
+ERROR 2026 (HY000): SSL connection error: SSL is required, but the server does not support it
+mysql --ssl --ssl-verify-server-cert -e "call test.have_ssl()"
+ERROR 2026 (HY000): SSL connection error: SSL is required, but the server does not support it
+drop procedure have_ssl;
diff --git a/mysql-test/r/ssl_7937.result b/mysql-test/r/ssl_7937.result
new file mode 100644
index 00000000000..a94ca3b3529
--- /dev/null
+++ b/mysql-test/r/ssl_7937.result
@@ -0,0 +1,16 @@
+create procedure have_ssl()
+select if(variable_value > '','yes','no') as 'have_ssl'
+ from information_schema.session_status
+where variable_name='ssl_cipher';
+mysql --ssl-ca=cacert.pem -e "call test.have_ssl()"
+have_ssl
+yes
+mysql --ssl -e "call test.have_ssl()"
+have_ssl
+yes
+mysql --ssl-ca=cacert.pem --ssl-verify-server-cert -e "call test.have_ssl()"
+have_ssl
+yes
+mysql --ssl --ssl-verify-server-cert -e "call test.have_ssl()"
+ERROR 2026 (HY000): SSL connection error: Failed to verify the server certificate
+drop procedure have_ssl;
diff --git a/mysql-test/r/stack-crash.result b/mysql-test/r/stack-crash.result
index be5b6464b9a..62870db79f3 100644
--- a/mysql-test/r/stack-crash.result
+++ b/mysql-test/r/stack-crash.result
@@ -23,10 +23,7 @@ CREATE TABLE t1 (
`sspo_lu_uid` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`sspo_id`),
KEY `post_uid` (`sspo_uid`,`sspo_cr_date`)
-) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8;
-Warnings:
-Warning 1286 Unknown storage engine 'InnoDB'
-Warning 1266 Using storage engine MyISAM for table 't1'
+) AUTO_INCREMENT=30 DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES (1,2,'P','test1','',0,'','',NULL,'','','','','A','2013-09-30 00:19:32',2,'2013-09-30 00:19:32',2),(2,2,'P','bbb','',0,'','',NULL,'','','','','A','2013-10-02 15:06:35',2,'2013-10-02 15:06:35',2);
CREATE TABLE `t2` (
`spoo_id` int(11) NOT NULL AUTO_INCREMENT,
@@ -41,10 +38,7 @@ CREATE TABLE `t2` (
`spoo_lu_uid` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`spoo_id`),
KEY `object_option_main_idx` (`spoo_user_type_id`,`spoo_uid`,`spoo_option_id`,`spoo_value`(255))
-) ENGINE=InnoDB AUTO_INCREMENT=107 DEFAULT CHARSET=utf8;
-Warnings:
-Warning 1286 Unknown storage engine 'InnoDB'
-Warning 1266 Using storage engine MyISAM for table 't2'
+) AUTO_INCREMENT=107 DEFAULT CHARSET=utf8;
INSERT INTO `t2` VALUES (19,1,2,6,'Dortmund','A','2013-09-26 01:36:51',2,'2013-09-26 01:36:51',2),(20,1,2,8,'49','A','2013-09-26 01:36:51',2,'2013-09-26 01:36:51',2);
SELECT Count(*)
FROM t1 AS tbl
diff --git a/mysql-test/r/stat_tables_rbr.result b/mysql-test/r/stat_tables_rbr.result
index 119801bf7d4..35e74e29b08 100644
--- a/mysql-test/r/stat_tables_rbr.result
+++ b/mysql-test/r/stat_tables_rbr.result
@@ -15,20 +15,17 @@ ALTER TABLE t1 ANALYZE PARTITION p1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
-SHOW BINLOG EVENTS;
+include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 248 Server ver: #, Binlog ver: #
-master-bin.000001 248 Gtid_list 1 273 []
-master-bin.000001 273 Binlog_checkpoint 1 313 master-bin.000001
-master-bin.000001 313 Gtid 1 351 GTID 0-1-1
-master-bin.000001 351 Query 1 451 use `test`; CREATE TABLE t1 (i INT) ENGINE=InnoDB
-master-bin.000001 451 Gtid 1 489 GTID 0-1-2
-master-bin.000001 489 Query 1 568 use `test`; ANALYZE TABLE t1
-master-bin.000001 568 Gtid 1 606 GTID 0-1-3
-master-bin.000001 606 Query 1 710 use `test`; DROP TABLE `t1` /* generated by server */
-master-bin.000001 710 Gtid 1 748 GTID 0-1-4
-master-bin.000001 748 Query 1 884 use `test`; CREATE TABLE t1 ( a INT ) ENGINE=MyISAM PARTITION BY HASH(a) PARTITIONS 2
-master-bin.000001 884 Gtid 1 922 GTID 0-1-5
-master-bin.000001 922 Query 1 1020 use `test`; ALTER TABLE t1 ANALYZE PARTITION p1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (i INT) ENGINE=InnoDB
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; ANALYZE TABLE t1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 ( a INT ) ENGINE=MyISAM PARTITION BY HASH(a) PARTITIONS 2
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; ALTER TABLE t1 ANALYZE PARTITION p1
SET use_stat_tables = DEFAULT;
DROP TABLE t1;
diff --git a/mysql-test/r/status.result b/mysql-test/r/status.result
index 140db7c5721..55afd159053 100644
--- a/mysql-test/r/status.result
+++ b/mysql-test/r/status.result
@@ -204,6 +204,7 @@ Com_drop_function 1
create database db37908;
create table db37908.t1(f1 int);
insert into db37908.t1 values(1);
+create user mysqltest_1@localhost;
grant usage,execute on test.* to mysqltest_1@localhost;
create procedure proc37908() begin select 1; end |
create function func37908() returns int sql security invoker
diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result
index 7cc29ae4ed6..66a4225a710 100644
--- a/mysql-test/r/strict.result
+++ b/mysql-test/r/strict.result
@@ -778,7 +778,7 @@ ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 VALUES ('-100E+1');
ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 VALUES ('-100E');
-ERROR 22007: Incorrect decimal value: '-100E' for column 'col1' at row 1
+ERROR 01000: Data truncated for column 'col1' at row 1
UPDATE t1 SET col1 =col1 * 50000 WHERE col1 =11;
ERROR 22003: Out of range value for column 'col1' at row 6
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
@@ -790,10 +790,10 @@ ERROR 22007: Incorrect decimal value: '' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('a59b');
ERROR 22007: Incorrect decimal value: 'a59b' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('1a');
-ERROR 22007: Incorrect decimal value: '1a' for column 'col1' at row 1
+ERROR 01000: Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
Warnings:
-Note 1265 Data truncated for column 'col1' at row 1
+Warning 1265 Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 values (1/0);
Warnings:
Warning 1365 Division by 0
@@ -853,9 +853,9 @@ ERROR 22012: Division by 0
UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES ('');
-ERROR 01000: Data truncated for column 'col1' at row 1
+ERROR 22007: Incorrect double value: '' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('a59b');
-ERROR 01000: Data truncated for column 'col1' at row 1
+ERROR 22007: Incorrect double value: 'a59b' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('1a');
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
@@ -903,9 +903,9 @@ ERROR 22012: Division by 0
UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES ('');
-ERROR 01000: Data truncated for column 'col1' at row 1
+ERROR 22007: Incorrect double value: '' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('a59b');
-ERROR 01000: Data truncated for column 'col1' at row 1
+ERROR 22007: Incorrect double value: 'a59b' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('1a');
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
@@ -1125,6 +1125,8 @@ ERROR 22007: Truncated incorrect INTEGER value: '10a'
insert into t1 (col2) values (cast('10' as unsigned integer));
insert into t1 (col2) values (cast('10' as signed integer));
insert into t1 (col2) values (10E+0 + '0 ');
+Warnings:
+Note 1292 Truncated incorrect DOUBLE value: '0 '
select * from t1;
col1 col2
NULL 10
@@ -1270,7 +1272,7 @@ alter table t1 add primary key(a);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -1280,7 +1282,7 @@ alter table t1 add primary key(a);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` timestamp NOT NULL DEFAULT '2005-01-02 03:04:05',
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 3732f62d5e5..689edfa6dab 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -402,13 +402,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` = '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` = '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
@@ -1255,7 +1255,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bigint(20) NOT NULL DEFAULT '0'
+ `a` bigint(20) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int);
@@ -6312,12 +6312,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
SELECT 1 FROM t1 WHERE a =
(SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
DROP TABLE t1, t2;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
diff --git a/mysql-test/r/subselect_cache.result b/mysql-test/r/subselect_cache.result
index e5a2fe12526..8ca6bf52e0e 100644
--- a/mysql-test/r/subselect_cache.result
+++ b/mysql-test/r/subselect_cache.result
@@ -39,6 +39,231 @@ Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 31
+analyze format=json
+select a, (select d from t2 where b=c) from t1;
+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": 100
+ },
+ "subqueries": [
+ {
+ "expression_cache": {
+ "r_loops": 10,
+ "r_hit_ratio": 60,
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 4,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 4,
+ "rows": 4,
+ "r_rows": 4,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 18.75,
+ "attached_condition": "(t1.b = t2.c)"
+ }
+ }
+ }
+ }
+ ]
+ }
+}
+analyze format=json
+select a, (select d from t2 where b=c), (select d from t2 where b=c union select 1 order by 1 limit 1) from t1;
+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": 100
+ },
+ "subqueries": [
+ {
+ "expression_cache": {
+ "r_loops": 10,
+ "r_hit_ratio": 60,
+ "query_block": {
+ "union_result": {
+ "table_name": "<union3,4>",
+ "access_type": "ALL",
+ "r_loops": 4,
+ "r_rows": 1,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 3,
+ "r_loops": 4,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 4,
+ "rows": 4,
+ "r_rows": 4,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 18.75,
+ "attached_condition": "(t1.b = t2.c)"
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 4,
+ "table": {
+ "message": "No tables used"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ {
+ "expression_cache": {
+ "r_loops": 10,
+ "r_hit_ratio": 60,
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 4,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 4,
+ "rows": 4,
+ "r_rows": 4,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 18.75,
+ "attached_condition": "(t1.b = t2.c)"
+ }
+ }
+ }
+ }
+ ]
+ }
+}
+explain format=json
+select a, (select d from t2 where b=c) from t1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ },
+ "subqueries": [
+ {
+ "expression_cache": {
+ "state": "uninitialized",
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "(t1.b = t2.c)"
+ }
+ }
+ }
+ }
+ ]
+ }
+}
+explain format=json
+select a, (select d from t2 where b=c), (select d from t2 where b=c union select 1 order by 1 limit 1) from t1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ },
+ "subqueries": [
+ {
+ "expression_cache": {
+ "state": "uninitialized",
+ "query_block": {
+ "union_result": {
+ "table_name": "<union3,4>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "(t1.b = t2.c)"
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 4,
+ "table": {
+ "message": "No tables used"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ {
+ "expression_cache": {
+ "state": "uninitialized",
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "(t1.b = t2.c)"
+ }
+ }
+ }
+ }
+ ]
+ }
+}
set optimizer_switch='subquery_cache=off';
flush status;
select a, (select d from t2 where b=c) from t1;
diff --git a/mysql-test/r/subselect_mat.result b/mysql-test/r/subselect_mat.result
index 40c0c21ae40..b201ac6a44c 100644
--- a/mysql-test/r/subselect_mat.result
+++ b/mysql-test/r/subselect_mat.result
@@ -2145,6 +2145,24 @@ drop database mysqltest1;
drop database mysqltest2;
drop database mysqltest3;
drop database mysqltest4;
+#
+# MDEV-7810 Wrong result on execution of a query as a PS
+# (both 1st and further executions)
+CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (0),(8);
+SELECT a FROM (SELECT DISTINCT * FROM t1) AS sq WHERE a IN (SELECT MIN(t2.a) FROM (t1 AS t2));
+a
+0
+PREPARE stmt FROM "
+SELECT a FROM (SELECT DISTINCT * FROM t1) AS sq WHERE a IN (SELECT MIN(t2.a) FROM (t1 AS t2))
+";
+execute stmt;
+a
+0
+execute stmt;
+a
+0
+drop table t1;
# End of 5.5 tests
#
# MDEV-7220: Materialization strategy is not used for REPLACE ... SELECT
@@ -2197,6 +2215,24 @@ Handler_read_rnd_next 6003
Handler_tmp_write 2000
Handler_write 1000
drop table t0,t1,t2,t3;
+#
+# MDEV-7971: Assertion `name != __null' failed in ACL_internal_schema_registry::lookup
+# on 2nd execution os PS with multi-table update
+#
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (f2 INT);
+INSERT INTO t2 VALUES (3),(4);
+CREATE TABLE t3 (f3 INT);
+INSERT INTO t3 VALUES (5),(6);
+PREPARE stmt FROM '
+ UPDATE t1, t2
+ SET f1 = 5
+ WHERE 8 IN ( SELECT MIN(f3) FROM t3 )
+';
+EXECUTE stmt;
+EXECUTE stmt;
+DROP TABLE t1,t2,t3;
set @subselect_mat_test_optimizer_switch_value=null;
set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off';
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
diff --git a/mysql-test/r/subselect_no_exists_to_in.result b/mysql-test/r/subselect_no_exists_to_in.result
index 140b7902660..195f377e7ff 100644
--- a/mysql-test/r/subselect_no_exists_to_in.result
+++ b/mysql-test/r/subselect_no_exists_to_in.result
@@ -406,13 +406,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` = '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` = '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
@@ -1259,7 +1259,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bigint(20) NOT NULL DEFAULT '0'
+ `a` bigint(20) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int);
@@ -6312,12 +6312,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
SELECT 1 FROM t1 WHERE a =
(SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
DROP TABLE t1, t2;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result
index 99ac9f4b300..26794b452cc 100644
--- a/mysql-test/r/subselect_no_mat.result
+++ b/mysql-test/r/subselect_no_mat.result
@@ -409,13 +409,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` = '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` = '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
@@ -1262,7 +1262,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bigint(20) NOT NULL DEFAULT '0'
+ `a` bigint(20) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int);
@@ -6307,12 +6307,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
SELECT 1 FROM t1 WHERE a =
(SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
DROP TABLE t1, t2;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result
index 7ecd40c3863..9a43e64554e 100644
--- a/mysql-test/r/subselect_no_opts.result
+++ b/mysql-test/r/subselect_no_opts.result
@@ -405,13 +405,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` = '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` = '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
@@ -1258,7 +1258,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bigint(20) NOT NULL DEFAULT '0'
+ `a` bigint(20) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int);
@@ -6303,12 +6303,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
SELECT 1 FROM t1 WHERE a =
(SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
DROP TABLE t1, t2;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result
index c70db6f8cc0..0a88e26bd2d 100644
--- a/mysql-test/r/subselect_no_scache.result
+++ b/mysql-test/r/subselect_no_scache.result
@@ -408,13 +408,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` = '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` = '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
@@ -1261,7 +1261,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bigint(20) NOT NULL DEFAULT '0'
+ `a` bigint(20) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int);
@@ -6318,12 +6318,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
SELECT 1 FROM t1 WHERE a =
(SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
DROP TABLE t1, t2;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result
index 6a7d6b3a81c..142f9f679bf 100644
--- a/mysql-test/r/subselect_no_semijoin.result
+++ b/mysql-test/r/subselect_no_semijoin.result
@@ -405,13 +405,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` = '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` = '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
@@ -1258,7 +1258,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bigint(20) NOT NULL DEFAULT '0'
+ `a` bigint(20) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int);
@@ -6303,12 +6303,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
SELECT 1 FROM t1 WHERE a =
(SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
DROP TABLE t1, t2;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
diff --git a/mysql-test/r/subselect_sj.result b/mysql-test/r/subselect_sj.result
index 46c799c4f6e..a937cc960f3 100644
--- a/mysql-test/r/subselect_sj.result
+++ b/mysql-test/r/subselect_sj.result
@@ -2821,10 +2821,7 @@ col_varchar_nokey varchar(1) DEFAULT NULL,
PRIMARY KEY (pk),
KEY col_int_key (col_int_key),
KEY col_varchar_key (col_varchar_key, col_int_key)
-) ENGINE=InnoDB;
-Warnings:
-Warning 1286 Unknown storage engine 'InnoDB'
-Warning 1266 Using storage engine MyISAM for table 't1'
+);
INSERT INTO t1 VALUES
(10,8,'x','x'),
(11,7,'d','d'),
diff --git a/mysql-test/r/subselect_sj2.result b/mysql-test/r/subselect_sj2.result
index 9a5da710a4c..21d97b3faea 100644
--- a/mysql-test/r/subselect_sj2.result
+++ b/mysql-test/r/subselect_sj2.result
@@ -703,7 +703,7 @@ create table t2 (id int, a int, primary key(id), key(a)) as select a as id, a as
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `id` int(11) NOT NULL DEFAULT '0',
+ `id` int(11) NOT NULL,
`a` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `a` (`a`)
@@ -1092,6 +1092,27 @@ AND ( alias5.b >= alias3.b OR alias5.c != alias3.c )
);
COUNT(*)
3724
+EXPLAIN
+SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3
+WHERE alias3.d IN (
+SELECT alias4.c FROM t2 AS alias4, t2 AS alias5
+WHERE alias5.b = alias4.b
+AND ( alias5.b >= alias3.b OR alias3.c != alias5.c )
+);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL 19 Using where
+1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d 1 Using index
+1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b 1 Using where; FirstMatch(alias3)
+1 PRIMARY alias2 ALL NULL NULL NULL NULL 14 Using join buffer (flat, BNL join)
+1 PRIMARY alias1 ALL NULL NULL NULL NULL 14 Using join buffer (flat, BNL join)
+SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3
+WHERE alias3.d IN (
+SELECT alias4.c FROM t2 AS alias4, t2 AS alias5
+WHERE alias5.b = alias4.b
+AND ( alias5.b >= alias3.b OR alias3.c != alias5.c )
+);
+COUNT(*)
+3724
set optimizer_prune_level=@tmp_951283;
DROP TABLE t1,t2;
#
@@ -1262,5 +1283,38 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY T2_0_ ref FK_T2_T1Id FK_T2_T1Id 8 test.T2_1_.t1idref 1 Using index; End temporary
drop table t3,t2,t1;
set optimizer_search_depth=@tmp7474;
+#
+#
+#
+CREATE TABLE t1 (
+id int(16) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+id int(16) NOT NULL AUTO_INCREMENT,
+t3_id int(16) NOT NULL DEFAULT '0',
+t1_id int(16) NOT NULL DEFAULT '0',
+PRIMARY KEY (id),
+KEY t3_idx (t3_id),
+KEY t1_idx (t1_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+CREATE TABLE t3 (
+id int(16) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t3 VALUES (1);
+INSERT INTO t2 VALUES (1, 1, 1);
+INSERT INTO t2 VALUES (2, 1, 2);
+INSERT INTO t2 VALUES (3, 1, 2);
+INSERT INTO t2 VALUES (4, 1, 1);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+SELECT * FROM t1 WHERE t1.id IN (
+SELECT t2.t1_id FROM t3 JOIN t2 ON t3.id = t2.t3_id WHERE t3.id = 1
+);
+id
+1
+2
+drop table t1,t2,t3;
# 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 c10b550d11a..eb91fe6d61b 100644
--- a/mysql-test/r/subselect_sj2_jcl6.result
+++ b/mysql-test/r/subselect_sj2_jcl6.result
@@ -717,7 +717,7 @@ create table t2 (id int, a int, primary key(id), key(a)) as select a as id, a as
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `id` int(11) NOT NULL DEFAULT '0',
+ `id` int(11) NOT NULL,
`a` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `a` (`a`)
@@ -1107,6 +1107,27 @@ AND ( alias5.b >= alias3.b OR alias5.c != alias3.c )
);
COUNT(*)
3724
+EXPLAIN
+SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3
+WHERE alias3.d IN (
+SELECT alias4.c FROM t2 AS alias4, t2 AS alias5
+WHERE alias5.b = alias4.b
+AND ( alias5.b >= alias3.b OR alias3.c != alias5.c )
+);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL 19 Using where
+1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d 1 Using index
+1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b 1 Using where; FirstMatch(alias3)
+1 PRIMARY alias2 ALL NULL NULL NULL NULL 14 Using join buffer (flat, BNL join)
+1 PRIMARY alias1 ALL NULL NULL NULL NULL 14 Using join buffer (incremental, BNL join)
+SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3
+WHERE alias3.d IN (
+SELECT alias4.c FROM t2 AS alias4, t2 AS alias5
+WHERE alias5.b = alias4.b
+AND ( alias5.b >= alias3.b OR alias3.c != alias5.c )
+);
+COUNT(*)
+3724
set optimizer_prune_level=@tmp_951283;
DROP TABLE t1,t2;
#
@@ -1277,6 +1298,39 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY T2_0_ ref FK_T2_T1Id FK_T2_T1Id 8 test.T2_1_.t1idref 1 Using index; End temporary
drop table t3,t2,t1;
set optimizer_search_depth=@tmp7474;
+#
+#
+#
+CREATE TABLE t1 (
+id int(16) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+id int(16) NOT NULL AUTO_INCREMENT,
+t3_id int(16) NOT NULL DEFAULT '0',
+t1_id int(16) NOT NULL DEFAULT '0',
+PRIMARY KEY (id),
+KEY t3_idx (t3_id),
+KEY t1_idx (t1_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+CREATE TABLE t3 (
+id int(16) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t3 VALUES (1);
+INSERT INTO t2 VALUES (1, 1, 1);
+INSERT INTO t2 VALUES (2, 1, 2);
+INSERT INTO t2 VALUES (3, 1, 2);
+INSERT INTO t2 VALUES (4, 1, 1);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+SELECT * FROM t1 WHERE t1.id IN (
+SELECT t2.t1_id FROM t3 JOIN t2 ON t3.id = t2.t3_id WHERE t3.id = 1
+);
+id
+1
+2
+drop table t1,t2,t3;
# 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 4e75aee24a2..16e8f88168d 100644
--- a/mysql-test/r/subselect_sj2_mat.result
+++ b/mysql-test/r/subselect_sj2_mat.result
@@ -705,7 +705,7 @@ create table t2 (id int, a int, primary key(id), key(a)) as select a as id, a as
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `id` int(11) NOT NULL DEFAULT '0',
+ `id` int(11) NOT NULL,
`a` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `a` (`a`)
@@ -1094,6 +1094,27 @@ AND ( alias5.b >= alias3.b OR alias5.c != alias3.c )
);
COUNT(*)
3724
+EXPLAIN
+SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3
+WHERE alias3.d IN (
+SELECT alias4.c FROM t2 AS alias4, t2 AS alias5
+WHERE alias5.b = alias4.b
+AND ( alias5.b >= alias3.b OR alias3.c != alias5.c )
+);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL 19 Using where
+1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d 1 Using index
+1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b 1 Using where; FirstMatch(alias3)
+1 PRIMARY alias2 ALL NULL NULL NULL NULL 14 Using join buffer (flat, BNL join)
+1 PRIMARY alias1 ALL NULL NULL NULL NULL 14 Using join buffer (flat, BNL join)
+SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3
+WHERE alias3.d IN (
+SELECT alias4.c FROM t2 AS alias4, t2 AS alias5
+WHERE alias5.b = alias4.b
+AND ( alias5.b >= alias3.b OR alias3.c != alias5.c )
+);
+COUNT(*)
+3724
set optimizer_prune_level=@tmp_951283;
DROP TABLE t1,t2;
#
@@ -1264,6 +1285,39 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY T2_0_ ref FK_T2_T1Id FK_T2_T1Id 8 test.T2_1_.t1idref 1 Using index; End temporary
drop table t3,t2,t1;
set optimizer_search_depth=@tmp7474;
+#
+#
+#
+CREATE TABLE t1 (
+id int(16) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+id int(16) NOT NULL AUTO_INCREMENT,
+t3_id int(16) NOT NULL DEFAULT '0',
+t1_id int(16) NOT NULL DEFAULT '0',
+PRIMARY KEY (id),
+KEY t3_idx (t3_id),
+KEY t1_idx (t1_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+CREATE TABLE t3 (
+id int(16) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t3 VALUES (1);
+INSERT INTO t2 VALUES (1, 1, 1);
+INSERT INTO t2 VALUES (2, 1, 2);
+INSERT INTO t2 VALUES (3, 1, 2);
+INSERT INTO t2 VALUES (4, 1, 1);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+SELECT * FROM t1 WHERE t1.id IN (
+SELECT t2.t1_id FROM t3 JOIN t2 ON t3.id = t2.t3_id WHERE t3.id = 1
+);
+id
+1
+2
+drop table t1,t2,t3;
# This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp;
set optimizer_switch=default;
diff --git a/mysql-test/r/subselect_sj_jcl6.result b/mysql-test/r/subselect_sj_jcl6.result
index ba582d7e008..73dd69681d2 100644
--- a/mysql-test/r/subselect_sj_jcl6.result
+++ b/mysql-test/r/subselect_sj_jcl6.result
@@ -2835,10 +2835,7 @@ col_varchar_nokey varchar(1) DEFAULT NULL,
PRIMARY KEY (pk),
KEY col_int_key (col_int_key),
KEY col_varchar_key (col_varchar_key, col_int_key)
-) ENGINE=InnoDB;
-Warnings:
-Warning 1286 Unknown storage engine 'InnoDB'
-Warning 1266 Using storage engine MyISAM for table 't1'
+);
INSERT INTO t1 VALUES
(10,8,'x','x'),
(11,7,'d','d'),
diff --git a/mysql-test/r/subselect_sj_mat.result b/mysql-test/r/subselect_sj_mat.result
index d5150f047d7..2dce6569d67 100644
--- a/mysql-test/r/subselect_sj_mat.result
+++ b/mysql-test/r/subselect_sj_mat.result
@@ -2185,6 +2185,24 @@ drop database mysqltest1;
drop database mysqltest2;
drop database mysqltest3;
drop database mysqltest4;
+#
+# MDEV-7810 Wrong result on execution of a query as a PS
+# (both 1st and further executions)
+CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (0),(8);
+SELECT a FROM (SELECT DISTINCT * FROM t1) AS sq WHERE a IN (SELECT MIN(t2.a) FROM (t1 AS t2));
+a
+0
+PREPARE stmt FROM "
+SELECT a FROM (SELECT DISTINCT * FROM t1) AS sq WHERE a IN (SELECT MIN(t2.a) FROM (t1 AS t2))
+";
+execute stmt;
+a
+0
+execute stmt;
+a
+0
+drop table t1;
# End of 5.5 tests
#
# MDEV-7220: Materialization strategy is not used for REPLACE ... SELECT
@@ -2237,3 +2255,21 @@ Handler_read_rnd_next 6003
Handler_tmp_write 2000
Handler_write 1000
drop table t0,t1,t2,t3;
+#
+# MDEV-7971: Assertion `name != __null' failed in ACL_internal_schema_registry::lookup
+# on 2nd execution os PS with multi-table update
+#
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (f2 INT);
+INSERT INTO t2 VALUES (3),(4);
+CREATE TABLE t3 (f3 INT);
+INSERT INTO t3 VALUES (5),(6);
+PREPARE stmt FROM '
+ UPDATE t1, t2
+ SET f1 = 5
+ WHERE 8 IN ( SELECT MIN(f3) FROM t3 )
+';
+EXECUTE stmt;
+EXECUTE stmt;
+DROP TABLE t1,t2,t3;
diff --git a/mysql-test/r/table_elim.result b/mysql-test/r/table_elim.result
index c633261bcd3..3e0cc480aec 100644
--- a/mysql-test/r/table_elim.result
+++ b/mysql-test/r/table_elim.result
@@ -682,20 +682,14 @@ SET optimizer_switch=@save_optimizer_switch;
# (just a testcase)
CREATE TABLE t1 (
PostID int(10) unsigned NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-Warnings:
-Warning 1286 Unknown storage engine 'InnoDB'
-Warning 1266 Using storage engine MyISAM for table 't1'
+) DEFAULT CHARSET=utf8;
INSERT INTO t1 (PostID) VALUES (1), (2);
CREATE TABLE t2 (
VoteID int(10) unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
EntityID int(10) unsigned NOT NULL,
UserID int(10) unsigned NOT NULL,
UNIQUE KEY EntityID (EntityID,UserID)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-Warnings:
-Warning 1286 Unknown storage engine 'InnoDB'
-Warning 1266 Using storage engine MyISAM for table 't2'
+) DEFAULT CHARSET=utf8;
INSERT INTO t2 (EntityID, UserID) VALUES (1, 30), (2, 30);
SELECT t1.*, T.Voted as Voted
FROM
diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result
index 0a1701be0d7..ee0b3ab6d48 100644
--- a/mysql-test/r/temp_table.result
+++ b/mysql-test/r/temp_table.result
@@ -128,7 +128,7 @@ This is temp. table
show create table v1;
Table Create Table
v1 CREATE TEMPORARY TABLE `v1` (
- `A` varchar(19) NOT NULL DEFAULT ''
+ `A` varchar(19) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create view v1;
View Create View character_set_client collation_connection
@@ -291,3 +291,20 @@ test.t1 repair status OK
test.t2 repair status OK
test.t3 repair status OK
DROP TABLES t1, t2, t3;
+create temporary temporary table t1 (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 'temporary table t1 (a int)' at line 1
+flush status;
+create table t1 (a int);
+create temporary table t2 (a int);
+create temporary table t3 (a int);
+drop table t1;
+drop table t2;
+drop temporary table t3;
+show status like 'com_create%table';
+Variable_name Value
+Com_create_table 1
+Com_create_temporary_table 2
+show status like 'com_drop%table';
+Variable_name Value
+Com_drop_table 2
+Com_drop_temporary_table 1
diff --git a/mysql-test/r/temporal_literal.result b/mysql-test/r/temporal_literal.result
index e317eba37f0..f4f43fe9ba3 100644
--- a/mysql-test/r/temporal_literal.result
+++ b/mysql-test/r/temporal_literal.result
@@ -40,7 +40,7 @@ CREATE TABLE t1 AS SELECT DATE'2010-01-01';
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `DATE'2010-01-01'` date NOT NULL DEFAULT '0000-00-00'
+ `DATE'2010-01-01'` date NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 AS SELECT
@@ -50,9 +50,9 @@ CREATE TABLE t1 AS SELECT
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `{d'2001-01-01'}` date NOT NULL DEFAULT '0000-00-00',
- `{ d '2001-01-01' }` date NOT NULL DEFAULT '0000-00-00',
- `2001-01-01 10:10:10` varchar(19) NOT NULL DEFAULT ''
+ `{d'2001-01-01'}` date NOT NULL,
+ `{ d '2001-01-01' }` date NOT NULL,
+ `2001-01-01 10:10:10` varchar(19) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
EXPLAIN EXTENDED SELECT {d'2010-01-01'};
@@ -150,14 +150,14 @@ TIME'10:10:10.123456';
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `TIME'10:10:10'` time NOT NULL DEFAULT '00:00:00',
- `TIME'10:10:10.'` time NOT NULL DEFAULT '00:00:00',
- `TIME'10:10:10.1'` time(1) NOT NULL DEFAULT '00:00:00.0',
- `TIME'10:10:10.12'` time(2) NOT NULL DEFAULT '00:00:00.00',
- `TIME'10:10:10.123'` time(3) NOT NULL DEFAULT '00:00:00.000',
- `TIME'10:10:10.1234'` time(4) NOT NULL DEFAULT '00:00:00.0000',
- `TIME'10:10:10.12345'` time(5) NOT NULL DEFAULT '00:00:00.00000',
- `TIME'10:10:10.123456'` time(6) NOT NULL DEFAULT '00:00:00.000000'
+ `TIME'10:10:10'` time NOT NULL,
+ `TIME'10:10:10.'` time NOT NULL,
+ `TIME'10:10:10.1'` time(1) NOT NULL,
+ `TIME'10:10:10.12'` time(2) NOT NULL,
+ `TIME'10:10:10.123'` time(3) NOT NULL,
+ `TIME'10:10:10.1234'` time(4) NOT NULL,
+ `TIME'10:10:10.12345'` time(5) NOT NULL,
+ `TIME'10:10:10.123456'` time(6) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 AS SELECT
@@ -169,11 +169,11 @@ CREATE TABLE t1 AS SELECT
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `{t'10:10:10'}` time NOT NULL DEFAULT '00:00:00',
- `{ t '10:10:10' }` time NOT NULL DEFAULT '00:00:00',
- `{t'10:10:10.'}` time NOT NULL DEFAULT '00:00:00',
- `{t'10:10:10.123456'}` time(6) NOT NULL DEFAULT '00:00:00.000000',
- `2001-01-01` varchar(10) NOT NULL DEFAULT ''
+ `{t'10:10:10'}` time NOT NULL,
+ `{ t '10:10:10' }` time NOT NULL,
+ `{t'10:10:10.'}` time NOT NULL,
+ `{t'10:10:10.123456'}` time(6) NOT NULL,
+ `2001-01-01` varchar(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
EXPLAIN EXTENDED SELECT {t'10:01:01'};
@@ -242,14 +242,14 @@ TIMESTAMP'2010-01-01 10:10:10.123456';
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `TIMESTAMP'2010-01-01 10:10:10'` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `TIMESTAMP'2010-01-01 10:10:10.'` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `TIMESTAMP'2010-01-01 10:10:10.1'` datetime(1) NOT NULL DEFAULT '0000-00-00 00:00:00.0',
- `TIMESTAMP'2010-01-01 10:10:10.12'` datetime(2) NOT NULL DEFAULT '0000-00-00 00:00:00.00',
- `TIMESTAMP'2010-01-01 10:10:10.123'` datetime(3) NOT NULL DEFAULT '0000-00-00 00:00:00.000',
- `TIMESTAMP'2010-01-01 10:10:10.1234'` datetime(4) NOT NULL DEFAULT '0000-00-00 00:00:00.0000',
- `TIMESTAMP'2010-01-01 10:10:10.12345'` datetime(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000',
- `TIMESTAMP'2010-01-01 10:10:10.123456'` datetime(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000'
+ `TIMESTAMP'2010-01-01 10:10:10'` datetime NOT NULL,
+ `TIMESTAMP'2010-01-01 10:10:10.'` datetime NOT NULL,
+ `TIMESTAMP'2010-01-01 10:10:10.1'` datetime(1) NOT NULL,
+ `TIMESTAMP'2010-01-01 10:10:10.12'` datetime(2) NOT NULL,
+ `TIMESTAMP'2010-01-01 10:10:10.123'` datetime(3) NOT NULL,
+ `TIMESTAMP'2010-01-01 10:10:10.1234'` datetime(4) NOT NULL,
+ `TIMESTAMP'2010-01-01 10:10:10.12345'` datetime(5) NOT NULL,
+ `TIMESTAMP'2010-01-01 10:10:10.123456'` datetime(6) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 AS SELECT
@@ -261,11 +261,11 @@ CREATE TABLE t1 AS SELECT
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `{ts'2001-01-01 10:10:10'}` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `{ ts '2001-01-01 10:10:10' }` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `{ts'2001-01-01 10:10:10.'}` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `{ts'2001-01-01 10:10:10.123456'}` datetime(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000',
- `2001-01-01` varchar(10) NOT NULL DEFAULT ''
+ `{ts'2001-01-01 10:10:10'}` datetime NOT NULL,
+ `{ ts '2001-01-01 10:10:10' }` datetime NOT NULL,
+ `{ts'2001-01-01 10:10:10.'}` datetime NOT NULL,
+ `{ts'2001-01-01 10:10:10.123456'}` datetime(6) NOT NULL,
+ `2001-01-01` varchar(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
EXPLAIN EXTENDED SELECT {ts'2010-01-01 10:10:10'};
@@ -590,8 +590,8 @@ DATE'2001-01-00';
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `DATE'2001-01-01'` date NOT NULL DEFAULT '0000-00-00',
- `DATE'0000-01-01'` date NOT NULL DEFAULT '0000-00-00',
+ `DATE'2001-01-01'` date NOT NULL,
+ `DATE'0000-01-01'` date NOT NULL,
`DATE'2001-00-00'` date DEFAULT NULL,
`DATE'2001-00-01'` date DEFAULT NULL,
`DATE'2001-01-00'` date DEFAULT NULL
@@ -606,8 +606,8 @@ TIMESTAMP'2001-01-00 00:00:00';
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `TIMESTAMP'2001-01-01 00:00:00'` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `TIMESTAMP'0000-01-01 00:00:00'` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `TIMESTAMP'2001-01-01 00:00:00'` datetime NOT NULL,
+ `TIMESTAMP'0000-01-01 00:00:00'` datetime NOT NULL,
`TIMESTAMP'2001-00-00 00:00:00'` datetime DEFAULT NULL,
`TIMESTAMP'2001-00-01 00:00:00'` datetime DEFAULT NULL,
`TIMESTAMP'2001-01-00 00:00:00'` datetime DEFAULT NULL
diff --git a/mysql-test/r/timezone_grant.result b/mysql-test/r/timezone_grant.result
index 49918038da5..d33d92dbc9e 100644
--- a/mysql-test/r/timezone_grant.result
+++ b/mysql-test/r/timezone_grant.result
@@ -7,6 +7,7 @@ delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges;
create table t1 (a int, b datetime);
create table t2 (c int, d datetime);
+create user mysqltest_1@localhost;
grant all privileges on test.* to mysqltest_1@localhost;
show grants for current_user();
Grants for mysqltest_1@localhost
@@ -63,6 +64,7 @@ flush privileges;
drop table t1, t2;
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;
create view v1 as select a, convert_tz(b, 'UTC', 'Europe/Moscow') as lb from t1;
select * from v1;
diff --git a/mysql-test/r/trigger-compat.result b/mysql-test/r/trigger-compat.result
index 8caba961624..7659667fb37 100644
--- a/mysql-test/r/trigger-compat.result
+++ b/mysql-test/r/trigger-compat.result
@@ -29,8 +29,8 @@ 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 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 mysqltest_dfn@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+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
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.
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
index e71090b8528..9dfa5897af1 100644
--- a/mysql-test/r/trigger.result
+++ b/mysql-test/r/trigger.result
@@ -415,6 +415,13 @@ i j k @b
15 NULL 15 Fired
set @b:="";
load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, j);
+Warnings:
+Note 1265 Data truncated for column 'i' at row 1
+Note 1265 Data truncated for column 'j' at row 1
+Note 1265 Data truncated for column 'i' at row 2
+Note 1265 Data truncated for column 'j' at row 2
+Note 1265 Data truncated for column 'i' at row 3
+Note 1265 Data truncated for column 'j' at row 3
select *, @b from t1;
i j k @b
10 NULL 10 Fired
diff --git a/mysql-test/r/trigger_notembedded.result b/mysql-test/r/trigger_notembedded.result
index ef86e4c496c..795f722b0d4 100644
--- a/mysql-test/r/trigger_notembedded.result
+++ b/mysql-test/r/trigger_notembedded.result
@@ -138,8 +138,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 mysqltest_inv@localhost latin1 latin1_swedish_ci latin1_swedish_ci
-trg2 INSERT t1 SET @new_sum = 0 AFTER NULL mysqltest_nonexs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+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
DROP TRIGGER trg1;
DROP TRIGGER trg2;
CREATE TRIGGER trg1 BEFORE INSERT ON t1
@@ -168,11 +168,11 @@ 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 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 @ 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 @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 @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 @abcdef@@@hostname latin1 latin1_swedish_ci latin1_swedish_ci
+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
DROP USER mysqltest_dfn@localhost;
@@ -502,6 +502,7 @@ DROP DATABASE db1;
DROP DATABASE IF EXISTS mysqltest_db1;
CREATE DATABASE mysqltest_db1;
USE mysqltest_db1;
+CREATE USER mysqltest_u1@localhost;
GRANT ALL ON mysqltest_db1.* TO mysqltest_u1@localhost;
CREATE TABLE t1 (
a1 int,
diff --git a/mysql-test/r/truncate-stale-6500.result b/mysql-test/r/truncate-stale-6500.result
new file mode 100644
index 00000000000..b6222716953
--- /dev/null
+++ b/mysql-test/r/truncate-stale-6500.result
@@ -0,0 +1,33 @@
+SET GLOBAL query_cache_size=1024*1024*8;
+CREATE TABLE `test` (
+`uniqueId` INT NOT NULL,
+`partitionId` INT NOT NULL,
+PRIMARY KEY (`uniqueId`,`partitionId`)
+) ENGINE=InnoDB PARTITION BY LIST (partitionId) (
+PARTITION p01 VALUES IN (1),
+PARTITION p02 VALUES IN (2)
+);
+INSERT INTO `test`(`uniqueId`,`partitionId`) VALUES(407237055, 2);
+SELECT * FROM `test`;
+uniqueId partitionId
+407237055 2
+#Confirms 1 row in partition 'p02'
+SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS FROM information_schema.PARTITIONS where TABLE_NAME = 'test';
+TABLE_NAME PARTITION_NAME TABLE_ROWS
+test p01 0
+test p02 1
+ALTER TABLE `test` TRUNCATE PARTITION `p02`;
+#Confirms no more rows in partition 'p02'
+SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS FROM information_schema.PARTITIONS where TABLE_NAME = 'test';
+TABLE_NAME PARTITION_NAME TABLE_ROWS
+test p01 0
+test p02 0
+#Before the patch, this returned the previously existing values.
+SELECT * FROM `test`;
+uniqueId partitionId
+SELECT SQL_CACHE * FROM `test`;
+uniqueId partitionId
+SELECT SQL_NO_CACHE * FROM `test`;
+uniqueId partitionId
+DROP TABLE test;
+SET GLOBAL query_cache_size=DEFAULT;
diff --git a/mysql-test/r/truncate.result b/mysql-test/r/truncate.result
index 773075f9dae..9b4cb4a36d9 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 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+p1 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/type_binary.result b/mysql-test/r/type_binary.result
index b00d1585b29..9d44d718a02 100644
--- a/mysql-test/r/type_binary.result
+++ b/mysql-test/r/type_binary.result
@@ -146,3 +146,37 @@ hex(f2) hex(f3)
0000
drop table t1;
End of 5.0 tests
+#
+# Start of 10.0 tests
+#
+#
+# MDEV-8472 BINARY, VARBINARY and BLOB return different warnings on CAST to DECIMAL
+#
+SET NAMES utf8;
+CREATE TABLE t1 (a BINARY(30));
+INSERT INTO t1 VALUES ('1äÖüß@µ*$');
+SELECT CAST(a AS DECIMAL) FROM t1;
+CAST(a AS DECIMAL)
+1
+Warnings:
+Warning 1292 Truncated incorrect DECIMAL value: '1\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
+DROP TABLE t1;
+CREATE TABLE t1 (a VARBINARY(30));
+INSERT INTO t1 VALUES ('1äÖüß@µ*$');
+SELECT CAST(a AS DECIMAL) FROM t1;
+CAST(a AS DECIMAL)
+1
+Warnings:
+Warning 1292 Truncated incorrect DECIMAL value: '1\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$'
+DROP TABLE t1;
+CREATE TABLE t1 (a BLOB);
+INSERT INTO t1 VALUES ('1äÖüß@µ*$');
+SELECT CAST(a AS DECIMAL) FROM t1;
+CAST(a AS DECIMAL)
+1
+Warnings:
+Warning 1292 Truncated incorrect DECIMAL value: '1\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$'
+DROP TABLE t1;
+#
+# End of 10.0 tests
+#
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index ff4ebd6b15c..6a09df409da 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -506,6 +506,8 @@ create table t1 (id integer auto_increment unique,imagem LONGBLOB not null defau
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')),
@@ -711,10 +713,10 @@ alter table t1 add key (a,b,d,e);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL DEFAULT '0',
- `b` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
+ `b` int(11) NOT NULL,
`c` tinyblob NOT NULL,
- `d` int(11) NOT NULL DEFAULT '0',
+ `d` int(11) NOT NULL,
`e` int(11) DEFAULT NULL,
PRIMARY KEY (`a`,`b`,`c`(255),`d`),
KEY `a` (`a`,`b`,`d`,`e`)
diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result
index 398f7b83bc9..155918ccbb7 100644
--- a/mysql-test/r/type_date.result
+++ b/mysql-test/r/type_date.result
@@ -438,3 +438,326 @@ id select_type table type possible_keys key key_len ref rows Extra
select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
1
drop table t1;
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-7824 [Bug #68041] Zero date can be inserted in strict no-zero mode through a default value
+#
+SET sql_mode=DEFAULT;
+CREATE TABLE t1 (a DATE DEFAULT '0000-00-00');
+SET sql_mode=TRADITIONAL;
+INSERT INTO t1 VALUES ('0000-00-00');
+ERROR 22007: Incorrect date value: '0000-00-00' for column 'a' at row 1
+INSERT INTO t1 VALUES ();
+ERROR 22007: Incorrect default value '0000-00-00' for column 'a'
+INSERT INTO t1 VALUES (DEFAULT);
+ERROR 22007: Incorrect default value '0000-00-00' for column 'a'
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+CREATE TABLE t1 (a DATE NOT NULL DEFAULT '0000-00-00', b DATE NOT NULL DEFAULT '0000-00-00');
+CREATE TABLE t2 (a DATE NOT NULL DEFAULT '0000-00-00');
+INSERT INTO t2 VALUES ('0000-00-00');
+SET sql_mode=TRADITIONAL;
+INSERT INTO t1 (a) SELECT a FROM t2;
+ERROR 22007: Incorrect default value '0000-00-00' for column 'b'
+DROP TABLE t1, t2;
+SET sql_mode=DEFAULT;
+CREATE TABLE t1 (a DATE DEFAULT '0000-00-00', b DATE DEFAULT '0000-00-00');
+INSERT INTO t1 VALUES (DEFAULT,DEFAULT);;
+SELECT a INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/mdev-7824.txt' FROM t1;
+DELETE FROM t1;
+SET sql_mode=TRADITIONAL;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/mdev-7824.txt' INTO TABLE t1 (a);
+ERROR 22007: Incorrect default value '0000-00-00' for column 'b'
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+CREATE TABLE t1 (a DATE DEFAULT '0000-00-00');;
+SET sql_mode='NO_ZERO_DATE';
+ALTER TABLE t1 ADD b INT NOT NULL;
+ERROR 42000: Invalid default value for 'a'
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+#
+# End of MDEV-7824 [Bug #68041] Zero date can be inserted in strict no-zero mode through a default value
+#
+#
+# MDEV-8373 Zero date can be inserted in strict no-zero mode through CREATE TABLE AS SELECT timestamp_field
+#
+SET sql_mode=DEFAULT;
+CREATE TABLE t1 (a DATE);;
+INSERT INTO t1 VALUES (0);
+SET sql_mode='TRADITIONAL';
+CREATE TABLE t2 AS SELECT * FROM t1;
+ERROR 22007: Incorrect date value: '0000-00-00' for column 'a' at row 1
+DROP TABLE t1;
+#
+# End of MDEV-8373 Zero date can be inserted in strict no-zero mode through CREATE TABLE AS SELECT timestamp_field
+#
+#
+# MDEV-8722 The patch for MDEV-8688 disabled equal field propagation for temporal column and BETWEEN and IN
+#
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02');
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a BETWEEN '2001-01-01' AND '2001-01-02';
+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')
+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')
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8699 Wrong result for SELECT..WHERE HEX(date_column)!='323030312D30312D3031' AND date_column='2001-01-01x'
+#
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02');
+SELECT * FROM t1 WHERE a='2001-01-01x';
+a
+2001-01-01
+Warnings:
+Warning 1292 Truncated incorrect date value: '2001-01-01x'
+SELECT * FROM t1 WHERE HEX(a)!='323030312D30312D3031';
+a
+2001-01-02
+SELECT * FROM t1 WHERE HEX(a)!='323030312D30312D3031' AND a='2001-01-01x';
+a
+Warnings:
+Warning 1292 Truncated incorrect date value: '2001-01-01x'
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE HEX(a)!='323030312D30312D3031' AND a='2001-01-01x';
+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:
+Warning 1292 Truncated incorrect date value: '2001-01-01x'
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE HEX(a)!=CONCAT('xx',RAND()) AND a='2001-01-01x';
+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())))
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02');
+SELECT * FROM t1 WHERE LENGTH(a)=11;
+a
+SELECT * FROM t1 WHERE LENGTH(a)=11 AND a=' 2001-01-01';
+a
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=11 AND a=' 2001-01-01';
+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
+EXPLAIN EXTENDED
+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())))
+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())))
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-01');
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+a
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='20010101';
+a
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='20010101';
+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
+EXPLAIN EXTENDED
+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())))
+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'
+#
+SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
+SELECT * FROM t1 WHERE a=TIME'00:00:00';
+a
+2015-08-30
+SELECT * FROM t1 WHERE LENGTH(a)=10;
+a
+2015-08-30
+2015-08-31
+SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'00:00:00';
+a
+2015-08-30
+EXPLAIN EXTENDED
+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')
+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())))
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
+SELECT * FROM t1 WHERE a=TIME'24:00:00';
+a
+2015-08-31
+SELECT * FROM t1 WHERE LENGTH(a)=10;
+a
+2015-08-30
+2015-08-31
+SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'24:00:00';
+a
+2015-08-31
+EXPLAIN EXTENDED
+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')
+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())))
+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'.
+# This may change after MDEV-8322 Distinguish between time and date strings more carefully
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
+SELECT * FROM t1 WHERE a='00:00:00';
+a
+SELECT * FROM t1 WHERE LENGTH(a)=10;
+a
+2015-08-30
+2015-08-31
+SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='00:00:00';
+a
+EXPLAIN EXTENDED
+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')
+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())))
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
+SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00';
+a
+2015-08-30
+SELECT * FROM t1 WHERE LENGTH(a)=10;
+a
+2015-08-30
+2015-08-31
+SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00';
+a
+2015-08-30
+EXPLAIN EXTENDED
+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')
+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())))
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
+SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00.1';
+a
+SELECT * FROM t1 WHERE LENGTH(a)=10;
+a
+2015-08-30
+2015-08-31
+SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00.1';
+a
+EXPLAIN EXTENDED
+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')
+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())))
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
+SELECT * FROM t1 WHERE a='2015-08-30 00:00:00';
+a
+2015-08-30
+SELECT * FROM t1 WHERE LENGTH(a)=10;
+a
+2015-08-30
+2015-08-31
+SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='2015-08-30 00:00:00';
+a
+2015-08-30
+EXPLAIN EXTENDED
+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')
+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())))
+DROP TABLE t1;
+SET timestamp=DEFAULT;
+#
+# MDEV-8795 Equal expression propagation does not work for temporal literals
+#
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02');
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=DATE'2001-01-01' AND COALESCE(a)>=DATE'2001-01-01';
+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')
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index fc1946b3e6f..011855ca2d1 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -836,3 +836,265 @@ DROP TABLE t1,t2;
#
# End of 5.5 tests
#
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-7824 [Bug #68041] Zero date can be inserted in strict no-zero mode through a default value
+#
+SET sql_mode=DEFAULT;
+CREATE TABLE t1 (a DATETIME DEFAULT '0000-00-00 00:00:00');
+SET sql_mode=TRADITIONAL;
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00');
+ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'a' at row 1
+INSERT INTO t1 VALUES ();
+ERROR 22007: Incorrect default value '0000-00-00 00:00:00' for column 'a'
+INSERT INTO t1 VALUES (DEFAULT);
+ERROR 22007: Incorrect default value '0000-00-00 00:00:00' for column 'a'
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+CREATE TABLE t1 (a DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', b DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00');
+CREATE TABLE t2 (a DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00');
+INSERT INTO t2 VALUES ('0000-00-00 00:00:00');
+SET sql_mode=TRADITIONAL;
+INSERT INTO t1 (a) SELECT a FROM t2;
+ERROR 22007: Incorrect default value '0000-00-00 00:00:00' for column 'b'
+DROP TABLE t1, t2;
+SET sql_mode=DEFAULT;
+CREATE TABLE t1 (a DATETIME DEFAULT '0000-00-00 00:00:00', b DATETIME DEFAULT '0000-00-00 00:00:00');
+INSERT INTO t1 VALUES (DEFAULT,DEFAULT);;
+SELECT a INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/mdev-7824.txt' FROM t1;
+DELETE FROM t1;
+SET sql_mode=TRADITIONAL;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/mdev-7824.txt' INTO TABLE t1 (a);
+ERROR 22007: Incorrect default value '0000-00-00 00:00:00' for column 'b'
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+CREATE TABLE t1 (a DATETIME DEFAULT '0000-00-00 00:00:00');;
+SET sql_mode='NO_ZERO_DATE';
+ALTER TABLE t1 ADD b INT NOT NULL;
+ERROR 42000: Invalid default value for 'a'
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+#
+# End of MDEV-7824 [Bug #68041] Zero date can be inserted in strict no-zero mode through a default value
+#
+#
+# MDEV-8373 Zero date can be inserted in strict no-zero mode through CREATE TABLE AS SELECT timestamp_field
+#
+SET sql_mode=DEFAULT;
+CREATE TABLE t1 (a DATETIME);;
+INSERT INTO t1 VALUES (0);
+SET sql_mode='TRADITIONAL';
+CREATE TABLE t2 AS SELECT * FROM t1;
+ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'a' at row 1
+DROP TABLE t1;
+#
+# End of MDEV-8373 Zero date can be inserted in strict no-zero mode through CREATE TABLE AS SELECT timestamp_field
+#
+#
+# MDEV-8336 The meaning of NO_ZERO_DATE is not clear for DATETIME
+#
+SET sql_mode='NO_ZERO_DATE';
+SELECT TIMESTAMP'0000-00-01 10:20:30';
+TIMESTAMP'0000-00-01 10:20:30'
+0000-00-01 10:20:30
+SELECT TIMESTAMP'0000-00-00 10:20:30';
+TIMESTAMP'0000-00-00 10:20:30'
+0000-00-00 10:20:30
+SELECT TIMESTAMP'0000-00-00 00:00:00.000001';
+TIMESTAMP'0000-00-00 00:00:00.000001'
+0000-00-00 00:00:00.000001
+CREATE TABLE t1 (a DATETIME);
+INSERT INTO t1 VALUES ('0000-00-00 10:20:30');
+SELECT a, LEAST(a,'2001-01-01 10:20:30') FROM t1;
+a LEAST(a,'2001-01-01 10:20:30')
+0000-00-00 10:20:30 0000-00-00 10:20:30.000000
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME(6));
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.000001');
+SELECT a, LEAST(a,'2001-01-01 10:20:30') FROM t1;
+a LEAST(a,'2001-01-01 10:20:30')
+0000-00-00 00:00:00.000001 0000-00-00 00:00:00.000001
+DROP TABLE t1;
+SELECT STR_TO_DATE('0000-00-00 10:20:30','%Y-%m-%d %h:%i:%s');
+STR_TO_DATE('0000-00-00 10:20:30','%Y-%m-%d %h:%i:%s')
+0000-00-00 10:20:30
+SELECT STR_TO_DATE('0000-00-00 00:00:00.000001','%Y-%m-%d %H:%i:%s.%f');
+STR_TO_DATE('0000-00-00 00:00:00.000001','%Y-%m-%d %H:%i:%s.%f')
+0000-00-00 00:00:00.000001
+SET old_mode=zero_date_time_cast;
+SELECT CAST(TIME'10:20:30' AS DATETIME);
+CAST(TIME'10:20:30' AS DATETIME)
+0000-00-00 10:20:30
+SELECT CAST(TIME'00:00:00.000001' AS DATETIME(6));
+CAST(TIME'00:00:00.000001' AS DATETIME(6))
+0000-00-00 00:00:00.000001
+SELECT CAST(CAST('10:20:30' AS TIME) AS DATETIME);
+CAST(CAST('10:20:30' AS TIME) AS DATETIME)
+0000-00-00 10:20:30
+SELECT CAST(CAST('00:00:00.000001' AS TIME(6)) AS DATETIME(6));
+CAST(CAST('00:00:00.000001' AS TIME(6)) AS DATETIME(6))
+0000-00-00 00:00:00.000001
+SELECT CAST(CAST(TIMESTAMP'0000-00-00 10:20:30' AS TIME) AS DATETIME);
+CAST(CAST(TIMESTAMP'0000-00-00 10:20:30' AS TIME) AS DATETIME)
+0000-00-00 10:20:30
+SELECT CAST(CAST(TIMESTAMP'0000-00-00 00:00:00.000001' AS TIME(6)) AS DATETIME(6));
+CAST(CAST(TIMESTAMP'0000-00-00 00:00:00.000001' AS TIME(6)) AS DATETIME(6))
+0000-00-00 00:00:00.000001
+SET old_mode=DEFAULT;
+SET sql_mode=DEFAULT;
+#
+# MDEV-8699 Wrong result for SELECT..WHERE HEX(date_column)!='323030312D30312D3031' AND date_column='2001-01-01x'
+#
+CREATE TABLE t1 (a DATETIME);;
+INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01');
+SELECT * FROM t1 WHERE a='2001-01-01 00:00:00x';
+a
+2001-01-01 00:00:00
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x'
+SELECT * FROM t1 WHERE LENGTH(a) != 20;
+a
+2001-01-01 00:00:00
+2001-01-01 00:00:01
+SELECT * FROM t1 WHERE LENGTH(a) != 20 AND a='2001-01-01 00:00:00x';
+a
+2001-01-01 00:00:00
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x'
+Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x'
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a) != 20 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` = '2001-01-01 00:00:00x')
+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` = '2001-01-01 00:00:00x') 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');
+SELECT * FROM t1 WHERE LENGTH(a)=19;
+a
+2001-01-01 00:00:00
+2001-01-01 00:00:01
+SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=' 2001-01-01 00:00:00';
+a
+2001-01-01 00:00:00
+EXPLAIN EXTENDED
+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` = ' 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` = ' 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` = ' garbage ') and (length(`test`.`t1`.`a`) = (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');
+SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 00:00:00.000000';
+a
+2001-01-01 00:00:00
+SELECT * FROM t1 WHERE LENGTH(a)=19;
+a
+2001-01-01 00:00:00
+2001-01-01 00:00:01
+SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIMESTAMP'2001-01-01 00:00:00.000000';
+a
+2001-01-01 00:00:00
+EXPLAIN EXTENDED
+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')
+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())))
+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');
+SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 00:00:00.000000';
+a
+2001-01-01 00:00:00.000000
+SELECT * FROM t1 WHERE LENGTH(a)=26;
+a
+2001-01-01 00:00:00.000000
+2001-01-01 00:00:01.000000
+SELECT * FROM t1 WHERE LENGTH(a)=26 AND a=TIMESTAMP'2001-01-01 00:00:00.000000';
+a
+2001-01-01 00:00:00.000000
+EXPLAIN EXTENDED
+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')
+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())))
+DROP TABLE t1;
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30');
+CREATE TABLE t1 (a DATETIME);;
+INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01');
+SELECT * FROM t1 WHERE a=TIME'00:00:00';
+a
+2001-01-01 00:00:00
+SELECT * FROM t1 WHERE LENGTH(a)=19;
+a
+2001-01-01 00:00:00
+2001-01-01 00:00:01
+SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIME'00:00:00';
+a
+2001-01-01 00:00:00
+EXPLAIN EXTENDED
+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` = TIME'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` = TIME'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
+#
+CREATE TABLE t1 (a DATETIME);
+INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-02 00:00:00');
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=TIMESTAMP'2001-01-01 00:00:00' AND COALESCE(a)>=TIMESTAMP'2001-01-01 00:00:00';
+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')
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result
index f8649f030bb..85ea43752a5 100644
--- a/mysql-test/r/type_decimal.result
+++ b/mysql-test/r/type_decimal.result
@@ -181,7 +181,7 @@ 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");
Warnings:
-Note 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 3
select * from t1;
a
@@ -246,7 +246,7 @@ 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");
Warnings:
-Note 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 3
select * from t1;
a
@@ -305,7 +305,7 @@ 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");
Warnings:
-Note 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 3
select * from t1;
a
@@ -358,6 +358,9 @@ insert into t1 values (123.4e0),(123.4e+2),(123.4e-2),(123e1),(123e+0);
Warnings:
Note 1265 Data truncated for column 'a' at row 3
insert into t1 values (MID("987",1,2)),("987 "),("987.6e+2 ");
+Warnings:
+Note 1265 Data truncated for column 'a' at row 2
+Note 1265 Data truncated for column 'a' at row 3
select * from t1;
a
0.00
@@ -994,3 +997,24 @@ GROUP BY t2.col0
WHERE CONCAT(t1.col1, CAST(subq.col0 AS DECIMAL));
1
DROP TABLE t1, t2;
+#
+# Start of 5.5 tests
+#
+#
+# MDEV-8267 Add /*old*/ comment into I_S.COLUMN_TYPE for old DECIMAL
+#
+SHOW CREATE TABLE t1dec102;
+Table Create Table
+t1dec102 CREATE TABLE `t1dec102` (
+ `a` decimal(10,2)/*old*/ DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW COLUMNS FROM t1dec102;
+Field Type Null Key Default Extra
+a decimal(10,2)/*old*/ YES NULL
+SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1dec102';
+COLUMN_NAME DATA_TYPE COLUMN_TYPE
+a decimal decimal(10,2)/*old*/
+DROP TABLE t1dec102;
+#
+# End of 5.5 tests
+#
diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result
index dd9277517d8..d901434fd6e 100644
--- a/mysql-test/r/type_enum.result
+++ b/mysql-test/r/type_enum.result
@@ -2082,3 +2082,55 @@ DROP TABLE t1;
#
# End of 10.0 tests
#
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8729 Wrong result for SELECT..WHERE HEX(enum_column)='61' AND enum_column='a '
+#
+CREATE TABLE t1 (a ENUM('a','A') CHARACTER SET latin1 COLLATE latin1_bin);
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT * FROM t1 WHERE a='a ';
+a
+a
+SELECT * FROM t1 WHERE HEX(a)='61';
+a
+a
+SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
+a
+a
+# Can't propagate the equality into HEX(a), because binary collations still ignore trailing spaces
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
+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'))
+DROP TABLE t1;
+CREATE TABLE t1 (a ENUM('a','a ') CHARACTER SET BINARY);
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT * FROM t1 WHERE a='a ';
+a
+a
+SELECT * FROM t1 WHERE HEX(a)='61';
+a
+a
+SELECT * FROM t1 WHERE HEX(a)='61' AND a='a';
+a
+a
+SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
+a
+# Ok to propagate the equality into HEX(a), because "CHARACTER SET BINARY" does not ignore trailing spaces
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a';
+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')
+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
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result
index 57e2660750b..e7267f012ae 100644
--- a/mysql-test/r/type_float.result
+++ b/mysql-test/r/type_float.result
@@ -245,22 +245,22 @@ show warnings;
Level Code Message
desc t1;
Field Type Null Key Default Extra
-x decimal(21,2) NO 0.00
+x decimal(21,2) NO NULL
drop table t1;
create table t1 select 0.0 x;
desc t1;
Field Type Null Key Default Extra
-x decimal(2,1) NO 0.0
+x decimal(2,1) NO NULL
create table t2 select 105213674794682365.00 y;
desc t2;
Field Type Null Key Default Extra
-y decimal(20,2) NO 0.00
+y decimal(20,2) NO NULL
create table t3 select x+y a from t1,t2;
show warnings;
Level Code Message
desc t3;
Field Type Null Key Default Extra
-a decimal(21,2) NO 0.00
+a decimal(21,2) NO NULL
drop table t1,t2,t3;
select 1e-308, 1.00000001e-300, 100000000e-300;
1e-308 1.00000001e-300 100000000e-300
@@ -458,7 +458,7 @@ Warnings:
Warning 1265 Data truncated for column 'f' at row 1
INSERT INTO t1 VALUES ('.');
Warnings:
-Warning 1265 Data truncated for column 'f' at row 1
+Warning 1366 Incorrect double value: '.' for column 'f' at row 1
SELECT * FROM t1 ORDER BY f;
f
0
@@ -532,3 +532,109 @@ DROP TABLE t1,t2;
#
# End of 10.0 tests
#
+#
+# MDEV-8704 Wrong result for SELECT..WHERE LENGTH(double_column)!=6 AND double_column=100e0
+#
+CREATE TABLE t1 (a DOUBLE(9,2));
+INSERT INTO t1 VALUES (100),(110);
+SELECT * FROM t1 WHERE LENGTH(a)!=6;
+a
+SELECT * FROM t1 WHERE LENGTH(a)!=6 AND a=100e0;
+a
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES (100),(110);
+SELECT * FROM t1 WHERE LENGTH(a)!=6;
+a
+100
+110
+SELECT * FROM t1 WHERE LENGTH(a)!=6 AND a=100e0;
+a
+100
+EXPLAIN EXTENDED
+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)
+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()))
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE(10,1));
+INSERT INTO t1 VALUES (1.1),(1.2),(1.3);
+SELECT * FROM t1 WHERE LENGTH(a)!=3;
+a
+SELECT * FROM t1 WHERE LENGTH(a)!=3 AND a=1.10e0;
+a
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=3 AND a=1.10e0;
+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
+# Notice 1.1 instead of 1.10 in the final WHERE condition
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=1.10e0;
+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()))
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE(10,2));
+INSERT INTO t1 VALUES (1.1),(1.2),(1.3);
+SELECT * FROM t1 WHERE LENGTH(a)!=4;
+a
+SELECT * FROM t1 WHERE LENGTH(a)!=4 AND a=1.10e0;
+a
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=4 AND a=1.10e0;
+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
+# Notice 1.10 in the final WHERE condition
+EXPLAIN EXTENDED
+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()))
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE(10,3));
+INSERT INTO t1 VALUES (1.1),(1.2),(1.3);
+SELECT * FROM t1 WHERE LENGTH(a)!=5;
+a
+SELECT * FROM t1 WHERE LENGTH(a)!=5 AND a=1.10e0;
+a
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=5 AND a=1.10e0;
+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
+# Notice 1.100 rather than 1.10 in the final WHERE condition
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=1.10e0;
+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()))
+DROP TABLE t1;
+#
+# MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010
+#
+CREATE TABLE t1 (a DOUBLE ZEROFILL);
+INSERT INTO t1 VALUES (2010),(2020);
+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)
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/type_int.result b/mysql-test/r/type_int.result
new file mode 100644
index 00000000000..4e7b928ac07
--- /dev/null
+++ b/mysql-test/r/type_int.result
@@ -0,0 +1,38 @@
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010
+#
+CREATE TABLE t1 (a INT ZEROFILL);
+INSERT INTO t1 VALUES (2010),(2020);
+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)
+DROP TABLE t1;
+#
+# MDEV-8369 Unexpected impossible WHERE for a condition on a ZEROFILL field
+#
+CREATE TABLE t1 (a INT ZEROFILL);
+INSERT INTO t1 VALUES (128),(129);
+SELECT * FROM t1 WHERE a=128;
+a
+0000000128
+SELECT * FROM t1 WHERE hex(a)='80';
+a
+0000000128
+SELECT * FROM t1 WHERE a=128 AND hex(a)='80';
+a
+0000000128
+EXPLAIN EXTENDED
+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'))
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result
index ab075d29e22..b498910f13c 100644
--- a/mysql-test/r/type_newdecimal.result
+++ b/mysql-test/r/type_newdecimal.result
@@ -52,13 +52,13 @@ if(1, 1.1, 1.2) if(0, 1.1, 1.2) if(0.1, 1.1, 1.2) if(0, 1, 1.1) if(0, NULL, 1.2)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `if(1, 1.1, 1.2)` decimal(2,1) NOT NULL DEFAULT '0.0',
- `if(0, 1.1, 1.2)` decimal(2,1) NOT NULL DEFAULT '0.0',
- `if(0.1, 1.1, 1.2)` decimal(2,1) NOT NULL DEFAULT '0.0',
- `if(0, 1, 1.1)` decimal(2,1) NOT NULL DEFAULT '0.0',
+ `if(1, 1.1, 1.2)` decimal(2,1) NOT NULL,
+ `if(0, 1.1, 1.2)` decimal(2,1) NOT NULL,
+ `if(0.1, 1.1, 1.2)` decimal(2,1) NOT NULL,
+ `if(0, 1, 1.1)` decimal(2,1) NOT NULL,
`if(0, NULL, 1.2)` decimal(2,1) DEFAULT NULL,
- `if(1, 0.22e1, 1.1)` double NOT NULL DEFAULT '0',
- `if(1E0, 1.1, 1.2)` decimal(2,1) NOT NULL DEFAULT '0.0'
+ `if(1, 0.22e1, 1.1)` double NOT NULL,
+ `if(1E0, 1.1, 1.2)` decimal(2,1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 select nullif(1.1, 1.1), nullif(1.1, 1.2), nullif(1.1, 0.11e1), nullif(1.0, 1), nullif(1, 1.0), nullif(1, 1.1);
@@ -174,10 +174,10 @@ create table t1 select round(15.4,-1), truncate(-5678.123451,-3), abs(-1.1), -(-
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `round(15.4,-1)` decimal(3,0) NOT NULL DEFAULT '0',
- `truncate(-5678.123451,-3)` decimal(4,0) NOT NULL DEFAULT '0',
- `abs(-1.1)` decimal(3,1) NOT NULL DEFAULT '0.0',
- `-(-1.1)` decimal(2,1) NOT NULL DEFAULT '0.0'
+ `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,
+ `-(-1.1)` decimal(2,1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set session sql_mode='traditional';
@@ -771,7 +771,7 @@ create table t1 as select 0.5;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `0.5` decimal(2,1) NOT NULL DEFAULT '0.0'
+ `0.5` decimal(2,1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select round(1.5),round(2.5);
@@ -1509,7 +1509,7 @@ Warnings:
Note 1265 Data truncated for column 'f1' at row 1
DESC t1;
Field Type Null Key Default Extra
-f1 decimal(31,30) NO 0.000000000000000000000000000000
+f1 decimal(31,30) NO NULL
SELECT f1 FROM t1;
f1
0.123456789012345678901234567890
@@ -1519,7 +1519,7 @@ 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 0.000000000000000000000000000000
+f1 decimal(65,30) NO NULL
SELECT f1 FROM t1;
f1
99999999999999999999999999999999999.999999999999999999999999999999
@@ -1623,7 +1623,7 @@ 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 0.000000000000000000000000000000
+my_col decimal(30,30) NO NULL
SELECT my_col FROM t1;
my_col
0.123456789123456789123456789123
@@ -1633,7 +1633,7 @@ 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 0.000000000000000000000000000000
+my_col decimal(65,30) NO NULL
SELECT my_col FROM t1;
my_col
1.123456789123456789123456789123
@@ -1643,7 +1643,7 @@ 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 0.000000000000000000000000000000
+my_col decimal(65,30) NO NULL
SELECT my_col FROM t1;
my_col
0.123456789123456789123456789123
@@ -1679,7 +1679,7 @@ Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(65,0) NO 0
+c1 decimal(65,0) NO NULL
SELECT * FROM t1;
c1
99999999999999999999999999999999999999999999999999999999999999999
@@ -1691,7 +1691,7 @@ Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(65,0) NO 0
+c1 decimal(65,0) NO NULL
SELECT * FROM t1;
c1
99999999999999999999999999999999999999999999999999999999999999999
@@ -1703,7 +1703,7 @@ Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(65,0) NO 0
+c1 decimal(65,0) NO NULL
SELECT * FROM t1;
c1
99999999999999999999999999999999999999999999999999999999999999999
@@ -1715,7 +1715,7 @@ Warnings:
Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated.
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(65,0) NO 0
+c1 decimal(65,0) NO NULL
SELECT * FROM t1;
c1
99999999999999999999999999999999999999999999999999999999999999999
@@ -1727,7 +1727,7 @@ 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 0.000000000000000000000000000000
+c1 decimal(65,30) NO NULL
SELECT * FROM t1;
c1
99999999999999999999999999999999999.999999999999999999999999999999
@@ -1737,7 +1737,7 @@ CREATE TABLE t1 SELECT
AS c1;
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(31,30) NO 0.000000000000000000000000000000
+c1 decimal(31,30) NO NULL
SELECT * FROM t1;
c1
1.100000000000000000000000000000
@@ -1747,7 +1747,7 @@ CREATE TABLE t1 SELECT
AS c1;
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(31,30) NO 0.000000000000000000000000000000
+c1 decimal(31,30) NO NULL
SELECT * FROM t1;
c1
1.100000000000000000000000000000
@@ -1759,7 +1759,7 @@ Warnings:
Note 1265 Data truncated for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(30,30) NO 0.000000000000000000000000000000
+c1 decimal(30,30) NO NULL
SELECT * FROM t1;
c1
0.100000000000000000000000000000
@@ -1771,7 +1771,7 @@ 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 0.000000000000000000000000000000
+c1 decimal(65,30) NO NULL
SELECT * FROM t1;
c1
99999999999999999999999999999999999.999999999999999999999999999999
@@ -1783,7 +1783,7 @@ Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(65,1) NO 0.0
+c1 decimal(65,1) NO NULL
SELECT * FROM t1;
c1
9999999999999999999999999999999999999999999999999999999999999999.9
@@ -1795,7 +1795,7 @@ Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(65,1) NO 0.0
+c1 decimal(65,1) NO NULL
SELECT * FROM t1;
c1
9999999999999999999999999999999999999999999999999999999999999999.9
@@ -1807,7 +1807,7 @@ Warnings:
Note 1265 Data truncated for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(30,30) NO 0.000000000000000000000000000000
+c1 decimal(30,30) NO NULL
SELECT * FROM t1;
c1
0.123456789012345678901234567890
@@ -1817,7 +1817,7 @@ Warnings:
Note 1265 Data truncated for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(33,30) NO 0.000000000000000000000000000000
+c1 decimal(33,30) NO NULL
SELECT * FROM t1;
c1
123.123456789012345678901234567890
@@ -1825,7 +1825,7 @@ DROP TABLE t1;
CREATE TABLE t1 SELECT 1.1 + CAST(1 AS DECIMAL(65,30)) AS c1;
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(65,30) NO 0.000000000000000000000000000000
+c1 decimal(65,30) NO NULL
SELECT * FROM t1;
c1
2.100000000000000000000000000000
@@ -2078,3 +2078,83 @@ DROP TABLE t1,t2;
#
# End of 10.0 tests
#
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8703 Wrong result for SELECT..WHERE LENGTH(decimal_10_1_column)!=3 AND decimal_10_1_column=1.10
+#
+CREATE TABLE t1 (a DECIMAL(10,1));
+INSERT INTO t1 VALUES (1.1),(1.2),(1.3);
+SELECT * FROM t1 WHERE LENGTH(a)!=3;
+a
+SELECT * FROM t1 WHERE LENGTH(a)!=3 AND a=1.10;
+a
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=3 AND a=1.10;
+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
+# Notice 1.1 instead of 1.10 in the final WHERE condition
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=rand() AND a=1.10;
+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()))
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(10,2));
+INSERT INTO t1 VALUES (1.1),(1.2),(1.3);
+SELECT * FROM t1 WHERE LENGTH(a)!=4;
+a
+SELECT * FROM t1 WHERE LENGTH(a)!=4 AND a=1.10;
+a
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=4 AND a=1.10;
+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
+# Notice 1.10 in the final WHERE condition
+EXPLAIN EXTENDED
+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()))
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(10,3));
+INSERT INTO t1 VALUES (1.1),(1.2),(1.3);
+SELECT * FROM t1 WHERE LENGTH(a)!=5;
+a
+SELECT * FROM t1 WHERE LENGTH(a)!=5 AND a=1.10;
+a
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=5 AND a=1.10;
+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
+# Notice 1.100 rather than 1.10 in the final WHERE condition
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=rand() AND a=1.10;
+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()))
+DROP TABLE t1;
+#
+# MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010
+#
+CREATE TABLE t1 (a DECIMAL(10,1) ZEROFILL);
+INSERT INTO t1 VALUES (2010),(2020);
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010.0 AND a>=2010.0;
+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)
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/type_num.result b/mysql-test/r/type_num.result
new file mode 100644
index 00000000000..cbac7b6f445
--- /dev/null
+++ b/mysql-test/r/type_num.result
@@ -0,0 +1,1222 @@
+#
+# Start of 10.0 tests
+#
+#
+# MDEV-8468 CAST and INSERT work differently for DECIMAL/INT vs DOUBLE for a string with trailing spaces
+#
+SET sql_mode='STRICT_ALL_TABLES';
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('1 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('1 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('1 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('1 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('1 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('1 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('1 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('');
+ERROR 22007: Incorrect double value: '' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('');
+ERROR 22007: Incorrect double value: '' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('');
+ERROR 22007: Incorrect integer value: '' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('');
+ERROR 22007: Incorrect integer value: '' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('');
+ERROR 22007: Incorrect integer value: '' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('');
+ERROR 22007: Incorrect integer value: '' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('');
+ERROR 22007: Incorrect decimal value: '' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('x');
+ERROR 22007: Incorrect double value: 'x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('x');
+ERROR 22007: Incorrect double value: 'x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('x');
+ERROR 22007: Incorrect integer value: 'x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('x');
+ERROR 22007: Incorrect integer value: 'x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('x');
+ERROR 22007: Incorrect integer value: 'x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('x');
+ERROR 22007: Incorrect integer value: 'x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('x');
+ERROR 22007: Incorrect decimal value: 'x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES (' x');
+ERROR 22007: Incorrect double value: ' x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES (' x');
+ERROR 22007: Incorrect double value: ' x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES (' x');
+ERROR 22007: Incorrect integer value: ' x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES (' x');
+ERROR 22007: Incorrect integer value: ' x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (' x');
+ERROR 22007: Incorrect integer value: ' x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES (' x');
+ERROR 22007: Incorrect integer value: ' x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES (' x');
+ERROR 22007: Incorrect decimal value: ' x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('.');
+ERROR 22007: Incorrect double value: '.' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('.');
+ERROR 22007: Incorrect double value: '.' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('.');
+ERROR 22007: Incorrect integer value: '.' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('.');
+ERROR 22007: Incorrect integer value: '.' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('.');
+ERROR 22007: Incorrect integer value: '.' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('.');
+ERROR 22007: Incorrect integer value: '.' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('.');
+ERROR 22007: Incorrect decimal value: '.' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('-');
+ERROR 22007: Incorrect double value: '-' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('-');
+ERROR 22007: Incorrect double value: '-' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('-');
+ERROR 22007: Incorrect integer value: '-' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('-');
+ERROR 22007: Incorrect integer value: '-' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('-');
+ERROR 22007: Incorrect integer value: '-' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('-');
+ERROR 22007: Incorrect integer value: '-' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('-');
+ERROR 22007: Incorrect decimal value: '-' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('+');
+ERROR 22007: Incorrect double value: '+' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('+');
+ERROR 22007: Incorrect double value: '+' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('+');
+ERROR 22007: Incorrect integer value: '+' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('+');
+ERROR 22007: Incorrect integer value: '+' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('+');
+ERROR 22007: Incorrect integer value: '+' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('+');
+ERROR 22007: Incorrect integer value: '+' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('+');
+ERROR 22007: Incorrect decimal value: '+' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('1x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('1x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('1x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('1x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('1x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('1x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('1x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('1e');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('1e');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('1e');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('1e');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('1e');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('1e');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('1e');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('1e+');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('1e+');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('1e+');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('1e+');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('1e+');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('1e+');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('1e+');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('1E-');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('1E-');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('1E-');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('1E-');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('1E-');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('1E-');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('1E-');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('1Ex');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('1Ex');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('1Ex');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('1Ex');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('1Ex');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('1Ex');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('1Ex');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('1e+x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('1e+x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('1e+x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('1e+x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('1e+x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('1e+x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('1e+x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('1e1000');
+ERROR 22003: Out of range value for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('1e1000');
+ERROR 22003: Out of range value for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('1e1000');
+ERROR 22003: Out of range value for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('1e1000');
+ERROR 22003: Out of range value for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('1e1000');
+ERROR 22003: Out of range value for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('1e1000');
+ERROR 22003: Out of range value for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('1e1000');
+ERROR 22003: Out of range value for column 'a' at row 1
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+CREATE TABLE t1 (
+f4 FLOAT,
+f8 DOUBLE,
+i1 TINYINT,
+i2 SMALLINT,
+i4 INT,
+i8 BIGINT,
+d DECIMAL
+);
+INSERT INTO t1 VALUES ('1 ','1 ','1 ','1 ','1 ','1 ','1 ');
+Warnings:
+Note 1265 Data truncated for column 'f4' at row 1
+Note 1265 Data truncated for column 'f8' at row 1
+Note 1265 Data truncated for column 'i1' at row 1
+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 ('','','','','','','');
+Warnings:
+Warning 1366 Incorrect double value: '' for column 'f4' at row 1
+Warning 1366 Incorrect double value: '' for column 'f8' at row 1
+Warning 1366 Incorrect integer value: '' for column 'i1' at row 1
+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');
+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
+Warning 1366 Incorrect integer value: 'x' for column 'i1' at row 1
+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');
+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
+Warning 1366 Incorrect integer value: ' x' for column 'i1' at row 1
+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 ('.','.','.','.','.','.','.');
+Warnings:
+Warning 1366 Incorrect double value: '.' for column 'f4' at row 1
+Warning 1366 Incorrect double value: '.' for column 'f8' at row 1
+Warning 1366 Incorrect integer value: '.' for column 'i1' at row 1
+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 ('-','-','-','-','-','-','-');
+Warnings:
+Warning 1366 Incorrect double value: '-' for column 'f4' at row 1
+Warning 1366 Incorrect double value: '-' for column 'f8' at row 1
+Warning 1366 Incorrect integer value: '-' for column 'i1' at row 1
+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 ('+','+','+','+','+','+','+');
+Warnings:
+Warning 1366 Incorrect double value: '+' for column 'f4' at row 1
+Warning 1366 Incorrect double value: '+' for column 'f8' at row 1
+Warning 1366 Incorrect integer value: '+' for column 'i1' at row 1
+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');
+Warnings:
+Warning 1265 Data truncated for column 'f4' at row 1
+Warning 1265 Data truncated for column 'f8' at row 1
+Warning 1265 Data truncated for column 'i1' at row 1
+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');
+Warnings:
+Warning 1265 Data truncated for column 'f4' at row 1
+Warning 1265 Data truncated for column 'f8' at row 1
+Warning 1265 Data truncated for column 'i1' at row 1
+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-');
+Warnings:
+Warning 1265 Data truncated for column 'f4' at row 1
+Warning 1265 Data truncated for column 'f8' at row 1
+Warning 1265 Data truncated for column 'i1' at row 1
+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+');
+Warnings:
+Warning 1265 Data truncated for column 'f4' at row 1
+Warning 1265 Data truncated for column 'f8' at row 1
+Warning 1265 Data truncated for column 'i1' at row 1
+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');
+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
+Warning 1264 Out of range value for column 'f8' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i2' at row 1
+Warning 1264 Out of range value for column 'i4' at row 1
+Warning 1264 Out of range value for column 'i8' at row 1
+Warning 1264 Out of range value for column 'd' at row 1
+DELETE FROM t1;
+INSERT INTO t1 VALUES (0,0,0,0,0,0,0);
+INSERT INTO t1 VALUES (0,0,0,0,0,0,0);
+INSERT INTO t1 VALUES (1,1,1,1,1,1,1);
+INSERT INTO t1 VALUES (1,1,1,1,1,1,1);
+INSERT INTO t1 VALUES (2,2,2,2,2,2,2);
+INSERT INTO t1 VALUES (2,2,2,2,2,2,2);
+INSERT INTO t1 VALUES (3,3,3,3,3,3,3);
+INSERT INTO t1 VALUES (3,3,3,3,3,3,3);
+INSERT INTO t1 VALUES (4,4,4,4,4,4,4);
+INSERT INTO t1 VALUES (4,4,4,4,4,4,4);
+INSERT INTO t1 VALUES (5,5,5,5,5,5,5);
+INSERT INTO t1 VALUES (5,5,5,5,5,5,5);
+SELECT COUNT(*) FROM t1 WHERE f4='1 ';
+COUNT(*)
+2
+Warnings:
+Note 1292 Truncated incorrect DOUBLE value: '1 '
+SELECT COUNT(*) FROM t1 WHERE f8='1 ';
+COUNT(*)
+2
+Warnings:
+Note 1292 Truncated incorrect DOUBLE value: '1 '
+SELECT COUNT(*) FROM t1 WHERE i1='1 ';
+COUNT(*)
+2
+Warnings:
+Note 1292 Truncated incorrect DOUBLE value: '1 '
+SELECT COUNT(*) FROM t1 WHERE i2='1 ';
+COUNT(*)
+2
+Warnings:
+Note 1292 Truncated incorrect DOUBLE value: '1 '
+SELECT COUNT(*) FROM t1 WHERE i4='1 ';
+COUNT(*)
+2
+Warnings:
+Note 1292 Truncated incorrect DOUBLE value: '1 '
+SELECT COUNT(*) FROM t1 WHERE i8='1 ';
+COUNT(*)
+2
+Warnings:
+Note 1292 Truncated incorrect DOUBLE value: '1 '
+SELECT COUNT(*) FROM t1 WHERE d='1 ';
+COUNT(*)
+2
+Warnings:
+Note 1292 Truncated incorrect DOUBLE value: '1 '
+SELECT COUNT(*) FROM t1 WHERE f4='';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
+SELECT COUNT(*) FROM t1 WHERE f8='';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
+SELECT COUNT(*) FROM t1 WHERE i1='';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
+SELECT COUNT(*) FROM t1 WHERE i2='';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
+SELECT COUNT(*) FROM t1 WHERE i4='';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
+SELECT COUNT(*) FROM t1 WHERE i8='';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
+SELECT COUNT(*) FROM t1 WHERE d='';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
+SELECT COUNT(*) FROM t1 WHERE f4='x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+SELECT COUNT(*) FROM t1 WHERE f8='x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+SELECT COUNT(*) FROM t1 WHERE i1='x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+SELECT COUNT(*) FROM t1 WHERE i2='x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+SELECT COUNT(*) FROM t1 WHERE i4='x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+SELECT COUNT(*) FROM t1 WHERE i8='x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+SELECT COUNT(*) FROM t1 WHERE d='x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+SELECT COUNT(*) FROM t1 WHERE f4=' x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' x'
+SELECT COUNT(*) FROM t1 WHERE f8=' x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' x'
+SELECT COUNT(*) FROM t1 WHERE i1=' x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' x'
+SELECT COUNT(*) FROM t1 WHERE i2=' x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' x'
+SELECT COUNT(*) FROM t1 WHERE i4=' x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' x'
+SELECT COUNT(*) FROM t1 WHERE i8=' x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' x'
+SELECT COUNT(*) FROM t1 WHERE d=' x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' x'
+SELECT COUNT(*) FROM t1 WHERE f4='.';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '.'
+SELECT COUNT(*) FROM t1 WHERE f8='.';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '.'
+SELECT COUNT(*) FROM t1 WHERE i1='.';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '.'
+SELECT COUNT(*) FROM t1 WHERE i2='.';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '.'
+SELECT COUNT(*) FROM t1 WHERE i4='.';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '.'
+SELECT COUNT(*) FROM t1 WHERE i8='.';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '.'
+SELECT COUNT(*) FROM t1 WHERE d='.';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '.'
+SELECT COUNT(*) FROM t1 WHERE f4='-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '-'
+SELECT COUNT(*) FROM t1 WHERE f8='-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '-'
+SELECT COUNT(*) FROM t1 WHERE i1='-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '-'
+SELECT COUNT(*) FROM t1 WHERE i2='-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '-'
+SELECT COUNT(*) FROM t1 WHERE i4='-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '-'
+SELECT COUNT(*) FROM t1 WHERE i8='-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '-'
+SELECT COUNT(*) FROM t1 WHERE d='-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '-'
+SELECT COUNT(*) FROM t1 WHERE f4='+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '+'
+SELECT COUNT(*) FROM t1 WHERE f8='+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '+'
+SELECT COUNT(*) FROM t1 WHERE i1='+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '+'
+SELECT COUNT(*) FROM t1 WHERE i2='+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '+'
+SELECT COUNT(*) FROM t1 WHERE i4='+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '+'
+SELECT COUNT(*) FROM t1 WHERE i8='+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '+'
+SELECT COUNT(*) FROM t1 WHERE d='+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '+'
+SELECT COUNT(*) FROM t1 WHERE f4='1x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1x'
+SELECT COUNT(*) FROM t1 WHERE f8='1x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1x'
+SELECT COUNT(*) FROM t1 WHERE i1='1x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1x'
+SELECT COUNT(*) FROM t1 WHERE i2='1x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1x'
+SELECT COUNT(*) FROM t1 WHERE i4='1x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1x'
+SELECT COUNT(*) FROM t1 WHERE i8='1x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1x'
+SELECT COUNT(*) FROM t1 WHERE d='1x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1x'
+SELECT COUNT(*) FROM t1 WHERE f4='1e';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e'
+SELECT COUNT(*) FROM t1 WHERE f8='1e';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e'
+SELECT COUNT(*) FROM t1 WHERE i1='1e';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e'
+SELECT COUNT(*) FROM t1 WHERE i2='1e';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e'
+SELECT COUNT(*) FROM t1 WHERE i4='1e';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e'
+SELECT COUNT(*) FROM t1 WHERE i8='1e';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e'
+SELECT COUNT(*) FROM t1 WHERE d='1e';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e'
+SELECT COUNT(*) FROM t1 WHERE f4='1e+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+'
+SELECT COUNT(*) FROM t1 WHERE f8='1e+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+'
+SELECT COUNT(*) FROM t1 WHERE i1='1e+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+'
+SELECT COUNT(*) FROM t1 WHERE i2='1e+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+'
+SELECT COUNT(*) FROM t1 WHERE i4='1e+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+'
+SELECT COUNT(*) FROM t1 WHERE i8='1e+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+'
+SELECT COUNT(*) FROM t1 WHERE d='1e+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+'
+SELECT COUNT(*) FROM t1 WHERE f4='1E-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1E-'
+SELECT COUNT(*) FROM t1 WHERE f8='1E-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1E-'
+SELECT COUNT(*) FROM t1 WHERE i1='1E-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1E-'
+SELECT COUNT(*) FROM t1 WHERE i2='1E-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1E-'
+SELECT COUNT(*) FROM t1 WHERE i4='1E-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1E-'
+SELECT COUNT(*) FROM t1 WHERE i8='1E-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1E-'
+SELECT COUNT(*) FROM t1 WHERE d='1E-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1E-'
+SELECT COUNT(*) FROM t1 WHERE f4='1Ex';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1Ex'
+SELECT COUNT(*) FROM t1 WHERE f8='1Ex';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1Ex'
+SELECT COUNT(*) FROM t1 WHERE i1='1Ex';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1Ex'
+SELECT COUNT(*) FROM t1 WHERE i2='1Ex';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1Ex'
+SELECT COUNT(*) FROM t1 WHERE i4='1Ex';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1Ex'
+SELECT COUNT(*) FROM t1 WHERE i8='1Ex';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1Ex'
+SELECT COUNT(*) FROM t1 WHERE d='1Ex';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1Ex'
+SELECT COUNT(*) FROM t1 WHERE f4='1e+x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+x'
+SELECT COUNT(*) FROM t1 WHERE f8='1e+x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+x'
+SELECT COUNT(*) FROM t1 WHERE i1='1e+x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+x'
+SELECT COUNT(*) FROM t1 WHERE i2='1e+x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+x'
+SELECT COUNT(*) FROM t1 WHERE i4='1e+x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+x'
+SELECT COUNT(*) FROM t1 WHERE i8='1e+x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+x'
+SELECT COUNT(*) FROM t1 WHERE d='1e+x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+x'
+SELECT COUNT(*) FROM t1 WHERE f4='1e1000';
+COUNT(*)
+0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e1000'
+SELECT COUNT(*) FROM t1 WHERE f8='1e1000';
+COUNT(*)
+0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e1000'
+SELECT COUNT(*) FROM t1 WHERE i1='1e1000';
+COUNT(*)
+0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e1000'
+SELECT COUNT(*) FROM t1 WHERE i2='1e1000';
+COUNT(*)
+0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e1000'
+SELECT COUNT(*) FROM t1 WHERE i4='1e1000';
+COUNT(*)
+0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e1000'
+SELECT COUNT(*) FROM t1 WHERE i8='1e1000';
+COUNT(*)
+0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e1000'
+SELECT COUNT(*) FROM t1 WHERE d='1e1000';
+COUNT(*)
+0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e1000'
+ALTER TABLE t1
+ADD KEY f4(f4),
+ADD KEY f8(f8),
+ADD KEY i1(i1),
+ADD KEY i2(i2),
+ADD KEY i4(i4),
+ADD KEY i8(i8),
+ADD KEY d(d);
+SELECT COUNT(*) FROM t1 FORCE INDEX(f4) WHERE f4='1 ';
+COUNT(*)
+2
+Warnings:
+Note 1292 Truncated incorrect DOUBLE value: '1 '
+SELECT COUNT(*) FROM t1 FORCE INDEX(f8) WHERE f8='1 ';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 FORCE INDEX(i1) WHERE i1='1 ';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 FORCE INDEX(i2) WHERE i2='1 ';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 FORCE INDEX(i4) WHERE i4='1 ';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 FORCE INDEX(i8) WHERE i8='1 ';
+COUNT(*)
+2
+Warnings:
+Note 1292 Truncated incorrect DOUBLE value: '1 '
+SELECT COUNT(*) FROM t1 FORCE INDEX(d) WHERE d='1 ';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 FORCE INDEX(f4) WHERE f4='';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
+SELECT COUNT(*) FROM t1 FORCE INDEX(f8) WHERE f8='';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 FORCE INDEX(i1) WHERE i1='';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 FORCE INDEX(i2) WHERE i2='';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 FORCE INDEX(i4) WHERE i4='';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 FORCE INDEX(i8) WHERE i8='';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
+SELECT COUNT(*) FROM t1 FORCE INDEX(d) WHERE d='';
+COUNT(*)
+2
+DROP TABLE t1;
+SELECT
+CAST('1 ' AS SIGNED),
+CAST('1 ' AS UNSIGNED),
+CAST('1 ' AS DECIMAL),
+CAST('1 ' AS DOUBLE);
+CAST('1 ' AS SIGNED) CAST('1 ' AS UNSIGNED) CAST('1 ' AS DECIMAL) CAST('1 ' AS DOUBLE)
+1 1 1 1
+Warnings:
+Note 1292 Truncated incorrect INTEGER value: '1 '
+Note 1292 Truncated incorrect INTEGER value: '1 '
+Note 1292 Truncated incorrect DECIMAL value: '1 '
+Note 1292 Truncated incorrect DOUBLE value: '1 '
+SELECT
+CAST('' AS SIGNED),
+CAST('' AS UNSIGNED),
+CAST('' AS DECIMAL),
+CAST('' AS DOUBLE);
+CAST('' AS SIGNED) CAST('' AS UNSIGNED) CAST('' AS DECIMAL) CAST('' AS DOUBLE)
+0 0 0 0
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: ''
+Warning 1292 Truncated incorrect INTEGER value: ''
+Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1292 Truncated incorrect DOUBLE value: ''
+SELECT
+CAST('x' AS SIGNED),
+CAST('x' AS UNSIGNED),
+CAST('x' AS DECIMAL),
+CAST('x' AS DOUBLE);
+CAST('x' AS SIGNED) CAST('x' AS UNSIGNED) CAST('x' AS DECIMAL) CAST('x' AS DOUBLE)
+0 0 0 0
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'x'
+Warning 1292 Truncated incorrect INTEGER value: 'x'
+Warning 1292 Truncated incorrect DECIMAL value: 'x'
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+SELECT
+CAST(' x' AS SIGNED),
+CAST(' x' AS UNSIGNED),
+CAST(' x' AS DECIMAL),
+CAST(' x' AS DOUBLE);
+CAST(' x' AS SIGNED) CAST(' x' AS UNSIGNED) CAST(' x' AS DECIMAL) CAST(' x' AS DOUBLE)
+0 0 0 0
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: ' x'
+Warning 1292 Truncated incorrect INTEGER value: ' x'
+Warning 1292 Truncated incorrect DECIMAL value: ' x'
+Warning 1292 Truncated incorrect DOUBLE value: ' x'
+SELECT
+CAST('.' AS SIGNED),
+CAST('.' AS UNSIGNED),
+CAST('.' AS DECIMAL),
+CAST('.' AS DOUBLE);
+CAST('.' AS SIGNED) CAST('.' AS UNSIGNED) CAST('.' AS DECIMAL) CAST('.' AS DOUBLE)
+0 0 0 0
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '.'
+Warning 1292 Truncated incorrect INTEGER value: '.'
+Warning 1292 Truncated incorrect DECIMAL value: '.'
+Warning 1292 Truncated incorrect DOUBLE value: '.'
+SELECT
+CAST('-' AS SIGNED),
+CAST('-' AS UNSIGNED),
+CAST('-' AS DECIMAL),
+CAST('-' AS DOUBLE);
+CAST('-' AS SIGNED) CAST('-' AS UNSIGNED) CAST('-' AS DECIMAL) CAST('-' AS DOUBLE)
+0 0 0 0
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '-'
+Warning 1292 Truncated incorrect INTEGER value: '-'
+Warning 1292 Truncated incorrect DECIMAL value: '-'
+Warning 1292 Truncated incorrect DOUBLE value: '-'
+SELECT
+CAST('+' AS SIGNED),
+CAST('+' AS UNSIGNED),
+CAST('+' AS DECIMAL),
+CAST('+' AS DOUBLE);
+CAST('+' AS SIGNED) CAST('+' AS UNSIGNED) CAST('+' AS DECIMAL) CAST('+' AS DOUBLE)
+0 0 0 0
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '+'
+Warning 1292 Truncated incorrect INTEGER value: '+'
+Warning 1292 Truncated incorrect DECIMAL value: '+'
+Warning 1292 Truncated incorrect DOUBLE value: '+'
+SELECT
+CAST('1x' AS SIGNED),
+CAST('1x' AS UNSIGNED),
+CAST('1x' AS DECIMAL),
+CAST('1x' AS DOUBLE);
+CAST('1x' AS SIGNED) CAST('1x' AS UNSIGNED) CAST('1x' AS DECIMAL) CAST('1x' AS DOUBLE)
+1 1 1 1
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '1x'
+Warning 1292 Truncated incorrect INTEGER value: '1x'
+Warning 1292 Truncated incorrect DECIMAL value: '1x'
+Warning 1292 Truncated incorrect DOUBLE value: '1x'
+SELECT
+CAST('1e' AS SIGNED),
+CAST('1e' AS UNSIGNED),
+CAST('1e' AS DECIMAL),
+CAST('1e' AS DOUBLE);
+CAST('1e' AS SIGNED) CAST('1e' AS UNSIGNED) CAST('1e' AS DECIMAL) CAST('1e' AS DOUBLE)
+1 1 1 1
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '1e'
+Warning 1292 Truncated incorrect INTEGER value: '1e'
+Warning 1292 Truncated incorrect DECIMAL value: '1e'
+Warning 1292 Truncated incorrect DOUBLE value: '1e'
+SELECT
+CAST('1e-' AS SIGNED),
+CAST('1e-' AS UNSIGNED),
+CAST('1e-' AS DECIMAL),
+CAST('1e-' AS DOUBLE);
+CAST('1e-' AS SIGNED) CAST('1e-' AS UNSIGNED) CAST('1e-' AS DECIMAL) CAST('1e-' AS DOUBLE)
+1 1 1 1
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '1e-'
+Warning 1292 Truncated incorrect INTEGER value: '1e-'
+Warning 1292 Truncated incorrect DECIMAL value: '1e-'
+Warning 1292 Truncated incorrect DOUBLE value: '1e-'
+SELECT
+CAST('1E+' AS SIGNED),
+CAST('1E+' AS UNSIGNED),
+CAST('1E+' AS DECIMAL),
+CAST('1E+' AS DOUBLE);
+CAST('1E+' AS SIGNED) CAST('1E+' AS UNSIGNED) CAST('1E+' AS DECIMAL) CAST('1E+' AS DOUBLE)
+1 1 1 1
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '1E+'
+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
+#
diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result
index 53fc3104666..7f42c6d343e 100644
--- a/mysql-test/r/type_ranges.result
+++ b/mysql-test/r/type_ranges.result
@@ -129,6 +129,9 @@ 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
@@ -275,15 +278,15 @@ drop table t2;
create table t2 (primary key (auto)) select auto+1 as auto,1 as t1, 'a' as t2, repeat('a',256) as t3, binary repeat('b',256) as t4, repeat('a',4096) as t5, binary repeat('b',4096) as t6, '' as t7, binary '' as t8 from t1;
show full columns from t2;
Field Type Collation Null Key Default Extra Privileges Comment
-auto int(11) unsigned NULL NO PRI 0 #
-t1 int(1) NULL NO 0 #
-t2 varchar(1) latin1_swedish_ci NO #
-t3 varchar(256) latin1_swedish_ci NO #
-t4 varbinary(256) NULL NO #
+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 #
-t7 char(0) latin1_swedish_ci NO #
-t8 binary(0) NULL NO #
+t7 char(0) latin1_swedish_ci NO NULL #
+t8 binary(0) NULL NO 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
@@ -304,7 +307,7 @@ show full columns from t3;
Field Type Collation Null Key Default Extra Privileges Comment
c1 int(11) NULL YES NULL #
c2 int(11) NULL YES NULL #
-const int(1) NULL NO 0 #
+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:
diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result
index f3b7019c989..586c6345e00 100644
--- a/mysql-test/r/type_set.result
+++ b/mysql-test/r/type_set.result
@@ -263,3 +263,55 @@ DROP TABLE t1;
#
# End of 10.0 tests
#
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8729 Wrong result for SELECT..WHERE HEX(enum_column)='61' AND enum_column='a '
+#
+CREATE TABLE t1 (a SET('a','A') CHARACTER SET latin1 COLLATE latin1_bin);
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT * FROM t1 WHERE a='a ';
+a
+a
+SELECT * FROM t1 WHERE HEX(a)='61';
+a
+a
+SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
+a
+a
+# Can't propagate the equality into HEX(a), because binary collations still ignore trailing spaces
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
+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'))
+DROP TABLE t1;
+CREATE TABLE t1 (a SET('a','a ') CHARACTER SET BINARY);
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT * FROM t1 WHERE a='a ';
+a
+a
+SELECT * FROM t1 WHERE HEX(a)='61';
+a
+a
+SELECT * FROM t1 WHERE HEX(a)='61' AND a='a';
+a
+a
+SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
+a
+# Ok to propagate the equality into HEX(a), because "CHARACTER SET BINARY" does not ignore trailing spaces
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a';
+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')
+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
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result
index 477703edebb..ba40fbf774b 100644
--- a/mysql-test/r/type_time.result
+++ b/mysql-test/r/type_time.result
@@ -393,3 +393,765 @@ SET timestamp=DEFAULT;
#
# End of 10.0 tests
#
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8699 Wrong result for SELECT..WHERE HEX(date_column)!='323030312D30312D3031' AND date_column='2001-01-01x'
+#
+# Trailing garbage in string literals
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+a
+00:00:00
+00:00:01
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='00:00:00x';
+a
+00:00:00
+Warnings:
+Warning 1292 Truncated incorrect time value: '00:00:00x'
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=8 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')
+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())))
+DROP TABLE t1;
+# Trailing fractional digits in string literals
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+a
+00:00:00
+00:00:01
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='00:00:00.000000';
+a
+00:00:00
+EXPLAIN EXTENDED
+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')
+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())))
+DROP TABLE t1;
+# Trailing fractional digits in temporal literals
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+a
+00:00:00
+00:00:01
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'00:00:00.000000';
+a
+00:00:00
+EXPLAIN EXTENDED
+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')
+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())))
+DROP TABLE t1;
+# Trailing fractional digits in temporal literals, same precision
+CREATE TABLE t1 (a TIME(6));
+INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+a
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'00:00:00.000000';
+a
+EXPLAIN EXTENDED
+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 NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
+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.000000')) = (30 + rand())))
+DROP TABLE t1;
+# Leading spaces in string literals
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+a
+00:00:00
+00:00:01
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=' 00:00:00';
+a
+00:00:00
+EXPLAIN EXTENDED
+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')
+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())))
+DROP TABLE t1;
+# Numeric format in string literals
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+a
+00:00:00
+00:00:01
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='000000';
+a
+00:00:00
+EXPLAIN EXTENDED
+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')
+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())))
+DROP TABLE t1;
+#
+# MDEV-8766 Wrong result for SELECT..WHERE LENGTH(time_column)=8 AND time_column=TIMESTAMP'2001-01-01 10:20:31'
+#
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03');
+# TIMESTAMP literal with the same scale, ok to propagate
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
+SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 10:20:31';
+a
+10:20:31
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+a
+10:20:31
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31';
+a
+10:20:31
+EXPLAIN EXTENDED
+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')
+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())))
+DROP TABLE t1;
+# TIMESTAMP literal with a bigger scale and fractional second truncation
+# Ok to propagate with precision truncation
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
+SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 10:20:31.123';
+a
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+a
+10:20:31
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.123';
+a
+EXPLAIN EXTENDED
+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')
+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())))
+DROP TABLE t1;
+# TIMESTAMP literal with a bigger scale and no fractional second truncation
+# Ok to propagate
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
+SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 10:20:31.000';
+a
+10:20:31
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+a
+10:20:31
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.000';
+a
+10:20:31
+EXPLAIN EXTENDED
+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')
+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())))
+DROP TABLE t1;
+# TIMESTAMP literal with a smaller scale
+# Ok to propagate
+CREATE TABLE t1 (a TIME(6));
+INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
+SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 10:20:31.123';
+a
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+a
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.123';
+a
+EXPLAIN EXTENDED
+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 NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
+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.123000')) = (30 + rand())))
+DROP TABLE t1;
+# TIME literal with a bigger scale and fractional second truncation
+# Ok to propagate with precision truncation
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
+SELECT * FROM t1 WHERE a=TIME'10:20:31.123';
+a
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+a
+10:20:31
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.123';
+a
+EXPLAIN EXTENDED
+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')
+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())))
+DROP TABLE t1;
+# TIME literal with a bigger scale and no fractional second truncation
+# Ok to propagate
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
+SELECT * FROM t1 WHERE a=TIME'10:20:31.000';
+a
+10:20:31
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+a
+10:20:31
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.000';
+a
+10:20:31
+EXPLAIN EXTENDED
+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')
+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())))
+DROP TABLE t1;
+# TIME literal with a smaller scale
+# Ok to propagate
+CREATE TABLE t1 (a TIME(6));
+INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
+SELECT * FROM t1 WHERE a=TIME'10:20:31.123';
+a
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+a
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.123';
+a
+EXPLAIN EXTENDED
+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 NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
+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.123000')) = (30 + rand())))
+DROP TABLE t1;
+# TIME-alike string literal with a bigger scale and fractional second truncation
+# Ok to propagate with precision truncation
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
+SELECT * FROM t1 WHERE a='10:20:31.123';
+a
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+a
+10:20:31
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.123';
+a
+EXPLAIN EXTENDED
+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')
+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())))
+DROP TABLE t1;
+# TIME-alike string literal with a bigger scale and no fractional second truncation
+# Ok to propagate
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
+SELECT * FROM t1 WHERE a='10:20:31.000';
+a
+10:20:31
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+a
+10:20:31
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.000';
+a
+10:20:31
+EXPLAIN EXTENDED
+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')
+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())))
+DROP TABLE t1;
+# TIME-alike string literal with a smaller scale
+# Ok to propagate
+CREATE TABLE t1 (a TIME(6));
+INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
+SELECT * FROM t1 WHERE a='10:20:31.123';
+a
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+a
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.123';
+a
+EXPLAIN EXTENDED
+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 NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
+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.123000')) = (30 + rand())))
+DROP TABLE t1;
+SET timestamp=DEFAULT;
+SET @@old_mode=zero_date_time_cast;
+# TIMESTAMP literal, old mode
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('0000-00-00 10:20:30'),('0000-00-00 10:20:31');
+INSERT INTO t1 VALUES ('0000-00-01 10:20:30'),('0000-00-01 10:20:31');
+INSERT INTO t1 VALUES ('31 10:20:30'),('32 10:20:30'),('33 10:20:30'),('34 10:20:30');
+SELECT * FROM t1;
+a
+10:20:30
+10:20:31
+34:20:30
+34:20:31
+754:20:30
+778:20:30
+802:20:30
+826:20:30
+# Old mode, TIMESTAMP literal, zero YYYYMMDD, Ok to propagate
+SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30';
+a
+10:20:30
+SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=8;
+a
+10:20:30
+EXPLAIN EXTENDED
+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')
+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
+SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30';
+a
+34:20:30
+SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30' AND LENGTH(a)=8;
+a
+34:20:30
+EXPLAIN EXTENDED
+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))
+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())))
+# Old mode, TIMESTAMP-alike string literal, zero YYYYMMDD, Ok to propagate
+SELECT * FROM t1 WHERE a='0000-00-00 10:20:30';
+a
+10:20:30
+SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=8;
+a
+10:20:30
+EXPLAIN EXTENDED
+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')
+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
+SELECT * FROM t1 WHERE a='0000-00-01 10:20:30';
+a
+34:20:30
+SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8;
+a
+34:20:30
+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))
+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())))
+DROP TABLE t1;
+SET @@old_mode=DEFAULT;
+#
+# MDEV-8706 Wrong result for SELECT..WHERE time_column=TIMESTAMP'2015-08-30 00:00:00' AND time_column='00:00:00'
+#
+SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
+SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00';
+a
+00:00:00
+SELECT * FROM t1 WHERE a='00:00:00';
+a
+00:00:00
+SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00' AND a='00:00:00';
+a
+00:00:00
+SELECT * FROM t1 WHERE a>=TIMESTAMP'2015-08-30 00:00:00' AND a='00:00:00';
+a
+00:00:00
+EXPLAIN EXTENDED
+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')
+DROP TABLE t1;
+SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
+SELECT * FROM t1 WHERE DATE(a)<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00';
+a
+00:00:00
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE DATE(a)<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00';
+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')
+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'))
+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'))
+DROP TABLE t1;
+SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
+SELECT * FROM t1 WHERE DATE(a)<=DATE'2015-08-30' AND a='00:00:00';
+a
+00:00:00
+EXPLAIN EXTENDED
+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')
+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'))
+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'))
+DROP TABLE t1;
+SET timestamp=DEFAULT;
+#
+# MDEV-8795 Equal expression propagation does not work for temporal literals
+#
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('00:00:01'),('00:00:02');
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:01' AND COALESCE(a)>=TIME'00:00:01';
+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')
+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')
+#
+SET timestamp=UNIX_TIMESTAMP('2015-09-11 20:20:20');
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES('10:20:30'),('00:00:00');
+SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00');
+a
+00:00:00
+SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11');
+a
+00:00:00
+# TIME cast + DATE cast
+SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE('2015-09-11');
+a
+00:00:00
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)=TIME('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`) = <cache>(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
+00:00:00
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)=TIME('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`) = <cache>(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
+00:00:00
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)=TIME'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`) = 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
+00:00:00
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)=TIME'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`) = 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
+00:00:00
+EXPLAIN EXTENDED
+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`) = <cache>(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
+00:00:00
+EXPLAIN EXTENDED
+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'))
+# TIME-alike integer literal + DATE cast
+SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE('2015-09-11');
+a
+00:00:00
+EXPLAIN EXTENDED
+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`) = <cache>(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
+00:00:00
+EXPLAIN EXTENDED
+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'))
+# DATE cast + TIME cast
+SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME('00:00:00');
+a
+00:00:00
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(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 (coalesce(`test`.`t1`.`a`) = <cache>(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
+00:00:00
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(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 (coalesce(`test`.`t1`.`a`) = <cache>(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
+00:00:00
+EXPLAIN EXTENDED
+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`) = <cache>(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
+00:00:00
+EXPLAIN EXTENDED
+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`) = <cache>(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
+00:00:00
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(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 (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
+00:00:00
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(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 (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
+00:00:00
+EXPLAIN EXTENDED
+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'))
+# DATE literal + TIME-alike integer literal
+SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=0;
+a
+00:00:00
+EXPLAIN EXTENDED
+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))
+DROP TABLE t1;
+SET timestamp=DEFAULT;
+#
+# MDEV-8814 Wrong result for WHERE datetime_column > TIME('00:00:00')
+#
+CREATE TABLE t1 (a DATETIME);
+INSERT INTO t1 VALUES ('2000-09-12 00:00:00'), ('2007-04-25 05:08:49');
+SELECT * FROM t1 WHERE a>TIME'00:00:00';
+a
+SELECT * FROM t1 WHERE a>TIME('00:00:00');
+a
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/type_time_hires.result b/mysql-test/r/type_time_hires.result
index 8096785dcc1..2620dac0794 100644
--- a/mysql-test/r/type_time_hires.result
+++ b/mysql-test/r/type_time_hires.result
@@ -115,7 +115,6 @@ NULL
delete from t1 where a < 20110101;
select * from t1;
a
-01:02:13.3332
NULL
create table t2 select * from t1;
create table t3 like t1;
@@ -135,12 +134,11 @@ Warnings:
Note 1265 Data truncated for column 'a' at row 1
select a, a+0, a-1, a*1, a/2 from t1;
a a+0 a-1 a*1 a/2
-01:02:13.3332 10213.3332 10212.3332 10213.3332 5106.66660000
NULL NULL NULL NULL NULL
14:15:16.2222 141516.2222 141515.2222 141516.2222 70758.11110000
select max(a), min(a), sum(a), avg(a) from t1;
max(a) min(a) sum(a) avg(a)
-14:15:16.2222 01:02:13.3332 151729.5554 75864.77770000
+14:15:16.2222 14:15:16.2222 141516.2222 141516.22220000
create table t2 select a, a+0, a-1, a*1, a/2 from t1;
create table t3 select max(a), min(a), sum(a), avg(a) from t1;
show create table t2;
diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result
index 786bce471ce..95e89e22f2b 100644
--- a/mysql-test/r/type_timestamp.result
+++ b/mysql-test/r/type_timestamp.result
@@ -747,5 +747,198 @@ Warnings:
Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
DROP TABLE t1;
#
+# MDEV-7824 [Bug #68041] Zero date can be inserted in strict no-zero mode through a default value
+#
+SET sql_mode=DEFAULT;
+CREATE TABLE t1 (a TIMESTAMP DEFAULT '0000-00-00 00:00:00');
+SET sql_mode=TRADITIONAL;
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00');
+ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'a' at row 1
+INSERT INTO t1 VALUES ();
+ERROR 22007: Incorrect default value '0000-00-00 00:00:00' for column 'a'
+INSERT INTO t1 VALUES (DEFAULT);
+ERROR 22007: Incorrect default value '0000-00-00 00:00:00' for column 'a'
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', b TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00');
+CREATE TABLE t2 (a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00');
+INSERT INTO t2 VALUES ('0000-00-00 00:00:00');
+SET sql_mode=TRADITIONAL;
+INSERT INTO t1 (a) SELECT a FROM t2;
+ERROR 22007: Incorrect default value '0000-00-00 00:00:00' for column 'b'
+DROP TABLE t1, t2;
+SET sql_mode=DEFAULT;
+CREATE TABLE t1 (a TIMESTAMP DEFAULT '0000-00-00 00:00:00', b TIMESTAMP DEFAULT '0000-00-00 00:00:00');
+INSERT INTO t1 VALUES (DEFAULT,DEFAULT);;
+SELECT a INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/mdev-7824.txt' FROM t1;
+DELETE FROM t1;
+SET sql_mode=TRADITIONAL;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/mdev-7824.txt' INTO TABLE t1 (a);
+ERROR 22007: Incorrect default value '0000-00-00 00:00:00' for column 'b'
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+CREATE TABLE t1 (a TIMESTAMP DEFAULT '0000-00-00 00:00:00');;
+SET sql_mode='NO_ZERO_DATE';
+ALTER TABLE t1 ADD b INT NOT NULL;
+ERROR 42000: Invalid default value for 'a'
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+#
+# End of MDEV-7824 [Bug #68041] Zero date can be inserted in strict no-zero mode through a default value
+#
+#
+# MDEV-8373 Zero date can be inserted in strict no-zero mode through CREATE TABLE AS SELECT timestamp_field
+#
+SET sql_mode=DEFAULT;
+CREATE TABLE t1 (a TIMESTAMP);;
+INSERT INTO t1 VALUES (0);
+SET sql_mode='TRADITIONAL';
+CREATE TABLE t2 AS SELECT * FROM t1;
+ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'a' at row 1
+DROP TABLE t1;
+#
+# End of MDEV-8373 Zero date can be inserted in strict no-zero mode through CREATE TABLE AS SELECT timestamp_field
+#
+#
+# MDEV-8699 Wrong result for SELECT..WHERE HEX(date_column)!='323030312D30312D3031' AND date_column='2001-01-01x'
+#
+CREATE TABLE t1 (a TIMESTAMP);;
+INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01');
+SELECT * FROM t1 WHERE a='2001-01-01 00:00:00x';
+a
+2001-01-01 00:00:00
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x'
+SELECT * FROM t1 WHERE LENGTH(a) != 20;
+a
+2001-01-01 00:00:00
+2001-01-01 00:00:01
+SELECT * FROM t1 WHERE LENGTH(a) != 20 AND a='2001-01-01 00:00:00x';
+a
+2001-01-01 00:00:00
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x'
+Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x'
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a) != 20 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` = '2001-01-01 00:00:00x')
+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` = '2001-01-01 00:00:00x') 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');
+SELECT * FROM t1 WHERE LENGTH(a)=19;
+a
+2001-01-01 00:00:00
+2001-01-01 00:00:01
+SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=' 2001-01-01 00:00:00';
+a
+2001-01-01 00:00:00
+EXPLAIN EXTENDED
+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` = ' 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` = ' 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` = ' garbage ') and (length(`test`.`t1`.`a`) = (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');
+SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 00:00:00.000000';
+a
+2001-01-01 00:00:00
+SELECT * FROM t1 WHERE LENGTH(a)=19;
+a
+2001-01-01 00:00:00
+2001-01-01 00:00:01
+SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIMESTAMP'2001-01-01 00:00:00.000000';
+a
+2001-01-01 00:00:00
+EXPLAIN EXTENDED
+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')
+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())))
+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');
+SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 00:00:00.000000';
+a
+2001-01-01 00:00:00.000000
+SELECT * FROM t1 WHERE LENGTH(a)=26;
+a
+2001-01-01 00:00:00.000000
+2001-01-01 00:00:01.000000
+SELECT * FROM t1 WHERE LENGTH(a)=26 AND a=TIMESTAMP'2001-01-01 00:00:00.000000';
+a
+2001-01-01 00:00:00.000000
+EXPLAIN EXTENDED
+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')
+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())))
+DROP TABLE t1;
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30');
+CREATE TABLE t1 (a TIMESTAMP);;
+INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01');
+SELECT * FROM t1 WHERE a=TIME'00:00:00';
+a
+2001-01-01 00:00:00
+SELECT * FROM t1 WHERE LENGTH(a)=19;
+a
+2001-01-01 00:00:00
+2001-01-01 00:00:01
+SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIME'00:00:00';
+a
+2001-01-01 00:00:00
+EXPLAIN EXTENDED
+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` = TIME'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` = TIME'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 6ebf83a09f0..21e72b98146 100644
--- a/mysql-test/r/type_timestamp_hires.result
+++ b/mysql-test/r/type_timestamp_hires.result
@@ -131,9 +131,9 @@ 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+0` decimal(25,4) NOT NULL DEFAULT '0.0000',
- `a-1` decimal(25,4) NOT NULL DEFAULT '0.0000',
- `a*1` decimal(25,4) NOT NULL DEFAULT '0.0000',
+ `a+0` decimal(25,4) NOT NULL,
+ `a-1` decimal(25,4) NOT NULL,
+ `a*1` decimal(25,4) NOT NULL,
`a/2` decimal(28,8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create table t3;
diff --git a/mysql-test/r/type_varchar.result b/mysql-test/r/type_varchar.result
index 936f48e6122..e15b029e9c6 100644
--- a/mysql-test/r/type_varchar.result
+++ b/mysql-test/r/type_varchar.result
@@ -499,6 +499,7 @@ SELECT 5 = a FROM t1;
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 's'
+Warning 1292 Truncated incorrect DOUBLE value: ''
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(16));
INSERT INTO t1 VALUES ('5'), ('s'), ('');
@@ -509,6 +510,7 @@ SELECT 5 = a FROM t1;
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 's '
+Warning 1292 Truncated incorrect DOUBLE value: ' '
DROP TABLE t1;
#
# Start of 10.0 tests
diff --git a/mysql-test/r/type_year.result b/mysql-test/r/type_year.result
index 38bddd42cfa..842a16e3b4a 100644
--- a/mysql-test/r/type_year.result
+++ b/mysql-test/r/type_year.result
@@ -394,3 +394,47 @@ select a from t1 where a=b;
a
drop table t1;
drop function y2k;
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010
+#
+CREATE TABLE t1 (a YEAR);
+INSERT INTO t1 VALUES (2010),(2020);
+SELECT * FROM t1 WHERE a=2010 AND a>=2010;
+a
+2010
+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)
+SELECT * FROM t1 WHERE a=2010 AND a>=10;
+a
+2010
+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)
+SELECT * FROM t1 WHERE a=10 AND a>=2010;
+a
+2010
+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)
+SELECT * FROM t1 WHERE a=10 AND a>=10;
+a
+2010
+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)
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index ef1749eda52..d3498c27f13 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -1281,7 +1281,7 @@ t3 CREATE TABLE `t3` (
drop tables t1,t2,t3;
SELECT @tmp_max:= @@global.max_allowed_packet;
@tmp_max:= @@global.max_allowed_packet
-1048576
+4194304
SET @@global.max_allowed_packet=25000000;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '25000000'
diff --git a/mysql-test/r/update_innodb.result b/mysql-test/r/update_innodb.result
new file mode 100644
index 00000000000..88c86c50625
--- /dev/null
+++ b/mysql-test/r/update_innodb.result
@@ -0,0 +1,31 @@
+CREATE TABLE `t1` (
+`c1` int(11) NOT NULL,
+`c2` datetime DEFAULT NULL,
+PRIMARY KEY (`c1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+CREATE TABLE `t2` (
+`c0` varchar(10) NOT NULL,
+`c1` int(11) NOT NULL,
+`c2` int(11) NOT NULL,
+PRIMARY KEY (`c0`,`c1`),
+KEY `c1` (`c1`),
+KEY `c2` (`c2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+CREATE TABLE `t3` (
+`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+`c1` datetime NOT NULL,
+`c2` bigint(20) NOT NULL,
+`c3` int(4) unsigned NOT NULL,
+PRIMARY KEY (`id`),
+KEY `c2` (`c2`),
+KEY `c3` (`c3`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+CREATE TABLE `t4` (
+`c1` int(11) NOT NULL,
+`c2` bigint(20) DEFAULT NULL,
+`c3` int(11) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select `t4`.`c1` AS `c1`,`t4`.`c2` AS `c2`,`t4`.`c3` AS `c3` from `t4`;
+UPDATE t1 a JOIN t2 b ON a.c1 = b.c1 JOIN v1 vw ON b.c2 = vw.c1 JOIN t3 del ON vw.c2 = del.c2 SET a.c2 = ( SELECT max(t.c1) FROM t3 t, v1 i WHERE del.c2 = t.c2 AND vw.c3 = i.c3 AND t.c3 = 4 ) WHERE a.c2 IS NULL OR a.c2 < '2011-05-01';
+drop view v1;
+drop table t1,t2,t3,t4;
diff --git a/mysql-test/r/user_limits.result b/mysql-test/r/user_limits.result
index 688704f528a..5ab98d1fc30 100644
--- a/mysql-test/r/user_limits.result
+++ b/mysql-test/r/user_limits.result
@@ -6,6 +6,7 @@ delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%';
delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges;
+create user mysqltest_1@localhost;
grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 2;
flush user_resources;
select * from t1;
@@ -17,6 +18,7 @@ ERROR 42000: User 'mysqltest_1' has exceeded the 'max_queries_per_hour' resource
select * from t1;
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_queries_per_hour' resource (current value: 2)
drop user mysqltest_1@localhost;
+create user mysqltest_1@localhost;
grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 2;
flush user_resources;
select * from t1;
@@ -36,6 +38,7 @@ ERROR 42000: User 'mysqltest_1' has exceeded the 'max_updates_per_hour' resource
select * from t1;
i
drop user mysqltest_1@localhost;
+create user mysqltest_1@localhost;
grant usage on *.* to mysqltest_1@localhost with max_connections_per_hour 2;
flush user_resources;
select * from t1;
@@ -50,6 +53,7 @@ connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_connections_per_hour' resource (current value: 2)
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;
select * from t1;
@@ -86,6 +90,7 @@ set global max_user_connections= 2;
select @@session.max_user_connections, @@global.max_user_connections;
@@session.max_user_connections @@global.max_user_connections
2 2
+create user mysqltest_1@localhost;
grant usage on *.* to mysqltest_1@localhost;
flush user_resources;
select @@session.max_user_connections, @@global.max_user_connections;
diff --git a/mysql-test/r/user_var-binlog.result b/mysql-test/r/user_var-binlog.result
index e6e9ddf9545..2e1eb15cad4 100644
--- a/mysql-test/r/user_var-binlog.result
+++ b/mysql-test/r/user_var-binlog.result
@@ -30,7 +30,7 @@ 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=0/*!*/;
+SET @@session.sql_mode=1342177280/*!*/;
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/varbinary.result b/mysql-test/r/varbinary.result
index b5f6d065174..58cab5ad1ca 100644
--- a/mysql-test/r/varbinary.result
+++ b/mysql-test/r/varbinary.result
@@ -175,6 +175,8 @@ b'' 0+b''
select x'', 0+x'';
x'' 0+x''
0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
select 0x;
ERROR 42S22: Unknown column '0x' in 'field list'
select 0b;
diff --git a/mysql-test/r/variables-notembedded.result b/mysql-test/r/variables-notembedded.result
index 75fd2430e4b..f8191345219 100644
--- a/mysql-test/r/variables-notembedded.result
+++ b/mysql-test/r/variables-notembedded.result
@@ -44,19 +44,58 @@ ERROR HY000: Variable 'relay_log' is a read only variable
SET @@global.relay_log= 'x';
ERROR HY000: Variable 'relay_log' is a read only variable
#
+SHOW VARIABLES like 'relay_log_basename';
+Variable_name Value
+relay_log_basename MYSQLTEST_VARDIR/mysqld.1/data/mysqld-relay-bin
+SELECT @@session.relay_log_basename;
+ERROR HY000: Variable 'relay_log_basename' is a GLOBAL variable
+SELECT @@global.relay_log_basename;
+@@global.relay_log_basename
+MYSQLTEST_VARDIR/mysqld.1/data/mysqld-relay-bin
+SET @@session.relay_log_basename= 'x';
+ERROR HY000: Variable 'relay_log_basename' is a read only variable
+SET @@global.relay_log_basename= 'x';
+ERROR HY000: Variable 'relay_log_basename' is a read only variable
+#
+SHOW VARIABLES like 'log_bin_basename';
+Variable_name Value
+log_bin_basename
+SELECT @@session.log_bin_basename;
+ERROR HY000: Variable 'log_bin_basename' is a GLOBAL variable
+SELECT @@global.log_bin_basename;
+@@global.log_bin_basename
+NULL
+SET @@session.log_bin_basename= 'x';
+ERROR HY000: Variable 'log_bin_basename' is a read only variable
+SET @@global.log_bin_basename= 'x';
+ERROR HY000: Variable 'log_bin_basename' is a read only variable
+#
SHOW VARIABLES like 'relay_log_index';
Variable_name Value
-relay_log_index mysqld-relay-bin.index
+relay_log_index MYSQLTEST_VARDIR/mysqld.1/data/mysqld-relay-bin.index
SELECT @@session.relay_log_index;
ERROR HY000: Variable 'relay_log_index' is a GLOBAL variable
SELECT @@global.relay_log_index;
@@global.relay_log_index
-mysqld-relay-bin.index
+MYSQLTEST_VARDIR/mysqld.1/data/mysqld-relay-bin.index
SET @@session.relay_log_index= 'x';
ERROR HY000: Variable 'relay_log_index' is a read only variable
SET @@global.relay_log_index= 'x';
ERROR HY000: Variable 'relay_log_index' is a read only variable
#
+SHOW VARIABLES like 'log_bin_index';
+Variable_name Value
+log_bin_index
+SELECT @@session.log_bin_index;
+ERROR HY000: Variable 'log_bin_index' is a GLOBAL variable
+SELECT @@global.log_bin_index;
+@@global.log_bin_index
+NULL
+SET @@session.log_bin_index= 'x';
+ERROR HY000: Variable 'log_bin_index' is a read only variable
+SET @@global.log_bin_index= 'x';
+ERROR HY000: Variable 'log_bin_index' is a read only variable
+#
SHOW VARIABLES like 'relay_log_info_file';
Variable_name Value
relay_log_info_file relay-log.info
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index ddb007439d1..fef3e4a3e9e 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -1133,12 +1133,12 @@ ERROR HY000: Variable 'ft_stopword_file' is a read only variable
#
SHOW VARIABLES like 'back_log';
Variable_name Value
-back_log 150
+back_log 80
SELECT @@session.back_log;
ERROR HY000: Variable 'back_log' is a GLOBAL variable
SELECT @@global.back_log;
@@global.back_log
-150
+80
SET @@session.back_log= 7;
ERROR HY000: Variable 'back_log' is a read only variable
SET @@global.back_log= 7;
@@ -1528,7 +1528,7 @@ SET @@global.key_buffer_size=@kbs;
SET @@global.key_cache_block_size=@kcbs;
select @@max_long_data_size;
@@max_long_data_size
-1048576
+4194304
#
# Bug#11766424 59527:
# Assert in DECIMAL_BIN_SIZE:
@@ -1569,7 +1569,7 @@ CREATE TABLE t1 AS SELECT @a:= CAST(1 AS UNSIGNED) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) unsigned NOT NULL DEFAULT '0'
+ `a` int(1) unsigned NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
End of 5.1 tests
@@ -1743,7 +1743,9 @@ SET @@sql_quote_show_create = @sql_quote_show_create_saved;
drop table if exists t1;
drop function if exists t1_max;
drop function if exists t1_min;
+set sql_mode="";
create table t1 (a int) engine=innodb;
+set sql_mode=default;
insert into t1(a) values (0), (1);
create function t1_max() returns int return (select max(a) from t1);
create function t1_min() returns int return (select min(a) from t1);
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index abb9c6240d3..eaef3f96ee0 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -1350,8 +1350,11 @@ a b
delete from t1;
load data infile '../../std_data/loaddata3.dat' ignore into table v1 fields terminated by '' enclosed by '' ignore 1 lines;
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'
+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'
select * from t1 order by a,b;
@@ -2237,12 +2240,12 @@ drop table t1;
create table t1 (
r_object_id char(16) NOT NULL,
group_name varchar(32) NOT NULL
-) engine = InnoDB;
+);
create table t2 (
r_object_id char(16) NOT NULL,
i_position int(11) NOT NULL,
users_names varchar(32) default NULL
-) Engine = InnoDB;
+);
create view v1 as select r_object_id, group_name from t1;
create view v2 as select r_object_id, i_position, users_names from t2;
create unique index r_object_id on t1(r_object_id);
@@ -2902,6 +2905,8 @@ Tables_in_test
t1
DROP TABLE t1;
DROP VIEW IF EXISTS v1;
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
CREATE DATABASE bug21261DB;
USE bug21261DB;
CREATE TABLE t1 (x INT);
@@ -2924,6 +2929,8 @@ DROP VIEW v1;
DROP TABLE t1;
DROP DATABASE bug21261DB;
USE test;
+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;
@@ -4426,36 +4433,58 @@ CREATE TABLE t1 (a varchar(10), KEY (a)) ;
INSERT INTO t1 VALUES
('DD'), ('ZZ'), ('ZZ'), ('KK'), ('FF'), ('HH'),('MM');
CREATE VIEW v1 AS SELECT * FROM t1;
+# t1 and v1 should return the same result set
SELECT * FROM v1 WHERE a > 'JJ' OR a <> 0 AND a = 'VV';
a
KK
MM
ZZ
ZZ
-Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: 'VV'
+SELECT * FROM t1 WHERE a > 'JJ' OR a <> 0 AND a = 'VV';
+a
+KK
+MM
+ZZ
+ZZ
+# t1 and v1 should propagate constants in the same way
EXPLAIN EXTENDED
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:
-Warning 1292 Truncated incorrect DOUBLE value: 'VV'
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > 'JJ')
+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)))
+# t1 and v1 should return the same result set
SELECT * FROM v1 WHERE a > 'JJ' OR a AND a = 'VV';
a
KK
MM
ZZ
ZZ
-Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: 'VV'
+SELECT * FROM t1 WHERE a > 'JJ' OR a AND a = 'VV';
+a
+KK
+MM
+ZZ
+ZZ
+# t1 and v1 should propagate constants in the same way
EXPLAIN EXTENDED
SELECT * FROM v1 WHERE a > 'JJ' OR a AND a = 'VV';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 13 NULL 4 100.00 Using where; Using index
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: 'VV'
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > 'JJ')
+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)))
DROP VIEW v1;
DROP TABLE t1;
#
@@ -5410,6 +5439,39 @@ create view v2 as select t2.* from (t2 left join v1 using (id));
update t3 left join v2 using (id) set flag=flag+1;
drop view v2, v1;
drop table t1, t2, t3;
+#
+# MDEV-7207 - ALTER VIEW does not change ALGORITM
+#
+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
+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
+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
+drop view v2;
+drop table t1;
+#
+# MDEV-8554: Server crashes in base_list_iterator::next_fast on 1st execution of PS with a multi-table update
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3),(4);
+CREATE TABLE t3 (c INT) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (5),(6);
+CREATE OR REPLACE ALGORITHM=MERGE VIEW v3 AS SELECT * FROM t3;
+PREPARE stmt FROM 'UPDATE t1, t2 SET a = 1 WHERE a IN ( SELECT 0 FROM t3 )';
+UPDATE t1, t2 SET a = 1 WHERE a IN ( SELECT 0 FROM v3 );
+EXECUTE stmt;
+DROP TABLE t1, t2, t3;
+DROP VIEW v3;
# -----------------------------------------------------------------
# -- End of 5.5 tests.
# -----------------------------------------------------------------
@@ -5534,3 +5596,74 @@ drop view v3;
# -- End of 10.0 tests.
# -----------------------------------------------------------------
SET optimizer_switch=@save_optimizer_switch;
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8747 Wrong result for SELECT..WHERE derived_table_column='a' AND derived_table_column<>_latin1'A' COLLATE latin1_bin
+#
+CREATE TABLE t1 (a varchar(10) character set cp1251 collate cp1251_ukrainian_ci, KEY (a)) ;
+INSERT INTO t1 VALUES ('DD'), ('ZZ'), ('ZZ'), ('KK'), ('FF'), ('HH'),('MM'),('`1');
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT * FROM t1 WHERE a <> 0 AND a = ' 1';
+a
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '`1'
+SELECT * FROM v1 WHERE a <> 0 AND a = ' 1';
+a
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '`1'
+DROP VIEW v1;
+DROP TABLE t1;
+CREATE TABLE t1 (a ENUM('5','6'));
+INSERT INTO t1 VALUES ('5'),('6');
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT * FROM t1 WHERE a='5' AND a<2;
+a
+5
+SELECT * FROM v1 WHERE a='5' AND a<2;
+a
+5
+DROP VIEW v1;
+DROP TABLE t1;
+#
+# MDEV-8749 Wrong result for SELECT..WHERE derived_table_enum_column='number' AND derived_table_enum_column OP number2
+#
+CREATE TABLE t1 (a varchar(10) character set cp1251 collate cp1251_ukrainian_ci, KEY (a));
+INSERT INTO t1 VALUES ('DD'), ('ZZ'), ('ZZ'), ('KK'), ('FF'), ('HH'),('MM'),('`1');
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT * FROM t1 WHERE a <> 0 AND a = ' 1';
+a
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '`1'
+SELECT * FROM v1 WHERE a <> 0 AND a = ' 1';
+a
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '`1'
+DROP VIEW v1;
+DROP TABLE t1;
+CREATE TABLE t1 (a ENUM('5','6'));
+INSERT INTO t1 VALUES ('5'),('6');
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT * FROM t1 WHERE a='5' AND a<2;
+a
+5
+SELECT * FROM v1 WHERE a='5' AND a<2;
+a
+5
+DROP VIEW v1;
+DROP TABLE t1;
+#
+# MDEV-8742 Wrong result for SELECT..WHERE view_latin1_swedish_ci_field='a' COLLATE latin1_bin
+#
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
+INSERT INTO t1 VALUES ('a'),('A');
+CREATE VIEW v1 AS SELECT * FROM t1 WHERE a='a';
+SELECT * FROM v1 WHERE a=_latin1'a' COLLATE latin1_bin;
+a
+a
+DROP VIEW v1;
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result
index 550ca12d19e..525f9fbb5e1 100644
--- a/mysql-test/r/view_grant.result
+++ b/mysql-test/r/view_grant.result
@@ -1,5 +1,6 @@
drop database if exists mysqltest;
drop view if exists v1,v2,v3;
+create user test@localhost;
grant create view on test.* to test@localhost;
show grants for test@localhost;
Grants for test@localhost
@@ -13,6 +14,7 @@ drop user test@localhost;
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;
create definer=root@localhost view v1 as select * from mysqltest.t1;
@@ -46,18 +48,19 @@ c
select d from mysqltest.v1;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'd' in table 'v1'
revoke all privileges on mysqltest.v1 from mysqltest_1@localhost;
-delete from mysql.user where user='mysqltest_1';
+drop user mysqltest_1@localhost;
drop database mysqltest;
create database mysqltest;
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;
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'
revoke all privileges on mysqltest.v1 from mysqltest_1@localhost;
-delete from mysql.user where user='mysqltest_1';
+drop user mysqltest_1@localhost;
drop database mysqltest;
create database mysqltest;
create table mysqltest.t1 (a int, b int);
@@ -67,6 +70,7 @@ create algorithm=temptable view mysqltest.v2 (c,d) as select a+1,b+1 from mysqlt
create view mysqltest.v3 (c,d) as select a+1,b+1 from mysqltest.t2;
create algorithm=temptable view mysqltest.v4 (c,d) as select a+1,b+1 from mysqltest.t2;
create view mysqltest.v5 (c,d) as select a+1,b+1 from mysqltest.t1;
+create user mysqltest_1@localhost;
grant select on mysqltest.v1 to mysqltest_1@localhost;
grant select on mysqltest.v2 to mysqltest_1@localhost;
grant select on mysqltest.v3 to mysqltest_1@localhost;
@@ -166,7 +170,7 @@ 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
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
-delete from mysql.user where user='mysqltest_1';
+drop user mysqltest_1@localhost;
drop database mysqltest;
create database mysqltest;
create table mysqltest.t1 (a int, b int, primary key(a));
@@ -176,6 +180,7 @@ insert into mysqltest.t2 values (3), (4), (5), (6);
create view mysqltest.v1 (a,c) as select a, b+1 from mysqltest.t1;
create view mysqltest.v2 (a,c) as select a, b from mysqltest.t1;
create view mysqltest.v3 (a,c) as select a, b+1 from mysqltest.t1;
+create user mysqltest_1@localhost;
grant update (a) on mysqltest.v2 to mysqltest_1@localhost;
grant update on mysqltest.v1 to mysqltest_1@localhost;
grant select on mysqltest.* to mysqltest_1@localhost;
@@ -222,6 +227,7 @@ update v3 set a=a+c;
ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table 'v3'
use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
drop database mysqltest;
create database mysqltest;
create table mysqltest.t1 (a int, b int, primary key(a));
@@ -230,6 +236,7 @@ create table mysqltest.t2 (x int);
insert into mysqltest.t2 values (3), (4), (5), (6);
create view mysqltest.v1 (a,c) as select a, b+1 from mysqltest.t1;
create view mysqltest.v2 (a,c) as select a, b+1 from mysqltest.t1;
+create user mysqltest_1@localhost;
grant delete on mysqltest.v1 to mysqltest_1@localhost;
grant select on mysqltest.* to mysqltest_1@localhost;
use mysqltest;
@@ -250,6 +257,7 @@ delete from v2 where c < 4;
ERROR 42000: DELETE command denied to user 'mysqltest_1'@'localhost' for table 'v2'
use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
drop database mysqltest;
create database mysqltest;
create table mysqltest.t1 (a int, b int, primary key(a));
@@ -258,6 +266,7 @@ create table mysqltest.t2 (x int, y int);
insert into mysqltest.t2 values (3,4);
create view mysqltest.v1 (a,c) as select a, b from mysqltest.t1;
create view mysqltest.v2 (a,c) as select a, b from mysqltest.t1;
+create user mysqltest_1@localhost;
grant insert on mysqltest.v1 to mysqltest_1@localhost;
grant select on mysqltest.* to mysqltest_1@localhost;
use mysqltest;
@@ -280,10 +289,12 @@ insert into v2 select x,y from t2;
ERROR 42000: INSERT command denied to user 'mysqltest_1'@'localhost' for table 'v2'
use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
drop database mysqltest;
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 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;
@@ -308,18 +319,22 @@ ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column
grant update,select(b) on mysqltest.t2 to mysqltest_1@localhost;
create view v4 as select b+1 from mysqltest.t2;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
drop database mysqltest;
drop view v1,v2,v4;
create database mysqltest;
create table mysqltest.t1 (a int);
+create user mysqltest_1@localhost;
grant all privileges on mysqltest.* to mysqltest_1@localhost;
use mysqltest;
create view v1 as select * from t1;
use test;
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
drop database mysqltest;
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;
create view v1 as select * from mysqltest.t1;
@@ -333,6 +348,7 @@ grant select on mysqltest.t1 to mysqltest_1@localhost;
select * from v1;
a b
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
drop view v1;
drop database mysqltest;
create database mysqltest;
@@ -348,6 +364,7 @@ create algorithm=MERGE view v2 as select f2() from t1;
create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select f2() from t1;
create algorithm=MERGE SQL SECURITY INVOKER view v4 as select f2() from t1;
create SQL SECURITY INVOKER view v5 as select * from v4;
+create user mysqltest_1@localhost;
grant select on v1 to mysqltest_1@localhost;
grant select on v2 to mysqltest_1@localhost;
grant select on v3 to mysqltest_1@localhost;
@@ -372,6 +389,7 @@ drop function f2;
drop table t1, t2;
use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
drop database mysqltest;
create database mysqltest;
use mysqltest;
@@ -381,6 +399,7 @@ create table t2 (s1 int);
drop function if exists f2;
create function f2 () returns int begin declare v int; select s1 from t2
into v; return v; end//
+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;
@@ -409,12 +428,14 @@ drop function f2;
drop table t1, t2;
use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
drop database mysqltest;
create database mysqltest;
use mysqltest;
create table t1 (a int);
create table v1 (a int);
insert into t1 values (1);
+create user mysqltest_1@localhost;
grant select on t1 to mysqltest_1@localhost;
grant select on v1 to mysqltest_1@localhost;
grant create view on mysqltest.* to mysqltest_1@localhost;
@@ -442,6 +463,7 @@ ERROR HY000: View 'mysqltest.v5' references invalid table(s) or column(s) or fun
drop table t1;
use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
drop database mysqltest;
create database mysqltest;
use mysqltest;
@@ -452,6 +474,7 @@ create algorithm=MERGE view v2 as select *, a as b from t1;
create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select *, a as b from t1;
create algorithm=MERGE SQL SECURITY INVOKER view v4 as select *, a as b from t1;
create SQL SECURITY INVOKER view v5 as select * from v4;
+create user mysqltest_1@localhost;
grant select on v1 to mysqltest_1@localhost;
grant select on v2 to mysqltest_1@localhost;
grant select on v3 to mysqltest_1@localhost;
@@ -475,12 +498,14 @@ drop view v1, v2, v3, v4, v5;
drop table t1;
use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
drop database mysqltest;
drop view if exists v1;
drop table if exists t1;
create table t1 as select * from mysql.user where user='';
delete from mysql.user where user='';
flush privileges;
+create user 'test14256'@'%';
grant all on test.* to 'test14256'@'%';
use test;
create view v1 as select 42;
@@ -511,6 +536,7 @@ CREATE VIEW v1 AS SELECT * 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`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
+create user mysqltest_1@localhost;
GRANT SELECT, LOCK TABLES ON mysqltest.* TO mysqltest_1@localhost;
use mysqltest;
LOCK TABLES v1 READ;
@@ -853,6 +879,7 @@ INSERT INTO mysqltest1.t1 VALUES (11), (12), (13), (14);
INSERT INTO mysqltest1.t2 VALUES (21), (22), (23), (24);
INSERT INTO mysqltest1.t3 VALUES (31), (32), (33), (34);
INSERT INTO mysqltest1.t4 VALUES (41), (42), (43), (44);
+CREATE USER mysqltest_u1@localhost;
GRANT SELECT ON mysqltest1.t1 TO mysqltest_u1@localhost;
GRANT INSERT ON mysqltest1.t2 TO mysqltest_u1@localhost;
GRANT SELECT, UPDATE ON mysqltest1.t3 TO mysqltest_u1@localhost;
@@ -933,6 +960,7 @@ CREATE DATABASE db1;
USE db1;
CREATE TABLE t1(f1 INT, f2 INT);
CREATE VIEW v1 AS SELECT f1, f2 FROM t1;
+CREATE USER foo;
GRANT SELECT (f1) ON t1 TO foo;
GRANT SELECT (f1) ON v1 TO foo;
USE db1;
diff --git a/mysql-test/r/warnings_engine_disabled.result b/mysql-test/r/warnings_engine_disabled.result
index 9fcd3b934c0..d9e490ba18f 100644
--- a/mysql-test/r/warnings_engine_disabled.result
+++ b/mysql-test/r/warnings_engine_disabled.result
@@ -1,3 +1,4 @@
+set sql_mode="";
create table t1 (id int) engine=InnoDB;
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
@@ -6,6 +7,7 @@ alter table t1 engine=InnoDB;
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
drop table t1;
+set sql_mode=default;
SELECT ENGINE, SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='InnoDB';
ENGINE SUPPORT
InnoDB NO
diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result
index 24b95f0e204..b6f0f048c68 100644
--- a/mysql-test/r/xml.result
+++ b/mysql-test/r/xml.result
@@ -1161,6 +1161,8 @@ SET NAMES latin1;
SELECT UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0);
UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0)
NULL
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
#
# Bug#12375190: UPDATEXML CRASHES ON SIMPLE INPUTS
#
diff --git a/mysql-test/std_data/galera-cert.pem b/mysql-test/std_data/galera-cert.pem
new file mode 100644
index 00000000000..3b48002f47a
--- /dev/null
+++ b/mysql-test/std_data/galera-cert.pem
@@ -0,0 +1,20 @@
+-----BEGIN CERTIFICATE-----
+MIIDWTCCAkGgAwIBAgIJAIlW4JmZGnU4MA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNV
+BAYTAkZJMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1bHQg
+Q29tcGFueSBMdGQwIBcNMTQxMDI0MDc1MTU1WhgPMzAxNDAyMjQwNzUxNTVaMEIx
+CzAJBgNVBAYTAkZJMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0Rl
+ZmF1bHQgQ29tcGFueSBMdGQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
+AQDDzU6xLZDD5rZENsOpTpTmqS8YisBaefU3ZeN7VJepZZ/7unM/1YLGJtuRh2Qa
+MyTkvyjzf7bSFsDt9L5lfQwBBblVeWkrCvGnQmHDQQYB7JrSmFDPz9W9Mxf9Q2BW
+B3lcoKXXJgMnWw0WGrt0lEdFp9gWbq8H9hwJdjpyyk4ZTIuucSOD4JUP3QFEhYU5
+kdcIbDRVw81J4eAZ6EdvbjDN05S7qWjW7rJTnCHAHEd18hcsMGwjpwhjEaSdhMrM
+mhOeL8kuQV0fI8v2xfYBliIn9xBZGOVzySPzwFmQceORlW6F3V5w6mwFkmuXqXWX
+Qo98swTu7mb89qVYmR71d3L3AgMBAAGjUDBOMB0GA1UdDgQWBBRdWet/kGNTyvXK
+wuBdP/eSldOgWjAfBgNVHSMEGDAWgBRdWet/kGNTyvXKwuBdP/eSldOgWjAMBgNV
+HRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQCcJpP+DR4AJxVelNTSZa+V38c+
+jgrMD2Ku2eU8NQlsjgMfNEU5Md/g7FpP8aCFzVf0kAAT7DxZmSE3uWXQbMXyVJmy
+bF+qXinf71QzdWULm6sASoshC6wbHnXL9ZjWQ3gh1nqVgo3MmLQYrb3eJfKaaLoc
+wpjhYxVxGFOx1ITN3jED64lUfoLHvR6NFbESYKAuAAzSNqX4HOQ3uGk2THM8JocZ
+oH2+38d81Kd4HQ7DDDKS/isG0+rR60Ti1cMgu7OT7p1dZCwT/KQuI5eGjE9lubkc
+yAJjaod4rVLdBri3XVvtySfS2+/75qUgv2TF7d/s7mxMq4DDt29yeKSUhZCs
+-----END CERTIFICATE-----
diff --git a/mysql-test/std_data/galera-key.pem b/mysql-test/std_data/galera-key.pem
new file mode 100644
index 00000000000..c88c613cacf
--- /dev/null
+++ b/mysql-test/std_data/galera-key.pem
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDDzU6xLZDD5rZE
+NsOpTpTmqS8YisBaefU3ZeN7VJepZZ/7unM/1YLGJtuRh2QaMyTkvyjzf7bSFsDt
+9L5lfQwBBblVeWkrCvGnQmHDQQYB7JrSmFDPz9W9Mxf9Q2BWB3lcoKXXJgMnWw0W
+Grt0lEdFp9gWbq8H9hwJdjpyyk4ZTIuucSOD4JUP3QFEhYU5kdcIbDRVw81J4eAZ
+6EdvbjDN05S7qWjW7rJTnCHAHEd18hcsMGwjpwhjEaSdhMrMmhOeL8kuQV0fI8v2
+xfYBliIn9xBZGOVzySPzwFmQceORlW6F3V5w6mwFkmuXqXWXQo98swTu7mb89qVY
+mR71d3L3AgMBAAECggEBAIMT0UdZSp1quL/nrYqNGa9kuSuDz4uCM3+3jNcGZVU4
+vCYHxpmINLi0UK8W5ROJA3zC4AZKjDgOlW93NXK5iKyyiUTIN3hiJi4jiVDuGbh2
+DZtH7mmAKAU1zCx2y2osLLmurfbe8qOJF7ShhrZfgWsHFujFhhUdU92dsTkhZ7EU
+2NF8ScxCo4PbOJoHC3j0ApfwCMxUMAKZF5+08EeKYqK7OAXI79HeIvEbHn3cUDGm
+bvg6ykwlz2UUO4sg+xdCmn1Bt36HF/4e973Y5fkE/vd9mryHIlu9t7GJgWyUiPr8
+BGEoAWDSpPOMd/b9ivtxh9Gd+LW/uitMuBIfrRPgz9kCgYEA+JqeeD2xqF2IzZyq
+i1UqgKe3su2U2zhkgbu1h/1M/reNIZGylF0wFs3P+kNIB2NavmHjXcgSjdJzqRL9
+XEWfFJRmeARo9RTEQEVd8zp1Eo8ISeiksGgvbL4rrNIRR5V5MZytfISRiGCWN6jx
+ulJ6EieQk5EcvknGlWpJY/bBsQ0CgYEAyaCLqrR38gVl2Z0t6YlhW/HWAwGt+lf4
+apN1AS4uykx7wRW2B0y9QUDfsrYeVlbbeRPP4UzPmJez+J2cweoIIeFFyo3KP2L7
+79E3EVYywjXhPg52F7OjFA4Bp970XclIC5Al7kDufSgwZmWdceSx4Jjc5ixyQEC8
+Ad0ThgP6yxMCgYAvC4OFmZcvF1Q2JLmZWGqMojB/KbqLqaZLbqwxqduSMEYC3kF/
+FgttpVEAOQ8+ZqzbbkbKjnwEXpkIm9FaTsqF6HdjquH5zw48Y2QeDSfudSbKZb4U
+rAKdf3dgYvhmJYEjxFSIRcYMmsqSieQEsGrtWJNheYqI8AkmaVCuHBoXWQKBgQCj
+daelNffD2wJuQNI28axfiRjSiSsNuQHpDTCfS1ydnxH5QGu5UUphO4HfdWv03SfC
+6f/vDIGEmQBLvyOVxfDf3qzhAMCFUO8kxj1ZrcMq1dmMoNa2cmj0WkKXYNZFrmfd
+D/jgRf3Ss6FBcoIJErnudp8nb8MUOibxb9RjIpjQxwKBgEliKaGN+/QkPTNJ4vXz
+609CIilxpE+YVTzlv3YeZP5HqsJTJPS2ARIUr/Pjpbl3LHfYNeeGDCwgkJIK0JJH
+iA1M51q6t3zG2y9gKmC15FF0jShoZkRgqBxqrSHAnrCo5t2C48ElxJ3FEU8T75sz
+dlGTbkmR0Wm43Kh++dWICJ3g
+-----END PRIVATE KEY-----
diff --git a/mysql-test/std_data/old_decimal/t1dec102.MYD b/mysql-test/std_data/old_decimal/t1dec102.MYD
new file mode 100644
index 00000000000..59e43854d4a
--- /dev/null
+++ b/mysql-test/std_data/old_decimal/t1dec102.MYD
@@ -0,0 +1 @@
+ý 123.45ý 123.46ý 123.47 \ No newline at end of file
diff --git a/mysql-test/std_data/old_decimal/t1dec102.MYI b/mysql-test/std_data/old_decimal/t1dec102.MYI
new file mode 100644
index 00000000000..e0b2d4a003c
--- /dev/null
+++ b/mysql-test/std_data/old_decimal/t1dec102.MYI
Binary files differ
diff --git a/mysql-test/std_data/old_decimal/t1dec102.frm b/mysql-test/std_data/old_decimal/t1dec102.frm
new file mode 100644
index 00000000000..652cfc3bbac
--- /dev/null
+++ b/mysql-test/std_data/old_decimal/t1dec102.frm
Binary files differ
diff --git a/mysql-test/std_data/wsrep_notify.sh b/mysql-test/std_data/wsrep_notify.sh
new file mode 100755
index 00000000000..7036f603c84
--- /dev/null
+++ b/mysql-test/std_data/wsrep_notify.sh
@@ -0,0 +1,99 @@
+#!/bin/sh -eu
+
+# This is a simple example of wsrep notification script (wsrep_notify_cmd).
+# It will create 'wsrep' schema and two tables in it: 'membeship' and 'status'
+# and fill them on every membership or node status change.
+#
+# Edit parameters below to specify the address and login to server.
+
+USER=root
+HOST=127.0.0.1
+PORT=$NODE_MYPORT_1
+
+SCHEMA="mtr_wsrep_notify"
+MEMB_TABLE="$SCHEMA.membership"
+STATUS_TABLE="$SCHEMA.status"
+
+BEGIN="
+SET wsrep_on=0;
+CREATE SCHEMA IF NOT EXISTS $SCHEMA;
+CREATE TABLE IF NOT EXISTS $MEMB_TABLE (
+ idx INT,
+ uuid CHAR(40), /* node UUID */
+ name VARCHAR(32), /* node name */
+ addr VARCHAR(256) /* node address */
+) ENGINE=MEMORY;
+CREATE TABLE IF NOT EXISTS $STATUS_TABLE (
+ size INT, /* component size */
+ idx INT, /* this node index */
+ status CHAR(16), /* this node status */
+ uuid CHAR(40), /* cluster UUID */
+ prim BOOLEAN /* if component is primary */
+) ENGINE=MEMORY;
+BEGIN;
+"
+END="COMMIT;"
+
+configuration_change()
+{
+ echo "$BEGIN;"
+
+ local idx=0
+
+ for NODE in $(echo $MEMBERS | sed s/,/\ /g)
+ do
+ echo "INSERT INTO $MEMB_TABLE VALUES ( $idx, "
+ # Don't forget to properly quote string values
+ echo "'$NODE'" | sed s/\\//\',\'/g
+ echo ");"
+ idx=$(( $idx + 1 ))
+ done
+
+ echo "INSERT INTO $STATUS_TABLE VALUES($idx, $INDEX, '$STATUS', '$CLUSTER_UUID', $PRIMARY);"
+
+ echo "$END"
+}
+
+status_update()
+{
+ echo "SET wsrep_on=0; BEGIN; UPDATE $STATUS_TABLE SET status='$STATUS'; COMMIT;"
+}
+
+COM=status_update # not a configuration change by default
+
+while [ $# -gt 0 ]
+do
+ case $1 in
+ --status)
+ STATUS=$2
+ shift
+ ;;
+ --uuid)
+ CLUSTER_UUID=$2
+ shift
+ ;;
+ --primary)
+ [ "$2" = "yes" ] && PRIMARY="1" || PRIMARY="0"
+ COM=configuration_change
+ shift
+ ;;
+ --index)
+ INDEX=$2
+ shift
+ ;;
+ --members)
+ MEMBERS=$2
+ shift
+ ;;
+ esac
+ shift
+done
+
+# Undefined means node is shutting down
+if [ "$STATUS" != "Undefined" ]
+then
+ $COM | mysql -B -u$USER -h$HOST -P$PORT
+fi
+
+exit 0
+#
diff --git a/mysql-test/suite/archive/archive_gis.result b/mysql-test/suite/archive/archive_gis.result
index 9f3c5b062a3..6ee50fd3b85 100644
--- a/mysql-test/suite/archive/archive_gis.result
+++ b/mysql-test/suite/archive/archive_gis.result
@@ -395,7 +395,7 @@ first second w c o e d t i r
120 120 1 1 0 1 0 0 1 0
120 121 0 0 1 0 0 0 1 0
121 120 0 0 1 0 0 0 1 0
-121 121 1 1 0 1 0 1 1 0
+121 121 1 1 0 1 0 0 1 0
explain extended SELECT g1.fid as first, g2.fid as second,
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
@@ -494,7 +494,7 @@ mbroverlaps
down,left,right,up
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrtouches
-big,center,down,down2,left,left2,right,right2,small,up,up2
+down2,left2,right2,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrwithin
big,center
@@ -515,7 +515,7 @@ overlaps
down,left,right,up
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
touches
-big,center,down,down2,left,left2,right,right2,small,up,up2
+down2,left2,right2,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
within
big,center
diff --git a/mysql-test/suite/archive/archive_plugin.result b/mysql-test/suite/archive/archive_plugin.result
index 90c1f10bf19..5656704989e 100644
--- a/mysql-test/suite/archive/archive_plugin.result
+++ b/mysql-test/suite/archive/archive_plugin.result
@@ -1,11 +1,8 @@
CREATE TABLE t1(a int) ENGINE=ARCHIVE;
-Warnings:
-Warning 1286 Unknown storage engine 'ARCHIVE'
-Warning 1266 Using storage engine MyISAM for table 't1'
-DROP TABLE t1;
+ERROR 42000: Unknown storage engine 'ARCHIVE'
INSTALL PLUGIN archive SONAME 'ha_archive.so';
INSTALL PLUGIN ARCHIVE SONAME 'ha_archive.so';
-ERROR HY000: Function 'ARCHIVE' already exists
+ERROR HY000: Plugin 'ARCHIVE' already installed
UNINSTALL PLUGIN archive;
INSTALL PLUGIN archive SONAME 'ha_archive.so';
CREATE TABLE t1(a int) ENGINE=ARCHIVE;
diff --git a/mysql-test/suite/archive/archive_plugin.test b/mysql-test/suite/archive/archive_plugin.test
index ba80652fb02..69bf9a5f4ce 100644
--- a/mysql-test/suite/archive/archive_plugin.test
+++ b/mysql-test/suite/archive/archive_plugin.test
@@ -2,12 +2,12 @@ if (!$HA_ARCHIVE_SO) {
--skip Need archive plugin
}
+--error ER_UNKNOWN_STORAGE_ENGINE
CREATE TABLE t1(a int) ENGINE=ARCHIVE;
-DROP TABLE t1;
--replace_regex /\.dll/.so/
eval INSTALL PLUGIN archive SONAME '$HA_ARCHIVE_SO';
--replace_regex /\.dll/.so/
---error 1125
+--error ER_PLUGIN_INSTALLED
eval INSTALL PLUGIN ARCHIVE SONAME '$HA_ARCHIVE_SO';
UNINSTALL PLUGIN archive;
diff --git a/mysql-test/suite/archive/discover_5438.result b/mysql-test/suite/archive/discover_5438.result
index b5ab56aa364..0cd44c40a4e 100644
--- a/mysql-test/suite/archive/discover_5438.result
+++ b/mysql-test/suite/archive/discover_5438.result
@@ -3,6 +3,7 @@ create view t1 as select "I am a view" as a;
ERROR 42S01: Table 't1' already exists
drop table t1;
create table t1 (a int) engine=archive;
+create user foo@bar;
grant select on test.t1 to foo@bar;
drop user foo@bar;
drop table t1;
diff --git a/mysql-test/suite/archive/discover_5438.test b/mysql-test/suite/archive/discover_5438.test
index c05955baaf3..892b9d49592 100644
--- a/mysql-test/suite/archive/discover_5438.test
+++ b/mysql-test/suite/archive/discover_5438.test
@@ -12,6 +12,7 @@ create view t1 as select "I am a view" as a;
drop table t1;
create table t1 (a int) engine=archive;
+create user foo@bar;
grant select on test.t1 to foo@bar;
drop user foo@bar;
drop table t1;
diff --git a/mysql-test/suite/binlog/r/binlog_grant.result b/mysql-test/suite/binlog/r/binlog_grant.result
index 09a3d709929..618e00af72a 100644
--- a/mysql-test/suite/binlog/r/binlog_grant.result
+++ b/mysql-test/suite/binlog/r/binlog_grant.result
@@ -22,6 +22,7 @@ ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) fo
**** Clean up ****
set global binlog_format = @saved_binlog_format;
drop user mysqltest_1@localhost;
+CREATE USER 'mysqltest_1'@'localhost';
GRANT REPLICATION CLIENT ON *.* TO 'mysqltest_1'@'localhost';
SHOW MASTER LOGS;
SHOW BINARY LOGS;
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result
index 7581a9a7cad..2719091f4dd 100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result
@@ -1,3 +1,4 @@
+set sql_mode="";
drop table if exists t1;
reset master;
set @a=UNIX_TIMESTAMP("2020-01-21 15:32:22");
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
index 714c01d8426..da48f4b2641 100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
@@ -327,6 +327,18 @@ INSERT INTO t2 SET a=1;
INSERT INTO t2 SET b=1;
UPDATE t1, t2 SET t1.a=10, t2.a=20;
DROP TABLE t1,t2;
+INSERT INTO t1dec102 VALUES (-999.99);
+INSERT INTO t1dec102 VALUES (0);
+INSERT INTO t1dec102 VALUES (999.99);
+SELECT * FROM t1dec102 ORDER BY a;
+a
+-999.99
+0.00
+123.45
+123.46
+123.47
+999.99
+DROP TABLE t1dec102;
flush logs;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
@@ -351,7 +363,7 @@ use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
-SET @@session.sql_mode=0/*!*/;
+SET @@session.sql_mode=1342177280/*!*/;
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/*!*/;
@@ -4555,6 +4567,62 @@ SET TIMESTAMP=1000000000/*!*/;
DROP TABLE `t1`,`t2` /* generated by server */
/*!*/;
# at #
+#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-317
+/*!100001 SET @@session.gtid_seq_no=317*//*!*/;
+BEGIN
+/*!*/;
+# at #
+# at #
+#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1dec102` mapped to number #
+#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
+### INSERT INTO `test`.`t1dec102`
+### SET
+### @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # at #
+#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
+SET TIMESTAMP=1000000000/*!*/;
+COMMIT
+/*!*/;
+# at #
+#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-318
+/*!100001 SET @@session.gtid_seq_no=318*//*!*/;
+BEGIN
+/*!*/;
+# at #
+# at #
+#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1dec102` mapped to number #
+#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
+### INSERT INTO `test`.`t1dec102`
+### SET
+### @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # at #
+#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
+SET TIMESTAMP=1000000000/*!*/;
+COMMIT
+/*!*/;
+# at #
+#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-319
+/*!100001 SET @@session.gtid_seq_no=319*//*!*/;
+BEGIN
+/*!*/;
+# at #
+# at #
+#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1dec102` mapped to number #
+#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
+### INSERT INTO `test`.`t1dec102`
+### SET
+### @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # at #
+#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
+SET TIMESTAMP=1000000000/*!*/;
+COMMIT
+/*!*/;
+# at #
+#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-320 ddl
+/*!100001 SET @@session.gtid_seq_no=320*//*!*/;
+# at #
+#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
+SET TIMESTAMP=1000000000/*!*/;
+DROP TABLE `t1dec102` /* generated by server */
+/*!*/;
+# at #
#010909 4:46:40 server id 1 end_log_pos # Rotate to master-bin.000002 pos: 4
DELIMITER ;
# End of log file
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result
index 21b3d4f63be..a5e4d39eb5f 100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result
@@ -1,3 +1,4 @@
+set sql_mode="";
SET NAMES 'utf8';
#
# Preparatory cleanup.
@@ -4817,7 +4818,14 @@ LOAD DATA INFILE '../../std_data/loaddata5.dat'
INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (c1,c2)
SET c3 = 'Wow';
affected rows: 3
-info: Records: 3 Deleted: 0 Skipped: 0 Warnings: 0
+info: Records: 3 Deleted: 0 Skipped: 0 Warnings: 6
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c1' at row 2
+Note 1265 Data truncated for column 'c2' at row 2
+Note 1265 Data truncated for column 'c1' at row 3
+Note 1265 Data truncated for column 'c2' at row 3
#
# Show what we have in the table.
#
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result
index 5dea7c79bdb..43c6d9c51b7 100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result
@@ -1,3 +1,4 @@
+set sql_mode="";
SET NAMES 'utf8';
#
# Preparatory cleanup.
@@ -4856,7 +4857,14 @@ LOAD DATA INFILE '../../std_data/loaddata5.dat'
INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (c1,c2)
SET c3 = 'Wow';
affected rows: 3
-info: Records: 3 Deleted: 0 Skipped: 0 Warnings: 0
+info: Records: 3 Deleted: 0 Skipped: 0 Warnings: 6
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c1' at row 2
+Note 1265 Data truncated for column 'c2' at row 2
+Note 1265 Data truncated for column 'c1' at row 3
+Note 1265 Data truncated for column 'c2' at row 3
#
# Show what we have in the table.
#
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result
index ad1a6ede9b7..92e8438094f 100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result
@@ -147,7 +147,7 @@ use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
-SET @@session.sql_mode=0/*!*/;
+SET @@session.sql_mode=1342177280/*!*/;
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/suite/binlog/r/binlog_row_ctype_cp932.result b/mysql-test/suite/binlog/r/binlog_row_ctype_cp932.result
index c34ccdf5601..346b7a58179 100644
--- a/mysql-test/suite/binlog/r/binlog_row_ctype_cp932.result
+++ b/mysql-test/suite/binlog/r/binlog_row_ctype_cp932.result
@@ -11499,9 +11499,21 @@ 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
@@ -11594,9 +11606,21 @@ 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
diff --git a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result
index c446c0f4861..6b56c006518 100644
--- a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result
+++ b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result
@@ -20,7 +20,7 @@ BEGIN
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=0/*!*/;
+SET @@session.sql_mode=1342177280/*!*/;
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/suite/binlog/r/binlog_row_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
index 22434790686..35607ea7f95 100644
--- a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
+++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
@@ -259,7 +259,7 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
create table t0 (n int);
insert t0 select * from t1;
set autocommit=1;
-insert into t0 select GET_LOCK("lock1",null);
+insert into t0 select GET_LOCK("lock1",0);
set autocommit=0;
create table t2 (n int) engine=innodb;
insert into t2 values (3);
diff --git a/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result b/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result
index f2722924b6a..ad5d0500d19 100644
--- a/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result
+++ b/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result
@@ -51,7 +51,7 @@ use `new_test1`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
-SET @@session.sql_mode=0/*!*/;
+SET @@session.sql_mode=1342177280/*!*/;
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/*!*/;
@@ -263,7 +263,7 @@ use `new_test1`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
-SET @@session.sql_mode=0/*!*/;
+SET @@session.sql_mode=1342177280/*!*/;
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/suite/binlog/r/binlog_stm_ctype_cp932.result b/mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result
index c34ccdf5601..346b7a58179 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result
@@ -11499,9 +11499,21 @@ 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
@@ -11594,9 +11606,21 @@ 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
diff --git a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result
index 55db2de4b52..825b9bf05a0 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result
@@ -22,7 +22,7 @@ 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=0/*!*/;
+SET @@session.sql_mode=1342177280/*!*/;
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/suite/binlog/r/binlog_stm_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
index 10f3f5ddf2a..0ac4716f383 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
@@ -243,7 +243,7 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
create table t0 (n int);
insert t0 select * from t1;
set autocommit=1;
-insert into t0 select GET_LOCK("lock1",null);
+insert into t0 select GET_LOCK("lock1",0);
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
set autocommit=0;
@@ -293,7 +293,7 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; insert t0 select * from t1
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
-master-bin.000001 # Query # # use `test`; insert into t0 select GET_LOCK("lock1",null)
+master-bin.000001 # Query # # use `test`; insert into t0 select GET_LOCK("lock1",0)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t2 (n int) engine=innodb
diff --git a/mysql-test/suite/binlog/r/binlog_variables_log_bin.result b/mysql-test/suite/binlog/r/binlog_variables_log_bin.result
new file mode 100644
index 00000000000..215e14f97df
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_variables_log_bin.result
@@ -0,0 +1,9 @@
+SHOW VARIABLES LIKE 'log_bin%';
+Variable_name log_bin
+Value ON
+Variable_name log_bin_basename
+Value MYSQLTEST_VARDIR/mysqld.1/data/other
+Variable_name log_bin_index
+Value MYSQLTEST_VARDIR/mysqld.1/data/mysqld-bin.index
+Variable_name log_bin_trust_function_creators
+Value ON
diff --git a/mysql-test/suite/binlog/r/binlog_variables_log_bin_index.result b/mysql-test/suite/binlog/r/binlog_variables_log_bin_index.result
new file mode 100644
index 00000000000..fb7324ced34
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_variables_log_bin_index.result
@@ -0,0 +1,9 @@
+SHOW VARIABLES LIKE 'log_bin%';
+Variable_name log_bin
+Value ON
+Variable_name log_bin_basename
+Value MYSQLTEST_VARDIR/mysqld.1/data/other
+Variable_name log_bin_index
+Value MYSQLTEST_VARDIR/tmp/something.index
+Variable_name log_bin_trust_function_creators
+Value ON
diff --git a/mysql-test/suite/binlog/r/binlog_variables_relay_log.result b/mysql-test/suite/binlog/r/binlog_variables_relay_log.result
new file mode 100644
index 00000000000..59135837c29
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_variables_relay_log.result
@@ -0,0 +1,15 @@
+SHOW VARIABLES LIKE 'relay_log%';
+Variable_name relay_log
+Value other-relay
+Variable_name relay_log_basename
+Value MYSQLTEST_VARDIR/mysqld.1/data/other-relay
+Variable_name relay_log_index
+Value MYSQLTEST_VARDIR/mysqld.1/data/mysqld-relay-bin.index
+Variable_name relay_log_info_file
+Value relay-log.info
+Variable_name relay_log_purge
+Value ON
+Variable_name relay_log_recovery
+Value OFF
+Variable_name relay_log_space_limit
+Value 0
diff --git a/mysql-test/suite/binlog/r/binlog_variables_relay_log_index.result b/mysql-test/suite/binlog/r/binlog_variables_relay_log_index.result
new file mode 100644
index 00000000000..1b18b89d298
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_variables_relay_log_index.result
@@ -0,0 +1,15 @@
+SHOW VARIABLES LIKE 'relay_log%';
+Variable_name relay_log
+Value other-relay
+Variable_name relay_log_basename
+Value MYSQLTEST_VARDIR/mysqld.1/data/other-relay
+Variable_name relay_log_index
+Value MYSQLTEST_VARDIR/tmp/something-relay.index
+Variable_name relay_log_info_file
+Value relay-log.info
+Variable_name relay_log_purge
+Value ON
+Variable_name relay_log_recovery
+Value OFF
+Variable_name relay_log_space_limit
+Value 0
diff --git a/mysql-test/suite/binlog/t/binlog_grant.test b/mysql-test/suite/binlog/t/binlog_grant.test
index 0c9d9a45ec9..8a76b11e707 100644
--- a/mysql-test/suite/binlog/t/binlog_grant.test
+++ b/mysql-test/suite/binlog/t/binlog_grant.test
@@ -58,6 +58,7 @@ drop user mysqltest_1@localhost;
# Testing if REPLICATION CLIENT privilege is enough to execute
# SHOW MASTER LOGS and SHOW BINARY.
+CREATE USER 'mysqltest_1'@'localhost';
GRANT REPLICATION CLIENT ON *.* TO 'mysqltest_1'@'localhost';
--connect(rpl,localhost,mysqltest_1,,)
diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test
index 367314d9643..76d6abf4d18 100644
--- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test
@@ -5,6 +5,7 @@
-- source include/have_binlog_format_mixed_or_statement.inc
-- source include/binlog_start_pos.inc
+set sql_mode="";
--disable_warnings
drop table if exists t1;
--enable_warnings
diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test
index 9b41c63d195..9609a9af384 100644
--- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test
@@ -438,9 +438,20 @@ INSERT INTO t2 SET b=1;
UPDATE t1, t2 SET t1.a=10, t2.a=20;
DROP TABLE t1,t2;
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--copy_file std_data/old_decimal/t1dec102.frm $MYSQLD_DATADIR/test/t1dec102.frm
+--copy_file std_data/old_decimal/t1dec102.MYD $MYSQLD_DATADIR/test/t1dec102.MYD
+--copy_file std_data/old_decimal/t1dec102.MYI $MYSQLD_DATADIR/test/t1dec102.MYI
+
+INSERT INTO t1dec102 VALUES (-999.99);
+INSERT INTO t1dec102 VALUES (0);
+INSERT INTO t1dec102 VALUES (999.99);
+SELECT * FROM t1dec102 ORDER BY a;
+DROP TABLE t1dec102;
+
flush logs;
-let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/
--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
diff --git a/mysql-test/suite/binlog/t/binlog_row_annotate.test b/mysql-test/suite/binlog/t/binlog_row_annotate.test
index a0f72c9222c..e831b29df00 100644
--- a/mysql-test/suite/binlog/t/binlog_row_annotate.test
+++ b/mysql-test/suite/binlog/t/binlog_row_annotate.test
@@ -24,6 +24,8 @@
--disable_query_log
+set sql_mode="";
+
# Fix timestamp to avoid varying results
SET timestamp=1000000000;
diff --git a/mysql-test/suite/binlog/t/binlog_variables_log_bin-master.opt b/mysql-test/suite/binlog/t/binlog_variables_log_bin-master.opt
new file mode 100644
index 00000000000..85d14ea7af9
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_variables_log_bin-master.opt
@@ -0,0 +1 @@
+--log-bin=other
diff --git a/mysql-test/suite/binlog/t/binlog_variables_log_bin.test b/mysql-test/suite/binlog/t/binlog_variables_log_bin.test
new file mode 100644
index 00000000000..d94d565d004
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_variables_log_bin.test
@@ -0,0 +1,4 @@
+--source include/not_embedded.inc
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--query_vertical SHOW VARIABLES LIKE 'log_bin%'
diff --git a/mysql-test/suite/binlog/t/binlog_variables_log_bin_index-master.opt b/mysql-test/suite/binlog/t/binlog_variables_log_bin_index-master.opt
new file mode 100644
index 00000000000..68e580bd205
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_variables_log_bin_index-master.opt
@@ -0,0 +1,2 @@
+--log-bin=other
+--log-bin-index=$MYSQLTEST_VARDIR/tmp/something.index
diff --git a/mysql-test/suite/binlog/t/binlog_variables_log_bin_index.test b/mysql-test/suite/binlog/t/binlog_variables_log_bin_index.test
new file mode 100644
index 00000000000..d94d565d004
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_variables_log_bin_index.test
@@ -0,0 +1,4 @@
+--source include/not_embedded.inc
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--query_vertical SHOW VARIABLES LIKE 'log_bin%'
diff --git a/mysql-test/suite/binlog/t/binlog_variables_relay_log-master.opt b/mysql-test/suite/binlog/t/binlog_variables_relay_log-master.opt
new file mode 100644
index 00000000000..a01432d7a17
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_variables_relay_log-master.opt
@@ -0,0 +1 @@
+--relay-log=other-relay
diff --git a/mysql-test/suite/binlog/t/binlog_variables_relay_log.test b/mysql-test/suite/binlog/t/binlog_variables_relay_log.test
new file mode 100644
index 00000000000..1e987901986
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_variables_relay_log.test
@@ -0,0 +1,4 @@
+--source include/not_embedded.inc
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--query_vertical SHOW VARIABLES LIKE 'relay_log%'
diff --git a/mysql-test/suite/binlog/t/binlog_variables_relay_log_index-master.opt b/mysql-test/suite/binlog/t/binlog_variables_relay_log_index-master.opt
new file mode 100644
index 00000000000..eeabaca11a0
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_variables_relay_log_index-master.opt
@@ -0,0 +1,2 @@
+--relay-log=other-relay
+--relay-log-index=$MYSQLTEST_VARDIR/tmp/something-relay.index
diff --git a/mysql-test/suite/binlog/t/binlog_variables_relay_log_index.test b/mysql-test/suite/binlog/t/binlog_variables_relay_log_index.test
new file mode 100644
index 00000000000..1e987901986
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_variables_relay_log_index.test
@@ -0,0 +1,4 @@
+--source include/not_embedded.inc
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--query_vertical SHOW VARIABLES LIKE 'relay_log%'
diff --git a/mysql-test/suite/encryption/disabled.def b/mysql-test/suite/encryption/disabled.def
index 6e8f566452c..8c0d47983fd 100644
--- a/mysql-test/suite/encryption/disabled.def
+++ b/mysql-test/suite/encryption/disabled.def
@@ -13,3 +13,5 @@
innodb_scrub : MDEV-8139
innodb_scrub_compressed : MDEV-8139
innodb_scrub_background : MDEV-8139
+innodb_encryption-page-compression : Fails with lost connection at line 156
+
diff --git a/mysql-test/suite/encryption/include/have_file_key_management_plugin.inc b/mysql-test/suite/encryption/include/have_file_key_management_plugin.inc
index 8f0634a9076..06fbb510d6b 100644
--- a/mysql-test/suite/encryption/include/have_file_key_management_plugin.inc
+++ b/mysql-test/suite/encryption/include/have_file_key_management_plugin.inc
@@ -1,4 +1,4 @@
-if (!$FILE_KEY_MANAGEMENT_SO)
+if (`SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME = 'file_key_management' AND PLUGIN_STATUS='ACTIVE'`)
{
- --skip Needs file_key_management
+ --skip Test requires file_key_management plugin
}
diff --git a/mysql-test/suite/encryption/r/encryption_create_or_replace.result b/mysql-test/suite/encryption/r/create_or_replace.result
index c30855a258b..54d41972e7c 100644
--- a/mysql-test/suite/encryption/r/encryption_create_or_replace.result
+++ b/mysql-test/suite/encryption/r/create_or_replace.result
@@ -13,5 +13,9 @@ INSERT IGNORE INTO `table0_int_autoinc` ( `col_int_key` ) VALUES ( 1 ), ( 3 ), (
INSERT IGNORE INTO `table1_int_autoinc` ( `col_int` ) VALUES ( 1 ), ( 0 ), ( 7 ), ( 9 );
INSERT IGNORE INTO `table10_int_autoinc` ( `col_int` ) VALUES ( 6 ), ( 2 ), ( 3 ), ( 6 );
drop table if exists create_or_replace_t, table1_int_autoinc, table0_int_autoinc, table10_int_autoinc;
+SET GLOBAL innodb_encrypt_tables = OFF;
+SET GLOBAL innodb_encryption_threads = 4;
+# Wait max 10 min for key encryption threads to decrypt all spaces
+# Success!
SET GLOBAL innodb_encryption_threads = 0;
SET GLOBAL innodb_encrypt_tables = OFF;
diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change.result b/mysql-test/suite/encryption/r/innodb-bad-key-change.result
new file mode 100644
index 00000000000..1026e0e62ab
--- /dev/null
+++ b/mysql-test/suite/encryption/r/innodb-bad-key-change.result
@@ -0,0 +1,137 @@
+call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
+call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed.*");
+call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
+call mtr.add_suppression("InnoDB: Block in space_id .* in file test/.* encrypted");
+call mtr.add_suppression("InnoDB: However key management plugin or used key_id .* is not found or used encryption algorithm or method does not match.");
+call mtr.add_suppression("InnoDB: Marking tablespace as missing. You may drop this table or install correct key management plugin and key file.");
+call mtr.add_suppression(".*InnoDB: Cannot open table test/.* from the internal data dictionary of InnoDB though the .frm file for the table exists. See .* for how you can resolve the problem.");
+call mtr.add_suppression("InnoDB: .ibd file is missing for table test/.*");
+call mtr.add_suppression("mysqld: File .*");
+call mtr.add_suppression("InnoDB: Tablespace id .* is encrypted but encryption service or used key_id .* is not available. Can't continue opening tablespace.");
+
+# Start server with keys2.txt
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+CREATE TABLE t1 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=2;
+INSERT INTO t1 VALUES ('foobar');
+ALTER TABLE t1 ADD COLUMN c2 INT;
+INSERT INTO t1 VALUES ('foobar',2);
+SELECT * FROM t1;
+c c2
+foobar NULL
+foobar 2
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+c c2
+INSERT INTO t1 VALUES ('foobar',1);
+INSERT INTO t1 VALUES ('foobar',2);
+FLUSH TABLE WITH READ LOCK;
+SELECT * FROM t1;
+c c2
+foobar 1
+foobar 2
+
+# Restart server with keysbad3.txt
+SELECT * FROM t1;
+ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+SHOW WARNINGS;
+Level Code Message
+Warning 1812 Tablespace is missing for table 'test/t1'
+Warning 192 Table test/t1 is encrypted but encryption service or used key_id 2 is not available. Can't continue reading table.
+Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+DROP TABLE t1;
+# Start server with keys.txt
+CREATE TABLE t2 (c VARCHAR(8), id int not null primary key, b int, key(b)) ENGINE=InnoDB ENCRYPTED=YES;
+INSERT INTO t2 VALUES ('foobar',1,2);
+
+# Restart server with keys2.txt
+SELECT * FROM t2;
+ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+SHOW WARNINGS;
+Level Code Message
+Warning 192 Table test/t2 in tablespace 7 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
+Warning 192 Table test/t2 in tablespace 7 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
+Warning 192 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
+Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+SELECT * FROM t2 where id = 1;
+ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+SHOW WARNINGS;
+Level Code Message
+Warning 1812 Tablespace is missing for table 'test/t2'
+Warning 192 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
+Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+SELECT * FROM t2 where b = 1;
+ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+SHOW WARNINGS;
+Level Code Message
+Warning 1812 Tablespace is missing for table 'test/t2'
+Warning 192 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
+Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+INSERT INTO t2 VALUES ('tmp',3,3);
+ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+SHOW WARNINGS;
+Level Code Message
+Warning 1812 Tablespace is missing for table 'test/t2'
+Warning 192 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
+Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+DELETE FROM t2 where b = 3;
+ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+SHOW WARNINGS;
+Level Code Message
+Warning 1812 Tablespace is missing for table 'test/t2'
+Warning 192 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
+Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+DELETE FROM t2 where id = 3;
+ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+SHOW WARNINGS;
+Level Code Message
+Warning 1812 Tablespace is missing for table 'test/t2'
+Warning 192 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
+Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+UPDATE t2 set b = b +1;
+ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+SHOW WARNINGS;
+Level Code Message
+Warning 1812 Tablespace is missing for table 'test/t2'
+Warning 192 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
+Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+OPTIMIZE TABLE t2;
+Table Op Msg_type Msg_text
+test.t2 optimize Warning Tablespace is missing for table 'test/t2'
+test.t2 optimize Warning Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
+test.t2 optimize Error Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+test.t2 optimize error Corrupt
+SHOW WARNINGS;
+Level Code Message
+ALTER TABLE t2 ADD COLUMN c INT;
+ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+SHOW WARNINGS;
+Level Code Message
+Warning 1812 Tablespace is missing for table 'test/t2'
+Warning 192 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
+Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+ANALYZE TABLE t2;
+Table Op Msg_type Msg_text
+test.t2 analyze Warning Tablespace is missing for table 'test/t2'
+test.t2 analyze Warning Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
+test.t2 analyze Error Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+test.t2 analyze error Corrupt
+SHOW WARNINGS;
+Level Code Message
+TRUNCATE TABLE t2;
+ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+SHOW WARNINGS;
+Level Code Message
+Warning 1812 Tablespace is missing for table 'test/t2'
+Warning 192 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
+Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+DROP TABLE t2;
+ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+SHOW WARNINGS;
+Level Code Message
+Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+
+# Restart server with keys.txt
+DROP TABLE t2;
+SHOW WARNINGS;
+Level Code Message
diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change2.result b/mysql-test/suite/encryption/r/innodb-bad-key-change2.result
new file mode 100644
index 00000000000..ea760e7a213
--- /dev/null
+++ b/mysql-test/suite/encryption/r/innodb-bad-key-change2.result
@@ -0,0 +1,26 @@
+call mtr.add_suppression("InnoDB: Block in space_id .* in file test/.* encrypted");
+call mtr.add_suppression("InnoDB: However key management plugin or used key_id 1 is not found or used encryption algorithm or method does not match.");
+call mtr.add_suppression("InnoDB: Marking tablespace as missing. You may drop this table or install correct key management plugin and key file.");
+call mtr.add_suppression(".*InnoDB: Cannot open table test/.* from the internal data dictionary of InnoDB though the .frm file for the table exists. See .* for how you can resolve the problem.");
+call mtr.add_suppression("InnoDB: .ibd file is missing for table test/.*");
+call mtr.add_suppression("Couldn't load plugins from 'file_key_management*");
+CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
+INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
+select * from t1;
+ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+show warnings;
+Level Code Message
+Warning 192 Table test/t1 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
+Warning 192 Table test/t1 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
+Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+alter table t1 discard tablespace;
+ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+show warnings;
+Level Code Message
+Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+alter table t1 engine=InnoDB;
+ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+show warnings;
+Level Code Message
+Warning 192 Table test/t1 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
+Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change3.result b/mysql-test/suite/encryption/r/innodb-bad-key-change3.result
new file mode 100644
index 00000000000..68d8552a0a3
--- /dev/null
+++ b/mysql-test/suite/encryption/r/innodb-bad-key-change3.result
@@ -0,0 +1,44 @@
+call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded");
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+set global innodb_compression_algorithm = 1;
+CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(255)) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
+SHOW WARNINGS;
+Level Code Message
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `pk` int(11) NOT NULL,
+ `f` varchar(255) DEFAULT NULL,
+ PRIMARY KEY (`pk`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `ENCRYPTED`=YES `ENCRYPTION_KEY_ID`=4
+INSERT INTO t1 VALUES (1,'foobar'),(2,'barfoo');
+FLUSH TABLE t1 FOR EXPORT;
+# List before copying files
+t1.cfg
+t1.frm
+t1.ibd
+UNLOCK TABLES;
+# Tablespaces should be still encrypted
+# t1 yes on expecting NOT FOUND
+NOT FOUND /foobar/ in t1.ibd
+ALTER TABLE t1 DISCARD TABLESPACE;
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+# List after t1 DISCARD
+t1.frm
+ALTER TABLE t1 IMPORT TABLESPACE;
+ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `pk` int(11) NOT NULL,
+ `f` varchar(255) DEFAULT NULL,
+ PRIMARY KEY (`pk`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `ENCRYPTED`=YES `ENCRYPTION_KEY_ID`=4
+SELECT * FROM t1;
+ERROR HY000: Tablespace has been discarded for table 't1'
+# Tablespaces should be still encrypted
+# t1 yes on expecting NOT FOUND
+NOT FOUND /foobar/ in t1.ibd
+DROP TABLE t1;
diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change4.result b/mysql-test/suite/encryption/r/innodb-bad-key-change4.result
new file mode 100644
index 00000000000..531ba4063a4
--- /dev/null
+++ b/mysql-test/suite/encryption/r/innodb-bad-key-change4.result
@@ -0,0 +1,20 @@
+call mtr.add_suppression("InnoDB: Block in space_id .* in file test/.* encrypted");
+call mtr.add_suppression("InnoDB: However key management plugin or used key_id 1 is not found or used encryption algorithm or method does not match.");
+call mtr.add_suppression("InnoDB: Marking tablespace as missing. You may drop this table or install correct key management plugin and key file.");
+call mtr.add_suppression(".*InnoDB: Cannot open table test/.* from the internal data dictionary of InnoDB though the .frm file for the table exists. See .* for how you can resolve the problem.");
+call mtr.add_suppression("InnoDB: .ibd file is missing for table test/.*");
+call mtr.add_suppression("Couldn't load plugins from 'file_key_management*");
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
+INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check Warning Table test/t1 in tablespace 4 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
+test.t1 check Warning Table test/t1 is encrypted but encryption service or used key_id is not available. Can't continue checking table.
+test.t1 check error Corrupt
+SHOW WARNINGS;
+Level Code Message
+DROP TABLE t1;
diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change5.result b/mysql-test/suite/encryption/r/innodb-bad-key-change5.result
new file mode 100644
index 00000000000..11130a7a20b
--- /dev/null
+++ b/mysql-test/suite/encryption/r/innodb-bad-key-change5.result
@@ -0,0 +1,28 @@
+call mtr.add_suppression("InnoDB: Block in space_id .* in file test/.* encrypted");
+call mtr.add_suppression("InnoDB: However key management plugin or used key_id 1 is not found or used encryption algorithm or method does not match.");
+call mtr.add_suppression("InnoDB: Marking tablespace as missing. You may drop this table or install correct key management plugin and key file.");
+call mtr.add_suppression(".*InnoDB: Cannot open table test/.* from the internal data dictionary of InnoDB though the .frm file for the table exists. See .* for how you can resolve the problem.");
+call mtr.add_suppression("InnoDB: .ibd file is missing for table test/.*");
+call mtr.add_suppression("Couldn't load plugins from 'file_key_management*");
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
+INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize Warning Table test/t1 is encrypted but encryption service or used key_id is not available. Can't continue checking table.
+test.t1 optimize Warning InnoDB: Cannot defragment table test/t1: returned error code 192
+
+test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize error Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+test.t1 optimize status Operation failed
+Warnings:
+Warning 192 Table test/t1 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
+Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+SHOW WARNINGS;
+Level Code Message
+Warning 192 Table test/t1 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
+Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+DROP TABLE t1;
diff --git a/mysql-test/suite/encryption/r/innodb-page_encryption.result b/mysql-test/suite/encryption/r/innodb-page_encryption.result
index e8035a537be..c4814983af4 100644
--- a/mysql-test/suite/encryption/r/innodb-page_encryption.result
+++ b/mysql-test/suite/encryption/r/innodb-page_encryption.result
@@ -1,12 +1,27 @@
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
+show warnings;
+Level Code Message
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1;
+show warnings;
+Level Code Message
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=2;
+show warnings;
+Level Code Message
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=3;
ERROR HY000: Can't create table `test`.`innodb_dynamic` (errno: 140 "Wrong create options")
+show warnings;
+Level Code Message
+Warning 140 InnoDB: ENCRYPTION_KEY_ID 3 not available
+Error 1005 Can't create table `test`.`innodb_dynamic` (errno: 140 "Wrong create options")
+Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=33;
+show warnings;
+Level Code Message
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=4;
+show warnings;
+Level Code Message
set innodb_default_encryption_key_id = 5;
create table innodb_defkey(c1 bigint not null, b char(200)) engine=innodb encrypted=yes;
show create table innodb_defkey;
@@ -99,10 +114,10 @@ select count(*) from innodb_defkey t1, innodb_normal t2 where
t1.c1 = t2.c1 and t1.b = t2.b;
count(*)
2000
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
variable_value >= 0
1
SET GLOBAL innodb_file_format = `Barracuda`;
@@ -148,10 +163,10 @@ select count(*) from innodb_defkey t1, innodb_normal t2 where
t1.c1 = t2.c1 and t1.b = t2.b;
count(*)
2000
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
variable_value >= 0
1
alter table innodb_compact engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
@@ -247,10 +262,10 @@ select count(*) from innodb_redundant t1, innodb_normal t2 where
t1.c1 = t2.c1 and t1.b = t2.b;
count(*)
2000
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
variable_value >= 0
1
drop procedure innodb_insert_proc;
diff --git a/mysql-test/suite/encryption/r/innodb-page_encryption_compression.result b/mysql-test/suite/encryption/r/innodb-page_encryption_compression.result
index 02a13b3c13c..f7ffc77fd66 100644
--- a/mysql-test/suite/encryption/r/innodb-page_encryption_compression.result
+++ b/mysql-test/suite/encryption/r/innodb-page_encryption_compression.result
@@ -2,7 +2,11 @@ SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb page_compressed=1;
+show warnings;
+Level Code Message
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1 page_compressed=1;
+show warnings;
+Level Code Message
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=2 page_compressed=1;
show warnings;
Level Code Message
@@ -60,15 +64,15 @@ select count(*) from innodb_dynamic t1, innodb_normal t2 where
t1.c1 = t2.c1 and t1.b = t2.b;
count(*)
5000
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_compressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_compressed';
variable_value >= 0
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decompressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decompressed';
variable_value >= 0
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
@@ -93,15 +97,15 @@ select count(*) from innodb_dynamic t1, innodb_normal t2 where
t1.c1 = t2.c1 and t1.b = t2.b;
count(*)
5000
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_compressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_compressed';
variable_value >= 0
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decompressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decompressed';
variable_value >= 0
alter table innodb_normal engine=innodb page_compressed=DEFAULT;
show create table innodb_normal;
@@ -164,15 +168,15 @@ select count(*) from innodb_dynamic t1, innodb_normal t2 where
t1.c1 = t2.c1 and t1.b = t2.b;
count(*)
5000
-SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
+SELECT variable_value = 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
variable_value = 0
1
-SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value = 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
variable_value = 0
1
-SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_compressed';
+SELECT variable_value = 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_compressed';
variable_value = 0
-SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decompressed';
+SELECT variable_value = 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decompressed';
variable_value = 0
drop procedure innodb_insert_proc;
drop table innodb_normal;
diff --git a/mysql-test/suite/encryption/r/innodb-page_encryption_log_encryption.result b/mysql-test/suite/encryption/r/innodb-page_encryption_log_encryption.result
index 0318ad50cbb..92130da19e9 100644
--- a/mysql-test/suite/encryption/r/innodb-page_encryption_log_encryption.result
+++ b/mysql-test/suite/encryption/r/innodb-page_encryption_log_encryption.result
@@ -4,10 +4,20 @@ call mtr.add_suppression("InnoDB: Redo log crypto: Can't initialize to key versi
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
+show warnings;
+Level Code Message
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1;
+show warnings;
+Level Code Message
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=2;
+show warnings;
+Level Code Message
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=33;
+show warnings;
+Level Code Message
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=4;
+show warnings;
+Level Code Message
show create table innodb_compact;
Table Create Table
innodb_compact CREATE TABLE `innodb_compact` (
@@ -83,10 +93,10 @@ select count(*) from innodb_redundant t1, innodb_normal t2 where
t1.c1 = t2.c1 and t1.b = t2.b;
count(*)
2000
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
variable_value >= 0
1
SET GLOBAL innodb_file_format = `Barracuda`;
@@ -124,10 +134,10 @@ select count(*) from innodb_redundant t1, innodb_normal t2 where
t1.c1 = t2.c1 and t1.b = t2.b;
count(*)
2000
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
variable_value >= 0
1
alter table innodb_compact engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
@@ -217,10 +227,10 @@ select count(*) from innodb_redundant t1, innodb_normal t2 where
t1.c1 = t2.c1 and t1.b = t2.b;
count(*)
2000
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
variable_value >= 0
1
drop procedure innodb_insert_proc;
diff --git a/mysql-test/suite/encryption/r/innodb_encryption-page-compression.result b/mysql-test/suite/encryption/r/innodb_encryption-page-compression.result
index d14951a862a..e3238990aaa 100644
--- a/mysql-test/suite/encryption/r/innodb_encryption-page-compression.result
+++ b/mysql-test/suite/encryption/r/innodb_encryption-page-compression.result
@@ -141,16 +141,16 @@ count(*)
select count(*) from innodb_page_compressed9 where c1 < 500000;
count(*)
5000
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed';
variable_value >= 0
1
select count(*) from innodb_page_compressed1 where c1 < 500000;
@@ -189,16 +189,16 @@ update innodb_page_compressed6 set c1 = c1 + 1;
update innodb_page_compressed7 set c1 = c1 + 1;
update innodb_page_compressed8 set c1 = c1 + 1;
update innodb_page_compressed9 set c1 = c1 + 1;
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed';
variable_value >= 0
1
SET GLOBAL innodb_encryption_threads = 4;
@@ -239,16 +239,16 @@ update innodb_page_compressed6 set c1 = c1 + 1;
update innodb_page_compressed7 set c1 = c1 + 1;
update innodb_page_compressed8 set c1 = c1 + 1;
update innodb_page_compressed9 set c1 = c1 + 1;
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed';
variable_value >= 0
1
drop procedure innodb_insert_proc;
@@ -262,5 +262,3 @@ drop table innodb_page_compressed6;
drop table innodb_page_compressed7;
drop table innodb_page_compressed8;
drop table innodb_page_compressed9;
-SET GLOBAL innodb_encryption_threads = 4;
-SET GLOBAL innodb_encrypt_tables = on;
diff --git a/mysql-test/suite/encryption/r/innodb_encryption_discard_import.result b/mysql-test/suite/encryption/r/innodb_encryption_discard_import.result
new file mode 100644
index 00000000000..706d7a13260
--- /dev/null
+++ b/mysql-test/suite/encryption/r/innodb_encryption_discard_import.result
@@ -0,0 +1,136 @@
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB encrypted=yes;
+CREATE TABLE t2 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB;
+CREATE TABLE t3 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB row_format=compressed encrypted=yes;
+create procedure innodb_insert_proc (repeat_count int)
+begin
+declare current_num int;
+set current_num = 0;
+while current_num < repeat_count do
+insert into t1 values (current_num,repeat('foobar',42));
+insert into t2 values (current_num,repeat('temp', 42));
+insert into t3 values (current_num,repeat('barfoo',42));
+set current_num = current_num + 1;
+end while;
+end//
+commit;
+set autocommit=0;
+call innodb_insert_proc(10000);
+commit;
+set autocommit=1;
+# Wait max 10 min for key encryption threads to encrypt all spaces
+# tablespaces should be now encrypted
+# t1 yes on expecting NOT FOUND
+NOT FOUND /foobar/ in t1.ibd
+# t2 ... on expecting NOT FOUND
+NOT FOUND /temp/ in t2.ibd
+# t3 ... on expecting NOT FOUND
+NOT FOUND /barfoo/ in t3.ibd
+FLUSH TABLE t1, t2, t3 FOR EXPORT;
+# List before copying files
+t1.cfg
+t1.frm
+t1.ibd
+t2.cfg
+t2.frm
+t2.ibd
+t3.cfg
+t3.frm
+t3.ibd
+UNLOCK TABLES;
+# Restarting server
+# Done restarting server
+# List before t1 DISCARD
+t1.frm
+t1.ibd
+t2.frm
+t2.ibd
+t3.frm
+t3.ibd
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+ALTER TABLE t1 DISCARD TABLESPACE;
+ALTER TABLE t2 DISCARD TABLESPACE;
+ALTER TABLE t3 DISCARD TABLESPACE;
+# Discarded tablespaces should be encrypted
+# t1 yes on expecting NOT FOUND
+NOT FOUND /foobar/ in t1.ibd
+# t2 ... on expecting NOT FOUND
+NOT FOUND /temp/ in t2.ibd
+# t3 ... on expecting NOT FOUND
+NOT FOUND /barfoo/ in t3.ibd
+# List after t1 DISCARD
+t1.frm
+t2.frm
+t3.frm
+# Tablespaces should be still encrypted
+# t1 yes on expecting NOT FOUND
+NOT FOUND /foobar/ in t1.ibd
+# t2 ... on expecting NOT FOUND
+NOT FOUND /temp/ in t2.ibd
+# t3 ... on expecting NOT FOUND
+NOT FOUND /barfoo/ in t3.ibd
+ALTER TABLE t1 IMPORT TABLESPACE;
+ALTER TABLE t2 IMPORT TABLESPACE;
+ALTER TABLE t3 IMPORT TABLESPACE;
+# tablespaces should remain encrypted after import
+# t1 yes on expecting NOT FOUND
+NOT FOUND /foobar/ in t1.ibd
+# t2 ... on expecting NOT FOUND
+NOT FOUND /temp/ in t2.ibd
+# t3 ... on expecting NOT FOUND
+NOT FOUND /barfoo/ in t3.ibd
+ALTER TABLE t1 ENGINE InnoDB;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `a` varchar(255) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes
+ALTER TABLE t2 ENGINE InnoDB;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `a` varchar(255) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ALTER TABLE t3 ENGINE InnoDB;
+SHOW CREATE TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `id` int(11) NOT NULL,
+ `a` varchar(255) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED `encrypted`=yes
+# Wait max 10 min for key encryption threads to encrypt all spaces
+# Tablespaces should be encrypted after alter table
+# t1 yes on expecting NOT FOUND
+NOT FOUND /foobar/ in t1.ibd
+# t2 ... on expecting NOT FOUND
+NOT FOUND /temp/ in t2.ibd
+# t3 ... on expecting NOT FOUND
+NOT FOUND /barfoo/ in t3.ibd
+# Restarting server
+# Done restarting server
+# Verify that tables are still usable
+SELECT COUNT(1) FROM t1;
+COUNT(1)
+10000
+SELECT COUNT(1) FROM t2;
+COUNT(1)
+10000
+SELECT COUNT(1) FROM t3;
+COUNT(1)
+10000
+# Tablespaces should be encrypted after restart
+# t1 yes on expecting NOT FOUND
+NOT FOUND /foobar/ in t1.ibd
+# t2 ... on expecting NOT FOUND
+NOT FOUND /temp/ in t2.ibd
+# t3 ... on expecting NOT FOUND
+NOT FOUND /barfoo/ in t3.ibd
+DROP PROCEDURE innodb_insert_proc;
+DROP TABLE t1, t2, t3;
diff --git a/mysql-test/suite/encryption/r/innodb_encryption_tables.result b/mysql-test/suite/encryption/r/innodb_encryption_tables.result
index ee5be0bfdd3..640e2be87a2 100644
--- a/mysql-test/suite/encryption/r/innodb_encryption_tables.result
+++ b/mysql-test/suite/encryption/r/innodb_encryption_tables.result
@@ -91,16 +91,16 @@ select count(*) from innodb_redundant t1, innodb_normal t2 where
t1.c1 = t2.c1 and t1.b = t2.b;
count(*)
2000
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed';
variable_value >= 0
1
SET GLOBAL innodb_file_format = `Barracuda`;
@@ -141,16 +141,16 @@ select count(*) from innodb_redundant t1, innodb_normal t2 where
t1.c1 = t2.c1 and t1.b = t2.b;
count(*)
2000
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed';
variable_value >= 0
1
drop procedure innodb_insert_proc;
diff --git a/mysql-test/suite/encryption/r/innodb_onlinealter_encryption.result b/mysql-test/suite/encryption/r/innodb_onlinealter_encryption.result
new file mode 100644
index 00000000000..a3a3ab3fed6
--- /dev/null
+++ b/mysql-test/suite/encryption/r/innodb_onlinealter_encryption.result
@@ -0,0 +1,176 @@
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB encrypted=yes;
+CREATE TABLE t2 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB;
+CREATE TABLE t3 (id INT, a VARCHAR(255)) ENGINE=InnoDB encrypted=yes;
+CREATE TABLE t4 (id INT, a VARCHAR(255)) engine=InnoDB;
+CREATE TABLE t5 (id INT NOT NULL PRIMARY KEY, a TEXT(500), b VARCHAR(255), FULLTEXT(b)) ENGINE=InnoDB encrypted=yes;
+CREATE TABLE t6 (id INT, a TEXT(500), b VARCHAR(255), FULLTEXT(b)) ENGINE=InnoDB;
+CREATE TABLE t7 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB row_format=compressed encrypted=yes;
+create procedure innodb_insert_proc (repeat_count int)
+begin
+declare current_num int;
+set current_num = 0;
+while current_num < repeat_count do
+insert into t1 values (current_num,repeat('foobar',42));
+insert into t2 values (current_num,repeat('temp', 42));
+insert into t3 values (current_num,repeat('barfoo',42));
+insert into t4 values (current_num,repeat('repeat',42));
+insert into t5 values (current_num,substring('A BC DEF GHIJ KLM NOPQRS TUV WXYZ 012 3456789', rand()*36+1, 100), repeat('author new',22));
+insert into t6 values (current_num,substring('A BC DEF GHIJ KLM NOPQRS TUV WXYZ 012 3456789', rand()*36+1, 100), repeat('mangled old',22));
+insert into t7 values (current_num,repeat('mysql',42));
+set current_num = current_num + 1;
+end while;
+end//
+commit;
+set autocommit=0;
+call innodb_insert_proc(15000);
+commit;
+set autocommit=1;
+# Wait max 10 min for key encryption threads to encrypt all spaces
+# t1 yes on expecting NOT FOUND
+NOT FOUND /foobar/ in t1.ibd
+# t2 ... on expecting NOT FOUND
+NOT FOUND /temp/ in t2.ibd
+# t3 ... on expecting NOT FOUND
+NOT FOUND /barfoo/ in t3.ibd
+# t4 ... on expecting NOT FOUND
+NOT FOUND /repeat/ in t4.ibd
+# t5 ... on expecting NOT FOUND
+NOT FOUND /author/ in t5.ibd
+# t6 ... on expecting NOT FOUND
+NOT FOUND /mangled/ in t6.ibd
+# t7 ... on expecting NOT FOUND
+NOT FOUND /mysql/ in t7.ibd
+ALTER TABLE t1 ADD COLUMN b int default 2;
+ALTER TABLE t2 ADD COLUMN b int default 2;
+ALTER TABLE t7 ADD COLUMN b int default 2;
+ALTER TABLE t1 ADD KEY a(a), ADD KEY b(b);
+ALTER TABLE t2 ADD KEY a(a), ADD KEY b(b);
+ALTER TABLE t3 ADD COLUMN c int default 5;
+ALTER TABLE t4 ADD COLUMN c int default 5;
+ALTER TABLE t3 ADD KEY (a), ADD KEY c(c);
+ALTER TABLE t4 ADD KEY (a), ADD KEY c(c);
+ALTER TABLE t5 ADD FULLTEXT(a);
+ALTER TABLE t6 ADD FULLTEXT(a);
+ALTER TABLE t7 ADD KEY a(a), ADD key b(b);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `a` varchar(255) DEFAULT NULL,
+ `b` int(11) DEFAULT '2',
+ PRIMARY KEY (`id`),
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `a` varchar(255) DEFAULT NULL,
+ `b` int(11) DEFAULT '2',
+ PRIMARY KEY (`id`),
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW CREATE TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `id` int(11) DEFAULT NULL,
+ `a` varchar(255) DEFAULT NULL,
+ `c` int(11) DEFAULT '5',
+ KEY `a` (`a`),
+ KEY `c` (`c`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes
+SHOW CREATE TABLE t4;
+Table Create Table
+t4 CREATE TABLE `t4` (
+ `id` int(11) DEFAULT NULL,
+ `a` varchar(255) DEFAULT NULL,
+ `c` int(11) DEFAULT '5',
+ KEY `a` (`a`),
+ KEY `c` (`c`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW CREATE TABLE t5;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `id` int(11) NOT NULL,
+ `a` text,
+ `b` varchar(255) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `b` (`b`),
+ FULLTEXT KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes
+SHOW CREATE TABLE t6;
+Table Create Table
+t6 CREATE TABLE `t6` (
+ `id` int(11) DEFAULT NULL,
+ `a` text,
+ `b` varchar(255) DEFAULT NULL,
+ FULLTEXT KEY `b` (`b`),
+ FULLTEXT KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW CREATE TABLE t7;
+Table Create Table
+t7 CREATE TABLE `t7` (
+ `id` int(11) NOT NULL,
+ `a` varchar(255) DEFAULT NULL,
+ `b` int(11) DEFAULT '2',
+ PRIMARY KEY (`id`),
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED `encrypted`=yes
+# t1 yes on expecting NOT FOUND
+NOT FOUND /foobar/ in t1.ibd
+# t2 ... on expecting NOT FOUND
+NOT FOUND /temp/ in t2.ibd
+# t3 ... on expecting NOT FOUND
+NOT FOUND /barfoo/ in t3.ibd
+# t4 ... on expecting NOT FOUND
+NOT FOUND /repeat/ in t4.ibd
+# t5 ... on expecting NOT FOUND
+NOT FOUND /author/ in t5.ibd
+# t6 ... on expecting NOT FOUND
+NOT FOUND /mangled/ in t6.ibd
+# t7 ... on expecting NOT FOUND
+NOT FOUND /mysql/ in t7.ibd
+# Restarting server
+# Done restarting server
+select count(1) from t1;
+count(1)
+15000
+select count(1) from t2;
+count(1)
+15000
+select count(1) from t3;
+count(1)
+15000
+select count(1) from t4;
+count(1)
+15000
+select count(1) from t5;
+count(1)
+15000
+select count(1) from t6;
+count(1)
+15000
+select count(1) from t7;
+count(1)
+15000
+# t1 yes on expecting NOT FOUND
+NOT FOUND /foobar/ in t1.ibd
+# t2 ... on expecting NOT FOUND
+NOT FOUND /temp/ in t2.ibd
+# t3 ... on expecting NOT FOUND
+NOT FOUND /barfoo/ in t3.ibd
+# t4 ... on expecting NOT FOUND
+NOT FOUND /repeat/ in t4.ibd
+# t5 ... on expecting NOT FOUND
+NOT FOUND /author/ in t5.ibd
+# t6 ... on expecting NOT FOUND
+NOT FOUND /mangled/ in t6.ibd
+# t7 ... on expecting NOT FOUND
+NOT FOUND /mysql/ in t7.ibd
+DROP PROCEDURE innodb_insert_proc;
+DROP TABLE t1, t2, t3, t4, t5, t6, t7;
diff --git a/mysql-test/suite/encryption/r/innodb_page_encryption_key_change.result b/mysql-test/suite/encryption/r/innodb_page_encryption_key_change.result
index 8817479006d..43fb7368654 100644
--- a/mysql-test/suite/encryption/r/innodb_page_encryption_key_change.result
+++ b/mysql-test/suite/encryption/r/innodb_page_encryption_key_change.result
@@ -2,19 +2,29 @@
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
+show warnings;
+Level Code Message
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=2;
+show warnings;
+Level Code Message
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=3;
+show warnings;
+Level Code Message
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=4;
+show warnings;
+Level Code Message
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=5;
+show warnings;
+Level Code Message
insert into innodb_normal values (1,'test1'),(2,'foo'),(3,'bar'),(4,'mariadb');
insert into innodb_compact select * from innodb_normal;
insert into innodb_compressed select * from innodb_normal;
insert into innodb_dynamic select * from innodb_normal;
insert into innodb_redundant select * from innodb_normal;
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
variable_value >= 0
1
alter table innodb_compact engine=innodb encryption_key_id = 6;
@@ -51,10 +61,10 @@ c1 b
2 foo
3 bar
4 mariadb
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
variable_value >= 0
1
# Restart mysqld --loose-file-key-management-filename=keys3.txt
@@ -88,10 +98,10 @@ c1 b
2 foo
3 bar
4 mariadb
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
variable_value >= 0
1
SET GLOBAL innodb_file_format = `Barracuda`;
@@ -130,10 +140,10 @@ c1 b
2 foo
3 bar
4 mariadb
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
variable_value >= 0
1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
variable_value >= 0
1
drop table innodb_normal;
diff --git a/mysql-test/suite/encryption/t/create_or_replace.opt b/mysql-test/suite/encryption/t/create_or_replace.opt
new file mode 100644
index 00000000000..7d3f2da7971
--- /dev/null
+++ b/mysql-test/suite/encryption/t/create_or_replace.opt
@@ -0,0 +1 @@
+--innodb-tablespaces-encryption
diff --git a/mysql-test/suite/encryption/t/encryption_create_or_replace.test b/mysql-test/suite/encryption/t/create_or_replace.test
index d515698d378..3b2970e5162 100644
--- a/mysql-test/suite/encryption/t/encryption_create_or_replace.test
+++ b/mysql-test/suite/encryption/t/create_or_replace.test
@@ -1,6 +1,8 @@
--source include/have_innodb.inc
--source include/have_file_key_management_plugin.inc
--source include/not_embedded.inc
+# This is needed for longer testcase timeout at least P7/P8
+--source include/big_test.inc
#
# MDEV-8164: Server crashes in pfs_mutex_enter_func after fil_crypt_is_closing or alike
@@ -105,5 +107,36 @@ drop table if exists create_or_replace_t, table1_int_autoinc, table0_int_autoinc
--disconnect con2
--enable_abort_on_error
--enable_warnings
+
+SET GLOBAL innodb_encrypt_tables = OFF;
+SET GLOBAL innodb_encryption_threads = 4;
+
+--echo # Wait max 10 min for key encryption threads to decrypt all spaces
+let $cnt=600;
+while ($cnt)
+{
+ let $success=`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0`;
+ if ($success)
+ {
+ let $cnt=0;
+ }
+ if (!$success)
+ {
+ real_sleep 1;
+ dec $cnt;
+ }
+}
+if (!$success)
+{
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
+ SHOW STATUS LIKE 'innodb_encryption%';
+ -- die Timeout waiting for encryption threads
+}
+--echo # Success!
+
SET GLOBAL innodb_encryption_threads = 0;
SET GLOBAL innodb_encrypt_tables = OFF;
+
+# Make sure that all dirty pages are flushed
+
+-- source include/restart_mysqld.inc
diff --git a/mysql-test/suite/encryption/t/encryption_create_or_replace.opt b/mysql-test/suite/encryption/t/encryption_create_or_replace.opt
deleted file mode 100644
index 5d8903d5c20..00000000000
--- a/mysql-test/suite/encryption/t/encryption_create_or_replace.opt
+++ /dev/null
@@ -1,3 +0,0 @@
---plugin-load-add=$FILE_KEY_MANAGEMENT_SO
---file-key-management-filekey=FILE:$MTR_SUITE_DIR/t/filekeys-data.key
---file-key-management-filename=$MTR_SUITE_DIR/t/filekeys-data.enc
diff --git a/mysql-test/suite/encryption/t/filekeys_plugin.inc b/mysql-test/suite/encryption/t/filekeys_plugin.inc
index 8f0634a9076..a9bde3b06e6 100644
--- a/mysql-test/suite/encryption/t/filekeys_plugin.inc
+++ b/mysql-test/suite/encryption/t/filekeys_plugin.inc
@@ -1,4 +1,4 @@
if (!$FILE_KEY_MANAGEMENT_SO)
{
- --skip Needs file_key_management
+ --skip Needs dynamic file_key_management plugin
}
diff --git a/mysql-test/suite/encryption/t/filekeys_plugin_exists.inc b/mysql-test/suite/encryption/t/filekeys_plugin_exists.inc
new file mode 100644
index 00000000000..a9bde3b06e6
--- /dev/null
+++ b/mysql-test/suite/encryption/t/filekeys_plugin_exists.inc
@@ -0,0 +1,4 @@
+if (!$FILE_KEY_MANAGEMENT_SO)
+{
+ --skip Needs dynamic file_key_management plugin
+}
diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change.test b/mysql-test/suite/encryption/t/innodb-bad-key-change.test
new file mode 100644
index 00000000000..8ef773d769b
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-change.test
@@ -0,0 +1,121 @@
+-- source include/have_innodb.inc
+-- source include/have_file_key_management_plugin.inc
+# embedded does not support restart
+-- source include/not_embedded.inc
+-- source include/not_valgrind.inc
+# Avoid CrashReporter popup on Mac
+-- source include/not_crashrep.inc
+-- source include/not_windows.inc
+
+#
+# MDEV-8588: Assertion failure in file ha_innodb.cc line 21140 if at least one encrypted
+# table exists and encryption service is not available.
+#
+
+call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
+call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed.*");
+call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
+call mtr.add_suppression("InnoDB: Block in space_id .* in file test/.* encrypted");
+call mtr.add_suppression("InnoDB: However key management plugin or used key_id .* is not found or used encryption algorithm or method does not match.");
+call mtr.add_suppression("InnoDB: Marking tablespace as missing. You may drop this table or install correct key management plugin and key file.");
+call mtr.add_suppression(".*InnoDB: Cannot open table test/.* from the internal data dictionary of InnoDB though the .frm file for the table exists. See .* for how you can resolve the problem.");
+call mtr.add_suppression("InnoDB: .ibd file is missing for table test/.*");
+call mtr.add_suppression("mysqld: File .*");
+call mtr.add_suppression("InnoDB: Tablespace id .* is encrypted but encryption service or used key_id .* is not available. Can't continue opening tablespace.");
+--echo
+--echo # Start server with keys2.txt
+-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
+-- source include/restart_mysqld.inc
+
+--disable_query_log
+let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
+let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
+--enable_query_log
+
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
+CREATE TABLE t1 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=2;
+INSERT INTO t1 VALUES ('foobar');
+ALTER TABLE t1 ADD COLUMN c2 INT;
+INSERT INTO t1 VALUES ('foobar',2);
+SELECT * FROM t1;
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+INSERT INTO t1 VALUES ('foobar',1);
+INSERT INTO t1 VALUES ('foobar',2);
+FLUSH TABLE WITH READ LOCK;
+SELECT * FROM t1;
+
+--echo
+--echo # Restart server with keysbad3.txt
+-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keysbad3.txt
+-- source include/restart_mysqld.inc
+
+--error ER_GET_ERRMSG
+SELECT * FROM t1;
+SHOW WARNINGS;
+
+-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keysbad3.txt
+-- source include/restart_mysqld.inc
+DROP TABLE t1;
+
+#
+# MDEV-8591: Database page corruption on disk or a failed space, Assertion failure in file buf0buf.cc
+# line 2856 on querying a table using wrong default encryption key
+#
+
+--echo # Start server with keys.txt
+-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt
+-- source include/restart_mysqld.inc
+
+CREATE TABLE t2 (c VARCHAR(8), id int not null primary key, b int, key(b)) ENGINE=InnoDB ENCRYPTED=YES;
+INSERT INTO t2 VALUES ('foobar',1,2);
+
+--echo
+--echo # Restart server with keys2.txt
+-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
+-- source include/restart_mysqld.inc
+
+--error ER_GET_ERRMSG
+SELECT * FROM t2;
+SHOW WARNINGS;
+--error ER_GET_ERRMSG
+SELECT * FROM t2 where id = 1;
+SHOW WARNINGS;
+--error ER_GET_ERRMSG
+SELECT * FROM t2 where b = 1;
+SHOW WARNINGS;
+--error ER_GET_ERRMSG
+INSERT INTO t2 VALUES ('tmp',3,3);
+SHOW WARNINGS;
+--error ER_GET_ERRMSG
+DELETE FROM t2 where b = 3;
+SHOW WARNINGS;
+--error ER_GET_ERRMSG
+DELETE FROM t2 where id = 3;
+SHOW WARNINGS;
+--error ER_GET_ERRMSG
+UPDATE t2 set b = b +1;
+SHOW WARNINGS;
+OPTIMIZE TABLE t2;
+SHOW WARNINGS;
+--error ER_GET_ERRMSG
+ALTER TABLE t2 ADD COLUMN c INT;
+SHOW WARNINGS;
+ANALYZE TABLE t2;
+SHOW WARNINGS;
+--error ER_GET_ERRMSG
+TRUNCATE TABLE t2;
+SHOW WARNINGS;
+--error ER_GET_ERRMSG
+DROP TABLE t2;
+SHOW WARNINGS;
+
+--echo
+--echo # Restart server with keys.txt
+-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt
+-- source include/restart_mysqld.inc
+
+DROP TABLE t2;
+SHOW WARNINGS;
diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change2.test b/mysql-test/suite/encryption/t/innodb-bad-key-change2.test
new file mode 100644
index 00000000000..7c61c34ec59
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-change2.test
@@ -0,0 +1,59 @@
+--source include/have_innodb.inc
+# embedded does not support restart
+-- source include/not_embedded.inc
+-- source include/not_valgrind.inc
+# Avoid CrashReporter popup on Mac
+-- source include/not_crashrep.inc
+-- source filekeys_plugin_exists.inc
+#
+# MDEV-8750: Server crashes in page_cur_is_after_last on altering table using a wrong encryption key
+#
+call mtr.add_suppression("InnoDB: Block in space_id .* in file test/.* encrypted");
+call mtr.add_suppression("InnoDB: However key management plugin or used key_id 1 is not found or used encryption algorithm or method does not match.");
+call mtr.add_suppression("InnoDB: Marking tablespace as missing. You may drop this table or install correct key management plugin and key file.");
+call mtr.add_suppression(".*InnoDB: Cannot open table test/.* from the internal data dictionary of InnoDB though the .frm file for the table exists. See .* for how you can resolve the problem.");
+call mtr.add_suppression("InnoDB: .ibd file is missing for table test/.*");
+# Suppression for builds where file_key_management plugin is linked statically
+call mtr.add_suppression("Couldn't load plugins from 'file_key_management*");
+
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--shutdown_server
+--source include/wait_until_disconnected.inc
+
+--write_file $MYSQLTEST_VARDIR/keys1.txt
+1;770A8A65DA156D24EE2A093277530142
+4;770A8A65DA156D24EE2A093277530143
+EOF
+
+--exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
+INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
+
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--shutdown_server
+--source include/wait_until_disconnected.inc
+
+--write_file $MYSQLTEST_VARDIR/keys2.txt
+1;770A8A65DA156D24EE2A093277530142
+4;770A8A65DA156D24EE2A093277530144
+EOF
+
+--exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+--error ER_GET_ERRMSG
+select * from t1;
+show warnings;
+--error ER_GET_ERRMSG
+alter table t1 discard tablespace;
+show warnings;
+--error ER_GET_ERRMSG
+alter table t1 engine=InnoDB;
+show warnings;
+
+--remove_file $MYSQLTEST_VARDIR/keys1.txt
+--remove_file $MYSQLTEST_VARDIR/keys2.txt
diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change3.test b/mysql-test/suite/encryption/t/innodb-bad-key-change3.test
new file mode 100644
index 00000000000..20d63b10649
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-change3.test
@@ -0,0 +1,114 @@
+--source include/have_innodb.inc
+# embedded does not support restart
+-- source include/not_embedded.inc
+-- source include/not_valgrind.inc
+# Avoid CrashReporter popup on Mac
+-- source include/not_crashrep.inc
+-- source filekeys_plugin_exists.inc
+#
+# MDEV-8772: Assertion failure in file ha_innodb.cc line 20027 when importing page compressed and encrypted tablespace using incorrect keys
+#
+call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded");
+
+--disable_query_log
+let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
+let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
+--enable_query_log
+
+--let $MYSQLD_TMPDIR = `SELECT @@tmpdir`
+--let $MYSQLD_DATADIR = `SELECT @@datadir`
+--let SEARCH_RANGE = 10000000
+--let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--shutdown_server
+--source include/wait_until_disconnected.inc
+
+--write_file $MYSQLTEST_VARDIR/keys1.txt
+1;770A8A65DA156D24EE2A093277530142
+4;770A8A65DA156D24EE2A093277530143
+EOF
+
+--exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+set global innodb_compression_algorithm = 1;
+
+CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(255)) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
+SHOW WARNINGS;
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES (1,'foobar'),(2,'barfoo');
+FLUSH TABLE t1 FOR EXPORT;
+--echo # List before copying files
+--list_files $MYSQLD_DATADIR/test
+--copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_TMPDIR/t1.cfg
+--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_TMPDIR/t1.ibd
+UNLOCK TABLES;
+
+--sleep 5
+--echo # Tablespaces should be still encrypted
+--let SEARCH_PATTERN=foobar
+--echo # t1 yes on expecting NOT FOUND
+-- let SEARCH_FILE=$t1_IBD
+-- source include/search_pattern_in_file.inc
+
+ALTER TABLE t1 DISCARD TABLESPACE;
+
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--shutdown_server
+--source include/wait_until_disconnected.inc
+
+--write_file $MYSQLTEST_VARDIR/keys2.txt
+1;770A8A65DA156D24EE2A093277530142
+4;770A8A65DA156D24EE2A093277530144
+EOF
+
+--exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+--source include/restart_mysqld.inc
+
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+--echo # List after t1 DISCARD
+--list_files $MYSQLD_DATADIR/test
+--copy_file $MYSQLD_TMPDIR/t1.cfg $MYSQLD_DATADIR/test/t1.cfg
+--copy_file $MYSQLD_TMPDIR/t1.ibd $MYSQLD_DATADIR/test/t1.ibd
+
+--error ER_GET_ERRMSG
+ALTER TABLE t1 IMPORT TABLESPACE;
+SHOW CREATE TABLE t1;
+--error ER_TABLESPACE_DISCARDED
+SELECT * FROM t1;
+--sleep 5
+--echo # Tablespaces should be still encrypted
+-- let SEARCH_FILE=$t1_IBD
+--let SEARCH_PATTERN=foobar
+--echo # t1 yes on expecting NOT FOUND
+-- let SEARCH_FILE=$t1_IBD
+-- source include/search_pattern_in_file.inc
+
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--shutdown_server
+--source include/wait_until_disconnected.inc
+--remove_file $MYSQLTEST_VARDIR/keys1.txt
+--write_file $MYSQLTEST_VARDIR/keys1.txt
+1;770A8A65DA156D24EE2A093277530142
+4;770A8A65DA156D24EE2A093277530143
+EOF
+
+--exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+DROP TABLE t1;
+
+# reset system
+--disable_query_log
+EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
+EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
+--enable_query_log
+
+--remove_file $MYSQLTEST_VARDIR/keys1.txt
+--remove_file $MYSQLTEST_VARDIR/keys2.txt
diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change4.test b/mysql-test/suite/encryption/t/innodb-bad-key-change4.test
new file mode 100644
index 00000000000..96f9563fb3b
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-change4.test
@@ -0,0 +1,89 @@
+--source include/have_innodb.inc
+# embedded does not support restart
+-- source include/not_embedded.inc
+-- source include/not_valgrind.inc
+# Avoid CrashReporter popup on Mac
+-- source include/not_crashrep.inc
+-- source filekeys_plugin_exists.inc
+#
+# MDEV-8768: Server crash at file btr0btr.ic line 122 when checking encrypted table using incorrect keys
+#
+call mtr.add_suppression("InnoDB: Block in space_id .* in file test/.* encrypted");
+call mtr.add_suppression("InnoDB: However key management plugin or used key_id 1 is not found or used encryption algorithm or method does not match.");
+call mtr.add_suppression("InnoDB: Marking tablespace as missing. You may drop this table or install correct key management plugin and key file.");
+call mtr.add_suppression(".*InnoDB: Cannot open table test/.* from the internal data dictionary of InnoDB though the .frm file for the table exists. See .* for how you can resolve the problem.");
+call mtr.add_suppression("InnoDB: .ibd file is missing for table test/.*");
+# Suppression for builds where file_key_management plugin is linked statically
+call mtr.add_suppression("Couldn't load plugins from 'file_key_management*");
+
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--shutdown_server
+--source include/wait_until_disconnected.inc
+
+--write_file $MYSQLTEST_VARDIR/keys1.txt
+1;770A8A65DA156D24EE2A093277530142
+4;770A8A65DA156D24EE2A093277530143
+EOF
+
+--exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+--let $MYSQLD_TMPDIR = `SELECT @@tmpdir`
+--let $MYSQLD_DATADIR = `SELECT @@datadir`
+
+--disable_query_log
+let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
+let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
+--enable_query_log
+
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
+CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
+INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
+
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--shutdown_server
+--source include/wait_until_disconnected.inc
+
+--write_file $MYSQLTEST_VARDIR/keys2.txt
+1;770A8A65DA156D24EE2A093277530142
+4;770A8A65DA156D24EE2A093277530144
+EOF
+
+--exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
+CHECK TABLE t1;
+SHOW WARNINGS;
+
+--remove_file $MYSQLTEST_VARDIR/keys1.txt
+--remove_file $MYSQLTEST_VARDIR/keys2.txt
+
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--shutdown_server
+--source include/wait_until_disconnected.inc
+
+--write_file $MYSQLTEST_VARDIR/keys1.txt
+1;770A8A65DA156D24EE2A093277530142
+4;770A8A65DA156D24EE2A093277530143
+EOF
+
+--exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+DROP TABLE t1;
+
+--remove_file $MYSQLTEST_VARDIR/keys1.txt
+
+# reset system
+--disable_query_log
+EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
+EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
+--enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change5.opt b/mysql-test/suite/encryption/t/innodb-bad-key-change5.opt
new file mode 100644
index 00000000000..6426bac41a0
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-change5.opt
@@ -0,0 +1,4 @@
+--loose-innodb-buffer-pool-stats
+--loose-innodb-buffer-page
+--loose-innodb-buffer-page-lru
+--innodb-defragment=1 \ No newline at end of file
diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change5.test b/mysql-test/suite/encryption/t/innodb-bad-key-change5.test
new file mode 100644
index 00000000000..c6c0c963818
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-change5.test
@@ -0,0 +1,88 @@
+--source include/have_innodb.inc
+# embedded does not support restart
+-- source include/not_embedded.inc
+-- source include/not_valgrind.inc
+# Avoid CrashReporter popup on Mac
+-- source include/not_crashrep.inc
+-- source filekeys_plugin_exists.inc
+#
+# MDEV-8769: Server crash at file btr0btr.ic line 122 when defragmenting encrypted table using incorrect keys
+#
+call mtr.add_suppression("InnoDB: Block in space_id .* in file test/.* encrypted");
+call mtr.add_suppression("InnoDB: However key management plugin or used key_id 1 is not found or used encryption algorithm or method does not match.");
+call mtr.add_suppression("InnoDB: Marking tablespace as missing. You may drop this table or install correct key management plugin and key file.");
+call mtr.add_suppression(".*InnoDB: Cannot open table test/.* from the internal data dictionary of InnoDB though the .frm file for the table exists. See .* for how you can resolve the problem.");
+call mtr.add_suppression("InnoDB: .ibd file is missing for table test/.*");
+# Suppression for builds where file_key_management plugin is linked statically
+call mtr.add_suppression("Couldn't load plugins from 'file_key_management*");
+
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--shutdown_server
+--source include/wait_until_disconnected.inc
+
+--write_file $MYSQLTEST_VARDIR/keys1.txt
+1;770A8A65DA156D24EE2A093277530142
+4;770A8A65DA156D24EE2A093277530143
+EOF
+
+--exec echo "restart:--innodb-encrypt-tables --innodb-defragment=1 --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+--let $MYSQLD_TMPDIR = `SELECT @@tmpdir`
+--let $MYSQLD_DATADIR = `SELECT @@datadir`
+
+--disable_query_log
+let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
+let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
+--enable_query_log
+
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
+CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
+INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
+
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--shutdown_server
+--source include/wait_until_disconnected.inc
+
+--write_file $MYSQLTEST_VARDIR/keys2.txt
+1;770A8A65DA156D24EE2A093277530142
+4;770A8A65DA156D24EE2A093277530144
+EOF
+
+--exec echo "restart:--innodb-encrypt-tables --innodb-defragment=1 --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
+OPTIMIZE TABLE t1;
+SHOW WARNINGS;
+
+--remove_file $MYSQLTEST_VARDIR/keys1.txt
+--remove_file $MYSQLTEST_VARDIR/keys2.txt
+
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--shutdown_server
+--source include/wait_until_disconnected.inc
+
+--write_file $MYSQLTEST_VARDIR/keys1.txt
+1;770A8A65DA156D24EE2A093277530142
+4;770A8A65DA156D24EE2A093277530143
+EOF
+
+--exec echo "restart:--innodb-encrypt-tables --innodb-defragment=1 --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+DROP TABLE t1;
+--remove_file $MYSQLTEST_VARDIR/keys1.txt
+
+# reset system
+--disable_query_log
+EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
+EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
+--enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb-page_encryption.test b/mysql-test/suite/encryption/t/innodb-page_encryption.test
index 26fd4e7e9c1..463df756933 100644
--- a/mysql-test/suite/encryption/t/innodb-page_encryption.test
+++ b/mysql-test/suite/encryption/t/innodb-page_encryption.test
@@ -10,12 +10,18 @@ SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
+show warnings;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1;
+show warnings;
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=2;
+show warnings;
--error ER_CANT_CREATE_TABLE
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=3;
+show warnings;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=33;
+show warnings;
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=4;
+show warnings;
set innodb_default_encryption_key_id = 5;
create table innodb_defkey(c1 bigint not null, b char(200)) engine=innodb encrypted=yes;
@@ -74,8 +80,8 @@ select count(*) from innodb_defkey t1, innodb_normal t2 where
t1.c1 = t2.c1 and t1.b = t2.b;
# Note there that these variables are updated only when real I/O is done, thus they are not reliable
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
--source include/restart_mysqld.inc
@@ -104,8 +110,8 @@ t1.c1 = t2.c1 and t1.b = t2.b;
select count(*) from innodb_defkey t1, innodb_normal t2 where
t1.c1 = t2.c1 and t1.b = t2.b;
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
alter table innodb_compact engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
show create table innodb_compact;
@@ -145,8 +151,8 @@ t1.c1 = t2.c1 and t1.b = t2.b;
select count(*) from innodb_redundant t1, innodb_normal t2 where
t1.c1 = t2.c1 and t1.b = t2.b;
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
drop procedure innodb_insert_proc;
drop table innodb_normal;
diff --git a/mysql-test/suite/encryption/t/innodb-page_encryption_compression.test b/mysql-test/suite/encryption/t/innodb-page_encryption_compression.test
index 6c508d858cf..1d59c39d637 100644
--- a/mysql-test/suite/encryption/t/innodb-page_encryption_compression.test
+++ b/mysql-test/suite/encryption/t/innodb-page_encryption_compression.test
@@ -15,7 +15,9 @@ SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb page_compressed=1;
+show warnings;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1 page_compressed=1;
+show warnings;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=2 page_compressed=1;
show warnings;
@@ -55,10 +57,10 @@ t1.c1 = t2.c1 and t1.b = t2.b;
select count(*) from innodb_dynamic t1, innodb_normal t2 where
t1.c1 = t2.c1 and t1.b = t2.b;
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_compressed';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decompressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_compressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decompressed';
--source include/restart_mysqld.inc
@@ -78,10 +80,10 @@ t1.c1 = t2.c1 and t1.b = t2.b;
select count(*) from innodb_dynamic t1, innodb_normal t2 where
t1.c1 = t2.c1 and t1.b = t2.b;
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_compressed';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decompressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_compressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decompressed';
alter table innodb_normal engine=innodb page_compressed=DEFAULT;
show create table innodb_normal;
@@ -110,10 +112,10 @@ t1.c1 = t2.c1 and t1.b = t2.b;
select count(*) from innodb_dynamic t1, innodb_normal t2 where
t1.c1 = t2.c1 and t1.b = t2.b;
-SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
-SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
-SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_compressed';
-SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decompressed';
+SELECT variable_value = 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
+SELECT variable_value = 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
+SELECT variable_value = 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_compressed';
+SELECT variable_value = 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decompressed';
drop procedure innodb_insert_proc;
drop table innodb_normal;
diff --git a/mysql-test/suite/encryption/t/innodb-page_encryption_log_encryption.test b/mysql-test/suite/encryption/t/innodb-page_encryption_log_encryption.test
index 3cd0cf0d2aa..b6fe0d10b65 100644
--- a/mysql-test/suite/encryption/t/innodb-page_encryption_log_encryption.test
+++ b/mysql-test/suite/encryption/t/innodb-page_encryption_log_encryption.test
@@ -15,10 +15,15 @@ SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
+show warnings;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1;
+show warnings;
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=2;
+show warnings;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=33;
+show warnings;
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=4;
+show warnings;
show create table innodb_compact;
show create table innodb_compressed;
@@ -67,8 +72,8 @@ select count(*) from innodb_redundant t1, innodb_normal t2 where
t1.c1 = t2.c1 and t1.b = t2.b;
# Note there that these variables are updated only when real I/O is done, thus they are not reliable
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
--source include/restart_mysqld.inc
@@ -93,8 +98,8 @@ t1.c1 = t2.c1 and t1.b = t2.b;
select count(*) from innodb_redundant t1, innodb_normal t2 where
t1.c1 = t2.c1 and t1.b = t2.b;
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
alter table innodb_compact engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
show create table innodb_compact;
@@ -133,8 +138,8 @@ t1.c1 = t2.c1 and t1.b = t2.b;
select count(*) from innodb_redundant t1, innodb_normal t2 where
t1.c1 = t2.c1 and t1.b = t2.b;
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
drop procedure innodb_insert_proc;
drop table innodb_normal;
diff --git a/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test b/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test
index 2cde4fe4787..c2c7bd96d3e 100644
--- a/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test
+++ b/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test
@@ -8,6 +8,8 @@
let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
+let $innodb_encrypt_tables_orig = `SELECT @@innodb_encrypt_tables`;
+let $innodb_encryption_threads_orig = `SELECT @@innodb_encryption_threads`;
--enable_query_log
SET GLOBAL innodb_file_format = `Barracuda`;
@@ -85,10 +87,10 @@ select count(*) from innodb_page_compressed7 where c1 < 500000;
select count(*) from innodb_page_compressed8 where c1 < 500000;
select count(*) from innodb_page_compressed9 where c1 < 500000;
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed';
--source include/restart_mysqld.inc
@@ -112,10 +114,10 @@ update innodb_page_compressed7 set c1 = c1 + 1;
update innodb_page_compressed8 set c1 = c1 + 1;
update innodb_page_compressed9 set c1 = c1 + 1;
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed';
SET GLOBAL innodb_encryption_threads = 4;
SET GLOBAL innodb_encrypt_tables = off;
@@ -139,10 +141,10 @@ update innodb_page_compressed7 set c1 = c1 + 1;
update innodb_page_compressed8 set c1 = c1 + 1;
update innodb_page_compressed9 set c1 = c1 + 1;
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed';
drop procedure innodb_insert_proc;
drop table innodb_normal;
@@ -161,7 +163,7 @@ drop table innodb_page_compressed9;
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
+EVAL SET GLOBAL innodb_encrypt_tables = $innodb_encrypt_tables_orig;
+EVAL SET GLOBAL innodb_encryption_threads = $innodb_encryption_threads_orig;
--enable_query_log
-SET GLOBAL innodb_encryption_threads = 4;
-SET GLOBAL innodb_encrypt_tables = on;
diff --git a/mysql-test/suite/encryption/t/innodb_encryption_discard_import.opt b/mysql-test/suite/encryption/t/innodb_encryption_discard_import.opt
new file mode 100644
index 00000000000..bcff011eb82
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb_encryption_discard_import.opt
@@ -0,0 +1,8 @@
+--innodb-encrypt-tables=ON
+--innodb-encrypt-log=ON
+--innodb-encryption-rotate-key-age=15
+--innodb-encryption-threads=4
+--innodb-tablespaces-encryption
+--innodb-max-dirty-pages-pct=0.001
+
+
diff --git a/mysql-test/suite/encryption/t/innodb_encryption_discard_import.test b/mysql-test/suite/encryption/t/innodb_encryption_discard_import.test
new file mode 100644
index 00000000000..70f937f0832
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb_encryption_discard_import.test
@@ -0,0 +1,211 @@
+-- source include/have_innodb.inc
+-- source include/have_example_key_management_plugin.inc
+-- source include/not_valgrind.inc
+-- source include/not_embedded.inc
+-- source include/not_windows.inc
+
+--let $MYSQLD_TMPDIR = `SELECT @@tmpdir`
+--let $MYSQLD_DATADIR = `SELECT @@datadir`
+--let SEARCH_RANGE = 10000000
+--let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd
+--let t2_IBD = $MYSQLD_DATADIR/test/t2.ibd
+--let t3_IBD = $MYSQLD_DATADIR/test/t3.ibd
+--let t1_IBD_1 = $MYSQLD_TMPDIR/t1.ibd
+--let t2_IBD_1 = $MYSQLD_TMPDIR/t2.ibd
+--let t3_IBD_1 = $MYSQLD_TMPDIR/t3.ibd
+
+--disable_query_log
+let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
+let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
+--enable_query_log
+
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB encrypted=yes;
+CREATE TABLE t2 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB;
+CREATE TABLE t3 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB row_format=compressed encrypted=yes;
+
+delimiter //;
+create procedure innodb_insert_proc (repeat_count int)
+begin
+ declare current_num int;
+ set current_num = 0;
+ while current_num < repeat_count do
+ insert into t1 values (current_num,repeat('foobar',42));
+ insert into t2 values (current_num,repeat('temp', 42));
+ insert into t3 values (current_num,repeat('barfoo',42));
+ set current_num = current_num + 1;
+ end while;
+end//
+delimiter ;//
+commit;
+
+set autocommit=0;
+call innodb_insert_proc(10000);
+commit;
+set autocommit=1;
+
+--echo # Wait max 10 min for key encryption threads to encrypt all spaces
+--let $wait_timeout= 600
+--let $wait_condition=SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
+--source include/wait_condition.inc
+
+--sleep 5
+--echo # tablespaces should be now encrypted
+--let SEARCH_PATTERN=foobar
+--echo # t1 yes on expecting NOT FOUND
+-- let SEARCH_FILE=$t1_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=temp
+--echo # t2 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t2_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=barfoo
+--echo # t3 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t3_IBD
+-- source include/search_pattern_in_file.inc
+
+FLUSH TABLE t1, t2, t3 FOR EXPORT;
+
+--echo # List before copying files
+--list_files $MYSQLD_DATADIR/test
+--copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_TMPDIR/t1.cfg
+--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_TMPDIR/t1.ibd
+--copy_file $MYSQLD_DATADIR/test/t2.cfg $MYSQLD_TMPDIR/t2.cfg
+--copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_TMPDIR/t2.ibd
+--copy_file $MYSQLD_DATADIR/test/t3.cfg $MYSQLD_TMPDIR/t3.cfg
+--copy_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_TMPDIR/t3.ibd
+UNLOCK TABLES;
+
+--echo # Restarting server
+-- source include/restart_mysqld.inc
+--echo # Done restarting server
+--echo # List before t1 DISCARD
+--list_files $MYSQLD_DATADIR/test
+
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
+ALTER TABLE t1 DISCARD TABLESPACE;
+ALTER TABLE t2 DISCARD TABLESPACE;
+ALTER TABLE t3 DISCARD TABLESPACE;
+
+--sleep 5
+--echo # Discarded tablespaces should be encrypted
+--let SEARCH_PATTERN=foobar
+--echo # t1 yes on expecting NOT FOUND
+-- let SEARCH_FILE=$t1_IBD_1
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=temp
+--echo # t2 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t2_IBD_1
+-- source include/search_pattern_in_file.inc
+--echo # t3 ... on expecting NOT FOUND
+--let SEARCH_PATTERN=barfoo
+-- let SEARCH_FILE=$t3_IBD_1
+-- source include/search_pattern_in_file.inc
+
+--echo # List after t1 DISCARD
+--list_files $MYSQLD_DATADIR/test
+--copy_file $MYSQLD_TMPDIR/t1.cfg $MYSQLD_DATADIR/test/t1.cfg
+--copy_file $MYSQLD_TMPDIR/t1.ibd $MYSQLD_DATADIR/test/t1.ibd
+--copy_file $MYSQLD_TMPDIR/t2.cfg $MYSQLD_DATADIR/test/t2.cfg
+--copy_file $MYSQLD_TMPDIR/t2.ibd $MYSQLD_DATADIR/test/t2.ibd
+--copy_file $MYSQLD_TMPDIR/t3.cfg $MYSQLD_DATADIR/test/t3.cfg
+--copy_file $MYSQLD_TMPDIR/t3.ibd $MYSQLD_DATADIR/test/t3.ibd
+
+--sleep 5
+--echo # Tablespaces should be still encrypted
+--let SEARCH_PATTERN=foobar
+--echo # t1 yes on expecting NOT FOUND
+-- let SEARCH_FILE=$t1_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=temp
+--echo # t2 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t2_IBD
+-- source include/search_pattern_in_file.inc
+--echo # t3 ... on expecting NOT FOUND
+--let SEARCH_PATTERN=barfoo
+-- let SEARCH_FILE=$t3_IBD
+-- source include/search_pattern_in_file.inc
+
+ALTER TABLE t1 IMPORT TABLESPACE;
+ALTER TABLE t2 IMPORT TABLESPACE;
+ALTER TABLE t3 IMPORT TABLESPACE;
+
+--sleep 5
+--echo # tablespaces should remain encrypted after import
+--let SEARCH_PATTERN=foobar
+--echo # t1 yes on expecting NOT FOUND
+-- let SEARCH_FILE=$t1_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=temp
+--echo # t2 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t2_IBD
+-- source include/search_pattern_in_file.inc
+--echo # t3 ... on expecting NOT FOUND
+--let SEARCH_PATTERN=barfoo
+-- let SEARCH_FILE=$t3_IBD
+-- source include/search_pattern_in_file.inc
+
+ALTER TABLE t1 ENGINE InnoDB;
+SHOW CREATE TABLE t1;
+ALTER TABLE t2 ENGINE InnoDB;
+SHOW CREATE TABLE t2;
+ALTER TABLE t3 ENGINE InnoDB;
+SHOW CREATE TABLE t3;
+
+--echo # Wait max 10 min for key encryption threads to encrypt all spaces
+--let $wait_timeout= 600
+--let $wait_condition=SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
+--source include/wait_condition.inc
+
+--sleep 5
+--echo # Tablespaces should be encrypted after alter table
+--let SEARCH_PATTERN=foobar
+--echo # t1 yes on expecting NOT FOUND
+-- let SEARCH_FILE=$t1_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=temp
+--echo # t2 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t2_IBD
+-- source include/search_pattern_in_file.inc
+--echo # t3 ... on expecting NOT FOUND
+--let SEARCH_PATTERN=barfoo
+-- let SEARCH_FILE=$t3_IBD
+-- source include/search_pattern_in_file.inc
+
+--echo # Restarting server
+-- source include/restart_mysqld.inc
+--echo # Done restarting server
+
+--echo # Verify that tables are still usable
+SELECT COUNT(1) FROM t1;
+SELECT COUNT(1) FROM t2;
+SELECT COUNT(1) FROM t3;
+
+--sleep 5
+--echo # Tablespaces should be encrypted after restart
+--let SEARCH_PATTERN=foobar
+--echo # t1 yes on expecting NOT FOUND
+-- let SEARCH_FILE=$t1_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=temp
+--echo # t2 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t2_IBD
+-- source include/search_pattern_in_file.inc
+--echo # t3 ... on expecting NOT FOUND
+--let SEARCH_PATTERN=barfoo
+-- let SEARCH_FILE=$t3_IBD
+-- source include/search_pattern_in_file.inc
+
+
+DROP PROCEDURE innodb_insert_proc;
+DROP TABLE t1, t2, t3;
+
+# reset system
+--disable_query_log
+EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
+EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
+--enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb_encryption_tables.test b/mysql-test/suite/encryption/t/innodb_encryption_tables.test
index 6d378270ad9..f806b776800 100644
--- a/mysql-test/suite/encryption/t/innodb_encryption_tables.test
+++ b/mysql-test/suite/encryption/t/innodb_encryption_tables.test
@@ -66,10 +66,10 @@ t1.c1 = t2.c1 and t1.b = t2.b;
select count(*) from innodb_redundant t1, innodb_normal t2 where
t1.c1 = t2.c1 and t1.b = t2.b;
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed';
--source include/restart_mysqld.inc
@@ -95,10 +95,10 @@ t1.c1 = t2.c1 and t1.b = t2.b;
select count(*) from innodb_redundant t1, innodb_normal t2 where
t1.c1 = t2.c1 and t1.b = t2.b;
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed';
drop procedure innodb_insert_proc;
drop table innodb_normal;
diff --git a/mysql-test/suite/encryption/t/innodb_first_page.test b/mysql-test/suite/encryption/t/innodb_first_page.test
index 917a1e990a6..a0c563b1854 100644
--- a/mysql-test/suite/encryption/t/innodb_first_page.test
+++ b/mysql-test/suite/encryption/t/innodb_first_page.test
@@ -14,6 +14,8 @@ let datadir=`select @@datadir`;
shutdown;
+--source include/wait_until_disconnected.inc
+
--remove_file $datadir/ib_logfile0
--remove_file $datadir/ib_logfile1
--remove_file $datadir/ibdata1
diff --git a/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.opt b/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.opt
new file mode 100644
index 00000000000..bcff011eb82
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.opt
@@ -0,0 +1,8 @@
+--innodb-encrypt-tables=ON
+--innodb-encrypt-log=ON
+--innodb-encryption-rotate-key-age=15
+--innodb-encryption-threads=4
+--innodb-tablespaces-encryption
+--innodb-max-dirty-pages-pct=0.001
+
+
diff --git a/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.test b/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.test
new file mode 100644
index 00000000000..40beb10bcdb
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.test
@@ -0,0 +1,191 @@
+-- source include/have_innodb.inc
+-- source include/have_example_key_management_plugin.inc
+-- source include/not_valgrind.inc
+-- source include/not_embedded.inc
+-- source include/not_windows.inc
+
+--disable_query_log
+let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
+let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
+--enable_query_log
+
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
+--let $MYSQLD_DATADIR=`select @@datadir`
+--let SEARCH_RANGE = 10000000
+--let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd
+--let t2_IBD = $MYSQLD_DATADIR/test/t2.ibd
+--let t3_IBD = $MYSQLD_DATADIR/test/t3.ibd
+--let t4_IBD = $MYSQLD_DATADIR/test/t4.ibd
+--let t5_IBD = $MYSQLD_DATADIR/test/t5.ibd
+--let t6_IBD = $MYSQLD_DATADIR/test/t6.ibd
+--let t7_IBD = $MYSQLD_DATADIR/test/t7.ibd
+
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB encrypted=yes;
+CREATE TABLE t2 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB;
+CREATE TABLE t3 (id INT, a VARCHAR(255)) ENGINE=InnoDB encrypted=yes;
+CREATE TABLE t4 (id INT, a VARCHAR(255)) engine=InnoDB;
+CREATE TABLE t5 (id INT NOT NULL PRIMARY KEY, a TEXT(500), b VARCHAR(255), FULLTEXT(b)) ENGINE=InnoDB encrypted=yes;
+CREATE TABLE t6 (id INT, a TEXT(500), b VARCHAR(255), FULLTEXT(b)) ENGINE=InnoDB;
+CREATE TABLE t7 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB row_format=compressed encrypted=yes;
+
+delimiter //;
+create procedure innodb_insert_proc (repeat_count int)
+begin
+ declare current_num int;
+ set current_num = 0;
+ while current_num < repeat_count do
+ insert into t1 values (current_num,repeat('foobar',42));
+ insert into t2 values (current_num,repeat('temp', 42));
+ insert into t3 values (current_num,repeat('barfoo',42));
+ insert into t4 values (current_num,repeat('repeat',42));
+ insert into t5 values (current_num,substring('A BC DEF GHIJ KLM NOPQRS TUV WXYZ 012 3456789', rand()*36+1, 100), repeat('author new',22));
+ insert into t6 values (current_num,substring('A BC DEF GHIJ KLM NOPQRS TUV WXYZ 012 3456789', rand()*36+1, 100), repeat('mangled old',22));
+ insert into t7 values (current_num,repeat('mysql',42));
+ set current_num = current_num + 1;
+ end while;
+end//
+delimiter ;//
+commit;
+
+set autocommit=0;
+call innodb_insert_proc(15000);
+commit;
+set autocommit=1;
+
+--echo # Wait max 10 min for key encryption threads to encrypt all spaces
+--let $wait_timeout= 600
+--let $wait_condition=SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
+--source include/wait_condition.inc
+
+--sleep 10
+--let SEARCH_PATTERN=foobar
+--echo # t1 yes on expecting NOT FOUND
+-- let SEARCH_FILE=$t1_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=temp
+--echo # t2 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t2_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=barfoo
+--echo # t3 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t3_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=repeat
+--echo # t4 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t4_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=author
+--echo # t5 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t5_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=mangled
+--echo # t6 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t6_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=mysql
+--echo # t7 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t7_IBD
+-- source include/search_pattern_in_file.inc
+
+ALTER TABLE t1 ADD COLUMN b int default 2;
+ALTER TABLE t2 ADD COLUMN b int default 2;
+ALTER TABLE t7 ADD COLUMN b int default 2;
+ALTER TABLE t1 ADD KEY a(a), ADD KEY b(b);
+ALTER TABLE t2 ADD KEY a(a), ADD KEY b(b);
+ALTER TABLE t3 ADD COLUMN c int default 5;
+ALTER TABLE t4 ADD COLUMN c int default 5;
+ALTER TABLE t3 ADD KEY (a), ADD KEY c(c);
+ALTER TABLE t4 ADD KEY (a), ADD KEY c(c);
+ALTER TABLE t5 ADD FULLTEXT(a);
+ALTER TABLE t6 ADD FULLTEXT(a);
+ALTER TABLE t7 ADD KEY a(a), ADD key b(b);
+
+SHOW CREATE TABLE t1;
+SHOW CREATE TABLE t2;
+SHOW CREATE TABLE t3;
+SHOW CREATE TABLE t4;
+SHOW CREATE TABLE t5;
+SHOW CREATE TABLE t6;
+SHOW CREATE TABLE t7;
+
+--sleep 10
+--let SEARCH_PATTERN=foobar
+--echo # t1 yes on expecting NOT FOUND
+-- let SEARCH_FILE=$t1_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=temp
+--echo # t2 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t2_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=barfoo
+--echo # t3 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t3_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=repeat
+--echo # t4 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t4_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=author
+--echo # t5 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t5_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=mangled
+--echo # t6 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t6_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=mysql
+--echo # t7 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t7_IBD
+-- source include/search_pattern_in_file.inc
+
+--echo # Restarting server
+-- source include/restart_mysqld.inc
+--echo # Done restarting server
+
+select count(1) from t1;
+select count(1) from t2;
+select count(1) from t3;
+select count(1) from t4;
+select count(1) from t5;
+select count(1) from t6;
+select count(1) from t7;
+
+--let SEARCH_PATTERN=foobar
+--echo # t1 yes on expecting NOT FOUND
+-- let SEARCH_FILE=$t1_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=temp
+--echo # t2 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t2_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=barfoo
+--echo # t3 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t3_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=repeat
+--echo # t4 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t4_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=author
+--echo # t5 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t5_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=mangled
+--echo # t6 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t6_IBD
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=mysql
+--echo # t7 ... on expecting NOT FOUND
+-- let SEARCH_FILE=$t7_IBD
+-- source include/search_pattern_in_file.inc
+
+DROP PROCEDURE innodb_insert_proc;
+DROP TABLE t1, t2, t3, t4, t5, t6, t7;
+
+# reset system
+--disable_query_log
+EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
+EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
+--enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb_page_encryption_key_change.test b/mysql-test/suite/encryption/t/innodb_page_encryption_key_change.test
index cfd792447cf..7cbf005ed32 100644
--- a/mysql-test/suite/encryption/t/innodb_page_encryption_key_change.test
+++ b/mysql-test/suite/encryption/t/innodb_page_encryption_key_change.test
@@ -16,10 +16,15 @@ SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
+show warnings;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=2;
+show warnings;
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=3;
+show warnings;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=4;
+show warnings;
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=5;
+show warnings;
insert into innodb_normal values (1,'test1'),(2,'foo'),(3,'bar'),(4,'mariadb');
insert into innodb_compact select * from innodb_normal;
@@ -28,8 +33,8 @@ insert into innodb_dynamic select * from innodb_normal;
insert into innodb_redundant select * from innodb_normal;
# Note there that these variables are updated only when real I/O is done, thus they are not reliable
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
alter table innodb_compact engine=innodb encryption_key_id = 6;
alter table innodb_compressed engine=innodb encryption_key_id = 6;
@@ -43,8 +48,8 @@ select * from innodb_dynamic;
select * from innodb_redundant;
# Note there that these variables are updated only when real I/O is done, thus they are not reliable
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
--echo # Restart mysqld --loose-file-key-management-filename=keys3.txt
-- let $restart_parameters=--loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt
@@ -57,8 +62,8 @@ select * from innodb_dynamic;
select * from innodb_redundant;
# Note there that these variables are updated only when real I/O is done, thus they are not reliable
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
@@ -75,8 +80,8 @@ select * from innodb_dynamic;
select * from innodb_redundant;
# Note there that these variables are updated only when real I/O is done, thus they are not reliable
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
drop table innodb_normal;
drop table innodb_compact;
diff --git a/mysql-test/suite/federated/federated_bug_35333.result b/mysql-test/suite/federated/federated_bug_35333.result
index 05e4bab8ec5..38a3a51ef28 100644
--- a/mysql-test/suite/federated/federated_bug_35333.result
+++ b/mysql-test/suite/federated/federated_bug_35333.result
@@ -29,7 +29,7 @@ Warnings:
Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
DROP TABLE t1;
Warnings:
-Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
+Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
#
# Cleanup
#
diff --git a/mysql-test/suite/federated/federatedx.result b/mysql-test/suite/federated/federatedx.result
index 522b286c545..0b0b39f0abd 100644
--- a/mysql-test/suite/federated/federatedx.result
+++ b/mysql-test/suite/federated/federatedx.result
@@ -1689,6 +1689,11 @@ a b c
19 23 437
delete from federated.t1;
load data infile '../../std_data/loaddata5.dat' into table federated.t1 fields terminated by '' enclosed by '' ignore 1 lines (a, b);
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'b' at row 1
+Note 1265 Data truncated for column 'a' at row 2
+Note 1265 Data truncated for column 'b' at row 2
select * from federated.t1 order by a;
a b c
3 4 12
@@ -1810,6 +1815,7 @@ length(a)
5000
drop table t1;
drop table t1;
+set sql_mode="";
DROP TABLE IF EXISTS federated.test;
CREATE TABLE federated.test (
`i` int(11) NOT NULL,
@@ -1818,6 +1824,7 @@ CREATE TABLE federated.test (
PRIMARY KEY (`i`,`j`),
UNIQUE KEY `i` (`i`,`c`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+set sql_mode=default;
DROP TABLE IF EXISTS federated.test1;
DROP TABLE IF EXISTS federated.test2;
create table federated.test1 (
diff --git a/mysql-test/suite/federated/federatedx.test b/mysql-test/suite/federated/federatedx.test
index e79970f8dcd..87ef49e66e8 100644
--- a/mysql-test/suite/federated/federatedx.test
+++ b/mysql-test/suite/federated/federatedx.test
@@ -1633,6 +1633,7 @@ drop table t1;
#
connection slave;
+set sql_mode="";
--disable_warnings
DROP TABLE IF EXISTS federated.test;
CREATE TABLE federated.test (
@@ -1643,6 +1644,7 @@ CREATE TABLE federated.test (
UNIQUE KEY `i` (`i`,`c`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--enable_warnings
+set sql_mode=default;
connection master;
--disable_warnings
diff --git a/mysql-test/suite/funcs_1/datadict/datadict_priv.inc b/mysql-test/suite/funcs_1/datadict/datadict_priv.inc
index 178a8f18c74..c69d7b004be 100644
--- a/mysql-test/suite/funcs_1/datadict/datadict_priv.inc
+++ b/mysql-test/suite/funcs_1/datadict/datadict_priv.inc
@@ -48,9 +48,9 @@ eval INSERT INTO $table SELECT * FROM test.t_$table;
eval DROP TABLE test.t_$table;
--error ER_VIEW_NONUPD_CHECK
-eval CREATE VIEW test.v_$table ($columns) AS SELECT * FROM $table WITH CHECK OPTION;
+eval CREATE VIEW test.v_$table ($columns) AS SELECT $columns FROM $table WITH CHECK OPTION;
-eval CREATE VIEW test.v_$table ($columns) AS SELECT * FROM $table;
+eval CREATE VIEW test.v_$table ($columns) AS SELECT $columns FROM $table;
# !!! This query returns a wrong error due to a bug in the code of mwl106
# !!! Uncomment it when the bug is fixed
diff --git a/mysql-test/suite/funcs_1/datadict/is_routines.inc b/mysql-test/suite/funcs_1/datadict/is_routines.inc
index 5ef88e2dffc..ecbb1b8c0da 100644
--- a/mysql-test/suite/funcs_1/datadict/is_routines.inc
+++ b/mysql-test/suite/funcs_1/datadict/is_routines.inc
@@ -18,6 +18,7 @@
# 2008-06-11 mleich Move t/is_routines.test to this file and
# create variants for embedded/non embedded server.
#
+set sql_mode="";
let $engine_type = MEMORY;
let $other_engine_type = MyISAM;
diff --git a/mysql-test/suite/funcs_1/datadict/is_triggers.inc b/mysql-test/suite/funcs_1/datadict/is_triggers.inc
index 5597bc816fc..6c618e533b2 100644
--- a/mysql-test/suite/funcs_1/datadict/is_triggers.inc
+++ b/mysql-test/suite/funcs_1/datadict/is_triggers.inc
@@ -19,6 +19,7 @@
# 2008-06-11 mleich Move t/is_triggers.test to this file and
# create variants for embedded/non embedded server.
#
+set global sql_mode="";
let $engine_type = MEMORY;
let $other_engine_type = MyISAM;
@@ -257,3 +258,4 @@ ALTER TABLE information_schema.triggers RENAME information_schema.xtriggers;
# Cleanup
DROP DATABASE db_datadict;
+set global sql_mode=default;
diff --git a/mysql-test/suite/funcs_1/datadict/processlist_priv.inc b/mysql-test/suite/funcs_1/datadict/processlist_priv.inc
index cc96f89f01a..e19f8b4f820 100644
--- a/mysql-test/suite/funcs_1/datadict/processlist_priv.inc
+++ b/mysql-test/suite/funcs_1/datadict/processlist_priv.inc
@@ -158,9 +158,9 @@ WHERE DB = 'information_schema' AND COMMAND = 'Sleep' AND USER = 'ddicttestuser1
eval SHOW CREATE TABLE $table;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
eval SHOW $table;
---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID
+--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
eval SELECT * FROM $table $select_where ORDER BY id;
---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID
+--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
eval SELECT $columns FROM $table $select_where ORDER BY id;
--source suite/funcs_1/datadict/datadict_priv.inc
--real_sleep 0.3
@@ -178,9 +178,9 @@ connection con100;
eval SHOW CREATE TABLE $table;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
eval SHOW $table;
---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID
+--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
eval SELECT * FROM $table $select_where ORDER BY id;
---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID
+--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
eval SELECT $columns FROM $table $select_where ORDER BY id;
--source suite/funcs_1/datadict/datadict_priv.inc
--real_sleep 0.3
@@ -204,7 +204,7 @@ connection con100;
SHOW GRANTS;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist;
---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID
+--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
SELECT * FROM information_schema.processlist;
--real_sleep 0.3
@@ -216,7 +216,7 @@ connect (con101,localhost,ddicttestuser1,ddictpass,information_schema);
SHOW GRANTS;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist;
---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID
+--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
SELECT * FROM information_schema.processlist;
--real_sleep 0.3
@@ -226,6 +226,7 @@ SELECT * FROM information_schema.processlist;
--echo connection default (user=root)
--echo ####################################################################################
connection default;
+create user ''@'localhost';
GRANT PROCESS ON *.* TO ''@'localhost';
--real_sleep 0.3
@@ -238,7 +239,7 @@ connect (anonymous1,localhost,"''",,information_schema);
SHOW GRANTS;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist;
---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID
+--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
SELECT * FROM information_schema.processlist;
--real_sleep 0.3
@@ -260,7 +261,7 @@ connect (con102,localhost,ddicttestuser1,ddictpass,information_schema);
SHOW GRANTS;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist;
---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID
+--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
SELECT * FROM information_schema.processlist;
--real_sleep 0.3
@@ -286,7 +287,7 @@ if ($fixed_bug_30395)
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist;
}
---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID
+--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
SELECT * FROM information_schema.processlist;
--real_sleep 0.3
@@ -307,7 +308,7 @@ connect (con103,localhost,ddicttestuser1,ddictpass,information_schema);
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist;
---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID
+--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
SELECT * FROM information_schema.processlist;
--real_sleep 0.3
@@ -329,7 +330,7 @@ connect (con104,localhost,ddicttestuser1,ddictpass,information_schema);
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist;
---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID
+--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
SELECT * FROM information_schema.processlist;
--real_sleep 0.3
@@ -376,7 +377,7 @@ connect (con200,localhost,ddicttestuser2,ddictpass,information_schema);
SHOW GRANTS FOR 'ddicttestuser2'@'localhost';
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist;
---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID
+--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
SELECT * FROM information_schema.processlist;
--real_sleep 0.3
@@ -397,7 +398,7 @@ connect (con201,localhost,ddicttestuser2,ddictpass,information_schema);
SHOW GRANTS;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist;
---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID
+--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
SELECT * FROM information_schema.processlist;
--real_sleep 0.3
@@ -420,7 +421,7 @@ SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost';
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist;
---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID
+--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
SELECT * FROM information_schema.processlist;
--real_sleep 0.3
@@ -444,7 +445,7 @@ connect (con108,localhost,ddicttestuser1,ddictpass,information_schema);
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist;
---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID
+--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
SELECT * FROM information_schema.processlist;
--real_sleep 0.3
diff --git a/mysql-test/suite/funcs_1/datadict/processlist_val.inc b/mysql-test/suite/funcs_1/datadict/processlist_val.inc
index 72c23fa89ed..6e76cedde2e 100644
--- a/mysql-test/suite/funcs_1/datadict/processlist_val.inc
+++ b/mysql-test/suite/funcs_1/datadict/processlist_val.inc
@@ -92,7 +92,7 @@ echo
# - INFO must contain the corresponding SHOW/SELECT PROCESSLIST
#
# 1. Just dump what we get
---replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID>
+--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID> 17 <TID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS>
SHOW FULL PROCESSLIST;
@@ -165,7 +165,7 @@ let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE COMMAND = 'Sleep' AND USER = 'test_user';
--source include/wait_condition.inc
# 1. Just dump what we get
---replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 7 <STATE> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID>
+--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 7 <STATE> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID> 17 <TID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME>
SHOW FULL PROCESSLIST;
@@ -210,7 +210,7 @@ echo
# ----- switch to connection con1 (user = test_user) -----
;
connection con1;
---replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID>
+--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID> 17 <TID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME>
SHOW FULL PROCESSLIST;
@@ -244,7 +244,7 @@ echo
;
connection con2;
# Just dump what we get
---replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID>
+--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID> 17 <TID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME>
SHOW FULL PROCESSLIST;
@@ -304,7 +304,7 @@ WHERE ID = @test_user_con2_id AND Command IN('Query','Execute')
AND State = 'User sleep' AND INFO IS NOT NULL ;
--source include/wait_condition.inc
# 1. Just dump what we get
---replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID>
+--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID> 17 <TID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME>
SHOW FULL PROCESSLIST;
@@ -375,7 +375,7 @@ let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST
#
# Expect to see the state 'Waiting for table metadata lock' for the third
# connection because the SELECT collides with the WRITE TABLE LOCK.
---replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID>
+--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID> 17 <TID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
UNLOCK TABLES;
#
@@ -434,7 +434,7 @@ echo
# SHOW FULL PROCESSLIST Complete statement
# SHOW PROCESSLIST statement truncated after 100 char
;
---replace_column 1 <ID> 3 <HOST_NAME> 5 <COMMAND> 6 <TIME> 7 <STATE> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID>
+--replace_column 1 <ID> 3 <HOST_NAME> 5 <COMMAND> 6 <TIME> 7 <STATE> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID> 17 <TID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--replace_column 1 <ID> 3 <HOST_NAME> 5 <COMMAND> 6 <TIME> 7 <STATE>
SHOW FULL PROCESSLIST;
diff --git a/mysql-test/suite/funcs_1/r/innodb_func_view.result b/mysql-test/suite/funcs_1/r/innodb_func_view.result
index b91f1a0bfdb..de30240b288 100644
--- a/mysql-test/suite/funcs_1/r/innodb_func_view.result
+++ b/mysql-test/suite/funcs_1/r/innodb_func_view.result
@@ -14,7 +14,7 @@ ALTER TABLE t1_values ADD my_varbinary_1000 VARBINARY(1000);
ALTER TABLE t1_values ADD my_datetime DATETIME;
ALTER TABLE t1_values ADD my_date DATE;
ALTER TABLE t1_values ADD ts_dummy TIMESTAMP;
-ALTER TABLE t1_values ADD my_timestamp TIMESTAMP;
+ALTER TABLE t1_values ADD my_timestamp TIMESTAMP NOT NULL DEFAULT '2001-01-01 10:20:30';
ALTER TABLE t1_values ADD my_time TIME;
ALTER TABLE t1_values ADD my_year YEAR;
ALTER TABLE t1_values ADD my_bigint BIGINT;
@@ -1276,7 +1276,7 @@ SELECT IFNULL(my_timestamp,'IS_NULL'),
my_timestamp, id FROM t1_values
WHERE select_id = 136 OR select_id IS NULL order by id;
IFNULL(my_timestamp,'IS_NULL') my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
@@ -1288,7 +1288,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 136 OR select_id IS NULL) order by id;
IFNULL(my_timestamp,'IS_NULL') my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
@@ -1595,7 +1595,7 @@ SELECT IF(my_timestamp IS NULL, 'IS NULL',
WHERE select_id = 124 OR select_id IS NULL order by id;
IF(my_timestamp IS NULL, 'IS NULL',
'IS NOT NULL') my_timestamp id
-IS NOT NULL 0000-00-00 00:00:00 1
+IS NOT NULL 2001-01-01 10:20:30 1
IS NOT NULL 1970-01-01 14:00:01 2
IS NOT NULL 2038-01-01 02:59:59 3
IS NOT NULL 2004-02-29 23:59:59 4
@@ -1609,7 +1609,7 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 124 OR select_id IS NULL) order by id;
IF(my_timestamp IS NULL, 'IS NULL',
'IS NOT NULL') my_timestamp id
-IS NOT NULL 0000-00-00 00:00:00 1
+IS NOT NULL 2001-01-01 10:20:30 1
IS NOT NULL 1970-01-01 14:00:01 2
IS NOT NULL 2038-01-01 02:59:59 3
IS NOT NULL 2004-02-29 23:59:59 4
@@ -1936,7 +1936,7 @@ SELECT IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE'),
my_timestamp, id FROM t1_values
WHERE select_id = 112 OR select_id IS NULL order by id;
IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE') my_timestamp id
-IS NOT TRUE 0000-00-00 00:00:00 1
+IS TRUE 2001-01-01 10:20:30 1
IS TRUE 1970-01-01 14:00:01 2
IS TRUE 2038-01-01 02:59:59 3
IS TRUE 2004-02-29 23:59:59 4
@@ -1948,7 +1948,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 112 OR select_id IS NULL) order by id;
IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE') my_timestamp id
-IS NOT TRUE 0000-00-00 00:00:00 1
+IS TRUE 2001-01-01 10:20:30 1
IS TRUE 1970-01-01 14:00:01 2
IS TRUE 2038-01-01 02:59:59 3
IS TRUE 2004-02-29 23:59:59 4
@@ -2098,8 +2098,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
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 if(`t1_values`.`my_varbinary_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -2113,8 +2114,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -2166,8 +2168,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
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 if(`t1_values`.`my_varchar_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -2181,8 +2184,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
@@ -2198,6 +2202,7 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' '
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
@@ -2213,6 +2218,7 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' '
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
@@ -2282,7 +2288,7 @@ NULL NULL 1
---????????@??*$-- ---äÖüß@µ*$-- 4
-1 -1 5
Warnings:
-Warning 1976 Cannot convert 'latin1' character 0xC3 to 'koi8r'
+Warning 1977 Cannot convert 'latin1' character 0xC3 to 'koi8r'
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 convert(`t1_values`.`my_varchar_1000` using koi8r) AS `CONVERT(my_varchar_1000 USING koi8r)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -2296,7 +2302,7 @@ NULL NULL 1
---????????@??*$-- ---äÖüß@µ*$-- 4
-1 -1 5
Warnings:
-Warning 1976 Cannot convert 'latin1' character 0xC3 to 'koi8r'
+Warning 1977 Cannot convert 'latin1' character 0xC3 to 'koi8r'
DROP VIEW v1;
@@ -2312,7 +2318,7 @@ NULL NULL 1
---????????@??*$-- ---äÖüß@µ*$-- 4
-1 -1 5
Warnings:
-Warning 1976 Cannot convert 'latin1' character 0xC3 to 'koi8r'
+Warning 1977 Cannot convert 'latin1' character 0xC3 to 'koi8r'
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 convert(`t1_values`.`my_char_30` using koi8r) AS `CONVERT(my_char_30 USING koi8r)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -2326,7 +2332,7 @@ NULL NULL 1
---????????@??*$-- ---äÖüß@µ*$-- 4
-1 -1 5
Warnings:
-Warning 1976 Cannot convert 'latin1' character 0xC3 to 'koi8r'
+Warning 1977 Cannot convert 'latin1' character 0xC3 to 'koi8r'
DROP VIEW v1;
@@ -2496,7 +2502,7 @@ SELECT CAST(my_timestamp AS UNSIGNED INTEGER),
my_timestamp, id FROM t1_values
WHERE select_id = 92 OR select_id IS NULL order by id;
CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id
-0 0000-00-00 00:00:00 1
+20010101102030 2001-01-01 10:20:30 1
19700101140001 1970-01-01 14:00:01 2
20380101025959 2038-01-01 02:59:59 3
20040229235959 2004-02-29 23:59:59 4
@@ -2508,7 +2514,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 92 OR select_id IS NULL) order by id;
CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id
-0 0000-00-00 00:00:00 1
+20010101102030 2001-01-01 10:20:30 1
19700101140001 1970-01-01 14:00:01 2
20380101025959 2038-01-01 02:59:59 3
20040229235959 2004-02-29 23:59:59 4
@@ -2874,7 +2880,7 @@ SELECT CAST(my_timestamp AS SIGNED INTEGER),
my_timestamp, id FROM t1_values
WHERE select_id = 80 OR select_id IS NULL order by id;
CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id
-0 0000-00-00 00:00:00 1
+20010101102030 2001-01-01 10:20:30 1
19700101140001 1970-01-01 14:00:01 2
20380101025959 2038-01-01 02:59:59 3
20040229235959 2004-02-29 23:59:59 4
@@ -2886,7 +2892,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 80 OR select_id IS NULL) order by id;
CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id
-0 0000-00-00 00:00:00 1
+20010101102030 2001-01-01 10:20:30 1
19700101140001 1970-01-01 14:00:01 2
20380101025959 2038-01-01 02:59:59 3
20040229235959 2004-02-29 23:59:59 4
@@ -3232,7 +3238,7 @@ SELECT CAST(my_timestamp AS DECIMAL(37,2)),
my_timestamp, id FROM t1_values
WHERE select_id = 68 OR select_id IS NULL order by id;
CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id
-0.00 0000-00-00 00:00:00 1
+20010101102030.00 2001-01-01 10:20:30 1
19700101140001.00 1970-01-01 14:00:01 2
20380101025959.00 2038-01-01 02:59:59 3
20040229235959.00 2004-02-29 23:59:59 4
@@ -3244,7 +3250,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 68 OR select_id IS NULL) order by id;
CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id
-0.00 0000-00-00 00:00:00 1
+20010101102030.00 2001-01-01 10:20:30 1
19700101140001.00 1970-01-01 14:00:01 2
20380101025959.00 2038-01-01 02:59:59 3
20040229235959.00 2004-02-29 23:59:59 4
@@ -3412,7 +3418,7 @@ Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
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 cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3432,7 +3438,7 @@ Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -3500,7 +3506,7 @@ Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
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 cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3520,7 +3526,7 @@ Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
@@ -3624,7 +3630,7 @@ SELECT CAST(my_timestamp AS TIME),
my_timestamp, id FROM t1_values
WHERE select_id = 56 OR select_id IS NULL order by id;
CAST(my_timestamp AS TIME) my_timestamp id
-00:00:00 0000-00-00 00:00:00 1
+10:20:30 2001-01-01 10:20:30 1
14:00:01 1970-01-01 14:00:01 2
02:59:59 2038-01-01 02:59:59 3
23:59:59 2004-02-29 23:59:59 4
@@ -3636,7 +3642,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 56 OR select_id IS NULL) order by id;
CAST(my_timestamp AS TIME) my_timestamp id
-00:00:00 0000-00-00 00:00:00 1
+10:20:30 2001-01-01 10:20:30 1
14:00:01 1970-01-01 14:00:01 2
02:59:59 2038-01-01 02:59:59 3
23:59:59 2004-02-29 23:59:59 4
@@ -3970,7 +3976,7 @@ SELECT CAST(my_timestamp AS DATETIME),
my_timestamp, id FROM t1_values
WHERE select_id = 45 OR select_id IS NULL order by id;
CAST(my_timestamp AS DATETIME) my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
@@ -3982,7 +3988,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 45 OR select_id IS NULL) order by id;
CAST(my_timestamp AS DATETIME) my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
@@ -4332,7 +4338,7 @@ SELECT CAST(my_timestamp AS DATE),
my_timestamp, id FROM t1_values
WHERE select_id = 34 OR select_id IS NULL order by id;
CAST(my_timestamp AS DATE) my_timestamp id
-0000-00-00 0000-00-00 00:00:00 1
+2001-01-01 2001-01-01 10:20:30 1
1970-01-01 1970-01-01 14:00:01 2
2038-01-01 2038-01-01 02:59:59 3
2004-02-29 2004-02-29 23:59:59 4
@@ -4344,7 +4350,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 34 OR select_id IS NULL) order by id;
CAST(my_timestamp AS DATE) my_timestamp id
-0000-00-00 0000-00-00 00:00:00 1
+2001-01-01 2001-01-01 10:20:30 1
1970-01-01 1970-01-01 14:00:01 2
2038-01-01 2038-01-01 02:59:59 3
2004-02-29 2004-02-29 23:59:59 4
@@ -4690,7 +4696,7 @@ SELECT CAST(my_timestamp AS CHAR),
my_timestamp, id FROM t1_values
WHERE select_id = 23 OR select_id IS NULL order by id;
CAST(my_timestamp AS CHAR) my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
@@ -4702,7 +4708,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 23 OR select_id IS NULL) order by id;
CAST(my_timestamp AS CHAR) my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
@@ -5002,7 +5008,7 @@ SELECT CAST(my_timestamp AS BINARY),
my_timestamp, id FROM t1_values
WHERE select_id = 11 OR select_id IS NULL order by id;
CAST(my_timestamp AS BINARY) my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
@@ -5014,7 +5020,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 11 OR select_id IS NULL) order by id;
CAST(my_timestamp AS BINARY) my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
diff --git a/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result b/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result
index fa8fb6c1eb2..1131477869a 100644
--- a/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result
+++ b/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result
@@ -1,3 +1,5 @@
+set sql_mode="";
+set GLOBAL sql_mode="";
--source suite/funcs_1/storedproc/load_sp_tb.inc
--------------------------------------------------------------------------------
@@ -388,6 +390,7 @@ DROP USER 'user_2'@'localhost';
--------------------------------------------------------------------------------
DROP DATABASE IF EXISTS db_storedproc;
DROP DATABASE IF EXISTS db_storedproc_1;
+set GLOBAL sql_mode=default;
. +++ END OF SCRIPT +++
--------------------------------------------------------------------------------
diff --git a/mysql-test/suite/funcs_1/r/innodb_storedproc_08.result b/mysql-test/suite/funcs_1/r/innodb_storedproc_08.result
index 0dfc1f51b76..de63339ee95 100644
--- a/mysql-test/suite/funcs_1/r/innodb_storedproc_08.result
+++ b/mysql-test/suite/funcs_1/r/innodb_storedproc_08.result
@@ -1,3 +1,4 @@
+set sql_mode="";
--source suite/funcs_1/storedproc/load_sp_tb.inc
--------------------------------------------------------------------------------
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_03.result b/mysql-test/suite/funcs_1/r/innodb_trig_03.result
index db92ea56444..5edef4cf3af 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_03.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_03.result
@@ -1,3 +1,4 @@
+set sql_mode="";
USE test;
drop table if exists tb3;
create table tb3 (
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_03e.result b/mysql-test/suite/funcs_1/r/innodb_trig_03e.result
index cf93657885c..6d8bba4714b 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_03e.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_03e.result
@@ -449,8 +449,8 @@ create trigger trg1_4 before UPDATE on t1 for each row
set new.f1 = 'trig 1_4-yes';
show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
-trg1_3 INSERT t1 set new.f1 = 'trig 1_3-yes' BEFORE NULL test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
-trg1_4 UPDATE t1 set new.f1 = 'trig 1_4-yes' BEFORE NULL test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+trg1_3 INSERT t1 set new.f1 = 'trig 1_3-yes' BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+trg1_4 UPDATE t1 set new.f1 = 'trig 1_4-yes' BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
select current_user;
current_user
test_noprivs@localhost
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_0407.result b/mysql-test/suite/funcs_1/r/innodb_trig_0407.result
index 7f01975db16..c51347d5fa8 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_0407.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_0407.result
@@ -1,3 +1,5 @@
+set sql_mode="";
+set GLOBAL sql_mode="";
USE test;
drop table if exists tb3;
create table tb3 (
@@ -468,3 +470,4 @@ drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;
DROP TABLE test.tb3;
+set GLOBAL sql_mode=default;
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_08.result b/mysql-test/suite/funcs_1/r/innodb_trig_08.result
index f9454edce4b..20354088a0f 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_08.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_08.result
@@ -1,3 +1,5 @@
+set sql_mode="";
+set GLOBAL sql_mode="";
USE test;
drop table if exists tb3;
create table tb3 (
@@ -521,3 +523,4 @@ drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;
DROP TABLE test.tb3;
+set GLOBAL sql_mode=default;
diff --git a/mysql-test/suite/funcs_1/r/innodb_views.result b/mysql-test/suite/funcs_1/r/innodb_views.result
index e7523922154..59eec5b0220 100644
--- a/mysql-test/suite/funcs_1/r/innodb_views.result
+++ b/mysql-test/suite/funcs_1/r/innodb_views.result
@@ -22032,7 +22032,7 @@ Testcase 3.3.2.1 - 3.3.2.6 alternative implementation
--------------------------------------------------------------------------------
DROP TABLE IF EXISTS t1;
DROP VIEW IF EXISTS v1;
-CREATE TABLE t1 ( f1 BIGINT, f2 CHAR(20), f3 NUMERIC(7,4),
+CREATE TABLE t1 ( f1 BIGINT DEFAULT 0, f2 CHAR(20), f3 NUMERIC(7,4),
f4 CHAR, PRIMARY KEY(f1));
CREATE VIEW v1 AS SELECT f1, f2, f3 FROM t1;
INSERT INTO v1 SET f1 = 1;
diff --git a/mysql-test/suite/funcs_1/r/is_columns.result b/mysql-test/suite/funcs_1/r/is_columns.result
index e3d66a1ed6c..ada8110d229 100644
--- a/mysql-test/suite/funcs_1/r/is_columns.result
+++ b/mysql-test/suite/funcs_1/r/is_columns.result
@@ -125,10 +125,10 @@ def db_datadict t1 f1 1 NULL YES char 10 10 NULL NULL NULL latin1 latin1_swedish
def db_datadict t1 f2 2 NULL YES text 65535 65535 NULL NULL NULL latin1 latin1_swedish_ci text select,insert,update,references
def db_datadict t1 f3 3 NULL YES date NULL NULL NULL NULL NULL NULL NULL date select,insert,update,references
def db_datadict t1 f4 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) PRI auto_increment select,insert,update,references
-def db_datadict t2 f1 1 NO char 10 10 NULL NULL NULL latin1 latin1_swedish_ci char(10) PRI select,insert,update,references
+def db_datadict t2 f1 1 NULL NO char 10 10 NULL NULL NULL latin1 latin1_swedish_ci char(10) PRI select,insert,update,references
def db_datadict t2 f2 2 NULL YES text 65535 65535 NULL NULL NULL latin1 latin1_swedish_ci text select,insert,update,references
def db_datadict t2 f3 3 NULL YES date NULL NULL NULL NULL NULL NULL NULL date select,insert,update,references
-def db_datadict t2 f4 4 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) PRI select,insert,update,references
+def db_datadict t2 f4 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) PRI select,insert,update,references
def db_datadict v1 f1 1 0 NO int NULL NULL 10 0 NULL NULL NULL int(1) select,insert,update,references
def db_datadict v1 f2 2 0 NO int NULL NULL 10 0 NULL NULL NULL int(1) select,insert,update,references
SHOW COLUMNS FROM db_datadict.t1;
@@ -139,10 +139,10 @@ f3 date YES NULL
f4 int(11) NO PRI NULL auto_increment
SHOW COLUMNS FROM db_datadict.t2;
Field Type Null Key Default Extra
-f1 char(10) NO PRI
+f1 char(10) NO PRI NULL
f2 text YES NULL
f3 date YES NULL
-f4 int(11) NO PRI 0
+f4 int(11) NO PRI NULL
SHOW COLUMNS FROM db_datadict.v1;
Field Type Null Key Default Extra
f1 int(1) NO 0
@@ -169,13 +169,13 @@ SELECT * FROM information_schema.columns
WHERE table_schema = 'db_datadict'
ORDER BY table_schema, table_name, ordinal_position;
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 db_datadict t2 f1 1 NO char 10 10 NULL NULL NULL latin1 latin1_swedish_ci char(10) PRI insert
+def db_datadict t2 f1 1 NULL NO char 10 10 NULL NULL NULL latin1 latin1_swedish_ci char(10) PRI insert
def db_datadict t2 f2 2 NULL YES text 65535 65535 NULL NULL NULL latin1 latin1_swedish_ci text insert
SHOW COLUMNS FROM db_datadict.t1;
ERROR 42000: SELECT command denied to user 'testuser2'@'localhost' for table 't1'
SHOW COLUMNS FROM db_datadict.t2;
Field Type Null Key Default Extra
-f1 char(10) NO PRI
+f1 char(10) NO PRI NULL
f2 text YES NULL
SHOW COLUMNS FROM db_datadict.v1;
ERROR 42000: SELECT command denied to user 'testuser2'@'localhost' for table 'v1'
diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result
index 866461720f0..34ff5ecafee 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_is.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_is.result
@@ -167,9 +167,9 @@ def information_schema GEOMETRY_COLUMNS MAX_PPR 12 0 NO tinyint NULL NULL 3 0 NU
def information_schema GEOMETRY_COLUMNS SRID 13 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) select
def information_schema GEOMETRY_COLUMNS STORAGE_TYPE 9 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) select
def information_schema GLOBAL_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select
+def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select
def information_schema GLOBAL_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select
+def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select
def information_schema INDEX_STATISTICS INDEX_NAME 3 NO varchar 192 576 NULL NULL NULL utf8 utf8_general_ci varchar(192) select
def information_schema INDEX_STATISTICS ROWS_READ 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select
def information_schema INDEX_STATISTICS TABLE_NAME 2 NO varchar 192 576 NULL NULL NULL utf8 utf8_general_ci varchar(192) select
@@ -265,6 +265,7 @@ def information_schema PROCESSLIST PROGRESS 12 0.000 NO decimal NULL NULL 7 3 NU
def information_schema PROCESSLIST QUERY_ID 15 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select
def information_schema PROCESSLIST STAGE 10 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) select
def information_schema PROCESSLIST STATE 7 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
+def information_schema PROCESSLIST TID 17 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select
def information_schema PROCESSLIST TIME 6 0 NO int NULL NULL 10 0 NULL NULL NULL int(7) select
def information_schema PROCESSLIST TIME_MS 9 0.000 NO decimal NULL NULL 22 3 NULL NULL NULL decimal(22,3) select
def information_schema PROCESSLIST USER 2 NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select
@@ -321,9 +322,9 @@ def information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE 4 NO varchar 64 192 NUL
def information_schema SCHEMA_PRIVILEGES TABLE_CATALOG 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select
def information_schema SCHEMA_PRIVILEGES TABLE_SCHEMA 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema SESSION_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema SESSION_STATUS VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select
+def information_schema SESSION_STATUS VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select
def information_schema SESSION_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select
+def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select
def information_schema SPATIAL_REF_SYS AUTH_NAME 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select
def information_schema SPATIAL_REF_SYS AUTH_SRID 3 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) select
def information_schema SPATIAL_REF_SYS SRID 1 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) select
@@ -345,15 +346,15 @@ def information_schema STATISTICS TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL
def information_schema STATISTICS TABLE_NAME 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema STATISTICS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema SYSTEM_VARIABLES COMMAND_LINE_ARGUMENT 14 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema SYSTEM_VARIABLES DEFAULT_VALUE 5 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select
+def information_schema SYSTEM_VARIABLES DEFAULT_VALUE 5 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select
def information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST 12 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext select
-def information_schema SYSTEM_VARIABLES GLOBAL_VALUE 3 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select
+def information_schema SYSTEM_VARIABLES GLOBAL_VALUE 3 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select
def information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN 4 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema SYSTEM_VARIABLES NUMERIC_BLOCK_SIZE 11 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) select
def information_schema SYSTEM_VARIABLES NUMERIC_MAX_VALUE 10 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) select
def information_schema SYSTEM_VARIABLES NUMERIC_MIN_VALUE 9 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) select
def information_schema SYSTEM_VARIABLES READ_ONLY 13 NO varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3) select
-def information_schema SYSTEM_VARIABLES SESSION_VALUE 2 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select
+def information_schema SYSTEM_VARIABLES SESSION_VALUE 2 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select
def information_schema SYSTEM_VARIABLES VARIABLE_COMMENT 8 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select
def information_schema SYSTEM_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema SYSTEM_VARIABLES VARIABLE_SCOPE 6 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
@@ -694,9 +695,9 @@ NULL information_schema GEOMETRY_COLUMNS COORD_DIMENSION tinyint NULL NULL NULL
NULL information_schema GEOMETRY_COLUMNS MAX_PPR tinyint NULL NULL NULL NULL tinyint(2)
NULL information_schema GEOMETRY_COLUMNS SRID smallint NULL NULL NULL NULL smallint(5)
3.0000 information_schema GLOBAL_STATUS VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema GLOBAL_STATUS VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
+3.0000 information_schema GLOBAL_STATUS VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema GLOBAL_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema GLOBAL_VARIABLES VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
+3.0000 information_schema GLOBAL_VARIABLES VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema INDEX_STATISTICS TABLE_SCHEMA varchar 192 576 utf8 utf8_general_ci varchar(192)
3.0000 information_schema INDEX_STATISTICS TABLE_NAME varchar 192 576 utf8 utf8_general_ci varchar(192)
3.0000 information_schema INDEX_STATISTICS INDEX_NAME varchar 192 576 utf8 utf8_general_ci varchar(192)
@@ -795,6 +796,7 @@ NULL information_schema PROCESSLIST MEMORY_USED int NULL NULL NULL NULL int(7)
NULL information_schema PROCESSLIST EXAMINED_ROWS int NULL NULL NULL NULL int(7)
NULL information_schema PROCESSLIST QUERY_ID bigint NULL NULL NULL NULL bigint(4)
1.0000 information_schema PROCESSLIST INFO_BINARY blob 65535 65535 NULL NULL blob
+NULL information_schema PROCESSLIST TID bigint NULL NULL NULL NULL bigint(4)
3.0000 information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
3.0000 information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
@@ -848,9 +850,9 @@ NULL information_schema ROUTINES LAST_ALTERED datetime NULL NULL NULL NULL datet
3.0000 information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema SCHEMA_PRIVILEGES IS_GRANTABLE varchar 3 9 utf8 utf8_general_ci varchar(3)
3.0000 information_schema SESSION_STATUS VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema SESSION_STATUS VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
+3.0000 information_schema SESSION_STATUS VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema SESSION_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema SESSION_VARIABLES VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
+3.0000 information_schema SESSION_VARIABLES VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
NULL information_schema SPATIAL_REF_SYS SRID smallint NULL NULL NULL NULL smallint(5)
3.0000 information_schema SPATIAL_REF_SYS AUTH_NAME varchar 512 1536 utf8 utf8_general_ci varchar(512)
NULL information_schema SPATIAL_REF_SYS AUTH_SRID smallint NULL NULL NULL NULL smallint(5)
@@ -872,10 +874,10 @@ NULL information_schema STATISTICS SUB_PART bigint NULL NULL NULL NULL bigint(3)
3.0000 information_schema STATISTICS COMMENT varchar 16 48 utf8 utf8_general_ci varchar(16)
3.0000 information_schema STATISTICS INDEX_COMMENT varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema SYSTEM_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema SYSTEM_VARIABLES SESSION_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
-3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
+3.0000 information_schema SYSTEM_VARIABLES SESSION_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
+3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema SYSTEM_VARIABLES DEFAULT_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
+3.0000 information_schema SYSTEM_VARIABLES DEFAULT_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema SYSTEM_VARIABLES VARIABLE_SCOPE varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema SYSTEM_VARIABLES VARIABLE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema SYSTEM_VARIABLES VARIABLE_COMMENT varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
diff --git a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
index c314165367f..bd49492c353 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
@@ -167,9 +167,9 @@ def information_schema GEOMETRY_COLUMNS MAX_PPR 12 0 NO tinyint NULL NULL 3 0 NU
def information_schema GEOMETRY_COLUMNS SRID 13 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5)
def information_schema GEOMETRY_COLUMNS STORAGE_TYPE 9 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2)
def information_schema GLOBAL_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
-def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024)
+def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048)
def information_schema GLOBAL_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
-def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024)
+def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048)
def information_schema INDEX_STATISTICS INDEX_NAME 3 NO varchar 192 576 NULL NULL NULL utf8 utf8_general_ci varchar(192)
def information_schema INDEX_STATISTICS ROWS_READ 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21)
def information_schema INDEX_STATISTICS TABLE_NAME 2 NO varchar 192 576 NULL NULL NULL utf8 utf8_general_ci varchar(192)
@@ -321,9 +321,9 @@ def information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE 4 NO varchar 64 192 NUL
def information_schema SCHEMA_PRIVILEGES TABLE_CATALOG 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512)
def information_schema SCHEMA_PRIVILEGES TABLE_SCHEMA 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
def information_schema SESSION_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
-def information_schema SESSION_STATUS VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024)
+def information_schema SESSION_STATUS VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048)
def information_schema SESSION_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
-def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024)
+def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048)
def information_schema SPATIAL_REF_SYS AUTH_NAME 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512)
def information_schema SPATIAL_REF_SYS AUTH_SRID 3 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5)
def information_schema SPATIAL_REF_SYS SRID 1 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5)
@@ -345,15 +345,15 @@ def information_schema STATISTICS TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL
def information_schema STATISTICS TABLE_NAME 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
def information_schema STATISTICS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
def information_schema SYSTEM_VARIABLES COMMAND_LINE_ARGUMENT 14 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
-def information_schema SYSTEM_VARIABLES DEFAULT_VALUE 5 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024)
+def information_schema SYSTEM_VARIABLES DEFAULT_VALUE 5 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048)
def information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST 12 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext
-def information_schema SYSTEM_VARIABLES GLOBAL_VALUE 3 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024)
+def information_schema SYSTEM_VARIABLES GLOBAL_VALUE 3 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048)
def information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN 4 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
def information_schema SYSTEM_VARIABLES NUMERIC_BLOCK_SIZE 11 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21)
def information_schema SYSTEM_VARIABLES NUMERIC_MAX_VALUE 10 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21)
def information_schema SYSTEM_VARIABLES NUMERIC_MIN_VALUE 9 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21)
def information_schema SYSTEM_VARIABLES READ_ONLY 13 NO varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3)
-def information_schema SYSTEM_VARIABLES SESSION_VALUE 2 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024)
+def information_schema SYSTEM_VARIABLES SESSION_VALUE 2 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048)
def information_schema SYSTEM_VARIABLES VARIABLE_COMMENT 8 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048)
def information_schema SYSTEM_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
def information_schema SYSTEM_VARIABLES VARIABLE_SCOPE 6 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
@@ -694,9 +694,9 @@ NULL information_schema GEOMETRY_COLUMNS COORD_DIMENSION tinyint NULL NULL NULL
NULL information_schema GEOMETRY_COLUMNS MAX_PPR tinyint NULL NULL NULL NULL tinyint(2)
NULL information_schema GEOMETRY_COLUMNS SRID smallint NULL NULL NULL NULL smallint(5)
3.0000 information_schema GLOBAL_STATUS VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema GLOBAL_STATUS VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
+3.0000 information_schema GLOBAL_STATUS VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema GLOBAL_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema GLOBAL_VARIABLES VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
+3.0000 information_schema GLOBAL_VARIABLES VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema INDEX_STATISTICS TABLE_SCHEMA varchar 192 576 utf8 utf8_general_ci varchar(192)
3.0000 information_schema INDEX_STATISTICS TABLE_NAME varchar 192 576 utf8 utf8_general_ci varchar(192)
3.0000 information_schema INDEX_STATISTICS INDEX_NAME varchar 192 576 utf8 utf8_general_ci varchar(192)
@@ -848,9 +848,9 @@ NULL information_schema ROUTINES LAST_ALTERED datetime NULL NULL NULL NULL datet
3.0000 information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema SCHEMA_PRIVILEGES IS_GRANTABLE varchar 3 9 utf8 utf8_general_ci varchar(3)
3.0000 information_schema SESSION_STATUS VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema SESSION_STATUS VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
+3.0000 information_schema SESSION_STATUS VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema SESSION_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema SESSION_VARIABLES VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
+3.0000 information_schema SESSION_VARIABLES VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
NULL information_schema SPATIAL_REF_SYS SRID smallint NULL NULL NULL NULL smallint(5)
3.0000 information_schema SPATIAL_REF_SYS AUTH_NAME varchar 512 1536 utf8 utf8_general_ci varchar(512)
NULL information_schema SPATIAL_REF_SYS AUTH_SRID smallint NULL NULL NULL NULL smallint(5)
@@ -872,10 +872,10 @@ NULL information_schema STATISTICS SUB_PART bigint NULL NULL NULL NULL bigint(3)
3.0000 information_schema STATISTICS COMMENT varchar 16 48 utf8 utf8_general_ci varchar(16)
3.0000 information_schema STATISTICS INDEX_COMMENT varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema SYSTEM_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema SYSTEM_VARIABLES SESSION_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
-3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
+3.0000 information_schema SYSTEM_VARIABLES SESSION_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
+3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema SYSTEM_VARIABLES DEFAULT_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
+3.0000 information_schema SYSTEM_VARIABLES DEFAULT_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema SYSTEM_VARIABLES VARIABLE_SCOPE varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema SYSTEM_VARIABLES VARIABLE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema SYSTEM_VARIABLES VARIABLE_COMMENT varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
diff --git a/mysql-test/suite/funcs_1/r/is_routines.result b/mysql-test/suite/funcs_1/r/is_routines.result
index a062e2d7b8f..525b5c92a68 100644
--- a/mysql-test/suite/funcs_1/r/is_routines.result
+++ b/mysql-test/suite/funcs_1/r/is_routines.result
@@ -1,3 +1,4 @@
+set sql_mode="";
SHOW TABLES FROM information_schema LIKE 'ROUTINES';
Tables_in_information_schema (ROUTINES)
ROUTINES
diff --git a/mysql-test/suite/funcs_1/r/is_triggers.result b/mysql-test/suite/funcs_1/r/is_triggers.result
index 53bb54aa0f2..d6b5f3a42bf 100644
--- a/mysql-test/suite/funcs_1/r/is_triggers.result
+++ b/mysql-test/suite/funcs_1/r/is_triggers.result
@@ -1,3 +1,4 @@
+set global sql_mode="";
SHOW TABLES FROM information_schema LIKE 'TRIGGERS';
Tables_in_information_schema (TRIGGERS)
TRIGGERS
@@ -228,3 +229,4 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_
ALTER TABLE information_schema.triggers RENAME information_schema.xtriggers;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
DROP DATABASE db_datadict;
+set global sql_mode=default;
diff --git a/mysql-test/suite/funcs_1/r/memory_func_view.result b/mysql-test/suite/funcs_1/r/memory_func_view.result
index 250ef4453a3..f8b6dc66d8a 100644
--- a/mysql-test/suite/funcs_1/r/memory_func_view.result
+++ b/mysql-test/suite/funcs_1/r/memory_func_view.result
@@ -15,7 +15,7 @@ ALTER TABLE t1_values ADD my_varbinary_1000 VARBINARY(1000);
ALTER TABLE t1_values ADD my_datetime DATETIME;
ALTER TABLE t1_values ADD my_date DATE;
ALTER TABLE t1_values ADD ts_dummy TIMESTAMP;
-ALTER TABLE t1_values ADD my_timestamp TIMESTAMP;
+ALTER TABLE t1_values ADD my_timestamp TIMESTAMP NOT NULL DEFAULT '2001-01-01 10:20:30';
ALTER TABLE t1_values ADD my_time TIME;
ALTER TABLE t1_values ADD my_year YEAR;
ALTER TABLE t1_values ADD my_bigint BIGINT;
@@ -1277,7 +1277,7 @@ SELECT IFNULL(my_timestamp,'IS_NULL'),
my_timestamp, id FROM t1_values
WHERE select_id = 136 OR select_id IS NULL order by id;
IFNULL(my_timestamp,'IS_NULL') my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
@@ -1289,7 +1289,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 136 OR select_id IS NULL) order by id;
IFNULL(my_timestamp,'IS_NULL') my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
@@ -1596,7 +1596,7 @@ SELECT IF(my_timestamp IS NULL, 'IS NULL',
WHERE select_id = 124 OR select_id IS NULL order by id;
IF(my_timestamp IS NULL, 'IS NULL',
'IS NOT NULL') my_timestamp id
-IS NOT NULL 0000-00-00 00:00:00 1
+IS NOT NULL 2001-01-01 10:20:30 1
IS NOT NULL 1970-01-01 14:00:01 2
IS NOT NULL 2038-01-01 02:59:59 3
IS NOT NULL 2004-02-29 23:59:59 4
@@ -1610,7 +1610,7 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 124 OR select_id IS NULL) order by id;
IF(my_timestamp IS NULL, 'IS NULL',
'IS NOT NULL') my_timestamp id
-IS NOT NULL 0000-00-00 00:00:00 1
+IS NOT NULL 2001-01-01 10:20:30 1
IS NOT NULL 1970-01-01 14:00:01 2
IS NOT NULL 2038-01-01 02:59:59 3
IS NOT NULL 2004-02-29 23:59:59 4
@@ -1937,7 +1937,7 @@ SELECT IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE'),
my_timestamp, id FROM t1_values
WHERE select_id = 112 OR select_id IS NULL order by id;
IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE') my_timestamp id
-IS NOT TRUE 0000-00-00 00:00:00 1
+IS TRUE 2001-01-01 10:20:30 1
IS TRUE 1970-01-01 14:00:01 2
IS TRUE 2038-01-01 02:59:59 3
IS TRUE 2004-02-29 23:59:59 4
@@ -1949,7 +1949,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 112 OR select_id IS NULL) order by id;
IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE') my_timestamp id
-IS NOT TRUE 0000-00-00 00:00:00 1
+IS TRUE 2001-01-01 10:20:30 1
IS TRUE 1970-01-01 14:00:01 2
IS TRUE 2038-01-01 02:59:59 3
IS TRUE 2004-02-29 23:59:59 4
@@ -2099,8 +2099,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
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 if(`t1_values`.`my_varbinary_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -2114,8 +2115,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -2167,8 +2169,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
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 if(`t1_values`.`my_varchar_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -2182,8 +2185,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
@@ -2199,6 +2203,7 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' '
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
@@ -2214,6 +2219,7 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' '
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
@@ -2283,7 +2289,7 @@ NULL NULL 1
---????????@??*$-- ---äÖüß@µ*$-- 4
-1 -1 5
Warnings:
-Warning 1976 Cannot convert 'latin1' character 0xC3 to 'koi8r'
+Warning 1977 Cannot convert 'latin1' character 0xC3 to 'koi8r'
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 convert(`t1_values`.`my_varchar_1000` using koi8r) AS `CONVERT(my_varchar_1000 USING koi8r)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -2297,7 +2303,7 @@ NULL NULL 1
---????????@??*$-- ---äÖüß@µ*$-- 4
-1 -1 5
Warnings:
-Warning 1976 Cannot convert 'latin1' character 0xC3 to 'koi8r'
+Warning 1977 Cannot convert 'latin1' character 0xC3 to 'koi8r'
DROP VIEW v1;
@@ -2313,7 +2319,7 @@ NULL NULL 1
---????????@??*$-- ---äÖüß@µ*$-- 4
-1 -1 5
Warnings:
-Warning 1976 Cannot convert 'latin1' character 0xC3 to 'koi8r'
+Warning 1977 Cannot convert 'latin1' character 0xC3 to 'koi8r'
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 convert(`t1_values`.`my_char_30` using koi8r) AS `CONVERT(my_char_30 USING koi8r)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -2327,7 +2333,7 @@ NULL NULL 1
---????????@??*$-- ---äÖüß@µ*$-- 4
-1 -1 5
Warnings:
-Warning 1976 Cannot convert 'latin1' character 0xC3 to 'koi8r'
+Warning 1977 Cannot convert 'latin1' character 0xC3 to 'koi8r'
DROP VIEW v1;
@@ -2497,7 +2503,7 @@ SELECT CAST(my_timestamp AS UNSIGNED INTEGER),
my_timestamp, id FROM t1_values
WHERE select_id = 92 OR select_id IS NULL order by id;
CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id
-0 0000-00-00 00:00:00 1
+20010101102030 2001-01-01 10:20:30 1
19700101140001 1970-01-01 14:00:01 2
20380101025959 2038-01-01 02:59:59 3
20040229235959 2004-02-29 23:59:59 4
@@ -2509,7 +2515,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 92 OR select_id IS NULL) order by id;
CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id
-0 0000-00-00 00:00:00 1
+20010101102030 2001-01-01 10:20:30 1
19700101140001 1970-01-01 14:00:01 2
20380101025959 2038-01-01 02:59:59 3
20040229235959 2004-02-29 23:59:59 4
@@ -2875,7 +2881,7 @@ SELECT CAST(my_timestamp AS SIGNED INTEGER),
my_timestamp, id FROM t1_values
WHERE select_id = 80 OR select_id IS NULL order by id;
CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id
-0 0000-00-00 00:00:00 1
+20010101102030 2001-01-01 10:20:30 1
19700101140001 1970-01-01 14:00:01 2
20380101025959 2038-01-01 02:59:59 3
20040229235959 2004-02-29 23:59:59 4
@@ -2887,7 +2893,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 80 OR select_id IS NULL) order by id;
CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id
-0 0000-00-00 00:00:00 1
+20010101102030 2001-01-01 10:20:30 1
19700101140001 1970-01-01 14:00:01 2
20380101025959 2038-01-01 02:59:59 3
20040229235959 2004-02-29 23:59:59 4
@@ -3233,7 +3239,7 @@ SELECT CAST(my_timestamp AS DECIMAL(37,2)),
my_timestamp, id FROM t1_values
WHERE select_id = 68 OR select_id IS NULL order by id;
CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id
-0.00 0000-00-00 00:00:00 1
+20010101102030.00 2001-01-01 10:20:30 1
19700101140001.00 1970-01-01 14:00:01 2
20380101025959.00 2038-01-01 02:59:59 3
20040229235959.00 2004-02-29 23:59:59 4
@@ -3245,7 +3251,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 68 OR select_id IS NULL) order by id;
CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id
-0.00 0000-00-00 00:00:00 1
+20010101102030.00 2001-01-01 10:20:30 1
19700101140001.00 1970-01-01 14:00:01 2
20380101025959.00 2038-01-01 02:59:59 3
20040229235959.00 2004-02-29 23:59:59 4
@@ -3413,7 +3419,7 @@ Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
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 cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3433,7 +3439,7 @@ Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -3501,7 +3507,7 @@ Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
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 cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3521,7 +3527,7 @@ Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
@@ -3625,7 +3631,7 @@ SELECT CAST(my_timestamp AS TIME),
my_timestamp, id FROM t1_values
WHERE select_id = 56 OR select_id IS NULL order by id;
CAST(my_timestamp AS TIME) my_timestamp id
-00:00:00 0000-00-00 00:00:00 1
+10:20:30 2001-01-01 10:20:30 1
14:00:01 1970-01-01 14:00:01 2
02:59:59 2038-01-01 02:59:59 3
23:59:59 2004-02-29 23:59:59 4
@@ -3637,7 +3643,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 56 OR select_id IS NULL) order by id;
CAST(my_timestamp AS TIME) my_timestamp id
-00:00:00 0000-00-00 00:00:00 1
+10:20:30 2001-01-01 10:20:30 1
14:00:01 1970-01-01 14:00:01 2
02:59:59 2038-01-01 02:59:59 3
23:59:59 2004-02-29 23:59:59 4
@@ -3971,7 +3977,7 @@ SELECT CAST(my_timestamp AS DATETIME),
my_timestamp, id FROM t1_values
WHERE select_id = 45 OR select_id IS NULL order by id;
CAST(my_timestamp AS DATETIME) my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
@@ -3983,7 +3989,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 45 OR select_id IS NULL) order by id;
CAST(my_timestamp AS DATETIME) my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
@@ -4333,7 +4339,7 @@ SELECT CAST(my_timestamp AS DATE),
my_timestamp, id FROM t1_values
WHERE select_id = 34 OR select_id IS NULL order by id;
CAST(my_timestamp AS DATE) my_timestamp id
-0000-00-00 0000-00-00 00:00:00 1
+2001-01-01 2001-01-01 10:20:30 1
1970-01-01 1970-01-01 14:00:01 2
2038-01-01 2038-01-01 02:59:59 3
2004-02-29 2004-02-29 23:59:59 4
@@ -4345,7 +4351,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 34 OR select_id IS NULL) order by id;
CAST(my_timestamp AS DATE) my_timestamp id
-0000-00-00 0000-00-00 00:00:00 1
+2001-01-01 2001-01-01 10:20:30 1
1970-01-01 1970-01-01 14:00:01 2
2038-01-01 2038-01-01 02:59:59 3
2004-02-29 2004-02-29 23:59:59 4
@@ -4691,7 +4697,7 @@ SELECT CAST(my_timestamp AS CHAR),
my_timestamp, id FROM t1_values
WHERE select_id = 23 OR select_id IS NULL order by id;
CAST(my_timestamp AS CHAR) my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
@@ -4703,7 +4709,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 23 OR select_id IS NULL) order by id;
CAST(my_timestamp AS CHAR) my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
@@ -5003,7 +5009,7 @@ SELECT CAST(my_timestamp AS BINARY),
my_timestamp, id FROM t1_values
WHERE select_id = 11 OR select_id IS NULL order by id;
CAST(my_timestamp AS BINARY) my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
@@ -5015,7 +5021,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 11 OR select_id IS NULL) order by id;
CAST(my_timestamp AS BINARY) my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
diff --git a/mysql-test/suite/funcs_1/r/memory_storedproc_06.result b/mysql-test/suite/funcs_1/r/memory_storedproc_06.result
index f08165b21f8..c38481bac50 100644
--- a/mysql-test/suite/funcs_1/r/memory_storedproc_06.result
+++ b/mysql-test/suite/funcs_1/r/memory_storedproc_06.result
@@ -1,4 +1,5 @@
SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION';
+set GLOBAL sql_mode="";
--source suite/funcs_1/storedproc/load_sp_tb.inc
--------------------------------------------------------------------------------
@@ -389,6 +390,7 @@ DROP USER 'user_2'@'localhost';
--------------------------------------------------------------------------------
DROP DATABASE IF EXISTS db_storedproc;
DROP DATABASE IF EXISTS db_storedproc_1;
+set GLOBAL sql_mode=default;
. +++ END OF SCRIPT +++
--------------------------------------------------------------------------------
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_03e.result b/mysql-test/suite/funcs_1/r/memory_trig_03e.result
index 5f05f7c0af5..cfa839b382c 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_03e.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_03e.result
@@ -450,8 +450,8 @@ create trigger trg1_4 before UPDATE on t1 for each row
set new.f1 = 'trig 1_4-yes';
show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
-trg1_3 INSERT t1 set new.f1 = 'trig 1_3-yes' BEFORE NULL test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
-trg1_4 UPDATE t1 set new.f1 = 'trig 1_4-yes' BEFORE NULL test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+trg1_3 INSERT t1 set new.f1 = 'trig 1_3-yes' BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+trg1_4 UPDATE t1 set new.f1 = 'trig 1_4-yes' BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
select current_user;
current_user
test_noprivs@localhost
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_0407.result b/mysql-test/suite/funcs_1/r/memory_trig_0407.result
index 2146c74b72e..7f3277f55e1 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_0407.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_0407.result
@@ -1,4 +1,5 @@
SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION';
+set GLOBAL sql_mode="";
USE test;
drop table if exists tb3;
create table tb3 (
@@ -469,3 +470,4 @@ drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;
DROP TABLE test.tb3;
+set GLOBAL sql_mode=default;
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_08.result b/mysql-test/suite/funcs_1/r/memory_trig_08.result
index d19507e5f4d..4632cfe269c 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_08.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_08.result
@@ -1,4 +1,5 @@
SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION';
+set GLOBAL sql_mode="";
USE test;
drop table if exists tb3;
create table tb3 (
@@ -522,3 +523,4 @@ drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;
DROP TABLE test.tb3;
+set GLOBAL sql_mode=default;
diff --git a/mysql-test/suite/funcs_1/r/memory_views.result b/mysql-test/suite/funcs_1/r/memory_views.result
index 9f8ec11a7d8..995787aba84 100644
--- a/mysql-test/suite/funcs_1/r/memory_views.result
+++ b/mysql-test/suite/funcs_1/r/memory_views.result
@@ -22034,7 +22034,7 @@ Testcase 3.3.2.1 - 3.3.2.6 alternative implementation
--------------------------------------------------------------------------------
DROP TABLE IF EXISTS t1;
DROP VIEW IF EXISTS v1;
-CREATE TABLE t1 ( f1 BIGINT, f2 CHAR(20), f3 NUMERIC(7,4),
+CREATE TABLE t1 ( f1 BIGINT DEFAULT 0, f2 CHAR(20), f3 NUMERIC(7,4),
f4 CHAR, PRIMARY KEY(f1));
CREATE VIEW v1 AS SELECT f1, f2, f3 FROM t1;
INSERT INTO v1 SET f1 = 1;
diff --git a/mysql-test/suite/funcs_1/r/myisam_func_view.result b/mysql-test/suite/funcs_1/r/myisam_func_view.result
index 250ef4453a3..f8b6dc66d8a 100644
--- a/mysql-test/suite/funcs_1/r/myisam_func_view.result
+++ b/mysql-test/suite/funcs_1/r/myisam_func_view.result
@@ -15,7 +15,7 @@ ALTER TABLE t1_values ADD my_varbinary_1000 VARBINARY(1000);
ALTER TABLE t1_values ADD my_datetime DATETIME;
ALTER TABLE t1_values ADD my_date DATE;
ALTER TABLE t1_values ADD ts_dummy TIMESTAMP;
-ALTER TABLE t1_values ADD my_timestamp TIMESTAMP;
+ALTER TABLE t1_values ADD my_timestamp TIMESTAMP NOT NULL DEFAULT '2001-01-01 10:20:30';
ALTER TABLE t1_values ADD my_time TIME;
ALTER TABLE t1_values ADD my_year YEAR;
ALTER TABLE t1_values ADD my_bigint BIGINT;
@@ -1277,7 +1277,7 @@ SELECT IFNULL(my_timestamp,'IS_NULL'),
my_timestamp, id FROM t1_values
WHERE select_id = 136 OR select_id IS NULL order by id;
IFNULL(my_timestamp,'IS_NULL') my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
@@ -1289,7 +1289,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 136 OR select_id IS NULL) order by id;
IFNULL(my_timestamp,'IS_NULL') my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
@@ -1596,7 +1596,7 @@ SELECT IF(my_timestamp IS NULL, 'IS NULL',
WHERE select_id = 124 OR select_id IS NULL order by id;
IF(my_timestamp IS NULL, 'IS NULL',
'IS NOT NULL') my_timestamp id
-IS NOT NULL 0000-00-00 00:00:00 1
+IS NOT NULL 2001-01-01 10:20:30 1
IS NOT NULL 1970-01-01 14:00:01 2
IS NOT NULL 2038-01-01 02:59:59 3
IS NOT NULL 2004-02-29 23:59:59 4
@@ -1610,7 +1610,7 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 124 OR select_id IS NULL) order by id;
IF(my_timestamp IS NULL, 'IS NULL',
'IS NOT NULL') my_timestamp id
-IS NOT NULL 0000-00-00 00:00:00 1
+IS NOT NULL 2001-01-01 10:20:30 1
IS NOT NULL 1970-01-01 14:00:01 2
IS NOT NULL 2038-01-01 02:59:59 3
IS NOT NULL 2004-02-29 23:59:59 4
@@ -1937,7 +1937,7 @@ SELECT IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE'),
my_timestamp, id FROM t1_values
WHERE select_id = 112 OR select_id IS NULL order by id;
IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE') my_timestamp id
-IS NOT TRUE 0000-00-00 00:00:00 1
+IS TRUE 2001-01-01 10:20:30 1
IS TRUE 1970-01-01 14:00:01 2
IS TRUE 2038-01-01 02:59:59 3
IS TRUE 2004-02-29 23:59:59 4
@@ -1949,7 +1949,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 112 OR select_id IS NULL) order by id;
IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE') my_timestamp id
-IS NOT TRUE 0000-00-00 00:00:00 1
+IS TRUE 2001-01-01 10:20:30 1
IS TRUE 1970-01-01 14:00:01 2
IS TRUE 2038-01-01 02:59:59 3
IS TRUE 2004-02-29 23:59:59 4
@@ -2099,8 +2099,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
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 if(`t1_values`.`my_varbinary_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -2114,8 +2115,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -2167,8 +2169,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
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 if(`t1_values`.`my_varchar_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -2182,8 +2185,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
@@ -2199,6 +2203,7 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' '
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
@@ -2214,6 +2219,7 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' '
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
@@ -2283,7 +2289,7 @@ NULL NULL 1
---????????@??*$-- ---äÖüß@µ*$-- 4
-1 -1 5
Warnings:
-Warning 1976 Cannot convert 'latin1' character 0xC3 to 'koi8r'
+Warning 1977 Cannot convert 'latin1' character 0xC3 to 'koi8r'
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 convert(`t1_values`.`my_varchar_1000` using koi8r) AS `CONVERT(my_varchar_1000 USING koi8r)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -2297,7 +2303,7 @@ NULL NULL 1
---????????@??*$-- ---äÖüß@µ*$-- 4
-1 -1 5
Warnings:
-Warning 1976 Cannot convert 'latin1' character 0xC3 to 'koi8r'
+Warning 1977 Cannot convert 'latin1' character 0xC3 to 'koi8r'
DROP VIEW v1;
@@ -2313,7 +2319,7 @@ NULL NULL 1
---????????@??*$-- ---äÖüß@µ*$-- 4
-1 -1 5
Warnings:
-Warning 1976 Cannot convert 'latin1' character 0xC3 to 'koi8r'
+Warning 1977 Cannot convert 'latin1' character 0xC3 to 'koi8r'
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 convert(`t1_values`.`my_char_30` using koi8r) AS `CONVERT(my_char_30 USING koi8r)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -2327,7 +2333,7 @@ NULL NULL 1
---????????@??*$-- ---äÖüß@µ*$-- 4
-1 -1 5
Warnings:
-Warning 1976 Cannot convert 'latin1' character 0xC3 to 'koi8r'
+Warning 1977 Cannot convert 'latin1' character 0xC3 to 'koi8r'
DROP VIEW v1;
@@ -2497,7 +2503,7 @@ SELECT CAST(my_timestamp AS UNSIGNED INTEGER),
my_timestamp, id FROM t1_values
WHERE select_id = 92 OR select_id IS NULL order by id;
CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id
-0 0000-00-00 00:00:00 1
+20010101102030 2001-01-01 10:20:30 1
19700101140001 1970-01-01 14:00:01 2
20380101025959 2038-01-01 02:59:59 3
20040229235959 2004-02-29 23:59:59 4
@@ -2509,7 +2515,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 92 OR select_id IS NULL) order by id;
CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id
-0 0000-00-00 00:00:00 1
+20010101102030 2001-01-01 10:20:30 1
19700101140001 1970-01-01 14:00:01 2
20380101025959 2038-01-01 02:59:59 3
20040229235959 2004-02-29 23:59:59 4
@@ -2875,7 +2881,7 @@ SELECT CAST(my_timestamp AS SIGNED INTEGER),
my_timestamp, id FROM t1_values
WHERE select_id = 80 OR select_id IS NULL order by id;
CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id
-0 0000-00-00 00:00:00 1
+20010101102030 2001-01-01 10:20:30 1
19700101140001 1970-01-01 14:00:01 2
20380101025959 2038-01-01 02:59:59 3
20040229235959 2004-02-29 23:59:59 4
@@ -2887,7 +2893,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 80 OR select_id IS NULL) order by id;
CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id
-0 0000-00-00 00:00:00 1
+20010101102030 2001-01-01 10:20:30 1
19700101140001 1970-01-01 14:00:01 2
20380101025959 2038-01-01 02:59:59 3
20040229235959 2004-02-29 23:59:59 4
@@ -3233,7 +3239,7 @@ SELECT CAST(my_timestamp AS DECIMAL(37,2)),
my_timestamp, id FROM t1_values
WHERE select_id = 68 OR select_id IS NULL order by id;
CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id
-0.00 0000-00-00 00:00:00 1
+20010101102030.00 2001-01-01 10:20:30 1
19700101140001.00 1970-01-01 14:00:01 2
20380101025959.00 2038-01-01 02:59:59 3
20040229235959.00 2004-02-29 23:59:59 4
@@ -3245,7 +3251,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 68 OR select_id IS NULL) order by id;
CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id
-0.00 0000-00-00 00:00:00 1
+20010101102030.00 2001-01-01 10:20:30 1
19700101140001.00 1970-01-01 14:00:01 2
20380101025959.00 2038-01-01 02:59:59 3
20040229235959.00 2004-02-29 23:59:59 4
@@ -3413,7 +3419,7 @@ Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
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 cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3433,7 +3439,7 @@ Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -3501,7 +3507,7 @@ Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
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 cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3521,7 +3527,7 @@ Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
@@ -3625,7 +3631,7 @@ SELECT CAST(my_timestamp AS TIME),
my_timestamp, id FROM t1_values
WHERE select_id = 56 OR select_id IS NULL order by id;
CAST(my_timestamp AS TIME) my_timestamp id
-00:00:00 0000-00-00 00:00:00 1
+10:20:30 2001-01-01 10:20:30 1
14:00:01 1970-01-01 14:00:01 2
02:59:59 2038-01-01 02:59:59 3
23:59:59 2004-02-29 23:59:59 4
@@ -3637,7 +3643,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 56 OR select_id IS NULL) order by id;
CAST(my_timestamp AS TIME) my_timestamp id
-00:00:00 0000-00-00 00:00:00 1
+10:20:30 2001-01-01 10:20:30 1
14:00:01 1970-01-01 14:00:01 2
02:59:59 2038-01-01 02:59:59 3
23:59:59 2004-02-29 23:59:59 4
@@ -3971,7 +3977,7 @@ SELECT CAST(my_timestamp AS DATETIME),
my_timestamp, id FROM t1_values
WHERE select_id = 45 OR select_id IS NULL order by id;
CAST(my_timestamp AS DATETIME) my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
@@ -3983,7 +3989,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 45 OR select_id IS NULL) order by id;
CAST(my_timestamp AS DATETIME) my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
@@ -4333,7 +4339,7 @@ SELECT CAST(my_timestamp AS DATE),
my_timestamp, id FROM t1_values
WHERE select_id = 34 OR select_id IS NULL order by id;
CAST(my_timestamp AS DATE) my_timestamp id
-0000-00-00 0000-00-00 00:00:00 1
+2001-01-01 2001-01-01 10:20:30 1
1970-01-01 1970-01-01 14:00:01 2
2038-01-01 2038-01-01 02:59:59 3
2004-02-29 2004-02-29 23:59:59 4
@@ -4345,7 +4351,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 34 OR select_id IS NULL) order by id;
CAST(my_timestamp AS DATE) my_timestamp id
-0000-00-00 0000-00-00 00:00:00 1
+2001-01-01 2001-01-01 10:20:30 1
1970-01-01 1970-01-01 14:00:01 2
2038-01-01 2038-01-01 02:59:59 3
2004-02-29 2004-02-29 23:59:59 4
@@ -4691,7 +4697,7 @@ SELECT CAST(my_timestamp AS CHAR),
my_timestamp, id FROM t1_values
WHERE select_id = 23 OR select_id IS NULL order by id;
CAST(my_timestamp AS CHAR) my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
@@ -4703,7 +4709,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 23 OR select_id IS NULL) order by id;
CAST(my_timestamp AS CHAR) my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
@@ -5003,7 +5009,7 @@ SELECT CAST(my_timestamp AS BINARY),
my_timestamp, id FROM t1_values
WHERE select_id = 11 OR select_id IS NULL order by id;
CAST(my_timestamp AS BINARY) my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
@@ -5015,7 +5021,7 @@ SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 11 OR select_id IS NULL) order by id;
CAST(my_timestamp AS BINARY) my_timestamp id
-0000-00-00 00:00:00 0000-00-00 00:00:00 1
+2001-01-01 10:20:30 2001-01-01 10:20:30 1
1970-01-01 14:00:01 1970-01-01 14:00:01 2
2038-01-01 02:59:59 2038-01-01 02:59:59 3
2004-02-29 23:59:59 2004-02-29 23:59:59 4
diff --git a/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result b/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result
index f08165b21f8..c38481bac50 100644
--- a/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result
+++ b/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result
@@ -1,4 +1,5 @@
SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION';
+set GLOBAL sql_mode="";
--source suite/funcs_1/storedproc/load_sp_tb.inc
--------------------------------------------------------------------------------
@@ -389,6 +390,7 @@ DROP USER 'user_2'@'localhost';
--------------------------------------------------------------------------------
DROP DATABASE IF EXISTS db_storedproc;
DROP DATABASE IF EXISTS db_storedproc_1;
+set GLOBAL sql_mode=default;
. +++ END OF SCRIPT +++
--------------------------------------------------------------------------------
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_03e.result b/mysql-test/suite/funcs_1/r/myisam_trig_03e.result
index c34525a52f8..fd796dd4550 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_03e.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_03e.result
@@ -450,8 +450,8 @@ create trigger trg1_4 before UPDATE on t1 for each row
set new.f1 = 'trig 1_4-yes';
show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
-trg1_3 INSERT t1 set new.f1 = 'trig 1_3-yes' BEFORE NULL test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
-trg1_4 UPDATE t1 set new.f1 = 'trig 1_4-yes' BEFORE NULL test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+trg1_3 INSERT t1 set new.f1 = 'trig 1_3-yes' BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+trg1_4 UPDATE t1 set new.f1 = 'trig 1_4-yes' BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
select current_user;
current_user
test_noprivs@localhost
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_0407.result b/mysql-test/suite/funcs_1/r/myisam_trig_0407.result
index 2146c74b72e..7f3277f55e1 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_0407.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_0407.result
@@ -1,4 +1,5 @@
SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION';
+set GLOBAL sql_mode="";
USE test;
drop table if exists tb3;
create table tb3 (
@@ -469,3 +470,4 @@ drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;
DROP TABLE test.tb3;
+set GLOBAL sql_mode=default;
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_08.result b/mysql-test/suite/funcs_1/r/myisam_trig_08.result
index d19507e5f4d..4632cfe269c 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_08.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_08.result
@@ -1,4 +1,5 @@
SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION';
+set GLOBAL sql_mode="";
USE test;
drop table if exists tb3;
create table tb3 (
@@ -522,3 +523,4 @@ drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;
DROP TABLE test.tb3;
+set GLOBAL sql_mode=default;
diff --git a/mysql-test/suite/funcs_1/r/myisam_views-big.result b/mysql-test/suite/funcs_1/r/myisam_views-big.result
index 9f5adc15b7f..0e0bede7257 100644
--- a/mysql-test/suite/funcs_1/r/myisam_views-big.result
+++ b/mysql-test/suite/funcs_1/r/myisam_views-big.result
@@ -23736,7 +23736,7 @@ Testcase 3.3.2.1 - 3.3.2.6 alternative implementation
--------------------------------------------------------------------------------
DROP TABLE IF EXISTS t1;
DROP VIEW IF EXISTS v1;
-CREATE TABLE t1 ( f1 BIGINT, f2 CHAR(20), f3 NUMERIC(7,4),
+CREATE TABLE t1 ( f1 BIGINT DEFAULT 0, f2 CHAR(20), f3 NUMERIC(7,4),
f4 CHAR, PRIMARY KEY(f1));
CREATE VIEW v1 AS SELECT f1, f2, f3 FROM t1;
INSERT INTO v1 SET f1 = 1;
diff --git a/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result b/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result
index 079aca6b25c..ee7468ff5ba 100644
--- a/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result
+++ b/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result
@@ -37,16 +37,17 @@ PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` (
`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
+ `INFO_BINARY` blob,
+ `TID` bigint(4) NOT NULL DEFAULT '0'
) DEFAULT CHARSET=utf8
SHOW processlist;
Id User Host db Command Time State Info Progress
ID root HOST_NAME information_schema Query TIME init SHOW processlist TIME_MS
ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS
SELECT * FROM processlist ORDER BY id;
-ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY
-ID root HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM processlist ORDER BY id TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM processlist ORDER BY id
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
+ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
+ID root HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM processlist ORDER BY id TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM processlist ORDER BY id TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY FROM processlist ORDER BY id;
ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY
ID root HOST_NAME information_schema Query TIME Filling schema table SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY FROM processlist ORDER BY id TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY FROM processlist ORDER BY id
@@ -56,9 +57,9 @@ UPDATE test.t_processlist SET user='horst' WHERE id=1 ;
INSERT INTO processlist SELECT * FROM test.t_processlist;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
DROP TABLE test.t_processlist;
-CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY) AS SELECT * FROM processlist WITH CHECK OPTION;
+CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY) AS SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY FROM processlist WITH CHECK OPTION;
ERROR HY000: CHECK OPTION on non-updatable view 'test.v_processlist'
-CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY) AS SELECT * FROM processlist;
+CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY) AS SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY FROM processlist;
DROP VIEW test.v_processlist;
UPDATE processlist SET user='any_user' WHERE id=1 ;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
@@ -114,14 +115,15 @@ PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` (
`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
+ `INFO_BINARY` blob,
+ `TID` bigint(4) NOT NULL DEFAULT '0'
) DEFAULT CHARSET=utf8
SHOW processlist;
Id User Host db Command Time State Info Progress
ID ddicttestuser1 HOST_NAME information_schema Query TIME init SHOW processlist TIME_MS
SELECT * FROM processlist ORDER BY id;
-ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY
-ID ddicttestuser1 HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM processlist ORDER BY id TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM processlist ORDER BY id
+ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
+ID ddicttestuser1 HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM processlist ORDER BY id TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM processlist ORDER BY id TID
SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY FROM processlist ORDER BY id;
ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY
ID ddicttestuser1 HOST_NAME information_schema Query TIME Filling schema table SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY FROM processlist ORDER BY id TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY FROM processlist ORDER BY id
@@ -130,9 +132,9 @@ UPDATE test.t_processlist SET user='horst' WHERE id=1 ;
INSERT INTO processlist SELECT * FROM test.t_processlist;
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
DROP TABLE test.t_processlist;
-CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY) AS SELECT * FROM processlist WITH CHECK OPTION;
+CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY) AS SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY FROM processlist WITH CHECK OPTION;
ERROR HY000: CHECK OPTION on non-updatable view 'test.v_processlist'
-CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY) AS SELECT * FROM processlist;
+CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY) AS SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY FROM processlist;
DROP VIEW test.v_processlist;
UPDATE processlist SET user='any_user' WHERE id=1 ;
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
@@ -183,8 +185,8 @@ SHOW processlist;
Id User Host db Command Time State Info Progress
ID ddicttestuser1 HOST_NAME information_schema Query TIME init SHOW processlist TIME_MS
SELECT * FROM information_schema.processlist;
-ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY
-ID ddicttestuser1 HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM information_schema.processlist TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM information_schema.processlist
+ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
+ID ddicttestuser1 HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM information_schema.processlist TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM information_schema.processlist TID
####################################################################################
4.2 New connection con101 (ddicttestuser1 with PROCESS privilege)
SHOW/SELECT shows all processes/threads.
@@ -198,14 +200,15 @@ ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS
ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS
ID ddicttestuser1 HOST_NAME information_schema Query TIME init SHOW processlist TIME_MS
SELECT * FROM information_schema.processlist;
-ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY
-ID ddicttestuser1 HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM information_schema.processlist TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM information_schema.processlist
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
+ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
+ID ddicttestuser1 HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM information_schema.processlist TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM information_schema.processlist TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
####################################################################################
5 Grant PROCESS privilege to anonymous user.
connection default (user=root)
####################################################################################
+create user ''@'localhost';
GRANT PROCESS ON *.* TO ''@'localhost';
####################################################################################
5.1 Establish connection (anonymous1,localhost,'',,information_schema)
@@ -222,11 +225,11 @@ ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS
ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS
ID HOST_NAME information_schema Query TIME init SHOW processlist TIME_MS
SELECT * FROM information_schema.processlist;
-ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY
-ID HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM information_schema.processlist TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM information_schema.processlist
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
+ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
+ID HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM information_schema.processlist TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM information_schema.processlist TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
####################################################################################
6 Revoke PROCESS privilege from ddicttestuser1
connection default (user=root)
@@ -246,10 +249,10 @@ ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS
ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS
ID ddicttestuser1 HOST_NAME information_schema Query TIME init SHOW processlist TIME_MS
SELECT * FROM information_schema.processlist;
-ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY
-ID ddicttestuser1 HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM information_schema.processlist TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM information_schema.processlist
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
+ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
+ID ddicttestuser1 HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM information_schema.processlist TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM information_schema.processlist TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
####################################################################################
7 Revoke PROCESS privilege from anonymous user
connection default (user=root)
@@ -264,9 +267,9 @@ SHOW GRANTS FOR ''@'localhost';
Grants for @localhost
GRANT USAGE ON *.* TO ''@'localhost'
SELECT * FROM information_schema.processlist;
-ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY
-ID HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM information_schema.processlist TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM information_schema.processlist
-ID HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
+ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
+ID HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM information_schema.processlist TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM information_schema.processlist TID
+ID HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
####################################################################################
8 Grant SUPER (does not imply PROCESS) privilege to ddicttestuser1
connection default (user=root)
@@ -286,11 +289,11 @@ ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS
ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS
ID ddicttestuser1 HOST_NAME information_schema Query TIME init SHOW processlist TIME_MS
SELECT * FROM information_schema.processlist;
-ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY
-ID ddicttestuser1 HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM information_schema.processlist TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM information_schema.processlist
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
+ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
+ID ddicttestuser1 HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM information_schema.processlist TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM information_schema.processlist TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
####################################################################################
9 Revoke SUPER privilege from user ddicttestuser1
connection default (user=root)
@@ -312,12 +315,12 @@ ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS
ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS
ID ddicttestuser1 HOST_NAME information_schema Query TIME init SHOW processlist TIME_MS
SELECT * FROM information_schema.processlist;
-ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY
-ID ddicttestuser1 HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM information_schema.processlist TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM information_schema.processlist
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
+ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
+ID ddicttestuser1 HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM information_schema.processlist TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM information_schema.processlist TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
####################################################################################
10 Grant SUPER privilege with grant option to user ddicttestuser1.
connection default (user=root)
@@ -366,18 +369,18 @@ ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS
ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS
ID ddicttestuser2 HOST_NAME information_schema Query TIME init SHOW processlist TIME_MS
SELECT * FROM information_schema.processlist;
-ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY
-ID ddicttestuser2 HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM information_schema.processlist TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM information_schema.processlist
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
+ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
+ID ddicttestuser2 HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM information_schema.processlist TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM information_schema.processlist TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
####################################################################################
11 User ddicttestuser1 revokes PROCESS privilege from user ddicttestuser2
connection ddicttestuser1;
@@ -395,9 +398,9 @@ Id User Host db Command Time State Info Progress
ID ddicttestuser2 HOST_NAME information_schema Sleep TIME NULL TIME_MS
ID ddicttestuser2 HOST_NAME information_schema Query TIME init SHOW processlist TIME_MS
SELECT * FROM information_schema.processlist;
-ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY
-ID ddicttestuser2 HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM information_schema.processlist TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM information_schema.processlist
-ID ddicttestuser2 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
+ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
+ID ddicttestuser2 HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM information_schema.processlist TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM information_schema.processlist TID
+ID ddicttestuser2 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
####################################################################################
11.2 Revoke SUPER,PROCESS,GRANT OPTION privilege from user ddicttestuser1
connection default (user=root)
@@ -424,15 +427,15 @@ ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS
ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS
ID ddicttestuser1 HOST_NAME information_schema Query TIME init SHOW processlist TIME_MS
SELECT * FROM information_schema.processlist;
-ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY
-ID ddicttestuser1 HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM information_schema.processlist TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM information_schema.processlist
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
+ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
+ID ddicttestuser1 HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM information_schema.processlist TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM information_schema.processlist TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
####################################################################################
12 Revoke the SELECT privilege from user ddicttestuser1
connection default (user=root)
@@ -460,16 +463,16 @@ ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS
ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS
ID ddicttestuser1 HOST_NAME information_schema Query TIME init SHOW processlist TIME_MS
SELECT * FROM information_schema.processlist;
-ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY
-ID ddicttestuser1 HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM information_schema.processlist TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM information_schema.processlist
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
-ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL
+ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
+ID ddicttestuser1 HOST_NAME information_schema Query TIME Filling schema table SELECT * FROM information_schema.processlist TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID SELECT * FROM information_schema.processlist TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
+ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS QUERY_ID NULL TID
####################################################################################
12.2 Revoke only the SELECT privilege on the information_schema from ddicttestuser1.
connection default (user=root)
diff --git a/mysql-test/suite/funcs_1/r/processlist_priv_ps.result b/mysql-test/suite/funcs_1/r/processlist_priv_ps.result
index 19631cfb820..04c309c3f54 100644
--- a/mysql-test/suite/funcs_1/r/processlist_priv_ps.result
+++ b/mysql-test/suite/funcs_1/r/processlist_priv_ps.result
@@ -206,6 +206,7 @@ ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY R
5 Grant PROCESS privilege to anonymous user.
connection default (user=root)
####################################################################################
+create user ''@'localhost';
GRANT PROCESS ON *.* TO ''@'localhost';
####################################################################################
5.1 Establish connection (anonymous1,localhost,'',,information_schema)
diff --git a/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result b/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result
index c7c80593a73..acf81d090d1 100644
--- a/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result
+++ b/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result
@@ -27,14 +27,15 @@ PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` (
`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
+ `INFO_BINARY` blob,
+ `TID` bigint(4) NOT NULL DEFAULT '0'
) DEFAULT CHARSET=utf8
# Ensure that the information about the own connection is correct.
#--------------------------------------------------------------------------
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
-ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY
-<ID> root <HOST_NAME> test Query <TIME> Filling schema table SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
+ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
+<ID> root <HOST_NAME> test Query <TIME> Filling schema table SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TID>
SHOW FULL PROCESSLIST;
Id User Host db Command Time State Info Progress
<ID> root <HOST_NAME> test Query <TIME> init SHOW FULL PROCESSLIST <TIME_MS>
@@ -80,9 +81,9 @@ Has TIME a reasonable value?
# Poll till the connection con1 is in state COMMAND = 'Sleep'.
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
-ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY
-<ID> test_user <HOST_NAME> information_schema Sleep <TIME> <STATE> NULL <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> NULL
-<ID> root <HOST_NAME> information_schema Query <TIME> <STATE> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
+ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
+<ID> test_user <HOST_NAME> information_schema Sleep <TIME> <STATE> NULL <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> NULL <TID>
+<ID> root <HOST_NAME> information_schema Query <TIME> <STATE> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TID>
SHOW FULL PROCESSLIST;
Id User Host db Command Time State Info Progress
<ID> root <HOST_NAME> information_schema Query <TIME> init SHOW FULL PROCESSLIST 0.000
@@ -114,8 +115,8 @@ Expect 1
# ----- switch to connection con1 (user = test_user) -----
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
-ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY
-<ID> test_user <HOST_NAME> information_schema Query <TIME> Filling schema table SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
+ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
+<ID> test_user <HOST_NAME> information_schema Query <TIME> Filling schema table SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TID>
SHOW FULL PROCESSLIST;
Id User Host db Command Time State Info Progress
<ID> test_user <HOST_NAME> information_schema Query <TIME> init SHOW FULL PROCESSLIST 0.000
@@ -131,9 +132,9 @@ Id User Host db Command Time State Info Progress
# ----- switch to connection con2 (user = test_user) -----
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
-ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY
-<ID> test_user <HOST_NAME> information_schema Query <TIME> Filling schema table SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
-<ID> test_user <HOST_NAME> information_schema Sleep <TIME> NULL <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> NULL
+ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
+<ID> test_user <HOST_NAME> information_schema Query <TIME> Filling schema table SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TID>
+<ID> test_user <HOST_NAME> information_schema Sleep <TIME> NULL <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> NULL <TID>
SHOW FULL PROCESSLIST;
Id User Host db Command Time State Info Progress
<ID> test_user <HOST_NAME> information_schema Sleep <TIME> NULL 0.000
@@ -157,10 +158,10 @@ SELECT sleep(10), 17;
# Poll till connection con2 is in state 'User sleep'.
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
-ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY
-<ID> test_user <HOST_NAME> information_schema Query <TIME> User sleep SELECT sleep(10), 17 <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT sleep(10), 17
-<ID> test_user <HOST_NAME> information_schema Sleep <TIME> NULL <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> NULL
-<ID> root <HOST_NAME> information_schema Query <TIME> Filling schema table SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
+ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
+<ID> test_user <HOST_NAME> information_schema Query <TIME> User sleep SELECT sleep(10), 17 <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT sleep(10), 17 <TID>
+<ID> test_user <HOST_NAME> information_schema Sleep <TIME> NULL <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> NULL <TID>
+<ID> root <HOST_NAME> information_schema Query <TIME> Filling schema table SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TID>
SHOW FULL PROCESSLIST;
Id User Host db Command Time State Info Progress
<ID> root <HOST_NAME> information_schema Query <TIME> init SHOW FULL PROCESSLIST 0.000
@@ -204,10 +205,10 @@ SELECT COUNT(*) FROM test.t1;
# Poll till INFO is no more NULL and State = 'Waiting for table metadata lock'.
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
-ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY
-<ID> test_user <HOST_NAME> information_schema Query <TIME> Waiting for table metadata lock SELECT COUNT(*) FROM test.t1 <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT COUNT(*) FROM test.t1
-<ID> test_user <HOST_NAME> information_schema Sleep <TIME> NULL <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> NULL
-<ID> root <HOST_NAME> information_schema Query <TIME> Filling schema table SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
+ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
+<ID> test_user <HOST_NAME> information_schema Query <TIME> Waiting for table metadata lock SELECT COUNT(*) FROM test.t1 <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT COUNT(*) FROM test.t1 <TID>
+<ID> test_user <HOST_NAME> information_schema Sleep <TIME> NULL <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> NULL <TID>
+<ID> root <HOST_NAME> information_schema Query <TIME> Filling schema table SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TID>
UNLOCK TABLES;
# ----- switch to connection con2 (user = test_user) -----
@@ -238,10 +239,10 @@ SELECT count(*),'BEGIN-This is the representative of a very long statement.This
# SHOW PROCESSLIST statement truncated after 100 char
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
-ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY
-<ID> test_user <HOST_NAME> information_schema <COMMAND> <TIME> <STATE> SELECT count(*),'BEGIN-This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.-END' AS "Long string" FROM test.t1 <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT count(*),'BEGIN-This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.-END' AS "Long string" FROM test.t1
-<ID> test_user <HOST_NAME> information_schema <COMMAND> <TIME> <STATE> NULL <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> NULL
-<ID> root <HOST_NAME> information_schema <COMMAND> <TIME> <STATE> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
+ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
+<ID> test_user <HOST_NAME> information_schema <COMMAND> <TIME> <STATE> SELECT count(*),'BEGIN-This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.-END' AS "Long string" FROM test.t1 <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT count(*),'BEGIN-This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.-END' AS "Long string" FROM test.t1 <TID>
+<ID> test_user <HOST_NAME> information_schema <COMMAND> <TIME> <STATE> NULL <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> NULL <TID>
+<ID> root <HOST_NAME> information_schema <COMMAND> <TIME> <STATE> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TID>
SHOW FULL PROCESSLIST;
Id User Host db Command Time State Info Progress
<ID> root <HOST_NAME> information_schema <COMMAND> <TIME> <STATE> SHOW FULL PROCESSLIST 0.000
diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result
index cf3bc923b19..f0e1ee74e0b 100644
--- a/mysql-test/suite/funcs_1/r/storedproc.result
+++ b/mysql-test/suite/funcs_1/r/storedproc.result
@@ -1,3 +1,4 @@
+set sql_mode="";
--source suite/funcs_1/storedproc/load_sp_tb.inc
--------------------------------------------------------------------------------
@@ -13869,7 +13870,7 @@ CALL sp1();
xx
0
Warnings:
-Warning 1265 Data truncated for column 'xx' at row 1
+Warning 1366 Incorrect double value: 'asd' for column 'xx' at row 1
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
BEGIN
diff --git a/mysql-test/suite/funcs_1/storedproc/storedproc_06.inc b/mysql-test/suite/funcs_1/storedproc/storedproc_06.inc
index 3e5ca055ae1..c4f8496fd06 100644
--- a/mysql-test/suite/funcs_1/storedproc/storedproc_06.inc
+++ b/mysql-test/suite/funcs_1/storedproc/storedproc_06.inc
@@ -4,6 +4,8 @@
# privileges.
--source include/not_embedded.inc
+set GLOBAL sql_mode="";
+
--source suite/funcs_1/storedproc/load_sp_tb.inc
# ==============================================================================
@@ -451,6 +453,7 @@ DROP USER 'user_2'@'localhost';
# USE the same .inc to cleanup before and after the test
--source suite/funcs_1/storedproc/cleanup_sp_tb.inc
+set GLOBAL sql_mode=default;
# ==============================================================================
--echo
--echo . +++ END OF SCRIPT +++
diff --git a/mysql-test/suite/funcs_1/t/innodb_storedproc_06.test b/mysql-test/suite/funcs_1/t/innodb_storedproc_06.test
index ce061da2299..7bfc3153a61 100644
--- a/mysql-test/suite/funcs_1/t/innodb_storedproc_06.test
+++ b/mysql-test/suite/funcs_1/t/innodb_storedproc_06.test
@@ -4,6 +4,7 @@
--source include/have_innodb.inc
# 2. Set $engine_type
+set sql_mode="";
let $engine_type= innodb;
--source suite/funcs_1/storedproc/storedproc_06.inc
diff --git a/mysql-test/suite/funcs_1/t/innodb_storedproc_08.test b/mysql-test/suite/funcs_1/t/innodb_storedproc_08.test
index c8c289c5f49..39c983ad2a0 100644
--- a/mysql-test/suite/funcs_1/t/innodb_storedproc_08.test
+++ b/mysql-test/suite/funcs_1/t/innodb_storedproc_08.test
@@ -4,6 +4,7 @@
--source include/have_innodb.inc
# 2. Set $engine_type
+set sql_mode="";
let $engine_type= innodb;
--source suite/funcs_1/storedproc/storedproc_08.inc
diff --git a/mysql-test/suite/funcs_1/t/innodb_trig_03.test b/mysql-test/suite/funcs_1/t/innodb_trig_03.test
index 2a611c97fbf..f2a8fa3c1d9 100644
--- a/mysql-test/suite/funcs_1/t/innodb_trig_03.test
+++ b/mysql-test/suite/funcs_1/t/innodb_trig_03.test
@@ -5,6 +5,7 @@
# 1. Check if InnoDB is available
--source include/have_innodb.inc
# 2. Set $engine_type
+set sql_mode="";
let $engine_type= innodb;
--source suite/funcs_1/triggers/triggers_03.inc
diff --git a/mysql-test/suite/funcs_1/t/innodb_trig_0407.test b/mysql-test/suite/funcs_1/t/innodb_trig_0407.test
index d8081770f4b..dddb000cf18 100644
--- a/mysql-test/suite/funcs_1/t/innodb_trig_0407.test
+++ b/mysql-test/suite/funcs_1/t/innodb_trig_0407.test
@@ -5,6 +5,7 @@
# 1. Check if InnoDB is available
--source include/have_innodb.inc
# 2. Set $engine_type
+set sql_mode="";
let $engine_type= innodb;
--source suite/funcs_1/triggers/triggers_0407.inc
diff --git a/mysql-test/suite/funcs_1/t/innodb_trig_08.test b/mysql-test/suite/funcs_1/t/innodb_trig_08.test
index ba48b977ba2..c870c1a7895 100644
--- a/mysql-test/suite/funcs_1/t/innodb_trig_08.test
+++ b/mysql-test/suite/funcs_1/t/innodb_trig_08.test
@@ -5,6 +5,7 @@
# 1. Check if InnoDB is available
--source include/have_innodb.inc
# 2. Set $engine_type
+set sql_mode="";
let $engine_type= innodb;
--source suite/funcs_1/triggers/triggers_08.inc
diff --git a/mysql-test/suite/funcs_1/t/processlist_priv_no_prot.test b/mysql-test/suite/funcs_1/t/processlist_priv_no_prot.test
index d6746d92250..88563b046df 100644
--- a/mysql-test/suite/funcs_1/t/processlist_priv_no_prot.test
+++ b/mysql-test/suite/funcs_1/t/processlist_priv_no_prot.test
@@ -25,10 +25,6 @@ let $fixed_bug_30395= 0;
# The file with expected results fits only to a run without
# ps-protocol/sp-protocol/cursor-protocol/view-protocol.
-if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL
- + $VIEW_PROTOCOL > 0`)
-{
- --skip Test requires: ps-protocol/sp-protocol/cursor-protocol/view-protocol disabled
-}
+--source include/no_protocol.inc
--source suite/funcs_1/datadict/processlist_priv.inc
diff --git a/mysql-test/suite/funcs_1/t/processlist_val_no_prot.test b/mysql-test/suite/funcs_1/t/processlist_val_no_prot.test
index b92c963c79c..a03d3774484 100644
--- a/mysql-test/suite/funcs_1/t/processlist_val_no_prot.test
+++ b/mysql-test/suite/funcs_1/t/processlist_val_no_prot.test
@@ -20,10 +20,6 @@
# The file with expected results fits only to a run without
# ps-protocol/sp-protocol/cursor-protocol/view-protocol.
-if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL
- + $VIEW_PROTOCOL > 0`)
-{
- --skip Test requires: ps-protocol/sp-protocol/cursor-protocol/view-protocol disabled
-}
+--source include/no_protocol.inc
--source suite/funcs_1/datadict/processlist_val.inc
diff --git a/mysql-test/suite/funcs_1/t/storedproc.test b/mysql-test/suite/funcs_1/t/storedproc.test
index ff417957c85..ca9dfcbbe2d 100644
--- a/mysql-test/suite/funcs_1/t/storedproc.test
+++ b/mysql-test/suite/funcs_1/t/storedproc.test
@@ -9,6 +9,7 @@
# - restore global sort_buffer_size after some subtest
#
############################################################################
+set sql_mode="";
# Bug#37746 - Arithmetic range ("int") is smaller than expected
# This code is in place to ensure this test is only skipped
diff --git a/mysql-test/suite/funcs_1/triggers/triggers_0407.inc b/mysql-test/suite/funcs_1/triggers/triggers_0407.inc
index 2bc9dd66478..907260a00f0 100644
--- a/mysql-test/suite/funcs_1/triggers/triggers_0407.inc
+++ b/mysql-test/suite/funcs_1/triggers/triggers_0407.inc
@@ -3,6 +3,7 @@
# Trigger Tests
# (test case numbering refer to requirement document TP v1.1)
#======================================================================
+set GLOBAL sql_mode="";
USE test;
--source suite/funcs_1/include/tb3.inc
@@ -622,3 +623,6 @@ let $message= Testcase 3.5.7.17 (see Testcase 3.5.1.1);
drop user test_super@localhost;
DROP TABLE test.tb3;
+
+
+set GLOBAL sql_mode=default;
diff --git a/mysql-test/suite/funcs_1/triggers/triggers_08.inc b/mysql-test/suite/funcs_1/triggers/triggers_08.inc
index 996a5aa69ae..0aeb46896a6 100644
--- a/mysql-test/suite/funcs_1/triggers/triggers_08.inc
+++ b/mysql-test/suite/funcs_1/triggers/triggers_08.inc
@@ -4,6 +4,7 @@
# (test case numbering refer to requirement document TP v1.1)
#======================================================================
# WL#4084: enable disabled parts, 2007-11-15 hhunger
+set GLOBAL sql_mode="";
USE test;
--source suite/funcs_1/include/tb3.inc
@@ -557,3 +558,4 @@ let $message= Testcase 3.5.8.7;
drop user test_super@localhost;
DROP TABLE test.tb3;
+set GLOBAL sql_mode=default;
diff --git a/mysql-test/suite/funcs_1/views/func_view.inc b/mysql-test/suite/funcs_1/views/func_view.inc
index 1f0b0ac52a7..5bd30472ec3 100644
--- a/mysql-test/suite/funcs_1/views/func_view.inc
+++ b/mysql-test/suite/funcs_1/views/func_view.inc
@@ -210,7 +210,7 @@ ALTER TABLE t1_values ADD my_varbinary_1000 VARBINARY(1000);
ALTER TABLE t1_values ADD my_datetime DATETIME;
ALTER TABLE t1_values ADD my_date DATE;
ALTER TABLE t1_values ADD ts_dummy TIMESTAMP;
-ALTER TABLE t1_values ADD my_timestamp TIMESTAMP;
+ALTER TABLE t1_values ADD my_timestamp TIMESTAMP NOT NULL DEFAULT '2001-01-01 10:20:30';
ALTER TABLE t1_values ADD my_time TIME;
ALTER TABLE t1_values ADD my_year YEAR;
ALTER TABLE t1_values ADD my_bigint BIGINT;
diff --git a/mysql-test/suite/funcs_1/views/views_master.inc b/mysql-test/suite/funcs_1/views/views_master.inc
index c34773b6c43..bb9bbdb06d0 100644
--- a/mysql-test/suite/funcs_1/views/views_master.inc
+++ b/mysql-test/suite/funcs_1/views/views_master.inc
@@ -3315,7 +3315,7 @@ DROP TABLE IF EXISTS t1;
DROP VIEW IF EXISTS v1;
--enable_warnings
-CREATE TABLE t1 ( f1 BIGINT, f2 CHAR(20), f3 NUMERIC(7,4),
+CREATE TABLE t1 ( f1 BIGINT DEFAULT 0, f2 CHAR(20), f3 NUMERIC(7,4),
f4 CHAR, PRIMARY KEY(f1));
# VIEW including the base table PRIMARY KEY, but not all base table columns (f4)
diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
new file mode 100644
index 00000000000..9c38c1296fe
--- /dev/null
+++ b/mysql-test/suite/galera/disabled.def
@@ -0,0 +1,21 @@
+galera_wsrep_provider_unset_set : lp1379204 'Unsupported protocol downgrade: incremental data collection disabled. Expect abort.'
+galera_kill_nochanges : mysql-wsrep#24 Galera server does not restart properly if killed
+galera_bf_abort_for_update : mysql-wsrep#26 SELECT FOR UPDATE sometimes allowed to proceed in the face of a concurrent update
+galera_toi_ddl_fk_insert : qa#39 galera_toi_ddl_fk_insert fails sporadically
+galera_binlog_row_image : MDEV-7471 - Enable binlog_row_image parameter in MariaDB
+galera_binlog_rows_query_log_events : Unknown system variable 'binlog_rows_query_log_events' (see annotate_rows_log_event)
+
+galera_ist_mysqldump : Lost connection to MySQL server during query
+galera_ist_xtrabackup-v2 : mysqltest failed but provided no output
+galera_ist_innodb_flush_logs : mysqltest failed but provided no output
+galera_sst_mysqldump : query 'show status' failed with wrong errno 1927
+galera_as_master_gtid : Needs to be re-worked
+galera_as_master_gtid_change_master : Needs to be re-worked
+galera_migrate : query 'let $success= `$wait_condition`' failed: 1146
+galera_var_notify_cmd : Result content mismatch
+query_cache : Fails intermittently due to content mismatch. Needs to be investigated
+basic : Fails intermittently without providing any output. Needs to be investigated
+galera_var_auto_inc_control_on : Failing sporadically with content mismatch
+galera_parallel_simple : Failing sporadically
+galera_bf_abort : Failing sporadically
+galera_log_output_csv : Failing sporadically
diff --git a/mysql-test/suite/galera/galera_2nodes.cnf b/mysql-test/suite/galera/galera_2nodes.cnf
index 99f887b7ca2..f9e5be1901e 100644
--- a/mysql-test/suite/galera/galera_2nodes.cnf
+++ b/mysql-test/suite/galera/galera_2nodes.cnf
@@ -6,9 +6,8 @@ wsrep-on=1
binlog-format=row
innodb-autoinc-lock-mode=2
default-storage-engine=innodb
-
-wsrep-cluster-address=gcomm://
wsrep-provider=@ENV.WSREP_PROVIDER
+wsrep_node_address=127.0.0.1
# enforce read-committed characteristics across the cluster
wsrep-causal-reads=ON
wsrep-sync-wait=7
@@ -17,18 +16,21 @@ wsrep-sync-wait=7
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
-wsrep_provider_options='base_port=@mysqld.1.#galera_port'
+wsrep-cluster-address=gcomm://
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M'
+wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port'
-wsrep_node_incoming_address=127.0.0.1
[mysqld.2]
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
-wsrep_provider_options='base_port=@mysqld.2.#galera_port'
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M'
+wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
+
[ENV]
NODE_MYPORT_1= @mysqld.1.port
NODE_MYSOCK_1= @mysqld.1.socket
diff --git a/mysql-test/suite/galera/galera_2nodes_as_master.cnf b/mysql-test/suite/galera/galera_2nodes_as_master.cnf
new file mode 100644
index 00000000000..68c0cca29a2
--- /dev/null
+++ b/mysql-test/suite/galera/galera_2nodes_as_master.cnf
@@ -0,0 +1,70 @@
+#
+# This file creates a setup with a 2-node Galera cluster (master) and one
+# standalone MariaDB server, to be used as a slave.
+#
+
+# Use default setting for mysqld processes
+!include include/default_mysqld.cnf
+
+[mysqld]
+log-bin=mysqld-bin
+binlog-format=row
+innodb-autoinc-lock-mode=2
+default-storage-engine=innodb
+
+[mysqld.1]
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+
+server-id=1
+log_slave_updates
+
+wsrep-on=1
+wsrep-provider=@ENV.WSREP_PROVIDER
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M'
+wsrep_cluster_address=gcomm://
+wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port'
+wsrep_node_address=127.0.0.1
+wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port
+# enforce read-committed characteristics across the cluster
+wsrep-causal-reads=ON
+wsrep-sync-wait=7
+
+[mysqld.2]
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+
+server-id=2
+log_slave_updates
+
+wsrep-on=1
+wsrep_provider=@ENV.WSREP_PROVIDER
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M'
+wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
+wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
+wsrep_node_address=127.0.0.1
+wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
+# enforce read-committed characteristics across the cluster
+wsrep-causal-reads=ON
+wsrep-sync-wait=7
+
+[mysqld.3]
+server-id=3
+
+[ENV]
+NODE_MYPORT_1= @mysqld.1.port
+NODE_MYSOCK_1= @mysqld.1.socket
+
+NODE_MYPORT_2= @mysqld.2.port
+NODE_MYSOCK_2= @mysqld.2.socket
+
+NODE_MYPORT_3= @mysqld.3.port
+NODE_MYSOCK_3= @mysqld.3.socket
+
+NODE_GALERAPORT_1= @mysqld.1.#galera_port
+NODE_GALERAPORT_2= @mysqld.2.#galera_port
+
+NODE_SSTPORT_1= @mysqld.1.#sst_port
+NODE_SSTPORT_2= @mysqld.2.#sst_port
diff --git a/mysql-test/suite/galera/galera_2nodes_as_slave.cnf b/mysql-test/suite/galera/galera_2nodes_as_slave.cnf
new file mode 100644
index 00000000000..4017f69b02f
--- /dev/null
+++ b/mysql-test/suite/galera/galera_2nodes_as_slave.cnf
@@ -0,0 +1,69 @@
+#
+# This .cnf file creates a setup with 1 standard MariaDB server, followed by a 2-node Galera cluster
+#
+
+# Use default setting for mysqld processes
+!include include/default_mysqld.cnf
+
+[mysqld]
+binlog-format=row
+
+[mysqld.1]
+log-bin
+server-id=1
+
+[mysqld.2]
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+
+wsrep-on=1
+innodb-autoinc-lock-mode=2
+default-storage-engine=innodb
+wsrep-provider=@ENV.WSREP_PROVIDER
+wsrep_node_address=127.0.0.1
+wsrep-cluster-address=gcomm://
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M'
+wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
+wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
+
+# enforce read-committed characteristics across the cluster
+wsrep-causal-reads=ON
+wsrep-sync-wait=7
+server-id=2
+
+[mysqld.3]
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+
+wsrep-on=1
+innodb-autoinc-lock-mode=2
+default-storage-engine=innodb
+wsrep-provider=@ENV.WSREP_PROVIDER
+wsrep_node_address=127.0.0.1
+wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.2.#galera_port'
+wsrep_provider_options='base_port=@mysqld.3.#galera_port;gcache.size=10M'
+wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port
+wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port'
+
+# enforce read-committed characteristics across the cluster
+wsrep-causal-reads=ON
+wsrep-sync-wait=7
+server-id=3
+
+[ENV]
+NODE_MYPORT_1= @mysqld.1.port
+NODE_MYSOCK_1= @mysqld.1.socket
+
+NODE_MYPORT_2= @mysqld.2.port
+NODE_MYSOCK_2= @mysqld.2.socket
+
+NODE_MYPORT_3= @mysqld.2.port
+NODE_MYSOCK_3= @mysqld.2.socket
+
+NODE_GALERAPORT_2= @mysqld.2.#galera_port
+NODE_GALERAPORT_3= @mysqld.3.#galera_port
+
+NODE_SSTPORT_2= @mysqld.2.#sst_port
+NODE_SSTPORT_3= @mysqld.3.#sst_port
diff --git a/mysql-test/suite/galera/galera_4nodes.cnf b/mysql-test/suite/galera/galera_4nodes.cnf
new file mode 100644
index 00000000000..c93282e6c47
--- /dev/null
+++ b/mysql-test/suite/galera/galera_4nodes.cnf
@@ -0,0 +1,74 @@
+# Use default setting for mysqld processes
+!include include/default_mysqld.cnf
+
+[mysqld]
+binlog-format=row
+innodb-autoinc-lock-mode=2
+default-storage-engine=innodb
+wsrep-on=1
+wsrep-provider=@ENV.WSREP_PROVIDER
+wsrep_node_address=127.0.0.1
+# enforce read-committed characteristics across the cluster
+wsrep-causal-reads=ON
+wsrep-sync-wait=7
+
+[mysqld.1]
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+wsrep-cluster-address=gcomm://
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M'
+wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port
+wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port'
+
+[mysqld.2]
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M'
+wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
+wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
+
+
+[mysqld.3]
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
+wsrep_provider_options='base_port=@mysqld.3.#galera_port;gcache.size=10M'
+wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port
+wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port'
+
+
+[mysqld.4]
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
+wsrep_provider_options='base_port=@mysqld.4.#galera_port;gcache.size=10M'
+wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port
+wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port'
+
+[ENV]
+NODE_MYPORT_1= @mysqld.1.port
+NODE_MYSOCK_1= @mysqld.1.socket
+
+NODE_MYPORT_2= @mysqld.2.port
+NODE_MYSOCK_2= @mysqld.2.socket
+
+NODE_MYPORT_3= @mysqld.3.port
+NODE_MYSOCK_3= @mysqld.3.socket
+
+NODE_MYPORT_4= @mysqld.4.port
+NODE_MYSOCK_4= @mysqld.4.socket
+
+NODE_GALERAPORT_1= @mysqld.1.#galera_port
+NODE_GALERAPORT_2= @mysqld.2.#galera_port
+NODE_GALERAPORT_3= @mysqld.3.#galera_port
+NODE_GALERAPORT_4= @mysqld.4.#galera_port
+
+NODE_SSTPORT_1= @mysqld.1.#sst_port
+NODE_SSTPORT_2= @mysqld.2.#sst_port
+NODE_SSTPORT_3= @mysqld.3.#sst_port
+NODE_SSTPORT_4= @mysqld.4.#sst_port
diff --git a/mysql-test/suite/galera/include/galera_have_debug_sync.inc b/mysql-test/suite/galera/include/galera_have_debug_sync.inc
new file mode 100644
index 00000000000..7c0156052d8
--- /dev/null
+++ b/mysql-test/suite/galera/include/galera_have_debug_sync.inc
@@ -0,0 +1,9 @@
+--disable_query_log
+
+--let $galera_have_debug_sync = `SELECT 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters'`
+
+--if (!$galera_have_debug_sync) {
+ --skip "Test requires Galera debug library with debug_sync functionality"
+}
+
+--enable_query_log
diff --git a/mysql-test/suite/galera/include/galera_load_provider.inc b/mysql-test/suite/galera/include/galera_load_provider.inc
new file mode 100644
index 00000000000..761a1a89fd3
--- /dev/null
+++ b/mysql-test/suite/galera/include/galera_load_provider.inc
@@ -0,0 +1,10 @@
+--echo Loading wsrep provider ...
+
+--disable_query_log
+--eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig';
+--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig';
+--enable_query_log
+
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+--source include/wait_until_ready.inc
diff --git a/mysql-test/suite/galera/include/galera_reset_cluster_address.inc b/mysql-test/suite/galera/include/galera_reset_cluster_address.inc
new file mode 100644
index 00000000000..02937ec8ea3
--- /dev/null
+++ b/mysql-test/suite/galera/include/galera_reset_cluster_address.inc
@@ -0,0 +1,12 @@
+--echo Resetting wsrep_cluster_address
+
+--let $wsrep_cluster_size_orig = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'`
+
+SET GLOBAL wsrep_cluster_address = @@wsrep_cluster_address;
+
+--source include/wait_until_connected_again.inc
+
+# Wait for wsrep_cluster_size to go back to its original value
+
+--let $wait_condition = SELECT VARIABLE_VALUE = $wsrep_cluster_size_orig FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
diff --git a/mysql-test/suite/galera/include/galera_resume.inc b/mysql-test/suite/galera/include/galera_resume.inc
new file mode 100644
index 00000000000..232cb46479e
--- /dev/null
+++ b/mysql-test/suite/galera/include/galera_resume.inc
@@ -0,0 +1,9 @@
+--echo Resuming node ...
+--perl
+ my $pid_filename = $ENV{'_SUSPEND_NODE_PIDFILE'};
+ my $mysqld_pid = `cat $pid_filename`;
+ chomp($mysqld_pid);
+ system("kill -18 $mysqld_pid");
+ exit(0);
+EOF
+
diff --git a/mysql-test/suite/galera/include/galera_sst_restore.inc b/mysql-test/suite/galera/include/galera_sst_restore.inc
new file mode 100644
index 00000000000..a08b148c31a
--- /dev/null
+++ b/mysql-test/suite/galera/include/galera_sst_restore.inc
@@ -0,0 +1,29 @@
+#
+# Restore the various options used for SST to their original values
+# so that MTR's end-of-test checks are happy.
+#
+
+--connection node_1
+CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+
+--disable_query_log
+--eval SET GLOBAL wsrep_sst_auth = '$wsrep_sst_auth_orig';
+--enable_query_log
+
+--error 0,ER_CANNOT_USER
+DROP USER sst;
+
+--connection node_2
+CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
+CALL mtr.add_suppression("InnoDB: New log files created");
+CALL mtr.add_suppression("InnoDB: Creating foreign key constraint system tables");
+CALL mtr.add_suppression("Can't open and lock time zone table");
+CALL mtr.add_suppression("Can't open and lock privilege tables");
+CALL mtr.add_suppression("Info table is not ready to be used");
+CALL mtr.add_suppression("Native table .* has the wrong structure");
+
+--disable_query_log
+--eval SET GLOBAL wsrep_sst_method = '$wsrep_sst_method_orig';
+--eval SET GLOBAL wsrep_sst_receive_address = '$wsrep_sst_receive_address_orig';
+--enable_query_log
diff --git a/mysql-test/suite/galera/include/galera_sst_set_mysqldump.inc b/mysql-test/suite/galera/include/galera_sst_set_mysqldump.inc
new file mode 100644
index 00000000000..405c16ce4f1
--- /dev/null
+++ b/mysql-test/suite/galera/include/galera_sst_set_mysqldump.inc
@@ -0,0 +1,22 @@
+#
+# Set all the variables required for the SST to be performed via mysqldump
+#
+
+--echo Setting SST method to mysqldump ...
+
+--connection node_1
+# We need a user with a password to perform SST, otherwise we hit LP #1378253
+GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst';
+
+--let $wsrep_sst_auth_orig = `SELECT @@wsrep_sst_auth`
+SET GLOBAL wsrep_sst_auth = 'sst:sst';
+
+--connection node_2
+--let $wsrep_sst_method_orig = `SELECT @@wsrep_sst_method`
+--let $wsrep_sst_receive_address_orig = `SELECT @@wsrep_sst_receive_address`
+
+--disable_query_log
+# Set wsrep_sst_receive_address to the SQL port
+--eval SET GLOBAL wsrep_sst_receive_address = '127.0.0.2:$NODE_MYPORT_2';
+--enable_query_log
+SET GLOBAL wsrep_sst_method = 'mysqldump';
diff --git a/mysql-test/suite/galera/include/galera_st_clean_slave.inc b/mysql-test/suite/galera/include/galera_st_clean_slave.inc
new file mode 100644
index 00000000000..81ba54aa6f5
--- /dev/null
+++ b/mysql-test/suite/galera/include/galera_st_clean_slave.inc
@@ -0,0 +1,113 @@
+--echo Performing State Transfer on a server that starts from a clean var directory
+--echo This is accomplished by shutting down node #2 and removing its var directory before restarting it
+
+--connection node_1
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+
+--connection node_2
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+
+--echo Shutting down server ...
+--source include/shutdown_mysqld.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+--echo Cleaning var directory ...
+--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mtr
+--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/performance_schema
+--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/test
+--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mysql
+--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+
+--connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+
+--connection node_2
+--echo Starting server ...
+--source include/start_mysqld.inc
+--source include/wait_until_ready.inc
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+
+--connection node_1
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+
+--connection node_1a_galera_st_clean_slave
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+
+SELECT COUNT(*) = 35 FROM t1;
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+
+--connection node_1
+SELECT COUNT(*) = 35 FROM t1;
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
diff --git a/mysql-test/suite/galera/include/galera_st_disconnect_slave.inc b/mysql-test/suite/galera/include/galera_st_disconnect_slave.inc
new file mode 100644
index 00000000000..c8869746bd1
--- /dev/null
+++ b/mysql-test/suite/galera/include/galera_st_disconnect_slave.inc
@@ -0,0 +1,105 @@
+--echo Performing State Transfer on a server that has been temporarily disconnected
+
+--connection node_1
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+
+--connection node_2
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+
+--source suite/galera/include/galera_unload_provider.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+
+--connect node_1a_galera_st_disconnect_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+
+--connection node_2
+--source suite/galera/include/galera_load_provider.inc
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+
+--connection node_1
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+
+--connection node_1a_galera_st_disconnect_slave
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+
+SELECT COUNT(*) = 35 FROM t1;
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+
+--connection node_1
+SELECT COUNT(*) = 35 FROM t1;
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
diff --git a/mysql-test/suite/galera/include/galera_st_kill_slave.inc b/mysql-test/suite/galera/include/galera_st_kill_slave.inc
new file mode 100644
index 00000000000..bae37755c65
--- /dev/null
+++ b/mysql-test/suite/galera/include/galera_st_kill_slave.inc
@@ -0,0 +1,108 @@
+--echo Performing State Transfer on a server that has been killed and restarted
+
+--connection node_1
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+
+--connection node_2
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+
+--source include/kill_galera.inc
+
+--connection node_1
+--source include/wait_until_connected_again.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+
+--connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+
+--connection node_2
+--let $galera_wsrep_recover_server_id=2
+--source suite/galera/include/galera_wsrep_recover.inc
+
+--echo Starting server ...
+--source include/start_mysqld.inc
+--source include/wait_until_ready.inc
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+
+--connection node_1
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+
+--connection node_1a_galera_st_kill_slave
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+
+SELECT COUNT(*) = 35 FROM t1;
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+
+--connection node_1
+SELECT COUNT(*) = 35 FROM t1;
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
diff --git a/mysql-test/suite/galera/include/galera_st_kill_slave_ddl.inc b/mysql-test/suite/galera/include/galera_st_kill_slave_ddl.inc
new file mode 100644
index 00000000000..b8dd0fda987
--- /dev/null
+++ b/mysql-test/suite/galera/include/galera_st_kill_slave_ddl.inc
@@ -0,0 +1,123 @@
+--echo Performing State Transfer on a server that has been killed and restarted
+--echo while a DDL was in progress on it
+
+--connection node_1
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+
+--connection node_2
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+
+# Suspend the applier as it applies the ALTER TABLE
+--let $debug_orig = `SELECT @@debug_dbug`
+SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
+
+--connection node_1
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+
+--connection node_2
+SET wsrep_sync_wait = 0;
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'debug sync point: now'
+--source include/wait_condition.inc
+
+--source include/kill_galera.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+COMMIT;
+
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+
+--connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+
+--connection node_2
+--let $galera_wsrep_recover_server_id=2
+--source suite/galera/include/galera_wsrep_recover.inc
+
+--connection node_2
+--echo Starting server ...
+--source include/start_mysqld.inc
+--source include/wait_until_ready.inc
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+COMMIT;
+
+--connection node_1
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+COMMIT;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+COMMIT;
+
+--connection node_1a_galera_st_kill_slave_ddl
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+SELECT COUNT(*) = 35 FROM t1;
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+
+--connection node_1
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+SELECT COUNT(*) = 35 FROM t1;
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+
+SET GLOBAL debug_dbug = $debug_orig;
diff --git a/mysql-test/suite/galera/include/galera_st_shutdown_slave.inc b/mysql-test/suite/galera/include/galera_st_shutdown_slave.inc
new file mode 100644
index 00000000000..1a65ef1bd94
--- /dev/null
+++ b/mysql-test/suite/galera/include/galera_st_shutdown_slave.inc
@@ -0,0 +1,105 @@
+--echo Performing State Transfer on a server that has been shut down cleanly and restarted
+
+--connection node_1
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+
+--connection node_2
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+
+--echo Shutting down server ...
+--source include/shutdown_mysqld.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+
+--connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+
+--connection node_2
+--echo Starting server ...
+--source include/start_mysqld.inc
+--source include/wait_until_ready.inc
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+
+--connection node_1
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+
+--connection node_1a_galera_st_shutdown_slave
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+
+SELECT COUNT(*) = 35 FROM t1;
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+
+--connection node_1
+SELECT COUNT(*) = 35 FROM t1;
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
diff --git a/mysql-test/suite/galera/include/galera_unload_provider.inc b/mysql-test/suite/galera/include/galera_unload_provider.inc
new file mode 100644
index 00000000000..edc7eb31e0e
--- /dev/null
+++ b/mysql-test/suite/galera/include/galera_unload_provider.inc
@@ -0,0 +1,7 @@
+--echo Unloading wsrep provider ...
+
+--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address`
+--let $wsrep_provider_orig = `SELECT @@wsrep_provider`
+--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options`
+
+SET GLOBAL wsrep_provider = 'none';
diff --git a/mysql-test/suite/galera/include/galera_wsrep_recover.inc b/mysql-test/suite/galera/include/galera_wsrep_recover.inc
new file mode 100644
index 00000000000..090ffe5f5df
--- /dev/null
+++ b/mysql-test/suite/galera/include/galera_wsrep_recover.inc
@@ -0,0 +1,23 @@
+--echo Performing --wsrep-recover ...
+--exec $MYSQLD --defaults-group-suffix=.$galera_wsrep_recover_server_id --defaults-file=$MYSQLTEST_VARDIR/my.cnf --innodb --wsrep-recover > $MYSQL_TMP_DIR/galera_wsrep_recover.log 2>&1
+
+--perl
+ use strict;
+ my $wsrep_start_position_str = "grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'";
+ my $wsrep_start_position = `grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
+ chomp($wsrep_start_position);
+
+ die if $wsrep_start_position eq '';
+
+ open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/galera_wsrep_start_position.inc") or die;
+ print FILE "--let \$galera_wsrep_start_position = $wsrep_start_position\n";
+ close FILE;
+EOF
+
+--source $MYSQL_TMP_DIR/galera_wsrep_start_position.inc
+
+if ($galera_wsrep_start_position == '') {
+ --die "Could not obtain wsrep_start_position."
+}
+
+--remove_file $MYSQL_TMP_DIR/galera_wsrep_start_position.inc
diff --git a/mysql-test/suite/galera/include/kill_galera.inc b/mysql-test/suite/galera/include/kill_galera.inc
new file mode 100644
index 00000000000..d7f665df6c7
--- /dev/null
+++ b/mysql-test/suite/galera/include/kill_galera.inc
@@ -0,0 +1,20 @@
+--echo Killing server ...
+
+# Write file to make mysql-test-run.pl expect the crash, but don't start it
+--let $_server_id= `SELECT @@server_id`
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
+--exec echo "wait" > $_expect_file_name
+
+# Kill the connected server
+--disable_reconnect
+--let KILL_NODE_PIDFILE = `SELECT @@pid_file`
+
+--perl
+ my $pid_filename = $ENV{'KILL_NODE_PIDFILE'};
+ my $mysqld_pid = `cat $pid_filename`;
+ chomp($mysqld_pid);
+ system("kill -9 $mysqld_pid");
+ exit(0);
+EOF
+
+--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/galera/include/shutdown_mysqld.inc b/mysql-test/suite/galera/include/shutdown_mysqld.inc
new file mode 100644
index 00000000000..54bba1318e7
--- /dev/null
+++ b/mysql-test/suite/galera/include/shutdown_mysqld.inc
@@ -0,0 +1,18 @@
+# This is the first half of include/restart_mysqld.inc.
+if ($rpl_inited)
+{
+ if (!$allow_rpl_inited)
+ {
+ --die ERROR IN TEST: When using the replication test framework (master-slave.inc, rpl_init.inc etc), use rpl_restart_server.inc instead of restart_mysqld.inc. If you know what you are doing and you really have to use restart_mysqld.inc, set allow_rpl_inited=1 before you source restart_mysqld.inc
+ }
+}
+
+# Write file to make mysql-test-run.pl expect the "crash", but don't start it
+--let $_server_id= `SELECT @@server_id`
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
+--exec echo "wait" > $_expect_file_name
+
+# Send shutdown to the connected server
+--shutdown_server
+--source include/wait_until_disconnected.inc
+
diff --git a/mysql-test/suite/galera/include/start_mysqld.inc b/mysql-test/suite/galera/include/start_mysqld.inc
new file mode 100644
index 00000000000..4ee3d17810c
--- /dev/null
+++ b/mysql-test/suite/galera/include/start_mysqld.inc
@@ -0,0 +1,22 @@
+# Include this script only after using shutdown_mysqld.inc
+# where $_expect_file_name was initialized.
+# Write file to make mysql-test-run.pl start up the server again
+
+if ($galera_wsrep_start_position != '') {
+ --echo Using --wsrep-start-position when starting mysqld ...
+ --exec echo "restart:$start_mysqld_params --wsrep-start-position=$galera_wsrep_start_position" > $_expect_file_name
+ --let $galera_wsrep_start_position = 0
+}
+
+if ($galera_wsrep_start_position == '') {
+ --exec echo "restart:$start_mysqld_params" > $_expect_file_name
+}
+
+# Turn on reconnect
+--enable_reconnect
+
+# Call script that will poll the server waiting for it to be back online again
+--source include/wait_until_connected_again.inc
+
+# Turn off reconnect again
+--disable_reconnect
diff --git a/mysql-test/suite/galera/r/binlog_checksum.result b/mysql-test/suite/galera/r/binlog_checksum.result
new file mode 100644
index 00000000000..5c1981fc17f
--- /dev/null
+++ b/mysql-test/suite/galera/r/binlog_checksum.result
@@ -0,0 +1,36 @@
+# On node_1
+SET @binlog_checksum_saved= @@GLOBAL.BINLOG_CHECKSUM;
+SET @@GLOBAL.BINLOG_CHECKSUM=CRC32;
+# On node_2
+SET @binlog_checksum_saved= @@GLOBAL.BINLOG_CHECKSUM;
+SET @@GLOBAL.BINLOG_CHECKSUM=CRC32;
+USE test;
+CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
+SELECT * FROM t1;
+c1
+1
+2
+3
+4
+5
+SELECT * FROM test.t1;
+c1
+1
+2
+3
+4
+5
+
+# On node_2
+SELECT * FROM test.t1;
+c1
+1
+2
+3
+4
+5
+DROP TABLE t1;
+SET @@GLOBAL.BINLOG_CHECKSUM = @binlog_checksum_saved;
+SET @@GLOBAL.BINLOG_CHECKSUM = @binlog_checksum_saved;
+# End of test
diff --git a/mysql-test/suite/galera/r/create.result b/mysql-test/suite/galera/r/create.result
index 4dffe96d719..d8a2db99a68 100644
--- a/mysql-test/suite/galera/r/create.result
+++ b/mysql-test/suite/galera/r/create.result
@@ -6,6 +6,8 @@ SET @@GLOBAL.wsrep_forced_binlog_format=STATEMENT;
SHOW VARIABLES LIKE '%log%bin%';
Variable_name Value
log_bin OFF
+log_bin_basename
+log_bin_index
log_bin_trust_function_creators ON
sql_log_bin ON
USE test;
@@ -20,4 +22,40 @@ i
1
DROP TABLE t1;
SET @@GLOBAL.wsrep_forced_binlog_format=@wsrep_forced_binlog_format_saved;
+#
+# MDEV-7673: CREATE TABLE SELECT fails on Galera cluster
+#
+CREATE TABLE t1 (i INT) ENGINE=INNODB DEFAULT CHARSET=utf8 SELECT 1 as i;
+SELECT * FROM t1;
+i
+1
+SELECT * FROM t1;
+i
+1
+DROP TABLE t1;
+#
+# MDEV-8166 : Adding index on new table from select crashes Galera
+# cluster
+#
+CREATE TABLE t1(i int(11) NOT NULL DEFAULT '0') ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t1(i) VALUES (1), (2), (3);
+CREATE TABLE t2 (i INT) SELECT i FROM t1;
+ALTER TABLE t2 ADD INDEX idx(i);
+SELECT * FROM t2;
+i
+1
+2
+3
+SELECT * FROM t2;
+i
+1
+2
+3
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `i` int(11) DEFAULT NULL,
+ KEY `idx` (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t1, t2;
# End of tests
diff --git a/mysql-test/suite/galera/r/galera_account_management.result b/mysql-test/suite/galera/r/galera_account_management.result
new file mode 100644
index 00000000000..9b3ae9ba46e
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_account_management.result
@@ -0,0 +1,40 @@
+CREATE USER user1, user2 IDENTIFIED BY 'password';
+SELECT COUNT(*) = 2 FROM mysql.user WHERE user IN ('user1', 'user2');
+COUNT(*) = 2
+1
+RENAME USER user2 TO user3;
+SELECT COUNT(*) = 0 FROM mysql.user WHERE user = 'user2';
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 1 FROM mysql.user WHERE user = 'user3';
+COUNT(*) = 1
+1
+SET PASSWORD FOR user3 = PASSWORD('foo');
+SELECT password != '' FROM mysql.user WHERE user = 'user3';
+password != ''
+1
+DROP USER user1, user3;
+SELECT COUNT(*) = 0 FROM mysql.user WHERE user IN ('user1', 'user2');
+COUNT(*) = 0
+1
+GRANT ALL ON *.* TO user4 IDENTIFIED BY 'password';
+SELECT COUNT(*) = 1 FROM mysql.user WHERE user = 'user4';
+COUNT(*) = 1
+1
+SELECT Select_priv = 'Y' FROM mysql.user WHERE user = 'user4';
+Select_priv = 'Y'
+1
+CREATE USER user5;
+GRANT PROXY ON user4 TO user5;
+SELECT COUNT(*) = 1 FROM mysql.proxies_priv WHERE user = 'user5';
+COUNT(*) = 1
+1
+REVOKE ALL PRIVILEGES ON *.* FROM user4;
+SELECT Select_priv = 'N' FROM mysql.user WHERE user = 'user4';
+Select_priv = 'N'
+1
+REVOKE PROXY ON user4 FROM user5;
+SELECT COUNT(*) = 0 FROM mysql.proxies_priv WHERE user = 'user5';
+COUNT(*) = 0
+1
+DROP USER user4, user5;
diff --git a/mysql-test/suite/galera/r/galera_alter_engine_innodb.result b/mysql-test/suite/galera/r/galera_alter_engine_innodb.result
new file mode 100644
index 00000000000..2b30ac5814d
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_alter_engine_innodb.result
@@ -0,0 +1,10 @@
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 ENGINE=InnoDB;
+SELECT ENGINE = 'InnoDB' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+ENGINE = 'InnoDB'
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_alter_engine_myisam.result b/mysql-test/suite/galera/r/galera_alter_engine_myisam.result
new file mode 100644
index 00000000000..280cb58208c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_alter_engine_myisam.result
@@ -0,0 +1,11 @@
+SET GLOBAL wsrep_replicate_myisam = TRUE;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 ENGINE=InnoDB;
+SELECT ENGINE = 'InnoDB' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+ENGINE = 'InnoDB'
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_alter_table_force.result b/mysql-test/suite/galera/r/galera_alter_table_force.result
new file mode 100644
index 00000000000..401ab46d868
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_alter_table_force.result
@@ -0,0 +1,10 @@
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 FORCE;
+SELECT ENGINE = 'InnoDB' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+ENGINE = 'InnoDB'
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_as_master.result b/mysql-test/suite/galera/r/galera_as_master.result
new file mode 100644
index 00000000000..d87a744000c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_as_master.result
@@ -0,0 +1,48 @@
+START SLAVE;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+# Disable binary logging for current session
+SET SQL_LOG_BIN=OFF;
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t2 VALUES(1);
+INSERT INTO t1 VALUES(2);
+CREATE TABLE test.t3 AS SELECT * from t1;
+SET SQL_LOG_BIN=ON;
+INSERT INTO t1 VALUES(3);
+CREATE TABLE test.t4 AS SELECT * from t1;
+SELECT * FROM t1;
+f1
+1
+2
+3
+SELECT * FROM t2;
+f1
+1
+SELECT * FROM t3;
+f1
+1
+2
+SELECT * FROM t4;
+f1
+1
+2
+3
+SHOW TABLES;
+Tables_in_test
+t1
+t4
+SELECT * FROM t1;
+f1
+1
+3
+SELECT * FROM t4;
+f1
+1
+2
+3
+# Cleanup
+DROP TABLE t1, t4;
+SET SQL_LOG_BIN=OFF;
+DROP TABLE t2, t3;
+STOP SLAVE;
+RESET SLAVE ALL;
diff --git a/mysql-test/suite/galera/r/galera_as_master_gtid.result b/mysql-test/suite/galera/r/galera_as_master_gtid.result
new file mode 100644
index 00000000000..8dfe462d495
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_as_master_gtid.result
@@ -0,0 +1,59 @@
+START SLAVE USER='root';
+Warnings:
+Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+uuids_do_not_match
+1
+SHOW BINLOG EVENTS IN 'mysqld-bin.000002' FROM 120;
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000002 120 Previous_gtids 1 151
+mysqld-bin.000002 151 Gtid 1 199 SET @@SESSION.GTID_NEXT= '<effective_uuid>:1'
+mysqld-bin.000002 199 Query 1 327 use `test`; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB
+mysqld-bin.000002 327 Gtid 1 375 SET @@SESSION.GTID_NEXT= '<effective_uuid>:2'
+mysqld-bin.000002 375 Query 1 452 BEGIN
+mysqld-bin.000002 452 Table_map 1 497 table_id: # (test.t1)
+mysqld-bin.000002 497 Write_rows 1 537 table_id: # flags: STMT_END_F
+mysqld-bin.000002 537 Xid 1 568 COMMIT /* xid=# */
+INSERT INTO t1 VALUES(2);
+uuids_do_not_match
+1
+uuids_match
+1
+SHOW BINLOG EVENTS IN 'mysqld-bin.000003' FROM 120;
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000003 120 Previous_gtids 2 151
+mysqld-bin.000003 151 Gtid 1 199 SET @@SESSION.GTID_NEXT= '<effective_uuid>:1'
+mysqld-bin.000003 199 Query 1 327 use `test`; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB
+mysqld-bin.000003 327 Gtid 1 375 SET @@SESSION.GTID_NEXT= '<effective_uuid>:2'
+mysqld-bin.000003 375 Query 1 443 BEGIN
+mysqld-bin.000003 443 Table_map 1 488 table_id: # (test.t1)
+mysqld-bin.000003 488 Write_rows 1 528 table_id: # flags: STMT_END_F
+mysqld-bin.000003 528 Xid 1 559 COMMIT /* xid=# */
+mysqld-bin.000003 559 Gtid 2 607 SET @@SESSION.GTID_NEXT= '<effective_uuid>:3'
+mysqld-bin.000003 607 Query 2 684 BEGIN
+mysqld-bin.000003 684 Table_map 2 729 table_id: # (test.t1)
+mysqld-bin.000003 729 Write_rows 2 769 table_id: # flags: STMT_END_F
+mysqld-bin.000003 769 Xid 2 800 COMMIT /* xid=# */
+uuids_do_not_match
+1
+uuids_match
+1
+SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 120;
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000001 120 Previous_gtids 3 151
+mysqld-bin.000001 151 Gtid 1 199 SET @@SESSION.GTID_NEXT= '<effective_uuid>:1'
+mysqld-bin.000001 199 Query 1 327 use `test`; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB
+mysqld-bin.000001 327 Gtid 1 375 SET @@SESSION.GTID_NEXT= '<effective_uuid>:2'
+mysqld-bin.000001 375 Query 1 443 BEGIN
+mysqld-bin.000001 443 Table_map 1 488 table_id: # (test.t1)
+mysqld-bin.000001 488 Write_rows 1 528 table_id: # flags: STMT_END_F
+mysqld-bin.000001 528 Xid 1 559 COMMIT /* xid=# */
+mysqld-bin.000001 559 Gtid 2 607 SET @@SESSION.GTID_NEXT= '<effective_uuid>:3'
+mysqld-bin.000001 607 Query 2 675 BEGIN
+mysqld-bin.000001 675 Table_map 2 720 table_id: # (test.t1)
+mysqld-bin.000001 720 Write_rows 2 760 table_id: # flags: STMT_END_F
+mysqld-bin.000001 760 Xid 2 791 COMMIT /* xid=# */
+DROP TABLE t1;
+STOP SLAVE;
+RESET SLAVE ALL;
diff --git a/mysql-test/suite/galera/r/galera_as_master_gtid_change_master.result b/mysql-test/suite/galera/r/galera_as_master_gtid_change_master.result
new file mode 100644
index 00000000000..80fbccf58e2
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_as_master_gtid_change_master.result
@@ -0,0 +1,15 @@
+START SLAVE USER='root';
+Warnings:
+Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+INSERT INTO t1 VALUES(2);
+STOP SLAVE;
+START SLAVE USER='root';
+Warnings:
+Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
+INSERT INTO t1 VALUES(3);
+INSERT INTO t1 VALUES(4);
+DROP TABLE t1;
+STOP SLAVE;
+RESET SLAVE ALL;
diff --git a/mysql-test/suite/galera/r/galera_as_slave.result b/mysql-test/suite/galera/r/galera_as_slave.result
new file mode 100644
index 00000000000..1e86afa35b7
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_as_slave.result
@@ -0,0 +1,14 @@
+START SLAVE;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+INSERT INTO t1 VALUES (2);
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+INSERT INTO t1 VALUES (3);
+SELECT COUNT(*) = 3 FROM t1;
+COUNT(*) = 3
+1
+DROP TABLE t1;
+STOP SLAVE;
+RESET SLAVE ALL;
diff --git a/mysql-test/suite/galera/r/galera_as_slave_gtid.result b/mysql-test/suite/galera/r/galera_as_slave_gtid.result
new file mode 100644
index 00000000000..fbac7b1b6b5
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_as_slave_gtid.result
@@ -0,0 +1,16 @@
+START SLAVE;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+SELECT LENGTH(@@global.gtid_binlog_state) > 1;
+LENGTH(@@global.gtid_binlog_state) > 1
+1
+gtid_binlog_state_equal
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+gtid_binlog_state_equal
+1
+DROP TABLE t1;
+STOP SLAVE;
+RESET SLAVE ALL;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort.result b/mysql-test/suite/galera/r/galera_bf_abort.result
new file mode 100644
index 00000000000..c55f1a4dfcb
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_abort.result
@@ -0,0 +1,10 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+wsrep_local_aborts_increment
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_for_update.result b/mysql-test/suite/galera/r/galera_bf_abort_for_update.result
new file mode 100644
index 00000000000..3978a3df193
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_abort_for_update.result
@@ -0,0 +1,10 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+wsrep_local_aborts_increment
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_ftwrl.result b/mysql-test/suite/galera/r/galera_bf_abort_ftwrl.result
new file mode 100644
index 00000000000..e3819172510
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_abort_ftwrl.result
@@ -0,0 +1,8 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+FLUSH TABLES WITH READ LOCK;;
+INSERT INTO t1 VALUES (1);
+UNLOCK TABLES;
+wsrep_local_aborts_increment
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_get_lock.result b/mysql-test/suite/galera/r/galera_bf_abort_get_lock.result
new file mode 100644
index 00000000000..2e44a773b23
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_abort_get_lock.result
@@ -0,0 +1,12 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SELECT GET_LOCK("foo", 1000);
+GET_LOCK("foo", 1000)
+1
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT GET_LOCK("foo", 1000);;
+INSERT INTO t1 VALUES (1);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+wsrep_local_aborts_increment
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_lock_table.result b/mysql-test/suite/galera/r/galera_bf_abort_lock_table.result
new file mode 100644
index 00000000000..e657e724a8b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_abort_lock_table.result
@@ -0,0 +1,8 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+LOCK TABLE t1 WRITE;
+INSERT INTO t1 VALUES (1);;
+INSERT INTO t1 VALUES (2);
+wsrep_local_aborts_increment
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_sleep.result b/mysql-test/suite/galera/r/galera_bf_abort_sleep.result
new file mode 100644
index 00000000000..8e85a5feda2
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_abort_sleep.result
@@ -0,0 +1,9 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT SLEEP(1000);;
+INSERT INTO t1 VALUES (1);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+wsrep_local_aborts_increment
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_binlog_cache_size.result b/mysql-test/suite/galera/r/galera_binlog_cache_size.result
new file mode 100644
index 00000000000..9726cf2a440
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_binlog_cache_size.result
@@ -0,0 +1,12 @@
+CREATE TABLE t1 (f1 VARCHAR(767)) ENGINE=InnoDB;
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+SET GLOBAL binlog_cache_size=4096;
+SET GLOBAL max_binlog_cache_size=4096;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+INSERT INTO t1 SELECT REPEAT('a', 767) FROM ten;
+INSERT INTO t1 SELECT REPEAT('a', 767) FROM ten;
+ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mysqld variable and try again
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_binlog_checksum.result b/mysql-test/suite/galera/r/galera_binlog_checksum.result
new file mode 100644
index 00000000000..a6ab62350b1
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_binlog_checksum.result
@@ -0,0 +1,10 @@
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+UPDATE t1 SET f1 = 2 WHERE f1 = 1;
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_binlog_event_max_size_max.result b/mysql-test/suite/galera/r/galera_binlog_event_max_size_max.result
new file mode 100644
index 00000000000..4156c0c70a7
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_binlog_event_max_size_max.result
@@ -0,0 +1,9 @@
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t1 (f1 VARCHAR(1000));
+INSERT INTO t1 SELECT REPEAT('x', 1000) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+SELECT COUNT(*) = 10000 FROM t1;
+COUNT(*) = 10000
+1
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_binlog_event_max_size_min.result b/mysql-test/suite/galera/r/galera_binlog_event_max_size_min.result
new file mode 100644
index 00000000000..984a943fcbe
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_binlog_event_max_size_min.result
@@ -0,0 +1,6 @@
+CREATE TABLE t1 (f1 VARCHAR(1000));
+INSERT INTO t1 VALUES (REPEAT('x', 1000));
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = REPEAT('x', 1000);
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_binlog_row_image.result b/mysql-test/suite/galera/r/galera_binlog_row_image.result
new file mode 100644
index 00000000000..a1f0fb455f3
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_binlog_row_image.result
@@ -0,0 +1,79 @@
+SET SESSION binlog_row_image=minimal;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER NOT NULL UNIQUE) ENGINE=InnoDB;
+CREATE TABLE t3 (f1 VARCHAR(1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+INSERT INTO t3 VALUES (1);
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t3 WHERE f1 = 1;
+COUNT(*) = 1
+1
+UPDATE t1 SET f1 = 2 WHERE f1 = 1;
+UPDATE t2 SET f1 = 2 WHERE f1 = 1;
+UPDATE t3 SET f1 = 2 WHERE f1 = 1;
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t3 WHERE f1 = 2;
+COUNT(*) = 1
+1
+DELETE FROM t1;
+DELETE FROM t2;
+DELETE FROM t3;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t3;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+SET SESSION binlog_row_image=noblob;
+CREATE TABLE t1 (f1 BLOB, f2 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 BLOB) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('abc', 1);
+INSERT INTO t2 VALUES ('abc');
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'abc';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 'abc';
+COUNT(*) = 1
+1
+UPDATE t1 SET f1 = 'xyz';
+UPDATE t2 SET f1 = 'xyz';
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'xyz';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 'xyz';
+COUNT(*) = 1
+1
+UPDATE t1 SET f2 = 2 WHERE f2 = 1;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'xyz';
+COUNT(*) = 1
+1
+DELETE FROM t1;
+DELETE FROM t2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_binlog_rows_query_log_events.result b/mysql-test/suite/galera/r/galera_binlog_rows_query_log_events.result
new file mode 100644
index 00000000000..80ae3d0de2c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_binlog_rows_query_log_events.result
@@ -0,0 +1,12 @@
+SET GLOBAL binlog_rows_query_log_events=TRUE;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+UPDATE t1 SET f1 = 2 WHERE f1 = 1;
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SET GLOBAL binlog_rows_query_log_events = 0;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_concurrent_ctas.result b/mysql-test/suite/galera/r/galera_concurrent_ctas.result
new file mode 100644
index 00000000000..8b0a4c07ac2
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_concurrent_ctas.result
@@ -0,0 +1 @@
+# End of test
diff --git a/mysql-test/suite/galera/r/galera_create_function.result b/mysql-test/suite/galera/r/galera_create_function.result
new file mode 100644
index 00000000000..10020712286
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_create_function.result
@@ -0,0 +1,55 @@
+CREATE USER 'user1';
+CREATE
+DEFINER = 'user1'
+FUNCTION f1 (param INTEGER)
+RETURNS VARCHAR(200)
+COMMENT 'f1_comment'
+LANGUAGE SQL
+NOT DETERMINISTIC
+MODIFIES SQL DATA
+SQL SECURITY DEFINER
+RETURN 'abc';
+GRANT EXECUTE ON FUNCTION f1 TO user1;
+CREATE
+DEFINER = CURRENT_USER
+FUNCTION f2 (param VARCHAR(100))
+RETURNS INTEGER
+DETERMINISTIC
+NO SQL
+SQL SECURITY INVOKER
+RETURN 123;
+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=`user1`@`%` FUNCTION `f1`(param INTEGER) RETURNS varchar(200) CHARSET latin1
+ MODIFIES SQL DATA
+ COMMENT 'f1_comment'
+RETURN 'abc' latin1 latin1_swedish_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=`user1`@`%` FUNCTION `f1`(param INTEGER) RETURNS varchar(200) CHARSET latin1
+ MODIFIES SQL DATA
+ COMMENT 'f1_comment'
+RETURN 'abc' latin1 latin1_swedish_ci latin1_swedish_ci
+SHOW CREATE FUNCTION f2;
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f2 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f2`(param VARCHAR(100)) RETURNS int(11)
+ NO SQL
+ DETERMINISTIC
+ SQL SECURITY INVOKER
+RETURN 123 latin1 latin1_swedish_ci latin1_swedish_ci
+SHOW CREATE FUNCTION f2;
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f2 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f2`(param VARCHAR(100)) RETURNS int(11)
+ NO SQL
+ DETERMINISTIC
+ SQL SECURITY INVOKER
+RETURN 123 latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT f1(1) = 'abc';
+f1(1) = 'abc'
+1
+SELECT f2('abc') = 123;
+f2('abc') = 123
+1
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+DROP USER 'user1';
diff --git a/mysql-test/suite/galera/r/galera_create_procedure.result b/mysql-test/suite/galera/r/galera_create_procedure.result
new file mode 100644
index 00000000000..6191ef48ee5
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_create_procedure.result
@@ -0,0 +1,53 @@
+CREATE USER 'user1';
+CREATE TABLE t1 (f1 INTEGER);
+CREATE
+DEFINER = 'user1'
+PROCEDURE p1 (IN param1 INTEGER, OUT param2 INTEGER, INOUT param3 INTEGER)
+COMMENT 'p1_comment'
+LANGUAGE SQL
+NOT DETERMINISTIC
+MODIFIES SQL DATA
+SQL SECURITY DEFINER
+INSERT INTO t1 VALUES (1);
+GRANT EXECUTE ON PROCEDURE p1 TO user1;
+CREATE
+DEFINER = CURRENT_USER
+PROCEDURE p2 (param VARCHAR(100))
+DETERMINISTIC
+NO SQL
+SQL SECURITY INVOKER BEGIN END ;
+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=`user1`@`%` PROCEDURE `p1`(IN param1 INTEGER, OUT param2 INTEGER, INOUT param3 INTEGER)
+ MODIFIES SQL DATA
+ COMMENT 'p1_comment'
+INSERT INTO t1 VALUES (1) latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT 1 FROM DUAL;
+1
+1
+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=`user1`@`%` PROCEDURE `p1`(IN param1 INTEGER, OUT param2 INTEGER, INOUT param3 INTEGER)
+ MODIFIES SQL DATA
+ COMMENT 'p1_comment'
+INSERT INTO t1 VALUES (1) latin1 latin1_swedish_ci latin1_swedish_ci
+SHOW CREATE PROCEDURE p2;
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p2 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`(param VARCHAR(100))
+ NO SQL
+ DETERMINISTIC
+ SQL SECURITY INVOKER
+BEGIN END latin1 latin1_swedish_ci latin1_swedish_ci
+SHOW CREATE PROCEDURE p2;
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p2 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`(param VARCHAR(100))
+ NO SQL
+ DETERMINISTIC
+ SQL SECURITY INVOKER
+BEGIN END latin1 latin1_swedish_ci latin1_swedish_ci
+CALL p1(@a, @b, @c);
+CALL p2('abc');
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+DROP USER 'user1';
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_create_table_like.result b/mysql-test/suite/galera/r/galera_create_table_like.result
new file mode 100644
index 00000000000..b335101fa62
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_create_table_like.result
@@ -0,0 +1,47 @@
+CREATE SCHEMA schema1;
+CREATE SCHEMA schema2;
+USE schema1;
+CREATE TABLE real_table (f1 INTEGER) ENGINE=InnoDB;
+CREATE TEMPORARY TABLE temp_table (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE myisam_table (f1 INTEGER) ENGINE=MyISAM;
+USE schema2;
+CREATE TABLE real_table1 LIKE schema1.real_table;
+CREATE TABLE real_table2 LIKE schema1.temp_table;
+CREATE TABLE real_table3 LIKE schema1.myisam_table;
+CREATE TEMPORARY TABLE temp_table1 LIKE schema1.real_table;
+CREATE TEMPORARY TABLE temp_table2 LIKE schema1.temp_table;
+CREATE TEMPORARY TABLE temp_table3 LIKE schema1.myisam_table;
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'real_table' AND TABLE_SCHEMA = 'schema1';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'myisam_table' AND TABLE_SCHEMA = 'schema1';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'temp_table' AND TABLE_SCHEMA = 'schema1';
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'real_table1' AND TABLE_SCHEMA = 'schema2';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'real_table2' AND TABLE_SCHEMA = 'schema2';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'real_table3' AND TABLE_SCHEMA = 'schema2';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'temp_table1' AND TABLE_SCHEMA = 'schema2';
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'temp_table2' AND TABLE_SCHEMA = 'schema2';
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'temp_table3' AND TABLE_SCHEMA = 'schema2';
+COUNT(*) = 0
+1
+DROP TABLE schema1.real_table;
+DROP TABLE schema1.myisam_table;
+DROP TABLE schema2.real_table1;
+DROP TABLE schema2.real_table2;
+DROP TABLE schema2.real_table3;
+DROP SCHEMA schema1;
+DROP SCHEMA schema2;
diff --git a/mysql-test/suite/galera/r/galera_create_trigger.result b/mysql-test/suite/galera/r/galera_create_trigger.result
new file mode 100644
index 00000000000..7e656081871
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_create_trigger.result
@@ -0,0 +1,42 @@
+CREATE TABLE definer_root (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB;
+CREATE TABLE definer_user (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB;
+CREATE TABLE definer_current_user (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB;
+CREATE TABLE definer_default (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB;
+CREATE USER 'user1';
+CREATE DEFINER=root@localhost TRIGGER definer_root BEFORE INSERT ON definer_root FOR EACH ROW SET NEW.trigger_user = CURRENT_USER();
+CREATE DEFINER=user1 TRIGGER definer_user BEFORE INSERT ON definer_user FOR EACH ROW SET NEW.trigger_user = CURRENT_USER();
+CREATE DEFINER=current_user TRIGGER definer_current_user BEFORE INSERT ON definer_current_user FOR EACH ROW SET NEW.trigger_user = CURRENT_USER();
+CREATE TRIGGER definer_default BEFORE INSERT ON definer_default FOR EACH ROW SET NEW.trigger_user = CURRENT_USER();
+INSERT INTO definer_root (f1) VALUES (1);
+SELECT DEFINER = 'root@localhost' FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME = 'definer_root';
+DEFINER = 'root@localhost'
+1
+SELECT trigger_user = 'root@localhost' FROM definer_root;
+trigger_user = 'root@localhost'
+1
+INSERT INTO definer_user (f1) VALUES (1);
+SELECT DEFINER = 'user1@%' FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME = 'definer_user';
+DEFINER = 'user1@%'
+1
+SELECT trigger_user = 'user1@%' FROM definer_user;
+trigger_user = 'user1@%'
+1
+INSERT INTO definer_current_user (f1) VALUES (1);
+SELECT DEFINER = 'root@localhost' FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME = 'definer_current_user';
+DEFINER = 'root@localhost'
+1
+SELECT trigger_user = 'root@localhost' FROM definer_current_user;
+trigger_user = 'root@localhost'
+1
+INSERT INTO definer_default (f1) VALUES (1);
+SELECT DEFINER = 'root@localhost' FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME = 'definer_default';
+DEFINER = 'root@localhost'
+1
+SELECT trigger_user = 'root@localhost' FROM definer_default;
+trigger_user = 'root@localhost'
+1
+DROP TABLE definer_current_user;
+DROP TABLE definer_user;
+DROP TABLE definer_root;
+DROP TABLE definer_default;
+DROP USER 'user1';
diff --git a/mysql-test/suite/galera/r/galera_defaults.result b/mysql-test/suite/galera/r/galera_defaults.result
new file mode 100644
index 00000000000..cea97a8e047
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_defaults.result
@@ -0,0 +1,120 @@
+SELECT COUNT(*) = 42 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';
+COUNT(*) = 42
+1
+SELECT VARIABLE_NAME, VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME LIKE 'wsrep_%'
+AND VARIABLE_NAME NOT IN (
+'WSREP_PROVIDER_OPTIONS',
+'WSREP_SST_RECEIVE_ADDRESS',
+'WSREP_NODE_ADDRESS',
+'WSREP_NODE_NAME',
+'WSREP_PROVIDER',
+'WSREP_DATA_HOME_DIR',
+'WSREP_NODE_INCOMING_ADDRESS',
+'WSREP_START_POSITION'
+)
+ORDER BY VARIABLE_NAME;
+VARIABLE_NAME VARIABLE_VALUE
+WSREP_AUTO_INCREMENT_CONTROL ON
+WSREP_CAUSAL_READS ON
+WSREP_CERTIFY_NONPK ON
+WSREP_CLUSTER_ADDRESS gcomm://
+WSREP_CLUSTER_NAME my_wsrep_cluster
+WSREP_CONVERT_LOCK_TO_TRX OFF
+WSREP_DBUG_OPTION
+WSREP_DEBUG OFF
+WSREP_DESYNC OFF
+WSREP_DRUPAL_282555_WORKAROUND OFF
+WSREP_FORCED_BINLOG_FORMAT NONE
+WSREP_GTID_DOMAIN_ID 0
+WSREP_GTID_MODE OFF
+WSREP_LOAD_DATA_SPLITTING ON
+WSREP_LOG_CONFLICTS OFF
+WSREP_MAX_WS_ROWS 131072
+WSREP_MAX_WS_SIZE 1073741824
+WSREP_MYSQL_REPLICATION_BUNDLE 0
+WSREP_NOTIFY_CMD
+WSREP_ON ON
+WSREP_OSU_METHOD TOI
+WSREP_PATCH_VERSION wsrep_25.10
+WSREP_RECOVER OFF
+WSREP_REPLICATE_MYISAM OFF
+WSREP_RESTART_SLAVE OFF
+WSREP_RETRY_AUTOCOMMIT 1
+WSREP_SLAVE_FK_CHECKS ON
+WSREP_SLAVE_THREADS 1
+WSREP_SLAVE_UK_CHECKS OFF
+WSREP_SST_AUTH
+WSREP_SST_DONOR
+WSREP_SST_DONOR_REJECTS_QUERIES OFF
+WSREP_SST_METHOD rsync
+WSREP_SYNC_WAIT 7
+<BASE_HOST>; <BASE_PORT>; cert.log_conflicts = no; debug = no; evs.auto_evict = 0; evs.causal_keepalive_period = PT1S; evs.debug_log_mask = 0x1; evs.delay_margin = PT1S; evs.delayed_keep_period = PT30S; evs.inactive_check_period = PT0.5S; evs.inactive_timeout = PT15S; evs.info_log_mask = 0; evs.install_timeout = PT7.5S; evs.join_retrans_period = PT1S; evs.keepalive_period = PT1S; evs.max_install_timeouts = 3; evs.send_window = 4; evs.stats_report_period = PT1M; evs.suspect_timeout = PT5S; evs.use_aggregate = true; evs.user_send_window = 2; evs.version = 0; evs.view_forget_timeout = P1D; <GCACHE_DIR>; gcache.keep_pages_size = 0; gcache.mem_size = 0; <GCACHE_NAME>; gcache.page_size = 128M; gcache.size = 10M; gcs.fc_debug = 0; gcs.fc_factor = 1.0; gcs.fc_limit = 16; gcs.fc_master_slave = no; gcs.max_packet_size = 64500; gcs.max_throttle = 0.25; <GCS_RECV_Q_HARD_LIMIT>; gcs.recv_q_soft_limit = 0.25; gcs.sync_donor = no; <GMCAST_LISTEN_ADDR>; gmcast.mcast_addr = ; gmcast.mcast_ttl = 1; gmcast.peer_timeout = PT3S; gmcast.segment = 0; gmcast.time_wait = PT5S; gmcast.version = 0; <IST_RECV_ADDR>; pc.announce_timeout = PT3S; pc.checksum = false; pc.ignore_quorum = false; pc.ignore_sb = false; pc.linger = PT20S; pc.npvo = false; pc.recovery = true; pc.version = 0; pc.wait_prim = true; pc.wait_prim_timeout = P30S; pc.weight = 1; protonet.backend = asio; protonet.version = 0; repl.causal_read_timeout = PT30S; repl.commit_order = 3; repl.key_format = FLAT8; repl.max_ws_size = 2147483647; repl.proto_max = 7; socket.checksum = 2;
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_STATUS
+WHERE VARIABLE_NAME LIKE 'wsrep_%'
+AND VARIABLE_NAME != 'wsrep_debug_sync_waiters';
+COUNT(*)
+57
+SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.GLOBAL_STATUS
+WHERE VARIABLE_NAME LIKE 'wsrep_%'
+AND VARIABLE_NAME != 'wsrep_debug_sync_waiters'
+ORDER BY VARIABLE_NAME;
+VARIABLE_NAME
+WSREP_APPLY_OOOE
+WSREP_APPLY_OOOL
+WSREP_APPLY_WINDOW
+WSREP_CAUSAL_READS
+WSREP_CERT_DEPS_DISTANCE
+WSREP_CERT_INDEX_SIZE
+WSREP_CERT_INTERVAL
+WSREP_CLUSTER_CONF_ID
+WSREP_CLUSTER_SIZE
+WSREP_CLUSTER_STATE_UUID
+WSREP_CLUSTER_STATUS
+WSREP_COMMIT_OOOE
+WSREP_COMMIT_OOOL
+WSREP_COMMIT_WINDOW
+WSREP_CONNECTED
+WSREP_EVS_DELAYED
+WSREP_EVS_EVICT_LIST
+WSREP_EVS_REPL_LATENCY
+WSREP_EVS_STATE
+WSREP_FLOW_CONTROL_PAUSED
+WSREP_FLOW_CONTROL_PAUSED_NS
+WSREP_FLOW_CONTROL_RECV
+WSREP_FLOW_CONTROL_SENT
+WSREP_GCOMM_UUID
+WSREP_INCOMING_ADDRESSES
+WSREP_LAST_COMMITTED
+WSREP_LOCAL_BF_ABORTS
+WSREP_LOCAL_CACHED_DOWNTO
+WSREP_LOCAL_CERT_FAILURES
+WSREP_LOCAL_COMMITS
+WSREP_LOCAL_INDEX
+WSREP_LOCAL_RECV_QUEUE
+WSREP_LOCAL_RECV_QUEUE_AVG
+WSREP_LOCAL_RECV_QUEUE_MAX
+WSREP_LOCAL_RECV_QUEUE_MIN
+WSREP_LOCAL_REPLAYS
+WSREP_LOCAL_SEND_QUEUE
+WSREP_LOCAL_SEND_QUEUE_AVG
+WSREP_LOCAL_SEND_QUEUE_MAX
+WSREP_LOCAL_SEND_QUEUE_MIN
+WSREP_LOCAL_STATE
+WSREP_LOCAL_STATE_COMMENT
+WSREP_LOCAL_STATE_UUID
+WSREP_PROTOCOL_VERSION
+WSREP_PROVIDER_NAME
+WSREP_PROVIDER_VENDOR
+WSREP_PROVIDER_VERSION
+WSREP_READY
+WSREP_RECEIVED
+WSREP_RECEIVED_BYTES
+WSREP_REPLICATED
+WSREP_REPLICATED_BYTES
+WSREP_REPL_DATA_BYTES
+WSREP_REPL_KEYS
+WSREP_REPL_KEYS_BYTES
+WSREP_REPL_OTHER_BYTES
+WSREP_THREAD_COUNT
diff --git a/mysql-test/suite/galera/r/galera_delete_limit.result b/mysql-test/suite/galera/r/galera_delete_limit.result
new file mode 100644
index 00000000000..72bee18eab6
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_delete_limit.result
@@ -0,0 +1,19 @@
+CREATE TABLE ten (f1 INTEGER) Engine=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+INSERT INTO t1 SELECT f1 FROM ten ORDER BY RAND();
+DELETE FROM t1 ORDER BY RAND() LIMIT 5;
+sum_matches
+1
+max_matches
+1
+DROP TABLE t1;
+CREATE TABLE t2 (f1 INTEGER) Engine=InnoDB;
+INSERT INTO t2 SELECT f1 FROM ten ORDER BY RAND();
+DELETE FROM t2 ORDER BY RAND() LIMIT 5;
+sum_matches
+1
+max_matches
+1
+DROP TABLE t2;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_enum.result b/mysql-test/suite/galera/r/galera_enum.result
new file mode 100644
index 00000000000..e853c5c9943
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_enum.result
@@ -0,0 +1,37 @@
+CREATE TABLE t1 (f1 ENUM('', 'one', 'two'), KEY (f1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('');
+INSERT INTO t1 VALUES ('one'), ('two');
+INSERT INTO t1 VALUES (0), (1), (2);
+Warnings:
+Warning 1265 Data truncated for column 'f1' at row 1
+SELECT COUNT(*) = 6 FROM t1;
+COUNT(*) = 6
+1
+SELECT COUNT(*) = 2 FROM t1 where f1 = '';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 2 FROM t1 where f1 = 'one';
+COUNT(*) = 2
+1
+DROP TABLE t1;
+CREATE TABLE t1 (f1 ENUM('', 'one', 'two', 'three', 'four') PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (''), ('one'), ('two');
+SELECT COUNT(*) = 3 FROM t1;
+COUNT(*) = 3
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = '';
+COUNT(*) = 1
+1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'three' where f1 = '';
+SET AUTOCOMMIt=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'four' where f1 = '';
+COMMIT;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'three';
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_events.result b/mysql-test/suite/galera/r/galera_events.result
new file mode 100644
index 00000000000..09d8406d5d0
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_events.result
@@ -0,0 +1,18 @@
+CREATE EVENT event1 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT 1;
+SELECT DEFINER= 'root@localhost', ORIGINATOR = 1, STATUS = 'SLAVESIDE_DISABLED', EVENT_TYPE = 'ONE TIME', ON_COMPLETION = 'NOT PRESERVE' FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event1';
+DEFINER= 'root@localhost' ORIGINATOR = 1 STATUS = 'SLAVESIDE_DISABLED' EVENT_TYPE = 'ONE TIME' ON_COMPLETION = 'NOT PRESERVE'
+1 1 1 1 1
+ALTER EVENT event1 DISABLE;
+SELECT DEFINER= 'root@localhost', ORIGINATOR = 1, STATUS = 'SLAVESIDE_DISABLED', EVENT_TYPE = 'ONE TIME', ON_COMPLETION = 'NOT PRESERVE' FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event1';
+DEFINER= 'root@localhost' ORIGINATOR = 1 STATUS = 'SLAVESIDE_DISABLED' EVENT_TYPE = 'ONE TIME' ON_COMPLETION = 'NOT PRESERVE'
+1 1 1 1 1
+SET GLOBAL event_scheduler = ON;
+CREATE EVENT event2 ON SCHEDULE AT CURRENT_TIMESTAMP ON COMPLETION NOT PRESERVE DO SELECT 1;
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event2';
+COUNT(*) = 0
+1
+DROP EVENT event1;
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event1';
+COUNT(*) = 0
+1
+SET GLOBAL event_scheduler = OFF;;
diff --git a/mysql-test/suite/galera/r/galera_fk_multicolumn.result b/mysql-test/suite/galera/r/galera_fk_multicolumn.result
index 62ec9f85cd4..a86b87a83ef 100644
--- a/mysql-test/suite/galera/r/galera_fk_multicolumn.result
+++ b/mysql-test/suite/galera/r/galera_fk_multicolumn.result
@@ -1,19 +1,19 @@
CREATE TABLE t0 (
f1 INT PRIMARY KEY,
f2 INT UNIQUE
-) ENGINE=INNODB;
+);
CREATE TABLE t1 (
f1 INT PRIMARY KEY,
FOREIGN KEY (f1)
REFERENCES t0(f1)
ON UPDATE CASCADE
-) ENGINE=INNODB;
+);
CREATE TABLE t2 (
f2 INT PRIMARY KEY,
FOREIGN KEY (f2)
REFERENCES t0(f2)
ON UPDATE CASCADE
-) ENGINE=INNODB;
+);
INSERT INTO t0 VALUES (0, 0);
INSERT INTO t1 VALUES (0);
INSERT INTO t2 VALUES (0);
diff --git a/mysql-test/suite/galera/r/galera_fk_multitable.result b/mysql-test/suite/galera/r/galera_fk_multitable.result
index 410565eb0ed..e77128d3b04 100644
--- a/mysql-test/suite/galera/r/galera_fk_multitable.result
+++ b/mysql-test/suite/galera/r/galera_fk_multitable.result
@@ -1,13 +1,13 @@
CREATE TABLE t0 (
f0 INT PRIMARY KEY
-) ENGINE=INNODB;
+);
CREATE TABLE t1 (
f1 INT PRIMARY KEY,
f0 INTEGER,
FOREIGN KEY (f0)
REFERENCES t0(f0)
ON DELETE CASCADE
-) ENGINE=INNODB;
+);
INSERT INTO t0 VALUES (0), (1);
INSERT INTO t1 VALUES (0, 0);
INSERT INTO t1 VALUES (1, 0);
diff --git a/mysql-test/suite/galera/r/galera_flush.result b/mysql-test/suite/galera/r/galera_flush.result
new file mode 100644
index 00000000000..c5e47c29324
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_flush.result
@@ -0,0 +1,32 @@
+FLUSH DES_KEY_FILE;
+wsrep_last_committed_diff
+1
+FLUSH HOSTS;
+wsrep_last_committed_diff
+1
+SET GLOBAL wsrep_replicate_myisam = TRUE;
+INSERT INTO mysql.user VALUES('localhost','user1',PASSWORD('pass1'), '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,'mysql_native_password','','N','N','',0);
+FLUSH PRIVILEGES;
+DELETE FROM mysql.user WHERE user = 'user1';
+SET GLOBAL wsrep_replicate_myisam = FALSE;
+FLUSH PRIVILEGES;
+FLUSH QUERY CACHE;
+wsrep_last_committed_diff
+1
+FLUSH STATUS;
+wsrep_last_committed_diff
+1
+FLUSH USER_RESOURCES;
+wsrep_last_committed_diff
+1
+CREATE TABLE t1 (f1 INTEGER);
+FLUSH LOGS;
+FLUSH TABLES WITH READ LOCK;
+UNLOCK TABLES;
+FLUSH TABLES t1 WITH READ LOCK;
+UNLOCK TABLES;
+FLUSH TABLES t1 FOR EXPORT;
+UNLOCK TABLES;
+wsrep_last_committed_diff
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_ftwrl.result b/mysql-test/suite/galera/r/galera_ftwrl.result
new file mode 100644
index 00000000000..c216b52650b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ftwrl.result
@@ -0,0 +1,16 @@
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+SET GLOBAL wsrep_provider_options = "repl.causal_read_timeout=PT1S";
+FLUSH TABLES WITH READ LOCK;
+INSERT INTO t1 VALUES (1);
+SHOW TABLES;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SELECT * FROM t1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+UNLOCK TABLES;
+SHOW TABLES;
+Tables_in_test
+t1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_fulltext.result b/mysql-test/suite/galera/r/galera_fulltext.result
new file mode 100644
index 00000000000..72577695202
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_fulltext.result
@@ -0,0 +1,26 @@
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(100), FULLTEXT (f2)) ENGINE=InnoDB;
+SELECT COUNT(*) = 13 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name LIKE 'test/%';
+COUNT(*) = 13
+1
+INSERT INTO t1 (f2) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+SELECT COUNT(f2) = 10000 FROM t1 WHERE MATCH(f2) AGAINST ('foobarbaz');
+COUNT(f2) = 10000
+1
+UPDATE t1 SET f2 = 'abcdefjhk';
+SELECT COUNT(f2) = 10000 FROM t1 WHERE MATCH(f2) AGAINST ('abcdefjhk');
+COUNT(f2) = 10000
+1
+DROP TABLE t1;
+CREATE TABLE t1 (f1 VARCHAR(100), FULLTEXT (f1)) ENGINE=InnoDB;
+INSERT INTO t1 (f1) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3;
+SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('foobarbaz');
+COUNT(f1) = 1000
+1
+UPDATE t1 SET f1 = 'abcdefjhk';
+SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('abcdefjhk');
+COUNT(f1) = 1000
+1
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_gcs_fc_limit.result b/mysql-test/suite/galera/r/galera_gcs_fc_limit.result
new file mode 100644
index 00000000000..99c710f25a5
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_gcs_fc_limit.result
@@ -0,0 +1,17 @@
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SET GLOBAL wsrep_provider_options = 'gcs.fc_limit=1';
+FLUSH TABLES WITH READ LOCK;
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'query end' AND INFO = 'INSERT INTO t1 VALUES (5)';
+COUNT(*) = 1
+1
+UNLOCK TABLES;
+INSERT INTO t1 VALUES (6);
+SELECT COUNT(*) = 6 FROM t1;
+COUNT(*) = 6
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_gcs_max_packet_size.result b/mysql-test/suite/galera/r/galera_gcs_max_packet_size.result
new file mode 100644
index 00000000000..606cb549def
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_gcs_max_packet_size.result
@@ -0,0 +1,15 @@
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+CREATE TABLE t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 VARCHAR(512) UNIQUE) ENGINE=InnoDB;
+INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+INSERT INTO t2 VALUES (REPEAT('x', 512));
+SELECT COUNT(*) = 10000 FROM t1;
+COUNT(*) = 10000
+1
+SELECT LENGTH(f1) = 512 FROM t2 WHERE f1 = REPEAT('x', 512);
+LENGTH(f1) = 512
+1
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_gtid.result b/mysql-test/suite/galera/r/galera_gtid.result
new file mode 100644
index 00000000000..546c29cb49a
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_gtid.result
@@ -0,0 +1,12 @@
+CREATE TABLE t1 (f1 INT PRIMARY KEY);
+INSERT INTO t1 VALUES (1);
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+UPDATE t1 SET f1 = 2;
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+gtid_binlog_state_equal
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_insert_ignore.result b/mysql-test/suite/galera/r/galera_insert_ignore.result
new file mode 100644
index 00000000000..b53b5795416
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_insert_ignore.result
@@ -0,0 +1,52 @@
+SET GLOBAL wsrep_sync_wait = 7;
+SET GLOBAL wsrep_sync_wait = 7;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT IGNORE INTO t1 VALUES (1), (2);
+Warnings:
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
+SELECT * FROM t1;
+f1
+1
+2
+SELECT * FROM t1;
+f1
+1
+2
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (0), (2), (3);
+INSERT IGNORE INTO t1 SELECT f1 FROM t2;
+Warnings:
+Warning 1062 Duplicate entry '2' for key 'PRIMARY'
+SELECT * FROM t1;
+f1
+0
+1
+2
+3
+SELECT * FROM t1;
+f1
+0
+1
+2
+3
+CREATE TABLE t3 (f1 INTEGER UNIQUE) Engine=InnoDB;
+INSERT INTO t3 VALUES (NULL);
+INSERT IGNORE INTO t3 VALUES (1), (NULL), (2);
+SELECT * FROM t3;
+f1
+NULL
+NULL
+1
+2
+SELECT * FROM t3;
+f1
+NULL
+NULL
+1
+2
+SET GLOBAL wsrep_sync_wait = (SELECT @@wsrep_sync_wait);
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+SET GLOBAL wsrep_sync_wait = (SELECT @@wsrep_sync_wait);
diff --git a/mysql-test/suite/galera/r/galera_insert_multi.result b/mysql-test/suite/galera/r/galera_insert_multi.result
new file mode 100644
index 00000000000..33717781f2c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_insert_multi.result
@@ -0,0 +1,58 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+INSERT INTO t1 VALUES (3),(4);
+SELECT COUNT(*) = 4 FROM t1;
+COUNT(*) = 4
+1
+SELECT COUNT(*) = 4 FROM t1;
+COUNT(*) = 4
+1
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER, KEY (f1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(1);
+INSERT INTO t1 VALUES (2),(2);
+SELECT COUNT(*) = 4 FROM t1;
+COUNT(*) = 4
+1
+SELECT COUNT(*) = 4 FROM t1;
+COUNT(*) = 4
+1
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET AUTOCOMMIT = OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1), (2);
+SET AUTOCOMMIT = OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (2), (1);
+COMMIT;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+ROLLBACK;
+INSERT INTO t1 VALUES (1), (2);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1), (2);
+START TRANSACTION;
+INSERT INTO t1 VALUES (2), (1);
+ROLLBACK;
+COMMIT;
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_ist_innodb_flush_logs.result b/mysql-test/suite/galera/r/galera_ist_innodb_flush_logs.result
new file mode 100644
index 00000000000..5421b234ee1
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_innodb_flush_logs.result
@@ -0,0 +1,184 @@
+Performing State Transfer on a server that has been killed and restarted
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+Killing server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that has been killed and restarted
+while a DDL was in progress on it
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+SET GLOBAL debug = 'd,sync.alter_opened_table';
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+SET wsrep_sync_wait = 0;
+Killing server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
diff --git a/mysql-test/suite/galera/r/galera_ist_mysqldump.result b/mysql-test/suite/galera/r/galera_ist_mysqldump.result
new file mode 100644
index 00000000000..4b5a8fe948a
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_mysqldump.result
@@ -0,0 +1,284 @@
+Setting SST method to mysqldump ...
+GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst';
+SET GLOBAL wsrep_sst_auth = 'sst:sst';
+SET GLOBAL wsrep_sst_method = 'mysqldump';
+Performing State Transfer on a server that has been shut down cleanly and restarted
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+Shutting down server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that has been killed and restarted
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+Killing server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that has been killed and restarted
+while a DDL was in progress on it
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+SET GLOBAL debug = 'd,sync.alter_opened_table';
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+SET wsrep_sync_wait = 0;
+Killing server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+DROP USER sst;
+CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
+CALL mtr.add_suppression("InnoDB: New log files created");
+CALL mtr.add_suppression("InnoDB: Creating foreign key constraint system tables");
+CALL mtr.add_suppression("Can't open and lock time zone table");
+CALL mtr.add_suppression("Can't open and lock privilege tables");
+CALL mtr.add_suppression("Info table is not ready to be used");
+CALL mtr.add_suppression("Native table .* has the wrong structure");
diff --git a/mysql-test/suite/galera/r/galera_ist_restart_joiner.result b/mysql-test/suite/galera/r/galera_ist_restart_joiner.result
new file mode 100644
index 00000000000..f7a1386e7f8
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_restart_joiner.result
@@ -0,0 +1,43 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+INSERT INTO t1 VALUES (1, 'a'), (2, 'a'), (3, 'a'), (4, 'a'), (5, 'a'),(6, 'a');
+Unloading wsrep provider ...
+SET GLOBAL wsrep_provider = 'none';
+UPDATE t1 SET f2 = 'b' WHERE f1 > 1;
+UPDATE t1 SET f2 = 'c' WHERE f1 > 2;
+SET GLOBAL wsrep_provider_options = 'dbug=d,recv_IST_after_apply_trx';
+SET SESSION wsrep_sync_wait = 0;
+Loading wsrep_provider ...
+SHOW STATUS LIKE 'wsrep_debug_sync_waiters';
+Variable_name Value
+wsrep_debug_sync_waiters recv_IST_after_apply_trx
+UPDATE t1 SET f2 = 'd' WHERE f1 > 3;
+CREATE TABLE t2 (f1 INTEGER);
+UPDATE t1 SET f2 = 'e' WHERE f1 > 4;
+CREATE TABLE t3 (f1 INTEGER);
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+UPDATE t1 SET f2 = 'f' WHERE f1 > 5;
+SELECT * FROM t1;
+f1 f2
+1 a
+2 b
+3 c
+4 d
+5 e
+6 f
+SELECT * FROM t1;
+f1 f2
+1 a
+2 b
+3 c
+4 d
+5 e
+6 f
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t3;
+COUNT(*) = 0
+1
+DROP TABLE t1, t2, t3;
diff --git a/mysql-test/suite/galera/r/galera_ist_rsync.result b/mysql-test/suite/galera/r/galera_ist_rsync.result
new file mode 100644
index 00000000000..0b25a299b24
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_rsync.result
@@ -0,0 +1,358 @@
+Performing State Transfer on a server that has been temporarily disconnected
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+Unloading wsrep provider ...
+SET GLOBAL wsrep_provider = 'none';
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+Loading wsrep provider ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+Shutting down server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that has been killed and restarted
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+Killing server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that has been killed and restarted
+while a DDL was in progress on it
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+SET wsrep_sync_wait = 0;
+Killing server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+SET GLOBAL debug_dbug = $debug_orig;
diff --git a/mysql-test/suite/galera/r/galera_ist_xtrabackup-v2.result b/mysql-test/suite/galera/r/galera_ist_xtrabackup-v2.result
new file mode 100644
index 00000000000..175e7443a4d
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_xtrabackup-v2.result
@@ -0,0 +1,357 @@
+Performing State Transfer on a server that has been temporarily disconnected
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+Unloading wsrep provider ...
+SET GLOBAL wsrep_provider = 'none';
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+Loading wsrep provider ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+Shutting down server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that has been killed and restarted
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+Killing server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that has been killed and restarted
+while a DDL was in progress on it
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+SET GLOBAL debug = 'd,sync.alter_opened_table';
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+SET wsrep_sync_wait = 0;
+Killing server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
diff --git a/mysql-test/suite/galera/r/galera_kill_ddl.result b/mysql-test/suite/galera/r/galera_kill_ddl.result
new file mode 100644
index 00000000000..8dd36497dfb
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_kill_ddl.result
@@ -0,0 +1,11 @@
+SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+Killing server ...
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1';
+COUNT(*) = 2
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_kill_largechanges.result b/mysql-test/suite/galera/r/galera_kill_largechanges.result
new file mode 100644
index 00000000000..a37056ad9b0
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_kill_largechanges.result
@@ -0,0 +1,14 @@
+SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+CREATE TABLE t1 (f1 VARCHAR(128)) ENGINE=InnoDB;
+Killing server ...
+INSERT INTO t1 SELECT REPEAT('a', 128) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;
+SELECT COUNT(*) = 1000000 FROM t1;
+COUNT(*) = 1000000
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_kill_nochanges.result b/mysql-test/suite/galera/r/galera_kill_nochanges.result
new file mode 100644
index 00000000000..db3c75e2886
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_kill_nochanges.result
@@ -0,0 +1,10 @@
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+Killing server ...
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_kill_smallchanges.result b/mysql-test/suite/galera/r/galera_kill_smallchanges.result
new file mode 100644
index 00000000000..8409740a035
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_kill_smallchanges.result
@@ -0,0 +1,11 @@
+SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+Killing server ...
+INSERT INTO t1 VALUES (1);
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_lock_table.result b/mysql-test/suite/galera/r/galera_lock_table.result
new file mode 100644
index 00000000000..16e9037a4de
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_lock_table.result
@@ -0,0 +1,21 @@
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB;
+LOCK TABLE t1 READ;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+SET SESSION wsrep_sync_wait=0;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+UNLOCK TABLES;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t2;
+COUNT(*) = 1
+1
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_log_bin.result b/mysql-test/suite/galera/r/galera_log_bin.result
new file mode 100644
index 00000000000..6411a1e3043
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_log_bin.result
@@ -0,0 +1,58 @@
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (id INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1);
+INSERT INTO t2 VALUES (1);
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 2 FROM t2;
+COUNT(*) = 2
+1
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+FLUSH LOGS;
+SHOW BINLOG EVENTS IN 'mysqld-bin.000002' LIMIT 4,18;
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000002 # Gtid # # GTID 0-1-1
+mysqld-bin.000002 # Query # # use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB
+mysqld-bin.000002 # Gtid # # BEGIN GTID 0-1-2
+mysqld-bin.000002 # Table_map # # table_id: 48 (test.t1)
+mysqld-bin.000002 # Write_rows_v1 # # table_id: 48 flags: STMT_END_F
+mysqld-bin.000002 # Xid # # COMMIT /* xid=2 */
+mysqld-bin.000002 # Gtid # # GTID 0-1-3
+mysqld-bin.000002 # Query # # use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB
+mysqld-bin.000002 # Gtid # # BEGIN GTID 0-1-4
+mysqld-bin.000002 # Table_map # # table_id: 49 (test.t2)
+mysqld-bin.000002 # Write_rows_v1 # # table_id: 49 flags: STMT_END_F
+mysqld-bin.000002 # Xid # # COMMIT /* xid=4 */
+mysqld-bin.000002 # Gtid # # BEGIN GTID 0-1-5
+mysqld-bin.000002 # Table_map # # table_id: 49 (test.t2)
+mysqld-bin.000002 # Write_rows_v1 # # table_id: 49 flags: STMT_END_F
+mysqld-bin.000002 # Xid # # COMMIT /* xid=5 */
+mysqld-bin.000002 # Gtid # # GTID 0-1-6
+mysqld-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SHOW BINLOG EVENTS IN 'mysqld-bin.000003' LIMIT 3,18;
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000003 # Gtid # # GTID 0-1-1
+mysqld-bin.000003 # Query # # use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB
+mysqld-bin.000003 # Gtid # # BEGIN GTID 0-1-2
+mysqld-bin.000003 # Table_map # # table_id: 30 (test.t1)
+mysqld-bin.000003 # Write_rows_v1 # # table_id: 30 flags: STMT_END_F
+mysqld-bin.000003 # Xid # # COMMIT /* xid=2 */
+mysqld-bin.000003 # Gtid # # GTID 0-1-3
+mysqld-bin.000003 # Query # # use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB
+mysqld-bin.000003 # Gtid # # BEGIN GTID 0-1-4
+mysqld-bin.000003 # Table_map # # table_id: 31 (test.t2)
+mysqld-bin.000003 # Write_rows_v1 # # table_id: 31 flags: STMT_END_F
+mysqld-bin.000003 # Xid # # COMMIT /* xid=4 */
+mysqld-bin.000003 # Gtid # # BEGIN GTID 0-1-5
+mysqld-bin.000003 # Table_map # # table_id: 31 (test.t2)
+mysqld-bin.000003 # Write_rows_v1 # # table_id: 31 flags: STMT_END_F
+mysqld-bin.000003 # Xid # # COMMIT /* xid=5 */
+mysqld-bin.000003 # Gtid # # GTID 0-1-6
+mysqld-bin.000003 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_log_output_csv.result b/mysql-test/suite/galera/r/galera_log_output_csv.result
new file mode 100644
index 00000000000..07a78469578
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_log_output_csv.result
@@ -0,0 +1,21 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SELECT COUNT(*) > 0 FROM mysql.general_log;
+COUNT(*) > 0
+1
+SELECT 1 = 1 FROM t1;
+1 = 1
+1
+SELECT COUNT(*) = 1 FROM mysql.slow_log WHERE sql_text = 'SELECT 1 = 1 FROM t1';
+COUNT(*) = 1
+1
+SELECT COUNT(*) > 0 FROM mysql.general_log WHERE argument = 'CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB';
+COUNT(*) > 0
+1
+SELECT 2 = 2 FROM t1;
+2 = 2
+1
+SELECT COUNT(*) = 1 FROM mysql.slow_log WHERE sql_text = 'SELECT 2 = 2 FROM t1';
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_many_columns.result b/mysql-test/suite/galera/r/galera_many_columns.result
index ba7b9116e7c..6fa574e47c2 100644
--- a/mysql-test/suite/galera/r/galera_many_columns.result
+++ b/mysql-test/suite/galera/r/galera_many_columns.result
@@ -1,1021 +1,3 @@
-CREATE TABLE t1 (f1017 VARCHAR(3) DEFAULT 'ABC') ENGINE=InnoDB;
-ALTER TABLE t1 ADD COLUMN f1016 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f1015 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f1014 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f1013 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f1012 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f1011 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f1010 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f1009 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f1008 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f1007 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f1006 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f1005 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f1004 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f1003 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f1002 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f1001 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f1000 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f999 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f998 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f997 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f996 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f995 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f994 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f993 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f992 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f991 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f990 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f989 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f988 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f987 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f986 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f985 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f984 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f983 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f982 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f981 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f980 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f979 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f978 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f977 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f976 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f975 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f974 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f973 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f972 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f971 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f970 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f969 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f968 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f967 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f966 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f965 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f964 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f963 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f962 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f961 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f960 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f959 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f958 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f957 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f956 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f955 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f954 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f953 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f952 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f951 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f950 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f949 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f948 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f947 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f946 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f945 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f944 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f943 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f942 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f941 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f940 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f939 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f938 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f937 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f936 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f935 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f934 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f933 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f932 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f931 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f930 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f929 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f928 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f927 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f926 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f925 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f924 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f923 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f922 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f921 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f920 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f919 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f918 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f917 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f916 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f915 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f914 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f913 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f912 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f911 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f910 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f909 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f908 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f907 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f906 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f905 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f904 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f903 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f902 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f901 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f900 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f899 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f898 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f897 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f896 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f895 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f894 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f893 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f892 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f891 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f890 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f889 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f888 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f887 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f886 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f885 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f884 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f883 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f882 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f881 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f880 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f879 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f878 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f877 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f876 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f875 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f874 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f873 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f872 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f871 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f870 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f869 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f868 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f867 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f866 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f865 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f864 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f863 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f862 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f861 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f860 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f859 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f858 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f857 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f856 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f855 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f854 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f853 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f852 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f851 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f850 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f849 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f848 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f847 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f846 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f845 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f844 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f843 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f842 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f841 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f840 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f839 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f838 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f837 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f836 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f835 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f834 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f833 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f832 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f831 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f830 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f829 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f828 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f827 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f826 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f825 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f824 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f823 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f822 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f821 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f820 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f819 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f818 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f817 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f816 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f815 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f814 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f813 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f812 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f811 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f810 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f809 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f808 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f807 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f806 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f805 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f804 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f803 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f802 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f801 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f800 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f799 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f798 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f797 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f796 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f795 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f794 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f793 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f792 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f791 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f790 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f789 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f788 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f787 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f786 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f785 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f784 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f783 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f782 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f781 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f780 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f779 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f778 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f777 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f776 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f775 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f774 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f773 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f772 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f771 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f770 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f769 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f768 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f767 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f766 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f765 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f764 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f763 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f762 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f761 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f760 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f759 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f758 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f757 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f756 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f755 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f754 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f753 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f752 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f751 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f750 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f749 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f748 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f747 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f746 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f745 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f744 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f743 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f742 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f741 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f740 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f739 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f738 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f737 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f736 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f735 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f734 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f733 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f732 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f731 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f730 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f729 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f728 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f727 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f726 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f725 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f724 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f723 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f722 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f721 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f720 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f719 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f718 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f717 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f716 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f715 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f714 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f713 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f712 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f711 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f710 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f709 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f708 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f707 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f706 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f705 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f704 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f703 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f702 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f701 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f700 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f699 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f698 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f697 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f696 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f695 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f694 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f693 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f692 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f691 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f690 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f689 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f688 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f687 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f686 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f685 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f684 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f683 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f682 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f681 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f680 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f679 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f678 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f677 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f676 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f675 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f674 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f673 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f672 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f671 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f670 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f669 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f668 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f667 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f666 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f665 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f664 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f663 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f662 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f661 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f660 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f659 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f658 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f657 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f656 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f655 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f654 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f653 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f652 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f651 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f650 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f649 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f648 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f647 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f646 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f645 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f644 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f643 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f642 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f641 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f640 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f639 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f638 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f637 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f636 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f635 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f634 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f633 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f632 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f631 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f630 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f629 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f628 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f627 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f626 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f625 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f624 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f623 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f622 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f621 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f620 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f619 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f618 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f617 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f616 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f615 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f614 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f613 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f612 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f611 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f610 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f609 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f608 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f607 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f606 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f605 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f604 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f603 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f602 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f601 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f600 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f599 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f598 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f597 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f596 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f595 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f594 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f593 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f592 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f591 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f590 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f589 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f588 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f587 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f586 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f585 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f584 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f583 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f582 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f581 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f580 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f579 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f578 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f577 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f576 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f575 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f574 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f573 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f572 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f571 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f570 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f569 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f568 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f567 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f566 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f565 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f564 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f563 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f562 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f561 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f560 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f559 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f558 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f557 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f556 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f555 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f554 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f553 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f552 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f551 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f550 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f549 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f548 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f547 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f546 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f545 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f544 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f543 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f542 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f541 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f540 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f539 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f538 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f537 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f536 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f535 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f534 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f533 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f532 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f531 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f530 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f529 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f528 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f527 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f526 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f525 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f524 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f523 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f522 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f521 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f520 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f519 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f518 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f517 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f516 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f515 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f514 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f513 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f512 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f511 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f510 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f509 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f508 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f507 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f506 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f505 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f504 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f503 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f502 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f501 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f500 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f499 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f498 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f497 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f496 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f495 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f494 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f493 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f492 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f491 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f490 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f489 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f488 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f487 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f486 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f485 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f484 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f483 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f482 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f481 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f480 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f479 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f478 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f477 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f476 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f475 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f474 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f473 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f472 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f471 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f470 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f469 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f468 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f467 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f466 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f465 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f464 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f463 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f462 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f461 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f460 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f459 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f458 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f457 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f456 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f455 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f454 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f453 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f452 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f451 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f450 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f449 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f448 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f447 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f446 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f445 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f444 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f443 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f442 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f441 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f440 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f439 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f438 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f437 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f436 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f435 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f434 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f433 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f432 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f431 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f430 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f429 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f428 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f427 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f426 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f425 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f424 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f423 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f422 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f421 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f420 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f419 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f418 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f417 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f416 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f415 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f414 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f413 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f412 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f411 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f410 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f409 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f408 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f407 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f406 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f405 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f404 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f403 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f402 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f401 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f400 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f399 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f398 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f397 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f396 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f395 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f394 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f393 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f392 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f391 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f390 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f389 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f388 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f387 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f386 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f385 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f384 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f383 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f382 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f381 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f380 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f379 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f378 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f377 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f376 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f375 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f374 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f373 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f372 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f371 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f370 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f369 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f368 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f367 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f366 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f365 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f364 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f363 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f362 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f361 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f360 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f359 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f358 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f357 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f356 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f355 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f354 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f353 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f352 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f351 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f350 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f349 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f348 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f347 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f346 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f345 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f344 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f343 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f342 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f341 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f340 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f339 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f338 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f337 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f336 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f335 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f334 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f333 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f332 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f331 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f330 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f329 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f328 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f327 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f326 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f325 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f324 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f323 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f322 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f321 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f320 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f319 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f318 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f317 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f316 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f315 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f314 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f313 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f312 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f311 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f310 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f309 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f308 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f307 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f306 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f305 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f304 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f303 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f302 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f301 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f300 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f299 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f298 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f297 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f296 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f295 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f294 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f293 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f292 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f291 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f290 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f289 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f288 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f287 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f286 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f285 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f284 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f283 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f282 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f281 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f280 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f279 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f278 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f277 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f276 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f275 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f274 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f273 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f272 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f271 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f270 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f269 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f268 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f267 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f266 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f265 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f264 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f263 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f262 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f261 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f260 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f259 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f258 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f257 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f256 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f255 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f254 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f253 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f252 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f251 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f250 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f249 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f248 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f247 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f246 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f245 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f244 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f243 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f242 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f241 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f240 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f239 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f238 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f237 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f236 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f235 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f234 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f233 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f232 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f231 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f230 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f229 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f228 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f227 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f226 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f225 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f224 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f223 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f222 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f221 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f220 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f219 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f218 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f217 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f216 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f215 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f214 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f213 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f212 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f211 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f210 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f209 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f208 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f207 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f206 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f205 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f204 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f203 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f202 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f201 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f200 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f199 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f198 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f197 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f196 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f195 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f194 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f193 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f192 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f191 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f190 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f189 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f188 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f187 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f186 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f185 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f184 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f183 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f182 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f181 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f180 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f179 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f178 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f177 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f176 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f175 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f174 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f173 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f172 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f171 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f170 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f169 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f168 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f167 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f166 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f165 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f164 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f163 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f162 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f161 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f160 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f159 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f158 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f157 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f156 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f155 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f154 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f153 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f152 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f151 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f150 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f149 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f148 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f147 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f146 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f145 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f144 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f143 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f142 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f141 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f140 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f139 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f138 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f137 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f136 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f135 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f134 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f133 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f132 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f131 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f130 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f129 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f128 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f127 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f126 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f125 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f124 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f123 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f122 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f121 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f120 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f119 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f118 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f117 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f116 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f115 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f114 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f113 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f112 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f111 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f110 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f109 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f108 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f107 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f106 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f105 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f104 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f103 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f102 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f101 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f100 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f99 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f98 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f97 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f96 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f95 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f94 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f93 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f92 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f91 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f90 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f89 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f88 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f87 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f86 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f85 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f84 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f83 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f82 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f81 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f80 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f79 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f78 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f77 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f76 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f75 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f74 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f73 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f72 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f71 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f70 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f69 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f68 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f67 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f66 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f65 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f64 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f63 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f62 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f61 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f60 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f59 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f58 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f57 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f56 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f55 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f54 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f53 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f52 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f51 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f50 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f49 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f48 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f47 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f46 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f45 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f44 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f43 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f42 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f41 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f40 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f39 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f38 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f37 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f36 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f35 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f34 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f33 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f32 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f31 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f30 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f29 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f28 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f27 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f26 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f25 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f24 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f23 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f22 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f21 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f20 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f19 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f18 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f17 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f16 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f15 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f14 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f13 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f12 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f11 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f10 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f9 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f8 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f7 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f6 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f5 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f4 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f3 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f2 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD COLUMN f1 VARCHAR(3) DEFAULT 'ABC';
-ALTER TABLE t1 ADD PRIMARY KEY (f1, f1017);
INSERT INTO t1 (f1) VALUES (DEFAULT);
SELECT f1 = 'ABC', f1017 = 'ABC' FROM t1;
f1 = 'ABC' f1017 = 'ABC'
diff --git a/mysql-test/suite/galera/r/galera_many_rows.result b/mysql-test/suite/galera/r/galera_many_rows.result
index fdcec573030..6ec0add8ba8 100644
--- a/mysql-test/suite/galera/r/galera_many_rows.result
+++ b/mysql-test/suite/galera/r/galera_many_rows.result
@@ -1,4 +1,4 @@
-CREATE TABLE ten (f1 INTEGER) ENGINE=INNODB;
+CREATE TABLE ten (f1 INTEGER);
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB;
INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
diff --git a/mysql-test/suite/galera/r/galera_many_tables_nopk.result b/mysql-test/suite/galera/r/galera_many_tables_nopk.result
new file mode 100644
index 00000000000..7a4f364730c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_many_tables_nopk.result
@@ -0,0 +1,17 @@
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+COMMIT;
+CREATE TABLE sum_table (f1 INTEGER);
+SELECT SUM(f1) = 1000 FROM sum_table;
+SUM(f1) = 1000
+1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1000 SET f1 = 3;
+COMMIT;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+DROP SCHEMA test;
+CREATE SCHEMA test;
diff --git a/mysql-test/suite/galera/r/galera_many_tables_pk.result b/mysql-test/suite/galera/r/galera_many_tables_pk.result
new file mode 100644
index 00000000000..6b6899d979d
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_many_tables_pk.result
@@ -0,0 +1,20 @@
+SELECT COUNT(*) = 1000 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME LIKE 't%';
+COUNT(*) = 1000
+1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+COMMIT;
+CREATE TABLE sum_table (f1 INTEGER);
+SELECT SUM(f1) = 1000 FROM sum_table;
+SUM(f1) = 1000
+1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1000 SET f1 = 3;
+COMMIT;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+DROP SCHEMA test;
+CREATE SCHEMA test;
diff --git a/mysql-test/suite/galera/r/galera_migrate.result b/mysql-test/suite/galera/r/galera_migrate.result
new file mode 100644
index 00000000000..7c92d66ff97
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_migrate.result
@@ -0,0 +1,79 @@
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+START SLAVE USER='root';
+Warnings:
+Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
+INSERT INTO t1 VALUES (2);
+START SLAVE USER='root';
+Warnings:
+Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+SET GLOBAL wsrep_cluster_address='gcomm://';
+INSERT INTO t1 VALUES (5);
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Synced'
+1
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 1
+1
+INSERT INTO t1 VALUES (6);
+GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst';
+SET GLOBAL wsrep_sst_auth = 'sst:sst';
+GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst';
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Synced'
+1
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+STOP SLAVE;
+RESET SLAVE ALL;
+STOP SLAVE;
+RESET SLAVE ALL;
+INSERT INTO t1 VALUES (7);
+INSERT INTO t1 VALUES (8);
+SELECT COUNT(*) = 8 FROM t1;
+COUNT(*) = 8
+1
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Synced'
+1
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+SELECT COUNT(*) = 8 FROM t1;
+COUNT(*) = 8
+1
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Synced'
+1
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+DROP TABLE t1;
+DROP TABLE t1;
+SET GLOBAL wsrep_provider = 'none';
+SET GLOBAL wsrep_sst_auth = '';
+SET GLOBAL wsrep_provider_options = '';
+DROP TABLE t1;
+DROP USER sst;
+SET GLOBAL wsrep_provider = 'none';
+SET GLOBAL wsrep_sst_method = 'rsync';
+SET GLOBAL wsrep_provider_options = '';
+SET GLOBAL wsrep_sst_receive_address = 'AUTO';
+DROP TABLE t1;
+DROP USER sst;
+CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
diff --git a/mysql-test/suite/galera/r/galera_multi_database.result b/mysql-test/suite/galera/r/galera_multi_database.result
new file mode 100644
index 00000000000..a04eb484caf
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_multi_database.result
@@ -0,0 +1,28 @@
+CREATE DATABASE d1;
+CREATE TABLE d1.t1(f1 INTEGER) ENGINE=InnoDB;
+CREATE DATABASE d2;
+CREATE TABLE d2.t1(f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO d1.t1 VALUES (1);
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO d2.t1 VALUES (1);
+COMMIT;
+COMMIT;
+SELECT COUNT(*) = 1 FROM d1.t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM d2.t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM d1.t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM d2.t1;
+COUNT(*) = 1
+1
+DROP TABLE d1.t1;
+DROP TABLE d2.t1;
+DROP DATABASE d1;
+DROP DATABASE d2;
diff --git a/mysql-test/suite/galera/r/galera_myisam_autocommit.result b/mysql-test/suite/galera/r/galera_myisam_autocommit.result
new file mode 100644
index 00000000000..3f8d93bae76
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_myisam_autocommit.result
@@ -0,0 +1,24 @@
+CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2), (3);
+INSERT INTO t1 SELECT 4 FROM DUAL UNION ALL SELECT 5 FROM DUAL;
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1);
+INSERT INTO t2 VALUES (2), (3);
+INSERT INTO t2 SELECT 4 FROM DUAL UNION ALL SELECT 5 FROM DUAL;
+INSERT INTO t2 VALUES (6), (1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+UPDATE t1 SET f1 = 9;
+UPDATE t2 SET f1 = 9 WHERE f1 = 1;
+DELETE FROM t1 WHERE f1 = 9;
+DELETE FROM t2 WHERE f1 = 9;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_myisam_transactions.result b/mysql-test/suite/galera/r/galera_myisam_transactions.result
new file mode 100644
index 00000000000..284f92b414c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_myisam_transactions.result
@@ -0,0 +1,34 @@
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=MyISAM;
+CREATE TABLE t3 (f1 INTEGER) ENGINE=MyISAM;
+CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t3 VALUES (NEW.f1);
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+COMMIT;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+DROP TABLE t1, t2, t3;
diff --git a/mysql-test/suite/galera/r/galera_nopk_unicode.result b/mysql-test/suite/galera/r/galera_nopk_unicode.result
new file mode 100644
index 00000000000..68d049a2146
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_nopk_unicode.result
@@ -0,0 +1,24 @@
+CREATE TABLE t1 (
+f1 VARCHAR(255),
+KEY (f1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES ('текÑÑ‚');
+SELECT f1 = 'текÑÑ‚' FROM t1;
+f1 = 'текÑÑ‚'
+1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'текÑÑ‚2';
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'текÑÑ‚3';
+COMMIT;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT f1 = 'текÑÑ‚2' FROM t1;
+f1 = 'текÑÑ‚2'
+1
+SELECT f1 = 'текÑÑ‚2' FROM t1 WHERE f1 = 'текÑÑ‚2';
+f1 = 'текÑÑ‚2'
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result b/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result
new file mode 100644
index 00000000000..db4528ac22d
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result
@@ -0,0 +1,33 @@
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB;
+SET GLOBAL wsrep_slave_threads = 2;
+LOCK TABLE t1 READ;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+SET SESSION wsrep_sync_wait=0;
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%applied write set%';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Waiting for table level lock%';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+UNLOCK TABLES;
+SET SESSION wsrep_sync_wait = 7;;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'committed%';
+COUNT(*) = 2
+1
+SET GLOBAL wsrep_slave_threads = 1;;
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result b/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result
new file mode 100644
index 00000000000..1f163f4366c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result
@@ -0,0 +1,18 @@
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB;
+SET GLOBAL wsrep_slave_threads = 4;
+INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;;
+INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;;
+INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;;
+SELECT COUNT(*) = 30000 FROM t1;
+COUNT(*) = 30000
+1
+SELECT COUNT(DISTINCT f1) = 30000 FROM t1;
+COUNT(DISTINCT f1) = 30000
+1
+SELECT COUNT(*) = 5 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+COUNT(*) = 5
+1
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result b/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result
new file mode 100644
index 00000000000..05ce328228a
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result
@@ -0,0 +1,15 @@
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB;
+SET GLOBAL wsrep_slave_threads = 4;
+SELECT COUNT(*) = 20000 FROM t1;
+COUNT(*) = 20000
+1
+SELECT COUNT(DISTINCT f1) = 20000 FROM t1;
+COUNT(DISTINCT f1) = 20000
+1
+SELECT COUNT(*) = 4 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'committed%';
+COUNT(*) = 4
+1
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_parallel_simple.result b/mysql-test/suite/galera/r/galera_parallel_simple.result
new file mode 100644
index 00000000000..880d4e8ae3d
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_parallel_simple.result
@@ -0,0 +1,27 @@
+CREATE TABLE t1 (id INT) ENGINE=InnoDB;
+CREATE TABLE t2 (id INT) ENGINE=InnoDB;
+SET GLOBAL wsrep_slave_threads = 2;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+SELECT COUNT(*) = 6 FROM t1;
+COUNT(*) = 6
+1
+SELECT COUNT(*) = 6 FROM t2;
+COUNT(*) = 6
+1
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'closing tables';
+COUNT(*) = 2
+1
+SET GLOBAL wsrep_slave_threads = 1;;
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_pc_ignore_sb.result b/mysql-test/suite/galera/r/galera_pc_ignore_sb.result
new file mode 100644
index 00000000000..5fcccfe2d59
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_pc_ignore_sb.result
@@ -0,0 +1,12 @@
+SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
+Killing server ...
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+DROP TABLE t1;
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 1
+1
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+VARIABLE_VALUE = 'ON'
+1
+SET GLOBAL wsrep_cluster_address = '';
diff --git a/mysql-test/suite/galera/r/galera_pk_bigint_signed.result b/mysql-test/suite/galera/r/galera_pk_bigint_signed.result
new file mode 100644
index 00000000000..a3075994657
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_pk_bigint_signed.result
@@ -0,0 +1,26 @@
+CREATE TABLE t1 (f1 BIGINT SIGNED PRIMARY KEY, f2 VARCHAR(5)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(-9223372036854775808, 'min'),
+(9223372036854775807, 'max')
+;
+SELECT * FROM t1;
+f1 f2
+-9223372036854775808 min
+9223372036854775807 max
+UPDATE t1 SET f2 = CONCAT(f2, '_');
+SELECT * FROM t1;
+f1 f2
+-9223372036854775808 min_
+9223372036854775807 max_
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'foo' WHERE f1 = -9223372036854775808;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'bar' WHERE f1 = -9223372036854775808;
+COMMIT;
+SET AUTOCOMMIT=ON;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SET AUTOCOMMIT=ON;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_pk_bigint_unsigned.result b/mysql-test/suite/galera/r/galera_pk_bigint_unsigned.result
new file mode 100644
index 00000000000..441926e949c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_pk_bigint_unsigned.result
@@ -0,0 +1,23 @@
+CREATE TABLE t1 (f1 BIGINT UNSIGNED PRIMARY KEY, f2 VARCHAR(5)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(18446744073709551615, 'max')
+;
+SELECT f1 = 18446744073709551615 FROM t1;
+f1 = 18446744073709551615
+1
+UPDATE t1 SET f2 = CONCAT(f2, '_');
+SELECT f1 = 18446744073709551615 FROM t1;
+f1 = 18446744073709551615
+1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'foo' WHERE f1 = 18446744073709551615;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'bar' WHERE f1 = 18446744073709551615;
+COMMIT;
+SET AUTOCOMMIT=ON;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SET AUTOCOMMIT=ON;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_query_cache.result b/mysql-test/suite/galera/r/galera_query_cache.result
new file mode 100644
index 00000000000..502d8a58e9c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_query_cache.result
@@ -0,0 +1,57 @@
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+RESET QUERY CACHE;
+FLUSH STATUS;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache';
+VARIABLE_VALUE = 1
+1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits';
+VARIABLE_VALUE = 1
+1
+INSERT INTO t1 VALUES (2);
+FLUSH STATUS;
+SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache';
+VARIABLE_VALUE = 0
+1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache';
+VARIABLE_VALUE = 1
+1
+SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits';
+VARIABLE_VALUE = 0
+1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits';
+VARIABLE_VALUE = 1
+1
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+FLUSH STATUS;
+SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache';
+VARIABLE_VALUE = 0
+1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache';
+VARIABLE_VALUE = 1
+1
+SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits';
+VARIABLE_VALUE = 0
+1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits';
+VARIABLE_VALUE = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_read_only.result b/mysql-test/suite/galera/r/galera_read_only.result
new file mode 100644
index 00000000000..d2af3867fe7
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_read_only.result
@@ -0,0 +1,8 @@
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+SET GLOBAL read_only=TRUE;
+INSERT INTO t1 VALUES (1);
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SET GLOBAL read_only=FALSE;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_repl_key_format_flat16.result b/mysql-test/suite/galera/r/galera_repl_key_format_flat16.result
new file mode 100644
index 00000000000..4acf0143f8b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_repl_key_format_flat16.result
@@ -0,0 +1,18 @@
+SET GLOBAL wsrep_provider_options = 'repl.key_format=FLAT16';
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (123);
+CREATE TABLE t2 (f1 VARCHAR(256)) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (REPEAT('a', 256));
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+UPDATE t1 SET f1 = 234;
+UPDATE t2 SET f1 = REPEAT('b', 256);
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 234;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t2 WHERE f1 = REPEAT('b', 256);
+COUNT(*) = 1
+1
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_repl_max_ws_size.result b/mysql-test/suite/galera/r/galera_repl_max_ws_size.result
new file mode 100644
index 00000000000..6e245b44462
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_repl_max_ws_size.result
@@ -0,0 +1,8 @@
+CREATE TABLE t1 (f1 VARCHAR(512)) ENGINE=InnoDB;
+SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=512';
+INSERT INTO t1 VALUES (REPEAT('a', 512));
+ERROR HY000: Got error 90 "Message too long" during COMMIT
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_restart_nochanges.result b/mysql-test/suite/galera/r/galera_restart_nochanges.result
new file mode 100644
index 00000000000..accace97826
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_restart_nochanges.result
@@ -0,0 +1,9 @@
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_roles.result b/mysql-test/suite/galera/r/galera_roles.result
new file mode 100644
index 00000000000..c0cdbc0e338
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_roles.result
@@ -0,0 +1,156 @@
+#
+# Testing CREATE/GRANT role
+#
+
+# On node_1
+CREATE DATABASE test1;
+CREATE TABLE test1.t1 (a int, b int);
+CREATE TABLE test1.t2 (a int, b int);
+INSERT INTO test1.t1 values (1,2),(3,4);
+INSERT INTO test1.t2 values (5,6),(7,8);
+CREATE PROCEDURE test1.pr1() SELECT "pr1";
+CREATE USER foo@localhost;
+CREATE ROLE role1;
+GRANT role1 TO foo@localhost;
+GRANT RELOAD ON *.* TO role1;
+GRANT SELECT ON mysql.* TO role1;
+GRANT EXECUTE ON PROCEDURE test1.pr1 TO role1;
+GRANT SELECT ON test1.t1 TO role1;
+GRANT SELECT (a) ON test1.t2 TO role1;
+# Open connections to the 2 nodes using 'foo' user.
+
+# Connect with foo_node_1
+SHOW GRANTS;
+Grants for foo@localhost
+GRANT role1 TO 'foo'@'localhost'
+GRANT USAGE ON *.* TO 'foo'@'localhost'
+FLUSH TABLES;
+ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
+SELECT * FROM mysql.roles_mapping;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping'
+SHOW TABLES FROM test1;
+ERROR 42000: Access denied for user 'foo'@'localhost' to database 'test1'
+SET ROLE role1;
+FLUSH TABLES;
+SELECT * FROM mysql.roles_mapping;
+Host User Role Admin_option
+localhost foo role1 N
+localhost root role1 Y
+SHOW TABLES FROM test1;
+Tables_in_test1
+t1
+t2
+SELECT * FROM test1.t1;
+a b
+1 2
+3 4
+SELECT * FROM test1.t2;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't2'
+SELECT a FROM test1.t2;
+a
+5
+7
+CALL test1.pr1();
+pr1
+pr1
+
+# Connect with foo_node_2
+SHOW GRANTS;
+Grants for foo@localhost
+GRANT role1 TO 'foo'@'localhost'
+GRANT USAGE ON *.* TO 'foo'@'localhost'
+FLUSH TABLES;
+ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
+SELECT * FROM mysql.roles_mapping;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping'
+SHOW TABLES FROM test1;
+ERROR 42000: Access denied for user 'foo'@'localhost' to database 'test1'
+SET ROLE role1;
+FLUSH TABLES;
+SELECT * FROM mysql.roles_mapping;
+Host User Role Admin_option
+ role1 Y
+localhost foo role1 N
+SHOW TABLES FROM test1;
+Tables_in_test1
+t1
+t2
+SELECT * FROM test1.t1;
+a b
+1 2
+3 4
+SELECT * FROM test1.t2;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't2'
+SELECT a FROM test1.t2;
+a
+5
+7
+CALL test1.pr1();
+pr1
+pr1
+#
+# Testing REVOKE role
+#
+#
+# Connect with node_1
+REVOKE EXECUTE ON PROCEDURE test1.pr1 FROM role1;
+
+# Connect with foo_node_1
+CALL test1.pr1();
+ERROR 42000: execute command denied to user 'foo'@'localhost' for routine 'test1.pr1'
+
+# Connect with foo_node_2
+CALL test1.pr1();
+ERROR 42000: execute command denied to user 'foo'@'localhost' for routine 'test1.pr1'
+#
+# Testing DROP role
+#
+
+# Connect with node_1
+DROP ROLE role1;
+
+# Connect with foo_node_1
+FLUSH TABLES;
+SELECT * FROM mysql.roles_mapping;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping'
+SELECT * FROM test1.t1;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1'
+SELECT a FROM test1.t2;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't2'
+SHOW GRANTS;
+Grants for foo@localhost
+GRANT USAGE ON *.* TO 'foo'@'localhost'
+SELECT * FROM INFORMATION_SCHEMA.ENABLED_ROLES;
+ROLE_NAME
+NULL
+SELECT * FROM INFORMATION_SCHEMA.ENABLED_ROLES;
+ROLE_NAME
+NULL
+SELECT CURRENT_ROLE();
+CURRENT_ROLE()
+role1
+
+# Connect with foo_node_2
+FLUSH TABLES;
+SELECT * FROM mysql.roles_mapping;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping'
+SELECT * FROM test1.t1;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1'
+SELECT a FROM test1.t2;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't2'
+SHOW GRANTS;
+Grants for foo@localhost
+GRANT USAGE ON *.* TO 'foo'@'localhost'
+SELECT * FROM INFORMATION_SCHEMA.ENABLED_ROLES;
+ROLE_NAME
+NULL
+SELECT * FROM INFORMATION_SCHEMA.ENABLED_ROLES;
+ROLE_NAME
+NULL
+SELECT CURRENT_ROLE();
+CURRENT_ROLE()
+role1
+# Connect with node_1
+DROP USER foo@localhost;
+DROP DATABASE test1;
+# End of test
diff --git a/mysql-test/suite/galera/r/galera_rsu_add_pk.result b/mysql-test/suite/galera/r/galera_rsu_add_pk.result
new file mode 100644
index 00000000000..3fd24af9ad7
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_rsu_add_pk.result
@@ -0,0 +1,26 @@
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
+INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+INSERT INTO t1 (f1) SELECT 100000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;;
+SET SESSION wsrep_OSU_method = "RSU";
+ALTER TABLE t1 ADD PRIMARY KEY (f1);
+SET SESSION wsrep_OSU_method = "TOI";
+INSERT INTO t1 (f1) SELECT 200000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+SELECT COUNT(*) = 300000 FROM t1;
+COUNT(*) = 300000
+1
+SELECT MAX(f1) = 299999 FROM t1;
+MAX(f1) = 299999
+1
+SELECT COUNT(*) = 300000 FROM t1;
+COUNT(*) = 300000
+1
+SELECT MAX(f1) = 299999 FROM t1;
+MAX(f1) = 299999
+1
+SET SESSION wsrep_OSU_method = "RSU";
+ALTER TABLE t1 ADD PRIMARY KEY (f1);
+SET SESSION wsrep_OSU_method = "TOI";
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_rsu_drop_pk.result b/mysql-test/suite/galera/r/galera_rsu_drop_pk.result
new file mode 100644
index 00000000000..039fb68d244
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_rsu_drop_pk.result
@@ -0,0 +1,42 @@
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+INSERT INTO t1 (f1) SELECT 100000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;;
+SET SESSION wsrep_OSU_method = "RSU";
+ALTER TABLE t1 DROP PRIMARY KEY;
+SET SESSION wsrep_OSU_method = "TOI";
+INSERT INTO t1 (f1) SELECT 200000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+SELECT COUNT(*) = 300000 FROM t1;
+COUNT(*) = 300000
+1
+SELECT MAX(f1) = 299999 FROM t1;
+MAX(f1) = 299999
+1
+SELECT COUNT(*) = 300000 FROM t1;
+COUNT(*) = 300000
+1
+SELECT MAX(f1) = 299999 FROM t1;
+MAX(f1) = 299999
+1
+SET SESSION wsrep_OSU_method = "RSU";
+ALTER TABLE t1 DROP PRIMARY KEY;
+SET SESSION wsrep_OSU_method = "TOI";
+INSERT INTO t1 (f1) VALUES (1);
+INSERT INTO t1 (f1) VALUES (10);
+SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 1;
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 10;
+COUNT(*) = 2
+1
+INSERT INTO t1 (f1) VALUES (100);
+INSERT INTO t1 (f1) VALUES (1000);
+SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 100;
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 1000;
+COUNT(*) = 2
+1
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_rsu_error.result b/mysql-test/suite/galera/r/galera_rsu_error.result
new file mode 100644
index 00000000000..bfe41390d1d
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_rsu_error.result
@@ -0,0 +1,21 @@
+CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
+INSERT INTO t1 VALUES (1), (1);
+SET SESSION wsrep_OSU_method = "RSU";
+ALTER TABLE t1 ADD PRIMARY KEY (f1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SET SESSION wsrep_OSU_method = "TOI";
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME = 't1';
+COUNT(*) = 0
+1
+INSERT INTO t1 VALUES (1);
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME = 't1';
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 3 FROM t1;
+COUNT(*) = 3
+1
+INSERT INTO t1 VALUES (1);
+SELECT COUNT(3) = 4 FROM t1;
+COUNT(3) = 4
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_rsu_simple.result b/mysql-test/suite/galera/r/galera_rsu_simple.result
new file mode 100644
index 00000000000..4c2780a2933
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_rsu_simple.result
@@ -0,0 +1,21 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+SET SESSION wsrep_OSU_method = "RSU";
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 1
+1
+INSERT INTO t1 VALUES (1);
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+INSERT INTO t1 (f1) VALUES (2);
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_sbr.result b/mysql-test/suite/galera/r/galera_sbr.result
new file mode 100644
index 00000000000..0bf6cc7c9d3
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sbr.result
@@ -0,0 +1,14 @@
+SET SESSION binlog_format = 'STATEMENT';
+Warnings:
+Warning 1105 MariaDB Galera does not support binlog format: STATEMENT
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SET SESSION binlog_format = 'MIXED';
+Warnings:
+Warning 1105 MariaDB Galera does not support binlog format: MIXED
+INSERT INTO t1 VALUES (2);
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+DROP TABLE t1;
+SET GLOBAL binlog_format = 'ROW';
diff --git a/mysql-test/suite/galera/r/galera_sbr_binlog.result b/mysql-test/suite/galera/r/galera_sbr_binlog.result
new file mode 100644
index 00000000000..0bf6cc7c9d3
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sbr_binlog.result
@@ -0,0 +1,14 @@
+SET SESSION binlog_format = 'STATEMENT';
+Warnings:
+Warning 1105 MariaDB Galera does not support binlog format: STATEMENT
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SET SESSION binlog_format = 'MIXED';
+Warnings:
+Warning 1105 MariaDB Galera does not support binlog format: MIXED
+INSERT INTO t1 VALUES (2);
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+DROP TABLE t1;
+SET GLOBAL binlog_format = 'ROW';
diff --git a/mysql-test/suite/galera/r/galera_split_brain.result b/mysql-test/suite/galera/r/galera_split_brain.result
new file mode 100644
index 00000000000..615615040fe
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_split_brain.result
@@ -0,0 +1,5 @@
+call mtr.add_suppression("WSREP: TO isolation failed for: ");
+Killing server ...
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SET GLOBAL wsrep_cluster_address = '';
diff --git a/mysql-test/suite/galera/r/galera_sql_log_bin_zero.result b/mysql-test/suite/galera/r/galera_sql_log_bin_zero.result
new file mode 100644
index 00000000000..c15a24e481f
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sql_log_bin_zero.result
@@ -0,0 +1,12 @@
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+SET SESSION sql_log_bin = 0;
+INSERT INTO t1 VALUES (1);
+SET SESSION sql_log_bin = 1;
+INSERT INTO t1 VALUES (2);
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_ssl.result b/mysql-test/suite/galera/r/galera_ssl.result
new file mode 100644
index 00000000000..569c3c607d5
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ssl.result
@@ -0,0 +1,18 @@
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Synced'
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+INSERT INTO t1 VALUES (1);
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Synced'
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump.result b/mysql-test/suite/galera/r/galera_sst_mysqldump.result
new file mode 100644
index 00000000000..1be2002001b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mysqldump.result
@@ -0,0 +1,459 @@
+Setting SST method to mysqldump ...
+GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst';
+SET GLOBAL wsrep_sst_auth = 'sst:sst';
+SET GLOBAL wsrep_sst_method = 'mysqldump';
+Performing State Transfer on a server that has been temporarily disconnected
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+Unloading wsrep provider ...
+SET GLOBAL wsrep_provider = 'none';
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+Loading wsrep provider ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+Shutting down server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that starts from a clean var directory
+This is accomplished by shutting down node #2 and removing its var directory before restarting it
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+Shutting down server ...
+Cleaning var directory ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that has been killed and restarted
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+Killing server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that has been killed and restarted
+while a DDL was in progress on it
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+SET GLOBAL debug = 'd,sync.alter_opened_table';
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+SET wsrep_sync_wait = 0;
+Killing server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+DROP USER sst;
+CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
+CALL mtr.add_suppression("InnoDB: New log files created");
+CALL mtr.add_suppression("InnoDB: Creating foreign key constraint system tables");
+CALL mtr.add_suppression("Can't open and lock time zone table");
+CALL mtr.add_suppression("Can't open and lock privilege tables");
+CALL mtr.add_suppression("Info table is not ready to be used");
+CALL mtr.add_suppression("Native table .* has the wrong structure");
diff --git a/mysql-test/suite/galera/r/galera_sst_rsync.result b/mysql-test/suite/galera/r/galera_sst_rsync.result
new file mode 100644
index 00000000000..df2d9190a4b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_rsync.result
@@ -0,0 +1,359 @@
+Performing State Transfer on a server that has been shut down cleanly and restarted
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+Shutting down server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that starts from a clean var directory
+This is accomplished by shutting down node #2 and removing its var directory before restarting it
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+Shutting down server ...
+Cleaning var directory ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that has been killed and restarted
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+Killing server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that has been killed and restarted
+while a DDL was in progress on it
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+SET wsrep_sync_wait = 0;
+Killing server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+SET GLOBAL debug_dbug = $debug_orig;
diff --git a/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2.result b/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2.result
new file mode 100644
index 00000000000..750d73b615f
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2.result
@@ -0,0 +1,358 @@
+Performing State Transfer on a server that has been shut down cleanly and restarted
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+Shutting down server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that starts from a clean var directory
+This is accomplished by shutting down node #2 and removing its var directory before restarting it
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+Shutting down server ...
+Cleaning var directory ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that has been killed and restarted
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+Killing server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that has been killed and restarted
+while a DDL was in progress on it
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+SET GLOBAL debug = 'd,sync.alter_opened_table';
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+SET wsrep_sync_wait = 0;
+Killing server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
diff --git a/mysql-test/suite/galera/r/galera_status_cluster.result b/mysql-test/suite/galera/r/galera_status_cluster.result
new file mode 100644
index 00000000000..d7cf671cb10
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_status_cluster.result
@@ -0,0 +1,12 @@
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
diff --git a/mysql-test/suite/galera/r/galera_status_local_state.result b/mysql-test/suite/galera/r/galera_status_local_state.result
new file mode 100644
index 00000000000..65713f1975c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_status_local_state.result
@@ -0,0 +1,14 @@
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+VARIABLE_VALUE = 4
+1
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Synced'
+1
+SET GLOBAL wsrep_desync = 1;
+SELECT VARIABLE_VALUE = 'Donor/Desynced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Donor/Desynced'
+1
+SET GLOBAL wsrep_desync = 0;
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Synced'
+1
diff --git a/mysql-test/suite/galera/r/galera_suspend_slave.result b/mysql-test/suite/galera/r/galera_suspend_slave.result
new file mode 100644
index 00000000000..02904812dd5
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_suspend_slave.result
@@ -0,0 +1,10 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+Suspending node_2 ...
+INSERT INTO t1 VALUES (1);
+Got one of the listed errors
+Resuming node_2 ...
+INSERT INTO t1 VALUES (1);
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result b/mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result
new file mode 100644
index 00000000000..f91415323ec
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result
@@ -0,0 +1,42 @@
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+ALTER TABLE t1 AUTO_INCREMENT = 1000;
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+SELECT MIN(f1) >= 1000, COUNT(*) = 20, COUNT(DISTINCT f1) = 20 FROM t1 WHERE f1 >= 1000;
+MIN(f1) >= 1000 COUNT(*) = 20 COUNT(DISTINCT f1) = 20
+1 1 1
+SELECT MIN(f1) >= 1000, COUNT(*) = 20, COUNT(DISTINCT f1) = 20 FROM t1 WHERE f1 >= 1000;
+MIN(f1) >= 1000 COUNT(*) = 20 COUNT(DISTINCT f1) = 20
+1 1 1
+ALTER TABLE t1 AUTO_INCREMENT = 5;
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+SELECT MIN(f1) >= 1000, COUNT(*) = 40, COUNT(DISTINCT f1) = 40 FROM t1 WHERE f1 >= 1000;
+MIN(f1) >= 1000 COUNT(*) = 40 COUNT(DISTINCT f1) = 40
+1 1 1
+SELECT MIN(f1) >= 1000, COUNT(*) = 40, COUNT(DISTINCT f1) = 40 FROM t1 WHERE f1 >= 1000;
+MIN(f1) >= 1000 COUNT(*) = 40 COUNT(DISTINCT f1) = 40
+1 1 1
+DROP TABLE t1;
+SET GLOBAL wsrep_auto_increment_control = OFF;
+SET GLOBAL auto_increment_increment = 1;
+SET GLOBAL auto_increment_offset = 1;
+SET GLOBAL wsrep_auto_increment_control = OFF;
+SET GLOBAL auto_increment_increment = 1;
+SET GLOBAL auto_increment_offset = 1;
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
+ALTER TABLE t1 AUTO_INCREMENT=100;
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+SELECT MIN(f1) = 100, MAX(f1) = 119, COUNT(f1) = 20, COUNT(DISTINCT f1) = 20 FROM t1;
+MIN(f1) = 100 MAX(f1) = 119 COUNT(f1) = 20 COUNT(DISTINCT f1) = 20
+1 1 1 1
+SELECT MIN(f1) = 100, MAX(f1) = 119, COUNT(f1) = 20, COUNT(DISTINCT f1) = 20 FROM t1;
+MIN(f1) = 100 MAX(f1) = 119 COUNT(f1) = 20 COUNT(DISTINCT f1) = 20
+1 1 1 1
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_error.result b/mysql-test/suite/galera/r/galera_toi_ddl_error.result
new file mode 100644
index 00000000000..656e20bcc46
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_ddl_error.result
@@ -0,0 +1,19 @@
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 (f1) SELECT (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+INSERT INTO t1 (f1) SELECT MAX(f1) FROM t1;
+ALTER TABLE t1 ADD PRIMARY KEY (f1);
+ERROR 23000: Duplicate entry '111110' for key 'PRIMARY'
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result b/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result
new file mode 100644
index 00000000000..81781fbeae7
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result
@@ -0,0 +1,31 @@
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE parent (
+id INT PRIMARY KEY AUTO_INCREMENT,
+f2 INTEGER,
+KEY (id)
+) ENGINE=InnoDB;
+CREATE TABLE child (
+id INT PRIMARY KEY AUTO_INCREMENT,
+parent_id INT
+) ENGINE=InnoDB;
+INSERT INTO parent VALUES (DEFAULT, 0);
+INSERT INTO child (parent_id) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;;
+INSERT INTO parent (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;;
+INSERT INTO parent (f2) SELECT 2 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;;
+ALTER TABLE child ADD FOREIGN KEY (parent_id) REFERENCES parent(id);;
+SELECT COUNT(*) = 20001 FROM parent;
+COUNT(*) = 20001
+1
+SELECT COUNT(*) = 10000 FROM child;
+COUNT(*) = 10000
+1
+SELECT COUNT(*) = 20001 FROM parent;
+COUNT(*) = 20001
+1
+SELECT COUNT(*) = 10000 FROM child;
+COUNT(*) = 10000
+1
+DROP TABLE child;
+DROP TABLE parent;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_locking.result b/mysql-test/suite/galera/r/galera_toi_ddl_locking.result
new file mode 100644
index 00000000000..f0a51db14d3
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_ddl_locking.result
@@ -0,0 +1,41 @@
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue';
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;;
+SET SESSION wsrep_sync_wait = 0;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+INSERT INTO t1 VALUES (1);
+Got one of the listed errors
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t2 VALUES (1);
+COMMIT;;
+SET SESSION wsrep_sync_wait = 0;
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO = 'Commit';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+SET DEBUG_SYNC= 'now SIGNAL continue';
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 1 FROM t2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 1 FROM t2;
+COUNT(*) = 1
+1
+SET DEBUG_SYNC= 'RESET';
+SET DEBUG_SYNC= 'RESET';
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_nonconflicting.result b/mysql-test/suite/galera/r/galera_toi_ddl_nonconflicting.result
new file mode 100644
index 00000000000..41e693c2b19
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_ddl_nonconflicting.result
@@ -0,0 +1,23 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 INTEGER);
+ALTER TABLE t1 ADD COLUMN f3 INTEGER; INSERT INTO t1 (f1, f2) VALUES (DEFAULT, 123);;
+CREATE UNIQUE INDEX i1 ON t1(f2);;
+INSERT INTO t1 (f1, f2) VALUES (DEFAULT, 234);
+SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 3
+1
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 3
+1
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_sequential.result b/mysql-test/suite/galera/r/galera_toi_ddl_sequential.result
new file mode 100644
index 00000000000..9dfa433d49f
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_ddl_sequential.result
@@ -0,0 +1,35 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+INSERT INTO t1 VALUES (2, 3);
+ALTER TABLE t1 DROP COLUMN f2;
+INSERT INTO t1 VALUES (4);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL,
+ PRIMARY KEY (`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SELECT COUNT(*) = 3 FROM t1;
+COUNT(*) = 3
+1
+SELECT * FROM t1 ORDER BY f1;
+f1
+1
+2
+4
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL,
+ PRIMARY KEY (`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SELECT COUNT(*) = 3 FROM t1;
+COUNT(*) = 3
+1
+SELECT * FROM t1 ORDER BY f1;
+f1
+1
+2
+4
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_toi_ftwrl.result b/mysql-test/suite/galera/r/galera_toi_ftwrl.result
new file mode 100644
index 00000000000..594717c96ff
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_ftwrl.result
@@ -0,0 +1,12 @@
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+FLUSH TABLES WITH READ LOCK;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+UNLOCK TABLES;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `f2` int(11) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_toi_lock_exclusive.result b/mysql-test/suite/galera/r/galera_toi_lock_exclusive.result
new file mode 100644
index 00000000000..eac50e8853c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_lock_exclusive.result
@@ -0,0 +1,17 @@
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (2);
+ALTER TABLE t1 ADD COLUMN f2 INTEGER, LOCK=EXCLUSIVE;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+INSERT INTO t1 VALUES (2, 2);
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+INSERT INTO t1 VALUES (3, 3);
+SELECT COUNT(*) = 3 FROM t1;
+COUNT(*) = 3
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_toi_lock_shared.result b/mysql-test/suite/galera/r/galera_toi_lock_shared.result
new file mode 100644
index 00000000000..36c38860688
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_lock_shared.result
@@ -0,0 +1,12 @@
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 ADD COLUMN f2 INTEGER, LOCK=SHARED;
+INSERT INTO t1 VALUES (2, 2);
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+INSERT INTO t1 VALUES (3, 3);
+SELECT COUNT(*) = 3 FROM t1;
+COUNT(*) = 3
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_transaction_read_only.result b/mysql-test/suite/galera/r/galera_transaction_read_only.result
new file mode 100644
index 00000000000..3cd1076a285
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_transaction_read_only.result
@@ -0,0 +1,21 @@
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+COMMIT;
+wsrep_last_committed_diff
+1
+START TRANSACTION READ ONLY;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+COMMIT;
+wsrep_last_committed_diff
+1
+START TRANSACTION;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+COMMIT;
+wsrep_last_committed_diff
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_transaction_replay.result b/mysql-test/suite/galera/r/galera_transaction_replay.result
new file mode 100644
index 00000000000..23ed87ffe22
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_transaction_replay.result
@@ -0,0 +1,30 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (2, 'a');
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE;
+f1 f2
+2 a
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_enter_sync';
+COMMIT;;
+SET SESSION wsrep_sync_wait = 0;
+UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_enter_sync';
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+COUNT(*) = 1
+1
+wsrep_local_replays
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_truncate.result b/mysql-test/suite/galera/r/galera_truncate.result
new file mode 100644
index 00000000000..eeeb6721d12
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_truncate.result
@@ -0,0 +1,29 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+INSERT INTO t1 VALUES (1);
+TRUNCATE TABLE t1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+CREATE TABLE t2 (f1 VARCHAR(255)) Engine=InnoDB;
+INSERT INTO t2 VALUES ('abc');
+TRUNCATE TABLE t2;
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+CREATE TABLE t3 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB;
+INSERT INTO t3 VALUES (DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT);
+CREATE TABLE t4 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB AUTO_INCREMENT=1234;
+INSERT INTO t4 VALUES (DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT);
+TRUNCATE TABLE t3;
+TRUNCATE TABLE t4;
+SELECT AUTO_INCREMENT = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME IN ('t3', 't4');
+AUTO_INCREMENT = 1
+1
+1
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
diff --git a/mysql-test/suite/galera/r/galera_truncate_temporary.result b/mysql-test/suite/galera/r/galera_truncate_temporary.result
new file mode 100644
index 00000000000..0bdc4e3632a
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_truncate_temporary.result
@@ -0,0 +1,63 @@
+CREATE TEMPORARY TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+INSERT INTO t1 VALUES (1);
+TRUNCATE TABLE t1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT * FROM t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (2);
+SELECT f1 = 2 FROM t1;
+f1 = 2
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+TRUNCATE TABLE t1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT f1 = 1 FROM t1;
+f1 = 1
+1
+DROP TABLE t1;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT f1 = 1 FROM t1;
+f1 = 1
+1
+TRUNCATE TABLE t1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (2);
+TRUNCATE TABLE t1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT f1 = 2 FROM t1;
+f1 = 2
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_unicode_identifiers.result b/mysql-test/suite/galera/r/galera_unicode_identifiers.result
index cb348f8509f..8bea105c77e 100644
--- a/mysql-test/suite/galera/r/galera_unicode_identifiers.result
+++ b/mysql-test/suite/galera/r/galera_unicode_identifiers.result
@@ -6,15 +6,15 @@ CREATE TABLE `table with space` (
`column with space` INTEGER AUTO_INCREMENT PRIMARY KEY,
`second column with space` INTEGER,
UNIQUE `index name with space` (`second column with space`)
-) ENGINE=INNODB;
-INSERT INTO `table with space` VALUES (DEFAULT, 1);
+);
+INSERT INTO `table with space` VALUES (1, 1);
CREATE DATABASE `база`;
USE `база`;
CREATE TABLE `таблица` (
`първа_колона` INTEGER PRIMARY KEY,
`втора_колона` INTEGER,
UNIQUE `индекÑ` (`втора_колона`)
-) ENGINE=INNODB;
+);
INSERT INTO `таблица` VALUES (1, 1);
CREATE DATABASE `втора база`;
USE `втора база`;
@@ -22,20 +22,20 @@ CREATE TABLE `втора таблица` (
`първа колона` INTEGER,
`втора колона` INTEGER,
KEY `първи индекÑ` (`първа колона`)
-) ENGINE=INNODB;
+);
INSERT INTO `втора таблица` VALUES (1, 1);
USE `database with space`;
-SELECT * FROM `table with space`;
-column with space second column with space
-1 1
+SELECT `second column with space` FROM `table with space`;
+second column with space
+1
USE `база`;
SELECT * FROM `таблица`;
първа_колона втора_колона
1 1
USE `втора база`;
-SELECT * FROM `втора таблица`;
-първа колона втора колона
-1 1
+SELECT `втора колона` FROM `втора таблица`;
+втора колона
+1
SET GLOBAL wsrep_sync_wait = (SELECT @@wsrep_sync_wait);
DROP TABLE `database with space`.`table with space`;
DROP TABLE `база`.`таблица`;
diff --git a/mysql-test/suite/galera/r/galera_unicode_pk.result b/mysql-test/suite/galera/r/galera_unicode_pk.result
new file mode 100644
index 00000000000..d59615b2542
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_unicode_pk.result
@@ -0,0 +1,31 @@
+CREATE TABLE t1 (
+f1 VARCHAR(255) PRIMARY KEY
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES ('текÑÑ‚');
+SELECT f1 = 'текÑÑ‚' FROM t1;
+f1 = 'текÑÑ‚'
+1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'текÑÑ‚2';
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'текÑÑ‚3';
+COMMIT;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT f1 = 'текÑÑ‚2' FROM t1;
+f1 = 'текÑÑ‚2'
+1
+SELECT f1 = 'текÑÑ‚2' FROM t1 WHERE f1 = 'текÑÑ‚2';
+f1 = 'текÑÑ‚2'
+1
+START TRANSACTION;
+INSERT INTO t1 VALUES ('текÑÑ‚4');
+START TRANSACTION;
+INSERT INTO t1 VALUES ('текÑÑ‚4');
+COMMIT;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+COMMIT;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_update_limit.result b/mysql-test/suite/galera/r/galera_update_limit.result
new file mode 100644
index 00000000000..c26eb1c29f6
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_update_limit.result
@@ -0,0 +1,17 @@
+CREATE TABLE ten (f1 INTEGER) Engine=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+INSERT INTO t1 SELECT f1 FROM ten ORDER BY RAND();
+UPDATE IGNORE t1 SET f1 = FLOOR(1 + (RAND() * 10)) ORDER BY RAND() LIMIT 5;
+sum_matches
+1
+max_matches
+1
+DROP TABLE t1;
+CREATE TABLE t2 (f1 INTEGER) Engine=InnoDB;
+INSERT INTO t2 SELECT f1 FROM ten ORDER BY RAND();
+UPDATE IGNORE t2 SET f1 = FLOOR(1 + (RAND() * 10)) ORDER BY RAND() LIMIT 5;
+sum_matches
+1
+DROP TABLE t2;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_v1_row_events.result b/mysql-test/suite/galera/r/galera_v1_row_events.result
new file mode 100644
index 00000000000..a6ab62350b1
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_v1_row_events.result
@@ -0,0 +1,10 @@
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+UPDATE t1 SET f1 = 2 WHERE f1 = 1;
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_var_OSU_method.result b/mysql-test/suite/galera/r/galera_var_OSU_method.result
new file mode 100644
index 00000000000..9a07873e1b9
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_OSU_method.result
@@ -0,0 +1,16 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+SET SESSION wsrep_OSU_method = "RSU";
+SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue';
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;;
+SET GLOBAL wsrep_OSU_method = "TOI";
+SET DEBUG_SYNC= 'now SIGNAL continue';
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 1
+1
+SET SESSION wsrep_OSU_method = "TOI";
+SET DEBUG_SYNC= 'RESET';
+SET DEBUG_SYNC= 'RESET';
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_var_OSU_method2.result b/mysql-test/suite/galera/r/galera_var_OSU_method2.result
new file mode 100644
index 00000000000..08f2e6aa0d8
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_OSU_method2.result
@@ -0,0 +1,19 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+SET SESSION wsrep_OSU_method = "TOI";
+SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue';
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_OSU_method = "RSU";
+SET DEBUG_SYNC= 'now SIGNAL continue';
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+INSERT INTO t1 VALUES (1,2);
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+INSERT INTO t1 VALUES (3,4);
+SET GLOBAL wsrep_OSU_method = "TOI";
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';
+SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result b/mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result
index 87d6020d47c..92b69fbbaa7 100644
--- a/mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result
+++ b/mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result
@@ -58,10 +58,4 @@ f1 node
SELECT * FROM t1;
f1 node
1 node1
-SET GLOBAL wsrep_auto_increment_control = 1;
-SET GLOBAL auto_increment_increment = 2;
-SET GLOBAL auto_increment_offset = 1;
-SET GLOBAL wsrep_auto_increment_control = 1;
-SET GLOBAL auto_increment_increment = 2;
-SET GLOBAL auto_increment_offset = 2;
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result b/mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result
index 953ae9f4d81..c1bb065975b 100644
--- a/mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result
+++ b/mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result
@@ -1,31 +1,17 @@
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, node VARCHAR(10)) ENGINE=InnoDB;
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `f1` int(11) NOT NULL AUTO_INCREMENT,
- `node` varchar(10) DEFAULT NULL,
- PRIMARY KEY (`f1`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size');
@@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size')
1
-SELECT @@auto_increment_offset = 1;
-@@auto_increment_offset = 1
+SELECT @@global.auto_increment_offset = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index') + 1;
+@@global.auto_increment_offset = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index') + 1
1
INSERT INTO t1 VALUES (DEFAULT, 'node1');;
INSERT INTO t1 VALUES (DEFAULT, 'node2');;
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `f1` int(11) NOT NULL AUTO_INCREMENT,
- `node` varchar(10) DEFAULT NULL,
- PRIMARY KEY (`f1`)
-) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size');
@@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size')
1
-SELECT @@auto_increment_offset = 2;
-@@auto_increment_offset = 2
+SELECT @@global.auto_increment_offset = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index') + 1;
+@@global.auto_increment_offset = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index') + 1
1
INSERT INTO t1 VALUES (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2');;
INSERT INTO t1 VALUES (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1');;
diff --git a/mysql-test/suite/galera/r/galera_var_certify_nonPK_off.result b/mysql-test/suite/galera/r/galera_var_certify_nonPK_off.result
index 35dabb7654f..e6f37792569 100644
--- a/mysql-test/suite/galera/r/galera_var_certify_nonPK_off.result
+++ b/mysql-test/suite/galera/r/galera_var_certify_nonPK_off.result
@@ -3,7 +3,7 @@ SET GLOBAL wsrep_certify_nonPK = OFF;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB /* Table has no primary key */;
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1), (2);
-ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+Got one of the listed errors
INSERT INTO t2 VALUES (1), (2);
UPDATE t2 SET f1 = 3 WHERE f1 = 1;
SELECT COUNT(*) = 0 FROM t1;
diff --git a/mysql-test/suite/galera/r/galera_var_cluster_address.result b/mysql-test/suite/galera/r/galera_var_cluster_address.result
new file mode 100644
index 00000000000..f8bd869f8fe
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_cluster_address.result
@@ -0,0 +1,51 @@
+SET GLOBAL wsrep_cluster_address = 'foo://';
+SET SESSION wsrep_sync_wait=0;
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS;
+ERROR 08S01: WSREP has not yet prepared node for application use
+SHOW STATUS LIKE 'wsrep_ready';
+Variable_name Value
+wsrep_ready OFF
+SHOW STATUS LIKE 'wsrep_cluster_status';
+Variable_name Value
+wsrep_cluster_status non-Primary
+SHOW STATUS LIKE 'wsrep_local_state';
+Variable_name Value
+wsrep_local_state 0
+SHOW STATUS LIKE 'wsrep_local_state_comment';
+Variable_name Value
+wsrep_local_state_comment Initialized
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 1
+1
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SET GLOBAL wsrep_cluster_address = @@wsrep_cluster_address;
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+SET GLOBAL wsrep_cluster_address = 'gcomm://192.0.2.1';
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS;
+ERROR 08S01: WSREP has not yet prepared node for application use
+SHOW STATUS LIKE 'wsrep_ready';
+Variable_name Value
+wsrep_ready OFF
+SHOW STATUS LIKE 'wsrep_cluster_status';
+Variable_name Value
+wsrep_cluster_status non-Primary
+SHOW STATUS LIKE 'wsrep_local_state';
+Variable_name Value
+wsrep_local_state 0
+SHOW STATUS LIKE 'wsrep_local_state_comment';
+Variable_name Value
+wsrep_local_state_comment Initialized
+SET GLOBAL wsrep_cluster_address = @@wsrep_cluster_address;
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
diff --git a/mysql-test/suite/galera/r/galera_var_desync_on.result b/mysql-test/suite/galera/r/galera_var_desync_on.result
new file mode 100644
index 00000000000..0b5f34688b7
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_desync_on.result
@@ -0,0 +1,29 @@
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SET GLOBAL wsrep_provider_options = 'gcs.fc_limit=1';
+SET GLOBAL wsrep_desync = TRUE;
+FLUSH TABLES WITH READ LOCK;
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (7);
+INSERT INTO t1 VALUES (8);
+INSERT INTO t1 VALUES (9);
+INSERT INTO t1 VALUES (10);
+SET SESSION wsrep_sync_wait = 0;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SET GLOBAL wsrep_desync = FALSE;
+UNLOCK TABLES;
+SET SESSION wsrep_sync_wait = 1;
+SELECT COUNT(*) = 10 FROM t1;
+COUNT(*) = 10
+1
+INSERT INTO t1 VALUES (11);
+SELECT COUNT(*) = 11 FROM t1;
+COUNT(*) = 11
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result b/mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result
new file mode 100644
index 00000000000..912e45a14b1
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result
@@ -0,0 +1,12 @@
+SET SESSION wsrep_sync_wait = 0;
+CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
+SET GLOBAL innodb_disallow_writes=ON;
+INSERT INTO t1 VALUES (1);;
+SET GLOBAL innodb_disallow_writes=OFF;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_var_load_data_splitting.result b/mysql-test/suite/galera/r/galera_var_load_data_splitting.result
new file mode 100644
index 00000000000..db145fd1561
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_load_data_splitting.result
@@ -0,0 +1,9 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET GLOBAL wsrep_load_data_splitting = TRUE;
+SELECT COUNT(*) = 95000 FROM t1;
+COUNT(*) = 95000
+1
+wsrep_last_committed_diff
+1
+SET GLOBAL wsrep_load_data_splitting = 1;;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_var_max_ws_size.result b/mysql-test/suite/galera/r/galera_var_max_ws_size.result
new file mode 100644
index 00000000000..d0bf7deafa5
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_max_ws_size.result
@@ -0,0 +1,8 @@
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 VARCHAR(1024)) Engine=InnoDB;
+SET GLOBAL wsrep_max_ws_size = 1024;
+INSERT INTO t1 VALUES (DEFAULT, REPEAT('X', 1024));
+ERROR HY000: Got error 90 "Message too long" during COMMIT
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_var_notify_cmd.result b/mysql-test/suite/galera/r/galera_var_notify_cmd.result
new file mode 100644
index 00000000000..e9e4605e1bc
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_notify_cmd.result
@@ -0,0 +1,10 @@
+SELECT COUNT(DISTINCT uuid) = 2 FROM mtr_wsrep_notify.membership;
+COUNT(DISTINCT uuid) = 2
+1
+SELECT MAX(size) = 2 FROM mtr_wsrep_notify.status;
+MAX(size) = 2
+1
+SELECT COUNT(DISTINCT idx) = 2 FROM mtr_wsrep_notify.status;
+COUNT(DISTINCT idx) = 2
+1
+DROP SCHEMA mtr_wsrep_notify;
diff --git a/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result b/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result
index abaec56a2ad..73a0576048b 100644
--- a/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result
+++ b/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result
@@ -1,8 +1,78 @@
SET GLOBAL wsrep_replicate_myisam = TRUE;
+SET GLOBAL wsrep_replicate_myisam = TRUE;
CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=MyISAM;
INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2), (3);
+INSERT INTO t1 SELECT 4 FROM DUAL UNION ALL SELECT 5 FROM DUAL;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(100)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1, 'abc'),(2,'abc'), (3, 'xxx');
+REPLACE INTO t1 VALUES (1, 'klm'), (2,'xyz');
+REPLACE INTO t1 SELECT 3, 'yyy' FROM DUAL;
+SELECT COUNT(*) = 3 FROM t1;
+COUNT(*) = 3
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1 AND f2 = 'klm';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2 AND f2 = 'xyz';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 3 AND f2 = 'yyy';
+COUNT(*) = 1
+1
+UPDATE t1 SET f2 = 'zzz' WHERE f2 = 'yyy';
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'zzz';
+COUNT(*) = 1
+1
+DELETE FROM t1 WHERE f2 = 'zzz';
+SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'zzz';
+COUNT(*) = 0
+1
+TRUNCATE TABLE t1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+COMMIT;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
-SET GLOBAL wsrep_replicate_myisam = 0;
+SELECT COUNT(*) = 1 FROM t2;
+COUNT(*) = 1
+1
+START TRANSACTION;
+INSERT INTO t1 VALUES (2);
+INSERT INTO t2 VALUES (2);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 1 FROM t2;
+COUNT(*) = 1
+1
+DROP TABLE t1;
+DROP TABLE t2;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=MyISAM;
+CREATE TABLE t2 (f2 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+INSERT INTO t1 VALUES (1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+COMMIT;
DROP TABLE t1;
+DROP TABLE t2;
+SET GLOBAL wsrep_replicate_myisam = 0;
+SET GLOBAL wsrep_replicate_myisam = 0;
diff --git a/mysql-test/suite/galera/r/galera_var_slave_threads.result b/mysql-test/suite/galera/r/galera_var_slave_threads.result
new file mode 100644
index 00000000000..6b84f03737b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_slave_threads.result
@@ -0,0 +1,106 @@
+CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB;
+CREATE TABLE t2 (f1 INT AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB;
+SET GLOBAL wsrep_slave_threads = 0;
+Warnings:
+Warning 1292 Truncated incorrect wsrep_slave_threads value: '0'
+SHOW WARNINGS;
+Level Code Message
+Warning 1292 Truncated incorrect wsrep_slave_threads value: '0'
+SELECT @@wsrep_slave_threads = 1;
+@@wsrep_slave_threads = 1
+1
+SET GLOBAL wsrep_slave_threads = 1;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
+COUNT(*) = 1
+1
+SET GLOBAL wsrep_slave_threads = 64;
+INSERT INTO t1 VALUES (1);
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+COUNT(*) = @@wsrep_slave_threads + 1
+1
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
+COUNT(*) = 1
+1
+SET GLOBAL wsrep_slave_threads = 1;
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+INSERT INTO t2 VALUES (DEFAULT);
+SELECT COUNT(*) = 64 FROM t2;
+COUNT(*) = 64
+1
+SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+COUNT(*) = @@wsrep_slave_threads + 1
+1
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
+COUNT(*) = 1
+1
+SET GLOBAL wsrep_slave_threads = 1;
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_var_wsrep_on_off.result b/mysql-test/suite/galera/r/galera_var_wsrep_on_off.result
new file mode 100644
index 00000000000..8b1c4ebf83b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_wsrep_on_off.result
@@ -0,0 +1,19 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SET SESSION wsrep_on = FALSE;
+INSERT INTO t1 VALUES (2);
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SET GLOBAL wsrep_on = TRUE;
+INSERT INTO t1 VALUES (3);
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 2;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 3;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_wan.result b/mysql-test/suite/galera/r/galera_wan.result
new file mode 100644
index 00000000000..6be32b291e5
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_wan.result
@@ -0,0 +1,14 @@
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 4
+1
+CREATE TABLE t1 (f1 INTEGER);
+INSERT INTO t1 VALUES (1);
+CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside");
+SELECT VARIABLE_VALUE LIKE '%gmcast.segment = 3%' FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'wsrep_provider_options';
+VARIABLE_VALUE LIKE '%gmcast.segment = 3%'
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
+CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside");
diff --git a/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result b/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result
new file mode 100644
index 00000000000..06fc27ae7ed
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result
@@ -0,0 +1,33 @@
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
+INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+SET GLOBAL wsrep_desync = TRUE;
+SET SESSION wsrep_on = FALSE;
+ALTER TABLE t1 ADD PRIMARY KEY (f1);
+SET SESSION wsrep_on = TRUE;
+SET GLOBAL wsrep_desync = FALSE;
+INSERT INTO t1 (f1) SELECT 100000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+SELECT COUNT(*) = 200000 FROM t1;
+COUNT(*) = 200000
+1
+SELECT MAX(f1) = 199999 FROM t1;
+MAX(f1) = 199999
+1
+SELECT COUNT(*) = 200000 FROM t1;
+COUNT(*) = 200000
+1
+SELECT MAX(f1) = 199999 FROM t1;
+MAX(f1) = 199999
+1
+SET GLOBAL wsrep_desync = TRUE;
+SET SESSION wsrep_on = FALSE;
+ALTER TABLE t1 ADD PRIMARY KEY (f1);
+SET SESSION wsrep_on = TRUE;
+SET GLOBAL wsrep_desync = FALSE;
+INSERT INTO t1 (f1) VALUES (1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+INSERT INTO t1 (f1) VALUES (100);
+ERROR 23000: Duplicate entry '100' for key 'PRIMARY'
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result b/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result
new file mode 100644
index 00000000000..e3f2fa4046f
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result
@@ -0,0 +1,36 @@
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+VARIABLE_VALUE = 'ON'
+1
+SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
+VARIABLE_VALUE = 0
+1
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+VARIABLE_VALUE = 'ON'
+1
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+VARIABLE_VALUE = 4
+1
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Synced'
+1
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+VARIABLE_VALUE = 'ON'
+1
+SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
+VARIABLE_VALUE = 0
+1
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+VARIABLE_VALUE = 'ON'
+1
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+VARIABLE_VALUE = 4
+1
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Synced'
+1
diff --git a/mysql-test/suite/galera/r/galera_wsrep_provider_unset_set.result b/mysql-test/suite/galera/r/galera_wsrep_provider_unset_set.result
new file mode 100644
index 00000000000..681e4606b38
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_wsrep_provider_unset_set.result
@@ -0,0 +1,13 @@
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SET GLOBAL wsrep_provider='none';
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+SELECT COUNT(*) = 4 FROM t1;
+COUNT(*) = 4
+1
+SELECT COUNT(*) = 3 FROM t1;
+COUNT(*) = 3
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_zero_length_column.result b/mysql-test/suite/galera/r/galera_zero_length_column.result
new file mode 100644
index 00000000000..2e6119bd1ba
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_zero_length_column.result
@@ -0,0 +1,38 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY , f2 VARCHAR(0)) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 VARCHAR(0)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (2, '');
+INSERT INTO t2 VALUES (NULL);
+INSERT INTO t2 VALUES ('');
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+SELECT f2 IS NULL FROM t1 WHERE f1 = 1;
+f2 IS NULL
+1
+SELECT f2 = '' FROM t1 WHERE f1 = 2;
+f2 = ''
+1
+SELECT COUNT(*) = 2 FROM t2;
+COUNT(*) = 2
+1
+SELECT f1 IS NULL FROM t2 WHERE f1 IS NULL;
+f1 IS NULL
+1
+SELECT f1 = '' FROM t2 WHERE f1 IS NOT NULL;
+f1 = ''
+1
+UPDATE t1 SET f2 = '' WHERE f1 = 1;
+UPDATE t1 SET f2 = NULL WHERE f1 = 2;
+UPDATE t2 SET f1 = '' WHERE f1 IS NULL;
+SELECT f2 = '' FROM t1 WHERE f1 = 1;
+f2 = ''
+1
+SELECT f2 IS NULL FROM t1 WHERE f1 = 2;
+f2 IS NULL
+1
+SELECT COUNT(*) = 2 FROM t2 WHERE f1 = '';
+COUNT(*) = 2
+1
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/lp1276424.result b/mysql-test/suite/galera/r/lp1276424.result
new file mode 100644
index 00000000000..5f09ec9ea8b
--- /dev/null
+++ b/mysql-test/suite/galera/r/lp1276424.result
@@ -0,0 +1,11 @@
+CREATE TABLE t1 (f1 INT DEFAULT NULL, UNIQUE KEY i1 (f1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL);
+INSERT INTO t1 VALUES (NULL);
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+SELECT f1 IS NULL FROM t1;
+f1 IS NULL
+1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/lp1347768.result b/mysql-test/suite/galera/r/lp1347768.result
new file mode 100644
index 00000000000..c085059e014
--- /dev/null
+++ b/mysql-test/suite/galera/r/lp1347768.result
@@ -0,0 +1,17 @@
+CREATE TABLE `r8kmb_redirect_links` (
+`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+`old_url` varchar(255) DEFAULT NULL,
+`new_url` varchar(255) NOT NULL,
+`referer` varchar(150) NOT NULL,
+`comment` varchar(255) NOT NULL,
+`published` tinyint(4) NOT NULL,
+`created_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+`modified_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+PRIMARY KEY (`id`),
+UNIQUE KEY `idx_link_old` (`old_url`),
+KEY `idx_link_modifed` (`modified_date`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO r8kmb_redirect_links VALUES (550,'http://mysite.com/images/download/ßуñûічýøù_ôþóþòір_þфõÑ.doc','','','',0,'2013-07-15 14:29:42','0000-00-00 00:00:00');
+Warnings:
+Warning 1265 Data truncated for column 'old_url' at row 1
+DROP TABLE r8kmb_redirect_links;
diff --git a/mysql-test/suite/galera/r/lp959512.result b/mysql-test/suite/galera/r/lp959512.result
new file mode 100644
index 00000000000..55adfa360b0
--- /dev/null
+++ b/mysql-test/suite/galera/r/lp959512.result
@@ -0,0 +1,24 @@
+DROP TABLE IF EXISTS variable;
+Warnings:
+Note 1051 Unknown table 'test.variable'
+DROP TABLE IF EXISTS foo;
+Warnings:
+Note 1051 Unknown table 'test.foo'
+CREATE TABLE variable (
+name varchar(128) NOT NULL DEFAULT '' COMMENT 'The name of the variable.',
+value longblob NOT NULL COMMENT 'The value of the variable.',
+PRIMARY KEY (name)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Named variable/value pairs created by Drupal core or any...';
+CREATE TABLE foo (a int);
+INSERT INTO variable (name, value) VALUES ('menu_expanded', 'a:0:{}');
+START TRANSACTION;
+SELECT 1 AS expression FROM variable variable
+WHERE ( (name = 'menu_expanded') ) FOR UPDATE;
+expression
+1
+UPDATE variable SET value='a:0:{}' WHERE ( (name = 'menu_expanded') );
+COMMIT;
+INSERT INTO foo VALUES (1);
+UPDATE foo SET a = 2 WHERE a = 1;
+DROP TABLE foo;
+DROP TABLE variable;
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#33.result b/mysql-test/suite/galera/r/mysql-wsrep#33.result
new file mode 100644
index 00000000000..153d8084bec
--- /dev/null
+++ b/mysql-test/suite/galera/r/mysql-wsrep#33.result
@@ -0,0 +1,103 @@
+Setting SST method to mysqldump ...
+GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst';
+SET GLOBAL wsrep_sst_auth = 'sst:sst';
+SET GLOBAL wsrep_sst_method = 'mysqldump';
+Performing State Transfer on a server that has been temporarily disconnected
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+Unloading wsrep provider ...
+SET GLOBAL wsrep_provider = 'none';
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+Loading wsrep provider ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+DROP USER sst;
+CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
+CALL mtr.add_suppression("InnoDB: New log files created");
+CALL mtr.add_suppression("InnoDB: Creating foreign key constraint system tables");
+CALL mtr.add_suppression("Can't open and lock time zone table");
+CALL mtr.add_suppression("Can't open and lock privilege tables");
+CALL mtr.add_suppression("Info table is not ready to be used");
+CALL mtr.add_suppression("Native table .* has the wrong structure");
+SET GLOBAL general_log = ON;
+SET GLOBAL slow_query_log = ON;
diff --git a/mysql-test/suite/galera/r/partition.result b/mysql-test/suite/galera/r/partition.result
index 60fb2ed298d..3907b4f08c9 100644
--- a/mysql-test/suite/galera/r/partition.result
+++ b/mysql-test/suite/galera/r/partition.result
@@ -20,4 +20,121 @@ pk i
SELECT * FROM t1;
pk i
DROP TABLE t1;
+#
+# MDEV#7501 : alter table exchange partition is not replicated in
+# galera cluster
+#
+
+# On node_1
+CREATE TABLE test.t1 (
+i INT UNSIGNED NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (i)
+) ENGINE=INNODB
+PARTITION BY RANGE (i)
+(PARTITION p1 VALUES LESS THAN (10) ENGINE = INNODB,
+PARTITION p2 VALUES LESS THAN (20) ENGINE = INNODB,
+PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = INNODB);
+INSERT INTO test.t1 (i) VALUE (9),(19);
+CREATE TABLE test.p1 LIKE test.t1;
+ALTER TABLE test.p1 REMOVE PARTITIONING;
+ALTER TABLE test.t1 EXCHANGE PARTITION p1 WITH TABLE test.p1;
+SELECT * FROM test.t1;
+i
+19
+SELECT * FROM test.p1;
+i
+9
+
+# On node_2
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY RANGE (i)
+(PARTITION p1 VALUES LESS THAN (10) ENGINE = InnoDB,
+ PARTITION p2 VALUES LESS THAN (20) ENGINE = InnoDB,
+ PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
+SHOW CREATE TABLE p1;
+Table Create Table
+p1 CREATE TABLE `p1` (
+ `i` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
+SELECT * FROM test.t1;
+i
+19
+SELECT * FROM test.p1;
+i
+9
+
+# On node_1
+ALTER TABLE t1 TRUNCATE PARTITION p2;
+SELECT * FROM test.t1;
+i
+
+# On node_2
+SELECT * FROM test.t1;
+i
+
+# On node_1
+ALTER TABLE t1 DROP PARTITION p2;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY RANGE (i)
+(PARTITION p1 VALUES LESS THAN (10) ENGINE = InnoDB,
+ PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
+
+# On node_2
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY RANGE (i)
+(PARTITION p1 VALUES LESS THAN (10) ENGINE = InnoDB,
+ PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
+DROP TABLE t1, p1;
+#
+# MDEV-5146: Bulk loads into partitioned table not working
+#
+# Case 1: wsrep_load_data_splitting = ON & LOAD DATA with 20002
+# entries.
+SET GLOBAL wsrep_load_data_splitting = ON;
+CREATE TABLE t1 (pk INT PRIMARY KEY)
+ENGINE=INNODB PARTITION BY HASH(pk) PARTITIONS 2;
+SELECT COUNT(*) = 20002 FROM t1;
+COUNT(*) = 20002
+1
+wsrep_last_committed_diff
+1
+DROP TABLE t1;
+# Case 2: wsrep_load_data_splitting = ON & LOAD DATA with 101 entries.
+SET GLOBAL wsrep_load_data_splitting = ON;
+CREATE TABLE t1 (pk INT PRIMARY KEY)
+ENGINE=INNODB PARTITION BY HASH(pk) PARTITIONS 2;
+SELECT COUNT(*) = 101 FROM t1;
+COUNT(*) = 101
+1
+wsrep_last_committed_diff
+1
+DROP TABLE t1;
+# Case 3: wsrep_load_data_splitting = OFF & LOAD DATA with 20002
+# entries.
+SET GLOBAL wsrep_load_data_splitting = OFF;
+CREATE TABLE t1 (pk INT PRIMARY KEY)
+ENGINE=INNODB PARTITION BY HASH(pk) PARTITIONS 2;
+SELECT COUNT(*) = 20002 FROM t1;
+COUNT(*) = 20002
+1
+wsrep_last_committed_diff
+1
+DROP TABLE t1;
+SET GLOBAL wsrep_load_data_splitting = 1;;
# End of test
diff --git a/mysql-test/suite/galera/r/rename.result b/mysql-test/suite/galera/r/rename.result
new file mode 100644
index 00000000000..3c81e8b6320
--- /dev/null
+++ b/mysql-test/suite/galera/r/rename.result
@@ -0,0 +1,39 @@
+#
+# MDEV-8598 : Failed MySQL DDL commands and Galera replication
+#
+# On node 1
+USE test;
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1(i INT) ENGINE=INNODB;
+INSERT INTO t1 VALUE(1);
+SELECT * FROM t1;
+i
+1
+# Create a new user 'foo' with limited privileges
+CREATE USER foo@localhost;
+GRANT SELECT on test.* TO foo@localhost;
+# Open connection to the 1st node using 'test_user1' user.
+SELECT * FROM t1;
+i
+1
+# Following RENAME should not replicate to other node.
+RENAME TABLE t1 TO t2;
+ERROR 42000: DROP, ALTER command denied to user 'foo'@'localhost' for table 't1'
+# On node 2
+USE test;
+SELECT * FROM t1;
+i
+1
+# On node_1
+RENAME TABLE t1 TO t2;
+SHOW TABLES;
+Tables_in_test
+t2
+# On node 2
+USE test;
+SELECT * FROM t2;
+i
+1
+DROP USER foo@localhost;
+DROP TABLE t2;
+# End of tests
diff --git a/mysql-test/suite/galera/r/rpl_row_annotate.result b/mysql-test/suite/galera/r/rpl_row_annotate.result
new file mode 100644
index 00000000000..ff8d49702ac
--- /dev/null
+++ b/mysql-test/suite/galera/r/rpl_row_annotate.result
@@ -0,0 +1,66 @@
+# On node_2
+RESET MASTER;
+# On node_1
+RESET MASTER;
+CREATE TABLE t1(i INT)ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+DELETE FROM t1 WHERE i = 1;
+# On node_2
+INSERT INTO t1 VALUES(2);
+DELETE FROM t1 WHERE i = 2;
+# On node_1
+SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM <start_pos>;
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000001 # Gtid_list 1 # []
+mysqld-bin.000001 # Binlog_checkpoint 1 # mysqld-bin.000001
+mysqld-bin.000001 # Gtid 1 # GTID 0-1-1
+mysqld-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(i INT)ENGINE=INNODB
+mysqld-bin.000001 # Gtid 1 # BEGIN GTID 0-1-2
+mysqld-bin.000001 # Annotate_rows 1 # INSERT INTO t1 VALUES(1)
+mysqld-bin.000001 # Table_map 1 # table_id: # (test.t1)
+mysqld-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid 1 # COMMIT /* xid= */
+mysqld-bin.000001 # Gtid 1 # BEGIN GTID 0-1-3
+mysqld-bin.000001 # Annotate_rows 1 # DELETE FROM t1 WHERE i = 1
+mysqld-bin.000001 # Table_map 1 # table_id: # (test.t1)
+mysqld-bin.000001 # Delete_rows_v1 1 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid 1 # COMMIT /* xid= */
+mysqld-bin.000001 # Gtid 2 # BEGIN GTID 0-2-4
+mysqld-bin.000001 # Annotate_rows 2 # INSERT INTO t1 VALUES(2)
+mysqld-bin.000001 # Table_map 2 # table_id: # (test.t1)
+mysqld-bin.000001 # Write_rows_v1 2 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid 2 # COMMIT /* xid= */
+mysqld-bin.000001 # Gtid 2 # BEGIN GTID 0-2-5
+mysqld-bin.000001 # Annotate_rows 2 # DELETE FROM t1 WHERE i = 2
+mysqld-bin.000001 # Table_map 2 # table_id: # (test.t1)
+mysqld-bin.000001 # Delete_rows_v1 2 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid 2 # COMMIT /* xid= */
+# On node_2
+SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM <start_pos>;
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000001 # Gtid_list 2 # []
+mysqld-bin.000001 # Binlog_checkpoint 2 # mysqld-bin.000001
+mysqld-bin.000001 # Gtid 1 # GTID 0-1-1
+mysqld-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(i INT)ENGINE=INNODB
+mysqld-bin.000001 # Gtid 1 # BEGIN GTID 0-1-2
+mysqld-bin.000001 # Annotate_rows 1 # INSERT INTO t1 VALUES(1)
+mysqld-bin.000001 # Table_map 1 # table_id: # (test.t1)
+mysqld-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid 1 # COMMIT /* xid= */
+mysqld-bin.000001 # Gtid 1 # BEGIN GTID 0-1-3
+mysqld-bin.000001 # Annotate_rows 1 # DELETE FROM t1 WHERE i = 1
+mysqld-bin.000001 # Table_map 1 # table_id: # (test.t1)
+mysqld-bin.000001 # Delete_rows_v1 1 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid 1 # COMMIT /* xid= */
+mysqld-bin.000001 # Gtid 2 # BEGIN GTID 0-2-4
+mysqld-bin.000001 # Annotate_rows 2 # INSERT INTO t1 VALUES(2)
+mysqld-bin.000001 # Table_map 2 # table_id: # (test.t1)
+mysqld-bin.000001 # Write_rows_v1 2 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid 2 # COMMIT /* xid= */
+mysqld-bin.000001 # Gtid 2 # BEGIN GTID 0-2-5
+mysqld-bin.000001 # Annotate_rows 2 # DELETE FROM t1 WHERE i = 2
+mysqld-bin.000001 # Table_map 2 # table_id: # (test.t1)
+mysqld-bin.000001 # Delete_rows_v1 2 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid 2 # COMMIT /* xid= */
+DROP TABLE t1;
+# End of test
diff --git a/mysql-test/suite/galera/r/sql_log_bin.result b/mysql-test/suite/galera/r/sql_log_bin.result
new file mode 100644
index 00000000000..237725ec9a7
--- /dev/null
+++ b/mysql-test/suite/galera/r/sql_log_bin.result
@@ -0,0 +1,52 @@
+
+# On node_1
+USE test;
+CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1);
+# Disable binary logging for current session
+SET SQL_LOG_BIN=OFF;
+INSERT INTO t1 VALUES (2);
+CREATE TABLE t2(c1 INT PRIMARY KEY) ENGINE=INNODB;
+INSERT INTO t2 VALUES (1);
+CREATE TABLE test.t3 AS SELECT * from t1;
+# Enable binary logging for current session
+SET SQL_LOG_BIN=ON;
+INSERT INTO t2 VALUES (2);
+CREATE TABLE t4 AS SELECT * from t2;
+SELECT * FROM t1;
+c1
+1
+2
+SELECT * FROM t2;
+c1
+1
+2
+SELECT * FROM t3;
+c1
+1
+2
+SELECT * FROM t4;
+c1
+1
+2
+
+# On node_2
+USE test;
+SELECT * FROM t1;
+c1
+1
+2
+SELECT * FROM t2;
+c1
+1
+2
+SELECT * FROM t3;
+c1
+1
+2
+SELECT * FROM t4;
+c1
+1
+2
+DROP TABLE t1, t2, t3, t4;
+# End of test
diff --git a/mysql-test/suite/galera/r/view.result b/mysql-test/suite/galera/r/view.result
index 89e2355b4dc..06d7bf072e8 100644
--- a/mysql-test/suite/galera/r/view.result
+++ b/mysql-test/suite/galera/r/view.result
@@ -4,4 +4,49 @@
USE test;
CREATE DEFINER=CURRENT_USER VIEW v1 AS SELECT 1;
DROP VIEW v1;
+#
+# MDEV-8464 : ALTER VIEW not replicated in some cases
+#
+# On node_1
+USE test;
+CREATE TABLE t1(i INT) ENGINE=INNODB;
+CREATE DEFINER=CURRENT_USER VIEW v1 AS SELECT * FROM t1;
+CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t1;
+CREATE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t1;
+CREATE ALGORITHM=UNDEFINED DEFINER=CURRENT_USER VIEW v4 AS SELECT * FROM t1;
+# On node_2
+USE test;
+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`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
+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`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
+SHOW CREATE VIEW v3;
+View Create View character_set_client collation_connection
+v3 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
+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`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
+# On node_1
+ALTER ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
+ALTER ALGORITHM=UNDEFINED VIEW v2 AS SELECT * FROM t1;
+ALTER DEFINER=CURRENT_USER VIEW v3 AS SELECT * FROM t1;
+ALTER ALGORITHM=TEMPTABLE DEFINER=CURRENT_USER VIEW v4 AS SELECT * FROM t1;
+# On node_2
+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`.`i` AS `i` from `t1` 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 `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
+SHOW CREATE VIEW v3;
+View Create View character_set_client collation_connection
+v3 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
+SHOW CREATE VIEW v4;
+View Create View character_set_client collation_connection
+v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
+# Cleanup
+DROP VIEW v1, v2, v3, v4;
+DROP TABLE t1;
# End of tests
diff --git a/mysql-test/suite/galera/suite.pm b/mysql-test/suite/galera/suite.pm
index 2b762d630be..28163d62ef1 100644
--- a/mysql-test/suite/galera/suite.pm
+++ b/mysql-test/suite/galera/suite.pm
@@ -33,8 +33,39 @@ push @::global_suppressions,
qr(WSREP: last inactive check more than .* skipping check),
qr(WSREP: SQL statement was ineffective),
qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned.),
- qr|WSREP: access file\(gvwstate.dat\) failed\(No such file or directory\)|,
+ qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|,
+ qr(WSREP: Quorum: No node with complete state),
+ qr(WSREP: Initial position was provided by configuration or SST, avoiding override),
+ qr|WSREP: discarding established \(time wait\) .*|,
+ qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside. Will use that one.),
+ qr(WSREP: evs::proto.*),
+ qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:.*|,
+ qr(WSREP: no nodes coming from prim view, prim not possible),
+ qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable),
+ qr(WSREP: user message in state LEAVING),
+ qr(WSREP: .* sending install message failed: Transport endpoint is not connected),
+ qr(WSREP: .* sending install message failed: Resource temporarily unavailable),
+ qr(WSREP: Maximum writeset size exceeded by .*),
+ qr(WSREP: transaction size exceeded.*),
+ qr(WSREP: RBR event .*),
+ qr(WSREP: Ignoring error for TO isolated action: .*),
+ qr(WSREP: transaction size limit .*),
+ qr(WSREP: rbr write fail, .*),
+ qr(WSREP: .*Backend not supported: foo.*),
+ qr(WSREP: .*Failed to initialize backend using .*),
+ qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*),
+ qr(WSREP: gcs connect failed: Socket type not supported),
+ qr(WSREP: failed to open gcomm backend connection: 110: failed to reach primary view: 110 .*),
+ qr(WSREP: .*Failed to open backend connection: -110 .*),
+ qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*),
+ qr(WSREP: gcs connect failed: Connection timed out),
+ qr|WSREP: wsrep::connect\(\) failed: 7|,
qr(WSREP: SYNC message from member [0-9]* in non-primary configuration. Ignored.),
+ qr(WSREP: Could not find peer:),
+ qr(WSREP: TO isolation failed for: .*),
+ qr|WSREP: gcs_caused\(\) returned .*|,
+ qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(SYNCED\). Message ignored.|,
+ qr(WSREP: Action message in non-primary configuration from member [0-9]*),
);
diff --git a/mysql-test/suite/galera/t/binlog_checksum.test b/mysql-test/suite/galera/t/binlog_checksum.test
new file mode 100644
index 00000000000..5aab68a7746
--- /dev/null
+++ b/mysql-test/suite/galera/t/binlog_checksum.test
@@ -0,0 +1,36 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--echo # On node_1
+--connection node_1
+SET @binlog_checksum_saved= @@GLOBAL.BINLOG_CHECKSUM;
+SET @@GLOBAL.BINLOG_CHECKSUM=CRC32;
+
+--echo # On node_2
+--connection node_2
+SET @binlog_checksum_saved= @@GLOBAL.BINLOG_CHECKSUM;
+SET @@GLOBAL.BINLOG_CHECKSUM=CRC32;
+
+USE test;
+CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
+SELECT * FROM t1;
+SELECT * FROM test.t1;
+
+--echo
+--echo # On node_2
+--connection node_2
+SELECT * FROM test.t1;
+
+--let $galera_diff_statement = SELECT * FROM t1
+--source include/galera_diff.inc
+
+# Cleanup
+DROP TABLE t1;
+--connection node_1
+SET @@GLOBAL.BINLOG_CHECKSUM = @binlog_checksum_saved;
+--connection node_2
+SET @@GLOBAL.BINLOG_CHECKSUM = @binlog_checksum_saved;
+
+--source include/galera_end.inc
+--echo # End of test
diff --git a/mysql-test/suite/galera/t/create.test b/mysql-test/suite/galera/t/create.test
index b56a841fb65..fb9b0935288 100644
--- a/mysql-test/suite/galera/t/create.test
+++ b/mysql-test/suite/galera/t/create.test
@@ -22,5 +22,37 @@ SELECT * FROM t1_temp;
DROP TABLE t1;
SET @@GLOBAL.wsrep_forced_binlog_format=@wsrep_forced_binlog_format_saved;
+--echo #
+--echo # MDEV-7673: CREATE TABLE SELECT fails on Galera cluster
+--echo #
+--connection node_1
+CREATE TABLE t1 (i INT) ENGINE=INNODB DEFAULT CHARSET=utf8 SELECT 1 as i;
+SELECT * FROM t1;
+
+--connection node_2
+SELECT * FROM t1;
+# Cleanup
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-8166 : Adding index on new table from select crashes Galera
+--echo # cluster
+--echo #
+--connection node_1
+CREATE TABLE t1(i int(11) NOT NULL DEFAULT '0') ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t1(i) VALUES (1), (2), (3);
+
+CREATE TABLE t2 (i INT) SELECT i FROM t1;
+ALTER TABLE t2 ADD INDEX idx(i);
+
+SELECT * FROM t2;
+
+--connection node_2
+SELECT * FROM t2;
+SHOW CREATE TABLE t2;
+
+# Cleanup
+DROP TABLE t1, t2;
+
--echo # End of tests
diff --git a/mysql-test/suite/galera/t/galera_account_management.test b/mysql-test/suite/galera/t/galera_account_management.test
new file mode 100644
index 00000000000..357319ad106
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_account_management.test
@@ -0,0 +1,101 @@
+#
+# Test the account management statements - GRANT, REVOKE, etc.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# CREATE USER
+#
+--connection node_1
+CREATE USER user1, user2 IDENTIFIED BY 'password';
+
+--connection node_2
+SELECT COUNT(*) = 2 FROM mysql.user WHERE user IN ('user1', 'user2');
+
+#
+# ALTER USER
+#
+
+# LP bug 1376269
+#
+#--connection node_1
+#ALTER USER user1 PASSWORD EXPIRE;
+#SELECT password_expired = 'Y' FROM mysql.user WHERE user = 'user1';
+#
+#--connection node_2
+#SELECT password_expired = 'Y' FROM mysql.user WHERE user = 'user1';
+
+#
+# RENAME USER
+#
+
+--connection node_1
+RENAME USER user2 TO user3;
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM mysql.user WHERE user = 'user2';
+SELECT COUNT(*) = 1 FROM mysql.user WHERE user = 'user3';
+
+#
+# SET PASSWORD
+#
+
+--connection node_1
+SET PASSWORD FOR user3 = PASSWORD('foo');
+
+--connection node_1
+SELECT password != '' FROM mysql.user WHERE user = 'user3';
+
+#
+# DROP USER
+#
+--connection node_1
+DROP USER user1, user3;
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM mysql.user WHERE user IN ('user1', 'user2');
+
+#
+# GRANT
+#
+
+--connection node_1
+GRANT ALL ON *.* TO user4 IDENTIFIED BY 'password';
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM mysql.user WHERE user = 'user4';
+SELECT Select_priv = 'Y' FROM mysql.user WHERE user = 'user4';
+
+#
+# GRANT PROXY ON
+#
+--connection node_1
+CREATE USER user5;
+GRANT PROXY ON user4 TO user5;
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM mysql.proxies_priv WHERE user = 'user5';
+
+#
+# REVOKE
+#
+
+--connection node_1
+REVOKE ALL PRIVILEGES ON *.* FROM user4;
+
+--connection node_2
+SELECT Select_priv = 'N' FROM mysql.user WHERE user = 'user4';
+
+#
+# REVOKE PROXY
+#
+
+--connection node_1
+REVOKE PROXY ON user4 FROM user5;
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM mysql.proxies_priv WHERE user = 'user5';
+
+DROP USER user4, user5;
diff --git a/mysql-test/suite/galera/t/galera_alter_engine_innodb.test b/mysql-test/suite/galera/t/galera_alter_engine_innodb.test
new file mode 100644
index 00000000000..bc914a38776
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_alter_engine_innodb.test
@@ -0,0 +1,17 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test ALTER ENGINE from InnoDB to InnoDB
+#
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+ALTER TABLE t1 ENGINE=InnoDB;
+
+--connection node_2
+SELECT ENGINE = 'InnoDB' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+SELECT COUNT(*) = 1 FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_alter_engine_myisam.test b/mysql-test/suite/galera/t/galera_alter_engine_myisam.test
new file mode 100644
index 00000000000..6d41d276a17
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_alter_engine_myisam.test
@@ -0,0 +1,25 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test ALTER ENGINE from MyISAM to InnoDB under wsrep_replicate_myisam
+#
+
+--let $wsrep_replicate_myisam_orig = `SELECT @@wsrep_replicate_myisam`
+SET GLOBAL wsrep_replicate_myisam = TRUE;
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1);
+
+ALTER TABLE t1 ENGINE=InnoDB;
+
+--connection node_2
+SELECT ENGINE = 'InnoDB' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+SELECT COUNT(*) = 1 FROM t1;
+
+--connection node_1
+--disable_query_log
+--eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig
+--enable_query_log
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_alter_table_force.test b/mysql-test/suite/galera/t/galera_alter_table_force.test
new file mode 100644
index 00000000000..1fcc9d4bda5
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_alter_table_force.test
@@ -0,0 +1,17 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test ALTER TABLE FORCE, a 5.6.3 feature that simply rebuilds the table
+#
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+ALTER TABLE t1 FORCE;
+
+--connection node_2
+SELECT ENGINE = 'InnoDB' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+SELECT COUNT(*) = 1 FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_as_master.cnf b/mysql-test/suite/galera/t/galera_as_master.cnf
new file mode 100644
index 00000000000..52fd3093931
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_master.cnf
@@ -0,0 +1 @@
+!include ../galera_2nodes_as_master.cnf
diff --git a/mysql-test/suite/galera/t/galera_as_master.test b/mysql-test/suite/galera/t/galera_as_master.test
new file mode 100644
index 00000000000..c5d4db9f192
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_master.test
@@ -0,0 +1,62 @@
+#
+# Test Galera as a master to a MySQL slave
+#
+# The galera/galera_2node_master.cnf describes the setup of the nodes
+#
+
+--source include/have_innodb.inc
+--source include/galera_cluster.inc
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--disable_query_log
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1;
+--enable_query_log
+START SLAVE;
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+
+--echo # Disable binary logging for current session
+SET SQL_LOG_BIN=OFF;
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t2 VALUES(1);
+INSERT INTO t1 VALUES(2);
+CREATE TABLE test.t3 AS SELECT * from t1;
+
+SET SQL_LOG_BIN=ON;
+INSERT INTO t1 VALUES(3);
+CREATE TABLE test.t4 AS SELECT * from t1;
+
+--connection node_2
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+SELECT * FROM t4;
+
+--connection node_3
+SHOW TABLES;
+
+--let $wait_condition = SELECT COUNT(*) = 2 FROM t1;
+--source include/wait_condition.inc
+
+--let $wait_condition = SELECT COUNT(*) = 3 FROM t4;
+--source include/wait_condition.inc
+
+SELECT * FROM t1;
+SELECT * FROM t4;
+
+--echo # Cleanup
+--connection node_1
+DROP TABLE t1, t4;
+SET SQL_LOG_BIN=OFF;
+DROP TABLE t2, t3;
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't4';
+--source include/wait_condition.inc
+
+STOP SLAVE;
+RESET SLAVE ALL;
diff --git a/mysql-test/suite/galera/t/galera_as_master_gtid.cnf b/mysql-test/suite/galera/t/galera_as_master_gtid.cnf
new file mode 100644
index 00000000000..19517556331
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_master_gtid.cnf
@@ -0,0 +1,8 @@
+!include ../galera_2nodes_as_master.cnf
+
+[mysqld]
+gtid-mode=ON
+log-bin=mysqld-bin
+log-slave-updates
+enforce-gtid-consistency
+binlog-format=ROW
diff --git a/mysql-test/suite/galera/t/galera_as_master_gtid.test b/mysql-test/suite/galera/t/galera_as_master_gtid.test
new file mode 100644
index 00000000000..9db104b7cab
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_master_gtid.test
@@ -0,0 +1,70 @@
+#
+# Test Galera as a master to a MySQL slave with GTID
+#
+# The galera/galera_2node_master.cnf describes the setup of the nodes
+#
+# We check that all transactions originating from within Galera use a UUID that is
+# different from the server_uuid of either node
+#
+#
+
+--source include/have_innodb.inc
+--source include/have_log_bin.inc
+--source include/galera_cluster.inc
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--disable_query_log
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_1;
+--enable_query_log
+START SLAVE USER='root';
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+
+--let $effective_uuid = `SELECT LEFT(@@global.gtid_executed, 36)`
+--disable_query_log
+--eval SELECT '$effective_uuid' != @@global.server_uuid AS uuids_do_not_match;
+--enable_query_log
+
+--replace_result $effective_uuid <effective_uuid>
+--replace_regex /table_id: [0-9]+/table_id: #/ /xid=[0-9]+/xid=#/
+SHOW BINLOG EVENTS IN 'mysqld-bin.000002' FROM 120;
+
+--connection node_2
+INSERT INTO t1 VALUES(2);
+
+--disable_query_log
+--eval SELECT '$effective_uuid' != @@global.server_uuid AS uuids_do_not_match;
+--eval SELECT '$effective_uuid' = LEFT(@@global.gtid_executed, 36) AS uuids_match;
+--enable_query_log
+
+--replace_result $effective_uuid <effective_uuid>
+--replace_regex /table_id: [0-9]+/table_id: #/ /xid=[0-9]+/xid=#/
+SHOW BINLOG EVENTS IN 'mysqld-bin.000003' FROM 120;
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+
+--let $wait_condition = SELECT COUNT(*) = 2 FROM t1;
+--source include/wait_condition.inc
+
+--disable_query_log
+--eval SELECT '$effective_uuid' != @@global.server_uuid AS uuids_do_not_match;
+--eval SELECT '$effective_uuid' = LEFT(@@global.gtid_executed, 36) AS uuids_match;
+--enable_query_log
+
+--replace_result $effective_uuid <effective_uuid>
+--replace_regex /table_id: [0-9]+/table_id: #/ /xid=[0-9]+/xid=#/
+SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 120;
+
+--connection node_1
+DROP TABLE t1;
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+
+STOP SLAVE;
+RESET SLAVE ALL;
diff --git a/mysql-test/suite/galera/t/galera_as_master_gtid_change_master.cnf b/mysql-test/suite/galera/t/galera_as_master_gtid_change_master.cnf
new file mode 100644
index 00000000000..19517556331
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_master_gtid_change_master.cnf
@@ -0,0 +1,8 @@
+!include ../galera_2nodes_as_master.cnf
+
+[mysqld]
+gtid-mode=ON
+log-bin=mysqld-bin
+log-slave-updates
+enforce-gtid-consistency
+binlog-format=ROW
diff --git a/mysql-test/suite/galera/t/galera_as_master_gtid_change_master.test b/mysql-test/suite/galera/t/galera_as_master_gtid_change_master.test
new file mode 100644
index 00000000000..23606d7ac4c
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_master_gtid_change_master.test
@@ -0,0 +1,54 @@
+#
+# Test that a MySQL slave can use CHANGE MASTER MASTER_AUTO_POSITION to begin replicating
+# from another Galera node
+#
+# The galera/galera_2node_master.cnf describes the setup of the nodes
+#
+#
+
+--source include/have_innodb.inc
+--source include/have_log_bin.inc
+--source include/galera_cluster.inc
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--disable_query_log
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_1;
+--enable_query_log
+START SLAVE USER='root';
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+
+--connection node_2
+INSERT INTO t1 VALUES(2);
+
+--connection node_3
+STOP SLAVE;
+--disable_query_log
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_2, MASTER_AUTO_POSITION=1;
+--enable_query_log
+START SLAVE USER='root';
+
+--connection node_1
+INSERT INTO t1 VALUES(3);
+
+--connection node_2
+INSERT INTO t1 VALUES(4);
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+
+--let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+DROP TABLE t1;
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+
+STOP SLAVE;
+RESET SLAVE ALL;
diff --git a/mysql-test/suite/galera/t/galera_as_slave.cnf b/mysql-test/suite/galera/t/galera_as_slave.cnf
new file mode 100644
index 00000000000..9449ec9cf40
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_slave.cnf
@@ -0,0 +1 @@
+!include ../galera_2nodes_as_slave.cnf
diff --git a/mysql-test/suite/galera/t/galera_as_slave.test b/mysql-test/suite/galera/t/galera_as_slave.test
new file mode 100644
index 00000000000..79b9e5071a3
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_slave.test
@@ -0,0 +1,47 @@
+#
+# Test Galera as a slave to a MySQL master
+#
+# The galera/galera_2node_slave.cnf describes the setup of the nodes
+#
+
+--source include/have_innodb.inc
+
+# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--source include/galera_cluster.inc
+
+--connection node_2
+--disable_query_log
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1;
+--enable_query_log
+START SLAVE;
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+
+--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
+--source include/wait_condition.inc
+
+INSERT INTO t1 VALUES (2);
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+SELECT COUNT(*) = 2 FROM t1;
+INSERT INTO t1 VALUES (3);
+
+--connection node_2
+SELECT COUNT(*) = 3 FROM t1;
+
+--connection node_1
+DROP TABLE t1;
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+
+STOP SLAVE;
+RESET SLAVE ALL;
diff --git a/mysql-test/suite/galera/t/galera_as_slave_gtid.cnf b/mysql-test/suite/galera/t/galera_as_slave_gtid.cnf
new file mode 100644
index 00000000000..01d2eb12630
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_slave_gtid.cnf
@@ -0,0 +1,6 @@
+!include ../galera_2nodes_as_slave.cnf
+
+[mysqld]
+log-bin=mysqld-bin
+log-slave-updates
+binlog-format=ROW
diff --git a/mysql-test/suite/galera/t/galera_as_slave_gtid.test b/mysql-test/suite/galera/t/galera_as_slave_gtid.test
new file mode 100644
index 00000000000..c2331a2ae05
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_slave_gtid.test
@@ -0,0 +1,67 @@
+#
+# Test Galera as a slave to a MariaDB master using GTIDs
+#
+# suite/galera/galera_2nodes_as_slave.cnf describes the setup of the nodes
+# suite/galera/t/galera_as_slave_gtid.cnf has the GTID options
+#
+# In addition to performing DDL and DML, we check that the gtid of the master is preserved inside the cluster
+#
+
+--source include/have_innodb.inc
+
+# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--source include/galera_cluster.inc
+
+--connection node_2
+--disable_query_log
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1;
+--enable_query_log
+START SLAVE;
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+
+SELECT LENGTH(@@global.gtid_binlog_state) > 1;
+--let $gtid_binlog_state_node1 = `SELECT @@global.gtid_binlog_state;`
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+
+--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
+--source include/wait_condition.inc
+
+--disable_query_log
+--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
+--enable_query_log
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+SELECT COUNT(*) = 1 FROM t1;
+
+--disable_query_log
+--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
+--enable_query_log
+
+--connection node_1
+DROP TABLE t1;
+
+#
+# Unfortunately without the sleep below the following statement fails with "query returned no rows", which
+# is difficult to understand given that it is an aggregate query. A "query execution was interrupted"
+# warning is also reported by MTR, which is also weird.
+#
+
+--sleep 1
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+
+STOP SLAVE;
+RESET SLAVE ALL;
diff --git a/mysql-test/suite/galera/t/galera_bf_abort.test b/mysql-test/suite/galera/t/galera_bf_abort.test
new file mode 100644
index 00000000000..69825ea4919
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_bf_abort.test
@@ -0,0 +1,29 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test a local transaction being aborted by a slave one
+#
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+--connection node_2
+--let $wsrep_local_bf_aborts_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+
+--connection node_1
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+--error ER_LOCK_DEADLOCK
+INSERT INTO t1 VALUES (2);
+
+--let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
+
+--disable_query_log
+--eval SELECT $wsrep_local_bf_aborts_after - $wsrep_local_bf_aborts_before = 1 AS wsrep_local_aborts_increment;
+--enable_query_log
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_bf_abort_for_update.test b/mysql-test/suite/galera/t/galera_bf_abort_for_update.test
new file mode 100644
index 00000000000..24c29778e5d
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_bf_abort_for_update.test
@@ -0,0 +1,29 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test a local transaction being aborted by a slave one while it is running a SELECT FOR UPDATE
+#
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+--connection node_2
+--let $wsrep_local_bf_aborts_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+
+--connection node_1
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+--error ER_LOCK_DEADLOCK
+SELECT * FROM t1 FOR UPDATE;
+
+--let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
+
+--disable_query_log
+--eval SELECT $wsrep_local_bf_aborts_after - $wsrep_local_bf_aborts_before = 1 AS wsrep_local_aborts_increment;
+--enable_query_log
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_bf_abort_ftwrl.test b/mysql-test/suite/galera/t/galera_bf_abort_ftwrl.test
new file mode 100644
index 00000000000..44398e717d1
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_bf_abort_ftwrl.test
@@ -0,0 +1,30 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# A local transaction running FLUSH TABLES WITH READ LOCK will not be aborted by a slave transaction
+#
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+--connection node_2
+SET AUTOCOMMIT=OFF;
+--let $wsrep_local_bf_aborts_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
+--send FLUSH TABLES WITH READ LOCK;
+
+--connection node_1
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+--reap
+
+UNLOCK TABLES;
+
+--let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
+
+# No aborts should be registered on the counter
+--disable_query_log
+--eval SELECT $wsrep_local_bf_aborts_after - $wsrep_local_bf_aborts_before = 0 AS wsrep_local_aborts_increment;
+--enable_query_log
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_bf_abort_get_lock.test b/mysql-test/suite/galera/t/galera_bf_abort_get_lock.test
new file mode 100644
index 00000000000..72fc1c5b583
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_bf_abort_get_lock.test
@@ -0,0 +1,36 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test a local transaction being aborted by a slave one while it is running a GET_LOCK()
+#
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+--let $galera_connection_name = node_2a
+--let $galera_server_number = 2
+--source include/galera_connect.inc
+--connection node_2a
+SELECT GET_LOCK("foo", 1000);
+
+--connection node_2
+SET AUTOCOMMIT=OFF;
+--let $wsrep_local_bf_aborts_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
+INSERT INTO t1 VALUES (1);
+--send SELECT GET_LOCK("foo", 1000);
+
+--connection node_1
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+--error ER_LOCK_DEADLOCK
+--reap
+
+--let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
+
+# Check that wsrep_local_bf_aborts has been incremented by exactly 1
+--disable_query_log
+--eval SELECT $wsrep_local_bf_aborts_after - $wsrep_local_bf_aborts_before = 1 AS wsrep_local_aborts_increment;
+--enable_query_log
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_bf_abort_lock_table.test b/mysql-test/suite/galera/t/galera_bf_abort_lock_table.test
new file mode 100644
index 00000000000..788427103a5
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_bf_abort_lock_table.test
@@ -0,0 +1,33 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test that a local LOCK TABLE will be broken by an incoming remote transaction against that table
+#
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+--connection node_2
+SET AUTOCOMMIT=OFF;
+--let $wsrep_local_bf_aborts_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
+LOCK TABLE t1 WRITE;
+
+# Issue a concurrent INSERT against the lock table that will block
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--send INSERT INTO t1 VALUES (1);
+
+--connection node_1
+INSERT INTO t1 VALUES (2);
+
+# The concurent insert is allowed to complete because the LOCK TABLE is now broken
+--connection node_2a
+--error 0
+--reap
+
+--let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
+
+--disable_query_log
+--eval SELECT $wsrep_local_bf_aborts_after - $wsrep_local_bf_aborts_before = 1 AS wsrep_local_aborts_increment;
+--enable_query_log
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_bf_abort_sleep.test b/mysql-test/suite/galera/t/galera_bf_abort_sleep.test
new file mode 100644
index 00000000000..8d135dc7d42
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_bf_abort_sleep.test
@@ -0,0 +1,30 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test a local transaction being aborted by a slave one while it is running a SLEEP()
+#
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+--connection node_2
+SET AUTOCOMMIT=OFF;
+--let $wsrep_local_bf_aborts_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
+INSERT INTO t1 VALUES (1);
+--send SELECT SLEEP(1000);
+
+--connection node_1
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+--error ER_LOCK_DEADLOCK
+--reap
+
+--let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
+
+# Check that wsrep_local_bf_aborts has been incremented by exactly 1
+--disable_query_log
+--eval SELECT $wsrep_local_bf_aborts_after - $wsrep_local_bf_aborts_before = 1 AS wsrep_local_aborts_increment;
+--enable_query_log
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_binlog_cache_size.test b/mysql-test/suite/galera/t/galera_binlog_cache_size.test
new file mode 100644
index 00000000000..6ce9072d412
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_binlog_cache_size.test
@@ -0,0 +1,35 @@
+#
+# Test that Galera, like the stock MySQL, returns an error on transactions
+# larger than max_binlog_cache_size
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 VARCHAR(767)) ENGINE=InnoDB;
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+--let $max_binlog_cache_size_orig = `SELECT @@max_binlog_cache_size`
+--let $binlog_cache_size_orig = `SELECT @@binlog_cache_size`
+
+SET GLOBAL binlog_cache_size=4096;
+SET GLOBAL max_binlog_cache_size=4096;
+
+--let $galera_connection_name = node_1a
+--let $galera_server_number = 1
+--source include/galera_connect.inc
+--connection node_1a
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+INSERT INTO t1 SELECT REPEAT('a', 767) FROM ten;
+--error ER_TRANS_CACHE_FULL
+INSERT INTO t1 SELECT REPEAT('a', 767) FROM ten;
+
+--disable_query_log
+--eval SET GLOBAL max_binlog_cache_size = $max_binlog_cache_size_orig
+--eval SET GLOBAL binlog_cache_size = $binlog_cache_size_orig
+--enable_query_log
+
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/t/galera_binlog_checksum-master.opt b/mysql-test/suite/galera/t/galera_binlog_checksum-master.opt
new file mode 100644
index 00000000000..c8e53f07fc2
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_binlog_checksum-master.opt
@@ -0,0 +1 @@
+--binlog-checksum=CRC32 --master-verify-checksum=1 --slave-sql-verify-checksum=1
diff --git a/mysql-test/suite/galera/t/galera_binlog_checksum.test b/mysql-test/suite/galera/t/galera_binlog_checksum.test
new file mode 100644
index 00000000000..48669305242
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_binlog_checksum.test
@@ -0,0 +1,22 @@
+#
+# Test that Galera works with binary log checksums.
+# The galera_binlog_checksum-master.opt file is used to enable checksums.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+
+--connection node_1
+UPDATE t1 SET f1 = 2 WHERE f1 = 1;
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt
new file mode 100644
index 00000000000..a36d21315a6
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt
@@ -0,0 +1 @@
+--binlog-row-event-max-size=4294967295
diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.test b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.test
new file mode 100644
index 00000000000..600432ce0ca
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.test
@@ -0,0 +1,20 @@
+#
+# Test that replication works event with the maximum value of binlog-row-event-max-size - 4294967295 (on 32-bit platforms)
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+CREATE TABLE t1 (f1 VARCHAR(1000));
+
+# Insert 10K records, 1K bytes each
+INSERT INTO t1 SELECT REPEAT('x', 1000) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+
+--connection node_2
+SELECT COUNT(*) = 10000 FROM t1;
+
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_min-master.opt b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min-master.opt
new file mode 100644
index 00000000000..22174756652
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min-master.opt
@@ -0,0 +1 @@
+--binlog-row-event-max-size=256
diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.test b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.test
new file mode 100644
index 00000000000..00b55339770
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.test
@@ -0,0 +1,15 @@
+#
+# Test that replication works event with the minimum value of binlog-row-event-max-size - 256
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 VARCHAR(1000));
+INSERT INTO t1 VALUES (REPEAT('x', 1000));
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = REPEAT('x', 1000);
+
+DROP TABLE t1;
+
diff --git a/mysql-test/suite/galera/t/galera_binlog_row_image.test b/mysql-test/suite/galera/t/galera_binlog_row_image.test
new file mode 100644
index 00000000000..70262ec44ca
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_binlog_row_image.test
@@ -0,0 +1,100 @@
+#
+# Test the operation on the different values of the binlog_row_image option
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# binlog_row_image = minimal
+#
+
+--connection node_1
+SET SESSION binlog_row_image=minimal;
+
+# Create a table with a PK, with a unique key and with no key
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER NOT NULL UNIQUE) ENGINE=InnoDB;
+CREATE TABLE t3 (f1 VARCHAR(1)) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+INSERT INTO t3 VALUES (1);
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 1;
+SELECT COUNT(*) = 1 FROM t3 WHERE f1 = 1;
+
+--connection node_1
+UPDATE t1 SET f1 = 2 WHERE f1 = 1;
+UPDATE t2 SET f1 = 2 WHERE f1 = 1;
+UPDATE t3 SET f1 = 2 WHERE f1 = 1;
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 2;
+SELECT COUNT(*) = 1 FROM t3 WHERE f1 = 2;
+
+--connection node_1
+DELETE FROM t1;
+DELETE FROM t2;
+DELETE FROM t3;
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) = 0 FROM t2;
+SELECT COUNT(*) = 0 FROM t3;
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+
+#
+# binlog_row_image = noblob
+#
+
+# A table with only a blob, and a table with a PK and a blob
+
+--connection node_1
+SET SESSION binlog_row_image=noblob;
+
+CREATE TABLE t1 (f1 BLOB, f2 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 BLOB) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES ('abc', 1);
+INSERT INTO t2 VALUES ('abc');
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'abc';
+SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 'abc';
+
+--connection node_1
+UPDATE t1 SET f1 = 'xyz';
+UPDATE t2 SET f1 = 'xyz';
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'xyz';
+SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 'xyz';
+
+--connection node_1
+UPDATE t1 SET f2 = 2 WHERE f2 = 1;
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 2;
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'xyz';
+
+--connection node_1
+DELETE FROM t1;
+DELETE FROM t2;
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) = 0 FROM t2;
+
+DROP TABLE t1;
+DROP TABLE t2;
+
+
+
+
diff --git a/mysql-test/suite/galera/t/galera_binlog_rows_query_log_events.test b/mysql-test/suite/galera/t/galera_binlog_rows_query_log_events.test
new file mode 100644
index 00000000000..95bc85c4cab
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_binlog_rows_query_log_events.test
@@ -0,0 +1,28 @@
+#
+# Test that Galera continues to run even with binlog-rows-query-log-events=TRUE
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--let $binlog_rows_query_log_events_orig = `SELECT @@binlog_rows_query_log_events`
+
+SET GLOBAL binlog_rows_query_log_events=TRUE;
+
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+
+--connection node_1
+UPDATE t1 SET f1 = 2 WHERE f1 = 1;
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+
+--connection node_1
+--eval SET GLOBAL binlog_rows_query_log_events = $binlog_rows_query_log_events_orig
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_concurrent_ctas.test b/mysql-test/suite/galera/t/galera_concurrent_ctas.test
new file mode 100644
index 00000000000..f0dcf8e4900
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_concurrent_ctas.test
@@ -0,0 +1,57 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--write_file $MYSQLTEST_VARDIR/tmp/galera_concurrent.sql
+CREATE table t1 as SELECT SLEEP(0);
+DROP table t1;
+CREATE table t1 as SELECT SLEEP(0);
+DROP table t1;
+CREATE table t1 as SELECT SLEEP(0);
+DROP table t1;
+CREATE table t1 as SELECT SLEEP(0);
+DROP table t1;
+CREATE table t1 as SELECT SLEEP(0);
+DROP table t1;
+CREATE table t1 as SELECT SLEEP(0);
+DROP table t1;
+CREATE table t1 as SELECT SLEEP(0);
+DROP table t1;
+CREATE table t1 as SELECT SLEEP(0);
+DROP table t1;
+CREATE table t1 as SELECT SLEEP(0);
+CREATE table t2 as SELECT SLEEP(0);
+CREATE table t3 as SELECT SLEEP(0);
+CREATE table t4 as SELECT SLEEP(0);
+CREATE table t5 as SELECT SLEEP(0);
+CREATE table t6 as SELECT SLEEP(0);
+CREATE table t7 as SELECT SLEEP(0);
+CREATE table t8 as SELECT SLEEP(0);
+CREATE table t9 as SELECT SLEEP(0);
+DROP table t1;
+DROP table t2;
+DROP table t3;
+DROP table t4;
+DROP table t5;
+DROP table t6;
+DROP table t7;
+DROP table t8;
+DROP table t9;
+EOF
+
+let $run=10;
+
+while($run)
+{
+ --error 0,1
+ exec $MYSQL --user=root --host=127.0.0.1 --port=$NODE_MYPORT_1 test
+ < $MYSQLTEST_VARDIR/tmp/galera_concurrent.sql &
+ $MYSQL --user=root --host=127.0.0.1 --port=$NODE_MYPORT_2 test
+ < $MYSQLTEST_VARDIR/tmp/galera_concurrent.sql;
+ dec $run;
+}
+
+--remove_file $MYSQLTEST_VARDIR/tmp/galera_concurrent.sql
+
+--source include/galera_end.inc
+--echo # End of test
+
diff --git a/mysql-test/suite/galera/t/galera_create_function.test b/mysql-test/suite/galera/t/galera_create_function.test
new file mode 100644
index 00000000000..fd4903a7b83
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_create_function.test
@@ -0,0 +1,57 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test CREATE FUNCTION
+#
+
+--connection node_1
+CREATE USER 'user1';
+
+CREATE
+DEFINER = 'user1'
+FUNCTION f1 (param INTEGER)
+RETURNS VARCHAR(200)
+COMMENT 'f1_comment'
+LANGUAGE SQL
+NOT DETERMINISTIC
+MODIFIES SQL DATA
+SQL SECURITY DEFINER
+RETURN 'abc';
+GRANT EXECUTE ON FUNCTION f1 TO user1;
+
+CREATE
+DEFINER = CURRENT_USER
+FUNCTION f2 (param VARCHAR(100))
+RETURNS INTEGER
+DETERMINISTIC
+NO SQL
+SQL SECURITY INVOKER
+RETURN 123;
+
+--connection node_1
+SHOW CREATE FUNCTION f1;
+
+--connection node_2
+SHOW CREATE FUNCTION f1;
+
+--connection node_1
+SHOW CREATE FUNCTION f2;
+
+--connection node_2
+SHOW CREATE FUNCTION f2;
+
+SELECT f1(1) = 'abc';
+SELECT f2('abc') = 123;
+
+--connection node_1
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+
+DROP USER 'user1';
+
+
+
+
+
+
diff --git a/mysql-test/suite/galera/t/galera_create_procedure.test b/mysql-test/suite/galera/t/galera_create_procedure.test
new file mode 100644
index 00000000000..30bc85fcea0
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_create_procedure.test
@@ -0,0 +1,52 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test CREATE PROCEDURE
+#
+
+--connection node_1
+CREATE USER 'user1';
+CREATE TABLE t1 (f1 INTEGER);
+
+CREATE
+DEFINER = 'user1'
+PROCEDURE p1 (IN param1 INTEGER, OUT param2 INTEGER, INOUT param3 INTEGER)
+COMMENT 'p1_comment'
+LANGUAGE SQL
+NOT DETERMINISTIC
+MODIFIES SQL DATA
+SQL SECURITY DEFINER
+INSERT INTO t1 VALUES (1);
+GRANT EXECUTE ON PROCEDURE p1 TO user1;
+
+CREATE
+DEFINER = CURRENT_USER
+PROCEDURE p2 (param VARCHAR(100))
+DETERMINISTIC
+NO SQL
+SQL SECURITY INVOKER BEGIN END ;
+
+--connection node_1
+SHOW CREATE PROCEDURE p1;
+
+--connection node_2
+# Perform causal wait
+SELECT 1 FROM DUAL;
+SHOW CREATE PROCEDURE p1;
+
+--connection node_1
+SHOW CREATE PROCEDURE p2;
+
+--connection node_2
+SHOW CREATE PROCEDURE p2;
+
+CALL p1(@a, @b, @c);
+CALL p2('abc');
+
+--connection node_1
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+
+DROP USER 'user1';
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_create_table_like.test b/mysql-test/suite/galera/t/galera_create_table_like.test
new file mode 100644
index 00000000000..0e0e8b0ffcf
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_create_table_like.test
@@ -0,0 +1,50 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test the various forms of CREATE TABLE LIKE ... , since Galera has special handling
+# for them, especially when one of the tables is a temporary one.
+#
+
+CREATE SCHEMA schema1;
+CREATE SCHEMA schema2;
+
+USE schema1;
+CREATE TABLE real_table (f1 INTEGER) ENGINE=InnoDB;
+CREATE TEMPORARY TABLE temp_table (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE myisam_table (f1 INTEGER) ENGINE=MyISAM;
+
+USE schema2;
+CREATE TABLE real_table1 LIKE schema1.real_table;
+CREATE TABLE real_table2 LIKE schema1.temp_table;
+CREATE TABLE real_table3 LIKE schema1.myisam_table;
+
+CREATE TEMPORARY TABLE temp_table1 LIKE schema1.real_table;
+CREATE TEMPORARY TABLE temp_table2 LIKE schema1.temp_table;
+CREATE TEMPORARY TABLE temp_table3 LIKE schema1.myisam_table;
+
+--connection node_2
+# Only the non-temporary tables are replicated, regardless of the type of table they are based on
+
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'real_table' AND TABLE_SCHEMA = 'schema1';
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'myisam_table' AND TABLE_SCHEMA = 'schema1';
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'temp_table' AND TABLE_SCHEMA = 'schema1';
+
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'real_table1' AND TABLE_SCHEMA = 'schema2';
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'real_table2' AND TABLE_SCHEMA = 'schema2';
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'real_table3' AND TABLE_SCHEMA = 'schema2';
+
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'temp_table1' AND TABLE_SCHEMA = 'schema2';
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'temp_table2' AND TABLE_SCHEMA = 'schema2';
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'temp_table3' AND TABLE_SCHEMA = 'schema2';
+
+--connection node_1
+DROP TABLE schema1.real_table;
+DROP TABLE schema1.myisam_table;
+
+DROP TABLE schema2.real_table1;
+DROP TABLE schema2.real_table2;
+DROP TABLE schema2.real_table3;
+
+DROP SCHEMA schema1;
+DROP SCHEMA schema2;
diff --git a/mysql-test/suite/galera/t/galera_create_trigger.test b/mysql-test/suite/galera/t/galera_create_trigger.test
new file mode 100644
index 00000000000..6708e30bf0f
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_create_trigger.test
@@ -0,0 +1,43 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test CREATE TRIGGER, especially with different DEFINER
+#
+
+CREATE TABLE definer_root (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB;
+CREATE TABLE definer_user (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB;
+CREATE TABLE definer_current_user (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB;
+CREATE TABLE definer_default (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB;
+
+CREATE USER 'user1';
+CREATE DEFINER=root@localhost TRIGGER definer_root BEFORE INSERT ON definer_root FOR EACH ROW SET NEW.trigger_user = CURRENT_USER();
+CREATE DEFINER=user1 TRIGGER definer_user BEFORE INSERT ON definer_user FOR EACH ROW SET NEW.trigger_user = CURRENT_USER();
+CREATE DEFINER=current_user TRIGGER definer_current_user BEFORE INSERT ON definer_current_user FOR EACH ROW SET NEW.trigger_user = CURRENT_USER();
+CREATE TRIGGER definer_default BEFORE INSERT ON definer_default FOR EACH ROW SET NEW.trigger_user = CURRENT_USER();
+
+--connection node_2
+INSERT INTO definer_root (f1) VALUES (1);
+SELECT DEFINER = 'root@localhost' FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME = 'definer_root';
+SELECT trigger_user = 'root@localhost' FROM definer_root;
+
+INSERT INTO definer_user (f1) VALUES (1);
+SELECT DEFINER = 'user1@%' FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME = 'definer_user';
+SELECT trigger_user = 'user1@%' FROM definer_user;
+
+INSERT INTO definer_current_user (f1) VALUES (1);
+SELECT DEFINER = 'root@localhost' FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME = 'definer_current_user';
+SELECT trigger_user = 'root@localhost' FROM definer_current_user;
+
+INSERT INTO definer_default (f1) VALUES (1);
+SELECT DEFINER = 'root@localhost' FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME = 'definer_default';
+SELECT trigger_user = 'root@localhost' FROM definer_default;
+
+--connection node_1
+DROP TABLE definer_current_user;
+DROP TABLE definer_user;
+DROP TABLE definer_root;
+DROP TABLE definer_default;
+
+DROP USER 'user1';
+
diff --git a/mysql-test/suite/galera/t/galera_defaults.test b/mysql-test/suite/galera/t/galera_defaults.test
new file mode 100644
index 00000000000..1ef7c751859
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_defaults.test
@@ -0,0 +1,70 @@
+#
+# The purpose of this test is to preserve the current state of the following:
+# * SHOW VARIABLES LIKE 'wsrep%'
+# * wsrep_provider_options
+# * The names of the Galera status variables
+#
+# This way, if there is any change, inadvertent or not, the test will fail and the
+# developer and QA will be alerted.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+# Make sure that the test is operating on the right version of galera library.
+--disable_query_log
+--let $galera_version=3.9
+source ../wsrep/include/check_galera_version.inc;
+--enable_query_log
+
+# Global Variables
+
+SELECT COUNT(*) = 42 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';
+
+SELECT VARIABLE_NAME, VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME LIKE 'wsrep_%'
+AND VARIABLE_NAME NOT IN (
+ 'WSREP_PROVIDER_OPTIONS',
+ 'WSREP_SST_RECEIVE_ADDRESS',
+ 'WSREP_NODE_ADDRESS',
+ 'WSREP_NODE_NAME',
+ 'WSREP_PROVIDER',
+ 'WSREP_DATA_HOME_DIR',
+ 'WSREP_NODE_INCOMING_ADDRESS',
+ 'WSREP_START_POSITION'
+)
+ORDER BY VARIABLE_NAME;
+
+# wsrep_provider_options
+#
+# We replace the ones that vary from run to run with placeholders
+
+--let _WSREP_PROVIDER_OPTIONS = `SELECT @@wsrep_provider_options`
+--perl
+ use strict;
+ my $wsrep_provider_options = $ENV{'_WSREP_PROVIDER_OPTIONS'};
+ $wsrep_provider_options =~ s/base_dir = .*?;/<BASE_DIR>;/sgio;
+ $wsrep_provider_options =~ s/base_host = .*?;/<BASE_HOST>;/sgio;
+ $wsrep_provider_options =~ s/base_port = .*?;/<BASE_PORT>;/sgio;
+ $wsrep_provider_options =~ s/gcache\.dir = .*?;/<GCACHE_DIR>;/sgio;
+ $wsrep_provider_options =~ s/gcache\.name = .*?;/<GCACHE_NAME>;/sgio;
+ $wsrep_provider_options =~ s/gmcast\.listen_addr = .*?;/<GMCAST_LISTEN_ADDR>;/sgio;
+ $wsrep_provider_options =~ s/gcs\.recv_q_hard_limit = .*?;/<GCS_RECV_Q_HARD_LIMIT>;/sgio;
+ $wsrep_provider_options =~ s/ist\.recv_addr = .*?;/<IST_RECV_ADDR>;/sgio;
+ $wsrep_provider_options =~ s/evs\.evict = .*?;/<EVS_EVICT>;/sgio;
+ $wsrep_provider_options =~ s/signal = .*?;\s*//sgio;
+ $wsrep_provider_options =~ s/dbug = .*?;\s*//sgio;
+ print $wsrep_provider_options."\n";
+EOF
+
+# Global Status
+
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_STATUS
+WHERE VARIABLE_NAME LIKE 'wsrep_%'
+AND VARIABLE_NAME != 'wsrep_debug_sync_waiters';
+
+SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.GLOBAL_STATUS
+WHERE VARIABLE_NAME LIKE 'wsrep_%'
+AND VARIABLE_NAME != 'wsrep_debug_sync_waiters'
+ORDER BY VARIABLE_NAME;
diff --git a/mysql-test/suite/galera/t/galera_delete_limit.test b/mysql-test/suite/galera/t/galera_delete_limit.test
new file mode 100644
index 00000000000..4cbadbd3ba0
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_delete_limit.test
@@ -0,0 +1,52 @@
+#
+# DELETE LIMIT should not cause any issues with row-based Galera replication
+# regardless of the order in which the rows were deleted
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# With a PK
+#
+
+--connection node_1
+CREATE TABLE ten (f1 INTEGER) Engine=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+INSERT INTO t1 SELECT f1 FROM ten ORDER BY RAND();
+
+--connection node_2
+DELETE FROM t1 ORDER BY RAND() LIMIT 5;
+--let $sum_remaining = `SELECT SUM(f1) FROM t1`
+--let $max_remaining = `SELECT MAX(f1) FROM t1`
+
+--connection node_1
+--disable_query_log
+--eval SELECT (SELECT SUM(f1) FROM t1) = $sum_remaining AS sum_matches;
+--eval SELECT f1 = $max_remaining AS max_matches FROM t1 WHERE f1 = $max_remaining;
+--enable_query_log
+
+DROP TABLE t1;
+
+#
+# Without a PK
+#
+
+CREATE TABLE t2 (f1 INTEGER) Engine=InnoDB;
+INSERT INTO t2 SELECT f1 FROM ten ORDER BY RAND();
+
+--connection node_2
+DELETE FROM t2 ORDER BY RAND() LIMIT 5;
+--let $sum_remaining = `SELECT SUM(f1) FROM t2`
+--let $max_remaining = `SELECT MAX(f1) FROM t2`
+
+--connection node_1
+--disable_query_log
+--eval SELECT (SELECT SUM(f1) FROM t2) = $sum_remaining AS sum_matches;
+--eval SELECT f1 = $max_remaining AS max_matches FROM t2 WHERE f1 = $max_remaining;
+--enable_query_log
+
+DROP TABLE t2;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/t/galera_enum.test b/mysql-test/suite/galera/t/galera_enum.test
new file mode 100644
index 00000000000..ff5332486aa
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_enum.test
@@ -0,0 +1,62 @@
+#
+# Test the ENUM column type, as it is frequently an unwanted child
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# ENUM as key
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 ENUM('', 'one', 'two'), KEY (f1)) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES ('');
+INSERT INTO t1 VALUES ('one'), ('two');
+INSERT INTO t1 VALUES (0), (1), (2);
+
+--connection node_2
+SELECT COUNT(*) = 6 FROM t1;
+SELECT COUNT(*) = 2 FROM t1 where f1 = '';
+SELECT COUNT(*) = 2 FROM t1 where f1 = 'one';
+
+DROP TABLE t1;
+
+#
+# ENUM as PK
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 ENUM('', 'one', 'two', 'three', 'four') PRIMARY KEY) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (''), ('one'), ('two');
+
+--connection node_2
+SELECT COUNT(*) = 3 FROM t1;
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = '';
+
+# Conflict
+
+--connection node_1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'three' where f1 = '';
+
+--connection node_2
+SET AUTOCOMMIt=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'four' where f1 = '';
+
+--connection node_1
+COMMIT;
+
+--connection node_2
+--error ER_LOCK_DEADLOCK
+COMMIT;
+
+--connection node_1
+
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'three';
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_events.test b/mysql-test/suite/galera/t/galera_events.test
new file mode 100644
index 00000000000..ae9940fc694
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_events.test
@@ -0,0 +1,53 @@
+#
+# Test that the replication of MySQL events conforms to the behavior of stock MySQL replication as described here
+# http://dev.mysql.com/doc/refman/5.6/en/replication-features-invoked.html
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--let $event_scheduler_orig = `SELECT @@event_scheduler;`
+
+#
+# Events arrive on slave as SLAVESIDE_DISABLED
+#
+
+--connection node_1
+CREATE EVENT event1 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT 1;
+
+--connection node_2
+SELECT DEFINER= 'root@localhost', ORIGINATOR = 1, STATUS = 'SLAVESIDE_DISABLED', EVENT_TYPE = 'ONE TIME', ON_COMPLETION = 'NOT PRESERVE' FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event1';
+
+--connection node_1
+ALTER EVENT event1 DISABLE;
+
+--connection node_2
+# The definition on node 2 should still say SLAVESIDE_DISABLED
+SELECT DEFINER= 'root@localhost', ORIGINATOR = 1, STATUS = 'SLAVESIDE_DISABLED', EVENT_TYPE = 'ONE TIME', ON_COMPLETION = 'NOT PRESERVE' FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event1';
+
+#
+# Expired event should be dropped from the slave
+#
+
+--connection node_2
+SET GLOBAL event_scheduler = ON;
+CREATE EVENT event2 ON SCHEDULE AT CURRENT_TIMESTAMP ON COMPLETION NOT PRESERVE DO SELECT 1;
+--sleep 1
+
+--connection node_1
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event2';
+
+#
+# DROP EVENT causes event to be dropped everywhere
+#
+
+--connection node_1
+DROP EVENT event1;
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event1';
+
+# Cleanup
+
+--connection node_2
+--eval SET GLOBAL event_scheduler = $event_scheduler_orig;
diff --git a/mysql-test/suite/galera/t/galera_fk_multicolumn.test b/mysql-test/suite/galera/t/galera_fk_multicolumn.test
index fc00eadcf5f..ad42f65924d 100644
--- a/mysql-test/suite/galera/t/galera_fk_multicolumn.test
+++ b/mysql-test/suite/galera/t/galera_fk_multicolumn.test
@@ -8,21 +8,21 @@
CREATE TABLE t0 (
f1 INT PRIMARY KEY,
f2 INT UNIQUE
-) ENGINE=INNODB;
+);
CREATE TABLE t1 (
f1 INT PRIMARY KEY,
FOREIGN KEY (f1)
REFERENCES t0(f1)
ON UPDATE CASCADE
-) ENGINE=INNODB;
+);
CREATE TABLE t2 (
f2 INT PRIMARY KEY,
FOREIGN KEY (f2)
REFERENCES t0(f2)
ON UPDATE CASCADE
-) ENGINE=INNODB;
+);
INSERT INTO t0 VALUES (0, 0);
INSERT INTO t1 VALUES (0);
diff --git a/mysql-test/suite/galera/t/galera_fk_multitable.test b/mysql-test/suite/galera/t/galera_fk_multitable.test
index e53757b051b..6adfb8195ec 100644
--- a/mysql-test/suite/galera/t/galera_fk_multitable.test
+++ b/mysql-test/suite/galera/t/galera_fk_multitable.test
@@ -7,7 +7,7 @@
CREATE TABLE t0 (
f0 INT PRIMARY KEY
-) ENGINE=INNODB;
+);
CREATE TABLE t1 (
f1 INT PRIMARY KEY,
@@ -15,7 +15,7 @@ CREATE TABLE t1 (
FOREIGN KEY (f0)
REFERENCES t0(f0)
ON DELETE CASCADE
-) ENGINE=INNODB;
+);
INSERT INTO t0 VALUES (0), (1);
INSERT INTO t1 VALUES (0, 0);
diff --git a/mysql-test/suite/galera/t/galera_flush-master.opt b/mysql-test/suite/galera/t/galera_flush-master.opt
new file mode 100644
index 00000000000..5a1fb6748d9
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_flush-master.opt
@@ -0,0 +1 @@
+--query_cache_type=1 --query_cache_size=1000000
diff --git a/mysql-test/suite/galera/t/galera_flush.test b/mysql-test/suite/galera/t/galera_flush.test
new file mode 100644
index 00000000000..5845fadd562
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_flush.test
@@ -0,0 +1,107 @@
+#
+# Test that various FLUSH commands are replicated. Whenever possible, check the slave for the effects.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/have_perfschema.inc
+--source include/have_query_cache.inc
+
+#
+# The following FLUSH statements should be replicated
+#
+
+--connection node_2
+--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+--connection node_1
+FLUSH DES_KEY_FILE;
+--connection node_2
+--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+--disable_query_log
+--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff;
+--enable_query_log
+
+
+--connection node_2
+--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+--connection node_1
+FLUSH HOSTS;
+--connection node_2
+--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+--disable_query_log
+--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff;
+--enable_query_log
+
+--connection node_1
+SET GLOBAL wsrep_replicate_myisam = TRUE;
+INSERT INTO mysql.user VALUES('localhost','user1',PASSWORD('pass1'), '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,'mysql_native_password','','N','N','',0);
+FLUSH PRIVILEGES;
+--connect node_2a, 127.0.0.1, user1, pass1, test, $NODE_MYPORT_2
+--connection node_1
+DELETE FROM mysql.user WHERE user = 'user1';
+SET GLOBAL wsrep_replicate_myisam = FALSE;
+FLUSH PRIVILEGES;
+
+
+--connection node_2
+--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+--connection node_1
+FLUSH QUERY CACHE;
+--connection node_2
+--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+--disable_query_log
+--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff;
+--enable_query_log
+
+
+--connection node_2
+--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+--connection node_1
+FLUSH STATUS;
+
+--connection node_2
+--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+--disable_query_log
+--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff;
+--enable_query_log
+
+
+--connection node_2
+--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+--connection node_1
+FLUSH USER_RESOURCES;
+--connection node_2
+--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+--disable_query_log
+--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff;
+--enable_query_log
+
+
+#
+# The following statements should not be replicated: FLUSH LOGS, FLUSH TABLES
+#
+
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER);
+
+--connection node_2
+--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+--connection node_1
+FLUSH LOGS;
+FLUSH TABLES WITH READ LOCK;
+UNLOCK TABLES;
+FLUSH TABLES t1 WITH READ LOCK;
+UNLOCK TABLES;
+FLUSH TABLES t1 FOR EXPORT;
+UNLOCK TABLES;
+
+--connection node_2
+--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+--disable_query_log
+--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before AS wsrep_last_committed_diff;
+--enable_query_log
+
+--connection node_1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_ftwrl.test b/mysql-test/suite/galera/t/galera_ftwrl.test
new file mode 100644
index 00000000000..db9bd132566
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_ftwrl.test
@@ -0,0 +1,39 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# At this time, issing a FLUSH TABLES WITH READ LOCK causes SELECT and SHOW to hang if
+# casuality can not be ensured because another node issued a statement in the meantime
+# which could not be applied because FTWRL blocks the applier as well
+#
+# See LP bug 1271177
+#
+
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+
+--connection node_2
+--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options;`
+SET GLOBAL wsrep_provider_options = "repl.causal_read_timeout=PT1S";
+FLUSH TABLES WITH READ LOCK;
+
+--connection node_1
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+--error ER_LOCK_WAIT_TIMEOUT
+SHOW TABLES;
+
+--error ER_LOCK_WAIT_TIMEOUT
+SELECT * FROM t1;
+
+UNLOCK TABLES;
+
+SHOW TABLES;
+SELECT COUNT(*) = 1 FROM t1;
+
+--disable_query_log
+--eval SET GLOBAL wsrep_provider_options = "$wsrep_provider_options_orig";
+--enable_query_log
+
+DROP TABLE t1;
+
diff --git a/mysql-test/suite/galera/t/galera_fulltext.test b/mysql-test/suite/galera/t/galera_fulltext.test
new file mode 100644
index 00000000000..aa93a336f92
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_fulltext.test
@@ -0,0 +1,62 @@
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# InnoDB FULLTEXT indexes
+#
+
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+#
+# Fulltext index creation causes the creation of multiple system tables
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(100), FULLTEXT (f2)) ENGINE=InnoDB;
+
+--connection node_2
+SELECT COUNT(*) = 13 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name LIKE 'test/%';
+
+#
+# Fulltext insertion causes a flurry of updates on those system tables
+#
+
+--connection node_1
+# Insert 10K rows
+INSERT INTO t1 (f2) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+
+--connection node_2
+SELECT COUNT(f2) = 10000 FROM t1 WHERE MATCH(f2) AGAINST ('foobarbaz');
+
+UPDATE t1 SET f2 = 'abcdefjhk';
+
+--connection node_1
+SELECT COUNT(f2) = 10000 FROM t1 WHERE MATCH(f2) AGAINST ('abcdefjhk');
+
+--connection node_2
+
+DROP TABLE t1;
+
+#
+# Same on a table with no PK
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 VARCHAR(100), FULLTEXT (f1)) ENGINE=InnoDB;
+
+--connection node_2
+# We insert only 1K rows here, because updates without a PK are very slow
+INSERT INTO t1 (f1) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3;
+
+--connection node_1
+SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('foobarbaz');
+
+UPDATE t1 SET f1 = 'abcdefjhk';
+
+--connection node_2
+SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('abcdefjhk');
+
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/t/galera_gcs_fc_limit.test b/mysql-test/suite/galera/t/galera_gcs_fc_limit.test
new file mode 100644
index 00000000000..e15da0e35ad
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_gcs_fc_limit.test
@@ -0,0 +1,52 @@
+#
+# Test that under gcs.fc_limit=1 on the slave, transactions on the master can not commit.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options`
+SET GLOBAL wsrep_provider_options = 'gcs.fc_limit=1';
+
+# Block the slave applier thread
+FLUSH TABLES WITH READ LOCK;
+
+--connection node_1
+
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+
+# This query will hang because flow control will kick in
+--send
+INSERT INTO t1 VALUES (5);
+--sleep 1
+
+--let $galera_connection_name = node_1a
+--let $galera_server_number = 1
+--source include/galera_connect.inc
+--connection node_1a
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'query end' AND INFO = 'INSERT INTO t1 VALUES (5)';
+
+--connection node_2
+# Unblock the slave applier thread
+UNLOCK TABLES;
+
+--connection node_1
+--reap
+
+INSERT INTO t1 VALUES (6);
+
+--connection node_2
+# Replication catches up and continues normally
+SELECT COUNT(*) = 6 FROM t1;
+
+--disable_query_log
+--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig';
+--enable_query_log
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_gcs_max_packet_size.cnf b/mysql-test/suite/galera/t/galera_gcs_max_packet_size.cnf
new file mode 100644
index 00000000000..6bb11e5957a
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_gcs_max_packet_size.cnf
@@ -0,0 +1,5 @@
+!include ../galera_2nodes.cnf
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcs.max_packet_size=64;gcache.size=10M'
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcs.max_packet_size=64;gcache.size=10M'
diff --git a/mysql-test/suite/galera/t/galera_gcs_max_packet_size.test b/mysql-test/suite/galera/t/galera_gcs_max_packet_size.test
new file mode 100644
index 00000000000..cafd8acfdd9
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_gcs_max_packet_size.test
@@ -0,0 +1,25 @@
+#
+# Test fragmentation by setting gcs.max_packet_size to a low value
+# The actual setting is performed in galera_gcs_max_packet_size.cnf
+# as gcs.max_packet_size is not a dynamic variable
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+
+CREATE TABLE t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 VARCHAR(512) UNIQUE) ENGINE=InnoDB;
+
+INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+INSERT INTO t2 VALUES (REPEAT('x', 512));
+
+--connection node_2
+SELECT COUNT(*) = 10000 FROM t1;
+SELECT LENGTH(f1) = 512 FROM t2 WHERE f1 = REPEAT('x', 512);
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/t/galera_gtid-master.opt b/mysql-test/suite/galera/t/galera_gtid-master.opt
new file mode 100644
index 00000000000..8a755e98b00
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_gtid-master.opt
@@ -0,0 +1 @@
+--log-bin --log-slave-updates
diff --git a/mysql-test/suite/galera/t/galera_gtid.test b/mysql-test/suite/galera/t/galera_gtid.test
new file mode 100644
index 00000000000..e8369be62e6
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_gtid.test
@@ -0,0 +1,27 @@
+#
+# Test GTID for basic Galera operations
+#
+
+--source include/have_log_bin.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 INT PRIMARY KEY);
+
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+
+UPDATE t1 SET f1 = 2;
+
+--let $gtid_binlog_state_node2 = `SELECT @@global.gtid_binlog_state;`
+
+--connection node_1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+
+--disable_query_log
+--eval SELECT '$gtid_binlog_state_node2' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
+--enable_query_log
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_insert_ignore.test b/mysql-test/suite/galera/t/galera_insert_ignore.test
new file mode 100644
index 00000000000..4b4b0a6e9fb
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_insert_ignore.test
@@ -0,0 +1,60 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--let $wsrep_sync_wait_orig = (SELECT @@wsrep_sync_wait)
+SET GLOBAL wsrep_sync_wait = 7;
+
+--connection node_2
+SET GLOBAL wsrep_sync_wait = 7;
+
+
+#
+# INSERT IGNORE with PRIMARY KEY
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+INSERT IGNORE INTO t1 VALUES (1), (2);
+SELECT * FROM t1;
+
+--connection node_2
+SELECT * FROM t1;
+
+#
+# INSERT IGNORE ... SELECT
+#
+
+--connection node_2
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (0), (2), (3);
+INSERT IGNORE INTO t1 SELECT f1 FROM t2;
+
+SELECT * FROM t1;
+--connection node_1
+SELECT * FROM t1;
+
+#
+# INSERT IGNORE with UNIQUE + NULLs
+#
+
+--connection node_2
+CREATE TABLE t3 (f1 INTEGER UNIQUE) Engine=InnoDB;
+INSERT INTO t3 VALUES (NULL);
+
+--connection node_1
+INSERT IGNORE INTO t3 VALUES (1), (NULL), (2);
+SELECT * FROM t3;
+
+--connection node_2
+SELECT * FROM t3;
+
+--eval SET GLOBAL wsrep_sync_wait = $wsrep_sync_wait_orig
+
+--connection node_1
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+--eval SET GLOBAL wsrep_sync_wait = $wsrep_sync_wait_orig
+
diff --git a/mysql-test/suite/galera/t/galera_insert_multi.test b/mysql-test/suite/galera/t/galera_insert_multi.test
new file mode 100644
index 00000000000..d62283aff69
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_insert_multi.test
@@ -0,0 +1,122 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Multi-row INSERT with a PK
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+
+--connection node_2
+INSERT INTO t1 VALUES (3),(4);
+
+--connection node_1
+SELECT COUNT(*) = 4 FROM t1;
+
+--connection node_2
+SELECT COUNT(*) = 4 FROM t1;
+
+DROP TABLE t1;
+
+#
+# Multi-row INSERT without a PK
+#
+
+--connection node_2
+CREATE TABLE t1 (f1 INTEGER, KEY (f1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(1);
+
+--connection node_1
+INSERT INTO t1 VALUES (2),(2);
+
+--connection node_2
+SELECT COUNT(*) = 4 FROM t1;
+
+--connection node_1
+SELECT COUNT(*) = 4 FROM t1;
+
+DROP TABLE t1;
+
+#
+# Error in the middle of a multi-row INSERT
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+--error ER_DUP_ENTRY
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (1);
+
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM t1;
+
+DROP TABLE t1;
+
+#
+# Deadlock
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+SET AUTOCOMMIT = OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1), (2);
+
+--connection node_2
+SET AUTOCOMMIT = OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (2), (1);
+
+--connection node_1
+COMMIT;
+
+--connection node_2
+--error ER_LOCK_DEADLOCK
+COMMIT;
+
+# Workaround for mysql-wsrep#39 Transaction receives deadlock error twice in row
+--error 0,ER_LOCK_DEADLOCK
+ROLLBACK;
+
+--error ER_DUP_ENTRY
+INSERT INTO t1 VALUES (1), (2);
+
+DROP TABLE t1;
+
+#
+# Rollback
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+START TRANSACTION;
+INSERT INTO t1 VALUES (1), (2);
+
+--connection node_2
+START TRANSACTION;
+INSERT INTO t1 VALUES (2), (1);
+
+--connection node_1
+ROLLBACK;
+
+--connection node_2
+COMMIT;
+SELECT COUNT(*) = 2 FROM t1;
+
+--connection node_1
+SELECT COUNT(*) = 2 FROM t1;
+
+DROP TABLE t1;
+
+
+
+
+
+
+
diff --git a/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.cnf b/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.cnf
new file mode 100644
index 00000000000..85245ff464a
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.cnf
@@ -0,0 +1,12 @@
+!include ../galera_2nodes.cnf
+
+[mysqld]
+wsrep_sst_method=xtrabackup-v2
+innodb_flush_log_at_trx_commit=0
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true'
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true'
+
diff --git a/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.test b/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.test
new file mode 100644
index 00000000000..07838702deb
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.test
@@ -0,0 +1,12 @@
+#
+# This test performs server kill and IST while innodb_flush_logs_on_trx_commit = 0
+# This confirms that IST can properly catch up even in the face of relaxed single-node durability
+#
+#
+
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--source suite/galera/include/galera_st_kill_slave.inc
+--source suite/galera/include/galera_st_kill_slave_ddl.inc
diff --git a/mysql-test/suite/galera/t/galera_ist_mysqldump.cnf b/mysql-test/suite/galera/t/galera_ist_mysqldump.cnf
new file mode 100644
index 00000000000..db6b7d5e129
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_ist_mysqldump.cnf
@@ -0,0 +1,11 @@
+!include ../galera_2nodes.cnf
+
+# We do not set mysqldump-related SST options here because doing so on startup
+# causes the first MTR connection to be forefully dropped by Galera, which in turn confuses MTR
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true'
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true'
+
diff --git a/mysql-test/suite/galera/t/galera_ist_mysqldump.test b/mysql-test/suite/galera/t/galera_ist_mysqldump.test
new file mode 100644
index 00000000000..a9ff8c41f06
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_ist_mysqldump.test
@@ -0,0 +1,17 @@
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--source suite/galera/include/galera_sst_set_mysqldump.inc
+
+# mysql-wsrep#33 - nnoDB: Failing assertion: xid_seqno > trx_sys_cur_xid_seqno in trx_sys_update_wsrep_checkpoint with mysqldump IST
+# --source suite/galera/include/galera_st_disconnect_slave.inc
+
+# We set the required mysqldump SST options here so that they are used every time the server is restarted during the test
+--let $start_mysqld_params = --wsrep_sst_auth=sst:sst --wsrep_sst_method=mysqldump --wsrep-sst-receive-address=127.0.0.1:$NODE_MYPORT_2 --skip-grant-tables
+
+--source suite/galera/include/galera_st_shutdown_slave.inc
+--source suite/galera/include/galera_st_kill_slave.inc
+--source suite/galera/include/galera_st_kill_slave_ddl.inc
+
+--source suite/galera/include/galera_sst_restore.inc
diff --git a/mysql-test/suite/galera/t/galera_ist_restart_joiner.cnf b/mysql-test/suite/galera/t/galera_ist_restart_joiner.cnf
new file mode 100644
index 00000000000..10958aad9a8
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_ist_restart_joiner.cnf
@@ -0,0 +1,4 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true'
diff --git a/mysql-test/suite/galera/t/galera_ist_restart_joiner.test b/mysql-test/suite/galera/t/galera_ist_restart_joiner.test
new file mode 100644
index 00000000000..69446f0f86a
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_ist_restart_joiner.test
@@ -0,0 +1,106 @@
+#
+# Test that a joiner performing IST can be killed and restarted with no adverse consequences.
+# This is achieved by using the recv_IST_after_apply_trx Galera dbug sync point to block IST after
+# one transaction has been applied. When IST blocks, we kill and restart the joiner
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/have_debug_sync.inc
+--source suite/galera/include/galera_have_debug_sync.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+INSERT INTO t1 VALUES (1, 'a'), (2, 'a'), (3, 'a'), (4, 'a'), (5, 'a'),(6, 'a');
+
+# Disconnect node #2
+--connection node_2
+--source suite/galera/include/galera_unload_provider.inc
+
+--connection node_1
+UPDATE t1 SET f2 = 'b' WHERE f1 > 1;
+
+# Wait until node #1 has left
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+UPDATE t1 SET f2 = 'c' WHERE f1 > 2;
+
+--connection node_2
+# Make sure IST will block ...
+SET GLOBAL wsrep_provider_options = 'dbug=d,recv_IST_after_apply_trx';
+SET SESSION wsrep_sync_wait = 0;
+
+
+# Write file to make mysql-test-run.pl expect the crash, but don't start it
+--let $_server_id= `SELECT @@server_id`
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
+--exec echo "wait" > $_expect_file_name
+
+--let KILL_NODE_PIDFILE = `SELECT @@pid_file`
+
+# ... and restart provider to force IST
+--echo Loading wsrep_provider ...
+--disable_query_log
+--eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig';
+--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig';
+--enable_query_log
+
+# We can not use a wait_condition on SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS as such queries are blocked during IST
+# so we perform a simple sleep and SHOW instead
+
+--sleep 5
+SHOW STATUS LIKE 'wsrep_debug_sync_waiters';
+
+--connection node_1
+# Perform DML and DDL while IST is in progress
+--connection node_1
+UPDATE t1 SET f2 = 'd' WHERE f1 > 3;
+CREATE TABLE t2 (f1 INTEGER);
+
+# Kill node #2 while IST is in progress
+--connection node_2
+
+# Kill the connected server
+--disable_reconnect
+
+--perl
+ my $pid_filename = $ENV{'KILL_NODE_PIDFILE'};
+ my $mysqld_pid = `cat $pid_filename`;
+ chomp($mysqld_pid);
+ system("kill -9 $mysqld_pid");
+ exit(0);
+EOF
+
+--source include/wait_until_disconnected.inc
+
+--connection node_1
+--source include/wait_until_connected_again.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+# Perform DML and DDL while node #2 is down
+UPDATE t1 SET f2 = 'e' WHERE f1 > 4;
+CREATE TABLE t3 (f1 INTEGER);
+
+--connection node_2
+
+--let $galera_wsrep_recover_server_id=2
+--source suite/galera/include/galera_wsrep_recover.inc
+
+--echo Starting server ...
+--source include/start_mysqld.inc
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+--connection node_1
+UPDATE t1 SET f2 = 'f' WHERE f1 > 5;
+SELECT * FROM t1;
+
+--connection node_2
+SELECT * FROM t1;
+SELECT COUNT(*) = 0 FROM t2;
+SELECT COUNT(*) = 0 FROM t3;
+
+--connection node_1
+DROP TABLE t1, t2, t3;
diff --git a/mysql-test/suite/galera/t/galera_ist_rsync.cnf b/mysql-test/suite/galera/t/galera_ist_rsync.cnf
new file mode 100644
index 00000000000..bbe0f6047fb
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_ist_rsync.cnf
@@ -0,0 +1,11 @@
+!include ../galera_2nodes.cnf
+
+[mysqld]
+wsrep_sst_method=rsync
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true'
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true'
+
diff --git a/mysql-test/suite/galera/t/galera_ist_rsync.test b/mysql-test/suite/galera/t/galera_ist_rsync.test
new file mode 100644
index 00000000000..41d1a0c1fc2
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_ist_rsync.test
@@ -0,0 +1,8 @@
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--source suite/galera/include/galera_st_disconnect_slave.inc
+--source suite/galera/include/galera_st_shutdown_slave.inc
+--source suite/galera/include/galera_st_kill_slave.inc
+--source suite/galera/include/galera_st_kill_slave_ddl.inc
diff --git a/mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.cnf b/mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.cnf
new file mode 100644
index 00000000000..21e597445a8
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.cnf
@@ -0,0 +1,11 @@
+!include ../galera_2nodes.cnf
+
+[mysqld]
+wsrep_sst_method=xtrabackup-v2
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true'
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true'
+
diff --git a/mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.test b/mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.test
new file mode 100644
index 00000000000..8b399e77794
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.test
@@ -0,0 +1,9 @@
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--source suite/galera/include/galera_st_disconnect_slave.inc
+--source suite/galera/include/galera_st_shutdown_slave.inc
+
+--source suite/galera/include/galera_st_kill_slave.inc
+--source suite/galera/include/galera_st_kill_slave_ddl.inc
diff --git a/mysql-test/suite/galera/t/galera_kill_ddl.test b/mysql-test/suite/galera/t/galera_kill_ddl.test
new file mode 100644
index 00000000000..3c2bce5b9c9
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_kill_ddl.test
@@ -0,0 +1,39 @@
+#
+# This test kill -9-s a slave while small updates have been performed on the master.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+
+# Enable the master to continue running during the split-brain situation that
+# occurs when the slave is killed
+--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options`
+SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+
+--connection node_2
+--source include/kill_galera.inc
+
+--connection node_1
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+
+--connection node_2
+--source include/start_mysqld.inc
+
+--let $galera_connection_name = node_2a
+--let $galera_server_number = 2
+--source include/galera_connect.inc
+--connection node_2a
+
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1';
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+--connection node_1
+--disable_query_log
+--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig';
+--enable_query_log
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_kill_largechanges.test b/mysql-test/suite/galera/t/galera_kill_largechanges.test
new file mode 100644
index 00000000000..e9a32ce813b
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_kill_largechanges.test
@@ -0,0 +1,43 @@
+#
+# This test kill -9-s a slave while a large update has been performed on the master. SST is performed.
+#
+
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+# Enable the master to continue running during the split-brain situation that
+# occurs when the slave is killed
+--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options`
+SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
+
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+CREATE TABLE t1 (f1 VARCHAR(128)) ENGINE=InnoDB;
+
+--connection node_2
+--source include/kill_galera.inc
+
+--connection node_1
+# We create a 128Mb (or so) transaction that is larger than gcache. The size of the gcache is not adjustable dynamically
+INSERT INTO t1 SELECT REPEAT('a', 128) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;
+
+--connection node_2
+--source include/start_mysqld.inc
+
+--let $galera_connection_name = node_2a
+--let $galera_server_number = 2
+--source include/galera_connect.inc
+--connection node_2a
+
+SELECT COUNT(*) = 1000000 FROM t1;
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+--connection node_1
+--disable_query_log
+--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig';
+--enable_query_log
+
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/t/galera_kill_nochanges.test b/mysql-test/suite/galera/t/galera_kill_nochanges.test
new file mode 100644
index 00000000000..1903df449e4
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_kill_nochanges.test
@@ -0,0 +1,24 @@
+#
+# This test kill -9-s a slave while no updates have been performed on the master.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+--source include/kill_galera.inc
+--source include/start_mysqld.inc
+
+--let $galera_connection_name = node_2a
+--let $galera_server_number = 2
+--source include/galera_connect.inc
+--connection node_2a
+
+SELECT COUNT(*) = 1 FROM t1;
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_kill_smallchanges.test b/mysql-test/suite/galera/t/galera_kill_smallchanges.test
new file mode 100644
index 00000000000..d998032cbc3
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_kill_smallchanges.test
@@ -0,0 +1,39 @@
+#
+# This test kill -9-s a slave while small updates have been performed on the master.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+
+# Enable the master to continue running during the split-brain situation that
+# occurs when the slave is killed
+--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options`
+SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+
+--connection node_2
+--source include/kill_galera.inc
+
+--connection node_1
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+--source include/start_mysqld.inc
+
+--let $galera_connection_name = node_2a
+--let $galera_server_number = 2
+--source include/galera_connect.inc
+--connection node_2a
+
+SELECT COUNT(*) = 1 FROM t1;
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+--connection node_1
+--disable_query_log
+--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig';
+--enable_query_log
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_lock_table.test b/mysql-test/suite/galera/t/galera_lock_table.test
new file mode 100644
index 00000000000..bd581842f6f
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_lock_table.test
@@ -0,0 +1,43 @@
+#
+# Test that a LOCK TABLE on the slave will cause the applier thread to block, so no subsequent updates
+# are replicated on the slave until UNLOCK TABLE is issued.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--let $wsrep_sync_wait_orig = `SELECT @@wsrep_sync_wait`
+
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB;
+
+--connection node_2
+LOCK TABLE t1 READ;
+
+--connection node_1
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+# We use a separate connection here so that we can SELECT from both tables
+# without running into "table t2 was not locked" error.
+
+--let $galera_connection_name = node_2a
+--let $galera_server_number = 2
+--source include/galera_connect.inc
+--connection node_2a
+SET SESSION wsrep_sync_wait=0;
+SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) = 0 FROM t2;
+
+--connection node_2
+UNLOCK TABLES;
+
+--disable_query_log
+--eval SET SESSION wsrep_sync_wait=$wsrep_sync_wait_orig;
+--enable_query_log
+
+SELECT COUNT(*) = 1 FROM t1;
+SELECT COUNT(*) = 1 FROM t2;
+
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/t/galera_log_bin-master.opt b/mysql-test/suite/galera/t/galera_log_bin-master.opt
new file mode 100644
index 00000000000..8a755e98b00
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_log_bin-master.opt
@@ -0,0 +1 @@
+--log-bin --log-slave-updates
diff --git a/mysql-test/suite/galera/t/galera_log_bin.test b/mysql-test/suite/galera/t/galera_log_bin.test
new file mode 100644
index 00000000000..e36bd7e6025
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_log_bin.test
@@ -0,0 +1,35 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test Galera with --log-bin --log-slave-updates .
+# This way the actual MySQL binary log is used,
+# rather than Galera's own implementation
+#
+
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+CREATE TABLE t2 (id INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+SELECT COUNT(*) = 2 FROM t2;
+
+--connection node_1
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+
+FLUSH LOGS;
+--replace_column 2 # 4 # 5 #
+SHOW BINLOG EVENTS IN 'mysqld-bin.000002' LIMIT 4,18;
+
+--connection node_2
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+--replace_column 2 # 4 # 5 #
+SHOW BINLOG EVENTS IN 'mysqld-bin.000003' LIMIT 3,18;
+
+DROP TABLE t1;
+DROP TABLE t2;
+
diff --git a/mysql-test/suite/galera/t/galera_log_output_csv-master.opt b/mysql-test/suite/galera/t/galera_log_output_csv-master.opt
new file mode 100644
index 00000000000..2f71b140b65
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_log_output_csv-master.opt
@@ -0,0 +1 @@
+--log-output=TABLE --log-queries-not-using-indexes --general-log --slow-query-log
diff --git a/mysql-test/suite/galera/t/galera_log_output_csv.test b/mysql-test/suite/galera/t/galera_log_output_csv.test
new file mode 100644
index 00000000000..00009396f6a
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_log_output_csv.test
@@ -0,0 +1,27 @@
+#
+# Test that --log-output=FILE works with Galera.
+# The relevant options are set using a -master.opt file
+# wsrep_replicate_myisam is not used as it crashes in MTR with mysql-wsrep#14
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+SELECT COUNT(*) > 0 FROM mysql.general_log;
+
+SELECT 1 = 1 FROM t1;
+SELECT COUNT(*) = 1 FROM mysql.slow_log WHERE sql_text = 'SELECT 1 = 1 FROM t1';
+
+--connection node_2
+
+# CREATE TABLE from master is also present in the slave query log, but is logged twice, mysql-wsrep#44
+SELECT COUNT(*) > 0 FROM mysql.general_log WHERE argument = 'CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB';
+
+SELECT 2 = 2 FROM t1;
+SELECT COUNT(*) = 1 FROM mysql.slow_log WHERE sql_text = 'SELECT 2 = 2 FROM t1';
+
+--connection node_1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_many_columns.test b/mysql-test/suite/galera/t/galera_many_columns.test
index 09bd9902e81..3f596179c01 100644
--- a/mysql-test/suite/galera/t/galera_many_columns.test
+++ b/mysql-test/suite/galera/t/galera_many_columns.test
@@ -2,20 +2,18 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
-CREATE TABLE t1 (f1017 VARCHAR(3) DEFAULT 'ABC') ENGINE=InnoDB;
-
---let $count = 1016
+--disable_query_log
+SET @create_var1 = "";
+--let $count = 1017
while ($count)
{
- --disable_query_log
- --eval SET @ddl_var1 = CONCAT("ALTER TABLE t1 ADD COLUMN f", $count, " VARCHAR(3) DEFAULT 'ABC'")
- --let $ddl_var = `SELECT @ddl_var1`
- --enable_query_log
- --eval $ddl_var
+ --eval SET @create_var1 = CONCAT(@create_var1, "f", $count, " VARCHAR(3) DEFAULT 'ABC', ")
--dec $count
}
-ALTER TABLE t1 ADD PRIMARY KEY (f1, f1017);
+--let $create_var = `SELECT @create_var1`
+--eval CREATE TABLE t1 ($create_var PRIMARY KEY (f1, f1017)) ENGINE=InnoDB;
+--enable_query_log
INSERT INTO t1 (f1) VALUES (DEFAULT);
diff --git a/mysql-test/suite/galera/t/galera_many_rows.test b/mysql-test/suite/galera/t/galera_many_rows.test
index 5ec1af0a8bf..0f4c4c0db78 100644
--- a/mysql-test/suite/galera/t/galera_many_rows.test
+++ b/mysql-test/suite/galera/t/galera_many_rows.test
@@ -3,7 +3,7 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
-CREATE TABLE ten (f1 INTEGER) ENGINE=INNODB;
+CREATE TABLE ten (f1 INTEGER);
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB;
diff --git a/mysql-test/suite/galera/t/galera_many_tables_nopk.test b/mysql-test/suite/galera/t/galera_many_tables_nopk.test
new file mode 100644
index 00000000000..2496d145c93
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_many_tables_nopk.test
@@ -0,0 +1,103 @@
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# This test forces 1K tables without a PK to participate in a single transaction
+#
+
+#
+# First, create 1K tables
+#
+
+--connection node_1
+
+--let $count = 1000
+while ($count)
+{
+ --disable_query_log
+ --let $ddl_var = `SELECT CONCAT("CREATE TABLE t", $count, " (f1 INTEGER) ENGINE=InnoDB")`
+ --eval $ddl_var
+ --enable_query_log
+ --dec $count
+}
+
+--let $count = 1000
+while ($count)
+{
+ --disable_query_log
+ --let $ddl_var = `SELECT CONCAT("INSERT INTO t", $count, " VALUES (1234)")`
+ --eval $ddl_var
+ --enable_query_log
+ --dec $count
+}
+
+#
+# Second, perform 1K updates
+#
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+--let $count = 1000
+while ($count)
+{
+ --disable_query_log
+ --let $ddl_var = `SELECT CONCAT("UPDATE t", $count, " SET f1 = 1")`
+ --eval $ddl_var
+ --enable_query_log
+ --dec $count
+}
+
+COMMIT;
+
+# Third, confirm that all the inserts have arrived on the second node
+#
+
+--connection node_2
+CREATE TABLE sum_table (f1 INTEGER);
+
+--let $count = 1000
+while ($count)
+{
+ --disable_query_log
+ --let $ddl_var = `SELECT CONCAT("INSERT INTO sum_table SELECT COUNT(*) FROM t", $count)`
+ --eval $ddl_var
+ --enable_query_log
+ --dec $count
+}
+
+SELECT SUM(f1) = 1000 FROM sum_table;
+
+#
+# Fourth, create a deadlock
+#
+
+--connection node_1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+--let $count = 1000
+while ($count)
+{
+ --disable_query_log
+ --let $ddl_var = `SELECT CONCAT("UPDATE t", $count, " SET f1 = 2")`
+ --eval $ddl_var
+ --enable_query_log
+ --dec $count
+}
+
+--connection node_2
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1000 SET f1 = 3;
+
+--connection node_1
+COMMIT;
+
+--connection node_2
+--error ER_LOCK_DEADLOCK
+COMMIT;
+
+DROP SCHEMA test;
+CREATE SCHEMA test;
diff --git a/mysql-test/suite/galera/t/galera_many_tables_pk.test b/mysql-test/suite/galera/t/galera_many_tables_pk.test
new file mode 100644
index 00000000000..886cb7c1a00
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_many_tables_pk.test
@@ -0,0 +1,98 @@
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# This test forces 1K tables with a PK to participate in a single transaction
+#
+
+#
+# First, create 1K tables and make sure the DDLs are all propagated
+#
+
+--connection node_1
+
+--let $count = 1000
+while ($count)
+{
+ --disable_query_log
+ --let $ddl_var = `SELECT CONCAT("CREATE TABLE t", $count, " (f1 INTEGER AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB")`
+ --eval $ddl_var
+ --enable_query_log
+ --dec $count
+}
+
+--connection node_2
+SELECT COUNT(*) = 1000 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME LIKE 't%';
+
+#
+# Second, create a transaction that uses all those tables
+#
+
+--connection node_1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+--let $count = 1000
+while ($count)
+{
+ --disable_query_log
+ --let $ddl_var = `SELECT CONCAT("INSERT INTO t", $count, " VALUES (DEFAULT)")`
+ --eval $ddl_var
+ --enable_query_log
+ --dec $count
+}
+
+COMMIT;
+
+#
+# Third, confirm that all the inserts have arrived on the second node
+#
+
+--connection node_2
+CREATE TABLE sum_table (f1 INTEGER);
+
+--let $count = 1000
+while ($count)
+{
+ --disable_query_log
+ --let $ddl_var = `SELECT CONCAT("INSERT INTO sum_table SELECT COUNT(*) FROM t", $count)`
+ --eval $ddl_var
+ --enable_query_log
+ --dec $count
+}
+
+SELECT SUM(f1) = 1000 FROM sum_table;
+
+#
+# Fourth, create a deadlock
+#
+
+--connection node_1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+--let $count = 1000
+while ($count)
+{
+ --disable_query_log
+ --let $ddl_var = `SELECT CONCAT("UPDATE t", $count, " SET f1 = 2")`
+ --eval $ddl_var
+ --enable_query_log
+ --dec $count
+}
+
+--connection node_2
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1000 SET f1 = 3;
+
+--connection node_1
+COMMIT;
+
+--connection node_2
+--error ER_LOCK_DEADLOCK
+COMMIT;
+
+DROP SCHEMA test;
+CREATE SCHEMA test;
diff --git a/mysql-test/suite/galera/t/galera_migrate.cnf b/mysql-test/suite/galera/t/galera_migrate.cnf
new file mode 100644
index 00000000000..47bdf53afef
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_migrate.cnf
@@ -0,0 +1,59 @@
+#
+# This .cnf file starts 4 servers without enabling Galera.
+# The galera_migrate.test will set wsrep_provider and the other settings as needed.
+#
+
+!include include/default_mysqld.cnf
+
+[mysqld]
+binlog-format=row
+innodb_autoinc_lock_mode=2
+innodb_flush_log_at_trx_commit=2
+log-bin=mysqld-bin
+
+wsrep_node_address=127.0.0.1
+wsrep_causal_reads=ON
+wsrep_sync_wait = 7
+
+[mysqld.1]
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+
+[mysqld.2]
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+
+[mysqld.3]
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+
+[mysqld.4]
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+
+[ENV]
+NODE_MYPORT_1= @mysqld.1.port
+NODE_MYSOCK_1= @mysqld.1.socket
+
+NODE_MYPORT_2= @mysqld.2.port
+NODE_MYSOCK_2= @mysqld.2.socket
+
+NODE_MYPORT_3= @mysqld.3.port
+NODE_MYSOCK_3= @mysqld.3.socket
+
+NODE_MYPORT_4= @mysqld.4.port
+NODE_MYSOCK_4= @mysqld.4.socket
+
+NODE_GALERAPORT_1= @mysqld.1.#galera_port
+NODE_GALERAPORT_2= @mysqld.2.#galera_port
+NODE_GALERAPORT_3= @mysqld.3.#galera_port
+NODE_GALERAPORT_4= @mysqld.4.#galera_port
+
+NODE_SSTPORT_1= @mysqld.1.#sst_port
+NODE_SSTPORT_2= @mysqld.2.#sst_port
+NODE_SSTPORT_3= @mysqld.3.#sst_port
+NODE_SSTPORT_4= @mysqld.4.#sst_port
diff --git a/mysql-test/suite/galera/t/galera_migrate.test b/mysql-test/suite/galera/t/galera_migrate.test
new file mode 100644
index 00000000000..873640b88d4
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_migrate.test
@@ -0,0 +1,204 @@
+#
+# Execute a migration from MariaDB replication to Galera replication.
+# The test starts with 4 stand-alone servers defined by galera_migrate.cnf and then
+# performs the following steps:
+#
+# 1. Begin with a single MySQL server
+# 2. Establish traditional MySQL master-slave replication
+# 3. Attach a new sever to serve as a MySQL replication slave
+# 4. Enable Galera on the new slave and create a single-node Galera cluster
+# 5. Attach a second Galera node
+# 6. Turn off the traditional replication parts of the system
+# 7. Continue replicating within Galera only
+#
+
+--source include/big_test.inc
+--source include/have_innodb.inc
+--source include/have_log_bin.inc
+
+#
+# Step #1 Begin with a single server
+#
+
+--connect node_1, 127.0.0.1, root, , test, $NODE_MYPORT_1
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+#
+# Step #2. Establish traditional MySQL replication
+#
+
+--connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--disable_query_log
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT = $NODE_MYPORT_1;
+--enable_query_log
+START SLAVE;
+
+--connection node_1
+INSERT INTO t1 VALUES (2);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+
+--let $wait_condition = SELECT COUNT(*) = 2 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Step #3. Attach a second slave, later to be converted to Galera
+#
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--disable_query_log
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT = $NODE_MYPORT_1;
+--enable_query_log
+START SLAVE USER='root';
+
+--connection node_1
+INSERT INTO t1 VALUES (3);
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+
+--let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Step #4. Convert this MySQL slave into a Galera node
+#
+
+--connection node_1
+INSERT INTO t1 VALUES (4);
+
+--connection node_3
+--disable_query_log
+--eval SET GLOBAL wsrep_provider='$WSREP_PROVIDER'
+--eval SET GLOBAL wsrep_provider_options='base_port=$NODE_GALERAPORT_3'
+--enable_query_log
+SET GLOBAL wsrep_cluster_address='gcomm://';
+
+--connection node_1
+INSERT INTO t1 VALUES (5);
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
+--source include/wait_condition.inc
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+--source include/wait_condition.inc
+
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+--connection node_1
+INSERT INTO t1 VALUES (6);
+
+#
+# Step #5. Attach a second Galera node using mysqldump SST
+#
+
+--connection node_3
+# We need a user with a password for mysqldump SST
+GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst';
+SET GLOBAL wsrep_sst_auth = 'sst:sst';
+
+--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4
+GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst';
+
+--disable_query_log
+--eval SET GLOBAL wsrep_sst_method = 'mysqldump';
+--eval SET GLOBAL wsrep_provider='$WSREP_PROVIDER'
+--eval SET GLOBAL wsrep_provider_options='base_port=$NODE_GALERAPORT_4'
+--eval SET GLOBAL wsrep_sst_receive_address = '127.0.0.2:$NODE_MYPORT_4';
+--eval SET GLOBAL wsrep_cluster_address='gcomm://127.0.0.1:$NODE_GALERAPORT_3'
+--enable_query_log
+
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+
+--let $wait_condition = SELECT COUNT(*) = 6 FROM t1;
+--source include/wait_condition.inc
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+--source include/wait_condition.inc
+
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+
+#
+# Step #6. Turn off traditional replication
+#
+
+--connection node_2
+STOP SLAVE;
+RESET SLAVE ALL;
+
+--connection node_3
+STOP SLAVE;
+RESET SLAVE ALL;
+
+#
+# Step #7. Continue replicating within Galera only
+#
+
+# We need fresh connections due to galera#191
+
+--connect node_3a, 127.0.0.1, root, , test, $NODE_MYPORT_3
+INSERT INTO t1 VALUES (7);
+
+--connect node_4a, 127.0.0.1, root, , test, $NODE_MYPORT_4
+INSERT INTO t1 VALUES (8);
+
+--connection node_4a
+SELECT COUNT(*) = 8 FROM t1;
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+--source include/wait_condition.inc
+
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+--connection node_3a
+SELECT COUNT(*) = 8 FROM t1;
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+--source include/wait_condition.inc
+
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+#
+# Teardown
+#
+
+--connection node_1
+DROP TABLE t1;
+
+--connection node_2
+DROP TABLE t1;
+
+--connection node_3
+SET GLOBAL wsrep_provider = 'none';
+SET GLOBAL wsrep_sst_auth = '';
+SET GLOBAL wsrep_provider_options = '';
+DROP TABLE t1;
+DROP USER sst;
+
+--connection node_4
+SET GLOBAL wsrep_provider = 'none';
+SET GLOBAL wsrep_sst_method = 'rsync';
+SET GLOBAL wsrep_provider_options = '';
+SET GLOBAL wsrep_sst_receive_address = 'AUTO';
+DROP TABLE t1;
+DROP USER sst;
+
+CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
diff --git a/mysql-test/suite/galera/t/galera_multi_database.test b/mysql-test/suite/galera/t/galera_multi_database.test
new file mode 100644
index 00000000000..6e06aaaa2c6
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_multi_database.test
@@ -0,0 +1,43 @@
+#
+# Test that identical updates can be delivered to two separate
+# databases without this causing a certification conflict
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE DATABASE d1;
+CREATE TABLE d1.t1(f1 INTEGER) ENGINE=InnoDB;
+
+CREATE DATABASE d2;
+CREATE TABLE d2.t1(f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+--connection node_1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO d1.t1 VALUES (1);
+
+--connection node_2
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO d2.t1 VALUES (1);
+
+--connection node_1
+COMMIT;
+
+--connection node_2
+COMMIT;
+
+SELECT COUNT(*) = 1 FROM d1.t1;
+SELECT COUNT(*) = 1 FROM d2.t1;
+
+--connection node_1
+
+SELECT COUNT(*) = 1 FROM d1.t1;
+SELECT COUNT(*) = 1 FROM d2.t1;
+
+DROP TABLE d1.t1;
+DROP TABLE d2.t1;
+
+DROP DATABASE d1;
+DROP DATABASE d2;
diff --git a/mysql-test/suite/galera/t/galera_myisam_autocommit.test b/mysql-test/suite/galera/t/galera_myisam_autocommit.test
new file mode 100644
index 00000000000..b01b5dc07f7
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_myisam_autocommit.test
@@ -0,0 +1,45 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# This tests simple autocommit replication of MyISAM tables. No updates arrive on the slave.
+#
+
+# Without a PK
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2), (3);
+INSERT INTO t1 SELECT 4 FROM DUAL UNION ALL SELECT 5 FROM DUAL;
+
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1);
+INSERT INTO t2 VALUES (2), (3);
+INSERT INTO t2 SELECT 4 FROM DUAL UNION ALL SELECT 5 FROM DUAL;
+
+# Error
+--error ER_DUP_ENTRY
+INSERT INTO t2 VALUES (6), (1);
+
+# UPDATE
+
+UPDATE t1 SET f1 = 9;
+UPDATE t2 SET f1 = 9 WHERE f1 = 1;
+
+# DELETE
+
+DELETE FROM t1 WHERE f1 = 9;
+DELETE FROM t2 WHERE f1 = 9;
+
+# TRUNCATE
+
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t1;
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) = 0 FROM t2;
+
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/t/galera_myisam_transactions.test b/mysql-test/suite/galera/t/galera_myisam_transactions.test
new file mode 100644
index 00000000000..00e0bf3fdca
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_myisam_transactions.test
@@ -0,0 +1,36 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# This tests MyISAM tables in transactions. No MyISAM updates arrive on the slave, but InnoDB ones do.
+#
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=MyISAM;
+CREATE TABLE t3 (f1 INTEGER) ENGINE=MyISAM;
+
+CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t3 VALUES (NEW.f1);
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+COMMIT;
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+SELECT COUNT(*) = 0 FROM t2;
+SELECT COUNT(*) = 0 FROM t2;
+
+--connection node_1
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+ROLLBACK;
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+SELECT COUNT(*) = 0 FROM t2;
+SELECT COUNT(*) = 0 FROM t2;
+
+DROP TABLE t1, t2, t3;
diff --git a/mysql-test/suite/galera/t/galera_nopk_unicode.test b/mysql-test/suite/galera/t/galera_nopk_unicode.test
new file mode 100644
index 00000000000..e036e14ebe0
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_nopk_unicode.test
@@ -0,0 +1,43 @@
+#
+# Test non-ascii data in table without a PK
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (
+ f1 VARCHAR(255),
+ KEY (f1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+INSERT INTO t1 VALUES ('текÑÑ‚');
+
+--connection node_2
+SELECT f1 = 'текÑÑ‚' FROM t1;
+
+#
+# Provoke a conflict
+#
+
+--connection node_1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'текÑÑ‚2';
+
+--connection node_2
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'текÑÑ‚3';
+
+--connection node_1
+COMMIT;
+
+--connection node_2
+--error ER_LOCK_DEADLOCK
+COMMIT;
+
+SELECT f1 = 'текÑÑ‚2' FROM t1;
+SELECT f1 = 'текÑÑ‚2' FROM t1 WHERE f1 = 'текÑÑ‚2';
+
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test b/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test
new file mode 100644
index 00000000000..febb91a9725
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test
@@ -0,0 +1,51 @@
+#
+# Test that a LOCK TABLE on the slave will cause all applier threads to block,
+# Even though the two INSERTS are independent transactions, the fact that t1 is locked
+# prevents the applier thread from committing the insert against t2, as commits are done
+# in order.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB;
+
+--connection node_2
+
+--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads`
+--let $wsrep_sync_wait_orig = `SELECT @@wsrep_sync_wait`
+
+SET GLOBAL wsrep_slave_threads = 2;
+LOCK TABLE t1 READ;
+
+--connection node_1
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+# We use a separate connection here so that we can SELECT from both tables
+# without running into "table t2 was not locked" error.
+
+--let $galera_connection_name = node_2a
+--let $galera_server_number = 2
+--source include/galera_connect.inc
+--connection node_2a
+--sleep 1
+SET SESSION wsrep_sync_wait=0;
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%applied write set%';
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Waiting for table level lock%';
+SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) = 0 FROM t2;
+
+--connection node_2
+UNLOCK TABLES;
+
+--connection node_2a
+--eval SET SESSION wsrep_sync_wait = $wsrep_sync_wait_orig;
+SELECT COUNT(*) = 1 FROM t1;
+SELECT COUNT(*) = 1 FROM t2;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'committed%';
+
+--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig;
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test b/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test
new file mode 100644
index 00000000000..a192044754d
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test
@@ -0,0 +1,50 @@
+##
+## This test tests parallel application of multiple auto-increment insert transactions
+##
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+# Create a second connection to node1 so that we can run transactions concurrently
+--let $galera_connection_name = node_1a
+--let $galera_server_number = 1
+--source include/galera_connect.inc
+
+--connection node_1
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB;
+--connection node_2
+--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads`
+SET GLOBAL wsrep_slave_threads = 4;
+
+--connection node_1
+--send INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+
+--connection node_1a
+--send INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+
+--connection node_2
+--send INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+
+--connection node_1
+--reap
+
+--connection node_1a
+--reap
+
+--connection node_2
+--reap
+SELECT COUNT(*) = 30000 FROM t1;
+SELECT COUNT(DISTINCT f1) = 30000 FROM t1;
+SELECT COUNT(*) = 5 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+
+--disable_query_log
+--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig;
+--enable_query_log
+
+--connection default
+DROP TABLE t1;
+DROP TABLE ten;
+
diff --git a/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test b/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test
new file mode 100644
index 00000000000..cf984f92b2f
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test
@@ -0,0 +1,53 @@
+##
+## Tests the parallel application of many small-ish auto-increment insert transactions
+##
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+# Create a second connection to node1 so that we can run transactions concurrently
+--let $galera_connection_name = node_1a
+--let $galera_server_number = 1
+--source include/galera_connect.inc
+
+--connection node_1
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB;
+--connection node_2
+--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads`
+SET GLOBAL wsrep_slave_threads = 4;
+
+--connection node_1
+--let $count = 1000
+while ($count)
+{
+ --disable_query_log
+ INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1;
+ --enable_query_log
+ --dec $count
+}
+
+--connection node_2
+--let $count = 1000
+while ($count)
+{
+ --disable_query_log
+ INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1;
+ --enable_query_log
+ --dec $count
+}
+
+SELECT COUNT(*) = 20000 FROM t1;
+SELECT COUNT(DISTINCT f1) = 20000 FROM t1;
+SELECT COUNT(*) = 4 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'committed%';
+
+--disable_query_log
+--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig;
+--enable_query_log
+
+--connection default
+DROP TABLE t1;
+DROP TABLE ten;
+
diff --git a/mysql-test/suite/galera/t/galera_parallel_simple.test b/mysql-test/suite/galera/t/galera_parallel_simple.test
new file mode 100644
index 00000000000..a1429954980
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_parallel_simple.test
@@ -0,0 +1,45 @@
+#
+# Test that SHOW PROCESSLIST reports that two slave threads have been involved in applying
+# two independent transactions
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads`
+
+CREATE TABLE t1 (id INT) ENGINE=InnoDB;
+CREATE TABLE t2 (id INT) ENGINE=InnoDB;
+
+--connection node_2
+SET GLOBAL wsrep_slave_threads = 2;
+
+--connection node_1
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+--connection node_2
+
+SELECT COUNT(*) = 6 FROM t1;
+SELECT COUNT(*) = 6 FROM t2;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'closing tables';
+
+--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig;
+
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/t/galera_pc_ignore_sb.test b/mysql-test/suite/galera/t/galera_pc_ignore_sb.test
new file mode 100644
index 00000000000..f63215ebe4a
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_pc_ignore_sb.test
@@ -0,0 +1,49 @@
+#
+# Test pc.ignore_sb=true wsrep_provider option . Killing one node should leave the other running.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+# Save original auto_increment_offset values.
+--connection node_1
+let $auto_increment_offset_node_1 = `SELECT @@global.auto_increment_offset`;
+--connection node_2
+let $auto_increment_offset_node_2 = `SELECT @@global.auto_increment_offset`;
+
+--connection node_1
+--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address`
+--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options`
+
+SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
+
+--connection node_2
+--source include/kill_galera.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+DROP TABLE t1;
+
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+
+# Reset the master and restart the slave so that post-test checks can run
+
+SET GLOBAL wsrep_cluster_address = '';
+--disable_query_log
+--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig';
+--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig';
+--enable_query_log
+
+--connection node_2
+--source include/start_mysqld.inc
+--source include/wait_until_connected_again.inc
+
+--disable_query_log
+# Restore original auto_increment_offset values.
+--connection node_1
+--eval SET @@global.auto_increment_offset = $auto_increment_offset_node_1;
+--connection node_2
+--eval SET @@global.auto_increment_offset = $auto_increment_offset_node_2;
+--enable_query_log
diff --git a/mysql-test/suite/galera/t/galera_pk_bigint_signed.test b/mysql-test/suite/galera/t/galera_pk_bigint_signed.test
new file mode 100644
index 00000000000..12a8a8f5d64
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_pk_bigint_signed.test
@@ -0,0 +1,46 @@
+#
+# PK that is a BIGINT SIGNED
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 BIGINT SIGNED PRIMARY KEY, f2 VARCHAR(5)) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES
+ (-9223372036854775808, 'min'),
+ (9223372036854775807, 'max')
+;
+
+--connection node_2
+SELECT * FROM t1;
+
+UPDATE t1 SET f2 = CONCAT(f2, '_');
+
+--connection node_1
+SELECT * FROM t1;
+
+#
+# Deadlock
+#
+
+--connection node_1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'foo' WHERE f1 = -9223372036854775808;
+
+--connection node_2
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'bar' WHERE f1 = -9223372036854775808;
+
+--connection node_1
+COMMIT;
+SET AUTOCOMMIT=ON;
+
+--connection node_2
+--error ER_LOCK_DEADLOCK
+COMMIT;
+SET AUTOCOMMIT=ON;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_pk_bigint_unsigned.test b/mysql-test/suite/galera/t/galera_pk_bigint_unsigned.test
new file mode 100644
index 00000000000..2bb02d5ea4e
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_pk_bigint_unsigned.test
@@ -0,0 +1,45 @@
+#
+# PK that is a BIGINT UNSIGNED
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 BIGINT UNSIGNED PRIMARY KEY, f2 VARCHAR(5)) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES
+ (18446744073709551615, 'max')
+;
+
+--connection node_2
+SELECT f1 = 18446744073709551615 FROM t1;
+
+UPDATE t1 SET f2 = CONCAT(f2, '_');
+
+--connection node_1
+SELECT f1 = 18446744073709551615 FROM t1;
+
+#
+# Deadlock
+#
+
+--connection node_1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'foo' WHERE f1 = 18446744073709551615;
+
+--connection node_2
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'bar' WHERE f1 = 18446744073709551615;
+
+--connection node_1
+COMMIT;
+SET AUTOCOMMIT=ON;
+
+--connection node_2
+--error ER_LOCK_DEADLOCK
+COMMIT;
+SET AUTOCOMMIT=ON;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_query_cache-master.opt b/mysql-test/suite/galera/t/galera_query_cache-master.opt
new file mode 100644
index 00000000000..cb983993b91
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_query_cache-master.opt
@@ -0,0 +1,3 @@
+--query_cache_type=1 --query_cache_size=1355776
+
+
diff --git a/mysql-test/suite/galera/t/galera_query_cache.test b/mysql-test/suite/galera/t/galera_query_cache.test
new file mode 100644
index 00000000000..900faba0e1b
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_query_cache.test
@@ -0,0 +1,67 @@
+--source include/have_query_cache.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Ensure that the query cache behaves properly with respect to Galera
+#
+# * in the absence of updates, the query cache does serve cached results
+# * any cache-invalidating query on the remote node also causes the local cache to be invalidated
+#
+
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+RESET QUERY CACHE;
+FLUSH STATUS;
+
+#
+# 1. Cache works
+#
+
+SELECT COUNT(*) FROM t1;
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache';
+
+SELECT COUNT(*) FROM t1;
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits';
+
+#
+# 2. Cache is invalidated by DML on remote node
+#
+
+--connection node_1
+INSERT INTO t1 VALUES (2);
+
+--connection node_2
+FLUSH STATUS;
+
+SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache';
+SELECT COUNT(*) FROM t1;
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache';
+
+SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits';
+SELECT COUNT(*) FROM t1;
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits';
+
+#
+# 3. Cache is invalidated by DDL on remote node
+#
+
+--connection node_1
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+
+--connection node_2
+FLUSH STATUS;
+
+SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache';
+SELECT COUNT(*) FROM t1;
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache';
+
+SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits';
+SELECT COUNT(*) FROM t1;
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits';
+
+DROP TABLE t1;
+
diff --git a/mysql-test/suite/galera/t/galera_read_only.test b/mysql-test/suite/galera/t/galera_read_only.test
new file mode 100644
index 00000000000..828f35d2ba3
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_read_only.test
@@ -0,0 +1,23 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Ensure that the read_only option does not apply to Galera appliers and that replication
+# continues, the way MySQL replication would.
+#
+
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+
+--connection node_2
+SET GLOBAL read_only=TRUE;
+
+--connection node_1
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+
+SET GLOBAL read_only=FALSE;
+
+DROP TABLE t1;
+
diff --git a/mysql-test/suite/galera/t/galera_repl_key_format_flat16.test b/mysql-test/suite/galera/t/galera_repl_key_format_flat16.test
new file mode 100644
index 00000000000..8749c20faed
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_repl_key_format_flat16.test
@@ -0,0 +1,34 @@
+#
+# Test repl.key_format = FLAT16 . Since it is very difficult to cause a collision on a 16-byte hash,
+# we simply verify that the option is settable and that replication works.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options`
+SET GLOBAL wsrep_provider_options = 'repl.key_format=FLAT16';
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (123);
+
+CREATE TABLE t2 (f1 VARCHAR(256)) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (REPEAT('a', 256));
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+UPDATE t1 SET f1 = 234;
+UPDATE t2 SET f1 = REPEAT('b', 256);
+
+--connection node_1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 234;
+SELECT COUNT(*) = 1 FROM t2 WHERE f1 = REPEAT('b', 256);
+
+
+--disable_query_log
+--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig';
+--enable_query_log
+
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/t/galera_repl_max_ws_size.test b/mysql-test/suite/galera/t/galera_repl_max_ws_size.test
new file mode 100644
index 00000000000..37a2f7d4ce3
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_repl_max_ws_size.test
@@ -0,0 +1,25 @@
+#
+# Test repl.max_ws_size . A transaction larger than this size can not commit.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options`
+
+CREATE TABLE t1 (f1 VARCHAR(512)) ENGINE=InnoDB;
+
+SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=512';
+
+--error ER_ERROR_DURING_COMMIT
+INSERT INTO t1 VALUES (REPEAT('a', 512));
+
+SELECT COUNT(*) = 0 FROM t1;
+
+--disable_query_log
+--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig';
+--enable_query_log
+
+DROP TABLE t1;
+
diff --git a/mysql-test/suite/galera/t/galera_restart_nochanges.test b/mysql-test/suite/galera/t/galera_restart_nochanges.test
new file mode 100644
index 00000000000..4021ab39cc0
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_restart_nochanges.test
@@ -0,0 +1,38 @@
+#
+# This test restarts a slave while no updates have been performed on the master. No SST is performed.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+# Save original auto_increment_offset values.
+--connection node_1
+let $auto_increment_offset_node_1 = `SELECT @@global.auto_increment_offset`;
+--connection node_2
+let $auto_increment_offset_node_2 = `SELECT @@global.auto_increment_offset`;
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+--source include/restart_mysqld.inc
+
+--let $galera_connection_name = node_2a
+--let $galera_server_number = 2
+--source include/galera_connect.inc
+--connection node_2a
+
+SELECT COUNT(*) = 1 FROM t1;
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+DROP TABLE t1;
+
+--disable_query_log
+# Restore original auto_increment_offset values.
+--connection node_1
+--eval SET @@global.auto_increment_offset = $auto_increment_offset_node_1;
+--connection node_2a
+--eval SET @@global.auto_increment_offset = $auto_increment_offset_node_2;
+--enable_query_log
+
diff --git a/mysql-test/suite/galera/t/galera_roles.test b/mysql-test/suite/galera/t/galera_roles.test
new file mode 100644
index 00000000000..f9a15126e5e
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_roles.test
@@ -0,0 +1,167 @@
+#
+# Test for CREATE/DROP/GRANT/REVOKE role.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--echo #
+--echo # Testing CREATE/GRANT role
+--echo #
+
+--echo
+--echo # On node_1
+--connection node_1
+
+CREATE DATABASE test1;
+CREATE TABLE test1.t1 (a int, b int);
+CREATE TABLE test1.t2 (a int, b int);
+INSERT INTO test1.t1 values (1,2),(3,4);
+INSERT INTO test1.t2 values (5,6),(7,8);
+
+CREATE PROCEDURE test1.pr1() SELECT "pr1";
+
+CREATE USER foo@localhost;
+CREATE ROLE role1;
+
+GRANT role1 TO foo@localhost;
+GRANT RELOAD ON *.* TO role1;
+GRANT SELECT ON mysql.* TO role1;
+GRANT EXECUTE ON PROCEDURE test1.pr1 TO role1;
+GRANT SELECT ON test1.t1 TO role1;
+GRANT SELECT (a) ON test1.t2 TO role1;
+
+--echo # Open connections to the 2 nodes using 'foo' user.
+--let $port_1= \$NODE_MYPORT_1
+--connect(foo_node_1,127.0.0.1,foo,,test,$port_1,)
+
+--let $port_2= \$NODE_MYPORT_2
+--connect(foo_node_2,127.0.0.1,foo,,test,$port_2,)
+
+--echo
+--echo # Connect with foo_node_1
+--connection foo_node_1
+
+SHOW GRANTS;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+FLUSH TABLES;
+--error ER_TABLEACCESS_DENIED_ERROR
+SELECT * FROM mysql.roles_mapping;
+--error ER_DBACCESS_DENIED_ERROR
+SHOW TABLES FROM test1;
+
+SET ROLE role1;
+
+FLUSH TABLES;
+--sorted_result
+SELECT * FROM mysql.roles_mapping;
+SHOW TABLES FROM test1;
+SELECT * FROM test1.t1;
+--error ER_TABLEACCESS_DENIED_ERROR
+SELECT * FROM test1.t2;
+SELECT a FROM test1.t2;
+CALL test1.pr1();
+
+--echo
+--echo # Connect with foo_node_2
+--connection foo_node_2
+
+SHOW GRANTS;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+FLUSH TABLES;
+--error ER_TABLEACCESS_DENIED_ERROR
+SELECT * FROM mysql.roles_mapping;
+--error ER_DBACCESS_DENIED_ERROR
+SHOW TABLES FROM test1;
+
+SET ROLE role1;
+
+FLUSH TABLES;
+--sorted_result
+SELECT * FROM mysql.roles_mapping;
+SHOW TABLES FROM test1;
+SELECT * FROM test1.t1;
+--error ER_TABLEACCESS_DENIED_ERROR
+SELECT * FROM test1.t2;
+SELECT a FROM test1.t2;
+CALL test1.pr1();
+
+--echo #
+--echo # Testing REVOKE role
+--echo #
+
+--echo #
+--echo # Connect with node_1
+--connection node_1
+REVOKE EXECUTE ON PROCEDURE test1.pr1 FROM role1;
+
+--echo
+--echo # Connect with foo_node_1
+--connection foo_node_1
+
+--error ER_PROCACCESS_DENIED_ERROR
+CALL test1.pr1();
+
+--echo
+--echo # Connect with foo_node_2
+--connection foo_node_2
+
+--error ER_PROCACCESS_DENIED_ERROR
+CALL test1.pr1();
+
+--echo #
+--echo # Testing DROP role
+--echo #
+
+--echo
+--echo # Connect with node_1
+--connection node_1
+
+DROP ROLE role1;
+
+--echo
+--echo # Connect with foo_node_1
+--connection foo_node_1
+
+FLUSH TABLES;
+--error ER_TABLEACCESS_DENIED_ERROR
+SELECT * FROM mysql.roles_mapping;
+--error ER_TABLEACCESS_DENIED_ERROR
+SELECT * FROM test1.t1;
+--error ER_TABLEACCESS_DENIED_ERROR
+SELECT a FROM test1.t2;
+
+SHOW GRANTS;
+SELECT * FROM INFORMATION_SCHEMA.ENABLED_ROLES;
+SELECT * FROM INFORMATION_SCHEMA.ENABLED_ROLES; # yes, repeat it twice
+SELECT CURRENT_ROLE();
+
+--echo
+--echo # Connect with foo_node_2
+--connection foo_node_2
+
+FLUSH TABLES;
+--error ER_TABLEACCESS_DENIED_ERROR
+SELECT * FROM mysql.roles_mapping;
+--error ER_TABLEACCESS_DENIED_ERROR
+SELECT * FROM test1.t1;
+--error ER_TABLEACCESS_DENIED_ERROR
+SELECT a FROM test1.t2;
+
+SHOW GRANTS;
+SELECT * FROM INFORMATION_SCHEMA.ENABLED_ROLES;
+SELECT * FROM INFORMATION_SCHEMA.ENABLED_ROLES; # yes, repeat it twice
+SELECT CURRENT_ROLE();
+
+# Cleanup
+disconnect foo_node_2;
+--echo # Connect with node_1
+--connection node_1
+
+DROP USER foo@localhost;
+DROP DATABASE test1;
+
+--source include/galera_end.inc
+--echo # End of test
diff --git a/mysql-test/suite/galera/t/galera_rsu_add_pk.test b/mysql-test/suite/galera/t/galera_rsu_add_pk.test
new file mode 100644
index 00000000000..7db990d7be1
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_rsu_add_pk.test
@@ -0,0 +1,43 @@
+#
+# ALTER TABLE ... ADD PRIMARY KEY under Rolling Schema Upgrade
+#
+
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
+
+# Insert some values before the ALTER
+INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+
+# Insert more values while the ALTER is running
+--send INSERT INTO t1 (f1) SELECT 100000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+
+--connection node_2
+SET SESSION wsrep_OSU_method = "RSU";
+ALTER TABLE t1 ADD PRIMARY KEY (f1);
+SET SESSION wsrep_OSU_method = "TOI";
+
+# Insert values after the ALTER
+INSERT INTO t1 (f1) SELECT 200000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+
+
+SELECT COUNT(*) = 300000 FROM t1;
+SELECT MAX(f1) = 299999 FROM t1;
+
+--connection node_1
+--reap
+SELECT COUNT(*) = 300000 FROM t1;
+SELECT MAX(f1) = 299999 FROM t1;
+
+SET SESSION wsrep_OSU_method = "RSU";
+ALTER TABLE t1 ADD PRIMARY KEY (f1);
+SET SESSION wsrep_OSU_method = "TOI";
+
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/t/galera_rsu_drop_pk.test b/mysql-test/suite/galera/t/galera_rsu_drop_pk.test
new file mode 100644
index 00000000000..e64259494d1
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_rsu_drop_pk.test
@@ -0,0 +1,58 @@
+#
+# ALTER TABLE ... DROP PRIMARY KEY under Rolling Schema Upgrade
+#
+
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+
+# Insert some values before the ALTER
+INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+
+# Insert more values while the ALTER is running
+--send INSERT INTO t1 (f1) SELECT 100000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+
+--connection node_2
+SET SESSION wsrep_OSU_method = "RSU";
+ALTER TABLE t1 DROP PRIMARY KEY;
+SET SESSION wsrep_OSU_method = "TOI";
+
+# Insert even more data after the ALTER has completed
+INSERT INTO t1 (f1) SELECT 200000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+
+SELECT COUNT(*) = 300000 FROM t1;
+SELECT MAX(f1) = 299999 FROM t1;
+
+--connection node_1
+--reap
+SELECT COUNT(*) = 300000 FROM t1;
+SELECT MAX(f1) = 299999 FROM t1;
+
+SET SESSION wsrep_OSU_method = "RSU";
+ALTER TABLE t1 DROP PRIMARY KEY;
+SET SESSION wsrep_OSU_method = "TOI";
+
+# Insert some previously-conflicting values after the ALTER has been applied on all nodes.
+--connection node_2
+INSERT INTO t1 (f1) VALUES (1);
+INSERT INTO t1 (f1) VALUES (10);
+
+--connection node_1
+SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 1;
+SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 10;
+
+INSERT INTO t1 (f1) VALUES (100);
+INSERT INTO t1 (f1) VALUES (1000);
+
+--connection node_2
+SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 100;
+SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 1000;
+
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/t/galera_rsu_error.test b/mysql-test/suite/galera/t/galera_rsu_error.test
new file mode 100644
index 00000000000..cad8154ac76
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_rsu_error.test
@@ -0,0 +1,31 @@
+#
+# Test DDL errors under Rolling Schema Upgrade
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
+INSERT INTO t1 VALUES (1), (1);
+
+--connection node_2
+SET SESSION wsrep_OSU_method = "RSU";
+--error ER_DUP_ENTRY
+ALTER TABLE t1 ADD PRIMARY KEY (f1);
+SET SESSION wsrep_OSU_method = "TOI";
+
+# The ALTER has no effect
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME = 't1';
+
+INSERT INTO t1 VALUES (1);
+
+--connection node_1
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME = 't1';
+SELECT COUNT(*) = 3 FROM t1;
+
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+SELECT COUNT(3) = 4 FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_rsu_simple.test b/mysql-test/suite/galera/t/galera_rsu_simple.test
new file mode 100644
index 00000000000..5841dbd8006
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_rsu_simple.test
@@ -0,0 +1,34 @@
+#
+# Test Rolling Schema Upgrade
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+
+--connection node_2
+SET SESSION wsrep_OSU_method = "RSU";
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+
+--connection node_1
+# The ALTER above is not visible on node_1
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+# The INSERT above is now visible on node_2
+SELECT COUNT(*) = 1 FROM t1;
+
+INSERT INTO t1 (f1) VALUES (2);
+
+--connection node_1
+# The ALTER has not replicated
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+
+# However the INSERT above has
+SELECT COUNT(*) = 2 FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_sbr.test b/mysql-test/suite/galera/t/galera_sbr.test
new file mode 100644
index 00000000000..33f45c6b532
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sbr.test
@@ -0,0 +1,27 @@
+#
+# Test behavior if the user attempts to use statement-based replication
+#
+# SBR is not currently supported but we expect that no crashes or binlog-related assertions will be triggered.
+#
+
+--source include/have_innodb.inc
+--source include/galera_cluster.inc
+
+--connection node_1
+#SET GLOBAL binlog_format = 'STATEMENT';
+SET SESSION binlog_format = 'STATEMENT';
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+SET SESSION binlog_format = 'MIXED';
+
+INSERT INTO t1 VALUES (2);
+
+--connection node_2
+SELECT COUNT(*) = 2 FROM t1;
+
+DROP TABLE t1;
+
+--connection node_1
+SET GLOBAL binlog_format = 'ROW';
diff --git a/mysql-test/suite/galera/t/galera_sbr_binlog-master.opt b/mysql-test/suite/galera/t/galera_sbr_binlog-master.opt
new file mode 100644
index 00000000000..beae84b3862
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sbr_binlog-master.opt
@@ -0,0 +1 @@
+--log-bin
diff --git a/mysql-test/suite/galera/t/galera_sbr_binlog.test b/mysql-test/suite/galera/t/galera_sbr_binlog.test
new file mode 100644
index 00000000000..1291a4ff8a9
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sbr_binlog.test
@@ -0,0 +1,28 @@
+#
+# Test behavior if the user attempts to use statement-based replication
+#
+# SBR is not currently supported but we expect that no crashes or binlog-related assertions will be triggered.
+#
+
+--source include/have_log_bin.inc
+--source include/have_innodb.inc
+--source include/galera_cluster.inc
+
+--connection node_1
+#SET GLOBAL binlog_format = 'STATEMENT';
+SET SESSION binlog_format = 'STATEMENT';
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+SET SESSION binlog_format = 'MIXED';
+
+INSERT INTO t1 VALUES (2);
+
+--connection node_2
+SELECT COUNT(*) = 2 FROM t1;
+
+DROP TABLE t1;
+
+--connection node_1
+SET GLOBAL binlog_format = 'ROW';
diff --git a/mysql-test/suite/galera/t/galera_split_brain.test b/mysql-test/suite/galera/t/galera_split_brain.test
new file mode 100644
index 00000000000..c3e779618df
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_split_brain.test
@@ -0,0 +1,53 @@
+#
+# Confirm that with two nodes, killing one causes the other to stop accepting connections
+# The pc.ignore_sb=true wsrep_provider option is tested in the galera_kill_* tests.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+call mtr.add_suppression("WSREP: TO isolation failed for: ");
+
+--connection node_1
+--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address`
+
+# Save original auto_increment_offset values.
+--connection node_1
+let $auto_increment_offset_node_1 = `SELECT @@global.auto_increment_offset`;
+--connection node_2
+let $auto_increment_offset_node_2 = `SELECT @@global.auto_increment_offset`;
+
+--connection node_2
+--source include/kill_galera.inc
+
+--connection node_1
+--error ER_LOCK_DEADLOCK
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+
+# Reset the master and restart the slave so that post-test checks can run
+
+SET GLOBAL wsrep_cluster_address = '';
+--disable_query_log
+--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig';
+--enable_query_log
+
+--source include/start_mysqld.inc
+--sleep 5
+--source include/wait_until_connected_again.inc
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+--sleep 5
+
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--source include/wait_until_connected_again.inc
+
+# Restore original auto_increment_offset values.
+--disable_query_log
+--connection node_1
+--eval SET @@global.auto_increment_offset = $auto_increment_offset_node_1;
+--connection node_2a
+--eval SET @@global.auto_increment_offset = $auto_increment_offset_node_2;
+--enable_query_log
+
diff --git a/mysql-test/suite/galera/t/galera_sql_log_bin_zero.test b/mysql-test/suite/galera/t/galera_sql_log_bin_zero.test
new file mode 100644
index 00000000000..cd8d6ba6426
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sql_log_bin_zero.test
@@ -0,0 +1,26 @@
+#
+# Test SET SESSION sql_log_bin = 0 . We expect that updates gets repliated to
+# other nodes while they do not show up in the binary log files.
+# (see galera.galera_as_master)
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+
+SET SESSION sql_log_bin = 0;
+
+INSERT INTO t1 VALUES (1);
+
+SET SESSION sql_log_bin = 1;
+
+INSERT INTO t1 VALUES (2);
+
+
+--connection node_2
+SELECT COUNT(*) = 2 FROM t1;
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+
+--connection node_1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_ssl.cnf b/mysql-test/suite/galera/t/galera_ssl.cnf
new file mode 100644
index 00000000000..1c22580cc15
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_ssl.cnf
@@ -0,0 +1,7 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem'
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem'
diff --git a/mysql-test/suite/galera/t/galera_ssl.test b/mysql-test/suite/galera/t/galera_ssl.test
new file mode 100644
index 00000000000..8dc94dc1966
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_ssl.test
@@ -0,0 +1,24 @@
+#
+# Test node connections over SSL. The accompanying galera_ssl.cnf has a customized
+# wsrep_provider_options setting that enables SSL.
+#
+# At this time, the actual operation of SSL is not visible only in the error log and not in SHOW STATUS.
+# So this test can only check that the cluster has formed and is replicating.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+SELECT COUNT(*) = 1 FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_sst_mysqldump.cnf b/mysql-test/suite/galera/t/galera_sst_mysqldump.cnf
new file mode 100644
index 00000000000..574ae28b54a
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sst_mysqldump.cnf
@@ -0,0 +1,11 @@
+!include ../galera_2nodes.cnf
+
+# We do not set mysqldump-related SST options here because doing so on startup
+# causes the first MTR connection to be forefully dropped by Galera, which in turn confuses MTR
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true'
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true'
+
diff --git a/mysql-test/suite/galera/t/galera_sst_mysqldump.test b/mysql-test/suite/galera/t/galera_sst_mysqldump.test
new file mode 100644
index 00000000000..0b7171597dd
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sst_mysqldump.test
@@ -0,0 +1,18 @@
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--source suite/galera/include/galera_sst_set_mysqldump.inc
+
+--source suite/galera/include/galera_st_disconnect_slave.inc
+
+# We set the required mysqldump SST options here so that they are used every time the server is restarted during the test
+--let $start_mysqld_params = --wsrep_sst_auth=sst:sst --wsrep_sst_method=mysqldump --wsrep-sst-receive-address=127.0.0.1:$NODE_MYPORT_2 --skip-grant-tables
+
+--source suite/galera/include/galera_st_shutdown_slave.inc
+--source suite/galera/include/galera_st_clean_slave.inc
+
+--source suite/galera/include/galera_st_kill_slave.inc
+--source suite/galera/include/galera_st_kill_slave_ddl.inc
+
+--source suite/galera/include/galera_sst_restore.inc
diff --git a/mysql-test/suite/galera/t/galera_sst_rsync.cnf b/mysql-test/suite/galera/t/galera_sst_rsync.cnf
new file mode 100644
index 00000000000..93981d9daa7
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sst_rsync.cnf
@@ -0,0 +1,11 @@
+!include ../galera_2nodes.cnf
+
+[mysqld]
+wsrep_sst_method=rsync
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true'
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true'
+
diff --git a/mysql-test/suite/galera/t/galera_sst_rsync.test b/mysql-test/suite/galera/t/galera_sst_rsync.test
new file mode 100644
index 00000000000..c6823795e59
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sst_rsync.test
@@ -0,0 +1,9 @@
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--source suite/galera/include/galera_st_shutdown_slave.inc
+--source suite/galera/include/galera_st_clean_slave.inc
+
+--source suite/galera/include/galera_st_kill_slave.inc
+--source suite/galera/include/galera_st_kill_slave_ddl.inc
diff --git a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.cnf b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.cnf
new file mode 100644
index 00000000000..47cb3e02292
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.cnf
@@ -0,0 +1,13 @@
+!include ../galera_2nodes.cnf
+
+[mysqld]
+wsrep_sst_method=xtrabackup-v2
+wsrep_sst_auth="root:"
+wsrep_debug=ON
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true'
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true'
+
diff --git a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.test b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.test
new file mode 100644
index 00000000000..c6823795e59
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.test
@@ -0,0 +1,9 @@
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--source suite/galera/include/galera_st_shutdown_slave.inc
+--source suite/galera/include/galera_st_clean_slave.inc
+
+--source suite/galera/include/galera_st_kill_slave.inc
+--source suite/galera/include/galera_st_kill_slave_ddl.inc
diff --git a/mysql-test/suite/galera/t/galera_status_cluster.test b/mysql-test/suite/galera/t/galera_status_cluster.test
new file mode 100644
index 00000000000..3299613d584
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_status_cluster.test
@@ -0,0 +1,18 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# A simple test for the wsrep_cluster_* status variables
+#
+
+--connection node_1
+
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+
+--connection node_2
+
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+
+
diff --git a/mysql-test/suite/galera/t/galera_status_local_state.test b/mysql-test/suite/galera/t/galera_status_local_state.test
new file mode 100644
index 00000000000..09cdb25f80c
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_status_local_state.test
@@ -0,0 +1,28 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test wsrep_local_state . We can not reliably produce all possible statuses in MTR, but
+# we can at least test for the ones we can.
+#
+
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+
+SET GLOBAL wsrep_desync = 1;
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+--source include/wait_condition.inc
+
+SELECT VARIABLE_VALUE = 'Donor/Desynced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+
+SET GLOBAL wsrep_desync = 0;
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+--source include/wait_condition.inc
+
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+
+
+
+
diff --git a/mysql-test/suite/galera/t/galera_suspend_slave.test b/mysql-test/suite/galera/t/galera_suspend_slave.test
new file mode 100644
index 00000000000..b4302f7d195
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_suspend_slave.test
@@ -0,0 +1,66 @@
+##
+## This test tests that transactions on the master will fail if the slave
+## is made completely unresponsive by suspending the process. Resuming the
+## process should allow replication to continue to run.
+##
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+# Save original auto_increment_offset values.
+--connection node_1
+let $auto_increment_offset_node_1 = `SELECT @@global.auto_increment_offset`;
+--connection node_2
+let $auto_increment_offset_node_2 = `SELECT @@global.auto_increment_offset`;
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+--connection node_2
+--let NODE_2_PIDFILE = `SELECT @@pid_file`
+--disconnect node_2
+
+--connection node_1
+--echo Suspending node_2 ...
+--perl
+ my $pid_filename = $ENV{'NODE_2_PIDFILE'};
+ my $mysqld_pid = `cat $pid_filename`;
+ chomp($mysqld_pid);
+ system("kill -19 $mysqld_pid");
+ exit(0);
+EOF
+
+--error ER_UNKNOWN_COM_ERROR,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK,ER_ERROR_DURING_COMMIT
+INSERT INTO t1 VALUES (1);
+
+--echo Resuming node_2 ...
+--perl
+ my $pid_filename = $ENV{'NODE_2_PIDFILE'};
+ my $mysqld_pid = `cat $pid_filename`;
+ chomp($mysqld_pid);
+ system("kill -18 $mysqld_pid");
+ exit(0);
+EOF
+
+--sleep 10
+--source include/wait_until_ready.inc
+INSERT INTO t1 VALUES (1);
+
+--let $galera_connection_name = node_2a
+--let $galera_server_number = 2
+--source include/galera_connect.inc
+--connection node_2a
+
+--source include/wait_until_ready.inc
+SELECT COUNT(*) = 1 FROM t1;
+
+DROP TABLE t1;
+
+--disable_query_log
+# Restore original auto_increment_offset values.
+--connection node_1
+--eval SET @@global.auto_increment_offset = $auto_increment_offset_node_1;
+--connection node_2a
+--eval SET @@global.auto_increment_offset = $auto_increment_offset_node_2;
+--enable_query_log
+
diff --git a/mysql-test/suite/galera/t/galera_toi_alter_auto_increment.test b/mysql-test/suite/galera/t/galera_toi_alter_auto_increment.test
new file mode 100644
index 00000000000..641d2101c80
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_toi_alter_auto_increment.test
@@ -0,0 +1,120 @@
+
+#
+# Test the operation of ALTER TABLE ... AUTO_INCREMENT
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
+
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+
+--connection node_2
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+
+ALTER TABLE t1 AUTO_INCREMENT = 1000;
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+
+--connection node_1
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+
+SELECT MIN(f1) >= 1000, COUNT(*) = 20, COUNT(DISTINCT f1) = 20 FROM t1 WHERE f1 >= 1000;
+
+--connection node_2
+SELECT MIN(f1) >= 1000, COUNT(*) = 20, COUNT(DISTINCT f1) = 20 FROM t1 WHERE f1 >= 1000;
+
+#
+# AUTO_INCREMENT set to a value lower than the current one.
+# The ALTER does nothing, the sequence continues from the current maximum.
+#
+
+--connection node_1
+ALTER TABLE t1 AUTO_INCREMENT = 5;
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+
+--connection node_2
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+SELECT MIN(f1) >= 1000, COUNT(*) = 40, COUNT(DISTINCT f1) = 40 FROM t1 WHERE f1 >= 1000;
+
+--connection node_1
+SELECT MIN(f1) >= 1000, COUNT(*) = 40, COUNT(DISTINCT f1) = 40 FROM t1 WHERE f1 >= 1000;
+
+DROP TABLE t1;
+
+#
+# Under wsrep_auto_increment_control = OFF
+#
+
+--connection node_1
+--let $auto_increment_control_orig = `SELECT @@wsrep_auto_increment_control`
+--let $auto_increment_increment_node1 = `SELECT @@auto_increment_increment`
+--let $auto_increment_offset_node1 = `SELECT @@auto_increment_offset`
+
+# Restore stock MySQL defaults
+SET GLOBAL wsrep_auto_increment_control = OFF;
+SET GLOBAL auto_increment_increment = 1;
+SET GLOBAL auto_increment_offset = 1;
+
+#Open a fresh connection to node_1 so that the variables above take effect
+--let $galera_connection_name = node_1a
+--let $galera_server_number = 1
+--source include/galera_connect.inc
+
+--connection node_2
+--let $auto_increment_increment_node2 = `SELECT @@auto_increment_increment`
+--let $auto_increment_offset_node2 = `SELECT @@auto_increment_offset`
+
+SET GLOBAL wsrep_auto_increment_control = OFF;
+SET GLOBAL auto_increment_increment = 1;
+SET GLOBAL auto_increment_offset = 1;
+
+#Open a fresh connection to node_2
+--let $galera_connection_name = node_2a
+--let $galera_server_number = 2
+--source include/galera_connect.inc
+
+--connection node_1a
+
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
+
+--connection node_2a
+
+ALTER TABLE t1 AUTO_INCREMENT=100;
+
+--connection node_1a
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+
+--connection node_2a
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+
+SELECT MIN(f1) = 100, MAX(f1) = 119, COUNT(f1) = 20, COUNT(DISTINCT f1) = 20 FROM t1;
+
+--connection node_1a
+SELECT MIN(f1) = 100, MAX(f1) = 119, COUNT(f1) = 20, COUNT(DISTINCT f1) = 20 FROM t1;
+
+DROP TABLE t1;
+
+#
+# Restore all variables as they were
+#
+
+--disable_query_log
+
+--connection node_1
+--eval SET GLOBAL wsrep_auto_increment_control = $auto_increment_control_orig
+--eval SET GLOBAL auto_increment_increment = $auto_increment_increment_node1
+--eval SET GLOBAL auto_increment_offset = $auto_increment_offset_node1
+
+--connection node_2
+--eval SET GLOBAL wsrep_auto_increment_control = $auto_increment_control_orig
+--eval SET GLOBAL auto_increment_increment = $auto_increment_increment_node2
+--eval SET GLOBAL auto_increment_offset = $auto_increment_offset_node2
+
+--enable_query_log
+
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/t/galera_toi_ddl_error.test b/mysql-test/suite/galera/t/galera_toi_ddl_error.test
new file mode 100644
index 00000000000..c586d97bdb5
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_toi_ddl_error.test
@@ -0,0 +1,29 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/big_test.inc
+
+#
+# Test the operation of DDLs that fail partway through
+#
+
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+
+# Insert 100K rows
+INSERT INTO t1 (f1) SELECT (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+
+# Insert one duplicate value
+INSERT INTO t1 (f1) SELECT MAX(f1) FROM t1;
+
+--connection node_2
+--error ER_DUP_ENTRY
+ALTER TABLE t1 ADD PRIMARY KEY (f1);
+SHOW CREATE TABLE t1;
+
+--connection node_1
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/t/galera_toi_ddl_fk_insert.test b/mysql-test/suite/galera/t/galera_toi_ddl_fk_insert.test
new file mode 100644
index 00000000000..1f446938775
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_toi_ddl_fk_insert.test
@@ -0,0 +1,70 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/big_test.inc
+
+#
+# This test creates a new FK constraint while concurrent INSERTS are running
+#
+
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+CREATE TABLE parent (
+ id INT PRIMARY KEY AUTO_INCREMENT,
+ f2 INTEGER,
+ KEY (id)
+) ENGINE=InnoDB;
+
+CREATE TABLE child (
+ id INT PRIMARY KEY AUTO_INCREMENT,
+ parent_id INT
+) ENGINE=InnoDB;
+
+INSERT INTO parent VALUES (DEFAULT, 0);
+
+--connection node_2
+--send INSERT INTO child (parent_id) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+
+--let $galera_connection_name = node_1a
+--let $galera_server_number = 1
+--source include/galera_connect.inc
+--connection node_1a
+--send INSERT INTO parent (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+
+--let $galera_connection_name = node_2a
+--let $galera_server_number = 2
+--source include/galera_connect.inc
+--connection node_2a
+--send INSERT INTO parent (f2) SELECT 2 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+
+--let $galera_connection_name = node_1b
+--let $galera_server_number = 1
+--source include/galera_connect.inc
+--connection node_1b
+--sleep 2
+--send ALTER TABLE child ADD FOREIGN KEY (parent_id) REFERENCES parent(id);
+
+--connection node_1a
+--reap
+
+--connection node_1b
+--reap
+
+--connection node_2
+--reap
+
+--connection node_2a
+--reap
+
+--connection node_1
+SELECT COUNT(*) = 20001 FROM parent;
+SELECT COUNT(*) = 10000 FROM child;
+
+--connection node_2
+SELECT COUNT(*) = 20001 FROM parent;
+SELECT COUNT(*) = 10000 FROM child;
+
+DROP TABLE child;
+DROP TABLE parent;
+
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/t/galera_toi_ddl_locking.test b/mysql-test/suite/galera/t/galera_toi_ddl_locking.test
new file mode 100644
index 00000000000..12c83a1f87a
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_toi_ddl_locking.test
@@ -0,0 +1,76 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+
+#
+# Test that DDL indeed causes all nodes to block so even unrelated updates
+# are not allowed to proceed. We block the DDL using DBUG_SYNC
+#
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+
+--connection node_1
+SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue';
+--send ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+
+--let $galera_connection_name = node_1a
+--let $galera_server_number = 1
+--source include/galera_connect.inc
+
+--let $galera_connection_name = node_1b
+--let $galera_server_number = 1
+--source include/galera_connect.inc
+
+--connection node_1a
+SET SESSION wsrep_sync_wait = 0;
+
+# Allowed
+SELECT COUNT(*) = 0 FROM t1;
+
+# Allowed
+SELECT COUNT(*) = 0 FROM t2;
+
+# Not allowed
+--error ER_LOCK_DEADLOCK,ER_ERROR_DURING_COMMIT
+INSERT INTO t1 VALUES (1);
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+# Allowed
+INSERT INTO t2 VALUES (1);
+
+# Hangs
+--send COMMIT;
+--sleep 1
+
+--connection node_1b
+SET SESSION wsrep_sync_wait = 0;
+
+# The Commit issued above is still not done
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO = 'Commit';
+SELECT COUNT(*) = 0 FROM t2;
+SET DEBUG_SYNC= 'now SIGNAL continue';
+
+--connection node_1a
+--reap
+
+--connection node_1
+--reap
+SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) = 1 FROM t2;
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) = 1 FROM t2;
+
+--connection node_1
+SET DEBUG_SYNC= 'RESET';
+
+--connection node_1b
+SET DEBUG_SYNC= 'RESET';
+
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test b/mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test
new file mode 100644
index 00000000000..821f7a6eb2c
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test
@@ -0,0 +1,30 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# In this test, we simultaneously send two non-conflicting ALTER TABLE statements
+#
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 INTEGER);
+
+--connection node_2
+--send ALTER TABLE t1 ADD COLUMN f3 INTEGER; INSERT INTO t1 (f1, f2) VALUES (DEFAULT, 123);
+
+--connection node_1
+--send CREATE UNIQUE INDEX i1 ON t1(f2);
+
+--connection node_2
+--reap
+INSERT INTO t1 (f1, f2) VALUES (DEFAULT, 234);
+
+SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
+SELECT COUNT(*) = 2 FROM t1;
+
+--connection node_1
+--reap
+SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
+SELECT COUNT(*) = 2 FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_toi_ddl_sequential.test b/mysql-test/suite/galera/t/galera_toi_ddl_sequential.test
new file mode 100644
index 00000000000..51eae7005df
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_toi_ddl_sequential.test
@@ -0,0 +1,29 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# In this test, we send two ALTER TABLE statements that would only work if executed in the right order
+#
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+INSERT INTO t1 VALUES (2, 3);
+
+--connection node_1
+ALTER TABLE t1 DROP COLUMN f2;
+INSERT INTO t1 VALUES (4);
+
+--connection node_2
+SHOW CREATE TABLE t1;
+SELECT COUNT(*) = 3 FROM t1;
+SELECT * FROM t1 ORDER BY f1;
+
+--connection node_1
+SHOW CREATE TABLE t1;
+SELECT COUNT(*) = 3 FROM t1;
+SELECT * FROM t1 ORDER BY f1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_toi_ftwrl.test b/mysql-test/suite/galera/t/galera_toi_ftwrl.test
new file mode 100644
index 00000000000..4d0edefda8e
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_toi_ftwrl.test
@@ -0,0 +1,22 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# At this time, issing a FLUSH TABLES WITH READ LOCK on one node does not prevent DDLs from other nodes
+# from proceeding. The locked node will apply the DDL after it has been unlocked
+#
+
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+
+--connection node_2
+FLUSH TABLES WITH READ LOCK;
+
+--connection node_1
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+
+--connection node_2
+UNLOCK TABLES;
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
diff --git a/mysql-test/suite/galera/t/galera_toi_lock_exclusive.test b/mysql-test/suite/galera/t/galera_toi_lock_exclusive.test
new file mode 100644
index 00000000000..3c66286a3e6
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_toi_lock_exclusive.test
@@ -0,0 +1,38 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Ensure that ALTER LOCK=EXCLUSIVE works under TOI. It is difficult to check that concurrent operations
+# are truly not possible, but at least we expect no hangs or deadlocks
+#
+
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+# Start a transaction that is concurrent to the DDL. This is not strictly necessary for this test
+# but does put more locks into play.
+--connection node_2
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (2);
+
+--let $galera_connection_name = node_2a
+--let $galera_server_number = 2
+--source include/galera_connect.inc
+--connection node_2a
+ALTER TABLE t1 ADD COLUMN f2 INTEGER, LOCK=EXCLUSIVE;
+
+# In Galera, a concurrent transaction aborts in the face of ALTER
+--connection node_2
+--error ER_LOCK_DEADLOCK
+COMMIT;
+
+--connection node_1
+INSERT INTO t1 VALUES (2, 2);
+SELECT COUNT(*) = 2 FROM t1;
+
+--connection node_2
+INSERT INTO t1 VALUES (3, 3);
+SELECT COUNT(*) = 3 FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_toi_lock_shared.test b/mysql-test/suite/galera/t/galera_toi_lock_shared.test
new file mode 100644
index 00000000000..6857a0e08ca
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_toi_lock_shared.test
@@ -0,0 +1,23 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Ensure that ALTER LOCK=SHARED works under TOI. It is difficult to check that concurrent operations
+# will be possible, but at least we expect no hangs or deadlocks
+#
+
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+ALTER TABLE t1 ADD COLUMN f2 INTEGER, LOCK=SHARED;
+
+--connection node_1
+INSERT INTO t1 VALUES (2, 2);
+SELECT COUNT(*) = 2 FROM t1;
+
+--connection node_2
+INSERT INTO t1 VALUES (3, 3);
+SELECT COUNT(*) = 3 FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_transaction_read_only.test b/mysql-test/suite/galera/t/galera_transaction_read_only.test
new file mode 100644
index 00000000000..386d73fd3ca
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_transaction_read_only.test
@@ -0,0 +1,58 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Ensure that transactions that do not write anything do not cause the wsrep_last_committed counter to advance
+#
+
+# Empty transaction
+
+--connection node_1
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+
+--connection node_2
+--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+--connection node_1
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+COMMIT;
+
+--connection node_2
+--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+--disable_query_log
+--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before AS wsrep_last_committed_diff;
+--enable_query_log
+
+# START TRANSACTION READ ONLY
+
+--connection node_2
+--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+--connection node_1
+START TRANSACTION READ ONLY;
+SELECT COUNT(*) = 0 FROM t1;
+COMMIT;
+
+--connection node_2
+--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+--disable_query_log
+--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before AS wsrep_last_committed_diff;
+--enable_query_log
+
+# Ordinary transaction with only SELECTs
+
+--connection node_1
+START TRANSACTION;
+SELECT COUNT(*) = 0 FROM t1;
+COMMIT;
+
+--connection node_2
+--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+--disable_query_log
+--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before AS wsrep_last_committed_diff;
+--enable_query_log
+
+DROP TABLE t1;
+
diff --git a/mysql-test/suite/galera/t/galera_transaction_replay.test b/mysql-test/suite/galera/t/galera_transaction_replay.test
new file mode 100644
index 00000000000..d2c74ab192b
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_transaction_replay.test
@@ -0,0 +1,63 @@
+#
+# This test tests the operation of transaction replay. If a potentially conflicting remote transaction arrives at
+# just the right time during the commit of a local transaction, the local transaction will be aborted and replayed.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/have_debug_sync.inc
+--source suite/galera/include/galera_have_debug_sync.inc
+
+--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (2, 'a');
+
+--connection node_1
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE;
+
+# Block the commit
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_enter_sync';
+
+--connection node_1
+--send COMMIT;
+
+# Wait until commit is blocked
+--connection node_1a
+SET SESSION wsrep_sync_wait = 0;
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters' AND VARIABLE_VALUE = 'apply_monitor_enter_sync'
+--source include/wait_condition.inc
+
+# Issue a conflicting update on node #2
+--connection node_2
+UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
+
+# Unblock the commit
+--connection node_1a
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_enter_sync';
+
+# Commit succeeds
+--connection node_1
+--reap
+
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+
+# wsrep_local_replays has increased by 1
+--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--disable_query_log
+--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old = 1 AS wsrep_local_replays;
+--enable_query_log
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_truncate.test b/mysql-test/suite/galera/t/galera_truncate.test
new file mode 100644
index 00000000000..79f9bad1f1b
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_truncate.test
@@ -0,0 +1,57 @@
+#
+# Test TRUNCATE
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Simple case
+#
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+TRUNCATE TABLE t1;
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_1
+SELECT COUNT(*) = 0 FROM t1;
+
+#
+# Table with no PK
+#
+
+--connection node_2
+CREATE TABLE t2 (f1 VARCHAR(255)) Engine=InnoDB;
+INSERT INTO t2 VALUES ('abc');
+
+--connection node_1
+TRUNCATE TABLE t2;
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM t2;
+
+#
+# Table with AUTO_INCREMENT. The AUTO_INCREMENT counter must be reset on all nodes
+#
+
+--connection node_1
+CREATE TABLE t3 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB;
+INSERT INTO t3 VALUES (DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT);
+
+CREATE TABLE t4 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB AUTO_INCREMENT=1234;
+INSERT INTO t4 VALUES (DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT);
+
+TRUNCATE TABLE t3;
+TRUNCATE TABLE t4;
+
+--connection node_2
+SELECT AUTO_INCREMENT = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME IN ('t3', 't4');
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
diff --git a/mysql-test/suite/galera/t/galera_truncate_temporary.test b/mysql-test/suite/galera/t/galera_truncate_temporary.test
new file mode 100644
index 00000000000..3ad94eb9930
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_truncate_temporary.test
@@ -0,0 +1,82 @@
+#
+# Test TRUNCATE on TEMPORARY tables. It should not be replicated
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TEMPORARY TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+
+INSERT INTO t1 VALUES (1);
+
+TRUNCATE TABLE t1;
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_2
+--error ER_NO_SUCH_TABLE
+SELECT * FROM t1;
+
+--connection node_1
+DROP TABLE t1;
+
+#
+# Test the case where a TEMPORARY table is masking an existing one
+#
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (2);
+
+SELECT f1 = 2 FROM t1;
+SELECT COUNT(*) = 1 FROM t1;
+
+TRUNCATE TABLE t1;
+
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+SELECT f1 = 1 FROM t1;
+
+--connection node_1
+
+DROP TABLE t1;
+SELECT COUNT(*) = 1 FROM t1;
+SELECT f1 = 1 FROM t1;
+
+TRUNCATE TABLE t1;
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_1
+DROP TABLE t1;
+
+#
+# Test the case where one node has a TEMPORARY table but the TRUNCATE arrives from another node
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (2);
+
+--connection node_2
+TRUNCATE TABLE t1;
+
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_1
+SELECT f1 = 2 FROM t1;
+SELECT COUNT(*) = 1 FROM t1;
+
+DROP TABLE t1;
+
+SELECT COUNT(*) = 0 FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_udf-master.opt b/mysql-test/suite/galera/t/galera_udf-master.opt
new file mode 100644
index 00000000000..14dfe3e20bc
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_udf-master.opt
@@ -0,0 +1,2 @@
+$UDF_EXAMPLE_LIB_OPT
+--query_cache_type=1
diff --git a/mysql-test/suite/galera/t/galera_unicode_identifiers.test b/mysql-test/suite/galera/t/galera_unicode_identifiers.test
index 4722d6d61a2..9adac1aa555 100644
--- a/mysql-test/suite/galera/t/galera_unicode_identifiers.test
+++ b/mysql-test/suite/galera/t/galera_unicode_identifiers.test
@@ -21,8 +21,8 @@ CREATE TABLE `table with space` (
`column with space` INTEGER AUTO_INCREMENT PRIMARY KEY,
`second column with space` INTEGER,
UNIQUE `index name with space` (`second column with space`)
-) ENGINE=INNODB;
-INSERT INTO `table with space` VALUES (DEFAULT, 1);
+);
+INSERT INTO `table with space` VALUES (1, 1);
# Unicode identifiers
@@ -32,7 +32,7 @@ CREATE TABLE `таблица` (
`първа_колона` INTEGER PRIMARY KEY,
`втора_колона` INTEGER,
UNIQUE `индекÑ` (`втора_колона`)
-) ENGINE=INNODB;
+);
INSERT INTO `таблица` VALUES (1, 1);
@@ -44,19 +44,19 @@ CREATE TABLE `втора таблица` (
`първа колона` INTEGER,
`втора колона` INTEGER,
KEY `първи индекÑ` (`първа колона`)
-) ENGINE=INNODB;
+);
INSERT INTO `втора таблица` VALUES (1, 1);
--connection node_2
USE `database with space`;
-SELECT * FROM `table with space`;
+SELECT `second column with space` FROM `table with space`;
USE `база`;
SELECT * FROM `таблица`;
USE `втора база`;
-SELECT * FROM `втора таблица`;
+SELECT `втора колона` FROM `втора таблица`;
--eval SET GLOBAL wsrep_sync_wait = $wsrep_sync_wait_orig
diff --git a/mysql-test/suite/galera/t/galera_unicode_pk.test b/mysql-test/suite/galera/t/galera_unicode_pk.test
new file mode 100644
index 00000000000..0d571f5cfd7
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_unicode_pk.test
@@ -0,0 +1,64 @@
+#
+# Test non-ascii data in table where the PK is unicode
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (
+ f1 VARCHAR(255) PRIMARY KEY
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+INSERT INTO t1 VALUES ('текÑÑ‚');
+
+--connection node_2
+SELECT f1 = 'текÑÑ‚' FROM t1;
+
+#
+# Provoke a conflict
+#
+
+--connection node_1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'текÑÑ‚2';
+
+--connection node_2
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'текÑÑ‚3';
+
+--connection node_1
+COMMIT;
+
+--connection node_2
+--error ER_LOCK_DEADLOCK
+COMMIT;
+
+SELECT f1 = 'текÑÑ‚2' FROM t1;
+SELECT f1 = 'текÑÑ‚2' FROM t1 WHERE f1 = 'текÑÑ‚2';
+
+#
+# Provoke a duplicate key error
+#
+
+--connection node_2
+START TRANSACTION;
+INSERT INTO t1 VALUES ('текÑÑ‚4');
+
+--connection node_1
+START TRANSACTION;
+INSERT INTO t1 VALUES ('текÑÑ‚4');
+
+--connection node_2
+COMMIT;
+
+--connection node_1
+--error ER_LOCK_DEADLOCK
+COMMIT;
+
+# Work around for mysql-wsrep#29 'Spurious deadlock error on a DROP TABLE'
+--error 0,ER_LOCK_DEADLOCK
+COMMIT;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_update_limit.test b/mysql-test/suite/galera/t/galera_update_limit.test
new file mode 100644
index 00000000000..baacf2a60b2
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_update_limit.test
@@ -0,0 +1,55 @@
+#
+# UPDATE LIMIT should not cause any issues with row-based Galera replication
+# regardless of the order in which the rows were updated
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# With a PK
+#
+
+--connection node_1
+CREATE TABLE ten (f1 INTEGER) Engine=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+INSERT INTO t1 SELECT f1 FROM ten ORDER BY RAND();
+
+--connection node_2
+UPDATE IGNORE t1 SET f1 = FLOOR(1 + (RAND() * 10)) ORDER BY RAND() LIMIT 5;
+
+# Check that the sum of all elements and the max element are identical across nodes
+# as this will indicate that the same UPDATE was applied to both nodes
+
+--let $sum_rows = `SELECT SUM(f1) FROM t1`
+--let $max_row = `SELECT MAX(f1) FROM t1`
+
+--connection node_1
+--disable_query_log
+--eval SELECT (SELECT SUM(f1) FROM t1) = $sum_rows AS sum_matches;
+--eval SELECT f1 = $max_row AS max_matches FROM t1 WHERE f1 = $max_row;
+--enable_query_log
+
+DROP TABLE t1;
+
+#
+# Without a PK
+#
+
+CREATE TABLE t2 (f1 INTEGER) Engine=InnoDB;
+INSERT INTO t2 SELECT f1 FROM ten ORDER BY RAND();
+
+--connection node_2
+UPDATE IGNORE t2 SET f1 = FLOOR(1 + (RAND() * 10)) ORDER BY RAND() LIMIT 5;
+
+--let $sum_rows = `SELECT SUM(f1) FROM t2`
+
+--connection node_1
+--disable_query_log
+--eval SELECT (SELECT SUM(f1) FROM t2) = $sum_rows AS sum_matches;
+--enable_query_log
+
+DROP TABLE t2;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/t/galera_v1_row_events-master.opt b/mysql-test/suite/galera/t/galera_v1_row_events-master.opt
new file mode 100644
index 00000000000..dc82542128e
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_v1_row_events-master.opt
@@ -0,0 +1 @@
+--log-bin-use-v1-row-events=1
diff --git a/mysql-test/suite/galera/t/galera_v1_row_events.test b/mysql-test/suite/galera/t/galera_v1_row_events.test
new file mode 100644
index 00000000000..0c0a044510e
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_v1_row_events.test
@@ -0,0 +1,21 @@
+#
+# Test that Galera continues to run even with --log-bin-use-v1-row-events=1
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+
+--connection node_1
+UPDATE t1 SET f1 = 2 WHERE f1 = 1;
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_var_OSU_method.test b/mysql-test/suite/galera/t/galera_var_OSU_method.test
new file mode 100644
index 00000000000..fcf964c4f89
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_var_OSU_method.test
@@ -0,0 +1,45 @@
+#
+# Test that the wsrep_var_OSU_method variable can be changed in the middle of an ALTER without adverse effects.
+# In-depth testing of various OSU methods is implemented in separate tests.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/have_debug_sync.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+
+--connection node_1
+SET SESSION wsrep_OSU_method = "RSU";
+SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue';
+--send ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connection node_1a
+
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'debug sync point: alter_table_before_open_tables'
+--source include/wait_condition.inc
+
+SET GLOBAL wsrep_OSU_method = "TOI";
+SET DEBUG_SYNC= 'now SIGNAL continue';
+
+--connection node_1
+--reap
+
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+
+--connection node_2
+# The ALTER above is not visible on node_2
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+
+--connection node_1
+SET SESSION wsrep_OSU_method = "TOI";
+
+--connection node_1
+SET DEBUG_SYNC= 'RESET';
+
+--connection node_1a
+SET DEBUG_SYNC= 'RESET';
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_var_OSU_method2.test b/mysql-test/suite/galera/t/galera_var_OSU_method2.test
new file mode 100644
index 00000000000..099e2cc6612
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_var_OSU_method2.test
@@ -0,0 +1,47 @@
+#
+# Test that the wsrep_var_OSU_method variable can be changed in the middle of an ALTER without adverse effects.
+# In-depth testing of various OSU methods is implemented in separate tests.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/have_debug_sync.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+
+--connection node_1
+SET SESSION wsrep_OSU_method = "TOI";
+SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue';
+--send ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connection node_1a
+
+SET SESSION wsrep_sync_wait = 0;
+
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'debug sync point: alter_table_before_open_tables'
+--source include/wait_condition.inc
+
+SET GLOBAL wsrep_OSU_method = "RSU";
+SET DEBUG_SYNC= 'now SIGNAL continue';
+
+--connection node_1
+--reap
+
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+INSERT INTO t1 VALUES (1,2);
+
+--connection node_2
+# The ALTER above is visible on node_2
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+INSERT INTO t1 VALUES (3,4);
+
+--connection node_1
+SET GLOBAL wsrep_OSU_method = "TOI";
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';
+
+--connection node_1a
+SET DEBUG_SYNC= 'RESET';
+
diff --git a/mysql-test/suite/galera/t/galera_var_auto_inc_control_off.test b/mysql-test/suite/galera/t/galera_var_auto_inc_control_off.test
index 1ae08abc920..c0bbe5af8cf 100644
--- a/mysql-test/suite/galera/t/galera_var_auto_inc_control_off.test
+++ b/mysql-test/suite/galera/t/galera_var_auto_inc_control_off.test
@@ -88,6 +88,8 @@ SELECT * FROM t1;
# Restore all variables as they were
#
+--disable_query_log
+
--connection node_1
--eval SET GLOBAL wsrep_auto_increment_control = $auto_increment_control_orig
--eval SET GLOBAL auto_increment_increment = $auto_increment_increment_node1
@@ -98,4 +100,6 @@ SELECT * FROM t1;
--eval SET GLOBAL auto_increment_increment = $auto_increment_increment_node2
--eval SET GLOBAL auto_increment_offset = $auto_increment_offset_node2
+--enable_query_log
+
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.test b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.test
index 4d1b9af1573..d65a35be4d1 100644
--- a/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.test
+++ b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.test
@@ -9,13 +9,11 @@
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, node VARCHAR(10)) ENGINE=InnoDB;
-SHOW CREATE TABLE t1;
-
# auto_increment_increment is equal to the number of nodes
# auto_increment_offset is equal to the ID of the node
SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size');
-SELECT @@auto_increment_offset = 1;
+SELECT @@global.auto_increment_offset = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index') + 1;
# Expect no conflicts
--send INSERT INTO t1 VALUES (DEFAULT, 'node1');
@@ -29,9 +27,8 @@ SELECT @@auto_increment_offset = 1;
--connection node_2
--reap
-SHOW CREATE TABLE t1;
SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size');
-SELECT @@auto_increment_offset = 2;
+SELECT @@global.auto_increment_offset = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index') + 1;
# Expect no conflicts
--send INSERT INTO t1 VALUES (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2');
diff --git a/mysql-test/suite/galera/t/galera_var_certify_nonPK_off.test b/mysql-test/suite/galera/t/galera_var_certify_nonPK_off.test
index f7967daebe7..3e8f3d18859 100644
--- a/mysql-test/suite/galera/t/galera_var_certify_nonPK_off.test
+++ b/mysql-test/suite/galera/t/galera_var_certify_nonPK_off.test
@@ -16,7 +16,7 @@ CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB /* Table has no primary key */;
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
# All DML without a PK is rejected with an error
---error ER_LOCK_DEADLOCK
+--error ER_LOCK_DEADLOCK,ER_ERROR_DURING_COMMIT
INSERT INTO t1 VALUES (1), (2);
# DML with a PK is allowed to proceed
diff --git a/mysql-test/suite/galera/t/galera_var_cluster_address.test b/mysql-test/suite/galera/t/galera_var_cluster_address.test
new file mode 100644
index 00000000000..dfd84002dd6
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_var_cluster_address.test
@@ -0,0 +1,110 @@
+#
+# Check the handling of @@wsrep_cluster_address
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+# Save original auto_increment_offset values.
+--connection node_1
+let $auto_increment_offset_node_1 = `SELECT @@global.auto_increment_offset`;
+--connection node_2
+let $auto_increment_offset_node_2 = `SELECT @@global.auto_increment_offset`;
+
+#
+# Set to invalid value
+#
+
+--connection node_1
+--let $wsrep_cluster_address_node1 = `SELECT @@wsrep_cluster_address`
+SET GLOBAL wsrep_cluster_address = 'foo://';
+
+# With wsrep_sync_wait, this returns an error
+#--error ER_LOCK_WAIT_TIMEOUT
+#SHOW STATUS;
+
+SET SESSION wsrep_sync_wait=0;
+
+--error ER_UNKNOWN_COM_ERROR
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS;
+
+# Must return 'OFF'
+SHOW STATUS LIKE 'wsrep_ready';
+
+# Must return 'Non-primary'
+SHOW STATUS LIKE 'wsrep_cluster_status';
+
+# Must return 0 = 'Initialized'
+SHOW STATUS LIKE 'wsrep_local_state';
+SHOW STATUS LIKE 'wsrep_local_state_comment';
+
+--connection node_2
+--sleep 1
+# Node #2 thinks that it is now part of a single-node primary cluster
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+
+#
+# Reset everything as it was
+#
+
+--connection node_1
+--disable_query_log
+--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_node1';
+--enable_query_log
+
+--connection node_2
+SET GLOBAL wsrep_cluster_address = @@wsrep_cluster_address;
+
+--source include/wait_until_connected_again.inc
+
+--connection node_1
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+#
+# Set to invalid host
+#
+
+--connection node_1
+SET GLOBAL wsrep_cluster_address = 'gcomm://192.0.2.1';
+
+--error ER_UNKNOWN_COM_ERROR
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS;
+
+# Must return 'OFF'
+SHOW STATUS LIKE 'wsrep_ready';
+
+# Must return 'Non-primary'
+SHOW STATUS LIKE 'wsrep_cluster_status';
+
+# Must return 0 = 'Initialized'
+SHOW STATUS LIKE 'wsrep_local_state';
+SHOW STATUS LIKE 'wsrep_local_state_comment';
+
+#
+# Reset everything as it was
+#
+
+--connection node_1
+--disable_query_log
+--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_node1';
+--enable_query_log
+
+--connection node_2
+SET GLOBAL wsrep_cluster_address = @@wsrep_cluster_address;
+--sleep 1
+
+--connection node_1
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+# Restore original auto_increment_offset values.
+--disable_query_log
+--connection node_1
+--eval SET @@global.auto_increment_offset = $auto_increment_offset_node_1;
+--connection node_2
+--eval SET @@global.auto_increment_offset = $auto_increment_offset_node_2;
+--enable_query_log
+
+
diff --git a/mysql-test/suite/galera/t/galera_var_desync_on.test b/mysql-test/suite/galera/t/galera_var_desync_on.test
new file mode 100644
index 00000000000..fb0fb9f762a
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_var_desync_on.test
@@ -0,0 +1,58 @@
+#
+# Test wsrep_desync = ON . Node should temporarily not participate in flow control
+# so even if fc_limit has been reached, the master should be able to continue to
+# commit transactions.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options`
+SET GLOBAL wsrep_provider_options = 'gcs.fc_limit=1';
+SET GLOBAL wsrep_desync = TRUE;
+
+# Block the slave applier thread
+FLUSH TABLES WITH READ LOCK;
+
+--connection node_1
+
+# Without wsrep_desync = TRUE it would not be possible to perform 10 inserts on the master with gcs.fc_limit=1
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (7);
+INSERT INTO t1 VALUES (8);
+INSERT INTO t1 VALUES (9);
+INSERT INTO t1 VALUES (10);
+--sleep 1
+
+--connection node_2
+SET SESSION wsrep_sync_wait = 0;
+# No updates have arrived after the FLUSH TABLES
+SELECT COUNT(*) = 1 FROM t1;
+
+# Resync the slave
+SET GLOBAL wsrep_desync = FALSE;
+--disable_query_log
+--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig';
+--enable_query_log
+UNLOCK TABLES;
+
+SET SESSION wsrep_sync_wait = 1;
+# The slave is now fully caught up
+SELECT COUNT(*) = 10 FROM t1;
+
+--connection node_1
+INSERT INTO t1 VALUES (11);
+
+--connection node_2
+# Replication continues normally
+SELECT COUNT(*) = 11 FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test b/mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test
new file mode 100644
index 00000000000..c08483b63ad
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test
@@ -0,0 +1,33 @@
+#
+# This test checks that innodb_disallow_writes works as expected
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+# Open a separate connection to be used to run SHOW PROCESSLIST
+--let $galera_connection_name = node_1a
+--let $galera_server_number = 1
+--source include/galera_connect.inc
+--connection node_1a
+SET SESSION wsrep_sync_wait = 0;
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
+SET GLOBAL innodb_disallow_writes=ON;
+--send INSERT INTO t1 VALUES (1);
+
+--connection node_1a
+let $wait_condition = SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO = 'INSERT INTO t1 VALUES (1)' AND State = 'query end';
+--source include/wait_condition.inc
+
+SET GLOBAL innodb_disallow_writes=OFF;
+
+--connection node_1
+--reap
+SELECT COUNT(*) = 1 FROM t1;
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_var_load_data_splitting.test b/mysql-test/suite/galera/t/galera_var_load_data_splitting.test
new file mode 100644
index 00000000000..0783dc897f8
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_var_load_data_splitting.test
@@ -0,0 +1,38 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--let $wsrep_load_data_splitting_orig = `SELECT @@wsrep_load_data_splitting`
+
+# Create a file for LOAD DATA with 95K entries
+--perl
+open(FILE, ">", "$ENV{'MYSQLTEST_VARDIR'}/tmp/galera_var_load_data_splitting.csv") or die;
+foreach my $i (1..95000) {
+ print FILE "$i\n";
+}
+EOF
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+# Record wsrep_last_committed as it was before LOAD DATA
+--connection node_2
+--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+SET GLOBAL wsrep_load_data_splitting = TRUE;
+--disable_query_log
+--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/galera_var_load_data_splitting.csv' INTO TABLE t1;
+--enable_query_log
+
+--connection node_2
+--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+SELECT COUNT(*) = 95000 FROM t1;
+
+# LOAD-ing 95K rows causes 10 commits to be registered
+--disable_query_log
+--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 10 AS wsrep_last_committed_diff;
+--enable_query_log
+
+--connection node_1
+--eval SET GLOBAL wsrep_load_data_splitting = $wsrep_load_data_splitting_orig;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_var_max_ws_size.test b/mysql-test/suite/galera/t/galera_var_max_ws_size.test
new file mode 100644
index 00000000000..b66ef2d5ee2
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_var_max_ws_size.test
@@ -0,0 +1,23 @@
+#
+# This test sets wsrep_max_ws_size to a very low value and checks that the transaction is rejected
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 VARCHAR(1024)) Engine=InnoDB;
+
+--let $wsrep_max_ws_size_orig = `SELECT @@wsrep_max_ws_size`
+SET GLOBAL wsrep_max_ws_size = 1024;
+
+--error ER_ERROR_DURING_COMMIT
+INSERT INTO t1 VALUES (DEFAULT, REPEAT('X', 1024));
+SELECT COUNT(*) = 0 FROM t1;
+
+--disable_query_log
+--eval SET GLOBAL wsrep_max_ws_size = $wsrep_max_ws_size_orig
+--enable_query_log
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_var_notify_cmd-master.opt b/mysql-test/suite/galera/t/galera_var_notify_cmd-master.opt
new file mode 100644
index 00000000000..70dfc98736b
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_var_notify_cmd-master.opt
@@ -0,0 +1 @@
+--wsrep_notify_cmd=$MYSQL_TEST_DIR/std_data/wsrep_notify.sh --wsrep-sync-wait=0
diff --git a/mysql-test/suite/galera/t/galera_var_notify_cmd.test b/mysql-test/suite/galera/t/galera_var_notify_cmd.test
new file mode 100644
index 00000000000..4fea69f62bb
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_var_notify_cmd.test
@@ -0,0 +1,14 @@
+#
+# Test wsrep_notify_cmd. We use a version of the support-files/wsrep_notify.sh script that writes
+# notifications into a table.
+#
+
+--source include/have_innodb.inc
+--source include/galera_cluster.inc
+
+--connection node_1
+SELECT COUNT(DISTINCT uuid) = 2 FROM mtr_wsrep_notify.membership;
+SELECT MAX(size) = 2 FROM mtr_wsrep_notify.status;
+SELECT COUNT(DISTINCT idx) = 2 FROM mtr_wsrep_notify.status;
+
+DROP SCHEMA mtr_wsrep_notify;
diff --git a/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test b/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test
index f6838028e66..9cb0edf1810 100644
--- a/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test
+++ b/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test
@@ -5,17 +5,135 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
+--connection node_1
--let $wsrep_replicate_myisam_orig = `SELECT @@wsrep_replicate_myisam`
+--connection node_1
SET GLOBAL wsrep_replicate_myisam = TRUE;
+--connection node_2
+SET GLOBAL wsrep_replicate_myisam = TRUE;
+
+#
+# Simple INSERT
+#
+--connection node_1
CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=MyISAM;
INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2), (3);
+INSERT INTO t1 SELECT 4 FROM DUAL UNION ALL SELECT 5 FROM DUAL;
+
+--connection node_2
+SELECT COUNT(*) = 5 FROM t1;
+
+DROP TABLE t1;
+
+#
+# REPLACE
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(100)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1, 'abc'),(2,'abc'), (3, 'xxx');
+REPLACE INTO t1 VALUES (1, 'klm'), (2,'xyz');
+REPLACE INTO t1 SELECT 3, 'yyy' FROM DUAL;
+
+--connection node_2
+SELECT COUNT(*) = 3 FROM t1;
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1 AND f2 = 'klm';
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2 AND f2 = 'xyz';
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 3 AND f2 = 'yyy';
+
+#
+# UPDATE
+#
+
+--connection node_1
+UPDATE t1 SET f2 = 'zzz' WHERE f2 = 'yyy';
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'zzz';
+
+#
+# DELETE
+#
+
+--connection node_1
+DELETE FROM t1 WHERE f2 = 'zzz';
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'zzz';
+
+#
+# TRUNCATE
+#
+
+--connection node_1
+TRUNCATE TABLE t1;
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM t1;
+DROP TABLE t1;
+
+#
+# Transaction
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+COMMIT;
--connection node_2
SELECT COUNT(*) = 1 FROM t1;
+SELECT COUNT(*) = 1 FROM t2;
+
+#
+# Transaction rollback
+#
--connection node_1
---eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig
+START TRANSACTION;
+INSERT INTO t1 VALUES (2);
+INSERT INTO t2 VALUES (2);
+ROLLBACK;
+
+--connection node_2
+SELECT COUNT(*) = 2 FROM t1;
+SELECT COUNT(*) = 1 FROM t2;
+
+DROP TABLE t1;
+DROP TABLE t2;
+
+#
+# Transaction conflict
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=MyISAM;
+CREATE TABLE t2 (f2 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+--connection node_2
+# The MyISAM update is replicated immediately, so a duplicate key error happens even before the COMMIT
+--error ER_DUP_ENTRY
+INSERT INTO t1 VALUES (1);
+
+--connection node_1
+COMMIT;
DROP TABLE t1;
+DROP TABLE t2;
+
+--connection node_1
+--eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig
+
+--connection node_2
+--eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig
diff --git a/mysql-test/suite/galera/t/galera_var_slave_threads.test b/mysql-test/suite/galera/t/galera_var_slave_threads.test
new file mode 100644
index 00000000000..a83924c13ce
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_var_slave_threads.test
@@ -0,0 +1,70 @@
+#
+# This tests the very basic operations around wsrep-slave-threads
+# More complex scenarios will be tested separately in the context of
+# parallel replication
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads`
+
+--connection node_1
+CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB;
+CREATE TABLE t2 (f1 INT AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB;
+
+--connection node_2
+
+# Setting wsrep_slave_threads to zero triggers a warning
+SET GLOBAL wsrep_slave_threads = 0;
+SHOW WARNINGS;
+SELECT @@wsrep_slave_threads = 1;
+
+SET GLOBAL wsrep_slave_threads = 1;
+# There is a separate wsrep_aborter thread at all times
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
+
+#
+# Increase the number of slave threads. The change takes effect immediately
+#
+
+SET GLOBAL wsrep_slave_threads = 64;
+--sleep 0.5
+
+--connection node_1
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+
+SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
+
+#
+# Reduce the number of slave threads. The change is not immediate -- a thread will only exit after a replication event
+#
+
+SET GLOBAL wsrep_slave_threads = 1;
+
+--connection node_1
+
+# Generate 64 replication events
+--let $count = 64
+while ($count)
+{
+ INSERT INTO t2 VALUES (DEFAULT);
+ --dec $count
+}
+
+--connection node_2
+SELECT COUNT(*) = 64 FROM t2;
+
+SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
+
+
+--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig
+
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/t/galera_var_wsrep_on_off.test b/mysql-test/suite/galera/t/galera_var_wsrep_on_off.test
new file mode 100644
index 00000000000..783b78792e6
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_var_wsrep_on_off.test
@@ -0,0 +1,32 @@
+#
+# Test wsrep_on = OFF. Some events will not be replicated
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SET SESSION wsrep_on = FALSE;
+
+# This statement will not be replicated
+INSERT INTO t1 VALUES (2);
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+
+--connection node_1
+SET GLOBAL wsrep_on = TRUE;
+INSERT INTO t1 VALUES (3);
+
+--connection node_2
+SELECT COUNT(*) = 2 FROM t1;
+
+# Middle insert is not replicated
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 2;
+
+# Final insert is replicated
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 3;
+
+DROP TABLE t1;
+
diff --git a/mysql-test/suite/galera/t/galera_wan.cnf b/mysql-test/suite/galera/t/galera_wan.cnf
new file mode 100644
index 00000000000..0effd59403b
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_wan.cnf
@@ -0,0 +1,14 @@
+!include ../galera_4nodes.cnf
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M;gmcast.segment=1'
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M;gmcast.segment=1'
+
+[mysqld.3]
+wsrep_provider_options='base_port=@mysqld.3.#galera_port;gcache.size=10M;gmcast.segment=2'
+
+[mysqld.4]
+wsrep_provider_options='base_port=@mysqld.4.#galera_port;gcache.size=10M;gmcast.segment=3'
+
diff --git a/mysql-test/suite/galera/t/galera_wan.test b/mysql-test/suite/galera/t/galera_wan.test
new file mode 100644
index 00000000000..a8fd351b168
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_wan.test
@@ -0,0 +1,30 @@
+#
+# Test WAN replication and the gmcast.segment functionality.
+# The galera_wan.cnf file partitions 4 Galera nodes into 3 WAN segments
+#
+# We can not test any of the actual WAN optimizations from inside MTR and no
+# status variables are provided. So we only check that simple replication works.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER);
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--connection node_3
+INSERT INTO t1 VALUES (1);
+CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside");
+
+--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4
+--connection node_4
+SELECT VARIABLE_VALUE LIKE '%gmcast.segment = 3%' FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'wsrep_provider_options';
+
+SELECT COUNT(*) = 1 FROM t1;
+
+DROP TABLE t1;
+
+CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside");
diff --git a/mysql-test/suite/galera/t/galera_wsrep_desync_wsrep_on.test b/mysql-test/suite/galera/t/galera_wsrep_desync_wsrep_on.test
new file mode 100644
index 00000000000..3c7988a4924
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_wsrep_desync_wsrep_on.test
@@ -0,0 +1,57 @@
+#
+# Test the wsrep_desync + wsrep_on method for schema upgrades discussed at
+# http://www.slideshare.net/Severalnines/schema-upgrades-codershippresodec2013 , slide 30
+#
+
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
+
+# Insert some values before the ALTER
+INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+
+--connection node_2
+SET GLOBAL wsrep_desync = TRUE;
+SET SESSION wsrep_on = FALSE;
+
+ALTER TABLE t1 ADD PRIMARY KEY (f1);
+
+SET SESSION wsrep_on = TRUE;
+SET GLOBAL wsrep_desync = FALSE;
+
+# Insert even more data after the ALTER has completed
+INSERT INTO t1 (f1) SELECT 100000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+
+SELECT COUNT(*) = 200000 FROM t1;
+SELECT MAX(f1) = 199999 FROM t1;
+
+--connection node_1
+SELECT COUNT(*) = 200000 FROM t1;
+SELECT MAX(f1) = 199999 FROM t1;
+
+SET GLOBAL wsrep_desync = TRUE;
+SET SESSION wsrep_on = FALSE;
+
+ALTER TABLE t1 ADD PRIMARY KEY (f1);
+
+SET SESSION wsrep_on = TRUE;
+SET GLOBAL wsrep_desync = FALSE;
+
+# Insert some conflicting values after the ALTER has been applied on all nodes.
+
+--connection node_2
+--error ER_DUP_ENTRY
+INSERT INTO t1 (f1) VALUES (1);
+
+--connection node_1
+--error ER_DUP_ENTRY
+INSERT INTO t1 (f1) VALUES (100);
+
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/t/galera_wsrep_new_cluster-master.opt b/mysql-test/suite/galera/t/galera_wsrep_new_cluster-master.opt
new file mode 100644
index 00000000000..c31150c46af
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_wsrep_new_cluster-master.opt
@@ -0,0 +1 @@
+--wsrep-new-cluster
diff --git a/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test b/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test
new file mode 100644
index 00000000000..6ba8ce786c8
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test
@@ -0,0 +1,24 @@
+#
+# Test the --wsrep-new-cluster option by putting it in the galera_wsrep_new_cluster-master.opt file
+#
+# In MTR, running two nodes, the result is two separate clusters of size 1
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+
+--connection node_2
+
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
diff --git a/mysql-test/suite/galera/t/galera_wsrep_provider_unset_set.test b/mysql-test/suite/galera/t/galera_wsrep_provider_unset_set.test
new file mode 100644
index 00000000000..fe4c358bd89
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_wsrep_provider_unset_set.test
@@ -0,0 +1,41 @@
+#
+# Test that wsrep_provider can be unset and then set back to its original value
+# and replication will continue except for any updates made while the value was 'none'
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+--let $wsrep_provider_orig = `SELECT @@wsrep_provider`
+--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address`
+
+SET GLOBAL wsrep_provider='none';
+INSERT INTO t1 VALUES (2);
+
+--connection node_1
+INSERT INTO t1 VALUES (3);
+
+--connection node_2
+--disable_query_log
+--eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig';
+--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig';
+--enable_query_log
+
+--source include/wait_until_connected_again.inc
+--source include/galera_wait_ready.inc
+
+INSERT INTO t1 VALUES (4);
+
+# Node #2 has all the inserts
+SELECT COUNT(*) = 4 FROM t1;
+
+--connection node_1
+# Node #1 is missing the insert made while Node #2 was not replicated
+SELECT COUNT(*) = 3 FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_zero_length_column.test b/mysql-test/suite/galera/t/galera_zero_length_column.test
new file mode 100644
index 00000000000..6ae81a83271
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_zero_length_column.test
@@ -0,0 +1,41 @@
+#
+# Test columns with size zero. This is known to have tripped other storage engines.
+# Keys are not allowed on such columns
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY , f2 VARCHAR(0)) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 VARCHAR(0)) ENGINE=InnoDB;
+
+
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (2, '');
+
+INSERT INTO t2 VALUES (NULL);
+INSERT INTO t2 VALUES ('');
+
+--connection node_2
+SELECT COUNT(*) = 2 FROM t1;
+SELECT f2 IS NULL FROM t1 WHERE f1 = 1;
+SELECT f2 = '' FROM t1 WHERE f1 = 2;
+
+SELECT COUNT(*) = 2 FROM t2;
+SELECT f1 IS NULL FROM t2 WHERE f1 IS NULL;
+SELECT f1 = '' FROM t2 WHERE f1 IS NOT NULL;
+
+UPDATE t1 SET f2 = '' WHERE f1 = 1;
+UPDATE t1 SET f2 = NULL WHERE f1 = 2;
+
+UPDATE t2 SET f1 = '' WHERE f1 IS NULL;
+
+--connection node_1
+SELECT f2 = '' FROM t1 WHERE f1 = 1;
+SELECT f2 IS NULL FROM t1 WHERE f1 = 2;
+
+SELECT COUNT(*) = 2 FROM t2 WHERE f1 = '';
+
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/t/lp1276424.test b/mysql-test/suite/galera/t/lp1276424.test
new file mode 100644
index 00000000000..a37e950b6a1
--- /dev/null
+++ b/mysql-test/suite/galera/t/lp1276424.test
@@ -0,0 +1,17 @@
+#
+# LP:1276424 Deadlock with insertion of NULL unique ke
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 INT DEFAULT NULL, UNIQUE KEY i1 (f1)) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (NULL);
+INSERT INTO t1 VALUES (NULL);
+
+--connection node_2
+SELECT COUNT(*) = 2 FROM t1;
+SELECT f1 IS NULL FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/lp1347768.test b/mysql-test/suite/galera/t/lp1347768.test
new file mode 100644
index 00000000000..96d42867c6a
--- /dev/null
+++ b/mysql-test/suite/galera/t/lp1347768.test
@@ -0,0 +1,24 @@
+#
+# LP:1347768 Assertion failure in file ha_innodb.cc line 6759
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE `r8kmb_redirect_links` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `old_url` varchar(255) DEFAULT NULL,
+ `new_url` varchar(255) NOT NULL,
+ `referer` varchar(150) NOT NULL,
+ `comment` varchar(255) NOT NULL,
+ `published` tinyint(4) NOT NULL,
+ `created_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `modified_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `idx_link_old` (`old_url`),
+ KEY `idx_link_modifed` (`modified_date`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+INSERT INTO r8kmb_redirect_links VALUES (550,'http://mysite.com/images/download/ßуñûічýøù_ôþóþòір_þфõÑ.doc','','','',0,'2013-07-15 14:29:42','0000-00-00 00:00:00');
+
+DROP TABLE r8kmb_redirect_links;
diff --git a/mysql-test/suite/galera/t/lp959512.test b/mysql-test/suite/galera/t/lp959512.test
new file mode 100644
index 00000000000..bcc0db24ea7
--- /dev/null
+++ b/mysql-test/suite/galera/t/lp959512.test
@@ -0,0 +1,26 @@
+#
+# LP#959512 IO cache not reset at trx cleanup if write set was empty Edit
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+DROP TABLE IF EXISTS variable;
+DROP TABLE IF EXISTS foo;
+CREATE TABLE variable (
+ name varchar(128) NOT NULL DEFAULT '' COMMENT 'The name of the variable.',
+ value longblob NOT NULL COMMENT 'The value of the variable.',
+ PRIMARY KEY (name)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Named variable/value pairs created by Drupal core or any...';
+CREATE TABLE foo (a int);
+INSERT INTO variable (name, value) VALUES ('menu_expanded', 'a:0:{}');
+START TRANSACTION;
+SELECT 1 AS expression FROM variable variable
+ WHERE ( (name = 'menu_expanded') ) FOR UPDATE;
+UPDATE variable SET value='a:0:{}' WHERE ( (name = 'menu_expanded') );
+COMMIT;
+INSERT INTO foo VALUES (1);
+UPDATE foo SET a = 2 WHERE a = 1;
+
+DROP TABLE foo;
+DROP TABLE variable;
diff --git a/mysql-test/suite/galera/t/mysql-wsrep#33.cnf b/mysql-test/suite/galera/t/mysql-wsrep#33.cnf
new file mode 100644
index 00000000000..f1c3d802e4b
--- /dev/null
+++ b/mysql-test/suite/galera/t/mysql-wsrep#33.cnf
@@ -0,0 +1,8 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true'
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true'
+
diff --git a/mysql-test/suite/galera/t/mysql-wsrep#33.test b/mysql-test/suite/galera/t/mysql-wsrep#33.test
new file mode 100644
index 00000000000..acc7c735849
--- /dev/null
+++ b/mysql-test/suite/galera/t/mysql-wsrep#33.test
@@ -0,0 +1,18 @@
+
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--source suite/galera/include/galera_sst_set_mysqldump.inc
+
+--source suite/galera/include/galera_st_disconnect_slave.inc
+
+--source suite/galera/include/galera_sst_restore.inc
+
+--connection node_2
+# We have to manually restore global_log and slow_query_log due to mysql-wsrep#108
+# Otherwise MTR's check_testcases complains
+
+SET GLOBAL general_log = ON;
+SET GLOBAL slow_query_log = ON;
+
diff --git a/mysql-test/suite/galera/t/partition.test b/mysql-test/suite/galera/t/partition.test
index 048f35a9282..bb5a02411c3 100644
--- a/mysql-test/suite/galera/t/partition.test
+++ b/mysql-test/suite/galera/t/partition.test
@@ -27,5 +27,181 @@ SELECT * FROM t1;
# Cleanup
DROP TABLE t1;
+
+--echo #
+--echo # MDEV#7501 : alter table exchange partition is not replicated in
+--echo # galera cluster
+--echo #
+
+--echo
+--echo # On node_1
+--connection node_1
+
+CREATE TABLE test.t1 (
+ i INT UNSIGNED NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (i)
+ ) ENGINE=INNODB
+ PARTITION BY RANGE (i)
+ (PARTITION p1 VALUES LESS THAN (10) ENGINE = INNODB,
+ PARTITION p2 VALUES LESS THAN (20) ENGINE = INNODB,
+ PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = INNODB);
+
+INSERT INTO test.t1 (i) VALUE (9),(19);
+CREATE TABLE test.p1 LIKE test.t1;
+ALTER TABLE test.p1 REMOVE PARTITIONING;
+
+ALTER TABLE test.t1 EXCHANGE PARTITION p1 WITH TABLE test.p1;
+SELECT * FROM test.t1;
+SELECT * FROM test.p1;
+
+--echo
+--echo # On node_2
+--connection node_2
+
+SHOW CREATE TABLE t1;
+SHOW CREATE TABLE p1;
+
+SELECT * FROM test.t1;
+SELECT * FROM test.p1;
+
+--echo
+--echo # On node_1
+--connection node_1
+ALTER TABLE t1 TRUNCATE PARTITION p2;
+SELECT * FROM test.t1;
+
+--echo
+--echo # On node_2
+--connection node_2
+SELECT * FROM test.t1;
+
+--echo
+--echo # On node_1
+--connection node_1
+ALTER TABLE t1 DROP PARTITION p2;
+SHOW CREATE TABLE t1;
+
+--echo
+--echo # On node_2
+--connection node_2
+SHOW CREATE TABLE t1;
+
+
+# Cleanup
+DROP TABLE t1, p1;
+
+--echo #
+--echo # MDEV-5146: Bulk loads into partitioned table not working
+--echo #
+
+# Create 2 files with 20002 & 101 entries in each.
+--perl
+open(FILE, ">", "$ENV{'MYSQLTEST_VARDIR'}/tmp/mdev-5146-1.dat") or die;
+foreach my $i (1..20002) {
+ print FILE "$i\n";
+}
+
+open(FILE, ">", "$ENV{'MYSQLTEST_VARDIR'}/tmp/mdev-5146-2.dat") or die;
+foreach my $i (1..101) {
+ print FILE "$i\n";
+}
+EOF
+
+--connection node_1
+
+--let $wsrep_load_data_splitting_orig = `SELECT @@wsrep_load_data_splitting`
+
+--echo # Case 1: wsrep_load_data_splitting = ON & LOAD DATA with 20002
+--echo # entries.
+
+SET GLOBAL wsrep_load_data_splitting = ON;
+
+CREATE TABLE t1 (pk INT PRIMARY KEY)
+ ENGINE=INNODB PARTITION BY HASH(pk) PARTITIONS 2;
+
+# Record wsrep_last_committed as it was before LOAD DATA
+--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+--disable_query_log
+--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/mdev-5146-1.dat' INTO TABLE t1;
+--enable_query_log
+
+--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+--connection node_2
+SELECT COUNT(*) = 20002 FROM t1;
+
+# LOAD-ing 20002 rows causes 3 commits to be registered
+--disable_query_log
+--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 3 AS wsrep_last_committed_diff;
+--enable_query_log
+
+DROP TABLE t1;
+
+--echo # Case 2: wsrep_load_data_splitting = ON & LOAD DATA with 101 entries.
+
+--connection node_1
+
+SET GLOBAL wsrep_load_data_splitting = ON;
+
+CREATE TABLE t1 (pk INT PRIMARY KEY)
+ ENGINE=INNODB PARTITION BY HASH(pk) PARTITIONS 2;
+
+# Record wsrep_last_committed as it was before LOAD DATA
+--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+--disable_query_log
+--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/mdev-5146-2.dat' INTO TABLE t1;
+--enable_query_log
+
+--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+--connection node_2
+SELECT COUNT(*) = 101 FROM t1;
+
+# LOAD-ing 101 rows causes 1 commit to be registered
+--disable_query_log
+--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff;
+--enable_query_log
+
+DROP TABLE t1;
+
+--echo # Case 3: wsrep_load_data_splitting = OFF & LOAD DATA with 20002
+--echo # entries.
+
+--connection node_1
+
+SET GLOBAL wsrep_load_data_splitting = OFF;
+
+CREATE TABLE t1 (pk INT PRIMARY KEY)
+ ENGINE=INNODB PARTITION BY HASH(pk) PARTITIONS 2;
+
+# Record wsrep_last_committed as it was before LOAD DATA
+--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+--disable_query_log
+--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/mdev-5146-1.dat' INTO TABLE t1;
+--enable_query_log
+
+--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+--connection node_2
+SELECT COUNT(*) = 20002 FROM t1;
+
+# LOAD-ing 20002 rows causes 1 commit to be registered
+--disable_query_log
+--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff;
+--enable_query_log
+
+DROP TABLE t1;
+
+--connection node_1
+# Restore the original value
+--eval SET GLOBAL wsrep_load_data_splitting = $wsrep_load_data_splitting_orig;
+
+# Cleanup
+remove_file '$MYSQLTEST_VARDIR/tmp/mdev-5146-1.dat';
+remove_file '$MYSQLTEST_VARDIR/tmp/mdev-5146-2.dat';
+
--source include/galera_end.inc
--echo # End of test
diff --git a/mysql-test/suite/galera/t/rename.test b/mysql-test/suite/galera/t/rename.test
new file mode 100644
index 00000000000..326d64d3b8a
--- /dev/null
+++ b/mysql-test/suite/galera/t/rename.test
@@ -0,0 +1,53 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--echo #
+--echo # MDEV-8598 : Failed MySQL DDL commands and Galera replication
+--echo #
+--echo # On node 1
+--connection node_1
+USE test;
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+CREATE TABLE t1(i INT) ENGINE=INNODB;
+INSERT INTO t1 VALUE(1);
+SELECT * FROM t1;
+
+--echo # Create a new user 'foo' with limited privileges
+CREATE USER foo@localhost;
+GRANT SELECT on test.* TO foo@localhost;
+
+--echo # Open connection to the 1st node using 'test_user1' user.
+--let $port_1= \$NODE_MYPORT_1
+--connect(foo_node_1,localhost,foo,,test,$port_1,)
+
+--connection foo_node_1
+SELECT * FROM t1;
+--echo # Following RENAME should not replicate to other node.
+--error ER_TABLEACCESS_DENIED_ERROR
+RENAME TABLE t1 TO t2;
+
+--echo # On node 2
+--connection node_2
+USE test;
+SELECT * FROM t1;
+
+--echo # On node_1
+--connection node_1
+RENAME TABLE t1 TO t2;
+SHOW TABLES;
+
+--echo # On node 2
+--connection node_2
+USE test;
+SELECT * FROM t2;
+
+# Cleanup
+--connection node_1
+DROP USER foo@localhost;
+DROP TABLE t2;
+
+--echo # End of tests
+
diff --git a/mysql-test/suite/galera/t/rpl_row_annotate.cnf b/mysql-test/suite/galera/t/rpl_row_annotate.cnf
new file mode 100644
index 00000000000..1f1d83dfa0b
--- /dev/null
+++ b/mysql-test/suite/galera/t/rpl_row_annotate.cnf
@@ -0,0 +1,6 @@
+!include ../galera_2nodes.cnf
+
+[mysqld]
+log-bin
+log-slave-updates
+binlog-annotate-row-events=ON
diff --git a/mysql-test/suite/galera/t/rpl_row_annotate.test b/mysql-test/suite/galera/t/rpl_row_annotate.test
new file mode 100644
index 00000000000..b1cfdb36639
--- /dev/null
+++ b/mysql-test/suite/galera/t/rpl_row_annotate.test
@@ -0,0 +1,42 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--echo # On node_2
+--connection node_2
+RESET MASTER;
+
+--echo # On node_1
+--connection node_1
+RESET MASTER;
+CREATE TABLE t1(i INT)ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+DELETE FROM t1 WHERE i = 1;
+
+--echo # On node_2
+--connection node_2
+INSERT INTO t1 VALUES(2);
+DELETE FROM t1 WHERE i = 2;
+
+--echo # On node_1
+--connection node_1
+--source include/binlog_start_pos.inc
+let $start_pos= `select @binlog_start_pos`;
+--replace_column 2 # 5 #
+--replace_result $start_pos <start_pos>
+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
+--eval SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM $start_pos
+
+--echo # On node_2
+--connection node_2
+--source include/binlog_start_pos.inc
+let $start_pos= `select @binlog_start_pos`;
+--replace_column 2 # 5 #
+--replace_result $start_pos <start_pos>
+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
+--eval SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM $start_pos
+
+# Cleanup
+DROP TABLE t1;
+
+--source include/galera_end.inc
+--echo # End of test
diff --git a/mysql-test/suite/galera/t/sql_log_bin.test b/mysql-test/suite/galera/t/sql_log_bin.test
new file mode 100644
index 00000000000..615bc4c30af
--- /dev/null
+++ b/mysql-test/suite/galera/t/sql_log_bin.test
@@ -0,0 +1,44 @@
+# Test to check the behavior of galera cluster with sql_log_bin=ON|OFF & binary
+# logging is disabled. sql_bin_log should not affect galera replication.
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--echo
+--echo # On node_1
+--connection node_1
+
+USE test;
+CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1);
+
+--echo # Disable binary logging for current session
+SET SQL_LOG_BIN=OFF;
+INSERT INTO t1 VALUES (2);
+CREATE TABLE t2(c1 INT PRIMARY KEY) ENGINE=INNODB;
+INSERT INTO t2 VALUES (1);
+CREATE TABLE test.t3 AS SELECT * from t1;
+
+--echo # Enable binary logging for current session
+SET SQL_LOG_BIN=ON;
+INSERT INTO t2 VALUES (2);
+CREATE TABLE t4 AS SELECT * from t2;
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+SELECT * FROM t4;
+
+--echo
+--echo # On node_2
+--connection node_2
+USE test;
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+SELECT * FROM t4;
+
+# Cleanup
+DROP TABLE t1, t2, t3, t4;
+
+--source include/galera_end.inc
+--echo # End of test
diff --git a/mysql-test/suite/galera/t/view.test b/mysql-test/suite/galera/t/view.test
index 6768917589c..fa2cd8b2a67 100644
--- a/mysql-test/suite/galera/t/view.test
+++ b/mysql-test/suite/galera/t/view.test
@@ -8,4 +8,43 @@ USE test;
CREATE DEFINER=CURRENT_USER VIEW v1 AS SELECT 1;
DROP VIEW v1;
+--echo #
+--echo # MDEV-8464 : ALTER VIEW not replicated in some cases
+--echo #
+--echo # On node_1
+--connection node_1
+USE test;
+CREATE TABLE t1(i INT) ENGINE=INNODB;
+CREATE DEFINER=CURRENT_USER VIEW v1 AS SELECT * FROM t1;
+CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t1;
+CREATE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t1;
+CREATE ALGORITHM=UNDEFINED DEFINER=CURRENT_USER VIEW v4 AS SELECT * FROM t1;
+
+--echo # On node_2
+--connection node_2
+USE test;
+SHOW CREATE VIEW v1;
+SHOW CREATE VIEW v2;
+SHOW CREATE VIEW v3;
+SHOW CREATE VIEW v4;
+
+--echo # On node_1
+--connection node_1
+ALTER ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
+ALTER ALGORITHM=UNDEFINED VIEW v2 AS SELECT * FROM t1;
+ALTER DEFINER=CURRENT_USER VIEW v3 AS SELECT * FROM t1;
+ALTER ALGORITHM=TEMPTABLE DEFINER=CURRENT_USER VIEW v4 AS SELECT * FROM t1;
+
+--echo # On node_2
+--connection node_2
+SHOW CREATE VIEW v1;
+SHOW CREATE VIEW v2;
+SHOW CREATE VIEW v3;
+SHOW CREATE VIEW v4;
+
+--echo # Cleanup
+DROP VIEW v1, v2, v3, v4;
+DROP TABLE t1;
+
--echo # End of tests
+
diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def
new file mode 100644
index 00000000000..ec02e73b4a3
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/disabled.def
@@ -0,0 +1,2 @@
+galera_garbd : Fix the test case
+galera_evs_suspect_timeout : TODO: investigate
diff --git a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf
new file mode 100644
index 00000000000..2a06c1cd5a9
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf
@@ -0,0 +1,60 @@
+# Use default setting for mysqld processes
+!include include/default_mysqld.cnf
+
+[mysqld]
+binlog-format=row
+innodb-autoinc-lock-mode=2
+default-storage-engine=innodb
+
+wsrep-on=1
+wsrep-provider=@ENV.WSREP_PROVIDER
+wsrep_node_address=127.0.0.1
+# enforce read-committed characteristics across the cluster
+wsrep-causal-reads=ON
+wsrep-sync-wait=7
+
+[mysqld.1]
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+wsrep-cluster-address=gcomm://
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M'
+wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port
+wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port'
+
+[mysqld.2]
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M'
+wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
+wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
+
+[mysqld.3]
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
+wsrep_provider_options='base_port=@mysqld.3.#galera_port;gcache.size=10M'
+wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port
+wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port'
+
+[ENV]
+NODE_MYPORT_1= @mysqld.1.port
+NODE_MYSOCK_1= @mysqld.1.socket
+
+NODE_MYPORT_2= @mysqld.2.port
+NODE_MYSOCK_2= @mysqld.2.socket
+
+NODE_MYPORT_3= @mysqld.3.port
+NODE_MYSOCK_3= @mysqld.3.socket
+
+NODE_GALERAPORT_1= @mysqld.1.#galera_port
+NODE_GALERAPORT_2= @mysqld.2.#galera_port
+NODE_GALERAPORT_3= @mysqld.3.#galera_port
+
+NODE_SSTPORT_1= @mysqld.1.#sst_port
+NODE_SSTPORT_2= @mysqld.2.#sst_port
+NODE_SSTPORT_3= @mysqld.3.#sst_port
+
diff --git a/mysql-test/suite/galera_3nodes/include/galera_suspend.inc b/mysql-test/suite/galera_3nodes/include/galera_suspend.inc
new file mode 100644
index 00000000000..3495ad2342b
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/include/galera_suspend.inc
@@ -0,0 +1,14 @@
+#
+# This macro suspends the current node
+#
+
+--let _SUSPEND_NODE_PIDFILE = `SELECT @@pid_file`
+--echo Suspending node ...
+
+--perl
+ my $pid_filename = $ENV{'_SUSPEND_NODE_PIDFILE'};
+ my $mysqld_pid = `cat $pid_filename`;
+ chomp($mysqld_pid);
+ system("kill -19 $mysqld_pid");
+ exit(0);
+EOF
diff --git a/mysql-test/suite/galera_3nodes/my.cnf b/mysql-test/suite/galera_3nodes/my.cnf
new file mode 100644
index 00000000000..bb25b95ceea
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/my.cnf
@@ -0,0 +1 @@
+!include galera_3nodes.cnf
diff --git a/mysql-test/suite/galera_3nodes/r/galera_certification_ccc.result b/mysql-test/suite/galera_3nodes/r/galera_certification_ccc.result
new file mode 100644
index 00000000000..96a2bec0d7f
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/r/galera_certification_ccc.result
@@ -0,0 +1,17 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 3
+1
+SET GLOBAL wsrep_cluster_address = '';
+INSERT INTO t1 VALUES (2);
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+COMMIT;
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes/r/galera_certification_double_failure.result b/mysql-test/suite/galera_3nodes/r/galera_certification_double_failure.result
new file mode 100644
index 00000000000..9dc735d5d3d
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/r/galera_certification_double_failure.result
@@ -0,0 +1,12 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result b/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result
new file mode 100644
index 00000000000..1464222a079
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result
@@ -0,0 +1,19 @@
+SET GLOBAL wsrep_provider_options = 'evs.inactive_timeout=PT100M; evs.suspect_timeout=PT1S';
+SET GLOBAL wsrep_provider_options = 'evs.inactive_timeout=PT100M; evs.suspect_timeout=PT1S';
+Suspending node ...
+SET SESSION wsrep_sync_wait = 0;
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+CREATE TABLE t1 (f1 INTEGER);
+INSERT INTO t1 VALUES (1);
+SET SESSION wsrep_sync_wait = 0;
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
+Resuming node ...
+CALL mtr.add_suppression("WSREP: gcs_caused() returned -1 \\(Operation not permitted\\)");
diff --git a/mysql-test/suite/galera_3nodes/r/galera_garbd.result b/mysql-test/suite/galera_3nodes/r/galera_garbd.result
new file mode 100644
index 00000000000..616c9d33303
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/r/galera_garbd.result
@@ -0,0 +1,14 @@
+Killing node #3 to free ports for garbd ...
+Starting garbd ...
+CREATE TABLE t1 (f1 INTEGER);
+INSERT INTO t1 VALUES (1);
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+Killing garbd ...
+INSERT INTO t1 VALUES (2);
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+DROP TABLE t1;
+Restarting node #3 to satisfy MTR's end-of-test checks
diff --git a/mysql-test/suite/galera_3nodes/r/galera_ist_gcache_rollover.result b/mysql-test/suite/galera_3nodes/r/galera_ist_gcache_rollover.result
new file mode 100644
index 00000000000..1ecea5db5ab
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/r/galera_ist_gcache_rollover.result
@@ -0,0 +1,46 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+INSERT INTO t1 VALUES (01), (02), (03), (04), (05);
+Unloading wsrep provider ...
+SET GLOBAL wsrep_provider = 'none';
+Unloading wsrep provider ...
+SET GLOBAL wsrep_provider = 'none';
+INSERT INTO t1 VALUES (11), (12), (13), (14), (15);
+INSERT INTO t1 VALUES (21), (22), (23), (24), (25);
+SET GLOBAL wsrep_provider_options = 'dbug=d,ist_sender_send_after_get_buffers';
+INSERT INTO t1 VALUES (31), (32), (33), (34), (35);
+SHOW STATUS LIKE 'wsrep_debug_sync_waiters';
+Variable_name Value
+wsrep_debug_sync_waiters ist_sender_send_after_get_buffers ist_sender_send_after_get_buffers
+INSERT INTO t1 VALUES (41), (42), (43), (44), (45);
+CREATE TABLE t2 (f1 LONGTEXT);
+INSERT INTO t2 VALUES (REPEAT('x', 512 * 1024));
+INSERT INTO t2 VALUES (REPEAT('x', 512 * 1024));
+INSERT INTO t2 VALUES (REPEAT('x', 512 * 1024));
+SET GLOBAL wsrep_provider_options = 'signal=ist_sender_send_after_get_buffers';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+INSERT INTO t1 VALUES (51), (52), (53), (54), (55);
+SELECT COUNT(*) = 30 FROM t1;
+COUNT(*) = 30
+1
+SELECT COUNT(*) = 3 FROM t2;
+COUNT(*) = 3
+1
+SELECT LENGTH(f1) = 512 * 1024 FROM t2;
+LENGTH(f1) = 512 * 1024
+1
+1
+1
+CALL mtr.add_suppression("WSREP: Unsupported protocol downgrade: incremental data collection disabled");
+SELECT COUNT(*) = 30 FROM t1;
+COUNT(*) = 30
+1
+SELECT COUNT(*) = 3 FROM t2;
+COUNT(*) = 3
+1
+SELECT LENGTH(f1) = 512 * 1024 FROM t2;
+LENGTH(f1) = 512 * 1024
+1
+1
+1
+CALL mtr.add_suppression("WSREP: Unsupported protocol downgrade: incremental data collection disabled");
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result b/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result
new file mode 100644
index 00000000000..ec97d392c0f
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result
@@ -0,0 +1,13 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SET GLOBAL wsrep_slave_threads = 2;
+UPDATE t1 SET f1 = f1 + 10;;
+UPDATE t1 SET f1 = f1 + 100;;
+SELECT f1 = 111 FROM t1;
+f1 = 111
+1
+SELECT COUNT(*) IN (1, 2) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'committed%';
+COUNT(*) IN (1, 2)
+1
+SET GLOBAL wsrep_slave_threads = 1;;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result b/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result
new file mode 100644
index 00000000000..ca051436491
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result
@@ -0,0 +1,118 @@
+SET GLOBAL wsrep_provider_options = 'pc.weight=3';
+Suspending node ...
+SET SESSION wsrep_sync_wait=0;
+SHOW STATUS LIKE 'wsrep_cluster_size';
+Variable_name Value
+wsrep_cluster_size 2
+SHOW STATUS LIKE 'wsrep_cluster_status';
+Variable_name Value
+wsrep_cluster_status non-Primary
+SHOW STATUS LIKE 'wsrep_connected';
+Variable_name Value
+wsrep_connected ON
+SHOW STATUS LIKE 'wsrep_ready';
+Variable_name Value
+wsrep_ready OFF
+SHOW STATUS LIKE 'wsrep_local_state';
+Variable_name Value
+wsrep_local_state 0
+SHOW STATUS LIKE 'wsrep_local_state_comment';
+Variable_name Value
+wsrep_local_state_comment Initialized
+SET SESSION wsrep_sync_wait=0;
+SHOW STATUS LIKE 'wsrep_cluster_size';
+Variable_name Value
+wsrep_cluster_size 2
+SHOW STATUS LIKE 'wsrep_cluster_status';
+Variable_name Value
+wsrep_cluster_status non-Primary
+SHOW STATUS LIKE 'wsrep_connected';
+Variable_name Value
+wsrep_connected ON
+SHOW STATUS LIKE 'wsrep_ready';
+Variable_name Value
+wsrep_ready OFF
+SHOW STATUS LIKE 'wsrep_local_state';
+Variable_name Value
+wsrep_local_state 0
+SHOW STATUS LIKE 'wsrep_local_state_comment';
+Variable_name Value
+wsrep_local_state_comment Initialized
+Resuming node ...
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 1
+1
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+VARIABLE_VALUE = 'ON'
+1
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+VARIABLE_VALUE = 'ON'
+1
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+VARIABLE_VALUE = 4
+1
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Synced'
+1
+SET SESSION wsrep_sync_wait=0;
+SET SESSION wsrep_sync_wait=0;
+SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 3
+1
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+VARIABLE_VALUE = 'ON'
+1
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+VARIABLE_VALUE = 'ON'
+1
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+VARIABLE_VALUE = 4
+1
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Synced'
+1
+SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 3
+1
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+VARIABLE_VALUE = 'ON'
+1
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+VARIABLE_VALUE = 'ON'
+1
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+VARIABLE_VALUE = 4
+1
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Synced'
+1
+SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 3
+1
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+VARIABLE_VALUE = 'ON'
+1
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+VARIABLE_VALUE = 'ON'
+1
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+VARIABLE_VALUE = 4
+1
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Synced'
+1
+CALL mtr.add_suppression('WSREP: gcs_caused\\(\\) returned -1');
+CALL mtr.add_suppression('WSREP: user message in state LEAVING');
+CALL mtr.add_suppression('sending install message failed: Transport endpoint is not connected');
diff --git a/mysql-test/suite/galera_3nodes/suite.pm b/mysql-test/suite/galera_3nodes/suite.pm
new file mode 100644
index 00000000000..1f00e37bdc3
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/suite.pm
@@ -0,0 +1,52 @@
+package My::Suite::GALERA_3NODES;
+use File::Basename;
+use My::Find;
+
+@ISA = qw(My::Suite);
+
+return "Not run for embedded server" if $::opt_embedded_server;
+
+return "WSREP is not compiled in" unless defined $::mysqld_variables{'wsrep-on'};
+
+my ($provider) = grep { -f $_ } $ENV{WSREP_PROVIDER},
+ "/usr/lib/galera/libgalera_smm.so",
+ "/usr/lib64/galera/libgalera_smm.so";
+
+return "No wsrep provider library" unless -f $provider;
+
+$ENV{WSREP_PROVIDER} = $provider;
+
+my ($spath) = grep { -f "$_/wsrep_sst_rsync"; } "$::bindir/scripts", $::path_client_bindir;
+return "No SST scripts" unless $spath;
+
+my ($epath) = grep { -f "$_/my_print_defaults"; } "$::bindir/extra", $::path_client_bindir;
+return "No my_print_defaults" unless $epath;
+
+push @::global_suppressions,
+ (
+ qr(WSREP: wsrep_sst_receive_address is set to '127.0.0.1),
+ qr(WSREP: Could not open saved state file for reading: ),
+ qr(WSREP: Gap in state sequence. Need state transfer.),
+ qr(WSREP: Failed to prepare for incremental state transfer:),
+ qr(WSREP:.*down context.*),
+ qr(WSREP: Failed to send state UUID:),
+ qr(WSREP: last inactive check more than .* skipping check),
+ qr(WSREP: SQL statement was ineffective),
+ qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned.),
+ qr|WSREP: access file\(gvwstate.dat\) failed\(No such file or directory\)|,
+ qr(WSREP: Quorum: No node with complete state),
+ qr(WSREP: Initial position was provided by configuration or SST, avoiding override),
+ qr|WSREP: discarding established \(time wait\) .*|,
+ qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside. Will use that one.),
+ qr(WSREP: evs::proto.*),
+ qr|WSREP: Ignoring possible split-brain (allowed by configuration) from view:.*|,
+ qr(WSREP: Could not find peer:),
+ qr(WSREP: Protocol violation. JOIN message sender .*),
+ );
+
+
+$ENV{PATH}="$epath:$ENV{PATH}";
+$ENV{PATH}="$spath:$ENV{PATH}" unless $epath eq $spath;
+
+bless { };
+
diff --git a/mysql-test/suite/galera_3nodes/t/galera_certification_ccc.test b/mysql-test/suite/galera_3nodes/t/galera_certification_ccc.test
new file mode 100644
index 00000000000..e19169a350c
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_certification_ccc.test
@@ -0,0 +1,60 @@
+#
+# Test that a cluster configuration change during a transaction does not cause a failure
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--let $galera_connection_name = node_3
+--let $galera_server_number = 3
+--source include/galera_connect.inc
+
+# Save original auto_increment_offset values.
+--connection node_1
+let $auto_increment_offset_node_1 = `SELECT @@global.auto_increment_offset`;
+--connection node_2
+let $auto_increment_offset_node_2 = `SELECT @@global.auto_increment_offset`;
+--connection node_3
+let $auto_increment_offset_node_3 = `SELECT @@global.auto_increment_offset`;
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+--connection node_3
+--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address`
+SET GLOBAL wsrep_cluster_address = '';
+--sleep 5
+
+--connection node_1
+INSERT INTO t1 VALUES (2);
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+COMMIT;
+
+--connection node_2
+SELECT COUNT(*) = 2 FROM t1;
+
+--connection node_3
+--disable_query_log
+--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig';
+--enable_query_log
+--sleep 5
+--source include/wait_until_ready.inc
+
+--connection node_1
+DROP TABLE t1;
+
+# Restore original auto_increment_offset values.
+--disable_query_log
+--connection node_1
+--eval SET @@global.auto_increment_offset = $auto_increment_offset_node_1;
+--connection node_2
+--eval SET @@global.auto_increment_offset = $auto_increment_offset_node_2;
+--connection node_3
+--eval SET @@global.auto_increment_offset = $auto_increment_offset_node_3;
+--enable_query_log
+
diff --git a/mysql-test/suite/galera_3nodes/t/galera_certification_double_failure.test b/mysql-test/suite/galera_3nodes/t/galera_certification_double_failure.test
new file mode 100644
index 00000000000..a2ad0765028
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_certification_double_failure.test
@@ -0,0 +1,33 @@
+#
+# This test creates a transaction whose certification will fail on two separate nodes
+# for two different reasons.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--let $galera_connection_name = node_3
+--let $galera_server_number = 3
+--source include/galera_connect.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+--connection node_2
+INSERT INTO t1 VALUES (1);
+
+--connection node_3
+INSERT INTO t2 VALUES (1);
+
+--connection node_1
+--error ER_LOCK_DEADLOCK
+COMMIT;
+
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test b/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test
new file mode 100644
index 00000000000..a87f19ac94e
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test
@@ -0,0 +1,67 @@
+#
+# Test the operation of evs.suspect_timeout.
+#
+# We set evs.inactive_timeout to a very high value so that evs.suspect_timeout can kick in instead.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+--let $wsrep_provider_options_node1 = `SELECT @@wsrep_provider_options`
+SET GLOBAL wsrep_provider_options = 'evs.inactive_timeout=PT100M; evs.suspect_timeout=PT1S';
+
+--connection node_2
+--source include/wait_until_connected_again.inc
+--let $wsrep_provider_options_node2 = `SELECT @@wsrep_provider_options`
+SET GLOBAL wsrep_provider_options = 'evs.inactive_timeout=PT100M; evs.suspect_timeout=PT1S';
+
+--let $galera_connection_name = node_3
+--let $galera_server_number = 3
+--source include/galera_connect.inc
+--connection node_3
+--source include/wait_until_connected_again.inc
+--let $wsrep_cluster_address_node3 = `SELECT @@wsrep_cluster_address`
+
+# Suspend node #3
+
+--source include/galera_suspend.inc
+--sleep 5
+
+# Confirm that the other nodes have booted it out
+
+--connection node_1
+--source include/wait_until_connected_again.inc
+SET SESSION wsrep_sync_wait = 0;
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--disable_query_log
+--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_node1';
+--enable_query_log
+
+--source include/wait_until_connected_again.inc
+CREATE TABLE t1 (f1 INTEGER);
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+SET SESSION wsrep_sync_wait = 0;
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--disable_query_log
+--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_node2';
+--enable_query_log
+
+--source include/wait_until_connected_again.inc
+SELECT COUNT(*) = 1 FROM t1;
+DROP TABLE t1;
+
+# Reconnect node #3 so that MTR's end-of-test checks can run
+
+--connection node_3
+--source include/galera_resume.inc
+--source include/wait_until_connected_again.inc
+
+CALL mtr.add_suppression("WSREP: gcs_caused() returned -1 \\(Operation not permitted\\)");
+
+--disable_query_log
+--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_node3';
+--enable_query_log
+--source include/wait_until_connected_again.inc
diff --git a/mysql-test/suite/galera_3nodes/t/galera_garbd.test b/mysql-test/suite/galera_3nodes/t/galera_garbd.test
new file mode 100644
index 00000000000..3f58783ad31
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_garbd.test
@@ -0,0 +1,50 @@
+#
+# A very basic test for the galera arbitrator. We shut down node #3 and use its port allocation to start garbd.
+# As MTR does not allow multiple servers to be down at the same time, we are limited as to what we can test.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/big_test.inc
+
+--echo Killing node #3 to free ports for garbd ...
+--let $galera_connection_name = node_3
+--let $galera_server_number = 3
+--source include/galera_connect.inc
+--source include/shutdown_mysqld.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+--echo Starting garbd ...
+--exec `dirname $WSREP_PROVIDER`/garb/garbd --address "gcomm://127.0.0.1:$NODE_GALERAPORT_1" --group my_wsrep_cluster --options 'base_port=$NODE_GALERAPORT_3' > $MYSQL_TMP_DIR/garbd.log 2>&1 &
+
+--sleep 5
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+CREATE TABLE t1 (f1 INTEGER);
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+
+--echo Killing garbd ...
+--exec pkill --oldest --full garbd.*$NODE_GALERAPORT_3
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+INSERT INTO t1 VALUES (2);
+
+--connection node_2
+SELECT COUNT(*) = 2 FROM t1;
+
+DROP TABLE t1;
+
+--echo Restarting node #3 to satisfy MTR's end-of-test checks
+--connection node_3
+--source include/start_mysqld.inc
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.cnf b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.cnf
new file mode 100644
index 00000000000..821175220ac
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.cnf
@@ -0,0 +1,11 @@
+!include ../galera_3nodes.cnf
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true;gcache.size=1M'
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true;gcache.size=1M'
+
+[mysqld.3]
+wsrep_provider_options='base_port=@mysqld.3.#galera_port;pc.ignore_sb=true;gcache.size=1M'
+
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test
new file mode 100644
index 00000000000..0668c246624
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test
@@ -0,0 +1,98 @@
+#
+# Test that if the gcache rolls over while IST is in progress, IST will still complete.
+# This is achieved by using the ist_sender_send_after_get_buffers Galera dbug sync point to block the donor after
+# the first gcache buffer has been locked for IST.
+#
+# After IST blocks, we roll over the gcache and resume IST to confirm that it completes successfully.
+#
+# Two nodes perform IST at the same time in order to make the test more stressfull
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/have_debug_sync.inc
+--source suite/galera/include/galera_have_debug_sync.inc
+
+--let $galera_connection_name = node_3
+--let $galera_server_number = 3
+--source include/galera_connect.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+INSERT INTO t1 VALUES (01), (02), (03), (04), (05);
+
+# Disconnect nodes #2 and #3
+--connection node_2
+--source suite/galera/include/galera_unload_provider.inc
+
+--connection node_3
+--source suite/galera/include/galera_unload_provider.inc
+
+--connection node_1
+--source include/wait_until_connected_again.inc
+INSERT INTO t1 VALUES (11), (12), (13), (14), (15);
+
+# Wait until nodes #2 and #3 have left
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+INSERT INTO t1 VALUES (21), (22), (23), (24), (25);
+
+# Make sure IST will block ...
+SET GLOBAL wsrep_provider_options = 'dbug=d,ist_sender_send_after_get_buffers';
+
+# ... and restart providers to force IST
+--connection node_2
+--disable_query_log
+--eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig';
+--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig';
+--enable_query_log
+
+--connection node_1
+INSERT INTO t1 VALUES (31), (32), (33), (34), (35);
+
+--connection node_3
+--disable_query_log
+--eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig';
+--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig';
+--enable_query_log
+
+--connection node_1
+--sleep 2
+SHOW STATUS LIKE 'wsrep_debug_sync_waiters';
+
+INSERT INTO t1 VALUES (41), (42), (43), (44), (45);
+
+# Roll over gcache by writing a lot of information to it
+
+CREATE TABLE t2 (f1 LONGTEXT);
+INSERT INTO t2 VALUES (REPEAT('x', 512 * 1024));
+INSERT INTO t2 VALUES (REPEAT('x', 512 * 1024));
+INSERT INTO t2 VALUES (REPEAT('x', 512 * 1024));
+
+# Unlock IST and wait for it to complete
+SET GLOBAL wsrep_provider_options = 'signal=ist_sender_send_after_get_buffers';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+
+INSERT INTO t1 VALUES (51), (52), (53), (54), (55);
+
+--connection node_2
+--source include/wait_until_connected_again.inc
+
+--connection node_3
+--source include/wait_until_connected_again.inc
+
+# Final checks
+--connection node_2
+SELECT COUNT(*) = 30 FROM t1;
+SELECT COUNT(*) = 3 FROM t2;
+SELECT LENGTH(f1) = 512 * 1024 FROM t2;
+CALL mtr.add_suppression("WSREP: Unsupported protocol downgrade: incremental data collection disabled");
+
+# Final checks
+--connection node_3
+SELECT COUNT(*) = 30 FROM t1;
+SELECT COUNT(*) = 3 FROM t2;
+SELECT LENGTH(f1) = 512 * 1024 FROM t2;
+CALL mtr.add_suppression("WSREP: Unsupported protocol downgrade: incremental data collection disabled");
+
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test b/mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test
new file mode 100644
index 00000000000..7d80d8036a1
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test
@@ -0,0 +1,38 @@
+#
+# This test performs two dependent updates on two nodes and checks the results on the third where
+# parallel apply is enabled.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--let $galera_connection_name = node_3
+--let $galera_server_number = 3
+--source include/galera_connect.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+--connection node_3
+--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads`
+SET GLOBAL wsrep_slave_threads = 2;
+
+--connection node_1
+--send UPDATE t1 SET f1 = f1 + 10;
+
+--connection node_2
+--send UPDATE t1 SET f1 = f1 + 100;
+
+--connection node_1
+--reap
+
+--connection node_2
+--reap
+
+--connection node_3
+SELECT f1 = 111 FROM t1;
+SELECT COUNT(*) IN (1, 2) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'committed%';
+
+--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test
new file mode 100644
index 00000000000..8956bae98ec
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test
@@ -0,0 +1,110 @@
+#
+# Test the pc.weight wsrep provider option. We set Node #1 to have a high weight and then
+# suspend it. This will cause Nodes #2 and #3 to transition to non-primary component.
+#
+
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--let $wsrep_provider_options_node1 = `SELECT @@wsrep_provider_options`
+SET GLOBAL wsrep_provider_options = 'pc.weight=3';
+
+--source include/wait_until_connected_again.inc
+--source include/galera_suspend.inc
+--sleep 10
+
+--connection node_2
+# Do not wait for causality as we are no longer in the primary component
+SET SESSION wsrep_sync_wait=0;
+--source include/wait_until_connected_again.inc
+
+# We can not use SELECT queries here, as only SHOW is allowed to run.
+# For nodes #2 and #3, we expect a non-primary component of size 2
+
+SHOW STATUS LIKE 'wsrep_cluster_size';
+SHOW STATUS LIKE 'wsrep_cluster_status';
+SHOW STATUS LIKE 'wsrep_connected';
+SHOW STATUS LIKE 'wsrep_ready';
+SHOW STATUS LIKE 'wsrep_local_state';
+SHOW STATUS LIKE 'wsrep_local_state_comment';
+
+--let $galera_connection_name = node_3
+--let $galera_server_number = 3
+--source include/galera_connect.inc
+--connection node_3
+SET SESSION wsrep_sync_wait=0;
+--source include/wait_until_connected_again.inc
+
+SHOW STATUS LIKE 'wsrep_cluster_size';
+SHOW STATUS LIKE 'wsrep_cluster_status';
+SHOW STATUS LIKE 'wsrep_connected';
+SHOW STATUS LIKE 'wsrep_ready';
+SHOW STATUS LIKE 'wsrep_local_state';
+SHOW STATUS LIKE 'wsrep_local_state_comment';
+
+--connection node_1
+--source include/galera_resume.inc
+--sleep 5
+--source include/wait_until_connected_again.inc
+
+# For Node #1, we expect a primary component of size 1
+
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+
+# Restore the cluster by resetting wsrep_cluster_address on nodes #1 and #2
+
+--connection node_2
+--disable_query_log
+--eval SET GLOBAL wsrep_cluster_address = @@wsrep_cluster_address;
+--enable_query_log
+
+SET SESSION wsrep_sync_wait=0;
+--source include/wait_until_connected_again.inc
+
+--connection node_3
+--disable_query_log
+--eval SET GLOBAL wsrep_cluster_address = @@wsrep_cluster_address;
+--enable_query_log
+
+SET SESSION wsrep_sync_wait=0;
+--source include/wait_until_connected_again.inc
+
+# On all nodes, we now expect a Primary component of size 3, Synced and ready
+
+--connection node_1
+--source include/wait_until_connected_again.inc
+SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+
+--connection node_2
+SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+
+--connection node_3
+SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+
+--connection node_1
+CALL mtr.add_suppression('WSREP: gcs_caused\\(\\) returned -1');
+
+--connection node_3
+CALL mtr.add_suppression('WSREP: user message in state LEAVING');
+CALL mtr.add_suppression('sending install message failed: Transport endpoint is not connected');
diff --git a/mysql-test/suite/innodb/r/add_constraint.result b/mysql-test/suite/innodb/r/add_constraint.result
new file mode 100644
index 00000000000..798e87a3761
--- /dev/null
+++ b/mysql-test/suite/innodb/r/add_constraint.result
@@ -0,0 +1,13 @@
+#
+# Bug #20762798 FK DDL: CRASH IN DICT_FOREIGN_REMOVE_FROM_CACHE
+#
+create table t1(a int, b int, key(a),key(b))engine=innodb;
+create table t2(a int, b int, key(a),key(b))engine=innodb;
+alter table t2 add constraint b foreign key (b) references t1(a);
+alter table t1 add constraint b1 foreign key (b) references t2(a);
+alter table t2 add constraint b1 foreign key (b) references t1(a);
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 121 "Duplicate key on write or update")
+alter table t2 drop foreign key b;
+alter table t1 drop foreign key b1;
+drop table t2;
+drop table t1;
diff --git a/mysql-test/suite/innodb/r/binlog_consistent.result b/mysql-test/suite/innodb/r/binlog_consistent.result
index 47f9900c449..1e095c6596e 100644
--- a/mysql-test/suite/innodb/r/binlog_consistent.result
+++ b/mysql-test/suite/innodb/r/binlog_consistent.result
@@ -3,11 +3,11 @@ RESET MASTER;
CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb;
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 486
+master-bin.000001 <pos>
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
Binlog_snapshot_file master-bin.000001
-Binlog_snapshot_position 486
+Binlog_snapshot_position <pos>
BEGIN;
INSERT INTO t1 VALUES (0, "");
# Connection con1
@@ -38,10 +38,10 @@ a b
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
Binlog_snapshot_file master-bin.000001
-Binlog_snapshot_position 988
+Binlog_snapshot_position <pos>
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 1340
+master-bin.000001 <pos>
SELECT * FROM t2 ORDER BY a;
a
2
@@ -60,50 +60,47 @@ a b
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
Binlog_snapshot_file master-bin.000001
-Binlog_snapshot_position 988
+Binlog_snapshot_position <pos>
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000002 367
+master-bin.000002 <pos>
COMMIT;
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
Binlog_snapshot_file master-bin.000002
-Binlog_snapshot_position 367
+Binlog_snapshot_position <pos>
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000002 367
-SHOW BINLOG EVENTS;
+master-bin.000002 <pos>
+include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 248 Server ver: #, Binlog ver: #
-master-bin.000001 248 Gtid_list 1 273 []
-master-bin.000001 273 Binlog_checkpoint 1 313 master-bin.000001
-master-bin.000001 313 Gtid 1 351 GTID 0-1-1
-master-bin.000001 351 Query 1 486 use `test`; CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb
-master-bin.000001 486 Gtid 1 524 GTID 0-1-2
-master-bin.000001 524 Query 1 636 use `test`; CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=myisam
-master-bin.000001 636 Gtid 1 674 BEGIN GTID 0-1-3
-master-bin.000001 674 Query 1 762 use `test`; INSERT INTO t2 VALUES (2)
-master-bin.000001 762 Query 1 831 COMMIT
-master-bin.000001 831 Gtid 1 869 BEGIN GTID 0-1-4
-master-bin.000001 869 Query 1 961 use `test`; INSERT INTO t1 VALUES (0, "")
-master-bin.000001 961 Xid 1 988 COMMIT /* XID */
-master-bin.000001 988 Gtid 1 1026 BEGIN GTID 0-1-5
-master-bin.000001 1026 Query 1 1114 use `test`; INSERT INTO t2 VALUES (3)
-master-bin.000001 1114 Query 1 1183 COMMIT
-master-bin.000001 1183 Gtid 1 1221 BEGIN GTID 0-1-6
-master-bin.000001 1221 Query 1 1313 use `test`; INSERT INTO t1 VALUES (4, "")
-master-bin.000001 1313 Xid 1 1340 COMMIT /* XID */
-master-bin.000001 1340 Gtid 1 1378 BEGIN GTID 0-1-7
-master-bin.000001 1378 Query 1 1470 use `test`; INSERT INTO t1 VALUES (1, "")
-master-bin.000001 1470 Xid 1 1497 COMMIT /* XID */
-master-bin.000001 1497 Gtid 1 1535 BEGIN GTID 0-1-8
-master-bin.000001 1535 Query 1 1632 use `test`; INSERT INTO t1 VALUES (2, "first")
-master-bin.000001 1632 Query 1 1730 use `test`; INSERT INTO t1 VALUES (2, "second")
-master-bin.000001 1730 Xid 1 1757 COMMIT /* XID */
-master-bin.000001 1757 Gtid 1 1795 BEGIN GTID 0-1-9
-master-bin.000001 1795 Query 1 1887 use `test`; INSERT INTO t1 VALUES (3, "")
-master-bin.000001 1887 Xid 1 1914 COMMIT /* XID */
-master-bin.000001 1914 Rotate 1 1958 master-bin.000002;pos=4
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=myisam
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES (2)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (0, "")
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES (3)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4, "")
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1, "")
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2, "first")
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2, "second")
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3, "")
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Rotate # # master-bin.000002;pos=POS
*** MDEV-7310: last_commit_pos_offset set to wrong value after binlog rotate in group commit ***
SET @old_size= @@GLOBAL.max_binlog_size;
SET GLOBAL max_binlog_size=4096;
diff --git a/mysql-test/suite/innodb/r/group_commit_binlog_pos.result b/mysql-test/suite/innodb/r/group_commit_binlog_pos.result
index 23f80b01a8d..8a0eed2bf3c 100644
--- a/mysql-test/suite/innodb/r/group_commit_binlog_pos.result
+++ b/mysql-test/suite/innodb/r/group_commit_binlog_pos.result
@@ -31,6 +31,6 @@ a
1
2
3
-InnoDB: Last MySQL binlog file position 0 926, file name ./master-bin.000001
+InnoDB: Last MySQL binlog file position 0 <pos>, file name ./master-bin.000001
SET DEBUG_SYNC= 'RESET';
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/group_commit_binlog_pos_no_optimize_thread.result b/mysql-test/suite/innodb/r/group_commit_binlog_pos_no_optimize_thread.result
index 3ef8a4acc0f..d85b6681360 100644
--- a/mysql-test/suite/innodb/r/group_commit_binlog_pos_no_optimize_thread.result
+++ b/mysql-test/suite/innodb/r/group_commit_binlog_pos_no_optimize_thread.result
@@ -32,6 +32,6 @@ a
1
2
3
-InnoDB: Last MySQL binlog file position 0 926, file name ./master-bin.000001
+InnoDB: Last MySQL binlog file position 0 <pos>, file name ./master-bin.000001
SET DEBUG_SYNC= 'RESET';
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb-16k.result b/mysql-test/suite/innodb/r/innodb-16k.result
index ed1a827e4ec..9e6e5145fa0 100644
--- a/mysql-test/suite/innodb/r/innodb-16k.result
+++ b/mysql-test/suite/innodb/r/innodb-16k.result
@@ -299,7 +299,7 @@ a LENGTH(b) b=LEFT(REPEAT(d,100*a), 65535) LENGTH(c) c=REPEAT(d,20*a) d
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` blob NOT NULL,
`c` text NOT NULL,
`d` text NOT NULL,
diff --git a/mysql-test/suite/innodb/r/innodb-alter-table.result b/mysql-test/suite/innodb/r/innodb-alter-table.result
new file mode 100644
index 00000000000..2c76a2640e0
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-alter-table.result
@@ -0,0 +1,45 @@
+drop database if exists moodle19;
+Warnings:
+Note 1008 Can't drop database 'moodle19'; database doesn't exist
+create database moodle19;
+use moodle19;
+CREATE TABLE `mdl_course_modules` (
+`id` bigint(10) NOT NULL AUTO_INCREMENT,
+`course` bigint(10) NOT NULL DEFAULT '0',
+`module` bigint(10) NOT NULL DEFAULT '0',
+`instance` bigint(10) NOT NULL DEFAULT '0',
+`section` bigint(10) NOT NULL DEFAULT '0',
+`idnumber` varchar(100) DEFAULT NULL,
+`added` bigint(10) NOT NULL DEFAULT '0',
+`delay` varchar(10) NOT NULL DEFAULT '0',
+`score` smallint(4) NOT NULL DEFAULT '0',
+`indent` mediumint(5) NOT NULL DEFAULT '0',
+`visible` tinyint(1) NOT NULL DEFAULT '1',
+`checkboxesforprereqs` tinyint(1) NOT NULL DEFAULT '0',
+`stylewhencomplete` varchar(200) DEFAULT '',
+`checkboxforcomplete` tinyint(1) NOT NULL DEFAULT '0',
+`stylewhenlocked` varchar(200) DEFAULT 'locked',
+`visiblewhenlocked` tinyint(1) NOT NULL DEFAULT '1',
+`visibleold` tinyint(1) NOT NULL DEFAULT '1',
+`groupmode` smallint(4) NOT NULL DEFAULT '0',
+`groupingid` bigint(10) NOT NULL DEFAULT '0',
+`groupmembersonly` smallint(4) NOT NULL DEFAULT '0',
+`completion` tinyint(1) NOT NULL DEFAULT '0',
+`completiongradeitemnumber` bigint(10) DEFAULT NULL,
+`completionview` tinyint(1) NOT NULL DEFAULT '0',
+`completionexpected` bigint(10) NOT NULL DEFAULT '0',
+`availablefrom` bigint(10) NOT NULL DEFAULT '0',
+`availableuntil` bigint(10) NOT NULL DEFAULT '0',
+`showavailability` tinyint(1) NOT NULL DEFAULT '0',
+`showdescription` tinyint(1) NOT NULL DEFAULT '0',
+PRIMARY KEY (`id`),
+KEY `mdl_courmodu_vis_ix` (`visible`),
+KEY `mdl_courmodu_cou_ix` (`course`),
+KEY `mdl_courmodu_mod_ix` (`module`),
+KEY `mdl_courmodu_ins_ix` (`instance`),
+KEY `mdl_courmodu_idncou_ix` (`idnumber`,`course`),
+KEY `mdl_courmodu_gro_ix` (`groupingid`)
+) ENGINE=InnoDB AUTO_INCREMENT=447023 DEFAULT CHARSET=utf8 COMMENT='course_modules table retrofitted from MySQL';
+# Inserting 2701 rows into the table...
+ALTER TABLE moodle19.mdl_course_modules ADD stefantest LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci AFTER showdescription;
+drop database moodle19;
diff --git a/mysql-test/suite/innodb/r/innodb-alter-timestamp.result b/mysql-test/suite/innodb/r/innodb-alter-timestamp.result
new file mode 100644
index 00000000000..2ab81136d1f
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-alter-timestamp.result
@@ -0,0 +1,29 @@
+CREATE TABLE t1 (
+`i1` INT(10) UNSIGNED NOT NULL,
+`d1` TIMESTAMP NULL DEFAULT NULL
+) ENGINE=innodb;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i1` int(10) unsigned NOT NULL,
+ `d1` timestamp NULL DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO t1 (i1) VALUES (1), (2), (3), (4), (5);
+select * from t1;
+i1 d1
+1 NULL
+2 NULL
+3 NULL
+4 NULL
+5 NULL
+set sql_mode = 'STRICT_ALL_TABLES,NO_ZERO_DATE';
+ALTER TABLE t1 CHANGE `d1` `d1` TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL;
+drop table t1;
+CREATE TABLE t1 (
+`i1` INT(10) UNSIGNED NOT NULL,
+`d1` TIMESTAMP NULL DEFAULT NULL
+) ENGINE=innodb;
+INSERT INTO t1 (i1) VALUES (1), (2), (3), (4), (5);
+ALTER TABLE t1 CHANGE `d1` `d1` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
+drop table t1;
+set sql_mode = '';
diff --git a/mysql-test/suite/innodb/r/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result
index 6ecb6055f26..6ac8bb53c66 100644
--- a/mysql-test/suite/innodb/r/innodb-autoinc.result
+++ b/mysql-test/suite/innodb/r/innodb-autoinc.result
@@ -1286,7 +1286,7 @@ t1 CREATE TABLE `t1` (
SELECT * FROM t1;
c1 c2
2147483648 a
-ALTER TABLE t1 CHANGE c1 c1 INT;
+ALTER TABLE t1 CHANGE c1 c1 INT default 0;
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SHOW CREATE TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb-fk-warnings.result b/mysql-test/suite/innodb/r/innodb-fk-warnings.result
new file mode 100644
index 00000000000..a022f07936c
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-fk-warnings.result
@@ -0,0 +1,112 @@
+CREATE TABLE t1 (
+id int(11) NOT NULL PRIMARY KEY,
+a int(11) NOT NULL,
+b int(11) NOT NULL,
+c int not null,
+CONSTRAINT test FOREIGN KEY (b) REFERENCES t1 (id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+CREATE TABLE t2 (
+id int(11) NOT NULL PRIMARY KEY,
+a int(11) NOT NULL,
+b int(11) NOT NULL,
+c int not null,
+CONSTRAINT mytest FOREIGN KEY (c) REFERENCES t1(id),
+CONSTRAINT test FOREIGN KEY (b) REFERENCES t2 (id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+ERROR HY000: Can't create table `test`.`t2` (errno: 121 "Duplicate key on write or update")
+show warnings;
+Level Code Message
+Warning 121 Create or Alter table `test`.`t2` with foreign key constraint failed. Foreign key constraint `test/test` already exists on data dictionary. Foreign key constraint names need to be unique in database. Error in foreign key definition: CONSTRAINT `test` FOREIGN KEY (`b`) REFERENCES `test`.`t2` (`id`).
+Error 1005 Can't create table `test`.`t2` (errno: 121 "Duplicate key on write or update")
+Warning 1022 Can't write; duplicate key in table 't2'
+drop table t1;
+create table t1(a int) engine=innodb;
+create table t2(a int, constraint a foreign key a (a) references t1(a)) engine=innodb;
+ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
+show warnings;
+Level Code Message
+Warning 150 Create table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns. Error close to foreign key a (a) references t1(a)) engine=innodb.
+Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
+Warning 1215 Cannot add foreign key constraint
+drop table t1;
+create table t1(a int not null primary key, b int) engine=innodb;
+create table t2(a int, b int, constraint a foreign key a (a) references t1(a),
+constraint a foreign key a (a) references t1(b)) engine=innodb;
+ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
+show warnings;
+Level Code Message
+Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
+Warning 1215 Cannot add foreign key constraint
+create table t2(a int, b int, constraint a foreign key a (a) references t1(a)) engine=innodb;
+alter table t2 add constraint b foreign key (b) references t2(b);
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+show warnings;
+Level Code Message
+Warning 150 Alter table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns. Error close to foreign key (b) references t2(b).
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+Warning 1215 Cannot add foreign key constraint
+drop table t2, t1;
+create table t1 (f1 integer primary key) engine=innodb;
+alter table t1 add constraint c1 foreign key (f1) references t11(f1);
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+show warnings;
+Level Code Message
+Warning 150 Alter table `test`.`t1` with foreign key constraint failed. Referenced table `test`.`t11` not found in the data dictionary close to foreign key (f1) references t11(f1).
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+Warning 1215 Cannot add foreign key constraint
+drop table t1;
+create temporary table t1(a int not null primary key, b int, key(b)) engine=innodb;
+create temporary table t2(a int, foreign key(a) references t1(a)) engine=innodb;
+ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
+show warnings;
+Level Code Message
+Warning 150 Create table `mysqld.1`.`t2` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary close to foreign key(a) references t1(a)) engine=innodb.
+Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
+Warning 1215 Cannot add foreign key constraint
+alter table t1 add foreign key(b) references t1(a);
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+show warnings;
+Level Code Message
+Warning 150 Alter table `mysqld.1`.`t1` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary close to foreign key(b) references t1(a).
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+Warning 1215 Cannot add foreign key constraint
+drop table t1;
+create table t1(a int not null primary key, b int, key(b)) engine=innodb;
+alter table t1 add foreign key(a,b) references t1(a);
+ERROR 42000: Incorrect foreign key definition for 'foreign key without name': Key reference and table reference don't match
+show warnings;
+Level Code Message
+Error 1239 Incorrect foreign key definition for 'foreign key without name': Key reference and table reference don't match
+drop table t1;
+create table t1(a int not null primary key, b int, key(b)) engine=innodb;
+alter table t1 add foreign key(a) references t1(a,b);
+ERROR 42000: Incorrect foreign key definition for 'foreign key without name': Key reference and table reference don't match
+show warnings;
+Level Code Message
+Error 1239 Incorrect foreign key definition for 'foreign key without name': Key reference and table reference don't match
+drop table t1;
+create table t1 (f1 integer not null primary key) engine=innodb;
+alter table t1 add constraint c1 foreign key (f1) references t1(f1) on update set null;
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+show warnings;
+Level Code Message
+Warning 150 Alter table `test`.`t1` with foreign key constraint failed. You have defined a SET NULL condition but column f1 is defined as NOT NULL in foreign key (f1) references t1(f1) on update set null close to on update set null.
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+Warning 1215 Cannot add foreign key constraint
+create table t2(a int not null, foreign key(a) references t1(f1) on delete set null) engine=innodb;
+ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
+show warnings;
+Level Code Message
+Warning 150 Create table `test`.`t2` with foreign key constraint failed. You have defined a SET NULL condition but column a is defined as NOT NULL in foreign key(a) references t1(f1) on delete set null) engine=innodb close to on delete set null) engine=innodb.
+Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
+Warning 1215 Cannot add foreign key constraint
+drop table t1;
+create table t1 (id int not null primary key, f1 int, f2 int, key(f1)) engine=innodb;
+create table t2(a char(20), key(a), foreign key(a) references t1(f1)) engine=innodb;
+ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
+show warnings;
+Level Code Message
+Warning 150 Create table `test`.`t2` with foreign key constraint failed. Field type or character set for column a does not mach referenced column f1 close to foreign key(a) references t1(f1)) engine=innodb
+Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
+Warning 1215 Cannot add foreign key constraint
+drop table t1;
diff --git a/mysql-test/suite/innodb/r/innodb-fk.result b/mysql-test/suite/innodb/r/innodb-fk.result
index 956dbce58ed..dee20d282f7 100644
--- a/mysql-test/suite/innodb/r/innodb-fk.result
+++ b/mysql-test/suite/innodb/r/innodb-fk.result
@@ -50,6 +50,8 @@ CONSTRAINT fk3 FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
+Warning 150 Create table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary close to FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE
+) ENGINE=InnoDB.
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
Warning 1215 Cannot add foreign key constraint
CREATE TABLE t2 (
@@ -63,6 +65,7 @@ ALTER TABLE t2 ADD CONSTRAINT fk3 FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
+Warning 150 Alter table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary close to FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE.
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
Warning 1215 Cannot add foreign key constraint
drop table t2;
diff --git a/mysql-test/suite/innodb/r/innodb-flush-changed-page-bitmaps.result b/mysql-test/suite/innodb/r/innodb-flush-changed-page-bitmaps.result
new file mode 100644
index 00000000000..5f098b8ecbf
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-flush-changed-page-bitmaps.result
@@ -0,0 +1,4 @@
+FLUSH NO_WRITE_TO_BINLOG changed_page_bitmaps;
+select * from information_schema.changed_page_bitmaps;
+dummy
+0
diff --git a/mysql-test/suite/innodb/r/innodb-index.result b/mysql-test/suite/innodb/r/innodb-index.result
index 996bc45f7e2..b151e20d321 100644
--- a/mysql-test/suite/innodb/r/innodb-index.result
+++ b/mysql-test/suite/innodb/r/innodb-index.result
@@ -528,7 +528,7 @@ info: Records: 0 Duplicates: 0 Warnings: 0
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `alpha` int(11) NOT NULL DEFAULT '0',
+ `alpha` int(11) NOT NULL,
`beta` int(11) DEFAULT NULL,
`c` int(11) NOT NULL,
`d` int(11) DEFAULT NULL,
@@ -1166,7 +1166,7 @@ t2 CREATE TABLE `t2` (
show create table t2i;
Table Create Table
t2i CREATE TABLE `t2i` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` char(1) NOT NULL,
PRIMARY KEY (`a`,`b`),
KEY `t2a` (`a`)
@@ -1174,7 +1174,7 @@ t2i CREATE TABLE `t2i` (
show create table t2c;
Table Create Table
t2c CREATE TABLE `t2c` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` char(1) NOT NULL,
PRIMARY KEY (`a`,`b`),
KEY `t2a` (`a`)
diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result
index f8020e080e6..34ed2ef3110 100644
--- a/mysql-test/suite/innodb/r/innodb.result
+++ b/mysql-test/suite/innodb/r/innodb.result
@@ -2484,7 +2484,7 @@ INSERT INTO t2 VALUES(1);
DELETE FROM t1 WHERE id = 1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
DROP TABLE t1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE t1;
SET FOREIGN_KEY_CHECKS=1;
diff --git a/mysql-test/suite/innodb/r/innodb_blob_unrecoverable_crash.result b/mysql-test/suite/innodb/r/innodb_blob_unrecoverable_crash.result
new file mode 100644
index 00000000000..9f6b7ca6a23
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_blob_unrecoverable_crash.result
@@ -0,0 +1,23 @@
+call mtr.add_suppression("InnoDB: The total blob data length");
+SET GLOBAL max_allowed_packet = 100*1024*1024;
+# Connection big_packets:
+CREATE TABLE t1 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB;
+INSERT INTO t1 (a, b) VALUES (1, '1');
+INSERT INTO t1 (a, b) VALUES (2, '2');
+INSERT INTO t1 (a, b) VALUES (3, '3');
+INSERT INTO t1 (a, b) VALUES (4, '4');
+INSERT INTO t1 (a, b) VALUES (5, '5');
+start transaction;
+INSERT INTO t1 (a, b) VALUES (6, REPEAT('a', 20*1024*1024));
+ERROR 42000: The size of BLOB/TEXT data inserted in one transaction is greater than 10% of redo log size. Increase the redo log size using innodb_log_file_size.
+# Connection default:
+# Quick shutdown and restart server
+# Connection default:
+SELECT a FROM t1;
+a
+1
+2
+3
+4
+5
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb_bug14147491.result b/mysql-test/suite/innodb/r/innodb_bug14147491.result
index faf922ca5f8..bd3c388fae1 100644
--- a/mysql-test/suite/innodb/r/innodb_bug14147491.result
+++ b/mysql-test/suite/innodb/r/innodb_bug14147491.result
@@ -1,5 +1,16 @@
+call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed.*");
CALL mtr.add_suppression("InnoDB: Error: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts");
CALL mtr.add_suppression("InnoDB: Warning: database page corruption or a failed");
+CALL mtr.add_suppression("InnoDB: Database page corruption on disk or a failed");
+CALL mtr.add_suppression("InnoDB: Space .* file test/t1 read of page .*");
+CALL mtr.add_suppression("InnoDB: You may have to recover from a backup.");
+CALL mtr.add_suppression("InnoDB: It is also possible that your operatingsystem has corrupted its own file cache.");
+CALL mtr.add_suppression("InnoDB: and rebooting your computer removes the error.");
+CALL mtr.add_suppression("InnoDB: If the corrupt page is an index page you can also try to");
+CALL mtr.add_suppression("InnoDB: fix the corruption by dumping, dropping, and reimporting");
+CALL mtr.add_suppression("InnoDB: the corrupt table. You can use CHECK");
+CALL mtr.add_suppression("InnoDB: TABLE to scan your table for corruption.");
+CALL mtr.add_suppression("InnoDB: See also .* about forcing recovery.");
# Create and populate the table to be corrupted
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB;
INSERT INTO t1 (b) VALUES ('corrupt me');
diff --git a/mysql-test/suite/innodb/r/innodb_bug21704.result b/mysql-test/suite/innodb/r/innodb_bug21704.result
index 239aeaa354d..c0bc3af2f20 100644
--- a/mysql-test/suite/innodb/r/innodb_bug21704.result
+++ b/mysql-test/suite/innodb/r/innodb_bug21704.result
@@ -54,14 +54,14 @@ info: Records: 0 Duplicates: 0 Warnings: 0
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `e` int(11) NOT NULL DEFAULT '0',
+ `e` int(11) NOT NULL,
`c` int(11) DEFAULT NULL,
PRIMARY KEY (`e`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `z` int(11) NOT NULL DEFAULT '0',
+ `z` int(11) NOT NULL,
`c` int(11) DEFAULT NULL,
PRIMARY KEY (`z`),
CONSTRAINT `fk1` FOREIGN KEY (`z`) REFERENCES `t1` (`e`)
@@ -69,7 +69,7 @@ t2 CREATE TABLE `t2` (
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `f` int(11) NOT NULL DEFAULT '0',
+ `f` int(11) NOT NULL,
`g` int(11) DEFAULT NULL,
`d` int(11) DEFAULT NULL,
PRIMARY KEY (`f`),
diff --git a/mysql-test/suite/innodb/r/innodb_defrag_binlog.result b/mysql-test/suite/innodb/r/innodb_defrag_binlog.result
index 7cc471f6345..6ff32726f57 100644
--- a/mysql-test/suite/innodb/r/innodb_defrag_binlog.result
+++ b/mysql-test/suite/innodb/r/innodb_defrag_binlog.result
@@ -8,22 +8,22 @@ optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
drop table t1;
-show binlog events in 'master-bin.000001' from 313;
+include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 313 Gtid 1 351 GTID 0-1-1
-master-bin.000001 351 Query 1 465 use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
-master-bin.000001 465 Gtid 1 503 GTID 0-1-2
-master-bin.000001 503 Query 1 669 use `test`; create table t1(a int not null primary key auto_increment, b varchar(256), key second(b)) engine=innodb
-master-bin.000001 669 Gtid 1 707 BEGIN GTID 0-1-3
-master-bin.000001 707 Table_map 1 751 table_id: # (test.t1)
-master-bin.000001 751 Write_rows_v1 1 1043 table_id: # flags: STMT_END_F
-master-bin.000001 1043 Xid 1 1070 COMMIT /* XID */
-master-bin.000001 1070 Gtid 1 1108 BEGIN GTID 0-1-4
-master-bin.000001 1108 Table_map 1 1152 table_id: # (test.t1)
-master-bin.000001 1152 Write_rows_v1 1 1444 table_id: # flags: STMT_END_F
-master-bin.000001 1444 Xid 1 1471 COMMIT /* XID */
-master-bin.000001 1471 Gtid 1 1509 GTID 0-1-5
-master-bin.000001 1509 Query 1 1589 use `test`; optimize table t1
-master-bin.000001 1589 Gtid 1 1627 GTID 0-1-6
-master-bin.000001 1627 Query 1 1731 use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; create table t1(a int not null primary key auto_increment, b varchar(256), key second(b)) engine=innodb
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; optimize table t1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
include/rpl_end.inc
diff --git a/mysql-test/suite/innodb/r/innodb_force_pk.result b/mysql-test/suite/innodb/r/innodb_force_pk.result
index ea8fd784320..867730a9247 100644
--- a/mysql-test/suite/innodb/r/innodb_force_pk.result
+++ b/mysql-test/suite/innodb/r/innodb_force_pk.result
@@ -51,3 +51,15 @@ show warnings;
Level Code Message
Error 1173 This table type requires a primary key
drop table t1;
+create table t1 (i int not null, key(i)) engine=innodb;
+ERROR 42000: This table type requires a primary key
+create table t1 (i int not null, unique key(i)) engine=innodb;
+show warnings;
+Level Code Message
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) NOT NULL,
+ UNIQUE KEY `i` (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1;
diff --git a/mysql-test/suite/innodb/r/innodb_gis.result b/mysql-test/suite/innodb/r/innodb_gis.result
index de5ff61357e..fc13ba1ab2c 100644
--- a/mysql-test/suite/innodb/r/innodb_gis.result
+++ b/mysql-test/suite/innodb/r/innodb_gis.result
@@ -395,7 +395,7 @@ first second w c o e d t i r
120 120 1 1 0 1 0 0 1 0
120 121 0 0 1 0 0 0 1 0
121 120 0 0 1 0 0 0 1 0
-121 121 1 1 0 1 0 1 1 0
+121 121 1 1 0 1 0 0 1 0
explain extended SELECT g1.fid as first, g2.fid as second,
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
@@ -494,7 +494,7 @@ mbroverlaps
down,left,right,up
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrtouches
-big,center,down,down2,left,left2,right,right2,small,up,up2
+down2,left2,right2,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrwithin
big,center
@@ -515,7 +515,7 @@ overlaps
down,left,right,up
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
touches
-big,center,down,down2,left,left2,right,right2,small,up,up2
+down2,left2,right2,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
within
big,center
diff --git a/mysql-test/suite/innodb/r/innodb_monitor.result b/mysql-test/suite/innodb/r/innodb_monitor.result
index 0977c8b8594..8c580348e1a 100644
--- a/mysql-test/suite/innodb/r/innodb_monitor.result
+++ b/mysql-test/suite/innodb/r/innodb_monitor.result
@@ -215,6 +215,8 @@ innodb_log_flush_usec disabled
innodb_mem_validate_usec disabled
innodb_master_purge_usec disabled
innodb_dict_lru_usec disabled
+innodb_dict_lru_count_active disabled
+innodb_dict_lru_count_idle disabled
innodb_checkpoint_usec disabled
innodb_dblwr_writes disabled
innodb_dblwr_pages_written disabled
diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result
index 793f407d5d8..61eec8d4155 100644
--- a/mysql-test/suite/innodb/r/innodb_mysql.result
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result
@@ -634,7 +634,7 @@ ERROR 42S02: Table 'test.bug29807' doesn't exist in engine
drop table t1;
drop table bug29807;
Warnings:
-Warning 155 Table 'test.bug29807' doesn't exist in engine
+Warning 1932 Table 'test.bug29807' doesn't exist in engine
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
switch to connection c1
diff --git a/mysql-test/suite/innodb/r/innodb_simulate_comp_failures.result b/mysql-test/suite/innodb/r/innodb_simulate_comp_failures.result
index cb7a3b9c282..1cb2cf77050 100644
--- a/mysql-test/suite/innodb/r/innodb_simulate_comp_failures.result
+++ b/mysql-test/suite/innodb/r/innodb_simulate_comp_failures.result
@@ -5,4 +5,4 @@ CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255), KEY msg_i(m
SET GLOBAL innodb_simulate_comp_failures = 25;
SELECT COUNT(*) FROM t1;
COUNT(*)
-100000
+10000
diff --git a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result
index aa7b8e7650f..db7be5c9586 100644
--- a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result
+++ b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result
@@ -250,6 +250,8 @@ innodb_log_flush_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NU
innodb_mem_validate_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent to do memory validation
innodb_master_purge_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent by master thread to purge records
innodb_dict_lru_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent to process DICT LRU list
+innodb_dict_lru_count_active server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of tables evicted from DICT LRU list in the active loop
+innodb_dict_lru_count_idle server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of tables evicted from DICT LRU list in the idle loop
innodb_checkpoint_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent by master thread to do checkpoint
innodb_dblwr_writes server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of doublewrite operations that have been performed (innodb_dblwr_writes)
innodb_dblwr_pages_written server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pages that have been written for doublewrite operations (innodb_dblwr_pages_written)
diff --git a/mysql-test/suite/innodb/r/innodb_uninstall.result b/mysql-test/suite/innodb/r/innodb_uninstall.result
new file mode 100644
index 00000000000..b1f618c5221
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_uninstall.result
@@ -0,0 +1,26 @@
+install plugin innodb soname 'ha_innodb';
+Warnings:
+Warning 1105 Cannot enable tc-log at run-time. XA features of InnoDB are disabled
+create table t1(a int not null primary key) engine=innodb;
+begin;
+insert into t1 values(1);
+flush tables;
+uninstall plugin innodb;
+select sleep(1);
+sleep(1)
+0
+Warnings:
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+install plugin innodb soname 'ha_innodb';
+Warnings:
+Warning 1105 Cannot enable tc-log at run-time. XA features of InnoDB are disabled
+drop table t1;
+create table t2(a int not null primary key) engine=innodb;
+insert into t2 values(1);
+drop table t2;
+uninstall plugin innodb;
+select sleep(1);
+sleep(1)
+0
+Warnings:
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
diff --git a/mysql-test/suite/innodb/r/xa_recovery.result b/mysql-test/suite/innodb/r/xa_recovery.result
new file mode 100644
index 00000000000..84cb37ef7c9
--- /dev/null
+++ b/mysql-test/suite/innodb/r/xa_recovery.result
@@ -0,0 +1,17 @@
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+XA START 'x';
+UPDATE t1 set a=2;
+XA END 'x';
+XA PREPARE 'x';
+call mtr.add_suppression("Found 1 prepared XA transactions");
+SELECT * FROM t1 LOCK IN SHARE MODE;
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT * FROM t1;
+a
+2
+XA ROLLBACK 'x';
+SELECT * FROM t1;
+a
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/add_constraint.test b/mysql-test/suite/innodb/t/add_constraint.test
new file mode 100644
index 00000000000..7e86a7e5f97
--- /dev/null
+++ b/mysql-test/suite/innodb/t/add_constraint.test
@@ -0,0 +1,21 @@
+--source include/have_innodb.inc
+
+--echo #
+--echo # Bug #20762798 FK DDL: CRASH IN DICT_FOREIGN_REMOVE_FROM_CACHE
+--echo #
+
+create table t1(a int, b int, key(a),key(b))engine=innodb;
+create table t2(a int, b int, key(a),key(b))engine=innodb;
+
+alter table t2 add constraint b foreign key (b) references t1(a);
+alter table t1 add constraint b1 foreign key (b) references t2(a);
+
+--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
+--error ER_CANT_CREATE_TABLE
+alter table t2 add constraint b1 foreign key (b) references t1(a);
+
+alter table t2 drop foreign key b;
+alter table t1 drop foreign key b1;
+
+drop table t2;
+drop table t1;
diff --git a/mysql-test/suite/innodb/t/binlog_consistent.test b/mysql-test/suite/innodb/t/binlog_consistent.test
index a97bef4cf38..4ab2903e693 100644
--- a/mysql-test/suite/innodb/t/binlog_consistent.test
+++ b/mysql-test/suite/innodb/t/binlog_consistent.test
@@ -1,6 +1,7 @@
--source include/have_innodb.inc
--source include/have_log_bin.inc
--source include/have_binlog_format_mixed_or_statement.inc
+--source include/binlog_start_pos.inc
RESET MASTER;
@@ -16,7 +17,10 @@ connection default;
--echo # Connection default
CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb;
+let pos=`select $binlog_start_pos + 238`;
+--replace_result $pos <pos>
SHOW MASTER STATUS;
+--replace_result $pos <pos>
SHOW STATUS LIKE 'binlog_snapshot_%';
BEGIN;
INSERT INTO t1 VALUES (0, "");
@@ -56,7 +60,11 @@ COMMIT;
connection default;
--echo # Connection default
SELECT * FROM t1 ORDER BY a,b;
+let pos=`select $binlog_start_pos + 740`;
+--replace_result $pos <pos>
SHOW STATUS LIKE 'binlog_snapshot_%';
+let pos=`select $binlog_start_pos + 1092`;
+--replace_result $pos <pos>
SHOW MASTER STATUS;
SELECT * FROM t2 ORDER BY a;
@@ -77,14 +85,19 @@ FLUSH LOGS;
connection default;
--echo # Connection default
SELECT * FROM t1 ORDER BY a,b;
+let pos=`select $binlog_start_pos + 740`;
+--replace_result $pos <pos>
SHOW STATUS LIKE 'binlog_snapshot_%';
+let pos=`select $binlog_start_pos + 119`;
+--replace_result $pos <pos>
SHOW MASTER STATUS;
COMMIT;
+--replace_result $pos <pos>
SHOW STATUS LIKE 'binlog_snapshot_%';
+--replace_result $pos <pos>
SHOW MASTER STATUS;
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS;
+source include/show_binlog_events.inc;
--echo *** MDEV-7310: last_commit_pos_offset set to wrong value after binlog rotate in group commit ***
diff --git a/mysql-test/suite/innodb/t/foreign-keys.test b/mysql-test/suite/innodb/t/foreign-keys.test
index 8ee96347208..2d586e2d6be 100644
--- a/mysql-test/suite/innodb/t/foreign-keys.test
+++ b/mysql-test/suite/innodb/t/foreign-keys.test
@@ -1,11 +1,6 @@
--source include/have_innodb.inc
--source include/have_debug.inc
-if (`select plugin_auth_version <= "5.5.39-MariaDB-36.0" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in XtraDB as of 5.5.39-MariaDB-36.0 or earlier
-}
-
--echo #
--echo # Bug #19471516 SERVER CRASHES WHEN EXECUTING ALTER TABLE
--echo # ADD FOREIGN KEY
diff --git a/mysql-test/suite/innodb/t/group_commit_binlog_pos.test b/mysql-test/suite/innodb/t/group_commit_binlog_pos.test
index 213dbc9d3d8..f1332d6dd6a 100644
--- a/mysql-test/suite/innodb/t/group_commit_binlog_pos.test
+++ b/mysql-test/suite/innodb/t/group_commit_binlog_pos.test
@@ -2,6 +2,7 @@
--source include/have_debug_sync.inc
--source include/have_log_bin.inc
--source include/have_binlog_format_mixed_or_statement.inc
+--source include/binlog_start_pos.inc
# Need DBUG to crash the server intentionally
--source include/have_debug.inc
@@ -96,6 +97,8 @@ SELECT * FROM t1 ORDER BY a;
# for the end of the second transaction (as can be checked with
# mysqlbinlog).
let $MYSQLD_DATADIR= `SELECT @@datadir`;
+let pos=`select $binlog_start_pos + 678`;
+--replace_result $pos <pos>
--exec grep 'InnoDB: Last MySQL binlog file position' $MYSQLD_DATADIR/../../log/mysqld.1.err | tail -1
SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/suite/innodb/t/group_commit_binlog_pos_no_optimize_thread.test b/mysql-test/suite/innodb/t/group_commit_binlog_pos_no_optimize_thread.test
index 3ae3c50085d..db49c3a9a31 100644
--- a/mysql-test/suite/innodb/t/group_commit_binlog_pos_no_optimize_thread.test
+++ b/mysql-test/suite/innodb/t/group_commit_binlog_pos_no_optimize_thread.test
@@ -2,6 +2,7 @@
--source include/have_debug_sync.inc
--source include/have_log_bin.inc
--source include/have_binlog_format_mixed_or_statement.inc
+--source include/binlog_start_pos.inc
# Need DBUG to crash the server intentionally
--source include/have_debug.inc
@@ -97,7 +98,8 @@ SELECT * FROM t1 ORDER BY a;
# for the end of the second transaction (as can be checked with
# mysqlbinlog).
let $MYSQLD_DATADIR= `SELECT @@datadir`;
+let pos=`select $binlog_start_pos + 678`;
+--replace_result $pos <pos>
--exec grep 'InnoDB: Last MySQL binlog file position' $MYSQLD_DATADIR/../../log/mysqld.1.err | tail -1
-
SET DEBUG_SYNC= 'RESET';
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb-alter-table.test b/mysql-test/suite/innodb/t/innodb-alter-table.test
new file mode 100644
index 00000000000..2be2a30194d
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-alter-table.test
@@ -0,0 +1,59 @@
+--source include/have_innodb.inc
+
+#
+# MMDEV-8386: MariaDB creates very big tmp file and hangs on xtradb
+#
+drop database if exists moodle19;
+create database moodle19;
+use moodle19;
+
+CREATE TABLE `mdl_course_modules` (
+ `id` bigint(10) NOT NULL AUTO_INCREMENT,
+ `course` bigint(10) NOT NULL DEFAULT '0',
+ `module` bigint(10) NOT NULL DEFAULT '0',
+ `instance` bigint(10) NOT NULL DEFAULT '0',
+ `section` bigint(10) NOT NULL DEFAULT '0',
+ `idnumber` varchar(100) DEFAULT NULL,
+ `added` bigint(10) NOT NULL DEFAULT '0',
+ `delay` varchar(10) NOT NULL DEFAULT '0',
+ `score` smallint(4) NOT NULL DEFAULT '0',
+ `indent` mediumint(5) NOT NULL DEFAULT '0',
+ `visible` tinyint(1) NOT NULL DEFAULT '1',
+ `checkboxesforprereqs` tinyint(1) NOT NULL DEFAULT '0',
+ `stylewhencomplete` varchar(200) DEFAULT '',
+ `checkboxforcomplete` tinyint(1) NOT NULL DEFAULT '0',
+ `stylewhenlocked` varchar(200) DEFAULT 'locked',
+ `visiblewhenlocked` tinyint(1) NOT NULL DEFAULT '1',
+ `visibleold` tinyint(1) NOT NULL DEFAULT '1',
+ `groupmode` smallint(4) NOT NULL DEFAULT '0',
+ `groupingid` bigint(10) NOT NULL DEFAULT '0',
+ `groupmembersonly` smallint(4) NOT NULL DEFAULT '0',
+ `completion` tinyint(1) NOT NULL DEFAULT '0',
+ `completiongradeitemnumber` bigint(10) DEFAULT NULL,
+ `completionview` tinyint(1) NOT NULL DEFAULT '0',
+ `completionexpected` bigint(10) NOT NULL DEFAULT '0',
+ `availablefrom` bigint(10) NOT NULL DEFAULT '0',
+ `availableuntil` bigint(10) NOT NULL DEFAULT '0',
+ `showavailability` tinyint(1) NOT NULL DEFAULT '0',
+ `showdescription` tinyint(1) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`id`),
+ KEY `mdl_courmodu_vis_ix` (`visible`),
+ KEY `mdl_courmodu_cou_ix` (`course`),
+ KEY `mdl_courmodu_mod_ix` (`module`),
+ KEY `mdl_courmodu_ins_ix` (`instance`),
+ KEY `mdl_courmodu_idncou_ix` (`idnumber`,`course`),
+ KEY `mdl_courmodu_gro_ix` (`groupingid`)
+) ENGINE=InnoDB AUTO_INCREMENT=447023 DEFAULT CHARSET=utf8 COMMENT='course_modules table retrofitted from MySQL';
+
+let $num= 2701;
+--disable_query_log
+--echo # Inserting $num rows into the table...
+while ($num)
+{
+ eval INSERT INTO mdl_course_modules VALUES ($num,4,5,5,24,NULL,1141569781,'',0,0,1,0,'',0,'locked',1,1,0,0,0,0,NULL,0,0,0,0,0,0);
+ dec $num;
+}
+--enable_query_log
+ALTER TABLE moodle19.mdl_course_modules ADD stefantest LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci AFTER showdescription;
+
+drop database moodle19;
diff --git a/mysql-test/suite/innodb/t/innodb-alter-timestamp.test b/mysql-test/suite/innodb/t/innodb-alter-timestamp.test
new file mode 100644
index 00000000000..c0b17ee6440
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-alter-timestamp.test
@@ -0,0 +1,27 @@
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (
+ `i1` INT(10) UNSIGNED NOT NULL,
+ `d1` TIMESTAMP NULL DEFAULT NULL
+) ENGINE=innodb;
+
+show create table t1;
+
+INSERT INTO t1 (i1) VALUES (1), (2), (3), (4), (5);
+select * from t1;
+set sql_mode = 'STRICT_ALL_TABLES,NO_ZERO_DATE';
+ALTER TABLE t1 CHANGE `d1` `d1` TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL;
+drop table t1;
+
+CREATE TABLE t1 (
+ `i1` INT(10) UNSIGNED NOT NULL,
+ `d1` TIMESTAMP NULL DEFAULT NULL
+) ENGINE=innodb;
+INSERT INTO t1 (i1) VALUES (1), (2), (3), (4), (5);
+ALTER TABLE t1 CHANGE `d1` `d1` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
+drop table t1;
+set sql_mode = '';
+
+
+
+
diff --git a/mysql-test/suite/innodb/t/innodb-autoinc.test b/mysql-test/suite/innodb/t/innodb-autoinc.test
index 415ada2939a..ab708e8762c 100644
--- a/mysql-test/suite/innodb/t/innodb-autoinc.test
+++ b/mysql-test/suite/innodb/t/innodb-autoinc.test
@@ -1,8 +1,3 @@
-if (`select plugin_auth_version <= "5.5.37-MariaDB-34.0" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in XtraDB as of 5.5.37-MariaDB-34.0 or earlier
-}
-
--source include/have_innodb.inc
# embedded server ignores 'delayed', so skip this
-- source include/not_embedded.inc
@@ -664,7 +659,7 @@ CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENG
INSERT INTO t1 VALUES (2147483648, 'a');
SHOW CREATE TABLE t1;
SELECT * FROM t1;
-ALTER TABLE t1 CHANGE c1 c1 INT;
+ALTER TABLE t1 CHANGE c1 c1 INT default 0;
SHOW CREATE TABLE t1;
INSERT INTO t1(c2) VALUES('b');
SELECT * FROM t1;
diff --git a/mysql-test/suite/innodb/t/innodb-fk-warnings.test b/mysql-test/suite/innodb/t/innodb-fk-warnings.test
new file mode 100644
index 00000000000..a95a7f55a40
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-fk-warnings.test
@@ -0,0 +1,145 @@
+--source include/have_innodb.inc
+
+#
+# MDEV-8524: Improve error messaging when there is duplicate key or foreign key names
+#
+CREATE TABLE t1 (
+ id int(11) NOT NULL PRIMARY KEY,
+ a int(11) NOT NULL,
+ b int(11) NOT NULL,
+ c int not null,
+ CONSTRAINT test FOREIGN KEY (b) REFERENCES t1 (id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+#
+# Below create table fails because constraint name test
+# is reserved for above table.
+#
+--error 1005
+CREATE TABLE t2 (
+ id int(11) NOT NULL PRIMARY KEY,
+ a int(11) NOT NULL,
+ b int(11) NOT NULL,
+ c int not null,
+ CONSTRAINT mytest FOREIGN KEY (c) REFERENCES t1(id),
+ CONSTRAINT test FOREIGN KEY (b) REFERENCES t2 (id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+show warnings;
+
+drop table t1;
+
+#
+# MDEV-6697: Improve foreign keys warnings/errors
+#
+
+#
+# No index for referenced columns
+#
+create table t1(a int) engine=innodb;
+--error 1005
+create table t2(a int, constraint a foreign key a (a) references t1(a)) engine=innodb;
+show warnings;
+drop table t1;
+
+create table t1(a int not null primary key, b int) engine=innodb;
+--error 1005
+create table t2(a int, b int, constraint a foreign key a (a) references t1(a),
+constraint a foreign key a (a) references t1(b)) engine=innodb;
+show warnings;
+create table t2(a int, b int, constraint a foreign key a (a) references t1(a)) engine=innodb;
+--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+--error 1005
+alter table t2 add constraint b foreign key (b) references t2(b);
+--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+show warnings;
+drop table t2, t1;
+
+#
+# Referenced table does not exists
+#
+
+create table t1 (f1 integer primary key) engine=innodb;
+--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+--error 1005
+alter table t1 add constraint c1 foreign key (f1) references t11(f1);
+--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+show warnings;
+drop table t1;
+
+#
+# Foreign key on temporal tables
+#
+
+create temporary table t1(a int not null primary key, b int, key(b)) engine=innodb;
+# remove echos and uncomment the commented when MDEV-8569 is fixed
+--echo create temporary table t2(a int, foreign key(a) references t1(a)) engine=innodb;
+--echo ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
+--echo show warnings;
+--echo Level Code Message
+--echo Warning 150 Create table `mysqld.1`.`t2` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary close to foreign key(a) references t1(a)) engine=innodb.
+--echo Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
+--echo Warning 1215 Cannot add foreign key constraint
+--echo alter table t1 add foreign key(b) references t1(a);
+--echo ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+--echo show warnings;
+--echo Level Code Message
+--echo Warning 150 Alter table `mysqld.1`.`t1` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary close to foreign key(b) references t1(a).
+--echo Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+--echo Warning 1215 Cannot add foreign key constraint
+#--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+#--error 1005
+#create temporary table t2(a int, foreign key(a) references t1(a)) engine=innodb;
+#--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+#show warnings;
+#--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+#--error 1005
+#alter table t1 add foreign key(b) references t1(a);
+#--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+#show warnings;
+drop table t1;
+
+#
+# Column numbers do not match
+#
+create table t1(a int not null primary key, b int, key(b)) engine=innodb;
+--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+--error 1239
+alter table t1 add foreign key(a,b) references t1(a);
+--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+show warnings;
+drop table t1;
+create table t1(a int not null primary key, b int, key(b)) engine=innodb;
+--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+--error 1239
+alter table t1 add foreign key(a) references t1(a,b);
+--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+show warnings;
+drop table t1;
+
+#
+# ON UPDATE/DELETE SET NULL on NOT NULL column
+#
+create table t1 (f1 integer not null primary key) engine=innodb;
+--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+--error 1005
+alter table t1 add constraint c1 foreign key (f1) references t1(f1) on update set null;
+--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+show warnings;
+--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+--error 1005
+create table t2(a int not null, foreign key(a) references t1(f1) on delete set null) engine=innodb;
+--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+show warnings;
+drop table t1;
+
+#
+# Incorrect types
+#
+create table t1 (id int not null primary key, f1 int, f2 int, key(f1)) engine=innodb;
+--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+--error 1005
+create table t2(a char(20), key(a), foreign key(a) references t1(f1)) engine=innodb;
+--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+show warnings;
+drop table t1;
diff --git a/mysql-test/suite/innodb/t/innodb-flush-changed-page-bitmaps.opt b/mysql-test/suite/innodb/t/innodb-flush-changed-page-bitmaps.opt
new file mode 100644
index 00000000000..afa6311a74b
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-flush-changed-page-bitmaps.opt
@@ -0,0 +1,2 @@
+--changed-page-bitmaps
+--innodb-track-changed-pages
diff --git a/mysql-test/suite/innodb/t/innodb-flush-changed-page-bitmaps.test b/mysql-test/suite/innodb/t/innodb-flush-changed-page-bitmaps.test
new file mode 100644
index 00000000000..662bbbaacaf
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-flush-changed-page-bitmaps.test
@@ -0,0 +1,5 @@
+-- source include/have_xtradb.inc
+-- source include/not_embedded.inc
+
+FLUSH NO_WRITE_TO_BINLOG changed_page_bitmaps;
+select * from information_schema.changed_page_bitmaps;
diff --git a/mysql-test/suite/innodb/t/innodb.test b/mysql-test/suite/innodb/t/innodb.test
index 47bbc90f955..bef13f5f418 100644
--- a/mysql-test/suite/innodb/t/innodb.test
+++ b/mysql-test/suite/innodb/t/innodb.test
@@ -1551,7 +1551,7 @@ INSERT INTO t2 VALUES(1);
--error 1451
DELETE FROM t1 WHERE id = 1;
---error 1217
+--error 1451
DROP TABLE t1;
SET FOREIGN_KEY_CHECKS=0;
diff --git a/mysql-test/suite/innodb/t/innodb_blob_unrecoverable_crash.test b/mysql-test/suite/innodb/t/innodb_blob_unrecoverable_crash.test
new file mode 100644
index 00000000000..16fb570737d
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_blob_unrecoverable_crash.test
@@ -0,0 +1,55 @@
+--source include/not_embedded.inc
+--source include/not_crashrep.inc
+--source include/have_innodb.inc
+
+call mtr.add_suppression("InnoDB: The total blob data length");
+
+let $old_max_allowed_packet = `select @@max_allowed_packet`;
+SET GLOBAL max_allowed_packet = 100*1024*1024;
+
+--echo # Connection big_packets:
+connect(big_packets,localhost,root,,);
+connection big_packets;
+
+CREATE TABLE t1 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB;
+
+# Insert a few rows (it doesn't really matter how many). These transactions
+# are committed once they are acked, so they should not be lost.
+INSERT INTO t1 (a, b) VALUES (1, '1');
+INSERT INTO t1 (a, b) VALUES (2, '2');
+INSERT INTO t1 (a, b) VALUES (3, '3');
+INSERT INTO t1 (a, b) VALUES (4, '4');
+INSERT INTO t1 (a, b) VALUES (5, '5');
+
+# The BLOB insert will fail, and should disappear. However all data committed
+# up to this point should not be lost.
+start transaction;
+--replace_regex /\(> [0-9]*\)/(> ####)/
+--error ER_TOO_BIG_ROWSIZE
+INSERT INTO t1 (a, b) VALUES (6, REPEAT('a', 20*1024*1024));
+
+--echo # Connection default:
+connection default;
+
+# We expect a restart.
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+--echo # Quick shutdown and restart server
+--shutdown_server 0
+
+# Wait for the server to come back up, and reconnect.
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+--echo # Connection default:
+connection default;
+
+# We should see (1,2,3,4,5) here.
+SELECT a FROM t1;
+
+# Clean up.
+DROP TABLE t1;
+
+--disable_query_log
+eval set global max_allowed_packet = $old_max_allowed_packet;
+--enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb_bug14147491.test b/mysql-test/suite/innodb/t/innodb_bug14147491.test
index ee9bb4814bc..16e88826c85 100644
--- a/mysql-test/suite/innodb/t/innodb_bug14147491.test
+++ b/mysql-test/suite/innodb/t/innodb_bug14147491.test
@@ -4,6 +4,8 @@
-- source include/not_encrypted.inc
+call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed.*");
+
# Don't test under valgrind, memory leaks will occur
source include/not_valgrind.inc;
# Avoid CrashReporter popup on Mac
@@ -20,6 +22,17 @@ source include/not_windows.inc;
CALL mtr.add_suppression("InnoDB: Error: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts");
CALL mtr.add_suppression("InnoDB: Warning: database page corruption or a failed");
+CALL mtr.add_suppression("InnoDB: Database page corruption on disk or a failed");
+CALL mtr.add_suppression("InnoDB: Space .* file test/t1 read of page .*");
+CALL mtr.add_suppression("InnoDB: You may have to recover from a backup.");
+CALL mtr.add_suppression("InnoDB: It is also possible that your operatingsystem has corrupted its own file cache.");
+CALL mtr.add_suppression("InnoDB: and rebooting your computer removes the error.");
+CALL mtr.add_suppression("InnoDB: If the corrupt page is an index page you can also try to");
+CALL mtr.add_suppression("InnoDB: fix the corruption by dumping, dropping, and reimporting");
+CALL mtr.add_suppression("InnoDB: the corrupt table. You can use CHECK");
+CALL mtr.add_suppression("InnoDB: TABLE to scan your table for corruption.");
+CALL mtr.add_suppression("InnoDB: See also .* about forcing recovery.");
+
--echo # Create and populate the table to be corrupted
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB;
diff --git a/mysql-test/suite/innodb/t/innodb_defrag_binlog.test b/mysql-test/suite/innodb/t/innodb_defrag_binlog.test
index ec3203893a4..db6849f8477 100644
--- a/mysql-test/suite/innodb/t/innodb_defrag_binlog.test
+++ b/mysql-test/suite/innodb/t/innodb_defrag_binlog.test
@@ -16,7 +16,6 @@ optimize table t1;
drop table t1;
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
-show binlog events in 'master-bin.000001' from 313;
+--source include/show_binlog_events.inc
--source include/rpl_end.inc
diff --git a/mysql-test/suite/innodb/t/innodb_force_pk.test b/mysql-test/suite/innodb/t/innodb_force_pk.test
index 48986ca2fee..7dcab8eaead 100644
--- a/mysql-test/suite/innodb/t/innodb_force_pk.test
+++ b/mysql-test/suite/innodb/t/innodb_force_pk.test
@@ -33,6 +33,17 @@ create table t2(a integer) engine=innodb;
show warnings;
drop table t1;
+#
+# MDEV-8582: innodb_force_primary_key option does not
+# force PK or unique key
+#
+--error 1173
+create table t1 (i int not null, key(i)) engine=innodb;
+create table t1 (i int not null, unique key(i)) engine=innodb;
+show warnings;
+show create table t1;
+drop table t1;
+
--disable_query_log
eval set global innodb_force_primary_key=$force_pk;
--enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures.test b/mysql-test/suite/innodb/t/innodb_simulate_comp_failures.test
index a940a926f85..ae9e0a9b984 100644
--- a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures.test
+++ b/mysql-test/suite/innodb/t/innodb_simulate_comp_failures.test
@@ -1,8 +1,8 @@
--source include/big_test.inc
# test takes too long with valgrind
--source include/not_valgrind.inc
---let $num_inserts = 100000
---let $num_ops = 30000
+--let $num_inserts = 10000
+--let $num_ops = 10000
--source suite/innodb/include/innodb_simulate_comp_failures.inc
# clean exit
--exit
diff --git a/mysql-test/suite/innodb/t/innodb_uninstall.opt b/mysql-test/suite/innodb/t/innodb_uninstall.opt
new file mode 100644
index 00000000000..918855a7b01
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_uninstall.opt
@@ -0,0 +1,3 @@
+--ignore-builtin-innodb
+--loose-innodb
+
diff --git a/mysql-test/suite/innodb/t/innodb_uninstall.test b/mysql-test/suite/innodb/t/innodb_uninstall.test
new file mode 100644
index 00000000000..3cd02b23d8c
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_uninstall.test
@@ -0,0 +1,58 @@
+--source include/not_embedded.inc
+--source include/not_windows.inc
+
+if (!$HA_INNODB_SO) {
+ --skip Need InnoDB plugin
+}
+
+#
+# MDEV-8474: InnoDB sets per-connection data unsafely
+# Below test caused hang
+#
+install plugin innodb soname 'ha_innodb';
+create table t1(a int not null primary key) engine=innodb;
+
+connect (con1, localhost, root);
+connection con1;
+begin;
+insert into t1 values(1);
+
+connection default;
+flush tables;
+send uninstall plugin innodb;
+
+connection con1;
+select sleep(1);
+disconnect con1;
+
+connection default;
+reap;
+
+--source include/restart_mysqld.inc
+
+#
+# Another test that caused hang.
+#
+
+connect (con1, localhost, root);
+connection con1;
+install plugin innodb soname 'ha_innodb';
+
+drop table t1;
+create table t2(a int not null primary key) engine=innodb;
+insert into t2 values(1);
+drop table t2;
+
+connection default;
+send uninstall plugin innodb;
+
+connection con1;
+select sleep(1);
+disconnect con1;
+
+connection default;
+reap;
+
+--source include/restart_mysqld.inc
+
+
diff --git a/mysql-test/suite/innodb/t/insert_debug.test b/mysql-test/suite/innodb/t/insert_debug.test
index 666b634bef9..36ceba2ee8b 100644
--- a/mysql-test/suite/innodb/t/insert_debug.test
+++ b/mysql-test/suite/innodb/t/insert_debug.test
@@ -2,11 +2,6 @@
--source include/have_debug.inc
--source include/have_partition.inc
-if (`select plugin_auth_version < "5.6.22" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in InnoDB/XtraDB as of 5.6.21 or earlier
-}
-
--echo #
--echo # Bug#19904003 INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG=1
--echo # CAUSES INFINITE PAGE SPLIT
diff --git a/mysql-test/suite/innodb/t/sp_temp_table.test b/mysql-test/suite/innodb/t/sp_temp_table.test
index 9a6be85fd7e..b2883f551b9 100644
--- a/mysql-test/suite/innodb/t/sp_temp_table.test
+++ b/mysql-test/suite/innodb/t/sp_temp_table.test
@@ -1,11 +1,6 @@
--source include/have_innodb.inc
--source include/big_test.inc
-if (`select plugin_auth_version < "5.6.22" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in InnoDB/XtraDB as of 5.6.21 or earlier
-}
-
--echo #
--echo # Bug #19306524 FAILING ASSERTION WITH TEMP TABLE FOR A PROCEDURE
--echo # CALLED FROM A FUNCTION
diff --git a/mysql-test/suite/innodb/t/strict_mode.test b/mysql-test/suite/innodb/t/strict_mode.test
index 9b115091f84..86b56a09c0e 100644
--- a/mysql-test/suite/innodb/t/strict_mode.test
+++ b/mysql-test/suite/innodb/t/strict_mode.test
@@ -1,10 +1,5 @@
--source include/have_innodb.inc
-if (`select plugin_auth_version <= "5.5.40-MariaDB-36.1" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in XtraDB as of 5.5.40-MariaDB-36.1 or earlier
-}
-
--echo #
--echo # Bug #17852083 PRINT A WARNING WHEN DDL HAS AN ERROR IN
--echo # INNODB_STRICT_MODE = 1
diff --git a/mysql-test/suite/innodb/t/xa_recovery.test b/mysql-test/suite/innodb/t/xa_recovery.test
new file mode 100644
index 00000000000..837b33cb3c4
--- /dev/null
+++ b/mysql-test/suite/innodb/t/xa_recovery.test
@@ -0,0 +1,47 @@
+if (`select plugin_auth_version <= "5.6.24" from information_schema.plugins where plugin_name='innodb'`)
+{
+ --skip Not fixed in InnoDB as of 5.6.24 or earlier
+}
+--source include/have_innodb.inc
+# Embedded server does not support restarting.
+--source include/not_embedded.inc
+
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connect (con1,localhost,root);
+XA START 'x'; UPDATE t1 set a=2; XA END 'x'; XA PREPARE 'x';
+connection default;
+
+call mtr.add_suppression("Found 1 prepared XA transactions");
+
+# Kill and restart the server.
+-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+-- shutdown_server 0
+-- source include/wait_until_disconnected.inc
+
+-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+-- enable_reconnect
+-- source include/wait_until_connected_again.inc
+-- disable_reconnect
+
+disconnect con1;
+connect (con1,localhost,root);
+--send SELECT * FROM t1 LOCK IN SHARE MODE
+
+connection default;
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = 'Sending data' and
+ info = 'SELECT * FROM t1 LOCK IN SHARE MODE';
+--source include/wait_condition.inc
+
+--source include/restart_mysqld.inc
+
+disconnect con1;
+
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT * FROM t1;
+XA ROLLBACK 'x';
+SELECT * FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_zip/r/innodb_prefix_index_liftedlimit.result b/mysql-test/suite/innodb_zip/r/innodb_prefix_index_liftedlimit.result
index 746072781bd..ccfd8a16710 100644
--- a/mysql-test/suite/innodb_zip/r/innodb_prefix_index_liftedlimit.result
+++ b/mysql-test/suite/innodb_zip/r/innodb_prefix_index_liftedlimit.result
@@ -1381,7 +1381,7 @@ info: Records: 0 Duplicates: 0 Warnings: 0
SHOW CREATE TABLE worklog5743;
Table Create Table
worklog5743 CREATE TABLE `worklog5743` (
- `col_1_varchar` varchar(4000) NOT NULL DEFAULT '',
+ `col_1_varchar` varchar(4000) NOT NULL,
`col_2_varchar` varchar(4000) DEFAULT NULL,
PRIMARY KEY (`col_1_varchar`(767)),
KEY `prefix_idx` (`col_1_varchar`(767))
diff --git a/mysql-test/suite/jp/r/jp_alter_sjis.result b/mysql-test/suite/jp/r/jp_alter_sjis.result
index 85d974df78e..20b71952197 100644
--- a/mysql-test/suite/jp/r/jp_alter_sjis.result
+++ b/mysql-test/suite/jp/r/jp_alter_sjis.result
@@ -31,14 +31,14 @@ NULL ³³³³³ NULL NULL
DESC `±±±`;
Field Type Null Key Default Extra
¶¶ char(1) YES MUL NULL
-··· char(6) NO PRI
+··· char(6) NO PRI NULL
¸¸¸ char(1) YES UNI NULL
¹¹¹ char(1) YES NULL
SHOW CREATE TABLE `±±±`;
Table Create Table
±±± CREATE TABLE `±±±` (
`¶¶` char(1) DEFAULT NULL,
- `···` char(6) NOT NULL DEFAULT '',
+ `···` char(6) NOT NULL,
`¸¸¸` char(1) DEFAULT NULL,
`¹¹¹` char(1) DEFAULT NULL,
PRIMARY KEY (`···`),
@@ -58,11 +58,11 @@ SELECT * FROM `±±±`;
³³³³³
DESC `±±±`;
Field Type Null Key Default Extra
-··· char(6) NO
+··· char(6) NO NULL
SHOW CREATE TABLE `±±±`;
Table Create Table
±±± CREATE TABLE `±±±` (
- `···` char(6) NOT NULL DEFAULT ''
+ `···` char(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=sjis
ALTER TABLE `‚ ‚ ‚ ` ADD `‚©‚©‚©` char(1) FIRST;
ALTER TABLE `‚ ‚ ‚ ` ADD `‚­‚­‚­` char(1) AFTER `‚«‚«‚«`;
@@ -80,14 +80,14 @@ NULL ‚¤‚¤‚¤‚¤‚¤ NULL NULL
DESC `‚ ‚ ‚ `;
Field Type Null Key Default Extra
‚©‚© char(1) YES MUL NULL
-‚«‚«‚« char(6) NO PRI
+‚«‚«‚« char(6) NO PRI NULL
‚­‚­‚­ char(1) YES UNI NULL
‚¯‚¯‚¯ char(1) YES NULL
SHOW CREATE TABLE `‚ ‚ ‚ `;
Table Create Table
‚ ‚ ‚  CREATE TABLE `‚ ‚ ‚ ` (
`‚©‚©` char(1) DEFAULT NULL,
- `‚«‚«‚«` char(6) NOT NULL DEFAULT '',
+ `‚«‚«‚«` char(6) NOT NULL,
`‚­‚­‚­` char(1) DEFAULT NULL,
`‚¯‚¯‚¯` char(1) DEFAULT NULL,
PRIMARY KEY (`‚«‚«‚«`),
@@ -107,11 +107,11 @@ SELECT * FROM `‚ ‚ ‚ `;
‚¤‚¤‚¤‚¤‚¤
DESC `‚ ‚ ‚ `;
Field Type Null Key Default Extra
-‚«‚«‚« char(6) NO
+‚«‚«‚« char(6) NO NULL
SHOW CREATE TABLE `‚ ‚ ‚ `;
Table Create Table
‚ ‚ ‚  CREATE TABLE `‚ ‚ ‚ ` (
- `‚«‚«‚«` char(6) NOT NULL DEFAULT ''
+ `‚«‚«‚«` char(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=sjis
ALTER TABLE `ƒ\ƒ\ƒ\` ADD `\\\` char(1) FIRST;
ALTER TABLE `ƒ\ƒ\ƒ\` ADD `”\”\”\` char(1) AFTER `•\•\•\`;
@@ -129,14 +129,14 @@ NULL •\•\•\•\•\ NULL NULL
DESC `ƒ\ƒ\ƒ\`;
Field Type Null Key Default Extra
\\ char(1) YES MUL NULL
-•\•\•\ char(6) NO PRI
+•\•\•\ char(6) NO PRI NULL
”\”\”\ char(1) YES UNI NULL
—\—\—\ char(1) YES NULL
SHOW CREATE TABLE `ƒ\ƒ\ƒ\`;
Table Create Table
ƒ\ƒ\ƒ\ CREATE TABLE `ƒ\ƒ\ƒ\` (
`\\` char(1) DEFAULT NULL,
- `•\•\•\` char(6) NOT NULL DEFAULT '',
+ `•\•\•\` char(6) NOT NULL,
`”\”\”\` char(1) DEFAULT NULL,
`—\—\—\` char(1) DEFAULT NULL,
PRIMARY KEY (`•\•\•\`),
@@ -156,11 +156,11 @@ SELECT * FROM `ƒ\ƒ\ƒ\`;
•\•\•\•\•\
DESC `ƒ\ƒ\ƒ\`;
Field Type Null Key Default Extra
-•\•\•\ char(6) NO
+•\•\•\ char(6) NO NULL
SHOW CREATE TABLE `ƒ\ƒ\ƒ\`;
Table Create Table
ƒ\ƒ\ƒ\ CREATE TABLE `ƒ\ƒ\ƒ\` (
- `•\•\•\` char(6) NOT NULL DEFAULT ''
+ `•\•\•\` char(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=sjis
DROP TABLE `±±±`;
DROP TABLE `²²²`;
@@ -193,14 +193,14 @@ NULL ³³³³³ NULL NULL
DESC `±±±`;
Field Type Null Key Default Extra
¶¶ char(1) YES MUL NULL
-··· char(6) NO PRI
+··· char(6) NO PRI NULL
¸¸¸ char(1) YES UNI NULL
¹¹¹ char(1) YES NULL
SHOW CREATE TABLE `±±±`;
Table Create Table
±±± CREATE TABLE `±±±` (
`¶¶` char(1) DEFAULT NULL,
- `···` char(6) NOT NULL DEFAULT '',
+ `···` char(6) NOT NULL,
`¸¸¸` char(1) DEFAULT NULL,
`¹¹¹` char(1) DEFAULT NULL,
PRIMARY KEY (`···`),
@@ -220,11 +220,11 @@ SELECT * FROM `±±±`;
³³³³³
DESC `±±±`;
Field Type Null Key Default Extra
-··· char(6) NO
+··· char(6) NO NULL
SHOW CREATE TABLE `±±±`;
Table Create Table
±±± CREATE TABLE `±±±` (
- `···` char(6) NOT NULL DEFAULT ''
+ `···` char(6) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=sjis
ALTER TABLE `‚ ‚ ‚ ` ADD `‚©‚©‚©` char(1) FIRST;
ALTER TABLE `‚ ‚ ‚ ` ADD `‚­‚­‚­` char(1) AFTER `‚«‚«‚«`;
@@ -242,14 +242,14 @@ NULL ‚¤‚¤‚¤‚¤‚¤ NULL NULL
DESC `‚ ‚ ‚ `;
Field Type Null Key Default Extra
‚©‚© char(1) YES MUL NULL
-‚«‚«‚« char(6) NO PRI
+‚«‚«‚« char(6) NO PRI NULL
‚­‚­‚­ char(1) YES UNI NULL
‚¯‚¯‚¯ char(1) YES NULL
SHOW CREATE TABLE `‚ ‚ ‚ `;
Table Create Table
‚ ‚ ‚  CREATE TABLE `‚ ‚ ‚ ` (
`‚©‚©` char(1) DEFAULT NULL,
- `‚«‚«‚«` char(6) NOT NULL DEFAULT '',
+ `‚«‚«‚«` char(6) NOT NULL,
`‚­‚­‚­` char(1) DEFAULT NULL,
`‚¯‚¯‚¯` char(1) DEFAULT NULL,
PRIMARY KEY (`‚«‚«‚«`),
@@ -269,11 +269,11 @@ SELECT * FROM `‚ ‚ ‚ `;
‚¤‚¤‚¤‚¤‚¤
DESC `‚ ‚ ‚ `;
Field Type Null Key Default Extra
-‚«‚«‚« char(6) NO
+‚«‚«‚« char(6) NO NULL
SHOW CREATE TABLE `‚ ‚ ‚ `;
Table Create Table
‚ ‚ ‚  CREATE TABLE `‚ ‚ ‚ ` (
- `‚«‚«‚«` char(6) NOT NULL DEFAULT ''
+ `‚«‚«‚«` char(6) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=sjis
ALTER TABLE `ƒ\ƒ\ƒ\` ADD `\\\` char(1) FIRST;
ALTER TABLE `ƒ\ƒ\ƒ\` ADD `”\”\”\` char(1) AFTER `•\•\•\`;
@@ -291,14 +291,14 @@ NULL ”\”\”\”\”\ NULL NULL
DESC `ƒ\ƒ\ƒ\`;
Field Type Null Key Default Extra
\\ char(1) YES MUL NULL
-•\•\•\ char(6) NO PRI
+•\•\•\ char(6) NO PRI NULL
”\”\”\ char(1) YES UNI NULL
—\—\—\ char(1) YES NULL
SHOW CREATE TABLE `ƒ\ƒ\ƒ\`;
Table Create Table
ƒ\ƒ\ƒ\ CREATE TABLE `ƒ\ƒ\ƒ\` (
`\\` char(1) DEFAULT NULL,
- `•\•\•\` char(6) NOT NULL DEFAULT '',
+ `•\•\•\` char(6) NOT NULL,
`”\”\”\` char(1) DEFAULT NULL,
`—\—\—\` char(1) DEFAULT NULL,
PRIMARY KEY (`•\•\•\`),
@@ -318,11 +318,11 @@ SELECT * FROM `ƒ\ƒ\ƒ\`;
”\”\”\”\”\
DESC `ƒ\ƒ\ƒ\`;
Field Type Null Key Default Extra
-•\•\•\ char(6) NO
+•\•\•\ char(6) NO NULL
SHOW CREATE TABLE `ƒ\ƒ\ƒ\`;
Table Create Table
ƒ\ƒ\ƒ\ CREATE TABLE `ƒ\ƒ\ƒ\` (
- `•\•\•\` char(6) NOT NULL DEFAULT ''
+ `•\•\•\` char(6) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=sjis
DROP TABLE `±±±`;
DROP TABLE `²²²`;
@@ -355,14 +355,14 @@ NULL ³³³³³ NULL NULL
DESC `±±±`;
Field Type Null Key Default Extra
¶¶ char(1) YES MUL NULL
-··· char(6) NO PRI
+··· char(6) NO PRI NULL
¸¸¸ char(1) YES UNI NULL
¹¹¹ char(1) YES NULL
SHOW CREATE TABLE `±±±`;
Table Create Table
±±± CREATE TABLE `±±±` (
`¶¶` char(1) DEFAULT NULL,
- `···` char(6) NOT NULL DEFAULT '',
+ `···` char(6) NOT NULL,
`¸¸¸` char(1) DEFAULT NULL,
`¹¹¹` char(1) DEFAULT NULL,
PRIMARY KEY (`···`),
@@ -382,11 +382,11 @@ SELECT * FROM `±±±`;
³³³³³
DESC `±±±`;
Field Type Null Key Default Extra
-··· char(6) NO
+··· char(6) NO NULL
SHOW CREATE TABLE `±±±`;
Table Create Table
±±± CREATE TABLE `±±±` (
- `···` char(6) NOT NULL DEFAULT ''
+ `···` char(6) NOT NULL
) ENGINE=MEMORY DEFAULT CHARSET=sjis
ALTER TABLE `‚ ‚ ‚ ` ADD `‚©‚©‚©` char(1) FIRST;
ALTER TABLE `‚ ‚ ‚ ` ADD `‚­‚­‚­` char(1) AFTER `‚«‚«‚«`;
@@ -404,14 +404,14 @@ NULL ‚¤‚¤‚¤‚¤‚¤ NULL NULL
DESC `‚ ‚ ‚ `;
Field Type Null Key Default Extra
‚©‚© char(1) YES MUL NULL
-‚«‚«‚« char(6) NO PRI
+‚«‚«‚« char(6) NO PRI NULL
‚­‚­‚­ char(1) YES UNI NULL
‚¯‚¯‚¯ char(1) YES NULL
SHOW CREATE TABLE `‚ ‚ ‚ `;
Table Create Table
‚ ‚ ‚  CREATE TABLE `‚ ‚ ‚ ` (
`‚©‚©` char(1) DEFAULT NULL,
- `‚«‚«‚«` char(6) NOT NULL DEFAULT '',
+ `‚«‚«‚«` char(6) NOT NULL,
`‚­‚­‚­` char(1) DEFAULT NULL,
`‚¯‚¯‚¯` char(1) DEFAULT NULL,
PRIMARY KEY (`‚«‚«‚«`),
@@ -431,11 +431,11 @@ SELECT * FROM `‚ ‚ ‚ `;
‚¤‚¤‚¤‚¤‚¤
DESC `‚ ‚ ‚ `;
Field Type Null Key Default Extra
-‚«‚«‚« char(6) NO
+‚«‚«‚« char(6) NO NULL
SHOW CREATE TABLE `‚ ‚ ‚ `;
Table Create Table
‚ ‚ ‚  CREATE TABLE `‚ ‚ ‚ ` (
- `‚«‚«‚«` char(6) NOT NULL DEFAULT ''
+ `‚«‚«‚«` char(6) NOT NULL
) ENGINE=MEMORY DEFAULT CHARSET=sjis
ALTER TABLE `ƒ\ƒ\ƒ\` ADD `\\\` char(1) FIRST;
ALTER TABLE `ƒ\ƒ\ƒ\` ADD `”\”\”\` char(1) AFTER `•\•\•\`;
@@ -453,14 +453,14 @@ NULL ”\”\”\”\”\ NULL NULL
DESC `ƒ\ƒ\ƒ\`;
Field Type Null Key Default Extra
\\ char(1) YES MUL NULL
-•\•\•\ char(6) NO PRI
+•\•\•\ char(6) NO PRI NULL
”\”\”\ char(1) YES UNI NULL
—\—\—\ char(1) YES NULL
SHOW CREATE TABLE `ƒ\ƒ\ƒ\`;
Table Create Table
ƒ\ƒ\ƒ\ CREATE TABLE `ƒ\ƒ\ƒ\` (
`\\` char(1) DEFAULT NULL,
- `•\•\•\` char(6) NOT NULL DEFAULT '',
+ `•\•\•\` char(6) NOT NULL,
`”\”\”\` char(1) DEFAULT NULL,
`—\—\—\` char(1) DEFAULT NULL,
PRIMARY KEY (`•\•\•\`),
@@ -480,11 +480,11 @@ SELECT * FROM `ƒ\ƒ\ƒ\`;
”\”\”\”\”\
DESC `ƒ\ƒ\ƒ\`;
Field Type Null Key Default Extra
-•\•\•\ char(6) NO
+•\•\•\ char(6) NO NULL
SHOW CREATE TABLE `ƒ\ƒ\ƒ\`;
Table Create Table
ƒ\ƒ\ƒ\ CREATE TABLE `ƒ\ƒ\ƒ\` (
- `•\•\•\` char(6) NOT NULL DEFAULT ''
+ `•\•\•\` char(6) NOT NULL
) ENGINE=MEMORY DEFAULT CHARSET=sjis
DROP TABLE `±±±`;
DROP TABLE `²²²`;
diff --git a/mysql-test/suite/jp/r/jp_alter_ucs2.result b/mysql-test/suite/jp/r/jp_alter_ucs2.result
index 7cbd8859ac1..204913250cc 100644
--- a/mysql-test/suite/jp/r/jp_alter_ucs2.result
+++ b/mysql-test/suite/jp/r/jp_alter_ucs2.result
@@ -32,14 +32,14 @@ NULL Ž³Ž³Ž³Ž³Ž³ NULL NULL
DESC `Ž±Ž±Ž±`;
Field Type Null Key Default Extra
Ž¶Ž¶ char(1) YES MUL NULL
-Ž·Ž·Ž· char(6) NO PRI
+Ž·Ž·Ž· char(6) NO PRI NULL
Ž¸Ž¸Ž¸ char(1) YES UNI NULL
Ž¹Ž¹Ž¹ char(1) YES NULL
SHOW CREATE TABLE `Ž±Ž±Ž±`;
Table Create Table
Ž±Ž±Ž± CREATE TABLE `Ž±Ž±Ž±` (
`Ž¶Ž¶` char(1) DEFAULT NULL,
- `Ž·Ž·Ž·` char(6) NOT NULL DEFAULT '',
+ `Ž·Ž·Ž·` char(6) NOT NULL,
`Ž¸Ž¸Ž¸` char(1) DEFAULT NULL,
`Ž¹Ž¹Ž¹` char(1) DEFAULT NULL,
PRIMARY KEY (`Ž·Ž·Ž·`),
@@ -59,11 +59,11 @@ SELECT * FROM `Ž±Ž±Ž±`;
Ž³Ž³Ž³Ž³Ž³
DESC `Ž±Ž±Ž±`;
Field Type Null Key Default Extra
-Ž·Ž·Ž· char(6) NO
+Ž·Ž·Ž· char(6) NO NULL
SHOW CREATE TABLE `Ž±Ž±Ž±`;
Table Create Table
Ž±Ž±Ž± CREATE TABLE `Ž±Ž±Ž±` (
- `Ž·Ž·Ž·` char(6) NOT NULL DEFAULT ''
+ `Ž·Ž·Ž·` char(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=ucs2
ALTER TABLE `¤¢¤¢¤¢` ADD `¤«¤«¤«` char(1) FIRST;
ALTER TABLE `¤¢¤¢¤¢` ADD `¤¯¤¯¤¯` char(1) AFTER `¤­¤­¤­`;
@@ -81,14 +81,14 @@ NULL ¤¦¤¦¤¦¤¦¤¦ NULL NULL
DESC `¤¢¤¢¤¢`;
Field Type Null Key Default Extra
¤«¤« char(1) YES MUL NULL
-¤­¤­¤­ char(6) NO PRI
+¤­¤­¤­ char(6) NO PRI NULL
¤¯¤¯¤¯ char(1) YES UNI NULL
¤±¤±¤± char(1) YES NULL
SHOW CREATE TABLE `¤¢¤¢¤¢`;
Table Create Table
¤¢¤¢¤¢ CREATE TABLE `¤¢¤¢¤¢` (
`¤«¤«` char(1) DEFAULT NULL,
- `¤­¤­¤­` char(6) NOT NULL DEFAULT '',
+ `¤­¤­¤­` char(6) NOT NULL,
`¤¯¤¯¤¯` char(1) DEFAULT NULL,
`¤±¤±¤±` char(1) DEFAULT NULL,
PRIMARY KEY (`¤­¤­¤­`),
@@ -108,11 +108,11 @@ SELECT * FROM `¤¢¤¢¤¢`;
¤¦¤¦¤¦¤¦¤¦
DESC `¤¢¤¢¤¢`;
Field Type Null Key Default Extra
-¤­¤­¤­ char(6) NO
+¤­¤­¤­ char(6) NO NULL
SHOW CREATE TABLE `¤¢¤¢¤¢`;
Table Create Table
¤¢¤¢¤¢ CREATE TABLE `¤¢¤¢¤¢` (
- `¤­¤­¤­` char(6) NOT NULL DEFAULT ''
+ `¤­¤­¤­` char(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=ucs2
ALTER TABLE `íÝíÝíÝ` ADD `°¢°¢°¢` char(1) FIRST;
ALTER TABLE `íÝíÝíÝ` ADD `°£°£°£` char(1) AFTER `°¡°¡°¡`;
@@ -130,14 +130,14 @@ NULL °£°£°£°£°£ NULL NULL
DESC `íÝíÝíÝ`;
Field Type Null Key Default Extra
°¢°¢ char(1) YES MUL NULL
-°¡°¡°¡ char(6) NO PRI
+°¡°¡°¡ char(6) NO PRI NULL
°£°£°£ char(1) YES UNI NULL
°´°´°´ char(1) YES NULL
SHOW CREATE TABLE `íÝíÝíÝ`;
Table Create Table
íÝíÝíÝ CREATE TABLE `íÝíÝíÝ` (
`°¢°¢` char(1) DEFAULT NULL,
- `°¡°¡°¡` char(6) NOT NULL DEFAULT '',
+ `°¡°¡°¡` char(6) NOT NULL,
`°£°£°£` char(1) DEFAULT NULL,
`°´°´°´` char(1) DEFAULT NULL,
PRIMARY KEY (`°¡°¡°¡`),
@@ -157,11 +157,11 @@ SELECT * FROM `íÝíÝíÝ`;
°£°£°£°£°£
DESC `íÝíÝíÝ`;
Field Type Null Key Default Extra
-°¡°¡°¡ char(6) NO
+°¡°¡°¡ char(6) NO NULL
SHOW CREATE TABLE `íÝíÝíÝ`;
Table Create Table
íÝíÝíÝ CREATE TABLE `íÝíÝíÝ` (
- `°¡°¡°¡` char(6) NOT NULL DEFAULT ''
+ `°¡°¡°¡` char(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=ucs2
DROP TABLE `Ž±Ž±Ž±`;
DROP TABLE `Ž²Ž²Ž²`;
@@ -194,14 +194,14 @@ NULL Ž³Ž³Ž³Ž³Ž³ NULL NULL
DESC `Ž±Ž±Ž±`;
Field Type Null Key Default Extra
Ž¶Ž¶ char(1) YES MUL NULL
-Ž·Ž·Ž· char(6) NO PRI
+Ž·Ž·Ž· char(6) NO PRI NULL
Ž¸Ž¸Ž¸ char(1) YES UNI NULL
Ž¹Ž¹Ž¹ char(1) YES NULL
SHOW CREATE TABLE `Ž±Ž±Ž±`;
Table Create Table
Ž±Ž±Ž± CREATE TABLE `Ž±Ž±Ž±` (
`Ž¶Ž¶` char(1) DEFAULT NULL,
- `Ž·Ž·Ž·` char(6) NOT NULL DEFAULT '',
+ `Ž·Ž·Ž·` char(6) NOT NULL,
`Ž¸Ž¸Ž¸` char(1) DEFAULT NULL,
`Ž¹Ž¹Ž¹` char(1) DEFAULT NULL,
PRIMARY KEY (`Ž·Ž·Ž·`),
@@ -221,11 +221,11 @@ SELECT * FROM `Ž±Ž±Ž±`;
Ž³Ž³Ž³Ž³Ž³
DESC `Ž±Ž±Ž±`;
Field Type Null Key Default Extra
-Ž·Ž·Ž· char(6) NO
+Ž·Ž·Ž· char(6) NO NULL
SHOW CREATE TABLE `Ž±Ž±Ž±`;
Table Create Table
Ž±Ž±Ž± CREATE TABLE `Ž±Ž±Ž±` (
- `Ž·Ž·Ž·` char(6) NOT NULL DEFAULT ''
+ `Ž·Ž·Ž·` char(6) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=ucs2
ALTER TABLE `¤¢¤¢¤¢` ADD `¤«¤«¤«` char(1) FIRST;
ALTER TABLE `¤¢¤¢¤¢` ADD `¤¯¤¯¤¯` char(1) AFTER `¤­¤­¤­`;
@@ -243,14 +243,14 @@ NULL ¤¦¤¦¤¦¤¦¤¦ NULL NULL
DESC `¤¢¤¢¤¢`;
Field Type Null Key Default Extra
¤«¤« char(1) YES MUL NULL
-¤­¤­¤­ char(6) NO PRI
+¤­¤­¤­ char(6) NO PRI NULL
¤¯¤¯¤¯ char(1) YES UNI NULL
¤±¤±¤± char(1) YES NULL
SHOW CREATE TABLE `¤¢¤¢¤¢`;
Table Create Table
¤¢¤¢¤¢ CREATE TABLE `¤¢¤¢¤¢` (
`¤«¤«` char(1) DEFAULT NULL,
- `¤­¤­¤­` char(6) NOT NULL DEFAULT '',
+ `¤­¤­¤­` char(6) NOT NULL,
`¤¯¤¯¤¯` char(1) DEFAULT NULL,
`¤±¤±¤±` char(1) DEFAULT NULL,
PRIMARY KEY (`¤­¤­¤­`),
@@ -270,11 +270,11 @@ SELECT * FROM `¤¢¤¢¤¢`;
¤¦¤¦¤¦¤¦¤¦
DESC `¤¢¤¢¤¢`;
Field Type Null Key Default Extra
-¤­¤­¤­ char(6) NO
+¤­¤­¤­ char(6) NO NULL
SHOW CREATE TABLE `¤¢¤¢¤¢`;
Table Create Table
¤¢¤¢¤¢ CREATE TABLE `¤¢¤¢¤¢` (
- `¤­¤­¤­` char(6) NOT NULL DEFAULT ''
+ `¤­¤­¤­` char(6) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=ucs2
ALTER TABLE `íÝíÝíÝ` ADD `°¢°¢°¢` char(1) FIRST;
ALTER TABLE `íÝíÝíÝ` ADD `°£°£°£` char(1) AFTER `°¡°¡°¡`;
@@ -292,14 +292,14 @@ NULL °£°£°£°£°£ NULL NULL
DESC `íÝíÝíÝ`;
Field Type Null Key Default Extra
°¢°¢ char(1) YES MUL NULL
-°¡°¡°¡ char(6) NO PRI
+°¡°¡°¡ char(6) NO PRI NULL
°£°£°£ char(1) YES UNI NULL
°´°´°´ char(1) YES NULL
SHOW CREATE TABLE `íÝíÝíÝ`;
Table Create Table
íÝíÝíÝ CREATE TABLE `íÝíÝíÝ` (
`°¢°¢` char(1) DEFAULT NULL,
- `°¡°¡°¡` char(6) NOT NULL DEFAULT '',
+ `°¡°¡°¡` char(6) NOT NULL,
`°£°£°£` char(1) DEFAULT NULL,
`°´°´°´` char(1) DEFAULT NULL,
PRIMARY KEY (`°¡°¡°¡`),
@@ -319,11 +319,11 @@ SELECT * FROM `íÝíÝíÝ`;
°£°£°£°£°£
DESC `íÝíÝíÝ`;
Field Type Null Key Default Extra
-°¡°¡°¡ char(6) NO
+°¡°¡°¡ char(6) NO NULL
SHOW CREATE TABLE `íÝíÝíÝ`;
Table Create Table
íÝíÝíÝ CREATE TABLE `íÝíÝíÝ` (
- `°¡°¡°¡` char(6) NOT NULL DEFAULT ''
+ `°¡°¡°¡` char(6) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=ucs2
DROP TABLE `Ž±Ž±Ž±`;
DROP TABLE `Ž²Ž²Ž²`;
@@ -356,14 +356,14 @@ NULL Ž³Ž³Ž³Ž³Ž³ NULL NULL
DESC `Ž±Ž±Ž±`;
Field Type Null Key Default Extra
Ž¶Ž¶ char(1) YES MUL NULL
-Ž·Ž·Ž· char(6) NO PRI
+Ž·Ž·Ž· char(6) NO PRI NULL
Ž¸Ž¸Ž¸ char(1) YES UNI NULL
Ž¹Ž¹Ž¹ char(1) YES NULL
SHOW CREATE TABLE `Ž±Ž±Ž±`;
Table Create Table
Ž±Ž±Ž± CREATE TABLE `Ž±Ž±Ž±` (
`Ž¶Ž¶` char(1) DEFAULT NULL,
- `Ž·Ž·Ž·` char(6) NOT NULL DEFAULT '',
+ `Ž·Ž·Ž·` char(6) NOT NULL,
`Ž¸Ž¸Ž¸` char(1) DEFAULT NULL,
`Ž¹Ž¹Ž¹` char(1) DEFAULT NULL,
PRIMARY KEY (`Ž·Ž·Ž·`),
@@ -383,11 +383,11 @@ SELECT * FROM `Ž±Ž±Ž±`;
Ž³Ž³Ž³Ž³Ž³
DESC `Ž±Ž±Ž±`;
Field Type Null Key Default Extra
-Ž·Ž·Ž· char(6) NO
+Ž·Ž·Ž· char(6) NO NULL
SHOW CREATE TABLE `Ž±Ž±Ž±`;
Table Create Table
Ž±Ž±Ž± CREATE TABLE `Ž±Ž±Ž±` (
- `Ž·Ž·Ž·` char(6) NOT NULL DEFAULT ''
+ `Ž·Ž·Ž·` char(6) NOT NULL
) ENGINE=MEMORY DEFAULT CHARSET=ucs2
ALTER TABLE `¤¢¤¢¤¢` ADD `¤«¤«¤«` char(1) FIRST;
ALTER TABLE `¤¢¤¢¤¢` ADD `¤¯¤¯¤¯` char(1) AFTER `¤­¤­¤­`;
@@ -405,14 +405,14 @@ NULL ¤¦¤¦¤¦¤¦¤¦ NULL NULL
DESC `¤¢¤¢¤¢`;
Field Type Null Key Default Extra
¤«¤« char(1) YES MUL NULL
-¤­¤­¤­ char(6) NO PRI
+¤­¤­¤­ char(6) NO PRI NULL
¤¯¤¯¤¯ char(1) YES UNI NULL
¤±¤±¤± char(1) YES NULL
SHOW CREATE TABLE `¤¢¤¢¤¢`;
Table Create Table
¤¢¤¢¤¢ CREATE TABLE `¤¢¤¢¤¢` (
`¤«¤«` char(1) DEFAULT NULL,
- `¤­¤­¤­` char(6) NOT NULL DEFAULT '',
+ `¤­¤­¤­` char(6) NOT NULL,
`¤¯¤¯¤¯` char(1) DEFAULT NULL,
`¤±¤±¤±` char(1) DEFAULT NULL,
PRIMARY KEY (`¤­¤­¤­`),
@@ -432,11 +432,11 @@ SELECT * FROM `¤¢¤¢¤¢`;
¤¦¤¦¤¦¤¦¤¦
DESC `¤¢¤¢¤¢`;
Field Type Null Key Default Extra
-¤­¤­¤­ char(6) NO
+¤­¤­¤­ char(6) NO NULL
SHOW CREATE TABLE `¤¢¤¢¤¢`;
Table Create Table
¤¢¤¢¤¢ CREATE TABLE `¤¢¤¢¤¢` (
- `¤­¤­¤­` char(6) NOT NULL DEFAULT ''
+ `¤­¤­¤­` char(6) NOT NULL
) ENGINE=MEMORY DEFAULT CHARSET=ucs2
ALTER TABLE `íÝíÝíÝ` ADD `°¢°¢°¢` char(1) FIRST;
ALTER TABLE `íÝíÝíÝ` ADD `°£°£°£` char(1) AFTER `°¡°¡°¡`;
@@ -454,14 +454,14 @@ NULL °£°£°£°£°£ NULL NULL
DESC `íÝíÝíÝ`;
Field Type Null Key Default Extra
°¢°¢ char(1) YES MUL NULL
-°¡°¡°¡ char(6) NO PRI
+°¡°¡°¡ char(6) NO PRI NULL
°£°£°£ char(1) YES UNI NULL
°´°´°´ char(1) YES NULL
SHOW CREATE TABLE `íÝíÝíÝ`;
Table Create Table
íÝíÝíÝ CREATE TABLE `íÝíÝíÝ` (
`°¢°¢` char(1) DEFAULT NULL,
- `°¡°¡°¡` char(6) NOT NULL DEFAULT '',
+ `°¡°¡°¡` char(6) NOT NULL,
`°£°£°£` char(1) DEFAULT NULL,
`°´°´°´` char(1) DEFAULT NULL,
PRIMARY KEY (`°¡°¡°¡`),
@@ -481,11 +481,11 @@ SELECT * FROM `íÝíÝíÝ`;
°£°£°£°£°£
DESC `íÝíÝíÝ`;
Field Type Null Key Default Extra
-°¡°¡°¡ char(6) NO
+°¡°¡°¡ char(6) NO NULL
SHOW CREATE TABLE `íÝíÝíÝ`;
Table Create Table
íÝíÝíÝ CREATE TABLE `íÝíÝíÝ` (
- `°¡°¡°¡` char(6) NOT NULL DEFAULT ''
+ `°¡°¡°¡` char(6) NOT NULL
) ENGINE=MEMORY DEFAULT CHARSET=ucs2
DROP TABLE `Ž±Ž±Ž±`;
DROP TABLE `Ž²Ž²Ž²`;
diff --git a/mysql-test/suite/jp/r/jp_alter_ujis.result b/mysql-test/suite/jp/r/jp_alter_ujis.result
index 7e4f19342f6..a46da01e1cd 100644
--- a/mysql-test/suite/jp/r/jp_alter_ujis.result
+++ b/mysql-test/suite/jp/r/jp_alter_ujis.result
@@ -31,14 +31,14 @@ NULL Ž³Ž³Ž³Ž³Ž³ NULL NULL
DESC `Ž±Ž±Ž±`;
Field Type Null Key Default Extra
Ž¶Ž¶ char(1) YES MUL NULL
-Ž·Ž·Ž· char(6) NO PRI
+Ž·Ž·Ž· char(6) NO PRI NULL
Ž¸Ž¸Ž¸ char(1) YES UNI NULL
Ž¹Ž¹Ž¹ char(1) YES NULL
SHOW CREATE TABLE `Ž±Ž±Ž±`;
Table Create Table
Ž±Ž±Ž± CREATE TABLE `Ž±Ž±Ž±` (
`Ž¶Ž¶` char(1) DEFAULT NULL,
- `Ž·Ž·Ž·` char(6) NOT NULL DEFAULT '',
+ `Ž·Ž·Ž·` char(6) NOT NULL,
`Ž¸Ž¸Ž¸` char(1) DEFAULT NULL,
`Ž¹Ž¹Ž¹` char(1) DEFAULT NULL,
PRIMARY KEY (`Ž·Ž·Ž·`),
@@ -58,11 +58,11 @@ SELECT * FROM `Ž±Ž±Ž±`;
Ž³Ž³Ž³Ž³Ž³
DESC `Ž±Ž±Ž±`;
Field Type Null Key Default Extra
-Ž·Ž·Ž· char(6) NO
+Ž·Ž·Ž· char(6) NO NULL
SHOW CREATE TABLE `Ž±Ž±Ž±`;
Table Create Table
Ž±Ž±Ž± CREATE TABLE `Ž±Ž±Ž±` (
- `Ž·Ž·Ž·` char(6) NOT NULL DEFAULT ''
+ `Ž·Ž·Ž·` char(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=ujis
ALTER TABLE `¤¢¤¢¤¢` ADD `¤«¤«¤«` char(1) FIRST;
ALTER TABLE `¤¢¤¢¤¢` ADD `¤¯¤¯¤¯` char(1) AFTER `¤­¤­¤­`;
@@ -80,14 +80,14 @@ NULL ¤¦¤¦¤¦¤¦¤¦ NULL NULL
DESC `¤¢¤¢¤¢`;
Field Type Null Key Default Extra
¤«¤« char(1) YES MUL NULL
-¤­¤­¤­ char(6) NO PRI
+¤­¤­¤­ char(6) NO PRI NULL
¤¯¤¯¤¯ char(1) YES UNI NULL
¤±¤±¤± char(1) YES NULL
SHOW CREATE TABLE `¤¢¤¢¤¢`;
Table Create Table
¤¢¤¢¤¢ CREATE TABLE `¤¢¤¢¤¢` (
`¤«¤«` char(1) DEFAULT NULL,
- `¤­¤­¤­` char(6) NOT NULL DEFAULT '',
+ `¤­¤­¤­` char(6) NOT NULL,
`¤¯¤¯¤¯` char(1) DEFAULT NULL,
`¤±¤±¤±` char(1) DEFAULT NULL,
PRIMARY KEY (`¤­¤­¤­`),
@@ -107,11 +107,11 @@ SELECT * FROM `¤¢¤¢¤¢`;
¤¦¤¦¤¦¤¦¤¦
DESC `¤¢¤¢¤¢`;
Field Type Null Key Default Extra
-¤­¤­¤­ char(6) NO
+¤­¤­¤­ char(6) NO NULL
SHOW CREATE TABLE `¤¢¤¢¤¢`;
Table Create Table
¤¢¤¢¤¢ CREATE TABLE `¤¢¤¢¤¢` (
- `¤­¤­¤­` char(6) NOT NULL DEFAULT ''
+ `¤­¤­¤­` char(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=ujis
ALTER TABLE `íÝíÝíÝ` ADD `°¢°¢°¢` char(1) FIRST;
ALTER TABLE `íÝíÝíÝ` ADD `°£°£°£` char(1) AFTER `°¡°¡°¡`;
@@ -129,14 +129,14 @@ NULL °£°£°£°£°£ NULL NULL
DESC `íÝíÝíÝ`;
Field Type Null Key Default Extra
°¢°¢ char(1) YES MUL NULL
-°¡°¡°¡ char(6) NO PRI
+°¡°¡°¡ char(6) NO PRI NULL
°£°£°£ char(1) YES UNI NULL
°´°´°´ char(1) YES NULL
SHOW CREATE TABLE `íÝíÝíÝ`;
Table Create Table
íÝíÝíÝ CREATE TABLE `íÝíÝíÝ` (
`°¢°¢` char(1) DEFAULT NULL,
- `°¡°¡°¡` char(6) NOT NULL DEFAULT '',
+ `°¡°¡°¡` char(6) NOT NULL,
`°£°£°£` char(1) DEFAULT NULL,
`°´°´°´` char(1) DEFAULT NULL,
PRIMARY KEY (`°¡°¡°¡`),
@@ -156,11 +156,11 @@ SELECT * FROM `íÝíÝíÝ`;
°£°£°£°£°£
DESC `íÝíÝíÝ`;
Field Type Null Key Default Extra
-°¡°¡°¡ char(6) NO
+°¡°¡°¡ char(6) NO NULL
SHOW CREATE TABLE `íÝíÝíÝ`;
Table Create Table
íÝíÝíÝ CREATE TABLE `íÝíÝíÝ` (
- `°¡°¡°¡` char(6) NOT NULL DEFAULT ''
+ `°¡°¡°¡` char(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=ujis
DROP TABLE `Ž±Ž±Ž±`;
DROP TABLE `Ž²Ž²Ž²`;
@@ -193,14 +193,14 @@ NULL Ž³Ž³Ž³Ž³Ž³ NULL NULL
DESC `Ž±Ž±Ž±`;
Field Type Null Key Default Extra
Ž¶Ž¶ char(1) YES MUL NULL
-Ž·Ž·Ž· char(6) NO PRI
+Ž·Ž·Ž· char(6) NO PRI NULL
Ž¸Ž¸Ž¸ char(1) YES UNI NULL
Ž¹Ž¹Ž¹ char(1) YES NULL
SHOW CREATE TABLE `Ž±Ž±Ž±`;
Table Create Table
Ž±Ž±Ž± CREATE TABLE `Ž±Ž±Ž±` (
`Ž¶Ž¶` char(1) DEFAULT NULL,
- `Ž·Ž·Ž·` char(6) NOT NULL DEFAULT '',
+ `Ž·Ž·Ž·` char(6) NOT NULL,
`Ž¸Ž¸Ž¸` char(1) DEFAULT NULL,
`Ž¹Ž¹Ž¹` char(1) DEFAULT NULL,
PRIMARY KEY (`Ž·Ž·Ž·`),
@@ -220,11 +220,11 @@ SELECT * FROM `Ž±Ž±Ž±`;
Ž³Ž³Ž³Ž³Ž³
DESC `Ž±Ž±Ž±`;
Field Type Null Key Default Extra
-Ž·Ž·Ž· char(6) NO
+Ž·Ž·Ž· char(6) NO NULL
SHOW CREATE TABLE `Ž±Ž±Ž±`;
Table Create Table
Ž±Ž±Ž± CREATE TABLE `Ž±Ž±Ž±` (
- `Ž·Ž·Ž·` char(6) NOT NULL DEFAULT ''
+ `Ž·Ž·Ž·` char(6) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=ujis
ALTER TABLE `¤¢¤¢¤¢` ADD `¤«¤«¤«` char(1) FIRST;
ALTER TABLE `¤¢¤¢¤¢` ADD `¤¯¤¯¤¯` char(1) AFTER `¤­¤­¤­`;
@@ -242,14 +242,14 @@ NULL ¤¦¤¦¤¦¤¦¤¦ NULL NULL
DESC `¤¢¤¢¤¢`;
Field Type Null Key Default Extra
¤«¤« char(1) YES MUL NULL
-¤­¤­¤­ char(6) NO PRI
+¤­¤­¤­ char(6) NO PRI NULL
¤¯¤¯¤¯ char(1) YES UNI NULL
¤±¤±¤± char(1) YES NULL
SHOW CREATE TABLE `¤¢¤¢¤¢`;
Table Create Table
¤¢¤¢¤¢ CREATE TABLE `¤¢¤¢¤¢` (
`¤«¤«` char(1) DEFAULT NULL,
- `¤­¤­¤­` char(6) NOT NULL DEFAULT '',
+ `¤­¤­¤­` char(6) NOT NULL,
`¤¯¤¯¤¯` char(1) DEFAULT NULL,
`¤±¤±¤±` char(1) DEFAULT NULL,
PRIMARY KEY (`¤­¤­¤­`),
@@ -269,11 +269,11 @@ SELECT * FROM `¤¢¤¢¤¢`;
¤¦¤¦¤¦¤¦¤¦
DESC `¤¢¤¢¤¢`;
Field Type Null Key Default Extra
-¤­¤­¤­ char(6) NO
+¤­¤­¤­ char(6) NO NULL
SHOW CREATE TABLE `¤¢¤¢¤¢`;
Table Create Table
¤¢¤¢¤¢ CREATE TABLE `¤¢¤¢¤¢` (
- `¤­¤­¤­` char(6) NOT NULL DEFAULT ''
+ `¤­¤­¤­` char(6) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=ujis
ALTER TABLE `íÝíÝíÝ` ADD `°¢°¢°¢` char(1) FIRST;
ALTER TABLE `íÝíÝíÝ` ADD `°£°£°£` char(1) AFTER `°¡°¡°¡`;
@@ -291,14 +291,14 @@ NULL °£°£°£°£°£ NULL NULL
DESC `íÝíÝíÝ`;
Field Type Null Key Default Extra
°¢°¢ char(1) YES MUL NULL
-°¡°¡°¡ char(6) NO PRI
+°¡°¡°¡ char(6) NO PRI NULL
°£°£°£ char(1) YES UNI NULL
°´°´°´ char(1) YES NULL
SHOW CREATE TABLE `íÝíÝíÝ`;
Table Create Table
íÝíÝíÝ CREATE TABLE `íÝíÝíÝ` (
`°¢°¢` char(1) DEFAULT NULL,
- `°¡°¡°¡` char(6) NOT NULL DEFAULT '',
+ `°¡°¡°¡` char(6) NOT NULL,
`°£°£°£` char(1) DEFAULT NULL,
`°´°´°´` char(1) DEFAULT NULL,
PRIMARY KEY (`°¡°¡°¡`),
@@ -318,11 +318,11 @@ SELECT * FROM `íÝíÝíÝ`;
°£°£°£°£°£
DESC `íÝíÝíÝ`;
Field Type Null Key Default Extra
-°¡°¡°¡ char(6) NO
+°¡°¡°¡ char(6) NO NULL
SHOW CREATE TABLE `íÝíÝíÝ`;
Table Create Table
íÝíÝíÝ CREATE TABLE `íÝíÝíÝ` (
- `°¡°¡°¡` char(6) NOT NULL DEFAULT ''
+ `°¡°¡°¡` char(6) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=ujis
DROP TABLE `Ž±Ž±Ž±`;
DROP TABLE `Ž²Ž²Ž²`;
@@ -355,14 +355,14 @@ NULL Ž³Ž³Ž³Ž³Ž³ NULL NULL
DESC `Ž±Ž±Ž±`;
Field Type Null Key Default Extra
Ž¶Ž¶ char(1) YES MUL NULL
-Ž·Ž·Ž· char(6) NO PRI
+Ž·Ž·Ž· char(6) NO PRI NULL
Ž¸Ž¸Ž¸ char(1) YES UNI NULL
Ž¹Ž¹Ž¹ char(1) YES NULL
SHOW CREATE TABLE `Ž±Ž±Ž±`;
Table Create Table
Ž±Ž±Ž± CREATE TABLE `Ž±Ž±Ž±` (
`Ž¶Ž¶` char(1) DEFAULT NULL,
- `Ž·Ž·Ž·` char(6) NOT NULL DEFAULT '',
+ `Ž·Ž·Ž·` char(6) NOT NULL,
`Ž¸Ž¸Ž¸` char(1) DEFAULT NULL,
`Ž¹Ž¹Ž¹` char(1) DEFAULT NULL,
PRIMARY KEY (`Ž·Ž·Ž·`),
@@ -382,11 +382,11 @@ SELECT * FROM `Ž±Ž±Ž±`;
Ž³Ž³Ž³Ž³Ž³
DESC `Ž±Ž±Ž±`;
Field Type Null Key Default Extra
-Ž·Ž·Ž· char(6) NO
+Ž·Ž·Ž· char(6) NO NULL
SHOW CREATE TABLE `Ž±Ž±Ž±`;
Table Create Table
Ž±Ž±Ž± CREATE TABLE `Ž±Ž±Ž±` (
- `Ž·Ž·Ž·` char(6) NOT NULL DEFAULT ''
+ `Ž·Ž·Ž·` char(6) NOT NULL
) ENGINE=MEMORY DEFAULT CHARSET=ujis
ALTER TABLE `¤¢¤¢¤¢` ADD `¤«¤«¤«` char(1) FIRST;
ALTER TABLE `¤¢¤¢¤¢` ADD `¤¯¤¯¤¯` char(1) AFTER `¤­¤­¤­`;
@@ -404,14 +404,14 @@ NULL ¤¦¤¦¤¦¤¦¤¦ NULL NULL
DESC `¤¢¤¢¤¢`;
Field Type Null Key Default Extra
¤«¤« char(1) YES MUL NULL
-¤­¤­¤­ char(6) NO PRI
+¤­¤­¤­ char(6) NO PRI NULL
¤¯¤¯¤¯ char(1) YES UNI NULL
¤±¤±¤± char(1) YES NULL
SHOW CREATE TABLE `¤¢¤¢¤¢`;
Table Create Table
¤¢¤¢¤¢ CREATE TABLE `¤¢¤¢¤¢` (
`¤«¤«` char(1) DEFAULT NULL,
- `¤­¤­¤­` char(6) NOT NULL DEFAULT '',
+ `¤­¤­¤­` char(6) NOT NULL,
`¤¯¤¯¤¯` char(1) DEFAULT NULL,
`¤±¤±¤±` char(1) DEFAULT NULL,
PRIMARY KEY (`¤­¤­¤­`),
@@ -431,11 +431,11 @@ SELECT * FROM `¤¢¤¢¤¢`;
¤¦¤¦¤¦¤¦¤¦
DESC `¤¢¤¢¤¢`;
Field Type Null Key Default Extra
-¤­¤­¤­ char(6) NO
+¤­¤­¤­ char(6) NO NULL
SHOW CREATE TABLE `¤¢¤¢¤¢`;
Table Create Table
¤¢¤¢¤¢ CREATE TABLE `¤¢¤¢¤¢` (
- `¤­¤­¤­` char(6) NOT NULL DEFAULT ''
+ `¤­¤­¤­` char(6) NOT NULL
) ENGINE=MEMORY DEFAULT CHARSET=ujis
ALTER TABLE `íÝíÝíÝ` ADD `°¢°¢°¢` char(1) FIRST;
ALTER TABLE `íÝíÝíÝ` ADD `°£°£°£` char(1) AFTER `°¡°¡°¡`;
@@ -453,14 +453,14 @@ NULL °£°£°£°£°£ NULL NULL
DESC `íÝíÝíÝ`;
Field Type Null Key Default Extra
°¢°¢ char(1) YES MUL NULL
-°¡°¡°¡ char(6) NO PRI
+°¡°¡°¡ char(6) NO PRI NULL
°£°£°£ char(1) YES UNI NULL
°´°´°´ char(1) YES NULL
SHOW CREATE TABLE `íÝíÝíÝ`;
Table Create Table
íÝíÝíÝ CREATE TABLE `íÝíÝíÝ` (
`°¢°¢` char(1) DEFAULT NULL,
- `°¡°¡°¡` char(6) NOT NULL DEFAULT '',
+ `°¡°¡°¡` char(6) NOT NULL,
`°£°£°£` char(1) DEFAULT NULL,
`°´°´°´` char(1) DEFAULT NULL,
PRIMARY KEY (`°¡°¡°¡`),
@@ -480,11 +480,11 @@ SELECT * FROM `íÝíÝíÝ`;
°£°£°£°£°£
DESC `íÝíÝíÝ`;
Field Type Null Key Default Extra
-°¡°¡°¡ char(6) NO
+°¡°¡°¡ char(6) NO NULL
SHOW CREATE TABLE `íÝíÝíÝ`;
Table Create Table
íÝíÝíÝ CREATE TABLE `íÝíÝíÝ` (
- `°¡°¡°¡` char(6) NOT NULL DEFAULT ''
+ `°¡°¡°¡` char(6) NOT NULL
) ENGINE=MEMORY DEFAULT CHARSET=ujis
DROP TABLE `Ž±Ž±Ž±`;
DROP TABLE `Ž²Ž²Ž²`;
diff --git a/mysql-test/suite/jp/r/jp_alter_utf8.result b/mysql-test/suite/jp/r/jp_alter_utf8.result
index b641e9de78d..847a5e628f5 100644
--- a/mysql-test/suite/jp/r/jp_alter_utf8.result
+++ b/mysql-test/suite/jp/r/jp_alter_utf8.result
@@ -31,14 +31,14 @@ NULL ウウウウウ NULL NULL
DESC `アアア`;
Field Type Null Key Default Extra
カカ char(1) YES MUL NULL
-ï½·ï½·ï½· char(6) NO PRI
+ï½·ï½·ï½· char(6) NO PRI NULL
ククク char(1) YES UNI NULL
ケケケ char(1) YES NULL
SHOW CREATE TABLE `アアア`;
Table Create Table
アアア CREATE TABLE `アアア` (
`カカ` char(1) DEFAULT NULL,
- `ï½·ï½·ï½·` char(6) NOT NULL DEFAULT '',
+ `ï½·ï½·ï½·` char(6) NOT NULL,
`ククク` char(1) DEFAULT NULL,
`ケケケ` char(1) DEFAULT NULL,
PRIMARY KEY (`ï½·ï½·ï½·`),
@@ -58,11 +58,11 @@ SELECT * FROM `アアア`;
ウウウウウ
DESC `アアア`;
Field Type Null Key Default Extra
-ï½·ï½·ï½· char(6) NO
+ï½·ï½·ï½· char(6) NO NULL
SHOW CREATE TABLE `アアア`;
Table Create Table
アアア CREATE TABLE `アアア` (
- `ï½·ï½·ï½·` char(6) NOT NULL DEFAULT ''
+ `ï½·ï½·ï½·` char(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8
ALTER TABLE `ã‚ã‚ã‚` ADD `ã‹ã‹ã‹` char(1) FIRST;
ALTER TABLE `ã‚ã‚ã‚` ADD `ããã` char(1) AFTER `ããã`;
@@ -80,14 +80,14 @@ NULL ã†ã†ã†ã†ã† NULL NULL
DESC `ã‚ã‚ã‚`;
Field Type Null Key Default Extra
ã‹ã‹ char(1) YES MUL NULL
-ããã char(6) NO PRI
+ããã char(6) NO PRI NULL
ããã char(1) YES UNI NULL
ã‘ã‘ã‘ char(1) YES NULL
SHOW CREATE TABLE `ã‚ã‚ã‚`;
Table Create Table
ã‚ã‚ã‚ CREATE TABLE `ã‚ã‚ã‚` (
`ã‹ã‹` char(1) DEFAULT NULL,
- `ããã` char(6) NOT NULL DEFAULT '',
+ `ããã` char(6) NOT NULL,
`ããã` char(1) DEFAULT NULL,
`ã‘ã‘ã‘` char(1) DEFAULT NULL,
PRIMARY KEY (`ããã`),
@@ -107,11 +107,11 @@ SELECT * FROM `ã‚ã‚ã‚`;
ã†ã†ã†ã†ã†
DESC `ã‚ã‚ã‚`;
Field Type Null Key Default Extra
-ããã char(6) NO
+ããã char(6) NO NULL
SHOW CREATE TABLE `ã‚ã‚ã‚`;
Table Create Table
ã‚ã‚ã‚ CREATE TABLE `ã‚ã‚ã‚` (
- `ããã` char(6) NOT NULL DEFAULT ''
+ `ããã` char(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8
ALTER TABLE `龖龖龖` ADD `丄丄丄` char(1) FIRST;
ALTER TABLE `龖龖龖` ADD `丅丅丅` char(1) AFTER `丂丂丂`;
@@ -129,14 +129,14 @@ NULL 丅丅丅丅丅 NULL NULL
DESC `é¾–é¾–é¾–`;
Field Type Null Key Default Extra
丄丄 char(1) YES MUL NULL
-丂丂丂 char(6) NO PRI
+丂丂丂 char(6) NO PRI NULL
丅丅丅 char(1) YES UNI NULL
乚乚乚 char(1) YES NULL
SHOW CREATE TABLE `é¾–é¾–é¾–`;
Table Create Table
é¾–é¾–é¾– CREATE TABLE `é¾–é¾–é¾–` (
`丄丄` char(1) DEFAULT NULL,
- `丂丂丂` char(6) NOT NULL DEFAULT '',
+ `丂丂丂` char(6) NOT NULL,
`丅丅丅` char(1) DEFAULT NULL,
`乚乚乚` char(1) DEFAULT NULL,
PRIMARY KEY (`丂丂丂`),
@@ -156,11 +156,11 @@ SELECT * FROM `é¾–é¾–é¾–`;
丅丅丅丅丅
DESC `é¾–é¾–é¾–`;
Field Type Null Key Default Extra
-丂丂丂 char(6) NO
+丂丂丂 char(6) NO NULL
SHOW CREATE TABLE `é¾–é¾–é¾–`;
Table Create Table
é¾–é¾–é¾– CREATE TABLE `é¾–é¾–é¾–` (
- `丂丂丂` char(6) NOT NULL DEFAULT ''
+ `丂丂丂` char(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8
DROP TABLE `アアア`;
DROP TABLE `イイイ`;
@@ -193,14 +193,14 @@ NULL ウウウウウ NULL NULL
DESC `アアア`;
Field Type Null Key Default Extra
カカ char(1) YES MUL NULL
-ï½·ï½·ï½· char(6) NO PRI
+ï½·ï½·ï½· char(6) NO PRI NULL
ククク char(1) YES UNI NULL
ケケケ char(1) YES NULL
SHOW CREATE TABLE `アアア`;
Table Create Table
アアア CREATE TABLE `アアア` (
`カカ` char(1) DEFAULT NULL,
- `ï½·ï½·ï½·` char(6) NOT NULL DEFAULT '',
+ `ï½·ï½·ï½·` char(6) NOT NULL,
`ククク` char(1) DEFAULT NULL,
`ケケケ` char(1) DEFAULT NULL,
PRIMARY KEY (`ï½·ï½·ï½·`),
@@ -220,11 +220,11 @@ SELECT * FROM `アアア`;
ウウウウウ
DESC `アアア`;
Field Type Null Key Default Extra
-ï½·ï½·ï½· char(6) NO
+ï½·ï½·ï½· char(6) NO NULL
SHOW CREATE TABLE `アアア`;
Table Create Table
アアア CREATE TABLE `アアア` (
- `ï½·ï½·ï½·` char(6) NOT NULL DEFAULT ''
+ `ï½·ï½·ï½·` char(6) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8
ALTER TABLE `ã‚ã‚ã‚` ADD `ã‹ã‹ã‹` char(1) FIRST;
ALTER TABLE `ã‚ã‚ã‚` ADD `ããã` char(1) AFTER `ããã`;
@@ -242,14 +242,14 @@ NULL ã†ã†ã†ã†ã† NULL NULL
DESC `ã‚ã‚ã‚`;
Field Type Null Key Default Extra
ã‹ã‹ char(1) YES MUL NULL
-ããã char(6) NO PRI
+ããã char(6) NO PRI NULL
ããã char(1) YES UNI NULL
ã‘ã‘ã‘ char(1) YES NULL
SHOW CREATE TABLE `ã‚ã‚ã‚`;
Table Create Table
ã‚ã‚ã‚ CREATE TABLE `ã‚ã‚ã‚` (
`ã‹ã‹` char(1) DEFAULT NULL,
- `ããã` char(6) NOT NULL DEFAULT '',
+ `ããã` char(6) NOT NULL,
`ããã` char(1) DEFAULT NULL,
`ã‘ã‘ã‘` char(1) DEFAULT NULL,
PRIMARY KEY (`ããã`),
@@ -269,11 +269,11 @@ SELECT * FROM `ã‚ã‚ã‚`;
ã†ã†ã†ã†ã†
DESC `ã‚ã‚ã‚`;
Field Type Null Key Default Extra
-ããã char(6) NO
+ããã char(6) NO NULL
SHOW CREATE TABLE `ã‚ã‚ã‚`;
Table Create Table
ã‚ã‚ã‚ CREATE TABLE `ã‚ã‚ã‚` (
- `ããã` char(6) NOT NULL DEFAULT ''
+ `ããã` char(6) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8
ALTER TABLE `龖龖龖` ADD `丄丄丄` char(1) FIRST;
ALTER TABLE `龖龖龖` ADD `丅丅丅` char(1) AFTER `丂丂丂`;
@@ -291,14 +291,14 @@ NULL 丅丅丅丅丅 NULL NULL
DESC `é¾–é¾–é¾–`;
Field Type Null Key Default Extra
丄丄 char(1) YES MUL NULL
-丂丂丂 char(6) NO PRI
+丂丂丂 char(6) NO PRI NULL
丅丅丅 char(1) YES UNI NULL
乚乚乚 char(1) YES NULL
SHOW CREATE TABLE `é¾–é¾–é¾–`;
Table Create Table
é¾–é¾–é¾– CREATE TABLE `é¾–é¾–é¾–` (
`丄丄` char(1) DEFAULT NULL,
- `丂丂丂` char(6) NOT NULL DEFAULT '',
+ `丂丂丂` char(6) NOT NULL,
`丅丅丅` char(1) DEFAULT NULL,
`乚乚乚` char(1) DEFAULT NULL,
PRIMARY KEY (`丂丂丂`),
@@ -318,11 +318,11 @@ SELECT * FROM `é¾–é¾–é¾–`;
丅丅丅丅丅
DESC `é¾–é¾–é¾–`;
Field Type Null Key Default Extra
-丂丂丂 char(6) NO
+丂丂丂 char(6) NO NULL
SHOW CREATE TABLE `é¾–é¾–é¾–`;
Table Create Table
é¾–é¾–é¾– CREATE TABLE `é¾–é¾–é¾–` (
- `丂丂丂` char(6) NOT NULL DEFAULT ''
+ `丂丂丂` char(6) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8
DROP TABLE `アアア`;
DROP TABLE `イイイ`;
@@ -355,14 +355,14 @@ NULL ウウウウウ NULL NULL
DESC `アアア`;
Field Type Null Key Default Extra
カカ char(1) YES MUL NULL
-ï½·ï½·ï½· char(6) NO PRI
+ï½·ï½·ï½· char(6) NO PRI NULL
ククク char(1) YES UNI NULL
ケケケ char(1) YES NULL
SHOW CREATE TABLE `アアア`;
Table Create Table
アアア CREATE TABLE `アアア` (
`カカ` char(1) DEFAULT NULL,
- `ï½·ï½·ï½·` char(6) NOT NULL DEFAULT '',
+ `ï½·ï½·ï½·` char(6) NOT NULL,
`ククク` char(1) DEFAULT NULL,
`ケケケ` char(1) DEFAULT NULL,
PRIMARY KEY (`ï½·ï½·ï½·`),
@@ -382,11 +382,11 @@ SELECT * FROM `アアア`;
ウウウウウ
DESC `アアア`;
Field Type Null Key Default Extra
-ï½·ï½·ï½· char(6) NO
+ï½·ï½·ï½· char(6) NO NULL
SHOW CREATE TABLE `アアア`;
Table Create Table
アアア CREATE TABLE `アアア` (
- `ï½·ï½·ï½·` char(6) NOT NULL DEFAULT ''
+ `ï½·ï½·ï½·` char(6) NOT NULL
) ENGINE=MEMORY DEFAULT CHARSET=utf8
ALTER TABLE `ã‚ã‚ã‚` ADD `ã‹ã‹ã‹` char(1) FIRST;
ALTER TABLE `ã‚ã‚ã‚` ADD `ããã` char(1) AFTER `ããã`;
@@ -404,14 +404,14 @@ NULL ã†ã†ã†ã†ã† NULL NULL
DESC `ã‚ã‚ã‚`;
Field Type Null Key Default Extra
ã‹ã‹ char(1) YES MUL NULL
-ããã char(6) NO PRI
+ããã char(6) NO PRI NULL
ããã char(1) YES UNI NULL
ã‘ã‘ã‘ char(1) YES NULL
SHOW CREATE TABLE `ã‚ã‚ã‚`;
Table Create Table
ã‚ã‚ã‚ CREATE TABLE `ã‚ã‚ã‚` (
`ã‹ã‹` char(1) DEFAULT NULL,
- `ããã` char(6) NOT NULL DEFAULT '',
+ `ããã` char(6) NOT NULL,
`ããã` char(1) DEFAULT NULL,
`ã‘ã‘ã‘` char(1) DEFAULT NULL,
PRIMARY KEY (`ããã`),
@@ -431,11 +431,11 @@ SELECT * FROM `ã‚ã‚ã‚`;
ã†ã†ã†ã†ã†
DESC `ã‚ã‚ã‚`;
Field Type Null Key Default Extra
-ããã char(6) NO
+ããã char(6) NO NULL
SHOW CREATE TABLE `ã‚ã‚ã‚`;
Table Create Table
ã‚ã‚ã‚ CREATE TABLE `ã‚ã‚ã‚` (
- `ããã` char(6) NOT NULL DEFAULT ''
+ `ããã` char(6) NOT NULL
) ENGINE=MEMORY DEFAULT CHARSET=utf8
ALTER TABLE `龖龖龖` ADD `丄丄丄` char(1) FIRST;
ALTER TABLE `龖龖龖` ADD `丅丅丅` char(1) AFTER `丂丂丂`;
@@ -453,14 +453,14 @@ NULL 丅丅丅丅丅 NULL NULL
DESC `é¾–é¾–é¾–`;
Field Type Null Key Default Extra
丄丄 char(1) YES MUL NULL
-丂丂丂 char(6) NO PRI
+丂丂丂 char(6) NO PRI NULL
丅丅丅 char(1) YES UNI NULL
乚乚乚 char(1) YES NULL
SHOW CREATE TABLE `é¾–é¾–é¾–`;
Table Create Table
é¾–é¾–é¾– CREATE TABLE `é¾–é¾–é¾–` (
`丄丄` char(1) DEFAULT NULL,
- `丂丂丂` char(6) NOT NULL DEFAULT '',
+ `丂丂丂` char(6) NOT NULL,
`丅丅丅` char(1) DEFAULT NULL,
`乚乚乚` char(1) DEFAULT NULL,
PRIMARY KEY (`丂丂丂`),
@@ -480,11 +480,11 @@ SELECT * FROM `é¾–é¾–é¾–`;
丅丅丅丅丅
DESC `é¾–é¾–é¾–`;
Field Type Null Key Default Extra
-丂丂丂 char(6) NO
+丂丂丂 char(6) NO NULL
SHOW CREATE TABLE `é¾–é¾–é¾–`;
Table Create Table
é¾–é¾–é¾– CREATE TABLE `é¾–é¾–é¾–` (
- `丂丂丂` char(6) NOT NULL DEFAULT ''
+ `丂丂丂` char(6) NOT NULL
) ENGINE=MEMORY DEFAULT CHARSET=utf8
DROP TABLE `アアア`;
DROP TABLE `イイイ`;
diff --git a/mysql-test/suite/jp/r/jp_convert_ucs2.result b/mysql-test/suite/jp/r/jp_convert_ucs2.result
index b16f5420559..842ddfa2ea7 100644
--- a/mysql-test/suite/jp/r/jp_convert_ucs2.result
+++ b/mysql-test/suite/jp/r/jp_convert_ucs2.result
@@ -161,13 +161,13 @@ SELECT `£Ã£±`, CONVERT(`£Ã£±` using sjis) FROM `£Ô£³`;
í´íµí¶í·í¸í¹íºí»í¼í½í¾í¿íÀíÁíÂíÃíÄíÅíÆíÇ ????????????????????
íÈíÉíÊíËíÌíÍíÎíÏíÐíÑíÒíÓíÔíÕíÖí×íØíÙíÚíÛ ????????????????????
Warnings:
-Warning 1976 Cannot convert 'ucs2' character 0x02DB to 'sjis'
-Warning 1976 Cannot convert 'ucs2' character 0x9EF8 to 'sjis'
-Warning 1976 Cannot convert 'ucs2' character 0x4E5A to 'sjis'
-Warning 1976 Cannot convert 'ucs2' character 0x4EE1 to 'sjis'
-Warning 1976 Cannot convert 'ucs2' character 0x4F19 to 'sjis'
-Warning 1976 Cannot convert 'ucs2' character 0x9F2B to 'sjis'
-Warning 1976 Cannot convert 'ucs2' character 0x9F57 to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x02DB to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x9EF8 to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x4E5A to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x4EE1 to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x4F19 to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x9F2B to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x9F57 to 'sjis'
SELECT `£Ã£±`, CONVERT(`£Ã£±` using utf8) FROM `£Ô£´`;
£Ã£± CONVERT(`£Ã£±` using utf8)
Ž¡Ž¢Ž£Ž¤Ž¥Ž¦Ž§Ž¨Ž©ŽªŽ«Ž¬Ž­Ž®Ž¯ Ž¡Ž¢Ž£Ž¤Ž¥Ž¦Ž§Ž¨Ž©ŽªŽ«Ž¬Ž­Ž®Ž¯
@@ -244,13 +244,13 @@ SELECT `£Ã£±`, CONVERT(`£Ã£±` using sjis) FROM `£Ô£¶`;
í´íµí¶í·í¸í¹íºí»í¼í½í¾í¿íÀíÁíÂíÃíÄíÅíÆíÇ ????????????????????
íÈíÉíÊíËíÌíÍíÎíÏíÐíÑíÒíÓíÔíÕíÖí×íØíÙíÚíÛ ????????????????????
Warnings:
-Warning 1976 Cannot convert 'ucs2' character 0x02DB to 'sjis'
-Warning 1976 Cannot convert 'ucs2' character 0x9EF8 to 'sjis'
-Warning 1976 Cannot convert 'ucs2' character 0x4E5A to 'sjis'
-Warning 1976 Cannot convert 'ucs2' character 0x4EE1 to 'sjis'
-Warning 1976 Cannot convert 'ucs2' character 0x4F19 to 'sjis'
-Warning 1976 Cannot convert 'ucs2' character 0x9F2B to 'sjis'
-Warning 1976 Cannot convert 'ucs2' character 0x9F57 to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x02DB to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x9EF8 to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x4E5A to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x4EE1 to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x4F19 to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x9F2B to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x9F57 to 'sjis'
SELECT `£Ã£±`, CONVERT(`£Ã£±` using utf8) FROM `£Ô£·`;
£Ã£± CONVERT(`£Ã£±` using utf8)
PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
@@ -327,13 +327,13 @@ SELECT `£Ã£±`, CONVERT(`£Ã£±` using sjis) FROM `£Ô£¹`;
í´íµí¶í·í¸í¹íºí»í¼í½í¾í¿íÀíÁíÂíÃíÄíÅíÆíÇ ????????????????????
íÈíÉíÊíËíÌíÍíÎíÏíÐíÑíÒíÓíÔíÕíÖí×íØíÙíÚíÛ ????????????????????
Warnings:
-Warning 1976 Cannot convert 'ucs2' character 0x02DB to 'sjis'
-Warning 1976 Cannot convert 'ucs2' character 0x4E5A to 'sjis'
-Warning 1976 Cannot convert 'ucs2' character 0x4EE1 to 'sjis'
-Warning 1976 Cannot convert 'ucs2' character 0x4F19 to 'sjis'
-Warning 1976 Cannot convert 'ucs2' character 0x9EF8 to 'sjis'
-Warning 1976 Cannot convert 'ucs2' character 0x9F2B to 'sjis'
-Warning 1976 Cannot convert 'ucs2' character 0x9F57 to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x02DB to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x4E5A to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x4EE1 to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x4F19 to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x9EF8 to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x9F2B to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x9F57 to 'sjis'
drop table `£Ô£±`;
drop table `£Ô£²`;
drop table `£Ô£³`;
diff --git a/mysql-test/suite/jp/r/jp_convert_ujis.result b/mysql-test/suite/jp/r/jp_convert_ujis.result
index 0f2aff23c0f..d47f6b4ef25 100644
--- a/mysql-test/suite/jp/r/jp_convert_ujis.result
+++ b/mysql-test/suite/jp/r/jp_convert_ujis.result
@@ -394,37 +394,37 @@ SELECT `£Ã£±`, CONVERT(`£Ã£±` using sjis) FROM `£Ô£³`;
¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦ ¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦
¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦ ¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦
Warnings:
-Warning 1976 Cannot convert 'ujis' character 0x8FA2F0 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA7C8 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA9C8 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FAAB4 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FAAC8 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FAADC to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FAAF0 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FABB4 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FABC8 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FABDC to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FABF0 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FB0B4 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FB0C8 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FB0DC to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FB0F0 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FEDB4 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FEDC8 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FEDDC to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA2B5 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA6F1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA9A1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FAAA1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FABA1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FB0A1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FEDA1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA7F2 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA6E1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA9C1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA7C2 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA2AF to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA2EB to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA2F0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA7C8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA9C8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAB4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAC8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAADC to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAF0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABB4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABC8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABDC to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABF0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0B4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0C8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0DC to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0F0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDB4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDC8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDDC to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA2B5 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA6F1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA9A1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAA1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABA1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0A1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDA1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA7F2 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA6E1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA9C1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA7C2 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA2AF to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA2EB to 'sjis'
SELECT `£Ã£±`, CONVERT(`£Ã£±` using utf8) FROM `£Ô£´`;
£Ã£± CONVERT(`£Ã£±` using utf8)
!"#$%&'()*+,-./ !"#$%&'()*+,-./
@@ -792,37 +792,37 @@ SELECT `£Ã£±`, CONVERT(`£Ã£±` using sjis) FROM `£Ô£¶`;
¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦ ¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦
¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦ ¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦
Warnings:
-Warning 1976 Cannot convert 'ujis' character 0x8FA2F0 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA7C8 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA9C8 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FAAB4 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FAAC8 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FAADC to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FAAF0 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FABB4 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FABC8 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FABDC to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FABF0 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FB0B4 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FB0C8 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FB0DC to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FB0F0 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FEDB4 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FEDC8 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FEDDC to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA2B5 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA6F1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA9A1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FAAA1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FABA1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FB0A1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FEDA1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA7F2 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA6E1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA9C1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA7C2 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA2AF to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA2EB to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA2F0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA7C8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA9C8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAB4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAC8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAADC to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAF0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABB4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABC8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABDC to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABF0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0B4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0C8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0DC to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0F0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDB4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDC8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDDC to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA2B5 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA6F1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA9A1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAA1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABA1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0A1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDA1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA7F2 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA6E1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA9C1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA7C2 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA2AF to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA2EB to 'sjis'
SELECT `£Ã£±`, CONVERT(`£Ã£±` using utf8) FROM `£Ô£·`;
£Ã£± CONVERT(`£Ã£±` using utf8)
!"#$%&'()*+,-./ !"#$%&'()*+,-./
@@ -1190,37 +1190,37 @@ SELECT `£Ã£±`, CONVERT(`£Ã£±` using sjis) FROM `£Ô£¹`;
íÜíÝíÞíßíàíáíâí㡦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦ ????????¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦
¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦ ¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦
Warnings:
-Warning 1976 Cannot convert 'ujis' character 0x8FA2AF to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA2B5 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA2EB to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA2F0 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA6E1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA6F1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA7C2 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA7C8 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA7F2 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA9A1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA9C1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FA9C8 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FAAA1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FAAB4 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FAAC8 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FAADC to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FAAF0 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FABA1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FABB4 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FABC8 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FABDC to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FABF0 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FB0A1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FB0B4 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FB0C8 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FB0DC to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FB0F0 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FEDA1 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FEDB4 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FEDC8 to 'sjis'
-Warning 1976 Cannot convert 'ujis' character 0x8FEDDC to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA2AF to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA2B5 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA2EB to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA2F0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA6E1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA6F1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA7C2 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA7C8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA7F2 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA9A1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA9C1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA9C8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAA1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAB4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAC8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAADC to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAF0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABA1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABB4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABC8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABDC to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABF0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0A1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0B4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0C8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0DC to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0F0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDA1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDB4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDC8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDDC to 'sjis'
drop table `£Ô£±`;
drop table `£Ô£²`;
drop table `£Ô£³`;
diff --git a/mysql-test/suite/jp/r/jp_convert_utf8.result b/mysql-test/suite/jp/r/jp_convert_utf8.result
index 3528493518f..e33edfb1c3f 100644
--- a/mysql-test/suite/jp/r/jp_convert_utf8.result
+++ b/mysql-test/suite/jp/r/jp_convert_utf8.result
@@ -132,7 +132,7 @@ SELECT `C1`, CONVERT(`C1` using ujis) FROM `T2`;
HIJKLMNOPQRSTUVWXYZ・ HIJKLMNOPQRSTUVWXYZ・
ï½ï½‘rstuvwxyz・・・・・・・・・ ï½ï½‘rstuvwxyz・・・・・・・・・
Warnings:
-Warning 1976 Cannot convert 'utf8' character 0xEFBCBC to 'ujis'
+Warning 1977 Cannot convert 'utf8' character 0xEFBCBC to 'ujis'
SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T2`;
C1 CONVERT(`C1` using ucs2)
θικλμνξοπÏστυφχψω・・・ θικλμνξοπÏστυφχψω・・・
@@ -270,7 +270,7 @@ SELECT `C1`, CONVERT(`C1` using sjis) FROM `T2`;
HIJKLMNOPQRSTUVWXYZ・ HIJKLMNOPQRSTUVWXYZ・
ï½ï½‘rstuvwxyz・・・・・・・・・ ï½ï½‘rstuvwxyz・・・・・・・・・
Warnings:
-Warning 1976 Cannot convert 'utf8' character 0xEFBCBC to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xEFBCBC to 'sjis'
SELECT `C1`, CONVERT(`C1` using ujis) FROM `T3`;
C1 CONVERT(`C1` using ujis)
êěėēęǵÄğ・ġĥíìïîÇ・īįĩ êěėēęǵÄğ・ġĥíìïîÇ・īįĩ
@@ -314,7 +314,7 @@ SELECT `C1`, CONVERT(`C1` using ujis) FROM `T3`;
齗齘齚é½é½žé½¨é½©é½­é½®é½¯é½°é½±é½³é½µé½ºé½½é¾é¾é¾‘é¾’ 齗齘齚é½é½žé½¨é½©é½­é½®é½¯é½°é½±é½³é½µé½ºé½½é¾é¾é¾‘é¾’
龔龖龗龞龡龢龣龥・・・・・・・・・・・・ 龔龖龗龞龡龢龣龥・・・・・・・・・・・・
Warnings:
-Warning 1976 Cannot convert 'utf8' character 0xEFBD9E to 'ujis'
+Warning 1977 Cannot convert 'utf8' character 0xEFBD9E to 'ujis'
SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T3`;
C1 CONVERT(`C1` using ucs2)
êěėēęǵÄğ・ġĥíìïîÇ・īįĩ êěėēęǵÄğ・ġĥíìïîÇ・īįĩ
@@ -400,37 +400,37 @@ SELECT `C1`, CONVERT(`C1` using sjis) FROM `T3`;
齗齘齚é½é½žé½¨é½©é½­é½®é½¯é½°é½±é½³é½µé½ºé½½é¾é¾é¾‘é¾’ ????????????????????
龔龖龗龞龡龢龣龥・・・・・・・・・・・・ ????????・・・・・・・・・・・・
Warnings:
-Warning 1976 Cannot convert 'utf8' character 0xC3AA to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC38A to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC4B4 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC4B5 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC59A to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC59B to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC795 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC796 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC2A4 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC582 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xD088 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC381 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC3A1 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC386 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xCB9B to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xCEAC to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xD192 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xCE86 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC3A6 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xD082 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC2BA to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xCB98 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE4B882 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE9BBB8 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE4B99A to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE4BBA1 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE4BC99 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE4BD9F to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE9BCAB to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE9BD97 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE9BE94 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC3AA to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC38A to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC4B4 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC4B5 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC59A to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC59B to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC795 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC796 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC2A4 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC582 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xD088 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC381 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC3A1 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC386 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xCB9B to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xCEAC to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xD192 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xCE86 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC3A6 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xD082 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC2BA to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xCB98 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE4B882 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE9BBB8 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE4B99A to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE4BBA1 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE4BC99 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE4BD9F to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE9BCAB to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE9BD97 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE9BE94 to 'sjis'
SELECT `C1`, CONVERT(`C1` using ujis) FROM `T4`;
C1 CONVERT(`C1` using ujis)
!"#$%&'()*+,-./ !"#$%&'()*+,-./
@@ -536,7 +536,7 @@ SELECT `C1`, CONVERT(`C1` using ujis) FROM `T5`;
HIJKLMNOPQRSTUVWXYZ・ HIJKLMNOPQRSTUVWXYZ・
ï½ï½‘rstuvwxyz・・・・・・・・・ ï½ï½‘rstuvwxyz・・・・・・・・・
Warnings:
-Warning 1976 Cannot convert 'utf8' character 0xEFBCBC to 'ujis'
+Warning 1977 Cannot convert 'utf8' character 0xEFBCBC to 'ujis'
SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T5`;
C1 CONVERT(`C1` using ucs2)
θικλμνξοπÏστυφχψω・・・ θικλμνξοπÏστυφχψω・・・
@@ -674,7 +674,7 @@ SELECT `C1`, CONVERT(`C1` using sjis) FROM `T5`;
HIJKLMNOPQRSTUVWXYZ・ HIJKLMNOPQRSTUVWXYZ・
ï½ï½‘rstuvwxyz・・・・・・・・・ ï½ï½‘rstuvwxyz・・・・・・・・・
Warnings:
-Warning 1976 Cannot convert 'utf8' character 0xEFBCBC to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xEFBCBC to 'sjis'
SELECT `C1`, CONVERT(`C1` using ujis) FROM `T6`;
C1 CONVERT(`C1` using ujis)
êěėēęǵÄğ・ġĥíìïîÇ・īįĩ êěėēęǵÄğ・ġĥíìïîÇ・īįĩ
@@ -718,7 +718,7 @@ SELECT `C1`, CONVERT(`C1` using ujis) FROM `T6`;
齗齘齚é½é½žé½¨é½©é½­é½®é½¯é½°é½±é½³é½µé½ºé½½é¾é¾é¾‘é¾’ 齗齘齚é½é½žé½¨é½©é½­é½®é½¯é½°é½±é½³é½µé½ºé½½é¾é¾é¾‘é¾’
龔龖龗龞龡龢龣龥・・・・・・・・・・・・ 龔龖龗龞龡龢龣龥・・・・・・・・・・・・
Warnings:
-Warning 1976 Cannot convert 'utf8' character 0xEFBD9E to 'ujis'
+Warning 1977 Cannot convert 'utf8' character 0xEFBD9E to 'ujis'
SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T6`;
C1 CONVERT(`C1` using ucs2)
êěėēęǵÄğ・ġĥíìïîÇ・īįĩ êěėēęǵÄğ・ġĥíìïîÇ・īįĩ
@@ -804,37 +804,37 @@ SELECT `C1`, CONVERT(`C1` using sjis) FROM `T6`;
齗齘齚é½é½žé½¨é½©é½­é½®é½¯é½°é½±é½³é½µé½ºé½½é¾é¾é¾‘é¾’ ????????????????????
龔龖龗龞龡龢龣龥・・・・・・・・・・・・ ????????・・・・・・・・・・・・
Warnings:
-Warning 1976 Cannot convert 'utf8' character 0xC3AA to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC38A to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC4B4 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC4B5 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC59A to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC59B to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC795 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC796 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC2A4 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC582 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xD088 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC381 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC3A1 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC386 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xCB9B to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xCEAC to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xD192 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xCE86 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC3A6 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xD082 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC2BA to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xCB98 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE4B882 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE9BBB8 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE4B99A to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE4BBA1 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE4BC99 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE4BD9F to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE9BCAB to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE9BD97 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE9BE94 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC3AA to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC38A to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC4B4 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC4B5 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC59A to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC59B to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC795 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC796 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC2A4 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC582 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xD088 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC381 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC3A1 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC386 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xCB9B to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xCEAC to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xD192 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xCE86 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC3A6 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xD082 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC2BA to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xCB98 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE4B882 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE9BBB8 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE4B99A to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE4BBA1 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE4BC99 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE4BD9F to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE9BCAB to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE9BD97 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE9BE94 to 'sjis'
SELECT `C1`, CONVERT(`C1` using ujis) FROM `T7`;
C1 CONVERT(`C1` using ujis)
!"#$%&'()*+,-./ !"#$%&'()*+,-./
@@ -940,7 +940,7 @@ SELECT `C1`, CONVERT(`C1` using ujis) FROM `T8`;
・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
Warnings:
-Warning 1976 Cannot convert 'utf8' character 0xEFBCBC to 'ujis'
+Warning 1977 Cannot convert 'utf8' character 0xEFBCBC to 'ujis'
SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T8`;
C1 CONVERT(`C1` using ucs2)
  ã€ã€‚,.・:;?ï¼ã‚›ã‚œÂ´ï½€Â¨ï¼¾ï¿£ï¼¿ãƒ½   ã€ã€‚,.・:;?ï¼ã‚›ã‚œÂ´ï½€Â¨ï¼¾ï¿£ï¼¿ãƒ½
@@ -1078,7 +1078,7 @@ SELECT `C1`, CONVERT(`C1` using sjis) FROM `T8`;
・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
Warnings:
-Warning 1976 Cannot convert 'utf8' character 0xEFBCBC to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xEFBCBC to 'sjis'
SELECT `C1`, CONVERT(`C1` using ujis) FROM `T9`;
C1 CONVERT(`C1` using ujis)
ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»Ë˜Ë‡Â¸Ë™Ë ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»Ë˜Ë‡Â¸Ë™Ë
@@ -1122,7 +1122,7 @@ SELECT `C1`, CONVERT(`C1` using ujis) FROM `T9`;
龔龖龗龞龡龢龣龥・・・・・・・・・・・・ 龔龖龗龞龡龢龣龥・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
Warnings:
-Warning 1976 Cannot convert 'utf8' character 0xEFBD9E to 'ujis'
+Warning 1977 Cannot convert 'utf8' character 0xEFBD9E to 'ujis'
SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T9`;
C1 CONVERT(`C1` using ucs2)
ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»Ë˜Ë‡Â¸Ë™Ë ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»ãƒ»Ë˜Ë‡Â¸Ë™Ë
@@ -1208,37 +1208,37 @@ SELECT `C1`, CONVERT(`C1` using sjis) FROM `T9`;
龔龖龗龞龡龢龣龥・・・・・・・・・・・・ ????????・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
Warnings:
-Warning 1976 Cannot convert 'utf8' character 0xCB98 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xCB9B to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC2BA to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC2A4 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xCE86 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xCEAC to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xD082 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xD088 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xD192 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC386 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC3A6 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC582 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC381 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC38A to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC4B4 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC59A to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC795 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC3A1 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC3AA to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC4B5 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC59B to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xC796 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE4B882 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE4B99A to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE4BBA1 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE4BC99 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE4BD9F to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE9BBB8 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE9BCAB to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE9BD97 to 'sjis'
-Warning 1976 Cannot convert 'utf8' character 0xE9BE94 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xCB98 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xCB9B to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC2BA to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC2A4 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xCE86 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xCEAC to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xD082 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xD088 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xD192 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC386 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC3A6 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC582 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC381 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC38A to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC4B4 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC59A to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC795 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC3A1 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC3AA to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC4B5 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC59B to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xC796 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE4B882 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE4B99A to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE4BBA1 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE4BC99 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE4BD9F to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE9BBB8 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE9BCAB to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE9BD97 to 'sjis'
+Warning 1977 Cannot convert 'utf8' character 0xE9BE94 to 'sjis'
drop table `T1`;
drop table `ï¼´ï¼’`;
drop table `T3`;
diff --git a/mysql-test/suite/maria/icp.result b/mysql-test/suite/maria/icp.result
index 85a21ada47d..42962b3a226 100644
--- a/mysql-test/suite/maria/icp.result
+++ b/mysql-test/suite/maria/icp.result
@@ -416,17 +416,11 @@ DROP TABLE t1;
# Bug#59259 "Incorrect rows returned for a correlated subquery
# when ICP is on"
#
-CREATE TABLE t1 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL) ENGINE=InnoDB;
-Warnings:
-Warning 1286 Unknown storage engine 'InnoDB'
-Warning 1266 Using storage engine Aria for table 't1'
+CREATE TABLE t1 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL);
INSERT INTO t1 VALUES (11,0);
INSERT INTO t1 VALUES (12,5);
INSERT INTO t1 VALUES (15,0);
-CREATE TABLE t2 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL) ENGINE=InnoDB;
-Warnings:
-Warning 1286 Unknown storage engine 'InnoDB'
-Warning 1266 Using storage engine Aria for table 't2'
+CREATE TABLE t2 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL);
INSERT INTO t2 VALUES (11,1);
INSERT INTO t2 VALUES (12,2);
INSERT INTO t2 VALUES (15,4);
@@ -606,6 +600,16 @@ SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
WHERE t2.pk <> t1.d1 AND t2.pk = 4;
d1 pk i1
1 4 1
+EXPLAIN
+SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
+WHERE t1.d1 <> t2.pk AND t2.pk = 4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL k1 9 NULL 3 Using index
+1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using where
+SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
+WHERE t1.d1 <> t2.pk AND t2.pk = 4;
+d1 pk i1
+1 4 1
DROP TABLE t1, t2;
#
# BUG#778434 Wrong result with in_to_exists=on in maria-5.3-mwl89
diff --git a/mysql-test/suite/maria/maria2.result b/mysql-test/suite/maria/maria2.result
index a0ec440b662..b4b27512054 100644
--- a/mysql-test/suite/maria/maria2.result
+++ b/mysql-test/suite/maria/maria2.result
@@ -46,12 +46,22 @@ drop table t1;
create table t1 (pk int primary key, apk int unique, data int) engine=aria;
insert into t1 values (1, 1, 1), (4, 4, 4), (6, 6, 6);
load data concurrent infile '../../std_data/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk);
+Warnings:
+Note 1265 Data truncated for column 'pk' at row 1
+Note 1265 Data truncated for column 'apk' at row 1
+Note 1265 Data truncated for column 'pk' at row 2
+Note 1265 Data truncated for column 'apk' at row 2
select * from t1 order by pk;
pk apk data
1 1 1
3 4 NULL
5 6 NULL
load data infile '../../std_data/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk);
+Warnings:
+Note 1265 Data truncated for column 'pk' at row 1
+Note 1265 Data truncated for column 'apk' at row 1
+Note 1265 Data truncated for column 'pk' at row 2
+Note 1265 Data truncated for column 'apk' at row 2
select * from t1 order by pk;
pk apk data
1 1 1
diff --git a/mysql-test/suite/maria/optimize.result b/mysql-test/suite/maria/optimize.result
index 9cce55d6199..a78e8e469aa 100644
--- a/mysql-test/suite/maria/optimize.result
+++ b/mysql-test/suite/maria/optimize.result
@@ -6,3 +6,14 @@ OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
drop table t1;
+#
+# MDEV-3870 - Valgrind warnings on OPTIMIZE MyISAM or Aria TABLE with
+# disabled keys
+#
+CREATE TABLE t1 (a INT, KEY(a)) ENGINE=Aria;
+INSERT INTO t1 VALUES (4),(3),(1),(0);
+ALTER TABLE t1 DISABLE KEYS;
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+DROP TABLE t1;
diff --git a/mysql-test/suite/maria/optimize.test b/mysql-test/suite/maria/optimize.test
index 6b310b1d1a6..b1fc250cd29 100644
--- a/mysql-test/suite/maria/optimize.test
+++ b/mysql-test/suite/maria/optimize.test
@@ -160,3 +160,13 @@ INSERT /*! IGNORE */ INTO t1 VALUES ('urxjxqvwabikpugvexxbxdpxjkeqiuhhuadbcuhoz
check table t1;
OPTIMIZE TABLE t1;
drop table t1;
+
+--echo #
+--echo # MDEV-3870 - Valgrind warnings on OPTIMIZE MyISAM or Aria TABLE with
+--echo # disabled keys
+--echo #
+CREATE TABLE t1 (a INT, KEY(a)) ENGINE=Aria;
+INSERT INTO t1 VALUES (4),(3),(1),(0);
+ALTER TABLE t1 DISABLE KEYS;
+OPTIMIZE TABLE t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/maria/ps_maria.result b/mysql-test/suite/maria/ps_maria.result
index 774bf8af54a..573d61fc6bf 100644
--- a/mysql-test/suite/maria/ps_maria.result
+++ b/mysql-test/suite/maria/ps_maria.result
@@ -49,7 +49,7 @@ test_sequence
prepare stmt1 from ' select * from t9 order by c1 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def test t9 t9 c1 c1 1 4 1 N 49155 0 63
+def test t9 t9 c1 c1 1 4 1 N 53251 0 63
def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
@@ -1775,21 +1775,21 @@ NULL as const12, @arg12 as param12,
show create table t5 ;
Table Create Table
t5 CREATE TABLE `t5` (
- `const01` int(1) NOT NULL DEFAULT '0',
+ `const01` int(1) NOT NULL,
`param01` bigint(20) DEFAULT NULL,
- `const02` decimal(2,1) NOT NULL DEFAULT '0.0',
+ `const02` decimal(2,1) NOT NULL,
`param02` decimal(65,30) DEFAULT NULL,
- `const03` double NOT NULL DEFAULT '0',
+ `const03` double NOT NULL,
`param03` double DEFAULT NULL,
- `const04` varchar(3) NOT NULL DEFAULT '',
+ `const04` varchar(3) NOT NULL,
`param04` longtext,
- `const05` varbinary(3) NOT NULL DEFAULT '',
+ `const05` varbinary(3) NOT NULL,
`param05` longblob,
- `const06` varchar(10) NOT NULL DEFAULT '',
+ `const06` varchar(10) NOT NULL,
`param06` longtext,
`const07` date DEFAULT NULL,
`param07` longtext,
- `const08` varchar(19) NOT NULL DEFAULT '',
+ `const08` varchar(19) NOT NULL,
`param08` longtext,
`const09` datetime DEFAULT NULL,
`param09` longtext,
@@ -1805,21 +1805,21 @@ t5 CREATE TABLE `t5` (
) 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 32769 0 63
+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 32769 1 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 const03 const03 5 17 1 N 32769 31 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 1 0 8
+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 129 0 63
+def test t5 t5 const05 const05 253 3 3 N 4225 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 1 0 8
+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
def test t5 t5 const07 const07 10 10 10 Y 128 0 63
def test t5 t5 param07 param07 252 4294967295 10 Y 16 0 8
-def test t5 t5 const08 const08 253 19 19 N 1 0 8
+def test t5 t5 const08 const08 253 19 19 N 4097 0 8
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8
diff --git a/mysql-test/suite/multi_source/gtid_ignore_duplicates.cnf b/mysql-test/suite/multi_source/gtid_ignore_duplicates.cnf
index b47ebb2cf30..ba1ffee4d9d 100644
--- a/mysql-test/suite/multi_source/gtid_ignore_duplicates.cnf
+++ b/mysql-test/suite/multi_source/gtid_ignore_duplicates.cnf
@@ -3,21 +3,25 @@
[mysqld.1]
log-slave-updates
loose-innodb
+binlog-format=mixed
[mysqld.2]
log-slave-updates
loose-innodb
+binlog-format=mixed
[mysqld.3]
log-bin=server3-bin
log-slave-updates
loose-innodb
+binlog-format=mixed
[mysqld.4]
server-id=4
log-bin=server4-bin
log-slave-updates
loose-innodb
+binlog-format=mixed
[ENV]
SERVER_MYPORT_4= @mysqld.4.port
diff --git a/mysql-test/suite/multi_source/gtid_ignore_duplicates.result b/mysql-test/suite/multi_source/gtid_ignore_duplicates.result
index 5426091b635..2e15f11a7c7 100644
--- a/mysql-test/suite/multi_source/gtid_ignore_duplicates.result
+++ b/mysql-test/suite/multi_source/gtid_ignore_duplicates.result
@@ -242,6 +242,178 @@ a
24
25
26
+*** MDEV-8354: out-of-order error with --gtid-ignore-duplicates and row-based replication ***
+SET default_master_connection = "b2a";
+STOP SLAVE;
+include/wait_for_slave_to_stop.inc
+SET default_master_connection = "c2a";
+STOP SLAVE;
+include/wait_for_slave_to_stop.inc
+SET default_master_connection = "c2b";
+STOP SLAVE;
+include/wait_for_slave_to_stop.inc
+SET default_master_connection = "b2c";
+STOP SLAVE;
+include/wait_for_slave_to_stop.inc
+SET @old_slave_mode=@@GLOBAL.slave_exec_mode;
+SET GLOBAL slave_exec_mode=IDEMPOTENT;
+SET @old_strict=@@GLOBAL.gtid_strict_mode;
+SET GLOBAL gtid_strict_mode=1;
+SET @old_dbug=@@GLOBAL.debug_dbug;
+SET GLOBAL debug_dbug="+d,inject_sleep_gtid_100_x_x";
+SET @old_domain=@@SESSION.gtid_domain_id;
+SET @old_format=@@SESSION.binlog_format;
+SET SESSION gtid_domain_id=100;
+SET SESSION binlog_format='row';
+INSERT INTO t1 VALUES (30);
+INSERT INTO t1 VALUES (31);
+INSERT INTO t1 VALUES (32);
+INSERT INTO t1 VALUES (33);
+INSERT INTO t1 VALUES (34);
+INSERT INTO t1 VALUES (35);
+INSERT INTO t1 VALUES (36);
+INSERT INTO t1 VALUES (37);
+INSERT INTO t1 VALUES (38);
+INSERT INTO t1 VALUES (39);
+INSERT INTO t1 VALUES (40);
+INSERT INTO t1 VALUES (41);
+INSERT INTO t1 VALUES (42);
+INSERT INTO t1 VALUES (43);
+INSERT INTO t1 VALUES (44);
+INSERT INTO t1 VALUES (45);
+INSERT INTO t1 VALUES (46);
+INSERT INTO t1 VALUES (47);
+INSERT INTO t1 VALUES (48);
+INSERT INTO t1 VALUES (49);
+SET SESSION gtid_domain_id=@old_domain;
+SET SESSION binlog_format=@old_format;
+include/save_master_gtid.inc
+include/sync_with_master_gtid.inc
+INSERT INTO t1 VALUES (50);
+include/save_master_gtid.inc
+SET default_master_connection = "b2c";
+START SLAVE;
+include/wait_for_slave_to_start.inc
+SELECT MASTER_GTID_WAIT("GTID", 30);
+MASTER_GTID_WAIT("GTID", 30)
+0
+SET default_master_connection = "b2a";
+START SLAVE;
+include/wait_for_slave_to_start.inc
+SET default_master_connection = "c2a";
+START SLAVE;
+include/wait_for_slave_to_start.inc
+include/sync_with_master_gtid.inc
+SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
+a
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+SET default_master_connection = "c2b";
+START SLAVE;
+include/wait_for_slave_to_start.inc
+include/sync_with_master_gtid.inc
+SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
+a
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+include/sync_with_master_gtid.inc
+SET GLOBAL debug_dbug=@old_dbug;
+SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
+a
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+SET GLOBAL slave_exec_mode=@old_slave_mode;
+SET GLOBAL gtid_strict_mode=@old_strict;
+*** MDEV-8496: gtid_ignore_duplicates treats gtid_seq_no as 32-bit ***
+SET @old_domain= @@SESSION.gtid_domain_id;
+SET SESSION gtid_domain_id=102;
+SET SESSION gtid_seq_no=4294967294;
+INSERT INTO t1 VALUES (60);
+INSERT INTO t1 VALUES (61);
+INSERT INTO t1 VALUES (62);
+SET SESSION gtid_domain_id= @old_domain;
+include/save_master_gtid.inc
+include/sync_with_master_gtid.inc
+SELECT * FROM t1 WHERE a >= 60 ORDER BY a;
+a
+60
+61
+62
+SET default_master_connection = "c2b";
+include/sync_with_master_gtid.inc
+SET default_master_connection = "a2b";
+include/sync_with_master_gtid.inc
+SELECT * FROM t1 WHERE a >= 60 ORDER BY a;
+a
+60
+61
+62
+SET default_master_connection = "b2c";
+include/sync_with_master_gtid.inc
+SET default_master_connection = "a2c";
+include/sync_with_master_gtid.inc
+SELECT * FROM t1 WHERE a >= 60 ORDER BY a;
+a
+60
+61
+62
SET GLOBAL gtid_domain_id=0;
STOP ALL SLAVES;
Warnings:
diff --git a/mysql-test/suite/multi_source/gtid_ignore_duplicates.test b/mysql-test/suite/multi_source/gtid_ignore_duplicates.test
index cf1c750fc19..1eea038f8c9 100644
--- a/mysql-test/suite/multi_source/gtid_ignore_duplicates.test
+++ b/mysql-test/suite/multi_source/gtid_ignore_duplicates.test
@@ -1,5 +1,7 @@
--source include/not_embedded.inc
--source include/have_innodb.inc
+--source include/have_debug.inc
+
--echo *** Test all-to-all replication with --gtid-ignore-duplicates ***
@@ -258,6 +260,146 @@ SELECT * FROM t1 WHERE a >= 20 ORDER BY a;
SELECT * FROM t1 WHERE a >= 20 ORDER BY a;
+--echo *** MDEV-8354: out-of-order error with --gtid-ignore-duplicates and row-based replication ***
+
+# Have only A->C A->B initially.
+--connection server_1
+SET default_master_connection = "b2a";
+STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
+SET default_master_connection = "c2a";
+STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
+
+--connection server_2
+SET default_master_connection = "c2b";
+STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
+
+--connection server_3
+SET default_master_connection = "b2c";
+STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
+SET @old_slave_mode=@@GLOBAL.slave_exec_mode;
+SET GLOBAL slave_exec_mode=IDEMPOTENT;
+SET @old_strict=@@GLOBAL.gtid_strict_mode;
+SET GLOBAL gtid_strict_mode=1;
+
+SET @old_dbug=@@GLOBAL.debug_dbug;
+# This will inject a small sleep that helps trigger the race. I did not manage
+# to create a non-sleeping version with debug_sync for this; the problem is
+# that once the bug is fixed, the race becomes impossible, so even with
+# debug_sync at best we can check that the debug_sync times out. Which is
+# just another way of adding a sleep.
+#
+# The bug was a race at this point where another multi-source connection
+# could incorrectly re-apply the same GTID, in case of row-based replication.
+SET GLOBAL debug_dbug="+d,inject_sleep_gtid_100_x_x";
+
+--connection server_1
+SET @old_domain=@@SESSION.gtid_domain_id;
+SET @old_format=@@SESSION.binlog_format;
+SET SESSION gtid_domain_id=100;
+SET SESSION binlog_format='row';
+INSERT INTO t1 VALUES (30);
+INSERT INTO t1 VALUES (31);
+INSERT INTO t1 VALUES (32);
+INSERT INTO t1 VALUES (33);
+INSERT INTO t1 VALUES (34);
+INSERT INTO t1 VALUES (35);
+INSERT INTO t1 VALUES (36);
+INSERT INTO t1 VALUES (37);
+INSERT INTO t1 VALUES (38);
+INSERT INTO t1 VALUES (39);
+INSERT INTO t1 VALUES (40);
+INSERT INTO t1 VALUES (41);
+INSERT INTO t1 VALUES (42);
+INSERT INTO t1 VALUES (43);
+INSERT INTO t1 VALUES (44);
+INSERT INTO t1 VALUES (45);
+INSERT INTO t1 VALUES (46);
+INSERT INTO t1 VALUES (47);
+INSERT INTO t1 VALUES (48);
+INSERT INTO t1 VALUES (49);
+SET SESSION gtid_domain_id=@old_domain;
+SET SESSION binlog_format=@old_format;
+--source include/save_master_gtid.inc
+
+--connection server_2
+--source include/sync_with_master_gtid.inc
+INSERT INTO t1 VALUES (50);
+--let $gtid=`SELECT @@last_gtid`
+--source include/save_master_gtid.inc
+
+--connection server_3
+SET default_master_connection = "b2c";
+START SLAVE;
+--source include/wait_for_slave_to_start.inc
+--replace_result $gtid GTID
+eval SELECT MASTER_GTID_WAIT("$gtid", 30);
+# The bug occured here, the slave would get an out-of-order binlog error
+# due to trying to re-apply the 100-x-x transaction.
+
+# Restart stopped multi-source connections, and sync up.
+--connection server_1
+SET default_master_connection = "b2a";
+START SLAVE;
+--source include/wait_for_slave_to_start.inc
+SET default_master_connection = "c2a";
+START SLAVE;
+--source include/wait_for_slave_to_start.inc
+--source include/sync_with_master_gtid.inc
+SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
+
+--connection server_2
+SET default_master_connection = "c2b";
+START SLAVE;
+--source include/wait_for_slave_to_start.inc
+--source include/sync_with_master_gtid.inc
+SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
+
+--connection server_3
+--source include/sync_with_master_gtid.inc
+SET GLOBAL debug_dbug=@old_dbug;
+SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
+SET GLOBAL slave_exec_mode=@old_slave_mode;
+SET GLOBAL gtid_strict_mode=@old_strict;
+
+
+--echo *** MDEV-8496: gtid_ignore_duplicates treats gtid_seq_no as 32-bit ***
+
+--connection server_1
+SET @old_domain= @@SESSION.gtid_domain_id;
+SET SESSION gtid_domain_id=102;
+SET SESSION gtid_seq_no=4294967294;
+INSERT INTO t1 VALUES (60);
+INSERT INTO t1 VALUES (61);
+INSERT INTO t1 VALUES (62);
+# The bug was an overflow, the seq_no value 4294967296 (2**32) was treated
+# as 0, causing the last transaction to be ignored.
+SET SESSION gtid_domain_id= @old_domain;
+--source include/save_master_gtid.inc
+
+--connection server_4
+--source include/sync_with_master_gtid.inc
+SELECT * FROM t1 WHERE a >= 60 ORDER BY a;
+
+--connection server_2
+SET default_master_connection = "c2b";
+--source include/sync_with_master_gtid.inc
+SET default_master_connection = "a2b";
+--source include/sync_with_master_gtid.inc
+SELECT * FROM t1 WHERE a >= 60 ORDER BY a;
+
+--connection server_3
+SET default_master_connection = "b2c";
+--source include/sync_with_master_gtid.inc
+SET default_master_connection = "a2c";
+--source include/sync_with_master_gtid.inc
+SELECT * FROM t1 WHERE a >= 60 ORDER BY a;
+
+
+
# Clean up.
--connection server_1
SET GLOBAL gtid_domain_id=0;
diff --git a/mysql-test/suite/multi_source/info_logs.result b/mysql-test/suite/multi_source/info_logs.result
index 6e6e4cf1503..d644939bd6f 100644
--- a/mysql-test/suite/multi_source/info_logs.result
+++ b/mysql-test/suite/multi_source/info_logs.result
@@ -85,16 +85,16 @@ MASTER 2.2
#
show all slaves status;
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
- Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 313 relay.000002 601 master-bin.000001 Yes Yes 0 0 313 888 None 0 No 0 No 0 0 1 No conservative 0 1073741824 7 0 60.000
-MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 313 relay-master@00202@002e2.000002 601 master-bin.000001 Yes Yes 0 0 313 907 None 0 No 0 No 0 0 2 No conservative 0 1073741824 7 0 60.000
+ Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 <read_master_log_pos> relay.000002 <relay_log_pos> master-bin.000001 Yes Yes 0 0 <read_master_log_pos> <relay_log_space1> None 0 No 0 No 0 0 1 No conservative 0 1073741824 7 0 60.000
+MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 <read_master_log_pos> relay-master@00202@002e2.000002 <relay_log_pos> master-bin.000001 Yes Yes 0 0 <read_master_log_pos> <relay_log_space2> None 0 No 0 No 0 0 2 No conservative 0 1073741824 7 0 60.000
include/wait_for_slave_to_start.inc
set default_master_connection = 'MASTER 2.2';
include/wait_for_slave_to_start.inc
set default_master_connection = '';
show all slaves status;
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
- Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 313 relay.000004 536 master-bin.000001 Yes Yes 0 0 313 823 None 0 No 0 No 0 0 1 No conservative 0 1073741824 6 0 60.000
-MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 313 relay-master@00202@002e2.000004 536 master-bin.000001 Yes Yes 0 0 313 842 None 0 No 0 No 0 0 2 No conservative 0 1073741824 6 0 60.000
+ Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 <read_master_log_pos> relay.000004 <relay_log_pos> master-bin.000001 Yes Yes 0 0 <read_master_log_pos> <relay_log_space1> None 0 No 0 No 0 0 1 No conservative 0 1073741824 6 0 60.000
+MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 <read_master_log_pos> relay-master@00202@002e2.000004 <relay_log_pos> master-bin.000001 Yes Yes 0 0 <read_master_log_pos> <relay_log_space2> None 0 No 0 No 0 0 2 No conservative 0 1073741824 6 0 60.000
#
# List of files matching '*info*' pattern
# after slave server restart
diff --git a/mysql-test/suite/multi_source/info_logs.test b/mysql-test/suite/multi_source/info_logs.test
index 569af8bd4a3..2f3b1934817 100644
--- a/mysql-test/suite/multi_source/info_logs.test
+++ b/mysql-test/suite/multi_source/info_logs.test
@@ -3,6 +3,7 @@
#
--source include/not_embedded.inc
+--source include/binlog_start_pos.inc
--let $rpl_server_count= 0
--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
@@ -136,8 +137,11 @@ let $field= Slave_IO_State;
let $condition= = 'Waiting for master to send event';
--source include/wait_show_condition.inc
-
---replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
+let read_master_log_pos=`select $binlog_start_pos + 65`;
+let relay_log_pos=`select 2*$binlog_start_pos + 105`;
+let relay_log_space1=`select 3*$binlog_start_pos + 144`;
+let relay_log_space2=`select 3*$binlog_start_pos + 163`;
+--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2 $read_master_log_pos <read_master_log_pos> $relay_log_pos <relay_log_pos> $relay_log_space1 <relay_log_space1> $relay_log_space2 <relay_log_space2>
show all slaves status;
# Restart the slave server
@@ -160,7 +164,10 @@ let $condition= = 'Waiting for master to send event';
--source include/wait_show_condition.inc
---replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
+let relay_log_pos=`select 2*$binlog_start_pos + 40`;
+let relay_log_space1=`select 3*$binlog_start_pos + 79`;
+let relay_log_space2=`select 3*$binlog_start_pos + 98`;
+--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2 $read_master_log_pos <read_master_log_pos> $relay_log_pos <relay_log_pos> $relay_log_space1 <relay_log_space1> $relay_log_space2 <relay_log_space2>
show all slaves status;
# Check the files
diff --git a/mysql-test/suite/multi_source/multisource.result b/mysql-test/suite/multi_source/multisource.result
index d9689f759bf..227e88f6d71 100644
--- a/mysql-test/suite/multi_source/multisource.result
+++ b/mysql-test/suite/multi_source/multisource.result
@@ -52,27 +52,27 @@ i f1
mysqld-relay-bin-master1.000001
mysqld-relay-bin-master1.000002
mysqld-relay-bin-master1.index
-show relaylog events;
+include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-mysqld-relay-bin-master1.000001 4 Format_desc 3 248 Server version
-mysqld-relay-bin-master1.000001 248 Rotate 3 306 mysqld-relay-bin-master1.000002;pos=4
-show relaylog events in 'mysqld-relay-bin-master1.000002';
+mysqld-relay-bin-master1.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+mysqld-relay-bin-master1.000001 # Rotate # # mysqld-relay-bin-master1.000002;pos=4
+include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-mysqld-relay-bin-master1.000002 4 Format_desc 3 248 Server version
-mysqld-relay-bin-master1.000002 248 Rotate 1 0 master-bin.000001;pos=4
-mysqld-relay-bin-master1.000002 292 Format_desc 1 248 Server version
-mysqld-relay-bin-master1.000002 536 Gtid_list 1 273 []
-mysqld-relay-bin-master1.000002 561 Binlog_checkpoint 1 313 master-bin.000001
-mysqld-relay-bin-master1.000002 601 Gtid 1 351 GTID 0-1-1
-mysqld-relay-bin-master1.000002 639 Query 1 440 drop database if exists db1
-mysqld-relay-bin-master1.000002 728 Gtid 1 478 GTID 0-1-2
-mysqld-relay-bin-master1.000002 766 Query 1 559 create database db1
-mysqld-relay-bin-master1.000002 847 Gtid 1 597 GTID 0-1-3
-mysqld-relay-bin-master1.000002 885 Query 1 750 use `db1`; create table t1 (i int auto_increment, f1 varchar(16), primary key pk (i,f1)) engine=MyISAM
-mysqld-relay-bin-master1.000002 1038 Gtid 1 788 BEGIN GTID 0-1-4
-mysqld-relay-bin-master1.000002 1076 Intvar 1 816 INSERT_ID=1
-mysqld-relay-bin-master1.000002 1104 Query 1 920 use `db1`; insert into t1 (f1) values ('one'),('two')
-mysqld-relay-bin-master1.000002 1208 Query 1 988 COMMIT
+mysqld-relay-bin-master1.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+mysqld-relay-bin-master1.000002 # Rotate # # master-bin.000001;pos=POS
+mysqld-relay-bin-master1.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+mysqld-relay-bin-master1.000002 # Gtid_list # # []
+mysqld-relay-bin-master1.000002 # Binlog_checkpoint # # master-bin.000001
+mysqld-relay-bin-master1.000002 # Gtid # # GTID #-#-#
+mysqld-relay-bin-master1.000002 # Query # # drop database if exists db1
+mysqld-relay-bin-master1.000002 # Gtid # # GTID #-#-#
+mysqld-relay-bin-master1.000002 # Query # # create database db1
+mysqld-relay-bin-master1.000002 # Gtid # # GTID #-#-#
+mysqld-relay-bin-master1.000002 # Query # # use `db1`; create table t1 (i int auto_increment, f1 varchar(16), primary key pk (i,f1)) engine=MyISAM
+mysqld-relay-bin-master1.000002 # Gtid # # BEGIN GTID #-#-#
+mysqld-relay-bin-master1.000002 # Intvar # # INSERT_ID=1
+mysqld-relay-bin-master1.000002 # Query # # use `db1`; insert into t1 (f1) values ('one'),('two')
+mysqld-relay-bin-master1.000002 # Query # # COMMIT
change master 'master1' to
master_port=MYPORT_2,
master_host='127.0.0.1',
@@ -138,7 +138,7 @@ flush logs;
purge binary logs to 'master-bin.000002';
show binary logs;
Log_name File_size
-master-bin.000002 367
+master-bin.000002 filesize
insert into t1 (f1) values ('four');
create table db1.t3 (f1 int) engine=InnoDB;
#
@@ -167,27 +167,27 @@ i f1
2 two
3 three
4 four
-show relaylog events;
+include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-mysqld-relay-bin.000001 4 Format_desc 3 248 Server version
-mysqld-relay-bin.000001 248 Rotate 3 298 mysqld-relay-bin.000002;pos=4
-show relaylog events in 'mysqld-relay-bin.000002';
+mysqld-relay-bin.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+mysqld-relay-bin.000001 # Rotate # # mysqld-relay-bin.000002;pos=4
+include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-mysqld-relay-bin.000002 4 Format_desc 3 248 Server version
-mysqld-relay-bin.000002 248 Rotate 2 0 master-bin.000001;pos=4
-mysqld-relay-bin.000002 292 Format_desc 2 248 Server version
-mysqld-relay-bin.000002 536 Gtid_list 2 273 []
-mysqld-relay-bin.000002 561 Binlog_checkpoint 2 313 master-bin.000001
-mysqld-relay-bin.000002 601 Gtid 2 351 GTID 0-2-1
-mysqld-relay-bin.000002 639 Query 2 440 drop database if exists db2
-mysqld-relay-bin.000002 728 Gtid 2 478 GTID 0-2-2
-mysqld-relay-bin.000002 766 Query 2 559 create database db2
-mysqld-relay-bin.000002 847 Gtid 2 597 GTID 0-2-3
-mysqld-relay-bin.000002 885 Query 2 732 use `db2`; create table t1 (pk int auto_increment primary key, f1 int) engine=InnoDB
-mysqld-relay-bin.000002 1020 Gtid 2 770 BEGIN GTID 0-2-4
-mysqld-relay-bin.000002 1058 Intvar 2 798 INSERT_ID=1
-mysqld-relay-bin.000002 1086 Query 2 894 use `db2`; insert into t1 (f1) values (1),(2)
-mysqld-relay-bin.000002 1182 Xid 2 921 COMMIT /* xid=<num> */
+mysqld-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+mysqld-relay-bin.000002 # Rotate # # master-bin.000001;pos=POS
+mysqld-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+mysqld-relay-bin.000002 # Gtid_list # # []
+mysqld-relay-bin.000002 # Binlog_checkpoint # # master-bin.000001
+mysqld-relay-bin.000002 # Gtid # # GTID #-#-#
+mysqld-relay-bin.000002 # Query # # drop database if exists db2
+mysqld-relay-bin.000002 # Gtid # # GTID #-#-#
+mysqld-relay-bin.000002 # Query # # create database db2
+mysqld-relay-bin.000002 # Gtid # # GTID #-#-#
+mysqld-relay-bin.000002 # Query # # use `db2`; create table t1 (pk int auto_increment primary key, f1 int) engine=InnoDB
+mysqld-relay-bin.000002 # Gtid # # BEGIN GTID #-#-#
+mysqld-relay-bin.000002 # Intvar # # INSERT_ID=1
+mysqld-relay-bin.000002 # Query # # use `db2`; insert into t1 (f1) values (1),(2)
+mysqld-relay-bin.000002 # Xid # # COMMIT /* XID */
stop slave io_thread;
show status like 'Slave_running';
Variable_name Value
diff --git a/mysql-test/suite/multi_source/multisource.test b/mysql-test/suite/multi_source/multisource.test
index c99db802981..de6874d6423 100644
--- a/mysql-test/suite/multi_source/multisource.test
+++ b/mysql-test/suite/multi_source/multisource.test
@@ -5,6 +5,7 @@
--source include/not_embedded.inc
--source include/have_innodb.inc
+--source include/binlog_start_pos.inc
--let $rpl_server_count= 0
--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
@@ -99,11 +100,11 @@ select * from db1.t1;
# Check that relay logs are recognizable
---replace_regex /Server ver:.*/Server version/ /xid=[0-9]+/xid=<num>/
-show relaylog events;
---replace_regex /Server ver:.*/Server version/ /xid=[0-9]+/xid=<num>/
-show relaylog events in 'mysqld-relay-bin-master1.000002';
-
+let binlog_start=4;
+let binlog_file=;
+source include/show_relaylog_events.inc;
+let binlog_file= mysqld-relay-bin-master1.000002;
+source include/show_relaylog_events.inc;
# Try to configure connection with the same name again,
# should get an error because the slave is running
@@ -221,6 +222,8 @@ flush logs;
--connection master1
purge binary logs to 'master-bin.000002';
+let filesize=`select $binlog_start_pos+119`;
+--replace_result $filesize filesize
show binary logs;
insert into t1 (f1) values ('four');
create table db1.t3 (f1 int) engine=InnoDB;
@@ -252,10 +255,10 @@ select * from db1.t1;
# This should show relay log events for the default master
# (the one with the empty name)
---replace_regex /Server ver:.*/Server version/ /xid=[0-9]+/xid=<num>/
-show relaylog events;
---replace_regex /Server ver:.*/Server version/ /xid=[0-9]+/xid=<num>/
-show relaylog events in 'mysqld-relay-bin.000002';
+let binlog_file=;
+source include/show_relaylog_events.inc;
+let binlog_file= mysqld-relay-bin.000002;
+source include/show_relaylog_events.inc;
# Make sure we don't lose control over replication connections
# after reconnecting to the slave
diff --git a/mysql-test/suite/multi_source/my.cnf b/mysql-test/suite/multi_source/my.cnf
index 826967b52f9..d98e6b62e29 100644
--- a/mysql-test/suite/multi_source/my.cnf
+++ b/mysql-test/suite/multi_source/my.cnf
@@ -17,6 +17,7 @@ server-id=3
log-warnings=2
[ENV]
+MASTER_MYPORT= @mysqld.1.port
SERVER_MYPORT_1= @mysqld.1.port
SERVER_MYSOCK_1= @mysqld.1.socket
SERVER_MYPORT_2= @mysqld.2.port
diff --git a/mysql-test/suite/multi_source/relaylog_events.result b/mysql-test/suite/multi_source/relaylog_events.result
index 970d7d20438..b96d71f4183 100644
--- a/mysql-test/suite/multi_source/relaylog_events.result
+++ b/mysql-test/suite/multi_source/relaylog_events.result
@@ -10,21 +10,21 @@ create table t1 (i int) engine=MyISAM;
mysqld-relay-bin-master1.000001
mysqld-relay-bin-master1.000002
mysqld-relay-bin-master1.index
-show relaylog events in 'mysqld-relay-bin-master1.000002';
+include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-mysqld-relay-bin-master1.000002 4 Format_desc 3 248 Server version
-mysqld-relay-bin-master1.000002 248 Rotate 1 0 master-bin.000001;pos=4
-mysqld-relay-bin-master1.000002 292 Format_desc 1 248 Server version
-mysqld-relay-bin-master1.000002 536 Gtid_list 1 273 []
-mysqld-relay-bin-master1.000002 561 Binlog_checkpoint 1 313 master-bin.000001
-mysqld-relay-bin-master1.000002 601 Gtid 1 351 GTID 0-1-1
-mysqld-relay-bin-master1.000002 639 Query 1 465 use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
-mysqld-relay-bin-master1.000002 753 Gtid 1 503 GTID 0-1-2
-mysqld-relay-bin-master1.000002 791 Query 1 603 use `test`; create table t1 (i int) engine=MyISAM
-show relaylog events;
+mysqld-relay-bin-master1.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+mysqld-relay-bin-master1.000002 # Rotate # # master-bin.000001;pos=POS
+mysqld-relay-bin-master1.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+mysqld-relay-bin-master1.000002 # Gtid_list # # []
+mysqld-relay-bin-master1.000002 # Binlog_checkpoint # # master-bin.000001
+mysqld-relay-bin-master1.000002 # Gtid # # GTID #-#-#
+mysqld-relay-bin-master1.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
+mysqld-relay-bin-master1.000002 # Gtid # # GTID #-#-#
+mysqld-relay-bin-master1.000002 # Query # # use `test`; create table t1 (i int) engine=MyISAM
+include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-mysqld-relay-bin-master1.000001 4 Format_desc 3 248 Server version
-mysqld-relay-bin-master1.000001 248 Rotate 3 306 mysqld-relay-bin-master1.000002;pos=4
+mysqld-relay-bin-master1.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+mysqld-relay-bin-master1.000001 # Rotate # # mysqld-relay-bin-master1.000002;pos=4
drop table t1;
include/reset_master_slave.inc
include/reset_master_slave.inc
diff --git a/mysql-test/suite/multi_source/relaylog_events.test b/mysql-test/suite/multi_source/relaylog_events.test
index a59dd706b94..18e92c32e8e 100644
--- a/mysql-test/suite/multi_source/relaylog_events.test
+++ b/mysql-test/suite/multi_source/relaylog_events.test
@@ -31,10 +31,11 @@ create table t1 (i int) engine=MyISAM;
--let $datadir = `SELECT @@datadir`
--list_files $datadir mysqld-relay-bin-master1.*
---replace_regex /Server ver:.*/Server version/
-show relaylog events in 'mysqld-relay-bin-master1.000002';
---replace_regex /Server ver:.*/Server version/
-show relaylog events;
+let binlog_start=4;
+let binlog_file= mysqld-relay-bin-master1.000002;
+source include/show_relaylog_events.inc;
+let binlog_file=;
+source include/show_relaylog_events.inc;
--connection master1
drop table t1;
diff --git a/mysql-test/suite/multi_source/reset_slave.result b/mysql-test/suite/multi_source/reset_slave.result
index 5e28047945d..6a9dbcdc561 100644
--- a/mysql-test/suite/multi_source/reset_slave.result
+++ b/mysql-test/suite/multi_source/reset_slave.result
@@ -11,14 +11,14 @@ insert into t1 values (1),(2);
stop slave 'master1';
show slave 'master1' status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode
- 127.0.0.1 root MYPORT_1 60 master-bin.000001 802 mysqld-relay-bin-master1.000002 1090 master-bin.000001 No No 0 0 802 1396 None 0 No NULL No 0 0 1 No conservative
+ 127.0.0.1 root MYPORT_1 60 master-bin.000001 <read_master_log_pos> mysqld-relay-bin-master1.000002 <relay_log_pos> master-bin.000001 No No 0 0 <read_master_log_pos> <relay_log_space> None 0 No NULL No 0 0 1 No conservative
mysqld-relay-bin-master1.000001
mysqld-relay-bin-master1.000002
mysqld-relay-bin-master1.index
reset slave 'master1';
show slave 'master1' status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode
- 127.0.0.1 root MYPORT_1 60 4 1090 No No 0 0 0 1396 None 0 No NULL No 0 0 1 No conservative
+ 127.0.0.1 root MYPORT_1 60 4 <relay_log_pos> No No 0 0 0 <relay_log_space> None 0 No NULL No 0 0 1 No conservative
reset slave 'master1' all;
show slave 'master1' status;
ERROR HY000: There is no master connection 'master1'
diff --git a/mysql-test/suite/multi_source/reset_slave.test b/mysql-test/suite/multi_source/reset_slave.test
index 108941c0d1a..ebbc33e4c22 100644
--- a/mysql-test/suite/multi_source/reset_slave.test
+++ b/mysql-test/suite/multi_source/reset_slave.test
@@ -3,6 +3,7 @@
#
--source include/not_embedded.inc
+--source include/binlog_start_pos.inc
--let $rpl_server_count= 0
--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
@@ -38,13 +39,16 @@ stop slave 'master1';
--let $datadir = `SELECT @@datadir`
---replace_result $SERVER_MYPORT_1 MYPORT_1
+let read_master_log_pos=`select $binlog_start_pos + 554`;
+let relay_log_pos=`select 2*$binlog_start_pos + 594`;
+let relay_log_space=`select 3*$binlog_start_pos + 652`;
+--replace_result $SERVER_MYPORT_1 MYPORT_1 $read_master_log_pos <read_master_log_pos> $relay_log_pos <relay_log_pos> $relay_log_space <relay_log_space>
show slave 'master1' status;
--list_files $datadir mysqld*
reset slave 'master1';
---replace_result $SERVER_MYPORT_1 MYPORT_1
+--replace_result $SERVER_MYPORT_1 MYPORT_1 $relay_log_pos <relay_log_pos> $relay_log_space <relay_log_space>
show slave 'master1' status;
--list_files $datadir mysqld*
diff --git a/mysql-test/suite/multi_source/simple.result b/mysql-test/suite/multi_source/simple.result
index 405e60c28fe..3bf25e8d788 100644
--- a/mysql-test/suite/multi_source/simple.result
+++ b/mysql-test/suite/multi_source/simple.result
@@ -11,8 +11,8 @@ include/wait_for_slave_to_start.inc
set default_master_connection = '';
show all slaves status;
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
-slave1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 313 mysqld-relay-bin-slave1.000002 601 master-bin.000001 Yes Yes 0 0 313 906 None 0 No 0 No 0 0 1 No conservative 0 1073741824 7 0 60.000
-slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 313 mysqld-relay-bin-slave2.000002 601 master-bin.000001 Yes Yes 0 0 313 906 None 0 No 0 No 0 0 2 No conservative 0 1073741824 7 0 60.000
+slave1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 <read_master_log_pos> mysqld-relay-bin-slave1.000002 <relay_log_pos> master-bin.000001 Yes Yes 0 0 <read_master_log_pos> <relay_log_space1> None 0 No 0 No 0 0 1 No conservative 0 1073741824 7 0 60.000
+slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 <read_master_log_pos> mysqld-relay-bin-slave2.000002 <relay_log_pos> master-bin.000001 Yes Yes 0 0 <read_master_log_pos> <relay_log_space1> None 0 No 0 No 0 0 2 No conservative 0 1073741824 7 0 60.000
start all slaves;
stop slave 'slave1';
show slave 'slave1' status;
@@ -22,9 +22,9 @@ Master_User root
Master_Port MYPORT_1
Connect_Retry 60
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 313
+Read_Master_Log_Pos <read_master_log_pos>
Relay_Log_File mysqld-relay-bin-slave1.000002
-Relay_Log_Pos 601
+Relay_Log_Pos <relay_log_pos>
Relay_Master_Log_File master-bin.000001
Slave_IO_Running No
Slave_SQL_Running No
@@ -37,8 +37,8 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 313
-Relay_Log_Space 906
+Exec_Master_Log_Pos <read_master_log_pos>
+Relay_Log_Space <relay_log_space1>
Until_Condition None
Until_Log_File
Until_Log_Pos 0
@@ -66,18 +66,18 @@ Parallel_Mode conservative
reset slave 'slave1';
show all slaves status;
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
-slave1 127.0.0.1 root MYPORT_1 60 4 601 No No 0 0 0 906 None 0 No NULL No 0 0 1 No conservative 0 1073741824 7 0 60.000
-slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 313 mysqld-relay-bin-slave2.000002 601 master-bin.000001 Yes Yes 0 0 313 906 None 0 No 0 No 0 0 2 No conservative 0 1073741824 7 0 60.000
+slave1 127.0.0.1 root MYPORT_1 60 4 <relay_log_pos> No No 0 0 0 <relay_log_space1> None 0 No NULL No 0 0 1 No conservative 0 1073741824 7 0 60.000
+slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 <read_master_log_pos> mysqld-relay-bin-slave2.000002 <relay_log_pos> master-bin.000001 Yes Yes 0 0 <read_master_log_pos> <relay_log_space1> None 0 No 0 No 0 0 2 No conservative 0 1073741824 7 0 60.000
reset slave 'slave1' all;
show all slaves status;
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
-slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 313 mysqld-relay-bin-slave2.000002 601 master-bin.000001 Yes Yes 0 0 313 906 None 0 No 0 No 0 0 2 No conservative 0 1073741824 7 0 60.000
+slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 <read_master_log_pos> mysqld-relay-bin-slave2.000002 <relay_log_pos> master-bin.000001 Yes Yes 0 0 <read_master_log_pos> <relay_log_space1> None 0 No 0 No 0 0 2 No conservative 0 1073741824 7 0 60.000
stop all slaves;
Warnings:
Note 1938 SLAVE 'slave2' stopped
show all slaves status;
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
-slave2 127.0.0.1 root MYPORT_2 60 master-bin.000001 313 mysqld-relay-bin-slave2.000002 601 master-bin.000001 No No 0 0 313 906 None 0 No NULL No 0 0 2 No conservative 0 1073741824 7 0 60.000
+slave2 127.0.0.1 root MYPORT_2 60 master-bin.000001 <read_master_log_pos> mysqld-relay-bin-slave2.000002 <relay_log_pos> master-bin.000001 No No 0 0 <read_master_log_pos> <relay_log_space1> None 0 No NULL No 0 0 2 No conservative 0 1073741824 7 0 60.000
stop all slaves;
include/reset_master_slave.inc
include/reset_master_slave.inc
diff --git a/mysql-test/suite/multi_source/simple.test b/mysql-test/suite/multi_source/simple.test
index 6108d3043d5..c990a04acb0 100644
--- a/mysql-test/suite/multi_source/simple.test
+++ b/mysql-test/suite/multi_source/simple.test
@@ -3,6 +3,7 @@
#
--source include/not_embedded.inc
+--source include/binlog_start_pos.inc
--let $rpl_server_count= 0
--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
@@ -40,7 +41,11 @@ let $condition = = 7;
let $wait_for_all = 1;
--source include/wait_show_condition.inc
---replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
+let read_master_log_pos=`select $binlog_start_pos + 65`;
+let relay_log_pos=`select 2*$binlog_start_pos + 105`;
+let relay_log_space1=`select 3*$binlog_start_pos + 162`;
+let relay_log_space2=`select 3*$binlog_start_pos + 162`;
+--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2 $read_master_log_pos <read_master_log_pos> $relay_log_pos <relay_log_pos> $relay_log_space1 <relay_log_space1> $relay_log_space2 <relay_log_space2>
show all slaves status;
# Ensure that start all slaves doesn't do anything as all slaves are started
@@ -48,19 +53,19 @@ start all slaves;
stop slave 'slave1';
---replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
+--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2 $read_master_log_pos <read_master_log_pos> $relay_log_pos <relay_log_pos> $relay_log_space1 <relay_log_space1> $relay_log_space2 <relay_log_space2>
query_vertical show slave 'slave1' status;
reset slave 'slave1';
---replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
+--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2 $read_master_log_pos <read_master_log_pos> $relay_log_pos <relay_log_pos> $relay_log_space1 <relay_log_space1> $relay_log_space2 <relay_log_space2>
show all slaves status;
reset slave 'slave1' all;
---replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
+--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2 $read_master_log_pos <read_master_log_pos> $relay_log_pos <relay_log_pos> $relay_log_space1 <relay_log_space1> $relay_log_space2 <relay_log_space2>
show all slaves status;
stop all slaves;
---replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
+--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2 $read_master_log_pos <read_master_log_pos> $relay_log_pos <relay_log_pos> $relay_log_space1 <relay_log_space1> $relay_log_space2 <relay_log_space2>
show all slaves status;
# Ensure that start all slaves doesn't do anything as all slaves are stopped
diff --git a/mysql-test/suite/ndb/r/ndb_restore_discover.result b/mysql-test/suite/ndb/r/ndb_restore_discover.result
new file mode 100644
index 00000000000..de10af87047
--- /dev/null
+++ b/mysql-test/suite/ndb/r/ndb_restore_discover.result
@@ -0,0 +1,33 @@
+#
+# 18075170 - sql node restart required to avoid deadlock after
+# restore
+#
+CREATE TABLE t1 (id INT) ENGINE=NDBCluster;
+CREATE TABLE t2 (id INT) ENGINE=NDBCluster;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+DROP TABLE t1;
+DROP TABLE t2;
+SET autocommit = 0;
+SELECT * FROM t1;
+id
+1
+SELECT * FROM t2;
+id
+1
+ROLLBACK;
+SET autocommit = 1;
+drop table t1;
+drop table t2;
+SET autocommit = 0;
+SELECT * FROM t1;
+id
+1
+SELECT * FROM t2;
+id
+1
+ALTER TABLE t1 ADD val INT;
+ROLLBACK;
+SET autocommit = 1;
+drop table t1;
+drop table t2;
diff --git a/mysql-test/suite/ndb/t/ndb_restore_discover.test b/mysql-test/suite/ndb/t/ndb_restore_discover.test
new file mode 100644
index 00000000000..6631c74d5c8
--- /dev/null
+++ b/mysql-test/suite/ndb/t/ndb_restore_discover.test
@@ -0,0 +1,70 @@
+-- source include/have_ndb.inc
+-- source include/count_sessions.inc
+
+--echo #
+--echo # 18075170 - sql node restart required to avoid deadlock after
+--echo # restore
+--echo #
+# Test Auto Discover option within a transaction
+# and make sure the transaction is not broken.
+CREATE TABLE t1 (id INT) ENGINE=NDBCluster;
+CREATE TABLE t2 (id INT) ENGINE=NDBCluster;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+-- source include/ndb_backup.inc
+
+DROP TABLE t1;
+DROP TABLE t2;
+
+-- source include/ndb_restore_master.inc
+
+SET autocommit = 0;
+SELECT * FROM t1;
+
+# Without fix below select was resulting in DEADLOCK error. With fix select
+# should succeed.
+SELECT * FROM t2;
+ROLLBACK;
+SET autocommit = 1;
+
+drop table t1;
+drop table t2;
+
+#
+# Checking lock preservation in transaction
+#
+# Using existing backup to create the scenario. Tables are deleted as part of
+# above test cleanup. Thus restoring the backup will bring the system to
+# required state.
+-- source include/ndb_restore_master.inc
+
+SET autocommit = 0;
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+connect(con2, localhost, root);
+--SEND ALTER TABLE t1 ADD val INT
+
+connection default;
+# Alter from con2 will be in waiting state as there is a lock on t1 from
+# default connection due to active transaction. We check for this condition
+# then releasing the lock by rollbacking active transaction.
+let $wait_condition=
+ SELECT count(*) = 1 FROM information_schema.processlist WHERE state
+ LIKE "Waiting%" AND info = "ALTER TABLE t1 ADD val INT";
+--source include/wait_condition.inc
+ROLLBACK;
+SET autocommit = 1;
+
+connection con2;
+--REAP
+
+disconnect con2;
+connection default;
+drop table t1;
+drop table t2;
+
+# Wait till all disconnects are completed
+-- source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result
index 4586fe84d2d..e4fdf0d03a7 100644
--- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result
@@ -247,6 +247,8 @@ UNLOCK TABLES;
select * from `table5` where (col2 <= '6566-06-15' AND col24 <> 'd') group by `col83` order by `col83` desc ;
col0 col1 col2 col3 col4 col5 col6 col7 col8 col9 col10 col11 col12 col13 col14 col15 col16 col17 col18 col19 col20 col21 col22 col23 col24 col25 col26 col27 col28 col29 col30 col31 col32 col33 col34 col35 col36 col37 col38 col39 col40 col41 col42 col43 col44 col45 col46 col47 col48 col49 col50 col51 col52 col53 col54 col55 col56 col57 col58 col59 col60 col61 col62 col63 col64 col65 col66 col67 col68 col69 col70 col71 col72 col73 col74 col75 col76 col77 col78 col79 col80 col81 col82 col83 col84 col85 col86 col87 col88 col89 col90 col91 col92 col93 col94 col95 col96 col97 col98 col99 col100 col101 col102 col103 col104 col105 col106 col107 col108 col109 col110 col111 col112 col113 col114 col115 col116 col117 col118 col119 col120 col121 col122 col123 col124 col125 col126 col127 col128 col129 col130 col131 col132 col133 col134 col135 col136 col137 col138 col139 col140 col141 col142 col143 col144 col145 col146 col147 col148 col149 col150 col151 col152 col153 col154 col155 col156 col157 col158 col159 col160 col161 col162 col163 col164 col165 col166 col167 col168 col169 col170 col171 col172 col173 col174 col175
Warnings:
-Warning 1366 Incorrect decimal value: 'd' for column 'col24' at row 1
-Warning 1366 Incorrect decimal value: 'd' for column 'col24' at row 1
+Warning 1292 Truncated incorrect DOUBLE value: 'd'
+Warning 1292 Truncated incorrect DOUBLE value: 'd'
+Warning 1292 Truncated incorrect DOUBLE value: 'd'
+Warning 1292 Truncated incorrect DOUBLE value: 'd'
drop table `table5`;
diff --git a/mysql-test/suite/parts/inc/partition.pre b/mysql-test/suite/parts/inc/partition.pre
index a78d80be20e..0fae04dddd4 100644
--- a/mysql-test/suite/parts/inc/partition.pre
+++ b/mysql-test/suite/parts/inc/partition.pre
@@ -104,8 +104,8 @@ let $insert_all= INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
# Column list with definition for all tables to be checked
-let $column_list= f_int1 INTEGER,
-f_int2 INTEGER,
+let $column_list= f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000);
diff --git a/mysql-test/suite/parts/inc/partition_auto_increment.inc b/mysql-test/suite/parts/inc/partition_auto_increment.inc
index 45406bd145a..e3a8d681275 100644
--- a/mysql-test/suite/parts/inc/partition_auto_increment.inc
+++ b/mysql-test/suite/parts/inc/partition_auto_increment.inc
@@ -3,6 +3,9 @@
# auto_increment test
# used variables: $engine
#
+--disable_query_log
+set sql_mode="";
+--enable_query_log
-- disable_warnings
DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result b/mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result
index 00ef7527059..34fcba6ae87 100644
--- a/mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -48,8 +48,8 @@ SET @@session.sql_mode= '';
# 1.2.1 PRIMARY KEY consisting of two columns
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -540,8 +540,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1032,8 +1032,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1539,8 +1539,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2040,8 +2040,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2539,8 +2539,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3049,8 +3049,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3561,8 +3561,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4062,8 +4062,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4554,8 +4554,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5046,8 +5046,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5553,8 +5553,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6054,8 +6054,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6553,8 +6553,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7063,8 +7063,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7575,8 +7575,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8077,8 +8077,8 @@ DROP TABLE t1;
# 1.2.2 UNIQUE INDEX consisting of two columns
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8097,8 +8097,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -8585,8 +8585,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8605,8 +8605,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -9093,8 +9093,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9121,8 +9121,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -9616,8 +9616,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9642,8 +9642,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -10133,8 +10133,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10157,8 +10157,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -10648,8 +10648,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10676,8 +10676,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -11174,8 +11174,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11202,8 +11202,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -11702,8 +11702,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11726,8 +11726,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -12219,8 +12219,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12239,8 +12239,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -12727,8 +12727,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12747,8 +12747,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -13235,8 +13235,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13263,8 +13263,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -13758,8 +13758,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13784,8 +13784,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -14275,8 +14275,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14299,8 +14299,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -14790,8 +14790,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14818,8 +14818,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -15316,8 +15316,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15344,8 +15344,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -15844,8 +15844,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15868,8 +15868,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -16362,8 +16362,8 @@ DROP TABLE t1;
# 1.2.3 PRIMARY KEY and UNIQUE INDEX consisting of two columns
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16855,8 +16855,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17348,8 +17348,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17856,8 +17856,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18358,8 +18358,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18858,8 +18858,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19369,8 +19369,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19882,8 +19882,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -20384,8 +20384,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -20877,8 +20877,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -21370,8 +21370,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -21878,8 +21878,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -22380,8 +22380,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -22880,8 +22880,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -23391,8 +23391,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -23904,8 +23904,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -24406,8 +24406,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -24899,8 +24899,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -25392,8 +25392,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -25900,8 +25900,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -26402,8 +26402,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -26902,8 +26902,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -27413,8 +27413,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -27926,8 +27926,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
diff --git a/mysql-test/suite/parts/r/partition_alter1_1_2_myisam.result b/mysql-test/suite/parts/r/partition_alter1_1_2_myisam.result
index bc737289895..018bc4e9287 100644
--- a/mysql-test/suite/parts/r/partition_alter1_1_2_myisam.result
+++ b/mysql-test/suite/parts/r/partition_alter1_1_2_myisam.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -48,8 +48,8 @@ SET @@session.sql_mode= '';
# 1.2.2 UNIQUE INDEX consisting of two columns
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -68,8 +68,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -565,8 +565,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -585,8 +585,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -1088,8 +1088,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1116,8 +1116,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -1632,8 +1632,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1658,8 +1658,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -2166,8 +2166,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2190,8 +2190,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -2702,8 +2702,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2730,8 +2730,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -3249,8 +3249,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3277,8 +3277,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -3798,8 +3798,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3822,8 +3822,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -4338,8 +4338,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4358,8 +4358,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -4855,8 +4855,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4875,8 +4875,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -5378,8 +5378,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5406,8 +5406,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -5922,8 +5922,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5948,8 +5948,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -6456,8 +6456,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6480,8 +6480,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -6992,8 +6992,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7020,8 +7020,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -7539,8 +7539,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7567,8 +7567,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -8088,8 +8088,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8112,8 +8112,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
diff --git a/mysql-test/suite/parts/r/partition_alter1_1_innodb.result b/mysql-test/suite/parts/r/partition_alter1_1_innodb.result
index 0a7b284a15c..c05abfbcaed 100644
--- a/mysql-test/suite/parts/r/partition_alter1_1_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter1_1_innodb.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -47,8 +47,8 @@ SET @@session.sql_mode= '';
#------------------------------------------------------------------------
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -62,8 +62,8 @@ ALTER TABLE t1 ADD PRIMARY KEY(f_int2);
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -77,8 +77,8 @@ ALTER TABLE t1 ADD PRIMARY KEY(f_int2);
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -100,8 +100,8 @@ ALTER TABLE t1 ADD PRIMARY KEY(f_int2);
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -121,8 +121,8 @@ ALTER TABLE t1 ADD PRIMARY KEY(f_int2);
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -140,8 +140,8 @@ ALTER TABLE t1 ADD PRIMARY KEY(f_int2);
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -163,8 +163,8 @@ ALTER TABLE t1 ADD PRIMARY KEY(f_int2);
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -186,8 +186,8 @@ ALTER TABLE t1 ADD PRIMARY KEY(f_int2);
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -206,8 +206,8 @@ ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -221,8 +221,8 @@ ALTER TABLE t1 ADD UNIQUE INDEX uidx1 (f_int2);
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -236,8 +236,8 @@ ALTER TABLE t1 ADD UNIQUE INDEX uidx1 (f_int2);
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -259,8 +259,8 @@ ALTER TABLE t1 ADD UNIQUE INDEX uidx1 (f_int2);
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -280,8 +280,8 @@ ALTER TABLE t1 ADD UNIQUE INDEX uidx1 (f_int2);
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -299,8 +299,8 @@ ALTER TABLE t1 ADD UNIQUE INDEX uidx1 (f_int2);
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -322,8 +322,8 @@ ALTER TABLE t1 ADD UNIQUE INDEX uidx1 (f_int2);
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -345,8 +345,8 @@ ALTER TABLE t1 ADD UNIQUE INDEX uidx1 (f_int2);
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -366,8 +366,8 @@ DROP TABLE t1;
# 1.1.3 PRIMARY KEY consisting of two columns
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -858,8 +858,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1350,8 +1350,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1857,8 +1857,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2358,8 +2358,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2859,8 +2859,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3369,8 +3369,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3881,8 +3881,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4382,8 +4382,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4874,8 +4874,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5366,8 +5366,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5873,8 +5873,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6374,8 +6374,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6875,8 +6875,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7385,8 +7385,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7897,8 +7897,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8399,8 +8399,8 @@ DROP TABLE t1;
# 1.1.4 UNIQUE INDEX consisting of two columns
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8419,8 +8419,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -8907,8 +8907,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8927,8 +8927,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -9415,8 +9415,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9443,8 +9443,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -9938,8 +9938,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9964,8 +9964,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -10455,8 +10455,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10479,8 +10479,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -10972,8 +10972,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11000,8 +11000,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -11498,8 +11498,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11526,8 +11526,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -12026,8 +12026,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12050,8 +12050,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -12543,8 +12543,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12563,8 +12563,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -13051,8 +13051,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13071,8 +13071,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -13559,8 +13559,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13587,8 +13587,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -14082,8 +14082,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14108,8 +14108,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -14599,8 +14599,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14623,8 +14623,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -15116,8 +15116,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15144,8 +15144,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -15642,8 +15642,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15670,8 +15670,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -16170,8 +16170,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16194,8 +16194,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
diff --git a/mysql-test/suite/parts/r/partition_alter1_1_myisam.result b/mysql-test/suite/parts/r/partition_alter1_1_myisam.result
index 26450b28620..514afd88a20 100644
--- a/mysql-test/suite/parts/r/partition_alter1_1_myisam.result
+++ b/mysql-test/suite/parts/r/partition_alter1_1_myisam.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -47,8 +47,8 @@ SET @@session.sql_mode= '';
#------------------------------------------------------------------------
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -62,8 +62,8 @@ ALTER TABLE t1 ADD UNIQUE INDEX uidx1 (f_int2);
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -77,8 +77,8 @@ ALTER TABLE t1 ADD UNIQUE INDEX uidx1 (f_int2);
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -100,8 +100,8 @@ ALTER TABLE t1 ADD UNIQUE INDEX uidx1 (f_int2);
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -121,8 +121,8 @@ ALTER TABLE t1 ADD UNIQUE INDEX uidx1 (f_int2);
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -140,8 +140,8 @@ ALTER TABLE t1 ADD UNIQUE INDEX uidx1 (f_int2);
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -163,8 +163,8 @@ ALTER TABLE t1 ADD UNIQUE INDEX uidx1 (f_int2);
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -186,8 +186,8 @@ ALTER TABLE t1 ADD UNIQUE INDEX uidx1 (f_int2);
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -207,8 +207,8 @@ DROP TABLE t1;
# 1.1.4 UNIQUE INDEX consisting of two columns
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -227,8 +227,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -724,8 +724,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -744,8 +744,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -1247,8 +1247,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1275,8 +1275,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -1791,8 +1791,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1817,8 +1817,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -2325,8 +2325,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2349,8 +2349,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -2863,8 +2863,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2891,8 +2891,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -3410,8 +3410,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3438,8 +3438,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -3959,8 +3959,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3983,8 +3983,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -4499,8 +4499,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4519,8 +4519,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -5016,8 +5016,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5036,8 +5036,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -5539,8 +5539,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5567,8 +5567,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -6083,8 +6083,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6109,8 +6109,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -6617,8 +6617,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6641,8 +6641,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -7155,8 +7155,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7183,8 +7183,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -7702,8 +7702,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7730,8 +7730,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -8251,8 +8251,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8275,8 +8275,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
diff --git a/mysql-test/suite/parts/r/partition_alter1_2_innodb.result b/mysql-test/suite/parts/r/partition_alter1_2_innodb.result
index 22d24bd50fe..8ab37aafcbe 100644
--- a/mysql-test/suite/parts/r/partition_alter1_2_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter1_2_innodb.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -47,8 +47,8 @@ SET @@session.sql_mode= '';
# 2.1.5 DROP PRIMARY KEY + UNIQUE INDEX consisting of two columns
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -487,8 +487,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -927,8 +927,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1382,8 +1382,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1831,8 +1831,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2280,8 +2280,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2738,8 +2738,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3198,8 +3198,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3647,8 +3647,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4087,8 +4087,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4527,8 +4527,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4982,8 +4982,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5431,8 +5431,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5880,8 +5880,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6338,8 +6338,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6798,8 +6798,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7247,8 +7247,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7267,8 +7267,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -7703,8 +7703,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7723,8 +7723,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -8159,8 +8159,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8187,8 +8187,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -8630,8 +8630,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8656,8 +8656,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -9095,8 +9095,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9119,8 +9119,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -9560,8 +9560,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9588,8 +9588,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -10034,8 +10034,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10062,8 +10062,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -10510,8 +10510,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10534,8 +10534,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -10979,8 +10979,8 @@ DROP TABLE t1;
# 2.2.1 DROP PRIMARY KEY consisting of two columns
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11419,8 +11419,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11859,8 +11859,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12314,8 +12314,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12763,8 +12763,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13210,8 +13210,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13668,8 +13668,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14128,8 +14128,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14577,8 +14577,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15017,8 +15017,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15457,8 +15457,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15912,8 +15912,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16361,8 +16361,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16808,8 +16808,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17266,8 +17266,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17726,8 +17726,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18176,8 +18176,8 @@ DROP TABLE t1;
# 2.2.2 DROP UNIQUE INDEX consisting of two columns
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18196,8 +18196,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -18632,8 +18632,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18652,8 +18652,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -19088,8 +19088,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19116,8 +19116,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -19559,8 +19559,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19585,8 +19585,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -20024,8 +20024,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -20048,8 +20048,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -20487,8 +20487,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -20515,8 +20515,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -20961,8 +20961,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -20989,8 +20989,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -21437,8 +21437,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -21461,8 +21461,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -21902,8 +21902,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -21922,8 +21922,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -22358,8 +22358,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -22378,8 +22378,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -22814,8 +22814,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -22842,8 +22842,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -23285,8 +23285,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -23311,8 +23311,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -23750,8 +23750,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -23774,8 +23774,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -24213,8 +24213,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -24241,8 +24241,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -24687,8 +24687,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -24715,8 +24715,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -25163,8 +25163,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -25187,8 +25187,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -25629,8 +25629,8 @@ DROP TABLE t1;
# 2.2.3 DROP PRIMARY KEY + UNIQUE INDEX consisting of two columns
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -26069,8 +26069,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -26509,8 +26509,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -26964,8 +26964,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -27413,8 +27413,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -27860,8 +27860,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -28318,8 +28318,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -28778,8 +28778,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -29227,8 +29227,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -29667,8 +29667,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -30107,8 +30107,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -30562,8 +30562,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -31011,8 +31011,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -31458,8 +31458,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -31916,8 +31916,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -32376,8 +32376,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -32825,8 +32825,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -32845,8 +32845,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -33281,8 +33281,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -33301,8 +33301,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -33737,8 +33737,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -33765,8 +33765,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -34208,8 +34208,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -34234,8 +34234,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -34673,8 +34673,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -34697,8 +34697,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -35136,8 +35136,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -35164,8 +35164,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -35610,8 +35610,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -35638,8 +35638,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -36086,8 +36086,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -36110,8 +36110,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
diff --git a/mysql-test/suite/parts/r/partition_alter1_2_myisam.result b/mysql-test/suite/parts/r/partition_alter1_2_myisam.result
index 72545e89bae..d998e264522 100644
--- a/mysql-test/suite/parts/r/partition_alter1_2_myisam.result
+++ b/mysql-test/suite/parts/r/partition_alter1_2_myisam.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -46,8 +46,8 @@ SET @@session.sql_mode= '';
#------------------------------------------------------------------------
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -66,8 +66,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -511,8 +511,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -531,8 +531,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -982,8 +982,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1010,8 +1010,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -1474,8 +1474,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1500,8 +1500,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -1956,8 +1956,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1980,8 +1980,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -2442,8 +2442,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2470,8 +2470,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -2937,8 +2937,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2965,8 +2965,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -3434,8 +3434,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3458,8 +3458,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -3926,8 +3926,8 @@ DROP TABLE t1;
# 2.2.2 DROP UNIQUE INDEX consisting of two columns
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3946,8 +3946,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -4391,8 +4391,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4411,8 +4411,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -4862,8 +4862,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4890,8 +4890,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -5354,8 +5354,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5380,8 +5380,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -5836,8 +5836,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5860,8 +5860,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -6320,8 +6320,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6348,8 +6348,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -6815,8 +6815,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6843,8 +6843,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -7312,8 +7312,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7336,8 +7336,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -7800,8 +7800,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7820,8 +7820,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -8265,8 +8265,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8285,8 +8285,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -8736,8 +8736,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8764,8 +8764,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -9228,8 +9228,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9254,8 +9254,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -9710,8 +9710,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9734,8 +9734,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -10194,8 +10194,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10222,8 +10222,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -10689,8 +10689,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10717,8 +10717,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -11186,8 +11186,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11210,8 +11210,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -11674,8 +11674,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11694,8 +11694,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -12139,8 +12139,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12159,8 +12159,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -12610,8 +12610,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12638,8 +12638,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -13102,8 +13102,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13128,8 +13128,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -13584,8 +13584,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13608,8 +13608,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -14068,8 +14068,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14096,8 +14096,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -14563,8 +14563,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14591,8 +14591,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -15060,8 +15060,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15084,8 +15084,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
diff --git a/mysql-test/suite/parts/r/partition_alter2_1_1_innodb.result b/mysql-test/suite/parts/r/partition_alter2_1_1_innodb.result
index f3d5314643b..efc81603b5a 100644
--- a/mysql-test/suite/parts/r/partition_alter2_1_1_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter2_1_1_innodb.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -48,8 +48,8 @@ SET @@session.sql_mode= '';
# 1.1.1 no PRIMARY KEY or UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -68,7 +68,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -504,8 +504,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -524,7 +524,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -960,8 +960,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -988,7 +988,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -1431,8 +1431,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1457,7 +1457,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -1896,8 +1896,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1920,7 +1920,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -2361,8 +2361,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2389,7 +2389,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -2835,8 +2835,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2863,7 +2863,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -3311,8 +3311,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3335,7 +3335,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -3777,8 +3777,8 @@ DROP TABLE t1;
# 1.1.2 PRIMARY KEY exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3798,7 +3798,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -4237,6 +4237,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -4269,8 +4271,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4290,7 +4292,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -4729,6 +4731,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -4761,8 +4765,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4790,7 +4794,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -5236,6 +5240,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -5268,8 +5274,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5295,7 +5301,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -5737,6 +5743,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -5769,8 +5777,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5794,7 +5802,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -6238,6 +6246,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -6270,8 +6280,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6299,7 +6309,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -6748,6 +6758,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -6780,8 +6792,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6809,7 +6821,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -7260,6 +7272,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -7292,8 +7306,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7317,7 +7331,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -7760,6 +7774,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -7793,8 +7809,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7814,7 +7830,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -8253,6 +8269,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -8285,8 +8303,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8306,7 +8324,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -8745,6 +8763,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -8777,8 +8797,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8806,7 +8826,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -9252,6 +9272,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -9284,8 +9306,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9311,7 +9333,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -9753,6 +9775,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -9785,8 +9809,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9810,7 +9834,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -10254,6 +10278,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -10286,8 +10312,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10315,7 +10341,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -10764,6 +10790,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -10796,8 +10824,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10825,7 +10853,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -11276,6 +11304,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -11308,8 +11338,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11333,7 +11363,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -11776,6 +11806,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -11810,8 +11842,8 @@ DROP TABLE t1;
# 1.1.3 UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11830,7 +11862,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -12318,8 +12350,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12338,7 +12370,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -12826,8 +12858,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12854,7 +12886,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -13349,8 +13381,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13375,7 +13407,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -13866,8 +13898,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13890,7 +13922,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -14383,8 +14415,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14411,7 +14443,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -14909,8 +14941,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14937,7 +14969,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -15437,8 +15469,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15461,7 +15493,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -15954,8 +15986,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15974,7 +16006,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -16462,8 +16494,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16482,7 +16514,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -16970,8 +17002,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16998,7 +17030,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -17493,8 +17525,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17519,7 +17551,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -18010,8 +18042,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18034,7 +18066,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -18527,8 +18559,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18555,7 +18587,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -19053,8 +19085,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19081,7 +19113,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -19581,8 +19613,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19605,7 +19637,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
diff --git a/mysql-test/suite/parts/r/partition_alter2_1_2_innodb.result b/mysql-test/suite/parts/r/partition_alter2_1_2_innodb.result
index eb662109cea..769abc32dff 100644
--- a/mysql-test/suite/parts/r/partition_alter2_1_2_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter2_1_2_innodb.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -44,8 +44,8 @@ SET @@session.sql_mode= '';
# 1.3.1 no PRIMARY KEY or UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -500,8 +500,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -956,8 +956,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1427,8 +1427,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1892,8 +1892,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2355,8 +2355,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2829,8 +2829,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3305,8 +3305,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3771,8 +3771,8 @@ DROP TABLE t1;
# 1.3.2 PRIMARY KEY exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3791,8 +3791,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` bigint(20) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int1` bigint(20) NOT NULL,
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -4231,6 +4231,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -4263,8 +4266,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4283,8 +4286,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` bigint(20) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int1` bigint(20) NOT NULL,
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -4723,6 +4726,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -4755,8 +4761,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4783,8 +4789,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` bigint(20) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int1` bigint(20) NOT NULL,
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -5230,6 +5236,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -5262,8 +5271,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5288,8 +5297,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` bigint(20) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int1` bigint(20) NOT NULL,
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -5731,6 +5740,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -5763,8 +5775,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5787,8 +5799,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` bigint(20) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int1` bigint(20) NOT NULL,
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -6230,6 +6242,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -6262,8 +6277,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6290,8 +6305,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` bigint(20) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int1` bigint(20) NOT NULL,
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -6740,6 +6755,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -6772,8 +6790,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6800,8 +6818,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` bigint(20) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int1` bigint(20) NOT NULL,
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -7252,6 +7270,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -7284,8 +7305,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7308,8 +7329,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` bigint(20) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int1` bigint(20) NOT NULL,
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -7752,6 +7773,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -7785,8 +7809,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7805,8 +7829,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` bigint(20) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int1` bigint(20) NOT NULL,
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -8245,6 +8269,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -8277,8 +8304,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8297,8 +8324,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` bigint(20) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int1` bigint(20) NOT NULL,
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -8737,6 +8764,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -8769,8 +8799,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8797,8 +8827,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` bigint(20) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int1` bigint(20) NOT NULL,
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -9244,6 +9274,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -9276,8 +9309,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9302,8 +9335,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` bigint(20) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int1` bigint(20) NOT NULL,
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -9745,6 +9778,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -9777,8 +9813,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9801,8 +9837,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` bigint(20) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int1` bigint(20) NOT NULL,
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -10244,6 +10280,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -10276,8 +10315,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10304,8 +10343,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` bigint(20) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int1` bigint(20) NOT NULL,
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -10754,6 +10793,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -10786,8 +10828,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10814,8 +10856,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` bigint(20) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int1` bigint(20) NOT NULL,
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -11266,6 +11308,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -11298,8 +11343,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11322,8 +11367,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` bigint(20) NOT NULL DEFAULT '0',
- `f_int2` bigint(20) NOT NULL DEFAULT '0',
+ `f_int1` bigint(20) NOT NULL,
+ `f_int2` bigint(20) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -11766,6 +11811,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -11800,8 +11848,8 @@ DROP TABLE t1;
# 1.3.3 UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12308,8 +12356,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12816,8 +12864,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13339,8 +13387,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13856,8 +13904,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14371,8 +14419,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14897,8 +14945,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15425,8 +15473,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15942,8 +15990,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16450,8 +16498,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16958,8 +17006,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17481,8 +17529,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17998,8 +18046,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18513,8 +18561,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19039,8 +19087,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19567,8 +19615,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
diff --git a/mysql-test/suite/parts/r/partition_alter2_1_maria.result b/mysql-test/suite/parts/r/partition_alter2_1_maria.result
index 0e7c1818fbc..1182794ff05 100644
--- a/mysql-test/suite/parts/r/partition_alter2_1_maria.result
+++ b/mysql-test/suite/parts/r/partition_alter2_1_maria.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -48,8 +48,8 @@ SET @@session.sql_mode= '';
# 1.1.1 no PRIMARY KEY or UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -68,7 +68,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -513,8 +513,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -533,7 +533,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -984,8 +984,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1012,7 +1012,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -1476,8 +1476,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1502,7 +1502,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -1958,8 +1958,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1982,7 +1982,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -2444,8 +2444,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2472,7 +2472,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -2939,8 +2939,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2967,7 +2967,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -3436,8 +3436,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3460,7 +3460,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -3925,8 +3925,8 @@ DROP TABLE t1;
# 1.1.3 UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3945,7 +3945,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -4442,8 +4442,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4462,7 +4462,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -4965,8 +4965,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4993,7 +4993,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -5509,8 +5509,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5535,7 +5535,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -6043,8 +6043,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6067,7 +6067,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -6581,8 +6581,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6609,7 +6609,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -7128,8 +7128,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7156,7 +7156,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -7677,8 +7677,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7701,7 +7701,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -8217,8 +8217,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8237,7 +8237,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -8734,8 +8734,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8754,7 +8754,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -9257,8 +9257,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9285,7 +9285,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -9801,8 +9801,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9827,7 +9827,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -10335,8 +10335,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10359,7 +10359,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -10873,8 +10873,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10901,7 +10901,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -11420,8 +11420,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11448,7 +11448,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -11969,8 +11969,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11993,7 +11993,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -12514,8 +12514,8 @@ DROP TABLE t1;
# 1.3.1 no PRIMARY KEY or UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12979,8 +12979,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13450,8 +13450,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13942,8 +13942,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14424,8 +14424,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14908,8 +14908,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15403,8 +15403,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15900,8 +15900,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16389,8 +16389,8 @@ DROP TABLE t1;
# 1.3.3 UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16906,8 +16906,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17429,8 +17429,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17973,8 +17973,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18507,8 +18507,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19043,8 +19043,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19590,8 +19590,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -20139,8 +20139,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -20679,8 +20679,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -21196,8 +21196,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -21719,8 +21719,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -22263,8 +22263,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -22797,8 +22797,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -23333,8 +23333,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -23880,8 +23880,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -24429,8 +24429,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
diff --git a/mysql-test/suite/parts/r/partition_alter2_1_myisam.result b/mysql-test/suite/parts/r/partition_alter2_1_myisam.result
index c3e1b18841c..c6f68a5882e 100644
--- a/mysql-test/suite/parts/r/partition_alter2_1_myisam.result
+++ b/mysql-test/suite/parts/r/partition_alter2_1_myisam.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -48,8 +48,8 @@ SET @@session.sql_mode= '';
# 1.1.1 no PRIMARY KEY or UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -68,7 +68,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -513,8 +513,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -533,7 +533,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -984,8 +984,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1012,7 +1012,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -1476,8 +1476,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1502,7 +1502,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -1958,8 +1958,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1982,7 +1982,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -2444,8 +2444,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2472,7 +2472,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -2939,8 +2939,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2967,7 +2967,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -3436,8 +3436,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3460,7 +3460,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -3925,8 +3925,8 @@ DROP TABLE t1;
# 1.1.3 UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3945,7 +3945,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -4442,8 +4442,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4462,7 +4462,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -4965,8 +4965,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4993,7 +4993,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -5509,8 +5509,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5535,7 +5535,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -6043,8 +6043,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6067,7 +6067,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -6581,8 +6581,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6609,7 +6609,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -7128,8 +7128,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7156,7 +7156,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -7677,8 +7677,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7701,7 +7701,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -8217,8 +8217,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8237,7 +8237,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -8734,8 +8734,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8754,7 +8754,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -9257,8 +9257,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9285,7 +9285,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -9801,8 +9801,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9827,7 +9827,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -10335,8 +10335,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10359,7 +10359,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -10873,8 +10873,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10901,7 +10901,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -11420,8 +11420,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11448,7 +11448,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -11969,8 +11969,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11993,7 +11993,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` bigint(20) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -12514,8 +12514,8 @@ DROP TABLE t1;
# 1.3.1 no PRIMARY KEY or UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12979,8 +12979,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13450,8 +13450,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13942,8 +13942,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14424,8 +14424,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14908,8 +14908,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15403,8 +15403,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15900,8 +15900,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16389,8 +16389,8 @@ DROP TABLE t1;
# 1.3.3 UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16906,8 +16906,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17429,8 +17429,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17973,8 +17973,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18507,8 +18507,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19043,8 +19043,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19590,8 +19590,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -20139,8 +20139,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -20679,8 +20679,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -21196,8 +21196,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -21719,8 +21719,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -22263,8 +22263,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -22797,8 +22797,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -23333,8 +23333,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -23880,8 +23880,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -24429,8 +24429,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
diff --git a/mysql-test/suite/parts/r/partition_alter2_2_1_innodb.result b/mysql-test/suite/parts/r/partition_alter2_2_1_innodb.result
index 1f4642f63ec..2c8ec37d844 100644
--- a/mysql-test/suite/parts/r/partition_alter2_2_1_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter2_2_1_innodb.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -48,8 +48,8 @@ SET @@session.sql_mode= '';
# 2.1.1 no PRIMARY KEY or UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -68,7 +68,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -506,8 +506,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -526,7 +526,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -964,8 +964,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -992,7 +992,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -1437,8 +1437,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1463,7 +1463,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -1902,8 +1902,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1926,7 +1926,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -2369,8 +2369,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2397,7 +2397,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -2843,8 +2843,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2871,7 +2871,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -3321,8 +3321,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3345,7 +3345,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -3788,8 +3788,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3809,7 +3809,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -4250,6 +4250,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -4282,8 +4284,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4303,7 +4305,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -4744,6 +4746,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -4776,8 +4780,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4805,7 +4809,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -5253,6 +5257,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -5285,8 +5291,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5312,7 +5318,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -5754,6 +5760,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -5786,8 +5794,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5811,7 +5819,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -6257,6 +6265,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -6289,8 +6299,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6318,7 +6328,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -6767,6 +6777,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -6799,8 +6811,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6828,7 +6840,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -7281,6 +7293,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -7313,8 +7327,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7338,7 +7352,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -7783,6 +7797,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -7816,8 +7832,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7837,7 +7853,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -8278,6 +8294,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -8310,8 +8328,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8331,7 +8349,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -8772,6 +8790,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -8804,8 +8824,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8833,7 +8853,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -9281,6 +9301,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -9313,8 +9335,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9340,7 +9362,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -9782,6 +9804,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -9814,8 +9838,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9839,7 +9863,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -10285,6 +10309,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -10317,8 +10343,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10346,7 +10372,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -10795,6 +10821,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -10827,8 +10855,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10856,7 +10884,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -11309,6 +11337,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -11341,8 +11371,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11366,7 +11396,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_int1` int(11) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -11811,6 +11841,8 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -11845,8 +11877,8 @@ DROP TABLE t1;
# 2.1.3 UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11865,7 +11897,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -12355,8 +12387,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12375,7 +12407,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -12865,8 +12897,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12893,7 +12925,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -13390,8 +13422,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13416,7 +13448,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -13907,8 +13939,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13931,7 +13963,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -14426,8 +14458,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14454,7 +14486,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -14952,8 +14984,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14980,7 +15012,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -15482,8 +15514,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15506,7 +15538,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -16001,8 +16033,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16021,7 +16053,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -16511,8 +16543,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16531,7 +16563,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -17021,8 +17053,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17049,7 +17081,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -17546,8 +17578,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17572,7 +17604,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -18063,8 +18095,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18087,7 +18119,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -18582,8 +18614,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18610,7 +18642,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -19108,8 +19140,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19136,7 +19168,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -19638,8 +19670,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19662,7 +19694,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
diff --git a/mysql-test/suite/parts/r/partition_alter2_2_2_innodb.result b/mysql-test/suite/parts/r/partition_alter2_2_2_innodb.result
index 0db5bf79c4d..c2e4d73cd0d 100644
--- a/mysql-test/suite/parts/r/partition_alter2_2_2_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter2_2_2_innodb.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -43,8 +43,8 @@ SET @@session.sql_mode= '';
# 2.3.1 no PRIMARY KEY or UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -502,8 +502,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -961,8 +961,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1435,8 +1435,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1905,8 +1905,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2373,8 +2373,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2852,8 +2852,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3331,8 +3331,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3800,8 +3800,8 @@ DROP TABLE t1;
# 2.3.2 PRIMARY KEY exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3820,8 +3820,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` mediumint(9) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int1` mediumint(9) NOT NULL,
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -4263,6 +4263,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -4295,8 +4298,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4315,8 +4318,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` mediumint(9) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int1` mediumint(9) NOT NULL,
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -4758,6 +4761,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -4790,8 +4796,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4818,8 +4824,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` mediumint(9) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int1` mediumint(9) NOT NULL,
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -5268,6 +5274,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -5300,8 +5309,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5326,8 +5335,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` mediumint(9) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int1` mediumint(9) NOT NULL,
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -5774,6 +5783,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -5806,8 +5818,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5830,8 +5842,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` mediumint(9) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int1` mediumint(9) NOT NULL,
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -6278,6 +6290,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -6310,8 +6325,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6338,8 +6353,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` mediumint(9) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int1` mediumint(9) NOT NULL,
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -6793,6 +6808,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -6825,8 +6843,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6853,8 +6871,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` mediumint(9) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int1` mediumint(9) NOT NULL,
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -7308,6 +7326,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -7340,8 +7361,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7364,8 +7385,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` mediumint(9) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int1` mediumint(9) NOT NULL,
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -7811,6 +7832,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -7844,8 +7868,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7864,8 +7888,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` mediumint(9) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int1` mediumint(9) NOT NULL,
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -8307,6 +8331,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -8339,8 +8366,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8359,8 +8386,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` mediumint(9) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int1` mediumint(9) NOT NULL,
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -8802,6 +8829,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -8834,8 +8864,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8862,8 +8892,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` mediumint(9) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int1` mediumint(9) NOT NULL,
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -9312,6 +9342,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -9344,8 +9377,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9370,8 +9403,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` mediumint(9) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int1` mediumint(9) NOT NULL,
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -9818,6 +9851,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -9850,8 +9886,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9874,8 +9910,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` mediumint(9) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int1` mediumint(9) NOT NULL,
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -10322,6 +10358,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -10354,8 +10393,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10382,8 +10421,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` mediumint(9) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int1` mediumint(9) NOT NULL,
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -10837,6 +10876,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -10869,8 +10911,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10897,8 +10939,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` mediumint(9) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int1` mediumint(9) NOT NULL,
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -11352,6 +11394,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -11384,8 +11429,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11408,8 +11453,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` mediumint(9) NOT NULL DEFAULT '0',
- `f_int2` mediumint(9) NOT NULL DEFAULT '0',
+ `f_int1` mediumint(9) NOT NULL,
+ `f_int2` mediumint(9) NOT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -11855,6 +11900,9 @@ SELECT CAST(f_int1 AS CHAR),
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
ORDER BY f_int1;
+Warnings:
+Warning 1364 Field 'f_int1' doesn't have a default value
+Warning 1364 Field 'f_int2' doesn't have a default value
DROP TRIGGER trg_3;
# check trigger-12 success: 1
@@ -11889,8 +11937,8 @@ DROP TABLE t1;
# 2.3.3 UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12400,8 +12448,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12911,8 +12959,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13437,8 +13485,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13959,8 +14007,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14479,8 +14527,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15010,8 +15058,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15541,8 +15589,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16061,8 +16109,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16572,8 +16620,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17083,8 +17131,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17609,8 +17657,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18131,8 +18179,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18651,8 +18699,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19182,8 +19230,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19713,8 +19761,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
diff --git a/mysql-test/suite/parts/r/partition_alter2_2_maria.result b/mysql-test/suite/parts/r/partition_alter2_2_maria.result
index 2bb3683ad73..7eaffd200ce 100644
--- a/mysql-test/suite/parts/r/partition_alter2_2_maria.result
+++ b/mysql-test/suite/parts/r/partition_alter2_2_maria.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -48,8 +48,8 @@ SET @@session.sql_mode= '';
# 2.1.1 no PRIMARY KEY or UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -68,7 +68,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -515,8 +515,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -535,7 +535,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -988,8 +988,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1016,7 +1016,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -1482,8 +1482,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1508,7 +1508,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -1964,8 +1964,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1988,7 +1988,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -2452,8 +2452,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2480,7 +2480,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -2947,8 +2947,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2975,7 +2975,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -3446,8 +3446,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3470,7 +3470,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -3937,8 +3937,8 @@ DROP TABLE t1;
# 2.1.3 UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3957,7 +3957,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -4456,8 +4456,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4476,7 +4476,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -4981,8 +4981,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5009,7 +5009,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -5527,8 +5527,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5553,7 +5553,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -6061,8 +6061,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6085,7 +6085,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -6601,8 +6601,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6629,7 +6629,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -7148,8 +7148,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7176,7 +7176,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -7699,8 +7699,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7723,7 +7723,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -8241,8 +8241,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8261,7 +8261,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -8760,8 +8760,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8780,7 +8780,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -9285,8 +9285,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9313,7 +9313,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -9831,8 +9831,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9857,7 +9857,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -10365,8 +10365,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10389,7 +10389,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -10905,8 +10905,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10933,7 +10933,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -11452,8 +11452,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11480,7 +11480,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -12003,8 +12003,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12027,7 +12027,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -12549,8 +12549,8 @@ DROP TABLE t1;
# 2.3.1 no PRIMARY KEY or UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13017,8 +13017,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13491,8 +13491,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13986,8 +13986,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14473,8 +14473,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14962,8 +14962,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15462,8 +15462,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15962,8 +15962,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16454,8 +16454,8 @@ DROP TABLE t1;
# 2.3.3 UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16974,8 +16974,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17500,8 +17500,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18047,8 +18047,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18586,8 +18586,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19127,8 +19127,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19679,8 +19679,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -20231,8 +20231,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -20774,8 +20774,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -21294,8 +21294,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -21820,8 +21820,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -22367,8 +22367,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -22906,8 +22906,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -23447,8 +23447,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -23999,8 +23999,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -24551,8 +24551,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
diff --git a/mysql-test/suite/parts/r/partition_alter2_2_myisam.result b/mysql-test/suite/parts/r/partition_alter2_2_myisam.result
index 8d8e77ebbd3..85ace90e88c 100644
--- a/mysql-test/suite/parts/r/partition_alter2_2_myisam.result
+++ b/mysql-test/suite/parts/r/partition_alter2_2_myisam.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -48,8 +48,8 @@ SET @@session.sql_mode= '';
# 2.1.1 no PRIMARY KEY or UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -68,7 +68,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -515,8 +515,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -535,7 +535,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -988,8 +988,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1016,7 +1016,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -1482,8 +1482,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1508,7 +1508,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -1964,8 +1964,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1988,7 +1988,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -2452,8 +2452,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2480,7 +2480,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -2947,8 +2947,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2975,7 +2975,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -3446,8 +3446,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3470,7 +3470,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -3937,8 +3937,8 @@ DROP TABLE t1;
# 2.1.3 UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3957,7 +3957,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -4456,8 +4456,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4476,7 +4476,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -4981,8 +4981,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5009,7 +5009,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -5527,8 +5527,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5553,7 +5553,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -6061,8 +6061,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6085,7 +6085,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -6601,8 +6601,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6629,7 +6629,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -7148,8 +7148,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7176,7 +7176,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -7699,8 +7699,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7723,7 +7723,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -8241,8 +8241,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8261,7 +8261,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -8760,8 +8760,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8780,7 +8780,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -9285,8 +9285,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9313,7 +9313,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -9831,8 +9831,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9857,7 +9857,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -10365,8 +10365,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10389,7 +10389,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -10905,8 +10905,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10933,7 +10933,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -11452,8 +11452,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11480,7 +11480,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -12003,8 +12003,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12027,7 +12027,7 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
`f_int2` mediumint(9) DEFAULT NULL,
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
@@ -12549,8 +12549,8 @@ DROP TABLE t1;
# 2.3.1 no PRIMARY KEY or UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13017,8 +13017,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13491,8 +13491,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13986,8 +13986,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14473,8 +14473,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14962,8 +14962,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15462,8 +15462,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15962,8 +15962,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16454,8 +16454,8 @@ DROP TABLE t1;
# 2.3.3 UNIQUE INDEX exists
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16974,8 +16974,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17500,8 +17500,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18047,8 +18047,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18586,8 +18586,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19127,8 +19127,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19679,8 +19679,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -20231,8 +20231,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -20774,8 +20774,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -21294,8 +21294,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -21820,8 +21820,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -22367,8 +22367,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -22906,8 +22906,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -23447,8 +23447,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -23999,8 +23999,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -24551,8 +24551,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
diff --git a/mysql-test/suite/parts/r/partition_alter3_innodb.result b/mysql-test/suite/parts/r/partition_alter3_innodb.result
index fd67547f55b..a1718453c11 100644
--- a/mysql-test/suite/parts/r/partition_alter3_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter3_innodb.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -429,8 +429,8 @@ unified filelist
#========================================================================
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -440,8 +440,8 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -463,8 +463,8 @@ ALTER TABLE t1 PARTITION BY KEY(f_int1);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -489,8 +489,8 @@ ALTER TABLE t1 ADD PARTITION (PARTITION part1, PARTITION part7);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -515,8 +515,8 @@ ALTER TABLE t1 ADD PARTITION (PARTITION part2);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -543,8 +543,8 @@ ALTER TABLE t1 ADD PARTITION PARTITIONS 4;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -586,8 +586,8 @@ ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -619,8 +619,8 @@ ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -650,8 +650,8 @@ ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -679,8 +679,8 @@ ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -706,8 +706,8 @@ ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -731,8 +731,8 @@ ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -754,8 +754,8 @@ ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -779,8 +779,8 @@ ALTER TABLE t1 REMOVE PARTITIONING;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
diff --git a/mysql-test/suite/parts/r/partition_alter3_myisam.result b/mysql-test/suite/parts/r/partition_alter3_myisam.result
index dfb21ee17ba..8bee02a3096 100644
--- a/mysql-test/suite/parts/r/partition_alter3_myisam.result
+++ b/mysql-test/suite/parts/r/partition_alter3_myisam.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -471,8 +471,8 @@ DROP TABLE t1;
#========================================================================
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -482,8 +482,8 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -506,8 +506,8 @@ ALTER TABLE t1 PARTITION BY KEY(f_int1);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -533,8 +533,8 @@ ALTER TABLE t1 ADD PARTITION (PARTITION part1, PARTITION part7);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -562,8 +562,8 @@ ALTER TABLE t1 ADD PARTITION (PARTITION part2);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -594,8 +594,8 @@ ALTER TABLE t1 ADD PARTITION PARTITIONS 4;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -645,8 +645,8 @@ ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -685,8 +685,8 @@ ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -722,8 +722,8 @@ ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -756,8 +756,8 @@ ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -787,8 +787,8 @@ ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -815,8 +815,8 @@ ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -840,8 +840,8 @@ ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -866,8 +866,8 @@ ALTER TABLE t1 REMOVE PARTITIONING;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
diff --git a/mysql-test/suite/parts/r/partition_alter4_innodb.result b/mysql-test/suite/parts/r/partition_alter4_innodb.result
index e4dacbc663c..f51d6e5cb02 100644
--- a/mysql-test/suite/parts/r/partition_alter4_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter4_innodb.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -47,8 +47,8 @@ SET @@session.sql_mode= '';
# 1.1 ALTER ... ANALYZE PARTITION part_1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -69,8 +69,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -506,8 +506,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -528,8 +528,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -968,8 +968,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -998,8 +998,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -1441,8 +1441,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1469,8 +1469,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -1908,8 +1908,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1934,8 +1934,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -2375,8 +2375,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2405,8 +2405,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -2851,8 +2851,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2881,8 +2881,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -3329,8 +3329,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3355,8 +3355,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -3797,8 +3797,8 @@ DROP TABLE t1;
# 1.2 ALTER ... ANALYZE PARTITION part_1,part_2;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3819,8 +3819,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -4256,8 +4256,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4278,8 +4278,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -4718,8 +4718,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4748,8 +4748,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -5191,8 +5191,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5219,8 +5219,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -5658,8 +5658,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5684,8 +5684,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -6125,8 +6125,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6155,8 +6155,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -6601,8 +6601,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6631,8 +6631,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -7079,8 +7079,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7105,8 +7105,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -7547,8 +7547,8 @@ DROP TABLE t1;
# 1.3 ALTER ... ANALYZE PARTITION part_1,part_2,part_5,part_6,part_10;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7569,8 +7569,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -8006,8 +8006,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8028,8 +8028,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -8468,8 +8468,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8498,8 +8498,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -8941,8 +8941,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8969,8 +8969,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -9408,8 +9408,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9434,8 +9434,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -9875,8 +9875,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9905,8 +9905,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -10351,8 +10351,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10381,8 +10381,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -10829,8 +10829,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10855,8 +10855,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -11297,8 +11297,8 @@ DROP TABLE t1;
# 1.4 ALTER ... ANALYZE PARTITION part_1,part_1,part_1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11319,8 +11319,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -11756,8 +11756,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11778,8 +11778,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -12218,8 +12218,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12248,8 +12248,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -12691,8 +12691,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12719,8 +12719,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -13158,8 +13158,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13184,8 +13184,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -13625,8 +13625,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13655,8 +13655,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -14101,8 +14101,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14131,8 +14131,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -14579,8 +14579,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14605,8 +14605,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -15047,8 +15047,8 @@ DROP TABLE t1;
# 1.5 ALTER ... ANALYZE PARTITION ALL;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15069,8 +15069,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -15506,8 +15506,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15528,8 +15528,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -15968,8 +15968,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15998,8 +15998,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -16441,8 +16441,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16469,8 +16469,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -16908,8 +16908,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16934,8 +16934,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -17375,8 +17375,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17405,8 +17405,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -17851,8 +17851,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17881,8 +17881,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -18329,8 +18329,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18355,8 +18355,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -18800,8 +18800,8 @@ DROP TABLE t1;
# 2.1 ALTER ... CHECK PARTITION part_1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18822,8 +18822,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -19259,8 +19259,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19281,8 +19281,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -19721,8 +19721,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19751,8 +19751,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -20194,8 +20194,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -20222,8 +20222,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -20661,8 +20661,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -20687,8 +20687,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -21128,8 +21128,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -21158,8 +21158,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -21604,8 +21604,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -21634,8 +21634,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -22082,8 +22082,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -22108,8 +22108,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -22550,8 +22550,8 @@ DROP TABLE t1;
# 2.2 ALTER ... CHECK PARTITION part_1,part_2;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -22572,8 +22572,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -23009,8 +23009,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -23031,8 +23031,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -23471,8 +23471,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -23501,8 +23501,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -23944,8 +23944,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -23972,8 +23972,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -24411,8 +24411,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -24437,8 +24437,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -24878,8 +24878,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -24908,8 +24908,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -25354,8 +25354,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -25384,8 +25384,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -25832,8 +25832,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -25858,8 +25858,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -26300,8 +26300,8 @@ DROP TABLE t1;
# 2.3 ALTER ... CHECK PARTITION part_1,part_2,part_5,part_6,part_10;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -26322,8 +26322,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -26759,8 +26759,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -26781,8 +26781,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -27221,8 +27221,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -27251,8 +27251,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -27694,8 +27694,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -27722,8 +27722,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -28161,8 +28161,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -28187,8 +28187,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -28628,8 +28628,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -28658,8 +28658,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -29104,8 +29104,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -29134,8 +29134,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -29582,8 +29582,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -29608,8 +29608,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -30050,8 +30050,8 @@ DROP TABLE t1;
# 2.4 ALTER ... CHECK PARTITION part_1,part_1,part_1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -30072,8 +30072,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -30509,8 +30509,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -30531,8 +30531,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -30971,8 +30971,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -31001,8 +31001,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -31444,8 +31444,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -31472,8 +31472,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -31911,8 +31911,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -31937,8 +31937,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -32378,8 +32378,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -32408,8 +32408,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -32854,8 +32854,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -32884,8 +32884,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -33332,8 +33332,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -33358,8 +33358,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -33800,8 +33800,8 @@ DROP TABLE t1;
# 2.5 ALTER ... CHECK PARTITION ALL;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -33822,8 +33822,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -34259,8 +34259,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -34281,8 +34281,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -34721,8 +34721,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -34751,8 +34751,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -35194,8 +35194,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -35222,8 +35222,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -35661,8 +35661,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -35687,8 +35687,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -36128,8 +36128,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -36158,8 +36158,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -36604,8 +36604,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -36634,8 +36634,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -37082,8 +37082,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -37108,8 +37108,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -37553,8 +37553,8 @@ DROP TABLE t1;
# 3.1 ALTER ... OPTIMIZE PARTITION part_1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -37576,8 +37576,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -38013,8 +38013,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -38036,8 +38036,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -38476,8 +38476,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -38507,8 +38507,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -38950,8 +38950,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -38979,8 +38979,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -39418,8 +39418,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -39445,8 +39445,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -39886,8 +39886,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -39917,8 +39917,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -40363,8 +40363,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -40394,8 +40394,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -40842,8 +40842,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -40869,8 +40869,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -41311,8 +41311,8 @@ DROP TABLE t1;
# 3.2 ALTER ... OPTIMIZE PARTITION part_1,part_2;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -41334,8 +41334,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -41771,8 +41771,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -41794,8 +41794,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -42234,8 +42234,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -42265,8 +42265,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -42708,8 +42708,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -42737,8 +42737,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -43176,8 +43176,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -43203,8 +43203,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -43644,8 +43644,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -43675,8 +43675,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -44121,8 +44121,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -44152,8 +44152,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -44600,8 +44600,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -44627,8 +44627,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -45069,8 +45069,8 @@ DROP TABLE t1;
# 3.3 ALTER ... OPTIMIZE PARTITION part_1,part_2,part_5,part_6,part_10;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -45091,8 +45091,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -45528,8 +45528,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -45550,8 +45550,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -45990,8 +45990,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -46020,8 +46020,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -46463,8 +46463,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -46491,8 +46491,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -46930,8 +46930,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -46956,8 +46956,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -47397,8 +47397,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -47427,8 +47427,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -47873,8 +47873,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -47903,8 +47903,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -48351,8 +48351,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -48377,8 +48377,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -48819,8 +48819,8 @@ DROP TABLE t1;
# 3.4 ALTER ... OPTIMIZE PARTITION part_1,part_1,part_1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -48841,8 +48841,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -49278,8 +49278,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -49300,8 +49300,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -49740,8 +49740,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -49770,8 +49770,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -50213,8 +50213,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -50241,8 +50241,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -50680,8 +50680,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -50706,8 +50706,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -51147,8 +51147,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -51177,8 +51177,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -51623,8 +51623,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -51653,8 +51653,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -52101,8 +52101,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -52127,8 +52127,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -52569,8 +52569,8 @@ DROP TABLE t1;
# 3.5 ALTER ... OPTIMIZE PARTITION ALL;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -52592,8 +52592,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -53029,8 +53029,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -53052,8 +53052,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -53492,8 +53492,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -53523,8 +53523,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -53966,8 +53966,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -53995,8 +53995,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -54434,8 +54434,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -54461,8 +54461,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -54902,8 +54902,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -54933,8 +54933,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -55379,8 +55379,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -55410,8 +55410,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -55858,8 +55858,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -55885,8 +55885,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -56330,8 +56330,8 @@ DROP TABLE t1;
# 4.1 ALTER ... REBUILD PARTITION part_1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -56350,8 +56350,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -56787,8 +56787,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -56807,8 +56807,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -57247,8 +57247,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -57275,8 +57275,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -57718,8 +57718,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -57744,8 +57744,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -58183,8 +58183,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -58207,8 +58207,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -58648,8 +58648,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -58676,8 +58676,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -59122,8 +59122,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -59150,8 +59150,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -59598,8 +59598,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -59622,8 +59622,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -60064,8 +60064,8 @@ DROP TABLE t1;
# 4.2 ALTER ... REBUILD PARTITION part_1,part_2;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -60084,8 +60084,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -60521,8 +60521,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -60541,8 +60541,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -60981,8 +60981,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -61009,8 +61009,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -61452,8 +61452,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -61478,8 +61478,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -61917,8 +61917,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -61941,8 +61941,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -62382,8 +62382,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -62410,8 +62410,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -62856,8 +62856,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -62884,8 +62884,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -63332,8 +63332,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -63356,8 +63356,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -63798,8 +63798,8 @@ DROP TABLE t1;
# 4.3 ALTER ... REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -63813,8 +63813,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -63828,8 +63828,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -63851,8 +63851,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -63872,8 +63872,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -63891,8 +63891,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -63914,8 +63914,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -63937,8 +63937,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -63958,8 +63958,8 @@ DROP TABLE t1;
# 4.4 ALTER ... REBUILD PARTITION part_1,part_1,part_1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -63973,8 +63973,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -63988,8 +63988,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -64011,8 +64011,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -64032,8 +64032,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -64051,8 +64051,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -64074,8 +64074,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -64097,8 +64097,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -64118,8 +64118,8 @@ DROP TABLE t1;
# 4.5 ALTER ... REBUILD PARTITION ALL;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -64138,8 +64138,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -64575,8 +64575,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -64595,8 +64595,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -65035,8 +65035,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -65063,8 +65063,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -65506,8 +65506,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -65532,8 +65532,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -65971,8 +65971,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -65995,8 +65995,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -66436,8 +66436,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -66464,8 +66464,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -66910,8 +66910,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -66938,8 +66938,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -67386,8 +67386,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -67410,8 +67410,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -67855,8 +67855,8 @@ DROP TABLE t1;
# 5.1 ALTER ... REPAIR PARTITION part_1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -67877,8 +67877,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -68314,8 +68314,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -68336,8 +68336,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -68776,8 +68776,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -68806,8 +68806,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -69249,8 +69249,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -69277,8 +69277,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -69716,8 +69716,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -69742,8 +69742,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -70183,8 +70183,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -70213,8 +70213,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -70659,8 +70659,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -70689,8 +70689,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -71137,8 +71137,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -71163,8 +71163,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -71605,8 +71605,8 @@ DROP TABLE t1;
# 5.2 ALTER ... REPAIR PARTITION part_1,part_2;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -71627,8 +71627,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -72064,8 +72064,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -72086,8 +72086,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -72526,8 +72526,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -72556,8 +72556,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -72999,8 +72999,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -73027,8 +73027,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -73466,8 +73466,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -73492,8 +73492,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -73933,8 +73933,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -73963,8 +73963,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -74409,8 +74409,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -74439,8 +74439,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -74887,8 +74887,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -74913,8 +74913,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -75355,8 +75355,8 @@ DROP TABLE t1;
# 5.3 ALTER ... REPAIR PARTITION part_1,part_2,part_5,part_6,part_10;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -75377,8 +75377,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -75814,8 +75814,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -75836,8 +75836,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -76276,8 +76276,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -76306,8 +76306,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -76749,8 +76749,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -76777,8 +76777,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -77216,8 +77216,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -77242,8 +77242,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -77683,8 +77683,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -77713,8 +77713,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -78159,8 +78159,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -78189,8 +78189,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -78637,8 +78637,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -78663,8 +78663,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -79105,8 +79105,8 @@ DROP TABLE t1;
# 5.4 ALTER ... REPAIR PARTITION part_1,part_1,part_1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -79127,8 +79127,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -79564,8 +79564,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -79586,8 +79586,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -80026,8 +80026,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -80056,8 +80056,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -80499,8 +80499,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -80527,8 +80527,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -80966,8 +80966,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -80992,8 +80992,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -81433,8 +81433,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -81463,8 +81463,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -81909,8 +81909,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -81939,8 +81939,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -82387,8 +82387,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -82413,8 +82413,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -82855,8 +82855,8 @@ DROP TABLE t1;
# 5.5 ALTER ... REPAIR PARTITION ALL;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -82877,8 +82877,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -83314,8 +83314,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -83336,8 +83336,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -83776,8 +83776,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -83806,8 +83806,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -84249,8 +84249,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -84277,8 +84277,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -84716,8 +84716,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -84742,8 +84742,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -85183,8 +85183,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -85213,8 +85213,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -85659,8 +85659,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -85689,8 +85689,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -86137,8 +86137,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -86163,8 +86163,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -86608,8 +86608,8 @@ DROP TABLE t1;
# 6.1 ALTER ... REMOVE PARTITIONING;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -86628,8 +86628,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -87062,8 +87062,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -87082,8 +87082,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -87516,8 +87516,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -87544,8 +87544,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -87978,8 +87978,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -88004,8 +88004,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -88438,8 +88438,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -88462,8 +88462,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -88896,8 +88896,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -88924,8 +88924,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -89358,8 +89358,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -89386,8 +89386,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -89820,8 +89820,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -89844,8 +89844,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
diff --git a/mysql-test/suite/parts/r/partition_alter4_myisam.result b/mysql-test/suite/parts/r/partition_alter4_myisam.result
index 8aba07874aa..c49b4229519 100644
--- a/mysql-test/suite/parts/r/partition_alter4_myisam.result
+++ b/mysql-test/suite/parts/r/partition_alter4_myisam.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -47,8 +47,8 @@ SET @@session.sql_mode= '';
# 1.1 ALTER ... ANALYZE PARTITION part_1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -69,8 +69,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -515,8 +515,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -537,8 +537,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -992,8 +992,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1022,8 +1022,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -1486,8 +1486,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1514,8 +1514,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -1970,8 +1970,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1996,8 +1996,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -2458,8 +2458,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2488,8 +2488,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -2955,8 +2955,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2985,8 +2985,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -3454,8 +3454,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3480,8 +3480,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -3945,8 +3945,8 @@ DROP TABLE t1;
# 1.2 ALTER ... ANALYZE PARTITION part_1,part_2;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3967,8 +3967,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -4413,8 +4413,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4435,8 +4435,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -4890,8 +4890,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4920,8 +4920,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -5384,8 +5384,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5412,8 +5412,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -5868,8 +5868,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5894,8 +5894,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -6356,8 +6356,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6386,8 +6386,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -6853,8 +6853,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6883,8 +6883,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -7352,8 +7352,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7378,8 +7378,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -7843,8 +7843,8 @@ DROP TABLE t1;
# 1.3 ALTER ... ANALYZE PARTITION part_1,part_2,part_5,part_6,part_10;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7865,8 +7865,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -8311,8 +8311,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8333,8 +8333,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -8788,8 +8788,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8818,8 +8818,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -9282,8 +9282,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9310,8 +9310,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -9766,8 +9766,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9792,8 +9792,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -10254,8 +10254,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10284,8 +10284,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -10751,8 +10751,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10781,8 +10781,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -11250,8 +11250,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11276,8 +11276,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -11741,8 +11741,8 @@ DROP TABLE t1;
# 1.4 ALTER ... ANALYZE PARTITION part_1,part_1,part_1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11763,8 +11763,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -12209,8 +12209,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12231,8 +12231,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -12686,8 +12686,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12716,8 +12716,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -13180,8 +13180,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13208,8 +13208,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -13664,8 +13664,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13690,8 +13690,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -14152,8 +14152,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14182,8 +14182,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -14649,8 +14649,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14679,8 +14679,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -15148,8 +15148,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15174,8 +15174,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -15639,8 +15639,8 @@ DROP TABLE t1;
# 1.5 ALTER ... ANALYZE PARTITION ALL;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15661,8 +15661,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -16107,8 +16107,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16129,8 +16129,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -16584,8 +16584,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16614,8 +16614,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -17078,8 +17078,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17106,8 +17106,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -17562,8 +17562,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17588,8 +17588,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -18050,8 +18050,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18080,8 +18080,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -18547,8 +18547,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18577,8 +18577,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -19046,8 +19046,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19072,8 +19072,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -19540,8 +19540,8 @@ DROP TABLE t1;
# 2.1 ALTER ... CHECK PARTITION part_1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19562,8 +19562,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -20008,8 +20008,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -20030,8 +20030,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -20485,8 +20485,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -20515,8 +20515,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -20979,8 +20979,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -21007,8 +21007,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -21463,8 +21463,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -21489,8 +21489,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -21951,8 +21951,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -21981,8 +21981,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -22448,8 +22448,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -22478,8 +22478,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -22947,8 +22947,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -22973,8 +22973,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -23438,8 +23438,8 @@ DROP TABLE t1;
# 2.2 ALTER ... CHECK PARTITION part_1,part_2;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -23460,8 +23460,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -23906,8 +23906,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -23928,8 +23928,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -24383,8 +24383,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -24413,8 +24413,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -24877,8 +24877,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -24905,8 +24905,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -25361,8 +25361,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -25387,8 +25387,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -25849,8 +25849,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -25879,8 +25879,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -26346,8 +26346,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -26376,8 +26376,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -26845,8 +26845,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -26871,8 +26871,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -27336,8 +27336,8 @@ DROP TABLE t1;
# 2.3 ALTER ... CHECK PARTITION part_1,part_2,part_5,part_6,part_10;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -27358,8 +27358,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -27804,8 +27804,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -27826,8 +27826,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -28281,8 +28281,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -28311,8 +28311,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -28775,8 +28775,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -28803,8 +28803,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -29259,8 +29259,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -29285,8 +29285,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -29747,8 +29747,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -29777,8 +29777,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -30244,8 +30244,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -30274,8 +30274,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -30743,8 +30743,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -30769,8 +30769,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -31234,8 +31234,8 @@ DROP TABLE t1;
# 2.4 ALTER ... CHECK PARTITION part_1,part_1,part_1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -31256,8 +31256,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -31702,8 +31702,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -31724,8 +31724,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -32179,8 +32179,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -32209,8 +32209,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -32673,8 +32673,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -32701,8 +32701,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -33157,8 +33157,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -33183,8 +33183,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -33645,8 +33645,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -33675,8 +33675,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -34142,8 +34142,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -34172,8 +34172,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -34641,8 +34641,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -34667,8 +34667,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -35132,8 +35132,8 @@ DROP TABLE t1;
# 2.5 ALTER ... CHECK PARTITION ALL;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -35154,8 +35154,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -35600,8 +35600,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -35622,8 +35622,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -36077,8 +36077,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -36107,8 +36107,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -36571,8 +36571,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -36599,8 +36599,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -37055,8 +37055,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -37081,8 +37081,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -37543,8 +37543,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -37573,8 +37573,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -38040,8 +38040,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -38070,8 +38070,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -38539,8 +38539,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -38565,8 +38565,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -39033,8 +39033,8 @@ DROP TABLE t1;
# 3.1 ALTER ... OPTIMIZE PARTITION part_1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -39055,8 +39055,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -39501,8 +39501,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -39523,8 +39523,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -39978,8 +39978,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -40008,8 +40008,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -40472,8 +40472,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -40500,8 +40500,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -40956,8 +40956,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -40982,8 +40982,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -41444,8 +41444,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -41474,8 +41474,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -41941,8 +41941,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -41971,8 +41971,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -42440,8 +42440,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -42466,8 +42466,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -42931,8 +42931,8 @@ DROP TABLE t1;
# 3.2 ALTER ... OPTIMIZE PARTITION part_1,part_2;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -42953,8 +42953,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -43399,8 +43399,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -43421,8 +43421,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -43876,8 +43876,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -43906,8 +43906,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -44370,8 +44370,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -44398,8 +44398,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -44854,8 +44854,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -44880,8 +44880,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -45342,8 +45342,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -45372,8 +45372,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -45839,8 +45839,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -45869,8 +45869,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -46338,8 +46338,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -46364,8 +46364,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -46829,8 +46829,8 @@ DROP TABLE t1;
# 3.3 ALTER ... OPTIMIZE PARTITION part_1,part_2,part_5,part_6,part_10;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -46851,8 +46851,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -47297,8 +47297,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -47319,8 +47319,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -47774,8 +47774,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -47804,8 +47804,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -48268,8 +48268,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -48296,8 +48296,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -48752,8 +48752,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -48778,8 +48778,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -49240,8 +49240,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -49270,8 +49270,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -49737,8 +49737,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -49767,8 +49767,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -50236,8 +50236,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -50262,8 +50262,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -50727,8 +50727,8 @@ DROP TABLE t1;
# 3.4 ALTER ... OPTIMIZE PARTITION part_1,part_1,part_1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -50749,8 +50749,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -51195,8 +51195,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -51217,8 +51217,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -51672,8 +51672,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -51702,8 +51702,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -52166,8 +52166,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -52194,8 +52194,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -52650,8 +52650,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -52676,8 +52676,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -53138,8 +53138,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -53168,8 +53168,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -53635,8 +53635,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -53665,8 +53665,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -54134,8 +54134,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -54160,8 +54160,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -54625,8 +54625,8 @@ DROP TABLE t1;
# 3.5 ALTER ... OPTIMIZE PARTITION ALL;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -54647,8 +54647,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -55093,8 +55093,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -55115,8 +55115,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -55570,8 +55570,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -55600,8 +55600,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -56064,8 +56064,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -56092,8 +56092,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -56548,8 +56548,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -56574,8 +56574,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -57036,8 +57036,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -57066,8 +57066,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -57533,8 +57533,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -57563,8 +57563,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -58032,8 +58032,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -58058,8 +58058,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -58526,8 +58526,8 @@ DROP TABLE t1;
# 4.1 ALTER ... REBUILD PARTITION part_1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -58546,8 +58546,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -58992,8 +58992,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -59012,8 +59012,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -59467,8 +59467,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -59495,8 +59495,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -59959,8 +59959,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -59985,8 +59985,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -60441,8 +60441,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -60465,8 +60465,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -60927,8 +60927,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -60955,8 +60955,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -61422,8 +61422,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -61450,8 +61450,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -61919,8 +61919,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -61943,8 +61943,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -62408,8 +62408,8 @@ DROP TABLE t1;
# 4.2 ALTER ... REBUILD PARTITION part_1,part_2;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -62428,8 +62428,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -62874,8 +62874,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -62894,8 +62894,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -63349,8 +63349,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -63377,8 +63377,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -63841,8 +63841,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -63867,8 +63867,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -64323,8 +64323,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -64347,8 +64347,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -64809,8 +64809,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -64837,8 +64837,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -65304,8 +65304,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -65332,8 +65332,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -65801,8 +65801,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -65825,8 +65825,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -66290,8 +66290,8 @@ DROP TABLE t1;
# 4.3 ALTER ... REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -66305,8 +66305,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -66320,8 +66320,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -66343,8 +66343,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -66364,8 +66364,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -66383,8 +66383,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -66406,8 +66406,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -66429,8 +66429,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -66450,8 +66450,8 @@ DROP TABLE t1;
# 4.4 ALTER ... REBUILD PARTITION part_1,part_1,part_1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -66465,8 +66465,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -66480,8 +66480,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -66503,8 +66503,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -66524,8 +66524,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -66543,8 +66543,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -66566,8 +66566,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -66589,8 +66589,8 @@ ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
ERROR HY000: Error in list of partitions to REBUILD
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -66610,8 +66610,8 @@ DROP TABLE t1;
# 4.5 ALTER ... REBUILD PARTITION ALL;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -66630,8 +66630,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -67076,8 +67076,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -67096,8 +67096,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -67551,8 +67551,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -67579,8 +67579,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -68043,8 +68043,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -68069,8 +68069,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -68525,8 +68525,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -68549,8 +68549,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -69011,8 +69011,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -69039,8 +69039,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -69506,8 +69506,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -69534,8 +69534,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -70003,8 +70003,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -70027,8 +70027,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -70495,8 +70495,8 @@ DROP TABLE t1;
# 5.1 ALTER ... REPAIR PARTITION part_1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -70517,8 +70517,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -70963,8 +70963,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -70985,8 +70985,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -71440,8 +71440,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -71470,8 +71470,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -71934,8 +71934,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -71962,8 +71962,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -72418,8 +72418,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -72444,8 +72444,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -72906,8 +72906,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -72936,8 +72936,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -73403,8 +73403,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -73433,8 +73433,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -73902,8 +73902,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -73928,8 +73928,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -74393,8 +74393,8 @@ DROP TABLE t1;
# 5.2 ALTER ... REPAIR PARTITION part_1,part_2;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -74415,8 +74415,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -74861,8 +74861,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -74883,8 +74883,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -75338,8 +75338,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -75368,8 +75368,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -75832,8 +75832,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -75860,8 +75860,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -76316,8 +76316,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -76342,8 +76342,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -76804,8 +76804,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -76834,8 +76834,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -77301,8 +77301,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -77331,8 +77331,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -77800,8 +77800,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -77826,8 +77826,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -78291,8 +78291,8 @@ DROP TABLE t1;
# 5.3 ALTER ... REPAIR PARTITION part_1,part_2,part_5,part_6,part_10;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -78313,8 +78313,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -78759,8 +78759,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -78781,8 +78781,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -79236,8 +79236,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -79266,8 +79266,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -79730,8 +79730,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -79758,8 +79758,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -80214,8 +80214,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -80240,8 +80240,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -80702,8 +80702,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -80732,8 +80732,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -81199,8 +81199,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -81229,8 +81229,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -81698,8 +81698,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -81724,8 +81724,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -82189,8 +82189,8 @@ DROP TABLE t1;
# 5.4 ALTER ... REPAIR PARTITION part_1,part_1,part_1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -82211,8 +82211,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -82657,8 +82657,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -82679,8 +82679,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -83134,8 +83134,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -83164,8 +83164,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -83628,8 +83628,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -83656,8 +83656,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -84112,8 +84112,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -84138,8 +84138,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -84600,8 +84600,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -84630,8 +84630,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -85097,8 +85097,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -85127,8 +85127,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -85596,8 +85596,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -85622,8 +85622,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -86087,8 +86087,8 @@ DROP TABLE t1;
# 5.5 ALTER ... REPAIR PARTITION ALL;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -86109,8 +86109,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -86555,8 +86555,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -86577,8 +86577,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -87032,8 +87032,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -87062,8 +87062,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -87526,8 +87526,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -87554,8 +87554,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -88010,8 +88010,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -88036,8 +88036,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -88498,8 +88498,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -88528,8 +88528,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -88995,8 +88995,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -89025,8 +89025,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -89494,8 +89494,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -89520,8 +89520,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -89988,8 +89988,8 @@ DROP TABLE t1;
# 6.1 ALTER ... REMOVE PARTITIONING;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -90008,8 +90008,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -90448,8 +90448,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -90468,8 +90468,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -90908,8 +90908,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -90936,8 +90936,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -91376,8 +91376,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -91402,8 +91402,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -91842,8 +91842,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -91866,8 +91866,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -92306,8 +92306,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -92334,8 +92334,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -92774,8 +92774,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -92802,8 +92802,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -93242,8 +93242,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -93266,8 +93266,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
diff --git a/mysql-test/suite/parts/r/partition_basic_innodb.result b/mysql-test/suite/parts/r/partition_basic_innodb.result
index 0bf2b8e8eaa..1a726229403 100644
--- a/mysql-test/suite/parts/r/partition_basic_innodb.result
+++ b/mysql-test/suite/parts/r/partition_basic_innodb.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -52,8 +52,8 @@ SET @@session.sql_mode= '';
# 1.1 The partitioning function contains one column.
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -67,8 +67,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -509,8 +509,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -524,8 +524,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -969,8 +969,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -992,8 +992,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -1447,8 +1447,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1468,8 +1468,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -1917,8 +1917,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1936,8 +1936,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -2389,8 +2389,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2412,8 +2412,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -2870,8 +2870,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2897,8 +2897,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -3357,8 +3357,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3376,8 +3376,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -3831,8 +3831,8 @@ DROP TABLE t1;
# 1.2 The partitioning function contains two columns.
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3846,8 +3846,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -4288,8 +4288,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4303,8 +4303,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -4748,8 +4748,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4771,8 +4771,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -5226,8 +5226,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5247,8 +5247,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -5696,8 +5696,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5715,8 +5715,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -6166,8 +6166,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6189,8 +6189,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -6647,8 +6647,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6670,8 +6670,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -7130,8 +7130,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7149,8 +7149,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -7608,8 +7608,8 @@ DROP TABLE t1;
# 2.5 PRIMARY KEY + UNIQUE INDEX consisting of two columns
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8102,8 +8102,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8599,8 +8599,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9114,8 +9114,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9621,8 +9621,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10130,8 +10130,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10648,8 +10648,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11172,8 +11172,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11682,8 +11682,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12176,8 +12176,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12673,8 +12673,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13188,8 +13188,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13695,8 +13695,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14204,8 +14204,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14722,8 +14722,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15246,8 +15246,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15756,8 +15756,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15771,8 +15771,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -16266,8 +16266,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16281,8 +16281,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -16779,8 +16779,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16802,8 +16802,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -17310,8 +17310,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17331,8 +17331,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -17833,8 +17833,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17852,8 +17852,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -18358,8 +18358,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18381,8 +18381,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -18892,8 +18892,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18919,8 +18919,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -19432,8 +19432,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19451,8 +19451,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -19963,8 +19963,8 @@ DROP TABLE t1;
# 3.3 PRIMARY KEY and UNIQUE INDEX consisting of two columns
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -20457,8 +20457,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -20954,8 +20954,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -21469,8 +21469,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -21976,8 +21976,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -22483,8 +22483,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -23001,8 +23001,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -23521,8 +23521,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -24031,8 +24031,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -24525,8 +24525,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -25022,8 +25022,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -25537,8 +25537,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -26044,8 +26044,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -26551,8 +26551,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -27069,8 +27069,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -27589,8 +27589,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -28099,8 +28099,8 @@ TRUNCATE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -28114,8 +28114,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -28609,8 +28609,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -28624,8 +28624,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -29122,8 +29122,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -29145,8 +29145,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -29653,8 +29653,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -29674,8 +29674,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -30176,8 +30176,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -30195,8 +30195,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -30699,8 +30699,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -30722,8 +30722,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -31233,8 +31233,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -31256,8 +31256,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -31769,8 +31769,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -31788,8 +31788,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
diff --git a/mysql-test/suite/parts/r/partition_basic_myisam.result b/mysql-test/suite/parts/r/partition_basic_myisam.result
index 8cddb7baca6..bade6841047 100644
--- a/mysql-test/suite/parts/r/partition_basic_myisam.result
+++ b/mysql-test/suite/parts/r/partition_basic_myisam.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -52,8 +52,8 @@ SET @@session.sql_mode= '';
# 1.1 The partitioning function contains one column.
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -67,8 +67,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -512,8 +512,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -527,8 +527,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -978,8 +978,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1001,8 +1001,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -1465,8 +1465,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1486,8 +1486,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -1942,8 +1942,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1961,8 +1961,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -2423,8 +2423,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2446,8 +2446,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -2913,8 +2913,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2940,8 +2940,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -3409,8 +3409,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3428,8 +3428,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -3893,8 +3893,8 @@ DROP TABLE t1;
# 1.2 The partitioning function contains two columns.
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3908,8 +3908,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -4353,8 +4353,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4368,8 +4368,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -4819,8 +4819,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4842,8 +4842,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -5306,8 +5306,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5327,8 +5327,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -5783,8 +5783,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5802,8 +5802,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -6262,8 +6262,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6285,8 +6285,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -6752,8 +6752,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6775,8 +6775,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -7244,8 +7244,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7263,8 +7263,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -7732,8 +7732,8 @@ DROP TABLE t1;
# 2.5 PRIMARY KEY + UNIQUE INDEX consisting of two columns
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7747,8 +7747,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -8245,8 +8245,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8260,8 +8260,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -8764,8 +8764,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8787,8 +8787,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -9304,8 +9304,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9325,8 +9325,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -9834,8 +9834,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9853,8 +9853,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -10368,8 +10368,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10391,8 +10391,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -10911,8 +10911,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10938,8 +10938,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -11460,8 +11460,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11479,8 +11479,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -12001,8 +12001,8 @@ DROP TABLE t1;
# 3.3 PRIMARY KEY and UNIQUE INDEX consisting of two columns
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12016,8 +12016,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -12514,8 +12514,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12529,8 +12529,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -13033,8 +13033,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13056,8 +13056,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -13573,8 +13573,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13594,8 +13594,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -14103,8 +14103,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14122,8 +14122,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -14635,8 +14635,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14658,8 +14658,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -15178,8 +15178,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15201,8 +15201,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -15723,8 +15723,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15742,8 +15742,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
diff --git a/mysql-test/suite/parts/r/partition_basic_symlink_myisam.result b/mysql-test/suite/parts/r/partition_basic_symlink_myisam.result
index 5f44fd138d9..006820d3f18 100644
--- a/mysql-test/suite/parts/r/partition_basic_symlink_myisam.result
+++ b/mysql-test/suite/parts/r/partition_basic_symlink_myisam.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -56,8 +56,8 @@ SET @@session.sql_mode= '';
# 1.1 The partitioning function contains one column.
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -77,8 +77,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -527,8 +527,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -557,8 +557,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -1022,8 +1022,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1053,8 +1053,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -1533,8 +1533,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1566,8 +1566,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -2034,8 +2034,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2061,8 +2061,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -2539,8 +2539,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2566,8 +2566,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -3049,8 +3049,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3096,8 +3096,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -3581,8 +3581,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3606,8 +3606,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -4089,8 +4089,8 @@ DROP TABLE t1;
# 1.2 The partitioning function contains two columns.
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4110,8 +4110,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -4560,8 +4560,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4590,8 +4590,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -5055,8 +5055,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5086,8 +5086,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -5566,8 +5566,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -5599,8 +5599,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -6067,8 +6067,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6094,8 +6094,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -6570,8 +6570,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -6597,8 +6597,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -7080,8 +7080,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7127,8 +7127,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -7612,8 +7612,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -7637,8 +7637,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -8124,8 +8124,8 @@ DROP TABLE t1;
# 2.5 PRIMARY KEY + UNIQUE INDEX consisting of two columns
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8145,8 +8145,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -8648,8 +8648,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -8678,8 +8678,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -9196,8 +9196,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9227,8 +9227,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -9760,8 +9760,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -9793,8 +9793,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -10314,8 +10314,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10341,8 +10341,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -10872,8 +10872,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -10899,8 +10899,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -11435,8 +11435,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -11482,8 +11482,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -12020,8 +12020,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12045,8 +12045,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -12585,8 +12585,8 @@ DROP TABLE t1;
# 3.3 PRIMARY KEY and UNIQUE INDEX consisting of two columns
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -12606,8 +12606,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -13109,8 +13109,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13139,8 +13139,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -13657,8 +13657,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -13688,8 +13688,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -14221,8 +14221,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14254,8 +14254,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -14775,8 +14775,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -14802,8 +14802,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -15331,8 +15331,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15358,8 +15358,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -15894,8 +15894,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -15941,8 +15941,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -16479,8 +16479,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -16504,8 +16504,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -17042,8 +17042,8 @@ DROP TABLE t1;
#========================================================================
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17061,8 +17061,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -17562,8 +17562,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -17587,8 +17587,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -18100,8 +18100,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18131,8 +18131,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -18657,8 +18657,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -18684,8 +18684,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -19199,8 +19199,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19222,8 +19222,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -19745,8 +19745,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -19773,8 +19773,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
@@ -20301,8 +20301,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -20316,8 +20316,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL,
diff --git a/mysql-test/suite/parts/r/partition_bit_innodb.result b/mysql-test/suite/parts/r/partition_bit_innodb.result
index 2e802d85b1f..558b5b3aae4 100644
--- a/mysql-test/suite/parts/r/partition_bit_innodb.result
+++ b/mysql-test/suite/parts/r/partition_bit_innodb.result
@@ -6,7 +6,7 @@ create table t1 (a bit(0), primary key (a)) engine='INNODB' partition by key (a)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bit(1) NOT NULL DEFAULT b'0',
+ `a` bit(1) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) */
@@ -18,7 +18,7 @@ partition pa2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bit(1) NOT NULL DEFAULT b'0',
+ `a` bit(1) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
@@ -30,7 +30,7 @@ partition by key (a) partitions 2;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bit(64) NOT NULL DEFAULT b'0',
+ `a` bit(64) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
@@ -58,7 +58,7 @@ partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bit(64) NOT NULL DEFAULT b'0',
+ `a` bit(64) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
@@ -88,7 +88,7 @@ partition by key (a) partitions 4;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` bit(1) NOT NULL DEFAULT b'0',
+ `a` bit(1) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
@@ -102,7 +102,7 @@ alter table t2 drop primary key;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` bit(1) NOT NULL DEFAULT b'0'
+ `a` bit(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 4 */
@@ -114,7 +114,7 @@ alter table t2 add primary key (a);
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` bit(1) NOT NULL DEFAULT b'0',
+ `a` bit(1) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
@@ -133,7 +133,7 @@ partition pa4 values less than (256));
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `a` bit(8) NOT NULL DEFAULT b'0',
+ `a` bit(8) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
@@ -416,7 +416,7 @@ partition pa3 values in (17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32));
show create table t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `a` bit(8) NOT NULL DEFAULT b'0',
+ `a` bit(8) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY LIST (a)
diff --git a/mysql-test/suite/parts/r/partition_bit_myisam.result b/mysql-test/suite/parts/r/partition_bit_myisam.result
index c396cf66521..c101f44475d 100644
--- a/mysql-test/suite/parts/r/partition_bit_myisam.result
+++ b/mysql-test/suite/parts/r/partition_bit_myisam.result
@@ -6,7 +6,7 @@ create table t1 (a bit(0), primary key (a)) engine='MyISAM' partition by key (a)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bit(1) NOT NULL DEFAULT b'0',
+ `a` bit(1) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) */
@@ -18,7 +18,7 @@ partition pa2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bit(1) NOT NULL DEFAULT b'0',
+ `a` bit(1) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
@@ -30,7 +30,7 @@ partition by key (a) partitions 2;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bit(64) NOT NULL DEFAULT b'0',
+ `a` bit(64) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
@@ -58,7 +58,7 @@ partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bit(64) NOT NULL DEFAULT b'0',
+ `a` bit(64) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
@@ -88,7 +88,7 @@ partition by key (a) partitions 4;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` bit(1) NOT NULL DEFAULT b'0',
+ `a` bit(1) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
@@ -102,7 +102,7 @@ alter table t2 drop primary key;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` bit(1) NOT NULL DEFAULT b'0'
+ `a` bit(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 4 */
@@ -114,7 +114,7 @@ alter table t2 add primary key (a);
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` bit(1) NOT NULL DEFAULT b'0',
+ `a` bit(1) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
@@ -133,7 +133,7 @@ partition pa4 values less than (256));
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `a` bit(8) NOT NULL DEFAULT b'0',
+ `a` bit(8) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
@@ -416,7 +416,7 @@ partition pa3 values in (17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32));
show create table t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `a` bit(8) NOT NULL DEFAULT b'0',
+ `a` bit(8) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY LIST (a)
diff --git a/mysql-test/suite/parts/r/partition_debug_sync_innodb.result b/mysql-test/suite/parts/r/partition_debug_sync_innodb.result
index 268db30bda0..77129d6bebb 100644
--- a/mysql-test/suite/parts/r/partition_debug_sync_innodb.result
+++ b/mysql-test/suite/parts/r/partition_debug_sync_innodb.result
@@ -58,7 +58,10 @@ t1.frm
t1.par
SET DEBUG_SYNC='before_open_in_get_all_tables SIGNAL parked WAIT_FOR open';
SET DEBUG_SYNC='partition_open_error SIGNAL alter WAIT_FOR finish';
-SELECT * FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
+SELECT TABLE_SCHEMA, TABLE_NAME, PARTITION_NAME, PARTITION_ORDINAL_POSITION,
+PARTITION_DESCRIPTION, TABLE_ROWS
+FROM INFORMATION_SCHEMA.PARTITIONS
+WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
SET DEBUG_SYNC = 'now WAIT_FOR parked';
# When waiting for the name lock in get_all_tables in sql_show.cc
# this will not be concurrent any more, thus the TIMEOUT
@@ -70,9 +73,9 @@ ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
PARTITION p10 VALUES LESS THAN MAXVALUE);
Warnings:
Warning 1639 debug sync point wait timed out
-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 RANGE NULL a NULL 10 1 16384 16384 NULL 0 0 NULL NULL NULL NULL default NULL
-def test t1 p10 NULL 2 NULL RANGE NULL a NULL MAXVALUE 3 5461 16384 NULL 0 0 NULL NULL NULL NULL default NULL
+TABLE_SCHEMA TABLE_NAME PARTITION_NAME PARTITION_ORDINAL_POSITION PARTITION_DESCRIPTION TABLE_ROWS
+test t1 p0 1 10 1
+test t1 p10 2 MAXVALUE 3
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
diff --git a/mysql-test/suite/parts/r/partition_engine_innodb.result b/mysql-test/suite/parts/r/partition_engine_innodb.result
index 8e5f7c43dd9..c3cb7cff083 100644
--- a/mysql-test/suite/parts/r/partition_engine_innodb.result
+++ b/mysql-test/suite/parts/r/partition_engine_innodb.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -48,8 +48,8 @@ DROP TABLE IF EXISTS t1;
# 1 Assignment of storage engine just after column list only
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -62,8 +62,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -502,8 +502,8 @@ DROP TABLE t1;
# name only
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -519,8 +519,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -956,8 +956,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -978,8 +978,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -1422,8 +1422,8 @@ DROP TABLE t1;
# engine assigned
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1434,8 +1434,8 @@ PARTITION part2
);
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MariaDB
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1446,8 +1446,8 @@ PARTITION part2 STORAGE ENGINE = 'InnoDB'
);
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MariaDB
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1463,8 +1463,8 @@ SUBPARTITION subpart22 STORAGE ENGINE = 'InnoDB')
);
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MariaDB
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1480,8 +1480,8 @@ SUBPARTITION subpart22 )
);
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MariaDB
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1503,8 +1503,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -1947,8 +1947,8 @@ DROP TABLE t1;
# subpartitions belonging to another partition
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1964,8 +1964,8 @@ SUBPARTITION subpart22 STORAGE ENGINE = 'InnoDB')
);
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MariaDB
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1982,8 +1982,8 @@ SUBPARTITION subpart22 STORAGE ENGINE = 'InnoDB')
);
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2004,8 +2004,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -2444,8 +2444,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2466,8 +2466,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -2911,8 +2911,8 @@ DROP TABLE t1;
# 5.1 Storage engine assignment after column list + after partition
# or subpartition name
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2928,8 +2928,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -3365,8 +3365,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3387,8 +3387,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -3830,8 +3830,8 @@ DROP TABLE t1;
# subpartition name
# in partition part + in sub partition part
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3852,8 +3852,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -4296,8 +4296,8 @@ DROP TABLE t1;
#------------------------------------------------------------------------
SET SESSION storage_engine='MEMORY';
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4310,8 +4310,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -4746,8 +4746,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4764,8 +4764,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
diff --git a/mysql-test/suite/parts/r/partition_engine_myisam.result b/mysql-test/suite/parts/r/partition_engine_myisam.result
index e63f9ee2fff..02f8649692d 100644
--- a/mysql-test/suite/parts/r/partition_engine_myisam.result
+++ b/mysql-test/suite/parts/r/partition_engine_myisam.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -48,8 +48,8 @@ DROP TABLE IF EXISTS t1;
# 1 Assignment of storage engine just after column list only
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -62,8 +62,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -511,8 +511,8 @@ DROP TABLE t1;
# name only
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -528,8 +528,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -974,8 +974,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -996,8 +996,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -1453,8 +1453,8 @@ DROP TABLE t1;
# engine assigned
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1465,8 +1465,8 @@ PARTITION part2
);
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MariaDB
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1477,8 +1477,8 @@ PARTITION part2 STORAGE ENGINE = 'MyISAM'
);
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MariaDB
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1494,8 +1494,8 @@ SUBPARTITION subpart22 STORAGE ENGINE = 'MyISAM')
);
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MariaDB
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1511,8 +1511,8 @@ SUBPARTITION subpart22 )
);
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MariaDB
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1534,8 +1534,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -1991,8 +1991,8 @@ DROP TABLE t1;
# subpartitions belonging to another partition
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2008,8 +2008,8 @@ SUBPARTITION subpart22 STORAGE ENGINE = 'MyISAM')
);
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MariaDB
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2026,8 +2026,8 @@ SUBPARTITION subpart22 STORAGE ENGINE = 'MyISAM')
);
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2048,8 +2048,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -2501,8 +2501,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2523,8 +2523,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -2981,8 +2981,8 @@ DROP TABLE t1;
# 5.1 Storage engine assignment after column list + after partition
# or subpartition name
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -2998,8 +2998,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -3444,8 +3444,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3466,8 +3466,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -3922,8 +3922,8 @@ DROP TABLE t1;
# subpartition name
# in partition part + in sub partition part
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -3944,8 +3944,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -4401,8 +4401,8 @@ DROP TABLE t1;
#------------------------------------------------------------------------
SET SESSION storage_engine='MEMORY';
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4415,8 +4415,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -4858,8 +4858,8 @@ TRUNCATE t1;
# End usability test (inc/partition_check.inc)
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -4876,8 +4876,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
diff --git a/mysql-test/suite/parts/r/partition_exch_qa_1_innodb.result b/mysql-test/suite/parts/r/partition_exch_qa_1_innodb.result
index 574518bff38..5fe5b7cbfcd 100644
--- a/mysql-test/suite/parts/r/partition_exch_qa_1_innodb.result
+++ b/mysql-test/suite/parts/r/partition_exch_qa_1_innodb.result
@@ -115,7 +115,7 @@ ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10;
show create table t_10;
Table Create Table
t_10 CREATE TABLE `t_10` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `a` (`a`) USING BTREE
@@ -123,7 +123,7 @@ t_10 CREATE TABLE `t_10` (
show create table tp ;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `a` (`a`) USING BTREE
@@ -140,7 +140,7 @@ ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10;
show create table t_10;
Table Create Table
t_10 CREATE TABLE `t_10` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `a` (`a`,`b`) USING BTREE
@@ -148,7 +148,7 @@ t_10 CREATE TABLE `t_10` (
show create table tp ;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `a` (`a`,`b`) USING BTREE
diff --git a/mysql-test/suite/parts/r/partition_exch_qa_1_myisam.result b/mysql-test/suite/parts/r/partition_exch_qa_1_myisam.result
index f15e56e76aa..8a9ffd0479a 100644
--- a/mysql-test/suite/parts/r/partition_exch_qa_1_myisam.result
+++ b/mysql-test/suite/parts/r/partition_exch_qa_1_myisam.result
@@ -115,7 +115,7 @@ ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10;
show create table t_10;
Table Create Table
t_10 CREATE TABLE `t_10` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `a` (`a`) USING BTREE
@@ -123,7 +123,7 @@ t_10 CREATE TABLE `t_10` (
show create table tp ;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `a` (`a`) USING BTREE
@@ -140,7 +140,7 @@ ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10;
show create table t_10;
Table Create Table
t_10 CREATE TABLE `t_10` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `a` (`a`,`b`) USING BTREE
@@ -148,7 +148,7 @@ t_10 CREATE TABLE `t_10` (
show create table tp ;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `a` (`a`,`b`) USING BTREE
diff --git a/mysql-test/suite/parts/r/partition_exchange_innodb.result b/mysql-test/suite/parts/r/partition_exchange_innodb.result
index d3287310f73..f0e4923d39a 100644
--- a/mysql-test/suite/parts/r/partition_exchange_innodb.result
+++ b/mysql-test/suite/parts/r/partition_exchange_innodb.result
@@ -183,14 +183,14 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
@@ -226,14 +226,14 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
@@ -301,14 +301,14 @@ SET DEBUG_SYNC= 'now SIGNAL test_done';
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
@@ -334,14 +334,14 @@ SET DEBUG_SYNC= 'RESET';
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
diff --git a/mysql-test/suite/parts/r/partition_exchange_memory.result b/mysql-test/suite/parts/r/partition_exchange_memory.result
index b6df8259b8c..9cc42791905 100644
--- a/mysql-test/suite/parts/r/partition_exchange_memory.result
+++ b/mysql-test/suite/parts/r/partition_exchange_memory.result
@@ -183,14 +183,14 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1
@@ -226,14 +226,14 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1
@@ -301,14 +301,14 @@ SET DEBUG_SYNC= 'now SIGNAL test_done';
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1
@@ -334,14 +334,14 @@ SET DEBUG_SYNC= 'RESET';
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1
diff --git a/mysql-test/suite/parts/r/partition_exchange_myisam.result b/mysql-test/suite/parts/r/partition_exchange_myisam.result
index 932891d74fa..c31e2a6ee89 100644
--- a/mysql-test/suite/parts/r/partition_exchange_myisam.result
+++ b/mysql-test/suite/parts/r/partition_exchange_myisam.result
@@ -183,14 +183,14 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -226,14 +226,14 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -301,14 +301,14 @@ SET DEBUG_SYNC= 'now SIGNAL test_done';
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -334,14 +334,14 @@ SET DEBUG_SYNC= 'RESET';
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE tp;
Table Create Table
tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
diff --git a/mysql-test/suite/parts/r/partition_special_innodb.result b/mysql-test/suite/parts/r/partition_special_innodb.result
index 37bc3e49ab7..1a513aa3d5f 100644
--- a/mysql-test/suite/parts/r/partition_special_innodb.result
+++ b/mysql-test/suite/parts/r/partition_special_innodb.result
@@ -10,7 +10,7 @@ t1 CREATE TABLE `t1` (
`a` date NOT NULL,
`b` varchar(50) NOT NULL,
`c` varchar(50) NOT NULL,
- `d` enum('m','w') NOT NULL DEFAULT 'm',
+ `d` enum('m','w') NOT NULL,
PRIMARY KEY (`a`,`b`,`c`,`d`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a,b,c,d)
diff --git a/mysql-test/suite/parts/r/partition_special_myisam.result b/mysql-test/suite/parts/r/partition_special_myisam.result
index 31868ea03ed..d300d6d2d44 100644
--- a/mysql-test/suite/parts/r/partition_special_myisam.result
+++ b/mysql-test/suite/parts/r/partition_special_myisam.result
@@ -10,7 +10,7 @@ t1 CREATE TABLE `t1` (
`a` date NOT NULL,
`b` varchar(50) NOT NULL,
`c` varchar(50) NOT NULL,
- `d` enum('m','w') NOT NULL DEFAULT 'm',
+ `d` enum('m','w') NOT NULL,
PRIMARY KEY (`a`,`b`,`c`,`d`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a,b,c,d)
diff --git a/mysql-test/suite/parts/r/partition_syntax_innodb.result b/mysql-test/suite/parts/r/partition_syntax_innodb.result
index 92af6bc733f..3dba2873235 100644
--- a/mysql-test/suite/parts/r/partition_syntax_innodb.result
+++ b/mysql-test/suite/parts/r/partition_syntax_innodb.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -48,8 +48,8 @@ DROP TABLE IF EXISTS t1;
# PARTITION BY HASH/KEY/LIST/RANGE
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -58,8 +58,8 @@ PRIMARY KEY (f_int2)
PARTITION BY HASH(f_int1) PARTITIONS 2;
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -68,8 +68,8 @@ PRIMARY KEY (f_int2)
PARTITION BY HASH(f_int1 + f_int2) PARTITIONS 2;
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -78,8 +78,8 @@ PRIMARY KEY (f_int2)
PARTITION BY KEY(f_int1) PARTITIONS 2;
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -88,8 +88,8 @@ PRIMARY KEY (f_int2)
PARTITION BY KEY(f_int1,f_int2) PARTITIONS 2;
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -99,8 +99,8 @@ PARTITION BY LIST(f_int1)
(PARTITION part1 VALUES IN (1));
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -110,8 +110,8 @@ PARTITION BY LIST(f_int1 + f_int2)
(PARTITION part1 VALUES IN (1));
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -121,8 +121,8 @@ PARTITION BY RANGE(f_int1)
(PARTITION part1 VALUES LESS THAN (1));
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -140,8 +140,8 @@ ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning
# Variant 2) two columns in partitioning function
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -150,8 +150,8 @@ UNIQUE INDEX (f_int2)
PARTITION BY HASH(f_int1) PARTITIONS 2;
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -160,8 +160,8 @@ PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
PARTITION BY HASH(f_int1) PARTITIONS 2;
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -170,8 +170,8 @@ UNIQUE INDEX (f_int2)
PARTITION BY HASH(f_int1 + f_int2) PARTITIONS 2;
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -180,8 +180,8 @@ PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
PARTITION BY HASH(f_int1 + f_int2) PARTITIONS 2;
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -190,8 +190,8 @@ UNIQUE INDEX (f_int2)
PARTITION BY KEY(f_int1) PARTITIONS 2;
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -200,8 +200,8 @@ PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
PARTITION BY KEY(f_int1) PARTITIONS 2;
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -210,8 +210,8 @@ UNIQUE INDEX (f_int2)
PARTITION BY KEY(f_int1,f_int2) PARTITIONS 2;
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -220,8 +220,8 @@ PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
PARTITION BY KEY(f_int1,f_int2) PARTITIONS 2;
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -234,8 +234,8 @@ PARTITION part1 VALUES IN (1),
PARTITION part2 VALUES IN (2));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -248,8 +248,8 @@ PARTITION part1 VALUES IN (1),
PARTITION part2 VALUES IN (2));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -262,8 +262,8 @@ PARTITION part1 VALUES IN (1),
PARTITION part2 VALUES IN (2));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -276,8 +276,8 @@ PARTITION part1 VALUES IN (1),
PARTITION part2 VALUES IN (2));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -288,8 +288,8 @@ PARTITION BY RANGE(f_int1)
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -300,8 +300,8 @@ PARTITION BY RANGE(f_int1)
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -312,8 +312,8 @@ PARTITION BY RANGE(f_int1 + f_int2)
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -328,8 +328,8 @@ ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning
# PARTITION BY RANGE/LIST -- SUBPARTITION BY HASH/KEY
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -340,8 +340,8 @@ PARTITION BY RANGE(f_int2) SUBPARTITION BY HASH(f_int1)
(SUBPARTITION subpart1));
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -352,8 +352,8 @@ PARTITION BY RANGE(f_int2) SUBPARTITION BY KEY(f_int1)
(SUBPARTITION subpart1));
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -364,8 +364,8 @@ PARTITION BY LIST(f_int2) SUBPARTITION BY HASH(f_int1)
(SUBPARTITION subpart1));
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -382,8 +382,8 @@ ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning
# Variant b) With correct additional PRIMARY KEY
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -395,8 +395,8 @@ SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 3
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -408,8 +408,8 @@ SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 3
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -421,8 +421,8 @@ SUBPARTITION BY KEY(f_int1) SUBPARTITIONS 3
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -434,8 +434,8 @@ SUBPARTITION BY KEY(f_int1) SUBPARTITIONS 3
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -449,8 +449,8 @@ PARTITION part1 VALUES IN (1),
PARTITION part2 VALUES IN (2));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -464,8 +464,8 @@ PARTITION part1 VALUES IN (1),
PARTITION part2 VALUES IN (2));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -479,8 +479,8 @@ PARTITION part1 VALUES IN (1),
PARTITION part2 VALUES IN (2));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -502,8 +502,8 @@ ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning
#------------------------------------------------------------------------
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -517,8 +517,8 @@ ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY pa
# later releases.
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -539,8 +539,8 @@ ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setti
# 3.1 The constants in VALUES IN clauses must differ
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -569,8 +569,8 @@ ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partiti
# 3.3 LIST partitions must be defined with VALUES IN
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -584,8 +584,8 @@ ERROR HY000: Only RANGE PARTITIONING can use VALUES LESS THAN in partition defin
# 3.4 RANGE partitions must be defined with VALUES LESS THAN
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -601,8 +601,8 @@ ERROR HY000: Only LIST PARTITIONING can use VALUES IN in partition definition
# 3.5.1 NULL in RANGE partitioning clause
# 3.5.1.1 VALUE LESS THAN (NULL) is not allowed
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -613,8 +613,8 @@ PARTITION part2 VALUES LESS THAN (1000));
ERROR HY000: Not allowed to use NULL value in VALUES LESS THAN
# 3.5.1.2 VALUE LESS THAN (NULL) is not allowed
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -626,8 +626,8 @@ ERROR HY000: Not allowed to use NULL value in VALUES LESS THAN
# 3.5.2 NULL in LIST partitioning clause
# 3.5.2.1 VALUE IN (NULL)
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -639,8 +639,8 @@ PARTITION part3 VALUES IN (1));
DROP TABLE t1;
# 3.5.2.2 VALUE IN (NULL)
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -652,8 +652,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -665,8 +665,8 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
# 3.5.3 Reveal that IN (...NULL) is not mapped to IN(0)
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -679,8 +679,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -702,8 +702,8 @@ DROP TABLE IF EXISTS t1;
#------------------------------------------------------------------------
# 4.1.1 no partition number, no named partitions
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -713,8 +713,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -724,8 +724,8 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
# 4.1.2 no partition number, named partitions
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -735,8 +735,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -748,31 +748,31 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
# 4.1.3 variations on no partition/subpartition number, named partitions,
# different subpartitions are/are not named
-CREATE TABLE t1 ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10), PARTITION part2 VALUES LESS THAN (20), PARTITION part3 VALUES LESS THAN (2147483646)) ;
DROP TABLE t1;
-CREATE TABLE t1 ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10), PARTITION part2 VALUES LESS THAN (20), PARTITION part3 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart31 , SUBPARTITION subpart32 )) ;
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart31 , SUBPARTITION subpart32 ))' at line 7
-CREATE TABLE t1 ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10), PARTITION part2 VALUES LESS THAN (20)
(SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS THAN (2147483646)) ;
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS T' at line 7
-CREATE TABLE t1 ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -780,16 +780,16 @@ PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES
(SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart31 , SUBPARTITION subpart32 )) ;
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS T' at line 7
-CREATE TABLE t1 ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10)
(SUBPARTITION subpart11 , SUBPARTITION subpart12 ), PARTITION part2 VALUES LESS THAN (20), PARTITION part3 VALUES LESS THAN (2147483646)) ;
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near ' PARTITION part3 VALUES LESS THAN (2147483646))' at line 7
-CREATE TABLE t1 ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -798,8 +798,8 @@ PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES
(SUBPARTITION subpart31 , SUBPARTITION subpart32 )) ;
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near ' PARTITION part3 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart31 , SUBPART' at line 7
-CREATE TABLE t1 ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -807,8 +807,8 @@ PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES
(SUBPARTITION subpart11 , SUBPARTITION subpart12 ), PARTITION part2 VALUES LESS THAN (20)
(SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS THAN (2147483646)) ;
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near ')' at line 8
-CREATE TABLE t1 ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -820,8 +820,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -845,8 +845,8 @@ DROP TABLE t1;
DROP TABLE IF EXISTS t1;
# 4.2.1 partition/subpartition numbers INTEGER notation
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -856,8 +856,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -867,8 +867,8 @@ PARTITIONS 2 */
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -881,8 +881,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -895,8 +895,8 @@ SUBPARTITIONS 2
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -906,8 +906,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -917,8 +917,8 @@ PARTITIONS 1 */
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -931,8 +931,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -945,8 +945,8 @@ SUBPARTITIONS 1
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -954,8 +954,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 0;
ERROR HY000: Number of partitions = 0 is not an allowed value
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -966,8 +966,8 @@ SUBPARTITIONS 0
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR HY000: Number of subpartitions = 0 is not an allowed value
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -975,8 +975,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS -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 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -989,8 +989,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (214' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -998,8 +998,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 1000000;
ERROR HY000: Too many partitions (including subpartitions) were defined
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1011,8 +1011,8 @@ PARTITION part2 VALUES LESS THAN (2147483646));
ERROR HY000: Too many partitions (including subpartitions) were defined
# 4.2.2 partition/subpartition numbers DECIMAL notation
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1020,8 +1020,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 2.0;
ERROR 42000: Only integers allowed as number here near '2.0' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1034,8 +1034,8 @@ ERROR 42000: Only integers allowed as number here near '2.0
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (21' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1043,8 +1043,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS -2.0;
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.0' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1057,8 +1057,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (2' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1066,8 +1066,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 0.0;
ERROR 42000: Only integers allowed as number here near '0.0' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1080,8 +1080,8 @@ ERROR 42000: Only integers allowed as number here near '0.0
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (21' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1089,8 +1089,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 1.6;
ERROR 42000: Only integers allowed as number here near '1.6' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1103,8 +1103,8 @@ ERROR 42000: Only integers allowed as number here near '1.6
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (21' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1112,8 +1112,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 999999999999999999999999999999.999999999999999999999999999999;
ERROR 42000: Only integers allowed as number here near '999999999999999999999999999999.999999999999999999999999999999' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1125,8 +1125,8 @@ PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '999999999999999999999999999999.999999999999999999999999999999
(PARTITION part1 V' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1134,8 +1134,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 0.000000000000000000000000000001;
ERROR 42000: Only integers allowed as number here near '0.000000000000000000000000000001' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1149,8 +1149,8 @@ ERROR 42000: Only integers allowed as number here near '0.0000000000000000000000
PARTITI' at line 9
# 4.2.3 partition/subpartition numbers FLOAT notation
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1158,8 +1158,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 2.0E+0;
ERROR 42000: Only integers allowed as number here near '2.0E+0' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1172,8 +1172,8 @@ ERROR 42000: Only integers allowed as number here near '2.0E+0
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN ' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1181,8 +1181,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 0.2E+1;
ERROR 42000: Only integers allowed as number here near '0.2E+1' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1195,8 +1195,8 @@ ERROR 42000: Only integers allowed as number here near '0.2E+1
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN ' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1204,8 +1204,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS -2.0E+0;
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.0E+0' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1218,8 +1218,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1227,8 +1227,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 0.16E+1;
ERROR 42000: Only integers allowed as number here near '0.16E+1' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1241,8 +1241,8 @@ ERROR 42000: Only integers allowed as number here near '0.16E+1
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1250,8 +1250,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 0.0E+300;
ERROR 42000: Only integers allowed as number here near '0.0E+300' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1264,8 +1264,8 @@ ERROR 42000: Only integers allowed as number here near '0.0E+300
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THA' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1273,8 +1273,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 1E+300;
ERROR 42000: Only integers allowed as number here near '1E+300' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1287,8 +1287,8 @@ ERROR 42000: Only integers allowed as number here near '1E+300
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN ' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1296,8 +1296,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 1E-300;
ERROR 42000: Only integers allowed as number here near '1E-300' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1311,8 +1311,8 @@ ERROR 42000: Only integers allowed as number here near '1E-300
PARTITION part2 VALUES LESS THAN ' at line 9
# 4.2.4 partition/subpartition numbers STRING notation
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1320,8 +1320,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS '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 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1334,8 +1334,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (21' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1343,8 +1343,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS '2.0';
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.0'' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1357,8 +1357,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1366,8 +1366,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS '0.2E+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 ''0.2E+1'' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1380,8 +1380,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THA' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1389,8 +1389,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS '2A';
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 ''2A'' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1403,8 +1403,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (2' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1412,8 +1412,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 'A2';
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 ''A2'' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1426,8 +1426,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (2' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1435,8 +1435,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS '';
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 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1449,8 +1449,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (214' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1458,8 +1458,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 'GARBAGE';
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 ''GARBAGE'' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1473,8 +1473,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
PARTITION part2 VALUES LESS TH' at line 9
# 4.2.5 partition/subpartition numbers other notations
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1482,8 +1482,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 2A;
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 '2A' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1496,8 +1496,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (214' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1505,8 +1505,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS A2;
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 'A2' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1519,8 +1519,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (214' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1528,8 +1528,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS GARBAGE;
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 'GARBAGE' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1542,8 +1542,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1551,8 +1551,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS "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 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1565,8 +1565,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (21' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1574,8 +1574,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS "2A";
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 '"2A"' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1588,8 +1588,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (2' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1597,8 +1597,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS "A2";
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 '"A2"' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1611,8 +1611,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (2' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1620,8 +1620,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS "GARBAGE";
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 '"GARBAGE"' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1636,8 +1636,8 @@ PARTITION part2 VALUES LESS TH' at line 9
# 4.2.6 (negative) partition/subpartition numbers per @variables
SET @aux = 5;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1645,8 +1645,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS @aux;
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 '@aux' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1664,8 +1664,8 @@ PARTITION part2 VALUES LESS THA' at line 9
# 4.3.1 (positive) number of partition/subpartition
# = number of named partition/subpartition
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1675,8 +1675,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -1687,8 +1687,8 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1704,8 +1704,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -1726,8 +1726,8 @@ DROP TABLE t1;
# 4.3.3 (negative) number of partitions/subpartitions
# > number of named partitions/subpartitions
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1735,8 +1735,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 2 ( PARTITION part1 ) ;
ERROR 42000: Wrong number of partitions defined, mismatch with previous setting near ')' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1752,8 +1752,8 @@ ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setti
PARTITION part2 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart21, SUBPAR' at line 11
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1771,8 +1771,8 @@ ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setti
PARTITION part3 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart31, SUBPAR' at line 13
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1788,8 +1788,8 @@ ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setti
)' at line 13
# 4.3.4 (negative) number of partitions < number of named partitions
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1797,8 +1797,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 1 ( PARTITION part1, PARTITION part2 ) ;
ERROR 42000: Wrong number of partitions defined, mismatch with previous setting near ')' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1814,8 +1814,8 @@ ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setti
PARTITION part2 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart21, SUBPAR' at line 11
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1833,8 +1833,8 @@ ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setti
PARTITION part2 VALUES LESS THAN (2000)
(SUBPARTITION subpart21 ' at line 11
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1860,8 +1860,8 @@ DROP TABLE IF EXISTS t1;
#------------------------------------------------------------------------
# 5.1.1 duplicate partition name
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1870,8 +1870,8 @@ PARTITION BY HASH(f_int1) (PARTITION part1, PARTITION part1);
ERROR HY000: Duplicate partition name part1
# 5.1.2 duplicate subpartition name
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
diff --git a/mysql-test/suite/parts/r/partition_syntax_myisam.result b/mysql-test/suite/parts/r/partition_syntax_myisam.result
index ae401e7f88a..7da964a1f8c 100644
--- a/mysql-test/suite/parts/r/partition_syntax_myisam.result
+++ b/mysql-test/suite/parts/r/partition_syntax_myisam.result
@@ -11,8 +11,8 @@ SELECT @max_row DIV 4 INTO @max_row_div4;
SET @max_int_4 = 2147483647;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
@@ -27,8 +27,8 @@ file_list VARBINARY(10000),
PRIMARY KEY (state)
) ENGINE = MEMORY;
DROP TABLE IF EXISTS t0_aux;
-CREATE TABLE t0_aux ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t0_aux ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -48,8 +48,8 @@ DROP TABLE IF EXISTS t1;
# PARTITION BY HASH/KEY/LIST/RANGE
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -58,8 +58,8 @@ PRIMARY KEY (f_int2)
PARTITION BY HASH(f_int1) PARTITIONS 2;
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -68,8 +68,8 @@ PRIMARY KEY (f_int2)
PARTITION BY HASH(f_int1 + f_int2) PARTITIONS 2;
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -78,8 +78,8 @@ PRIMARY KEY (f_int2)
PARTITION BY KEY(f_int1) PARTITIONS 2;
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -88,8 +88,8 @@ PRIMARY KEY (f_int2)
PARTITION BY KEY(f_int1,f_int2) PARTITIONS 2;
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -99,8 +99,8 @@ PARTITION BY LIST(f_int1)
(PARTITION part1 VALUES IN (1));
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -110,8 +110,8 @@ PARTITION BY LIST(f_int1 + f_int2)
(PARTITION part1 VALUES IN (1));
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -121,8 +121,8 @@ PARTITION BY RANGE(f_int1)
(PARTITION part1 VALUES LESS THAN (1));
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -140,8 +140,8 @@ ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning
# Variant 2) two columns in partitioning function
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -150,8 +150,8 @@ UNIQUE INDEX (f_int2)
PARTITION BY HASH(f_int1) PARTITIONS 2;
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -160,8 +160,8 @@ PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
PARTITION BY HASH(f_int1) PARTITIONS 2;
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -170,8 +170,8 @@ UNIQUE INDEX (f_int2)
PARTITION BY HASH(f_int1 + f_int2) PARTITIONS 2;
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -180,8 +180,8 @@ PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
PARTITION BY HASH(f_int1 + f_int2) PARTITIONS 2;
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -190,8 +190,8 @@ UNIQUE INDEX (f_int2)
PARTITION BY KEY(f_int1) PARTITIONS 2;
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -200,8 +200,8 @@ PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
PARTITION BY KEY(f_int1) PARTITIONS 2;
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -210,8 +210,8 @@ UNIQUE INDEX (f_int2)
PARTITION BY KEY(f_int1,f_int2) PARTITIONS 2;
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -220,8 +220,8 @@ PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
PARTITION BY KEY(f_int1,f_int2) PARTITIONS 2;
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -234,8 +234,8 @@ PARTITION part1 VALUES IN (1),
PARTITION part2 VALUES IN (2));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -248,8 +248,8 @@ PARTITION part1 VALUES IN (1),
PARTITION part2 VALUES IN (2));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -262,8 +262,8 @@ PARTITION part1 VALUES IN (1),
PARTITION part2 VALUES IN (2));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -276,8 +276,8 @@ PARTITION part1 VALUES IN (1),
PARTITION part2 VALUES IN (2));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -288,8 +288,8 @@ PARTITION BY RANGE(f_int1)
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -300,8 +300,8 @@ PARTITION BY RANGE(f_int1)
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -312,8 +312,8 @@ PARTITION BY RANGE(f_int1 + f_int2)
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -328,8 +328,8 @@ ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning
# PARTITION BY RANGE/LIST -- SUBPARTITION BY HASH/KEY
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -340,8 +340,8 @@ PARTITION BY RANGE(f_int2) SUBPARTITION BY HASH(f_int1)
(SUBPARTITION subpart1));
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -352,8 +352,8 @@ PARTITION BY RANGE(f_int2) SUBPARTITION BY KEY(f_int1)
(SUBPARTITION subpart1));
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -364,8 +364,8 @@ PARTITION BY LIST(f_int2) SUBPARTITION BY HASH(f_int1)
(SUBPARTITION subpart1));
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -382,8 +382,8 @@ ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning
# Variant b) With correct additional PRIMARY KEY
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -395,8 +395,8 @@ SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 3
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -408,8 +408,8 @@ SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 3
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -421,8 +421,8 @@ SUBPARTITION BY KEY(f_int1) SUBPARTITIONS 3
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -434,8 +434,8 @@ SUBPARTITION BY KEY(f_int1) SUBPARTITIONS 3
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -449,8 +449,8 @@ PARTITION part1 VALUES IN (1),
PARTITION part2 VALUES IN (2));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -464,8 +464,8 @@ PARTITION part1 VALUES IN (1),
PARTITION part2 VALUES IN (2));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -479,8 +479,8 @@ PARTITION part1 VALUES IN (1),
PARTITION part2 VALUES IN (2));
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -502,8 +502,8 @@ ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning
#------------------------------------------------------------------------
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -517,8 +517,8 @@ ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY pa
# later releases.
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000),
@@ -539,8 +539,8 @@ ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setti
# 3.1 The constants in VALUES IN clauses must differ
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -569,8 +569,8 @@ ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partiti
# 3.3 LIST partitions must be defined with VALUES IN
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -584,8 +584,8 @@ ERROR HY000: Only RANGE PARTITIONING can use VALUES LESS THAN in partition defin
# 3.4 RANGE partitions must be defined with VALUES LESS THAN
#------------------------------------------------------------------------
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -601,8 +601,8 @@ ERROR HY000: Only LIST PARTITIONING can use VALUES IN in partition definition
# 3.5.1 NULL in RANGE partitioning clause
# 3.5.1.1 VALUE LESS THAN (NULL) is not allowed
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -613,8 +613,8 @@ PARTITION part2 VALUES LESS THAN (1000));
ERROR HY000: Not allowed to use NULL value in VALUES LESS THAN
# 3.5.1.2 VALUE LESS THAN (NULL) is not allowed
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -626,8 +626,8 @@ ERROR HY000: Not allowed to use NULL value in VALUES LESS THAN
# 3.5.2 NULL in LIST partitioning clause
# 3.5.2.1 VALUE IN (NULL)
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -639,8 +639,8 @@ PARTITION part3 VALUES IN (1));
DROP TABLE t1;
# 3.5.2.2 VALUE IN (NULL)
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -652,8 +652,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -673,8 +673,8 @@ t1.par
DROP TABLE t1;
# 3.5.3 Reveal that IN (...NULL) is not mapped to IN(0)
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -687,8 +687,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -720,8 +720,8 @@ DROP TABLE IF EXISTS t1;
#------------------------------------------------------------------------
# 4.1.1 no partition number, no named partitions
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -731,8 +731,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -748,8 +748,8 @@ t1.par
DROP TABLE t1;
# 4.1.2 no partition number, named partitions
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -759,8 +759,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -780,31 +780,31 @@ t1.par
DROP TABLE t1;
# 4.1.3 variations on no partition/subpartition number, named partitions,
# different subpartitions are/are not named
-CREATE TABLE t1 ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10), PARTITION part2 VALUES LESS THAN (20), PARTITION part3 VALUES LESS THAN (2147483646)) ;
DROP TABLE t1;
-CREATE TABLE t1 ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10), PARTITION part2 VALUES LESS THAN (20), PARTITION part3 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart31 , SUBPARTITION subpart32 )) ;
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart31 , SUBPARTITION subpart32 ))' at line 7
-CREATE TABLE t1 ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10), PARTITION part2 VALUES LESS THAN (20)
(SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS THAN (2147483646)) ;
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS T' at line 7
-CREATE TABLE t1 ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -812,16 +812,16 @@ PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES
(SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart31 , SUBPARTITION subpart32 )) ;
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS T' at line 7
-CREATE TABLE t1 ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10)
(SUBPARTITION subpart11 , SUBPARTITION subpart12 ), PARTITION part2 VALUES LESS THAN (20), PARTITION part3 VALUES LESS THAN (2147483646)) ;
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near ' PARTITION part3 VALUES LESS THAN (2147483646))' at line 7
-CREATE TABLE t1 ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -830,8 +830,8 @@ PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES
(SUBPARTITION subpart31 , SUBPARTITION subpart32 )) ;
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near ' PARTITION part3 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart31 , SUBPART' at line 7
-CREATE TABLE t1 ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -839,8 +839,8 @@ PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES
(SUBPARTITION subpart11 , SUBPARTITION subpart12 ), PARTITION part2 VALUES LESS THAN (20)
(SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS THAN (2147483646)) ;
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near ')' at line 8
-CREATE TABLE t1 ( f_int1 INTEGER,
-f_int2 INTEGER,
+CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
@@ -852,8 +852,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -893,8 +893,8 @@ DROP TABLE t1;
DROP TABLE IF EXISTS t1;
# 4.2.1 partition/subpartition numbers INTEGER notation
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -904,8 +904,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -923,8 +923,8 @@ t1.par
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -937,8 +937,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -963,8 +963,8 @@ t1.par
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -974,8 +974,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -991,8 +991,8 @@ t1.par
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1005,8 +1005,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -1027,8 +1027,8 @@ t1.par
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1036,8 +1036,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 0;
ERROR HY000: Number of partitions = 0 is not an allowed value
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1048,8 +1048,8 @@ SUBPARTITIONS 0
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR HY000: Number of subpartitions = 0 is not an allowed value
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1057,8 +1057,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS -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 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1071,8 +1071,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (214' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1080,8 +1080,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 1000000;
ERROR HY000: Too many partitions (including subpartitions) were defined
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1093,8 +1093,8 @@ PARTITION part2 VALUES LESS THAN (2147483646));
ERROR HY000: Too many partitions (including subpartitions) were defined
# 4.2.2 partition/subpartition numbers DECIMAL notation
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1102,8 +1102,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 2.0;
ERROR 42000: Only integers allowed as number here near '2.0' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1116,8 +1116,8 @@ ERROR 42000: Only integers allowed as number here near '2.0
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (21' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1125,8 +1125,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS -2.0;
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.0' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1139,8 +1139,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (2' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1148,8 +1148,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 0.0;
ERROR 42000: Only integers allowed as number here near '0.0' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1162,8 +1162,8 @@ ERROR 42000: Only integers allowed as number here near '0.0
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (21' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1171,8 +1171,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 1.6;
ERROR 42000: Only integers allowed as number here near '1.6' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1185,8 +1185,8 @@ ERROR 42000: Only integers allowed as number here near '1.6
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (21' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1194,8 +1194,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 999999999999999999999999999999.999999999999999999999999999999;
ERROR 42000: Only integers allowed as number here near '999999999999999999999999999999.999999999999999999999999999999' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1207,8 +1207,8 @@ PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '999999999999999999999999999999.999999999999999999999999999999
(PARTITION part1 V' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1216,8 +1216,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 0.000000000000000000000000000001;
ERROR 42000: Only integers allowed as number here near '0.000000000000000000000000000001' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1231,8 +1231,8 @@ ERROR 42000: Only integers allowed as number here near '0.0000000000000000000000
PARTITI' at line 9
# 4.2.3 partition/subpartition numbers FLOAT notation
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1240,8 +1240,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 2.0E+0;
ERROR 42000: Only integers allowed as number here near '2.0E+0' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1254,8 +1254,8 @@ ERROR 42000: Only integers allowed as number here near '2.0E+0
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN ' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1263,8 +1263,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 0.2E+1;
ERROR 42000: Only integers allowed as number here near '0.2E+1' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1277,8 +1277,8 @@ ERROR 42000: Only integers allowed as number here near '0.2E+1
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN ' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1286,8 +1286,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS -2.0E+0;
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.0E+0' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1300,8 +1300,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1309,8 +1309,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 0.16E+1;
ERROR 42000: Only integers allowed as number here near '0.16E+1' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1323,8 +1323,8 @@ ERROR 42000: Only integers allowed as number here near '0.16E+1
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1332,8 +1332,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 0.0E+300;
ERROR 42000: Only integers allowed as number here near '0.0E+300' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1346,8 +1346,8 @@ ERROR 42000: Only integers allowed as number here near '0.0E+300
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THA' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1355,8 +1355,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 1E+300;
ERROR 42000: Only integers allowed as number here near '1E+300' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1369,8 +1369,8 @@ ERROR 42000: Only integers allowed as number here near '1E+300
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN ' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1378,8 +1378,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 1E-300;
ERROR 42000: Only integers allowed as number here near '1E-300' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1393,8 +1393,8 @@ ERROR 42000: Only integers allowed as number here near '1E-300
PARTITION part2 VALUES LESS THAN ' at line 9
# 4.2.4 partition/subpartition numbers STRING notation
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1402,8 +1402,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS '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 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1416,8 +1416,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (21' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1425,8 +1425,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS '2.0';
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.0'' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1439,8 +1439,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1448,8 +1448,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS '0.2E+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 ''0.2E+1'' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1462,8 +1462,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THA' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1471,8 +1471,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS '2A';
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 ''2A'' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1485,8 +1485,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (2' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1494,8 +1494,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 'A2';
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 ''A2'' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1508,8 +1508,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (2' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1517,8 +1517,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS '';
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 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1531,8 +1531,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (214' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1540,8 +1540,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 'GARBAGE';
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 ''GARBAGE'' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1555,8 +1555,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
PARTITION part2 VALUES LESS TH' at line 9
# 4.2.5 partition/subpartition numbers other notations
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1564,8 +1564,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 2A;
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 '2A' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1578,8 +1578,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (214' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1587,8 +1587,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS A2;
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 'A2' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1601,8 +1601,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (214' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1610,8 +1610,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS GARBAGE;
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 'GARBAGE' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1624,8 +1624,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1633,8 +1633,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS "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 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1647,8 +1647,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (21' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1656,8 +1656,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS "2A";
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 '"2A"' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1670,8 +1670,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (2' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1679,8 +1679,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS "A2";
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 '"A2"' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1693,8 +1693,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (2' at line 9
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1702,8 +1702,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS "GARBAGE";
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 '"GARBAGE"' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1718,8 +1718,8 @@ PARTITION part2 VALUES LESS TH' at line 9
# 4.2.6 (negative) partition/subpartition numbers per @variables
SET @aux = 5;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1727,8 +1727,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS @aux;
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 '@aux' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1746,8 +1746,8 @@ PARTITION part2 VALUES LESS THA' at line 9
# 4.3.1 (positive) number of partition/subpartition
# = number of named partition/subpartition
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1757,8 +1757,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -1777,8 +1777,8 @@ t1.par
DROP TABLE t1;
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1794,8 +1794,8 @@ create_command
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f_int1` int(11) DEFAULT NULL,
- `f_int2` int(11) DEFAULT NULL,
+ `f_int1` int(11) DEFAULT '0',
+ `f_int2` int(11) DEFAULT '0',
`f_char1` char(20) DEFAULT NULL,
`f_char2` char(20) DEFAULT NULL,
`f_charbig` varchar(1000) DEFAULT NULL
@@ -1828,8 +1828,8 @@ DROP TABLE t1;
# 4.3.3 (negative) number of partitions/subpartitions
# > number of named partitions/subpartitions
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1837,8 +1837,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 2 ( PARTITION part1 ) ;
ERROR 42000: Wrong number of partitions defined, mismatch with previous setting near ')' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1854,8 +1854,8 @@ ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setti
PARTITION part2 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart21, SUBPAR' at line 11
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1873,8 +1873,8 @@ ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setti
PARTITION part3 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart31, SUBPAR' at line 13
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1890,8 +1890,8 @@ ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setti
)' at line 13
# 4.3.4 (negative) number of partitions < number of named partitions
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1899,8 +1899,8 @@ f_charbig VARCHAR(1000)
PARTITION BY HASH(f_int1) PARTITIONS 1 ( PARTITION part1, PARTITION part2 ) ;
ERROR 42000: Wrong number of partitions defined, mismatch with previous setting near ')' at line 8
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1916,8 +1916,8 @@ ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setti
PARTITION part2 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart21, SUBPAR' at line 11
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1935,8 +1935,8 @@ ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setti
PARTITION part2 VALUES LESS THAN (2000)
(SUBPARTITION subpart21 ' at line 11
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1962,8 +1962,8 @@ DROP TABLE IF EXISTS t1;
#------------------------------------------------------------------------
# 5.1.1 duplicate partition name
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
@@ -1972,8 +1972,8 @@ PARTITION BY HASH(f_int1) (PARTITION part1, PARTITION part1);
ERROR HY000: Duplicate partition name part1
# 5.1.2 duplicate subpartition name
CREATE TABLE t1 (
-f_int1 INTEGER,
-f_int2 INTEGER,
+f_int1 INTEGER DEFAULT 0,
+f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000)
diff --git a/mysql-test/suite/parts/t/partition_debug_sync_innodb.test b/mysql-test/suite/parts/t/partition_debug_sync_innodb.test
index fce26132030..df9c06011c2 100644
--- a/mysql-test/suite/parts/t/partition_debug_sync_innodb.test
+++ b/mysql-test/suite/parts/t/partition_debug_sync_innodb.test
@@ -62,7 +62,10 @@ SHOW CREATE TABLE t1;
SET DEBUG_SYNC='before_open_in_get_all_tables SIGNAL parked WAIT_FOR open';
SET DEBUG_SYNC='partition_open_error SIGNAL alter WAIT_FOR finish';
send
-SELECT * FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
+SELECT TABLE_SCHEMA, TABLE_NAME, PARTITION_NAME, PARTITION_ORDINAL_POSITION,
+ PARTITION_DESCRIPTION, TABLE_ROWS
+FROM INFORMATION_SCHEMA.PARTITIONS
+WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
connect (con1, localhost, root,,);
SET DEBUG_SYNC = 'now WAIT_FOR parked';
diff --git a/mysql-test/suite/percona/percona_innodb_fake_changes.result b/mysql-test/suite/percona/percona_innodb_fake_changes.result
index 95f0c07cd11..1b870fdbb92 100644
--- a/mysql-test/suite/percona/percona_innodb_fake_changes.result
+++ b/mysql-test/suite/percona/percona_innodb_fake_changes.result
@@ -45,7 +45,7 @@ BEGIN;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
ERROR HY000: Can't create table `test`.`t2` (errno: 131 "Command not supported by database")
DROP TABLE t1;
-ERROR 42S02: Unknown table 'test.t1'
+ERROR HY000: Storage engine InnoDB of the table `test`.`t1` doesn't have this option
TRUNCATE TABLE t1;
ERROR HY000: Got error 131 "Command not supported by database" during COMMIT
ALTER TABLE t1 ENGINE=MyISAM;
diff --git a/mysql-test/suite/percona/percona_innodb_fake_changes.test b/mysql-test/suite/percona/percona_innodb_fake_changes.test
index 5fa3ecc7b63..67f5450ba45 100644
--- a/mysql-test/suite/percona/percona_innodb_fake_changes.test
+++ b/mysql-test/suite/percona/percona_innodb_fake_changes.test
@@ -38,7 +38,7 @@ SET innodb_fake_changes=1;
BEGIN;
--error 1005
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
---error 1051
+--error 1031
DROP TABLE t1;
--error 1180
TRUNCATE TABLE t1;
diff --git a/mysql-test/suite/perfschema/include/connection_setup.inc b/mysql-test/suite/perfschema/include/connection_setup.inc
index da57b6dd388..93b8e959ee3 100644
--- a/mysql-test/suite/perfschema/include/connection_setup.inc
+++ b/mysql-test/suite/perfschema/include/connection_setup.inc
@@ -48,15 +48,20 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
--source ../include/wait_for_pfs_thread_count.inc
--disable_query_log
+create user user1@localhost;
grant ALL on *.* to user1@localhost;
+create user user2@localhost;
grant ALL on *.* to user2@localhost;
+create user user3@localhost;
grant ALL on *.* to user3@localhost;
+create user user4@localhost;
grant ALL on *.* to user4@localhost;
+create user user5@localhost;
grant ALL on *.* to user5@localhost;
flush privileges;
diff --git a/mysql-test/suite/perfschema/include/digest_setup.inc b/mysql-test/suite/perfschema/include/digest_setup.inc
index ed463f58d04..6efab880d32 100644
--- a/mysql-test/suite/perfschema/include/digest_setup.inc
+++ b/mysql-test/suite/perfschema/include/digest_setup.inc
@@ -1,5 +1,5 @@
# Making sure not to run when ps-protocol is set.
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
--echo ####################################
--echo # SETUP
diff --git a/mysql-test/suite/perfschema/include/event_aggregate_setup.inc b/mysql-test/suite/perfschema/include/event_aggregate_setup.inc
index 769ba5f8607..7dfefd25235 100644
--- a/mysql-test/suite/perfschema/include/event_aggregate_setup.inc
+++ b/mysql-test/suite/perfschema/include/event_aggregate_setup.inc
@@ -62,14 +62,17 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
--source ../include/wait_for_pfs_thread_count.inc
--disable_query_log
-
+create user user1@localhost;
grant ALL on *.* to user1@localhost;
+create user user2@localhost;
grant ALL on *.* to user2@localhost;
+create user user3@localhost;
grant ALL on *.* to user3@localhost;
+create user user4@localhost;
grant ALL on *.* to user4@localhost;
flush privileges;
diff --git a/mysql-test/suite/perfschema/include/stage_setup.inc b/mysql-test/suite/perfschema/include/stage_setup.inc
index 3558e43652e..85ade046939 100644
--- a/mysql-test/suite/perfschema/include/stage_setup.inc
+++ b/mysql-test/suite/perfschema/include/stage_setup.inc
@@ -24,13 +24,17 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
--disable_query_log
+create user user1@localhost;
grant ALL on *.* to user1@localhost;
+create user user2@localhost;
grant ALL on *.* to user2@localhost;
+create user user3@localhost;
grant ALL on *.* to user3@localhost;
+create user user4@localhost;
grant ALL on *.* to user4@localhost;
flush privileges;
diff --git a/mysql-test/suite/perfschema/include/table_aggregate_setup.inc b/mysql-test/suite/perfschema/include/table_aggregate_setup.inc
index 8efdc8d2f24..79aa5482838 100644
--- a/mysql-test/suite/perfschema/include/table_aggregate_setup.inc
+++ b/mysql-test/suite/perfschema/include/table_aggregate_setup.inc
@@ -67,13 +67,17 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
--source ../include/wait_for_pfs_thread_count.inc
--disable_query_log
+create user user1@localhost;
grant ALL on *.* to user1@localhost;
+create user user2@localhost;
grant ALL on *.* to user2@localhost;
+create user user3@localhost;
grant ALL on *.* to user3@localhost;
+create user user4@localhost;
grant ALL on *.* to user4@localhost;
flush privileges;
diff --git a/mysql-test/suite/perfschema/r/column_privilege.result b/mysql-test/suite/perfschema/r/column_privilege.result
index e4ad9200272..ea901484d7e 100644
--- a/mysql-test/suite/perfschema/r/column_privilege.result
+++ b/mysql-test/suite/perfschema/r/column_privilege.result
@@ -2,6 +2,7 @@ show grants;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
+create user 'pfs_user_5'@localhost;
grant usage on *.* to 'pfs_user_5'@localhost with GRANT OPTION;
grant SELECT(thread_id, event_id) on performance_schema.events_waits_current
to 'pfs_user_5'@localhost;
diff --git a/mysql-test/suite/perfschema/r/digest_null_literal.result b/mysql-test/suite/perfschema/r/digest_null_literal.result
index b0cefbbbaaf..a595c3f541b 100644
--- a/mysql-test/suite/perfschema/r/digest_null_literal.result
+++ b/mysql-test/suite/perfschema/r/digest_null_literal.result
@@ -16,12 +16,12 @@ NULL NULL NULL 1 2 3 NULL NULL
SELECT SCHEMA_NAME, DIGEST_TEXT, COUNT_STAR
FROM performance_schema.events_statements_summary_by_digest;
SCHEMA_NAME DIGEST_TEXT COUNT_STAR
-test TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1
+test TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
test SELECT ? 1
test SELECT ? FROM DUAL 1
test SELECT ?, ... 2
test SELECT ? IS NULL 1
test SELECT ? IS NOT NULL 1
test SELECT ? IS NULL , ? IS NULL , ? IS NOT NULL , ? IS NOT NULL 1
-test CREATE TABLE foo ( a INTEGER DEFAULT ? , b INTEGER NOT NULL DEFAULT ? , c INTEGER NOT NULL ) 1
-test DROP TABLE foo 1
+test CREATE TABLE `foo` ( `a` INTEGER DEFAULT ? , `b` INTEGER NOT NULL DEFAULT ? , `c` INTEGER NOT NULL ) 1
+test DROP TABLE `foo` 1
diff --git a/mysql-test/suite/perfschema/r/digest_table_full.result b/mysql-test/suite/perfschema/r/digest_table_full.result
index 4c7de82abc2..f52b78c9f7d 100644
--- a/mysql-test/suite/perfschema/r/digest_table_full.result
+++ b/mysql-test/suite/perfschema/r/digest_table_full.result
@@ -113,7 +113,7 @@ SELECT SCHEMA_NAME, DIGEST_TEXT, COUNT_STAR, SUM_ROWS_AFFECTED, SUM_WARNINGS,
SUM_ERRORS FROM performance_schema.events_statements_summary_by_digest;
SCHEMA_NAME DIGEST_TEXT COUNT_STAR SUM_ROWS_AFFECTED SUM_WARNINGS SUM_ERRORS
NULL NULL 55 32 1 2
-statements_digest TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1 0 0 0
+statements_digest TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1 0 0 0
SHOW VARIABLES LIKE "performance_schema_digests_size";
Variable_name Value
performance_schema_digests_size 2
diff --git a/mysql-test/suite/perfschema/r/dml_setup_objects.result b/mysql-test/suite/perfschema/r/dml_setup_objects.result
index 075114a9b5a..603c9ba6cc9 100644
--- a/mysql-test/suite/perfschema/r/dml_setup_objects.result
+++ b/mysql-test/suite/perfschema/r/dml_setup_objects.result
@@ -17,7 +17,7 @@ OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME ENABLED TIMED
insert into performance_schema.setup_objects
set object_type='ILLEGAL', object_schema='FOO', object_name='BAR',
enabled='YES', timed='YES';
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails ()
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails
insert into performance_schema.setup_objects
set object_type='TABLE', object_schema='FOO', object_name='BAR',
enabled='YES', timed='YES';
diff --git a/mysql-test/suite/perfschema/r/global_read_lock.result b/mysql-test/suite/perfschema/r/global_read_lock.result
index d71bcf81ea7..dab22c79100 100644
--- a/mysql-test/suite/perfschema/r/global_read_lock.result
+++ b/mysql-test/suite/perfschema/r/global_read_lock.result
@@ -1,5 +1,6 @@
use performance_schema;
update performance_schema.setup_instruments set enabled='YES';
+create user pfsuser@localhost;
grant SELECT, UPDATE, LOCK TABLES on performance_schema.* to pfsuser@localhost;
flush privileges;
connect (con1, localhost, pfsuser, , test);
@@ -20,11 +21,13 @@ lock tables performance_schema.setup_instruments write;
connection default;
select event_name,
left(source, locate(":", source)) as short_source,
-timer_end, timer_wait, operation
+if(timer_end IS NULL, NULL, "SET") as timer_end,
+if(timer_wait IS NULL, NULL, "SET") as timer_wait,
+operation
from performance_schema.events_waits_current
where event_name like "wait/synch/cond/sql/MDL_context::COND_wait_status";
event_name short_source timer_end timer_wait operation
-wait/synch/cond/sql/MDL_context::COND_wait_status mdl.cc: NULL NULL timed_wait
+wait/synch/cond/sql/MDL_context::COND_wait_status mdl.cc: SET SET timed_wait
unlock tables;
update performance_schema.setup_instruments set enabled='NO';
update performance_schema.setup_instruments set enabled='YES';
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_allow.result
index ffe3dc2e0eb..d146f5324d0 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_allow.result
@@ -23,6 +23,7 @@ select `User`, `Host` from mysql.`user` where `user` like '2001:%';
User Host
select `User`, `Host` from mysql.`user` where `user` like 'santa.claus.%';
User Host
+create user 'root'@'192.0.2.4';
grant select on test.* to 'root'@'192.0.2.4';
select "Con1 is alive";
Con1 is alive
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_allow.result
index 7c658e17c55..6c1bce7c9a0 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_allow.result
@@ -23,6 +23,7 @@ select `User`, `Host` from mysql.`user` where `user` like '2001:%';
User Host
select `User`, `Host` from mysql.`user` where `user` like 'santa.claus.%';
User Host
+create user 'root'@'192.0.2.4';
grant select on test.* to 'root'@'192.0.2.4';
select "Con1 is alive";
Con1 is alive
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_allow.result
index 5657887e439..d04a565508f 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_allow.result
@@ -23,6 +23,7 @@ select `User`, `Host` from mysql.`user` where `user` like '2001:%';
User Host
select `User`, `Host` from mysql.`user` where `user` like 'santa.claus.%';
User Host
+create user 'root'@'santa.claus.ipv4.example.com';
grant select on test.* to 'root'@'santa.claus.ipv4.example.com';
select "Con1 is alive";
Con1 is alive
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_allow.result
index 115af4792c3..ea5e91307c8 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_allow.result
@@ -23,7 +23,9 @@ select `User`, `Host` from mysql.`user` where `user` like '2001:%';
User Host
select `User`, `Host` from mysql.`user` where `user` like 'santa.claus.%';
User Host
+create user 'root'@'santa.claus.ipv4.example.com';
grant select on test.* to 'root'@'santa.claus.ipv4.example.com';
+create user 'root'@'192.0.2.4';
grant select on test.* to 'root'@'192.0.2.4';
select "Con1 is alive";
Con1 is alive
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_blocked.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_blocked.result
index 6f5affadd2f..4eae65c4618 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_blocked.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_blocked.result
@@ -24,6 +24,7 @@ select `User`, `Host` from mysql.`user` where `user` like 'santa.claus.%';
User Host
select @@global.max_connect_errors into @saved_max_connect_errors;
set global max_connect_errors = 3;
+create user 'root'@'santa.claus.ipv4.example.com';
grant select on test.* to 'root'@'santa.claus.ipv4.example.com';
create user 'quota'@'santa.claus.ipv4.example.com';
grant select on test.* to 'quota'@'santa.claus.ipv4.example.com';
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_allow.result
index 6531f7e69f0..1c893320340 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_allow.result
@@ -23,7 +23,9 @@ select `User`, `Host` from mysql.`user` where `user` like '2001:%';
User Host
select `User`, `Host` from mysql.`user` where `user` like 'santa.claus.%';
User Host
+create user 'root'@'192.0.2.4';
grant select on test.* to 'root'@'192.0.2.4';
+create user 'root'@'santa.claus.ipv4.example.com';
grant select on test.* to 'root'@'santa.claus.ipv4.example.com';
select "Con1 is alive";
Con1 is alive
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_allow.result
index 315f90ce3e5..68855bbc0ce 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_allow.result
@@ -23,6 +23,7 @@ select `User`, `Host` from mysql.`user` where `user` like '2001:%';
User Host
select `User`, `Host` from mysql.`user` where `user` like 'santa.claus.%';
User Host
+create user 'root'@'192.0.2.4';
grant select on test.* to 'root'@'192.0.2.4';
select "Con1 is alive";
Con1 is alive
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_allow.result
index 59a12495352..36d7692f824 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_allow.result
@@ -23,6 +23,7 @@ select `User`, `Host` from mysql.`user` where `user` like '2001:%';
User Host
select `User`, `Host` from mysql.`user` where `user` like 'santa.claus.%';
User Host
+create user 'root'@'2001:db8::6:6';
grant select on test.* to 'root'@'2001:db8::6:6';
select "Con1 is alive";
Con1 is alive
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_allow.result
index 904139875c6..37470bdc0bb 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_allow.result
@@ -23,6 +23,7 @@ select `User`, `Host` from mysql.`user` where `user` like '2001:%';
User Host
select `User`, `Host` from mysql.`user` where `user` like 'santa.claus.%';
User Host
+create user 'root'@'2001:db8::6:6';
grant select on test.* to 'root'@'2001:db8::6:6';
select "Con1 is alive";
Con1 is alive
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_allow.result
index f5b2f43ab91..410f116f4d0 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_allow.result
@@ -23,6 +23,7 @@ select `User`, `Host` from mysql.`user` where `user` like '2001:%';
User Host
select `User`, `Host` from mysql.`user` where `user` like 'santa.claus.%';
User Host
+create user 'root'@'santa.claus.ipv6.example.com';
grant select on test.* to 'root'@'santa.claus.ipv6.example.com';
select "Con1 is alive";
Con1 is alive
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_allow.result
index 9cc8a675fcc..6ccb3b66f22 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_allow.result
@@ -23,7 +23,9 @@ select `User`, `Host` from mysql.`user` where `user` like '2001:%';
User Host
select `User`, `Host` from mysql.`user` where `user` like 'santa.claus.%';
User Host
+create user 'root'@'santa.claus.ipv6.example.com';
grant select on test.* to 'root'@'santa.claus.ipv6.example.com';
+create user 'root'@'2001:db8::6:6';
grant select on test.* to 'root'@'2001:db8::6:6';
select "Con1 is alive";
Con1 is alive
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_blocked.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_blocked.result
index 5d1846f3354..a0c2d8bdfa6 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_blocked.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_blocked.result
@@ -24,6 +24,7 @@ select `User`, `Host` from mysql.`user` where `user` like 'santa.claus.%';
User Host
select @@global.max_connect_errors into @saved_max_connect_errors;
set global max_connect_errors = 3;
+create user 'root'@'santa.claus.ipv6.example.com';
grant select on test.* to 'root'@'santa.claus.ipv6.example.com';
create user 'quota'@'santa.claus.ipv6.example.com';
grant select on test.* to 'quota'@'santa.claus.ipv6.example.com';
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_allow.result
index a2107324c65..a2b9a32c764 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_allow.result
@@ -23,7 +23,9 @@ select `User`, `Host` from mysql.`user` where `user` like '2001:%';
User Host
select `User`, `Host` from mysql.`user` where `user` like 'santa.claus.%';
User Host
+create user 'root'@'2001:db8::6:6';
grant select on test.* to 'root'@'2001:db8::6:6';
+create user 'root'@'santa.claus.ipv6.example.com';
grant select on test.* to 'root'@'santa.claus.ipv6.example.com';
select "Con1 is alive";
Con1 is alive
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_allow.result
index 809644cbe08..99b47be724f 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_allow.result
@@ -23,6 +23,7 @@ select `User`, `Host` from mysql.`user` where `user` like '2001:%';
User Host
select `User`, `Host` from mysql.`user` where `user` like 'santa.claus.%';
User Host
+create user 'root'@'2001:db8::6:6';
grant select on test.* to 'root'@'2001:db8::6:6';
select "Con1 is alive";
Con1 is alive
diff --git a/mysql-test/suite/perfschema/r/nesting.result b/mysql-test/suite/perfschema/r/nesting.result
index f1f872f95f9..2bf65c30e4a 100644
--- a/mysql-test/suite/perfschema/r/nesting.result
+++ b/mysql-test/suite/perfschema/r/nesting.result
@@ -107,7 +107,7 @@ and (end_event_id <= @marker_end)
) all_events
order by relative_event_id asc;
relative_event_id relative_end_event_id event_name comment nesting_event_type relative_nesting_event_id
-0 19 statement/sql/select select "MARKER_BEGIN" as marker NULL NULL
+0 18 statement/sql/select select "MARKER_BEGIN" as marker NULL NULL
1 4 stage/sql/init (stage) STATEMENT 0
2 2 wait/io/socket/sql/client_connection recv STAGE 1
3 3 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 1
@@ -124,125 +124,118 @@ relative_event_id relative_end_event_id event_name comment nesting_event_type re
14 14 stage/sql/freeing items (stage) STATEMENT 0
15 15 wait/io/socket/sql/client_connection send STATEMENT 0
16 16 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 0
-17 17 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 0
-18 19 stage/sql/cleaning up (stage) STATEMENT 0
-19 19 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 18
-20 20 idle idle NULL NULL
-21 40 statement/sql/select select "This is simple statement one" as payload NULL NULL
-22 25 stage/sql/init (stage) STATEMENT 21
-23 23 wait/io/socket/sql/client_connection recv STAGE 22
-24 24 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 22
-25 25 wait/io/file/sql/query_log write STAGE 22
-26 26 stage/sql/checking permissions (stage) STATEMENT 21
-27 27 stage/sql/Opening tables (stage) STATEMENT 21
-28 28 stage/sql/After opening tables (stage) STATEMENT 21
-29 29 stage/sql/init (stage) STATEMENT 21
-30 30 stage/sql/optimizing (stage) STATEMENT 21
-31 31 stage/sql/executing (stage) STATEMENT 21
-32 32 stage/sql/end (stage) STATEMENT 21
-33 33 stage/sql/query end (stage) STATEMENT 21
-34 34 stage/sql/closing tables (stage) STATEMENT 21
-35 35 stage/sql/freeing items (stage) STATEMENT 21
-36 36 wait/io/socket/sql/client_connection send STATEMENT 21
-37 37 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 21
-38 38 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 21
-39 40 stage/sql/cleaning up (stage) STATEMENT 21
-40 40 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 39
-41 41 idle idle NULL NULL
-42 61 statement/sql/select select "This is simple statement two" as payload NULL NULL
-43 46 stage/sql/init (stage) STATEMENT 42
-44 44 wait/io/socket/sql/client_connection recv STAGE 43
-45 45 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 43
-46 46 wait/io/file/sql/query_log write STAGE 43
-47 47 stage/sql/checking permissions (stage) STATEMENT 42
-48 48 stage/sql/Opening tables (stage) STATEMENT 42
-49 49 stage/sql/After opening tables (stage) STATEMENT 42
-50 50 stage/sql/init (stage) STATEMENT 42
-51 51 stage/sql/optimizing (stage) STATEMENT 42
-52 52 stage/sql/executing (stage) STATEMENT 42
-53 53 stage/sql/end (stage) STATEMENT 42
-54 54 stage/sql/query end (stage) STATEMENT 42
-55 55 stage/sql/closing tables (stage) STATEMENT 42
-56 56 stage/sql/freeing items (stage) STATEMENT 42
-57 57 wait/io/socket/sql/client_connection send STATEMENT 42
-58 58 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 42
-59 59 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 42
-60 61 stage/sql/cleaning up (stage) STATEMENT 42
-61 61 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 60
-62 62 idle idle NULL NULL
-63 80 statement/sql/select select "This is the first part of a multi query" as payload;
+17 18 stage/sql/cleaning up (stage) STATEMENT 0
+18 18 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 17
+19 19 idle idle NULL NULL
+20 38 statement/sql/select select "This is simple statement one" as payload NULL NULL
+21 24 stage/sql/init (stage) STATEMENT 20
+22 22 wait/io/socket/sql/client_connection recv STAGE 21
+23 23 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 21
+24 24 wait/io/file/sql/query_log write STAGE 21
+25 25 stage/sql/checking permissions (stage) STATEMENT 20
+26 26 stage/sql/Opening tables (stage) STATEMENT 20
+27 27 stage/sql/After opening tables (stage) STATEMENT 20
+28 28 stage/sql/init (stage) STATEMENT 20
+29 29 stage/sql/optimizing (stage) STATEMENT 20
+30 30 stage/sql/executing (stage) STATEMENT 20
+31 31 stage/sql/end (stage) STATEMENT 20
+32 32 stage/sql/query end (stage) STATEMENT 20
+33 33 stage/sql/closing tables (stage) STATEMENT 20
+34 34 stage/sql/freeing items (stage) STATEMENT 20
+35 35 wait/io/socket/sql/client_connection send STATEMENT 20
+36 36 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 20
+37 38 stage/sql/cleaning up (stage) STATEMENT 20
+38 38 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 37
+39 39 idle idle NULL NULL
+40 58 statement/sql/select select "This is simple statement two" as payload NULL NULL
+41 44 stage/sql/init (stage) STATEMENT 40
+42 42 wait/io/socket/sql/client_connection recv STAGE 41
+43 43 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 41
+44 44 wait/io/file/sql/query_log write STAGE 41
+45 45 stage/sql/checking permissions (stage) STATEMENT 40
+46 46 stage/sql/Opening tables (stage) STATEMENT 40
+47 47 stage/sql/After opening tables (stage) STATEMENT 40
+48 48 stage/sql/init (stage) STATEMENT 40
+49 49 stage/sql/optimizing (stage) STATEMENT 40
+50 50 stage/sql/executing (stage) STATEMENT 40
+51 51 stage/sql/end (stage) STATEMENT 40
+52 52 stage/sql/query end (stage) STATEMENT 40
+53 53 stage/sql/closing tables (stage) STATEMENT 40
+54 54 stage/sql/freeing items (stage) STATEMENT 40
+55 55 wait/io/socket/sql/client_connection send STATEMENT 40
+56 56 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 40
+57 58 stage/sql/cleaning up (stage) STATEMENT 40
+58 58 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 57
+59 59 idle idle NULL NULL
+60 76 statement/sql/select select "This is the first part of a multi query" as payload;
select "And this is the second part of a multi query" as payload;
select "With a third part to make things complete" as payload NULL NULL
-64 67 stage/sql/init (stage) STATEMENT 63
-65 65 wait/io/socket/sql/client_connection recv STAGE 64
-66 66 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 64
-67 67 wait/io/file/sql/query_log write STAGE 64
-68 68 stage/sql/checking permissions (stage) STATEMENT 63
-69 69 stage/sql/Opening tables (stage) STATEMENT 63
-70 70 stage/sql/After opening tables (stage) STATEMENT 63
-71 71 stage/sql/init (stage) STATEMENT 63
-72 72 stage/sql/optimizing (stage) STATEMENT 63
-73 73 stage/sql/executing (stage) STATEMENT 63
-74 74 stage/sql/end (stage) STATEMENT 63
-75 75 stage/sql/query end (stage) STATEMENT 63
-76 76 stage/sql/closing tables (stage) STATEMENT 63
-77 80 stage/sql/freeing items (stage) STATEMENT 63
-78 78 wait/io/socket/sql/client_connection send STAGE 77
-79 79 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 77
-80 80 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 77
-81 96 statement/sql/select select "And this is the second part of a multi query" as payload;
+61 64 stage/sql/init (stage) STATEMENT 60
+62 62 wait/io/socket/sql/client_connection recv STAGE 61
+63 63 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 61
+64 64 wait/io/file/sql/query_log write STAGE 61
+65 65 stage/sql/checking permissions (stage) STATEMENT 60
+66 66 stage/sql/Opening tables (stage) STATEMENT 60
+67 67 stage/sql/After opening tables (stage) STATEMENT 60
+68 68 stage/sql/init (stage) STATEMENT 60
+69 69 stage/sql/optimizing (stage) STATEMENT 60
+70 70 stage/sql/executing (stage) STATEMENT 60
+71 71 stage/sql/end (stage) STATEMENT 60
+72 72 stage/sql/query end (stage) STATEMENT 60
+73 73 stage/sql/closing tables (stage) STATEMENT 60
+74 76 stage/sql/freeing items (stage) STATEMENT 60
+75 75 wait/io/socket/sql/client_connection send STAGE 74
+76 76 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 74
+77 91 statement/sql/select select "And this is the second part of a multi query" as payload;
select "With a third part to make things complete" as payload NULL NULL
-82 83 stage/sql/init (stage) STATEMENT 81
-83 83 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 82
-84 84 stage/sql/checking permissions (stage) STATEMENT 81
-85 85 stage/sql/Opening tables (stage) STATEMENT 81
-86 86 stage/sql/After opening tables (stage) STATEMENT 81
-87 87 stage/sql/init (stage) STATEMENT 81
-88 88 stage/sql/optimizing (stage) STATEMENT 81
-89 89 stage/sql/executing (stage) STATEMENT 81
-90 90 stage/sql/end (stage) STATEMENT 81
-91 91 stage/sql/query end (stage) STATEMENT 81
-92 92 stage/sql/closing tables (stage) STATEMENT 81
-93 96 stage/sql/freeing items (stage) STATEMENT 81
-94 94 wait/io/socket/sql/client_connection send STAGE 93
-95 95 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 93
-96 96 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 93
-97 114 statement/sql/select select "With a third part to make things complete" as payload NULL NULL
-98 99 stage/sql/init (stage) STATEMENT 97
-99 99 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 98
-100 100 stage/sql/checking permissions (stage) STATEMENT 97
-101 101 stage/sql/Opening tables (stage) STATEMENT 97
-102 102 stage/sql/After opening tables (stage) STATEMENT 97
-103 103 stage/sql/init (stage) STATEMENT 97
-104 104 stage/sql/optimizing (stage) STATEMENT 97
-105 105 stage/sql/executing (stage) STATEMENT 97
-106 106 stage/sql/end (stage) STATEMENT 97
-107 107 stage/sql/query end (stage) STATEMENT 97
-108 108 stage/sql/closing tables (stage) STATEMENT 97
-109 109 stage/sql/freeing items (stage) STATEMENT 97
-110 110 wait/io/socket/sql/client_connection send STATEMENT 97
-111 111 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 97
-112 112 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 97
-113 114 stage/sql/cleaning up (stage) STATEMENT 97
-114 114 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 113
-115 115 idle idle NULL NULL
-116 135 statement/sql/select select "MARKER_END" as marker NULL NULL
-117 120 stage/sql/init (stage) STATEMENT 116
-118 118 wait/io/socket/sql/client_connection recv STAGE 117
-119 119 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 117
-120 120 wait/io/file/sql/query_log write STAGE 117
-121 121 stage/sql/checking permissions (stage) STATEMENT 116
-122 122 stage/sql/Opening tables (stage) STATEMENT 116
-123 123 stage/sql/After opening tables (stage) STATEMENT 116
-124 124 stage/sql/init (stage) STATEMENT 116
-125 125 stage/sql/optimizing (stage) STATEMENT 116
-126 126 stage/sql/executing (stage) STATEMENT 116
-127 127 stage/sql/end (stage) STATEMENT 116
-128 128 stage/sql/query end (stage) STATEMENT 116
-129 129 stage/sql/closing tables (stage) STATEMENT 116
-130 130 stage/sql/freeing items (stage) STATEMENT 116
-131 131 wait/io/socket/sql/client_connection send STATEMENT 116
-132 132 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 116
-133 133 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 116
-134 135 stage/sql/cleaning up (stage) STATEMENT 116
-135 135 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 134
+78 79 stage/sql/init (stage) STATEMENT 77
+79 79 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 78
+80 80 stage/sql/checking permissions (stage) STATEMENT 77
+81 81 stage/sql/Opening tables (stage) STATEMENT 77
+82 82 stage/sql/After opening tables (stage) STATEMENT 77
+83 83 stage/sql/init (stage) STATEMENT 77
+84 84 stage/sql/optimizing (stage) STATEMENT 77
+85 85 stage/sql/executing (stage) STATEMENT 77
+86 86 stage/sql/end (stage) STATEMENT 77
+87 87 stage/sql/query end (stage) STATEMENT 77
+88 88 stage/sql/closing tables (stage) STATEMENT 77
+89 91 stage/sql/freeing items (stage) STATEMENT 77
+90 90 wait/io/socket/sql/client_connection send STAGE 89
+91 91 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 89
+92 108 statement/sql/select select "With a third part to make things complete" as payload NULL NULL
+93 94 stage/sql/init (stage) STATEMENT 92
+94 94 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 93
+95 95 stage/sql/checking permissions (stage) STATEMENT 92
+96 96 stage/sql/Opening tables (stage) STATEMENT 92
+97 97 stage/sql/After opening tables (stage) STATEMENT 92
+98 98 stage/sql/init (stage) STATEMENT 92
+99 99 stage/sql/optimizing (stage) STATEMENT 92
+100 100 stage/sql/executing (stage) STATEMENT 92
+101 101 stage/sql/end (stage) STATEMENT 92
+102 102 stage/sql/query end (stage) STATEMENT 92
+103 103 stage/sql/closing tables (stage) STATEMENT 92
+104 104 stage/sql/freeing items (stage) STATEMENT 92
+105 105 wait/io/socket/sql/client_connection send STATEMENT 92
+106 106 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 92
+107 108 stage/sql/cleaning up (stage) STATEMENT 92
+108 108 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 107
+109 109 idle idle NULL NULL
+110 128 statement/sql/select select "MARKER_END" as marker NULL NULL
+111 114 stage/sql/init (stage) STATEMENT 110
+112 112 wait/io/socket/sql/client_connection recv STAGE 111
+113 113 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 111
+114 114 wait/io/file/sql/query_log write STAGE 111
+115 115 stage/sql/checking permissions (stage) STATEMENT 110
+116 116 stage/sql/Opening tables (stage) STATEMENT 110
+117 117 stage/sql/After opening tables (stage) STATEMENT 110
+118 118 stage/sql/init (stage) STATEMENT 110
+119 119 stage/sql/optimizing (stage) STATEMENT 110
+120 120 stage/sql/executing (stage) STATEMENT 110
+121 121 stage/sql/end (stage) STATEMENT 110
+122 122 stage/sql/query end (stage) STATEMENT 110
+123 123 stage/sql/closing tables (stage) STATEMENT 110
+124 124 stage/sql/freeing items (stage) STATEMENT 110
+125 125 wait/io/socket/sql/client_connection send STATEMENT 110
+126 126 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 110
+127 128 stage/sql/cleaning up (stage) STATEMENT 110
+128 128 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 127
diff --git a/mysql-test/suite/perfschema/r/ortho_iter.result b/mysql-test/suite/perfschema/r/ortho_iter.result
index 9081bfe5882..bb572237483 100644
--- a/mysql-test/suite/perfschema/r/ortho_iter.result
+++ b/mysql-test/suite/perfschema/r/ortho_iter.result
@@ -110,6 +110,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/privilege.result b/mysql-test/suite/perfschema/r/privilege.result
index 49d72fc499f..f46c094b5ac 100644
--- a/mysql-test/suite/perfschema/r/privilege.result
+++ b/mysql-test/suite/perfschema/r/privilege.result
@@ -2,6 +2,9 @@ show grants;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
+create user 'pfs_user_1'@localhost;
+create user 'pfs_user_2'@localhost;
+create user 'pfs_user_3'@localhost;
grant ALL on *.* to 'pfs_user_1'@localhost with GRANT OPTION;
grant ALL on performance_schema.* to 'pfs_user_2'@localhost
with GRANT OPTION;
diff --git a/mysql-test/suite/perfschema/r/privilege_table_io.result b/mysql-test/suite/perfschema/r/privilege_table_io.result
index 126b2a58fae..f1f0946cb90 100644
--- a/mysql-test/suite/perfschema/r/privilege_table_io.result
+++ b/mysql-test/suite/perfschema/r/privilege_table_io.result
@@ -38,6 +38,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/read_only.result b/mysql-test/suite/perfschema/r/read_only.result
index 19108326f1b..b2502808821 100644
--- a/mysql-test/suite/perfschema/r/read_only.result
+++ b/mysql-test/suite/perfschema/r/read_only.result
@@ -1,5 +1,6 @@
use performance_schema;
set @start_read_only= @@global.read_only;
+create user pfsuser@localhost;
grant SELECT, UPDATE on performance_schema.* to pfsuser@localhost;
flush privileges;
connect (con1, localhost, pfsuser, , test);
diff --git a/mysql-test/suite/perfschema/r/rpl_gtid_func.result b/mysql-test/suite/perfschema/r/rpl_gtid_func.result
index 86c8347addd..d5f764013df 100644
--- a/mysql-test/suite/perfschema/r/rpl_gtid_func.result
+++ b/mysql-test/suite/perfschema/r/rpl_gtid_func.result
@@ -37,7 +37,7 @@ select digest_text, count_star
from performance_schema.events_statements_summary_by_digest
where digest_text like "%in_%_digest%";
digest_text count_star
-SELECT ? AS in_master_digest 1
+SELECT ? AS `in_master_digest` 1
insert into test.marker values (2);
**** On Slave ****
select * from test.marker;
@@ -64,7 +64,7 @@ select digest_text, count_star
from performance_schema.events_statements_summary_by_digest
where digest_text like "%in_%_digest%";
digest_text count_star
-SELECT ? AS in_slave_digest 1
+SELECT ? AS `in_slave_digest` 1
**** On Master ****
delete from performance_schema.setup_objects
where object_schema='master';
diff --git a/mysql-test/suite/perfschema/r/rpl_statements.result b/mysql-test/suite/perfschema/r/rpl_statements.result
index 4e1f03643f1..081710f1d54 100644
--- a/mysql-test/suite/perfschema/r/rpl_statements.result
+++ b/mysql-test/suite/perfschema/r/rpl_statements.result
@@ -98,20 +98,20 @@ drop database marker2_db;
select thread_id, event_id, rpad(event_name, 28, ' ') event_name, rpad(current_schema, 10, ' ') current_schema, rpad(digest_text, 72, ' ') digest_text, sql_text from performance_schema.events_statements_history_long
where sql_text like '%marker%' order by event_id;
thread_id event_id event_name current_schema digest_text sql_text
-[THREAD_ID] [EVENT_ID] statement/sql/create_db test CREATE SCHEMA marker1_db create database marker1_db
-[THREAD_ID] [EVENT_ID] statement/sql/create_db test CREATE SCHEMA marker2_db create database marker2_db
-[THREAD_ID] [EVENT_ID] statement/sql/create_table test CREATE TABLE marker1_db . table1 ( s1 INTEGER ) ENGINE = innodb create table marker1_db.table1 (s1 int) engine=innodb
-[THREAD_ID] [EVENT_ID] statement/sql/create_table test CREATE TABLE marker2_db . table1 ( s1 INTEGER ) ENGINE = innodb create table marker2_db.table1 (s1 int) engine=innodb
-[THREAD_ID] [EVENT_ID] statement/sql/create_table test CREATE TABLE marker2_db . table2 ( s1 INTEGER ) ENGINE = innodb create table marker2_db.table2 (s1 int) engine=innodb
-[THREAD_ID] [EVENT_ID] statement/sql/insert test INSERT INTO marker1_db . table1 VALUES (?) /* , ... */ insert into marker1_db.table1 values (1), (2), (3)
-[THREAD_ID] [EVENT_ID] statement/sql/insert test INSERT INTO marker2_db . table1 VALUES (?) /* , ... */ insert into marker2_db.table1 values (1), (2), (3)
-[THREAD_ID] [EVENT_ID] statement/sql/alter_table test ALTER TABLE marker1_db . table1 ADD COLUMN ( s2 VARCHARACTER (?) ) alter table marker1_db.table1 add column (s2 varchar(32))
-[THREAD_ID] [EVENT_ID] statement/sql/insert test INSERT INTO marker1_db . table1 VALUES (...) /* , ... */ insert into marker1_db.table1 values (4, 'four'), (5, 'five'), (6, 'six')
-[THREAD_ID] [EVENT_ID] statement/sql/update test UPDATE marker1_db . table1 SET s1 = s1 + ? update marker1_db.table1 set s1 = s1 + 1
-[THREAD_ID] [EVENT_ID] statement/sql/insert test INSERT INTO marker1_db . table1 VALUES (...) /* , ... */ insert into marker1_db.table1 values (7, 'seven'), (8, 'eight'), (9, 'nine')
-[THREAD_ID] [EVENT_ID] statement/sql/delete test DELETE FROM marker1_db . table1 WHERE s1 > ? delete from marker1_db.table1 where s1 > 4
-[THREAD_ID] [EVENT_ID] statement/sql/drop_table test DROP TABLE marker2_db . table1 drop table marker2_db.table1
-[THREAD_ID] [EVENT_ID] statement/sql/drop_db test DROP SCHEMA marker2_db drop database marker2_db
+[THREAD_ID] [EVENT_ID] statement/sql/create_db test CREATE SCHEMA `marker1_db` create database marker1_db
+[THREAD_ID] [EVENT_ID] statement/sql/create_db test CREATE SCHEMA `marker2_db` create database marker2_db
+[THREAD_ID] [EVENT_ID] statement/sql/create_table test CREATE TABLE `marker1_db` . `table1` ( `s1` INTEGER ) ENGINE = `innodb` create table marker1_db.table1 (s1 int) engine=innodb
+[THREAD_ID] [EVENT_ID] statement/sql/create_table test CREATE TABLE `marker2_db` . `table1` ( `s1` INTEGER ) ENGINE = `innodb` create table marker2_db.table1 (s1 int) engine=innodb
+[THREAD_ID] [EVENT_ID] statement/sql/create_table test CREATE TABLE `marker2_db` . `table2` ( `s1` INTEGER ) ENGINE = `innodb` create table marker2_db.table2 (s1 int) engine=innodb
+[THREAD_ID] [EVENT_ID] statement/sql/insert test INSERT INTO `marker1_db` . `table1` VALUES (?) /* , ... */ insert into marker1_db.table1 values (1), (2), (3)
+[THREAD_ID] [EVENT_ID] statement/sql/insert test INSERT INTO `marker2_db` . `table1` VALUES (?) /* , ... */ insert into marker2_db.table1 values (1), (2), (3)
+[THREAD_ID] [EVENT_ID] statement/sql/alter_table test ALTER TABLE `marker1_db` . `table1` ADD COLUMN ( `s2` VARCHARACTER (?) ) alter table marker1_db.table1 add column (s2 varchar(32))
+[THREAD_ID] [EVENT_ID] statement/sql/insert test INSERT INTO `marker1_db` . `table1` VALUES (...) /* , ... */ insert into marker1_db.table1 values (4, 'four'), (5, 'five'), (6, 'six')
+[THREAD_ID] [EVENT_ID] statement/sql/update test UPDATE `marker1_db` . `table1` SET `s1` = `s1` + ? update marker1_db.table1 set s1 = s1 + 1
+[THREAD_ID] [EVENT_ID] statement/sql/insert test INSERT INTO `marker1_db` . `table1` VALUES (...) /* , ... */ insert into marker1_db.table1 values (7, 'seven'), (8, 'eight'), (9, 'nine')
+[THREAD_ID] [EVENT_ID] statement/sql/delete test DELETE FROM `marker1_db` . `table1` WHERE `s1` > ? delete from marker1_db.table1 where s1 > 4
+[THREAD_ID] [EVENT_ID] statement/sql/drop_table test DROP TABLE `marker2_db` . `table1` drop table marker2_db.table1
+[THREAD_ID] [EVENT_ID] statement/sql/drop_db test DROP SCHEMA `marker2_db` drop database marker2_db
#
# STEP 4 - REPLICATE STATEMENT EVENTS ON MASTER TO SLAVE
@@ -138,39 +138,39 @@ where (thread_id=@my_thread_id and digest_text like '%marker%'));
select thread_id, event_id, rpad(event_name, 28, ' ') event_name, rpad(current_schema, 10, ' ') current_schema, rpad(digest_text, 72, ' ') digest_text, sql_text from master_events_statements_history_long order by event_id;
thread_id event_id event_name current_schema digest_text sql_text
-[THREAD_ID] [EVENT_ID] statement/sql/create_db test CREATE SCHEMA marker1_db create database marker1_db
-[THREAD_ID] [EVENT_ID] statement/sql/create_db test CREATE SCHEMA marker2_db create database marker2_db
-[THREAD_ID] [EVENT_ID] statement/sql/create_table test CREATE TABLE marker1_db . table1 ( s1 INTEGER ) ENGINE = innodb create table marker1_db.table1 (s1 int) engine=innodb
-[THREAD_ID] [EVENT_ID] statement/sql/create_table test CREATE TABLE marker2_db . table1 ( s1 INTEGER ) ENGINE = innodb create table marker2_db.table1 (s1 int) engine=innodb
-[THREAD_ID] [EVENT_ID] statement/sql/create_table test CREATE TABLE marker2_db . table2 ( s1 INTEGER ) ENGINE = innodb create table marker2_db.table2 (s1 int) engine=innodb
-[THREAD_ID] [EVENT_ID] statement/sql/insert test INSERT INTO marker1_db . table1 VALUES (?) /* , ... */ insert into marker1_db.table1 values (1), (2), (3)
-[THREAD_ID] [EVENT_ID] statement/sql/insert test INSERT INTO marker2_db . table1 VALUES (?) /* , ... */ insert into marker2_db.table1 values (1), (2), (3)
-[THREAD_ID] [EVENT_ID] statement/sql/alter_table test ALTER TABLE marker1_db . table1 ADD COLUMN ( s2 VARCHARACTER (?) ) alter table marker1_db.table1 add column (s2 varchar(32))
-[THREAD_ID] [EVENT_ID] statement/sql/insert test INSERT INTO marker1_db . table1 VALUES (...) /* , ... */ insert into marker1_db.table1 values (4, 'four'), (5, 'five'), (6, 'six')
-[THREAD_ID] [EVENT_ID] statement/sql/update test UPDATE marker1_db . table1 SET s1 = s1 + ? update marker1_db.table1 set s1 = s1 + 1
-[THREAD_ID] [EVENT_ID] statement/sql/insert test INSERT INTO marker1_db . table1 VALUES (...) /* , ... */ insert into marker1_db.table1 values (7, 'seven'), (8, 'eight'), (9, 'nine')
-[THREAD_ID] [EVENT_ID] statement/sql/delete test DELETE FROM marker1_db . table1 WHERE s1 > ? delete from marker1_db.table1 where s1 > 4
-[THREAD_ID] [EVENT_ID] statement/sql/drop_table test DROP TABLE marker2_db . table1 drop table marker2_db.table1
-[THREAD_ID] [EVENT_ID] statement/sql/drop_db test DROP SCHEMA marker2_db drop database marker2_db
+[THREAD_ID] [EVENT_ID] statement/sql/create_db test CREATE SCHEMA `marker1_db` create database marker1_db
+[THREAD_ID] [EVENT_ID] statement/sql/create_db test CREATE SCHEMA `marker2_db` create database marker2_db
+[THREAD_ID] [EVENT_ID] statement/sql/create_table test CREATE TABLE `marker1_db` . `table1` ( `s1` INTEGER ) ENGINE = `innodb` create table marker1_db.table1 (s1 int) engine=innodb
+[THREAD_ID] [EVENT_ID] statement/sql/create_table test CREATE TABLE `marker2_db` . `table1` ( `s1` INTEGER ) ENGINE = `innodb` create table marker2_db.table1 (s1 int) engine=innodb
+[THREAD_ID] [EVENT_ID] statement/sql/create_table test CREATE TABLE `marker2_db` . `table2` ( `s1` INTEGER ) ENGINE = `innodb` create table marker2_db.table2 (s1 int) engine=innodb
+[THREAD_ID] [EVENT_ID] statement/sql/insert test INSERT INTO `marker1_db` . `table1` VALUES (?) /* , ... */ insert into marker1_db.table1 values (1), (2), (3)
+[THREAD_ID] [EVENT_ID] statement/sql/insert test INSERT INTO `marker2_db` . `table1` VALUES (?) /* , ... */ insert into marker2_db.table1 values (1), (2), (3)
+[THREAD_ID] [EVENT_ID] statement/sql/alter_table test ALTER TABLE `marker1_db` . `table1` ADD COLUMN ( `s2` VARCHARACTER (?) ) alter table marker1_db.table1 add column (s2 varchar(32))
+[THREAD_ID] [EVENT_ID] statement/sql/insert test INSERT INTO `marker1_db` . `table1` VALUES (...) /* , ... */ insert into marker1_db.table1 values (4, 'four'), (5, 'five'), (6, 'six')
+[THREAD_ID] [EVENT_ID] statement/sql/update test UPDATE `marker1_db` . `table1` SET `s1` = `s1` + ? update marker1_db.table1 set s1 = s1 + 1
+[THREAD_ID] [EVENT_ID] statement/sql/insert test INSERT INTO `marker1_db` . `table1` VALUES (...) /* , ... */ insert into marker1_db.table1 values (7, 'seven'), (8, 'eight'), (9, 'nine')
+[THREAD_ID] [EVENT_ID] statement/sql/delete test DELETE FROM `marker1_db` . `table1` WHERE `s1` > ? delete from marker1_db.table1 where s1 > 4
+[THREAD_ID] [EVENT_ID] statement/sql/drop_table test DROP TABLE `marker2_db` . `table1` drop table marker2_db.table1
+[THREAD_ID] [EVENT_ID] statement/sql/drop_db test DROP SCHEMA `marker2_db` drop database marker2_db
*** List statement events on slave
select thread_id, event_id, rpad(event_name, 28, ' ') event_name, rpad(current_schema, 10, ' ') current_schema, rpad(digest_text, 72, ' ') digest_text, sql_text from performance_schema.events_statements_history_long
where thread_id = @slave_thread_id and sql_text like '%marker%' order by event_id;
thread_id event_id event_name current_schema digest_text sql_text
-[THREAD_ID] [EVENT_ID] statement/sql/create_db marker1_db CREATE SCHEMA marker1_db create database marker1_db
-[THREAD_ID] [EVENT_ID] statement/sql/create_db marker2_db CREATE SCHEMA marker2_db create database marker2_db
-[THREAD_ID] [EVENT_ID] statement/sql/create_table test CREATE TABLE marker1_db . table1 ( s1 INTEGER ) ENGINE = innodb create table marker1_db.table1 (s1 int) engine=innodb
-[THREAD_ID] [EVENT_ID] statement/sql/create_table test CREATE TABLE marker2_db . table1 ( s1 INTEGER ) ENGINE = innodb create table marker2_db.table1 (s1 int) engine=innodb
-[THREAD_ID] [EVENT_ID] statement/sql/create_table test CREATE TABLE marker2_db . table2 ( s1 INTEGER ) ENGINE = innodb create table marker2_db.table2 (s1 int) engine=innodb
-[THREAD_ID] [EVENT_ID] statement/sql/insert test INSERT INTO marker1_db . table1 VALUES (?) /* , ... */ insert into marker1_db.table1 values (1), (2), (3)
-[THREAD_ID] [EVENT_ID] statement/sql/insert test INSERT INTO marker2_db . table1 VALUES (?) /* , ... */ insert into marker2_db.table1 values (1), (2), (3)
-[THREAD_ID] [EVENT_ID] statement/sql/alter_table test ALTER TABLE marker1_db . table1 ADD COLUMN ( s2 VARCHARACTER (?) ) alter table marker1_db.table1 add column (s2 varchar(32))
-[THREAD_ID] [EVENT_ID] statement/sql/insert test INSERT INTO marker1_db . table1 VALUES (...) /* , ... */ insert into marker1_db.table1 values (4, 'four'), (5, 'five'), (6, 'six')
-[THREAD_ID] [EVENT_ID] statement/sql/update test UPDATE marker1_db . table1 SET s1 = s1 + ? update marker1_db.table1 set s1 = s1 + 1
-[THREAD_ID] [EVENT_ID] statement/sql/delete test DELETE FROM marker1_db . table1 WHERE s1 > ? delete from marker1_db.table1 where s1 > 4
+[THREAD_ID] [EVENT_ID] statement/sql/create_db marker1_db CREATE SCHEMA `marker1_db` create database marker1_db
+[THREAD_ID] [EVENT_ID] statement/sql/create_db marker2_db CREATE SCHEMA `marker2_db` create database marker2_db
+[THREAD_ID] [EVENT_ID] statement/sql/create_table test CREATE TABLE `marker1_db` . `table1` ( `s1` INTEGER ) ENGINE = `innodb` create table marker1_db.table1 (s1 int) engine=innodb
+[THREAD_ID] [EVENT_ID] statement/sql/create_table test CREATE TABLE `marker2_db` . `table1` ( `s1` INTEGER ) ENGINE = `innodb` create table marker2_db.table1 (s1 int) engine=innodb
+[THREAD_ID] [EVENT_ID] statement/sql/create_table test CREATE TABLE `marker2_db` . `table2` ( `s1` INTEGER ) ENGINE = `innodb` create table marker2_db.table2 (s1 int) engine=innodb
+[THREAD_ID] [EVENT_ID] statement/sql/insert test INSERT INTO `marker1_db` . `table1` VALUES (?) /* , ... */ insert into marker1_db.table1 values (1), (2), (3)
+[THREAD_ID] [EVENT_ID] statement/sql/insert test INSERT INTO `marker2_db` . `table1` VALUES (?) /* , ... */ insert into marker2_db.table1 values (1), (2), (3)
+[THREAD_ID] [EVENT_ID] statement/sql/alter_table test ALTER TABLE `marker1_db` . `table1` ADD COLUMN ( `s2` VARCHARACTER (?) ) alter table marker1_db.table1 add column (s2 varchar(32))
+[THREAD_ID] [EVENT_ID] statement/sql/insert test INSERT INTO `marker1_db` . `table1` VALUES (...) /* , ... */ insert into marker1_db.table1 values (4, 'four'), (5, 'five'), (6, 'six')
+[THREAD_ID] [EVENT_ID] statement/sql/update test UPDATE `marker1_db` . `table1` SET `s1` = `s1` + ? update marker1_db.table1 set s1 = s1 + 1
+[THREAD_ID] [EVENT_ID] statement/sql/delete test DELETE FROM `marker1_db` . `table1` WHERE `s1` > ? delete from marker1_db.table1 where s1 > 4
[THREAD_ID] [EVENT_ID] statement/sql/drop_table test DROP TABLE `marker2_db` . `table1` DROP TABLE `marker2_db`.`table1` /* generated by server */
-[THREAD_ID] [EVENT_ID] statement/sql/drop_db marker2_db DROP SCHEMA marker2_db drop database marker2_db
+[THREAD_ID] [EVENT_ID] statement/sql/drop_db marker2_db DROP SCHEMA `marker2_db` drop database marker2_db
*** Compare master and slave events
@@ -190,7 +190,6 @@ where t1.thread_id = @slave_thread_id and
sql_text like '%marker%' and
not exists (select * from master_events_statements_history_long t2 where t2.digest = t1.digest);
thread_id event_id event_name digest digest_text sql_text
-[THREAD_ID] [EVENT_ID] statement/sql/drop_table [DIGEST] DROP TABLE `marker2_db` . `table1` DROP TABLE `marker2_db`.`table1` /* generated by server */
#
# STEP 6 - DISABLE REPLICATED STATEMENT EVENTS ON SLAVE
diff --git a/mysql-test/suite/perfschema/r/setup_actors.result b/mysql-test/suite/perfschema/r/setup_actors.result
index 038fb623ab6..187b558e827 100644
--- a/mysql-test/suite/perfschema/r/setup_actors.result
+++ b/mysql-test/suite/perfschema/r/setup_actors.result
@@ -17,10 +17,15 @@ hostb % %
hosta user1 %
% user2 %
localhost user3 %
+create user user1@localhost;
grant ALL on *.* to user1@localhost;
+create user user2@localhost;
grant ALL on *.* to user2@localhost;
+create user user3@localhost;
grant ALL on *.* to user3@localhost;
+create user user4@localhost;
grant ALL on *.* to user4@localhost;
+create user user5@localhost;
grant select on test.* to user5@localhost;
flush privileges;
# Switch to (con1, localhost, user1, , )
diff --git a/mysql-test/suite/perfschema/r/setup_objects.result b/mysql-test/suite/perfschema/r/setup_objects.result
index e623aeb8521..01744df940a 100644
--- a/mysql-test/suite/perfschema/r/setup_objects.result
+++ b/mysql-test/suite/perfschema/r/setup_objects.result
@@ -27,25 +27,25 @@ insert into performance_schema.setup_objects
values ('TABLE', 'db4', '%', 'YES', 'NO');
insert into performance_schema.setup_objects
values ('SOMETHING', 'bad1', 'bad1', 'YES', 'NO');
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails ()
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails
show warnings;
Level Code Message
Warning 1265 Data truncated for column 'OBJECT_TYPE' at row 1
-Error 1452 Cannot add or update a child row: a foreign key constraint fails ()
+Error 1452 Cannot add or update a child row: a foreign key constraint fails
insert into performance_schema.setup_objects
values ('TABLE', 'bad2', 'bad2', 'MAYBE', 'NO');
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails ()
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails
show warnings;
Level Code Message
Warning 1265 Data truncated for column 'ENABLED' at row 1
-Error 1452 Cannot add or update a child row: a foreign key constraint fails ()
+Error 1452 Cannot add or update a child row: a foreign key constraint fails
insert into performance_schema.setup_objects
values ('TABLE', 'bad3', 'bad3', 'YES', 'MAYBE NOT');
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails ()
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails
show warnings;
Level Code Message
Warning 1265 Data truncated for column 'TIMED' at row 1
-Error 1452 Cannot add or update a child row: a foreign key constraint fails ()
+Error 1452 Cannot add or update a child row: a foreign key constraint fails
select * from performance_schema.setup_objects
order by OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME;
OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME ENABLED TIMED
@@ -64,10 +64,10 @@ set OBJECT_TYPE='SOMETHING' where OBJECT_SCHEMA='db1' and OBJECT_NAME='t1';
ERROR HY000: Invalid performance_schema usage.
update performance_schema.setup_objects
set ENABLED='MAYBE' where OBJECT_SCHEMA='db1' and OBJECT_NAME='t1';
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails ()
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails
update performance_schema.setup_objects
set TIMED='MAYBE NOT' where OBJECT_SCHEMA='db1' and OBJECT_NAME='t1';
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails ()
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails
select * from performance_schema.setup_objects
order by OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME;
OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME ENABLED TIMED
diff --git a/mysql-test/suite/perfschema/r/sizing_default.result b/mysql-test/suite/perfschema/r/sizing_default.result
index d7c4e321204..1ca202e821f 100644
--- a/mysql-test/suite/perfschema/r/sizing_default.result
+++ b/mysql-test/suite/perfschema/r/sizing_default.result
@@ -23,6 +23,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 3504
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 7693
diff --git a/mysql-test/suite/perfschema/r/sizing_high.result b/mysql-test/suite/perfschema/r/sizing_high.result
index c7c7b065992..b633d5fce8d 100644
--- a/mysql-test/suite/perfschema/r/sizing_high.result
+++ b/mysql-test/suite/perfschema/r/sizing_high.result
@@ -23,6 +23,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 10900
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 23385
diff --git a/mysql-test/suite/perfschema/r/sizing_low.result b/mysql-test/suite/perfschema/r/sizing_low.result
index 213cc0b5f74..dce5a994099 100644
--- a/mysql-test/suite/perfschema/r/sizing_low.result
+++ b/mysql-test/suite/perfschema/r/sizing_low.result
@@ -23,6 +23,7 @@ performance_schema_events_waits_history_size 5
performance_schema_hosts_size 20
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 612
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 1556
diff --git a/mysql-test/suite/perfschema/r/sizing_med.result b/mysql-test/suite/perfschema/r/sizing_med.result
index fbe703c5ff5..2eda017467a 100644
--- a/mysql-test/suite/perfschema/r/sizing_med.result
+++ b/mysql-test/suite/perfschema/r/sizing_med.result
@@ -23,6 +23,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1079
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 1754
diff --git a/mysql-test/suite/perfschema/r/sizing_off.result b/mysql-test/suite/perfschema/r/sizing_off.result
index 614ad7d2475..b4ca7b1b9be 100644
--- a/mysql-test/suite/perfschema/r/sizing_off.result
+++ b/mysql-test/suite/perfschema/r/sizing_off.result
@@ -14,6 +14,7 @@ performance_schema_events_waits_history_size -1
performance_schema_hosts_size -1
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances -1
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances -1
diff --git a/mysql-test/suite/perfschema/r/socket_summary_by_instance_func.result b/mysql-test/suite/perfschema/r/socket_summary_by_instance_func.result
index d725009d8fd..21b99360e64 100644
--- a/mysql-test/suite/perfschema/r/socket_summary_by_instance_func.result
+++ b/mysql-test/suite/perfschema/r/socket_summary_by_instance_func.result
@@ -33,11 +33,13 @@ ERROR 28000: Access denied for user 'boot0123456789'@'localhost' (using password
# 2.5 Connect should pass, host = localhost
# length of user name = 10 character
# length of default db = 9 character
+CREATE USER 'root012345'@'localhost';
GRANT ALL PRIVILEGES ON *.* TO 'root012345'@'localhost';
DROP USER 'root012345'@'localhost';
# 2.6 Connect should pass, host = localhost
# length of user name = 14 character
# length of default db = 9 character
+CREATE USER 'root0123456789'@'localhost';
GRANT ALL PRIVILEGES ON *.* to 'root0123456789'@'localhost';
DROP USER 'root0123456789'@'localhost';
# 2.7 Connect should pass, host = my_localhost
diff --git a/mysql-test/suite/perfschema/r/stage_mdl_global.result b/mysql-test/suite/perfschema/r/stage_mdl_global.result
index 1a6f51a4acc..de5df8f189a 100644
--- a/mysql-test/suite/perfschema/r/stage_mdl_global.result
+++ b/mysql-test/suite/perfschema/r/stage_mdl_global.result
@@ -6,6 +6,8 @@ user1 statement/sql/flush flush tables with read lock
username event_name nesting_event_type
username event_name nesting_event_type
user1 stage/sql/init STATEMENT
+user1 stage/sql/Waiting for query cache lock STATEMENT
+user1 stage/sql/init STATEMENT
user1 stage/sql/query end STATEMENT
user1 stage/sql/closing tables STATEMENT
user1 stage/sql/freeing items STATEMENT
diff --git a/mysql-test/suite/perfschema/r/start_server_disable_idle.result b/mysql-test/suite/perfschema/r/start_server_disable_idle.result
index 9e0b9209b89..382824458a0 100644
--- a/mysql-test/suite/perfschema/r/start_server_disable_idle.result
+++ b/mysql-test/suite/perfschema/r/start_server_disable_idle.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_disable_stages.result b/mysql-test/suite/perfschema/r/start_server_disable_stages.result
index 99b18e851a4..6fae8be810f 100644
--- a/mysql-test/suite/perfschema/r/start_server_disable_stages.result
+++ b/mysql-test/suite/perfschema/r/start_server_disable_stages.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_disable_statements.result b/mysql-test/suite/perfschema/r/start_server_disable_statements.result
index 5217f16a32f..ff9c6f93268 100644
--- a/mysql-test/suite/perfschema/r/start_server_disable_statements.result
+++ b/mysql-test/suite/perfschema/r/start_server_disable_statements.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_disable_waits.result b/mysql-test/suite/perfschema/r/start_server_disable_waits.result
index 86c25348cd5..38e1f59cd39 100644
--- a/mysql-test/suite/perfschema/r/start_server_disable_waits.result
+++ b/mysql-test/suite/perfschema/r/start_server_disable_waits.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_innodb.result b/mysql-test/suite/perfschema/r/start_server_innodb.result
index d03c20a5878..a270b4a6320 100644
--- a/mysql-test/suite/perfschema/r/start_server_innodb.result
+++ b/mysql-test/suite/perfschema/r/start_server_innodb.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_account.result b/mysql-test/suite/perfschema/r/start_server_no_account.result
index 3e0324868a7..05d67d88a8b 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_account.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_account.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result
index 158dfb81ebe..574c8d4173b 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 0
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
index 3673600a078..ea5c7a69125 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 0
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_class.result b/mysql-test/suite/perfschema/r/start_server_no_file_class.result
index 1e819d26265..0f93054bfd4 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_file_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_class.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 0
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result
index b439af66f8d..71004d68f5e 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 0
diff --git a/mysql-test/suite/perfschema/r/start_server_no_host.result b/mysql-test/suite/perfschema/r/start_server_no_host.result
index abb8a157ec6..329f74a4fff 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_host.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_host.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 0
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
index c5fe555b749..cda2719cc37 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
index d88d808a9ab..0ea5fe44521 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
index 1155993e60c..29a17e6a3ac 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
index 4d419817b0a..8b214077f37 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result b/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result
index 281ca17491c..3a0588d616d 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result b/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result
index 1e5578daddc..89763379b99 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_socket_class.result b/mysql-test/suite/perfschema/r/start_server_no_socket_class.result
index ef1050d9fde..0b14c6caf15 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_socket_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_socket_class.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result b/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result
index 97cbc807f3c..599e09f6c99 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_stage_class.result b/mysql-test/suite/perfschema/r/start_server_no_stage_class.result
index a173447632d..1d53efc500c 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_stage_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_stage_class.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_stages_history.result b/mysql-test/suite/perfschema/r/start_server_no_stages_history.result
index 6de6cc3187e..370ec61ff67 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_stages_history.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_stages_history.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result
index fc0e680ebb7..d8018e0ba44 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_statement_class.result b/mysql-test/suite/perfschema/r/start_server_no_statement_class.result
index fca5ab82238..a617e7edb0a 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_statement_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_statement_class.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_statements_history.result b/mysql-test/suite/perfschema/r/start_server_no_statements_history.result
index 1fc13bf6ce3..8d196aa9a4a 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_statements_history.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_statements_history.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result
index d51d3acf343..360e8db910b 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result b/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result
index 784ed74e33c..01b7233582e 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_table_inst.result b/mysql-test/suite/perfschema/r/start_server_no_table_inst.result
index da73df5c419..5608c324321 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_table_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_table_inst.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result
index a84f0f3c0ef..b1a7758a9d8 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
index 3be29053b33..ad0353589ad 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_user.result b/mysql-test/suite/perfschema/r/start_server_no_user.result
index d80a9a4a2c4..2e1c097e28b 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_user.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_user.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_waits_history.result b/mysql-test/suite/perfschema/r/start_server_no_waits_history.result
index 928307123d8..a3a9cbeee11 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_waits_history.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_waits_history.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 0
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result
index d8ada5f9da5..e5465aa6bbb 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_nothing.result b/mysql-test/suite/perfschema/r/start_server_nothing.result
index bf84848641c..d28eed31e7d 100644
--- a/mysql-test/suite/perfschema/r/start_server_nothing.result
+++ b/mysql-test/suite/perfschema/r/start_server_nothing.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 0
performance_schema_hosts_size 0
performance_schema_max_cond_classes 0
performance_schema_max_cond_instances 0
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 0
performance_schema_max_file_handles 0
performance_schema_max_file_instances 0
@@ -119,6 +120,7 @@ performance_schema_events_waits_history_size 0
performance_schema_hosts_size 0
performance_schema_max_cond_classes 0
performance_schema_max_cond_instances 0
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 0
performance_schema_max_file_handles 0
performance_schema_max_file_instances 0
diff --git a/mysql-test/suite/perfschema/r/start_server_off.result b/mysql-test/suite/perfschema/r/start_server_off.result
index 293607c41e9..a5f552b4bbf 100644
--- a/mysql-test/suite/perfschema/r/start_server_off.result
+++ b/mysql-test/suite/perfschema/r/start_server_off.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/start_server_on.result b/mysql-test/suite/perfschema/r/start_server_on.result
index d03c20a5878..a270b4a6320 100644
--- a/mysql-test/suite/perfschema/r/start_server_on.result
+++ b/mysql-test/suite/perfschema/r/start_server_on.result
@@ -85,6 +85,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/statement_digest.result b/mysql-test/suite/perfschema/r/statement_digest.result
index 6d9429799bd..6abe865f1aa 100644
--- a/mysql-test/suite/perfschema/r/statement_digest.result
+++ b/mysql-test/suite/perfschema/r/statement_digest.result
@@ -112,42 +112,41 @@ DROP TRIGGER trg;
SELECT SCHEMA_NAME, DIGEST_TEXT, COUNT_STAR, SUM_ROWS_AFFECTED, SUM_WARNINGS,
SUM_ERRORS FROM performance_schema.events_statements_summary_by_digest;
SCHEMA_NAME DIGEST_TEXT COUNT_STAR SUM_ROWS_AFFECTED SUM_WARNINGS SUM_ERRORS
-statements_digest TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1 0 0 0
-statements_digest SELECT ? FROM t1 1 0 0 0
-statements_digest SELECT ? FROM `t1` 1 0 0 0
-statements_digest SELECT ?, ... FROM t1 2 0 0 0
-statements_digest SELECT ? FROM t2 1 0 0 0
-statements_digest SELECT ?, ... FROM t2 2 0 0 0
-statements_digest INSERT INTO t1 VALUES (?) 2 2 0 0
-statements_digest INSERT INTO t2 VALUES (?) 1 1 0 0
-statements_digest INSERT INTO t3 VALUES (...) 4 4 0 0
-statements_digest INSERT INTO t4 VALUES (...) 1 1 0 0
-statements_digest INSERT INTO t5 VALUES (...) 1 1 0 0
-statements_digest INSERT INTO t1 VALUES (?) /* , ... */ 2 7 0 0
-statements_digest INSERT INTO t3 VALUES (...) /* , ... */ 1 3 0 0
-statements_digest INSERT INTO t5 VALUES (...) /* , ... */ 1 3 0 0
-statements_digest INSERT INTO t6 VALUES (...) 5 5 0 0
+statements_digest TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1 0 0 0
+statements_digest SELECT ? FROM `t1` 2 0 0 0
+statements_digest SELECT ?, ... FROM `t1` 2 0 0 0
+statements_digest SELECT ? FROM `t2` 1 0 0 0
+statements_digest SELECT ?, ... FROM `t2` 2 0 0 0
+statements_digest INSERT INTO `t1` VALUES (?) 2 2 0 0
+statements_digest INSERT INTO `t2` VALUES (?) 1 1 0 0
+statements_digest INSERT INTO `t3` VALUES (...) 4 4 0 0
+statements_digest INSERT INTO `t4` VALUES (...) 1 1 0 0
+statements_digest INSERT INTO `t5` VALUES (...) 1 1 0 0
+statements_digest INSERT INTO `t1` VALUES (?) /* , ... */ 2 7 0 0
+statements_digest INSERT INTO `t3` VALUES (...) /* , ... */ 1 3 0 0
+statements_digest INSERT INTO `t5` VALUES (...) /* , ... */ 1 3 0 0
+statements_digest INSERT INTO `t6` VALUES (...) 5 5 0 0
statements_digest SELECT ? + ? 3 0 0 0
statements_digest SELECT ? 1 0 0 0
-statements_digest CREATE SCHEMA statements_digest_temp 2 2 0 0
-statements_digest DROP SCHEMA statements_digest_temp 2 0 0 0
-statements_digest SELECT ? FROM no_such_table 1 0 0 1
-statements_digest CREATE TABLE dup_table ( c CHARACTER (?) ) 2 0 0 1
-statements_digest DROP TABLE dup_table 1 0 0 0
-statements_digest INSERT INTO t11 VALUES (?) 1 1 1 0
+statements_digest CREATE SCHEMA `statements_digest_temp` 2 2 0 0
+statements_digest DROP SCHEMA `statements_digest_temp` 2 0 0 0
+statements_digest SELECT ? FROM `no_such_table` 1 0 0 1
+statements_digest CREATE TABLE `dup_table` ( `c` CHARACTER (?) ) 2 0 0 1
+statements_digest DROP TABLE `dup_table` 1 0 0 0
+statements_digest INSERT INTO `t11` VALUES (?) 1 1 1 0
statements_digest SHOW WARNINGS 1 0 0 0
-statements_digest PREPARE stmt FROM ? 1 0 0 0
-statements_digest EXECUTE stmt 2 0 0 0
-statements_digest DEALLOCATE PREPARE stmt 1 0 0 0
-statements_digest CREATE PROCEDURE p1 ( ) BEGIN SELECT * FROM t12 ; END 1 0 0 0
-statements_digest CALL p1 ( ) 2 0 0 0
-statements_digest DROP PROCEDURE p1 1 0 0 0
-statements_digest CREATE FUNCTION `func` ( a INTEGER , b INTEGER ) RETURNS INTEGER (?) RETURN a + b 1 0 0 0
-statements_digest SELECT func (...) 2 0 0 0
-statements_digest DROP FUNCTION func 1 0 0 0
-statements_digest CREATE TRIGGER trg BEFORE INSERT ON t12 FOR EACH ROW SET @? := ? 1 0 0 0
-statements_digest INSERT INTO t12 VALUES (?) 2 2 0 0
-statements_digest DROP TRIGGER trg 1 0 0 0
+statements_digest PREPARE `stmt` FROM ? 1 0 0 0
+statements_digest EXECUTE `stmt` 2 0 0 0
+statements_digest DEALLOCATE PREPARE `stmt` 1 0 0 0
+statements_digest CREATE PROCEDURE `p1` ( ) BEGIN SELECT * FROM `t12` ; END 1 0 0 0
+statements_digest CALL `p1` ( ) 2 0 0 0
+statements_digest DROP PROCEDURE `p1` 1 0 0 0
+statements_digest CREATE FUNCTION `func` ( `a` INTEGER , `b` INTEGER ) RETURNS INTEGER (?) RETURN `a` + `b` 1 0 0 0
+statements_digest SELECT `func` (...) 2 0 0 0
+statements_digest DROP FUNCTION `func` 1 0 0 0
+statements_digest CREATE TRIGGER `trg` BEFORE INSERT ON `t12` FOR EACH ROW SET @? := ? 1 0 0 0
+statements_digest INSERT INTO `t12` VALUES (?) 2 2 0 0
+statements_digest DROP TRIGGER `trg` 1 0 0 0
####################################
# CLEANUP
####################################
diff --git a/mysql-test/suite/perfschema/r/statement_digest_consumers.result b/mysql-test/suite/perfschema/r/statement_digest_consumers.result
index 04577e254f4..db60362dd92 100644
--- a/mysql-test/suite/perfschema/r/statement_digest_consumers.result
+++ b/mysql-test/suite/perfschema/r/statement_digest_consumers.result
@@ -125,42 +125,41 @@ DROP TRIGGER trg;
####################################
SELECT schema_name,digest_text, count_star FROM performance_schema.events_statements_summary_by_digest;
schema_name digest_text count_star
-statements_digest TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1
-statements_digest SELECT ? FROM t1 1
-statements_digest SELECT ? FROM `t1` 1
-statements_digest SELECT ?, ... FROM t1 2
-statements_digest SELECT ? FROM t2 1
-statements_digest SELECT ?, ... FROM t2 2
-statements_digest INSERT INTO t1 VALUES (?) 2
-statements_digest INSERT INTO t2 VALUES (?) 1
-statements_digest INSERT INTO t3 VALUES (...) 4
-statements_digest INSERT INTO t4 VALUES (...) 1
-statements_digest INSERT INTO t5 VALUES (...) 1
-statements_digest INSERT INTO t1 VALUES (?) /* , ... */ 2
-statements_digest INSERT INTO t3 VALUES (...) /* , ... */ 1
-statements_digest INSERT INTO t5 VALUES (...) /* , ... */ 1
-statements_digest INSERT INTO t6 VALUES (...) 5
+statements_digest TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
+statements_digest SELECT ? FROM `t1` 2
+statements_digest SELECT ?, ... FROM `t1` 2
+statements_digest SELECT ? FROM `t2` 1
+statements_digest SELECT ?, ... FROM `t2` 2
+statements_digest INSERT INTO `t1` VALUES (?) 2
+statements_digest INSERT INTO `t2` VALUES (?) 1
+statements_digest INSERT INTO `t3` VALUES (...) 4
+statements_digest INSERT INTO `t4` VALUES (...) 1
+statements_digest INSERT INTO `t5` VALUES (...) 1
+statements_digest INSERT INTO `t1` VALUES (?) /* , ... */ 2
+statements_digest INSERT INTO `t3` VALUES (...) /* , ... */ 1
+statements_digest INSERT INTO `t5` VALUES (...) /* , ... */ 1
+statements_digest INSERT INTO `t6` VALUES (...) 5
statements_digest SELECT ? + ? 3
statements_digest SELECT ? 1
-statements_digest CREATE SCHEMA statements_digest_temp 2
-statements_digest DROP SCHEMA statements_digest_temp 2
-statements_digest SELECT ? FROM no_such_table 1
-statements_digest CREATE TABLE dup_table ( c CHARACTER (?) ) 2
-statements_digest DROP TABLE dup_table 1
-statements_digest INSERT INTO t11 VALUES (?) 1
+statements_digest CREATE SCHEMA `statements_digest_temp` 2
+statements_digest DROP SCHEMA `statements_digest_temp` 2
+statements_digest SELECT ? FROM `no_such_table` 1
+statements_digest CREATE TABLE `dup_table` ( `c` CHARACTER (?) ) 2
+statements_digest DROP TABLE `dup_table` 1
+statements_digest INSERT INTO `t11` VALUES (?) 1
statements_digest SHOW WARNINGS 1
-statements_digest PREPARE stmt FROM ? 1
-statements_digest EXECUTE stmt 2
-statements_digest DEALLOCATE PREPARE stmt 1
-statements_digest CREATE PROCEDURE p1 ( ) BEGIN SELECT * FROM t12 ; END 1
-statements_digest CALL p1 ( ) 2
-statements_digest DROP PROCEDURE p1 1
-statements_digest CREATE FUNCTION `func` ( a INTEGER , b INTEGER ) RETURNS INTEGER (?) RETURN a + b 1
-statements_digest SELECT func (...) 2
-statements_digest DROP FUNCTION func 1
-statements_digest CREATE TRIGGER trg BEFORE INSERT ON t12 FOR EACH ROW SET @? := ? 1
-statements_digest INSERT INTO t12 VALUES (?) 2
-statements_digest DROP TRIGGER trg 1
+statements_digest PREPARE `stmt` FROM ? 1
+statements_digest EXECUTE `stmt` 2
+statements_digest DEALLOCATE PREPARE `stmt` 1
+statements_digest CREATE PROCEDURE `p1` ( ) BEGIN SELECT * FROM `t12` ; END 1
+statements_digest CALL `p1` ( ) 2
+statements_digest DROP PROCEDURE `p1` 1
+statements_digest CREATE FUNCTION `func` ( `a` INTEGER , `b` INTEGER ) RETURNS INTEGER (?) RETURN `a` + `b` 1
+statements_digest SELECT `func` (...) 2
+statements_digest DROP FUNCTION `func` 1
+statements_digest CREATE TRIGGER `trg` BEFORE INSERT ON `t12` FOR EACH ROW SET @? := ? 1
+statements_digest INSERT INTO `t12` VALUES (?) 2
+statements_digest DROP TRIGGER `trg` 1
SELECT digest_text FROM performance_schema.events_statements_current;
digest_text
####################################
diff --git a/mysql-test/suite/perfschema/r/statement_digest_long_query.result b/mysql-test/suite/perfschema/r/statement_digest_long_query.result
index 236720edb91..1c581085eef 100644
--- a/mysql-test/suite/perfschema/r/statement_digest_long_query.result
+++ b/mysql-test/suite/perfschema/r/statement_digest_long_query.result
@@ -8,5 +8,5 @@ SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1
####################################
SELECT schema_name, digest_text, count_star FROM events_statements_summary_by_digest;
schema_name digest_text count_star
-performance_schema TRUNCATE TABLE events_statements_summary_by_digest 1
+performance_schema TRUNCATE TABLE `events_statements_summary_by_digest` 1
performance_schema SELECT ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? 1
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result
index 2613737a3da..189a3200a91 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result
@@ -55,6 +55,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result
index e5aaf207820..b4fbf37265a 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result
@@ -54,6 +54,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result
index 637d923ebdb..d20378236f5 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result
@@ -55,6 +55,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result
index a41ae765a77..087ed9e63ab 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result
@@ -54,6 +54,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result
index 2278744621e..860059fe0eb 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result
@@ -53,6 +53,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result
index b3ada0d638a..50bc51b8da6 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result
@@ -52,6 +52,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result
index 361a8a700d0..9340014985e 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result
@@ -53,6 +53,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result
index 97bb0e34e0d..53ec7343676 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result
@@ -52,6 +52,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_off.result b/mysql-test/suite/perfschema/r/table_aggregate_off.result
index f28f374c5dd..029a5d53861 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_off.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_off.result
@@ -54,6 +54,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result
index f7760043ddd..d5c58d478bb 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result
@@ -55,6 +55,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result
index 0ee5eaddcaf..ae08a9749ef 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result
@@ -54,6 +54,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result
index 025a7f27738..c3849107bd4 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result
@@ -55,6 +55,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result
index f655cd5bb93..f8f17d400ae 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result
@@ -54,6 +54,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result
index 55bb5a6a71f..2aeeffdedcc 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result
@@ -57,6 +57,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result
index 7f9f9e99359..43088cd3cfd 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result
@@ -56,6 +56,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result
index 7aa15b6a01d..f65e0494ebd 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result
@@ -57,6 +57,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result
index 0732fce5853..2ab94084bb7 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result
@@ -56,6 +56,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result
index c1f6fd56a97..7aec1bba281 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result
@@ -55,6 +55,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result
index 705e6ca7021..ddfc5e373dd 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result
@@ -54,6 +54,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result
index 04b7c7979c4..01b1d61877f 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result
@@ -55,6 +55,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result
index ef1f31b19a4..7b2554a4b64 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result
@@ -54,6 +54,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result
index a7ac4fa860f..7a950643800 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result
@@ -57,6 +57,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result
index 28bdcfb1d82..8f9e6278ba8 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result
@@ -56,6 +56,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result
index 683dd9cc4a6..eb83349f11e 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result
@@ -57,6 +57,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result
index d488066dd7f..8c3b6a0549f 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result
@@ -56,6 +56,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result
index d3a4416fdfd..f2c79374583 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result
@@ -57,6 +57,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result
index c69fc8a37d3..66a917412a9 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result
@@ -56,6 +56,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result
index 91110a94be5..3b6326fd2df 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result
@@ -57,6 +57,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result
index b443ac28c17..85e1bbeb332 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result
@@ -56,6 +56,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result
index 08a107acb2a..725770f2b3c 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result
@@ -55,6 +55,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result
index 07272c6e204..d92ec0a1997 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result
@@ -54,6 +54,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result
index 77c52780ae9..b03a26f4694 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result
@@ -55,6 +55,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result
index 6d7192285e3..ca62861bedb 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result
@@ -54,6 +54,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result
index 160be444e7c..7c1bbd2ddb0 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result
@@ -57,6 +57,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result
index e915a8dfa95..302563786d2 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result
@@ -56,6 +56,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result
index 82c1b65acff..390a3523421 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result
@@ -57,6 +57,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result
index 9023a4b0a69..123075896aa 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result
@@ -56,6 +56,7 @@ performance_schema_events_waits_history_size 10
performance_schema_hosts_size 100
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances 1000
+performance_schema_max_digest_length 1024
performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
diff --git a/mysql-test/suite/perfschema/r/threads_mysql.result b/mysql-test/suite/perfschema/r/threads_mysql.result
index 4da857f83fc..6ab0b0641b0 100644
--- a/mysql-test/suite/perfschema/r/threads_mysql.result
+++ b/mysql-test/suite/perfschema/r/threads_mysql.result
@@ -13,7 +13,7 @@ processlist_user NULL
processlist_host NULL
processlist_db NULL
processlist_command NULL
-processlist_info INTERNAL DDL LOG RECOVER IN PROGRESS
+processlist_info NULL
unified_parent_thread_id NULL
role NULL
instrumented YES
diff --git a/mysql-test/suite/perfschema/r/unary_digest.result b/mysql-test/suite/perfschema/r/unary_digest.result
index 40fcc026fad..44347886a96 100644
--- a/mysql-test/suite/perfschema/r/unary_digest.result
+++ b/mysql-test/suite/perfschema/r/unary_digest.result
@@ -39,9 +39,9 @@ ERROR 42S02: Table 'test.expect_unchanged' doesn't exist
SELECT SCHEMA_NAME, DIGEST_TEXT, COUNT_STAR
FROM performance_schema.events_statements_summary_by_digest;
SCHEMA_NAME DIGEST_TEXT COUNT_STAR
-test TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1
-test SELECT ? FROM expect_unary 5
-test SELECT ? + ? FROM expect_binary 2
-test SELECT ? - ? FROM expect_binary 2
-test INSERT INTO expect_full_reduce VALUES (...) 27
-test SELECT a - b , a + b , - a , - b , + a , + b FROM expect_unchanged 1
+test TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
+test SELECT ? FROM `expect_unary` 5
+test SELECT ? + ? FROM `expect_binary` 2
+test SELECT ? - ? FROM `expect_binary` 2
+test INSERT INTO `expect_full_reduce` VALUES (...) 27
+test SELECT `a` - `b` , `a` + `b` , - `a` , - `b` , + `a` , + `b` FROM `expect_unchanged` 1
diff --git a/mysql-test/suite/perfschema/t/column_privilege.test b/mysql-test/suite/perfschema/t/column_privilege.test
index 6fabdfb4229..004492c6145 100644
--- a/mysql-test/suite/perfschema/t/column_privilege.test
+++ b/mysql-test/suite/perfschema/t/column_privilege.test
@@ -7,6 +7,7 @@
show grants;
+create user 'pfs_user_5'@localhost;
grant usage on *.* to 'pfs_user_5'@localhost with GRANT OPTION;
# Test per column privileges on performance_schema
diff --git a/mysql-test/suite/perfschema/t/digest_null_literal.test b/mysql-test/suite/perfschema/t/digest_null_literal.test
index a3007ced1e2..91f1eec1f95 100644
--- a/mysql-test/suite/perfschema/t/digest_null_literal.test
+++ b/mysql-test/suite/perfschema/t/digest_null_literal.test
@@ -7,7 +7,7 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;
diff --git a/mysql-test/suite/perfschema/t/global_read_lock.test b/mysql-test/suite/perfschema/t/global_read_lock.test
index f73b8785cb2..0883ed1ed42 100644
--- a/mysql-test/suite/perfschema/t/global_read_lock.test
+++ b/mysql-test/suite/perfschema/t/global_read_lock.test
@@ -11,6 +11,7 @@ use performance_schema;
# Ensure that instrumentation is turned on when we create new connection.
update performance_schema.setup_instruments set enabled='YES';
+create user pfsuser@localhost;
grant SELECT, UPDATE, LOCK TABLES on performance_schema.* to pfsuser@localhost;
flush privileges;
@@ -56,7 +57,9 @@ let $wait_condition= select 1 from performance_schema.events_waits_current where
# Observe the blocked thread in the performance schema :)
select event_name,
left(source, locate(":", source)) as short_source,
- timer_end, timer_wait, operation
+ if(timer_end IS NULL, NULL, "SET") as timer_end,
+ if(timer_wait IS NULL, NULL, "SET") as timer_wait,
+ operation
from performance_schema.events_waits_current
where event_name like "wait/synch/cond/sql/MDL_context::COND_wait_status";
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_allow.test
index a96ccf86315..df82a5c047d 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_allow.test
@@ -18,6 +18,7 @@ call mtr.add_suppression("santa.claus.ipv4.example.com");
--source ../include/wait_for_pfs_thread_count.inc
--source ../include/hostcache_set_state.inc
+create user 'root'@'192.0.2.4';
grant select on test.* to 'root'@'192.0.2.4';
connect (con1,"127.0.0.1",root,,test,$MASTER_MYPORT,);
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_allow.test
index 4bf041b1ada..08cbe8d15af 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_allow.test
@@ -20,6 +20,7 @@ call mtr.add_suppression("santa.claus.ipv4.example.com");
--source ../include/wait_for_pfs_thread_count.inc
--source ../include/hostcache_set_state.inc
+create user 'root'@'192.0.2.4';
grant select on test.* to 'root'@'192.0.2.4';
connect (con1,"127.0.0.1",root,,test,$MASTER_MYPORT,);
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_allow.test
index 9931fa5ffba..808a1b927d7 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_allow.test
@@ -18,6 +18,7 @@ call mtr.add_suppression("192.0.2.4");
--source ../include/wait_for_pfs_thread_count.inc
--source ../include/hostcache_set_state.inc
+create user 'root'@'santa.claus.ipv4.example.com';
grant select on test.* to 'root'@'santa.claus.ipv4.example.com';
connect (con1,"127.0.0.1",root,,test,$MASTER_MYPORT,);
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_allow.test
index 283d3a5841d..6f763d8c666 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_allow.test
@@ -18,7 +18,9 @@ call mtr.add_suppression("santa.claus.ipv4.example.com");
--source ../include/wait_for_pfs_thread_count.inc
--source ../include/hostcache_set_state.inc
+create user 'root'@'santa.claus.ipv4.example.com';
grant select on test.* to 'root'@'santa.claus.ipv4.example.com';
+create user 'root'@'192.0.2.4';
grant select on test.* to 'root'@'192.0.2.4';
connect (con1,"127.0.0.1",root,,test,$MASTER_MYPORT,);
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test
index 7c89aa3d44e..b18dcd5f494 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test
@@ -20,6 +20,7 @@ select @@global.max_connect_errors into @saved_max_connect_errors;
set global max_connect_errors = 3;
+create user 'root'@'santa.claus.ipv4.example.com';
grant select on test.* to 'root'@'santa.claus.ipv4.example.com';
create user 'quota'@'santa.claus.ipv4.example.com';
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_allow.test
index bce65b61cfc..ab72e0f4340 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_allow.test
@@ -18,7 +18,9 @@ call mtr.add_suppression("192.0.2.4");
--source ../include/wait_for_pfs_thread_count.inc
--source ../include/hostcache_set_state.inc
+create user 'root'@'192.0.2.4';
grant select on test.* to 'root'@'192.0.2.4';
+create user 'root'@'santa.claus.ipv4.example.com';
grant select on test.* to 'root'@'santa.claus.ipv4.example.com';
connect (con1,"127.0.0.1",root,,test,$MASTER_MYPORT,);
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_allow.test
index 52b696831af..06776de6b27 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_allow.test
@@ -18,6 +18,7 @@ call mtr.add_suppression("192.0.2.4");
--source ../include/wait_for_pfs_thread_count.inc
--source ../include/hostcache_set_state.inc
+create user 'root'@'192.0.2.4';
grant select on test.* to 'root'@'192.0.2.4';
connect (con1,"127.0.0.1",root,,test,$MASTER_MYPORT,);
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test
index ae58f4089ed..f276e759f75 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# [Warning] Host name 'santa.claus.ipv6.example.com' could not be resolved:
@@ -19,6 +19,7 @@ call mtr.add_suppression("santa.claus.ipv6.example.com");
--source ../include/wait_for_pfs_thread_count.inc
--source ../include/hostcache_set_state.inc
+create user 'root'@'2001:db8::6:6';
grant select on test.* to 'root'@'2001:db8::6:6';
connect (con1,"::1",root,,test,$MASTER_MYPORT,);
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test
index 8c408b160a6..a5ac18a8818 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# [Warning] Host name 'santa.claus.ipv6.example.com' could not be resolved:
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test
index ccd0ae383ee..9f951273e98 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# [Warning] Hostname 'santa.claus.ipv6.example.com' does not resolve to '2001:db8::6:6'.
@@ -21,6 +21,7 @@ call mtr.add_suppression("santa.claus.ipv6.example.com");
--source ../include/wait_for_pfs_thread_count.inc
--source ../include/hostcache_set_state.inc
+create user 'root'@'2001:db8::6:6';
grant select on test.* to 'root'@'2001:db8::6:6';
connect (con1,"::1",root,,test,$MASTER_MYPORT,);
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test
index 72d5d693a1b..361a3ce6bd1 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# [Warning] Hostname 'santa.claus.ipv6.example.com' does not resolve to '2001:db8::6:6'.
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test
index c253e4b77d5..81427e86c5e 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# [Warning] IP address '192.0.2.4' could not be resolved:
@@ -19,6 +19,7 @@ call mtr.add_suppression("192.0.2.4");
--source ../include/wait_for_pfs_thread_count.inc
--source ../include/hostcache_set_state.inc
+create user 'root'@'santa.claus.ipv6.example.com';
grant select on test.* to 'root'@'santa.claus.ipv6.example.com';
connect (con1,"::1",root,,test,$MASTER_MYPORT,);
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test
index 096b4b11eb4..4836dfc2d36 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# Enforce a clean state
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test
index 575dab9a337..7ce12639b7f 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# [Warning] Host name 'santa.claus.ipv6.example.com' could not be resolved:
@@ -19,7 +19,9 @@ call mtr.add_suppression("santa.claus.ipv6.example.com");
--source ../include/wait_for_pfs_thread_count.inc
--source ../include/hostcache_set_state.inc
+create user 'root'@'santa.claus.ipv6.example.com';
grant select on test.* to 'root'@'santa.claus.ipv6.example.com';
+create user 'root'@'2001:db8::6:6';
grant select on test.* to 'root'@'2001:db8::6:6';
connect (con1,"::1",root,,test,$MASTER_MYPORT,);
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test
index f6e5fa118df..9ce4fb926e6 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# [Warning] Host name 'santa.claus.ipv6.example.com' could not be resolved:
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test
index 0e0e900405a..9c8168e573a 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test
@@ -10,7 +10,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
--source include/have_plugin_auth.inc
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test
index 9d4707dc027..0a04ec306cf 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test
@@ -10,7 +10,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# Enforce a clean state
@@ -21,6 +21,7 @@ select @@global.max_connect_errors into @saved_max_connect_errors;
set global max_connect_errors = 3;
+create user 'root'@'santa.claus.ipv6.example.com';
grant select on test.* to 'root'@'santa.claus.ipv6.example.com';
create user 'quota'@'santa.claus.ipv6.example.com';
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test
index d4adc3e0d00..0ced79544a3 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test
@@ -10,7 +10,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# Enforce a clean state
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test
index e396dbbad3c..7e49ed62b93 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# [Warning] IP address '2001:db8::6:6' could not be resolved:
@@ -19,7 +19,9 @@ call mtr.add_suppression("2001:db8::6:6");
--source ../include/wait_for_pfs_thread_count.inc
--source ../include/hostcache_set_state.inc
+create user 'root'@'2001:db8::6:6';
grant select on test.* to 'root'@'2001:db8::6:6';
+create user 'root'@'santa.claus.ipv6.example.com';
grant select on test.* to 'root'@'santa.claus.ipv6.example.com';
connect (con1,"::1",root,,test,$MASTER_MYPORT,);
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test
index cc7eb0b566f..3cdd87e4cf9 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# [Warning] IP address '2001:db8::6:6' could not be resolved:
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test
index 80f07989212..62876e859cb 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# [Warning] IP address '2001:db8::6:6' could not be resolved:
@@ -19,6 +19,7 @@ call mtr.add_suppression("2001:db8::6:6");
--source ../include/wait_for_pfs_thread_count.inc
--source ../include/hostcache_set_state.inc
+create user 'root'@'2001:db8::6:6';
grant select on test.* to 'root'@'2001:db8::6:6';
connect (con1,"::1",root,,test,$MASTER_MYPORT,);
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test
index 0d11e433b58..054940e4a02 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# [Warning] IP address '2001:db8::6:6' could not be resolved:
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_passwd.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_passwd.test
index 6dd33b9bb5b..811c5c51c26 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_passwd.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_passwd.test
@@ -7,7 +7,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# Enforce a clean state
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_ssl.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_ssl.test
index 2b30a4eaf41..c11922624c6 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_ssl.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_ssl.test
@@ -7,7 +7,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# Enforce a clean state
diff --git a/mysql-test/suite/perfschema/t/nesting.test b/mysql-test/suite/perfschema/t/nesting.test
index 21e7260222a..7f1c0b570ad 100644
--- a/mysql-test/suite/perfschema/t/nesting.test
+++ b/mysql-test/suite/perfschema/t/nesting.test
@@ -5,11 +5,12 @@
# On windows, the socket instrumentation collects an extra "opt"
# event, which changes the test output.
--source include/not_windows.inc
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
--source ../include/wait_for_pfs_thread_count.inc
--disable_query_log
+create user user1@localhost;
grant ALL on *.* to user1@localhost;
flush privileges;
diff --git a/mysql-test/suite/perfschema/t/privilege.test b/mysql-test/suite/perfschema/t/privilege.test
index 1864a34bcfe..f5bd5cc4036 100644
--- a/mysql-test/suite/perfschema/t/privilege.test
+++ b/mysql-test/suite/perfschema/t/privilege.test
@@ -5,6 +5,9 @@
show grants;
+create user 'pfs_user_1'@localhost;
+create user 'pfs_user_2'@localhost;
+create user 'pfs_user_3'@localhost;
grant ALL on *.* to 'pfs_user_1'@localhost with GRANT OPTION;
# Test denied privileges on performance_schema.*
@@ -328,4 +331,3 @@ UPDATE performance_schema.setup_timers SET timer_name = 'MICROSECOND' where name
UPDATE performance_schema.setup_timers SET timer_name = 'CYCLE' where name="wait";
UPDATE performance_schema.setup_timers SET timer_name = 'NANOSECOND' where name="stage";
UPDATE performance_schema.setup_timers SET timer_name = 'NANOSECOND' where name="statement";
-
diff --git a/mysql-test/suite/perfschema/t/read_only.test b/mysql-test/suite/perfschema/t/read_only.test
index 3050cee9e72..7b0284a7a48 100644
--- a/mysql-test/suite/perfschema/t/read_only.test
+++ b/mysql-test/suite/perfschema/t/read_only.test
@@ -11,6 +11,7 @@ use performance_schema;
set @start_read_only= @@global.read_only;
+create user pfsuser@localhost;
grant SELECT, UPDATE on performance_schema.* to pfsuser@localhost;
flush privileges;
diff --git a/mysql-test/suite/perfschema/t/rpl_gtid_func.test b/mysql-test/suite/perfschema/t/rpl_gtid_func.test
index f337f95bf84..6373d4284dc 100644
--- a/mysql-test/suite/perfschema/t/rpl_gtid_func.test
+++ b/mysql-test/suite/perfschema/t/rpl_gtid_func.test
@@ -1,7 +1,7 @@
--source include/not_embedded.inc
--source include/have_innodb.inc
--source include/have_perfschema.inc
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
-- source include/master-slave.inc
diff --git a/mysql-test/suite/perfschema/t/rpl_statements.test b/mysql-test/suite/perfschema/t/rpl_statements.test
index 479805edccc..4f65cdcbd7b 100644
--- a/mysql-test/suite/perfschema/t/rpl_statements.test
+++ b/mysql-test/suite/perfschema/t/rpl_statements.test
@@ -4,7 +4,7 @@
--source include/not_embedded.inc
--source include/have_innodb.inc
--source include/have_perfschema.inc
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc
diff --git a/mysql-test/suite/perfschema/t/setup_actors.test b/mysql-test/suite/perfschema/t/setup_actors.test
index e975fa96782..39d60b0ab03 100644
--- a/mysql-test/suite/perfschema/t/setup_actors.test
+++ b/mysql-test/suite/perfschema/t/setup_actors.test
@@ -33,10 +33,15 @@ values ('hostb', '%', '%');
select * from performance_schema.setup_actors
order by USER, HOST, ROLE;
+create user user1@localhost;
grant ALL on *.* to user1@localhost;
+create user user2@localhost;
grant ALL on *.* to user2@localhost;
+create user user3@localhost;
grant ALL on *.* to user3@localhost;
+create user user4@localhost;
grant ALL on *.* to user4@localhost;
+create user user5@localhost;
grant select on test.* to user5@localhost;
flush privileges;
diff --git a/mysql-test/suite/perfschema/t/socket_instances_func-master.opt b/mysql-test/suite/perfschema/t/socket_instances_func-master.opt
index ab6ca1731f5..b12a8b3b70e 100644
--- a/mysql-test/suite/perfschema/t/socket_instances_func-master.opt
+++ b/mysql-test/suite/perfschema/t/socket_instances_func-master.opt
@@ -1 +1 @@
---skip-name-resolve
+--skip-name-resolve --bind-address=*
diff --git a/mysql-test/suite/perfschema/t/socket_summary_by_event_name_func.test b/mysql-test/suite/perfschema/t/socket_summary_by_event_name_func.test
index 5ba3af1e408..c6860eb3213 100644
--- a/mysql-test/suite/perfschema/t/socket_summary_by_event_name_func.test
+++ b/mysql-test/suite/perfschema/t/socket_summary_by_event_name_func.test
@@ -26,7 +26,7 @@
# happens per SQL statement within our MTR tests. And there is a significant
# difference between standard statement execution and execution via
# prepared statement.
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
# Set this to enable debugging output
let $my_socket_debug_dbug= 0;
diff --git a/mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test b/mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test
index ef5096d85ff..bf04e62e1b5 100644
--- a/mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test
+++ b/mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test
@@ -36,7 +36,7 @@
# happens per SQL statement within our MTR tests. And there is a significant
# difference between standard statement execution and execution via
# prepared statement.
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
#===================================
@@ -493,6 +493,7 @@ let $connect_user= root;
--echo # length of user name = 10 character
--echo # length of default db = 9 character
#========================================================================
+CREATE USER 'root012345'@'localhost';
GRANT ALL PRIVILEGES ON *.* TO 'root012345'@'localhost';
let $connect_host= localhost;
let $connect_db= mysqltest;
@@ -504,6 +505,7 @@ DROP USER 'root012345'@'localhost';
--echo # length of user name = 14 character
--echo # length of default db = 9 character
#========================================================================
+CREATE USER 'root0123456789'@'localhost';
GRANT ALL PRIVILEGES ON *.* to 'root0123456789'@'localhost';
let $connect_host= localhost;
let $connect_db= mysqltest;
diff --git a/mysql-test/suite/perfschema/t/socket_summary_by_instance_func_win.test b/mysql-test/suite/perfschema/t/socket_summary_by_instance_func_win.test
index 5d4b4209b6e..cefaf1de549 100644
--- a/mysql-test/suite/perfschema/t/socket_summary_by_instance_func_win.test
+++ b/mysql-test/suite/perfschema/t/socket_summary_by_instance_func_win.test
@@ -38,7 +38,7 @@
# happens per SQL statement within our MTR tests. And there is a significant
# difference between standard statement execution and execution via
# prepared statement.
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
#===================================
diff --git a/mysql-test/suite/perfschema/t/start_server_low_digest.test b/mysql-test/suite/perfschema/t/start_server_low_digest.test
index 953f4d31656..6f06def169b 100644
--- a/mysql-test/suite/perfschema/t/start_server_low_digest.test
+++ b/mysql-test/suite/perfschema/t/start_server_low_digest.test
@@ -4,7 +4,7 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
USE performance_schema;
truncate table events_statements_history_long;
diff --git a/mysql-test/suite/perfschema/t/statement_digest_long_query.test b/mysql-test/suite/perfschema/t/statement_digest_long_query.test
index be80917c9af..7a080f7a29f 100644
--- a/mysql-test/suite/perfschema/t/statement_digest_long_query.test
+++ b/mysql-test/suite/perfschema/t/statement_digest_long_query.test
@@ -4,7 +4,7 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
USE performance_schema;
truncate table events_statements_summary_by_digest;
diff --git a/mysql-test/suite/perfschema/t/unary_digest.test b/mysql-test/suite/perfschema/t/unary_digest.test
index c4583484f36..d8daea70d38 100644
--- a/mysql-test/suite/perfschema/t/unary_digest.test
+++ b/mysql-test/suite/perfschema/t/unary_digest.test
@@ -7,7 +7,7 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;
diff --git a/mysql-test/suite/plugins/r/audit_null.result b/mysql-test/suite/plugins/r/audit_null.result
index 584d10e3a3b..75eb5a9f682 100644
--- a/mysql-test/suite/plugins/r/audit_null.result
+++ b/mysql-test/suite/plugins/r/audit_null.result
@@ -1,5 +1,6 @@
set @old_global_general_log=@@global.general_log;
set global general_log=OFF;
+create user testuser@localhost;
grant select on *.* to testuser@localhost;
install plugin audit_null soname 'adt_null';
select 1;
diff --git a/mysql-test/suite/plugins/r/auth_v0100.result b/mysql-test/suite/plugins/r/auth_v0100.result
index 53affc94947..6b5f5c917f3 100644
--- a/mysql-test/suite/plugins/r/auth_v0100.result
+++ b/mysql-test/suite/plugins/r/auth_v0100.result
@@ -5,6 +5,7 @@ auth_0x0100 1.0
mysql_native_password 2.0
mysql_old_password 2.0
create user tt identified via auth_0x0100;
+create user zzzzzzzzzzzzzzzz;
grant select on test.* to zzzzzzzzzzzzzzzz;
connect(localhost,tt,,test,MASTER_MYPORT,MASTER_MYSOCK);
ERROR 28000: Access denied for user 'tt'@'localhost' (using password: YES)
diff --git a/mysql-test/suite/plugins/r/qc_info.result b/mysql-test/suite/plugins/r/qc_info.result
index 850e6db53f4..0924b5bd12d 100644
--- a/mysql-test/suite/plugins/r/qc_info.result
+++ b/mysql-test/suite/plugins/r/qc_info.result
@@ -1,3 +1,5 @@
+set global query_cache_type=ON;
+set local query_cache_type=ON;
set global query_cache_size=1355776;
create table t1 (a int not null);
insert into t1 values (1),(2),(3);
@@ -16,6 +18,7 @@ set global query_cache_size = 0;
select * from information_schema.query_cache_info;
STATEMENT_SCHEMA STATEMENT_TEXT RESULT_BLOCKS_COUNT RESULT_BLOCKS_SIZE RESULT_BLOCKS_SIZE_USED
set global query_cache_size= default;
+set global query_cache_type=default;
show query_cache_info;
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 'query_cache_info' at line 1
flush query_cache_info;
diff --git a/mysql-test/suite/plugins/r/qc_info_priv.result b/mysql-test/suite/plugins/r/qc_info_priv.result
index c723eca1ec0..f7b538f46e4 100644
--- a/mysql-test/suite/plugins/r/qc_info_priv.result
+++ b/mysql-test/suite/plugins/r/qc_info_priv.result
@@ -1,3 +1,5 @@
+set global query_cache_type=ON;
+set local query_cache_type=ON;
set global query_cache_size=1355776;
create table t1 (a int not null);
insert into t1 values (1),(2),(3);
@@ -21,3 +23,4 @@ count(*)
drop user mysqltest;
drop table t1;
set global query_cache_size= default;
+set global query_cache_type=default;
diff --git a/mysql-test/suite/plugins/r/server_audit.result b/mysql-test/suite/plugins/r/server_audit.result
index 09dcc06c848..bf71e518f97 100644
--- a/mysql-test/suite/plugins/r/server_audit.result
+++ b/mysql-test/suite/plugins/r/server_audit.result
@@ -45,6 +45,11 @@ id
2
alter table t1 rename renamed_t1;
set global server_audit_events='connect,query';
+select 1,
+2,
+3;
+1 2 3
+1 2 3
insert into t2 values (1), (2);
select * from t2;
id
@@ -157,6 +162,8 @@ id
CREATE USER u1 IDENTIFIED BY 'pwd-123';
GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321";
SET PASSWORD FOR u1 = PASSWORD('pwd 098');
+SET PASSWORD FOR u1=<secret>;
+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 '=<secret>' at line 1
CREATE USER u3 IDENTIFIED BY '';
drop user u1, u2, u3;
select 2;
@@ -246,6 +253,7 @@ TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,index_stats,
TIME,HOSTNAME,root,localhost,ID,ID,RENAME,test,t1|test.renamed_t1,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'alter table t1 rename renamed_t1',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_events=\'connect,query\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select 1, 2, 3',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t2 values (1), (2)',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t2',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t_doesnt_exist',ID
@@ -329,6 +337,7 @@ TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'/*comment*/ select 2',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u1 IDENTIFIED BY *****',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'GRANT ALL ON sa_db TO u2 IDENTIFIED BY *****',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1 = PASSWORD(*****)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1=<secret>',ID
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_events=\'\'',0
diff --git a/mysql-test/suite/plugins/r/thread_pool_server_audit.result b/mysql-test/suite/plugins/r/thread_pool_server_audit.result
new file mode 100644
index 00000000000..bf71e518f97
--- /dev/null
+++ b/mysql-test/suite/plugins/r/thread_pool_server_audit.result
@@ -0,0 +1,367 @@
+install plugin server_audit soname 'server_audit';
+show variables like 'server_audit%';
+Variable_name Value
+server_audit_events
+server_audit_excl_users
+server_audit_file_path server_audit.log
+server_audit_file_rotate_now OFF
+server_audit_file_rotate_size 1000000
+server_audit_file_rotations 9
+server_audit_incl_users
+server_audit_logging OFF
+server_audit_mode 0
+server_audit_output_type file
+server_audit_query_log_limit 1024
+server_audit_syslog_facility LOG_USER
+server_audit_syslog_ident mysql-server_auditing
+server_audit_syslog_info
+server_audit_syslog_priority LOG_INFO
+set global server_audit_file_path=null;
+set global server_audit_incl_users=null;
+set global server_audit_file_path='server_audit.log';
+set global server_audit_output_type=file;
+set global server_audit_logging=on;
+connect(localhost,no_such_user,,mysql,MASTER_PORT,MASTER_SOCKET);
+ERROR 28000: Access denied for user 'no_such_user'@'localhost' (using password: NO)
+set global server_audit_incl_users='odin, dva, tri';
+create table t1 (id int);
+set global server_audit_incl_users='odin, root, dva, tri';
+create table t2 (id int);
+set global server_audit_excl_users='odin, dva, tri';
+Warnings:
+Warning 1 User 'odin' is in the server_audit_incl_users, so wasn't added.
+Warning 1 User 'dva' is in the server_audit_incl_users, so wasn't added.
+Warning 1 User 'tri' is in the server_audit_incl_users, so wasn't added.
+insert into t1 values (1), (2);
+select * from t1;
+id
+1
+2
+set global server_audit_incl_users='odin, root, dva, tri';
+insert into t2 values (1), (2);
+select * from t2;
+id
+1
+2
+alter table t1 rename renamed_t1;
+set global server_audit_events='connect,query';
+select 1,
+2,
+3;
+1 2 3
+1 2 3
+insert into t2 values (1), (2);
+select * from t2;
+id
+1
+2
+1
+2
+select * from t_doesnt_exist;
+ERROR 42S02: Table 'test.t_doesnt_exist' doesn't exist
+syntax_error_query;
+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 'syntax_error_query' at line 1
+drop table renamed_t1, t2;
+show variables like 'server_audit%';
+Variable_name Value
+server_audit_events CONNECT,QUERY
+server_audit_excl_users
+server_audit_file_path server_audit.log
+server_audit_file_rotate_now OFF
+server_audit_file_rotate_size 1000000
+server_audit_file_rotations 9
+server_audit_incl_users odin, root, dva, tri
+server_audit_logging ON
+server_audit_mode 0
+server_audit_output_type file
+server_audit_query_log_limit 1024
+server_audit_syslog_facility LOG_USER
+server_audit_syslog_ident mysql-server_auditing
+server_audit_syslog_info
+server_audit_syslog_priority LOG_INFO
+set global server_audit_mode=1;
+set global server_audit_events='';
+create database sa_db;
+create table t1 (id2 int);
+insert into t1 values (1), (2);
+select * from t1;
+id2
+1
+2
+drop table t1;
+use sa_db;
+create table sa_t1(id int);
+insert into sa_t1 values (1), (2);
+drop table sa_t1;
+drop database sa_db;
+create database sa_db;
+use sa_db;
+CREATE USER u1 IDENTIFIED BY 'pwd-123';
+GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321";
+SET PASSWORD FOR u1 = PASSWORD('pwd 098');
+CREATE USER u3 IDENTIFIED BY '';
+drop user u1, u2, u3;
+set global server_audit_events='query_ddl';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+id
+1
+2
+select 2;
+2
+2
+(select 2);
+2
+2
+/*! select 2*/;
+2
+2
+/*comment*/ select 2;
+2
+2
+drop table t1;
+set global server_audit_events='query_ddl,query_dml';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+id
+1
+2
+select 2;
+2
+2
+drop table t1;
+set global server_audit_events='query_dml';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+id
+1
+2
+select 2;
+2
+2
+(select 2);
+2
+2
+/*! select 2*/;
+2
+2
+/*comment*/ select 2;
+2
+2
+drop table t1;
+set global server_audit_events='query_dcl';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+id
+1
+2
+CREATE USER u1 IDENTIFIED BY 'pwd-123';
+GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321";
+SET PASSWORD FOR u1 = PASSWORD('pwd 098');
+SET PASSWORD FOR u1=<secret>;
+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 '=<secret>' at line 1
+CREATE USER u3 IDENTIFIED BY '';
+drop user u1, u2, u3;
+select 2;
+2
+2
+(select 2);
+2
+2
+/*! select 2*/;
+2
+2
+/*comment*/ select 2;
+2
+2
+drop table t1;
+set global server_audit_events='';
+set global server_audit_query_log_limit= 15;
+select (1), (2), (3), (4);
+1 2 3 4
+1 2 3 4
+select 'A', 'B', 'C', 'D';
+A B C D
+A B C D
+set global server_audit_query_log_limit= 1024;
+drop database sa_db;
+set global server_audit_file_path='.';
+show status like 'server_audit_current_log';
+Variable_name Value
+Server_audit_current_log HOME_DIR/server_audit.log
+set global server_audit_file_path='';
+show status like 'server_audit_current_log';
+Variable_name Value
+Server_audit_current_log server_audit.log
+set global server_audit_file_path=' ';
+show status like 'server_audit_current_log';
+Variable_name Value
+Server_audit_current_log server_audit.log
+set global server_audit_file_path='nonexisting_dir/';
+Warnings:
+Warning 1 SERVER AUDIT plugin can't create file 'nonexisting_dir/'.
+show status like 'server_audit_current_log';
+Variable_name Value
+Server_audit_current_log server_audit.log
+show variables like 'server_audit%';
+Variable_name Value
+server_audit_events
+server_audit_excl_users
+server_audit_file_path
+server_audit_file_rotate_now OFF
+server_audit_file_rotate_size 1000000
+server_audit_file_rotations 9
+server_audit_incl_users odin, root, dva, tri
+server_audit_logging ON
+server_audit_mode 1
+server_audit_output_type file
+server_audit_query_log_limit 1024
+server_audit_syslog_facility LOG_USER
+server_audit_syslog_ident mysql-server_auditing
+server_audit_syslog_info
+server_audit_syslog_priority LOG_INFO
+uninstall plugin server_audit;
+Warnings:
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_logging=on',0
+TIME,HOSTNAME,root,localhost,ID,0,CONNECT,mysql,,0
+TIME,HOSTNAME,root,localhost,ID,0,DISCONNECT,mysql,,0
+TIME,HOSTNAME,no_such_user,localhost,ID,0,FAILED_CONNECT,,,ID
+TIME,HOSTNAME,no_such_user,localhost,ID,0,DISCONNECT,,,0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_incl_users=\'odin, root, dva, tri\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,CREATE,test,t2,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create table t2 (id int)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_excl_users=\'odin, dva, tri\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'SHOW WARNINGS',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,test,t1,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t1 values (1), (2)',0
+TIME,HOSTNAME,root,localhost,ID,ID,READ,test,t1,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t1',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_incl_users=\'odin, root, dva, tri\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,test,t2,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t2 values (1), (2)',0
+TIME,HOSTNAME,root,localhost,ID,ID,READ,test,t2,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t2',0
+TIME,HOSTNAME,root,localhost,ID,ID,ALTER,test,t1,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,table_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,column_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,index_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,RENAME,test,t1|test.renamed_t1,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'alter table t1 rename renamed_t1',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_events=\'connect,query\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select 1, 2, 3',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t2 values (1), (2)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t2',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t_doesnt_exist',ID
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'syntax_error_query',ID
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'drop table renamed_t1, t2',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show variables like \'server_audit%\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_mode=1',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_events=\'\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create database sa_db',0
+TIME,HOSTNAME,root,localhost,ID,0,CONNECT,test,,0
+TIME,HOSTNAME,root,localhost,ID,ID,CREATE,test,t1,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create table t1 (id2 int)',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,test,t1,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t1 values (1), (2)',0
+TIME,HOSTNAME,root,localhost,ID,ID,READ,test,t1,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t1',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,table_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,column_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,index_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,DROP,test,t1,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'drop table t1',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'use sa_db',0
+TIME,HOSTNAME,root,localhost,ID,ID,CREATE,sa_db,sa_t1,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table sa_t1(id int)',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,sa_db,sa_t1,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into sa_t1 values (1), (2)',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,table_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,column_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,index_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,DROP,sa_db,sa_t1,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop table sa_t1',0
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,proc,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proc,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,event,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop database sa_db',0
+TIME,HOSTNAME,root,localhost,ID,0,DISCONNECT,sa_db,,0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create database sa_db',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'use sa_db',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u1 IDENTIFIED BY *****',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'GRANT ALL ON sa_db TO u2 IDENTIFIED BY *****',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1 = PASSWORD(*****)',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table t1(id int)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop table t1',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table t1(id int)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into t1 values (1), (2)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select * from t1',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select 2',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop table t1',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into t1 values (1), (2)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select * from t1',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select 2',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'(select 2)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'/*! select 2*/',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'/*comment*/ select 2',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u1 IDENTIFIED BY *****',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'GRANT ALL ON sa_db TO u2 IDENTIFIED BY *****',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1 = PASSWORD(*****)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1=<secret>',ID
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_events=\'\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global serv',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select (1), (2)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select \'A\', ',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_query_log_limit= 1024',0
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,proc,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proc,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,event,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop database sa_db',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'.\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'.\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_current_log\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_current_log\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\' \'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\' \'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_current_log\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'nonexisting_dir/\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'nonexisting_dir/\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SHOW WARNINGS',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_current_log\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show variables like \'server_audit%\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,plugin,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'uninstall plugin server_audit',0
diff --git a/mysql-test/suite/plugins/t/audit_null.test b/mysql-test/suite/plugins/t/audit_null.test
index 3e32154ec3d..199e4ba154e 100644
--- a/mysql-test/suite/plugins/t/audit_null.test
+++ b/mysql-test/suite/plugins/t/audit_null.test
@@ -8,6 +8,7 @@ if (!$ADT_NULL_SO) {
set @old_global_general_log=@@global.general_log;
set global general_log=OFF;
+create user testuser@localhost;
grant select on *.* to testuser@localhost;
--disable_ps_protocol
diff --git a/mysql-test/suite/plugins/t/auth_v0100.test b/mysql-test/suite/plugins/t/auth_v0100.test
index 3cf93ba67f2..51f8d8941ef 100644
--- a/mysql-test/suite/plugins/t/auth_v0100.test
+++ b/mysql-test/suite/plugins/t/auth_v0100.test
@@ -9,6 +9,7 @@ install soname 'auth_0x0100';
select plugin_name, plugin_type_version from information_schema.plugins where plugin_type='authentication' order by plugin_name;
create user tt identified via auth_0x0100;
+create user zzzzzzzzzzzzzzzz;
grant select on test.* to zzzzzzzzzzzzzzzz;
--replace_result $MASTER_MYSOCK MASTER_MYSOCK $MASTER_MYPORT MASTER_MYPORT
diff --git a/mysql-test/suite/plugins/t/qc_info.test b/mysql-test/suite/plugins/t/qc_info.test
index fcb523eca2c..ef759ce8eb4 100644
--- a/mysql-test/suite/plugins/t/qc_info.test
+++ b/mysql-test/suite/plugins/t/qc_info.test
@@ -8,6 +8,7 @@ set global query_cache_size = 0;
select * from information_schema.query_cache_info;
set global query_cache_size= default;
+set global query_cache_type=default;
--error ER_PARSE_ERROR
show query_cache_info;
diff --git a/mysql-test/suite/plugins/t/qc_info_init.inc b/mysql-test/suite/plugins/t/qc_info_init.inc
index 9422bd7f141..1de99cc9029 100644
--- a/mysql-test/suite/plugins/t/qc_info_init.inc
+++ b/mysql-test/suite/plugins/t/qc_info_init.inc
@@ -3,6 +3,8 @@ if (`select count(*) = 0 from information_schema.plugins where plugin_name = 'qu
--skip QUERY_CACHE_INFO plugin is not active
}
+set global query_cache_type=ON;
+set local query_cache_type=ON;
set global query_cache_size=1355776;
create table t1 (a int not null);
diff --git a/mysql-test/suite/plugins/t/qc_info_priv.test b/mysql-test/suite/plugins/t/qc_info_priv.test
index 31c394107c1..adcf882be9f 100644
--- a/mysql-test/suite/plugins/t/qc_info_priv.test
+++ b/mysql-test/suite/plugins/t/qc_info_priv.test
@@ -12,4 +12,4 @@ drop user mysqltest;
drop table t1;
set global query_cache_size= default;
-
+set global query_cache_type=default;
diff --git a/mysql-test/suite/plugins/t/server_audit.test b/mysql-test/suite/plugins/t/server_audit.test
index 787861d3327..52428909c3b 100644
--- a/mysql-test/suite/plugins/t/server_audit.test
+++ b/mysql-test/suite/plugins/t/server_audit.test
@@ -13,6 +13,7 @@ set global server_audit_incl_users=null;
set global server_audit_file_path='server_audit.log';
set global server_audit_output_type=file;
set global server_audit_logging=on;
+--sleep 2
connect (con1,localhost,root,,mysql);
connection default;
disconnect con1;
@@ -35,6 +36,9 @@ insert into t2 values (1), (2);
select * from t2;
alter table t1 rename renamed_t1;
set global server_audit_events='connect,query';
+select 1,
+ 2,
+ 3;
insert into t2 values (1), (2);
select * from t2;
--error ER_NO_SUCH_TABLE
@@ -103,6 +107,8 @@ select * from t1;
CREATE USER u1 IDENTIFIED BY 'pwd-123';
GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321";
SET PASSWORD FOR u1 = PASSWORD('pwd 098');
+--error 1064
+SET PASSWORD FOR u1=<secret>;
CREATE USER u3 IDENTIFIED BY '';
drop user u1, u2, u3;
select 2;
diff --git a/mysql-test/suite/plugins/t/thread_pool_server_audit.opt b/mysql-test/suite/plugins/t/thread_pool_server_audit.opt
new file mode 100644
index 00000000000..30953d0c574
--- /dev/null
+++ b/mysql-test/suite/plugins/t/thread_pool_server_audit.opt
@@ -0,0 +1,2 @@
+--thread_handling=pool-of-threads
+
diff --git a/mysql-test/suite/plugins/t/thread_pool_server_audit.test b/mysql-test/suite/plugins/t/thread_pool_server_audit.test
new file mode 100644
index 00000000000..626d4136c47
--- /dev/null
+++ b/mysql-test/suite/plugins/t/thread_pool_server_audit.test
@@ -0,0 +1,144 @@
+--source include/not_embedded.inc
+--source include/have_pool_of_threads.inc
+
+if (!$SERVER_AUDIT_SO) {
+ skip No SERVER_AUDIT plugin;
+}
+
+install plugin server_audit soname 'server_audit';
+
+show variables like 'server_audit%';
+set global server_audit_file_path=null;
+set global server_audit_incl_users=null;
+set global server_audit_file_path='server_audit.log';
+set global server_audit_output_type=file;
+set global server_audit_logging=on;
+--sleep 2
+connect (con1,localhost,root,,mysql);
+connection default;
+disconnect con1;
+--sleep 2
+--sleep 2
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error ER_ACCESS_DENIED_ERROR
+connect (con1,localhost,no_such_user,,mysql);
+connection default;
+--sleep 2
+set global server_audit_incl_users='odin, dva, tri';
+create table t1 (id int);
+set global server_audit_incl_users='odin, root, dva, tri';
+create table t2 (id int);
+set global server_audit_excl_users='odin, dva, tri';
+insert into t1 values (1), (2);
+select * from t1;
+set global server_audit_incl_users='odin, root, dva, tri';
+insert into t2 values (1), (2);
+select * from t2;
+alter table t1 rename renamed_t1;
+set global server_audit_events='connect,query';
+select 1,
+ 2,
+ 3;
+insert into t2 values (1), (2);
+select * from t2;
+--error ER_NO_SUCH_TABLE
+select * from t_doesnt_exist;
+--error 1064
+syntax_error_query;
+drop table renamed_t1, t2;
+show variables like 'server_audit%';
+set global server_audit_mode=1;
+set global server_audit_events='';
+create database sa_db;
+--sleep 2
+connect (con1,localhost,root,,test);
+connection con1;
+--sleep 2
+--sleep 2
+create table t1 (id2 int);
+insert into t1 values (1), (2);
+select * from t1;
+drop table t1;
+use sa_db;
+create table sa_t1(id int);
+insert into sa_t1 values (1), (2);
+drop table sa_t1;
+drop database sa_db;
+connection default;
+disconnect con1;
+--sleep 2
+--sleep 2
+create database sa_db;
+use sa_db;
+CREATE USER u1 IDENTIFIED BY 'pwd-123';
+GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321";
+SET PASSWORD FOR u1 = PASSWORD('pwd 098');
+CREATE USER u3 IDENTIFIED BY '';
+drop user u1, u2, u3;
+
+set global server_audit_events='query_ddl';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+select 2;
+(select 2);
+/*! select 2*/;
+/*comment*/ select 2;
+drop table t1;
+set global server_audit_events='query_ddl,query_dml';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+select 2;
+drop table t1;
+set global server_audit_events='query_dml';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+select 2;
+(select 2);
+/*! select 2*/;
+/*comment*/ select 2;
+drop table t1;
+set global server_audit_events='query_dcl';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+CREATE USER u1 IDENTIFIED BY 'pwd-123';
+GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321";
+SET PASSWORD FOR u1 = PASSWORD('pwd 098');
+--error 1064
+SET PASSWORD FOR u1=<secret>;
+CREATE USER u3 IDENTIFIED BY '';
+drop user u1, u2, u3;
+select 2;
+(select 2);
+/*! select 2*/;
+/*comment*/ select 2;
+drop table t1;
+set global server_audit_events='';
+
+set global server_audit_query_log_limit= 15;
+select (1), (2), (3), (4);
+select 'A', 'B', 'C', 'D';
+set global server_audit_query_log_limit= 1024;
+drop database sa_db;
+
+set global server_audit_file_path='.';
+--replace_regex /\.[\\\/]/HOME_DIR\//
+show status like 'server_audit_current_log';
+set global server_audit_file_path='';
+show status like 'server_audit_current_log';
+set global server_audit_file_path=' ';
+show status like 'server_audit_current_log';
+set global server_audit_file_path='nonexisting_dir/';
+show status like 'server_audit_current_log';
+show variables like 'server_audit%';
+uninstall plugin server_audit;
+
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+# replace the timestamp and the hostname with constant values
+--replace_regex /[0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9]\,[^,]*\,/TIME,HOSTNAME,/ /\,[1-9][0-9]*\,/,1,/ /\,[1-9][0-9]*/,ID/
+cat_file $MYSQLD_DATADIR/server_audit.log;
+remove_file $MYSQLD_DATADIR/server_audit.log;
+
diff --git a/mysql-test/suite/roles/admin.result b/mysql-test/suite/roles/admin.result
index 44bf010b8ea..838f2ea165d 100644
--- a/mysql-test/suite/roles/admin.result
+++ b/mysql-test/suite/roles/admin.result
@@ -1,3 +1,4 @@
+create user foo@localhost;
grant create user on *.* to foo@localhost;
create role role1;
create role role2 with admin current_user;
diff --git a/mysql-test/suite/roles/admin.test b/mysql-test/suite/roles/admin.test
index 03f3449200b..242518eb13d 100644
--- a/mysql-test/suite/roles/admin.test
+++ b/mysql-test/suite/roles/admin.test
@@ -1,5 +1,6 @@
source include/not_embedded.inc;
+create user foo@localhost;
grant create user on *.* to foo@localhost;
########################################
@@ -99,4 +100,3 @@ grant role4 to current_user;
########################################
drop role role1, role2, role3, role4, role5, role6;
drop user foo@localhost;
-
diff --git a/mysql-test/suite/roles/create_and_drop_current.result b/mysql-test/suite/roles/create_and_drop_current.result
index 382e5d10248..7e847677364 100644
--- a/mysql-test/suite/roles/create_and_drop_current.result
+++ b/mysql-test/suite/roles/create_and_drop_current.result
@@ -1,3 +1,4 @@
+create user foo@localhost;
grant create user on *.* to foo@localhost;
create user current_user;
ERROR HY000: Operation CREATE USER failed for CURRENT_USER
diff --git a/mysql-test/suite/roles/create_and_drop_current.test b/mysql-test/suite/roles/create_and_drop_current.test
index 5250ef78f43..7ca8161a30c 100644
--- a/mysql-test/suite/roles/create_and_drop_current.test
+++ b/mysql-test/suite/roles/create_and_drop_current.test
@@ -12,6 +12,7 @@
--source include/not_embedded.inc
+create user foo@localhost;
grant create user on *.* to foo@localhost;
--change_user foo
diff --git a/mysql-test/suite/roles/definer.result b/mysql-test/suite/roles/definer.result
index a2d84244c38..7ced6255629 100644
--- a/mysql-test/suite/roles/definer.result
+++ b/mysql-test/suite/roles/definer.result
@@ -9,6 +9,7 @@ grant role1 to current_user;
create role role2;
grant insert,select on mysqltest1.t1 to role2;
grant event,execute,trigger on mysqltest1.* to role2;
+create user foo@localhost;
grant create view on mysqltest1.* to foo@localhost;
create role role4;
grant select on mysqltest1.t1 to role4;
@@ -78,6 +79,7 @@ Warnings:
Note 1449 The user specified as a definer ('role4'@'') does not exist
select * from test.v5;
ERROR HY000: The user specified as a definer ('role4'@'') does not exist
+create user role4;
grant select on mysqltest1.t1 to role4;
show create view test.v5;
View Create View character_set_client collation_connection
@@ -104,7 +106,7 @@ create definer=current_role trigger tr1 before insert on t2 for each row
insert t1 values (111, 222, 333);
show create trigger tr1;
Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-tr1 CREATE DEFINER=`role1` trigger tr1 before insert on t2 for each row
+tr1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`role1` trigger tr1 before insert on t2 for each row
insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci
set role none;
insert t2 values (11,22,33);
@@ -121,7 +123,7 @@ create definer=role2 trigger tr2 before delete on t2 for each row
insert t1 values (111, 222, 333);
show create trigger tr2;
Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-tr2 CREATE DEFINER=`role2` trigger tr2 before delete on t2 for each row
+tr2 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`role2` trigger tr2 before delete on t2 for each row
insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci
delete from t2 where a=1;
select * from t1;
@@ -139,7 +141,7 @@ Warnings:
Note 1449 The user specified as a definer ('role3'@'%') does not exist
show create trigger tr3;
Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-tr3 CREATE DEFINER=`role3`@`%` trigger tr3 before update on t2 for each row
+tr3 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`role3`@`%` trigger tr3 before update on t2 for each row
insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci
update t2 set b=2 where a=2;
ERROR HY000: The user specified as a definer ('role3'@'%') does not exist
@@ -153,7 +155,7 @@ a b c
flush tables;
show create trigger tr2;
Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-tr2 CREATE DEFINER=`role2`@`` trigger tr2 before delete on t2 for each row
+tr2 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`role2`@`` trigger tr2 before delete on t2 for each row
insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci
delete from t2 where a=2;
ERROR HY000: The user specified as a definer ('role2'@'%') does not exist
@@ -170,7 +172,7 @@ set role role1;
create definer=current_role procedure pr1() insert t1 values (111, 222, 333);
show create procedure pr1;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-pr1 CREATE DEFINER=`role1` PROCEDURE `pr1`()
+pr1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`role1` PROCEDURE `pr1`()
insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci
set role none;
call pr1();
@@ -182,7 +184,7 @@ a b c
create definer=role2 procedure pr2() insert t1 values (111, 222, 333);
show create procedure pr2;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-pr2 CREATE DEFINER=`role2` PROCEDURE `pr2`()
+pr2 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`role2` PROCEDURE `pr2`()
insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci
call pr2();
select * from t1;
@@ -196,7 +198,7 @@ Warnings:
Note 1449 The user specified as a definer ('role3'@'%') does not exist
show create procedure pr3;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-pr3 CREATE DEFINER=`role3`@`%` PROCEDURE `pr3`()
+pr3 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`role3`@`%` PROCEDURE `pr3`()
insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci
call pr3();
ERROR HY000: The user specified as a definer ('role3'@'%') does not exist
@@ -213,7 +215,7 @@ set role role1;
create definer=current_role function fn1() returns int return (select sum(a+b) from t1);
show create function fn1;
Function sql_mode Create Function character_set_client collation_connection Database Collation
-fn1 CREATE DEFINER=`role1` FUNCTION `fn1`() RETURNS int(11)
+fn1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`role1` FUNCTION `fn1`() RETURNS int(11)
return (select sum(a+b) from t1) latin1 latin1_swedish_ci latin1_swedish_ci
set role none;
select fn1();
@@ -225,7 +227,7 @@ a b c
create definer=role2 function fn2() returns int return (select sum(a+b) from t1);
show create function fn2;
Function sql_mode Create Function character_set_client collation_connection Database Collation
-fn2 CREATE DEFINER=`role2` FUNCTION `fn2`() RETURNS int(11)
+fn2 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`role2` FUNCTION `fn2`() RETURNS int(11)
return (select sum(a+b) from t1) latin1 latin1_swedish_ci latin1_swedish_ci
select fn2();
fn2()
@@ -235,7 +237,7 @@ Warnings:
Note 1449 The user specified as a definer ('role3'@'%') does not exist
show create function fn3;
Function sql_mode Create Function character_set_client collation_connection Database Collation
-fn3 CREATE DEFINER=`role3`@`%` FUNCTION `fn3`() RETURNS int(11)
+fn3 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`role3`@`%` FUNCTION `fn3`() RETURNS int(11)
return (select sum(a+b) from t1) latin1 latin1_swedish_ci latin1_swedish_ci
select fn3();
ERROR HY000: The user specified as a definer ('role3'@'%') does not exist
@@ -248,7 +250,7 @@ create definer=current_role event e1 on schedule every 1 second starts '2000-01-
insert t1 values (111, 2, 0);
show create event e1;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
-e1 SYSTEM CREATE DEFINER=`role1` EVENT `e1` ON SCHEDULE EVERY 1 SECOND STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO insert t1 values (111, 2, 0) latin1 latin1_swedish_ci latin1_swedish_ci
+e1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`role1` EVENT `e1` ON SCHEDULE EVERY 1 SECOND STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO insert t1 values (111, 2, 0) latin1 latin1_swedish_ci latin1_swedish_ci
set role none;
create definer=role3 event e3 on schedule every 1 second starts '2000-01-01' do
insert t1 values (111, 3, 0);
@@ -256,12 +258,12 @@ Warnings:
Note 1449 The user specified as a definer ('role3'@'%') does not exist
show create event e3;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
-e3 SYSTEM CREATE DEFINER=`role3`@`%` EVENT `e3` ON SCHEDULE EVERY 1 SECOND STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO insert t1 values (111, 3, 0) latin1 latin1_swedish_ci latin1_swedish_ci
+e3 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`role3`@`%` EVENT `e3` ON SCHEDULE EVERY 1 SECOND STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO insert t1 values (111, 3, 0) latin1 latin1_swedish_ci latin1_swedish_ci
create definer=role2 event e2 on schedule every 1 second starts '2000-01-01' do
insert t1 values (111, 4, 0);
show create event e2;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
-e2 SYSTEM CREATE DEFINER=`role2` EVENT `e2` ON SCHEDULE EVERY 1 SECOND STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO insert t1 values (111, 4, 0) latin1 latin1_swedish_ci latin1_swedish_ci
+e2 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`role2` EVENT `e2` ON SCHEDULE EVERY 1 SECOND STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO insert t1 values (111, 4, 0) latin1 latin1_swedish_ci latin1_swedish_ci
set global event_scheduler=off;
select distinct * from t1;
a b c
@@ -337,7 +339,7 @@ INSERT INTO `t2` VALUES (2,20,200);
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = '' */ ;
+/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`role1`*/ /*!50003 trigger tr1 before insert on t2 for each row
insert t1 values (111, 222, 333) */;;
@@ -353,7 +355,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 = '' */ ;
+/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`role3`@`%`*/ /*!50003 trigger tr3 before update on t2 for each row
insert t1 values (111, 222, 333) */;;
@@ -369,7 +371,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 = '' */ ;
+/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`role2`@``*/ /*!50003 trigger tr2 before delete on t2 for each row
insert t1 values (111, 222, 333) */;;
@@ -387,7 +389,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 = '' */ ;;
+/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
/*!50003 SET time_zone = 'SYSTEM' */ ;;
/*!50106 CREATE*/ /*!50117 DEFINER=`role1`*/ /*!50106 EVENT `e1` ON SCHEDULE EVERY 1 SECOND STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO insert t1 values (111, 2, 0) */ ;;
@@ -404,7 +406,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 = '' */ ;;
+/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
/*!50003 SET time_zone = 'SYSTEM' */ ;;
/*!50106 CREATE*/ /*!50117 DEFINER=`role2`*/ /*!50106 EVENT `e2` ON SCHEDULE EVERY 1 SECOND STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO insert t1 values (111, 4, 0) */ ;;
@@ -421,7 +423,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 = '' */ ;;
+/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
/*!50003 SET time_zone = 'SYSTEM' */ ;;
/*!50106 CREATE*/ /*!50117 DEFINER=`role3`@`%`*/ /*!50106 EVENT `e3` ON SCHEDULE EVERY 1 SECOND STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO insert t1 values (111, 3, 0) */ ;;
@@ -439,7 +441,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 = '' */ ;
+/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`role1` FUNCTION `fn1`() RETURNS int(11)
return (select sum(a+b) from t1) ;;
@@ -455,7 +457,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 = '' */ ;
+/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`role2` FUNCTION `fn2`() RETURNS int(11)
return (select sum(a+b) from t1) ;;
@@ -471,7 +473,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 = '' */ ;
+/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`role3`@`%` FUNCTION `fn3`() RETURNS int(11)
return (select sum(a+b) from t1) ;;
@@ -487,7 +489,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 = '' */ ;
+/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`role1` PROCEDURE `pr1`()
insert t1 values (111, 222, 333) ;;
@@ -503,7 +505,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 = '' */ ;
+/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`role2`@`%` PROCEDURE `pr2`()
insert t1 values (111, 222, 333) ;;
@@ -519,7 +521,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 = '' */ ;
+/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`role3`@`%` PROCEDURE `pr3`()
insert t1 values (111, 222, 333) ;;
diff --git a/mysql-test/suite/roles/definer.test b/mysql-test/suite/roles/definer.test
index 995c36a8511..3de4a6922c2 100644
--- a/mysql-test/suite/roles/definer.test
+++ b/mysql-test/suite/roles/definer.test
@@ -26,6 +26,7 @@ grant insert,select on mysqltest1.t1 to role2;
grant event,execute,trigger on mysqltest1.* to role2;
# create a non-priv user and a priv role granted to him
+create user foo@localhost;
grant create view on mysqltest1.* to foo@localhost;
create role role4;
grant select on mysqltest1.t1 to role4;
@@ -99,6 +100,7 @@ show create view test.v5;
--error ER_NO_SUCH_USER
select * from test.v5;
+create user role4;
grant select on mysqltest1.t1 to role4;
show create view test.v5;
--error ER_NO_SUCH_USER
diff --git a/mysql-test/suite/roles/drop_current_user-5176.result b/mysql-test/suite/roles/drop_current_user-5176.result
index 42fb4ba36b7..ea9f4fa4f92 100644
--- a/mysql-test/suite/roles/drop_current_user-5176.result
+++ b/mysql-test/suite/roles/drop_current_user-5176.result
@@ -1,3 +1,4 @@
+create user foo@localhost;
grant create user on *.* to foo@localhost;
drop user foo@localhost;
select * from information_schema.applicable_roles;
diff --git a/mysql-test/suite/roles/drop_current_user-5176.test b/mysql-test/suite/roles/drop_current_user-5176.test
index e022d3e8a86..27051345e8b 100644
--- a/mysql-test/suite/roles/drop_current_user-5176.test
+++ b/mysql-test/suite/roles/drop_current_user-5176.test
@@ -3,6 +3,7 @@
#
--source include/not_embedded.inc
+create user foo@localhost;
grant create user on *.* to foo@localhost;
--connect (foo,localhost,foo,,)
drop user foo@localhost;
diff --git a/mysql-test/suite/roles/grant-5771.result b/mysql-test/suite/roles/grant-5771.result
index 4921641f3a5..5d79820e7a0 100644
--- a/mysql-test/suite/roles/grant-5771.result
+++ b/mysql-test/suite/roles/grant-5771.result
@@ -1,5 +1,6 @@
create database mysqltest1;
create database mysqltest2;
+create user foo@localhost;
create role r1, r2;
grant all on mysqltest1.* to r1;
grant all on mysqltest2.* to r2;
diff --git a/mysql-test/suite/roles/grant-5771.test b/mysql-test/suite/roles/grant-5771.test
index 84c625a6067..3c8f5d2f7c0 100644
--- a/mysql-test/suite/roles/grant-5771.test
+++ b/mysql-test/suite/roles/grant-5771.test
@@ -6,6 +6,7 @@
create database mysqltest1;
create database mysqltest2;
+create user foo@localhost;
create role r1, r2;
grant all on mysqltest1.* to r1;
grant all on mysqltest2.* to r2;
diff --git a/mysql-test/suite/roles/grant_role_auto_create_user.result b/mysql-test/suite/roles/grant_role_auto_create_user.result
index 81b25e5f527..dee07aa6b3c 100644
--- a/mysql-test/suite/roles/grant_role_auto_create_user.result
+++ b/mysql-test/suite/roles/grant_role_auto_create_user.result
@@ -1,8 +1,11 @@
create database db;
create role auto_create;
+create user auto_create;
grant all on db.* to auto_create;
+create user foo@localhost;
grant auto_create to foo@localhost;
-grant auto_create to bar@localhost identified by 'baz';
+create user bar@localhost identified by 'baz';
+grant auto_create to bar@localhost;
set role 'auto_create';
use db;
create table t1 (i int);
@@ -60,4 +63,5 @@ ERROR 42000: You are not allowed to create a user with GRANT
drop user foo@localhost;
drop user bar@localhost;
drop role auto_create;
+drop user auto_create;
drop database db;
diff --git a/mysql-test/suite/roles/grant_role_auto_create_user.test b/mysql-test/suite/roles/grant_role_auto_create_user.test
index d2489a4ea74..e673934775e 100644
--- a/mysql-test/suite/roles/grant_role_auto_create_user.test
+++ b/mysql-test/suite/roles/grant_role_auto_create_user.test
@@ -5,10 +5,12 @@
create database db;
create role auto_create;
+create user auto_create;
grant all on db.* to auto_create;
-
+create user foo@localhost;
grant auto_create to foo@localhost;
-grant auto_create to bar@localhost identified by 'baz';
+create user bar@localhost identified by 'baz';
+grant auto_create to bar@localhost;
# Test if the users have been created and the role has been granted to them
--connect (con1,localhost,foo,,)
@@ -117,5 +119,5 @@ grant auto_create to foo2@localhost identified by 'pass';
drop user foo@localhost;
drop user bar@localhost;
drop role auto_create;
+drop user auto_create;
drop database db;
-
diff --git a/mysql-test/suite/roles/password.result b/mysql-test/suite/roles/password.result
index 1992431e1a3..2d54db2ca64 100644
--- a/mysql-test/suite/roles/password.result
+++ b/mysql-test/suite/roles/password.result
@@ -1,3 +1,4 @@
+set sql_mode='';
create role r1;
grant select on *.* to r1 identified by 'foobar';
drop user r1;
diff --git a/mysql-test/suite/roles/password.test b/mysql-test/suite/roles/password.test
index fed0f2f4a19..e5fff01ddbc 100644
--- a/mysql-test/suite/roles/password.test
+++ b/mysql-test/suite/roles/password.test
@@ -10,6 +10,7 @@
# max_queries_per_hour | max_updates_per_hour | max_connections_per_hour | max_user_connections
#set password for ... = ...
+set sql_mode='';
create role r1;
# IDENTIFIED does not apply to roles, using it forces username context
diff --git a/mysql-test/suite/roles/rpl_definer.result b/mysql-test/suite/roles/rpl_definer.result
index eadb6315d9b..c9e4f66a267 100644
--- a/mysql-test/suite/roles/rpl_definer.result
+++ b/mysql-test/suite/roles/rpl_definer.result
@@ -21,19 +21,19 @@ create definer=current_role procedure pcr() select current_role;
create definer=role1 procedure pr() select "role1";
show create procedure pcu;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-pcu CREATE DEFINER=`root`@`localhost` PROCEDURE `pcu`()
+pcu NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `pcu`()
select current_user latin1 latin1_swedish_ci latin1_swedish_ci
show create procedure pu;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-pu CREATE DEFINER=`root`@`localhost` PROCEDURE `pu`()
+pu NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `pu`()
select "root@localhost" latin1 latin1_swedish_ci latin1_swedish_ci
show create procedure pcr;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-pcr CREATE DEFINER=`role1` PROCEDURE `pcr`()
+pcr NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`role1` PROCEDURE `pcr`()
select current_role latin1 latin1_swedish_ci latin1_swedish_ci
show create procedure pr;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-pr CREATE DEFINER=`role1` PROCEDURE `pr`()
+pr NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`role1` PROCEDURE `pr`()
select "role1" latin1 latin1_swedish_ci latin1_swedish_ci
[connection slave]
set role role1;
@@ -49,19 +49,19 @@ GRANT role2 TO 'role1'
GRANT role2 TO 'root'@'localhost' WITH ADMIN OPTION
show create procedure pcu;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-pcu CREATE DEFINER=`root`@`localhost` PROCEDURE `pcu`()
+pcu NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `pcu`()
select current_user latin1 latin1_swedish_ci latin1_swedish_ci
show create procedure pu;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-pu CREATE DEFINER=`root`@`localhost` PROCEDURE `pu`()
+pu NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `pu`()
select "root@localhost" latin1 latin1_swedish_ci latin1_swedish_ci
show create procedure pcr;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-pcr CREATE DEFINER=`role1` PROCEDURE `pcr`()
+pcr NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`role1` PROCEDURE `pcr`()
select current_role latin1 latin1_swedish_ci latin1_swedish_ci
show create procedure pr;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-pr CREATE DEFINER=`role1` PROCEDURE `pr`()
+pr NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`role1` PROCEDURE `pr`()
select "role1" latin1 latin1_swedish_ci latin1_swedish_ci
drop procedure pcu;
drop procedure pu;
diff --git a/mysql-test/suite/rpl/r/create_or_replace_row.result b/mysql-test/suite/rpl/r/create_or_replace_row.result
index 6e29d02e3bc..311a5dfb809 100644
--- a/mysql-test/suite/rpl/r/create_or_replace_row.result
+++ b/mysql-test/suite/rpl/r/create_or_replace_row.result
@@ -22,14 +22,14 @@ master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE `t1` (
- `f1` int(1) NOT NULL DEFAULT '0'
+ `f1` int(1) NOT NULL
)
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
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` (
- `f1` int(1) NOT NULL DEFAULT '0'
+ `f1` int(1) NOT NULL
)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
@@ -55,14 +55,14 @@ slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t1 (to_be_deleted int)
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE TABLE `t1` (
- `f1` int(1) NOT NULL DEFAULT '0'
+ `f1` int(1) NOT NULL
)
slave-bin.000001 # Table_map # # table_id: # (test.t1)
slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
slave-bin.000001 # Query # # COMMIT
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` (
- `f1` int(1) NOT NULL DEFAULT '0'
+ `f1` int(1) NOT NULL
)
slave-bin.000001 # Table_map # # table_id: # (test.t1)
slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
diff --git a/mysql-test/suite/rpl/r/create_select.result b/mysql-test/suite/rpl/r/create_select.result
new file mode 100644
index 00000000000..ac222824e34
--- /dev/null
+++ b/mysql-test/suite/rpl/r/create_select.result
@@ -0,0 +1,30 @@
+include/rpl_init.inc [topology=1->2->3]
+# On server_1
+CREATE DATABASE test_8428;
+USE test_8428;
+CREATE TABLE t1(i INT) ENGINE=INNODB;
+INSERT INTO t1 VALUES(1), (2), (3), (4), (5);
+CREATE TABLE t2 AS SELECT * FROM t1;
+CREATE TABLE t3 ENGINE=MyISAM AS SELECT * FROM t1;
+# On server_2
+SHOW TABLES IN test_8428;
+Tables_in_test_8428
+t1
+t2
+t3
+# On server_3
+SHOW TABLES IN test_8428;
+Tables_in_test_8428
+t1
+t2
+t3
+SELECT * from test_8428.t1;
+i
+1
+2
+3
+4
+5
+DROP DATABASE test_8428;
+include/rpl_end.inc
+# End of test
diff --git a/mysql-test/suite/rpl/r/rpl_EE_err.result b/mysql-test/suite/rpl/r/rpl_EE_err.result
index f61ca063b77..1f605935005 100644
--- a/mysql-test/suite/rpl/r/rpl_EE_err.result
+++ b/mysql-test/suite/rpl/r/rpl_EE_err.result
@@ -4,5 +4,5 @@ create table t1 (a int) engine=myisam;
flush tables;
drop table if exists t1;
Warnings:
-Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
+Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_alter.result b/mysql-test/suite/rpl/r/rpl_alter.result
index 2cffa70d778..608526ea79f 100644
--- a/mysql-test/suite/rpl/r/rpl_alter.result
+++ b/mysql-test/suite/rpl/r/rpl_alter.result
@@ -14,4 +14,109 @@ select * from mysqltest.t3;
n
45
drop database mysqltest;
+use test;
+#
+# Test bug where ALTER TABLE MODIFY didn't replicate properly
+#
+create table t1 (a int unsigned primary key, b int);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(10) unsigned NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 (a) values (1),((1<<32)-1);
+select * from t1;
+a b
+1 NULL
+4294967295 NULL
+alter table t1 modify a bigint;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+a b
+1 NULL
+4294967295 NULL
+alter table t1 modify a int unsigned;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(10) unsigned NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+a b
+1 NULL
+4294967295 NULL
+alter table t1 modify a bigint unsigned;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+a b
+1 NULL
+4294967295 NULL
+use test;
+select * from t1;
+a b
+1 NULL
+4294967295 NULL
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create table t2 (a int unsigned auto_increment primary key, b int);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t2 modify a bigint;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` bigint(20) NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t2 modify a bigint auto_increment;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` bigint(20) NOT NULL AUTO_INCREMENT,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1,t2;
+#
+# MDEV-8432: Slave cannot replicate signed integer-type values
+# with high bit set to 1
+# Test replication when we have int on master and bigint on slave
+#
+create table t1 (a int unsigned primary key, b int);
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
+alter table t1 modify a bigint unsigned;
+insert into t1 (a) values (1),((1<<32)-1);
+select * from t1;
+a b
+1 NULL
+4294967295 NULL
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
+drop table t1;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_binlog_grant.result b/mysql-test/suite/rpl/r/rpl_binlog_grant.result
index ccc7116a949..0c780122e38 100644
--- a/mysql-test/suite/rpl/r/rpl_binlog_grant.result
+++ b/mysql-test/suite/rpl/r/rpl_binlog_grant.result
@@ -6,6 +6,7 @@ create table t (s1 int) engine=innodb;
set @@autocommit=0;
start transaction;
insert into t values (1);
+create user x@y;
grant select on t to x@y;
rollback;
show grants for x@y;
diff --git a/mysql-test/suite/rpl/r/rpl_checksum.result b/mysql-test/suite/rpl/r/rpl_checksum.result
index 3f9c780ed67..b8c718ff821 100644
--- a/mysql-test/suite/rpl/r/rpl_checksum.result
+++ b/mysql-test/suite/rpl/r/rpl_checksum.result
@@ -71,7 +71,7 @@ insert into t1 values (1) /* will not be applied on slave due to simulation */;
set @@global.debug_dbug='d,simulate_slave_unaware_checksum';
start slave;
include/wait_for_slave_io_error.inc [errno=1236]
-Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log; the first event 'master-bin.000009' at 367, the last event read from 'master-bin.000010' at 4, the last byte read from 'master-bin.000010' at 248.''
+Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log; the first event 'master-bin.000009' at 368, the last event read from 'master-bin.000010' at 4, the last byte read from 'master-bin.000010' at 249.''
select count(*) as zero from t1;
zero
0
diff --git a/mysql-test/suite/rpl/r/rpl_create_drop_function.result b/mysql-test/suite/rpl/r/rpl_create_drop_function.result
index 66b1f485aa7..fc10d1f7c25 100644
--- a/mysql-test/suite/rpl/r/rpl_create_drop_function.result
+++ b/mysql-test/suite/rpl/r/rpl_create_drop_function.result
@@ -7,7 +7,7 @@ CONCAT('Hello, ', str, '!');
ERROR 42000: FUNCTION hello already exists
SHOW CREATE FUNCTION hello;
Function sql_mode Create Function character_set_client collation_connection Database Collation
-hello CREATE DEFINER=`root`@`localhost` FUNCTION `hello`(str CHAR(20)) RETURNS char(50) CHARSET latin1
+hello NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `hello`(str CHAR(20)) RETURNS char(50) CHARSET latin1
DETERMINISTIC
RETURN
CONCAT('Hello, ', str, '!') latin1 latin1_swedish_ci latin1_swedish_ci
diff --git a/mysql-test/suite/rpl/r/rpl_create_drop_role.result b/mysql-test/suite/rpl/r/rpl_create_drop_role.result
index eee92eb0eaf..84c9b9a7110 100644
--- a/mysql-test/suite/rpl/r/rpl_create_drop_role.result
+++ b/mysql-test/suite/rpl/r/rpl_create_drop_role.result
@@ -6,7 +6,7 @@ User
role_1
CREATE ROLE IF NOT EXISTS role_1;
Warnings:
-Note 1974 Can't create role 'role_1'; it already exists
+Note 1975 Can't create role 'role_1'; it already exists
CREATE ROLE IF NOT EXISTS role_2;
SELECT User FROM mysql.user WHERE is_role='Y' ORDER BY User;
User
@@ -33,7 +33,7 @@ DROP ROLE IF EXISTS role_2;
DROP ROLE IF EXISTS role_3;
DROP ROLE IF EXISTS role_4;
Warnings:
-Note 1975 Can't drop role 'role_4'; it doesn't exist
+Note 1976 Can't drop role 'role_4'; it doesn't exist
DROP ROLE role_4;
ERROR HY000: Operation DROP ROLE failed for 'role_4'
SELECT User FROM mysql.user WHERE is_role='Y' ORDER BY User;
diff --git a/mysql-test/suite/rpl/r/rpl_create_drop_user.result b/mysql-test/suite/rpl/r/rpl_create_drop_user.result
index e83372a97aa..c55c522852c 100644
--- a/mysql-test/suite/rpl/r/rpl_create_drop_user.result
+++ b/mysql-test/suite/rpl/r/rpl_create_drop_user.result
@@ -40,7 +40,7 @@ DROP USER IF EXISTS u1@localhost;
DROP USER u2@localhost;
DROP USER IF EXISTS u3@localhost;
Warnings:
-Note 1973 Can't drop user 'u3'@'localhost'; it doesn't exist
+Note 1974 Can't drop user 'u3'@'localhost'; it doesn't exist
SELECT user, password FROM mysql.user WHERE user LIKE 'u%' ORDER BY user;
user password
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_current_user.result b/mysql-test/suite/rpl/r/rpl_current_user.result
index a5e340b8850..3391af5de9c 100644
--- a/mysql-test/suite/rpl/r/rpl_current_user.result
+++ b/mysql-test/suite/rpl/r/rpl_current_user.result
@@ -8,6 +8,7 @@ CREATE VIEW test.v_procs_priv AS SELECT * FROM mysql.procs_priv WHERE User LIKE
CREATE VIEW test.v_event AS SELECT definer FROM mysql.event WHERE name = 'e1';
CREATE PROCEDURE p1() SELECT 1;
# bug48321_1-01234 has the max length(16) of user.
+CREATE USER 'bug48321_1-01234'@'localhost';
GRANT ALL PRIVILEGES ON *.* TO 'bug48321_1-01234'@'localhost' WITH GRANT OPTION;
# Test the max lengths of user and host names
diff --git a/mysql-test/suite/rpl/r/rpl_ddl.result b/mysql-test/suite/rpl/r/rpl_ddl.result
index 0173bf1e28d..df246cc547f 100644
--- a/mysql-test/suite/rpl/r/rpl_ddl.result
+++ b/mysql-test/suite/rpl/r/rpl_ddl.result
@@ -1,5 +1,7 @@
include/master-slave.inc
[connection master]
+set global sql_mode='';
+set local sql_mode='';
-------- switch to master -------
SET AUTOCOMMIT = 1;
@@ -1620,4 +1622,5 @@ use test;
DROP TEMPORARY TABLE mysqltest1.t22;
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest3;
+set global sql_mode=default;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_do_grant.result b/mysql-test/suite/rpl/r/rpl_do_grant.result
index 4cbc2d7d9e9..a9f1d92cb42 100644
--- a/mysql-test/suite/rpl/r/rpl_do_grant.result
+++ b/mysql-test/suite/rpl/r/rpl_do_grant.result
@@ -6,6 +6,7 @@ flush privileges;
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
+create user rpl_do_grant@localhost;
grant select on *.* to rpl_do_grant@localhost;
grant drop on test.* to rpl_do_grant@localhost;
show grants for rpl_do_grant@localhost;
@@ -113,7 +114,7 @@ GRANT EXECUTE, ALTER ROUTINE ON FUNCTION `bug42217_db`.`upgrade_del_func` TO 'cr
USE bug42217_db;
SHOW CREATE FUNCTION upgrade_del_func;
Function sql_mode Create Function character_set_client collation_connection Database Collation
-upgrade_del_func CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_del_func`() RETURNS char(30) CHARSET latin1
+upgrade_del_func NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_del_func`() RETURNS char(30) CHARSET latin1
BEGIN
RETURN "INSIDE upgrade_del_func()";
END latin1 latin1_swedish_ci latin1_swedish_ci
@@ -124,7 +125,7 @@ INSIDE upgrade_del_func()
USE bug42217_db;
SHOW CREATE FUNCTION upgrade_del_func;
Function sql_mode Create Function character_set_client collation_connection Database Collation
-upgrade_del_func CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_del_func`() RETURNS char(30) CHARSET latin1
+upgrade_del_func NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_del_func`() RETURNS char(30) CHARSET latin1
BEGIN
RETURN "INSIDE upgrade_del_func()";
END latin1 latin1_swedish_ci latin1_swedish_ci
@@ -149,7 +150,7 @@ upgrade_alter_func()
INSIDE upgrade_alter_func()
SHOW CREATE FUNCTION upgrade_alter_func;
Function sql_mode Create Function character_set_client collation_connection Database Collation
-upgrade_alter_func CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_alter_func`() RETURNS char(30) CHARSET latin1
+upgrade_alter_func NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_alter_func`() RETURNS char(30) CHARSET latin1
BEGIN
RETURN "INSIDE upgrade_alter_func()";
END latin1 latin1_swedish_ci latin1_swedish_ci
diff --git a/mysql-test/suite/rpl/r/rpl_domain_id_filter.result b/mysql-test/suite/rpl/r/rpl_domain_id_filter.result
index 7fcbe236914..fb315c4b020 100644
--- a/mysql-test/suite/rpl/r/rpl_domain_id_filter.result
+++ b/mysql-test/suite/rpl/r/rpl_domain_id_filter.result
@@ -153,7 +153,9 @@ SET @@session.gtid_domain_id=1;
BEGIN;
INSERT INTO t2 VALUES(3);
INSERT INTO t3 VALUES(3);
+include/save_master_gtid.inc
# On slave
+include/sync_with_master_gtid.inc
include/stop_slave.inc
DO_DOMAIN_IDS (BEFORE) :
IGNORE_DOMAIN_IDS (BEFORE) : 1
@@ -180,7 +182,9 @@ SET @@session.gtid_domain_id=1;
BEGIN;
INSERT INTO t2 VALUES(5);
INSERT INTO t3 VALUES(5);
+include/save_master_gtid.inc
# On slave
+include/sync_with_master_gtid.inc
include/stop_slave.inc
DO_DOMAIN_IDS (BEFORE) :
IGNORE_DOMAIN_IDS (BEFORE) :
diff --git a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
index 7b93a221953..a5bf73cdbfa 100644
--- a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
+++ b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
@@ -2,7 +2,8 @@ include/rpl_init.inc [topology=1->2->1]
show variables like 'relay_log%';
Variable_name Value
relay_log master-relay-bin
-relay_log_index master-relay-bin.index
+relay_log_basename MYSQLD_DATADIR/master-relay-bin
+relay_log_index MYSQLD_DATADIR/master-relay-bin.index
relay_log_info_file relay-log.info
relay_log_purge ON
relay_log_recovery OFF
diff --git a/mysql-test/suite/rpl/r/rpl_hrtime.result b/mysql-test/suite/rpl/r/rpl_hrtime.result
index 5a6787d37ac..3b29d339739 100644
--- a/mysql-test/suite/rpl/r/rpl_hrtime.result
+++ b/mysql-test/suite/rpl/r/rpl_hrtime.result
@@ -35,7 +35,7 @@ use `test`/*!*/;
SET TIMESTAMP=1293832861/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
-SET @@session.sql_mode=0/*!*/;
+SET @@session.sql_mode=1342177280/*!*/;
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/suite/rpl/r/rpl_ignore_grant.result b/mysql-test/suite/rpl/r/rpl_ignore_grant.result
index ae6d6ddfc8d..40baaa60b01 100644
--- a/mysql-test/suite/rpl/r/rpl_ignore_grant.result
+++ b/mysql-test/suite/rpl/r/rpl_ignore_grant.result
@@ -1,8 +1,12 @@
include/master-slave.inc
[connection master]
+set global sql_mode="";
+set local sql_mode="";
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
+set global sql_mode="";
+set local sql_mode="";
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
@@ -31,4 +35,6 @@ flush privileges;
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
+set global sql_mode=default;
+set global sql_mode=default;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_ignore_table.result b/mysql-test/suite/rpl/r/rpl_ignore_table.result
index 8e7166fa278..aa5f6d3e6db 100644
--- a/mysql-test/suite/rpl/r/rpl_ignore_table.result
+++ b/mysql-test/suite/rpl/r/rpl_ignore_table.result
@@ -17,6 +17,7 @@ DROP TABLE t4;
**** Adding GRANTS on master ****
create table test.t1(a int);
create table test.t4(a int);
+set sql_mode="";
GRANT SELECT ON test.t1 TO mysqltest1@localhost;
GRANT INSERT ON test.t4 TO mysqltest2@localhost;
GRANT select, update, insert, references on t1
@@ -65,6 +66,7 @@ flush privileges;
show grants for mysqltest5@somehost;
Grants for mysqltest5@somehost
GRANT USAGE ON *.* TO 'mysqltest5'@'somehost'
+set sql_mode="";
**** Checking grants on slave ****
show grants for mysqltest2@localhost;
Grants for mysqltest2@localhost
diff --git a/mysql-test/suite/rpl/r/rpl_mdev382.result b/mysql-test/suite/rpl/r/rpl_mdev382.result
index bc245a073cd..2e3faaba7b6 100644
--- a/mysql-test/suite/rpl/r/rpl_mdev382.result
+++ b/mysql-test/suite/rpl/r/rpl_mdev382.result
@@ -362,7 +362,7 @@ use `ts``et`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
-SET @@session.sql_mode=0/*!*/;
+SET @@session.sql_mode=1342177280/*!*/;
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/suite/rpl/r/rpl_mdev8193.result b/mysql-test/suite/rpl/r/rpl_mdev8193.result
new file mode 100644
index 00000000000..ad92d32e7d4
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_mdev8193.result
@@ -0,0 +1,24 @@
+include/master-slave.inc
+[connection master]
+include/stop_slave_sql.inc
+CALL mtr.add_suppression("Statement is unsafe because it uses a system function that may return a different value on the slave");
+create table t1 (i int);
+insert into t1 values (1),(2);
+insert into t1 values (3),(4);
+insert into t1 select i+20+0*sleep(1) from t1 where i=1;
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+flush logs;
+insert into t1 values (5),(6);
+insert into t1 values (7),(8);
+insert into t1 values (9),(10);
+insert into t1 values (11),(12);
+insert into t1 values (13),(14);
+insert into t1 values (15),(16);
+set global slave_parallel_threads = 1;
+start slave until master_log_file='MASTER_FILE', master_log_pos=MASTER_POS;
+drop table t1;
+include/stop_slave_io.inc
+set global slave_parallel_threads = DEFAULT;
+drop table t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result
index 39e1541eb0e..c729ad7ab75 100644
--- a/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result
+++ b/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result
@@ -13398,8 +13398,8 @@ 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 # Query # # use `test`; CREATE TABLE `tt_xx_1` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=InnoDB
@@ -13419,8 +13419,8 @@ 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 # Query # # use `test`; CREATE TABLE `tt_xx_1` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=InnoDB
@@ -13443,8 +13443,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_2` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
@@ -13465,8 +13465,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_2` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
@@ -13490,8 +13490,8 @@ 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 # Query # # use `test`; CREATE TABLE `tt_xx_3` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=InnoDB
@@ -13512,8 +13512,8 @@ 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 # Query # # use `test`; CREATE TABLE `tt_xx_3` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=InnoDB
@@ -13537,8 +13537,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_4` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
@@ -13558,8 +13558,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_4` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
@@ -13582,8 +13582,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_5` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
@@ -13603,8 +13603,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_5` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
@@ -13627,8 +13627,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_6` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
@@ -13648,8 +13648,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_6` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
@@ -13670,8 +13670,8 @@ 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 # Query # # use `test`; CREATE TABLE `tt_xx_7` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=InnoDB
@@ -13684,8 +13684,8 @@ 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 # Query # # use `test`; CREATE TABLE `tt_xx_7` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=InnoDB
@@ -13914,8 +13914,8 @@ 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 # Query # # use `test`; CREATE TABLE `tt_xx_8` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=InnoDB
@@ -13928,8 +13928,8 @@ 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 # Query # # use `test`; CREATE TABLE `tt_xx_8` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=InnoDB
@@ -14150,8 +14150,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_9` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
@@ -14165,8 +14165,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_9` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
@@ -14416,8 +14416,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_10` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
@@ -14431,8 +14431,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_10` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
diff --git a/mysql-test/suite/rpl/r/rpl_old_decimal.result b/mysql-test/suite/rpl/r/rpl_old_decimal.result
new file mode 100644
index 00000000000..3e2fa3bf241
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_old_decimal.result
@@ -0,0 +1,9 @@
+include/master-slave.inc
+[connection master]
+CREATE TABLE t1dec102 (a DECIMAL(10,2));
+INSERT INTO t1dec102 VALUES(999.99);
+call mtr.add_suppression("Slave SQL.*Column 0 of table .* cannot be converted from type.* Error_code: 1677");
+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
+Last_SQL_Error = 'Column 0 of table 'test.t1dec102' cannot be converted from type 'decimal(0,?)/*old*/' to type 'decimal(10,2)''
+DROP TABLE t1dec102;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_parallel.result b/mysql-test/suite/rpl/r/rpl_parallel.result
index 459da711171..6c904aefa92 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel.result
@@ -1703,6 +1703,64 @@ include/stop_slave.inc
SET GLOBAL debug_dbug= @old_debg;
SET GLOBAL max_relay_log_size= @old_max;
include/start_slave.inc
+*** MDEV-8302: Duplicate key with parallel replication ***
+include/stop_slave.inc
+/* Inject a small sleep which makes the race easier to hit. */
+SET @old_dbug=@@GLOBAL.debug_dbug;
+SET GLOBAL debug_dbug="+d,inject_mdev8302";
+INSERT INTO t7 VALUES (100,1), (101,2), (102,3), (103,4), (104,5);
+SET @old_dbug= @@SESSION.debug_dbug;
+SET @commit_id= 20000;
+SET SESSION debug_dbug="+d,binlog_force_commit_id";
+SET SESSION debug_dbug=@old_dbug;
+SELECT * FROM t7 ORDER BY a;
+a b
+1 1
+2 2
+3 86
+4 4
+5 5
+100 5
+101 1
+102 2
+103 3
+104 4
+include/save_master_gtid.inc
+include/start_slave.inc
+include/sync_with_master_gtid.inc
+SELECT * FROM t7 ORDER BY a;
+a b
+1 1
+2 2
+3 86
+4 4
+5 5
+100 5
+101 1
+102 2
+103 3
+104 4
+include/stop_slave.inc
+SET GLOBAL debug_dbug=@old_dbug;
+include/start_slave.inc
+*** MDEV-8725: Assertion on ROLLBACK statement in the binary log ***
+BEGIN;
+INSERT INTO t2 VALUES (2000);
+INSERT INTO t1 VALUES (2000);
+INSERT INTO t2 VALUES (2001);
+ROLLBACK;
+SELECT * FROM t1 WHERE a>=2000 ORDER BY a;
+a
+2000
+SELECT * FROM t2 WHERE a>=2000 ORDER BY a;
+a
+include/save_master_gtid.inc
+include/sync_with_master_gtid.inc
+SELECT * FROM t1 WHERE a>=2000 ORDER BY a;
+a
+2000
+SELECT * FROM t2 WHERE a>=2000 ORDER BY a;
+a
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
include/start_slave.inc
diff --git a/mysql-test/suite/rpl/r/rpl_parallel2.result b/mysql-test/suite/rpl/r/rpl_parallel2.result
index 8bf8b9caf3b..de90bcd158f 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel2.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel2.result
@@ -12,6 +12,23 @@ Note 1592 Unsafe statement written to the binary log using statement format sinc
include/wait_for_slave_param.inc [Seconds_Behind_Master]
Seconds_Behind_Master should be zero here because the slave is fully caught up and idle.
Seconds_Behind_Master = '0'
+*** MDEV-8294: Inconsistent behavior of slave parallel threads at runtime ***
+INSERT INTO t1 VALUES (10,0);
+SET sql_log_bin= 0;
+DELETE FROM t1 WHERE a=10;
+SET sql_log_bin= 1;
+INSERT INTO t1 VALUES (10,0);
+SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
+a b
+10 0
+include/wait_for_slave_sql_error.inc [errno=1062]
+SET GLOBAL slave_parallel_threads=8;
+STOP SLAVE;
+SET GLOBAL sql_slave_skip_counter= 1;
+include/start_slave.inc
+SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
+a b
+10 0
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
include/start_slave.inc
diff --git a/mysql-test/suite/rpl/r/rpl_replicate_do.result b/mysql-test/suite/rpl/r/rpl_replicate_do.result
index 27fd92db31c..c1e3ee60e10 100644
--- a/mysql-test/suite/rpl/r/rpl_replicate_do.result
+++ b/mysql-test/suite/rpl/r/rpl_replicate_do.result
@@ -34,15 +34,15 @@ t1
t2
show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
-trg1 INSERT t1 set new.b=2 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
-trg2 INSERT t2 set new.b=2 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+trg1 INSERT t1 set new.b=2 BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+trg2 INSERT t2 set new.b=2 BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
*** slave ***
show tables;
Tables_in_test
t1
show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
-trg1 INSERT t1 set new.b=2 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+trg1 INSERT t1 set new.b=2 BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
*** master ***
drop trigger trg1;
drop trigger trg2;
diff --git a/mysql-test/suite/rpl/r/rpl_rewrt_db.result b/mysql-test/suite/rpl/r/rpl_rewrt_db.result
index d9b6006fbb0..57754183483 100644
--- a/mysql-test/suite/rpl/r/rpl_rewrt_db.result
+++ b/mysql-test/suite/rpl/r/rpl_rewrt_db.result
@@ -63,8 +63,11 @@ drop table t1;
create table t1 (a int, b char(10));
load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
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 1262 Row 3 was truncated; it contained more data than there were input columns
+Note 1265 Data truncated for column 'a' at row 4
Warning 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 5
Warning 1262 Row 5 was truncated; it contained more data than there were input columns
select * from rewrite.t1;
@@ -77,6 +80,9 @@ a b
truncate table t1;
load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'a' at row 2
+Note 1265 Data truncated for column 'a' at row 3
Warning 1366 Incorrect integer value: '
' for column 'a' at row 4
Warning 1261 Row 4 doesn't contain data for all columns
diff --git a/mysql-test/suite/rpl/r/rpl_row_USER.result b/mysql-test/suite/rpl/r/rpl_row_USER.result
index 5298395da20..47b94074ecf 100644
--- a/mysql-test/suite/rpl/r/rpl_row_USER.result
+++ b/mysql-test/suite/rpl/r/rpl_row_USER.result
@@ -1,5 +1,7 @@
include/master-slave.inc
[connection master]
+set global sql_mode="";
+set local sql_mode="";
DROP DATABASE IF EXISTS mysqltest1;
CREATE DATABASE mysqltest1;
CREATE USER tester IDENTIFIED BY 'test';
@@ -33,3 +35,5 @@ REVOKE ALL ON mysqltest1.* FROM ''@'localhost%';
DROP USER tester@'%';
DROP USER ''@'localhost%';
include/rpl_end.inc
+set global sql_mode=default;
+set local sql_mode=default;
diff --git a/mysql-test/suite/rpl/r/rpl_row_UUID.result b/mysql-test/suite/rpl/r/rpl_row_UUID.result
index b7d3f8914e0..e9ddc1c4d12 100644
--- a/mysql-test/suite/rpl/r/rpl_row_UUID.result
+++ b/mysql-test/suite/rpl/r/rpl_row_UUID.result
@@ -25,7 +25,7 @@ insert into t2 values(fn1(2));
SHOW CREATE TABLE test.t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`blob_column` longblob,
`vchar_column` varchar(100) DEFAULT NULL,
PRIMARY KEY (`a`)
diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result
index 5e7c3c10c1e..71747e825b9 100644
--- a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result
@@ -103,7 +103,7 @@ a
7
8
9
-SET GLOBAL QUERY_CACHE_SIZE=0;
+SET GLOBAL QUERY_CACHE_SIZE=default;
DROP TABLE t1;
================ Test for BUG#22550 ================
include/rpl_reset.inc
diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_8partition.result b/mysql-test/suite/rpl/r/rpl_row_basic_8partition.result
index ef68c81bde8..91b1007aa59 100644
--- a/mysql-test/suite/rpl/r/rpl_row_basic_8partition.result
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_8partition.result
@@ -574,7 +574,7 @@ t1 CREATE TABLE `t1` (
`bc` char(255) DEFAULT NULL,
`d` decimal(10,4) DEFAULT '0.0000',
`f` float DEFAULT '0',
- `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL,
`y` year(4) DEFAULT NULL,
`t` date DEFAULT NULL,
PRIMARY KEY (`id`,`total`)
@@ -591,7 +591,7 @@ t1 CREATE TABLE `t1` (
`bc` char(255) DEFAULT NULL,
`d` decimal(10,4) DEFAULT '0.0000',
`f` float DEFAULT '0',
- `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL,
`y` year(4) DEFAULT NULL,
`t` date DEFAULT NULL,
PRIMARY KEY (`id`,`total`)
@@ -647,7 +647,7 @@ t1 CREATE TABLE `t1` (
`bc` char(255) DEFAULT NULL,
`d` decimal(10,4) DEFAULT '0.0000',
`f` float DEFAULT '0',
- `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL,
`y` year(4) DEFAULT NULL,
`t` date DEFAULT NULL,
PRIMARY KEY (`id`,`total`)
@@ -664,7 +664,7 @@ t1 CREATE TABLE `t1` (
`bc` char(255) DEFAULT NULL,
`d` decimal(10,4) DEFAULT '0.0000',
`f` float DEFAULT '0',
- `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL,
`y` year(4) DEFAULT NULL,
`t` date DEFAULT NULL,
PRIMARY KEY (`id`,`total`)
diff --git a/mysql-test/suite/rpl/r/rpl_row_create_table.result b/mysql-test/suite/rpl/r/rpl_row_create_table.result
index 9c04f580c07..283e769ce9a 100644
--- a/mysql-test/suite/rpl/r/rpl_row_create_table.result
+++ b/mysql-test/suite/rpl/r/rpl_row_create_table.result
@@ -417,7 +417,7 @@ master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE mysqltest1.without_select (f1 BIGINT)
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE `mysqltest1`.`with_select` (
- `f1` int(1) NOT NULL DEFAULT '0'
+ `f1` int(1) NOT NULL
)
master-bin.000001 # Table_map # # table_id: # (mysqltest1.with_select)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
diff --git a/mysql-test/suite/rpl/r/rpl_row_img_blobs.result b/mysql-test/suite/rpl/r/rpl_row_img_blobs.result
new file mode 100644
index 00000000000..e69358a5d29
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_img_blobs.result
@@ -0,0 +1,4733 @@
+include/rpl_init.inc [topology=1->2->3]
+CON: 'server_1', IMG: 'NOBLOB', RESTART SLAVE: 'N'
+SET SESSION binlog_row_image= 'NOBLOB';
+SET GLOBAL binlog_row_image= 'NOBLOB';
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image NOBLOB
+CON: 'server_2', IMG: 'NOBLOB', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'NOBLOB';
+SET GLOBAL binlog_row_image= 'NOBLOB';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image NOBLOB
+CON: 'server_3', IMG: 'NOBLOB', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'NOBLOB';
+SET GLOBAL binlog_row_image= 'NOBLOB';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image NOBLOB
+### engines: MyISAM, MyISAM, MyISAM
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: MyISAM, MyISAM, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: MyISAM, InnoDB, MyISAM
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: MyISAM, InnoDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, MyISAM, MyISAM
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, MyISAM, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, MyISAM
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+CON: 'server_1', IMG: 'MINIMAL', RESTART SLAVE: 'N'
+SET SESSION binlog_row_image= 'MINIMAL';
+SET GLOBAL binlog_row_image= 'MINIMAL';
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image MINIMAL
+CON: 'server_2', IMG: 'MINIMAL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'MINIMAL';
+SET GLOBAL binlog_row_image= 'MINIMAL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image MINIMAL
+CON: 'server_3', IMG: 'MINIMAL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'MINIMAL';
+SET GLOBAL binlog_row_image= 'MINIMAL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image MINIMAL
+### engines: MyISAM, MyISAM, MyISAM
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: MyISAM, MyISAM, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: MyISAM, InnoDB, MyISAM
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: MyISAM, InnoDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, MyISAM, MyISAM
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, MyISAM, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, MyISAM
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+CON: 'server_1', IMG: 'FULL', RESTART SLAVE: 'N'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+CON: 'server_2', IMG: 'FULL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+CON: 'server_3', IMG: 'FULL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+### engines: MyISAM, MyISAM, MyISAM
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: MyISAM, MyISAM, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: MyISAM, InnoDB, MyISAM
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: MyISAM, InnoDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, MyISAM, MyISAM
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, MyISAM, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, MyISAM
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_row_img_eng_min.result b/mysql-test/suite/rpl/r/rpl_row_img_eng_min.result
new file mode 100644
index 00000000000..ba01221d3b6
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_img_eng_min.result
@@ -0,0 +1,3516 @@
+include/rpl_init.inc [topology=1->2->3]
+CON: 'server_1', IMG: 'MINIMAL', RESTART SLAVE: 'N'
+SET SESSION binlog_row_image= 'MINIMAL';
+SET GLOBAL binlog_row_image= 'MINIMAL';
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image MINIMAL
+CON: 'server_2', IMG: 'MINIMAL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'MINIMAL';
+SET GLOBAL binlog_row_image= 'MINIMAL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image MINIMAL
+CON: 'server_3', IMG: 'MINIMAL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'MINIMAL';
+SET GLOBAL binlog_row_image= 'MINIMAL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image MINIMAL
+### engines: MyISAM, MyISAM, MyISAM
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: MyISAM, MyISAM, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: MyISAM, InnoDB, MyISAM
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: MyISAM, InnoDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, MyISAM, MyISAM
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, MyISAM, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, MyISAM
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+CON: 'server_1', IMG: 'FULL', RESTART SLAVE: 'N'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+CON: 'server_2', IMG: 'FULL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+CON: 'server_3', IMG: 'FULL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_row_img_eng_noblob.result b/mysql-test/suite/rpl/r/rpl_row_img_eng_noblob.result
new file mode 100644
index 00000000000..16152f28c27
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_img_eng_noblob.result
@@ -0,0 +1,3516 @@
+include/rpl_init.inc [topology=1->2->3]
+CON: 'server_1', IMG: 'NOBLOB', RESTART SLAVE: 'N'
+SET SESSION binlog_row_image= 'NOBLOB';
+SET GLOBAL binlog_row_image= 'NOBLOB';
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image NOBLOB
+CON: 'server_2', IMG: 'NOBLOB', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'NOBLOB';
+SET GLOBAL binlog_row_image= 'NOBLOB';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image NOBLOB
+CON: 'server_3', IMG: 'NOBLOB', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'NOBLOB';
+SET GLOBAL binlog_row_image= 'NOBLOB';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image NOBLOB
+### engines: MyISAM, MyISAM, MyISAM
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: MyISAM, MyISAM, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: MyISAM, InnoDB, MyISAM
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: MyISAM, InnoDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, MyISAM, MyISAM
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, MyISAM, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, MyISAM
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+CON: 'server_1', IMG: 'FULL', RESTART SLAVE: 'N'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+CON: 'server_2', IMG: 'FULL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+CON: 'server_3', IMG: 'FULL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result
index 39e1541eb0e..c729ad7ab75 100644
--- a/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result
+++ b/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result
@@ -13398,8 +13398,8 @@ 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 # Query # # use `test`; CREATE TABLE `tt_xx_1` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=InnoDB
@@ -13419,8 +13419,8 @@ 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 # Query # # use `test`; CREATE TABLE `tt_xx_1` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=InnoDB
@@ -13443,8 +13443,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_2` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
@@ -13465,8 +13465,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_2` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
@@ -13490,8 +13490,8 @@ 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 # Query # # use `test`; CREATE TABLE `tt_xx_3` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=InnoDB
@@ -13512,8 +13512,8 @@ 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 # Query # # use `test`; CREATE TABLE `tt_xx_3` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=InnoDB
@@ -13537,8 +13537,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_4` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
@@ -13558,8 +13558,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_4` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
@@ -13582,8 +13582,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_5` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
@@ -13603,8 +13603,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_5` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
@@ -13627,8 +13627,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_6` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
@@ -13648,8 +13648,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_6` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
@@ -13670,8 +13670,8 @@ 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 # Query # # use `test`; CREATE TABLE `tt_xx_7` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=InnoDB
@@ -13684,8 +13684,8 @@ 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 # Query # # use `test`; CREATE TABLE `tt_xx_7` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=InnoDB
@@ -13914,8 +13914,8 @@ 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 # Query # # use `test`; CREATE TABLE `tt_xx_8` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=InnoDB
@@ -13928,8 +13928,8 @@ 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 # Query # # use `test`; CREATE TABLE `tt_xx_8` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=InnoDB
@@ -14150,8 +14150,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_9` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
@@ -14165,8 +14165,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_9` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
@@ -14416,8 +14416,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_10` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
@@ -14431,8 +14431,8 @@ 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 # Query # # use `test`; CREATE TABLE `nt_xx_10` (
- `trans_id` int(11) NOT NULL DEFAULT '0',
- `stmt_id` int(11) NOT NULL DEFAULT '0',
+ `trans_id` int(11) NOT NULL,
+ `stmt_id` int(11) NOT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`trans_id`,`stmt_id`)
) ENGINE=MyISAM
diff --git a/mysql-test/suite/rpl/r/rpl_row_sp012.result b/mysql-test/suite/rpl/r/rpl_row_sp012.result
index 57d92386638..e084d43f90a 100644
--- a/mysql-test/suite/rpl/r/rpl_row_sp012.result
+++ b/mysql-test/suite/rpl/r/rpl_row_sp012.result
@@ -3,6 +3,7 @@ include/master-slave.inc
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP PROCEDURE IF EXISTS test.p3;
+create user user1@localhost;
grant usage on *.* to user1@localhost;
flush privileges;
SELECT CURRENT_USER();
@@ -17,6 +18,7 @@ CREATE PROCEDURE test.p3 () SQL SECURITY INVOKER CALL test.p1();
GRANT EXECUTE ON PROCEDURE p1 TO user1@localhost;
GRANT EXECUTE ON PROCEDURE p2 TO user1@localhost;
GRANT EXECUTE ON PROCEDURE p3 TO user1@localhost;
+set sql_mode=default;
<******** Master user1 p3 & p2 calls *******>
----------------------------------------------
diff --git a/mysql-test/suite/rpl/r/rpl_row_until.result b/mysql-test/suite/rpl/r/rpl_row_until.result
index a09d44227a3..656dc45ea47 100644
--- a/mysql-test/suite/rpl/r/rpl_row_until.result
+++ b/mysql-test/suite/rpl/r/rpl_row_until.result
@@ -9,7 +9,8 @@ INSERT INTO t2 VALUES (3),(4);
DROP TABLE t2;
include/stop_slave.inc
RESET SLAVE;
-START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_drop_t1
+CHANGE MASTER TO MASTER_USER='root', MASTER_CONNECT_RETRY=1, MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_MYPORT;
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_drop_t1;
include/wait_for_slave_sql_to_stop.inc
SELECT * FROM t1;
n
@@ -18,7 +19,7 @@ n
3
4
include/check_slave_param.inc [Exec_Master_Log_Pos]
-START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS;
+START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291;
include/wait_for_slave_sql_to_stop.inc
SELECT * FROM t1;
n
@@ -30,7 +31,7 @@ include/check_slave_param.inc [Exec_Master_Log_Pos]
START SLAVE;
include/wait_for_slave_to_start.inc
include/stop_slave.inc
-START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2
+START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2;
include/wait_for_slave_param.inc [Until_Log_Pos]
include/wait_for_slave_sql_to_stop.inc
include/check_slave_param.inc [Exec_Master_Log_Pos]
@@ -55,6 +56,7 @@ include/stop_slave_sql.inc
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (3);
include/sync_slave_io_with_master.inc
+start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=relay_log_pos;
include/wait_for_slave_sql_to_stop.inc
include/assert.inc [table t1 should have two rows.]
include/start_slave.inc
diff --git a/mysql-test/suite/rpl/r/rpl_set_statement.result b/mysql-test/suite/rpl/r/rpl_set_statement.result
index 78d34bd0853..c9df74b0d3b 100644
--- a/mysql-test/suite/rpl/r/rpl_set_statement.result
+++ b/mysql-test/suite/rpl/r/rpl_set_statement.result
@@ -1,5 +1,7 @@
include/master-slave.inc
[connection master]
+set sql_mode="";
+set sql_mode="";
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
call mtr.add_suppression("Unsafe statement written to the binary log*");
diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result
index 8ca72672073..ea9c8906217 100644
--- a/mysql-test/suite/rpl/r/rpl_sp.result
+++ b/mysql-test/suite/rpl/r/rpl_sp.result
@@ -1,5 +1,7 @@
include/master-slave.inc
[connection master]
+set local sql_mode='';
+set global sql_mode='';
drop database if exists mysqltest1;
create database mysqltest1;
use mysqltest1;
@@ -1311,3 +1313,4 @@ drop table t1;
drop procedure p1;
# End of 5.5 tests.
include/rpl_end.inc
+set global sql_mode=default;
diff --git a/mysql-test/suite/rpl/r/rpl_ssl.result b/mysql-test/suite/rpl/r/rpl_ssl.result
index 35aaabc8c56..f02fa4e7b9f 100644
--- a/mysql-test/suite/rpl/r/rpl_ssl.result
+++ b/mysql-test/suite/rpl/r/rpl_ssl.result
@@ -1,5 +1,6 @@
include/master-slave.inc
[connection master]
+create user replssl@localhost;
grant replication slave on *.* to replssl@localhost require ssl;
create table t1 (t int auto_increment, KEY(t));
stop slave;
diff --git a/mysql-test/suite/rpl/r/rpl_ssl1.result b/mysql-test/suite/rpl/r/rpl_ssl1.result
index a7a56d7c5ee..c9fe21a7929 100644
--- a/mysql-test/suite/rpl/r/rpl_ssl1.result
+++ b/mysql-test/suite/rpl/r/rpl_ssl1.result
@@ -1,5 +1,6 @@
include/master-slave.inc
[connection master]
+create user replssl@localhost;
grant replication slave on *.* to replssl@localhost require ssl;
create table t1 (t int);
stop slave;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_until.result b/mysql-test/suite/rpl/r/rpl_stm_until.result
index b1cea5227f6..967acb540bd 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_until.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_until.result
@@ -25,7 +25,7 @@ n
3
4
include/check_slave_param.inc [Exec_Master_Log_Pos]
-start slave until master_log_file='master-no-such-bin.000001', master_log_pos=MASTER_LOG_POS;
+start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
include/wait_for_slave_io_to_start.inc
include/wait_for_slave_sql_to_stop.inc
select * from t1;
@@ -52,18 +52,18 @@ include/wait_for_slave_io_to_start.inc
include/wait_for_slave_sql_to_stop.inc
include/check_slave_param.inc [Exec_Master_Log_Pos]
==== Test various error conditions ====
-start slave until master_log_file='master-bin', master_log_pos=MASTER_LOG_POS;
+start slave until master_log_file='master-bin', master_log_pos=561;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS, relay_log_pos=RELAY_LOG_POS;
+start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave until master_log_file='master-bin.000001';
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave until relay_log_file='slave-relay-bin.000002';
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=MASTER_LOG_POS;
+start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave sql_thread;
-start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS;
+start slave until master_log_file='master-bin.000001', master_log_pos=776;
Warnings:
Note 1254 Slave is already running
include/stop_slave.inc
diff --git a/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result b/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result
index 1933b0b82f8..c9c9ed62452 100644
--- a/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result
+++ b/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result
@@ -90,7 +90,7 @@ 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 # Query # # use `test`; CREATE TABLE `t1` (
- `rand()` double NOT NULL DEFAULT '0'
+ `rand()` double NOT NULL
) ENGINE=MyISAM
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
diff --git a/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result b/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result
index 550b3f596e5..0264c9421fc 100644
--- a/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result
+++ b/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result
@@ -182,6 +182,11 @@ DROP USER test_3@localhost;
ERROR HY000: Table 'user' was not locked with LOCK TABLES
INSERT INTO t2 VALUES ("DROP USER test_3@localhost with table locked");
UNLOCK TABLE;
+CREATE DATABASE db;
+CREATE TABLE db.t1 LIKE t2;
+CREATE TABLE t3 LIKE t2;
+DROP TABLE t3;
+DROP DATABASE db;
DROP USER test_3@localhost;
DROP FUNCTION f2;
DROP PROCEDURE p2;
diff --git a/mysql-test/suite/rpl/r/rpl_variables.result b/mysql-test/suite/rpl/r/rpl_variables.result
index 8711dce4ab6..f91cdad6e47 100644
--- a/mysql-test/suite/rpl/r/rpl_variables.result
+++ b/mysql-test/suite/rpl/r/rpl_variables.result
@@ -38,6 +38,34 @@ include/stop_slave.inc
include/start_slave.inc
SET @@global.init_slave = 'SELECT 1';
[on master]
+SELECT @@pid_file, @@datadir;
+@@pid_file MYSQLTEST_VARDIR/run/mysqld.1.pid
+@@datadir MYSQLTEST_VARDIR/mysqld.1/data/
+**** Relay log variables
+SELECT @@relay_log, @@relay_log_index, @@relay_log_basename;
+@@relay_log master-relay-bin
+@@relay_log_index MYSQLTEST_VARDIR/mysqld.1/data/master-relay-bin.index
+@@relay_log_basename MYSQLTEST_VARDIR/mysqld.1/data/master-relay-bin
+**** Binary log variables
+SELECT @@log_bin, @@log_bin_index, @@log_bin_basename;
+@@log_bin 1
+@@log_bin_index MYSQLTEST_VARDIR/mysqld.1/data/master-bin.index
+@@log_bin_basename MYSQLTEST_VARDIR/mysqld.1/data/master-bin
+[on slave]
+SELECT @@pid_file, @@datadir;
+@@pid_file MYSQLTEST_VARDIR/run/mysqld.2.pid
+@@datadir MYSQLTEST_VARDIR/mysqld.2/data/
+**** Relay log variables
+SELECT @@relay_log, @@relay_log_index, @@relay_log_basename;
+@@relay_log slave-relay-bin
+@@relay_log_index MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.index
+@@relay_log_basename MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin
+**** Binary log variables
+SELECT @@log_bin, @@log_bin_index, @@log_bin_basename;
+@@log_bin 1
+@@log_bin_index MYSQLTEST_VARDIR/mysqld.2/data/slave-bin.index
+@@log_bin_basename MYSQLTEST_VARDIR/mysqld.2/data/slave-bin
+[on master]
CREATE TABLE tstmt (id INT AUTO_INCREMENT PRIMARY KEY,
truth BOOLEAN,
num INT,
diff --git a/mysql-test/suite/rpl/r/show_status_stop_slave_race-7126.result b/mysql-test/suite/rpl/r/show_status_stop_slave_race-7126.result
index e71bb2e29c9..c2a0498509b 100644
--- a/mysql-test/suite/rpl/r/show_status_stop_slave_race-7126.result
+++ b/mysql-test/suite/rpl/r/show_status_stop_slave_race-7126.result
@@ -1,2 +1,4 @@
include/master-slave.inc
[connection master]
+start slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/create_select.cnf b/mysql-test/suite/rpl/t/create_select.cnf
new file mode 100644
index 00000000000..65a4396edf3
--- /dev/null
+++ b/mysql-test/suite/rpl/t/create_select.cnf
@@ -0,0 +1,16 @@
+!include suite/rpl/my.cnf
+
+[mysqld.1]
+
+[mysqld.2]
+log-slave-updates
+binlog-checksum=CRC32
+
+[mysqld.3]
+log-slave-updates
+binlog-checksum=CRC32
+
+[ENV]
+SERVER_MYPORT_3= @mysqld.3.port
+SERVER_MYSOCK_3= @mysqld.3.socket
+
diff --git a/mysql-test/suite/rpl/t/create_select.test b/mysql-test/suite/rpl/t/create_select.test
new file mode 100644
index 00000000000..c55dea92744
--- /dev/null
+++ b/mysql-test/suite/rpl/t/create_select.test
@@ -0,0 +1,41 @@
+--source include/have_innodb.inc
+
+--let $rpl_topology=1->2->3
+--source include/rpl_init.inc
+
+#
+# Test of MDEV-8428 Mangled DML statements on 2nd level slave when enabling
+# binlog checksums
+#
+
+connection server_1;
+
+--echo # On server_1
+CREATE DATABASE test_8428;
+USE test_8428;
+CREATE TABLE t1(i INT) ENGINE=INNODB;
+INSERT INTO t1 VALUES(1), (2), (3), (4), (5);
+CREATE TABLE t2 AS SELECT * FROM t1;
+CREATE TABLE t3 ENGINE=MyISAM AS SELECT * FROM t1;
+
+save_master_pos;
+connection server_2;
+sync_with_master;
+
+--echo # On server_2
+SHOW TABLES IN test_8428;
+
+save_master_pos;
+connection server_3;
+sync_with_master;
+
+--echo # On server_3
+SHOW TABLES IN test_8428;
+SELECT * from test_8428.t1;
+
+# Cleanup
+connection server_1;
+DROP DATABASE test_8428;
+--source include/rpl_end.inc
+--echo # End of test
+
diff --git a/mysql-test/suite/rpl/t/rpl_000011.test b/mysql-test/suite/rpl/t/rpl_000011.test
index faad2242235..216e568fc42 100644
--- a/mysql-test/suite/rpl/t/rpl_000011.test
+++ b/mysql-test/suite/rpl/t/rpl_000011.test
@@ -11,6 +11,12 @@ insert into t1 values(1);
sync_slave_with_master;
show global status like 'com_insert';
stop slave;
+# Temporary work-around for bug MDEV-8301. There is a small window during
+# thread exit where the local status values of a thread are counted twice
+# in the global status. Remove this wait_condition.inc once MDEV-8301 is
+# fixed.
+--let $wait_condition= SELECT variable_value=1 FROM information_schema.global_status WHERE variable_name="Com_insert";
+--source include/wait_condition.inc
show global status like 'com_insert';
--source include/wait_for_slave_to_stop.inc
start slave;
diff --git a/mysql-test/suite/rpl/t/rpl_alter.test b/mysql-test/suite/rpl/t/rpl_alter.test
index 630197f8637..8b8bcfb3d26 100644
--- a/mysql-test/suite/rpl/t/rpl_alter.test
+++ b/mysql-test/suite/rpl/t/rpl_alter.test
@@ -15,4 +15,57 @@ drop database mysqltest;
sync_slave_with_master;
# End of 4.1 tests
+
+connection master;
+use test;
+
+--echo #
+--echo # Test bug where ALTER TABLE MODIFY didn't replicate properly
+--echo #
+
+create table t1 (a int unsigned primary key, b int);
+show create table t1;
+insert into t1 (a) values (1),((1<<32)-1);
+select * from t1;
+alter table t1 modify a bigint;
+show create table t1;
+select * from t1;
+alter table t1 modify a int unsigned;
+show create table t1;
+select * from t1;
+alter table t1 modify a bigint unsigned;
+show create table t1;
+select * from t1;
+sync_slave_with_master;
+use test;
+select * from t1;
+show create table t1;
+connection master;
+#
+create table t2 (a int unsigned auto_increment primary key, b int);
+show create table t2;
+alter table t2 modify a bigint;
+show create table t2;
+alter table t2 modify a bigint auto_increment;
+show create table t2;
+drop table t1,t2;
+
+--echo #
+--echo # MDEV-8432: Slave cannot replicate signed integer-type values
+--echo # with high bit set to 1
+--echo # Test replication when we have int on master and bigint on slave
+--echo #
+
+create table t1 (a int unsigned primary key, b int);
+sync_slave_with_master;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
+alter table t1 modify a bigint unsigned;
+connection master;
+insert into t1 (a) values (1),((1<<32)-1);
+sync_slave_with_master;
+select * from t1;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
+connection master;
+drop table t1;
+
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_binlog_grant.test b/mysql-test/suite/rpl/t/rpl_binlog_grant.test
index 26ebb29ae8d..f8513021134 100644
--- a/mysql-test/suite/rpl/t/rpl_binlog_grant.test
+++ b/mysql-test/suite/rpl/t/rpl_binlog_grant.test
@@ -16,6 +16,7 @@ create table t (s1 int) engine=innodb;
set @@autocommit=0;
start transaction;
insert into t values (1);
+create user x@y;
grant select on t to x@y;
let $wait_binlog_event= grant select;
source include/wait_for_binlog_event.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_current_user.test b/mysql-test/suite/rpl/t/rpl_current_user.test
index c9ee6fcd576..1f5a82486e3 100644
--- a/mysql-test/suite/rpl/t/rpl_current_user.test
+++ b/mysql-test/suite/rpl/t/rpl_current_user.test
@@ -42,6 +42,7 @@ CREATE VIEW test.v_procs_priv AS SELECT * FROM mysql.procs_priv WHERE User LIKE
CREATE VIEW test.v_event AS SELECT definer FROM mysql.event WHERE name = 'e1';
CREATE PROCEDURE p1() SELECT 1;
--echo # bug48321_1-01234 has the max length(16) of user.
+CREATE USER 'bug48321_1-01234'@'localhost';
GRANT ALL PRIVILEGES ON *.* TO 'bug48321_1-01234'@'localhost' WITH GRANT OPTION;
--echo
@@ -235,4 +236,3 @@ DROP PROCEDURE my_revoke;
DROP FUNCTION my_user;
DROP EVENT e1;
--source include/rpl_end.inc
-
diff --git a/mysql-test/suite/rpl/t/rpl_do_grant.test b/mysql-test/suite/rpl/t/rpl_do_grant.test
index 4d7d1bacc15..83b9a84744f 100644
--- a/mysql-test/suite/rpl/t/rpl_do_grant.test
+++ b/mysql-test/suite/rpl/t/rpl_do_grant.test
@@ -17,6 +17,7 @@ flush privileges;
# test replication of GRANT
connection master;
+create user rpl_do_grant@localhost;
grant select on *.* to rpl_do_grant@localhost;
grant drop on test.* to rpl_do_grant@localhost;
sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_domain_id_filter.test b/mysql-test/suite/rpl/t/rpl_domain_id_filter.test
index 01de2766b37..1503ee1adaa 100644
--- a/mysql-test/suite/rpl/t/rpl_domain_id_filter.test
+++ b/mysql-test/suite/rpl/t/rpl_domain_id_filter.test
@@ -228,11 +228,11 @@ SET @@session.gtid_domain_id=1;
BEGIN;
INSERT INTO t2 VALUES(3);
INSERT INTO t3 VALUES(3);
-save_master_pos;
+--source include/save_master_gtid.inc
--echo # On slave
connection slave;
-sync_with_master;
+--source include/sync_with_master_gtid.inc
--source include/stop_slave.inc
let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
let $ignore_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
@@ -270,11 +270,11 @@ SET @@session.gtid_domain_id=1;
BEGIN;
INSERT INTO t2 VALUES(5);
INSERT INTO t3 VALUES(5);
-save_master_pos;
+--source include/save_master_gtid.inc
--echo # On slave
connection slave;
-sync_with_master;
+--source include/sync_with_master_gtid.inc
--source include/stop_slave.inc
let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
let $ignore_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
diff --git a/mysql-test/suite/rpl/t/rpl_drop_db_fail.test b/mysql-test/suite/rpl/t/rpl_drop_db_fail.test
index f4482064d7b..c13bae1cab3 100644
--- a/mysql-test/suite/rpl/t/rpl_drop_db_fail.test
+++ b/mysql-test/suite/rpl/t/rpl_drop_db_fail.test
@@ -25,7 +25,7 @@ use db2;
CREATE TABLE table_child(id INT PRIMARY KEY, info VARCHAR(20), father_id INT) ENGINE=INNODB;
ALTER TABLE table_child ADD CONSTRAINT aaa FOREIGN KEY (father_id) REFERENCES db1.table_father(id);
---error ER_ROW_IS_REFERENCED
+--error ER_ROW_IS_REFERENCED_2
DROP DATABASE db1;
DROP DATABASE db2;
--sync_slave_with_master
diff --git a/mysql-test/suite/rpl/t/rpl_ignore_grant.test b/mysql-test/suite/rpl/t/rpl_ignore_grant.test
index 34074ba8ca9..ee049a515d7 100644
--- a/mysql-test/suite/rpl/t/rpl_ignore_grant.test
+++ b/mysql-test/suite/rpl/t/rpl_ignore_grant.test
@@ -6,11 +6,15 @@ source include/master-slave.inc;
# do not be influenced by other tests.
connection master;
+set global sql_mode="";
+set local sql_mode="";
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
save_master_pos;
connection slave;
+set global sql_mode="";
+set local sql_mode="";
sync_with_master;
# as these DELETE were not replicated, we need to do them manually on the
# slave.
@@ -56,5 +60,8 @@ delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
+set global sql_mode=default;
+connection master;
+set global sql_mode=default;
# End of 4.1 tests
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_ignore_table.test b/mysql-test/suite/rpl/t/rpl_ignore_table.test
index b0019b70dc8..f9b01c83917 100644
--- a/mysql-test/suite/rpl/t/rpl_ignore_table.test
+++ b/mysql-test/suite/rpl/t/rpl_ignore_table.test
@@ -49,6 +49,7 @@ connection master;
create table test.t1(a int);
create table test.t4(a int);
+set sql_mode="";
# Simple user that should not replicate
GRANT SELECT ON test.t1 TO mysqltest1@localhost;
@@ -87,7 +88,7 @@ show grants for mysqltest6@localhost;
flush privileges;
show grants for mysqltest5@somehost;
-
+set sql_mode="";
sync_slave_with_master;
--echo **** Checking grants on slave ****
diff --git a/mysql-test/suite/rpl/t/rpl_mdev8193.test b/mysql-test/suite/rpl/t/rpl_mdev8193.test
new file mode 100644
index 00000000000..29c26bb3da4
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_mdev8193.test
@@ -0,0 +1,56 @@
+--source include/master-slave.inc
+--source include/have_binlog_format_statement.inc
+
+--connection slave
+
+--source include/stop_slave_sql.inc
+
+--connection master
+
+CALL mtr.add_suppression("Statement is unsafe because it uses a system function that may return a different value on the slave");
+create table t1 (i int);
+insert into t1 values (1),(2);
+insert into t1 values (3),(4);
+# This sleep() helps trigger the failure more reliably.
+insert into t1 select i+20+0*sleep(1) from t1 where i=1;
+flush logs;
+insert into t1 values (5),(6);
+insert into t1 values (7),(8);
+insert into t1 values (9),(10);
+
+--let $master_file = query_get_value(show master status,File,1)
+--let $master_pos = query_get_value(show master status,Position,1)
+
+insert into t1 values (11),(12);
+insert into t1 values (13),(14);
+insert into t1 values (15),(16);
+
+--connection slave
+
+set global slave_parallel_threads = 1;
+--replace_result $master_file MASTER_FILE $master_pos MASTER_POS
+eval start slave until master_log_file='$master_file', master_log_pos=$master_pos;
+
+--let $show_statement = SHOW SLAVE STATUS
+--let $field = Slave_SQL_Running
+--let $condition = = 'No'
+--let $wait_timeout = 10
+
+--source include/wait_show_condition.inc
+
+if (`select COUNT(*) > 11 from t1`)
+{
+ query_vertical show slave status;
+ SELECT * FROM t1;
+ die "Wrong number of rows in the table";
+}
+
+drop table t1;
+--source include/stop_slave_io.inc
+set global slave_parallel_threads = DEFAULT;
+
+--connection master
+drop table t1;
+
+--let $rpl_only_running_threads= 1
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_old_decimal.test b/mysql-test/suite/rpl/t/rpl_old_decimal.test
new file mode 100644
index 00000000000..79fd2754079
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_old_decimal.test
@@ -0,0 +1,25 @@
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+
+--connection slave
+CREATE TABLE t1dec102 (a DECIMAL(10,2));
+
+--connection master
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--copy_file std_data/old_decimal/t1dec102.frm $MYSQLD_DATADIR/test/t1dec102.frm
+--copy_file std_data/old_decimal/t1dec102.MYD $MYSQLD_DATADIR/test/t1dec102.MYD
+--copy_file std_data/old_decimal/t1dec102.MYI $MYSQLD_DATADIR/test/t1dec102.MYI
+INSERT INTO t1dec102 VALUES(999.99);
+
+--let $slave_sql_errno=1677
+--let $show_slave_sql_error= 1
+call mtr.add_suppression("Slave SQL.*Column 0 of table .* cannot be converted from type.* Error_code: 1677");
+--source include/wait_for_slave_sql_error_and_skip.inc
+
+--connection master
+DROP TABLE t1dec102;
+--sync_slave_with_master
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_parallel.test b/mysql-test/suite/rpl/t/rpl_parallel.test
index 6861f1bbebe..8a512848145 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel.test
@@ -2374,6 +2374,82 @@ SET GLOBAL max_relay_log_size= @old_max;
--source include/start_slave.inc
+--echo *** MDEV-8302: Duplicate key with parallel replication ***
+
+--connection server_2
+--source include/stop_slave.inc
+/* Inject a small sleep which makes the race easier to hit. */
+SET @old_dbug=@@GLOBAL.debug_dbug;
+SET GLOBAL debug_dbug="+d,inject_mdev8302";
+
+
+--connection server_1
+INSERT INTO t7 VALUES (100,1), (101,2), (102,3), (103,4), (104,5);
+
+# Artificially create a bunch of group commits with conflicting transactions.
+# The bug happened when T1 and T2 was in one group commit, and T3 was in the
+# following group commit. T2 is a DELETE of a row with same primary key as a
+# row that T3 inserts. T1 and T2 can conflict, causing T2 to be deadlock
+# killed after starting to commit. The bug was that T2 could roll back before
+# doing unmark_start_commit(); this could allow T3 to run before the retry
+# of T2, causing duplicate key violation.
+
+SET @old_dbug= @@SESSION.debug_dbug;
+SET @commit_id= 20000;
+SET SESSION debug_dbug="+d,binlog_force_commit_id";
+
+--let $n = 100
+--disable_query_log
+while ($n)
+{
+ eval UPDATE t7 SET b=b+1 WHERE a=100+($n MOD 5);
+ eval DELETE FROM t7 WHERE a=100+($n MOD 5);
+
+ SET @commit_id = @commit_id + 1;
+ eval INSERT INTO t7 VALUES (100+($n MOD 5), $n);
+ SET @commit_id = @commit_id + 1;
+ dec $n;
+}
+--enable_query_log
+SET SESSION debug_dbug=@old_dbug;
+
+
+SELECT * FROM t7 ORDER BY a;
+--source include/save_master_gtid.inc
+
+
+--connection server_2
+--source include/start_slave.inc
+--source include/sync_with_master_gtid.inc
+SELECT * FROM t7 ORDER BY a;
+
+--source include/stop_slave.inc
+SET GLOBAL debug_dbug=@old_dbug;
+--source include/start_slave.inc
+
+
+
+--echo *** MDEV-8725: Assertion on ROLLBACK statement in the binary log ***
+--connection server_1
+# Inject an event group terminated by ROLLBACK, by mixing MyISAM and InnoDB
+# in a transaction. The bug was an assertion on the ROLLBACK due to
+# mark_start_commit() being already called.
+--disable_warnings
+BEGIN;
+INSERT INTO t2 VALUES (2000);
+INSERT INTO t1 VALUES (2000);
+INSERT INTO t2 VALUES (2001);
+ROLLBACK;
+--enable_warnings
+SELECT * FROM t1 WHERE a>=2000 ORDER BY a;
+SELECT * FROM t2 WHERE a>=2000 ORDER BY a;
+--source include/save_master_gtid.inc
+
+--connection server_2
+--source include/sync_with_master_gtid.inc
+SELECT * FROM t1 WHERE a>=2000 ORDER BY a;
+SELECT * FROM t2 WHERE a>=2000 ORDER BY a;
+
# Clean up.
--connection server_2
diff --git a/mysql-test/suite/rpl/t/rpl_parallel2.test b/mysql-test/suite/rpl/t/rpl_parallel2.test
index 51c9e39a26a..47b0e87a6b6 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel2.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel2.test
@@ -37,6 +37,48 @@ INSERT INTO t1 VALUES (1,sleep(2));
--source include/show_slave_status.inc
+--echo *** MDEV-8294: Inconsistent behavior of slave parallel threads at runtime ***
+
+--connection server_1
+INSERT INTO t1 VALUES (10,0);
+# Force a duplicate key error on the slave.
+SET sql_log_bin= 0;
+DELETE FROM t1 WHERE a=10;
+SET sql_log_bin= 1;
+INSERT INTO t1 VALUES (10,0);
+--save_master_pos
+SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
+
+--connection server_2
+--let $slave_sql_errno= 1062
+--source include/wait_for_slave_sql_error.inc
+
+# At this point, the worker threads should have stopped also.
+--let $wait_condition= SELECT COUNT(*)=0 FROM information_schema.processlist WHERE User = "system user" AND State = "Waiting for work from SQL thread";
+--source include/wait_condition.inc
+
+# Check that the pool can still be resized, but remains inactive as no slave
+# SQL thread is running.
+SET GLOBAL slave_parallel_threads=8;
+--let $wait_condition= SELECT COUNT(*)=0 FROM information_schema.processlist WHERE User = "system user" AND State = "Waiting for work from SQL thread";
+--source include/wait_condition.inc
+
+STOP SLAVE;
+# At this point, the worker threads should have stopped.
+--let $wait_condition= SELECT COUNT(*)=0 FROM information_schema.processlist WHERE User = "system user" AND State = "Waiting for work from SQL thread";
+--source include/wait_condition.inc
+
+
+SET GLOBAL sql_slave_skip_counter= 1;
+--source include/start_slave.inc
+# At this point, the worker threads should have been spawned.
+--let $wait_condition= SELECT COUNT(*)=8 FROM information_schema.processlist WHERE User = "system user" AND State = "Waiting for work from SQL thread";
+--source include/wait_condition.inc
+--sync_with_master
+SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
+
+
+# Clean up
--connection server_2
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
diff --git a/mysql-test/suite/rpl/t/rpl_row_USER.test b/mysql-test/suite/rpl/t/rpl_row_USER.test
index 7e05e4e0041..31826812efa 100644
--- a/mysql-test/suite/rpl/t/rpl_row_USER.test
+++ b/mysql-test/suite/rpl/t/rpl_row_USER.test
@@ -11,6 +11,8 @@
# Includes
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
+set global sql_mode="";
+set local sql_mode="";
# Begin clean up test section
connection master;
@@ -58,3 +60,6 @@ sync_slave_with_master;
# End of 5.0 test case
--source include/rpl_end.inc
+
+set global sql_mode=default;
+set local sql_mode=default;
diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test
index f4b371b737f..82929d57db5 100644
--- a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test
+++ b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test
@@ -91,7 +91,7 @@ INSERT INTO t1 VALUES (7),(8),(9);
sync_slave_with_master;
SELECT * FROM t1;
-SET GLOBAL QUERY_CACHE_SIZE=0;
+SET GLOBAL QUERY_CACHE_SIZE=default;
--connection master
DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/t/rpl_row_img.cnf b/mysql-test/suite/rpl/t/rpl_row_img.cnf
new file mode 100644
index 00000000000..ed9a4292917
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_img.cnf
@@ -0,0 +1,21 @@
+!include include/default_mysqld.cnf
+
+[mysqld.1]
+log-slave-updates
+innodb
+innodb_flush_log_at_trx_commit= 0
+
+[mysqld.2]
+log-slave-updates
+innodb
+innodb_flush_log_at_trx_commit= 0
+
+[mysqld.3]
+log-slave-updates
+innodb
+innodb_flush_log_at_trx_commit= 0
+
+[ENV]
+SERVER_MYPORT_1= @mysqld.1.port
+SERVER_MYPORT_2= @mysqld.2.port
+SERVER_MYPORT_3= @mysqld.3.port
diff --git a/mysql-test/suite/rpl/t/rpl_row_img_blobs.cnf b/mysql-test/suite/rpl/t/rpl_row_img_blobs.cnf
new file mode 100644
index 00000000000..d758d29f481
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_img_blobs.cnf
@@ -0,0 +1 @@
+!include suite/rpl/t/rpl_row_img.cnf
diff --git a/mysql-test/suite/rpl/t/rpl_row_img_blobs.test b/mysql-test/suite/rpl/t/rpl_row_img_blobs.test
new file mode 100644
index 00000000000..467202391b0
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_img_blobs.test
@@ -0,0 +1,59 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
+
+#
+# This file contains tests for WL#5096.
+#
+
+--let $rpl_topology= 1->2->3
+--source include/rpl_init.inc
+-- source include/have_binlog_format_row.inc
+
+-- connection server_1
+-- source include/have_innodb.inc
+-- connection server_2
+-- source include/have_innodb.inc
+-- connection server_3
+-- source include/have_innodb.inc
+-- connection server_1
+
+#
+# WL#5096 Tests.
+#
+
+#
+# Tests combinations of binlog-row-image against mixes of MyISAM and InnoDB
+# storage engines on all three servers.
+#
+# All the combinarions need not to be separated into their own files as
+# the tests for indexes and engines mixes are, because noblobs test script
+# does not take too long time, thence we do not risk triggering PB2 timeout
+# on valgrind runs.
+#
+
+## NOBLOB
+
+-- let $row_img_set=server_1:NOBLOB:N,server_2:NOBLOB:Y,server_3:NOBLOB:Y
+-- source include/rpl_row_img_set.inc
+
+-- let $row_img_test_script= extra/rpl_tests/rpl_row_img_blobs.test
+-- source include/rpl_row_img_general_loop.inc
+
+## MINIMAL
+
+-- let $row_img_set=server_1:MINIMAL:N,server_2:MINIMAL:Y,server_3:MINIMAL:Y
+-- source include/rpl_row_img_set.inc
+
+-- let $row_img_test_script= extra/rpl_tests/rpl_row_img_blobs.test
+-- source include/rpl_row_img_general_loop.inc
+
+## FULL
+
+-- let $row_img_set=server_1:FULL:N,server_2:FULL:Y,server_3:FULL:Y
+-- source include/rpl_row_img_set.inc
+
+-- let $row_img_test_script= extra/rpl_tests/rpl_row_img_blobs.test
+-- source include/rpl_row_img_general_loop.inc
+
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_row_img_eng_min.cnf b/mysql-test/suite/rpl/t/rpl_row_img_eng_min.cnf
new file mode 100644
index 00000000000..d758d29f481
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_img_eng_min.cnf
@@ -0,0 +1 @@
+!include suite/rpl/t/rpl_row_img.cnf
diff --git a/mysql-test/suite/rpl/t/rpl_row_img_eng_min.test b/mysql-test/suite/rpl/t/rpl_row_img_eng_min.test
new file mode 100644
index 00000000000..24b9655bd81
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_img_eng_min.test
@@ -0,0 +1,39 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
+#
+# This file contains tests for WL#5096 and bug fixes.
+#
+
+--let $rpl_topology= 1->2->3
+--source include/rpl_init.inc
+-- source include/have_binlog_format_row.inc
+
+-- connection server_1
+-- source include/have_innodb.inc
+-- connection server_2
+-- source include/have_innodb.inc
+-- connection server_3
+-- source include/have_innodb.inc
+-- connection server_1
+
+#
+# WL#5096
+#
+
+#
+# Tests for different storage engines on each server,
+# but same index structure on tables. The tests are conducted
+# using MINIMAL binlog-row-image on all servers.
+#
+
+-- let $row_img_set=server_1:MINIMAL:N,server_2:MINIMAL:Y,server_3:MINIMAL:Y
+-- source include/rpl_row_img_set.inc
+
+-- let $row_img_test_script= extra/rpl_tests/rpl_row_img.test
+-- source include/rpl_row_img_general_loop.inc
+
+-- let $row_img_set=server_1:FULL:N,server_2:FULL:Y,server_3:FULL:Y
+-- source include/rpl_row_img_set.inc
+
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_row_img_eng_noblob.cnf b/mysql-test/suite/rpl/t/rpl_row_img_eng_noblob.cnf
new file mode 100644
index 00000000000..d758d29f481
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_img_eng_noblob.cnf
@@ -0,0 +1 @@
+!include suite/rpl/t/rpl_row_img.cnf
diff --git a/mysql-test/suite/rpl/t/rpl_row_img_eng_noblob.test b/mysql-test/suite/rpl/t/rpl_row_img_eng_noblob.test
new file mode 100644
index 00000000000..5d5f95a6552
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_img_eng_noblob.test
@@ -0,0 +1,39 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
+#
+# This file contains tests for WL#5096 and bug fixes.
+#
+
+--let $rpl_topology= 1->2->3
+--source include/rpl_init.inc
+-- source include/have_binlog_format_row.inc
+
+-- connection server_1
+-- source include/have_innodb.inc
+-- connection server_2
+-- source include/have_innodb.inc
+-- connection server_3
+-- source include/have_innodb.inc
+-- connection server_1
+
+#
+# WL#5096
+#
+
+#
+# Tests for different storage engines on each server,
+# but same index structure on tables. The tests are conducted
+# using NOBLOB binlog-row-image on all servers.
+#
+
+-- let $row_img_set=server_1:NOBLOB:N,server_2:NOBLOB:Y,server_3:NOBLOB:Y
+-- source include/rpl_row_img_set.inc
+
+-- let $row_img_test_script= extra/rpl_tests/rpl_row_img.test
+-- source include/rpl_row_img_general_loop.inc
+
+-- let $row_img_set=server_1:FULL:N,server_2:FULL:Y,server_3:FULL:Y
+-- source include/rpl_row_img_set.inc
+
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
index ed0f31b75be..a44cc18c0ed 100644
--- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
+++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
@@ -21,6 +21,7 @@
--disable_query_log
select "---Setup Section --" as "";
+set sql_mode="";
--enable_query_log
set timestamp=1000000000;
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp012.test b/mysql-test/suite/rpl/t/rpl_row_sp012.test
index 23bc92b51cf..80d312f1878 100644
--- a/mysql-test/suite/rpl/t/rpl_row_sp012.test
+++ b/mysql-test/suite/rpl/t/rpl_row_sp012.test
@@ -23,6 +23,7 @@ DROP PROCEDURE IF EXISTS test.p3;
# Begin test section 1
# Create user user1 with no particular access rights
+create user user1@localhost;
grant usage on *.* to user1@localhost;
flush privileges;
@@ -34,6 +35,7 @@ CREATE PROCEDURE test.p3 () SQL SECURITY INVOKER CALL test.p1();
GRANT EXECUTE ON PROCEDURE p1 TO user1@localhost;
GRANT EXECUTE ON PROCEDURE p2 TO user1@localhost;
GRANT EXECUTE ON PROCEDURE p3 TO user1@localhost;
+set sql_mode=default;
# Need to wait for the rights to be applied at the slave
sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_row_until.test b/mysql-test/suite/rpl/t/rpl_row_until.test
index f10f921eada..8a5d743a238 100644
--- a/mysql-test/suite/rpl/t/rpl_row_until.test
+++ b/mysql-test/suite/rpl/t/rpl_row_until.test
@@ -39,17 +39,14 @@ sync_slave_with_master;
--source include/stop_slave.inc
# Reset slave.
RESET SLAVE;
---disable_query_log
+--replace_result $MASTER_MYPORT MASTER_MYPORT
eval CHANGE MASTER TO MASTER_USER='root', MASTER_CONNECT_RETRY=1, MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT;
---enable_query_log
# Try to replicate all queries until drop of t1
connection slave;
-echo START SLAVE UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=master_pos_drop_t1;
---disable_query_log
+--replace_result $master_pos_drop_t1 master_pos_drop_t1
eval START SLAVE UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=$master_pos_drop_t1;
---enable_query_log
--source include/wait_for_slave_sql_to_stop.inc
# Here table should be still not deleted
@@ -59,7 +56,6 @@ SELECT * FROM t1;
--source include/check_slave_param.inc
# This should fail right after start
---replace_result 291 MASTER_LOG_POS
START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291;
--source include/wait_for_slave_sql_to_stop.inc
# again this table should be still not deleted
@@ -77,10 +73,8 @@ sync_slave_with_master;
--source include/stop_slave.inc
# This should stop immediately as we are already there
-echo START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=master_pos_create_t2;
---disable_query_log
+--replace_result $master_pos_create_t2 master_pos_create_t2
eval START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=$master_pos_create_t2;
---enable_query_log
let $slave_param= Until_Log_Pos;
let $slave_param_value= $master_pos_create_t2;
--source include/wait_for_slave_param.inc
@@ -140,9 +134,8 @@ INSERT INTO t1 VALUES (3);
--let $relay_log_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File,1)
--source include/get_relay_log_pos.inc
---disable_query_log
+--replace_result $relay_log_pos relay_log_pos
--eval start slave until relay_log_file='$relay_log_file', relay_log_pos=$relay_log_pos
---enable_query_log
--source include/wait_for_slave_sql_to_stop.inc
--let $assert_cond= COUNT(*) = 2 FROM t1
diff --git a/mysql-test/suite/rpl/t/rpl_set_statement.test b/mysql-test/suite/rpl/t/rpl_set_statement.test
index 8a3087bec6d..5bc54e44e34 100644
--- a/mysql-test/suite/rpl/t/rpl_set_statement.test
+++ b/mysql-test/suite/rpl/t/rpl_set_statement.test
@@ -1,5 +1,9 @@
--source include/master-slave.inc
--source include/have_binlog_format_statement.inc
+set sql_mode="";
+connection slave;
+set sql_mode="";
+connection master;
--disable_warnings
DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/rpl/t/rpl_sp.test b/mysql-test/suite/rpl/t/rpl_sp.test
index c978a145a92..124d98cd29b 100644
--- a/mysql-test/suite/rpl/t/rpl_sp.test
+++ b/mysql-test/suite/rpl/t/rpl_sp.test
@@ -6,6 +6,8 @@
source include/have_binlog_format_mixed.inc;
source include/master-slave.inc;
+set local sql_mode='';
+set global sql_mode='';
# we need a db != test, where we don't have automatic grants
--disable_warnings
@@ -739,3 +741,4 @@ drop procedure p1;
# Cleanup
sync_slave_with_master;
--source include/rpl_end.inc
+set global sql_mode=default;
diff --git a/mysql-test/suite/rpl/t/rpl_ssl.test b/mysql-test/suite/rpl/t/rpl_ssl.test
index 43289428d45..9e42764715b 100644
--- a/mysql-test/suite/rpl/t/rpl_ssl.test
+++ b/mysql-test/suite/rpl/t/rpl_ssl.test
@@ -3,6 +3,7 @@ source include/master-slave.inc;
# create a user for replication that requires ssl encryption
connection master;
+create user replssl@localhost;
grant replication slave on *.* to replssl@localhost require ssl;
create table t1 (t int auto_increment, KEY(t));
diff --git a/mysql-test/suite/rpl/t/rpl_ssl1.test b/mysql-test/suite/rpl/t/rpl_ssl1.test
index f5f63a00033..d994dd21c1d 100644
--- a/mysql-test/suite/rpl/t/rpl_ssl1.test
+++ b/mysql-test/suite/rpl/t/rpl_ssl1.test
@@ -7,6 +7,7 @@ source include/master-slave.inc;
# creating replication user for whom ssl auth is required
# preparing playground
connection master;
+create user replssl@localhost;
grant replication slave on *.* to replssl@localhost require ssl;
create table t1 (t int);
diff --git a/mysql-test/suite/rpl/t/rpl_stm_until.test b/mysql-test/suite/rpl/t/rpl_stm_until.test
index 074d38ca0c6..9194a1fda63 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_until.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_until.test
@@ -64,7 +64,6 @@ select * from t1;
--source include/check_slave_param.inc
# this should fail right after start
---replace_result 291 MASTER_LOG_POS
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
--source include/wait_for_slave_io_to_start.inc
--source include/wait_for_slave_sql_to_stop.inc
@@ -107,22 +106,18 @@ eval start slave until master_log_file='$master_log_file', master_log_pos=$maste
--echo ==== Test various error conditions ====
---replace_result 561 MASTER_LOG_POS
--error 1277
start slave until master_log_file='master-bin', master_log_pos=561;
---replace_result 561 MASTER_LOG_POS 12 RELAY_LOG_POS
--error 1277
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
--error 1277
start slave until master_log_file='master-bin.000001';
--error 1277
start slave until relay_log_file='slave-relay-bin.000002';
---replace_result 561 MASTER_LOG_POS
--error 1277
start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
# Warning should be given for second command
start slave sql_thread;
---replace_result 776 MASTER_LOG_POS
start slave until master_log_file='master-bin.000001', master_log_pos=776;
#
diff --git a/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test b/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test
index e9cc098857e..bc4119f332f 100644
--- a/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test
+++ b/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test
@@ -150,6 +150,16 @@ DROP USER test_3@localhost;
INSERT INTO t2 VALUES ("DROP USER test_3@localhost with table locked");
UNLOCK TABLE;
+
+# Bug #20439913 CREATE TABLE DB.TABLE LIKE TMPTABLE IS
+# BINLOGGED INCORRECTLY - BREAKS A SLAVE
+CREATE DATABASE db;
+CREATE TABLE db.t1 LIKE t2;
+CREATE TABLE t3 LIKE t2;
+DROP TABLE t3;
+DROP DATABASE db;
+# end of Bug #20439913 test
+
DROP USER test_3@localhost;
DROP FUNCTION f2;
DROP PROCEDURE p2;
diff --git a/mysql-test/suite/rpl/t/rpl_variables.test b/mysql-test/suite/rpl/t/rpl_variables.test
index ca90054da2a..246e595d265 100644
--- a/mysql-test/suite/rpl/t/rpl_variables.test
+++ b/mysql-test/suite/rpl/t/rpl_variables.test
@@ -119,6 +119,30 @@ SET @@global.init_slave = 'SELECT 1';
--echo [on master]
connection master;
+# checking values of read-only variables
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+query_vertical SELECT @@pid_file, @@datadir;
+--echo **** Relay log variables
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+query_vertical SELECT @@relay_log, @@relay_log_index, @@relay_log_basename;
+--echo **** Binary log variables
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+query_vertical SELECT @@log_bin, @@log_bin_index, @@log_bin_basename;
+
+--echo [on slave]
+connection slave;
+# checking values of read-only variables
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+query_vertical SELECT @@pid_file, @@datadir;
+--echo **** Relay log variables
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+query_vertical SELECT @@relay_log, @@relay_log_index, @@relay_log_basename;
+--echo **** Binary log variables
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+query_vertical SELECT @@log_bin, @@log_bin_index, @@log_bin_basename;
+
+--echo [on master]
+connection master;
# Tables where everything happens.
CREATE TABLE tstmt (id INT AUTO_INCREMENT PRIMARY KEY,
diff --git a/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test b/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test
index a79a1885a6c..38759c9b16a 100644
--- a/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test
+++ b/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test
@@ -10,3 +10,10 @@
--exec $MYSQL_SLAP --silent --socket=$SLAVE_MYSOCK -q "START SLAVE; STOP SLAVE; SHOW GLOBAL STATUS" -c 2 --number-of-queries=100 --create-schema=test
# All done.
+
+--connection slave
+start slave;
+
+--connection master
+--source include/rpl_end.inc
+
diff --git a/mysql-test/suite/storage_engine/foreign_keys.test b/mysql-test/suite/storage_engine/foreign_keys.test
index cbadc4c950d..4991862685f 100644
--- a/mysql-test/suite/storage_engine/foreign_keys.test
+++ b/mysql-test/suite/storage_engine/foreign_keys.test
@@ -77,10 +77,10 @@ if (!$mysql_errname)
--sorted_result
SELECT a,b FROM t2;
- --let $error_codes = ER_ROW_IS_REFERENCED
+ --let $error_codes = ER_ROW_IS_REFERENCED_2
DROP TABLE t1;
--source check_errors.inc
- if ($mysql_errname != ER_ROW_IS_REFERENCED)
+ if ($mysql_errname != ER_ROW_IS_REFERENCED_2)
{
--let $functionality = Foreign keys
--source unexpected_result.inc
diff --git a/mysql-test/suite/storage_engine/select.result b/mysql-test/suite/storage_engine/select.result
index 015ed80b771..9bd36cffc27 100644
--- a/mysql-test/suite/storage_engine/select.result
+++ b/mysql-test/suite/storage_engine/select.result
@@ -68,7 +68,8 @@ a
SELECT FOUND_ROWS();
FOUND_ROWS()
3
-SET GLOBAL query_cache_size = 1024*1024;
+SET GLOBAL query_cache_type = ON;
+SET query_cache_type = ON;
SELECT SQL_CACHE * FROM t1, t2;
a b a b
1 z 1 z
@@ -89,7 +90,7 @@ a b a b
200 bar 100 foobar
200 bar 200 bar
200 bar 200 bar
-SET GLOBAL query_cache_size = 0;
+SET GLOBAL query_cache_type = DEFAULT;
SELECT a+10 AS field1, CONCAT(b,':',b) AS field2 FROM t1
WHERE b > 'b' AND a IS NOT NULL
GROUP BY 2 DESC, field1 ASC
diff --git a/mysql-test/suite/storage_engine/select.test b/mysql-test/suite/storage_engine/select.test
index 34cfd99d344..9b4e1784f47 100644
--- a/mysql-test/suite/storage_engine/select.test
+++ b/mysql-test/suite/storage_engine/select.test
@@ -45,11 +45,11 @@ SELECT SQL_BIG_RESULT SQL_CALC_FOUND_ROWS DISTINCT(t2.a)
FROM t1 t1_1, t2, t1 t1_2;
SELECT FOUND_ROWS();
-let $query_cache = `SELECT @@query_cache_size`;
-SET GLOBAL query_cache_size = 1024*1024;
+SET GLOBAL query_cache_type = ON;
+SET query_cache_type = ON;
--sorted_result
SELECT SQL_CACHE * FROM t1, t2;
-eval SET GLOBAL query_cache_size = $query_cache;
+SET GLOBAL query_cache_type = DEFAULT;
# Combination of main clauses
diff --git a/mysql-test/suite/storage_engine/type_spatial.result b/mysql-test/suite/storage_engine/type_spatial.result
index 6c2f5a4d50f..e1ae2f1fa64 100644
--- a/mysql-test/suite/storage_engine/type_spatial.result
+++ b/mysql-test/suite/storage_engine/type_spatial.result
@@ -412,12 +412,12 @@ Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
first second w c o e d t i r
-120 120 1 1 0 1 0 1 1 0
+120 120 1 1 0 1 0 0 1 0
120 121 0 0 1 0 0 0 1 0
120 122 NULL NULL NULL NULL NULL NULL NULL NULL
120 123 NULL NULL NULL NULL NULL NULL NULL NULL
121 120 0 0 1 0 0 0 1 0
-121 121 1 1 0 1 0 1 1 0
+121 121 1 1 0 1 0 0 1 0
121 122 NULL NULL NULL NULL NULL NULL NULL NULL
121 123 NULL NULL NULL NULL NULL NULL NULL NULL
122 120 NULL NULL NULL NULL NULL NULL NULL NULL
diff --git a/mysql-test/suite/storage_engine/type_spatial_indexes.result b/mysql-test/suite/storage_engine/type_spatial_indexes.result
index 93bb4c617e5..1c9fee3ceac 100644
--- a/mysql-test/suite/storage_engine/type_spatial_indexes.result
+++ b/mysql-test/suite/storage_engine/type_spatial_indexes.result
@@ -412,12 +412,12 @@ Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
first second w c o e d t i r
-120 120 1 1 0 1 0 1 1 0
+120 120 1 1 0 1 0 0 1 0
120 121 0 0 1 0 0 0 1 0
120 122 NULL NULL NULL NULL NULL NULL NULL NULL
120 123 NULL NULL NULL NULL NULL NULL NULL NULL
121 120 0 0 1 0 0 0 1 0
-121 121 1 1 0 1 0 1 1 0
+121 121 1 1 0 1 0 0 1 0
121 122 NULL NULL NULL NULL NULL NULL NULL NULL
121 123 NULL NULL NULL NULL NULL NULL NULL NULL
122 120 NULL NULL NULL NULL NULL NULL NULL NULL
@@ -1112,12 +1112,12 @@ Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
first second w c o e d t i r
-120 120 1 1 0 1 0 1 1 0
+120 120 1 1 0 1 0 0 1 0
120 121 0 0 1 0 0 0 1 0
120 122 NULL NULL NULL NULL NULL NULL NULL NULL
120 123 NULL NULL NULL NULL NULL NULL NULL NULL
121 120 0 0 1 0 0 0 1 0
-121 121 1 1 0 1 0 1 1 0
+121 121 1 1 0 1 0 0 1 0
121 122 NULL NULL NULL NULL NULL NULL NULL NULL
121 123 NULL NULL NULL NULL NULL NULL NULL NULL
122 120 NULL NULL NULL NULL NULL NULL NULL NULL
diff --git a/mysql-test/suite/stress/t/ddl_archive.test b/mysql-test/suite/stress/t/ddl_archive.test
index 0c47b5fcdd5..c688ae192d0 100644
--- a/mysql-test/suite/stress/t/ddl_archive.test
+++ b/mysql-test/suite/stress/t/ddl_archive.test
@@ -12,11 +12,8 @@
--source include/have_archive.inc
let $engine_type= ARCHIVE;
+--source include/no_protocol.inc
-if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL + $VIEW_PROTOCOL > 0`)
-{
- --skip Test requires: ps-protocol/sp-protocol/cursor-protocol/view-protocol disabled
-}
let $run= `SELECT '$BIG_TEST' = '1'`;
if ($run)
{
diff --git a/mysql-test/suite/stress/t/ddl_csv.test b/mysql-test/suite/stress/t/ddl_csv.test
index 9f6185c76be..3e0f8acb1d8 100644
--- a/mysql-test/suite/stress/t/ddl_csv.test
+++ b/mysql-test/suite/stress/t/ddl_csv.test
@@ -12,11 +12,8 @@
--source include/have_csv.inc
let $engine_type= CSV;
+--source include/no_protocol.inc
-if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL + $VIEW_PROTOCOL > 0`)
-{
- --skip Test requires: ps-protocol/sp-protocol/cursor-protocol/view-protocol disabled
-}
let $run= `SELECT '$BIG_TEST' = '1'`;
if ($run)
{
diff --git a/mysql-test/suite/stress/t/ddl_innodb.test b/mysql-test/suite/stress/t/ddl_innodb.test
index 784ba8ff003..083ec43e7d7 100644
--- a/mysql-test/suite/stress/t/ddl_innodb.test
+++ b/mysql-test/suite/stress/t/ddl_innodb.test
@@ -12,11 +12,8 @@
--source include/have_innodb.inc
let $engine_type= InnoDB;
+--source include/no_protocol.inc
-if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL + $VIEW_PROTOCOL > 0`)
-{
- --skip Test requires: ps-protocol/sp-protocol/cursor-protocol/view-protocol disabled
-}
let $run= `SELECT '$BIG_TEST' = '1'`;
if ($run)
{
diff --git a/mysql-test/suite/stress/t/ddl_memory.test b/mysql-test/suite/stress/t/ddl_memory.test
index 5178439bff1..bcca77a74d9 100644
--- a/mysql-test/suite/stress/t/ddl_memory.test
+++ b/mysql-test/suite/stress/t/ddl_memory.test
@@ -11,11 +11,8 @@
# Storage engine to be used in CREATE TABLE
let $engine_type= MEMORY;
+--source include/no_protocol.inc
-if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL + $VIEW_PROTOCOL > 0`)
-{
- --skip Test requires: ps-protocol/sp-protocol/cursor-protocol/view-protocol disabled
-}
let $run= `SELECT '$BIG_TEST' = '1'`;
if ($run)
{
diff --git a/mysql-test/suite/stress/t/ddl_myisam.test b/mysql-test/suite/stress/t/ddl_myisam.test
index 8d6226e573b..a9b14690c42 100644
--- a/mysql-test/suite/stress/t/ddl_myisam.test
+++ b/mysql-test/suite/stress/t/ddl_myisam.test
@@ -11,11 +11,8 @@
# Storage engine to be used in CREATE TABLE
let $engine_type= MyISAM;
+--source include/no_protocol.inc
-if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL + $VIEW_PROTOCOL > 0`)
-{
- --skip Test requires: ps-protocol/sp-protocol/cursor-protocol/view-protocol disabled
-}
let $run= `SELECT '$BIG_TEST' = '1'`;
if ($run)
{
diff --git a/mysql-test/suite/sys_vars/disabled.def b/mysql-test/suite/sys_vars/disabled.def
index 758215208de..a009bc5c174 100644
--- a/mysql-test/suite/sys_vars/disabled.def
+++ b/mysql-test/suite/sys_vars/disabled.def
@@ -12,3 +12,4 @@
innodb_flush_checkpoint_debug_basic: removed from XtraDB-26.0
table_open_cache_instances_basic: no such variable in MariaDB
+all_vars: obsolete, see sysvars_* tests
diff --git a/mysql-test/suite/sys_vars/inc/bin_relay_log_basename_index.inc b/mysql-test/suite/sys_vars/inc/bin_relay_log_basename_index.inc
new file mode 100644
index 00000000000..58d6ce2deb2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/inc/bin_relay_log_basename_index.inc
@@ -0,0 +1,55 @@
+# ==== Usage ====
+# [--let $rpl_debug=1]
+# --let $rpl_log_var_name= log_bin_basename|relay_log_basename|...
+# --source suite/sys_vars/inc/bin_relay_log_basename_index.inc
+#
+# $rpl_log_var_name
+# The name of the variable to test, i.e., one of:
+# - log_bin_basename
+# - relay_log_basename
+# - log_bin_index
+# - relay_log_index
+#
+# $rpl_debug
+# See include/rpl_init.inc
+
+if ($rpl_debug)
+{
+ --echo Testing variable named: $rpl_log_var_name
+}
+
+--let $basename= `SELECT @@global.$rpl_log_var_name`
+
+#
+# Assert that the variable is indeed only global
+#
+--replace_result $basename REPLACED
+--eval select @@global.$rpl_log_var_name
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+--eval select @@session.$rpl_log_var_name
+
+#
+# Assert that it is retrievable
+#
+--replace_result $basename REPLACED
+--eval show global variables like '$rpl_log_var_name'
+
+--replace_result $basename REPLACED
+--eval show session variables like '$rpl_log_var_name'
+
+--replace_result $basename REPLACED
+--eval select * from information_schema.global_variables where variable_name='$rpl_log_var_name'
+
+--replace_result $basename REPLACED
+--eval select * from information_schema.session_variables where variable_name='$rpl_log_var_name'
+
+#
+# Assert it is read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+--eval set global $rpl_log_var_name=1
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+--eval set session $rpl_log_var_name=1
+
diff --git a/mysql-test/suite/sys_vars/r/all_vars.result b/mysql-test/suite/sys_vars/r/all_vars.result
index ca821f870fb..b812a5dbee3 100644
--- a/mysql-test/suite/sys_vars/r/all_vars.result
+++ b/mysql-test/suite/sys_vars/r/all_vars.result
@@ -15,5 +15,6 @@ innodb_default_encryption_key_id
max_digest_length
strict_password_validation
wsrep_patch_version
+pfs_max_digest_length
drop table t1;
drop table t2;
diff --git a/mysql-test/suite/sys_vars/r/back_log_basic.result b/mysql-test/suite/sys_vars/r/back_log_basic.result
index d68e72a8a4a..0940ebeef8c 100644
--- a/mysql-test/suite/sys_vars/r/back_log_basic.result
+++ b/mysql-test/suite/sys_vars/r/back_log_basic.result
@@ -1,20 +1,20 @@
select @@global.back_log;
@@global.back_log
-150
+80
select @@session.back_log;
ERROR HY000: Variable 'back_log' is a GLOBAL variable
show global variables like 'back_log';
Variable_name Value
-back_log 150
+back_log 80
show session variables like 'back_log';
Variable_name Value
-back_log 150
+back_log 80
select * from information_schema.global_variables where variable_name='back_log';
VARIABLE_NAME VARIABLE_VALUE
-BACK_LOG 150
+BACK_LOG 80
select * from information_schema.session_variables where variable_name='back_log';
VARIABLE_NAME VARIABLE_VALUE
-BACK_LOG 150
+BACK_LOG 80
set global back_log=1;
ERROR HY000: Variable 'back_log' is a read only variable
set session back_log=1;
diff --git a/mysql-test/suite/sys_vars/r/binlog_row_image_basic.result b/mysql-test/suite/sys_vars/r/binlog_row_image_basic.result
new file mode 100644
index 00000000000..8a1aae216bb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/binlog_row_image_basic.result
@@ -0,0 +1,100 @@
+SELECT @@GLOBAL.binlog_row_image;
+@@GLOBAL.binlog_row_image
+FULL
+SELECT @@SESSION.binlog_row_image;
+@@SESSION.binlog_row_image
+FULL
+FULL Expected
+'#---------------------BS_STVARS_002_01----------------------#'
+SET @start_value= @@global.binlog_row_image;
+SELECT COUNT(@@GLOBAL.binlog_row_image);
+COUNT(@@GLOBAL.binlog_row_image)
+1
+1 Expected
+SELECT COUNT(@@SESSION.binlog_row_image);
+COUNT(@@SESSION.binlog_row_image)
+1
+1 Expected
+'#---------------------BS_STVARS_002_02----------------------#'
+SET @@GLOBAL.binlog_row_image=0;
+SELECT @@GLOBAL.binlog_row_image;
+@@GLOBAL.binlog_row_image
+MINIMAL
+MINIMAL Expected
+SET @@SESSION.binlog_row_image=0;
+SELECT @@SESSION.binlog_row_image;
+@@SESSION.binlog_row_image
+MINIMAL
+MINIMAL Expected
+SET @@GLOBAL.binlog_row_image=1;
+SELECT @@GLOBAL.binlog_row_image;
+@@GLOBAL.binlog_row_image
+NOBLOB
+NOBLOB Expected
+SET @@SESSION.binlog_row_image=1;
+SELECT @@SESSION.binlog_row_image;
+@@SESSION.binlog_row_image
+NOBLOB
+NOBLOB Expected
+SET @@GLOBAL.binlog_row_image=2;
+SELECT @@GLOBAL.binlog_row_image;
+@@GLOBAL.binlog_row_image
+FULL
+FULL Expected
+SET @@SESSION.binlog_row_image=2;
+SELECT @@SESSION.binlog_row_image;
+@@SESSION.binlog_row_image
+FULL
+FULL Expected
+'#---------------------BS_STVARS_002_03----------------------#'
+SELECT @@GLOBAL.binlog_row_image = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='binlog_row_image';
+@@GLOBAL.binlog_row_image = VARIABLE_VALUE
+1
+1 Expected
+SELECT COUNT(@@GLOBAL.binlog_row_image);
+COUNT(@@GLOBAL.binlog_row_image)
+1
+1 Expected
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='binlog_row_image';
+COUNT(VARIABLE_VALUE)
+1
+1 Expected
+'#---------------------BS_STVARS_002_04----------------------#'
+SELECT @@SESSION.binlog_row_image = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='binlog_row_image';
+@@SESSION.binlog_row_image = VARIABLE_VALUE
+1
+1 Expected
+SELECT COUNT(@@SESSION.binlog_row_image);
+COUNT(@@SESSION.binlog_row_image)
+1
+1 Expected
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='binlog_row_image';
+COUNT(VARIABLE_VALUE)
+1
+1 Expected
+'#---------------------BS_STVARS_002_05----------------------#'
+SELECT COUNT(@@binlog_row_image);
+COUNT(@@binlog_row_image)
+1
+1 Expected
+SELECT COUNT(@@local.binlog_row_image);
+COUNT(@@local.binlog_row_image)
+1
+1 Expected
+SELECT COUNT(@@SESSION.binlog_row_image);
+COUNT(@@SESSION.binlog_row_image)
+1
+1 Expected
+SELECT COUNT(@@GLOBAL.binlog_row_image);
+COUNT(@@GLOBAL.binlog_row_image)
+1
+1 Expected
+SET @@global.binlog_row_image= @start_value;
diff --git a/mysql-test/suite/sys_vars/r/debug_crc_break_basic.result b/mysql-test/suite/sys_vars/r/debug_crc_break_basic.result
deleted file mode 100644
index 70f338ad305..00000000000
--- a/mysql-test/suite/sys_vars/r/debug_crc_break_basic.result
+++ /dev/null
@@ -1,39 +0,0 @@
-SET @start_global_value = @@global.debug_crc_break;
-select @@global.debug_crc_break;
-@@global.debug_crc_break
-0
-select @@session.debug_crc_break;
-ERROR HY000: Variable 'debug_crc_break' is a GLOBAL variable
-show global variables like 'debug_crc_break';
-Variable_name Value
-debug_crc_break 0
-show session variables like 'debug_crc_break';
-Variable_name Value
-debug_crc_break 0
-select * from information_schema.global_variables where variable_name='debug_crc_break';
-VARIABLE_NAME VARIABLE_VALUE
-DEBUG_CRC_BREAK 0
-select * from information_schema.session_variables where variable_name='debug_crc_break';
-VARIABLE_NAME VARIABLE_VALUE
-DEBUG_CRC_BREAK 0
-set global debug_crc_break=1;
-select @@global.debug_crc_break;
-@@global.debug_crc_break
-1
-set session debug_crc_break=1;
-ERROR HY000: Variable 'debug_crc_break' is a GLOBAL variable and should be set with SET GLOBAL
-set global debug_crc_break=1.1;
-ERROR 42000: Incorrect argument type to variable 'debug_crc_break'
-set global debug_crc_break=1e1;
-ERROR 42000: Incorrect argument type to variable 'debug_crc_break'
-set global debug_crc_break="foo";
-ERROR 42000: Incorrect argument type to variable 'debug_crc_break'
-set global debug_crc_break=0;
-select @@global.debug_crc_break;
-@@global.debug_crc_break
-0
-set global debug_crc_break=cast(-1 as unsigned int);
-select @@global.debug_crc_break;
-@@global.debug_crc_break
-18446744073709551615
-SET @@global.debug_crc_break = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/r/innodb_buf_dump_status_frequency_basic.result b/mysql-test/suite/sys_vars/r/innodb_buf_dump_status_frequency_basic.result
new file mode 100644
index 00000000000..168509f466c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_buf_dump_status_frequency_basic.result
@@ -0,0 +1,42 @@
+SET @start_innodb_buf_dump_status_frequency = @@global.innodb_buf_dump_status_frequency;
+SELECT @start_innodb_buf_dump_status_frequency;
+@start_innodb_buf_dump_status_frequency
+0
+SELECT COUNT(@@global.innodb_buf_dump_status_frequency);
+COUNT(@@global.innodb_buf_dump_status_frequency)
+1
+SET @@global.innodb_buf_dump_status_frequency = 20;
+SELECT @@global.innodb_buf_dump_status_frequency;
+@@global.innodb_buf_dump_status_frequency
+20
+SET @@global.innodb_buf_dump_status_frequency = 0;
+SELECT @@global.innodb_buf_dump_status_frequency;
+@@global.innodb_buf_dump_status_frequency
+0
+SET @@global.innodb_buf_dump_status_frequency = 100;
+SELECT @@global.innodb_buf_dump_status_frequency;
+@@global.innodb_buf_dump_status_frequency
+100
+SET @@global.innodb_buf_dump_status_frequency = -1;
+Warnings:
+Warning 1292 Truncated incorrect innodb_buf_dump_status_frequency value: '-1'
+SELECT @@global.innodb_buf_dump_status_frequency;
+@@global.innodb_buf_dump_status_frequency
+0
+SET @@global.innodb_buf_dump_status_frequency = 101;
+Warnings:
+Warning 1292 Truncated incorrect innodb_buf_dump_status_frequency value: '101'
+SELECT @@global.innodb_buf_dump_status_frequency;
+@@global.innodb_buf_dump_status_frequency
+100
+SET @@global.innodb_buf_dump_status_frequency = 10.5;
+ERROR 42000: Incorrect argument type to variable 'innodb_buf_dump_status_frequency'
+SELECT @@global.innodb_buf_dump_status_frequency;
+@@global.innodb_buf_dump_status_frequency
+100
+SET @@global.innodb_buf_dump_status_frequency = "abc";
+ERROR 42000: Incorrect argument type to variable 'innodb_buf_dump_status_frequency'
+SELECT @@global.innodb_buf_dump_status_frequency;
+@@global.innodb_buf_dump_status_frequency
+100
+SET @@global.innodb_buf_dump_status_frequency = @start_innodb_buf_dump_status_frequency;
diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result
index d992695a7fe..6c7051dc3d0 100644
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result
@@ -215,6 +215,8 @@ innodb_log_flush_usec disabled
innodb_mem_validate_usec disabled
innodb_master_purge_usec disabled
innodb_dict_lru_usec disabled
+innodb_dict_lru_count_active disabled
+innodb_dict_lru_count_idle disabled
innodb_checkpoint_usec disabled
innodb_dblwr_writes disabled
innodb_dblwr_pages_written disabled
diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result
index d992695a7fe..6c7051dc3d0 100644
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result
@@ -215,6 +215,8 @@ innodb_log_flush_usec disabled
innodb_mem_validate_usec disabled
innodb_master_purge_usec disabled
innodb_dict_lru_usec disabled
+innodb_dict_lru_count_active disabled
+innodb_dict_lru_count_idle disabled
innodb_checkpoint_usec disabled
innodb_dblwr_writes disabled
innodb_dblwr_pages_written disabled
diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result
index d992695a7fe..6c7051dc3d0 100644
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result
@@ -215,6 +215,8 @@ innodb_log_flush_usec disabled
innodb_mem_validate_usec disabled
innodb_master_purge_usec disabled
innodb_dict_lru_usec disabled
+innodb_dict_lru_count_active disabled
+innodb_dict_lru_count_idle disabled
innodb_checkpoint_usec disabled
innodb_dblwr_writes disabled
innodb_dblwr_pages_written disabled
diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result
index d992695a7fe..6c7051dc3d0 100644
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result
@@ -215,6 +215,8 @@ innodb_log_flush_usec disabled
innodb_mem_validate_usec disabled
innodb_master_purge_usec disabled
innodb_dict_lru_usec disabled
+innodb_dict_lru_count_active disabled
+innodb_dict_lru_count_idle disabled
innodb_checkpoint_usec disabled
innodb_dblwr_writes disabled
innodb_dblwr_pages_written disabled
diff --git a/mysql-test/suite/sys_vars/r/join_buffer_size_basic.result b/mysql-test/suite/sys_vars/r/join_buffer_size_basic.result
index 2aa8b7dd80a..48131c96fce 100644
--- a/mysql-test/suite/sys_vars/r/join_buffer_size_basic.result
+++ b/mysql-test/suite/sys_vars/r/join_buffer_size_basic.result
@@ -1,20 +1,20 @@
SET @start_global_value = @@global.join_buffer_size;
SELECT @start_global_value;
@start_global_value
-131072
+262144
SET @start_session_value = @@session.join_buffer_size;
SELECT @start_session_value;
@start_session_value
-131072
+262144
'#--------------------FN_DYNVARS_053_01-------------------------#'
SET @@global.join_buffer_size = DEFAULT;
SELECT @@global.join_buffer_size;
@@global.join_buffer_size
-131072
+262144
SET @@session.join_buffer_size = DEFAULT;
SELECT @@session.join_buffer_size;
@@session.join_buffer_size
-131072
+262144
'#--------------------FN_DYNVARS_053_03-------------------------#'
SET @@global.join_buffer_size = 8200;
Warnings:
@@ -172,8 +172,8 @@ ERROR 42S22: Unknown column 'join_buffer_size' in 'field list'
SET @@global.join_buffer_size = @start_global_value;
SELECT @@global.join_buffer_size;
@@global.join_buffer_size
-131072
+262144
SET @@session.join_buffer_size = @start_session_value;
SELECT @@session.join_buffer_size;
@@session.join_buffer_size
-131072
+262144
diff --git a/mysql-test/suite/sys_vars/r/log_bin_basename_basic.result b/mysql-test/suite/sys_vars/r/log_bin_basename_basic.result
new file mode 100644
index 00000000000..696e384ac6e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/log_bin_basename_basic.result
@@ -0,0 +1,21 @@
+select @@global.log_bin_basename;
+@@global.log_bin_basename
+REPLACED
+select @@session.log_bin_basename;
+ERROR HY000: Variable 'log_bin_basename' is a GLOBAL variable
+show global variables like 'log_bin_basename';
+Variable_name Value
+log_bin_basename REPLACED
+show session variables like 'log_bin_basename';
+Variable_name Value
+log_bin_basename REPLACED
+select * from information_schema.global_variables where variable_name='log_bin_basename';
+VARIABLE_NAME VARIABLE_VALUE
+LOG_BIN_BASENAME REPLACED
+select * from information_schema.session_variables where variable_name='log_bin_basename';
+VARIABLE_NAME VARIABLE_VALUE
+LOG_BIN_BASENAME REPLACED
+set global log_bin_basename=1;
+ERROR HY000: Variable 'log_bin_basename' is a read only variable
+set session log_bin_basename=1;
+ERROR HY000: Variable 'log_bin_basename' is a read only variable
diff --git a/mysql-test/suite/sys_vars/r/log_bin_index_basic.result b/mysql-test/suite/sys_vars/r/log_bin_index_basic.result
new file mode 100644
index 00000000000..6b28f5fd3e3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/log_bin_index_basic.result
@@ -0,0 +1,21 @@
+select @@global.log_bin_index;
+@@global.log_bin_index
+REPLACED
+select @@session.log_bin_index;
+ERROR HY000: Variable 'log_bin_index' is a GLOBAL variable
+show global variables like 'log_bin_index';
+Variable_name Value
+log_bin_index REPLACED
+show session variables like 'log_bin_index';
+Variable_name Value
+log_bin_index REPLACED
+select * from information_schema.global_variables where variable_name='log_bin_index';
+VARIABLE_NAME VARIABLE_VALUE
+LOG_BIN_INDEX REPLACED
+select * from information_schema.session_variables where variable_name='log_bin_index';
+VARIABLE_NAME VARIABLE_VALUE
+LOG_BIN_INDEX REPLACED
+set global log_bin_index=1;
+ERROR HY000: Variable 'log_bin_index' is a read only variable
+set session log_bin_index=1;
+ERROR HY000: Variable 'log_bin_index' is a read only variable
diff --git a/mysql-test/suite/sys_vars/r/max_allowed_packet_basic.result b/mysql-test/suite/sys_vars/r/max_allowed_packet_basic.result
index ffa43415bd3..79708c480a8 100644
--- a/mysql-test/suite/sys_vars/r/max_allowed_packet_basic.result
+++ b/mysql-test/suite/sys_vars/r/max_allowed_packet_basic.result
@@ -1,7 +1,7 @@
SET @start_global_value = @@global.max_allowed_packet;
SELECT @start_global_value;
@start_global_value
-1048576
+4194304
SET @@global.max_allowed_packet = DEFAULT;
'#--------------------FN_DYNVARS_070_01-------------------------#'
SET @@global.max_allowed_packet = 1000;
@@ -11,19 +11,19 @@ Warning 1708 The value of 'max_allowed_packet' should be no less than the value
SET @@global.max_allowed_packet = DEFAULT;
SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet
-1048576
+4194304
SET @@session.max_allowed_packet = 20000;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SET @@session.max_allowed_packet = DEFAULT;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-1048576
+4194304
'#--------------------FN_DYNVARS_070_02-------------------------#'
SET @@global.max_allowed_packet = DEFAULT;
SELECT @@global.max_allowed_packet = 1048576;
@@global.max_allowed_packet = 1048576
-1
+0
'#--------------------FN_DYNVARS_070_03-------------------------#'
SET @@global.max_allowed_packet = 1024;
Warnings:
@@ -53,27 +53,27 @@ SET @@session.max_allowed_packet = 1024;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-1048576
+4194304
SET @@session.max_allowed_packet = 1025;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-1048576
+4194304
SET @@session.max_allowed_packet = 65535;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-1048576
+4194304
SET @@session.max_allowed_packet = 1073741824;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-1048576
+4194304
SET @@session.max_allowed_packet = 1073741823;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-1048576
+4194304
'#------------------FN_DYNVARS_070_05-----------------------#'
SET @@global.max_allowed_packet = 0;
Warnings:
@@ -116,29 +116,29 @@ SET @@session.max_allowed_packet = 0;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-1048576
+4194304
SET @@session.max_allowed_packet = 1023;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-1048576
+4194304
SET @@session.max_allowed_packet = -2;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-1048576
+4194304
SET @@session.max_allowed_packet = 65530.34;
ERROR 42000: Incorrect argument type to variable 'max_allowed_packet'
SET @@session.max_allowed_packet = 10737418241;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-1048576
+4194304
SET @@session.max_allowed_packet = test;
ERROR 42000: Incorrect argument type to variable 'max_allowed_packet'
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-1048576
+4194304
'#------------------FN_DYNVARS_070_06-----------------------#'
SELECT @@global.max_allowed_packet = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
@@ -187,7 +187,7 @@ SET max_allowed_packet = 1024;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@max_allowed_packet;
@@max_allowed_packet
-1048576
+4194304
SELECT local.max_allowed_packet;
ERROR 42S02: Unknown table 'local' in field list
SELECT session.max_allowed_packet;
@@ -197,7 +197,7 @@ ERROR 42S22: Unknown column 'max_allowed_packet' in 'field list'
SET @@global.max_allowed_packet = @start_global_value;
SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet
-1048576
+4194304
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-1048576
+4194304
diff --git a/mysql-test/suite/sys_vars/r/max_allowed_packet_func.result b/mysql-test/suite/sys_vars/r/max_allowed_packet_func.result
index 1e20776973c..1a848cbae4b 100644
--- a/mysql-test/suite/sys_vars/r/max_allowed_packet_func.result
+++ b/mysql-test/suite/sys_vars/r/max_allowed_packet_func.result
@@ -14,7 +14,7 @@ SET @@session.max_allowed_packet = 1024;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-1048576
+4194304
SET @@session.net_buffer_length = 1024;
ERROR HY000: SESSION variable 'net_buffer_length' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.net_buffer_length;
diff --git a/mysql-test/suite/sys_vars/r/max_user_connections_func.result b/mysql-test/suite/sys_vars/r/max_user_connections_func.result
index 04999a0a43f..4a71bf1b3f9 100644
--- a/mysql-test/suite/sys_vars/r/max_user_connections_func.result
+++ b/mysql-test/suite/sys_vars/r/max_user_connections_func.result
@@ -2,6 +2,7 @@
SET @default_max_user_connections = @@global.max_user_connections;
Set Global max_user_connections=2;
+CREATE USER test@localhost;
GRANT USAGE on *.* TO test@localhost;
'#--------------------FN_DYNVARS_114_01-------------------------#'
** Connecting conn1 using username 'test' **
diff --git a/mysql-test/suite/sys_vars/r/query_cache_limit_func.result b/mysql-test/suite/sys_vars/r/query_cache_limit_func.result
index bbbb273428a..8dde5c3603b 100644
--- a/mysql-test/suite/sys_vars/r/query_cache_limit_func.result
+++ b/mysql-test/suite/sys_vars/r/query_cache_limit_func.result
@@ -3,6 +3,8 @@
SET @global_query_cache_limit = @@global.query_cache_limit;
SET @global_query_cache_size = @@global.query_cache_size;
SET @global_query_cache_type = @@global.query_cache_type;
+SET GLOBAL query_cache_type= ON;
+SET LOCAL query_cache_type= ON;
** warnings **
DROP TABLE IF EXISTS t;
** creating table **
diff --git a/mysql-test/suite/sys_vars/r/query_cache_size_basic.result b/mysql-test/suite/sys_vars/r/query_cache_size_basic.result
index 319948deefa..ee959a45fa0 100644
--- a/mysql-test/suite/sys_vars/r/query_cache_size_basic.result
+++ b/mysql-test/suite/sys_vars/r/query_cache_size_basic.result
@@ -6,7 +6,7 @@ Warning 1292 Truncated incorrect query_cache_size value: '99'
SET @@global.query_cache_size = DEFAULT;
SELECT @@global.query_cache_size;
@@global.query_cache_size
-0
+1048576
'#---------------------FN_DYNVARS_133_02-------------------------#'
SET @@global.query_cache_size = @start_value;
SELECT @@global.query_cache_size = @start_value;
diff --git a/mysql-test/suite/sys_vars/r/query_cache_type_basic.result b/mysql-test/suite/sys_vars/r/query_cache_type_basic.result
index bb49d671840..dd59f503527 100644
--- a/mysql-test/suite/sys_vars/r/query_cache_type_basic.result
+++ b/mysql-test/suite/sys_vars/r/query_cache_type_basic.result
@@ -1,22 +1,22 @@
SET @global_start_value = @@global.query_cache_type;
SELECT @global_start_value;
@global_start_value
-ON
+OFF
SET @session_start_value = @@session.query_cache_type;
SELECT @session_start_value;
@session_start_value
-ON
+OFF
'#--------------------FN_DYNVARS_134_01------------------------#'
SET @@global.query_cache_type = 0;
SET @@global.query_cache_type = DEFAULT;
SELECT @@global.query_cache_type;
@@global.query_cache_type
-ON
+OFF
SET @@session.query_cache_type = 0;
SET @@session.query_cache_type = DEFAULT;
SELECT @@session.query_cache_type;
@@session.query_cache_type
-ON
+OFF
'#---------------------FN_DYNVARS_134_02-------------------------#'
SET @@global.query_cache_type = NULL;
ERROR 42000: Variable 'query_cache_type' can't be set to the value of 'NULL'
@@ -115,8 +115,8 @@ OFF
SET @@global.query_cache_type = @global_start_value;
SELECT @@global.query_cache_type;
@@global.query_cache_type
-ON
+OFF
SET @@session.query_cache_type = @session_start_value;
SELECT @@session.query_cache_type;
@@session.query_cache_type
-ON
+OFF
diff --git a/mysql-test/suite/sys_vars/r/query_cache_type_func.result b/mysql-test/suite/sys_vars/r/query_cache_type_func.result
index af121244572..c016f05e119 100644
--- a/mysql-test/suite/sys_vars/r/query_cache_type_func.result
+++ b/mysql-test/suite/sys_vars/r/query_cache_type_func.result
@@ -18,9 +18,12 @@ SET @@GLOBAL.query_cache_size = 65536;
SET @@query_cache_type = DEFAULT;
SELECT @@query_cache_type;
@@query_cache_type
-ON
-ON Expected
+OFF
+OFF Expected
+SET @@query_cache_type = ON;
+ERROR HY000: Query cache is globally disabled and you can't enable it only for this session
'#--------------------FN_DYNVARS_135_02-------------------------#'
+SET GLOBAL query_cache_type= ON;
SET @@query_cache_type = NULL;
ERROR 42000: Variable 'query_cache_type' can't be set to the value of 'NULL'
Expected error: Wrong value for variable
diff --git a/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result b/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result
index c4342f3bca8..5868bd597eb 100644
--- a/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result
+++ b/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result
@@ -7,6 +7,9 @@ SET @start_global_value = @@GLOBAL.query_cache_wlock_invalidate;
SET @start_session_value = @@SESSION.query_cache_wlock_invalidate;
SET @old_cache_size = @@GLOBAL.query_cache_size;
SET @old_cache_type = @@GLOBAL.query_cache_type;
+SET GLOBAL query_cache_type= ON;
+SET LOCAL query_cache_type= ON;
+SET LOCAL query_cache_type= ON;
CREATE TABLE t1(id int, value varchar(10));
INSERT INTO t1 VALUES(1, 'val1');
INSERT INTO t1 VALUES(2, 'val2');
diff --git a/mysql-test/suite/sys_vars/r/relay_log_basename_basic.result b/mysql-test/suite/sys_vars/r/relay_log_basename_basic.result
new file mode 100644
index 00000000000..10ad3711949
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/relay_log_basename_basic.result
@@ -0,0 +1,24 @@
+include/master-slave.inc
+[connection master]
+select @@global.relay_log_basename;
+@@global.relay_log_basename
+REPLACED
+select @@session.relay_log_basename;
+ERROR HY000: Variable 'relay_log_basename' is a GLOBAL variable
+show global variables like 'relay_log_basename';
+Variable_name Value
+relay_log_basename REPLACED
+show session variables like 'relay_log_basename';
+Variable_name Value
+relay_log_basename REPLACED
+select * from information_schema.global_variables where variable_name='relay_log_basename';
+VARIABLE_NAME VARIABLE_VALUE
+RELAY_LOG_BASENAME REPLACED
+select * from information_schema.session_variables where variable_name='relay_log_basename';
+VARIABLE_NAME VARIABLE_VALUE
+RELAY_LOG_BASENAME REPLACED
+set global relay_log_basename=1;
+ERROR HY000: Variable 'relay_log_basename' is a read only variable
+set session relay_log_basename=1;
+ERROR HY000: Variable 'relay_log_basename' is a read only variable
+include/rpl_end.inc
diff --git a/mysql-test/suite/sys_vars/r/relay_log_index_basic.result b/mysql-test/suite/sys_vars/r/relay_log_index_basic.result
index d0ceddc96fe..6d8eec9eb30 100644
--- a/mysql-test/suite/sys_vars/r/relay_log_index_basic.result
+++ b/mysql-test/suite/sys_vars/r/relay_log_index_basic.result
@@ -1,21 +1,45 @@
+include/master-slave.inc
+[connection master]
select @@global.relay_log_index;
@@global.relay_log_index
-mysqld-relay-bin.index
+MYSQLTEST_VARDIR/mysqld.1/data/master-relay-bin.index
select @@session.relay_log_index;
ERROR HY000: Variable 'relay_log_index' is a GLOBAL variable
show global variables like 'relay_log_index';
Variable_name Value
-relay_log_index mysqld-relay-bin.index
+relay_log_index MYSQLTEST_VARDIR/mysqld.1/data/master-relay-bin.index
show session variables like 'relay_log_index';
Variable_name Value
-relay_log_index mysqld-relay-bin.index
+relay_log_index MYSQLTEST_VARDIR/mysqld.1/data/master-relay-bin.index
select * from information_schema.global_variables where variable_name='relay_log_index';
VARIABLE_NAME VARIABLE_VALUE
-RELAY_LOG_INDEX mysqld-relay-bin.index
+RELAY_LOG_INDEX MYSQLTEST_VARDIR/mysqld.1/data/master-relay-bin.index
select * from information_schema.session_variables where variable_name='relay_log_index';
VARIABLE_NAME VARIABLE_VALUE
-RELAY_LOG_INDEX mysqld-relay-bin.index
+RELAY_LOG_INDEX MYSQLTEST_VARDIR/mysqld.1/data/master-relay-bin.index
set global relay_log_index=1;
ERROR HY000: Variable 'relay_log_index' is a read only variable
set session relay_log_index=1;
ERROR HY000: Variable 'relay_log_index' is a read only variable
+select @@global.relay_log_index;
+@@global.relay_log_index
+REPLACED
+select @@session.relay_log_index;
+ERROR HY000: Variable 'relay_log_index' is a GLOBAL variable
+show global variables like 'relay_log_index';
+Variable_name Value
+relay_log_index REPLACED
+show session variables like 'relay_log_index';
+Variable_name Value
+relay_log_index REPLACED
+select * from information_schema.global_variables where variable_name='relay_log_index';
+VARIABLE_NAME VARIABLE_VALUE
+RELAY_LOG_INDEX REPLACED
+select * from information_schema.session_variables where variable_name='relay_log_index';
+VARIABLE_NAME VARIABLE_VALUE
+RELAY_LOG_INDEX REPLACED
+set global relay_log_index=1;
+ERROR HY000: Variable 'relay_log_index' is a read only variable
+set session relay_log_index=1;
+ERROR HY000: Variable 'relay_log_index' is a read only variable
+include/rpl_end.inc
diff --git a/mysql-test/suite/sys_vars/r/secure_auth_basic.result b/mysql-test/suite/sys_vars/r/secure_auth_basic.result
index 9f12a1760a4..35f283de278 100644
--- a/mysql-test/suite/sys_vars/r/secure_auth_basic.result
+++ b/mysql-test/suite/sys_vars/r/secure_auth_basic.result
@@ -1,19 +1,19 @@
SET @global_start_value = @@global.secure_auth;
SELECT @global_start_value;
@global_start_value
-0
+1
'#--------------------FN_DYNVARS_143_01------------------------#'
SET @@global.secure_auth = 1;
SET @@global.secure_auth = DEFAULT;
SELECT @@global.secure_auth;
@@global.secure_auth
-0
+1
'#---------------------FN_DYNVARS_143_02-------------------------#'
SET secure_auth = 1;
ERROR HY000: Variable 'secure_auth' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@secure_auth;
@@secure_auth
-0
+1
SELECT global.secure_auth;
ERROR 42S02: Unknown table 'global' in field list
SET global secure_auth = 1;
@@ -102,4 +102,4 @@ SELECT @@global.secure_auth;
SET @@global.secure_auth = @global_start_value;
SELECT @@global.secure_auth;
@@global.secure_auth
-0
+1
diff --git a/mysql-test/suite/sys_vars/r/sql_mode_basic.result b/mysql-test/suite/sys_vars/r/sql_mode_basic.result
index c806fadc4ed..b3c76b12b64 100644
--- a/mysql-test/suite/sys_vars/r/sql_mode_basic.result
+++ b/mysql-test/suite/sys_vars/r/sql_mode_basic.result
@@ -1,22 +1,22 @@
SET @global_start_value = @@global.sql_mode;
SELECT @global_start_value;
@global_start_value
-
+NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
SET @session_start_value = @@session.sql_mode;
SELECT @session_start_value;
@session_start_value
-
+NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
'#--------------------FN_DYNVARS_152_01------------------------#'
SET @@global.sql_mode = ANSI;
SET @@global.sql_mode = DEFAULT;
SELECT @@global.sql_mode;
@@global.sql_mode
-
+NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
SET @@session.sql_mode = ANSI;
SET @@session.sql_mode = DEFAULT;
SELECT @@session.sql_mode;
@@session.sql_mode
-
+NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
'#---------------------FN_DYNVARS_152_02-------------------------#'
SET @@global.sql_mode = NULL;
ERROR 42000: Variable 'sql_mode' can't be set to the value of 'NULL'
@@ -420,8 +420,8 @@ ANSI_QUOTES
SET @@global.sql_mode = @global_start_value;
SELECT @@global.sql_mode;
@@global.sql_mode
-
+NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
SET @@session.sql_mode = @session_start_value;
SELECT @@session.sql_mode;
@@session.sql_mode
-
+NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
diff --git a/mysql-test/suite/sys_vars/r/sync_master_info_basic.result b/mysql-test/suite/sys_vars/r/sync_master_info_basic.result
index 940282f629a..ea8b7d7a483 100644
--- a/mysql-test/suite/sys_vars/r/sync_master_info_basic.result
+++ b/mysql-test/suite/sys_vars/r/sync_master_info_basic.result
@@ -1,24 +1,24 @@
SET @start_global_value = @@global.sync_master_info;
SELECT @start_global_value;
@start_global_value
-0
+10000
select @@global.sync_master_info;
@@global.sync_master_info
-0
+10000
select @@session.sync_master_info;
ERROR HY000: Variable 'sync_master_info' is a GLOBAL variable
show global variables like 'sync_master_info';
Variable_name Value
-sync_master_info 0
+sync_master_info 10000
show session variables like 'sync_master_info';
Variable_name Value
-sync_master_info 0
+sync_master_info 10000
select * from information_schema.global_variables where variable_name='sync_master_info';
VARIABLE_NAME VARIABLE_VALUE
-SYNC_MASTER_INFO 0
+SYNC_MASTER_INFO 10000
select * from information_schema.session_variables where variable_name='sync_master_info';
VARIABLE_NAME VARIABLE_VALUE
-SYNC_MASTER_INFO 0
+SYNC_MASTER_INFO 10000
set global sync_master_info=1;
select @@global.sync_master_info;
@@global.sync_master_info
@@ -45,4 +45,4 @@ select @@global.sync_master_info;
SET @@global.sync_master_info = @start_global_value;
SELECT @@global.sync_master_info;
@@global.sync_master_info
-0
+10000
diff --git a/mysql-test/suite/sys_vars/r/sync_relay_log_basic.result b/mysql-test/suite/sys_vars/r/sync_relay_log_basic.result
index a98fcbfe44c..5196f8ff2dc 100644
--- a/mysql-test/suite/sys_vars/r/sync_relay_log_basic.result
+++ b/mysql-test/suite/sys_vars/r/sync_relay_log_basic.result
@@ -1,24 +1,24 @@
SET @start_global_value = @@global.sync_relay_log;
SELECT @start_global_value;
@start_global_value
-0
+10000
select @@global.sync_relay_log;
@@global.sync_relay_log
-0
+10000
select @@session.sync_relay_log;
ERROR HY000: Variable 'sync_relay_log' is a GLOBAL variable
show global variables like 'sync_relay_log';
Variable_name Value
-sync_relay_log 0
+sync_relay_log 10000
show session variables like 'sync_relay_log';
Variable_name Value
-sync_relay_log 0
+sync_relay_log 10000
select * from information_schema.global_variables where variable_name='sync_relay_log';
VARIABLE_NAME VARIABLE_VALUE
-SYNC_RELAY_LOG 0
+SYNC_RELAY_LOG 10000
select * from information_schema.session_variables where variable_name='sync_relay_log';
VARIABLE_NAME VARIABLE_VALUE
-SYNC_RELAY_LOG 0
+SYNC_RELAY_LOG 10000
set global sync_relay_log=1;
select @@global.sync_relay_log;
@@global.sync_relay_log
@@ -45,4 +45,4 @@ select @@global.sync_relay_log;
SET @@global.sync_relay_log = @start_global_value;
SELECT @@global.sync_relay_log;
@@global.sync_relay_log
-0
+10000
diff --git a/mysql-test/suite/sys_vars/r/sync_relay_log_info_basic.result b/mysql-test/suite/sys_vars/r/sync_relay_log_info_basic.result
index 4900bf166b0..aa84affb7bb 100644
--- a/mysql-test/suite/sys_vars/r/sync_relay_log_info_basic.result
+++ b/mysql-test/suite/sys_vars/r/sync_relay_log_info_basic.result
@@ -1,24 +1,24 @@
SET @start_global_value = @@global.sync_relay_log_info;
SELECT @start_global_value;
@start_global_value
-0
+10000
select @@global.sync_relay_log_info;
@@global.sync_relay_log_info
-0
+10000
select @@session.sync_relay_log_info;
ERROR HY000: Variable 'sync_relay_log_info' is a GLOBAL variable
show global variables like 'sync_relay_log_info';
Variable_name Value
-sync_relay_log_info 0
+sync_relay_log_info 10000
show session variables like 'sync_relay_log_info';
Variable_name Value
-sync_relay_log_info 0
+sync_relay_log_info 10000
select * from information_schema.global_variables where variable_name='sync_relay_log_info';
VARIABLE_NAME VARIABLE_VALUE
-SYNC_RELAY_LOG_INFO 0
+SYNC_RELAY_LOG_INFO 10000
select * from information_schema.session_variables where variable_name='sync_relay_log_info';
VARIABLE_NAME VARIABLE_VALUE
-SYNC_RELAY_LOG_INFO 0
+SYNC_RELAY_LOG_INFO 10000
set global sync_relay_log_info=1;
select @@global.sync_relay_log_info;
@@global.sync_relay_log_info
@@ -45,4 +45,4 @@ select @@global.sync_relay_log_info;
SET @@global.sync_relay_log_info = @start_global_value;
SELECT @@global.sync_relay_log_info;
@@global.sync_relay_log_info
-0
+10000
diff --git a/mysql-test/suite/sys_vars/r/sysvars_debug.result b/mysql-test/suite/sys_vars/r/sysvars_debug.result
index a46e135af0a..f50e796bff4 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_debug.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_debug.result
@@ -29,20 +29,6 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
-VARIABLE_NAME DEBUG_CRC_BREAK
-SESSION_VALUE NULL
-GLOBAL_VALUE 0
-GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 0
-VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
-VARIABLE_COMMENT Call my_debug_put_break_here() if crc matches this number (for debug)
-NUMERIC_MIN_VALUE 0
-NUMERIC_MAX_VALUE 18446744073709551615
-NUMERIC_BLOCK_SIZE 1
-ENUM_VALUE_LIST NULL
-READ_ONLY NO
-COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME DEBUG_DBUG
SESSION_VALUE
GLOBAL_VALUE
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff
index 37f9060f1dd..a775ef28ef3 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff
@@ -108,7 +108,16 @@
VARIABLE_NAME INNODB_BUFFER_POOL_SIZE
SESSION_VALUE NULL
GLOBAL_VALUE 8388608
-@@ -418,7 +446,7 @@
+@@ -361,7 +389,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT A number between [0, 100] that tells how oftern buffer pool dump status in percentages should be printed. E.g. 10 means that buffer pool dump status is printed when every 10% of number of buffer pool pages are dumped. Default is 0 (only start and end status is printed).
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 100
+@@ -432,7 +460,7 @@
DEFAULT_VALUE ON
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
@@ -117,7 +126,7 @@
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-@@ -439,6 +467,104 @@
+@@ -453,6 +481,104 @@
ENUM_VALUE_LIST CRC32,STRICT_CRC32,INNODB,STRICT_INNODB,NONE,STRICT_NONE
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -222,7 +231,7 @@
VARIABLE_NAME INNODB_CMP_PER_INDEX_ENABLED
SESSION_VALUE NULL
GLOBAL_VALUE OFF
-@@ -459,7 +585,7 @@
+@@ -473,7 +599,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -231,7 +240,7 @@
VARIABLE_COMMENT Helps in performance tuning in heavily concurrent environments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1000
-@@ -487,7 +613,7 @@
+@@ -501,7 +627,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 5
VARIABLE_SCOPE GLOBAL
@@ -240,7 +249,7 @@
VARIABLE_COMMENT If the compression failure rate of a table is greater than this number more padding is added to the pages to reduce the failures. A value of zero implies no padding
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 100
-@@ -515,7 +641,7 @@
+@@ -529,7 +655,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 50
VARIABLE_SCOPE GLOBAL
@@ -249,7 +258,7 @@
VARIABLE_COMMENT Percentage of empty space on a data page that can be reserved to make the page compressible.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 75
-@@ -529,14 +655,28 @@
+@@ -543,14 +669,28 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 5000
VARIABLE_SCOPE GLOBAL
@@ -280,7 +289,7 @@
VARIABLE_NAME INNODB_DATA_FILE_PATH
SESSION_VALUE NULL
GLOBAL_VALUE ibdata1:12M:autoextend
-@@ -725,7 +865,7 @@
+@@ -739,7 +879,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 120
VARIABLE_SCOPE GLOBAL
@@ -289,7 +298,7 @@
VARIABLE_COMMENT Number of pages reserved in doublewrite buffer for batch flushing
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 127
-@@ -733,6 +873,20 @@
+@@ -747,6 +887,20 @@
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL
@@ -310,7 +319,7 @@
VARIABLE_NAME INNODB_ENCRYPTION_ROTATE_KEY_AGE
SESSION_VALUE NULL
GLOBAL_VALUE 1
-@@ -803,13 +957,27 @@
+@@ -817,13 +971,27 @@
ENUM_VALUE_LIST OFF,ON,FORCE
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
@@ -339,7 +348,7 @@
VARIABLE_COMMENT Speeds up the shutdown process of the InnoDB storage engine. Possible values are 0, 1 (faster) or 2 (fastest - crash-like).
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 2
-@@ -823,7 +991,7 @@
+@@ -837,7 +1005,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 600
VARIABLE_SCOPE GLOBAL
@@ -348,7 +357,7 @@
VARIABLE_COMMENT Maximum number of seconds that semaphore times out in InnoDB.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -893,7 +1061,7 @@
+@@ -907,7 +1075,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -357,7 +366,7 @@
VARIABLE_COMMENT Make the first page of the given tablespace dirty.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -907,7 +1075,7 @@
+@@ -921,7 +1089,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 30
VARIABLE_SCOPE GLOBAL
@@ -366,7 +375,7 @@
VARIABLE_COMMENT Number of iterations over which the background flushing is averaged.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1000
-@@ -930,12 +1098,12 @@
+@@ -944,12 +1112,12 @@
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_FLUSH_LOG_AT_TRX_COMMIT
@@ -382,7 +391,7 @@
VARIABLE_COMMENT Controls the durability/speed trade-off for commits. Set to 0 (write and flush redo log to disk only once per second), 1 (flush to disk at each commit), 2 (write to log at commit but flush to disk only once per second) or 3 (flush to disk at prepare and at commit, slower and usually redundant). 1 and 3 guarantees that after a crash, committed transactions will not be lost and will be consistent with the binlog and other transactional engines. 2 can get inconsistent and lose transactions if there is a power failure or kernel crash but not if mysqld crashes. 0 has no guarantees in case of crash. 0 and 2 can be faster than 1 or 3.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 3
-@@ -963,7 +1131,7 @@
+@@ -977,7 +1145,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
@@ -391,7 +400,7 @@
VARIABLE_COMMENT Set to 0 (don't flush neighbors from buffer pool), 1 (flush contiguous neighbors from buffer pool) or 2 (flush neighbors from buffer pool), when flushing a block
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 2
-@@ -1005,7 +1173,7 @@
+@@ -1019,7 +1187,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -400,7 +409,7 @@
VARIABLE_COMMENT Helps to save your data in case the disk image of the database becomes corrupt.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 6
-@@ -1019,7 +1187,7 @@
+@@ -1033,7 +1201,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -409,7 +418,7 @@
VARIABLE_COMMENT Kills the server during crash recovery.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 10
-@@ -1027,6 +1195,20 @@
+@@ -1041,6 +1209,20 @@
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
@@ -430,7 +439,7 @@
VARIABLE_NAME INNODB_FT_AUX_TABLE
SESSION_VALUE NULL
GLOBAL_VALUE
-@@ -1047,7 +1229,7 @@
+@@ -1061,7 +1243,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 8000000
VARIABLE_SCOPE GLOBAL
@@ -439,7 +448,7 @@
VARIABLE_COMMENT InnoDB Fulltext search cache size in bytes
NUMERIC_MIN_VALUE 1600000
NUMERIC_MAX_VALUE 80000000
-@@ -1089,7 +1271,7 @@
+@@ -1103,7 +1285,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 84
VARIABLE_SCOPE GLOBAL
@@ -448,7 +457,7 @@
VARIABLE_COMMENT InnoDB Fulltext search maximum token size in characters
NUMERIC_MIN_VALUE 10
NUMERIC_MAX_VALUE 84
-@@ -1103,7 +1285,7 @@
+@@ -1117,7 +1299,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 3
VARIABLE_SCOPE GLOBAL
@@ -457,7 +466,7 @@
VARIABLE_COMMENT InnoDB Fulltext search minimum token size in characters
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 16
-@@ -1117,7 +1299,7 @@
+@@ -1131,7 +1313,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 2000
VARIABLE_SCOPE GLOBAL
@@ -466,7 +475,7 @@
VARIABLE_COMMENT InnoDB Fulltext search number of words to optimize for each optimize table call
NUMERIC_MIN_VALUE 1000
NUMERIC_MAX_VALUE 10000
-@@ -1131,7 +1313,7 @@
+@@ -1145,7 +1327,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 2000000000
VARIABLE_SCOPE GLOBAL
@@ -475,7 +484,7 @@
VARIABLE_COMMENT InnoDB Fulltext search query result cache limit in bytes
NUMERIC_MIN_VALUE 1000000
NUMERIC_MAX_VALUE 4294967295
-@@ -1159,7 +1341,7 @@
+@@ -1173,7 +1355,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 2
VARIABLE_SCOPE GLOBAL
@@ -484,7 +493,7 @@
VARIABLE_COMMENT InnoDB Fulltext search parallel sort degree, will round up to nearest power of 2 number
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 16
-@@ -1173,7 +1355,7 @@
+@@ -1187,7 +1369,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 640000000
VARIABLE_SCOPE GLOBAL
@@ -493,7 +502,7 @@
VARIABLE_COMMENT Total memory allocated for InnoDB Fulltext Search cache
NUMERIC_MIN_VALUE 32000000
NUMERIC_MAX_VALUE 1600000000
-@@ -1201,7 +1383,7 @@
+@@ -1215,7 +1397,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 100
VARIABLE_SCOPE GLOBAL
@@ -502,7 +511,7 @@
VARIABLE_COMMENT Up to what percentage of dirty pages should be flushed when innodb finds it has spare resources to do so.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 100
-@@ -1243,10 +1425,10 @@
+@@ -1257,10 +1439,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 200
VARIABLE_SCOPE GLOBAL
@@ -515,7 +524,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1255,12 +1437,26 @@
+@@ -1269,12 +1451,26 @@
SESSION_VALUE NULL
GLOBAL_VALUE 2000
GLOBAL_VALUE_ORIGIN COMPILE-TIME
@@ -545,7 +554,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1293,6 +1489,20 @@
+@@ -1307,6 +1503,20 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -566,7 +575,7 @@
VARIABLE_NAME INNODB_LOCKS_UNSAFE_FOR_BINLOG
SESSION_VALUE NULL
GLOBAL_VALUE OFF
-@@ -1313,7 +1523,7 @@
+@@ -1327,7 +1537,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 50
VARIABLE_SCOPE SESSION
@@ -575,7 +584,7 @@
VARIABLE_COMMENT Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1073741824
-@@ -1321,39 +1531,109 @@
+@@ -1335,37 +1545,107 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -614,8 +623,7 @@
SESSION_VALUE NULL
-GLOBAL_VALUE OFF
+GLOBAL_VALUE PATH
- GLOBAL_VALUE_ORIGIN COMPILE-TIME
--DEFAULT_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE VARCHAR
@@ -699,12 +707,10 @@
+VARIABLE_NAME INNODB_LOG_COMPRESSED_PAGES
+SESSION_VALUE NULL
+GLOBAL_VALUE OFF
-+GLOBAL_VALUE_ORIGIN COMPILE-TIME
-+DEFAULT_VALUE OFF
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE OFF
VARIABLE_SCOPE GLOBAL
- VARIABLE_TYPE BOOLEAN
- VARIABLE_COMMENT Enables/disables the logging of entire compressed page images. InnoDB logs the compressed pages to prevent corruption if the zlib compression algorithm changes. When turned OFF, InnoDB will assume that the zlib compression algorithm doesn't change.
-@@ -1369,7 +1649,7 @@
+@@ -1383,7 +1663,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 2
VARIABLE_SCOPE GLOBAL
@@ -713,7 +719,7 @@
VARIABLE_COMMENT Number of log files in the log group. InnoDB writes to the files in a circular fashion.
NUMERIC_MIN_VALUE 2
NUMERIC_MAX_VALUE 100
-@@ -1411,9 +1691,37 @@
+@@ -1425,9 +1705,37 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 1024
VARIABLE_SCOPE GLOBAL
@@ -752,7 +758,7 @@
NUMERIC_MAX_VALUE 18446744073709551615
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
-@@ -1453,10 +1761,10 @@
+@@ -1467,10 +1775,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -765,7 +771,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1467,7 +1775,7 @@
+@@ -1481,7 +1789,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -774,7 +780,7 @@
VARIABLE_COMMENT Maximum delay of user threads in micro-seconds
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 10000000
-@@ -1481,7 +1789,7 @@
+@@ -1495,7 +1803,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -783,7 +789,7 @@
VARIABLE_COMMENT Number of identical copies of log groups we keep for the database. Currently this should be set to 1.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 10
-@@ -1551,7 +1859,7 @@
+@@ -1565,7 +1873,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 8
VARIABLE_SCOPE GLOBAL
@@ -792,7 +798,7 @@
VARIABLE_COMMENT Number of multi-threaded flush threads
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 64
-@@ -1607,10 +1915,10 @@
+@@ -1621,10 +1929,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -805,7 +811,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY YES
-@@ -1635,7 +1943,7 @@
+@@ -1649,7 +1957,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 16
VARIABLE_SCOPE GLOBAL
@@ -814,7 +820,7 @@
VARIABLE_COMMENT Number of rw_locks protecting buffer pool page_hash. Rounded up to the next power of 2
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1024
-@@ -1649,7 +1957,7 @@
+@@ -1663,7 +1971,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 16384
VARIABLE_SCOPE GLOBAL
@@ -823,7 +829,7 @@
VARIABLE_COMMENT Page size to use for all InnoDB tablespaces.
NUMERIC_MIN_VALUE 4096
NUMERIC_MAX_VALUE 65536
-@@ -1685,13 +1993,69 @@
+@@ -1699,13 +2007,69 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
@@ -894,7 +900,7 @@
VARIABLE_COMMENT Number of UNDO log pages to purge in one batch from the history list.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 5000
-@@ -1733,7 +2097,7 @@
+@@ -1747,7 +2111,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
@@ -903,7 +909,7 @@
VARIABLE_COMMENT Purge threads can be from 1 to 32. Default is 1.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 32
-@@ -1761,7 +2125,7 @@
+@@ -1775,7 +2139,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 56
VARIABLE_SCOPE GLOBAL
@@ -912,7 +918,7 @@
VARIABLE_COMMENT Number of pages that must be accessed sequentially for InnoDB to trigger a readahead.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 64
-@@ -1775,7 +2139,7 @@
+@@ -1789,7 +2153,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 4
VARIABLE_SCOPE GLOBAL
@@ -921,7 +927,7 @@
VARIABLE_COMMENT Number of background read I/O threads in InnoDB.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 64
-@@ -1803,10 +2167,10 @@
+@@ -1817,10 +2181,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -934,7 +940,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1831,7 +2195,7 @@
+@@ -1845,7 +2209,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 128
VARIABLE_SCOPE GLOBAL
@@ -943,7 +949,7 @@
VARIABLE_COMMENT Number of undo logs to use (deprecated).
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 128
-@@ -1845,7 +2209,7 @@
+@@ -1859,7 +2223,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -952,7 +958,7 @@
VARIABLE_COMMENT An InnoDB page number.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -1853,6 +2217,48 @@
+@@ -1867,6 +2231,48 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
@@ -1001,7 +1007,7 @@
VARIABLE_NAME INNODB_SCRUB_LOG
SESSION_VALUE NULL
GLOBAL_VALUE OFF
-@@ -1881,6 +2287,34 @@
+@@ -1895,6 +2301,34 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
@@ -1036,7 +1042,7 @@
VARIABLE_NAME INNODB_SIMULATE_COMP_FAILURES
SESSION_VALUE NULL
GLOBAL_VALUE 0
-@@ -1901,7 +2335,7 @@
+@@ -1915,7 +2349,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1048576
VARIABLE_SCOPE GLOBAL
@@ -1045,7 +1051,7 @@
VARIABLE_COMMENT Memory buffer size for index creation
NUMERIC_MIN_VALUE 65536
NUMERIC_MAX_VALUE 67108864
-@@ -1915,10 +2349,10 @@
+@@ -1929,10 +2363,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 6
VARIABLE_SCOPE GLOBAL
@@ -1058,7 +1064,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1944,7 +2378,7 @@
+@@ -1958,7 +2392,7 @@
DEFAULT_VALUE nulls_equal
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE ENUM
@@ -1067,7 +1073,7 @@
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-@@ -2111,7 +2545,7 @@
+@@ -2125,7 +2559,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
@@ -1076,7 +1082,7 @@
VARIABLE_COMMENT Size of the mutex/lock wait array.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1024
-@@ -2125,10 +2559,10 @@
+@@ -2139,10 +2573,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 30
VARIABLE_SCOPE GLOBAL
@@ -1089,7 +1095,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -2153,7 +2587,7 @@
+@@ -2167,7 +2601,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -1098,7 +1104,7 @@
VARIABLE_COMMENT Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1000
-@@ -2167,7 +2601,7 @@
+@@ -2181,7 +2615,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 10000
VARIABLE_SCOPE GLOBAL
@@ -1107,7 +1113,7 @@
VARIABLE_COMMENT Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1000000
-@@ -2175,6 +2609,34 @@
+@@ -2189,6 +2623,34 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -1142,7 +1148,7 @@
VARIABLE_NAME INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG
SESSION_VALUE NULL
GLOBAL_VALUE OFF
-@@ -2223,7 +2685,7 @@
+@@ -2237,7 +2699,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 128
VARIABLE_SCOPE GLOBAL
@@ -1151,7 +1157,7 @@
VARIABLE_COMMENT Number of undo logs to use.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 128
-@@ -2237,7 +2699,7 @@
+@@ -2251,7 +2713,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -1160,7 +1166,7 @@
VARIABLE_COMMENT Number of undo tablespaces to use.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 126
-@@ -2252,7 +2714,7 @@
+@@ -2266,7 +2728,7 @@
DEFAULT_VALUE OFF
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
@@ -1169,7 +1175,7 @@
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-@@ -2273,6 +2735,20 @@
+@@ -2287,6 +2749,20 @@
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT NONE
@@ -1190,7 +1196,7 @@
VARIABLE_NAME INNODB_USE_MTFLUSH
SESSION_VALUE NULL
GLOBAL_VALUE OFF
-@@ -2287,6 +2763,20 @@
+@@ -2301,6 +2777,20 @@
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT NONE
@@ -1211,12 +1217,12 @@
VARIABLE_NAME INNODB_USE_SYS_MALLOC
SESSION_VALUE NULL
GLOBAL_VALUE ON
-@@ -2317,12 +2807,12 @@
+@@ -2331,12 +2821,12 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
--GLOBAL_VALUE 5.6.24
-+GLOBAL_VALUE 5.6.23-72.1
+-GLOBAL_VALUE 5.6.26
++GLOBAL_VALUE 5.6.25-73.1
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL
@@ -1226,7 +1232,7 @@
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-@@ -2335,7 +2825,7 @@
+@@ -2349,7 +2839,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 4
VARIABLE_SCOPE GLOBAL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
index 29c8bdc3192..85f8e9c354e 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
@@ -1,5 +1,5 @@
---- sysvars_innodb.result 2015-01-09 16:00:06.000000000 +0100
-+++ sysvars_innodb,32bit.result 2015-01-09 17:32:17.000000000 +0100
+--- suite/sys_vars/r/sysvars_innodb.result
++++ suite/sys_vars/r/sysvars_innodb,32bit.reject
@@ -53,7 +53,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 150000
@@ -67,7 +67,16 @@
VARIABLE_COMMENT Number of buffer pool instances, set to higher value on high-end machines to increase scalability
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 64
-@@ -459,7 +459,7 @@
+@@ -361,7 +361,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT A number between [0, 100] that tells how oftern buffer pool dump status in percentages should be printed. E.g. 10 means that buffer pool dump status is printed when every 10% of number of buffer pool pages are dumped. Default is 0 (only start and end status is printed).
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 100
+@@ -473,7 +473,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -76,7 +85,7 @@
VARIABLE_COMMENT Helps in performance tuning in heavily concurrent environments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1000
-@@ -487,7 +487,7 @@
+@@ -501,7 +501,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 5
VARIABLE_SCOPE GLOBAL
@@ -85,7 +94,7 @@
VARIABLE_COMMENT If the compression failure rate of a table is greater than this number more padding is added to the pages to reduce the failures. A value of zero implies no padding
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 100
-@@ -515,7 +515,7 @@
+@@ -529,7 +529,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 50
VARIABLE_SCOPE GLOBAL
@@ -94,7 +103,7 @@
VARIABLE_COMMENT Percentage of empty space on a data page that can be reserved to make the page compressible.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 75
-@@ -529,10 +529,10 @@
+@@ -543,10 +543,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 5000
VARIABLE_SCOPE GLOBAL
@@ -107,7 +116,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -697,7 +697,7 @@
+@@ -739,7 +739,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 120
VARIABLE_SCOPE GLOBAL
@@ -116,7 +125,7 @@
VARIABLE_COMMENT Number of pages reserved in doublewrite buffer for batch flushing
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 127
-@@ -781,7 +781,7 @@
+@@ -823,7 +823,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
@@ -125,7 +134,7 @@
VARIABLE_COMMENT Speeds up the shutdown process of the InnoDB storage engine. Possible values are 0, 1 (faster) or 2 (fastest - crash-like).
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 2
-@@ -795,7 +795,7 @@
+@@ -837,7 +837,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 600
VARIABLE_SCOPE GLOBAL
@@ -134,7 +143,7 @@
VARIABLE_COMMENT Maximum number of seconds that semaphore times out in InnoDB.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -865,7 +865,7 @@
+@@ -907,7 +907,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -143,7 +152,7 @@
VARIABLE_COMMENT Make the first page of the given tablespace dirty.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -879,7 +879,7 @@
+@@ -921,7 +921,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 30
VARIABLE_SCOPE GLOBAL
@@ -152,7 +161,7 @@
VARIABLE_COMMENT Number of iterations over which the background flushing is averaged.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1000
-@@ -907,7 +907,7 @@
+@@ -949,7 +949,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
@@ -161,7 +170,7 @@
VARIABLE_COMMENT Controls the durability/speed trade-off for commits. Set to 0 (write and flush redo log to disk only once per second), 1 (flush to disk at each commit), 2 (write to log at commit but flush to disk only once per second) or 3 (flush to disk at prepare and at commit, slower and usually redundant). 1 and 3 guarantees that after a crash, committed transactions will not be lost and will be consistent with the binlog and other transactional engines. 2 can get inconsistent and lose transactions if there is a power failure or kernel crash but not if mysqld crashes. 0 has no guarantees in case of crash. 0 and 2 can be faster than 1 or 3.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 3
-@@ -935,7 +935,7 @@
+@@ -977,7 +977,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
@@ -170,7 +179,7 @@
VARIABLE_COMMENT Set to 0 (don't flush neighbors from buffer pool), 1 (flush contiguous neighbors from buffer pool) or 2 (flush neighbors from buffer pool), when flushing a block
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 2
-@@ -977,7 +977,7 @@
+@@ -1019,7 +1019,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -179,7 +188,7 @@
VARIABLE_COMMENT Helps to save your data in case the disk image of the database becomes corrupt.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 6
-@@ -991,7 +991,7 @@
+@@ -1033,7 +1033,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -188,7 +197,7 @@
VARIABLE_COMMENT Kills the server during crash recovery.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 10
-@@ -1019,7 +1019,7 @@
+@@ -1061,7 +1061,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 8000000
VARIABLE_SCOPE GLOBAL
@@ -197,7 +206,7 @@
VARIABLE_COMMENT InnoDB Fulltext search cache size in bytes
NUMERIC_MIN_VALUE 1600000
NUMERIC_MAX_VALUE 80000000
-@@ -1061,7 +1061,7 @@
+@@ -1103,7 +1103,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 84
VARIABLE_SCOPE GLOBAL
@@ -206,7 +215,7 @@
VARIABLE_COMMENT InnoDB Fulltext search maximum token size in characters
NUMERIC_MIN_VALUE 10
NUMERIC_MAX_VALUE 84
-@@ -1075,7 +1075,7 @@
+@@ -1117,7 +1117,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 3
VARIABLE_SCOPE GLOBAL
@@ -215,7 +224,7 @@
VARIABLE_COMMENT InnoDB Fulltext search minimum token size in characters
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 16
-@@ -1089,7 +1089,7 @@
+@@ -1131,7 +1131,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 2000
VARIABLE_SCOPE GLOBAL
@@ -224,7 +233,7 @@
VARIABLE_COMMENT InnoDB Fulltext search number of words to optimize for each optimize table call
NUMERIC_MIN_VALUE 1000
NUMERIC_MAX_VALUE 10000
-@@ -1103,7 +1103,7 @@
+@@ -1145,7 +1145,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 2000000000
VARIABLE_SCOPE GLOBAL
@@ -233,7 +242,7 @@
VARIABLE_COMMENT InnoDB Fulltext search query result cache limit in bytes
NUMERIC_MIN_VALUE 1000000
NUMERIC_MAX_VALUE 4294967295
-@@ -1131,7 +1131,7 @@
+@@ -1173,7 +1173,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 2
VARIABLE_SCOPE GLOBAL
@@ -242,7 +251,7 @@
VARIABLE_COMMENT InnoDB Fulltext search parallel sort degree, will round up to nearest power of 2 number
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 16
-@@ -1145,7 +1145,7 @@
+@@ -1187,7 +1187,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 640000000
VARIABLE_SCOPE GLOBAL
@@ -251,7 +260,7 @@
VARIABLE_COMMENT Total memory allocated for InnoDB Fulltext Search cache
NUMERIC_MIN_VALUE 32000000
NUMERIC_MAX_VALUE 1600000000
-@@ -1173,7 +1173,7 @@
+@@ -1215,7 +1215,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 100
VARIABLE_SCOPE GLOBAL
@@ -260,7 +269,7 @@
VARIABLE_COMMENT Up to what percentage of dirty pages should be flushed when innodb finds it has spare resources to do so.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 100
-@@ -1201,10 +1201,10 @@
+@@ -1257,10 +1257,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 200
VARIABLE_SCOPE GLOBAL
@@ -273,7 +282,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1213,12 +1213,12 @@
+@@ -1269,12 +1269,12 @@
SESSION_VALUE NULL
GLOBAL_VALUE 2000
GLOBAL_VALUE_ORIGIN COMPILE-TIME
@@ -289,7 +298,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1271,7 +1271,7 @@
+@@ -1327,7 +1327,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 50
VARIABLE_SCOPE SESSION
@@ -298,7 +307,7 @@
VARIABLE_COMMENT Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1073741824
-@@ -1285,10 +1285,10 @@
+@@ -1341,10 +1341,10 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 8388608
VARIABLE_SCOPE GLOBAL
@@ -311,7 +320,7 @@
NUMERIC_BLOCK_SIZE 1024
ENUM_VALUE_LIST NULL
READ_ONLY YES
-@@ -1327,7 +1327,7 @@
+@@ -1383,7 +1383,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 2
VARIABLE_SCOPE GLOBAL
@@ -320,7 +329,7 @@
VARIABLE_COMMENT Number of log files in the log group. InnoDB writes to the files in a circular fashion.
NUMERIC_MIN_VALUE 2
NUMERIC_MAX_VALUE 100
-@@ -1369,10 +1369,10 @@
+@@ -1425,10 +1425,10 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 1024
VARIABLE_SCOPE GLOBAL
@@ -333,7 +342,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1411,10 +1411,10 @@
+@@ -1467,10 +1467,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -346,7 +355,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1425,7 +1425,7 @@
+@@ -1481,7 +1481,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -355,7 +364,7 @@
VARIABLE_COMMENT Maximum delay of user threads in micro-seconds
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 10000000
-@@ -1439,7 +1439,7 @@
+@@ -1495,7 +1495,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -364,7 +373,7 @@
VARIABLE_COMMENT Number of identical copies of log groups we keep for the database. Currently this should be set to 1.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 10
-@@ -1509,7 +1509,7 @@
+@@ -1565,7 +1565,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 8
VARIABLE_SCOPE GLOBAL
@@ -373,7 +382,7 @@
VARIABLE_COMMENT Number of multi-threaded flush threads
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 64
-@@ -1565,10 +1565,10 @@
+@@ -1621,10 +1621,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -386,7 +395,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY YES
-@@ -1593,7 +1593,7 @@
+@@ -1649,7 +1649,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 16
VARIABLE_SCOPE GLOBAL
@@ -395,7 +404,7 @@
VARIABLE_COMMENT Number of rw_locks protecting buffer pool page_hash. Rounded up to the next power of 2
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1024
-@@ -1607,7 +1607,7 @@
+@@ -1663,7 +1663,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 16384
VARIABLE_SCOPE GLOBAL
@@ -404,7 +413,7 @@
VARIABLE_COMMENT Page size to use for all InnoDB tablespaces.
NUMERIC_MIN_VALUE 4096
NUMERIC_MAX_VALUE 65536
-@@ -1649,7 +1649,7 @@
+@@ -1705,7 +1705,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 300
VARIABLE_SCOPE GLOBAL
@@ -413,7 +422,7 @@
VARIABLE_COMMENT Number of UNDO log pages to purge in one batch from the history list.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 5000
-@@ -1691,7 +1691,7 @@
+@@ -1747,7 +1747,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
@@ -422,7 +431,7 @@
VARIABLE_COMMENT Purge threads can be from 1 to 32. Default is 1.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 32
-@@ -1719,7 +1719,7 @@
+@@ -1775,7 +1775,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 56
VARIABLE_SCOPE GLOBAL
@@ -431,7 +440,7 @@
VARIABLE_COMMENT Number of pages that must be accessed sequentially for InnoDB to trigger a readahead.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 64
-@@ -1733,7 +1733,7 @@
+@@ -1789,7 +1789,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 4
VARIABLE_SCOPE GLOBAL
@@ -440,7 +449,7 @@
VARIABLE_COMMENT Number of background read I/O threads in InnoDB.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 64
-@@ -1761,10 +1761,10 @@
+@@ -1817,10 +1817,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -453,7 +462,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1789,7 +1789,7 @@
+@@ -1845,7 +1845,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 128
VARIABLE_SCOPE GLOBAL
@@ -462,7 +471,7 @@
VARIABLE_COMMENT Number of undo logs to use (deprecated).
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 128
-@@ -1803,7 +1803,7 @@
+@@ -1859,7 +1859,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -471,7 +480,7 @@
VARIABLE_COMMENT An InnoDB page number.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -1873,7 +1873,7 @@
+@@ -1915,7 +1915,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1048576
VARIABLE_SCOPE GLOBAL
@@ -480,7 +489,7 @@
VARIABLE_COMMENT Memory buffer size for index creation
NUMERIC_MIN_VALUE 65536
NUMERIC_MAX_VALUE 67108864
-@@ -1887,10 +1887,10 @@
+@@ -1929,10 +1929,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 6
VARIABLE_SCOPE GLOBAL
@@ -493,7 +502,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -2083,7 +2083,7 @@
+@@ -2125,7 +2125,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
@@ -502,7 +511,7 @@
VARIABLE_COMMENT Size of the mutex/lock wait array.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1024
-@@ -2097,10 +2097,10 @@
+@@ -2139,10 +2139,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 30
VARIABLE_SCOPE GLOBAL
@@ -515,7 +524,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -2125,7 +2125,7 @@
+@@ -2167,7 +2167,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -524,7 +533,7 @@
VARIABLE_COMMENT Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1000
-@@ -2139,7 +2139,7 @@
+@@ -2181,7 +2181,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 10000
VARIABLE_SCOPE GLOBAL
@@ -533,7 +542,7 @@
VARIABLE_COMMENT Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1000000
-@@ -2195,7 +2195,7 @@
+@@ -2237,7 +2237,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 128
VARIABLE_SCOPE GLOBAL
@@ -542,7 +551,7 @@
VARIABLE_COMMENT Number of undo logs to use.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 128
-@@ -2209,7 +2209,7 @@
+@@ -2251,7 +2251,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -551,7 +560,7 @@
VARIABLE_COMMENT Number of undo tablespaces to use.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 126
-@@ -2307,7 +2307,7 @@
+@@ -2349,7 +2349,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 4
VARIABLE_SCOPE GLOBAL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff
index 6124273537e..2d3a7c07467 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff
@@ -42,7 +42,7 @@
VARIABLE_NAME INNODB_BUFFER_POOL_SIZE
SESSION_VALUE NULL
GLOBAL_VALUE 8388608
-@@ -418,7 +446,7 @@
+@@ -432,7 +460,7 @@
DEFAULT_VALUE ON
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
@@ -51,7 +51,7 @@
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-@@ -439,6 +467,104 @@
+@@ -453,6 +481,104 @@
ENUM_VALUE_LIST CRC32,STRICT_CRC32,INNODB,STRICT_INNODB,NONE,STRICT_NONE
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -156,7 +156,7 @@
VARIABLE_NAME INNODB_CMP_PER_INDEX_ENABLED
SESSION_VALUE NULL
GLOBAL_VALUE OFF
-@@ -537,6 +663,20 @@
+@@ -551,6 +677,20 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -177,7 +177,7 @@
VARIABLE_NAME INNODB_DATA_FILE_PATH
SESSION_VALUE NULL
GLOBAL_VALUE ibdata1:12M:autoextend
-@@ -733,6 +873,20 @@
+@@ -747,6 +887,20 @@
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL
@@ -198,7 +198,7 @@
VARIABLE_NAME INNODB_ENCRYPTION_ROTATE_KEY_AGE
SESSION_VALUE NULL
GLOBAL_VALUE 1
-@@ -803,6 +957,20 @@
+@@ -817,6 +971,20 @@
ENUM_VALUE_LIST OFF,ON,FORCE
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
@@ -219,7 +219,7 @@
VARIABLE_NAME INNODB_FAST_SHUTDOWN
SESSION_VALUE NULL
GLOBAL_VALUE 1
-@@ -930,11 +1098,11 @@
+@@ -944,11 +1112,11 @@
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_FLUSH_LOG_AT_TRX_COMMIT
@@ -233,7 +233,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Controls the durability/speed trade-off for commits. Set to 0 (write and flush redo log to disk only once per second), 1 (flush to disk at each commit), 2 (write to log at commit but flush to disk only once per second) or 3 (flush to disk at prepare and at commit, slower and usually redundant). 1 and 3 guarantees that after a crash, committed transactions will not be lost and will be consistent with the binlog and other transactional engines. 2 can get inconsistent and lose transactions if there is a power failure or kernel crash but not if mysqld crashes. 0 has no guarantees in case of crash. 0 and 2 can be faster than 1 or 3.
NUMERIC_MIN_VALUE 0
-@@ -1027,6 +1195,20 @@
+@@ -1041,6 +1209,20 @@
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
@@ -254,7 +254,7 @@
VARIABLE_NAME INNODB_FT_AUX_TABLE
SESSION_VALUE NULL
GLOBAL_VALUE
-@@ -1265,6 +1447,20 @@
+@@ -1279,6 +1461,20 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -275,7 +275,7 @@
VARIABLE_NAME INNODB_LARGE_PREFIX
SESSION_VALUE NULL
GLOBAL_VALUE OFF
-@@ -1293,6 +1489,20 @@
+@@ -1307,6 +1503,20 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -296,7 +296,7 @@
VARIABLE_NAME INNODB_LOCKS_UNSAFE_FOR_BINLOG
SESSION_VALUE NULL
GLOBAL_VALUE OFF
-@@ -1321,6 +1531,62 @@
+@@ -1335,6 +1545,62 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -359,7 +359,7 @@
VARIABLE_NAME INNODB_LOG_BUFFER_SIZE
SESSION_VALUE NULL
GLOBAL_VALUE 1048576
-@@ -1349,6 +1615,20 @@
+@@ -1363,6 +1629,20 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
@@ -380,7 +380,7 @@
VARIABLE_NAME INNODB_LOG_COMPRESSED_PAGES
SESSION_VALUE NULL
GLOBAL_VALUE OFF
-@@ -1419,6 +1699,34 @@
+@@ -1433,6 +1713,34 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -415,7 +415,7 @@
VARIABLE_NAME INNODB_MAX_DIRTY_PAGES_PCT
SESSION_VALUE NULL
GLOBAL_VALUE 75.000000
-@@ -1685,6 +1993,62 @@
+@@ -1699,6 +2007,62 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
@@ -478,7 +478,7 @@
VARIABLE_NAME INNODB_PURGE_BATCH_SIZE
SESSION_VALUE NULL
GLOBAL_VALUE 300
-@@ -1853,6 +2217,48 @@
+@@ -1867,6 +2231,48 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
@@ -527,7 +527,7 @@
VARIABLE_NAME INNODB_SCRUB_LOG
SESSION_VALUE NULL
GLOBAL_VALUE OFF
-@@ -1881,6 +2287,34 @@
+@@ -1895,6 +2301,34 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
@@ -562,7 +562,7 @@
VARIABLE_NAME INNODB_SIMULATE_COMP_FAILURES
SESSION_VALUE NULL
GLOBAL_VALUE 0
-@@ -1944,7 +2378,7 @@
+@@ -1958,7 +2392,7 @@
DEFAULT_VALUE nulls_equal
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE ENUM
@@ -571,7 +571,7 @@
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-@@ -2175,6 +2609,34 @@
+@@ -2189,6 +2623,34 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -606,7 +606,7 @@
VARIABLE_NAME INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG
SESSION_VALUE NULL
GLOBAL_VALUE OFF
-@@ -2252,7 +2714,7 @@
+@@ -2266,7 +2728,7 @@
DEFAULT_VALUE OFF
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
@@ -615,7 +615,7 @@
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-@@ -2273,6 +2735,20 @@
+@@ -2287,6 +2749,20 @@
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT NONE
@@ -636,7 +636,7 @@
VARIABLE_NAME INNODB_USE_MTFLUSH
SESSION_VALUE NULL
GLOBAL_VALUE OFF
-@@ -2287,6 +2763,20 @@
+@@ -2301,6 +2777,20 @@
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT NONE
@@ -657,12 +657,12 @@
VARIABLE_NAME INNODB_USE_SYS_MALLOC
SESSION_VALUE NULL
GLOBAL_VALUE ON
-@@ -2317,12 +2807,12 @@
+@@ -2331,12 +2821,12 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
--GLOBAL_VALUE 5.6.24
-+GLOBAL_VALUE 5.6.23-72.1
+-GLOBAL_VALUE 5.6.26
++GLOBAL_VALUE 5.6.25-73.1
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
index 927cd0599e0..1d7d52239ba 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
@@ -355,6 +355,20 @@ NUMERIC_BLOCK_SIZE 1048576
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME INNODB_BUF_DUMP_STATUS_FREQUENCY
+SESSION_VALUE NULL
+GLOBAL_VALUE 0
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE 0
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_COMMENT A number between [0, 100] that tells how oftern buffer pool dump status in percentages should be printed. E.g. 10 means that buffer pool dump status is printed when every 10% of number of buffer pool pages are dumped. Default is 0 (only start and end status is printed).
+NUMERIC_MIN_VALUE 0
+NUMERIC_MAX_VALUE 100
+NUMERIC_BLOCK_SIZE 0
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_BUF_FLUSH_LIST_NOW
SESSION_VALUE NULL
GLOBAL_VALUE OFF
@@ -1603,7 +1617,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_OPEN_FILES
SESSION_VALUE NULL
-GLOBAL_VALUE 400
+GLOBAL_VALUE 2000
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -2317,7 +2331,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
-GLOBAL_VALUE 5.6.24
+GLOBAL_VALUE 5.6.26
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff
index 654c7eafd16..170989d9fa0 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff
@@ -1,5 +1,5 @@
---- ../../mysql-test/suite/sys_vars/r/sysvars_server_embedded.result 2015-06-03 00:15:21.000000000 +0200
-+++ ../../mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.reject 2015-06-03 09:12:40.000000000 +0200
+--- suite/sys_vars/r/sysvars_server_embedded.result 2015-09-04 13:17:44.407031503 +0000
++++ suite/sys_vars/r/sysvars_server_embedded,32bit.reject 2015-09-04 13:39:45.098389360 +0000
@@ -57,7 +57,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 1
@@ -19,13 +19,13 @@
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 65535
@@ -85,7 +85,7 @@
- GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE 150
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
- VARIABLE_COMMENT The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time
- NUMERIC_MIN_VALUE 1
+ VARIABLE_COMMENT The number of outstanding connection requests MariaDB can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time
+ NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 65535
@@ -144,7 +144,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
@@ -62,7 +62,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -242,7 +242,7 @@
+@@ -256,7 +256,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The size of the statement cache for updates to non-transactional engines for the binary log. If you often use statements updating a great number of rows, you can increase this to get more performance
NUMERIC_MIN_VALUE 4096
@@ -71,7 +71,7 @@
NUMERIC_BLOCK_SIZE 4096
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -256,7 +256,7 @@
+@@ -270,7 +270,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Size of tree cache used in bulk insert optimisation. Note that this is a limit per thread!
NUMERIC_MIN_VALUE 0
@@ -80,7 +80,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -449,7 +449,7 @@
+@@ -463,7 +463,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 10
VARIABLE_SCOPE GLOBAL
@@ -89,7 +89,7 @@
VARIABLE_COMMENT The number of seconds the mysqld server is waiting for a connect packet before responding with 'Bad handshake'
NUMERIC_MIN_VALUE 2
NUMERIC_MAX_VALUE 31536000
-@@ -505,7 +505,7 @@
+@@ -519,7 +519,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 15
VARIABLE_SCOPE SESSION
@@ -98,7 +98,7 @@
VARIABLE_COMMENT Long search depth for the two-step deadlock detection
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 33
-@@ -519,7 +519,7 @@
+@@ -533,7 +533,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 4
VARIABLE_SCOPE SESSION
@@ -107,7 +107,7 @@
VARIABLE_COMMENT Short search depth for the two-step deadlock detection
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 32
-@@ -533,7 +533,7 @@
+@@ -547,7 +547,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 50000000
VARIABLE_SCOPE SESSION
@@ -116,7 +116,7 @@
VARIABLE_COMMENT Long timeout for the two-step deadlock detection (in microseconds)
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -547,7 +547,7 @@
+@@ -561,7 +561,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 10000
VARIABLE_SCOPE SESSION
@@ -125,7 +125,7 @@
VARIABLE_COMMENT Short timeout for the two-step deadlock detection (in microseconds)
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -603,7 +603,7 @@
+@@ -617,7 +617,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE SESSION
@@ -134,7 +134,7 @@
VARIABLE_COMMENT The default week format used by WEEK() functions
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 7
-@@ -617,7 +617,7 @@
+@@ -631,7 +631,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 100
VARIABLE_SCOPE GLOBAL
@@ -143,7 +143,7 @@
VARIABLE_COMMENT After inserting delayed_insert_limit rows, the INSERT DELAYED handler will check if there are any SELECT statements pending. If so, it allows these to execute before continuing
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -631,7 +631,7 @@
+@@ -645,7 +645,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 300
VARIABLE_SCOPE GLOBAL
@@ -152,7 +152,7 @@
VARIABLE_COMMENT How long a INSERT DELAYED thread should wait for INSERT statements before terminating
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 31536000
-@@ -645,7 +645,7 @@
+@@ -659,7 +659,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1000
VARIABLE_SCOPE GLOBAL
@@ -161,7 +161,7 @@
VARIABLE_COMMENT What size queue (in rows) should be allocated for handling INSERT DELAYED. If the queue becomes full, any client that does INSERT DELAYED will wait until there is room in the queue again
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -673,7 +673,7 @@
+@@ -687,7 +687,7 @@
GLOBAL_VALUE_ORIGIN SQL
DEFAULT_VALUE 4
VARIABLE_SCOPE SESSION
@@ -170,7 +170,7 @@
VARIABLE_COMMENT Precision of the result of '/' operator will be increased on that value
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 30
-@@ -757,7 +757,7 @@
+@@ -785,7 +785,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -179,7 +179,7 @@
VARIABLE_COMMENT If non-zero, binary logs will be purged after expire_logs_days days; possible purges happen at startup and at binary log rotation
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 99
-@@ -785,7 +785,7 @@
+@@ -813,7 +813,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
@@ -188,7 +188,7 @@
VARIABLE_COMMENT The number of connections on extra-port
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 100000
-@@ -827,7 +827,7 @@
+@@ -855,7 +855,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -197,7 +197,7 @@
VARIABLE_COMMENT A dedicated thread is created to flush all tables at the given interval
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 31536000
-@@ -869,7 +869,7 @@
+@@ -897,7 +897,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 84
VARIABLE_SCOPE GLOBAL
@@ -206,7 +206,7 @@
VARIABLE_COMMENT The maximum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable
NUMERIC_MIN_VALUE 10
NUMERIC_MAX_VALUE 84
-@@ -883,7 +883,7 @@
+@@ -911,7 +911,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 4
VARIABLE_SCOPE GLOBAL
@@ -215,7 +215,7 @@
VARIABLE_COMMENT The minimum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 84
-@@ -897,7 +897,7 @@
+@@ -925,7 +925,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 20
VARIABLE_SCOPE GLOBAL
@@ -224,7 +224,7 @@
VARIABLE_COMMENT Number of best matches to use for query expansion
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1000
-@@ -956,7 +956,7 @@
+@@ -984,7 +984,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The maximum length of the result of function GROUP_CONCAT()
NUMERIC_MIN_VALUE 4
@@ -233,7 +233,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1107,7 +1107,7 @@
+@@ -1135,7 +1135,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE SESSION
@@ -242,8 +242,8 @@
VARIABLE_COMMENT Number of bytes used for a histogram. If set to 0, no histograms are created by ANALYZE.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 255
-@@ -1135,7 +1135,7 @@
- GLOBAL_VALUE_ORIGIN COMPILE-TIME
+@@ -1163,7 +1163,7 @@
+ GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE 128
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
@@ -251,7 +251,7 @@
VARIABLE_COMMENT How many host names should be cached to avoid resolving.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 65536
-@@ -1247,7 +1247,7 @@
+@@ -1275,7 +1275,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 28800
VARIABLE_SCOPE SESSION
@@ -260,7 +260,7 @@
VARIABLE_COMMENT The number of seconds the server waits for activity on an interactive connection before closing it
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 31536000
-@@ -1278,7 +1278,7 @@
+@@ -1306,7 +1306,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The size of the buffer that is used for joins
NUMERIC_MIN_VALUE 128
@@ -269,7 +269,7 @@
NUMERIC_BLOCK_SIZE 128
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1303,7 +1303,7 @@
+@@ -1331,7 +1331,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 2
VARIABLE_SCOPE SESSION
@@ -278,7 +278,16 @@
VARIABLE_COMMENT Controls what join operations can be executed with join buffers. Odd numbers are used for plain join buffers while even numbers are used for linked buffers
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 8
-@@ -1541,7 +1541,7 @@
+@@ -1362,7 +1362,7 @@
+ VARIABLE_TYPE BIGINT UNSIGNED
+ VARIABLE_COMMENT The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 4096
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -1569,7 +1569,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 31536000
VARIABLE_SCOPE SESSION
@@ -287,7 +296,7 @@
VARIABLE_COMMENT Timeout in seconds to wait for a lock before returning an error.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 31536000
-@@ -1639,7 +1639,7 @@
+@@ -1667,7 +1667,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE SESSION
@@ -296,7 +305,7 @@
VARIABLE_COMMENT Write to slow log every #th slow query. Set to 1 to log everything. Increase it to reduce the size of the slow or the performance impact of slow logging
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -1667,7 +1667,7 @@
+@@ -1695,7 +1695,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE SESSION
@@ -305,16 +314,16 @@
VARIABLE_COMMENT Log some not critical warnings to the general log file.Value can be between 0 and 11. Higher values mean more verbosity
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -1709,7 +1709,7 @@
+@@ -1737,7 +1737,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
- DEFAULT_VALUE 1048576
+ DEFAULT_VALUE 4194304
VARIABLE_SCOPE SESSION
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Max packet length to send to or receive from the server
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 1073741824
-@@ -1719,14 +1719,14 @@
+@@ -1747,14 +1747,14 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_BINLOG_CACHE_SIZE
SESSION_VALUE NULL
@@ -332,7 +341,7 @@
NUMERIC_BLOCK_SIZE 4096
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1737,7 +1737,7 @@
+@@ -1765,7 +1765,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1073741824
VARIABLE_SCOPE GLOBAL
@@ -341,7 +350,7 @@
VARIABLE_COMMENT Binary log will be rotated automatically when the size exceeds this value.
NUMERIC_MIN_VALUE 4096
NUMERIC_MAX_VALUE 1073741824
-@@ -1747,14 +1747,14 @@
+@@ -1775,14 +1775,14 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_BINLOG_STMT_CACHE_SIZE
SESSION_VALUE NULL
@@ -359,7 +368,7 @@
NUMERIC_BLOCK_SIZE 4096
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1765,7 +1765,7 @@
+@@ -1793,7 +1793,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 151
VARIABLE_SCOPE GLOBAL
@@ -368,7 +377,7 @@
VARIABLE_COMMENT The number of simultaneous clients allowed
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 100000
-@@ -1779,7 +1779,7 @@
+@@ -1807,7 +1807,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 100
VARIABLE_SCOPE GLOBAL
@@ -377,7 +386,7 @@
VARIABLE_COMMENT If there is more than this number of interrupted connections from a host this host will be blocked from further connections
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -1793,7 +1793,7 @@
+@@ -1821,7 +1821,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 20
VARIABLE_SCOPE SESSION
@@ -386,7 +395,7 @@
VARIABLE_COMMENT Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 16384
-@@ -1821,7 +1821,7 @@
+@@ -1849,7 +1849,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 64
VARIABLE_SCOPE SESSION
@@ -395,7 +404,7 @@
VARIABLE_COMMENT Max number of errors/warnings to store for a statement
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 65535
-@@ -1838,7 +1838,7 @@
+@@ -1866,7 +1866,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Don't allow creation of heap tables bigger than this
NUMERIC_MIN_VALUE 16384
@@ -404,7 +413,7 @@
NUMERIC_BLOCK_SIZE 1024
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1849,7 +1849,7 @@
+@@ -1877,7 +1877,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 20
VARIABLE_SCOPE SESSION
@@ -413,7 +422,7 @@
VARIABLE_COMMENT Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 16384
-@@ -1877,7 +1877,7 @@
+@@ -1905,7 +1905,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1024
VARIABLE_SCOPE SESSION
@@ -422,7 +431,7 @@
VARIABLE_COMMENT Max number of bytes in sorted records
NUMERIC_MIN_VALUE 4
NUMERIC_MAX_VALUE 8388608
-@@ -1891,7 +1891,7 @@
+@@ -1919,7 +1919,7 @@
GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE 1048576
VARIABLE_SCOPE GLOBAL
@@ -431,7 +440,7 @@
VARIABLE_COMMENT The maximum BLOB length to send to server from mysql_send_long_data API. Deprecated option; use max_allowed_packet instead.
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 4294967295
-@@ -1905,7 +1905,7 @@
+@@ -1933,7 +1933,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 16382
VARIABLE_SCOPE GLOBAL
@@ -440,7 +449,7 @@
VARIABLE_COMMENT Maximum number of prepared statements in the server
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1048576
-@@ -1919,7 +1919,7 @@
+@@ -1947,7 +1947,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 4294967295
VARIABLE_SCOPE SESSION
@@ -449,7 +458,7 @@
VARIABLE_COMMENT Limit assumed max number of seeks when looking up rows based on a key
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -1933,7 +1933,7 @@
+@@ -1961,7 +1961,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1024
VARIABLE_SCOPE SESSION
@@ -458,7 +467,7 @@
VARIABLE_COMMENT The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored)
NUMERIC_MIN_VALUE 4
NUMERIC_MAX_VALUE 8388608
-@@ -1947,7 +1947,7 @@
+@@ -1975,7 +1975,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE SESSION
@@ -467,7 +476,7 @@
VARIABLE_COMMENT Maximum stored procedure recursion depth
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 255
-@@ -1975,7 +1975,7 @@
+@@ -2003,7 +2003,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 32
VARIABLE_SCOPE SESSION
@@ -476,7 +485,7 @@
VARIABLE_COMMENT Unused, will be removed.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -2003,7 +2003,7 @@
+@@ -2031,7 +2031,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 4294967295
VARIABLE_SCOPE GLOBAL
@@ -485,7 +494,7 @@
VARIABLE_COMMENT After this many write locks, allow some read locks to run in between
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -2017,7 +2017,7 @@
+@@ -2045,7 +2045,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1024
VARIABLE_SCOPE GLOBAL
@@ -494,7 +503,7 @@
VARIABLE_COMMENT Unused
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1048576
-@@ -2031,7 +2031,7 @@
+@@ -2059,7 +2059,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 8
VARIABLE_SCOPE GLOBAL
@@ -503,7 +512,7 @@
VARIABLE_COMMENT Unused
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1024
-@@ -2045,7 +2045,7 @@
+@@ -2073,7 +2073,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE SESSION
@@ -512,7 +521,7 @@
VARIABLE_COMMENT Don't write queries to slow log that examine fewer rows than that
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -2059,7 +2059,7 @@
+@@ -2087,7 +2087,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 262144
VARIABLE_SCOPE SESSION
@@ -521,7 +530,7 @@
VARIABLE_COMMENT Size of buffer to use when using MRR with range access
NUMERIC_MIN_VALUE 8192
NUMERIC_MAX_VALUE 2147483647
-@@ -2073,10 +2073,10 @@
+@@ -2101,10 +2101,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 256
VARIABLE_SCOPE SESSION
@@ -534,7 +543,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -2087,7 +2087,7 @@
+@@ -2115,7 +2115,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1024
VARIABLE_SCOPE GLOBAL
@@ -543,7 +552,7 @@
VARIABLE_COMMENT Block size to be used for MyISAM index pages
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 16384
-@@ -2101,7 +2101,7 @@
+@@ -2129,7 +2129,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 6
VARIABLE_SCOPE GLOBAL
@@ -552,7 +561,7 @@
VARIABLE_COMMENT Default pointer size to be used for MyISAM tables
NUMERIC_MIN_VALUE 2
NUMERIC_MAX_VALUE 7
-@@ -2111,9 +2111,9 @@
+@@ -2139,9 +2139,9 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MYISAM_MAX_SORT_FILE_SIZE
SESSION_VALUE NULL
@@ -564,7 +573,7 @@
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Don't use the fast sort index method to created index if the temporary file would get bigger than this
-@@ -2125,14 +2125,14 @@
+@@ -2153,14 +2153,14 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MYISAM_MMAP_SIZE
SESSION_VALUE NULL
@@ -582,7 +591,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY YES
-@@ -2157,10 +2157,10 @@
+@@ -2185,10 +2185,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE SESSION
@@ -595,7 +604,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -2174,7 +2174,7 @@
+@@ -2202,7 +2202,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE
NUMERIC_MIN_VALUE 4096
@@ -604,7 +613,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -2227,7 +2227,7 @@
+@@ -2255,7 +2255,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 16384
VARIABLE_SCOPE SESSION
@@ -613,7 +622,7 @@
VARIABLE_COMMENT Buffer length for TCP/IP and socket communication
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 1048576
-@@ -2241,7 +2241,7 @@
+@@ -2269,7 +2269,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 30
VARIABLE_SCOPE SESSION
@@ -622,7 +631,7 @@
VARIABLE_COMMENT Number of seconds to wait for more data from a connection before aborting the read
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 31536000
-@@ -2255,7 +2255,7 @@
+@@ -2283,7 +2283,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 10
VARIABLE_SCOPE SESSION
@@ -631,7 +640,7 @@
VARIABLE_COMMENT If a read on a communication port is interrupted, retry this many times before giving up
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -2269,7 +2269,7 @@
+@@ -2297,7 +2297,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 60
VARIABLE_SCOPE SESSION
@@ -640,7 +649,7 @@
VARIABLE_COMMENT Number of seconds to wait for a block to be written to a connection before aborting the write
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 31536000
-@@ -2339,7 +2339,7 @@
+@@ -2367,7 +2367,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE SESSION
@@ -649,7 +658,7 @@
VARIABLE_COMMENT Controls the heuristic(s) applied during query optimization to prune less-promising partial plans from the optimizer search space. Meaning: 0 - do not apply any heuristic, thus perform exhaustive search; 1 - prune plans based on number of retrieved rows
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1
-@@ -2353,7 +2353,7 @@
+@@ -2381,7 +2381,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 62
VARIABLE_SCOPE SESSION
@@ -658,7 +667,7 @@
VARIABLE_COMMENT Maximum depth of search performed by the query optimizer. Values larger than the number of relations in a query result in better query plans, but take longer to compile 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
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 63
-@@ -2367,7 +2367,7 @@
+@@ -2395,7 +2395,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 100
VARIABLE_SCOPE SESSION
@@ -667,7 +676,7 @@
VARIABLE_COMMENT Controls number of record samples to check condition selectivity
NUMERIC_MIN_VALUE 10
NUMERIC_MAX_VALUE 4294967295
-@@ -2395,7 +2395,7 @@
+@@ -2423,7 +2423,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE SESSION
@@ -676,7 +685,7 @@
VARIABLE_COMMENT Controls selectivity of which conditions the optimizer takes into account to calculate cardinality of a partial join when it searches for the best execution plan Meaning: 1 - use selectivity of index backed range conditions to calculate the cardinality of a partial join if the last joined table is accessed by full table scan or an index scan, 2 - use selectivity of index backed range conditions to calculate the cardinality of a partial join in any case, 3 - additionally always use selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join, 4 - use histograms to calculate selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join.5 - additionally use selectivity of certain non-range predicates calculated on record samples
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 5
-@@ -2423,7 +2423,7 @@
+@@ -2451,7 +2451,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -685,7 +694,7 @@
VARIABLE_COMMENT Maximum number of instrumented user@host accounts. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2437,7 +2437,7 @@
+@@ -2465,7 +2465,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -694,7 +703,7 @@
VARIABLE_COMMENT Size of the statement digest. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 200
-@@ -2451,7 +2451,7 @@
+@@ -2479,7 +2479,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -703,7 +712,7 @@
VARIABLE_COMMENT Number of rows in EVENTS_STAGES_HISTORY_LONG. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2465,7 +2465,7 @@
+@@ -2493,7 +2493,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -712,7 +721,7 @@
VARIABLE_COMMENT Number of rows per thread in EVENTS_STAGES_HISTORY. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1024
-@@ -2479,7 +2479,7 @@
+@@ -2507,7 +2507,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -721,7 +730,7 @@
VARIABLE_COMMENT Number of rows in EVENTS_STATEMENTS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2493,7 +2493,7 @@
+@@ -2521,7 +2521,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -730,7 +739,7 @@
VARIABLE_COMMENT Number of rows per thread in EVENTS_STATEMENTS_HISTORY. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1024
-@@ -2507,7 +2507,7 @@
+@@ -2535,7 +2535,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -739,7 +748,7 @@
VARIABLE_COMMENT Number of rows in EVENTS_WAITS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2521,7 +2521,7 @@
+@@ -2549,7 +2549,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -748,7 +757,7 @@
VARIABLE_COMMENT Number of rows per thread in EVENTS_WAITS_HISTORY. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1024
-@@ -2535,7 +2535,7 @@
+@@ -2563,7 +2563,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -757,7 +766,7 @@
VARIABLE_COMMENT Maximum number of instrumented hosts. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2549,7 +2549,7 @@
+@@ -2577,7 +2577,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 80
VARIABLE_SCOPE GLOBAL
@@ -766,7 +775,7 @@
VARIABLE_COMMENT Maximum number of condition instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2563,7 +2563,7 @@
+@@ -2591,7 +2591,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -775,7 +784,16 @@
VARIABLE_COMMENT Maximum number of instrumented condition objects. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2577,7 +2577,7 @@
+@@ -2605,7 +2605,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 1024
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Maximum length considered for digest text, when stored in performance_schema tables.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 1048576
+@@ -2619,7 +2619,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 50
VARIABLE_SCOPE GLOBAL
@@ -784,7 +802,7 @@
VARIABLE_COMMENT Maximum number of file instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2591,7 +2591,7 @@
+@@ -2633,7 +2633,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 32768
VARIABLE_SCOPE GLOBAL
@@ -793,7 +811,7 @@
VARIABLE_COMMENT Maximum number of opened instrumented files.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1048576
-@@ -2605,7 +2605,7 @@
+@@ -2647,7 +2647,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -802,7 +820,7 @@
VARIABLE_COMMENT Maximum number of instrumented files. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2619,7 +2619,7 @@
+@@ -2661,7 +2661,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 200
VARIABLE_SCOPE GLOBAL
@@ -811,7 +829,7 @@
VARIABLE_COMMENT Maximum number of mutex instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2633,7 +2633,7 @@
+@@ -2675,7 +2675,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -820,7 +838,7 @@
VARIABLE_COMMENT Maximum number of instrumented MUTEX objects. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 104857600
-@@ -2647,7 +2647,7 @@
+@@ -2689,7 +2689,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 40
VARIABLE_SCOPE GLOBAL
@@ -829,7 +847,7 @@
VARIABLE_COMMENT Maximum number of rwlock instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2661,7 +2661,7 @@
+@@ -2703,7 +2703,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -838,7 +856,7 @@
VARIABLE_COMMENT Maximum number of instrumented RWLOCK objects. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 104857600
-@@ -2675,7 +2675,7 @@
+@@ -2717,7 +2717,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 10
VARIABLE_SCOPE GLOBAL
@@ -847,7 +865,7 @@
VARIABLE_COMMENT Maximum number of socket instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2689,7 +2689,7 @@
+@@ -2731,7 +2731,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -856,7 +874,7 @@
VARIABLE_COMMENT Maximum number of opened instrumented sockets. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2703,7 +2703,7 @@
+@@ -2745,7 +2745,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 150
VARIABLE_SCOPE GLOBAL
@@ -865,7 +883,7 @@
VARIABLE_COMMENT Maximum number of stage instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2717,7 +2717,7 @@
+@@ -2759,7 +2759,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 178
VARIABLE_SCOPE GLOBAL
@@ -874,7 +892,7 @@
VARIABLE_COMMENT Maximum number of statement instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2731,7 +2731,7 @@
+@@ -2773,7 +2773,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -883,7 +901,7 @@
VARIABLE_COMMENT Maximum number of opened instrumented tables. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2745,7 +2745,7 @@
+@@ -2787,7 +2787,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -892,7 +910,7 @@
VARIABLE_COMMENT Maximum number of instrumented tables. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2759,7 +2759,7 @@
+@@ -2801,7 +2801,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 50
VARIABLE_SCOPE GLOBAL
@@ -901,7 +919,7 @@
VARIABLE_COMMENT Maximum number of thread instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2773,7 +2773,7 @@
+@@ -2815,7 +2815,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -910,7 +928,7 @@
VARIABLE_COMMENT Maximum number of instrumented threads. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2787,7 +2787,7 @@
+@@ -2829,7 +2829,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -919,7 +937,7 @@
VARIABLE_COMMENT Size of session attribute string buffer per thread. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2801,7 +2801,7 @@
+@@ -2843,7 +2843,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 100
VARIABLE_SCOPE GLOBAL
@@ -928,7 +946,7 @@
VARIABLE_COMMENT Maximum number of rows in SETUP_ACTORS.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1024
-@@ -2815,7 +2815,7 @@
+@@ -2857,7 +2857,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 100
VARIABLE_SCOPE GLOBAL
@@ -937,7 +955,7 @@
VARIABLE_COMMENT Maximum number of rows in SETUP_OBJECTS.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1048576
-@@ -2829,7 +2829,7 @@
+@@ -2871,7 +2871,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -946,7 +964,7 @@
VARIABLE_COMMENT Maximum number of instrumented users. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2899,7 +2899,7 @@
+@@ -2941,7 +2941,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 32768
VARIABLE_SCOPE SESSION
@@ -955,7 +973,7 @@
VARIABLE_COMMENT The size of the buffer that is allocated when preloading indexes
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 1073741824
-@@ -2927,7 +2927,7 @@
+@@ -2969,7 +2969,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 15
VARIABLE_SCOPE SESSION
@@ -964,7 +982,7 @@
VARIABLE_COMMENT Limit of query profiling memory
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 100
-@@ -2941,7 +2941,7 @@
+@@ -2983,7 +2983,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 5
VARIABLE_SCOPE SESSION
@@ -973,7 +991,7 @@
VARIABLE_COMMENT Seconds between sending progress reports to the client for time-consuming statements. Set to 0 to disable progress reporting.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -2997,10 +2997,10 @@
+@@ -3039,10 +3039,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE SESSION ONLY
@@ -986,7 +1004,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3011,7 +3011,7 @@
+@@ -3053,7 +3053,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 16384
VARIABLE_SCOPE SESSION
@@ -995,7 +1013,7 @@
VARIABLE_COMMENT Allocation block size for query parsing and execution
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 4294967295
-@@ -3025,7 +3025,7 @@
+@@ -3067,7 +3067,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1048576
VARIABLE_SCOPE GLOBAL
@@ -1004,7 +1022,7 @@
VARIABLE_COMMENT Don't cache results that are bigger than this
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -3039,7 +3039,7 @@
+@@ -3081,7 +3081,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 4096
VARIABLE_SCOPE GLOBAL
@@ -1013,7 +1031,7 @@
VARIABLE_COMMENT The minimum size for blocks allocated by the query cache
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -3056,7 +3056,7 @@
+@@ -3098,7 +3098,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The memory allocated to store results from old queries
NUMERIC_MIN_VALUE 0
@@ -1022,7 +1040,7 @@
NUMERIC_BLOCK_SIZE 1024
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3109,7 +3109,7 @@
+@@ -3151,7 +3151,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 24576
VARIABLE_SCOPE SESSION
@@ -1031,7 +1049,7 @@
VARIABLE_COMMENT Persistent buffer for query parsing and execution
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 4294967295
-@@ -3123,7 +3123,7 @@
+@@ -3165,7 +3165,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 4096
VARIABLE_SCOPE SESSION
@@ -1040,7 +1058,7 @@
VARIABLE_COMMENT Allocation block size for storing ranges during optimization
NUMERIC_MIN_VALUE 4096
NUMERIC_MAX_VALUE 4294967295
-@@ -3137,7 +3137,7 @@
+@@ -3179,7 +3179,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 131072
VARIABLE_SCOPE SESSION
@@ -1049,7 +1067,7 @@
VARIABLE_COMMENT Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value
NUMERIC_MIN_VALUE 8192
NUMERIC_MAX_VALUE 2147483647
-@@ -3165,7 +3165,7 @@
+@@ -3207,7 +3207,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 262144
VARIABLE_SCOPE SESSION
@@ -1058,7 +1076,7 @@
VARIABLE_COMMENT When reading rows in sorted order after a sort, the rows are read through this buffer to avoid a disk seeks
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 2147483647
-@@ -3179,10 +3179,10 @@
+@@ -3221,10 +3221,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 8388608
VARIABLE_SCOPE SESSION
@@ -1071,7 +1089,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3221,7 +3221,7 @@
+@@ -3263,7 +3263,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 0
VARIABLE_SCOPE SESSION
@@ -1080,7 +1098,7 @@
VARIABLE_COMMENT Uniquely identifies the server instance in the community of replication partners
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -3319,7 +3319,7 @@
+@@ -3361,7 +3361,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1073741824
VARIABLE_SCOPE GLOBAL
@@ -1089,7 +1107,7 @@
VARIABLE_COMMENT The maximum packet length to sent successfully from the master to slave.
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 1073741824
-@@ -3333,7 +3333,7 @@
+@@ -3375,7 +3375,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 2
VARIABLE_SCOPE GLOBAL
@@ -1098,7 +1116,7 @@
VARIABLE_COMMENT If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 31536000
-@@ -3392,7 +3392,7 @@
+@@ -3434,7 +3434,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Each thread that needs to do a sort allocates a buffer of this size
NUMERIC_MIN_VALUE 1024
@@ -1107,7 +1125,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3669,7 +3669,7 @@
+@@ -3711,7 +3711,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 256
VARIABLE_SCOPE GLOBAL
@@ -1116,7 +1134,7 @@
VARIABLE_COMMENT The soft upper limit for number of cached stored routines for one connection.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 524288
-@@ -3739,7 +3739,7 @@
+@@ -3781,7 +3781,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 400
VARIABLE_SCOPE GLOBAL
@@ -1125,16 +1143,16 @@
VARIABLE_COMMENT The number of cached table definitions
NUMERIC_MIN_VALUE 400
NUMERIC_MAX_VALUE 524288
-@@ -3753,7 +3753,7 @@
+@@ -3795,7 +3795,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
- DEFAULT_VALUE 400
+ DEFAULT_VALUE 2000
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT The number of cached open tables
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 524288
-@@ -3767,7 +3767,7 @@
+@@ -3809,7 +3809,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -1143,7 +1161,7 @@
VARIABLE_COMMENT How many threads we should keep in a cache for reuse
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 16384
-@@ -3781,7 +3781,7 @@
+@@ -3823,7 +3823,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 10
VARIABLE_SCOPE GLOBAL
@@ -1152,7 +1170,7 @@
VARIABLE_COMMENT Permits the application to give the threads system a hint for the desired number of threads that should be run at the same time.This variable has no effect, and is deprecated. It will be removed in a future release.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 512
-@@ -3896,7 +3896,7 @@
+@@ -3938,7 +3938,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM or Aria table
NUMERIC_MIN_VALUE 1024
@@ -1161,7 +1179,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3907,7 +3907,7 @@
+@@ -3949,7 +3949,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 8192
VARIABLE_SCOPE SESSION
@@ -1170,7 +1188,7 @@
VARIABLE_COMMENT Allocation block size for transactions to be stored in binary log
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 134217728
-@@ -3921,7 +3921,7 @@
+@@ -3963,7 +3963,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 4096
VARIABLE_SCOPE SESSION
@@ -1179,7 +1197,7 @@
VARIABLE_COMMENT Persistent buffer for transactions to be stored in binary log
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 134217728
-@@ -4019,7 +4019,7 @@
+@@ -4061,7 +4061,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 28800
VARIABLE_SCOPE SESSION
@@ -1188,7 +1206,7 @@
VARIABLE_COMMENT The number of seconds the server waits for activity on a connection before closing it
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 31536000
-@@ -4123,7 +4123,7 @@
+@@ -4165,7 +4165,7 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME OPEN_FILES_LIMIT
VARIABLE_SCOPE GLOBAL
@@ -1197,7 +1215,7 @@
VARIABLE_COMMENT 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
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -4136,7 +4136,7 @@
+@@ -4178,7 +4178,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
NUMERIC_MIN_VALUE 0
@@ -1206,7 +1224,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -4146,7 +4146,7 @@
+@@ -4188,7 +4188,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
NUMERIC_MIN_VALUE 0
@@ -1215,7 +1233,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -4231,7 +4231,7 @@
+@@ -4273,7 +4273,7 @@
VARIABLE_NAME LOG_TC_SIZE
GLOBAL_VALUE_ORIGIN AUTO
VARIABLE_SCOPE GLOBAL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
index d3bb7c2bf80..1f914394c26 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
@@ -81,13 +81,13 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME BACK_LOG
SESSION_VALUE NULL
-GLOBAL_VALUE 150
-GLOBAL_VALUE_ORIGIN COMPILE-TIME
+GLOBAL_VALUE 80
+GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE 150
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
-VARIABLE_COMMENT The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time
-NUMERIC_MIN_VALUE 1
+VARIABLE_COMMENT The number of outstanding connection requests MariaDB can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time
+NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 65535
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
@@ -233,6 +233,20 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME BINLOG_ROW_IMAGE
+SESSION_VALUE FULL
+GLOBAL_VALUE FULL
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE FULL
+VARIABLE_SCOPE SESSION
+VARIABLE_TYPE ENUM
+VARIABLE_COMMENT Controls whether rows should be logged in 'FULL', 'NOBLOB' or 'MINIMAL' formats. 'FULL', means that all columns in the before and after image are logged. 'NOBLOB', means that mysqld avoids logging blob columns whenever possible (eg, blob column was not changed or is not part of primary key). 'MINIMAL', means that a PK equivalent (PK columns or full row if there is no PK in the table) is logged in the before image, and only changed columns are logged in the after image. (Default: FULL).
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST MINIMAL,NOBLOB,FULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME BINLOG_STMT_CACHE_SIZE
SESSION_VALUE NULL
GLOBAL_VALUE 32768
@@ -681,6 +695,20 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME ENCRYPT_BINLOG
+SESSION_VALUE NULL
+GLOBAL_VALUE ON
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE ON
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BOOLEAN
+VARIABLE_COMMENT Encrypt binary logs (including relay logs)
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST OFF,ON
+READ_ONLY YES
+COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME ENCRYPT_TMP_DISK_TABLES
SESSION_VALUE NULL
GLOBAL_VALUE OFF
@@ -711,10 +739,10 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME ENFORCE_STORAGE_ENGINE
SESSION_VALUE
-GLOBAL_VALUE NULL
+GLOBAL_VALUE
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
-VARIABLE_SCOPE SESSION ONLY
+VARIABLE_SCOPE SESSION
VARIABLE_TYPE VARCHAR
VARIABLE_COMMENT Force the use of a storage engine for new tables
NUMERIC_MIN_VALUE NULL
@@ -1131,8 +1159,8 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME HOST_CACHE_SIZE
SESSION_VALUE NULL
-GLOBAL_VALUE 128
-GLOBAL_VALUE_ORIGIN COMPILE-TIME
+GLOBAL_VALUE 279
+GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE 128
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
@@ -1270,10 +1298,10 @@ ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME JOIN_BUFFER_SIZE
-SESSION_VALUE 131072
-GLOBAL_VALUE 131072
+SESSION_VALUE 262144
+GLOBAL_VALUE 262144
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 131072
+DEFAULT_VALUE 262144
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The size of the buffer that is used for joins
@@ -1333,9 +1361,9 @@ DEFAULT_VALUE 134217728
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford
-NUMERIC_MIN_VALUE NULL
-NUMERIC_MAX_VALUE NULL
-NUMERIC_BLOCK_SIZE NULL
+NUMERIC_MIN_VALUE 0
+NUMERIC_MAX_VALUE 18446744073709551615
+NUMERIC_BLOCK_SIZE 4096
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -1347,9 +1375,9 @@ DEFAULT_VALUE 300
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT This characterizes the number of hits a hot block has to be untouched until it is considered aged enough to be downgraded to a warm block. This specifies the percentage ratio of that number of hits to the total number of blocks in key cache
-NUMERIC_MIN_VALUE NULL
-NUMERIC_MAX_VALUE NULL
-NUMERIC_BLOCK_SIZE NULL
+NUMERIC_MIN_VALUE 100
+NUMERIC_MAX_VALUE 4294967295
+NUMERIC_BLOCK_SIZE 100
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -1361,9 +1389,9 @@ DEFAULT_VALUE 1024
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The default size of key cache blocks
-NUMERIC_MIN_VALUE NULL
-NUMERIC_MAX_VALUE NULL
-NUMERIC_BLOCK_SIZE NULL
+NUMERIC_MIN_VALUE 512
+NUMERIC_MAX_VALUE 16384
+NUMERIC_BLOCK_SIZE 512
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -1375,9 +1403,9 @@ DEFAULT_VALUE 100
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The minimum percentage of warm blocks in key cache
-NUMERIC_MIN_VALUE NULL
-NUMERIC_MAX_VALUE NULL
-NUMERIC_BLOCK_SIZE NULL
+NUMERIC_MIN_VALUE 1
+NUMERIC_MAX_VALUE 100
+NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -1389,9 +1417,9 @@ DEFAULT_VALUE 512
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Number of hash buckets for open and changed files. If you have a lot of MyISAM files open you should increase this for faster flush of changes. A good value is probably 1/10 of number of possible open MyISAM files.
-NUMERIC_MIN_VALUE NULL
-NUMERIC_MAX_VALUE NULL
-NUMERIC_BLOCK_SIZE NULL
+NUMERIC_MIN_VALUE 128
+NUMERIC_MAX_VALUE 16384
+NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -1403,9 +1431,9 @@ DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The number of segments in a key cache
-NUMERIC_MIN_VALUE NULL
-NUMERIC_MAX_VALUE NULL
-NUMERIC_BLOCK_SIZE NULL
+NUMERIC_MIN_VALUE 0
+NUMERIC_MAX_VALUE 64
+NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -1704,10 +1732,10 @@ ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME MAX_ALLOWED_PACKET
-SESSION_VALUE 1048576
-GLOBAL_VALUE 1048576
+SESSION_VALUE 4194304
+GLOBAL_VALUE 4194304
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 1048576
+DEFAULT_VALUE 4194304
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Max packet length to send to or receive from the server
@@ -1887,7 +1915,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_LONG_DATA_SIZE
SESSION_VALUE NULL
-GLOBAL_VALUE 1048576
+GLOBAL_VALUE 4194304
GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE 1048576
VARIABLE_SCOPE GLOBAL
@@ -2571,6 +2599,20 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_DIGEST_LENGTH
+SESSION_VALUE NULL
+GLOBAL_VALUE 1024
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE 1024
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BIGINT
+VARIABLE_COMMENT Maximum length considered for digest text, when stored in performance_schema tables.
+NUMERIC_MIN_VALUE 0
+NUMERIC_MAX_VALUE 1048576
+NUMERIC_BLOCK_SIZE 1
+ENUM_VALUE_LIST NULL
+READ_ONLY YES
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_FILE_CLASSES
SESSION_VALUE NULL
GLOBAL_VALUE 50
@@ -3049,9 +3091,9 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME QUERY_CACHE_SIZE
SESSION_VALUE NULL
-GLOBAL_VALUE 0
+GLOBAL_VALUE 1048576
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 0
+DEFAULT_VALUE 1048576
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The memory allocated to store results from old queries
@@ -3076,10 +3118,10 @@ ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME QUERY_CACHE_TYPE
-SESSION_VALUE ON
-GLOBAL_VALUE ON
+SESSION_VALUE OFF
+GLOBAL_VALUE OFF
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE ON
+DEFAULT_VALUE OFF
VARIABLE_SCOPE SESSION
VARIABLE_TYPE ENUM
VARIABLE_COMMENT OFF = Don't cache or retrieve results. ON = Cache all results except SELECT SQL_NO_CACHE ... queries. DEMAND = Cache only SELECT SQL_CACHE ... queries
@@ -3189,9 +3231,9 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SECURE_AUTH
SESSION_VALUE NULL
-GLOBAL_VALUE OFF
+GLOBAL_VALUE ON
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE OFF
+DEFAULT_VALUE ON
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Disallow authentication for accounts that have old (pre-4.1) passwords
@@ -3469,9 +3511,9 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME SQL_MODE
SESSION_VALUE ANSI_QUOTES
-GLOBAL_VALUE
+GLOBAL_VALUE NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE
+DEFAULT_VALUE NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
VARIABLE_SCOPE SESSION
VARIABLE_TYPE SET
VARIABLE_COMMENT Sets the sql mode
@@ -3721,12 +3763,12 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME SYNC_MASTER_INFO
SESSION_VALUE NULL
-GLOBAL_VALUE 0
+GLOBAL_VALUE 10000
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 0
+DEFAULT_VALUE 10000
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
-VARIABLE_COMMENT Synchronously flush master info to disk after every #th event. Use 0 (default) to disable synchronous flushing
+VARIABLE_COMMENT Synchronously flush master info to disk after every #th event. Use 0 to disable synchronous flushing
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 1
@@ -3749,9 +3791,9 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME TABLE_OPEN_CACHE
SESSION_VALUE NULL
-GLOBAL_VALUE 400
+GLOBAL_VALUE 2000
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 400
+DEFAULT_VALUE 2000
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The number of cached open tables
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff
index a27b8932aee..e87f2647f69 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff
@@ -19,13 +19,13 @@
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 65535
@@ -85,7 +85,7 @@
- GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE 150
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
- VARIABLE_COMMENT The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time
- NUMERIC_MIN_VALUE 1
+ VARIABLE_COMMENT The number of outstanding connection requests MariaDB can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time
+ NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 65535
@@ -144,7 +144,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
@@ -62,7 +62,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -242,7 +242,7 @@
+@@ -256,7 +256,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The size of the statement cache for updates to non-transactional engines for the binary log. If you often use statements updating a great number of rows, you can increase this to get more performance
NUMERIC_MIN_VALUE 4096
@@ -71,7 +71,7 @@
NUMERIC_BLOCK_SIZE 4096
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -256,7 +256,7 @@
+@@ -270,7 +270,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Size of tree cache used in bulk insert optimisation. Note that this is a limit per thread!
NUMERIC_MIN_VALUE 0
@@ -80,7 +80,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -449,7 +449,7 @@
+@@ -463,7 +463,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 10
VARIABLE_SCOPE GLOBAL
@@ -89,7 +89,7 @@
VARIABLE_COMMENT The number of seconds the mysqld server is waiting for a connect packet before responding with 'Bad handshake'
NUMERIC_MIN_VALUE 2
NUMERIC_MAX_VALUE 31536000
-@@ -505,7 +505,7 @@
+@@ -519,7 +519,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 15
VARIABLE_SCOPE SESSION
@@ -98,7 +98,7 @@
VARIABLE_COMMENT Long search depth for the two-step deadlock detection
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 33
-@@ -519,7 +519,7 @@
+@@ -533,7 +533,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 4
VARIABLE_SCOPE SESSION
@@ -107,7 +107,7 @@
VARIABLE_COMMENT Short search depth for the two-step deadlock detection
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 32
-@@ -533,7 +533,7 @@
+@@ -547,7 +547,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 50000000
VARIABLE_SCOPE SESSION
@@ -116,7 +116,7 @@
VARIABLE_COMMENT Long timeout for the two-step deadlock detection (in microseconds)
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -547,7 +547,7 @@
+@@ -561,7 +561,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 10000
VARIABLE_SCOPE SESSION
@@ -125,7 +125,7 @@
VARIABLE_COMMENT Short timeout for the two-step deadlock detection (in microseconds)
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -617,7 +617,7 @@
+@@ -631,7 +631,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE SESSION
@@ -134,7 +134,7 @@
VARIABLE_COMMENT The default week format used by WEEK() functions
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 7
-@@ -631,7 +631,7 @@
+@@ -645,7 +645,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 100
VARIABLE_SCOPE GLOBAL
@@ -143,7 +143,7 @@
VARIABLE_COMMENT After inserting delayed_insert_limit rows, the INSERT DELAYED handler will check if there are any SELECT statements pending. If so, it allows these to execute before continuing
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -645,7 +645,7 @@
+@@ -659,7 +659,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 300
VARIABLE_SCOPE GLOBAL
@@ -152,7 +152,7 @@
VARIABLE_COMMENT How long a INSERT DELAYED thread should wait for INSERT statements before terminating
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 31536000
-@@ -659,7 +659,7 @@
+@@ -673,7 +673,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1000
VARIABLE_SCOPE GLOBAL
@@ -161,7 +161,7 @@
VARIABLE_COMMENT What size queue (in rows) should be allocated for handling INSERT DELAYED. If the queue becomes full, any client that does INSERT DELAYED will wait until there is room in the queue again
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -687,7 +687,7 @@
+@@ -701,7 +701,7 @@
GLOBAL_VALUE_ORIGIN SQL
DEFAULT_VALUE 4
VARIABLE_SCOPE SESSION
@@ -170,7 +170,7 @@
VARIABLE_COMMENT Precision of the result of '/' operator will be increased on that value
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 30
-@@ -785,7 +785,7 @@
+@@ -813,7 +813,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -179,7 +179,7 @@
VARIABLE_COMMENT If non-zero, binary logs will be purged after expire_logs_days days; possible purges happen at startup and at binary log rotation
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 99
-@@ -813,7 +813,7 @@
+@@ -841,7 +841,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
@@ -188,7 +188,7 @@
VARIABLE_COMMENT The number of connections on extra-port
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 100000
-@@ -855,7 +855,7 @@
+@@ -883,7 +883,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -197,7 +197,7 @@
VARIABLE_COMMENT A dedicated thread is created to flush all tables at the given interval
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 31536000
-@@ -897,7 +897,7 @@
+@@ -925,7 +925,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 84
VARIABLE_SCOPE GLOBAL
@@ -206,7 +206,7 @@
VARIABLE_COMMENT The maximum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable
NUMERIC_MIN_VALUE 10
NUMERIC_MAX_VALUE 84
-@@ -911,7 +911,7 @@
+@@ -939,7 +939,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 4
VARIABLE_SCOPE GLOBAL
@@ -215,7 +215,7 @@
VARIABLE_COMMENT The minimum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 84
-@@ -925,7 +925,7 @@
+@@ -953,7 +953,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 20
VARIABLE_SCOPE GLOBAL
@@ -224,7 +224,7 @@
VARIABLE_COMMENT Number of best matches to use for query expansion
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1000
-@@ -984,7 +984,7 @@
+@@ -1012,7 +1012,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The maximum length of the result of function GROUP_CONCAT()
NUMERIC_MIN_VALUE 4
@@ -233,7 +233,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1219,7 +1219,7 @@
+@@ -1247,7 +1247,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE SESSION
@@ -242,8 +242,8 @@
VARIABLE_COMMENT Number of bytes used for a histogram. If set to 0, no histograms are created by ANALYZE.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 255
-@@ -1247,7 +1247,7 @@
- GLOBAL_VALUE_ORIGIN COMPILE-TIME
+@@ -1275,7 +1275,7 @@
+ GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE 128
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
@@ -251,7 +251,7 @@
VARIABLE_COMMENT How many host names should be cached to avoid resolving.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 65536
-@@ -1359,7 +1359,7 @@
+@@ -1387,7 +1387,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 28800
VARIABLE_SCOPE SESSION
@@ -260,7 +260,7 @@
VARIABLE_COMMENT The number of seconds the server waits for activity on an interactive connection before closing it
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 31536000
-@@ -1390,7 +1390,7 @@
+@@ -1418,7 +1418,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The size of the buffer that is used for joins
NUMERIC_MIN_VALUE 128
@@ -269,7 +269,7 @@
NUMERIC_BLOCK_SIZE 128
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1415,7 +1415,7 @@
+@@ -1443,7 +1443,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 2
VARIABLE_SCOPE SESSION
@@ -278,7 +278,16 @@
VARIABLE_COMMENT Controls what join operations can be executed with join buffers. Odd numbers are used for plain join buffers while even numbers are used for linked buffers
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 8
-@@ -1667,7 +1667,7 @@
+@@ -1474,7 +1474,7 @@
+ VARIABLE_TYPE BIGINT UNSIGNED
+ VARIABLE_COMMENT The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 4096
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -1695,7 +1695,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 31536000
VARIABLE_SCOPE SESSION
@@ -287,7 +296,7 @@
VARIABLE_COMMENT Timeout in seconds to wait for a lock before returning an error.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 31536000
-@@ -1779,7 +1779,7 @@
+@@ -1835,7 +1835,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE SESSION
@@ -296,7 +305,7 @@
VARIABLE_COMMENT Write to slow log every #th slow query. Set to 1 to log everything. Increase it to reduce the size of the slow or the performance impact of slow logging
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -1807,7 +1807,7 @@
+@@ -1863,7 +1863,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE SESSION
@@ -305,16 +314,16 @@
VARIABLE_COMMENT Log some not critical warnings to the general log file.Value can be between 0 and 11. Higher values mean more verbosity
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -1863,7 +1863,7 @@
+@@ -1919,7 +1919,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
- DEFAULT_VALUE 1048576
+ DEFAULT_VALUE 4194304
VARIABLE_SCOPE SESSION
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Max packet length to send to or receive from the server
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 1073741824
-@@ -1873,14 +1873,14 @@
+@@ -1929,14 +1929,14 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_BINLOG_CACHE_SIZE
SESSION_VALUE NULL
@@ -332,7 +341,7 @@
NUMERIC_BLOCK_SIZE 4096
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1891,7 +1891,7 @@
+@@ -1947,7 +1947,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1073741824
VARIABLE_SCOPE GLOBAL
@@ -341,7 +350,7 @@
VARIABLE_COMMENT Binary log will be rotated automatically when the size exceeds this value.
NUMERIC_MIN_VALUE 4096
NUMERIC_MAX_VALUE 1073741824
-@@ -1901,14 +1901,14 @@
+@@ -1957,14 +1957,14 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_BINLOG_STMT_CACHE_SIZE
SESSION_VALUE NULL
@@ -359,7 +368,7 @@
NUMERIC_BLOCK_SIZE 4096
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1919,7 +1919,7 @@
+@@ -1975,7 +1975,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 151
VARIABLE_SCOPE GLOBAL
@@ -368,7 +377,7 @@
VARIABLE_COMMENT The number of simultaneous clients allowed
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 100000
-@@ -1933,7 +1933,7 @@
+@@ -1989,7 +1989,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 100
VARIABLE_SCOPE GLOBAL
@@ -377,7 +386,7 @@
VARIABLE_COMMENT If there is more than this number of interrupted connections from a host this host will be blocked from further connections
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -1947,7 +1947,7 @@
+@@ -2003,7 +2003,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 20
VARIABLE_SCOPE SESSION
@@ -386,7 +395,7 @@
VARIABLE_COMMENT Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 16384
-@@ -1975,7 +1975,7 @@
+@@ -2031,7 +2031,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 64
VARIABLE_SCOPE SESSION
@@ -395,7 +404,7 @@
VARIABLE_COMMENT Max number of errors/warnings to store for a statement
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 65535
-@@ -1992,7 +1992,7 @@
+@@ -2048,7 +2048,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Don't allow creation of heap tables bigger than this
NUMERIC_MIN_VALUE 16384
@@ -404,7 +413,7 @@
NUMERIC_BLOCK_SIZE 1024
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -2003,7 +2003,7 @@
+@@ -2059,7 +2059,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 20
VARIABLE_SCOPE SESSION
@@ -413,7 +422,7 @@
VARIABLE_COMMENT Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 16384
-@@ -2031,7 +2031,7 @@
+@@ -2087,7 +2087,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1024
VARIABLE_SCOPE SESSION
@@ -422,7 +431,7 @@
VARIABLE_COMMENT Max number of bytes in sorted records
NUMERIC_MIN_VALUE 4
NUMERIC_MAX_VALUE 8388608
-@@ -2045,7 +2045,7 @@
+@@ -2101,7 +2101,7 @@
GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE 1048576
VARIABLE_SCOPE GLOBAL
@@ -431,7 +440,7 @@
VARIABLE_COMMENT The maximum BLOB length to send to server from mysql_send_long_data API. Deprecated option; use max_allowed_packet instead.
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 4294967295
-@@ -2059,7 +2059,7 @@
+@@ -2115,7 +2115,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 16382
VARIABLE_SCOPE GLOBAL
@@ -440,7 +449,7 @@
VARIABLE_COMMENT Maximum number of prepared statements in the server
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1048576
-@@ -2087,7 +2087,7 @@
+@@ -2143,7 +2143,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 4294967295
VARIABLE_SCOPE SESSION
@@ -449,7 +458,7 @@
VARIABLE_COMMENT Limit assumed max number of seeks when looking up rows based on a key
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -2101,7 +2101,7 @@
+@@ -2157,7 +2157,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1024
VARIABLE_SCOPE SESSION
@@ -458,7 +467,7 @@
VARIABLE_COMMENT The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored)
NUMERIC_MIN_VALUE 4
NUMERIC_MAX_VALUE 8388608
-@@ -2115,7 +2115,7 @@
+@@ -2171,7 +2171,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE SESSION
@@ -467,7 +476,7 @@
VARIABLE_COMMENT Maximum stored procedure recursion depth
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 255
-@@ -2143,7 +2143,7 @@
+@@ -2199,7 +2199,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 32
VARIABLE_SCOPE SESSION
@@ -476,7 +485,7 @@
VARIABLE_COMMENT Unused, will be removed.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -2171,7 +2171,7 @@
+@@ -2227,7 +2227,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 4294967295
VARIABLE_SCOPE GLOBAL
@@ -485,7 +494,7 @@
VARIABLE_COMMENT After this many write locks, allow some read locks to run in between
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -2185,7 +2185,7 @@
+@@ -2241,7 +2241,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1024
VARIABLE_SCOPE GLOBAL
@@ -494,7 +503,7 @@
VARIABLE_COMMENT Unused
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1048576
-@@ -2199,7 +2199,7 @@
+@@ -2255,7 +2255,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 8
VARIABLE_SCOPE GLOBAL
@@ -503,7 +512,7 @@
VARIABLE_COMMENT Unused
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1024
-@@ -2213,7 +2213,7 @@
+@@ -2269,7 +2269,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE SESSION
@@ -512,7 +521,7 @@
VARIABLE_COMMENT Don't write queries to slow log that examine fewer rows than that
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -2227,7 +2227,7 @@
+@@ -2283,7 +2283,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 262144
VARIABLE_SCOPE SESSION
@@ -521,7 +530,7 @@
VARIABLE_COMMENT Size of buffer to use when using MRR with range access
NUMERIC_MIN_VALUE 8192
NUMERIC_MAX_VALUE 2147483647
-@@ -2241,10 +2241,10 @@
+@@ -2297,10 +2297,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 256
VARIABLE_SCOPE SESSION
@@ -534,7 +543,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -2255,7 +2255,7 @@
+@@ -2311,7 +2311,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1024
VARIABLE_SCOPE GLOBAL
@@ -543,7 +552,7 @@
VARIABLE_COMMENT Block size to be used for MyISAM index pages
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 16384
-@@ -2269,7 +2269,7 @@
+@@ -2325,7 +2325,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 6
VARIABLE_SCOPE GLOBAL
@@ -552,7 +561,7 @@
VARIABLE_COMMENT Default pointer size to be used for MyISAM tables
NUMERIC_MIN_VALUE 2
NUMERIC_MAX_VALUE 7
-@@ -2279,9 +2279,9 @@
+@@ -2335,9 +2335,9 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MYISAM_MAX_SORT_FILE_SIZE
SESSION_VALUE NULL
@@ -564,7 +573,7 @@
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Don't use the fast sort index method to created index if the temporary file would get bigger than this
-@@ -2293,14 +2293,14 @@
+@@ -2349,14 +2349,14 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MYISAM_MMAP_SIZE
SESSION_VALUE NULL
@@ -582,7 +591,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY YES
-@@ -2325,10 +2325,10 @@
+@@ -2381,10 +2381,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE SESSION
@@ -595,7 +604,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -2342,7 +2342,7 @@
+@@ -2398,7 +2398,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE
NUMERIC_MIN_VALUE 4096
@@ -604,7 +613,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -2395,7 +2395,7 @@
+@@ -2451,7 +2451,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 16384
VARIABLE_SCOPE SESSION
@@ -613,7 +622,7 @@
VARIABLE_COMMENT Buffer length for TCP/IP and socket communication
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 1048576
-@@ -2409,7 +2409,7 @@
+@@ -2465,7 +2465,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 30
VARIABLE_SCOPE SESSION
@@ -622,7 +631,7 @@
VARIABLE_COMMENT Number of seconds to wait for more data from a connection before aborting the read
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 31536000
-@@ -2423,7 +2423,7 @@
+@@ -2479,7 +2479,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 10
VARIABLE_SCOPE SESSION
@@ -631,7 +640,7 @@
VARIABLE_COMMENT If a read on a communication port is interrupted, retry this many times before giving up
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -2437,7 +2437,7 @@
+@@ -2493,7 +2493,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 60
VARIABLE_SCOPE SESSION
@@ -640,7 +649,7 @@
VARIABLE_COMMENT Number of seconds to wait for a block to be written to a connection before aborting the write
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 31536000
-@@ -2507,7 +2507,7 @@
+@@ -2563,7 +2563,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE SESSION
@@ -649,7 +658,7 @@
VARIABLE_COMMENT Controls the heuristic(s) applied during query optimization to prune less-promising partial plans from the optimizer search space. Meaning: 0 - do not apply any heuristic, thus perform exhaustive search; 1 - prune plans based on number of retrieved rows
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1
-@@ -2521,7 +2521,7 @@
+@@ -2577,7 +2577,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 62
VARIABLE_SCOPE SESSION
@@ -658,7 +667,7 @@
VARIABLE_COMMENT Maximum depth of search performed by the query optimizer. Values larger than the number of relations in a query result in better query plans, but take longer to compile 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
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 63
-@@ -2535,7 +2535,7 @@
+@@ -2591,7 +2591,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 100
VARIABLE_SCOPE SESSION
@@ -667,7 +676,7 @@
VARIABLE_COMMENT Controls number of record samples to check condition selectivity
NUMERIC_MIN_VALUE 10
NUMERIC_MAX_VALUE 4294967295
-@@ -2563,7 +2563,7 @@
+@@ -2619,7 +2619,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE SESSION
@@ -676,7 +685,7 @@
VARIABLE_COMMENT Controls selectivity of which conditions the optimizer takes into account to calculate cardinality of a partial join when it searches for the best execution plan Meaning: 1 - use selectivity of index backed range conditions to calculate the cardinality of a partial join if the last joined table is accessed by full table scan or an index scan, 2 - use selectivity of index backed range conditions to calculate the cardinality of a partial join in any case, 3 - additionally always use selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join, 4 - use histograms to calculate selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join.5 - additionally use selectivity of certain non-range predicates calculated on record samples
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 5
-@@ -2591,7 +2591,7 @@
+@@ -2647,7 +2647,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -685,7 +694,7 @@
VARIABLE_COMMENT Maximum number of instrumented user@host accounts. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2605,7 +2605,7 @@
+@@ -2661,7 +2661,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -694,7 +703,7 @@
VARIABLE_COMMENT Size of the statement digest. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 200
-@@ -2619,7 +2619,7 @@
+@@ -2675,7 +2675,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -703,7 +712,7 @@
VARIABLE_COMMENT Number of rows in EVENTS_STAGES_HISTORY_LONG. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2633,7 +2633,7 @@
+@@ -2689,7 +2689,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -712,7 +721,7 @@
VARIABLE_COMMENT Number of rows per thread in EVENTS_STAGES_HISTORY. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1024
-@@ -2647,7 +2647,7 @@
+@@ -2703,7 +2703,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -721,7 +730,7 @@
VARIABLE_COMMENT Number of rows in EVENTS_STATEMENTS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2661,7 +2661,7 @@
+@@ -2717,7 +2717,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -730,7 +739,7 @@
VARIABLE_COMMENT Number of rows per thread in EVENTS_STATEMENTS_HISTORY. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1024
-@@ -2675,7 +2675,7 @@
+@@ -2731,7 +2731,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -739,7 +748,7 @@
VARIABLE_COMMENT Number of rows in EVENTS_WAITS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2689,7 +2689,7 @@
+@@ -2745,7 +2745,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -748,7 +757,7 @@
VARIABLE_COMMENT Number of rows per thread in EVENTS_WAITS_HISTORY. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1024
-@@ -2703,7 +2703,7 @@
+@@ -2759,7 +2759,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -757,7 +766,7 @@
VARIABLE_COMMENT Maximum number of instrumented hosts. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2717,7 +2717,7 @@
+@@ -2773,7 +2773,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 80
VARIABLE_SCOPE GLOBAL
@@ -766,7 +775,7 @@
VARIABLE_COMMENT Maximum number of condition instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2731,7 +2731,7 @@
+@@ -2787,7 +2787,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -775,7 +784,16 @@
VARIABLE_COMMENT Maximum number of instrumented condition objects. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2745,7 +2745,7 @@
+@@ -2801,7 +2801,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 1024
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Maximum length considered for digest text, when stored in performance_schema tables.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 1048576
+@@ -2801,7 +2801,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 50
VARIABLE_SCOPE GLOBAL
@@ -784,7 +802,7 @@
VARIABLE_COMMENT Maximum number of file instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2759,7 +2759,7 @@
+@@ -2815,7 +2815,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 32768
VARIABLE_SCOPE GLOBAL
@@ -793,7 +811,7 @@
VARIABLE_COMMENT Maximum number of opened instrumented files.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1048576
-@@ -2773,7 +2773,7 @@
+@@ -2829,7 +2829,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -802,7 +820,7 @@
VARIABLE_COMMENT Maximum number of instrumented files. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2787,7 +2787,7 @@
+@@ -2843,7 +2843,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 200
VARIABLE_SCOPE GLOBAL
@@ -811,7 +829,7 @@
VARIABLE_COMMENT Maximum number of mutex instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2801,7 +2801,7 @@
+@@ -2857,7 +2857,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -820,7 +838,7 @@
VARIABLE_COMMENT Maximum number of instrumented MUTEX objects. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 104857600
-@@ -2815,7 +2815,7 @@
+@@ -2871,7 +2871,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 40
VARIABLE_SCOPE GLOBAL
@@ -829,7 +847,7 @@
VARIABLE_COMMENT Maximum number of rwlock instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2829,7 +2829,7 @@
+@@ -2885,7 +2885,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -838,7 +856,7 @@
VARIABLE_COMMENT Maximum number of instrumented RWLOCK objects. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 104857600
-@@ -2843,7 +2843,7 @@
+@@ -2899,7 +2899,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 10
VARIABLE_SCOPE GLOBAL
@@ -847,7 +865,7 @@
VARIABLE_COMMENT Maximum number of socket instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2857,7 +2857,7 @@
+@@ -2913,7 +2913,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -856,7 +874,7 @@
VARIABLE_COMMENT Maximum number of opened instrumented sockets. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2871,7 +2871,7 @@
+@@ -2927,7 +2927,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 150
VARIABLE_SCOPE GLOBAL
@@ -865,7 +883,7 @@
VARIABLE_COMMENT Maximum number of stage instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2885,7 +2885,7 @@
+@@ -2941,7 +2941,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 178
VARIABLE_SCOPE GLOBAL
@@ -874,7 +892,7 @@
VARIABLE_COMMENT Maximum number of statement instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2899,7 +2899,7 @@
+@@ -2955,7 +2955,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -883,7 +901,7 @@
VARIABLE_COMMENT Maximum number of opened instrumented tables. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2913,7 +2913,7 @@
+@@ -2969,7 +2969,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -892,7 +910,7 @@
VARIABLE_COMMENT Maximum number of instrumented tables. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2927,7 +2927,7 @@
+@@ -2983,7 +2983,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 50
VARIABLE_SCOPE GLOBAL
@@ -901,7 +919,7 @@
VARIABLE_COMMENT Maximum number of thread instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2941,7 +2941,7 @@
+@@ -2997,7 +2997,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -910,7 +928,7 @@
VARIABLE_COMMENT Maximum number of instrumented threads. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2955,7 +2955,7 @@
+@@ -3011,7 +3011,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -919,7 +937,7 @@
VARIABLE_COMMENT Size of session attribute string buffer per thread. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2969,7 +2969,7 @@
+@@ -3025,7 +3025,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 100
VARIABLE_SCOPE GLOBAL
@@ -928,7 +946,7 @@
VARIABLE_COMMENT Maximum number of rows in SETUP_ACTORS.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1024
-@@ -2983,7 +2983,7 @@
+@@ -3039,7 +3039,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 100
VARIABLE_SCOPE GLOBAL
@@ -937,7 +955,7 @@
VARIABLE_COMMENT Maximum number of rows in SETUP_OBJECTS.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1048576
-@@ -2997,7 +2997,7 @@
+@@ -3053,7 +3053,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE -1
VARIABLE_SCOPE GLOBAL
@@ -946,7 +964,7 @@
VARIABLE_COMMENT Maximum number of instrumented users. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -3067,7 +3067,7 @@
+@@ -3123,7 +3123,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 32768
VARIABLE_SCOPE SESSION
@@ -955,7 +973,7 @@
VARIABLE_COMMENT The size of the buffer that is allocated when preloading indexes
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 1073741824
-@@ -3095,7 +3095,7 @@
+@@ -3151,7 +3151,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 15
VARIABLE_SCOPE SESSION
@@ -964,7 +982,7 @@
VARIABLE_COMMENT Limit of query profiling memory
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 100
-@@ -3109,7 +3109,7 @@
+@@ -3165,7 +3165,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 5
VARIABLE_SCOPE SESSION
@@ -973,7 +991,7 @@
VARIABLE_COMMENT Seconds between sending progress reports to the client for time-consuming statements. Set to 0 to disable progress reporting.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -3165,10 +3165,10 @@
+@@ -3221,10 +3221,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE SESSION ONLY
@@ -986,7 +1004,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3179,7 +3179,7 @@
+@@ -3235,7 +3235,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 16384
VARIABLE_SCOPE SESSION
@@ -995,7 +1013,7 @@
VARIABLE_COMMENT Allocation block size for query parsing and execution
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 4294967295
-@@ -3193,7 +3193,7 @@
+@@ -3249,7 +3249,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1048576
VARIABLE_SCOPE GLOBAL
@@ -1004,7 +1022,7 @@
VARIABLE_COMMENT Don't cache results that are bigger than this
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -3207,7 +3207,7 @@
+@@ -3263,7 +3263,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 4096
VARIABLE_SCOPE GLOBAL
@@ -1013,7 +1031,7 @@
VARIABLE_COMMENT The minimum size for blocks allocated by the query cache
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -3224,7 +3224,7 @@
+@@ -3280,7 +3280,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The memory allocated to store results from old queries
NUMERIC_MIN_VALUE 0
@@ -1022,7 +1040,7 @@
NUMERIC_BLOCK_SIZE 1024
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3277,7 +3277,7 @@
+@@ -3333,7 +3333,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 24576
VARIABLE_SCOPE SESSION
@@ -1031,7 +1049,7 @@
VARIABLE_COMMENT Persistent buffer for query parsing and execution
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 4294967295
-@@ -3291,7 +3291,7 @@
+@@ -3347,7 +3347,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 4096
VARIABLE_SCOPE SESSION
@@ -1040,7 +1058,7 @@
VARIABLE_COMMENT Allocation block size for storing ranges during optimization
NUMERIC_MIN_VALUE 4096
NUMERIC_MAX_VALUE 4294967295
-@@ -3305,7 +3305,7 @@
+@@ -3361,7 +3361,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 131072
VARIABLE_SCOPE SESSION
@@ -1049,7 +1067,7 @@
VARIABLE_COMMENT Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value
NUMERIC_MIN_VALUE 8192
NUMERIC_MAX_VALUE 2147483647
-@@ -3333,7 +3333,7 @@
+@@ -3389,7 +3389,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 262144
VARIABLE_SCOPE SESSION
@@ -1058,7 +1076,7 @@
VARIABLE_COMMENT When reading rows in sorted order after a sort, the rows are read through this buffer to avoid a disk seeks
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 2147483647
-@@ -3599,10 +3599,10 @@
+@@ -3669,10 +3669,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 8388608
VARIABLE_SCOPE SESSION
@@ -1071,7 +1089,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3641,7 +3641,7 @@
+@@ -3711,7 +3711,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 0
VARIABLE_SCOPE SESSION
@@ -1080,7 +1098,7 @@
VARIABLE_COMMENT Uniquely identifies the server instance in the community of replication partners
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -3767,7 +3767,7 @@
+@@ -3837,7 +3837,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -1089,7 +1107,7 @@
VARIABLE_COMMENT Maximum number of parallel threads to use on slave for events in a single replication domain. When using multiple domains, this can be used to limit a single domain from grabbing all threads and thus stalling other domains. The default of 0 means to allow a domain to grab as many threads as it wants, up to the value of slave_parallel_threads.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 16383
-@@ -3809,7 +3809,7 @@
+@@ -3879,7 +3879,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1073741824
VARIABLE_SCOPE GLOBAL
@@ -1098,7 +1116,7 @@
VARIABLE_COMMENT The maximum packet length to sent successfully from the master to slave.
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 1073741824
-@@ -3837,7 +3837,7 @@
+@@ -3907,7 +3907,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 131072
VARIABLE_SCOPE GLOBAL
@@ -1107,7 +1125,7 @@
VARIABLE_COMMENT Limit on how much memory SQL threads should use per parallel replication thread when reading ahead in the relay log looking for opportunities for parallel replication. Only used when --slave-parallel-threads > 0.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 2147483647
-@@ -3865,7 +3865,7 @@
+@@ -3935,7 +3935,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -1116,7 +1134,7 @@
VARIABLE_COMMENT If non-zero, number of threads to spawn to apply in parallel events on the slave that were group-committed on the master or were logged with GTID in different replication domains. Note that these threads are in addition to the IO and SQL threads, which are always created by a replication slave
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 16383
-@@ -3921,7 +3921,7 @@
+@@ -3991,7 +3991,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 10
VARIABLE_SCOPE GLOBAL
@@ -1125,7 +1143,7 @@
VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout, before giving up and stopping
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -3949,7 +3949,7 @@
+@@ -4019,7 +4019,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 2
VARIABLE_SCOPE GLOBAL
@@ -1134,7 +1152,7 @@
VARIABLE_COMMENT If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 31536000
-@@ -4008,7 +4008,7 @@
+@@ -4078,7 +4078,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Each thread that needs to do a sort allocates a buffer of this size
NUMERIC_MIN_VALUE 1024
@@ -1143,7 +1161,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -4299,7 +4299,7 @@
+@@ -4369,7 +4369,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 256
VARIABLE_SCOPE GLOBAL
@@ -1152,8 +1170,8 @@
VARIABLE_COMMENT The soft upper limit for number of cached stored routines for one connection.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 524288
-@@ -4397,7 +4397,7 @@
- GLOBAL_VALUE_ORIGIN COMPILE-TIME
+@@ -4467,7 +4467,7 @@
+ GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE 400
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
@@ -1161,16 +1179,16 @@
VARIABLE_COMMENT The number of cached table definitions
NUMERIC_MIN_VALUE 400
NUMERIC_MAX_VALUE 524288
-@@ -4411,7 +4411,7 @@
+@@ -4481,7 +4481,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
- DEFAULT_VALUE 400
+ DEFAULT_VALUE 2000
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT The number of cached open tables
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 524288
-@@ -4425,7 +4425,7 @@
+@@ -4495,7 +4495,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -1179,7 +1197,7 @@
VARIABLE_COMMENT How many threads we should keep in a cache for reuse
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 16384
-@@ -4439,7 +4439,7 @@
+@@ -4509,7 +4509,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 10
VARIABLE_SCOPE GLOBAL
@@ -1188,7 +1206,7 @@
VARIABLE_COMMENT Permits the application to give the threads system a hint for the desired number of threads that should be run at the same time.This variable has no effect, and is deprecated. It will be removed in a future release.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 512
-@@ -4624,7 +4624,7 @@
+@@ -4694,7 +4694,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM or Aria table
NUMERIC_MIN_VALUE 1024
@@ -1197,7 +1215,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -4635,7 +4635,7 @@
+@@ -4705,7 +4705,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 8192
VARIABLE_SCOPE SESSION
@@ -1206,7 +1224,7 @@
VARIABLE_COMMENT Allocation block size for transactions to be stored in binary log
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 134217728
-@@ -4649,7 +4649,7 @@
+@@ -4719,7 +4719,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 4096
VARIABLE_SCOPE SESSION
@@ -1215,7 +1233,7 @@
VARIABLE_COMMENT Persistent buffer for transactions to be stored in binary log
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 134217728
-@@ -4747,7 +4747,7 @@
+@@ -4817,7 +4817,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 28800
VARIABLE_SCOPE SESSION
@@ -1224,7 +1242,7 @@
VARIABLE_COMMENT The number of seconds the server waits for activity on a connection before closing it
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 31536000
-@@ -4851,7 +4851,7 @@
+@@ -4921,7 +4921,7 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME OPEN_FILES_LIMIT
VARIABLE_SCOPE GLOBAL
@@ -1233,7 +1251,7 @@
VARIABLE_COMMENT 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
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -4864,7 +4864,7 @@
+@@ -4934,7 +4934,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
NUMERIC_MIN_VALUE 0
@@ -1242,7 +1260,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -4874,7 +4874,7 @@
+@@ -4944,7 +4944,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
NUMERIC_MIN_VALUE 0
@@ -1251,7 +1269,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -4959,7 +4959,7 @@
+@@ -5029,7 +5029,7 @@
VARIABLE_NAME LOG_TC_SIZE
GLOBAL_VALUE_ORIGIN AUTO
VARIABLE_SCOPE GLOBAL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
index 10b3b12dabb..71b8790a3c1 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
@@ -81,13 +81,13 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME BACK_LOG
SESSION_VALUE NULL
-GLOBAL_VALUE 150
-GLOBAL_VALUE_ORIGIN COMPILE-TIME
+GLOBAL_VALUE 80
+GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE 150
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
-VARIABLE_COMMENT The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time
-NUMERIC_MIN_VALUE 1
+VARIABLE_COMMENT The number of outstanding connection requests MariaDB can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time
+NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 65535
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
@@ -233,6 +233,20 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME BINLOG_ROW_IMAGE
+SESSION_VALUE FULL
+GLOBAL_VALUE FULL
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE FULL
+VARIABLE_SCOPE SESSION
+VARIABLE_TYPE ENUM
+VARIABLE_COMMENT Controls whether rows should be logged in 'FULL', 'NOBLOB' or 'MINIMAL' formats. 'FULL', means that all columns in the before and after image are logged. 'NOBLOB', means that mysqld avoids logging blob columns whenever possible (eg, blob column was not changed or is not part of primary key). 'MINIMAL', means that a PK equivalent (PK columns or full row if there is no PK in the table) is logged in the before image, and only changed columns are logged in the after image. (Default: FULL).
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST MINIMAL,NOBLOB,FULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME BINLOG_STMT_CACHE_SIZE
SESSION_VALUE NULL
GLOBAL_VALUE 32768
@@ -695,6 +709,20 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME ENCRYPT_BINLOG
+SESSION_VALUE NULL
+GLOBAL_VALUE OFF
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE OFF
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BOOLEAN
+VARIABLE_COMMENT Encrypt binary logs (including relay logs)
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST OFF,ON
+READ_ONLY YES
+COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME ENCRYPT_TMP_DISK_TABLES
SESSION_VALUE NULL
GLOBAL_VALUE OFF
@@ -711,9 +739,9 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME ENCRYPT_TMP_FILES
SESSION_VALUE NULL
-GLOBAL_VALUE ON
+GLOBAL_VALUE OFF
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE ON
+DEFAULT_VALUE OFF
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Encrypt temporary files (created for filesort, binary log cache, etc)
@@ -725,10 +753,10 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME ENFORCE_STORAGE_ENGINE
SESSION_VALUE
-GLOBAL_VALUE NULL
+GLOBAL_VALUE
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
-VARIABLE_SCOPE SESSION ONLY
+VARIABLE_SCOPE SESSION
VARIABLE_TYPE VARCHAR
VARIABLE_COMMENT Force the use of a storage engine for new tables
NUMERIC_MIN_VALUE NULL
@@ -1243,8 +1271,8 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME HOST_CACHE_SIZE
SESSION_VALUE NULL
-GLOBAL_VALUE 128
-GLOBAL_VALUE_ORIGIN COMPILE-TIME
+GLOBAL_VALUE 279
+GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE 128
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
@@ -1382,10 +1410,10 @@ ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME JOIN_BUFFER_SIZE
-SESSION_VALUE 131072
-GLOBAL_VALUE 131072
+SESSION_VALUE 262144
+GLOBAL_VALUE 262144
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 131072
+DEFAULT_VALUE 262144
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The size of the buffer that is used for joins
@@ -1445,9 +1473,9 @@ DEFAULT_VALUE 134217728
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford
-NUMERIC_MIN_VALUE NULL
-NUMERIC_MAX_VALUE NULL
-NUMERIC_BLOCK_SIZE NULL
+NUMERIC_MIN_VALUE 0
+NUMERIC_MAX_VALUE 18446744073709551615
+NUMERIC_BLOCK_SIZE 4096
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -1459,9 +1487,9 @@ DEFAULT_VALUE 300
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT This characterizes the number of hits a hot block has to be untouched until it is considered aged enough to be downgraded to a warm block. This specifies the percentage ratio of that number of hits to the total number of blocks in key cache
-NUMERIC_MIN_VALUE NULL
-NUMERIC_MAX_VALUE NULL
-NUMERIC_BLOCK_SIZE NULL
+NUMERIC_MIN_VALUE 100
+NUMERIC_MAX_VALUE 4294967295
+NUMERIC_BLOCK_SIZE 100
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -1473,9 +1501,9 @@ DEFAULT_VALUE 1024
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The default size of key cache blocks
-NUMERIC_MIN_VALUE NULL
-NUMERIC_MAX_VALUE NULL
-NUMERIC_BLOCK_SIZE NULL
+NUMERIC_MIN_VALUE 512
+NUMERIC_MAX_VALUE 16384
+NUMERIC_BLOCK_SIZE 512
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -1487,9 +1515,9 @@ DEFAULT_VALUE 100
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The minimum percentage of warm blocks in key cache
-NUMERIC_MIN_VALUE NULL
-NUMERIC_MAX_VALUE NULL
-NUMERIC_BLOCK_SIZE NULL
+NUMERIC_MIN_VALUE 1
+NUMERIC_MAX_VALUE 100
+NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -1501,9 +1529,9 @@ DEFAULT_VALUE 512
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Number of hash buckets for open and changed files. If you have a lot of MyISAM files open you should increase this for faster flush of changes. A good value is probably 1/10 of number of possible open MyISAM files.
-NUMERIC_MIN_VALUE NULL
-NUMERIC_MAX_VALUE NULL
-NUMERIC_BLOCK_SIZE NULL
+NUMERIC_MIN_VALUE 128
+NUMERIC_MAX_VALUE 16384
+NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -1515,9 +1543,9 @@ DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The number of segments in a key cache
-NUMERIC_MIN_VALUE NULL
-NUMERIC_MAX_VALUE NULL
-NUMERIC_BLOCK_SIZE NULL
+NUMERIC_MIN_VALUE 0
+NUMERIC_MAX_VALUE 64
+NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -1689,6 +1717,34 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL
+VARIABLE_NAME LOG_BIN_BASENAME
+SESSION_VALUE NULL
+GLOBAL_VALUE
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE NULL
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE VARCHAR
+VARIABLE_COMMENT The full path of the binary log file names, excluding the extension.
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST NULL
+READ_ONLY YES
+COMMAND_LINE_ARGUMENT NULL
+VARIABLE_NAME LOG_BIN_INDEX
+SESSION_VALUE NULL
+GLOBAL_VALUE
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE NULL
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE VARCHAR
+VARIABLE_COMMENT File that holds the names for last binary log files.
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST NULL
+READ_ONLY YES
+COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME LOG_BIN_TRUST_FUNCTION_CREATORS
SESSION_VALUE NULL
GLOBAL_VALUE ON
@@ -1858,10 +1914,10 @@ ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME MAX_ALLOWED_PACKET
-SESSION_VALUE 1048576
-GLOBAL_VALUE 1048576
+SESSION_VALUE 4194304
+GLOBAL_VALUE 4194304
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 1048576
+DEFAULT_VALUE 4194304
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Max packet length to send to or receive from the server
@@ -2041,7 +2097,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_LONG_DATA_SIZE
SESSION_VALUE NULL
-GLOBAL_VALUE 1048576
+GLOBAL_VALUE 4194304
GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE 1048576
VARIABLE_SCOPE GLOBAL
@@ -2739,6 +2795,20 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_DIGEST_LENGTH
+SESSION_VALUE NULL
+GLOBAL_VALUE 1024
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE 1024
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BIGINT
+VARIABLE_COMMENT Maximum length considered for digest text, when stored in performance_schema tables.
+NUMERIC_MIN_VALUE 0
+NUMERIC_MAX_VALUE 1048576
+NUMERIC_BLOCK_SIZE 1
+ENUM_VALUE_LIST NULL
+READ_ONLY YES
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_FILE_CLASSES
SESSION_VALUE NULL
GLOBAL_VALUE 50
@@ -3217,9 +3287,9 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME QUERY_CACHE_SIZE
SESSION_VALUE NULL
-GLOBAL_VALUE 0
+GLOBAL_VALUE 1048576
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 0
+DEFAULT_VALUE 1048576
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The memory allocated to store results from old queries
@@ -3244,10 +3314,10 @@ ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME QUERY_CACHE_TYPE
-SESSION_VALUE ON
-GLOBAL_VALUE ON
+SESSION_VALUE OFF
+GLOBAL_VALUE OFF
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE ON
+DEFAULT_VALUE OFF
VARIABLE_SCOPE SESSION
VARIABLE_TYPE ENUM
VARIABLE_COMMENT OFF = Don't cache or retrieve results. ON = Cache all results except SELECT SQL_NO_CACHE ... queries. DEMAND = Cache only SELECT SQL_CACHE ... queries
@@ -3355,11 +3425,25 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME RELAY_LOG_BASENAME
+SESSION_VALUE NULL
+GLOBAL_VALUE PATH
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE NULL
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE VARCHAR
+VARIABLE_COMMENT The full path of the relay log file names, excluding the extension.
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST NULL
+READ_ONLY YES
+COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME RELAY_LOG_INDEX
SESSION_VALUE NULL
-GLOBAL_VALUE mysqld-relay-bin.index
-GLOBAL_VALUE_ORIGIN AUTO
-DEFAULT_VALUE
+GLOBAL_VALUE PATH
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE VARCHAR
VARIABLE_COMMENT The location and name to use for the file that keeps a list of the last relay logs
@@ -3368,7 +3452,7 @@ NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
-COMMAND_LINE_ARGUMENT REQUIRED
+COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME RELAY_LOG_INFO_FILE
SESSION_VALUE NULL
GLOBAL_VALUE relay-log.info
@@ -3609,9 +3693,9 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SECURE_AUTH
SESSION_VALUE NULL
-GLOBAL_VALUE OFF
+GLOBAL_VALUE ON
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE OFF
+DEFAULT_VALUE ON
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Disallow authentication for accounts that have old (pre-4.1) passwords
@@ -4085,9 +4169,9 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME SQL_MODE
SESSION_VALUE ANSI_QUOTES
-GLOBAL_VALUE
+GLOBAL_VALUE NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE
+DEFAULT_VALUE NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
VARIABLE_SCOPE SESSION
VARIABLE_TYPE SET
VARIABLE_COMMENT Sets the sql mode
@@ -4351,12 +4435,12 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME SYNC_MASTER_INFO
SESSION_VALUE NULL
-GLOBAL_VALUE 0
+GLOBAL_VALUE 10000
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 0
+DEFAULT_VALUE 10000
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
-VARIABLE_COMMENT Synchronously flush master info to disk after every #th event. Use 0 (default) to disable synchronous flushing
+VARIABLE_COMMENT Synchronously flush master info to disk after every #th event. Use 0 to disable synchronous flushing
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 1
@@ -4365,12 +4449,12 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SYNC_RELAY_LOG
SESSION_VALUE NULL
-GLOBAL_VALUE 0
+GLOBAL_VALUE 10000
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 0
+DEFAULT_VALUE 10000
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
-VARIABLE_COMMENT Synchronously flush relay log to disk after every #th event. Use 0 (default) to disable synchronous flushing
+VARIABLE_COMMENT Synchronously flush relay log to disk after every #th event. Use 0 to disable synchronous flushing
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 1
@@ -4379,12 +4463,12 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SYNC_RELAY_LOG_INFO
SESSION_VALUE NULL
-GLOBAL_VALUE 0
+GLOBAL_VALUE 10000
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 0
+DEFAULT_VALUE 10000
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
-VARIABLE_COMMENT Synchronously flush relay log info to disk after every #th transaction. Use 0 (default) to disable synchronous flushing
+VARIABLE_COMMENT Synchronously flush relay log info to disk after every #th transaction. Use 0 to disable synchronous flushing
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 1
@@ -4394,7 +4478,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME TABLE_DEFINITION_CACHE
SESSION_VALUE NULL
GLOBAL_VALUE 400
-GLOBAL_VALUE_ORIGIN COMPILE-TIME
+GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE 400
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
@@ -4407,9 +4491,9 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME TABLE_OPEN_CACHE
SESSION_VALUE NULL
-GLOBAL_VALUE 400
+GLOBAL_VALUE 2000
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 400
+DEFAULT_VALUE 2000
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The number of cached open tables
diff --git a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
index 1763078e2d7..54fd0beafdc 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
@@ -352,11 +352,11 @@ ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME WSREP_OSU_METHOD
-SESSION_VALUE NULL
+SESSION_VALUE TOI
GLOBAL_VALUE TOI
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE TOI
-VARIABLE_SCOPE GLOBAL
+VARIABLE_SCOPE SESSION
VARIABLE_TYPE ENUM
VARIABLE_COMMENT Method for Online Schema Upgrade
NUMERIC_MIN_VALUE NULL
diff --git a/mysql-test/suite/sys_vars/r/table_open_cache_basic.result b/mysql-test/suite/sys_vars/r/table_open_cache_basic.result
index 2381dfe4900..d940ed69901 100644
--- a/mysql-test/suite/sys_vars/r/table_open_cache_basic.result
+++ b/mysql-test/suite/sys_vars/r/table_open_cache_basic.result
@@ -1,18 +1,18 @@
SET @start_value = @@global.table_open_cache ;
SELECT @start_value;
@start_value
-400
+2000
'#--------------------FN_DYNVARS_001_01------------------------#'
SET @@global.table_open_cache = 99;
SET @@global.table_open_cache = DeFAULT;
SELECT @@global.table_open_cache;
@@global.table_open_cache
-400
+2000
'#---------------------FN_DYNVARS_001_02-------------------------#'
SET @@global.table_open_cache = Default;
SELECT @@global.table_open_cache = 400;
@@global.table_open_cache = 400
-1
+0
'#--------------------FN_DYNVARS_001_03------------------------#'
SET @@global.table_open_cache = 8;
SELECT @@global.table_open_cache ;
@@ -104,4 +104,4 @@ ERROR 42S22: Unknown column 'table_open_cache' in 'field list'
SET @@global.table_open_cache = @start_value;
SELECT @@global.table_open_cache ;
@@global.table_open_cache
-400
+2000
diff --git a/mysql-test/suite/sys_vars/r/wsrep_desync_basic.result b/mysql-test/suite/sys_vars/r/wsrep_desync_basic.result
index 69599c4b47a..991be9ade86 100644
--- a/mysql-test/suite/sys_vars/r/wsrep_desync_basic.result
+++ b/mysql-test/suite/sys_vars/r/wsrep_desync_basic.result
@@ -13,13 +13,11 @@ SELECT @@global.wsrep_desync;
SELECT @@session.wsrep_desync;
ERROR HY000: Variable 'wsrep_desync' is a GLOBAL variable
SET @@global.wsrep_desync=OFF;
-Warnings:
-Warning 1231 'wsrep_desync' is already OFF.
SELECT @@global.wsrep_desync;
@@global.wsrep_desync
0
SET @@global.wsrep_desync=ON;
-ERROR HY000: Operation 'desync' failed for SET @@global.wsrep_desync=ON
+Got one of the listed errors
SELECT @@global.wsrep_desync;
@@global.wsrep_desync
1
@@ -30,7 +28,7 @@ SELECT @@global.wsrep_desync;
@@global.wsrep_desync
0
SET @@global.wsrep_desync=ON;
-ERROR HY000: Operation 'desync' failed for SET @@global.wsrep_desync=ON
+Got one of the listed errors
SELECT @@global.wsrep_desync;
@@global.wsrep_desync
1
@@ -47,6 +45,4 @@ ERROR 42000: Variable 'wsrep_desync' can't be set to the value of 'junk'
# restore the initial value
SET @@global.wsrep_desync = @wsrep_desync_global_saved;
-Warnings:
-Warning 1231 'wsrep_desync' is already OFF.
# End of test
diff --git a/mysql-test/suite/sys_vars/r/wsrep_osu_method_basic.result b/mysql-test/suite/sys_vars/r/wsrep_osu_method_basic.result
index 95b59e62adc..10f1d654c12 100644
--- a/mysql-test/suite/sys_vars/r/wsrep_osu_method_basic.result
+++ b/mysql-test/suite/sys_vars/r/wsrep_osu_method_basic.result
@@ -10,7 +10,8 @@ TOI
# scope
SELECT @@session.wsrep_osu_method;
-ERROR HY000: Variable 'wsrep_OSU_method' is a GLOBAL variable
+@@session.wsrep_osu_method
+TOI
SET @@global.wsrep_osu_method=TOI;
SELECT @@global.wsrep_osu_method;
@@global.wsrep_osu_method
diff --git a/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result b/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result
index ed6b125e064..5ef36180de5 100644
--- a/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result
+++ b/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result
@@ -38,7 +38,7 @@ SELECT @@global.wsrep_provider_options;
@@global.wsrep_provider_options
SET @@global.wsrep_provider_options=NULL;
-ERROR HY000: Incorrect arguments to SET
+Got one of the listed errors
SELECT @@global.wsrep_provider_options;
@@global.wsrep_provider_options
NULL
diff --git a/mysql-test/suite/sys_vars/t/binlog_row_image_basic.test b/mysql-test/suite/sys_vars/t/binlog_row_image_basic.test
new file mode 100644
index 00000000000..6f5095b6a5d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_row_image_basic.test
@@ -0,0 +1,129 @@
+################## mysql-test\t\binlog_row_image_basic.test ###################
+# #
+# Variable Name: binlog_row_image #
+# Scope: Global & Session #
+# Access Type: Static #
+# Data Type: enumeration #
+# #
+# #
+# Creation Date: 2010-05-20 #
+# Author : Luis Soares #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable binlog_row_image #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.X/en/server-system-variables.html #
+# #
+###############################################################################
+
+
+SELECT @@GLOBAL.binlog_row_image;
+SELECT @@SESSION.binlog_row_image;
+--echo FULL Expected
+
+--echo '#---------------------BS_STVARS_002_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SET @start_value= @@global.binlog_row_image;
+
+SELECT COUNT(@@GLOBAL.binlog_row_image);
+--echo 1 Expected
+
+SELECT COUNT(@@SESSION.binlog_row_image);
+--echo 1 Expected
+
+--echo '#---------------------BS_STVARS_002_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+SET @@GLOBAL.binlog_row_image=0;
+SELECT @@GLOBAL.binlog_row_image;
+--echo MINIMAL Expected
+
+SET @@SESSION.binlog_row_image=0;
+SELECT @@SESSION.binlog_row_image;
+--echo MINIMAL Expected
+
+SET @@GLOBAL.binlog_row_image=1;
+SELECT @@GLOBAL.binlog_row_image;
+--echo NOBLOB Expected
+
+SET @@SESSION.binlog_row_image=1;
+SELECT @@SESSION.binlog_row_image;
+--echo NOBLOB Expected
+
+SET @@GLOBAL.binlog_row_image=2;
+SELECT @@GLOBAL.binlog_row_image;
+--echo FULL Expected
+
+SET @@SESSION.binlog_row_image=2;
+SELECT @@SESSION.binlog_row_image;
+--echo FULL Expected
+
+--echo '#---------------------BS_STVARS_002_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT @@GLOBAL.binlog_row_image = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='binlog_row_image';
+--enable_warnings
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.binlog_row_image);
+--echo 1 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='binlog_row_image';
+--enable_warnings
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_002_04----------------------#'
+#################################################################
+# Check if the value in SESSION Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT @@SESSION.binlog_row_image = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='binlog_row_image';
+--enable_warnings
+--echo 1 Expected
+
+SELECT COUNT(@@SESSION.binlog_row_image);
+--echo 1 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='binlog_row_image';
+--enable_warnings
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_002_05----------------------#'
+################################################################################
+# Check if binlog_row_image can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@binlog_row_image);
+--echo 1 Expected
+SELECT COUNT(@@local.binlog_row_image);
+--echo 1 Expected
+SELECT COUNT(@@SESSION.binlog_row_image);
+--echo 1 Expected
+SELECT COUNT(@@GLOBAL.binlog_row_image);
+--echo 1 Expected
+
+SET @@global.binlog_row_image= @start_value;
+
diff --git a/mysql-test/suite/sys_vars/t/debug_crc_break_basic.test b/mysql-test/suite/sys_vars/t/debug_crc_break_basic.test
deleted file mode 100644
index 435a6c33341..00000000000
--- a/mysql-test/suite/sys_vars/t/debug_crc_break_basic.test
+++ /dev/null
@@ -1,46 +0,0 @@
---source include/have_debug.inc
-# ulong global
-
-SET @start_global_value = @@global.debug_crc_break;
-
-#
-# exists as global only
-#
-select @@global.debug_crc_break;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-select @@session.debug_crc_break;
-show global variables like 'debug_crc_break';
-show session variables like 'debug_crc_break';
-select * from information_schema.global_variables where variable_name='debug_crc_break';
-select * from information_schema.session_variables where variable_name='debug_crc_break';
-
-#
-# show that it's writable
-#
-set global debug_crc_break=1;
-select @@global.debug_crc_break;
---error ER_GLOBAL_VARIABLE
-set session debug_crc_break=1;
-
-#
-# incorrect types
-#
---error ER_WRONG_TYPE_FOR_VAR
-set global debug_crc_break=1.1;
---error ER_WRONG_TYPE_FOR_VAR
-set global debug_crc_break=1e1;
---error ER_WRONG_TYPE_FOR_VAR
-set global debug_crc_break="foo";
-
-#
-# min/max values
-#
-set global debug_crc_break=0;
-select @@global.debug_crc_break;
---disable_warnings
-set global debug_crc_break=cast(-1 as unsigned int);
---enable_warnings
---replace_result 4294967295 18446744073709551615
-select @@global.debug_crc_break;
-
-SET @@global.debug_crc_break = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/innodb_buf_dump_status_frequency_basic.test b/mysql-test/suite/sys_vars/t/innodb_buf_dump_status_frequency_basic.test
new file mode 100644
index 00000000000..c505fbbd3b1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buf_dump_status_frequency_basic.test
@@ -0,0 +1,39 @@
+--source include/have_innodb.inc
+--source include/load_sysvars.inc
+
+SET @start_innodb_buf_dump_status_frequency = @@global.innodb_buf_dump_status_frequency;
+SELECT @start_innodb_buf_dump_status_frequency;
+
+SELECT COUNT(@@global.innodb_buf_dump_status_frequency);
+
+# test valid value
+SET @@global.innodb_buf_dump_status_frequency = 20;
+SELECT @@global.innodb_buf_dump_status_frequency;
+
+# test valid min
+SET @@global.innodb_buf_dump_status_frequency = 0;
+SELECT @@global.innodb_buf_dump_status_frequency;
+
+# test valid max
+SET @@global.innodb_buf_dump_status_frequency = 100;
+SELECT @@global.innodb_buf_dump_status_frequency;
+
+# test invalid value < min
+SET @@global.innodb_buf_dump_status_frequency = -1;
+SELECT @@global.innodb_buf_dump_status_frequency;
+
+# test invalid value > max
+SET @@global.innodb_buf_dump_status_frequency = 101;
+SELECT @@global.innodb_buf_dump_status_frequency;
+
+# test wrong type
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_buf_dump_status_frequency = 10.5;
+SELECT @@global.innodb_buf_dump_status_frequency;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_buf_dump_status_frequency = "abc";
+SELECT @@global.innodb_buf_dump_status_frequency;
+
+SET @@global.innodb_buf_dump_status_frequency = @start_innodb_buf_dump_status_frequency;
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test
index f988292b21e..11634e1e0c7 100644
--- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test
@@ -2,11 +2,6 @@
# This is a debug variable for now
-- source include/have_debug.inc
-if (`select plugin_auth_version <= "5.6.10" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in InnoDB 5.6.10 or earlier
-}
-
SELECT @@global.innodb_buffer_pool_evict;
SET GLOBAL innodb_buffer_pool_evict = 'uncompressed';
diff --git a/mysql-test/suite/sys_vars/t/innodb_thread_sleep_delay_basic.test b/mysql-test/suite/sys_vars/t/innodb_thread_sleep_delay_basic.test
index 782fb475140..85ae2358db5 100644
--- a/mysql-test/suite/sys_vars/t/innodb_thread_sleep_delay_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_thread_sleep_delay_basic.test
@@ -1,8 +1,3 @@
-if (`select plugin_auth_version <= "5.5.37-MariaDB-34.0" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in XtraDB as of 5.5.37-MariaDB-34.0 or earlier
-}
-
#
# 2010-01-27 - Added
#
diff --git a/mysql-test/suite/sys_vars/t/log_bin_basename_basic.test b/mysql-test/suite/sys_vars/t/log_bin_basename_basic.test
new file mode 100644
index 00000000000..8ad5bd22bb6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_bin_basename_basic.test
@@ -0,0 +1,13 @@
+#
+# WL#5465: System variables: paths to relay log and binary log files
+#
+# Test for variable:
+# Variable Name: log_bin_basename
+# Variable Scope: Global
+# Dynamic Variable: No
+
+--source include/not_embedded.inc
+--source include/have_log_bin.inc
+
+--let $rpl_log_var_name=log_bin_basename
+--source suite/sys_vars/inc/bin_relay_log_basename_index.inc
diff --git a/mysql-test/suite/sys_vars/t/log_bin_index_basic.test b/mysql-test/suite/sys_vars/t/log_bin_index_basic.test
new file mode 100644
index 00000000000..c99df79f36f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_bin_index_basic.test
@@ -0,0 +1,13 @@
+#
+# WL#5465: System variables: paths to relay log and binary log files
+#
+# Test for variable:
+# Variable Name: log_bin_index
+# Variable Scope: Global
+# Dynamic Variable: No
+
+--source include/not_embedded.inc
+--source include/have_log_bin.inc
+
+--let $rpl_log_var_name=log_bin_index
+--source suite/sys_vars/inc/bin_relay_log_basename_index.inc
diff --git a/mysql-test/suite/sys_vars/t/max_user_connections_func.test b/mysql-test/suite/sys_vars/t/max_user_connections_func.test
index 74707c9b296..2af396b614f 100644
--- a/mysql-test/suite/sys_vars/t/max_user_connections_func.test
+++ b/mysql-test/suite/sys_vars/t/max_user_connections_func.test
@@ -39,6 +39,7 @@ SET @default_max_user_connections = @@global.max_user_connections;
Set Global max_user_connections=2;
+CREATE USER test@localhost;
GRANT USAGE on *.* TO test@localhost;
--echo '#--------------------FN_DYNVARS_114_01-------------------------#'
diff --git a/mysql-test/suite/sys_vars/t/query_cache_limit_func.test b/mysql-test/suite/sys_vars/t/query_cache_limit_func.test
index e90a0e6adda..c115524d49d 100644
--- a/mysql-test/suite/sys_vars/t/query_cache_limit_func.test
+++ b/mysql-test/suite/sys_vars/t/query_cache_limit_func.test
@@ -31,6 +31,9 @@ SET @global_query_cache_limit = @@global.query_cache_limit;
SET @global_query_cache_size = @@global.query_cache_size;
SET @global_query_cache_type = @@global.query_cache_type;
+SET GLOBAL query_cache_type= ON;
+SET LOCAL query_cache_type= ON;
+
--echo ** warnings **
--disable_warnings
DROP TABLE IF EXISTS t;
diff --git a/mysql-test/suite/sys_vars/t/query_cache_type_func.test b/mysql-test/suite/sys_vars/t/query_cache_type_func.test
index 4679d1ec339..e015e374aeb 100644
--- a/mysql-test/suite/sys_vars/t/query_cache_type_func.test
+++ b/mysql-test/suite/sys_vars/t/query_cache_type_func.test
@@ -71,12 +71,15 @@ SET @@GLOBAL.query_cache_size = 65536;
SET @@query_cache_type = DEFAULT;
SELECT @@query_cache_type;
---echo ON Expected
+--echo OFF Expected
+--error ER_QUERY_CACHE_IS_GLOBALY_DISABLED
+SET @@query_cache_type = ON;
--echo '#--------------------FN_DYNVARS_135_02-------------------------#'
#
# Testing valid possible values
#
+SET GLOBAL query_cache_type= ON;
--error ER_WRONG_VALUE_FOR_VAR
SET @@query_cache_type = NULL;
diff --git a/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test b/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test
index e126a67ff30..5c7533eb50a 100644
--- a/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test
+++ b/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test
@@ -49,6 +49,11 @@ SET @start_session_value = @@SESSION.query_cache_wlock_invalidate;
SET @old_cache_size = @@GLOBAL.query_cache_size;
SET @old_cache_type = @@GLOBAL.query_cache_type;
+SET GLOBAL query_cache_type= ON;
+SET LOCAL query_cache_type= ON;
+connection con1;
+SET LOCAL query_cache_type= ON;
+connection con0;
#
# Creating test table
diff --git a/mysql-test/suite/sys_vars/t/relay_log_basename_basic.test b/mysql-test/suite/sys_vars/t/relay_log_basename_basic.test
new file mode 100644
index 00000000000..29b70e6cd47
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/relay_log_basename_basic.test
@@ -0,0 +1,16 @@
+#
+# WL#5465: System variables: paths to relay log and binary log files
+#
+# Test for variable:
+# Variable Name: relay_log_basename
+# Variable Scope: Global
+# Dynamic Variable: No
+
+--source include/not_embedded.inc
+--source include/master-slave.inc
+
+--connection slave
+--let $rpl_log_var_name=relay_log_basename
+--source suite/sys_vars/inc/bin_relay_log_basename_index.inc
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/sys_vars/t/relay_log_index_basic.test b/mysql-test/suite/sys_vars/t/relay_log_index_basic.test
index fa69d978016..5a585ac289f 100644
--- a/mysql-test/suite/sys_vars/t/relay_log_index_basic.test
+++ b/mysql-test/suite/sys_vars/t/relay_log_index_basic.test
@@ -1,13 +1,20 @@
--source include/not_embedded.inc
+--source include/master-slave.inc
+
#
# only global
#
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
select @@global.relay_log_index;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.relay_log_index;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
show global variables like 'relay_log_index';
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
show session variables like 'relay_log_index';
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
select * from information_schema.global_variables where variable_name='relay_log_index';
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
select * from information_schema.session_variables where variable_name='relay_log_index';
#
@@ -17,3 +24,10 @@ select * from information_schema.session_variables where variable_name='relay_lo
set global relay_log_index=1;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set session relay_log_index=1;
+
+--connection slave
+--let $rpl_log_var_name=relay_log_index
+--source suite/sys_vars/inc/bin_relay_log_basename_index.inc
+
+--source include/rpl_end.inc
+
diff --git a/mysql-test/suite/sys_vars/t/wsrep_cluster_address_basic.test b/mysql-test/suite/sys_vars/t/wsrep_cluster_address_basic.test
index b9e00901eb6..136c0745e42 100644
--- a/mysql-test/suite/sys_vars/t/wsrep_cluster_address_basic.test
+++ b/mysql-test/suite/sys_vars/t/wsrep_cluster_address_basic.test
@@ -43,6 +43,7 @@ SELECT @@global.wsrep_cluster_address;
--echo
--echo # restore the initial value
+--error 0,ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_cluster_address = @wsrep_cluster_address_global_saved;
--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_desync_basic.test b/mysql-test/suite/sys_vars/t/wsrep_desync_basic.test
index 15226c75d8b..67fe2402aed 100644
--- a/mysql-test/suite/sys_vars/t/wsrep_desync_basic.test
+++ b/mysql-test/suite/sys_vars/t/wsrep_desync_basic.test
@@ -17,21 +17,26 @@ SELECT @@global.wsrep_desync;
--echo # scope
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.wsrep_desync;
+--disable_warnings
+--error 0,ER_WRONG_ARGUMENTS
SET @@global.wsrep_desync=OFF;
+--enable_warnings
SELECT @@global.wsrep_desync;
# expected as no wsrep provider is currently loaded
---error ER_CANNOT_USER
+--error ER_CANNOT_USER,ER_WRONG_ARGUMENTS
SET @@global.wsrep_desync=ON;
SELECT @@global.wsrep_desync;
--echo
--echo # valid values
+--error 0,ER_WRONG_ARGUMENTS
SET @@global.wsrep_desync='OFF';
SELECT @@global.wsrep_desync;
# expected as no wsrep provider is currently loaded
---error ER_CANNOT_USER
+--error ER_CANNOT_USER,ER_WRONG_ARGUMENTS
SET @@global.wsrep_desync=ON;
SELECT @@global.wsrep_desync;
+--error 0,ER_WRONG_ARGUMENTS
SET @@global.wsrep_desync=default;
SELECT @@global.wsrep_desync;
@@ -44,6 +49,9 @@ SET @@global.wsrep_desync='junk';
--echo
--echo # restore the initial value
+--disable_warnings
+--error 0,ER_WRONG_ARGUMENTS
SET @@global.wsrep_desync = @wsrep_desync_global_saved;
+--enable_warnings
--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_osu_method_basic.test b/mysql-test/suite/sys_vars/t/wsrep_osu_method_basic.test
index d6d461075a5..ce3a3def88b 100644
--- a/mysql-test/suite/sys_vars/t/wsrep_osu_method_basic.test
+++ b/mysql-test/suite/sys_vars/t/wsrep_osu_method_basic.test
@@ -12,7 +12,6 @@ SELECT @@global.wsrep_osu_method;
--echo
--echo # scope
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.wsrep_osu_method;
SET @@global.wsrep_osu_method=TOI;
SELECT @@global.wsrep_osu_method;
diff --git a/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test b/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test
index 10ca8298029..73ec4ffc846 100644
--- a/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test
+++ b/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test
@@ -16,15 +16,19 @@ SELECT @@global.wsrep_provider_options;
--echo # scope
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.wsrep_provider_options;
+--error 0,ER_WRONG_ARGUMENTS
SET @@global.wsrep_provider_options='option1';
SELECT @@global.wsrep_provider_options;
--echo
--echo # valid values
+--error 0,ER_WRONG_ARGUMENTS
SET @@global.wsrep_provider_options='name1=value1;name2=value2';
SELECT @@global.wsrep_provider_options;
+--error 0,ER_WRONG_ARGUMENTS
SET @@global.wsrep_provider_options='hyphenated-name:value';
SELECT @@global.wsrep_provider_options;
+--error 0,ER_WRONG_ARGUMENTS
SET @@global.wsrep_provider_options=default;
SELECT @@global.wsrep_provider_options;
@@ -33,12 +37,13 @@ SELECT @@global.wsrep_provider_options;
--error ER_WRONG_TYPE_FOR_VAR
SET @@global.wsrep_provider_options=1;
SELECT @@global.wsrep_provider_options;
---error ER_WRONG_ARGUMENTS
+--error ER_WRONG_ARGUMENTS,ER_WRONG_ARGUMENTS
SET @@global.wsrep_provider_options=NULL;
SELECT @@global.wsrep_provider_options;
--echo
--echo # restore the initial value
+--error 0,ER_WRONG_ARGUMENTS
SET @@global.wsrep_provider_options = @wsrep_provider_options_global_saved;
--echo # End of test
diff --git a/mysql-test/suite/vcol/inc/vcol_blocked_sql_funcs_main.inc b/mysql-test/suite/vcol/inc/vcol_blocked_sql_funcs_main.inc
index 8124e4df888..571fe75560b 100644
--- a/mysql-test/suite/vcol/inc/vcol_blocked_sql_funcs_main.inc
+++ b/mysql-test/suite/vcol/inc/vcol_blocked_sql_funcs_main.inc
@@ -102,6 +102,18 @@ if (!$skip_full_text_checks)
-- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED
create table t1 (a varchar(1024), b varchar(1024) as (benchmark(a,3)));
+--echo # CHARSET()
+-- error ER_CONST_EXPR_IN_VCOL
+create table t1 (a varchar(64), b varchar(64) as (charset(a)));
+
+--echo # COERCIBILITY()
+-- error ER_CONST_EXPR_IN_VCOL
+create table t1 (a varchar(64), b int as (coercibility(a)));
+
+--echo # COLLATION()
+-- error ER_CONST_EXPR_IN_VCOL
+create table t1 (a varchar(64), b varchar(64) as (collation(a)));
+
--echo # CONNECTION_ID()
-- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED
create table t1 (a int as (connection_id()));
diff --git a/mysql-test/suite/vcol/inc/vcol_supported_sql_funcs_main.inc b/mysql-test/suite/vcol/inc/vcol_supported_sql_funcs_main.inc
index 5d2cbc63a6d..38f2b00a1a0 100644
--- a/mysql-test/suite/vcol/inc/vcol_supported_sql_funcs_main.inc
+++ b/mysql-test/suite/vcol/inc/vcol_supported_sql_funcs_main.inc
@@ -1142,24 +1142,6 @@ let $values1 = 5,default;
let $rows = 1;
--source suite/vcol/inc/vcol_supported_sql_funcs.inc
---echo # CHARSET()
-let $cols = a varchar(1024), b varchar(1024) as (charset(a));
-let $values1 = 'abc',default;
-let $rows = 1;
---source suite/vcol/inc/vcol_supported_sql_funcs.inc
-
---echo # COERCIBILITY()
-let $cols = a varchar(1024), b int as (coercibility(a));
-let $values1 = 'abc',default;
-let $rows = 1;
---source suite/vcol/inc/vcol_supported_sql_funcs.inc
-
---echo # COLLATION()
-let $cols = a varchar(1024), b varchar(1024) as (collation(a));
-let $values1 = 'abc',default;
-let $rows = 1;
---source suite/vcol/inc/vcol_supported_sql_funcs.inc
-
--echo # COMPRESS(), UNCOMPRESS()
let $cols = a varchar(1024), b varchar(1024) as (uncompress(compress(a)));
let $values1 = 'MySQL',default;
diff --git a/mysql-test/suite/vcol/r/load_data.result b/mysql-test/suite/vcol/r/load_data.result
new file mode 100644
index 00000000000..9769b55ac9a
--- /dev/null
+++ b/mysql-test/suite/vcol/r/load_data.result
@@ -0,0 +1,20 @@
+create table t1 ( c1 varchar(10), c2 varchar(10), c3 int );
+insert into t1 values ("a" , "b", 1), ("a" , "b", 2);
+create table t2 like t1 ;
+alter table t2 add column c4 bigint unsigned as (CONV(LEFT(MD5(concat(c1,c2,c3)), 16), 16, 10)) persistent unique key;
+select * into outfile 't1.csv' from t1;
+load data infile 't1.csv' into table t2 ;
+Warnings:
+Warning 1261 Row 1 doesn't contain data for all columns
+Warning 1261 Row 2 doesn't contain data for all columns
+select * from t2;
+c1 c2 c3 c4
+a b 1 7545402351885872315
+a b 2 6048842355806993119
+insert into t2 (c1,c2,c3) values ("a" , "b", 4);
+select * from t2;
+c1 c2 c3 c4
+a b 1 7545402351885872315
+a b 2 6048842355806993119
+a b 4 15541743660496249717
+drop table t1, t2;
diff --git a/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs_innodb.result b/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs_innodb.result
index 8d453565977..7f805459264 100644
--- a/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs_innodb.result
+++ b/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs_innodb.result
@@ -61,6 +61,15 @@ ERROR HY000: Function or expression is not allowed for column 'b'
# BENCHMARK()
create table t1 (a varchar(1024), b varchar(1024) as (benchmark(a,3)));
ERROR HY000: Function or expression is not allowed for column 'b'
+# CHARSET()
+create table t1 (a varchar(64), b varchar(64) as (charset(a)));
+ERROR HY000: Constant expression in computed column function is not allowed
+# COERCIBILITY()
+create table t1 (a varchar(64), b int as (coercibility(a)));
+ERROR HY000: Constant expression in computed column function is not allowed
+# COLLATION()
+create table t1 (a varchar(64), b varchar(64) as (collation(a)));
+ERROR HY000: Constant expression in computed column function is not allowed
# CONNECTION_ID()
create table t1 (a int as (connection_id()));
ERROR HY000: Function or expression is not allowed for column 'a'
diff --git a/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs_myisam.result b/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs_myisam.result
index d4dfc49ee32..1e1e6d6466e 100644
--- a/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs_myisam.result
+++ b/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs_myisam.result
@@ -63,6 +63,15 @@ ERROR HY000: Function or expression is not allowed for column 'b'
# BENCHMARK()
create table t1 (a varchar(1024), b varchar(1024) as (benchmark(a,3)));
ERROR HY000: Function or expression is not allowed for column 'b'
+# CHARSET()
+create table t1 (a varchar(64), b varchar(64) as (charset(a)));
+ERROR HY000: Constant expression in computed column function is not allowed
+# COERCIBILITY()
+create table t1 (a varchar(64), b int as (coercibility(a)));
+ERROR HY000: Constant expression in computed column function is not allowed
+# COLLATION()
+create table t1 (a varchar(64), b varchar(64) as (collation(a)));
+ERROR HY000: Constant expression in computed column function is not allowed
# CONNECTION_ID()
create table t1 (a int as (connection_id()));
ERROR HY000: Function or expression is not allowed for column 'a'
diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result
index 521952f4373..e68adf80073 100644
--- a/mysql-test/suite/vcol/r/vcol_misc.result
+++ b/mysql-test/suite/vcol/r/vcol_misc.result
@@ -322,3 +322,29 @@ drop table t1;
create table t1 (a int, b int as (b is null) virtual);
ERROR HY000: A computed column cannot be based on a computed column
# end of 5.3 tests
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8441 Bad SHOW CREATE TABLE output for a table with a virtual column
+#
+CREATE TABLE t1 (a DATETIME, b TIMESTAMP AS (TIMESTAMP(a)));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` datetime DEFAULT NULL,
+ `b` timestamp AS (TIMESTAMP(a)) VIRTUAL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME, b TIMESTAMP AS (TIMESTAMP(a)),c TIMESTAMP);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` datetime DEFAULT NULL,
+ `b` timestamp AS (TIMESTAMP(a)) VIRTUAL,
+ `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result b/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result
index 899a19c68f0..f9a7e2cc65c 100644
--- a/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result
+++ b/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result
@@ -2539,7 +2539,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` datetime DEFAULT NULL,
- `b` timestamp AS (timestamp(a)) VIRTUAL NULL ON UPDATE CURRENT_TIMESTAMP
+ `b` timestamp AS (timestamp(a)) VIRTUAL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
insert into t1 values ('2008-12-31',default);
select * from t1;
@@ -2554,7 +2554,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` datetime DEFAULT NULL,
- `b` timestamp AS (timestampadd(minute,1,a)) VIRTUAL NULL ON UPDATE CURRENT_TIMESTAMP
+ `b` timestamp AS (timestampadd(minute,1,a)) VIRTUAL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
insert into t1 values ('2003-01-02',default);
select * from t1;
@@ -2756,51 +2756,6 @@ a b
5 2
drop table t1;
set sql_warnings = 0;
-# CHARSET()
-set sql_warnings = 1;
-create table t1 (a varchar(1024), b varchar(1024) as (charset(a)));
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` varchar(1024) DEFAULT NULL,
- `b` varchar(1024) AS (charset(a)) VIRTUAL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-insert into t1 values ('abc',default);
-select * from t1;
-a b
-abc latin1
-drop table t1;
-set sql_warnings = 0;
-# COERCIBILITY()
-set sql_warnings = 1;
-create table t1 (a varchar(1024), b int as (coercibility(a)));
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` varchar(1024) DEFAULT NULL,
- `b` int(11) AS (coercibility(a)) VIRTUAL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-insert into t1 values ('abc',default);
-select * from t1;
-a b
-abc 2
-drop table t1;
-set sql_warnings = 0;
-# COLLATION()
-set sql_warnings = 1;
-create table t1 (a varchar(1024), b varchar(1024) as (collation(a)));
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` varchar(1024) DEFAULT NULL,
- `b` varchar(1024) AS (collation(a)) VIRTUAL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-insert into t1 values ('abc',default);
-select * from t1;
-a b
-abc latin1_swedish_ci
-drop table t1;
-set sql_warnings = 0;
# COMPRESS(), UNCOMPRESS()
set sql_warnings = 1;
create table t1 (a varchar(1024), b varchar(1024) as (uncompress(compress(a))));
diff --git a/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_myisam.result b/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_myisam.result
index 0034f25e223..184b4a441b2 100644
--- a/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_myisam.result
+++ b/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_myisam.result
@@ -2539,7 +2539,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` datetime DEFAULT NULL,
- `b` timestamp AS (timestamp(a)) VIRTUAL NULL ON UPDATE CURRENT_TIMESTAMP
+ `b` timestamp AS (timestamp(a)) VIRTUAL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ('2008-12-31',default);
select * from t1;
@@ -2554,7 +2554,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` datetime DEFAULT NULL,
- `b` timestamp AS (timestampadd(minute,1,a)) VIRTUAL NULL ON UPDATE CURRENT_TIMESTAMP
+ `b` timestamp AS (timestampadd(minute,1,a)) VIRTUAL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ('2003-01-02',default);
select * from t1;
@@ -2756,51 +2756,6 @@ a b
5 2
drop table t1;
set sql_warnings = 0;
-# CHARSET()
-set sql_warnings = 1;
-create table t1 (a varchar(1024), b varchar(1024) as (charset(a)));
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` varchar(1024) DEFAULT NULL,
- `b` varchar(1024) AS (charset(a)) VIRTUAL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-insert into t1 values ('abc',default);
-select * from t1;
-a b
-abc latin1
-drop table t1;
-set sql_warnings = 0;
-# COERCIBILITY()
-set sql_warnings = 1;
-create table t1 (a varchar(1024), b int as (coercibility(a)));
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` varchar(1024) DEFAULT NULL,
- `b` int(11) AS (coercibility(a)) VIRTUAL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-insert into t1 values ('abc',default);
-select * from t1;
-a b
-abc 2
-drop table t1;
-set sql_warnings = 0;
-# COLLATION()
-set sql_warnings = 1;
-create table t1 (a varchar(1024), b varchar(1024) as (collation(a)));
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` varchar(1024) DEFAULT NULL,
- `b` varchar(1024) AS (collation(a)) VIRTUAL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-insert into t1 values ('abc',default);
-select * from t1;
-a b
-abc latin1_swedish_ci
-drop table t1;
-set sql_warnings = 0;
# COMPRESS(), UNCOMPRESS()
set sql_warnings = 1;
create table t1 (a varchar(1024), b varchar(1024) as (uncompress(compress(a))));
diff --git a/mysql-test/suite/vcol/t/load_data.test b/mysql-test/suite/vcol/t/load_data.test
new file mode 100644
index 00000000000..4db3c77244e
--- /dev/null
+++ b/mysql-test/suite/vcol/t/load_data.test
@@ -0,0 +1,13 @@
+#
+# MDEV-7968 Virtual column set to NULL using load data infile
+#
+create table t1 ( c1 varchar(10), c2 varchar(10), c3 int );
+insert into t1 values ("a" , "b", 1), ("a" , "b", 2);
+create table t2 like t1 ;
+alter table t2 add column c4 bigint unsigned as (CONV(LEFT(MD5(concat(c1,c2,c3)), 16), 16, 10)) persistent unique key;
+select * into outfile 't1.csv' from t1;
+load data infile 't1.csv' into table t2 ;
+select * from t2;
+insert into t2 (c1,c2,c3) values ("a" , "b", 4);
+select * from t2;
+drop table t1, t2;
diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test
index a4c1fc06ce9..38f86702d70 100644
--- a/mysql-test/suite/vcol/t/vcol_misc.test
+++ b/mysql-test/suite/vcol/t/vcol_misc.test
@@ -283,3 +283,25 @@ drop table t1;
create table t1 (a int, b int as (b is null) virtual);
--echo # end of 5.3 tests
+
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8441 Bad SHOW CREATE TABLE output for a table with a virtual column
+--echo #
+CREATE TABLE t1 (a DATETIME, b TIMESTAMP AS (TIMESTAMP(a)));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+# Make sure that if the first TIMESTAMP column appears to be virtual,
+# then no further promotion is done, so the next TIMESTAMP column "c" does not
+# get the "DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP" attributes.
+CREATE TABLE t1 (a DATETIME, b TIMESTAMP AS (TIMESTAMP(a)),c TIMESTAMP);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/suite/wsrep/disabled.def b/mysql-test/suite/wsrep/disabled.def
new file mode 100644
index 00000000000..605f063f967
--- /dev/null
+++ b/mysql-test/suite/wsrep/disabled.def
@@ -0,0 +1 @@
+foreign_key : MDEV-7915
diff --git a/mysql-test/suite/wsrep/my.cnf b/mysql-test/suite/wsrep/my.cnf
index 8c5c9851cac..7e51b0750a1 100644
--- a/mysql-test/suite/wsrep/my.cnf
+++ b/mysql-test/suite/wsrep/my.cnf
@@ -8,5 +8,5 @@ wsrep-on=1
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
-wsrep_provider_options='base_port=@mysqld.1.#galera_port'
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M'
wsrep_cluster_address='not empty but invalid'
diff --git a/mysql-test/suite/wsrep/r/mdev_7798.result b/mysql-test/suite/wsrep/r/mdev_7798.result
new file mode 100644
index 00000000000..83a02f3a606
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/mdev_7798.result
@@ -0,0 +1,13 @@
+#
+# MDEV-7798: mysql.server init script can't stop mysqld when WSREP is
+# turned off
+#
+SELECT @@GLOBAL.WSREP_ON;
+@@GLOBAL.WSREP_ON
+1
+SET GLOBAL WSREP_ON= 0;
+Restart the node.
+SELECT @@GLOBAL.WSREP_ON;
+@@GLOBAL.WSREP_ON
+1
+# End of test.
diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result
index 8ddba797d7c..62d7f62440f 100644
--- a/mysql-test/suite/wsrep/r/variables.result
+++ b/mysql-test/suite/wsrep/r/variables.result
@@ -49,9 +49,13 @@ wsrep_local_commits #
wsrep_local_index #
wsrep_local_recv_queue #
wsrep_local_recv_queue_avg #
+wsrep_local_recv_queue_max #
+wsrep_local_recv_queue_min #
wsrep_local_replays #
wsrep_local_send_queue #
wsrep_local_send_queue_avg #
+wsrep_local_send_queue_max #
+wsrep_local_send_queue_min #
wsrep_local_state #
wsrep_local_state_comment #
wsrep_local_state_uuid #
@@ -100,9 +104,13 @@ wsrep_local_commits #
wsrep_local_index #
wsrep_local_recv_queue #
wsrep_local_recv_queue_avg #
+wsrep_local_recv_queue_max #
+wsrep_local_recv_queue_min #
wsrep_local_replays #
wsrep_local_send_queue #
wsrep_local_send_queue_avg #
+wsrep_local_send_queue_max #
+wsrep_local_send_queue_min #
wsrep_local_state #
wsrep_local_state_comment #
wsrep_local_state_uuid #
diff --git a/mysql-test/suite/wsrep/suite.pm b/mysql-test/suite/wsrep/suite.pm
index 33744a60ad8..ec7a3e374f5 100644
--- a/mysql-test/suite/wsrep/suite.pm
+++ b/mysql-test/suite/wsrep/suite.pm
@@ -25,9 +25,9 @@ return "No my_print_defaults" unless $epath;
push @::global_suppressions,
(
qr(WSREP: Could not open saved state file for reading: ),
- qr(WSREP: option --wsrep-casual-reads is deprecated),
- qr(WSREP: --wsrep-casual-reads=ON takes precedence over --wsrep-sync-wait=0),
- qr|WSREP: access file\(gvwstate.dat\) failed\(No such file or directory\)|,
+ qr(WSREP: option --wsrep-causal-reads is deprecated),
+ qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0),
+ qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|,
);
$ENV{PATH}="$epath:$ENV{PATH}";
diff --git a/mysql-test/suite/wsrep/t/mdev_7798.opt b/mysql-test/suite/wsrep/t/mdev_7798.opt
new file mode 100644
index 00000000000..459a9702707
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/mdev_7798.opt
@@ -0,0 +1 @@
+--wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep-on=1 --wsrep_causal_reads=ON
diff --git a/mysql-test/suite/wsrep/t/mdev_7798.test b/mysql-test/suite/wsrep/t/mdev_7798.test
new file mode 100644
index 00000000000..9dfff0959bc
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/mdev_7798.test
@@ -0,0 +1,17 @@
+--source include/have_wsrep_provider.inc
+--source include/have_binlog_format_row.inc
+
+--echo #
+--echo # MDEV-7798: mysql.server init script can't stop mysqld when WSREP is
+--echo # turned off
+--echo #
+
+SELECT @@GLOBAL.WSREP_ON;
+SET GLOBAL WSREP_ON= 0;
+
+--echo Restart the node.
+--source include/restart_mysqld.inc
+
+SELECT @@GLOBAL.WSREP_ON;
+
+--echo # End of test.
diff --git a/mysql-test/suite/wsrep/t/variables.test b/mysql-test/suite/wsrep/t/variables.test
index 5e195f5c4ab..d77dc4e66f9 100644
--- a/mysql-test/suite/wsrep/t/variables.test
+++ b/mysql-test/suite/wsrep/t/variables.test
@@ -29,7 +29,7 @@ CALL mtr.add_suppression("WSREP: Could not open saved state file for reading.*")
--disable_query_log
eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
---let $galera_version=25.3.5
+--let $galera_version=3.9
source include/check_galera_version.inc;
--enable_query_log
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 8a4ad35765c..bce7f3f95bb 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -1,3 +1,7 @@
+if (`select plugin_auth_version < "5.6.26" from information_schema.plugins where plugin_name='innodb'`)
+{
+ --skip Not fixed in XtraDB below 5.6.26
+}
--source include/have_innodb.inc
#
# Test of alter table
@@ -1326,6 +1330,14 @@ SHOW CREATE TABLE t2;
DROP TABLE t2;
DROP TABLE t1;
+CREATE TABLE t1 (
+ `transaction_id` int(11) NOT NULL DEFAULT '0',
+ KEY `transaction_id` (`transaction_id`));
+ALTER TABLE t1 DROP KEY IF EXISTS transaction_id, ADD PRIMARY KEY IF NOT EXISTS (transaction_id);
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
--echo # Bug#11748057 (formerly known as 34972): ALTER TABLE statement doesn't
--echo # identify correct column name.
--echo #
diff --git a/mysql-test/t/analyze_stmt_orderby.test b/mysql-test/t/analyze_stmt_orderby.test
index baddef3566c..a40f34805d1 100644
--- a/mysql-test/t/analyze_stmt_orderby.test
+++ b/mysql-test/t/analyze_stmt_orderby.test
@@ -1,4 +1,6 @@
+--source include/have_innodb.inc
+
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
@@ -70,4 +72,106 @@ analyze format=json
select * from t0,t2 where t2.a=t0.a order by t0.a limit 4;
drop table t2;
-drop table t0, t1;
+
+
+create table t2 (
+ a int,
+ b int,
+ c int
+);
+insert into t2
+select
+ a.a+10*b.a+100*c.a,
+ b.a+10*c.a,
+ c.a
+from t0 a, t0 b, t0 c;
+
+--replace_regex /"r_total_time_ms": [0-9]*[.]?[0-9]*/"r_total_time_ms": "REPLACED"/ /"r_buffer_size": "[^"]+"/"r_buffer_size": "REPLACED"/
+analyze format=json
+select MAX(b) from t2 where mod(a,2)=0 group by c;
+
+drop table t2;
+
+--echo #
+--echo # MDEV-8282: crash in filesort() with simple ordered delete
+--echo #
+create table t3(a int) engine=innodb;
+delete from t3 order by a;
+
+--echo # EXPLAIN thinks it will use delete_all_rows():
+explain
+delete from t3 order by a;
+
+--echo # ANALYZE shows that delete_all_rows() didn't work and we deleted rows
+--echo # one-by-one:
+analyze
+delete from t3 order by a;
+
+drop table t3;
+
+--echo #
+--echo # A test for duplicate_removal()
+--echo #
+create table t3 (a int, b int);
+insert into t3 select a, 123 from t0;
+
+--replace_regex /"r_total_time_ms": [0-9]*[.]?[0-9]*/"r_total_time_ms": "REPLACED"/ /"r_buffer_size": "[^"]+"/"r_buffer_size": "REPLACED"/
+analyze format=json
+select distinct max(t3.b) Q from t0, t3 where t0.a=t3.a group by t0.a order by null;
+
+
+--echo #
+--echo # A query with two filesort calls:
+--echo # - first is needed to do group-by-group grouping to calculate COUNT(DISTINCT)
+--echo # - the second is need to produce ORDER BY.
+--echo # (see MDEV-7836 for description of the query plan)
+
+
+create table t5 (a int , b int) ;
+create table t6 like t5 ;
+create table t7 like t5 ;
+insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
+ (2, -1), (3, 10);
+insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1);
+insert into t7 values (3, 3), (2, 2), (1, 1);
+
+--echo # TODO: This ANALYZE output doesn't make it clear what is used for what.
+--replace_regex /"r_total_time_ms": [0-9]*[.]?[0-9]*/"r_total_time_ms": "REPLACED"/ /"r_buffer_size": "[^"]+"/"r_buffer_size": "REPLACED"/
+analyze format=json
+select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= 5
+ group by t5.a order by sum limit 1;
+
+explain format=json
+select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= 5
+ group by t5.a order by sum limit 1;
+drop table t5,t6,t7;
+drop table t3;
+
+--echo #
+--echo # Tabular ANALYZE must get its data from execution tracker (and not from
+--echo # the query plan)
+--echo #
+
+CREATE TABLE t2(
+ col1 int,
+ col2 int,
+ UNIQUE INDEX idx (col1, col2)) engine=myisam;
+
+INSERT INTO t2(col1, col2) VALUES
+ (1,20),(2,19),(3,18),(4,17),(5,16),(6,15),(7,14),(8,13),(9,12),(10,11),
+ (11,10),(12,9),(13,8),(14,7),(15,6),(16,5),(17,4),(18,3),(19,2),(20,1);
+
+flush status;
+explain
+select col1 f1, col2 f2, col1 f3 from t2 group by f1;
+analyze
+select col1 f1, col2 f2, col1 f3 from t2 group by f1;
+--replace_regex /"r_total_time_ms": [0-9]*[.]?[0-9]*/"r_total_time_ms": "REPLACED"/ /"r_buffer_size": "[^"]+"/"r_buffer_size": "REPLACED"/
+analyze format=json
+select col1 f1, col2 f2, col1 f3 from t2 group by f1;
+drop table t2;
+
+
+drop table t0,t1;
diff --git a/mysql-test/t/analyze_stmt_privileges.test b/mysql-test/t/analyze_stmt_privileges.test
index 9dd8f274fce..b565f17c0f7 100644
--- a/mysql-test/t/analyze_stmt_privileges.test
+++ b/mysql-test/t/analyze_stmt_privileges.test
@@ -11,6 +11,7 @@ use db;
create table t1 (i int, c varchar(8));
insert into t1 values (1,'foo'),(2,'bar'),(3,'baz'),(4,'qux');
create view v1 as select * from t1 where i > 1;
+CREATE USER u1@localhost;
grant ALL on db.v1 to u1@localhost;
--connect (con1,localhost,u1,,)
diff --git a/mysql-test/t/analyze_stmt_privileges2.test b/mysql-test/t/analyze_stmt_privileges2.test
index 6fcdb7d4399..9a0299be535 100644
--- a/mysql-test/t/analyze_stmt_privileges2.test
+++ b/mysql-test/t/analyze_stmt_privileges2.test
@@ -24,6 +24,8 @@
--source include/count_sessions.inc
--enable_connect_log
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
CREATE DATABASE privtest_db;
@@ -5395,6 +5397,7 @@ DROP USER 'privtest'@localhost;
USE test;
DROP DATABASE privtest_db;
+set GLOBAL sql_mode=default;
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/blackhole_plugin.test b/mysql-test/t/blackhole_plugin.test
index 8af8fcc941c..487fc5656f2 100644
--- a/mysql-test/t/blackhole_plugin.test
+++ b/mysql-test/t/blackhole_plugin.test
@@ -1,13 +1,14 @@
if (!$HA_BLACKHOLE_SO) {
--skip Need blackhole plugin
}
-
+set sql_mode="";
CREATE TABLE t1(a int) ENGINE=BLACKHOLE;
+set sql_mode=default;
DROP TABLE t1;
--replace_regex /\.dll/.so/
eval INSTALL PLUGIN blackhole SONAME '$HA_BLACKHOLE_SO';
--replace_regex /\.dll/.so/
---error 1125
+--error ER_PLUGIN_INSTALLED
eval INSTALL PLUGIN BLACKHOLE SONAME '$HA_BLACKHOLE_SO';
UNINSTALL PLUGIN blackhole;
diff --git a/mysql-test/t/bootstrap.test b/mysql-test/t/bootstrap.test
index 97376eb7412..840b9a12cee 100644
--- a/mysql-test/t/bootstrap.test
+++ b/mysql-test/t/bootstrap.test
@@ -78,6 +78,7 @@ EOF
# Check that installed plugins are *not* automatically loaded in --bootstrap
#
--write_file $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql
+SET SQL_MODE="";
use test;
create table t1(a int) engine=example;
EOF
diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test
index f536f556780..957c4ac5c9d 100644
--- a/mysql-test/t/case.test
+++ b/mysql-test/t/case.test
@@ -193,3 +193,75 @@ insert t1 values ('00:00:00'),('00:01:00');
select case t1.f1 when '00:00:00' then 1 end from t1;
drop table t1;
+--echo #
+--echo # Start of 10.1 test
+--echo #
+
+--echo #
+--echo # MDEV-8752 Wrong result for SELECT..WHERE CASE enum_field WHEN 1 THEN 1 ELSE 0 END AND a='5'
+--echo #
+CREATE TABLE t1 (a ENUM('5','6') CHARACTER SET BINARY);
+INSERT INTO t1 VALUES ('5'),('6');
+SELECT * FROM t1 WHERE a='5';
+SELECT * FROM t1 WHERE a=1;
+SELECT * FROM t1 WHERE CASE a WHEN 1 THEN 1 ELSE 0 END;
+SELECT * FROM t1 WHERE CASE a WHEN 1 THEN 1 ELSE 0 END AND a='5';
+--echo # Multiple comparison types in CASE, not Ok to propagate
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE CASE a WHEN 1 THEN 1 ELSE 0 END AND a='5';
+DROP TABLE t1;
+
+CREATE TABLE t1 (a ENUM('a','b','100'));
+INSERT INTO t1 VALUES ('a'),('b'),('100');
+SELECT * FROM t1 WHERE a='a';
+SELECT * FROM t1 WHERE CASE a WHEN 'a' THEN 1 ELSE 0 END;
+SELECT * FROM t1 WHERE CASE a WHEN 'a' THEN 1 ELSE 0 END AND a='a';
+--echo # String comparison in CASE and in the equality, ok to propagate
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE CASE a WHEN 'a' THEN 1 ELSE 0 END AND a='a';
+
+SELECT * FROM t1 WHERE a=3;
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END;
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END AND a=3;
+--echo # Integer comparison in CASE and in the equality, not ok to propagate
+--echo # ENUM does not support this type of propagation yet.
+--echo # This can change in the future. See MDEV-8748.
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END AND a=3;
+
+SELECT * FROM t1 WHERE a=3;
+SELECT * FROM t1 WHERE CASE a WHEN '100' THEN 1 ELSE 0 END;
+SELECT * FROM t1 WHERE CASE a WHEN '100' THEN 1 ELSE 0 END AND a=3;
+--echo # String comparison in CASE, integer comparison in the equality, not Ok to propagate
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE CASE a WHEN '100' THEN 1 ELSE 0 END AND a=3;
+
+SELECT * FROM t1 WHERE a='100';
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END;
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END AND a='100';
+--echo # Integer comparison in CASE, string comparison in the equality, not Ok to propagate
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END AND a='100';
+
+SELECT * FROM t1 WHERE a='100';
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END;
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END AND a='100';
+--echo # Multiple type comparison in CASE, string comparison in the equality, not Ok to propagate
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END AND a='100';
+
+SELECT * FROM t1 WHERE a=3;
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END;
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END AND a=3;
+--echo # Multiple type comparison in CASE, integer comparison in the equality, not Ok to propagate
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END AND a=3;
+
+DROP TABLE t1;
+--echo #
+--echo # End of MDEV-8752
+--echo #
+
+--echo #
+--echo # End of 10.1 test
+--echo #
diff --git a/mysql-test/t/change_user.test b/mysql-test/t/change_user.test
index 659354e9c48..c918224520d 100644
--- a/mysql-test/t/change_user.test
+++ b/mysql-test/t/change_user.test
@@ -1,10 +1,14 @@
+# This test is checking that old password authentication works
+set global secure_auth=0;
#
# functional change user tests
#
-
+create user test_nopw;
grant select on test.* to test_nopw;
-grant select on test.* to test_oldpw identified by password "09301740536db389";
-grant select on test.* to test_newpw identified by "newpw";
+create user test_oldpw identified by password "09301740536db389";
+grant select on test.* to test_oldpw;
+create user test_newpw identified by "newpw";
+grant select on test.* to test_newpw;
select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
@@ -136,3 +140,5 @@ if ($after != $before){
die The value of com_select changed during change_user;
}
echo Value of com_select did not change;
+
+set global secure_auth=default;
diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test
index c4a6fb73b10..20989e70ef9 100644
--- a/mysql-test/t/connect.test
+++ b/mysql-test/t/connect.test
@@ -12,6 +12,7 @@
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
+SET global secure_auth=0;
--disable_warnings
drop table if exists t1,t2;
@@ -134,6 +135,7 @@ drop table t1;
--echo # -- which results in user lockout.
--echo
+CREATE USER mysqltest_u1@localhost;
GRANT USAGE ON *.* TO mysqltest_u1@localhost;
# NOTE: if the test case fails sporadically due to spurious connections,
@@ -452,3 +454,6 @@ delimiter ;|
call p1(2);
drop procedure p1;
+
+
+SET global secure_auth=default;
diff --git a/mysql-test/t/create_drop_binlog.test b/mysql-test/t/create_drop_binlog.test
index 775c7bec12a..aa772df4805 100644
--- a/mysql-test/t/create_drop_binlog.test
+++ b/mysql-test/t/create_drop_binlog.test
@@ -1,5 +1,8 @@
--source include/have_udf.inc
--source include/have_log_bin.inc
+--source include/binlog_start_pos.inc
+
+--let $pos=`select $binlog_start_pos + 65`
--let $binlog_file=query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_start=query_get_value(SHOW MASTER STATUS, Position, 1)
@@ -160,3 +163,15 @@ DROP TABLE t1;
--replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ /Server.ver.*/VER/
SHOW BINLOG EVENTS;
RESET MASTER;
+
+# Test RESET MASTER TO
+
+RESET MASTER;
+--replace_result $pos <pos>
+SHOW MASTER STATUS;
+RESET MASTER TO 100;
+--replace_result $pos <pos>
+SHOW MASTER STATUS;
+RESET MASTER;
+--replace_result $pos <pos>
+SHOW MASTER STATUS;
diff --git a/mysql-test/t/create_or_replace_permission.test b/mysql-test/t/create_or_replace_permission.test
index f155e97198c..0e833a125bd 100644
--- a/mysql-test/t/create_or_replace_permission.test
+++ b/mysql-test/t/create_or_replace_permission.test
@@ -2,6 +2,8 @@
# Grant tests not performed with embedded server
-- source include/not_embedded.inc
+set local sql_mode="";
+set global sql_mode="";
--echo #
--echo # Tests for checking permission denied on CREATE OR REPLACE if DROP
--echo # access is revoked
@@ -64,3 +66,6 @@ REVOKE ALL ON db1.* FROM mysqltest_1@localhost;
DROP DATABASE IF EXISTS db2;
DROP DATABASE db1;
DROP USER mysqltest_1@localhost;
+
+
+set global sql_mode=default;
diff --git a/mysql-test/t/ctype_binary.test b/mysql-test/t/ctype_binary.test
index 3d3f90b444b..8da4eaff572 100644
--- a/mysql-test/t/ctype_binary.test
+++ b/mysql-test/t/ctype_binary.test
@@ -27,3 +27,50 @@ SELECT _binary 0x7E, _binary X'7E', _binary B'01111110';
--echo #
--echo # End of 10.0 tests
--echo #
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8695 Wrong result for SELECT..WHERE varchar_column='a' AND CRC32(varchar_column)=3904355907
+--echo #
+CREATE TABLE t1 (a VARBINARY(10));
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE CRC32(a)=3904355907;
+SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)=3904355907;
+--echo # Okey to propagate 'a' into CRC32(a)
+EXPLAIN EXTENDED SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)=3904355907;
+SELECT a, HEX(a) FROM t1 WHERE HEX(a)='61';
+SELECT *,HEX(a) FROM t1 WHERE a='a' AND HEX(a)='61';
+--echo # Okey to propagate 'a' into HEX(a)
+EXPLAIN EXTENDED SELECT *,HEX(a) FROM t1 WHERE a='a' AND HEX(a)='61';
+SELECT * FROM t1 WHERE a='a';
+SELECT * FROM t1 WHERE LENGTH(a)=2;
+SELECT * FROM t1 WHERE a='a' AND LENGTH(a)=2;
+--echo # Okey to propagate 'a' into LENGTH(a)
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND LENGTH(a)=2;
+SELECT * FROM t1 WHERE a='a ';
+SELECT * FROM t1 WHERE a='a ' AND LENGTH(a)=2;
+--echo # Okey to propagate 'a ' into LENGTH(a)
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a ' AND LENGTH(a)=2;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-8723 Wrong result for SELECT..WHERE COLLATION(a)='binary' AND a='a'
+--echo #
+CREATE TABLE t1 (a VARBINARY(10));
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT * FROM t1 WHERE COLLATION(a)='binary' AND a='a';
+SELECT * FROM t1 WHERE CHARSET(a)='binary' AND a='a';
+SELECT * FROM t1 WHERE COERCIBILITY(a)=2 AND a='a';
+SELECT * FROM t1 WHERE WEIGHT_STRING(a)='a' AND a='a';
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE COLLATION(a)='binary' AND a='a';
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE CHARSET(a)='binary' AND a='a';
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE COERCIBILITY(a)=2 AND a='a';
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE WEIGHT_STRING(a)='a' AND a='a';
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/ctype_cp1250_ch.test b/mysql-test/t/ctype_cp1250_ch.test
index f5c241fb679..0bbe4cafca6 100644
--- a/mysql-test/t/ctype_cp1250_ch.test
+++ b/mysql-test/t/ctype_cp1250_ch.test
@@ -12,6 +12,7 @@ SHOW COLLATION LIKE 'cp1250_czech_cs';
SET @test_character_set= 'cp1250';
SET @test_collation= 'cp1250_general_ci';
-- source include/ctype_common.inc
+-- source include/ctype_like_cond_propagation.inc
SET @test_character_set= 'cp1250';
SET @test_collation= 'cp1250_czech_cs';
diff --git a/mysql-test/t/ctype_cp1251.test b/mysql-test/t/ctype_cp1251.test
index 0455f579922..93fd5cc9a1a 100644
--- a/mysql-test/t/ctype_cp1251.test
+++ b/mysql-test/t/ctype_cp1251.test
@@ -107,3 +107,38 @@ DROP TABLE t1;
--echo #
--echo # End of 5.5 tests
--echo #
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8688 Wrong result for SELECT..WHERE varchar_column IN (1,2,3) AND varchar_column=' 1';
+--echo #
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET cp1251 COLLATE cp1251_ukrainian_ci);
+INSERT INTO t1 VALUES (' 1'),('`1');
+SELECT * FROM t1 WHERE a IN (1,2,3);
+SELECT * FROM t1 WHERE a IN (1,2,3) AND a=' 1';
+SELECT * FROM t1 WHERE a IN (1,2,3,'4') AND a=' 1';
+# Equality should not propagate ' 1' to IN: incompatible comparison context
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,3) AND a=' 1';
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,3,'x') AND a=' 1';
+DROP TABLE t1;
+
+
+--echo #
+--echo # MDEV-8671 Wrong result for SELECT..WHERE varchar_column=' 1' AND (varchar_column XOR '1')
+--echo #
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET cp1251 COLLATE cp1251_ukrainian_ci);
+INSERT INTO t1 VALUES (' 1'),('`1');
+SELECT * FROM t1 WHERE a=' 1';
+SELECT * FROM t1 WHERE (a XOR '0');
+SELECT * FROM t1 WHERE a=' 1' AND (a XOR '0');
+--echo # ' 1' should not be propagated into (a XIR '0')
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=' 1' AND (a XOR '0');
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/ctype_eucjpms.test b/mysql-test/t/ctype_eucjpms.test
index 2dd806ed027..d533e38b2a2 100644
--- a/mysql-test/t/ctype_eucjpms.test
+++ b/mysql-test/t/ctype_eucjpms.test
@@ -541,3 +541,28 @@ SELECT _eucjpms 0x8EA0;
--echo #
--echo # End of 10.0 tests
--echo #
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8215 Asian MB3 charsets: compare broken bytes as "greater than any non-broken character"
+--echo #
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET eucjpms, KEY(a));
+# [x00-x7F] # ASCII/JIS-Roman
+# [x8E][xA1-xDF] # half-width katakana
+# [x8F][xA1-xFE][xA1-xFE] # JIS X 0212-1990
+# [xA1-xFE][xA1-xFE] # JIS X 0208:1997
+INSERT INTO t1 VALUES ('a'),(0x7F);
+INSERT INTO t1 VALUES (0x8EA1),(0x8EDF);
+INSERT INTO t1 VALUES (0x8FA1A1),(0x8FFEFE);
+INSERT INTO t1 VALUES (0xA1A1),(0xDEDE),(0xDFDF),(0xE0E0),(0xFEFE);
+SELECT HEX(a) FROM t1 ORDER BY a;
+ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET eucjpms COLLATE eucjpms_bin;
+SELECT HEX(a) FROM t1 ORDER BY a;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test
index aeaad2cc026..830fa075a39 100644
--- a/mysql-test/t/ctype_latin1.test
+++ b/mysql-test/t/ctype_latin1.test
@@ -248,3 +248,121 @@ SELECT _latin1 0x7E, _latin1 X'7E', _latin1 B'01111110';
--echo #
--echo # End of 10.0 tests
--echo #
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8661 Wrong result for SELECT..WHERE a='a' AND a='a' COLLATE latin1_bin
+--echo #
+SET NAMES latin1;
+CREATE TABLE t1 (a CHAR(10));
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT * FROM t1 WHERE a='a' AND a='a' COLLATE latin1_bin;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci);
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT * FROM t1 WHERE a='a' COLLATE latin1_bin AND a='A' COLLATE latin1_swedish_ci;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-8679 Equal field propagation is not used for VARCHAR when it safely could
+--echo #
+CREATE TABLE t1 (a VARCHAR(10));
+INSERT INTO t1 VALUES ('10'),('11'),('12');
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='10' AND IF(a='10',1,0)=1;
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='10' AND CASE WHEN a='10' THEN 1 ELSE 0 END;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-8680 Wrong result for SELECT..WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a'
+--echo #
+SET NAMES latin1;
+CREATE TABLE t1 (a VARCHAR(10));
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b');
+SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a';
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a';
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-8698 Wrong result for SELECT..WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin;
+--echo #
+SET NAMES latin1;
+CREATE TABLE t1 (a VARCHAR(10));
+INSERT INTO t1 VALUES ('a'),('A'),('b'),('B'),('c'),('C');
+SELECT * FROM t1 WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin;
+SELECT * FROM t1 WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin AND a='a';
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin AND a='a';
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-8707 Wrong result for SELECT..WHERE varchar_column=DATE'2001-01-01' AND varchar_column='2001-01-01'
+--echo #
+SET NAMES latin1;
+CREATE TABLE t1 (a VARCHAR(40));
+INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-01x');
+SELECT * FROM t1 WHERE a=DATE'2001-01-01' AND a='2001-01-01';
+SELECT * FROM t1 WHERE a='2001-01-01' AND a=DATE'2001-01-01';
+SELECT * FROM t1 WHERE (a,a)=('2001-01-01x',DATE'2001-01-01');
+SELECT * FROM t1 WHERE (a,a)=(DATE'2001-01-01','2001-01-01x');
+SELECT * FROM t1 WHERE (a,a)=('2001-01-01',DATE'2001-01-01');
+SELECT * FROM t1 WHERE (a,a)=(DATE'2001-01-01','2001-01-01');
+DROP TABLE t1;
+CREATE TABLE t1 (a ENUM('2001-01-01','2001-01-01x'));
+INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-01x');
+SELECT * FROM t1 WHERE a=DATE'2001-01-01' AND a='2001-01-01';
+SELECT * FROM t1 WHERE a='2001-01-01' AND a=DATE'2001-01-01';
+SELECT * FROM t1 WHERE (a,a)=('2001-01-01x',DATE'2001-01-01');
+SELECT * FROM t1 WHERE (a,a)=(DATE'2001-01-01','2001-01-01x');
+SELECT * FROM t1 WHERE (a,a)=('2001-01-01',DATE'2001-01-01');
+SELECT * FROM t1 WHERE (a,a)=(DATE'2001-01-01','2001-01-01');
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(40),b VARCHAR(40));
+INSERT INTO t1 VALUES ('2001-01-01','2001-01-01x');
+SELECT * FROM t1 WHERE a=b AND a=DATE'2001-01-01';
+DROP TABLE t1;
+CREATE TABLE t1 (a ENUM('2001-01-01','2001-01-01x'),b ENUM('2001-01-01','2001-01-01x'));
+INSERT INTO t1 VALUES ('2001-01-01','2001-01-01x');
+SELECT * FROM t1 WHERE a=b AND a=DATE'2001-01-01';
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-8695 Wrong result for SELECT..WHERE varchar_column='a' AND CRC32(varchar_column)=3904355907
+--echo #
+CREATE TABLE t1 (a VARCHAR(10) COLLATE latin1_bin);
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE CRC32(a)=3904355907;
+SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)=3904355907;
+--echo # 'a' should not be propagated into CRC32(a)
+EXPLAIN EXTENDED SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)=3904355907;
+SELECT a, HEX(a) FROM t1 WHERE HEX(a)='61';
+SELECT *,HEX(a) FROM t1 WHERE a='a' AND HEX(a)='61';
+--echo # 'a' should not be propagated into HEX(a)
+EXPLAIN EXTENDED SELECT *,HEX(a) FROM t1 WHERE a='a' AND HEX(a)='61';
+SELECT * FROM t1 WHERE a='a';
+SELECT * FROM t1 WHERE LENGTH(a)=2;
+SELECT * FROM t1 WHERE a='a' AND LENGTH(a)=2;
+--echo # 'a' should not be propagated into LENGTH(a)
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND LENGTH(a)=2;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-8712 Wrong result for SELECT..WHERE latin1_bin_column=_latin1'a' AND latin1_bin_column='A'
+--echo #
+SET NAMES latin1;
+CREATE TABLE t1 (a VARCHAR(20) COLLATE latin1_bin);
+INSERT INTO t1 VALUES ('a'),('b');
+SELECT * FROM t1 WHERE a='A';
+SELECT * FROM t1 WHERE a='A' AND a=_latin1'a';
+SELECT * FROM t1 WHERE a=_latin1'a' AND a='A';
+SELECT * FROM t1 WHERE a=_latin1'A';
+SELECT * FROM t1 WHERE a=_latin1'A' AND a=_latin1'a';
+SELECT * FROM t1 WHERE a=_latin1'a' AND a=_latin1'A';
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/ctype_latin2_ch.test b/mysql-test/t/ctype_latin2_ch.test
index acd93aad6d6..06ccd2c9782 100644
--- a/mysql-test/t/ctype_latin2_ch.test
+++ b/mysql-test/t/ctype_latin2_ch.test
@@ -33,6 +33,7 @@ drop table t1;
set names latin2 collate latin2_czech_cs;
--source include/ctype_pad_space.inc
+--source include/ctype_like_cond_propagation.inc
# We can not use ctype_filesort.inc because
# order of SPACE and TAB is not strict
@@ -143,6 +144,7 @@ SELECT * FROM t1 GROUP BY s1;
SELECT * FROM t1 ORDER BY s1;
DROP TABLE t1;
+set sql_mode="";
--disable_warnings
CREATE TABLE t1 ENGINE=INNODB AS SELECT repeat('a', 5) AS s1 LIMIT 0;
--enable_warnings
@@ -182,6 +184,7 @@ DROP TABLE t1;
SET NAMES latin2;
+
#
# Bug#37854 Test fails/aborts for collate latin2_czech_cs used with SET and ENUM datatypes
#
diff --git a/mysql-test/t/ctype_many.test b/mysql-test/t/ctype_many.test
index 11ad942e19c..a51ead67eb2 100644
--- a/mysql-test/t/ctype_many.test
+++ b/mysql-test/t/ctype_many.test
@@ -331,3 +331,22 @@ CREATE TABLE t2 (a BINARY(1));
SELECT * FROM t2 WHERE a=(SELECT a FROM t1) AND a=_LATIN1'x';
DROP TABLE t2;
DROP TABLE t1;
+
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8362 dash '-' is not recognized in charset armscii8 on select where query
+--echo #
+CREATE TABLE t1 (a VARCHAR(64) CHARACTER SET armscii8);
+INSERT INTO t1 VALUES ('abc-def');
+SELECT * FROM t1 WHERE a='abc-def';
+SELECT * FROM t1 WHERE a LIKE 'abc%';
+DROP TABLE t1;
+SELECT HEX(CONVERT(_utf8 0x2728292C2D2E USING armscii8));
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/ctype_tis620.test b/mysql-test/t/ctype_tis620.test
index b536a00bec9..ba5db9df54f 100644
--- a/mysql-test/t/ctype_tis620.test
+++ b/mysql-test/t/ctype_tis620.test
@@ -157,9 +157,11 @@ SET collation_connection='tis620_thai_ci';
-- source include/ctype_filesort.inc
-- source include/ctype_like_escape.inc
--source include/ctype_ascii_order.inc
+-- source include/ctype_like_cond_propagation.inc
SET collation_connection='tis620_bin';
-- source include/ctype_filesort.inc
-- source include/ctype_like_escape.inc
+-- source include/ctype_like_cond_propagation.inc
# End of 4.1 tests
diff --git a/mysql-test/t/ctype_uca.test b/mysql-test/t/ctype_uca.test
index 5e8195e4718..3e5fa873e9b 100644
--- a/mysql-test/t/ctype_uca.test
+++ b/mysql-test/t/ctype_uca.test
@@ -620,3 +620,29 @@ DROP TABLE t1;
--echo #
--echo # End of MariaDB-10.0 tests
--echo #
+
+--echo #
+--echo # Start of MariaDB-10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-6973 XOR aggregates argument collations
+--echo #
+SELECT '10' COLLATE utf8_general_ci XOR '20' COLLATE utf8_unicode_ci;
+
+--echo #
+--echo # MDEV-8705 Wrong result for SELECT..WHERE latin1_bin_column='a' AND latin1_bin_column='A'
+--echo #
+SET NAMES utf8 COLLATE utf8_german2_ci;
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_bin);
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT * FROM t1 WHERE a='a';
+SELECT * FROM t1 WHERE a=_utf8'a';
+# Make sure this does not return "Illegal mix of collations"
+SELECT * FROM t1 WHERE a='a' AND a=_utf8'a';
+DROP TABLE t1;
+SET NAMES utf8;
+
+--echo #
+--echo # End of MariaDB-10.1 tests
+--echo #
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
index 6e5b0850eca..18fe32c526b 100644
--- a/mysql-test/t/ctype_ucs.test
+++ b/mysql-test/t/ctype_ucs.test
@@ -440,9 +440,11 @@ drop table t1;
#
# Bug #14583 Bug on query using a LIKE on indexed field with ucs2_bin collation
#
+set sql_mode="";
--disable_warnings
create table t1(f1 varchar(5) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL) engine=InnoDB;
--enable_warnings
+set sql_mode=default;
insert into t1 values('a');
create index t1f1 on t1(f1);
select f1 from t1 where f1 like 'a%';
@@ -880,7 +882,7 @@ DO CAST(CONVERT('' USING ucs2) AS UNSIGNED);
CREATE TABLE t1 (a DECIMAL(2,0));
SET sql_mode='strict_all_tables';
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+--error ER_WARN_DATA_OUT_OF_RANGE
INSERT INTO t1 VALUES (CONVERT('9e99999999' USING ucs2));
SET sql_mode=DEFAULT;
diff --git a/mysql-test/t/ctype_ujis.test b/mysql-test/t/ctype_ujis.test
index 94fc7ffe4c0..3f444580b13 100644
--- a/mysql-test/t/ctype_ujis.test
+++ b/mysql-test/t/ctype_ujis.test
@@ -87,6 +87,7 @@ DROP TABLE t1;
#
# Bug #6345 Unexpected behaviour with partial indices
#
+set sql_mode="";
--disable_warnings
CREATE TABLE t1
(
@@ -96,6 +97,7 @@ CREATE TABLE t1
KEY b (b(10))
) ENGINE=InnoDB CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
--enable_warnings
+set sql_mode=default;
INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
INSERT INTO t1 (a, b) VALUES (2, 'iiijjjkkkl');
@@ -1369,3 +1371,28 @@ SELECT _ujis 0x8EA0;
--echo #
--echo # End of 10.0 tests
--echo #
+
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8215 Asian MB3 charsets: compare broken bytes as "greater than any non-broken character"
+--echo #
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ujis, KEY(a));
+# [x00-x7F] # ASCII/JIS-Roman
+# [x8E][xA1-xDF] # half-width katakana
+# [x8F][xA1-xFE][xA1-xFE] # JIS X 0212-1990
+# [xA1-xFE][xA1-xFE] # JIS X 0208:1997
+INSERT INTO t1 VALUES ('a'),(0x7F);
+INSERT INTO t1 VALUES (0x8EA1),(0x8EDF);
+INSERT INTO t1 VALUES (0x8FA1A1),(0x8FFEFE);
+INSERT INTO t1 VALUES (0xA1A1),(0xDEDE),(0xDFDF),(0xE0E0),(0xFEFE);
+SELECT HEX(a) FROM t1 ORDER BY a;
+ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ujis COLLATE ujis_bin;
+SELECT HEX(a) FROM t1 ORDER BY a;DROP TABLE t1;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/ctype_utf16.test b/mysql-test/t/ctype_utf16.test
index e4305ed9879..8ea6ea67f1f 100644
--- a/mysql-test/t/ctype_utf16.test
+++ b/mysql-test/t/ctype_utf16.test
@@ -860,3 +860,31 @@ DEALLOCATE PREPARE stmt;
--echo #
--echo # End of 10.0 tests
--echo #
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character"
+--echo #
+CREATE TABLE t1 (
+ id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ a VARCHAR(10) CHARACTER SET utf16, KEY(a,id)
+);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0x61);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0xC280),(_utf8mb4 0xDFBF);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0xE0A080),(_utf8mb4 0xEFBFBF);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0xF0908080),(_utf8mb4 0xF48FBFBF);
+SELECT id,HEX(a) FROM t1 ORDER BY a,id;
+SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
+SELECT COUNT(DISTINCT a) FROM t1;
+ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf16 COLLATE utf16_bin;
+SELECT id,HEX(a) FROM t1 ORDER BY a;
+SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
+SELECT COUNT(DISTINCT a) FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/ctype_utf16le.test b/mysql-test/t/ctype_utf16le.test
index a8326900847..f5998fec18c 100644
--- a/mysql-test/t/ctype_utf16le.test
+++ b/mysql-test/t/ctype_utf16le.test
@@ -744,3 +744,31 @@ SET NAMES utf8, collation_connection=utf16le_bin;
--echo #
--echo # End of 5.6 tests
--echo #
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character"
+--echo #
+CREATE TABLE t1 (
+ id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ a VARCHAR(10) CHARACTER SET utf16le, KEY(a,id)
+);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0x61);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0xC280),(_utf8mb4 0xDFBF);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0xE0A080),(_utf8mb4 0xEFBFBF);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0xF0908080),(_utf8mb4 0xF48FBFBF);
+SELECT id,HEX(a) FROM t1 ORDER BY a,id;
+SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
+SELECT COUNT(DISTINCT a) FROM t1;
+ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf16le COLLATE utf16le_bin;
+SELECT id,HEX(a) FROM t1 ORDER BY a;
+SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
+SELECT COUNT(DISTINCT a) FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/ctype_utf32.test b/mysql-test/t/ctype_utf32.test
index e6583f990ca..a75ac72b67f 100644
--- a/mysql-test/t/ctype_utf32.test
+++ b/mysql-test/t/ctype_utf32.test
@@ -956,3 +956,20 @@ DEALLOCATE PREPARE stmt;
--echo # End of 10.0 tests
--echo #
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8419 utf32: compare broken bytes as "greater than any non-broken character"
+--echo #
+# Make sure that all non-BMP characters are compared as equal
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf32, KEY(a));
+INSERT INTO t1 VALUES (0x10000),(0x10001),(0x10002);
+SELECT COUNT(DISTINCT a) FROM t1;
+DROP TABLE t1;
+SELECT _utf32 0x10001=_utf32 0x10002;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index dba00e96491..bb767900a8e 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -1636,6 +1636,22 @@ SET NAMES utf8 COLLATE utf8_general_ci;
--source include/ctype_utf8_ilseq.inc
--echo #
+--echo # MDEV-8067 correct fix for MySQL Bug # 19699237: UNINITIALIZED VARIABLE IN ITEM_FIELD::STR_RESULT
+--echo #
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8);
+CREATE TABLE t2 (a VARCHAR(10) CHARACTER SET latin1);
+INSERT INTO t1 VALUES ('aaa');
+INSERT INTO t2 VALUES ('aaa');
+SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2);
+INSERT INTO t1 VALUES ('aaa');
+INSERT INTO t2 VALUES ('aaa');
+# Running the below query crashed with two rows
+--error ER_SUBQUERY_NO_1_ROW
+SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2);
+DROP TABLE t1, t2;
+
+
+--echo #
--echo # End of 5.5 tests
--echo #
@@ -1790,5 +1806,33 @@ SET NAMES utf8;
SELECT * FROM `testðŸ˜ðŸ˜test`;
--echo #
+--echo #MDEV-8256 A part of a ROW comparison is erroneously optimized away
+--echo #
+SET NAMES utf8;
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8);
+INSERT INTO t1 VALUES ('1e1'),('1é1');
+SELECT * FROM t1 WHERE a=10;
+SELECT * FROM t1 WHERE a='1e1';
+SELECT * FROM t1 WHERE a=10 AND a='1e1';
+SELECT * FROM t1 WHERE (a,a)=(10,'1e1');
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a,a)=(10,'1e1');
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-8688 Wrong result for SELECT..WHERE varchar_column IN (1,2,3) AND varchar_column=' 1';
+--echo #
+SET NAMES utf8;
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
+INSERT INTO t1 VALUES ('1e1'),('1ë1');
+SELECT * FROM t1 WHERE a IN (1,2);
+SELECT * FROM t1 WHERE a IN (1,2) AND a='1ë1';
+SELECT * FROM t1 WHERE a IN (1,2,'x') AND a='1ë1';
+# Equality should not propagate '1ë1' to IN: incompatible comparison context
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2) AND a='1ë1';
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,'x') AND a='1ë1';
+DROP TABLE IF EXISTS t1;
+
+
+--echo #
--echo # End of 10.1 tests
--echo #
diff --git a/mysql-test/t/ddl_i18n_koi8r.test b/mysql-test/t/ddl_i18n_koi8r.test
index 40f8d07c55d..0a62a8ba0f8 100644
--- a/mysql-test/t/ddl_i18n_koi8r.test
+++ b/mysql-test/t/ddl_i18n_koi8r.test
@@ -24,6 +24,8 @@
# - restore object;
#
+set sql_mode="";
+
###########################################################################
#
# NOTE: this file contains text in UTF8 and KOI8-R encodings.
diff --git a/mysql-test/t/ddl_i18n_utf8.test b/mysql-test/t/ddl_i18n_utf8.test
index 35109e62100..023047b952e 100644
--- a/mysql-test/t/ddl_i18n_utf8.test
+++ b/mysql-test/t/ddl_i18n_utf8.test
@@ -30,6 +30,8 @@
#
###########################################################################
+set sql_mode="";
+
# Test requires server to accept client connections (for mysqldump portions)
--source include/not_embedded.inc
--source include/have_utf8.inc
diff --git a/mysql-test/t/default.test b/mysql-test/t/default.test
index 6904d9bb242..17f4383ae22 100644
--- a/mysql-test/t/default.test
+++ b/mysql-test/t/default.test
@@ -9,6 +9,7 @@ drop database if exists mysqltest;
# Bug 10838
# Insert causes warnings for no default values and corrupts tables
#
+set sql_mode="";
CREATE TABLE t1 (a varchar(30) binary NOT NULL DEFAULT ' ',
b varchar(1) binary NOT NULL DEFAULT ' ',
c varchar(4) binary NOT NULL DEFAULT '0000',
@@ -39,6 +40,7 @@ CREATE TABLE t1 (a varchar(30) binary NOT NULL DEFAULT ' ',
b1 tinyblob NULL)
ENGINE=InnoDB DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin;
--enable_warnings
+set sql_mode=default;
INSERT into t1 (b) values ('1');
SHOW WARNINGS;
diff --git a/mysql-test/t/delete_returning_grant.test b/mysql-test/t/delete_returning_grant.test
index f67a766b936..67613603a72 100644
--- a/mysql-test/t/delete_returning_grant.test
+++ b/mysql-test/t/delete_returning_grant.test
@@ -3,6 +3,9 @@
#
--source include/not_embedded.inc
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
+
CREATE TABLE t1 (a int(11), b varchar(32));
INSERT INTO t1 VALUES (7,'ggggggg'),(1,'a'),(3,'ccc'),(4,'dddd'),(1,'A'),
(2,'BB'),(4,'DDDD'),(5,'EEEEE'),(7,'GGGGGGG'),(2,'bb');
@@ -76,3 +79,4 @@ DROP USER mysqltest_1@localhost;
DROP VIEW v1;
DROP TABLE t1;
+set GLOBAL sql_mode=default;
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test
index ddce7f55292..38636b0e971 100644
--- a/mysql-test/t/derived.test
+++ b/mysql-test/t/derived.test
@@ -492,7 +492,38 @@ update t1 set balance=(select sum(balance) from (SELECT balance FROM t1 where ac
set optimizer_switch=@save_derived_optimizer_switch_bug;
drop table t1;
-set optimizer_switch=@save_derived_optimizer_switch;
+--echo #
+--echo # MDEV-6219:Server crashes in Bitmap<64u>::merge
+--echo # (this=0x180, map2=...) on 2nd execution of PS with INSERT .. SELECT,
+--echo # derived_merge
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(8)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('foo'),('bar');
+
+create procedure p1()
+ INSERT INTO t1 SELECT * FROM (
+ SELECT * FROM t1
+ ) AS sq
+ WHERE sq.a IN ( SELECT 'baz' FROM DUAL );
+
+call p1();
+call p1();
+drop procedure p1;
+
+PREPARE stmt FROM "
+ INSERT INTO t1 SELECT * FROM (
+ SELECT * FROM t1
+ ) AS sq
+ WHERE sq.a IN ( SELECT 'baz' FROM DUAL )
+";
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+deallocate prepare stmt;
+
+drop table t1;
--echo #
--echo # MDEV-6892: WHERE does not apply
@@ -506,3 +537,39 @@ select x.id, message from (select id from t1) x left join
(select id, 1 as message from t2) y on x.id=y.id
where coalesce(message,0) <> 0;
drop table t1,t2;
+
+set optimizer_switch=@save_derived_optimizer_switch;
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8747 Wrong result for SELECT..WHERE derived_table_column='a' AND derived_table_column<>_latin1'A' COLLATE latin1_bin
+--echo #
+CREATE TABLE t1 (a VARCHAR(10));
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT * FROM t1 WHERE a='a' AND a <> _latin1'A' COLLATE latin1_bin;
+SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a='a' AND a <> _latin1'A' COLLATE latin1_bin;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a ENUM('5','6'));
+INSERT INTO t1 VALUES ('5'),('6');
+SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a='5';
+SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a=1;
+SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a='5' AND a=1;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-8749 Wrong result for SELECT..WHERE derived_table_enum_column='number' AND derived_table_enum_column OP number2
+--echo #
+CREATE TABLE t1 (a ENUM('5','6'));
+INSERT INTO t1 VALUES ('5'),('6');
+SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a='5';
+SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a=1;
+SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a='5' AND a=1;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test
index 67899837bb2..3d9ab4e4477 100644
--- a/mysql-test/t/derived_view.test
+++ b/mysql-test/t/derived_view.test
@@ -1600,7 +1600,7 @@ CREATE TABLE IF NOT EXISTS `galleries` (
`year` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `pictures` (
`id` int(11) NOT NULL AUTO_INCREMENT,
@@ -1614,7 +1614,7 @@ CREATE TABLE IF NOT EXISTS `pictures` (
`type` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `gallery_id` (`gallery_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
+) DEFAULT CHARSET=utf8 ;
ALTER TABLE `pictures`
ADD CONSTRAINT `pictures_ibfk_1` FOREIGN KEY (`gallery_id`) REFERENCES `galleries` (`id`);
diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test
index 955337290cc..7cf3d6810bb 100644
--- a/mysql-test/t/distinct.test
+++ b/mysql-test/t/distinct.test
@@ -561,7 +561,7 @@ DROP TABLE t1;
#
# Bug #34928: Confusion by having Primary Key and Index
#
-CREATE TABLE t1(a INT, b INT, c INT, d INT, e INT,
+CREATE TABLE t1(a INT, b INT, c INT, d INT default 0, e INT default 0,
PRIMARY KEY(a,b,c,d,e),
KEY(a,b,d,c)
);
diff --git a/mysql-test/t/dyncol.test b/mysql-test/t/dyncol.test
index 65a94dcb49e..86dcee8148a 100644
--- a/mysql-test/t/dyncol.test
+++ b/mysql-test/t/dyncol.test
@@ -657,6 +657,13 @@ SELECT
select column_get(column_create(1, "18446744073709552001" as char), 1 as int);
--echo #
+--echo # MDEV-7505 - Too large scale in DECIMAL dynamic column getter crashes
+--echo # mysqld
+--echo #
+--error ER_TOO_BIG_SCALE
+SELECT COLUMN_GET(`x`, 'y' AS DECIMAL(5,34));
+
+--echo #
--echo # test of symbolic names
--echo #
--echo # creation test (names)
diff --git a/mysql-test/t/empty_server_name-8224.test b/mysql-test/t/empty_server_name-8224.test
new file mode 100644
index 00000000000..b15e9d82eb8
--- /dev/null
+++ b/mysql-test/t/empty_server_name-8224.test
@@ -0,0 +1,13 @@
+#
+# MDEV-8224 Server crashes in get_server_from_table_to_cache on empty name
+#
+--source include/not_embedded.inc
+create server '' foreign data wrapper w2 options (host '127.0.0.1');
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--shutdown_server 10
+--source include/wait_until_disconnected.inc
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+-- enable_reconnect
+-- source include/wait_until_connected_again.inc
+drop server '';
diff --git a/mysql-test/t/enforce_storage_engine.test b/mysql-test/t/enforce_storage_engine.test
index 83deac07fe0..6b422477fe6 100644
--- a/mysql-test/t/enforce_storage_engine.test
+++ b/mysql-test/t/enforce_storage_engine.test
@@ -1,5 +1,7 @@
-- source include/not_embedded.inc
+set local sql_mode="";
+set global sql_mode="";
--disable_warnings
drop table if exists t1;
--enable_warnings
@@ -69,5 +71,41 @@ CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10));
SHOW CREATE TABLE t1;
DROP TABLE t1;
---error 1228
+SET GLOBAL enforce_storage_engine=Memory;
+SET SESSION sql_mode='';
+
+connect (con1,localhost,root,,);
+connection con1;
+select @@session.enforce_storage_engine;
+select @@global.enforce_storage_engine;
+CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+connection default;
+disconnect con1;
+
+set global sql_mode=default;
+SET SESSION enforce_storage_engine=NULL;
SET GLOBAL enforce_storage_engine=NULL;
+
+#
+# MDEV-8577: With enforce-storage-engine mysql_upgrade corrupts the schema:
+# ALTER TABLE should either bypass enforce-storage-engine, or mysql_upgrade
+# should refuse to run
+#
+CREATE TABLE t3 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM;
+INSERT INTO t3 values (NULL, 'test');
+SET SESSION enforce_storage_engine=Memory;
+ALTER TABLE t3 ENGINE=MyISAM;
+SHOW CREATE TABLE t3;
+DROP TABLE t3;
+SET SESSION enforce_storage_engine=NULL;
+CREATE TABLE t3 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM;
+INSERT INTO t3 values (NULL, 'test');
+SET SESSION enforce_storage_engine=Memory;
+ALTER TABLE t3 ADD COLUMN c3 INT;
+SHOW CREATE TABLE t3;
+DROP TABLE t3;
+
+SET SESSION enforce_storage_engine=NULL;
+SET GLOBAL enforce_storage_engine=NULL; \ No newline at end of file
diff --git a/mysql-test/t/enforce_storage_engine_opt.test b/mysql-test/t/enforce_storage_engine_opt.test
index 82cc4117cdb..7ca7f94d3dc 100644
--- a/mysql-test/t/enforce_storage_engine_opt.test
+++ b/mysql-test/t/enforce_storage_engine_opt.test
@@ -1,3 +1,4 @@
+SET SQL_MODE="";
create table t1 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory;
show create table t1;
set session sql_mode='no_engine_substitution';
diff --git a/mysql-test/t/events_1.test b/mysql-test/t/events_1.test
index 89e8f9ca7dc..7cd488bc376 100644
--- a/mysql-test/t/events_1.test
+++ b/mysql-test/t/events_1.test
@@ -4,6 +4,8 @@
# Can't test with embedded server that doesn't support grants
-- source include/not_embedded.inc
+set sql_mode="";
+
call mtr.add_suppression("Column count of mysql.event is wrong. Expected .*, found .*\. The table is probably corrupted");
--disable_warnings
diff --git a/mysql-test/t/events_2.test b/mysql-test/t/events_2.test
index 3d609654b21..ec69a2a5591 100644
--- a/mysql-test/t/events_2.test
+++ b/mysql-test/t/events_2.test
@@ -3,6 +3,8 @@
# Can't test with embedded server that doesn't support grants
-- source include/not_embedded.inc
+set sql_mode="";
+
--disable_warnings
drop database if exists events_test;
--enable_warnings
diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test
index 1e93917b08e..c0157a7727e 100644
--- a/mysql-test/t/events_bugs.test
+++ b/mysql-test/t/events_bugs.test
@@ -8,6 +8,7 @@
# Bug#41925 Warning 1366 Incorrect string value: ... for column processlist.info
#
# Please set $
+SET SQL_MODE="";
let $fixed_bug41925= 0;
#
# Dear maintainer of this test. Please do NOT remove the next big comment.
@@ -1319,5 +1320,4 @@ DROP DATABASE events_test;
SET GLOBAL event_scheduler= 'ON';
--source include/running_event_scheduler.inc
SET @@global.concurrent_insert= @concurrent_insert;
-
# THIS MUST BE THE LAST LINE in this file.
diff --git a/mysql-test/t/events_trans.test b/mysql-test/t/events_trans.test
index 6d829379fea..eea24f19577 100644
--- a/mysql-test/t/events_trans.test
+++ b/mysql-test/t/events_trans.test
@@ -4,6 +4,8 @@
-- source include/have_innodb.inc
-- source include/not_embedded.inc
+set sql_mode="";
+
--disable_warnings
drop database if exists events_test;
drop database if exists mysqltest_no_such_database;
diff --git a/mysql-test/t/events_trans_notembedded.test b/mysql-test/t/events_trans_notembedded.test
index 0353d183386..3cf823bf713 100644
--- a/mysql-test/t/events_trans_notembedded.test
+++ b/mysql-test/t/events_trans_notembedded.test
@@ -13,6 +13,7 @@ use events_test;
#
# Privilege checks
#
+create user mysqltest_user1@localhost;
grant create, insert, select, delete on mysqltest_db2.*
to mysqltest_user1@localhost;
create database mysqltest_db2;
diff --git a/mysql-test/t/explain_json.test b/mysql-test/t/explain_json.test
index 3e6f34b854b..1078222725e 100644
--- a/mysql-test/t/explain_json.test
+++ b/mysql-test/t/explain_json.test
@@ -279,3 +279,18 @@ explain format=json select count(distinct a1,a2,b,c) from t1 where (a2 >= 'b') a
drop table t1;
+--echo #
+--echo # MDEV-8786 Wrong result for SELECT FORMAT=JSON * FROM t1 WHERE a=_latin1 0xDF
+--echo #
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
+INSERT INTO t1 VALUES ('a'),('b');
+EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE a=_latin1 0xDF;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-8785 Wrong results for EXPLAIN EXTENDED...WHERE NULLIF(latin1_col, _utf8'a' COLLATE utf8_bin) IS NOT NULL
+--echo #
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
+INSERT INTO t1 VALUES ('a'),('A');
+EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE NULLIF(a,_utf8'a' COLLATE utf8_bin);
+DROP TABLE t1;
diff --git a/mysql-test/t/features.test b/mysql-test/t/features.test
index f2ac5a5bba6..225ab40b361 100644
--- a/mysql-test/t/features.test
+++ b/mysql-test/t/features.test
@@ -6,6 +6,8 @@
drop table if exists t1;
--enable_warnings
+set sql_mode="";
+
flush status;
show status like "feature%";
diff --git a/mysql-test/t/fix_priv_tables.test b/mysql-test/t/fix_priv_tables.test
index f68c8b518c8..293d3915a05 100644
--- a/mysql-test/t/fix_priv_tables.test
+++ b/mysql-test/t/fix_priv_tables.test
@@ -22,6 +22,8 @@ if (!$MYSQL_FIX_PRIVILEGE_TABLES)
drop table if exists t1,t1aa,t2aa;
--enable_warnings
+set sql_mode="";
+
#
# Bug #20589 Missing some table level privileges after upgrade
#
diff --git a/mysql-test/t/flush-innodb-notembedded.test b/mysql-test/t/flush-innodb-notembedded.test
index d08a0647ff5..15bfeb53475 100644
--- a/mysql-test/t/flush-innodb-notembedded.test
+++ b/mysql-test/t/flush-innodb-notembedded.test
@@ -1,6 +1,8 @@
--source include/have_innodb.inc
--source include/not_embedded.inc
+set sql_mode="";
+
--echo # Test 7: Check privileges required.
--echo #
diff --git a/mysql-test/t/flush2.test b/mysql-test/t/flush2.test
index 7582ab8426b..496b57ccea4 100644
--- a/mysql-test/t/flush2.test
+++ b/mysql-test/t/flush2.test
@@ -1,9 +1,16 @@
#
# Bug#17733 Flushing logs causes daily server crash
#
+
+--source include/not_embedded.inc
+
flush logs;
set global expire_logs_days = 3;
show variables like 'log_bin%';
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+show variables like 'relay_log%';
flush logs;
show variables like 'log_bin%';
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+show variables like 'relay_log%';
set global expire_logs_days = 0;
diff --git a/mysql-test/t/flush_read_lock.test b/mysql-test/t/flush_read_lock.test
index e8ec07392b5..7ba80ea38ac 100644
--- a/mysql-test/t/flush_read_lock.test
+++ b/mysql-test/t/flush_read_lock.test
@@ -13,6 +13,8 @@
# Save the initial number of concurrent sessions.
--source include/count_sessions.inc
+set global sql_mode="";
+set local sql_mode="";
--echo # FTWRL takes two global metadata locks -- a global shared
--echo # metadata lock and the commit blocker lock.
--echo # The first lock prevents DDL from taking place.
@@ -2161,6 +2163,7 @@ disconnect con1;
disconnect con2;
disconnect con3;
+set global sql_mode=default;
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/func_compress.test b/mysql-test/t/func_compress.test
index fc3d2697426..2a06769b2ef 100644
--- a/mysql-test/t/func_compress.test
+++ b/mysql-test/t/func_compress.test
@@ -5,6 +5,10 @@
# Note that this test gives error in the gzip library when running under
# valgrind, but these warnings can be ignored
+set global max_allowed_packet=1048576;
+connect (conn1,localhost,root,,);
+connection conn1;
+
select @test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ';
select length(@test_compress_string);
@@ -142,6 +146,9 @@ DROP TABLE t1;
#
SELECT UNCOMPRESS(CAST(0 AS BINARY(5)));
+disconnect conn1;
+connection default;
+set global max_allowed_packet=default;
--echo #
--echo # End of 5.5 tests
--echo #
diff --git a/mysql-test/t/func_encrypt.test b/mysql-test/t/func_encrypt.test
index 18fb072966b..4eab0ac87e9 100644
--- a/mysql-test/t/func_encrypt.test
+++ b/mysql-test/t/func_encrypt.test
@@ -103,3 +103,21 @@ insert into t1 values (-15818,'requirement\'s');
select encrypt(f1,f2) as a from t1,(select encrypt(f1,f2) as b from t1) a;
--enable_result_log
drop table t1;
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8369 Unexpected impossible WHERE for a condition on a ZEROFILL field
+--echo #
+CREATE TABLE t1 (a INT(6) ZEROFILL);
+INSERT INTO t1 VALUES (1),(2);
+# This should not propagate a=1 into DES_ENCRYPT
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE a=1 AND DES_ENCRYPT('test',a)=_latin1 'abc' COLLATE latin1_bin;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index 42a30760a86..5550eebf1a3 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -821,3 +821,14 @@ FROM ( SELECT * FROM t2 ) AS sq2, t3
ORDER BY field;
drop table t3, t2, t1;
+
+--echo #
+--echo # MDEV-7821 - Server crashes in Item_func_group_concat::fix_fields on 2nd
+--echo # execution of PS
+--echo #
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES(1),(2);
+PREPARE stmt FROM "SELECT GROUP_CONCAT(t1a.a ORDER BY 1, t1a.a=0) FROM t1 AS t1a, t1 AS t1b GROUP BY t1a.a";
+EXECUTE stmt;
+EXECUTE stmt;
+DROP TABLE t1;
diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test
index 1e695142d90..fab39b04484 100644
--- a/mysql-test/t/func_in.test
+++ b/mysql-test/t/func_in.test
@@ -606,3 +606,16 @@ EXECUTE s;
DROP TABLE t1;
--echo # End of 5.3 tests
+
+--echo #
+--echo # MDEV-8755 Equal field propagation is not performed any longer for the IN list when multiple comparison types
+--echo #
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+--echo # Ok to propagate equalities into the left IN argument in case of a single comparison type
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND a IN (1,2,3);
+--echo # Ok to propagate equalities into IN () list, even if multiple comparison types
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND 1 IN (1,a,'3');
+--echo # Not Ok to propagate equalities into the left IN argument in case of multiple comparison types
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND a IN (1,2,'3');
+DROP TABLE t1;
diff --git a/mysql-test/t/func_like.test b/mysql-test/t/func_like.test
index aab3c7fe43b..d1b9b170a3b 100644
--- a/mysql-test/t/func_like.test
+++ b/mysql-test/t/func_like.test
@@ -164,5 +164,24 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10.0 AND a LIKE 10.00;
DROP TABLE t1;
--echo #
+--echo # MDEV-8599 "WHERE varchar_field LIKE temporal_const" does not use range optimizer
+--echo #
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1, KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('00:00:00');
+INSERT INTO t1 VALUES ('00:00:01');
+INSERT INTO t1 VALUES ('00:00:02');
+INSERT INTO t1 VALUES ('00:00:03');
+INSERT INTO t1 VALUES ('00:00:04');
+INSERT INTO t1 VALUES ('00:00:05');
+INSERT INTO t1 VALUES ('00:00:06');
+INSERT INTO t1 VALUES ('00:00:07');
+EXPLAIN SELECT * FROM t1 WHERE a LIKE '00:00:00';
+EXPLAIN SELECT * FROM t1 WHERE a LIKE TIME'00:00:00';
+SELECT * FROM t1 WHERE a LIKE '00:00:00';
+SELECT * FROM t1 WHERE a LIKE TIME'00:00:00';
+DROP TABLE t1;
+
+
+--echo #
--echo # End of 10.1 tests
--echo #
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
index 2998742dbcc..b48f4599074 100644
--- a/mysql-test/t/func_math.test
+++ b/mysql-test/t/func_math.test
@@ -136,9 +136,11 @@ DROP TABLE t1;
#
# InnoDB is required to reproduce the fault, but it is okay if we default to
# MyISAM when testing.
+set sql_mode="";
--disable_warnings
create table t1 (a varchar(90), ts datetime not null, index (a)) engine=innodb default charset=utf8;
--enable_warnings
+set sql_mode=default;
insert into t1 values ('http://www.foo.com/', now());
select a from t1 where a='http://www.foo.com/' order by abs(timediff(ts, 0));
drop table t1;
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
index 5236987e16f..364266d7f6f 100644
--- a/mysql-test/t/func_misc.test
+++ b/mysql-test/t/func_misc.test
@@ -379,7 +379,7 @@ CREATE TABLE t1 (a char(2) not null );
INSERT INTO t1 VALUES (4),(7),(1);
set @optimizer_switch_save= @@optimizer_switch;
set optimizer_switch='materialization=off';
-CREATE TABLE tv (e char(2) not null ) engine=mysql;
+CREATE TABLE tv (e char(2) not null );
INSERT INTO tv VALUES (1);
CREATE ALGORITHM=MERGE VIEW v_merge AS SELECT * FROM tv;
CREATE ALGORITHM=MERGE VIEW vm AS SELECT * FROM tv;
@@ -391,6 +391,11 @@ set optimizer_switch=@optimizer_switch_save;
drop view v_merge, vm;
drop table t1,tv;
+--echo #
+--echo # MDEV-4017 - GET_LOCK() with negative timeouts has strange behavior
+--echo #
+SELECT GET_LOCK('ul1', NULL);
+SELECT GET_LOCK('ul1', -1);
--echo #
--echo # GET_LOCK, RELEASE_LOCK, IS_USED_LOCK functions test
diff --git a/mysql-test/t/func_regexp_pcre.test b/mysql-test/t/func_regexp_pcre.test
index 6710f5cf096..c9b4c10007d 100644
--- a/mysql-test/t/func_regexp_pcre.test
+++ b/mysql-test/t/func_regexp_pcre.test
@@ -402,3 +402,27 @@ SET default_regex_flags=DEFAULT;
--echo # MDEV-6965 non-captured group \2 in regexp_replace
--echo #
SELECT REGEXP_REPLACE('1 foo and bar', '(\\d+) foo and (\\d+ )?bar', '\\1 this and \\2that');
+
+--echo #
+--echo # MDEV-8102 REGEXP function fails to match hex values when expression is stored as a variable
+--echo #
+
+--echo # Testing a warning
+SET NAMES latin1;
+SET @regCheck= '\\xE0\\x01';
+SELECT 0xE001 REGEXP @regCheck;
+
+--echo # Testing workaround N1: This makes the pattern to be a binary string:
+SET NAMES latin1;
+SET @regCheck= X'E001';
+SELECT 0xE001 REGEXP @regCheck;
+
+--echo # Testing workaround N2: This also makes the pattern to be a binary string, using a different syntax:
+SET NAMES latin1;
+SET @regCheck= _binary '\\xE0\\x01';
+SELECT 0xE001 REGEXP @regCheck;
+
+--echo # Testing workarond N3: This makes derivation of the subject string stronger (IMLICIT instead of COERCIBLE)
+SET NAMES latin1;
+SET @regCheck= '\\xE0\\x01';
+SELECT CAST(0xE001 AS BINARY) REGEXP @regCheck;
diff --git a/mysql-test/t/func_regexp_pcre_debug.test b/mysql-test/t/func_regexp_pcre_debug.test
new file mode 100644
index 00000000000..c2581fa4110
--- /dev/null
+++ b/mysql-test/t/func_regexp_pcre_debug.test
@@ -0,0 +1,6 @@
+--source include/have_debug.inc
+
+SET debug_dbug='+d,pcre_exec_error_123';
+SELECT 'a' RLIKE 'a';
+SET debug_dbug='';
+SELECT 'a' RLIKE 'a';
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 6369609bea3..14af10b0320 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -6,6 +6,10 @@
drop table if exists t1,t2;
--enable_warnings
+set global max_allowed_packet=1048576;
+connect (conn1,localhost,root,,);
+connection conn1;
+
let $mysqld_datadir= `select @@datadir`;
set names latin1;
@@ -105,6 +109,7 @@ select aes_decrypt(NULL,"a");
select aes_decrypt("a",NULL);
select aes_decrypt("a","a");
select aes_decrypt(aes_encrypt("","a"),"a");
+select aes_decrypt("", "a");
select repeat('monty',5),concat('*',space(5),'*');
select reverse('abc'),reverse('abcd');
select rpad('a',4,'1'),rpad('a',4,'12'),rpad('abcd',3,'12'), rpad(11, 10 , 22), rpad("ab", 10, 22);
@@ -1561,7 +1566,7 @@ round(
)
);
---connection default
+--connection conn1
SET @@global.max_allowed_packet:= @tmp_max;
--disconnect newconn
#
@@ -1738,7 +1743,31 @@ EXECUTE stmt;
SET NAMES latin2;
EXECUTE stmt;
+disconnect conn1;
+connection default;
+set global max_allowed_packet=default;
--echo #
--echo # End of 5.6 tests
--echo #
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8369 Unexpected impossible WHERE for a condition on a ZEROFILL field
+--echo #
+CREATE TABLE t1 (a BIGINT(20) ZEROFILL);
+INSERT INTO t1 VALUES (18446744073709551615),(0);
+SELECT * FROM t1 WHERE a=18446744073709551615;
+SELECT * FROM t1 WHERE FORMAT(a,0)='18,446,744,073,709,551,615';
+SELECT * FROM t1 WHERE a=18446744073709551615 AND FORMAT(a,0)='18,446,744,073,709,551,615';
+# This should not propagate the equality into FORMAT()
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE a=18446744073709551615 AND FORMAT(a,0)='18,446,744,073,709,551,615';
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test
index d3703de26c5..82e421dcb6b 100644
--- a/mysql-test/t/func_test.test
+++ b/mysql-test/t/func_test.test
@@ -194,3 +194,32 @@ EXPLAIN EXTENDED SELECT NOT NOT strcmp('a','b');
--echo #
--echo # End of 10.0 tests
--echo #
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8167 XOR returns bad results for an indexed column
+--echo #
+CREATE TABLE t1 (
+ id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
+ k INTEGER UNSIGNED DEFAULT '0' NOT NULL,
+ c CHAR(120) DEFAULT '' NOT NULL,
+ pad CHAR(60) DEFAULT '' NOT NULL,
+ PRIMARY KEY (id)
+) ENGINE=MyISAM;
+INSERT INTO t1 (k, c, pad) VALUES (10, 'a', 'xxx');
+INSERT INTO t1 (k, c, pad) VALUES (11, 'a', 'xxx');
+INSERT INTO t1 (k, c, pad) VALUES (12, 'a', 'xxx');
+INSERT INTO t1 (k, c, pad) VALUES (13, 'a', 'xxx');
+INSERT INTO t1 (k, c, pad) VALUES (14, 'a', 'xxx');
+INSERT INTO t1 (k, c, pad) VALUES (15, 'a', 'xxx');
+INSERT INTO t1 (k, c, pad) VALUES (16, 'a', 'xxx');
+SELECT * FROM t1 WHERE id XOR 0;
+SELECT * FROM t1 IGNORE KEY(PRIMARY) WHERE id XOR 0;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 2b189765bbc..3fb87e91b17 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -1649,3 +1649,44 @@ INSERT INTO t1 VALUES (17, NULL);
INSERT INTO t1 VALUES (18, '2010-10-13');
SELECT a.id,a.date1,FROM_DAYS(TO_DAYS(a.date1)-10) as date2, DATE_ADD(a.date1,INTERVAL -10 DAY),TO_DAYS(a.date1)-10 FROM t1 a ORDER BY a.id;
DROP TABLE t1;
+
+
+--echo #
+--echo # Start of 10.0 tests
+--echo #
+
+--echo #
+--echo # MDEV-8205 timediff returns null when comparing decimal time to time string value
+--echo #
+
+# 1h difference
+SELECT
+ TIMEDIFF('2014-01-01 00:00:00' , '2014-01-01 01:00:00' ) AS str_str,
+ TIMEDIFF('2014-01-01 00:00:00' , 20140101010000.000 ) AS str_dec,
+ TIMEDIFF(20140101000000.000 , 20140101010000.000 ) AS dec_dec,
+ TIMEDIFF(20140101000000.000 , '2014-01-01 01:00:00' ) AS dec_str;
+
+# 1D1h difference
+SELECT
+ TIMEDIFF('2014-01-01 00:00:00' , '2014-01-02 01:00:00' ) AS str_str,
+ TIMEDIFF('2014-01-01 00:00:00' , 20140102010000.000 ) AS str_dec,
+ TIMEDIFF(20140101000000.000 , 20140102010000.000 ) AS dec_dec,
+ TIMEDIFF(20140101000000.000 , '2014-01-02 01:00:00' ) AS dec_str;
+
+# 1M1D1h difference
+SELECT
+ TIMEDIFF('2014-01-01 00:00:00' , '2014-02-02 01:00:00' ) AS str_str,
+ TIMEDIFF('2014-01-01 00:00:00' , 20140202010000.000 ) AS str_dec,
+ TIMEDIFF(20140101000000.000 , 20140202010000.000 ) AS dec_dec,
+ TIMEDIFF(20140101000000.000 , '2014-02-02 01:00:00' ) AS dec_str;
+
+# 2M1D1h difference
+SELECT
+ TIMEDIFF('2014-01-01 00:00:00' , '2014-03-02 01:00:00' ) AS str_str,
+ TIMEDIFF('2014-01-01 00:00:00' , 20140302010000.000 ) AS str_dec,
+ TIMEDIFF(20140101000000.000 , 20140302010000.000 ) AS dec_dec,
+ TIMEDIFF(20140101000000.000 , '2014-03-02 01:00:00' ) AS dec_str;
+
+--echo #
+--echo # End of 10.0 tests
+--echo #
diff --git a/mysql-test/t/func_weight_string.test b/mysql-test/t/func_weight_string.test
index 6c34ce1e460..b8fdfd8b250 100644
--- a/mysql-test/t/func_weight_string.test
+++ b/mysql-test/t/func_weight_string.test
@@ -2,6 +2,11 @@
drop table if exists t1;
--enable_warnings
+
+set global max_allowed_packet=1048576;
+connect (conn1,localhost,root,,);
+connection conn1;
+
set names latin1;
#
@@ -111,3 +116,34 @@ drop table t1;
SELECT HEX(WEIGHT_STRING('ab' AS CHAR(1000000000000000000)));
SELECT HEX(WEIGHT_STRING('ab' AS BINARY(1000000000000000000)));
+disconnect conn1;
+connection default;
+set global max_allowed_packet=default;
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8369 Unexpected impossible WHERE for a condition on a ZEROFILL field
+--echo #
+CREATE TABLE t1 (a INT(6) ZEROFILL);
+INSERT INTO t1 VALUES (1),(2);
+SELECT * FROM t1 WHERE a=1;
+SELECT * FROM t1 WHERE WEIGHT_STRING(a) IS NULL;
+SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
+ALTER TABLE t1 MODIFY a DOUBLE ZEROFILL;
+SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
+ALTER TABLE t1 MODIFY a DECIMAL(10,1) ZEROFILL;
+SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/gis-precise.test b/mysql-test/t/gis-precise.test
index c6cf42e86e4..5e57569a912 100644
--- a/mysql-test/t/gis-precise.test
+++ b/mysql-test/t/gis-precise.test
@@ -357,5 +357,10 @@ SELECT ST_NUMPOINTS(ST_EXTERIORRING(ST_BUFFER( POLYGONFROMTEXT( 'POLYGON( ( 0.0
# MDEV-5615 crash in Gcalc_function::add_operation
select astext(buffer(st_linestringfromwkb(linestring(point(-1,1), point(-1,-2))),-1));
+# MDEV-7925 Inconsistent behavior of ST_Touches with a POINT as one of arguments
+select ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT(0 0)'));
+select ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)'));
+select ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'));
+
--source include/gis_debug.inc
diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test
index 404f0447f56..acd91a91c27 100644
--- a/mysql-test/t/gis-rtree.test
+++ b/mysql-test/t/gis-rtree.test
@@ -976,3 +976,37 @@ SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(
SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
DROP TABLE t1;
+
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8239 Reverse spatial operations OP(const, field) do not get optimized
+--echo #
+CREATE TABLE t1 (a GEOMETRY NOT NULL, SPATIAL KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (Point(1,2)),(Point(1,3));
+EXPLAIN SELECT * FROM t1 WHERE MBRINTERSECTS(a,Point(1,2));
+EXPLAIN SELECT * FROM t1 WHERE ST_INTERSECTS(a,Point(1,2));
+EXPLAIN SELECT * FROM t1 WHERE MBRINTERSECTS(Point(1,2),a);
+EXPLAIN SELECT * FROM t1 WHERE ST_INTERSECTS(Point(1,2),a);
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-8610 "WHERE CONTAINS(indexed_geometry_column,1)" causes full table scan
+--echo #
+CREATE TABLE t1 (a GEOMETRY NOT NULL, SPATIAL KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (Point(1,1)),(Point(2,2)),(Point(3,3));
+EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,1);
+EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,1.0);
+EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,1e0);
+EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,TIME'00:00:00');
+EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,DATE'2001-01-01');
+EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,TIMESTAMP'2001-01-01 00:00:00');
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
index 2d05d35bb13..18cfe95b749 100644
--- a/mysql-test/t/gis.test
+++ b/mysql-test/t/gis.test
@@ -1511,3 +1511,17 @@ select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'
select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(1 1)'),'FF*FF****') as disjoint;
select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'FF*FF****') as disjoint;
+
+--echo #
+--echo # MDEV-7528 GIS: Functions return NULL instead of specified -1 for NULL arguments.
+--echo #
+
+select ST_IsRing(NULL);
+
+--echo #
+--echo # MDEV-8675 Different results of GIS functions on NULL vs NOT NULL columns
+--echo #
+CREATE TABLE t1 (g1 GEOMETRY NOT NULL,g2 GEOMETRY NULL);
+CREATE TABLE t2 AS SELECT WITHIN(g1,g1) as w1,WITHIN(g2,g2) AS w2 FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index 20632038273..1d828cd8693 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -6,6 +6,8 @@
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
@@ -1666,6 +1668,7 @@ FLUSH PRIVILEGES;
CREATE DATABASE mysqltest1;
CREATE PROCEDURE mysqltest1.test() SQL SECURITY DEFINER
SELECT 1;
+CREATE FUNCTION mysqltest1.test() RETURNS INT RETURN 1;
--error ER_NO_SUCH_TABLE
GRANT EXECUTE ON FUNCTION mysqltest1.test TO mysqltest_1@localhost;
GRANT ALL PRIVILEGES ON test.* TO mysqltest_1@localhost;
@@ -2207,6 +2210,29 @@ disconnect con1;
DROP USER untrusted@localhost;
DROP DATABASE secret;
+--echo #
+--echo # BUG#11759114 - '51401: GRANT TREATS NONEXISTENT FUNCTIONS/PRIVILEGES
+--echo # DIFFERENTLY'.
+--echo #
+--disable_warnings
+drop database if exists mysqltest_db1;
+--enable_warnings
+create database mysqltest_db1;
+create user mysqltest_u1;
+--echo # Both GRANT statements below should fail with the same error.
+--error ER_SP_DOES_NOT_EXIST
+grant execute on function mysqltest_db1.f1 to mysqltest_u1;
+--error ER_SP_DOES_NOT_EXIST
+grant execute on procedure mysqltest_db1.p1 to mysqltest_u1;
+--echo # Let us show that GRANT behaviour for routines is consistent
+--echo # with GRANT behaviour for tables. Attempt to grant privilege
+--echo # on non-existent table also results in an error.
+--error ER_NO_SUCH_TABLE
+grant select on mysqltest_db1.t1 to mysqltest_u1;
+show grants for mysqltest_u1;
+drop database mysqltest_db1;
+drop user mysqltest_u1;
+
+set GLOBAL sql_mode=default;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
-
diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test
index 8590dccd1d1..a40fd2afb18 100644
--- a/mysql-test/t/grant2.test
+++ b/mysql-test/t/grant2.test
@@ -5,6 +5,8 @@
--source include/count_sessions.inc
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
SET NAMES binary;
#
@@ -1029,5 +1031,6 @@ DROP USER mysqltest_u4@localhost;
DROP USER mysqltest_u5@localhost;
+set GLOBAL sql_mode=default;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/grant3.test b/mysql-test/t/grant3.test
index d24b2de17eb..27f565916f7 100644
--- a/mysql-test/t/grant3.test
+++ b/mysql-test/t/grant3.test
@@ -4,6 +4,8 @@
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
+set global sql_mode="";
+set local sql_mode="";
# Test of GRANT commands
@@ -204,6 +206,7 @@ connection default;
DROP USER 'user2'@'%';
DROP DATABASE temp;
+set global sql_mode=default;
--echo End of 5.0 tests
# Wait till we reached the initial number of concurrent sessions
diff --git a/mysql-test/t/grant4.test b/mysql-test/t/grant4.test
index 36c44fe997a..a3578c9b85a 100644
--- a/mysql-test/t/grant4.test
+++ b/mysql-test/t/grant4.test
@@ -4,6 +4,8 @@
--disable_warnings
drop database if exists mysqltest_db1;
--enable_warnings
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
create database mysqltest_db1;
use mysqltest_db1;
create table t_column_priv_only (a int, b int);
@@ -232,3 +234,6 @@ create user foo2 identified via mysql_native_password using '2222222222222222';
create user foo3 identified via mysql_old_password using '00';
--error ER_PASSWD_LENGTH
create user foo4 identified via mysql_old_password using '11111111111111111111111111111111111111111';
+
+
+set GLOBAL sql_mode=default;
diff --git a/mysql-test/t/grant_4332.test b/mysql-test/t/grant_4332.test
index d3c3b2d5652..41e0b822f98 100644
--- a/mysql-test/t/grant_4332.test
+++ b/mysql-test/t/grant_4332.test
@@ -6,6 +6,8 @@
#
--source include/not_embedded.inc
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
alter table mysql.user modify User char(16) binary not null default '';
alter table mysql.db modify User char(16) binary not null default '';
@@ -40,3 +42,4 @@ flush privileges;
select user();
--disable_metadata
+set GLOBAL sql_mode=default;
diff --git a/mysql-test/t/grant_explain_non_select.test b/mysql-test/t/grant_explain_non_select.test
index d59a8f3d8ce..701586be325 100644
--- a/mysql-test/t/grant_explain_non_select.test
+++ b/mysql-test/t/grant_explain_non_select.test
@@ -8,6 +8,9 @@
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
+
CREATE DATABASE privtest_db;
CREATE TABLE privtest_db.t1 (a INT);
@@ -254,5 +257,7 @@ DROP USER 'privtest'@localhost;
USE test;
DROP DATABASE privtest_db;
+set GLOBAL sql_mode=default;
+set LOCAL sql_mode=default;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/grant_lowercase.test b/mysql-test/t/grant_lowercase.test
index 4fc5facf808..e31a72b890e 100644
--- a/mysql-test/t/grant_lowercase.test
+++ b/mysql-test/t/grant_lowercase.test
@@ -4,7 +4,7 @@
#
# http://seclists.org/fulldisclosure/2012/Dec/4
#
-
+set sql_mode="";
# in acl_get(), check_grant_db(), mysql_grant()
grant file on *.* to user1@localhost with grant option;
grant select on `a%`.* to user1@localhost with grant option;
@@ -19,13 +19,12 @@ drop user user1@localhost;
# in acl_load()
call mtr.add_suppression("Incorrect database name");
alter table mysql.host modify Db varchar(200);
-alter table mysql.db modify User char(16), modify Db varchar(200);
+alter table mysql.db modify User char(16) default "", modify Db varchar(200) default "";
insert mysql.host set db=concat('=>', repeat(_utf8 'й', 200));
insert mysql.db set db=concat('=>', repeat(_utf8 'й', 200));
flush privileges; # shouldn't crash here
delete from mysql.host where db like '=>%';
delete from mysql.db where db like '=>%';
-alter table mysql.host modify Db char(64);
-alter table mysql.db modify Db char(64), modify User char(80);
+alter table mysql.host modify Db char(64) default "";
+alter table mysql.db modify Db char(64) default "", modify User char(80) default "";
flush privileges;
-
diff --git a/mysql-test/t/grant_lowercase_fs.test b/mysql-test/t/grant_lowercase_fs.test
index f57f950ec8c..92191829c58 100644
--- a/mysql-test/t/grant_lowercase_fs.test
+++ b/mysql-test/t/grant_lowercase_fs.test
@@ -6,6 +6,8 @@
# Bug#41049 does syntax "grant" case insensitive?
#
create database db1;
+create user user_1@localhost;
+create user USER_1@localhost;
GRANT CREATE ON db1.* to user_1@localhost;
GRANT SELECT ON db1.* to USER_1@localhost;
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index dfb7f28ab28..531cec6b730 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -394,6 +394,7 @@ select a,count(*) from t1 group by a;
set big_tables=1;
select a,count(*) from t1 group by a;
drop table t1;
+set big_tables=0;
#
# Test of GROUP BY ... ORDER BY NULL optimization
@@ -485,9 +486,12 @@ create table t1 (a integer, b integer, c integer);
insert into t1 (a,b) values (1,2),(1,3),(2,5);
select a, 0.1*0+1 r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2=1;
# rand(100)*10 will be < 2 only for the first row (of 6)
-select a, round(rand(100)*10) r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2<=2;
+select a, round(rand(100)*10) r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2<=2;
+select a, round(rand(100)*10) r2, sum(1) r1 from t1 group by a having r1>1 and r2<=2;
select a,sum(b) from t1 where a=1 group by c;
select a*sum(b) from t1 where a=1 group by c;
+select a*sum(b) as f1 from t1 where a=1 group by c having f1 <= 10;
+select a,a*sum(b) as f1 from t1 where a=1 group by c having a*sum(b)+0 <= 10;
select sum(a)*sum(b) from t1 where a=1 group by c;
select a,sum(b) from t1 where a=1 group by c having a=1;
select a as d,sum(b) from t1 where a=1 group by c having d=1;
@@ -1346,9 +1350,9 @@ let $query=SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2
FROM t1 GROUP BY field1, field2;
# Needs to be range to exercise bug
---eval EXPLAIN $query;
+--eval EXPLAIN $query
FLUSH STATUS;
---eval $query;
+--eval $query
SHOW SESSION STATUS LIKE 'Sort_scan%';
CREATE VIEW v1 AS SELECT * FROM t1;
@@ -1369,6 +1373,14 @@ select col1 f1, col1 f2 from t1 order by f2, f1+0;
select col1 f1, col1 f2 from t1 order by f2, f1+0;
explain
+select col1 f1, col1 f2 from t1 group by f1;
+select col1 f1, col1 f2 from t1 group by f1;
+
+explain
+select col1 f1, col1 f2 from t1 group by f1, f2;
+select col1 f1, col1 f2 from t1 group by f1, f2;
+
+explain
select col1 f1, col1 f2 from t1 group by f2 order by f2, f1;
select col1 f1, col1 f2 from t1 group by f2 order by f2, f1;
@@ -1376,6 +1388,7 @@ explain
select col1 f1, col1 f2 from t1 group by f1, f2 order by f2, f1;
select col1 f1, col1 f2 from t1 group by f1, f2 order by f2, f1;
+
CREATE TABLE t2(
col1 int,
col2 int,
@@ -1386,10 +1399,21 @@ INSERT INTO t2(col1, col2) VALUES
(11,10),(12,9),(13,8),(14,7),(15,6),(16,5),(17,4),(18,3),(19,2),(20,1);
explain
+select col1 f1, col2 f2, col1 f3 from t2 group by f1;
+explain
+select SQL_BIG_RESULT col1 f1, col2 f2, col1 f3 from t2 group by f1;
+explain
+select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2;
+explain
+select col1 f1, col1 f2 from t2 group by f1, 1+1;
+
+explain
select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3+0;
select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3+0;
explain
+select col1 f1, col2 f2, col1 f3 from t2 order by f1,f2;
+explain
select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3+0;
select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3+0;
@@ -1522,7 +1546,7 @@ DROP TABLE t1;
create table t1 (a int, b int);
insert into t1 values (1,11), (1,12), (2,22),(2,23), (4,44),(4,45);
create table t2 (c int, d int);
-insert into t2 values (1,11), (1,12), (2,22),(2,23), (4,44),(4,45);
+insert into t2 values (1,11), (2,22), (4,44);
select distinct a,sum(b), (select d from t2 where c=a order by max(b) limit 1) from t1 group by a order by max(b);
drop table t1, t2;
diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test
index 47d551f8241..b0bc42d7f8c 100644
--- a/mysql-test/t/group_min_max.test
+++ b/mysql-test/t/group_min_max.test
@@ -1558,5 +1558,56 @@ SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id;
DROP TABLE t1;
--echo #
+--echo # MDEV-8229 GROUP_MIN_MAX is erroneously applied for BETWEEN in some cases
+--echo #
+SET NAMES latin1;
+CREATE TABLE t1 (id INT NOT NULL, a VARCHAR(20)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,'2001-01-01');
+INSERT INTO t1 VALUES (1,'2001-01-02');
+INSERT INTO t1 VALUES (1,'2001-01-03');
+INSERT INTO t1 VALUES (1,' 2001-01-04');
+INSERT INTO t1 VALUES (2,'2001-01-01');
+INSERT INTO t1 VALUES (2,'2001-01-02');
+INSERT INTO t1 VALUES (2,'2001-01-03');
+INSERT INTO t1 VALUES (2,' 2001-01-04');
+INSERT INTO t1 VALUES (3,'2001-01-01');
+INSERT INTO t1 VALUES (3,'2001-01-02');
+INSERT INTO t1 VALUES (3,'2001-01-03');
+INSERT INTO t1 VALUES (3,' 2001-01-04');
+INSERT INTO t1 VALUES (4,'2001-01-01');
+INSERT INTO t1 VALUES (4,'2001-01-02');
+INSERT INTO t1 VALUES (4,'2001-01-03');
+INSERT INTO t1 VALUES (4,' 2001-01-04');
+SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN ' 2001-01-04' AND '2001-01-05' GROUP BY id;
+SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND '2001-01-05' GROUP BY id;
+SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND DATE'2001-01-05' GROUP BY id;
+SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND '2001-01-05' GROUP BY id;
+SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND DATE'2001-01-05' GROUP BY id;
+ALTER TABLE t1 ADD KEY(id,a);
+SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN ' 2001-01-04' AND '2001-01-05' GROUP BY id;
+SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND '2001-01-05' GROUP BY id;
+SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND DATE'2001-01-05' GROUP BY id;
+SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND '2001-01-05' GROUP BY id;
+SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND DATE'2001-01-05' GROUP BY id;
+EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN ' 2001-01-04' AND '2001-01-05' GROUP BY id;
+EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND '2001-01-05' GROUP BY id;
+EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND DATE'2001-01-05' GROUP BY id;
+EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND '2001-01-05' GROUP BY id;
+EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND DATE'2001-01-05' GROUP BY id;
+DROP TABLE t1;
+
+--echo #
+--echo # MIN() optimization didn't work correctly with BETWEEN when using too
+--echo # long strings.
+--echo #
+
+create table t1 (a varchar(10), key (a)) engine=myisam;
+insert into t1 values("bar"),("Cafe");
+explain select min(a) from t1 where a between "a" and "Cafe2";
+explain select min(a) from t1 where a between "a" and "Cafeeeeeeeeeeeeeeeeeeeeeeeeee";
+explain select min(a) from t1 where a between "abbbbbbbbbbbbbbbbbbbb" and "Cafe2";
+drop table t1;
+
+--echo #
--echo # End of 10.1 tests
--echo #
diff --git a/mysql-test/t/help.test b/mysql-test/t/help.test
index 71821e46771..43e61136e05 100644
--- a/mysql-test/t/help.test
+++ b/mysql-test/t/help.test
@@ -63,12 +63,14 @@ help 'impossible_function_1';
help 'impossible_category_1';
##############
+set sql_mode="";
--disable_warnings
alter table mysql.help_relation engine=innodb;
alter table mysql.help_keyword engine=innodb;
alter table mysql.help_topic engine=innodb;
alter table mysql.help_category engine=innodb;
--enable_warnings
+set sql_mode=default;
##############
help 'function_of_my_dream';
diff --git a/mysql-test/t/host_cache_size_functionality.test b/mysql-test/t/host_cache_size_functionality.test
index 1696c2fcb97..5a7376cc5eb 100644
--- a/mysql-test/t/host_cache_size_functionality.test
+++ b/mysql-test/t/host_cache_size_functionality.test
@@ -35,7 +35,7 @@ SELECT COUNT(@@GLOBAL.Host_Cache_Size);
--echo 1 Expected
#set @Default_host_cache_size=(select if(if(@@global.max_connections<500,128+@@global.max_connections,128+@@global.max_connections+floor((@@global.max_connections-500)/20))>2000,2000,if(@@global.max_connections<500,128+@@global.max_connections,128+@@global.max_connections+floor((@@global.max_connections-500)/20))));
-set @Default_host_cache_size=128;
+set @Default_host_cache_size=279;
select @@global.Host_Cache_Size=@Default_host_cache_size;
--echo 1 Expected
diff --git a/mysql-test/t/implicit_commit.test b/mysql-test/t/implicit_commit.test
index 59f8dc3a44c..bcc43865395 100644
--- a/mysql-test/t/implicit_commit.test
+++ b/mysql-test/t/implicit_commit.test
@@ -2,6 +2,8 @@ source include/have_innodb.inc;
source include/not_embedded.inc;
source include/have_profiling.inc;
+SET SQL_MODE="";
+
SET GLOBAL EVENT_SCHEDULER = OFF;
SET BINLOG_FORMAT = STATEMENT;
diff --git a/mysql-test/t/index_intersect.test b/mysql-test/t/index_intersect.test
index 001c698029e..19918c03479 100644
--- a/mysql-test/t/index_intersect.test
+++ b/mysql-test/t/index_intersect.test
@@ -428,7 +428,7 @@ CREATE TABLE t1 (
f5 int,
PRIMARY KEY (f1),
KEY (f4)
-) ENGINE=InnoDB;
+);
INSERT INTO t1 VALUES
(5,'H',1), (9,'g',0), (527,'i',0), (528,'y',1), (529,'S',6),
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index cd98bf3aa5c..f1e78441852 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -14,6 +14,8 @@
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
+set global sql_mode="";
+set local sql_mode="";
# Test for information_schema.schemata &
# show databases
@@ -1907,3 +1909,4 @@ disconnect con1;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
+set global sql_mode=default;
diff --git a/mysql-test/t/information_schema2.test b/mysql-test/t/information_schema2.test
index c2479087f47..d577cdc1e4d 100644
--- a/mysql-test/t/information_schema2.test
+++ b/mysql-test/t/information_schema2.test
@@ -7,3 +7,16 @@ select variable_name from information_schema.session_status where variable_name
select variable_name from information_schema.session_variables where variable_name =
(select variable_name from information_schema.session_variables where variable_name = 'basedir');
+#
+# information_schema tables inside subqueries, they should not be re-populated
+# (i_s.columns needs to scan i_s itself, creating a tmp table for every i_s
+# table. if it's re-populated, it'll do that multiple times)
+#
+create table t1 (a char);
+insert t1 values ('a'),('t'),('z');
+flush status;
+select a, exists (select 1 from information_schema.columns where table_schema=concat('tes',a)) from t1;
+# fix the result in ps-protocol
+--replace_result 44 43
+show status like 'created_tmp_tables';
+drop table t1;
diff --git a/mysql-test/t/information_schema_db.test b/mysql-test/t/information_schema_db.test
index 5b730db47cd..70ad9b5b920 100644
--- a/mysql-test/t/information_schema_db.test
+++ b/mysql-test/t/information_schema_db.test
@@ -7,6 +7,9 @@
-- source include/testdb_only.inc
+set local sql_mode="";
+set global sql_mode="";
+
--disable_warnings
drop table if exists t1,t2;
drop view if exists v1,v2;
@@ -250,3 +253,5 @@ connection user1;
disconnect user1;
--source include/wait_until_disconnected.inc
connection default;
+
+set global sql_mode=default;
diff --git a/mysql-test/t/information_schema_linux.test b/mysql-test/t/information_schema_linux.test
new file mode 100644
index 00000000000..0e3170080c3
--- /dev/null
+++ b/mysql-test/t/information_schema_linux.test
@@ -0,0 +1,10 @@
+--source include/linux.inc
+
+--echo #
+--echo # MDEV-6756: map a linux pid (child pid) to a connection id shown in
+--echo # the output of SHOW PROCESSLIST
+--echo #
+--connect (con1,localhost,root)
+SELECT max(tid) != min(tid) FROM information_schema.processlist;
+--connection default
+--disconnect con1
diff --git a/mysql-test/t/information_schema_routines.test b/mysql-test/t/information_schema_routines.test
index c578176a85d..190410c2b82 100644
--- a/mysql-test/t/information_schema_routines.test
+++ b/mysql-test/t/information_schema_routines.test
@@ -54,6 +54,8 @@
# the routine; otherwise NULL),
# DEFINER (shows the user who created the routine).
################################################################################
+set sql_mode="";
+set sql_mode="";
-- echo # ========== routines.1 ==========
USE INFORMATION_SCHEMA;
--replace_result ENGINE=MyISAM "" ENGINE=MARIA "" ENGINE=Aria "" " PAGE_CHECKSUM=1" "" " PAGE_CHECKSUM=0" ""
diff --git a/mysql-test/t/innodb_load_xa.test b/mysql-test/t/innodb_load_xa.test
index fe466e1f899..65b74120e8e 100644
--- a/mysql-test/t/innodb_load_xa.test
+++ b/mysql-test/t/innodb_load_xa.test
@@ -20,3 +20,6 @@ commit;
show status like 'Handler_prepare';
drop table t1;
uninstall plugin innodb;
+
+--source include/restart_mysqld.inc
+
diff --git a/mysql-test/t/insert_notembedded.test b/mysql-test/t/insert_notembedded.test
index 4e5fe6f6755..713eaf5db40 100644
--- a/mysql-test/t/insert_notembedded.test
+++ b/mysql-test/t/insert_notembedded.test
@@ -1,5 +1,8 @@
-- source include/not_embedded.inc
+set local sql_mode="";
+set global sql_mode="";
+
--disable_warnings
drop table if exists t1;
--enable_warnings
@@ -188,3 +191,6 @@ disconnect select;
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/t/join_cache.test b/mysql-test/t/join_cache.test
index 7d873c555f6..019d8edde2f 100644
--- a/mysql-test/t/join_cache.test
+++ b/mysql-test/t/join_cache.test
@@ -2505,6 +2505,18 @@ SELECT t2.v FROM t1, t2, t3
WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;
+# MDEV-8189 field<>const and const<>field are not symmetric
+# Do the same EXPLAIN and SELECT
+# for "t2.v <> t3.v" instead of "t3.v <> t2.v"
+
+EXPLAIN
+SELECT t2.v FROM t1, t2, t3
+WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
+ GROUP BY t2.v ORDER BY t1.pk,t2.v;
+SELECT t2.v FROM t1, t2, t3
+WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
+ GROUP BY t2.v ORDER BY t1.pk,t2.v;
+
SET SESSION join_cache_level=6;
EXPLAIN
SELECT t2.v FROM t1, t2, t3
@@ -2514,6 +2526,17 @@ SELECT t2.v FROM t1, t2, t3
WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;
+# MDEV-8189 field<>const and const<>field are not symmetric
+# Do the same EXPLAIN and SELECT
+# for "t2.v <> t3.v" instead of "t3.v <> t2.v"
+EXPLAIN
+SELECT t2.v FROM t1, t2, t3
+WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
+ GROUP BY t2.v ORDER BY t1.pk,t2.v;
+SELECT t2.v FROM t1, t2, t3
+WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
+ GROUP BY t2.v ORDER BY t1.pk,t2.v;
+
SET SESSION join_cache_level=4;
EXPLAIN
SELECT t2.v FROM t1, t2, t3
@@ -2523,6 +2546,17 @@ SELECT t2.v FROM t1, t2, t3
WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;
+# MDEV-8189 field<>const and const<>field are not symmetric
+# Do the same EXPLAIN and SELECT
+# for "t2.v <> t3.v" instead of "t3.v <> t2.v"
+EXPLAIN
+SELECT t2.v FROM t1, t2, t3
+WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
+ GROUP BY t2.v ORDER BY t1.pk,t2.v;
+SELECT t2.v FROM t1, t2, t3
+WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
+ GROUP BY t2.v ORDER BY t1.pk,t2.v;
+
DROP TABLE t1,t2,t3;
SET SESSION join_cache_level=DEFAULT;
diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test
index 6e97f3bbc33..aaf931a2e7f 100644
--- a/mysql-test/t/kill.test
+++ b/mysql-test/t/kill.test
@@ -10,6 +10,8 @@
-- source include/not_embedded.inc
-- source include/have_debug_sync.inc
-- source include/not_threadpool.inc
+set local sql_mode="";
+set global sql_mode="";
--disable_warnings
SET DEBUG_SYNC = 'RESET';
@@ -647,5 +649,33 @@ reap;
--error ER_NO_SUCH_QUERY
KILL QUERY ID 0;
+--echo #
+--echo # MDEV-5096 - Wrong error message on attempt to kill somebody else's
+--echo # query ID
+--echo #
+CREATE USER u1@localhost;
+send SELECT SLEEP(1000);
+
+connection con1;
+let $wait_condition= SELECT @id:=QUERY_ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO='SELECT SLEEP(1000)';
+source include/wait_condition.inc;
+let $id= `SELECT @id`;
+
+connect(con5, localhost, u1,,);
+--replace_result $id ID
+--error ER_KILL_QUERY_DENIED_ERROR
+eval KILL QUERY ID $id;
+
+connection con1;
+KILL QUERY ID @id;
+
+connection default;
+reap;
+disconnect con5;
+DROP USER u1@localhost;
+
+
SET DEBUG_SYNC = 'RESET';
DROP FUNCTION MY_KILL;
+
+set global sql_mode=default;
diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test
index 753b6bd6379..efd0fe5d630 100644
--- a/mysql-test/t/lock_multi.test
+++ b/mysql-test/t/lock_multi.test
@@ -324,9 +324,11 @@ DROP DATABASE mysqltest_1;
#
connection locker;
# Disable warnings to allow test to run also without InnoDB
+set sql_mode="";
--disable_warnings
create table t1 (f1 int(12) unsigned not null auto_increment, primary key(f1)) engine=innodb;
--enable_warnings
+set sql_mode=default;
lock tables t1 write;
connection writer;
send
diff --git a/mysql-test/t/log_tables.test b/mysql-test/t/log_tables.test
index 28f6e6dd829..a4158ba6a24 100644
--- a/mysql-test/t/log_tables.test
+++ b/mysql-test/t/log_tables.test
@@ -6,6 +6,7 @@
# check that CSV engine was compiled in
--source include/have_csv.inc
+SET SQL_MODE="";
SET @old_general_log_state = @@global.general_log;
SET @old_log_output= @@global.log_output;
SET @old_slow_query_log= @@global.slow_query_log;
diff --git a/mysql-test/t/lowercase_fs_off.test b/mysql-test/t/lowercase_fs_off.test
index 1be0351f9bc..cb5cd711c7f 100644
--- a/mysql-test/t/lowercase_fs_off.test
+++ b/mysql-test/t/lowercase_fs_off.test
@@ -5,6 +5,8 @@
-- source include/have_case_sensitive_file_system.inc
-- source include/not_embedded.inc
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
connect (master,localhost,root,,);
connection master;
create database d1;
@@ -102,3 +104,5 @@ CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a= 1;
RENAME TABLE t1 TO T1;
ALTER TABLE T1 RENAME t1;
DROP TABLE t1;
+
+set GLOBAL sql_mode=default;
diff --git a/mysql-test/t/lowercase_table_grant.test b/mysql-test/t/lowercase_table_grant.test
index 7449231fca5..2f98f570e29 100644
--- a/mysql-test/t/lowercase_table_grant.test
+++ b/mysql-test/t/lowercase_table_grant.test
@@ -3,6 +3,7 @@
# Test of grants when lower_case_table_names is on
use mysql;
+set sql_mode="";
# mixed-case database name for testing
create database MYSQLtest;
diff --git a/mysql-test/t/lowercase_table_qcache.test b/mysql-test/t/lowercase_table_qcache.test
index e63ad3b2c16..ab05755bec1 100644
--- a/mysql-test/t/lowercase_table_qcache.test
+++ b/mysql-test/t/lowercase_table_qcache.test
@@ -3,6 +3,8 @@
# Test of query cache with --lower-case-table-names
#
set GLOBAL query_cache_size=1355776;
+set GLOBAL query_cache_type=ON;
+set LOCAL query_cache_type=ON;
--disable_warnings
drop database if exists MySQLtesT;
@@ -26,6 +28,7 @@ select * from MySQL.db;
enable_result_log;
show status like "Qcache_queries_in_cache";
-set GLOBAL query_cache_size=0;
+set GLOBAL query_cache_size=default;
+set GLOBAL query_cache_type=default;
# End of 4.1 tests
diff --git a/mysql-test/t/max_statement_time.test b/mysql-test/t/max_statement_time.test
index d994f04be83..0882daff139 100644
--- a/mysql-test/t/max_statement_time.test
+++ b/mysql-test/t/max_statement_time.test
@@ -1,9 +1,11 @@
#
# Test behavior of MAX_STATEMENT_TIME.
+# We can't do this under valgrind as valgrind interferes with thread scheduling
#
--source include/not_embedded.inc
--source include/have_innodb.inc
+--source include/not_valgrind.inc
--echo
--echo # Test the MAX_STATEMENT_TIME option.
@@ -77,6 +79,7 @@ DROP TABLE t1;
--echo # MAX_STATEMENT_TIME account resource
--echo
+set statement sql_mode="" for
GRANT USAGE ON *.* TO user1@localhost WITH MAX_STATEMENT_TIME 1.005;
--echo # con1
@@ -201,17 +204,20 @@ create procedure pr()
select 1;
select sql_no_cache * from t1 where i > 5;
select sql_no_cache * from t1 where i > 5;
+ select sleep(2);
end |
delimiter ;|
set max_statement_time = 0.001;
--error ER_STATEMENT_TIMEOUT
call pr();
+set max_statement_time = 0;
drop procedure pr;
delimiter |;
create procedure pr()
begin
select sql_no_cache * from t1 where i > 5;
select sql_no_cache * from t1 where i > 5;
+ select sleep(2);
end |
delimiter ;|
set max_statement_time = 0.001;
diff --git a/mysql-test/t/mdev-504.test b/mysql-test/t/mdev-504.test
index bc38e99067a..fb5c7666d33 100644
--- a/mysql-test/t/mdev-504.test
+++ b/mysql-test/t/mdev-504.test
@@ -1,5 +1,7 @@
--disable_ps_protocol
+SET GLOBAL net_write_timeout = 900;
+
CREATE TABLE A (
pk INTEGER AUTO_INCREMENT PRIMARY KEY,
fdate DATE
@@ -74,4 +76,4 @@ DROP TABLE A;
DROP PROCEDURE p_analyze;
DROP FUNCTION rnd3;
SET GLOBAL use_stat_tables = DEFAULT;
-
+SET GLOBAL net_write_timeout = DEFAULT;
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index 2697e3b9a5f..5bfe22697dd 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -1895,13 +1895,14 @@ DROP TABLE t1;
--disable_warnings
drop table if exists t_parent;
--enable_warnings
-set @save_table_definition_cache=@@global.table_definition_cache;
+set @save_table_open_cache=@@global.table_open_cache;
--echo #
---echo # Set @@global.table_definition_cache to minimum
+--echo # Set @@global.table_open_cache to minimum
--echo #
-set @@global.table_definition_cache=400;
+set @@global.table_open_cache=400;
+select @@table_open_cache;
set @a=null;
-let $1 = 400;
+let $1 = `select @@table_open_cache;`;
--echo #
--echo # Create 400 merge children
--echo #
@@ -1935,7 +1936,7 @@ deallocate prepare stmt;
--echo #
--echo # Cleanup
--echo #
-let $1 = 400;
+let $1 = `select @@table_open_cache;`;
--disable_query_log
while ($1)
{
@@ -1944,7 +1945,7 @@ while ($1)
}
--enable_query_log
drop table t_parent;
-set @@global.table_definition_cache=@save_table_definition_cache;
+set @@global.table_open_cache=@save_table_open_cache;
#
# WL#4144 - Lock MERGE engine children
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index c013938416e..8c620ed2ce4 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -378,6 +378,7 @@ create database mysqltest;
create table mysqltest.t1 (a int, b int, primary key (a));
create table mysqltest.t2 (a int, b int, primary key (a));
create table mysqltest.t3 (a int, b int, primary key (a));
+create user mysqltest_1@localhost;
grant select on mysqltest.* to mysqltest_1@localhost;
grant update on mysqltest.t1 to mysqltest_1@localhost;
connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
diff --git a/mysql-test/t/myisam-optimize.test b/mysql-test/t/myisam-optimize.test
new file mode 100644
index 00000000000..7c1fe4ec1c8
--- /dev/null
+++ b/mysql-test/t/myisam-optimize.test
@@ -0,0 +1,58 @@
+--echo #
+--echo # MDEV-8475 stale .TMM file causes Aria engine to stop serving the table
+--echo #
+create table t1 (pk int primary key, i int) engine=MyISAM;
+insert into t1 values (1,1),(2,2);
+--let $datadir=`SELECT @@datadir`
+
+--write_file $datadir/test/t1.TMM
+EOF
+
+--connect (con1,localhost,root,,)
+SHOW CREATE TABLE t1;
+OPTIMIZE TABLE t1;
+--disconnect con1
+
+--connect (con1,localhost,root,,)
+SHOW CREATE TABLE t1;
+OPTIMIZE TABLE t1;
+--disconnect con1
+
+--connect (con1,localhost,root,,)
+SHOW CREATE TABLE t1;
+OPTIMIZE TABLE t1;
+--disconnect con1
+
+# Cleanup
+--connection default
+DROP TABLE t1;
+
+#
+# Test also Aria
+#
+
+create table t1 (pk int primary key, i int) engine=aria;
+insert into t1 values (1,1),(2,2);
+--let $datadir=`SELECT @@datadir`
+
+--write_file $datadir/test/t1.TMM
+EOF
+
+--connect (con1,localhost,root,,)
+SHOW CREATE TABLE t1;
+OPTIMIZE TABLE t1;
+--disconnect con1
+
+--connect (con1,localhost,root,,)
+SHOW CREATE TABLE t1;
+OPTIMIZE TABLE t1;
+--disconnect con1
+
+--connect (con1,localhost,root,,)
+SHOW CREATE TABLE t1;
+OPTIMIZE TABLE t1;
+--disconnect con1
+
+# Cleanup
+--connection default
+DROP TABLE t1;
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index 6c9371eed25..9ac49a9063d 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -1751,6 +1751,16 @@ CHECK TABLE t1;
DROP TABLE t1;
+--echo #
+--echo # MDEV-3870 - Valgrind warnings on OPTIMIZE MyISAM or Aria TABLE with
+--echo # disabled keys
+--echo #
+CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4),(3),(1),(0);
+ALTER TABLE t1 DISABLE KEYS;
+OPTIMIZE TABLE t1;
+DROP TABLE t1;
+
#
# Check some variables
#
diff --git a/mysql-test/t/merge_recover-master.opt b/mysql-test/t/myisam_recover-master.opt
index fca5ea079e3..fca5ea079e3 100644
--- a/mysql-test/t/merge_recover-master.opt
+++ b/mysql-test/t/myisam_recover-master.opt
diff --git a/mysql-test/t/merge_recover.test b/mysql-test/t/myisam_recover.test
index f2cb204eeb6..49fe9c33460 100644
--- a/mysql-test/t/merge_recover.test
+++ b/mysql-test/t/myisam_recover.test
@@ -1,5 +1,9 @@
+--source include/count_sessions.inc
+
+--echo #
+--echo # Tests for corrupted MyISAM tables and MyISAMMRG tables with corrupted
+--echo # children..
--echo #
---echo # Test of MyISAM MRG tables with corrupted children.
--echo # Run with --myisam-recover=force option.
--echo #
--echo # Preparation: we need to make sure that the merge parent
@@ -57,10 +61,10 @@ eval $lock;
--echo #
connection default;
--echo #
---echo # We have to disable the ps-protocol, to avoid
+--echo # We have to disable the ps-protocol, to avoid
--echo # "Prepared statement needs to be re-prepared" errors
--echo # -- table def versions change all the time with full table cache.
---echo #
+--echo #
--disable_ps_protocol
--disable_warnings
drop table if exists t1, t1_mrg, t1_copy;
@@ -69,12 +73,12 @@ let $MYSQLD_DATADIR=`select @@datadir`;
--echo #
--echo # Prepare a MERGE engine table, that refers to a corrupted
--echo # child.
---echo #
+--echo #
create table t1 (a int, key(a)) engine=myisam;
create table t1_mrg (a int) union (t1) engine=merge;
--echo #
--echo # Create a table with a corrupted index file:
---echo # save an old index file, insert more rows,
+--echo # save an old index file, insert more rows,
--echo # overwrite the new index file with the old one.
--echo #
insert into t1 (a) values (1), (2), (3);
@@ -111,3 +115,66 @@ set @@global.table_open_cache=default;
disconnect con1;
connection default;
--enable_ps_protocol
+
+--echo #
+--echo # 18075170 - sql node restart required to avoid deadlock after
+--echo # restore
+--echo #
+--echo # Check that auto-repair for MyISAM tables can now happen in the
+--echo # middle of transaction, without aborting it.
+--enable_prepare_warnings
+
+connection default;
+
+create table t1 (a int, key(a)) engine=myisam;
+create table t2 (a int);
+insert into t2 values (1);
+
+--echo # Create a table with a corrupted index file:
+--echo # save an old index file, insert more rows,
+--echo # overwrite the new index file with the old one.
+insert into t1 (a) values (1);
+flush table t1;
+--copy_file $MYSQLD_DATADIR/test/t1.MYI $MYSQLD_DATADIR/test/t1_copy.MYI
+insert into t1 (a) values (4);
+flush table t1;
+--remove_file $MYSQLD_DATADIR/test/t1.MYI
+--copy_file $MYSQLD_DATADIR/test/t1_copy.MYI $MYSQLD_DATADIR/test/t1.MYI
+--remove_file $MYSQLD_DATADIR/test/t1_copy.MYI
+
+--echo # Check table is needed to mark the table as crashed.
+check table t1;
+
+--echo # At this point we have a corrupt t1
+set autocommit = 0;
+select * from t2;
+--echo # Without fix select from t1 will break the transaction. After the fix
+--echo # transaction should be active and should hold lock on table t2. Alter
+--echo # table from con2 will wait only if the transaction is not broken.
+--replace_regex /'.*[\/\\]/'/
+select * from t1;
+
+connect(con2, localhost, root);
+--SEND ALTER TABLE t2 ADD val INT
+
+connection default;
+--echo # With fix we should have alter table waiting for t2 lock here.
+let $wait_condition=
+ SELECT count(*) = 1 FROM information_schema.processlist WHERE state
+ LIKE "Waiting%" AND info = "ALTER TABLE t2 ADD val INT";
+
+--source include/wait_condition.inc
+ROLLBACK;
+SET autocommit = 1;
+
+connection con2;
+--REAP
+
+connection default;
+disconnect con2;
+
+--echo # Cleanup
+drop table t1, t2;
+
+# Wait till all disconnects are completed
+-- source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index c328ab19ffd..f1813dd0ca4 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -4,6 +4,8 @@
#
# Testing the MySQL command line client(mysql)
#
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
--disable_warnings
drop table if exists t1,t2,t3;
@@ -632,5 +634,6 @@ EOF
--exec $MYSQL --default-character-set=utf8 < $MYSQLTEST_VARDIR/tmp/mdev-6572.sql 2>&1
--remove_file $MYSQLTEST_VARDIR/tmp/mdev-6572.sql
+set GLOBAL sql_mode=default;
--echo
--echo End of tests
diff --git a/mysql-test/t/mysql_comments.test b/mysql-test/t/mysql_comments.test
index 1f997aeb1ab..7b00f17e259 100644
--- a/mysql-test/t/mysql_comments.test
+++ b/mysql-test/t/mysql_comments.test
@@ -10,6 +10,8 @@
# #
########################################################################
+set global sql_mode="";
+
#
# Bug #11230: Keeping comments when storing stored procedures
#
@@ -34,4 +36,6 @@ drop trigger if exists t1_bi;
--echo "Pass 2 : --enable-comments"
--exec $MYSQL --enable-comments test 2>&1 < "./t/mysql_comments.sql"
+
+set global sql_mode=default;
--echo End of 5.0 tests
diff --git a/mysql-test/t/mysql_tzinfo_to_sql_symlink.test b/mysql-test/t/mysql_tzinfo_to_sql_symlink.test
index 1ba4e91be3c..8ca82b87e30 100644
--- a/mysql-test/t/mysql_tzinfo_to_sql_symlink.test
+++ b/mysql-test/t/mysql_tzinfo_to_sql_symlink.test
@@ -37,3 +37,14 @@
#
--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo
+
+--echo #
+--echo # MDEV-6236 - [PATCH] mysql_tzinfo_to_sql may produce invalid SQL
+--echo #
+--exec mkdir $MYSQLTEST_VARDIR/zoneinfo
+--copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/Factory
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>&1
+
+--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo
diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test
index 8c641428353..0c20ffc36ce 100644
--- a/mysql-test/t/mysql_upgrade.test
+++ b/mysql-test/t/mysql_upgrade.test
@@ -2,6 +2,8 @@
-- source include/have_working_dns.inc
-- source include/have_innodb.inc
+set sql_mode="";
+
#
# Basic test that we can run mysql_upgrde and that it finds the
# expected binaries it uses.
@@ -15,7 +17,6 @@ file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
--echo Run it again - should say already completed
--replace_result $MYSQL_SERVER_VERSION VERSION
---error 1
--exec $MYSQL_UPGRADE 2>&1
# It should have created a file in the MySQL Servers datadir
@@ -159,4 +160,28 @@ SELECT grantor FROM mysql.tables_priv WHERE db = 'mysql' AND table_name = 'user'
DROP USER very_long_user_name_number_1, very_long_user_name_number_2, even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@localhost;
DROP PROCEDURE test.pr;
+set sql_mode=default;
+
+#
+# Enforce storage engine option should not effect mysql_upgrade
+#
+--echo # Droping the previously created mysql_upgrade_info file..
+--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
+
+create table test.t1(a int) engine=MyISAM;
+--echo # Trying to enforce InnoDB for all tables
+SET GLOBAL enforce_storage_engine=InnoDB;
+
+--replace_result $MYSQLTEST_VARDIR var
+--exec $MYSQL_UPGRADE --force 2>&1
+
+--echo # Should return 2
+SELECT count(*) FROM information_schema.tables where ENGINE="InnoDB";
+SHOW CREATE TABLE test.t1;
+DROP TABLE test.t1;
+# mysql_upgrade must have created mysql_upgrade_info file,
+# so the following command should never fail.
+--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
+SET GLOBAL enforce_storage_engine=NULL;
+
--echo End of tests
diff --git a/mysql-test/t/mysql_upgrade_view.test b/mysql-test/t/mysql_upgrade_view.test
index e222afa89fe..49a90264f11 100644
--- a/mysql-test/t/mysql_upgrade_view.test
+++ b/mysql-test/t/mysql_upgrade_view.test
@@ -8,6 +8,35 @@ drop view if exists t1,v1,v2,v3,v4,v1badcheck;
create table t1(a int);
create table kv(k varchar(30) NOT NULL PRIMARY KEY,v varchar(50));
+create view v1 as select 1;
+
+repair table t1 quick;
+repair table t1 extended;
+repair table t1 use_frm;
+--error ER_PARSE_ERROR
+repair table t1 from mysql;
+
+--error ER_PARSE_ERROR
+repair view v1 quick;
+--error ER_PARSE_ERROR
+repair view v1 extended;
+--error ER_PARSE_ERROR
+repair view v1 use_frm;
+repair view v1 from mysql;
+
+--error ER_PARSE_ERROR
+check view v1 quick;
+--error ER_PARSE_ERROR
+check view v1 fast;
+--error ER_PARSE_ERROR
+check view v1 medium;
+--error ER_PARSE_ERROR
+check view v1 extended;
+--error ER_PARSE_ERROR
+check view v1 changed;
+check view v1 for upgrade;
+
+drop view v1;
let $MYSQLD_DATADIR= `select @@datadir`;
diff --git a/mysql-test/t/mysqlbinlog-innodb.test b/mysql-test/t/mysqlbinlog-innodb.test
index 49702e8db38..c8bf8095705 100644
--- a/mysql-test/t/mysqlbinlog-innodb.test
+++ b/mysql-test/t/mysqlbinlog-innodb.test
@@ -1,7 +1,6 @@
-- source include/have_binlog_format_statement.inc
-- source include/have_log_bin.inc
-- source include/have_innodb.inc
-
#
# MBug#702303: Spurious `use` statements in output from mysqlbinlog --rewrite-db="a->b"
#
diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test
index e2733089f18..6cd0265f89a 100644
--- a/mysql-test/t/mysqlcheck.test
+++ b/mysql-test/t/mysqlcheck.test
@@ -8,6 +8,7 @@ call mtr.add_suppression("Invalid .old.. table or database name");
# check that CSV engine was compiled in, as the result of the test
# depends on the presence of the log tables (which are CSV-based).
--source include/have_csv.inc
+let $MYSQLD_DATADIR= `select @@datadir`;
#
# Clean up after previous tests
@@ -66,7 +67,6 @@ create table t_bug25347 (a int) engine=myisam;
create view v_bug25347 as select * from t_bug25347;
insert into t_bug25347 values (1),(2),(3);
flush tables;
-let $MYSQLD_DATADIR= `select @@datadir`;
--echo removing and creating
--remove_file $MYSQLD_DATADIR/d_bug25347/t_bug25347.MYI
--write_file $MYSQLD_DATADIR/d_bug25347/t_bug25347.MYI
@@ -119,7 +119,6 @@ DROP TABLE t1, t2;
create table t1(a int) engine=myisam;
create view v1 as select * from t1;
show tables;
-let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file $MYSQLD_DATADIR/test/v1.frm $MYSQLD_DATADIR/test/v-1.frm
show tables;
--exec $MYSQL_CHECK --check-upgrade --databases test
@@ -164,24 +163,23 @@ CREATE TABLE `#mysql50#c@d` (a INT) engine=myisam;
CREATE TABLE t1 (a INT) engine=myisam;
# Create 5.0 like triggers
-let $MYSQLTEST_VARDIR= `select @@datadir`;
---write_file $MYSQLTEST_VARDIR/a@b/c@d.TRG
+--write_file $MYSQLD_DATADIR/a@b/c@d.TRG
TYPE=TRIGGERS
triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr1 BEFORE INSERT ON `c@d` FOR EACH ROW SET NEW.a = 10 * NEW.a'
sql_modes=0
definers='root@localhost'
EOF
---write_file $MYSQLTEST_VARDIR/a@b/tr1.TRN
+--write_file $MYSQLD_DATADIR/a@b/tr1.TRN
TYPE=TRIGGERNAME
trigger_table=c@d
EOF
---write_file $MYSQLTEST_VARDIR/a@b/t1.TRG
+--write_file $MYSQLD_DATADIR/a@b/t1.TRG
TYPE=TRIGGERS
triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr2 BEFORE INSERT ON `a@b`.t1 FOR EACH ROW SET NEW.a = 100 * NEW.a'
sql_modes=0
definers='root@localhost'
EOF
---write_file $MYSQLTEST_VARDIR/a@b/tr2.TRN
+--write_file $MYSQLD_DATADIR/a@b/tr2.TRN
TYPE=TRIGGERNAME
trigger_table=t1
EOF
@@ -255,7 +253,6 @@ INSERT INTO bug47205 VALUES ("foobar");
FLUSH TABLE bug47205;
--echo # Replace the FRM with a 5.0 FRM that will require upgrade
-let $MYSQLD_DATADIR= `select @@datadir`;
--remove_file $MYSQLD_DATADIR/test/bug47205.frm
--copy_file std_data/bug47205.frm $MYSQLD_DATADIR/test/bug47205.frm
@@ -279,7 +276,6 @@ CREATE TABLE bug47205(a VARCHAR(20) PRIMARY KEY)
FLUSH TABLE bug47205;
--echo # Replace the FRM with a 5.0 FRM that will require upgrade
-let $MYSQLD_DATADIR= `select @@datadir`;
--remove_file $MYSQLD_DATADIR/test/bug47205.frm
--copy_file std_data/bug47205.frm $MYSQLD_DATADIR/test/bug47205.frm
@@ -322,3 +318,34 @@ CREATE TABLE test.`t.1` (id int);
--exec $MYSQL_CHECK test t.1
drop table test.`t.1`;
+
+#
+# MDEV-8123 mysqlcheck: new --process-views option conflicts with --quick, --extended and such
+#
+create view v1 as select 1;
+--echo mysqlcheck --process-views test
+--exec $MYSQL_CHECK --process-views test
+--echo mysqlcheck --process-views --extended test
+--exec $MYSQL_CHECK --process-views --extended test
+--echo mysqlcheck --process-views --fast test
+--exec $MYSQL_CHECK --process-views --fast test
+--echo mysqlcheck --process-views --quick test
+--exec $MYSQL_CHECK --process-views --quick test
+--echo mysqlcheck --process-views --check-only-changed test
+--exec $MYSQL_CHECK --process-views --check-only-changed test
+--echo mysqlcheck --process-views --medium-check test
+--exec $MYSQL_CHECK --process-views --medium-check test
+--echo mysqlcheck --process-views --check-upgrade test
+--exec $MYSQL_CHECK --process-views --check-upgrade test
+drop view v1;
+
+
+#
+# MDEV-8124 mysqlcheck: --auto-repair runs REPAIR TABLE instead of REPAIR VIEW on views
+#
+create table t1(a int);
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1.frm $MYSQLD_DATADIR/test/v1.frm
+--echo mysqlcheck --process-views --check-upgrade --auto-repair test
+--exec $MYSQL_CHECK --process-views --check-upgrade --auto-repair test
+drop view v1;
+drop table t1;
diff --git a/mysql-test/t/mysqldump-max.test b/mysql-test/t/mysqldump-max.test
index d0a4870ba31..3f73f046959 100644
--- a/mysql-test/t/mysqldump-max.test
+++ b/mysql-test/t/mysqldump-max.test
@@ -1193,12 +1193,16 @@ DROP TABLE t1;
DROP TABLE t2;
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mwl136.sql
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS LIMIT 7,3;
+let $binlog_limit= 7, 3;
+source include/show_binlog_events.inc;
+source include/binlog_start_pos.inc;
+let _BINLOG_START_POS= $binlog_start_pos;
--perl
my $f= "$ENV{MYSQLTEST_VARDIR}/tmp/mwl136.sql";
+my $pos=$ENV{_BINLOG_START_POS} + 691;
open F, '<', $f or die "Failed to open $f: $!\n";
while (<F>) {
+ s/$pos/<pos>/;
print if /CHANGE MASTER TO/;
}
EOF
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 8461ebff412..c3267ad7a40 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -1,5 +1,6 @@
call mtr.add_suppression("@003f.frm' \\(errno: 22\\)");
-
+#select * from mysql.user;
+#checksum table mysql.user;
# Embedded server doesn't support external clients
--source include/not_embedded.inc
@@ -139,7 +140,7 @@ create table t1(a int);
set global sql_mode='ANSI_QUOTES';
--exec $MYSQL_DUMP --comments=0 test
--exec $MYSQL_DUMP --comments=0 --compatible=ansi test
-set global sql_mode='';
+set global sql_mode=default;
drop table t1;
--echo #
@@ -2488,3 +2489,5 @@ drop table t1;
select * from t1;
drop table t1;
--remove_file $MYSQLTEST_VARDIR/tmp/mysqldump-test.out
+#select * from mysql.user;
+#checksum table mysql.user;
diff --git a/mysql-test/t/null.test b/mysql-test/t/null.test
index 65a45b9a21c..5347a961c59 100644
--- a/mysql-test/t/null.test
+++ b/mysql-test/t/null.test
@@ -868,6 +868,47 @@ CREATE TABLE t1 AS SELECT
END AS b;
DROP TABLE t1;
+--echo #
+--echo # MDEV-8785 Wrong results for EXPLAIN EXTENDED...WHERE NULLIF(latin1_col, _utf8'a' COLLATE utf8_bin) IS NOT NULL
+--echo #
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT a, NULLIF(a,_utf8'a' COLLATE utf8_bin) IS NULL FROM t1;
+SELECT CHARSET(NULLIF(a,_utf8'a' COLLATE utf8_bin)) FROM t1;
+EXPLAIN EXTENDED SELECT NULLIF(a,_utf8'a' COLLATE utf8_bin) IS NULL AS expr FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # MDEV-8740 Wrong result for SELECT..WHERE year_field=10 AND NULLIF(year_field,2011.1)='2011'
+--echo #
+CREATE TABLE t1 (a YEAR);
+INSERT INTO t1 VALUES (2010),(2011);
+SELECT a=10 AND NULLIF(a,2011.1)='2011' AS cond FROM t1;
+SELECT * FROM t1 WHERE a=10;
+SELECT * FROM t1 WHERE NULLIF(a,2011.1)='2011';
+SELECT * FROM t1 WHERE a=10 AND NULLIF(a,2011.1)='2011';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE a=10 AND NULLIF(a,2011.1)='2011';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE a=10 AND NULLIF(a,2011.1)=CONCAT('2011',RAND());
+DROP TABLE t1;
+
+
+--echo #
+--echo # MDEV-8754 Wrong result for SELECT..WHERE year_field=2020 AND NULLIF(year_field,2010)='2020'
+--echo #
+CREATE TABLE t1 (a YEAR);
+INSERT INTO t1 VALUES (2010),(2020);
+SELECT * FROM t1 WHERE a=2020;
+SELECT * FROM t1 WHERE NULLIF(a,2010)='2020';
+SELECT * FROM t1 WHERE a=2020 AND NULLIF(a,2010)='2020';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE a=2020 AND NULLIF(a,2010)='2020';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE a=2020 AND NULLIF(a,2010)=CONCAT('2020',RAND());
+DROP TABLE t1;
+
--echo #
--echo # End of 10.1 tests
diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test
index e36f106a5be..8c81bdc9bbb 100644
--- a/mysql-test/t/openssl_1.test
+++ b/mysql-test/t/openssl_1.test
@@ -6,6 +6,8 @@
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
+set local sql_mode="";
+set global sql_mode="";
--disable_warnings
drop table if exists t1;
@@ -263,6 +265,7 @@ disconnect con1;
connection default;
DROP USER bug42158@localhost;
+set global sql_mode=default;
--echo End of 5.1 tests
# Wait till we reached the initial number of concurrent sessions
diff --git a/mysql-test/t/openssl_6975.test b/mysql-test/t/openssl_6975.test
index bc6397c5c28..88fe17d0621 100644
--- a/mysql-test/t/openssl_6975.test
+++ b/mysql-test/t/openssl_6975.test
@@ -7,7 +7,9 @@ source include/have_ssl_communication.inc;
# this is OpenSSL test.
+create user ssl_sslv3@localhost;
grant select on test.* to ssl_sslv3@localhost require cipher "RC4-SHA";
+create user ssl_tls12@localhost;
grant select on test.* to ssl_tls12@localhost require cipher "AES128-SHA256";
let $mysql=$MYSQL --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1;
diff --git a/mysql-test/t/parser.test b/mysql-test/t/parser.test
index f59a5d01cf5..31c6ab92ba8 100644
--- a/mysql-test/t/parser.test
+++ b/mysql-test/t/parser.test
@@ -758,3 +758,10 @@ CREATE TABLE t1 (s VARCHAR(100));
CREATE TRIGGER trigger1 BEFORE INSERT ON t1 FOR EACH ROW
SET default_storage_engine = NEW.INNODB;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-7792 - SQL Parsing Error - UNION AND ORDER BY WITH JOIN
+--echo #
+CREATE TABLE t1(a INT);
+SELECT * FROM t1 JOIN ((SELECT 1 AS b) UNION ALL (SELECT 2 AS b) ORDER BY b DESC) s1 WHERE a=1;
+DROP TABLE t1;
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index 754677e9b37..d3161c9338c 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -2884,3 +2884,17 @@ alter table t1 drop partition if exists p5;
DROP TABLE t1;
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8283 crash in get_mm_leaf with xor on binary col
+--echo #
+CREATE TABLE t1(a BINARY(80)) PARTITION BY KEY(a) PARTITIONS 3;
+SELECT 1 FROM t1 WHERE a XOR 'a';
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/partition_grant.test b/mysql-test/t/partition_grant.test
index cf944e507fd..a5df218bb10 100644
--- a/mysql-test/t/partition_grant.test
+++ b/mysql-test/t/partition_grant.test
@@ -21,6 +21,7 @@ insert into t1 values (1),(2);
# cleanup possible grants for mysqltest_1 left by previous tests
# and ensure consistent results of SHOW GRANTS command below.
--disable_warnings
+create user mysqltest_1@localhost;
grant usage on *.* to mysqltest_1@localhost;
revoke all privileges on *.* from mysqltest_1@localhost;
--enable_warnings
diff --git a/mysql-test/t/partition_hash.test b/mysql-test/t/partition_hash.test
index 5b9aa5707b9..c8f473a0477 100644
--- a/mysql-test/t/partition_hash.test
+++ b/mysql-test/t/partition_hash.test
@@ -135,12 +135,14 @@ drop table t1;
#
# Disable warnings to allow this test case to run without
# the Blackhole storage engine.
+set sql_mode="";
--disable_warnings
CREATE TABLE t1 (s1 int) ENGINE=BLACKHOLE PARTITION BY HASH (s1);
--enable_warnings
--error 0,ER_BINLOG_LOGGING_IMPOSSIBLE
INSERT INTO t1 VALUES (0);
DROP TABLE t1;
+set sql_mode=default;
#
# BUG 18423 Hash partitioning can lose rows in some queries
diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test
index a74e95ab65b..b982ab8d2e8 100644
--- a/mysql-test/t/partition_innodb.test
+++ b/mysql-test/t/partition_innodb.test
@@ -1,3 +1,7 @@
+if (`select plugin_auth_version < "5.6.25" from information_schema.plugins where plugin_name='innodb'`)
+{
+ --skip Not fixed in InnoDB as of 5.6.24 or earlier
+}
--source include/not_embedded.inc
--source include/have_partition.inc
--source include/have_innodb.inc
@@ -403,7 +407,7 @@ DROP TABLE t1;
create table t1 (a int) engine=innodb partition by hash(a) ;
# Data_free for InnoDB tablespace varies depending on which
# tests have been run before this one
---replace_column 10 #
+--replace_column 10 # 12 #
show table status like 't1';
drop table t1;
@@ -415,12 +419,12 @@ engine = innodb
partition by key (a);
# Data_free for InnoDB tablespace varies depending on which
# tests have been run before this one
---replace_column 10 #
+--replace_column 10 # 12 #
show table status;
insert into t1 values (0), (1), (2), (3);
# Data_free for InnoDB tablespace varies depending on which
# tests have been run before this one
---replace_column 10 #
+--replace_column 10 # 12 #
show table status;
drop table t1;
@@ -429,17 +433,17 @@ engine = innodb
partition by key (a);
# Data_free for InnoDB tablespace varies depending on which
# tests have been run before this one
---replace_column 10 #
+--replace_column 10 # 12 #
show table status;
insert into t1 values (NULL), (NULL), (NULL), (NULL);
# Data_free for InnoDB tablespace varies depending on which
# tests have been run before this one
---replace_column 10 #
+--replace_column 10 # 12 #
show table status;
insert into t1 values (NULL), (NULL), (NULL), (NULL);
# Data_free for InnoDB tablespace varies depending on which
# tests have been run before this one
---replace_column 10 #
+--replace_column 10 # 12 #
show table status;
drop table t1;
@@ -474,6 +478,7 @@ drop table t1;
#
# Bug 20397: Partitions: Crash when using non-existing engine
#
+SET SQL_MODE="";
create table t1 (a int)
engine = x
partition by key (a);
@@ -488,6 +493,7 @@ partition by list (a)
alter table t1 engine = x;
show create table t1;
drop table t1;
+SET SQL_MODE=default;
# BUG#26117: index_merge sort-union over partitioned table crashes
@@ -675,6 +681,18 @@ ALTER TABLE t1 ADD UNIQUE KEY (b);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
+--echo #
+--echo # Bug #17299181 CREATE_TIME AND UPDATE_TIME ARE
+--echo # WRONG FOR PARTITIONED TABLES
+--echo #
+
+CREATE TABLE t1 (a int, PRIMARY KEY (a)) ENGINE=InnoDB
+PARTITION BY HASH (a) PARTITIONS 2;
+
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE
+CREATE_TIME IS NOT NULL AND TABLE_NAME='t1';
+
+DROP TABLE t1;
--echo #
--echo # BUG#12912171 - ASSERTION FAILED: QUICK->HEAD->READ_SET ==
diff --git a/mysql-test/t/partition_myisam.test b/mysql-test/t/partition_myisam.test
index a33b9e19fbf..bce0c6f009c 100644
--- a/mysql-test/t/partition_myisam.test
+++ b/mysql-test/t/partition_myisam.test
@@ -123,7 +123,7 @@ CHECK TABLE t1;
SELECT * FROM t1;
--echo # Note that it is currently impossible to drop a partitioned table
--echo # without the .par file
---error ER_BAD_TABLE_ERROR
+--error ER_GET_ERRNO
DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.frm
--remove_file $MYSQLD_DATADIR/test/t1#P#p0.MYI
diff --git a/mysql-test/t/partition_not_blackhole.test b/mysql-test/t/partition_not_blackhole.test
index 103c441dac4..64d4f3877c8 100644
--- a/mysql-test/t/partition_not_blackhole.test
+++ b/mysql-test/t/partition_not_blackhole.test
@@ -19,7 +19,7 @@ SHOW TABLES;
--replace_result $MYSQLD_DATADIR ./
--error ER_FAILED_READ_FROM_PAR_FILE
SHOW CREATE TABLE t1;
---error ER_BAD_TABLE_ERROR
+--error ER_GET_ERRNO
DROP TABLE t1;
--list_files $MYSQLD_DATADIR/test t1*
--remove_file $MYSQLD_DATADIR/test/t1.frm
diff --git a/mysql-test/t/plugin.test b/mysql-test/t/plugin.test
index 0655aff9fc9..68c4d5afd64 100644
--- a/mysql-test/t/plugin.test
+++ b/mysql-test/t/plugin.test
@@ -1,12 +1,12 @@
--source include/not_windows_embedded.inc
--source include/have_example_plugin.inc
+--error ER_UNKNOWN_STORAGE_ENGINE
CREATE TABLE t1(a int) ENGINE=EXAMPLE;
-DROP TABLE t1;
INSTALL PLUGIN example SONAME 'ha_example';
--replace_regex /\.dll/.so/
---error 1125
+--error ER_PLUGIN_INSTALLED
INSTALL PLUGIN EXAMPLE SONAME 'ha_example';
UNINSTALL PLUGIN example;
@@ -252,3 +252,16 @@ select plugin_name from information_schema.plugins where plugin_library like 'ha
uninstall soname 'ha_example';
select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
+
+--echo #
+--echo # MDEV-5309 - RENAME TABLE does not check for existence of the table's
+--echo # engine
+--echo #
+INSTALL PLUGIN example SONAME 'ha_example';
+CREATE TABLE t1(a INT) ENGINE=EXAMPLE;
+SELECT * FROM t1;
+FLUSH TABLES;
+UNINSTALL PLUGIN example;
+--error ER_NO_SUCH_TABLE
+RENAME TABLE t1 TO t2;
+DROP TABLE t1;
diff --git a/mysql-test/t/plugin_auth.test b/mysql-test/t/plugin_auth.test
index 5e620654e0a..c5d96e0d612 100644
--- a/mysql-test/t/plugin_auth.test
+++ b/mysql-test/t/plugin_auth.test
@@ -3,6 +3,9 @@
--source include/mysql_upgrade_preparation.inc
--source include/have_innodb.inc
+SET GLOBAL SQL_MODE="";
+SET LOCAL SQL_MODE="";
+
query_vertical SELECT PLUGIN_STATUS, PLUGIN_TYPE, PLUGIN_DESCRIPTION
FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME='test_plugin_server';
@@ -60,7 +63,7 @@ disconnect plug_con_rightp;
--echo ## test no_auto_create_user sql mode with plugin users
SET @@sql_mode=no_auto_create_user;
GRANT INSERT ON TEST.* TO grant_user IDENTIFIED WITH 'test_plugin_server';
-SET @@sql_mode=default;
+SET @@sql_mode="";
DROP USER grant_user;
--echo ## test utf-8 user name
@@ -580,4 +583,5 @@ disconnect bug12818542_con2;
DROP USER bug12818542@localhost;
DROP USER bug12818542_dest@localhost;
+SET GLOBAL SQL_MODE=default;
--echo End of 5.5 tests
diff --git a/mysql-test/t/plugin_auth_qa.test b/mysql-test/t/plugin_auth_qa.test
index 3a3921510e0..fce72a66702 100644
--- a/mysql-test/t/plugin_auth_qa.test
+++ b/mysql-test/t/plugin_auth_qa.test
@@ -3,6 +3,8 @@
--source include/have_plugin_auth.inc
--source include/not_embedded.inc
+set sql_mode="";
+
CREATE DATABASE test_user_db;
--sorted_result
@@ -332,5 +334,6 @@ DROP USER grant_user,plug_dest;
set @@sql_mode= @save_sql_mode;
#
DROP DATABASE test_user_db;
+
--exit
diff --git a/mysql-test/t/plugin_not_embedded.test b/mysql-test/t/plugin_not_embedded.test
index 3e3bd6e86ca..3b4129b6b6b 100644
--- a/mysql-test/t/plugin_not_embedded.test
+++ b/mysql-test/t/plugin_not_embedded.test
@@ -5,6 +5,7 @@
--echo # Bug#51770: UNINSTALL PLUGIN requires no privileges
--echo #
+CREATE USER bug51770@localhost;
GRANT INSERT ON mysql.plugin TO bug51770@localhost;
connect(con1,localhost,bug51770,,);
--replace_regex /\.dll/.so/
@@ -29,4 +30,3 @@ let $path = `select CONCAT_WS('/', '..', '$HA_EXAMPLE_SO')`;
--replace_regex /\.dll/.so/
--error ER_UDF_NO_PATHS
eval INSTALL PLUGIN example SONAME '$path';
-
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 84c9874260a..96dd88f5eb6 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -1,5 +1,6 @@
-- source include/not_embedded.inc
-- source include/have_log_bin.inc
+
call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
#
# SQL Syntax for Prepared Statements test
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index 387dcd205bd..a97b0b1c815 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -4,7 +4,16 @@
#
# Tests with query cache
#
+SET GLOBAL query_cache_type= Off;
+SET LOCAL query_cache_type= Off;
+SET LOCAL query_cache_type= 0;
+--error ER_QUERY_CACHE_IS_GLOBALY_DISABLED
+SET LOCAL query_cache_type= on;
+--error ER_QUERY_CACHE_IS_GLOBALY_DISABLED
+SET LOCAL query_cache_type= 1;
set GLOBAL query_cache_size=1355776;
+SET GLOBAL query_cache_type= ON;
+SET LOCAL query_cache_type= ON;
# Reset query cache variables.
@@ -1204,9 +1213,8 @@ set global query_cache_size=102400;
set global query_cache_size=0;
set global query_cache_type=0;
show status like 'Qcache_free_blocks';
-
---error ER_QUERY_CACHE_DISABLED
set global query_cache_size=102400;
+show status like 'Qcache_free_blocks';
set global query_cache_type=on;
set session query_cache_type=on;
@@ -1260,6 +1268,8 @@ set GLOBAL query_cache_limit=default;
set GLOBAL query_cache_min_res_unit=default;
set GLOBAL query_cache_size=default;
set local query_cache_type=default;
+set GLOBAL query_cache_type=on;
+set local query_cache_type=on;
#
# Bug#33756 - query cache with concurrent_insert=0 appears broken
diff --git a/mysql-test/t/query_cache_debug.test b/mysql-test/t/query_cache_debug.test
index 854af85f3fb..5eba778cf9e 100644
--- a/mysql-test/t/query_cache_debug.test
+++ b/mysql-test/t/query_cache_debug.test
@@ -3,6 +3,7 @@
--source include/have_debug_sync.inc
--source include/long_test.inc
+set global query_cache_type= ON;
#
# Bug #30887 Server crashes on SET GLOBAL query_cache_size=0
#
diff --git a/mysql-test/t/query_cache_merge.test b/mysql-test/t/query_cache_merge.test
index 189de8e4092..3046c4ecbfe 100644
--- a/mysql-test/t/query_cache_merge.test
+++ b/mysql-test/t/query_cache_merge.test
@@ -1,5 +1,8 @@
# Test query cache with many tables
+SET GLOBAL query_cache_type=ON;
+SET LOCAL query_cache_type=ON;
+
--source include/have_query_cache.inc
let $LIMIT=`SHOW VARIABLES LIKE 'open_files_limit'`;
let $MIN_LIMIT=600;
@@ -102,7 +105,8 @@ while ($c)
dec $c;
}
-SET @@global.query_cache_size = 0;
+SET @@global.query_cache_size = default;
SET @@global.table_definition_cache = @save_table_definition_cache;
+SET GLOBAL query_cache_type=default;
--echo End of 5.1 tests
diff --git a/mysql-test/t/query_cache_notembedded-master.opt b/mysql-test/t/query_cache_notembedded-master.opt
new file mode 100644
index 00000000000..871d6965726
--- /dev/null
+++ b/mysql-test/t/query_cache_notembedded-master.opt
@@ -0,0 +1 @@
+--query-cache-size=1355776
diff --git a/mysql-test/t/query_cache_notembedded.test b/mysql-test/t/query_cache_notembedded.test
index edb6db43516..dff6c2a139b 100644
--- a/mysql-test/t/query_cache_notembedded.test
+++ b/mysql-test/t/query_cache_notembedded.test
@@ -8,7 +8,12 @@
#
# Tests with query cache
#
-set GLOBAL query_cache_size=1355776;
+set @sql_mode_save=@@global.sql_mode;
+set @query_cache_type_save=@@global.query_cache_type;
+set @query_cache_size_save=@@global.query_cache_size;
+
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
# Reset query cache variables.
@@ -270,7 +275,8 @@ DROP DATABASE bug30269;
disconnect bug30269;
DROP USER 'bug30269'@'localhost';
-set GLOBAL query_cache_type=default;
+set GLOBAL query_cache_type=ON;
+set LOCAL query_cache_type=ON;
set GLOBAL query_cache_limit=default;
set GLOBAL query_cache_min_res_unit=default;
set GLOBAL query_cache_size=default;
@@ -324,3 +330,7 @@ delimiter ;|
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
+SET GLOBAL query_cache_size=@query_cache_size_save;
+SET GLOBAL query_cache_type=@query_cache_type_save;
+set GLOBAL sql_mode=@sql_mode_save;
+
diff --git a/mysql-test/t/query_cache_ps_no_prot.test b/mysql-test/t/query_cache_ps_no_prot.test
index 16533c7194e..4b2bb842e34 100644
--- a/mysql-test/t/query_cache_ps_no_prot.test
+++ b/mysql-test/t/query_cache_ps_no_prot.test
@@ -16,12 +16,7 @@ let collation=utf8_unicode_ci;
--source include/have_collation.inc
# The file with expected results fits only to a run without
-# ps-protocol/sp-protocol/cursor-protocol/view-protocol.
-if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL
- + $VIEW_PROTOCOL > 0`)
-{
- --skip Test requires: ps-protocol/sp-protocol/cursor-protocol/view-protocol disabled
-}
+--source include/no_protocol.inc
# The main testing script
--source include/query_cache_sql_prepare.inc
diff --git a/mysql-test/t/query_cache_with_views.test b/mysql-test/t/query_cache_with_views.test
index 97e37c53aa3..9b03d0e99d0 100644
--- a/mysql-test/t/query_cache_with_views.test
+++ b/mysql-test/t/query_cache_with_views.test
@@ -6,7 +6,8 @@
drop table if exists t1,t2,v1,v2,v3;
drop view if exists t1,t2,v1,v2,v3;
--enable_warnings
-
+set GLOBAL query_cache_type=ON;
+set LOCAL query_cache_type=ON;
set GLOBAL query_cache_size=1355776;
flush status;
create table t1 (a int, b int);
@@ -145,3 +146,4 @@ SET AUTOCOMMIT=DEFAULT;
# Reset default environment.
set GLOBAL query_cache_size=default;
+set GLOBAL query_cache_type=default;
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
index 6249d2b5e4f..9ce050c2da3 100644
--- a/mysql-test/t/range.test
+++ b/mysql-test/t/range.test
@@ -1777,3 +1777,33 @@ explain extended select * from t2 where (b > 25 and b < 15) or c < 44;
explain extended select * from t2 where (b > 25 and b < 15) or (a>55 and a<44);
drop table t1,t2;
+
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8189 field<>const and const<>field are not symmetric
+--echo #
+CREATE TABLE t1 (a INT, b INT, KEY(a));
+INSERT INTO t1 (a) VALUES (10),(10),(10),(10),(10),(10),(10),(10),(10),(10),(70);
+EXPLAIN SELECT * FROM t1 WHERE a<>10;
+EXPLAIN SELECT * FROM t1 WHERE 10<>a;
+SELECT * FROM t1 WHERE a<>10;
+SELECT * FROM t1 WHERE 10<>a;
+DROP TABLE t1;
+
+
+--echo #
+--echo # MDEV-8613 Full table scan for WHERE indexed_varchar_column <=> 'bad-character'
+--echo #
+SET NAMES utf8;
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8, KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('a'),('b'),('c'),('d'),('e');
+EXPLAIN SELECT * FROM t1 WHERE a<=>'😎';
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/range_innodb.test b/mysql-test/t/range_innodb.test
new file mode 100644
index 00000000000..f76794814ef
--- /dev/null
+++ b/mysql-test/t/range_innodb.test
@@ -0,0 +1,47 @@
+--echo #
+--echo # Range optimizer (and related) tests that need InnoDB.
+--echo #
+
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists t0, t1, t2;
+--enable_warnings
+
+--echo #
+--echo # MDEV-6735: Range checked for each record used with key
+--echo #
+
+create table t0(a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+create table t1(a int);
+insert into t1 select A.a + B.a* 10 + C.a * 100 + D.a * 1000
+from t0 A, t0 B, t0 C, t0 D;
+
+create table t2 (
+ a int,
+ b int,
+ filler1 char(100),
+ filler2 char(100),
+ filler3 char(100),
+ filler4 char(100),
+ key(a),
+ key(b)
+) engine=innodb;
+
+insert into t2
+select
+ a,a,
+ repeat('0123456789', 10),
+ repeat('0123456789', 10),
+ repeat('0123456789', 10),
+ repeat('0123456789', 10)
+from t1;
+
+analyze table t2;
+--echo # The following must not use "Range checked for each record":
+explain select * from t0 left join t2 on t2.a <t0.a and t2.b between 50 and 250;
+
+drop table t0,t1,t2;
+
diff --git a/mysql-test/t/read_only.test b/mysql-test/t/read_only.test
index d0f397697d5..3e5d4fc8ce1 100644
--- a/mysql-test/t/read_only.test
+++ b/mysql-test/t/read_only.test
@@ -3,7 +3,6 @@
# should work with embedded server after mysqltest is fixed
--source include/not_embedded.inc
-
set @start_read_only= @@global.read_only;
# Save the initial number of concurrent sessions
@@ -16,6 +15,7 @@ DROP TABLE IF EXISTS t1,t2,t3;
# READ_ONLY does nothing to SUPER users
# so we use a non-SUPER one:
+create user test@localhost;
grant CREATE, SELECT, DROP on *.* to test@localhost;
--echo connect (con1,localhost,test,,test);
@@ -278,6 +278,7 @@ delete from mysql.tables_priv where User like 'mysqltest_%';
delete from mysql.columns_priv where User like 'mysqltest_%';
flush privileges;
+create user `mysqltest_u1`@`%`;
grant all on mysqltest_db2.* to `mysqltest_u1`@`%`;
create database mysqltest_db1;
grant all on mysqltest_db1.* to `mysqltest_u1`@`%`;
@@ -364,4 +365,3 @@ DROP TABLE t1;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
-
diff --git a/mysql-test/t/read_only_innodb.test b/mysql-test/t/read_only_innodb.test
index de237fecbb6..f404ba17579 100644
--- a/mysql-test/t/read_only_innodb.test
+++ b/mysql-test/t/read_only_innodb.test
@@ -13,6 +13,7 @@ DROP TABLE IF EXISTS table_11733 ;
# READ_ONLY does nothing to SUPER users
# so we use a non-SUPER one:
+create user test@localhost;
grant CREATE, SELECT, DROP on *.* to test@localhost;
connect (con1,localhost,test,,test);
@@ -47,6 +48,7 @@ disconnect con1;
# Bug #35732: read-only blocks SELECT statements in InnoDB
#
# Test 1: read only mode
+create user test@localhost;
GRANT CREATE, SELECT, DROP ON *.* TO test@localhost;
connect(con1, localhost, test, , test);
@@ -251,3 +253,4 @@ connection default;
SET GLOBAL READ_ONLY = OFF;
DROP USER bug33669@localhost;
DROP DATABASE db1;
+
diff --git a/mysql-test/t/repair_symlink-5543.test b/mysql-test/t/repair_symlink-5543.test
index bad65a4175a..58cc810b1a9 100644
--- a/mysql-test/t/repair_symlink-5543.test
+++ b/mysql-test/t/repair_symlink-5543.test
@@ -22,5 +22,4 @@ repair table t2;
drop table t2;
--list_files $MYSQL_TMP_DIR foobar5543
---system rm $MYSQL_TMP_DIR/t1.TMD $MYSQL_TMP_DIR/t2.TMD
diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test
index fb49ce23644..9268a3e1086 100644
--- a/mysql-test/t/row.test
+++ b/mysql-test/t/row.test
@@ -285,3 +285,21 @@ SELECT i FROM t1 WHERE ROW(1,2) = (SELECT 1,3 FROM DUAL WHERE 1 = 0);
DROP TABLE t1;
--echo End of 5.1 tests
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8709 Row equality elements do not get propagated
+--echo #
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (10,10),(20,20);
+# Checking that the a>=10 part gets optimized away in both scalar and row notations
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND b=10 AND a>=10;
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a,b)=(10,10) AND a>=10;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/selectivity.test b/mysql-test/t/selectivity.test
index c46ff69295f..92e38604a30 100644
--- a/mysql-test/t/selectivity.test
+++ b/mysql-test/t/selectivity.test
@@ -848,6 +848,7 @@ set optimizer_use_condition_selectivity=1;
explain extended
select * from t1, t2, t1 as t3
where t1.b=t2.c and t2.d=t3.a and t3.b<5 and t1.a < 2000;
+--sorted_result
select * from t1, t2, t1 as t3
where t1.b=t2.c and t2.d=t3.a and t3.b<5 and t1.a < 2000;
@@ -855,6 +856,7 @@ set optimizer_use_condition_selectivity=3;
explain extended
select * from t1, t2, t1 as t3
where t1.b=t2.c and t2.d=t3.a and t3.b<5 and t1.a < 2000;
+--sorted_result
select * from t1, t2, t1 as t3
where t1.b=t2.c and t2.d=t3.a and t3.b<5 and t1.a < 2000;
@@ -946,11 +948,11 @@ drop table t0,t1,t2;
--echo # Bug mdev-7316: a conjunct in WHERE with selectivity == 0
--echo #
-CREATE TABLE t1 (a varchar(16), b int, PRIMARY KEY(a), KEY(b)) ENGINE=INNODB;
+CREATE TABLE t1 (a varchar(16), b int, PRIMARY KEY(a), KEY(b));
INSERT INTO t1 VALUES
('USAChinese',10), ('USAEnglish',20), ('USAFrench',30);
-CREATE TABLE t2 (i int) ENGINE=INNODB;
+CREATE TABLE t2 (i int);
INSERT INTO t2 VALUES
(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(1),(2),(3),(4);
diff --git a/mysql-test/t/servers.test b/mysql-test/t/servers.test
index 37817937ab5..645206c376e 100644
--- a/mysql-test/t/servers.test
+++ b/mysql-test/t/servers.test
@@ -1,4 +1,5 @@
# Generic tests for servers (do not require FEDERATED)
+set sql_mode="";
--echo #
--echo # MDEV-4594 - CREATE SERVER crashes embedded
@@ -21,5 +22,3 @@ DROP SERVER s1;
CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(SOCKET 'bar');
SELECT * FROM mysql.servers;
DROP SERVER s1;
-
-
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index 8a3d9478946..d7bfb3a973e 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -322,8 +322,11 @@ create database mysqltest;
show create database mysqltest;
create table mysqltest.t1(a int);
insert into mysqltest.t1 values(1);
+create user mysqltest_1@localhost;
grant select on `mysqltest`.* to mysqltest_1@localhost;
+create user mysqltest_2@localhost;
grant usage on `mysqltest`.* to mysqltest_2@localhost;
+create user mysqltest_3@localhost;
grant drop on `mysqltest`.* to mysqltest_3@localhost;
connect (con1,localhost,mysqltest_1,,mysqltest);
@@ -990,6 +993,7 @@ create database mysqltest;
show create database mysqltest;
create table mysqltest.t1(a int);
insert into mysqltest.t1 values(1);
+create user mysqltest_4@localhost;
grant select on `mysqltest`.`t1` to mysqltest_4@localhost;
connect (con4,localhost,mysqltest_4,,mysqltest);
connection con4;
diff --git a/mysql-test/t/show_explain.test b/mysql-test/t/show_explain.test
index 83c05d93007..6615ff66737 100644
--- a/mysql-test/t/show_explain.test
+++ b/mysql-test/t/show_explain.test
@@ -753,6 +753,7 @@ drop table t1,t3,t4;
--echo #
--echo # ---------- SHOW EXPLAIN and permissions -----------------
--echo #
+create user test2@localhost;
grant ALL on test.* to test2@localhost;
# Give the user SUPER privilege so it can set debug_dbug variable.
@@ -1201,4 +1202,3 @@ drop table t0,t1,t2;
connection default;
disconnect con1;
set debug_sync='RESET';
-
diff --git a/mysql-test/t/single_delete_update.test b/mysql-test/t/single_delete_update.test
index e3ee13f891c..ec939641ea3 100644
--- a/mysql-test/t/single_delete_update.test
+++ b/mysql-test/t/single_delete_update.test
@@ -452,30 +452,3 @@ SELECT * FROM t2 WHERE c = 10 ORDER BY a DESC, b DESC;
DROP TABLE t1, t2;
-
---echo #
---echo # Bug #53742: UPDATEs have no effect after applying patch for bug 36569
---echo #
-
---disable_warnings
-CREATE TABLE t1 (
- pk INT NOT NULL AUTO_INCREMENT,
- c1_idx CHAR(1) DEFAULT 'y',
- c2 INT,
- PRIMARY KEY (pk),
- INDEX c1_idx (c1_idx)
-) ENGINE=InnoDB;
---enable_warnings
-
-INSERT INTO t1 VALUES (), (), (), ();
-
-SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
-UPDATE t1 SET c2 = 0 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
-SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
-SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC;
-
-DELETE FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
-SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC;
-
-DROP TABLE t1;
-
diff --git a/mysql-test/t/single_delete_update_innodb.test b/mysql-test/t/single_delete_update_innodb.test
new file mode 100644
index 00000000000..7e7817d4dd6
--- /dev/null
+++ b/mysql-test/t/single_delete_update_innodb.test
@@ -0,0 +1,30 @@
+#
+# Single table specific update/delete tests (mysql_update and mysql_delete)
+#
+--source include/have_innodb.inc
+
+
+--echo #
+--echo # Bug #53742: UPDATEs have no effect after applying patch for bug 36569
+--echo #
+
+CREATE TABLE t1 (
+ pk INT NOT NULL AUTO_INCREMENT,
+ c1_idx CHAR(1) DEFAULT 'y',
+ c2 INT,
+ PRIMARY KEY (pk),
+ INDEX c1_idx (c1_idx)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (), (), (), ();
+
+SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
+UPDATE t1 SET c2 = 0 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
+SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
+SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC;
+
+DELETE FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
+SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC;
+
+DROP TABLE t1;
+
diff --git a/mysql-test/t/skip_grants.test b/mysql-test/t/skip_grants.test
index 6f4d23e1e14..2dc64254a9a 100644
--- a/mysql-test/t/skip_grants.test
+++ b/mysql-test/t/skip_grants.test
@@ -132,3 +132,8 @@ select count(*) from information_schema.USER_PRIVILEGES;
select no_such_function(1);
--echo End of 5.1 tests
+
+#
+# MDEV-8280 crash in 'show global status' with --skip-grant-tables
+#
+show global status like 'Acl%';
diff --git a/mysql-test/t/skip_name_resolve.test b/mysql-test/t/skip_name_resolve.test
index a14f3af5cd6..b0c5118f970 100644
--- a/mysql-test/t/skip_name_resolve.test
+++ b/mysql-test/t/skip_name_resolve.test
@@ -5,6 +5,7 @@
--source include/count_sessions.inc
# Bug#8471 IP address with mask fail when skip-name-resolve is on
+CREATE USER mysqltest_1@'127.0.0.1/255.255.255.255';
GRANT ALL ON test.* TO mysqltest_1@'127.0.0.1/255.255.255.255';
SHOW GRANTS FOR mysqltest_1@'127.0.0.1/255.255.255.255';
REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255';
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index c1a21c8ac85..a47fbe7a372 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -2606,7 +2606,7 @@ delimiter |;
CREATE PROCEDURE p1()
BEGIN
DECLARE c INT DEFAULT 0;
- DECLARE CONTINUE HANDLER FOR SQLWARNING SET c = c + 1;
+ DECLARE CONTINUE HANDLER FOR SQLSTATE '22007' SET c = c + 1;
CALL p2();
CALL p3();
CALL p4();
@@ -2641,7 +2641,7 @@ CREATE PROCEDURE p5()
CREATE PROCEDURE P6()
BEGIN
DECLARE c INT DEFAULT 0;
- DECLARE CONTINUE HANDLER FOR SQLWARNING SET c = c + 1;
+ DECLARE CONTINUE HANDLER FOR SQLSTATE '22007' SET c = c + 1;
CALL p5();
SELECT c;
END|
diff --git a/mysql-test/t/sp-group.test b/mysql-test/t/sp-group.test
new file mode 100644
index 00000000000..2083ac97595
--- /dev/null
+++ b/mysql-test/t/sp-group.test
@@ -0,0 +1,187 @@
+--source include/have_innodb.inc
+
+drop table if exists t1;
+drop view if exists view_t1;
+
+#
+# Test case for MDEV 7601, MDEV-7594 and MDEV-7555
+# Server crashes in functions related to stored procedures
+# Server crashes in different ways while executing concurrent
+# flow involving views and non-empty sql_mode with ONLY_FULL_GROUP_BY
+#
+
+SET sql_mode=ONLY_FULL_GROUP_BY;
+
+CREATE TABLE t1 (
+ pk INT,
+ f0 INT, f1 INT, f2 INT, f3 INT, f4 INT,
+ f5 INT, f6 INT, f7 INT, f8 INT, f9 INT,
+ PRIMARY KEY (pk)
+);
+
+CREATE VIEW view_t1 AS SELECT * FROM t1;
+CREATE PROCEDURE s1()
+ SELECT * FROM (
+ INFORMATION_SCHEMA.`INNODB_BUFFER_PAGE_LRU` AS table1
+ LEFT JOIN test.view_t1 AS table2
+ ON ( table2.`f6` = table1.FREE_PAGE_CLOCK)
+ )
+ ORDER BY table1.NUMBER_RECORDS
+ LIMIT 0
+;
+CALL s1;
+CALL s1;
+
+drop table t1;
+drop view view_t1;
+drop procedure s1;
+
+#
+# MDEV-7590
+# Server crashes in st_select_lex_unit::cleanup on executing a trigger
+#
+
+CREATE TABLE A (
+ pk INTEGER AUTO_INCREMENT,
+ col_int_key INTEGER,
+ col_varchar_key VARCHAR(1),
+ PRIMARY KEY (pk)
+) ENGINE=MyISAM;
+CREATE VIEW view_A AS SELECT * FROM A;
+CREATE TABLE C (
+ pk INTEGER AUTO_INCREMENT,
+ col_int_nokey INTEGER,
+ col_int_key INTEGER,
+ col_date_key DATE,
+ col_date_nokey DATE,
+ col_time_key TIME,
+ col_time_nokey TIME,
+ col_datetime_key DATETIME,
+ col_datetime_nokey DATETIME,
+ col_varchar_key VARCHAR(1),
+ col_varchar_nokey VARCHAR(1),
+ PRIMARY KEY (pk)
+) ENGINE=MyISAM;
+CREATE VIEW view_C AS SELECT * FROM C;
+CREATE TABLE AA (
+ pk INTEGER AUTO_INCREMENT,
+ col_int_nokey INTEGER,
+ col_int_key INTEGER,
+ col_date_key DATE,
+ col_date_nokey DATE,
+ col_time_key TIME,
+ col_time_nokey TIME,
+ col_datetime_key DATETIME,
+ col_datetime_nokey DATETIME,
+ col_varchar_key VARCHAR(1),
+ col_varchar_nokey VARCHAR(1),
+ PRIMARY KEY (pk),
+ KEY (col_varchar_key, col_int_key)
+) ENGINE=MyISAM;
+CREATE VIEW view_AA AS SELECT * FROM AA;
+CREATE TABLE BB (
+ pk INTEGER AUTO_INCREMENT,
+ col_int_key INTEGER,
+ col_varchar_key VARCHAR(1),
+ col_varchar_nokey VARCHAR(1),
+ PRIMARY KEY (pk),
+ KEY (col_varchar_key, col_int_key)
+) ENGINE=MyISAM;
+CREATE VIEW view_BB AS SELECT * FROM BB;
+CREATE TABLE DD (
+ pk INTEGER AUTO_INCREMENT,
+ col_int_key INTEGER,
+ col_date_key DATE,
+ col_time_key TIME,
+ col_datetime_key DATETIME,
+ col_varchar_key VARCHAR(1),
+ PRIMARY KEY (pk),
+ KEY (col_varchar_key, col_int_key)
+) ENGINE=MyISAM;
+CREATE VIEW view_DD AS SELECT * FROM DD;
+CREATE TRIGGER k BEFORE INSERT ON `DD` FOR EACH ROW INSERT INTO `view_BB` SELECT * FROM `view_A` LIMIT 0 ;
+CREATE TRIGGER r BEFORE INSERT ON `A` FOR EACH ROW INSERT INTO `view_AA` SELECT * FROM `view_C` LIMIT 0 ;
+--error ER_WRONG_AUTO_KEY
+ALTER TABLE `DD` DROP PRIMARY KEY;
+INSERT INTO `view_A` ( `pk` ) VALUES (NULL);
+--error 0,ER_WRONG_VALUE_COUNT_ON_ROW
+INSERT INTO `DD` ( `pk` ) VALUES (NULL);
+INSERT INTO `A` ( `pk` ) VALUES (NULL);
+--error 0,ER_WRONG_VALUE_COUNT_ON_ROW
+INSERT INTO `view_DD` ( `pk` ) VALUES (NULL);
+
+drop trigger r;
+drop trigger k;
+drop view view_A,view_AA,view_C,view_BB,view_DD;
+drop table A,C,AA,BB,DD;
+
+#
+# MDEV-7581
+# Server crashes in st_select_lex_unit::cleanup after a sequence of statements
+#
+
+CREATE TABLE A (
+ i INT,
+ i1 INT,
+ i2 INT,
+ d1 DATE,
+ d2 DATE,
+ col_time_nokey1 TIME,
+ col_time_nokey2 TIME,
+ col_datetime_nokey1 DATETIME,
+ col_datetime_nokey2 DATETIME,
+ col_varchar_nokey1 VARCHAR(1),
+ col_varchar_nokey2 VARCHAR(1)
+) ENGINE=MyISAM;
+
+CREATE VIEW view_A AS SELECT * FROM A;
+
+CREATE TABLE B (
+ col_varchar_nokey VARCHAR(1)
+) ENGINE=MyISAM;
+
+CREATE TABLE AA (
+ i INT,
+ i1 INT,
+ i2 INT,
+ d1 DATE,
+ d2 DATE,
+ col_time_nokey1 TIME,
+ col_time_nokey2 TIME,
+ col_datetime_nokey1 DATETIME,
+ col_datetime_nokey2 DATETIME,
+ col_varchar_nokey1 VARCHAR(1),
+ col_varchar_nokey2 VARCHAR(1)
+) ENGINE=MyISAM;
+
+CREATE VIEW view_AA AS SELECT * FROM AA;
+
+CREATE TABLE DD (
+ i INT,
+ i1 INT,
+ i2 INT,
+ d1 DATE,
+ d2 DATE,
+ col_time_nokey1 TIME,
+ col_time_nokey2 TIME,
+ col_datetime_nokey1 DATETIME,
+ col_datetime_nokey2 DATETIME,
+ col_varchar_nokey1 VARCHAR(1),
+ col_varchar_nokey2 VARCHAR(1)
+) ENGINE=MyISAM;
+
+CREATE VIEW view_DD AS SELECT * FROM DD;
+
+CREATE TRIGGER tr1 BEFORE INSERT ON `AA` FOR EACH ROW INSERT INTO `view_A` SELECT * FROM `view_AA` LIMIT 0 ;
+CREATE TRIGGER tr2 BEFORE INSERT ON `B` FOR EACH ROW INSERT INTO `D` SELECT * FROM `A` LIMIT 0 ;
+
+INSERT INTO `view_AA` ( `i` ) VALUES (1);
+INSERT INTO `AA` ( `i` ) VALUES (2);
+DELETE FROM `B`;
+INSERT INTO `view_DD` ( `i` ) VALUES (1);
+INSERT INTO `view_AA` ( `i` ) VALUES (3);
+
+drop trigger tr1;
+drop trigger tr2;
+drop view view_A, view_AA,view_DD;
+drop table A,B,AA,DD;
diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test
index 0646e727232..a5df4859d6b 100644
--- a/mysql-test/t/sp-security.test
+++ b/mysql-test/t/sp-security.test
@@ -7,13 +7,13 @@
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
-
connect (con1root,localhost,root,,);
connection con1root;
use test;
# Create user user1 with no particular access rights
+create user user1@localhost;
grant usage on *.* to user1@localhost;
flush privileges;
@@ -57,10 +57,13 @@ call stamp(1);
select * from t1;
select db();
+create user user1@'%';
grant execute on procedure db1_secret.stamp to user1@'%';
grant execute on function db1_secret.db to user1@'%';
+set sql_mode='';
grant execute on procedure db1_secret.stamp to ''@'%';
grant execute on function db1_secret.db to ''@'%';
+set sql_mode=default;
connect (con2user1,localhost,user1,,);
connect (con3anon,localhost,anon,,);
@@ -175,6 +178,7 @@ insert into t2 values (0);
grant usage on db2.* to user1@localhost;
grant select on db2.* to user1@localhost;
+create user user2@localhost;
grant usage on db2.* to user2@localhost;
grant select,insert,update,delete,create routine on db2.* to user2@localhost;
grant create routine on db2.* to user1@localhost;
@@ -263,8 +267,11 @@ flush privileges;
#
# Test the new security acls
#
+create user usera@localhost;
grant usage on *.* to usera@localhost;
+create user userb@localhost;
grant usage on *.* to userb@localhost;
+create user userc@localhost;
grant usage on *.* to userc@localhost;
create database sptest;
create table t1 ( u varchar(64), i int );
@@ -340,11 +347,13 @@ connection root;
--disable_warnings
drop function if exists bug_9503;
+drop user if exists user1@localhost;
--enable_warnings
delimiter //;
create database mysqltest//
use mysqltest//
create table t1 (s1 int)//
+create user user1@localhost//
grant select on t1 to user1@localhost//
create function bug_9503 () returns int sql security invoker begin declare v int;
select min(s1) into v from t1; return v; end//
@@ -420,6 +429,7 @@ begin
end//
delimiter ;//
+create user mysqltest_1@localhost;
grant usage on *.* to mysqltest_1@localhost;
connect (n1,localhost,mysqltest_1,,information_schema,$MASTER_MYPORT,$MASTER_MYSOCK);
@@ -1047,4 +1057,3 @@ grant execute on procedure sp1 to current_user() identified by 'barfoo';
show grants;
drop procedure sp1;
set password='';
-
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 7dda755481c..9e6b919ea19 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -14,7 +14,6 @@
# Tests that require --with-geometry go into sp_gis.test
# Tests that require multibyte character sets, which are not always available,
# go into separate files (e.g. sp-ucs2.test)
-
use test;
# Test tables
@@ -9301,6 +9300,75 @@ DROP TABLE t1;
--echo # End of 5.5 test
+--echo #
+--echo # MDEV-7040: Crash in field_conv, memcpy_field_possible, part#2
+--echo #
+create table t1 (
+ col1 bigint(20),
+ col2 char(1),
+ col3 char(2)
+);
+insert into t1 values (1,'a','a'), (2,'b','b');
+
+create table t2 as select * from t1;
+create table t3 as select * from t1;
+create table t4 as select * from t1;
+create table t5 as select * from t1;
+create table t6 as select * from t1;
+
+flush tables;
+
+DELIMITER |;
+
+CREATE PROCEDURE p1()
+begin
+ DECLARE _var1 bigint(20) UNSIGNED;
+ DECLARE _var2 CHAR(1) DEFAULT NULL;
+ DECLARE _var3 CHAR(1) DEFAULT NULL;
+
+ DECLARE _done BOOLEAN DEFAULT 0;
+
+ declare cur1 cursor for
+ select col1, col2, col3
+ from t1
+ where
+ col1 in (select t2.col1 from t2 where t2.col2=t1.col2) or
+ col2 in (select t3.col3 from t3 where t3.col3=t1.col2) ;
+
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET _done = 1;
+
+ OPEN cur1;
+
+ set _var1 = (select _var1 from t4 limit 1);
+ set _var1 = (select _var1 from t5 limit 1);
+ set _var1 = (select _var1 from t6 limit 1);
+label1:
+ LOOP
+ SET _done = 0;
+ FETCH cur1 INTO _var1, _var2, _var3;
+ IF _done THEN
+ LEAVE label1;
+ END IF;
+ END LOOP label1;
+ CLOSE cur1;
+end|
+DELIMITER ;|
+
+set @tmp_toc= @@table_open_cache;
+set @tmp_tdc= @@table_definition_cache;
+
+set global table_open_cache=1;
+set global table_definition_cache=1;
+call p1();
+
+set global table_open_cache= @tmp_toc;
+set global table_definition_cache= @tmp_tdc;
+drop procedure p1;
+
+drop table t1,t2,t3,t4,t5,t6;
+
+--echo # End of 10.0 test
+
DELIMITER |;
CREATE FUNCTION f(f1 VARCHAR(64) COLLATE latin1_german2_ci)
RETURNS VARCHAR(64)
diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test
index 2a24ab3d005..d7aaaa4340f 100644
--- a/mysql-test/t/sp_notembedded.test
+++ b/mysql-test/t/sp_notembedded.test
@@ -219,6 +219,7 @@ delimiter ;|
drop procedure if exists bug15298_1;
drop procedure if exists bug15298_2;
--enable_warnings
+create user 'mysqltest_1'@'localhost';
grant all privileges on test.* to 'mysqltest_1'@'localhost';
create procedure 15298_1 () sql security definer show grants for current_user;
create procedure 15298_2 () sql security definer show grants;
@@ -486,6 +487,5 @@ drop user foo1@localhost;
#
set @@global.concurrent_insert= @old_concurrent_insert;
-
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/sp_trans.test b/mysql-test/t/sp_trans.test
index 39ac086071b..a9759b99269 100644
--- a/mysql-test/t/sp_trans.test
+++ b/mysql-test/t/sp_trans.test
@@ -5,6 +5,8 @@
-- source include/have_log_bin.inc
-- source include/have_innodb.inc
+set SQL_MODE="";
+
disable_query_log;
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
enable_query_log;
diff --git a/mysql-test/t/ssl_7937.combinations b/mysql-test/t/ssl_7937.combinations
new file mode 100644
index 00000000000..46a45686a9b
--- /dev/null
+++ b/mysql-test/t/ssl_7937.combinations
@@ -0,0 +1,5 @@
+[ssl]
+--loose-enable-ssl
+
+[nossl]
+--loose-disable-ssl
diff --git a/mysql-test/t/ssl_7937.test b/mysql-test/t/ssl_7937.test
new file mode 100644
index 00000000000..d593b9d936d
--- /dev/null
+++ b/mysql-test/t/ssl_7937.test
@@ -0,0 +1,35 @@
+#
+# MDEV-7937: Enforce SSL when --ssl client option is used
+#
+
+source include/have_ssl_crypto_functs.inc;
+
+# create a procedure instead of SHOW STATUS LIKE 'ssl_cipher'
+# because the cipher depends on openssl (or yassl) version,
+# and it's actual value doesn't matter here anyway
+create procedure have_ssl()
+ select if(variable_value > '','yes','no') as 'have_ssl'
+ from information_schema.session_status
+ where variable_name='ssl_cipher';
+
+--disable_abort_on_error
+--echo mysql --ssl-ca=cacert.pem -e "call test.have_ssl()"
+--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem -e "call test.have_ssl()" 2>&1
+--echo mysql --ssl -e "call test.have_ssl()"
+--exec $MYSQL --ssl -e "call test.have_ssl()" 2>&1
+--echo mysql --ssl-ca=cacert.pem --ssl-verify-server-cert -e "call test.have_ssl()"
+--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-verify-server-cert -e "call test.have_ssl()" 2>&1
+
+--echo mysql --ssl --ssl-verify-server-cert -e "call test.have_ssl()"
+# this is the test where certificate verification fails.
+# but yassl doesn't support certificate verification, so
+# we fake the test result for yassl
+let yassl=`select variable_value='Unknown' from information_schema.session_status where variable_name='Ssl_session_cache_mode'`;
+if (!$yassl) {
+ --exec $MYSQL --ssl --ssl-verify-server-cert -e "call test.have_ssl()" 2>&1
+}
+if ($yassl) {
+ --echo ERROR 2026 (HY000): SSL connection error: Failed to verify the server certificate
+}
+
+drop procedure have_ssl;
diff --git a/mysql-test/t/stack-crash.test b/mysql-test/t/stack-crash.test
index d5bdccc132d..e4feb95a332 100644
--- a/mysql-test/t/stack-crash.test
+++ b/mysql-test/t/stack-crash.test
@@ -32,7 +32,7 @@ CREATE TABLE t1 (
`sspo_lu_uid` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`sspo_id`),
KEY `post_uid` (`sspo_uid`,`sspo_cr_date`)
-) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=30 DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES (1,2,'P','test1','',0,'','',NULL,'','','','','A','2013-09-30 00:19:32',2,'2013-09-30 00:19:32',2),(2,2,'P','bbb','',0,'','',NULL,'','','','','A','2013-10-02 15:06:35',2,'2013-10-02 15:06:35',2);
CREATE TABLE `t2` (
@@ -48,7 +48,7 @@ CREATE TABLE `t2` (
`spoo_lu_uid` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`spoo_id`),
KEY `object_option_main_idx` (`spoo_user_type_id`,`spoo_uid`,`spoo_option_id`,`spoo_value`(255))
-) ENGINE=InnoDB AUTO_INCREMENT=107 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=107 DEFAULT CHARSET=utf8;
INSERT INTO `t2` VALUES (19,1,2,6,'Dortmund','A','2013-09-26 01:36:51',2,'2013-09-26 01:36:51',2),(20,1,2,8,'49','A','2013-09-26 01:36:51',2,'2013-09-26 01:36:51',2);
SELECT Count(*)
diff --git a/mysql-test/t/stat_tables_rbr.test b/mysql-test/t/stat_tables_rbr.test
index 4336c02c34b..29f7c4e6622 100644
--- a/mysql-test/t/stat_tables_rbr.test
+++ b/mysql-test/t/stat_tables_rbr.test
@@ -23,8 +23,7 @@ SET use_stat_tables = PREFERABLY;
CREATE TABLE t1 ( a INT ) ENGINE=MyISAM PARTITION BY HASH(a) PARTITIONS 2;
ALTER TABLE t1 ANALYZE PARTITION p1;
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS;
+source include/show_binlog_events.inc;
SET use_stat_tables = DEFAULT;
diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test
index 9395323d32b..32b903c0265 100644
--- a/mysql-test/t/status.test
+++ b/mysql-test/t/status.test
@@ -281,6 +281,7 @@ create database db37908;
--enable_warnings
create table db37908.t1(f1 int);
insert into db37908.t1 values(1);
+create user mysqltest_1@localhost;
grant usage,execute on test.* to mysqltest_1@localhost;
delimiter |;
create procedure proc37908() begin select 1; end |
diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test
index 71b625e0843..b1d36447e00 100644
--- a/mysql-test/t/strict.test
+++ b/mysql-test/t/strict.test
@@ -750,7 +750,7 @@ INSERT INTO t1 VALUES ('-101.55');
INSERT INTO t1 VALUES ('-1010.55');
--error 1264
INSERT INTO t1 VALUES ('-100E+1');
---error 1366
+--error WARN_DATA_TRUNCATED
INSERT INTO t1 VALUES ('-100E');
--error 1264
UPDATE t1 SET col1 =col1 * 50000 WHERE col1 =11;
@@ -764,7 +764,7 @@ INSERT INTO t1 (col1) VALUES ('');
#--error 1265
--error 1366
INSERT INTO t1 (col1) VALUES ('a59b');
---error 1366
+--error WARN_DATA_TRUNCATED
INSERT INTO t1 (col1) VALUES ('1a');
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
INSERT IGNORE INTO t1 values (1/0);
@@ -796,9 +796,9 @@ UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
--error 1365
UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
---error 1265
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
INSERT INTO t1 (col1) VALUES ('');
---error 1265
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
INSERT INTO t1 (col1) VALUES ('a59b');
--error 1265
INSERT INTO t1 (col1) VALUES ('1a');
@@ -830,9 +830,9 @@ UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
--error 1365
UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
---error 1265
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
INSERT INTO t1 (col1) VALUES ('');
---error 1265
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
INSERT INTO t1 (col1) VALUES ('a59b');
--error 1265
INSERT INTO t1 (col1) VALUES ('1a');
diff --git a/mysql-test/t/subselect_cache.test b/mysql-test/t/subselect_cache.test
index 1276e546030..21247541fb6 100644
--- a/mysql-test/t/subselect_cache.test
+++ b/mysql-test/t/subselect_cache.test
@@ -24,6 +24,16 @@ select a, (select d from t2 where b=c) from t1;
show status like "subquery_cache%";
show status like '%Handler_read%';
+--replace_regex /"r_total_time_ms": [0-9]*[.]?[0-9]*/"r_total_time_ms": "REPLACED"/
+analyze format=json
+select a, (select d from t2 where b=c) from t1;
+--replace_regex /"r_total_time_ms": [0-9]*[.]?[0-9]*/"r_total_time_ms": "REPLACED"/
+analyze format=json
+select a, (select d from t2 where b=c), (select d from t2 where b=c union select 1 order by 1 limit 1) from t1;
+explain format=json
+select a, (select d from t2 where b=c) from t1;
+explain format=json
+select a, (select d from t2 where b=c), (select d from t2 where b=c union select 1 order by 1 limit 1) from t1;
set optimizer_switch='subquery_cache=off';
flush status;
diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test
index c989cb22558..c2b93c919dd 100644
--- a/mysql-test/t/subselect_sj.test
+++ b/mysql-test/t/subselect_sj.test
@@ -2524,7 +2524,7 @@ CREATE TABLE t1 (
PRIMARY KEY (pk),
KEY col_int_key (col_int_key),
KEY col_varchar_key (col_varchar_key, col_int_key)
-) ENGINE=InnoDB;
+);
INSERT INTO t1 VALUES
(10,8,'x','x'),
diff --git a/mysql-test/t/subselect_sj2.test b/mysql-test/t/subselect_sj2.test
index 0bf9c6d9d10..5d6639a6d5a 100644
--- a/mysql-test/t/subselect_sj2.test
+++ b/mysql-test/t/subselect_sj2.test
@@ -1222,6 +1222,25 @@ WHERE alias3.d IN (
AND ( alias5.b >= alias3.b OR alias5.c != alias3.c )
);
+# MDEV-8189 field<>const and const<>field are not symmetric
+# Do the same EXPLAIN SELECT and SELECT
+# with "alias3.c != alias5.c" instead of "alias5.c != alias3.c"
+
+EXPLAIN
+SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3
+WHERE alias3.d IN (
+ SELECT alias4.c FROM t2 AS alias4, t2 AS alias5
+ WHERE alias5.b = alias4.b
+ AND ( alias5.b >= alias3.b OR alias3.c != alias5.c )
+);
+
+SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3
+WHERE alias3.d IN (
+ SELECT alias4.c FROM t2 AS alias4, t2 AS alias5
+ WHERE alias5.b = alias4.b
+ AND ( alias5.b >= alias3.b OR alias3.c != alias5.c )
+);
+
set optimizer_prune_level=@tmp_951283;
DROP TABLE t1,t2;
@@ -1391,5 +1410,44 @@ eval explain $query;
drop table t3,t2,t1;
set optimizer_search_depth=@tmp7474;
+--echo #
+--echo #
+--echo #
+CREATE TABLE t1 (
+ id int(16) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE t2 (
+ id int(16) NOT NULL AUTO_INCREMENT,
+ t3_id int(16) NOT NULL DEFAULT '0',
+ t1_id int(16) NOT NULL DEFAULT '0',
+ PRIMARY KEY (id),
+ KEY t3_idx (t3_id),
+ KEY t1_idx (t1_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+CREATE TABLE t3 (
+ id int(16) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+
+INSERT INTO t3 VALUES (1);
+
+INSERT INTO t2 VALUES (1, 1, 1);
+INSERT INTO t2 VALUES (2, 1, 2);
+INSERT INTO t2 VALUES (3, 1, 2);
+INSERT INTO t2 VALUES (4, 1, 1);
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+
+SELECT * FROM t1 WHERE t1.id IN (
+ SELECT t2.t1_id FROM t3 JOIN t2 ON t3.id = t2.t3_id WHERE t3.id = 1
+);
+
+drop table t1,t2,t3;
+
--echo # This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp;
diff --git a/mysql-test/t/subselect_sj_mat.test b/mysql-test/t/subselect_sj_mat.test
index c34c805f90c..d2bafa86028 100644
--- a/mysql-test/t/subselect_sj_mat.test
+++ b/mysql-test/t/subselect_sj_mat.test
@@ -1841,8 +1841,23 @@ drop database mysqltest2;
drop database mysqltest3;
drop database mysqltest4;
---echo # End of 5.5 tests
+--echo #
+--echo # MDEV-7810 Wrong result on execution of a query as a PS
+--echo # (both 1st and further executions)
+
+CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (0),(8);
+
+SELECT a FROM (SELECT DISTINCT * FROM t1) AS sq WHERE a IN (SELECT MIN(t2.a) FROM (t1 AS t2));
+PREPARE stmt FROM "
+SELECT a FROM (SELECT DISTINCT * FROM t1) AS sq WHERE a IN (SELECT MIN(t2.a) FROM (t1 AS t2))
+";
+execute stmt;
+execute stmt;
+
+drop table t1;
+--echo # End of 5.5 tests
--echo #
--echo # MDEV-7220: Materialization strategy is not used for REPLACE ... SELECT
--echo #
@@ -1885,3 +1900,28 @@ select * from t1 where (a,b) in (select max(a),b from t2 group by b);
show status where Variable_name like 'Handler_read%' or Variable_name like 'Handler_%write%';
drop table t0,t1,t2,t3;
+
+--echo #
+--echo # MDEV-7971: Assertion `name != __null' failed in ACL_internal_schema_registry::lookup
+--echo # on 2nd execution os PS with multi-table update
+--echo #
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE TABLE t2 (f2 INT);
+INSERT INTO t2 VALUES (3),(4);
+
+CREATE TABLE t3 (f3 INT);
+INSERT INTO t3 VALUES (5),(6);
+
+PREPARE stmt FROM '
+ UPDATE t1, t2
+ SET f1 = 5
+ WHERE 8 IN ( SELECT MIN(f3) FROM t3 )
+';
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DROP TABLE t1,t2,t3;
+
diff --git a/mysql-test/t/table_elim.test b/mysql-test/t/table_elim.test
index 24f48206013..52857f9169f 100644
--- a/mysql-test/t/table_elim.test
+++ b/mysql-test/t/table_elim.test
@@ -616,7 +616,7 @@ SET optimizer_switch=@save_optimizer_switch;
--echo # (just a testcase)
CREATE TABLE t1 (
PostID int(10) unsigned NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
INSERT INTO t1 (PostID) VALUES (1), (2);
@@ -625,7 +625,7 @@ CREATE TABLE t2 (
EntityID int(10) unsigned NOT NULL,
UserID int(10) unsigned NOT NULL,
UNIQUE KEY EntityID (EntityID,UserID)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
INSERT INTO t2 (EntityID, UserID) VALUES (1, 30), (2, 30);
diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test
index f594f0c6c48..987fbf7e848 100644
--- a/mysql-test/t/temp_table.test
+++ b/mysql-test/t/temp_table.test
@@ -319,3 +319,22 @@ INSERT INTO t3 VALUES (101), (102), (103);
REPAIR TABLE t1, t2, t3;
DROP TABLES t1, t2, t3;
+
+#
+# CREATE TEMPORARY TEMPORARY TABLE
+#
+--error ER_PARSE_ERROR
+create temporary temporary table t1 (a int);
+
+#
+# MDEV-7832 Add status variables to track CREATE TEMPORARY TABLE and DROP TEMPORARY TABLE
+#
+flush status;
+create table t1 (a int);
+create temporary table t2 (a int);
+create temporary table t3 (a int);
+drop table t1;
+drop table t2;
+drop temporary table t3;
+show status like 'com_create%table';
+show status like 'com_drop%table';
diff --git a/mysql-test/t/timezone_grant.test b/mysql-test/t/timezone_grant.test
index 8013f2b04ce..a6dd6be695e 100644
--- a/mysql-test/t/timezone_grant.test
+++ b/mysql-test/t/timezone_grant.test
@@ -24,6 +24,7 @@ flush privileges;
create table t1 (a int, b datetime);
create table t2 (c int, d datetime);
+create user mysqltest_1@localhost;
grant all privileges on test.* to mysqltest_1@localhost;
connect (tzuser, localhost, mysqltest_1,,);
connection tzuser;
@@ -103,6 +104,7 @@ drop table t1, t2;
# Let us rely on that previous tests done proper cleanups
create table t1 (a int, b datetime);
insert into t1 values (1, 20010101000000), (2, 20020101000000);
+create user mysqltest_1@localhost;
grant all privileges on test.* to mysqltest_1@localhost;
connect (tzuser3, localhost, mysqltest_1,,);
create view v1 as select a, convert_tz(b, 'UTC', 'Europe/Moscow') as lb from t1;
diff --git a/mysql-test/t/trigger-compat.test b/mysql-test/t/trigger-compat.test
index 8b360d16b98..c627d1a6040 100644
--- a/mysql-test/t/trigger-compat.test
+++ b/mysql-test/t/trigger-compat.test
@@ -19,7 +19,6 @@
#
# Prepare environment.
#
-
DELETE FROM mysql.user WHERE User LIKE 'mysqltest_%';
DELETE FROM mysql.db WHERE User LIKE 'mysqltest_%';
DELETE FROM mysql.tables_priv WHERE User LIKE 'mysqltest_%';
diff --git a/mysql-test/t/trigger_notembedded.test b/mysql-test/t/trigger_notembedded.test
index b4ce183e114..f0c565be41f 100644
--- a/mysql-test/t/trigger_notembedded.test
+++ b/mysql-test/t/trigger_notembedded.test
@@ -28,7 +28,6 @@
#
# Prepare environment.
#
-
DELETE FROM mysql.user WHERE User LIKE 'mysqltest_%';
DELETE FROM mysql.db WHERE User LIKE 'mysqltest_%';
DELETE FROM mysql.tables_priv WHERE User LIKE 'mysqltest_%';
@@ -1019,6 +1018,7 @@ DROP DATABASE IF EXISTS mysqltest_db1;
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)
diff --git a/mysql-test/t/truncate-stale-6500.test b/mysql-test/t/truncate-stale-6500.test
new file mode 100644
index 00000000000..47dffb1966d
--- /dev/null
+++ b/mysql-test/t/truncate-stale-6500.test
@@ -0,0 +1,32 @@
+--source include/have_innodb.inc
+--source include/have_partition.inc
+
+SET GLOBAL query_cache_size=1024*1024*8;
+CREATE TABLE `test` (
+ `uniqueId` INT NOT NULL,
+ `partitionId` INT NOT NULL,
+ PRIMARY KEY (`uniqueId`,`partitionId`)
+) ENGINE=InnoDB PARTITION BY LIST (partitionId) (
+ PARTITION p01 VALUES IN (1),
+ PARTITION p02 VALUES IN (2)
+);
+
+
+INSERT INTO `test`(`uniqueId`,`partitionId`) VALUES(407237055, 2);
+
+SELECT * FROM `test`;
+
+--echo #Confirms 1 row in partition 'p02'
+SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS FROM information_schema.PARTITIONS where TABLE_NAME = 'test';
+ALTER TABLE `test` TRUNCATE PARTITION `p02`;
+
+--echo #Confirms no more rows in partition 'p02'
+SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS FROM information_schema.PARTITIONS where TABLE_NAME = 'test';
+
+--echo #Before the patch, this returned the previously existing values.
+SELECT * FROM `test`;
+SELECT SQL_CACHE * FROM `test`;
+SELECT SQL_NO_CACHE * FROM `test`;
+
+DROP TABLE test;
+SET GLOBAL query_cache_size=DEFAULT;
diff --git a/mysql-test/t/type_binary.test b/mysql-test/t/type_binary.test
index 4d5a5312472..b583e257aa9 100644
--- a/mysql-test/t/type_binary.test
+++ b/mysql-test/t/type_binary.test
@@ -100,3 +100,29 @@ select hex(f2), hex(f3) from t1;
drop table t1;
--echo End of 5.0 tests
+
+--echo #
+--echo # Start of 10.0 tests
+--echo #
+
+--echo #
+--echo # MDEV-8472 BINARY, VARBINARY and BLOB return different warnings on CAST to DECIMAL
+--echo #
+SET NAMES utf8;
+CREATE TABLE t1 (a BINARY(30));
+INSERT INTO t1 VALUES ('1äÖüß@µ*$');
+SELECT CAST(a AS DECIMAL) FROM t1;
+DROP TABLE t1;
+CREATE TABLE t1 (a VARBINARY(30));
+INSERT INTO t1 VALUES ('1äÖüß@µ*$');
+SELECT CAST(a AS DECIMAL) FROM t1;
+DROP TABLE t1;
+CREATE TABLE t1 (a BLOB);
+INSERT INTO t1 VALUES ('1äÖüß@µ*$');
+SELECT CAST(a AS DECIMAL) FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.0 tests
+--echo #
+
diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test
index 6b8ed128f4b..56036c4c7ba 100644
--- a/mysql-test/t/type_date.test
+++ b/mysql-test/t/type_date.test
@@ -385,3 +385,161 @@ select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
drop table t1;
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+let type=DATE;
+let defval='0000-00-00';
+--source include/type_temporal_zero_default.inc
+
+--echo #
+--echo # MDEV-8722 The patch for MDEV-8688 disabled equal field propagation for temporal column and BETWEEN and IN
+--echo #
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02');
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a BETWEEN '2001-01-01' AND '2001-01-02';
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a IN ('2001-01-01','2001-01-02');
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8699 Wrong result for SELECT..WHERE HEX(date_column)!='323030312D30312D3031' AND date_column='2001-01-01x'
+--echo #
+# Trailing garbage in string literals
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02');
+SELECT * FROM t1 WHERE a='2001-01-01x';
+SELECT * FROM t1 WHERE HEX(a)!='323030312D30312D3031';
+SELECT * FROM t1 WHERE HEX(a)!='323030312D30312D3031' AND a='2001-01-01x';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE HEX(a)!='323030312D30312D3031' AND a='2001-01-01x';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE HEX(a)!=CONCAT('xx',RAND()) AND a='2001-01-01x';
+DROP TABLE t1;
+
+# Leading spaces in string literals
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02');
+SELECT * FROM t1 WHERE LENGTH(a)=11;
+SELECT * FROM t1 WHERE LENGTH(a)=11 AND a=' 2001-01-01';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=11 AND a=' 2001-01-01';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=11+RAND() AND a=' 2001-01-01';
+# This should not propagate
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=11+RAND() AND a=' garbage ';
+DROP TABLE t1;
+
+# Numeric format in string literals
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-01');
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='20010101';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='20010101';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=8+RAND() AND a='20010101';
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-8706 Wrong result for SELECT..WHERE time_column=TIMESTAMP'2015-08-30 00:00:00' AND time_column='00:00:00'
+--echo #
+SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
+
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
+SELECT * FROM t1 WHERE a=TIME'00:00:00';
+SELECT * FROM t1 WHERE LENGTH(a)=10;
+SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'00:00:00';
+DROP TABLE t1;
+
+# Special case: zero TIME part after conversion to DATETIME
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
+SELECT * FROM t1 WHERE a=TIME'24:00:00';
+SELECT * FROM t1 WHERE LENGTH(a)=10;
+SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'24:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'24:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'24:00:00';
+DROP TABLE t1;
+
+--echo # In this example '00:00:00' is not recognized as TIME'00:00:00'
+--echo # and is treated as DATE'0000-00-00'.
+--echo # This may change after MDEV-8322 Distinguish between time and date strings more carefully
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
+SELECT * FROM t1 WHERE a='00:00:00';
+SELECT * FROM t1 WHERE LENGTH(a)=10;
+SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00';
+DROP TABLE t1;
+
+# DATETIME native literal
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
+SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00';
+SELECT * FROM t1 WHERE LENGTH(a)=10;
+SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2015-08-30 00:00:00';
+DROP TABLE t1;
+
+# DATETIME native literal with non-zero time
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
+SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00.1';
+SELECT * FROM t1 WHERE LENGTH(a)=10;
+SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00.1';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00.1';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2015-08-30 00:00:00.1';
+DROP TABLE t1;
+
+# DATETIME-alike string literal
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
+SELECT * FROM t1 WHERE a='2015-08-30 00:00:00';
+SELECT * FROM t1 WHERE LENGTH(a)=10;
+SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='2015-08-30 00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='2015-08-30 00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='2015-08-30 00:00:00';
+DROP TABLE t1;
+
+SET timestamp=DEFAULT;
+
+--echo #
+--echo # MDEV-8795 Equal expression propagation does not work for temporal literals
+--echo #
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02');
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=DATE'2001-01-01' AND COALESCE(a)>=DATE'2001-01-01';
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
index e44b190def0..b417c298837 100644
--- a/mysql-test/t/type_datetime.test
+++ b/mysql-test/t/type_datetime.test
@@ -613,3 +613,56 @@ DROP TABLE t1,t2;
--echo #
--echo # End of 5.5 tests
--echo #
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+let type=DATETIME;
+let defval='0000-00-00 00:00:00';
+--source include/type_temporal_zero_default.inc
+
+--echo #
+--echo # MDEV-8336 The meaning of NO_ZERO_DATE is not clear for DATETIME
+--echo #
+SET sql_mode='NO_ZERO_DATE';
+SELECT TIMESTAMP'0000-00-01 10:20:30';
+SELECT TIMESTAMP'0000-00-00 10:20:30';
+SELECT TIMESTAMP'0000-00-00 00:00:00.000001';
+CREATE TABLE t1 (a DATETIME);
+INSERT INTO t1 VALUES ('0000-00-00 10:20:30');
+SELECT a, LEAST(a,'2001-01-01 10:20:30') FROM t1;
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME(6));
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.000001');
+SELECT a, LEAST(a,'2001-01-01 10:20:30') FROM t1;
+DROP TABLE t1;
+SELECT STR_TO_DATE('0000-00-00 10:20:30','%Y-%m-%d %h:%i:%s');
+SELECT STR_TO_DATE('0000-00-00 00:00:00.000001','%Y-%m-%d %H:%i:%s.%f');
+SET old_mode=zero_date_time_cast;
+SELECT CAST(TIME'10:20:30' AS DATETIME);
+SELECT CAST(TIME'00:00:00.000001' AS DATETIME(6));
+SELECT CAST(CAST('10:20:30' AS TIME) AS DATETIME);
+SELECT CAST(CAST('00:00:00.000001' AS TIME(6)) AS DATETIME(6));
+SELECT CAST(CAST(TIMESTAMP'0000-00-00 10:20:30' AS TIME) AS DATETIME);
+SELECT CAST(CAST(TIMESTAMP'0000-00-00 00:00:00.000001' AS TIME(6)) AS DATETIME(6));
+SET old_mode=DEFAULT;
+SET sql_mode=DEFAULT;
+
+--echo #
+--echo # MDEV-8699 Wrong result for SELECT..WHERE HEX(date_column)!='323030312D30312D3031' AND date_column='2001-01-01x'
+--echo #
+--let $TYPE= DATETIME
+--source include/equal_fields_propagation_datetime.inc
+
+--echo #
+--echo # MDEV-8795 Equal expression propagation does not work for temporal literals
+--echo #
+CREATE TABLE t1 (a DATETIME);
+INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-02 00:00:00');
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=TIMESTAMP'2001-01-01 00:00:00' AND COALESCE(a)>=TIMESTAMP'2001-01-01 00:00:00';
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test
index 1d4ef345747..659e75270ca 100644
--- a/mysql-test/t/type_decimal.test
+++ b/mysql-test/t/type_decimal.test
@@ -583,3 +583,27 @@ JOIN
WHERE CONCAT(t1.col1, CAST(subq.col0 AS DECIMAL));
DROP TABLE t1, t2;
+
+
+--echo #
+--echo # Start of 5.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-8267 Add /*old*/ comment into I_S.COLUMN_TYPE for old DECIMAL
+--echo #
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--copy_file std_data/old_decimal/t1dec102.frm $MYSQLD_DATADIR/test/t1dec102.frm
+--copy_file std_data/old_decimal/t1dec102.MYD $MYSQLD_DATADIR/test/t1dec102.MYD
+--copy_file std_data/old_decimal/t1dec102.MYI $MYSQLD_DATADIR/test/t1dec102.MYI
+
+SHOW CREATE TABLE t1dec102;
+SHOW COLUMNS FROM t1dec102;
+SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1dec102';
+DROP TABLE t1dec102;
+
+--echo #
+--echo # End of 5.5 tests
+--echo #
diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test
index 9ce34c0b55b..314cb237dd3 100644
--- a/mysql-test/t/type_enum.test
+++ b/mysql-test/t/type_enum.test
@@ -357,3 +357,34 @@ DROP TABLE t1;
--echo #
--echo # End of 10.0 tests
--echo #
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8729 Wrong result for SELECT..WHERE HEX(enum_column)='61' AND enum_column='a '
+--echo #
+CREATE TABLE t1 (a ENUM('a','A') CHARACTER SET latin1 COLLATE latin1_bin);
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT * FROM t1 WHERE a='a ';
+SELECT * FROM t1 WHERE HEX(a)='61';
+SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
+--echo # Can't propagate the equality into HEX(a), because binary collations still ignore trailing spaces
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
+DROP TABLE t1;
+
+CREATE TABLE t1 (a ENUM('a','a ') CHARACTER SET BINARY);
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT * FROM t1 WHERE a='a ';
+SELECT * FROM t1 WHERE HEX(a)='61';
+SELECT * FROM t1 WHERE HEX(a)='61' AND a='a';
+SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
+--echo # Ok to propagate the equality into HEX(a), because "CHARACTER SET BINARY" does not ignore trailing spaces
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a';
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test
index bb7a784553e..3717dc028ba 100644
--- a/mysql-test/t/type_float.test
+++ b/mysql-test/t/type_float.test
@@ -385,3 +385,76 @@ DROP TABLE t1,t2;
--echo #
--echo # End of 10.0 tests
--echo #
+
+
+--echo #
+--echo # MDEV-8704 Wrong result for SELECT..WHERE LENGTH(double_column)!=6 AND double_column=100e0
+--echo #
+
+# The original test case from the bug report
+CREATE TABLE t1 (a DOUBLE(9,2));
+INSERT INTO t1 VALUES (100),(110);
+SELECT * FROM t1 WHERE LENGTH(a)!=6;
+SELECT * FROM t1 WHERE LENGTH(a)!=6 AND a=100e0;
+DROP TABLE t1;
+
+# DOUBLE with no specific precision
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES (100),(110);
+SELECT * FROM t1 WHERE LENGTH(a)!=6;
+SELECT * FROM t1 WHERE LENGTH(a)!=6 AND a=100e0;
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=6 AND a=100e0;
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=100e0;
+DROP TABLE t1;
+
+# The constant scale is bigger than the field scale
+CREATE TABLE t1 (a DOUBLE(10,1));
+INSERT INTO t1 VALUES (1.1),(1.2),(1.3);
+SELECT * FROM t1 WHERE LENGTH(a)!=3;
+SELECT * FROM t1 WHERE LENGTH(a)!=3 AND a=1.10e0;
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=3 AND a=1.10e0;
+--echo # Notice 1.1 instead of 1.10 in the final WHERE condition
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=1.10e0;
+DROP TABLE t1;
+
+# The constant scale is equal to the field scale
+CREATE TABLE t1 (a DOUBLE(10,2));
+INSERT INTO t1 VALUES (1.1),(1.2),(1.3);
+SELECT * FROM t1 WHERE LENGTH(a)!=4;
+SELECT * FROM t1 WHERE LENGTH(a)!=4 AND a=1.10e0;
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=4 AND a=1.10e0;
+--echo # Notice 1.10 in the final WHERE condition
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=1.10e0;
+DROP TABLE t1;
+
+# The constant scale is smaller than the field scale
+CREATE TABLE t1 (a DOUBLE(10,3));
+INSERT INTO t1 VALUES (1.1),(1.2),(1.3);
+SELECT * FROM t1 WHERE LENGTH(a)!=5;
+SELECT * FROM t1 WHERE LENGTH(a)!=5 AND a=1.10e0;
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=5 AND a=1.10e0;
+--echo # Notice 1.100 rather than 1.10 in the final WHERE condition
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=1.10e0;
+DROP TABLE t1;
+
+
+--echo #
+--echo # MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010
+--echo #
+CREATE TABLE t1 (a DOUBLE ZEROFILL);
+INSERT INTO t1 VALUES (2010),(2020);
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010e0 AND a>=2010e0;
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/type_int.test b/mysql-test/t/type_int.test
new file mode 100644
index 00000000000..e8b9b2cffcd
--- /dev/null
+++ b/mysql-test/t/type_int.test
@@ -0,0 +1,28 @@
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010
+--echo #
+
+CREATE TABLE t1 (a INT ZEROFILL);
+INSERT INTO t1 VALUES (2010),(2020);
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND a>=2010;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-8369 Unexpected impossible WHERE for a condition on a ZEROFILL field
+--echo #
+CREATE TABLE t1 (a INT ZEROFILL);
+INSERT INTO t1 VALUES (128),(129);
+SELECT * FROM t1 WHERE a=128;
+SELECT * FROM t1 WHERE hex(a)='80';
+SELECT * FROM t1 WHERE a=128 AND hex(a)='80';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE a=128 AND hex(a)='80';
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test
index 09149253c67..c31aefdb71c 100644
--- a/mysql-test/t/type_newdecimal.test
+++ b/mysql-test/t/type_newdecimal.test
@@ -1622,3 +1622,59 @@ DROP TABLE t1,t2;
--echo #
--echo # End of 10.0 tests
--echo #
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8703 Wrong result for SELECT..WHERE LENGTH(decimal_10_1_column)!=3 AND decimal_10_1_column=1.10
+--echo #
+
+# The constant scale is bigger than the field scale
+CREATE TABLE t1 (a DECIMAL(10,1));
+INSERT INTO t1 VALUES (1.1),(1.2),(1.3);
+SELECT * FROM t1 WHERE LENGTH(a)!=3;
+SELECT * FROM t1 WHERE LENGTH(a)!=3 AND a=1.10;
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=3 AND a=1.10;
+--echo # Notice 1.1 instead of 1.10 in the final WHERE condition
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=rand() AND a=1.10;
+DROP TABLE t1;
+
+# The constant scale is equal to the field scale
+CREATE TABLE t1 (a DECIMAL(10,2));
+INSERT INTO t1 VALUES (1.1),(1.2),(1.3);
+SELECT * FROM t1 WHERE LENGTH(a)!=4;
+SELECT * FROM t1 WHERE LENGTH(a)!=4 AND a=1.10;
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=4 AND a=1.10;
+--echo # Notice 1.10 in the final WHERE condition
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=rand() AND a=1.10;
+DROP TABLE t1;
+
+# The constant scale is smaller than the field scale
+CREATE TABLE t1 (a DECIMAL(10,3));
+INSERT INTO t1 VALUES (1.1),(1.2),(1.3);
+SELECT * FROM t1 WHERE LENGTH(a)!=5;
+SELECT * FROM t1 WHERE LENGTH(a)!=5 AND a=1.10;
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=5 AND a=1.10;
+--echo # Notice 1.100 rather than 1.10 in the final WHERE condition
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)!=rand() AND a=1.10;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010
+--echo #
+CREATE TABLE t1 (a DECIMAL(10,1) ZEROFILL);
+INSERT INTO t1 VALUES (2010),(2020);
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010.0 AND a>=2010.0;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/type_num.test b/mysql-test/t/type_num.test
new file mode 100644
index 00000000000..6ed04c8e1d3
--- /dev/null
+++ b/mysql-test/t/type_num.test
@@ -0,0 +1,683 @@
+--echo #
+--echo # Start of 10.0 tests
+--echo #
+
+--echo #
+--echo # MDEV-8468 CAST and INSERT work differently for DECIMAL/INT vs DOUBLE for a string with trailing spaces
+--echo #
+SET sql_mode='STRICT_ALL_TABLES';
+
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('1 ');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('1 ');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('1 ');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('1 ');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('1 ');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('1 ');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('1 ');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('x');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('x');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('x');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('x');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('x');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('x');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('x');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES (' x');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES (' x');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES (' x');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES (' x');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES (' x');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES (' x');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES (' x');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('.');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('.');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('.');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('.');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('.');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('.');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('.');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('-');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('-');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('-');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('-');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('-');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('-');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('-');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('+');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('+');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('+');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('+');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('+');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('+');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('+');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1x');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1x');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1x');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1x');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1x');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1x');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1x');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1E-');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1E-');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1E-');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1E-');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1E-');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1E-');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1E-');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1Ex');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1Ex');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1Ex');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1Ex');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1Ex');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1Ex');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1Ex');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+x');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+x');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+x');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+x');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+x');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+x');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+x');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error ER_WARN_DATA_OUT_OF_RANGE
+INSERT INTO t1 VALUES ('1e1000');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error ER_WARN_DATA_OUT_OF_RANGE
+INSERT INTO t1 VALUES ('1e1000');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error ER_WARN_DATA_OUT_OF_RANGE
+INSERT INTO t1 VALUES ('1e1000');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error ER_WARN_DATA_OUT_OF_RANGE
+INSERT INTO t1 VALUES ('1e1000');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error ER_WARN_DATA_OUT_OF_RANGE
+INSERT INTO t1 VALUES ('1e1000');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error ER_WARN_DATA_OUT_OF_RANGE
+INSERT INTO t1 VALUES ('1e1000');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error ER_WARN_DATA_OUT_OF_RANGE
+INSERT INTO t1 VALUES ('1e1000');
+DROP TABLE t1;
+
+
+SET sql_mode=DEFAULT;
+
+CREATE TABLE t1 (
+ f4 FLOAT,
+ f8 DOUBLE,
+ i1 TINYINT,
+ i2 SMALLINT,
+ i4 INT,
+ i8 BIGINT,
+ d DECIMAL
+);
+
+INSERT INTO t1 VALUES ('1 ','1 ','1 ','1 ','1 ','1 ','1 ');
+INSERT INTO t1 VALUES ('','','','','','','');
+INSERT INTO t1 VALUES ('x','x','x','x','x','x','x');
+INSERT INTO t1 VALUES (' x',' x',' x',' x',' x',' x',' x');
+INSERT INTO t1 VALUES ('.','.','.','.','.','.','.');
+INSERT INTO t1 VALUES ('-','-','-','-','-','-','-');
+INSERT INTO t1 VALUES ('+','+','+','+','+','+','+');
+INSERT INTO t1 VALUES ('1x','1x','1x','1x','1x','1x','1x');
+INSERT INTO t1 VALUES ('1e','1e','1e','1e','1e','1e','1e');
+INSERT INTO t1 VALUES ('1e-','1e-','1e-','1e-','1e-','1e-','1e-');
+INSERT INTO t1 VALUES ('1E+','1E+','1E+','1E+','1E+','1E+','1E+');
+INSERT INTO t1 VALUES ('1e1000','1e1000','1e1000','1e1000','1e1000','1e1000','1e1000');
+
+DELETE FROM t1;
+INSERT INTO t1 VALUES (0,0,0,0,0,0,0);
+INSERT INTO t1 VALUES (0,0,0,0,0,0,0);
+INSERT INTO t1 VALUES (1,1,1,1,1,1,1);
+INSERT INTO t1 VALUES (1,1,1,1,1,1,1);
+INSERT INTO t1 VALUES (2,2,2,2,2,2,2);
+INSERT INTO t1 VALUES (2,2,2,2,2,2,2);
+INSERT INTO t1 VALUES (3,3,3,3,3,3,3);
+INSERT INTO t1 VALUES (3,3,3,3,3,3,3);
+INSERT INTO t1 VALUES (4,4,4,4,4,4,4);
+INSERT INTO t1 VALUES (4,4,4,4,4,4,4);
+INSERT INTO t1 VALUES (5,5,5,5,5,5,5);
+INSERT INTO t1 VALUES (5,5,5,5,5,5,5);
+
+SELECT COUNT(*) FROM t1 WHERE f4='1 ';
+SELECT COUNT(*) FROM t1 WHERE f8='1 ';
+SELECT COUNT(*) FROM t1 WHERE i1='1 ';
+SELECT COUNT(*) FROM t1 WHERE i2='1 ';
+SELECT COUNT(*) FROM t1 WHERE i4='1 ';
+SELECT COUNT(*) FROM t1 WHERE i8='1 ';
+SELECT COUNT(*) FROM t1 WHERE d='1 ';
+
+SELECT COUNT(*) FROM t1 WHERE f4='';
+SELECT COUNT(*) FROM t1 WHERE f8='';
+SELECT COUNT(*) FROM t1 WHERE i1='';
+SELECT COUNT(*) FROM t1 WHERE i2='';
+SELECT COUNT(*) FROM t1 WHERE i4='';
+SELECT COUNT(*) FROM t1 WHERE i8='';
+SELECT COUNT(*) FROM t1 WHERE d='';
+
+SELECT COUNT(*) FROM t1 WHERE f4='x';
+SELECT COUNT(*) FROM t1 WHERE f8='x';
+SELECT COUNT(*) FROM t1 WHERE i1='x';
+SELECT COUNT(*) FROM t1 WHERE i2='x';
+SELECT COUNT(*) FROM t1 WHERE i4='x';
+SELECT COUNT(*) FROM t1 WHERE i8='x';
+SELECT COUNT(*) FROM t1 WHERE d='x';
+
+SELECT COUNT(*) FROM t1 WHERE f4=' x';
+SELECT COUNT(*) FROM t1 WHERE f8=' x';
+SELECT COUNT(*) FROM t1 WHERE i1=' x';
+SELECT COUNT(*) FROM t1 WHERE i2=' x';
+SELECT COUNT(*) FROM t1 WHERE i4=' x';
+SELECT COUNT(*) FROM t1 WHERE i8=' x';
+SELECT COUNT(*) FROM t1 WHERE d=' x';
+
+SELECT COUNT(*) FROM t1 WHERE f4='.';
+SELECT COUNT(*) FROM t1 WHERE f8='.';
+SELECT COUNT(*) FROM t1 WHERE i1='.';
+SELECT COUNT(*) FROM t1 WHERE i2='.';
+SELECT COUNT(*) FROM t1 WHERE i4='.';
+SELECT COUNT(*) FROM t1 WHERE i8='.';
+SELECT COUNT(*) FROM t1 WHERE d='.';
+
+SELECT COUNT(*) FROM t1 WHERE f4='-';
+SELECT COUNT(*) FROM t1 WHERE f8='-';
+SELECT COUNT(*) FROM t1 WHERE i1='-';
+SELECT COUNT(*) FROM t1 WHERE i2='-';
+SELECT COUNT(*) FROM t1 WHERE i4='-';
+SELECT COUNT(*) FROM t1 WHERE i8='-';
+SELECT COUNT(*) FROM t1 WHERE d='-';
+
+SELECT COUNT(*) FROM t1 WHERE f4='+';
+SELECT COUNT(*) FROM t1 WHERE f8='+';
+SELECT COUNT(*) FROM t1 WHERE i1='+';
+SELECT COUNT(*) FROM t1 WHERE i2='+';
+SELECT COUNT(*) FROM t1 WHERE i4='+';
+SELECT COUNT(*) FROM t1 WHERE i8='+';
+SELECT COUNT(*) FROM t1 WHERE d='+';
+
+SELECT COUNT(*) FROM t1 WHERE f4='1x';
+SELECT COUNT(*) FROM t1 WHERE f8='1x';
+SELECT COUNT(*) FROM t1 WHERE i1='1x';
+SELECT COUNT(*) FROM t1 WHERE i2='1x';
+SELECT COUNT(*) FROM t1 WHERE i4='1x';
+SELECT COUNT(*) FROM t1 WHERE i8='1x';
+SELECT COUNT(*) FROM t1 WHERE d='1x';
+
+SELECT COUNT(*) FROM t1 WHERE f4='1e';
+SELECT COUNT(*) FROM t1 WHERE f8='1e';
+SELECT COUNT(*) FROM t1 WHERE i1='1e';
+SELECT COUNT(*) FROM t1 WHERE i2='1e';
+SELECT COUNT(*) FROM t1 WHERE i4='1e';
+SELECT COUNT(*) FROM t1 WHERE i8='1e';
+SELECT COUNT(*) FROM t1 WHERE d='1e';
+
+SELECT COUNT(*) FROM t1 WHERE f4='1e+';
+SELECT COUNT(*) FROM t1 WHERE f8='1e+';
+SELECT COUNT(*) FROM t1 WHERE i1='1e+';
+SELECT COUNT(*) FROM t1 WHERE i2='1e+';
+SELECT COUNT(*) FROM t1 WHERE i4='1e+';
+SELECT COUNT(*) FROM t1 WHERE i8='1e+';
+SELECT COUNT(*) FROM t1 WHERE d='1e+';
+
+SELECT COUNT(*) FROM t1 WHERE f4='1E-';
+SELECT COUNT(*) FROM t1 WHERE f8='1E-';
+SELECT COUNT(*) FROM t1 WHERE i1='1E-';
+SELECT COUNT(*) FROM t1 WHERE i2='1E-';
+SELECT COUNT(*) FROM t1 WHERE i4='1E-';
+SELECT COUNT(*) FROM t1 WHERE i8='1E-';
+SELECT COUNT(*) FROM t1 WHERE d='1E-';
+
+SELECT COUNT(*) FROM t1 WHERE f4='1Ex';
+SELECT COUNT(*) FROM t1 WHERE f8='1Ex';
+SELECT COUNT(*) FROM t1 WHERE i1='1Ex';
+SELECT COUNT(*) FROM t1 WHERE i2='1Ex';
+SELECT COUNT(*) FROM t1 WHERE i4='1Ex';
+SELECT COUNT(*) FROM t1 WHERE i8='1Ex';
+SELECT COUNT(*) FROM t1 WHERE d='1Ex';
+
+SELECT COUNT(*) FROM t1 WHERE f4='1e+x';
+SELECT COUNT(*) FROM t1 WHERE f8='1e+x';
+SELECT COUNT(*) FROM t1 WHERE i1='1e+x';
+SELECT COUNT(*) FROM t1 WHERE i2='1e+x';
+SELECT COUNT(*) FROM t1 WHERE i4='1e+x';
+SELECT COUNT(*) FROM t1 WHERE i8='1e+x';
+SELECT COUNT(*) FROM t1 WHERE d='1e+x';
+
+SELECT COUNT(*) FROM t1 WHERE f4='1e1000';
+SELECT COUNT(*) FROM t1 WHERE f8='1e1000';
+SELECT COUNT(*) FROM t1 WHERE i1='1e1000';
+SELECT COUNT(*) FROM t1 WHERE i2='1e1000';
+SELECT COUNT(*) FROM t1 WHERE i4='1e1000';
+SELECT COUNT(*) FROM t1 WHERE i8='1e1000';
+SELECT COUNT(*) FROM t1 WHERE d='1e1000';
+
+ALTER TABLE t1
+ ADD KEY f4(f4),
+ ADD KEY f8(f8),
+ ADD KEY i1(i1),
+ ADD KEY i2(i2),
+ ADD KEY i4(i4),
+ ADD KEY i8(i8),
+ ADD KEY d(d);
+
+SELECT COUNT(*) FROM t1 FORCE INDEX(f4) WHERE f4='1 ';
+SELECT COUNT(*) FROM t1 FORCE INDEX(f8) WHERE f8='1 ';
+SELECT COUNT(*) FROM t1 FORCE INDEX(i1) WHERE i1='1 ';
+SELECT COUNT(*) FROM t1 FORCE INDEX(i2) WHERE i2='1 ';
+SELECT COUNT(*) FROM t1 FORCE INDEX(i4) WHERE i4='1 ';
+SELECT COUNT(*) FROM t1 FORCE INDEX(i8) WHERE i8='1 ';
+SELECT COUNT(*) FROM t1 FORCE INDEX(d) WHERE d='1 ';
+
+SELECT COUNT(*) FROM t1 FORCE INDEX(f4) WHERE f4='';
+SELECT COUNT(*) FROM t1 FORCE INDEX(f8) WHERE f8='';
+SELECT COUNT(*) FROM t1 FORCE INDEX(i1) WHERE i1='';
+SELECT COUNT(*) FROM t1 FORCE INDEX(i2) WHERE i2='';
+SELECT COUNT(*) FROM t1 FORCE INDEX(i4) WHERE i4='';
+SELECT COUNT(*) FROM t1 FORCE INDEX(i8) WHERE i8='';
+SELECT COUNT(*) FROM t1 FORCE INDEX(d) WHERE d='';
+
+# TODO: Add tests for all of the other tricky examples (see above) when
+# MDEV-8490 INT,DOUBLE,DECIMAL produce different warnings on comparison
+# is fixed
+
+DROP TABLE t1;
+
+SELECT
+ CAST('1 ' AS SIGNED),
+ CAST('1 ' AS UNSIGNED),
+ CAST('1 ' AS DECIMAL),
+ CAST('1 ' AS DOUBLE);
+
+SELECT
+ CAST('' AS SIGNED),
+ CAST('' AS UNSIGNED),
+ CAST('' AS DECIMAL),
+ CAST('' AS DOUBLE);
+
+SELECT
+ CAST('x' AS SIGNED),
+ CAST('x' AS UNSIGNED),
+ CAST('x' AS DECIMAL),
+ CAST('x' AS DOUBLE);
+
+SELECT
+ CAST(' x' AS SIGNED),
+ CAST(' x' AS UNSIGNED),
+ CAST(' x' AS DECIMAL),
+ CAST(' x' AS DOUBLE);
+
+SELECT
+ CAST('.' AS SIGNED),
+ CAST('.' AS UNSIGNED),
+ CAST('.' AS DECIMAL),
+ CAST('.' AS DOUBLE);
+
+SELECT
+ CAST('-' AS SIGNED),
+ CAST('-' AS UNSIGNED),
+ CAST('-' AS DECIMAL),
+ CAST('-' AS DOUBLE);
+
+SELECT
+ CAST('+' AS SIGNED),
+ CAST('+' AS UNSIGNED),
+ CAST('+' AS DECIMAL),
+ CAST('+' AS DOUBLE);
+
+SELECT
+ CAST('1x' AS SIGNED),
+ CAST('1x' AS UNSIGNED),
+ CAST('1x' AS DECIMAL),
+ CAST('1x' AS DOUBLE);
+
+SELECT
+ CAST('1e' AS SIGNED),
+ CAST('1e' AS UNSIGNED),
+ CAST('1e' AS DECIMAL),
+ CAST('1e' AS DOUBLE);
+
+SELECT
+ CAST('1e-' AS SIGNED),
+ CAST('1e-' AS UNSIGNED),
+ CAST('1e-' AS DECIMAL),
+ CAST('1e-' AS DOUBLE);
+
+SELECT
+ CAST('1E+' AS SIGNED),
+ CAST('1E+' AS UNSIGNED),
+ CAST('1E+' AS DECIMAL),
+ CAST('1E+' AS DOUBLE);
+
+# TODO: Uncomment this test when
+# MDEV-8468 CAST and INSERT work differently for DECIMAL/INT vs DOUBLE for a string with trailing spaces
+# is fixed
+#SELECT
+# CAST('1e1000' AS SIGNED),
+# CAST('1e1000' AS UNSIGNED),
+# CAST('1e1000' AS DECIMAL),
+# CAST('1e1000' AS DOUBLE);
+
+
+--echo #
+--echo # End of 10.0 tests
+--echo #
diff --git a/mysql-test/t/type_set.test b/mysql-test/t/type_set.test
index 8b9da6962d5..16e4f42301d 100644
--- a/mysql-test/t/type_set.test
+++ b/mysql-test/t/type_set.test
@@ -185,3 +185,35 @@ DROP TABLE t1;
--echo #
--echo # End of 10.0 tests
--echo #
+
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8729 Wrong result for SELECT..WHERE HEX(enum_column)='61' AND enum_column='a '
+--echo #
+CREATE TABLE t1 (a SET('a','A') CHARACTER SET latin1 COLLATE latin1_bin);
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT * FROM t1 WHERE a='a ';
+SELECT * FROM t1 WHERE HEX(a)='61';
+SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
+--echo # Can't propagate the equality into HEX(a), because binary collations still ignore trailing spaces
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
+DROP TABLE t1;
+
+CREATE TABLE t1 (a SET('a','a ') CHARACTER SET BINARY);
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT * FROM t1 WHERE a='a ';
+SELECT * FROM t1 WHERE HEX(a)='61';
+SELECT * FROM t1 WHERE HEX(a)='61' AND a='a';
+SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
+--echo # Ok to propagate the equality into HEX(a), because "CHARACTER SET BINARY" does not ignore trailing spaces
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a';
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/type_time.test b/mysql-test/t/type_time.test
index d36c6af65e8..d9d34ac124f 100644
--- a/mysql-test/t/type_time.test
+++ b/mysql-test/t/type_time.test
@@ -276,3 +276,418 @@ SET timestamp=DEFAULT;
--echo # End of 10.0 tests
--echo #
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8699 Wrong result for SELECT..WHERE HEX(date_column)!='323030312D30312D3031' AND date_column='2001-01-01x'
+--echo #
+
+--echo # Trailing garbage in string literals
+
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='00:00:00x';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='00:00:00x';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00x';
+DROP TABLE t1;
+
+--echo # Trailing fractional digits in string literals
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='00:00:00.000000';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='00:00:00.000000';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00.000000';
+DROP TABLE t1;
+
+--echo # Trailing fractional digits in temporal literals
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'00:00:00.000000';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'00:00:00.000000';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'00:00:00.000000';
+DROP TABLE t1;
+
+--echo # Trailing fractional digits in temporal literals, same precision
+CREATE TABLE t1 (a TIME(6));
+INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'00:00:00.000000';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'00:00:00.000000';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'00:00:00.000000';
+DROP TABLE t1;
+
+--echo # Leading spaces in string literals
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=' 00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=' 00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=' 00:00:00';
+DROP TABLE t1;
+
+--echo # Numeric format in string literals
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='000000';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='000000';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='000000';
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-8766 Wrong result for SELECT..WHERE LENGTH(time_column)=8 AND time_column=TIMESTAMP'2001-01-01 10:20:31'
+--echo #
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03');
+
+--echo # TIMESTAMP literal with the same scale, ok to propagate
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
+SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 10:20:31';
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31';
+DROP TABLE t1;
+
+--echo # TIMESTAMP literal with a bigger scale and fractional second truncation
+--echo # Ok to propagate with precision truncation
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
+SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 10:20:31.123';
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.123';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.123';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31.123';
+DROP TABLE t1;
+
+--echo # TIMESTAMP literal with a bigger scale and no fractional second truncation
+--echo # Ok to propagate
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
+SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 10:20:31.000';
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.000';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.000';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31.000';
+DROP TABLE t1;
+
+--echo # TIMESTAMP literal with a smaller scale
+--echo # Ok to propagate
+CREATE TABLE t1 (a TIME(6));
+INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
+SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 10:20:31.123';
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.123';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.123';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31.123';
+DROP TABLE t1;
+
+
+--echo # TIME literal with a bigger scale and fractional second truncation
+--echo # Ok to propagate with precision truncation
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
+SELECT * FROM t1 WHERE a=TIME'10:20:31.123';
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.123';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.123';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'10:20:31.123';
+DROP TABLE t1;
+
+--echo # TIME literal with a bigger scale and no fractional second truncation
+--echo # Ok to propagate
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
+SELECT * FROM t1 WHERE a=TIME'10:20:31.000';
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.000';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.000';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'10:20:31.000';
+DROP TABLE t1;
+
+--echo # TIME literal with a smaller scale
+--echo # Ok to propagate
+CREATE TABLE t1 (a TIME(6));
+INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
+SELECT * FROM t1 WHERE a=TIME'10:20:31.123';
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.123';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.123';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'10:20:31.123';
+DROP TABLE t1;
+
+
+--echo # TIME-alike string literal with a bigger scale and fractional second truncation
+--echo # Ok to propagate with precision truncation
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
+SELECT * FROM t1 WHERE a='10:20:31.123';
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.123';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.123';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='10:20:31.123';
+DROP TABLE t1;
+
+--echo # TIME-alike string literal with a bigger scale and no fractional second truncation
+--echo # Ok to propagate
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
+SELECT * FROM t1 WHERE a='10:20:31.000';
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.000';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.000';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='10:20:31.000';
+DROP TABLE t1;
+
+--echo # TIME-alike string literal with a smaller scale
+--echo # Ok to propagate
+CREATE TABLE t1 (a TIME(6));
+INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
+SELECT * FROM t1 WHERE a='10:20:31.123';
+SELECT * FROM t1 WHERE LENGTH(a)=8;
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.123';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.123';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='10:20:31.123';
+DROP TABLE t1;
+
+SET timestamp=DEFAULT;
+
+
+SET @@old_mode=zero_date_time_cast;
+--echo # TIMESTAMP literal, old mode
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('0000-00-00 10:20:30'),('0000-00-00 10:20:31');
+INSERT INTO t1 VALUES ('0000-00-01 10:20:30'),('0000-00-01 10:20:31');
+INSERT INTO t1 VALUES ('31 10:20:30'),('32 10:20:30'),('33 10:20:30'),('34 10:20:30');
+SELECT * FROM t1;
+
+--echo # Old mode, TIMESTAMP literal, zero YYYYMMDD, Ok to propagate
+SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30';
+SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=8;
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=8;
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=30+RAND();
+
+--echo # Old mode, TIMESTAMP literal, zon-zero YYYYMMDD, no propagation
+SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30';
+SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30' AND LENGTH(a)=8;
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30' AND LENGTH(a)=8;
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30' AND LENGTH(a)=30+RAND();
+
+--echo # Old mode, TIMESTAMP-alike string literal, zero YYYYMMDD, Ok to propagate
+SELECT * FROM t1 WHERE a='0000-00-00 10:20:30';
+SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=8;
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=8;
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=30+RAND();
+
+--echo # Old mode, TIMESTAMP-alike literal, zon-zero YYYYMMDD, no propagation
+SELECT * FROM t1 WHERE a='0000-00-01 10:20:30';
+SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8;
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8;
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=30+RAND();
+
+DROP TABLE t1;
+
+SET @@old_mode=DEFAULT;
+
+--echo #
+--echo # MDEV-8706 Wrong result for SELECT..WHERE time_column=TIMESTAMP'2015-08-30 00:00:00' AND time_column='00:00:00'
+--echo #
+SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
+SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00';
+SELECT * FROM t1 WHERE a='00:00:00';
+SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00' AND a='00:00:00';
+SELECT * FROM t1 WHERE a>=TIMESTAMP'2015-08-30 00:00:00' AND a='00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE a>=TIMESTAMP'2015-08-30 00:00:00' AND a='00:00:00';
+DROP TABLE t1;
+
+# TIMESTAMP literal with fractional seconds
+SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
+SELECT * FROM t1 WHERE DATE(a)<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE DATE(a)<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00.1';
+DROP TABLE t1;
+
+# DATE literal
+SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
+SELECT * FROM t1 WHERE DATE(a)<=DATE'2015-08-30' AND a='00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE DATE(a)<=DATE'2015-08-30' AND a='00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=DATE'2015-08-30' AND a='00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=DATE'2015-08-30' AND a='00:00:00.1';
+DROP TABLE t1;
+
+SET timestamp=DEFAULT;
+
+--echo #
+--echo # MDEV-8795 Equal expression propagation does not work for temporal literals
+--echo #
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('00:00:01'),('00:00:02');
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:01' AND COALESCE(a)>=TIME'00:00:01';
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-8793 Wrong result set for SELECT ... WHERE COALESCE(time_column)=TIME('00:00:00') AND COALESCE(time_column)=DATE('2015-09-11')
+--echo #
+SET timestamp=UNIX_TIMESTAMP('2015-09-11 20:20:20');
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES('10:20:30'),('00:00:00');
+SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00');
+SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11');
+
+--echo # TIME cast + DATE cast
+SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE('2015-09-11');
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE('2015-09-11');
+
+--echo # TIME cast + DATE literal
+SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE'2015-09-11';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE'2015-09-11';
+
+--echo # TIME literal + DATE cast
+SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE('2015-09-11');
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE('2015-09-11');
+
+--echo # TIME literal + DATE literal
+SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE'2015-09-11';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE'2015-09-11';
+
+--echo # TIME-alike string literal + DATE cast
+SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE('2015-09-11');
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE('2015-09-11');
+
+--echo # TIME-alike string literal + DATE literal
+SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE'2015-09-11';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE'2015-09-11';
+
+--echo # TIME-alike integer literal + DATE cast
+SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE('2015-09-11');
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE('2015-09-11');
+
+--echo # TIME-alike integer literal + DATE literal
+SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE'2015-09-11';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE'2015-09-11';
+
+
+### Now test the opposite order of the two equality expressions
+
+--echo # DATE cast + TIME cast
+SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME('00:00:00');
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME('00:00:00');
+
+--echo # DATE cast + TIME literal
+SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME'00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME'00:00:00';
+
+--echo # DATE cast + TIME-alike string literal
+SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)='00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)='00:00:00';
+
+--echo # DATE cast + TIME-alike integer literal
+SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=0;
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=0;
+
+--echo # DATE literal + TIME cast
+SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME('00:00:00');
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME('00:00:00');
+
+--echo # DATE literal + TIME literal
+SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME'00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME'00:00:00';
+
+--echo # DATE literal + TIME-alike string literal
+SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)='00:00:00';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)='00:00:00';
+
+--echo # DATE literal + TIME-alike integer literal
+SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=0;
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=0;
+
+DROP TABLE t1;
+SET timestamp=DEFAULT;
+
+--echo #
+--echo # MDEV-8814 Wrong result for WHERE datetime_column > TIME('00:00:00')
+--echo #
+CREATE TABLE t1 (a DATETIME);
+INSERT INTO t1 VALUES ('2000-09-12 00:00:00'), ('2007-04-25 05:08:49');
+SELECT * FROM t1 WHERE a>TIME'00:00:00';
+SELECT * FROM t1 WHERE a>TIME('00:00:00');
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test
index a12b221dc38..97b95d66077 100644
--- a/mysql-test/t/type_timestamp.test
+++ b/mysql-test/t/type_timestamp.test
@@ -534,6 +534,16 @@ SELECT DATE_ADD(a, INTERVAL 10 SECOND) FROM t1;
DROP TABLE t1;
+let type=TIMESTAMP;
+let defval='0000-00-00 00:00:00';
+--source include/type_temporal_zero_default.inc
+
+--echo #
+--echo # MDEV-8699 Wrong result for SELECT..WHERE HEX(date_column)!='323030312D30312D3031' AND date_column='2001-01-01x'
+--echo #
+--let $TYPE=TIMESTAMP
+--source include/equal_fields_propagation_datetime.inc
+
--echo #
--echo # End of 10.1 tests
--echo #
diff --git a/mysql-test/t/type_year.test b/mysql-test/t/type_year.test
index 685587fe3c5..d9fa2af1eb4 100644
--- a/mysql-test/t/type_year.test
+++ b/mysql-test/t/type_year.test
@@ -188,3 +188,25 @@ drop table t1;
drop function y2k;
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010
+--echo #
+CREATE TABLE t1 (a YEAR);
+INSERT INTO t1 VALUES (2010),(2020);
+SELECT * FROM t1 WHERE a=2010 AND a>=2010;
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND a>=2010;
+SELECT * FROM t1 WHERE a=2010 AND a>=10;
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND a>=10;
+SELECT * FROM t1 WHERE a=10 AND a>=2010;
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND a>=2010;
+SELECT * FROM t1 WHERE a=10 AND a>=10;
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND a>=10;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/update_innodb.test b/mysql-test/t/update_innodb.test
new file mode 100644
index 00000000000..67c356c4e2e
--- /dev/null
+++ b/mysql-test/t/update_innodb.test
@@ -0,0 +1,39 @@
+--source include/have_innodb.inc
+
+CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL,
+ `c2` datetime DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE `t2` (
+ `c0` varchar(10) NOT NULL,
+ `c1` int(11) NOT NULL,
+ `c2` int(11) NOT NULL,
+ PRIMARY KEY (`c0`,`c1`),
+ KEY `c1` (`c1`),
+ KEY `c2` (`c2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE `t3` (
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `c1` datetime NOT NULL,
+ `c2` bigint(20) NOT NULL,
+ `c3` int(4) unsigned NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `c2` (`c2`),
+ KEY `c3` (`c3`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE `t4` (
+ `c1` int(11) NOT NULL,
+ `c2` bigint(20) DEFAULT NULL,
+ `c3` int(11) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+ CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select `t4`.`c1` AS `c1`,`t4`.`c2` AS `c2`,`t4`.`c3` AS `c3` from `t4`;
+
+UPDATE t1 a JOIN t2 b ON a.c1 = b.c1 JOIN v1 vw ON b.c2 = vw.c1 JOIN t3 del ON vw.c2 = del.c2 SET a.c2 = ( SELECT max(t.c1) FROM t3 t, v1 i WHERE del.c2 = t.c2 AND vw.c3 = i.c3 AND t.c3 = 4 ) WHERE a.c2 IS NULL OR a.c2 < '2011-05-01';
+
+drop view v1;
+drop table t1,t2,t3,t4;
diff --git a/mysql-test/t/user_limits.test b/mysql-test/t/user_limits.test
index 7c249f61686..ebb4fd4fb88 100644
--- a/mysql-test/t/user_limits.test
+++ b/mysql-test/t/user_limits.test
@@ -26,6 +26,7 @@ flush privileges;
--disable_ps_protocol
# Test of MAX_QUERIES_PER_HOUR limit
+create user mysqltest_1@localhost;
grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 2;
# This ensures that counters are reset and makes test scheduling independent
flush user_resources;
@@ -46,6 +47,7 @@ disconnect mqph;
disconnect mqph2;
# Test of MAX_UPDATES_PER_HOUR limit
+create user mysqltest_1@localhost;
grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 2;
flush user_resources;
connect (muph, localhost, mysqltest_1,,);
@@ -70,6 +72,7 @@ disconnect muph;
disconnect muph2;
# Test of MAX_CONNECTIONS_PER_HOUR limit
+create user mysqltest_1@localhost;
grant usage on *.* to mysqltest_1@localhost with max_connections_per_hour 2;
flush user_resources;
connect (mcph1, localhost, mysqltest_1,,);
@@ -97,6 +100,7 @@ drop user mysqltest_1@localhost;
# Test of MAX_USER_CONNECTIONS limit
# We need this to reset internal mqh_used variable
flush privileges;
+create user mysqltest_1@localhost;
grant usage on *.* to mysqltest_1@localhost with max_user_connections 2;
flush user_resources;
connect (muc1, localhost, mysqltest_1,,);
@@ -150,6 +154,7 @@ set session max_user_connections= 2;
set global max_user_connections= 2;
select @@session.max_user_connections, @@global.max_user_connections;
# Let us check that global limit works
+create user mysqltest_1@localhost;
grant usage on *.* to mysqltest_1@localhost;
flush user_resources;
connect (muca1, localhost, mysqltest_1,,);
diff --git a/mysql-test/t/variables-notembedded.test b/mysql-test/t/variables-notembedded.test
index 471212bf38f..2aa77e1e254 100644
--- a/mysql-test/t/variables-notembedded.test
+++ b/mysql-test/t/variables-notembedded.test
@@ -58,9 +58,33 @@ SET @@session.relay_log= 'x';
SET @@global.relay_log= 'x';
#
--echo #
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+SHOW VARIABLES like 'relay_log_basename';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.relay_log_basename;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+SELECT @@global.relay_log_basename;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.relay_log_basename= 'x';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.relay_log_basename= 'x';
+#
+--echo #
+SHOW VARIABLES like 'log_bin_basename';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.log_bin_basename;
+SELECT @@global.log_bin_basename;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.log_bin_basename= 'x';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.log_bin_basename= 'x';
+#
+--echo #
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
SHOW VARIABLES like 'relay_log_index';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.relay_log_index;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
SELECT @@global.relay_log_index;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.relay_log_index= 'x';
@@ -68,6 +92,16 @@ SET @@session.relay_log_index= 'x';
SET @@global.relay_log_index= 'x';
#
--echo #
+SHOW VARIABLES like 'log_bin_index';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.log_bin_index;
+SELECT @@global.log_bin_index;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.log_bin_index= 'x';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.log_bin_index= 'x';
+#
+--echo #
SHOW VARIABLES like 'relay_log_info_file';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.relay_log_info_file;
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index 4c7c74f8032..8f29528ac25 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -1467,9 +1467,11 @@ drop function if exists t1_max;
drop function if exists t1_min;
--enable_warnings
+set sql_mode="";
--disable_warnings
create table t1 (a int) engine=innodb;
--enable_warnings
+set sql_mode=default;
insert into t1(a) values (0), (1);
create function t1_max() returns int return (select max(a) from t1);
create function t1_min() returns int return (select min(a) from t1);
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 84d7da548b2..e221a836134 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -2083,18 +2083,16 @@ drop table t1;
# Bug#12941
#
---disable_warnings
create table t1 (
r_object_id char(16) NOT NULL,
group_name varchar(32) NOT NULL
-) engine = InnoDB;
+);
create table t2 (
r_object_id char(16) NOT NULL,
i_position int(11) NOT NULL,
users_names varchar(32) default NULL
-) Engine = InnoDB;
---enable_warnings
+);
create view v1 as select r_object_id, group_name from t1;
create view v2 as select r_object_id, i_position, users_names from t2;
@@ -2806,11 +2804,12 @@ DROP VIEW IF EXISTS v1;
# Bug#21261 Wrong access rights was required for an insert to a view
#
+set GLOBAL sql_mode="";
+set LOCAL sql_mode="";
CREATE DATABASE bug21261DB;
USE bug21261DB;
connect (root,localhost,root,,bug21261DB);
connection root;
-
CREATE TABLE t1 (x INT);
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1;
GRANT INSERT, UPDATE ON v1 TO 'user21261'@'localhost';
@@ -2840,6 +2839,8 @@ USE test;
disconnect root;
disconnect user21261;
+set GLOBAL sql_mode=default;
+set LOCAL sql_mode=default;
#
# Bug#15950 NOW() optimized away in VIEWs
@@ -4317,13 +4318,23 @@ INSERT INTO t1 VALUES
CREATE VIEW v1 AS SELECT * FROM t1;
+--echo # t1 and v1 should return the same result set
SELECT * FROM v1 WHERE a > 'JJ' OR a <> 0 AND a = 'VV';
+SELECT * FROM t1 WHERE a > 'JJ' OR a <> 0 AND a = 'VV';
+--echo # t1 and v1 should propagate constants in the same way
EXPLAIN EXTENDED
SELECT * FROM v1 WHERE a > 'JJ' OR a <> 0 AND a = 'VV';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE a > 'JJ' OR a <> 0 AND a = 'VV';
+--echo # t1 and v1 should return the same result set
SELECT * FROM v1 WHERE a > 'JJ' OR a AND a = 'VV';
+SELECT * FROM t1 WHERE a > 'JJ' OR a AND a = 'VV';
+--echo # t1 and v1 should propagate constants in the same way
EXPLAIN EXTENDED
SELECT * FROM v1 WHERE a > 'JJ' OR a AND a = 'VV';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE a > 'JJ' OR a AND a = 'VV';
DROP VIEW v1;
DROP TABLE t1;
@@ -5367,6 +5378,40 @@ update t3 left join v2 using (id) set flag=flag+1;
drop view v2, v1;
drop table t1, t2, t3;
+--echo #
+--echo # MDEV-7207 - ALTER VIEW does not change ALGORITM
+--echo #
+create table t1 (a int, b int);
+create algorithm=temptable view v2 (c) as select b+1 from t1;
+show create view v2;
+alter algorithm=undefined view v2 (c) as select b+1 from t1;
+show create view v2;
+alter algorithm=merge view v2 (c) as select b+1 from t1;
+show create view v2;
+drop view v2;
+drop table t1;
+
+--echo #
+--echo # MDEV-8554: Server crashes in base_list_iterator::next_fast on 1st execution of PS with a multi-table update
+--echo #
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2); # Not necessary, the table can be empty
+
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3),(4); # Not necessary, the table can be empty
+
+CREATE TABLE t3 (c INT) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (5),(6); # Not necessary, the table can be empty
+
+CREATE OR REPLACE ALGORITHM=MERGE VIEW v3 AS SELECT * FROM t3;
+
+PREPARE stmt FROM 'UPDATE t1, t2 SET a = 1 WHERE a IN ( SELECT 0 FROM t3 )';
+UPDATE t1, t2 SET a = 1 WHERE a IN ( SELECT 0 FROM v3 );
+EXECUTE stmt;
+
+DROP TABLE t1, t2, t3;
+DROP VIEW v3;
+
--echo # -----------------------------------------------------------------
--echo # -- End of 5.5 tests.
--echo # -----------------------------------------------------------------
@@ -5415,3 +5460,60 @@ drop view v3;
--echo # -- End of 10.0 tests.
--echo # -----------------------------------------------------------------
SET optimizer_switch=@save_optimizer_switch;
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8747 Wrong result for SELECT..WHERE derived_table_column='a' AND derived_table_column<>_latin1'A' COLLATE latin1_bin
+--echo #
+CREATE TABLE t1 (a varchar(10) character set cp1251 collate cp1251_ukrainian_ci, KEY (a)) ;
+INSERT INTO t1 VALUES ('DD'), ('ZZ'), ('ZZ'), ('KK'), ('FF'), ('HH'),('MM'),('`1');
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT * FROM t1 WHERE a <> 0 AND a = ' 1';
+SELECT * FROM v1 WHERE a <> 0 AND a = ' 1';
+DROP VIEW v1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a ENUM('5','6'));
+INSERT INTO t1 VALUES ('5'),('6');
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT * FROM t1 WHERE a='5' AND a<2;
+SELECT * FROM v1 WHERE a='5' AND a<2;
+DROP VIEW v1;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-8749 Wrong result for SELECT..WHERE derived_table_enum_column='number' AND derived_table_enum_column OP number2
+--echo #
+CREATE TABLE t1 (a varchar(10) character set cp1251 collate cp1251_ukrainian_ci, KEY (a));
+INSERT INTO t1 VALUES ('DD'), ('ZZ'), ('ZZ'), ('KK'), ('FF'), ('HH'),('MM'),('`1');
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT * FROM t1 WHERE a <> 0 AND a = ' 1';
+SELECT * FROM v1 WHERE a <> 0 AND a = ' 1';
+DROP VIEW v1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a ENUM('5','6'));
+INSERT INTO t1 VALUES ('5'),('6');
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT * FROM t1 WHERE a='5' AND a<2;
+SELECT * FROM v1 WHERE a='5' AND a<2;
+DROP VIEW v1;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-8742 Wrong result for SELECT..WHERE view_latin1_swedish_ci_field='a' COLLATE latin1_bin
+--echo #
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
+INSERT INTO t1 VALUES ('a'),('A');
+CREATE VIEW v1 AS SELECT * FROM t1 WHERE a='a';
+SELECT * FROM v1 WHERE a=_latin1'a' COLLATE latin1_bin;
+DROP VIEW v1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/t/view_grant.test b/mysql-test/t/view_grant.test
index 8907c726ae3..6d0cd8e5c28 100644
--- a/mysql-test/t/view_grant.test
+++ b/mysql-test/t/view_grant.test
@@ -11,6 +11,7 @@ drop view if exists v1,v2,v3;
# simple test of grants
+create user test@localhost;
grant create view on test.* to test@localhost;
show grants for test@localhost;
revoke create view on test.* from test@localhost;
@@ -29,6 +30,7 @@ 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;
@@ -90,7 +92,7 @@ select d from mysqltest.v1;
connection root;
revoke all privileges on mysqltest.v1 from mysqltest_1@localhost;
-delete from mysql.user where user='mysqltest_1';
+drop user mysqltest_1@localhost;
drop database mysqltest;
# TEMPORARY TABLE algorithm
@@ -100,6 +102,7 @@ create database mysqltest;
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;
@@ -110,7 +113,7 @@ select d from mysqltest.v1;
connection root;
revoke all privileges on mysqltest.v1 from mysqltest_1@localhost;
-delete from mysql.user where user='mysqltest_1';
+drop user mysqltest_1@localhost;
drop database mysqltest;
#
@@ -129,6 +132,7 @@ create view mysqltest.v3 (c,d) as select a+1,b+1 from mysqltest.t2;
create algorithm=temptable view mysqltest.v4 (c,d) as select a+1,b+1 from mysqltest.t2;
# v5: SHOW VIEW, but no SELECT
create view mysqltest.v5 (c,d) as select a+1,b+1 from mysqltest.t1;
+create user mysqltest_1@localhost;
grant select on mysqltest.v1 to mysqltest_1@localhost;
grant select on mysqltest.v2 to mysqltest_1@localhost;
grant select on mysqltest.v3 to mysqltest_1@localhost;
@@ -225,7 +229,7 @@ show create view mysqltest.v4;
connection root;
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
-delete from mysql.user where user='mysqltest_1';
+drop user mysqltest_1@localhost;
drop database mysqltest;
#
@@ -244,6 +248,7 @@ create view mysqltest.v1 (a,c) as select a, b+1 from mysqltest.t1;
create view mysqltest.v2 (a,c) as select a, b from mysqltest.t1;
create view mysqltest.v3 (a,c) as select a, b+1 from mysqltest.t1;
+create user mysqltest_1@localhost;
grant update (a) on mysqltest.v2 to mysqltest_1@localhost;
grant update on mysqltest.v1 to mysqltest_1@localhost;
grant select on mysqltest.* to mysqltest_1@localhost;
@@ -274,6 +279,7 @@ update v3 set a=a+c;
use test;
connection root;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
drop database mysqltest;
#
@@ -291,6 +297,7 @@ insert into mysqltest.t2 values (3), (4), (5), (6);
create view mysqltest.v1 (a,c) as select a, b+1 from mysqltest.t1;
create view mysqltest.v2 (a,c) as select a, b+1 from mysqltest.t1;
+create user mysqltest_1@localhost;
grant delete on mysqltest.v1 to mysqltest_1@localhost;
grant select on mysqltest.* to mysqltest_1@localhost;
@@ -310,6 +317,7 @@ delete from v2 where c < 4;
use test;
connection root;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
drop database mysqltest;
#
@@ -327,6 +335,7 @@ insert into mysqltest.t2 values (3,4);
create view mysqltest.v1 (a,c) as select a, b from mysqltest.t1;
create view mysqltest.v2 (a,c) as select a, b from mysqltest.t1;
+create user mysqltest_1@localhost;
grant insert on mysqltest.v1 to mysqltest_1@localhost;
grant select on mysqltest.* to mysqltest_1@localhost;
@@ -346,6 +355,7 @@ insert into v2 select x,y from t2;
use test;
connection root;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
drop database mysqltest;
#
@@ -359,6 +369,7 @@ 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 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;
@@ -407,6 +418,7 @@ 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;
@@ -418,6 +430,7 @@ connection root;
create database mysqltest;
--enable_warnings
create table mysqltest.t1 (a int);
+create user mysqltest_1@localhost;
grant all privileges on mysqltest.* to mysqltest_1@localhost;
connection user1;
@@ -427,6 +440,7 @@ use test;
connection root;
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
drop database mysqltest;
#
@@ -439,6 +453,7 @@ 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;
@@ -455,6 +470,7 @@ select * from v1;
grant select on mysqltest.t1 to mysqltest_1@localhost;
select * from v1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
drop view v1;
drop database mysqltest;
@@ -482,6 +498,7 @@ create algorithm=MERGE view v2 as select f2() from t1;
create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select f2() from t1;
create algorithm=MERGE SQL SECURITY INVOKER view v4 as select f2() from t1;
create SQL SECURITY INVOKER view v5 as select * from v4;
+create user mysqltest_1@localhost;
grant select on v1 to mysqltest_1@localhost;
grant select on v2 to mysqltest_1@localhost;
grant select on v3 to mysqltest_1@localhost;
@@ -506,6 +523,7 @@ drop function f2;
drop table t1, t2;
use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
drop database mysqltest;
#
@@ -529,6 +547,7 @@ delimiter //;
create function f2 () returns int begin declare v int; select s1 from t2
into v; return v; end//
delimiter ;//
+create user mysqltest_1@localhost;
grant select on t1 to mysqltest_1@localhost;
grant execute on function f2 to mysqltest_1@localhost;
grant create view on mysqltest.* to mysqltest_1@localhost;
@@ -558,6 +577,7 @@ drop function f2;
drop table t1, t2;
use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
drop database mysqltest;
#
@@ -572,6 +592,7 @@ use mysqltest;
create table t1 (a int);
create table v1 (a int);
insert into t1 values (1);
+create user mysqltest_1@localhost;
grant select on t1 to mysqltest_1@localhost;
grant select on v1 to mysqltest_1@localhost;
grant create view on mysqltest.* to mysqltest_1@localhost;
@@ -601,6 +622,7 @@ select * from v5;
drop table t1;
use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
drop database mysqltest;
@@ -617,6 +639,7 @@ create algorithm=MERGE view v2 as select *, a as b from t1;
create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select *, a as b from t1;
create algorithm=MERGE SQL SECURITY INVOKER view v4 as select *, a as b from t1;
create SQL SECURITY INVOKER view v5 as select * from v4;
+create user mysqltest_1@localhost;
grant select on v1 to mysqltest_1@localhost;
grant select on v2 to mysqltest_1@localhost;
grant select on v3 to mysqltest_1@localhost;
@@ -640,6 +663,7 @@ drop view v1, v2, v3, v4, v5;
drop table t1;
use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
drop database mysqltest;
#
@@ -657,6 +681,7 @@ delete from mysql.user where user='';
flush privileges;
# Create the test user
+create user 'test14256'@'%';
grant all on test.* to 'test14256'@'%';
connect (test14256,localhost,test14256,,test);
@@ -702,6 +727,7 @@ use mysqltest;
CREATE TABLE t1 (i INT);
CREATE VIEW v1 AS SELECT * FROM t1;
SHOW CREATE VIEW v1;
+create user mysqltest_1@localhost;
GRANT SELECT, LOCK TABLES ON mysqltest.* TO mysqltest_1@localhost;
connection user1;
@@ -1162,6 +1188,7 @@ INSERT INTO mysqltest1.t2 VALUES (21), (22), (23), (24);
INSERT INTO mysqltest1.t3 VALUES (31), (32), (33), (34);
INSERT INTO mysqltest1.t4 VALUES (41), (42), (43), (44);
+CREATE USER mysqltest_u1@localhost;
GRANT SELECT ON mysqltest1.t1 TO mysqltest_u1@localhost;
GRANT INSERT ON mysqltest1.t2 TO mysqltest_u1@localhost;
GRANT SELECT, UPDATE ON mysqltest1.t3 TO mysqltest_u1@localhost;
@@ -1237,6 +1264,7 @@ USE db1;
CREATE TABLE t1(f1 INT, f2 INT);
CREATE VIEW v1 AS SELECT f1, f2 FROM t1;
+CREATE USER foo;
GRANT SELECT (f1) ON t1 TO foo;
GRANT SELECT (f1) ON v1 TO foo;
diff --git a/mysql-test/t/warnings_engine_disabled.test b/mysql-test/t/warnings_engine_disabled.test
index 11b22135128..46c686aa6d6 100644
--- a/mysql-test/t/warnings_engine_disabled.test
+++ b/mysql-test/t/warnings_engine_disabled.test
@@ -12,9 +12,11 @@ if (!`SELECT count(*) FROM information_schema.engines WHERE
# Test for handler type, will select MyISAM and print a warning
# about that - since InnoDB is disabled
#
+set sql_mode="";
create table t1 (id int) engine=InnoDB;
alter table t1 engine=InnoDB;
drop table t1;
+set sql_mode=default;
#
# Bug#29263 disabled storage engines omitted in SHOW ENGINES
diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp
index e97a6a3f0b7..53ddda21258 100644
--- a/mysql-test/valgrind.supp
+++ b/mysql-test/valgrind.supp
@@ -127,6 +127,15 @@
}
{
+ pthread memalign memory loss3
+ Memcheck:Leak
+ fun:memalign
+ fun:tls_get_addr_tail
+ ...
+ fun:*ha_finalize_handlerton*
+}
+
+{
pthread pthread_key_create
Memcheck:Leak
fun:malloc
@@ -420,7 +429,7 @@
Memcheck:Leak
fun:memalign
...
- fun:call_init
+ fun:call_init*
fun:_dl_init
}
diff --git a/mysys/checksum.c b/mysys/checksum.c
index 7bc52c6a178..a948785d935 100644
--- a/mysys/checksum.c
+++ b/mysys/checksum.c
@@ -18,8 +18,6 @@
#include <my_sys.h>
#include <zlib.h>
-ulong my_crc_dbug_check= ~0; /* Cannot happen */
-
/*
Calculate a long checksum for a memoryblock.
@@ -34,7 +32,5 @@ ha_checksum my_checksum(ha_checksum crc, const uchar *pos, size_t length)
{
crc= (ha_checksum) crc32((uint)crc, pos, (uint) length);
DBUG_PRINT("info", ("crc: %lu", (ulong) crc));
- if ((ulong)crc == my_crc_dbug_check)
- my_debug_put_break_here();
return crc;
}
diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c
index a7a048acac1..38c4c10c7f1 100644
--- a/mysys/ma_dyncol.c
+++ b/mysys/ma_dyncol.c
@@ -2578,7 +2578,6 @@ find_place(DYN_HEADER *hdr, void *key, my_bool string_keys)
mid= 1;
while (start != end)
{
- uint val;
mid= (start + end) / 2;
hdr->entry= hdr->header + mid * hdr->entry_size;
if (!string_keys)
@@ -3894,11 +3893,11 @@ mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val,
}
case DYN_COL_DECIMAL:
{
- int len= sizeof(buff);
- decimal2string(&val->x.decimal.value, buff, &len,
+ int tmp_len= sizeof(buff);
+ decimal2string(&val->x.decimal.value, buff, &tmp_len,
0, val->x.decimal.value.frac,
'0');
- if (dynstr_append_mem(str, buff, len))
+ if (dynstr_append_mem(str, buff, tmp_len))
return ER_DYNCOL_RESOURCE;
break;
}
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c
index 4591557baf0..28e5e72130d 100644
--- a/mysys/mf_iocache.c
+++ b/mysys/mf_iocache.c
@@ -265,7 +265,7 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize,
if (type == SEQ_READ_APPEND)
buffer_block *= 2;
else if (cache_myflags & MY_ENCRYPT)
- buffer_block= 2*my_aes_get_size(buffer_block) + sizeof(IO_CACHE_CRYPT);
+ buffer_block= 2*(buffer_block + MY_AES_BLOCK_SIZE) + sizeof(IO_CACHE_CRYPT);
if (cachesize == min_cache)
flags|= (myf) MY_WME;
diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c
index c0cd1594e72..d9bc0e9094e 100644
--- a/mysys/mf_keycache.c
+++ b/mysys/mf_keycache.c
@@ -552,17 +552,21 @@ int init_simple_key_cache(SIMPLE_KEY_CACHE_CB *keycache,
Allocate memory for blocks, hash_links and hash entries;
For each block 2 hash links are allocated
*/
- if (my_multi_malloc(MYF(MY_ZEROFILL),
- &keycache->block_root, blocks * sizeof(BLOCK_LINK),
- &keycache->hash_root,
- sizeof(HASH_LINK*) * keycache->hash_entries,
- &keycache->hash_link_root,
- hash_links * sizeof(HASH_LINK),
- &keycache->changed_blocks,
- sizeof(BLOCK_LINK*) * changed_blocks_hash_size,
- &keycache->file_blocks,
- sizeof(BLOCK_LINK*) * changed_blocks_hash_size,
- NullS))
+ if (my_multi_malloc_large(MYF(MY_ZEROFILL),
+ &keycache->block_root,
+ (ulonglong) (blocks * sizeof(BLOCK_LINK)),
+ &keycache->hash_root,
+ (ulonglong) (sizeof(HASH_LINK*) *
+ keycache->hash_entries),
+ &keycache->hash_link_root,
+ (ulonglong) (hash_links * sizeof(HASH_LINK)),
+ &keycache->changed_blocks,
+ (ulonglong) (sizeof(BLOCK_LINK*) *
+ changed_blocks_hash_size),
+ &keycache->file_blocks,
+ (ulonglong) (sizeof(BLOCK_LINK*) *
+ changed_blocks_hash_size),
+ NullS))
break;
my_large_free(keycache->block_mem);
keycache->block_mem= 0;
@@ -1123,6 +1127,7 @@ static void wait_on_queue(KEYCACHE_WQUEUE *wqueue,
struct st_my_thread_var *thread= my_thread_var;
DBUG_ASSERT(!thread->next);
DBUG_ASSERT(!thread->prev); /* Not required, but must be true anyway. */
+ mysql_mutex_assert_owner(mutex);
/* Add to queue. */
if (! (last= wqueue->last_thread))
@@ -1177,14 +1182,15 @@ static void release_whole_queue(KEYCACHE_WQUEUE *wqueue)
do
{
thread=next;
- DBUG_ASSERT(thread);
+ DBUG_ASSERT(thread && thread->init == 1);
KEYCACHE_DBUG_PRINT("release_whole_queue: signal",
("thread %ld", thread->id));
- /* Signal the thread. */
- keycache_pthread_cond_signal(&thread->suspend);
/* Take thread from queue. */
- next=thread->next;
+ next= thread->next;
thread->next= NULL;
+
+ /* Signal the thread. */
+ keycache_pthread_cond_signal(&thread->suspend);
}
while (thread != last);
@@ -4160,10 +4166,10 @@ restart:
if (! (type == FLUSH_KEEP || type == FLUSH_FORCE_WRITE))
{
- BLOCK_LINK *last_for_update= NULL;
BLOCK_LINK *last_in_switch= NULL;
uint total_found= 0;
uint found;
+ last_for_update= NULL;
/*
Finally free all clean blocks for this file.
diff --git a/mysys/mulalloc.c b/mysys/mulalloc.c
index 9384ed744ad..fceecdc1dc7 100644
--- a/mysys/mulalloc.c
+++ b/mysys/mulalloc.c
@@ -62,3 +62,47 @@ void* my_multi_malloc(myf myFlags, ...)
va_end(args);
DBUG_RETURN((void*) start);
}
+
+
+/*
+ Same as my_multi_malloc, but each entry can be over 4G
+
+ SYNOPSIS
+ my_multi_malloc()
+ myFlags Flags
+ ptr1, length1 Multiple arguments terminated by null ptr
+ ptr2, length2 ...
+ ...
+ NULL
+*/
+
+void *my_multi_malloc_large(myf myFlags, ...)
+{
+ va_list args;
+ char **ptr,*start,*res;
+ size_t tot_length,length;
+ DBUG_ENTER("my_multi_malloc");
+
+ va_start(args,myFlags);
+ tot_length=0;
+ while ((ptr=va_arg(args, char **)))
+ {
+ length=va_arg(args,ulonglong);
+ tot_length+=ALIGN_SIZE(length);
+ }
+ va_end(args);
+
+ if (!(start=(char *) my_malloc(tot_length, myFlags)))
+ DBUG_RETURN(0); /* purecov: inspected */
+
+ va_start(args,myFlags);
+ res=start;
+ while ((ptr=va_arg(args, char **)))
+ {
+ *ptr=res;
+ length=va_arg(args,ulonglong);
+ res+=ALIGN_SIZE(length);
+ }
+ va_end(args);
+ DBUG_RETURN((void*) start);
+}
diff --git a/mysys/my_create.c b/mysys/my_create.c
index 51de343d4a1..6a3bcd63557 100644
--- a/mysys/my_create.c
+++ b/mysys/my_create.c
@@ -43,7 +43,7 @@ File my_create(const char *FileName, int CreateFlags, int access_flags,
#if defined(_WIN32)
fd= my_win_open(FileName, access_flags | O_CREAT);
#else
- fd= open((char *) FileName, access_flags | O_CREAT,
+ fd= open((char *) FileName, access_flags | O_CREAT | O_CLOEXEC,
CreateFlags ? CreateFlags : my_umask);
#endif
diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c
index 3ec5e0ba0b1..1fa3f9b9b8f 100644
--- a/mysys/my_fopen.c
+++ b/mysys/my_fopen.c
@@ -42,7 +42,7 @@ static void make_ftype(char * to,int flag);
FILE *my_fopen(const char *filename, int flags, myf MyFlags)
{
FILE *fd;
- char type[5];
+ char type[10];
DBUG_ENTER("my_fopen");
DBUG_PRINT("my",("Name: '%s' flags: %d MyFlags: %lu",
filename, flags, MyFlags));
@@ -350,9 +350,11 @@ static void make_ftype(register char * to, register int flag)
else
*to++= 'r';
-#if FILE_BINARY /* If we have binary-files */
if (flag & FILE_BINARY)
*to++='b';
-#endif
+
+ if (O_CLOEXEC)
+ *to++= 'e';
+
*to='\0';
} /* make_ftype */
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 88fa3d493fc..56b6d55a92a 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -47,14 +47,15 @@ static char *check_struct_option(char *cur_arg, char *key_name);
order of their arguments must correspond to each other.
*/
static const char *special_opt_prefix[]=
-{"skip", "disable", "enable", "maximum", "loose", 0};
+{"skip", "disable", "enable", "maximum", "loose", "autoset", 0};
static const uint special_opt_prefix_lengths[]=
-{ 4, 7, 6, 7, 5, 0};
+{ 4, 7, 6, 7, 5, 7, 0};
enum enum_special_opt
-{ OPT_SKIP, OPT_DISABLE, OPT_ENABLE, OPT_MAXIMUM, OPT_LOOSE};
+{ OPT_SKIP, OPT_DISABLE, OPT_ENABLE, OPT_MAXIMUM, OPT_LOOSE, OPT_AUTOSET};
char *disabled_my_option= (char*) "0";
char *enabled_my_option= (char*) "1";
+char *autoset_my_option= (char*) "auto";
/*
This is a flag that can be set in client programs. 0 means that
@@ -198,7 +199,7 @@ int handle_options(int *argc, char ***argv,
{
uint UNINIT_VAR(opt_found), argvpos= 0, length;
my_bool end_of_options= 0, must_be_var, set_maximum_value,
- option_is_loose;
+ option_is_loose, option_is_autoset;
char **pos, **pos_end, *optend, *opt_str, key_name[FN_REFLEN];
const char *UNINIT_VAR(prev_found);
const struct my_option *optp;
@@ -249,6 +250,7 @@ int handle_options(int *argc, char ***argv,
must_be_var= 0;
set_maximum_value= 0;
option_is_loose= 0;
+ option_is_autoset= 0;
cur_arg++; /* skip '-' */
if (*cur_arg == '-') /* check for long option, */
@@ -297,6 +299,8 @@ int handle_options(int *argc, char ***argv,
length-= special_opt_prefix_lengths[i] + 1;
if (i == OPT_LOOSE)
option_is_loose= 1;
+ else if (i == OPT_AUTOSET)
+ option_is_autoset= 1;
if ((opt_found= findopt(opt_str, length, &optp, &prev_found)))
{
if (opt_found > 1)
@@ -458,6 +462,36 @@ int handle_options(int *argc, char ***argv,
}
argument= optend;
}
+ else if (option_is_autoset)
+ {
+ if (optend)
+ {
+ my_getopt_error_reporter(ERROR_LEVEL,
+ "%s: automatically set "
+ "option '--%s' cannot take an argument",
+ my_progname, optp->name);
+
+ DBUG_RETURN(EXIT_NO_ARGUMENT_ALLOWED);
+ }
+ /*
+ We support automatic setup only via get_one_option and only for
+ marked options.
+ */
+ if (!get_one_option ||
+ !(optp->var_type & GET_AUTO))
+ {
+ my_getopt_error_reporter(option_is_loose ?
+ WARNING_LEVEL : ERROR_LEVEL,
+ "%s: automatic setup request is "
+ "unsupported by option '--%s'",
+ my_progname, optp->name);
+ if (!option_is_loose)
+ return EXIT_ARGUMENT_INVALID;
+ continue;
+ }
+ else
+ argument= autoset_my_option;
+ }
else if (optp->arg_type == REQUIRED_ARG && !optend)
{
/* Check if there are more arguments after this one,
@@ -585,7 +619,8 @@ int handle_options(int *argc, char ***argv,
(*argc)--; /* option handled (short), decrease argument count */
continue;
}
- if (((error= setval(optp, value, argument, set_maximum_value))) &&
+ if ((!option_is_autoset) &&
+ ((error= setval(optp, value, argument, set_maximum_value))) &&
!option_is_loose)
DBUG_RETURN(error);
if (get_one_option && get_one_option(optp->id, optp, argument))
@@ -1278,7 +1313,8 @@ void my_cleanup_options(const struct my_option *options)
SYNOPSIS
init_variables()
- options Array of options
+ options Array of options
+ func_init_one_value Call this function to init the variable
NOTES
We will initialize the value that is pointed to by options->value.
@@ -1287,7 +1323,7 @@ void my_cleanup_options(const struct my_option *options)
*/
static void init_variables(const struct my_option *options,
- init_func_p init_one_value)
+ init_func_p func_init_one_value)
{
DBUG_ENTER("init_variables");
for (; options->name; options++)
@@ -1300,11 +1336,11 @@ static void init_variables(const struct my_option *options,
set the value to default value.
*/
if (options->u_max_value)
- init_one_value(options, options->u_max_value, options->max_value);
+ func_init_one_value(options, options->u_max_value, options->max_value);
value= (options->var_type & GET_ASK_ADDR ?
(*getopt_get_addr)("", 0, options, 0) : options->value);
if (value)
- init_one_value(options, value, options->def_value);
+ func_init_one_value(options, value, options->def_value);
}
DBUG_VOID_RETURN;
}
@@ -1426,6 +1462,11 @@ void my_print_help(const struct my_option *options)
}
col= print_comment(optp->comment, col, name_space, comment_space);
+ if (optp->var_type & GET_AUTO)
+ {
+ col= print_comment(" (Automatically configured unless set explicitly)",
+ col, name_space, comment_space);
+ }
switch (optp->var_type & GET_TYPE_MASK) {
case GET_ENUM:
diff --git a/mysys/my_open.c b/mysys/my_open.c
index 5263ba4b5c8..b6d8f08bfc1 100644
--- a/mysys/my_open.c
+++ b/mysys/my_open.c
@@ -46,9 +46,9 @@ File my_open(const char *FileName, int Flags, myf MyFlags)
#if defined(_WIN32)
fd= my_win_open(FileName, Flags);
#elif !defined(NO_OPEN_3)
- fd = open(FileName, Flags, my_umask); /* Normal unix */
+ fd = open(FileName, Flags | O_CLOEXEC, my_umask); /* Normal unix */
#else
- fd = open((char *) FileName, Flags);
+ fd = open((char *) FileName, Flags | O_CLOEXEC);
#endif
fd= my_register_filename(fd, FileName, FILE_BY_OPEN,
diff --git a/mysys/my_rdtsc.c b/mysys/my_rdtsc.c
index 028c7f810d4..c624a5ca288 100644
--- a/mysys/my_rdtsc.c
+++ b/mysys/my_rdtsc.c
@@ -728,7 +728,6 @@ void my_timer_init(MY_TIMER_INFO *mti)
mti->cycles.frequency= mti->microseconds.frequency;
else
{
- ulonglong time1, time2;
time1= my_timer_init_frequency(mti);
/* Repeat once in case there was an interruption. */
time2= my_timer_init_frequency(mti);
@@ -750,8 +749,7 @@ void my_timer_init(MY_TIMER_INFO *mti)
&& mti->microseconds.routine
&& mti->cycles.routine)
{
- int i;
- ulonglong time1, time2, time3, time4;
+ ulonglong time3, time4;
time1= my_timer_cycles();
time2= my_timer_milliseconds();
time3= time2; /* Avoids a Microsoft/IBM compiler warning */
@@ -776,8 +774,7 @@ void my_timer_init(MY_TIMER_INFO *mti)
&& mti->microseconds.routine
&& mti->cycles.routine)
{
- int i;
- ulonglong time1, time2, time3, time4;
+ ulonglong time3, time4;
time1= my_timer_cycles();
time2= my_timer_ticks();
time3= time2; /* Avoids a Microsoft/IBM compiler warning */
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c
index d9dbacc8524..1e4b85583b1 100644
--- a/mysys/my_thr_init.c
+++ b/mysys/my_thr_init.c
@@ -372,6 +372,8 @@ void my_thread_end(void)
mysql_cond_signal(&THR_COND_threads);
mysql_mutex_unlock(&THR_LOCK_threads);
+ /* Trash variable so that we can detect false accesses to my_thread_var */
+ tmp->init= 2;
TRASH(tmp, sizeof(*tmp));
free(tmp);
}
diff --git a/mysys/ptr_cmp.c b/mysys/ptr_cmp.c
index d4daf2b1ec5..6d853a8db25 100644
--- a/mysys/ptr_cmp.c
+++ b/mysys/ptr_cmp.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -91,6 +91,7 @@ static int ptr_compare(size_t *compare_length, uchar **a, uchar **b)
size_t length= *compare_length;
uchar *first,*last;
+ DBUG_ASSERT(length > 0);
first= *a; last= *b;
while (--length)
{
diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c
index d0bb2f1ef4c..9d917d3dd59 100644
--- a/mysys/thr_alarm.c
+++ b/mysys/thr_alarm.c
@@ -694,7 +694,7 @@ static void *test_thread(void *arg)
thread_count--;
mysql_cond_signal(&COND_thread_count); /* Tell main we are ready */
mysql_mutex_unlock(&LOCK_thread_count);
- free((uchar*) arg);
+ my_thread_end();
return 0;
}
@@ -771,7 +771,7 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
{
pthread_t tid;
pthread_attr_t thr_attr;
- int i,*param,error;
+ int i, param[2], error;
sigset_t set;
ALARM_INFO alarm_info;
MY_INIT(argv[0]);
@@ -815,12 +815,11 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
printf("Main thread: %s\n",my_thread_name());
for (i=0 ; i < 2 ; i++)
{
- param=(int*) malloc(sizeof(int));
- *param= i;
+ param[i]= i;
mysql_mutex_lock(&LOCK_thread_count);
if ((error= mysql_thread_create(0,
&tid, &thr_attr, test_thread,
- (void*) param)))
+ (void*) &param[i])))
{
printf("Can't create thread %d, error: %d\n",i,error);
exit(1);
@@ -851,6 +850,9 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
alarm_info.active_alarms, alarm_info.max_used_alarms,
alarm_info.next_alarm_time);
printf("Test succeeded\n");
+ mysql_cond_destroy(&COND_thread_count);
+ mysql_mutex_destroy(&LOCK_thread_count);
+ my_end(MY_CHECK_ERROR);
return 0;
}
diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c
index 37dad48396a..8990cbd5a14 100644
--- a/mysys/thr_lock.c
+++ b/mysys/thr_lock.c
@@ -345,15 +345,14 @@ static void check_locks(THR_LOCK *lock, const char *where,
"Warning at '%s': Write lock %d waiting while no exclusive read locks\n",where,(int) lock->write_wait.data->type);
DBUG_PRINT("warning", ("Warning at '%s': Write lock %d waiting while no exclusive read locks",where,(int) lock->write_wait.data->type));
}
- }
+ }
}
else
{
/* We have at least one write lock */
if (lock->write.data->type == TL_WRITE_CONCURRENT_INSERT)
{
- THR_LOCK_DATA *data;
- uint count= 0;
+ count= 0;
for (data=lock->write.data->next;
data && count < MAX_LOCKS;
data=data->next)
@@ -386,7 +385,6 @@ static void check_locks(THR_LOCK *lock, const char *where,
}
if (lock->read.data)
{
- THR_LOCK_DATA *data;
for (data=lock->read.data ; data ; data=data->next)
{
if (!thr_lock_owner_equal(lock->write.data->owner,
@@ -1851,7 +1849,7 @@ static void *test_thread(void *arg)
thread_count--;
mysql_cond_signal(&COND_thread_count); /* Tell main we are ready */
mysql_mutex_unlock(&LOCK_thread_count);
- free((uchar*) arg);
+ my_thread_end();
return 0;
}
@@ -1860,7 +1858,7 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
{
pthread_t tid;
pthread_attr_t thr_attr;
- int *param,error;
+ int param[array_elements(lock_counts)], error;
uint i;
MY_INIT(argv[0]);
if (argc > 1 && argv[1][0] == '-' && argv[1][1] == '#')
@@ -1916,8 +1914,7 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
#endif
for (i=0 ; i < array_elements(lock_counts) ; i++)
{
- param=(int*) malloc(sizeof(int));
- *param=i;
+ param[i]= i;
if ((error= mysql_mutex_lock(&LOCK_thread_count)))
{
@@ -1927,7 +1924,7 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
}
if ((error= mysql_thread_create(0,
&tid, &thr_attr, test_thread,
- (void*) param)))
+ (void*) &param[i])))
{
fprintf(stderr, "Got error: %d from mysql_thread_create (errno: %d)\n",
error, errno);
@@ -1956,6 +1953,9 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
else
#endif
printf("Test succeeded\n");
+ mysql_cond_destroy(&COND_thread_count);
+ mysql_mutex_destroy(&LOCK_thread_count);
+ my_end(MY_CHECK_ERROR);
return 0;
}
diff --git a/mysys_ssl/my_crypt.cc b/mysys_ssl/my_crypt.cc
index 9f37883a9b8..1e76b34a1fb 100644
--- a/mysys_ssl/my_crypt.cc
+++ b/mysys_ssl/my_crypt.cc
@@ -16,199 +16,115 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include <my_global.h>
+#include <string.h>
#include <my_crypt.h>
#ifdef HAVE_YASSL
-#include "aes.hpp"
-
-typedef TaoCrypt::CipherDir Dir;
-static const Dir CRYPT_ENCRYPT = TaoCrypt::ENCRYPTION;
-static const Dir CRYPT_DECRYPT = TaoCrypt::DECRYPTION;
-
-typedef TaoCrypt::Mode CipherMode;
-static inline CipherMode aes_ecb(uint) { return TaoCrypt::ECB; }
-static inline CipherMode aes_cbc(uint) { return TaoCrypt::CBC; }
-
-typedef TaoCrypt::byte KeyByte;
-
+#include "yassl.cc"
#else
+
#include <openssl/evp.h>
#include <openssl/aes.h>
#include <openssl/err.h>
-typedef int Dir;
-static const Dir CRYPT_ENCRYPT = 1;
-static const Dir CRYPT_DECRYPT = 0;
-
-typedef const EVP_CIPHER *CipherMode;
-
-#define make_aes_dispatcher(mode) \
- static inline CipherMode aes_ ## mode(uint key_length) \
- { \
- switch (key_length) { \
- case 16: return EVP_aes_128_ ## mode(); \
- case 24: return EVP_aes_192_ ## mode(); \
- case 32: return EVP_aes_256_ ## mode(); \
- default: return 0; \
- } \
- }
-
-make_aes_dispatcher(ecb)
-make_aes_dispatcher(cbc)
-
-typedef uchar KeyByte;
-
-struct MyCTX : EVP_CIPHER_CTX {
- MyCTX() { EVP_CIPHER_CTX_init(this); }
- ~MyCTX() { EVP_CIPHER_CTX_cleanup(this); ERR_remove_state(0); }
-};
#endif
-static int block_crypt(CipherMode cipher, Dir dir,
- const uchar* source, uint source_length,
- uchar* dest, uint* dest_length,
- const KeyByte *key, uint key_length,
- const KeyByte *iv, uint iv_length, int no_padding)
+class MyCTX
{
- int tail= source_length % MY_AES_BLOCK_SIZE;
+public:
+ EVP_CIPHER_CTX ctx;
+ MyCTX() { EVP_CIPHER_CTX_init(&ctx); }
+ virtual ~MyCTX() { EVP_CIPHER_CTX_cleanup(&ctx); ERR_remove_state(0); }
- if (likely(source_length >= MY_AES_BLOCK_SIZE || !no_padding))
+ virtual int init(const EVP_CIPHER *cipher, int encrypt, const uchar *key,
+ uint klen, const uchar *iv, uint ivlen)
{
-#ifdef HAVE_YASSL
- TaoCrypt::AES ctx(dir, cipher);
-
- if (unlikely(key_length != 16 && key_length != 24 && key_length != 32))
- return MY_AES_BAD_KEYSIZE;
-
- ctx.SetKey(key, key_length);
- if (iv)
- {
- ctx.SetIV(iv);
- DBUG_ASSERT(TaoCrypt::AES::BLOCK_SIZE <= iv_length);
- }
- DBUG_ASSERT(TaoCrypt::AES::BLOCK_SIZE == MY_AES_BLOCK_SIZE);
-
- ctx.Process(dest, source, source_length - tail);
- *dest_length= source_length - tail;
-
- /* unlike OpenSSL, YaSSL doesn't support PKCS#7 padding */
- if (!no_padding)
- {
- if (dir == CRYPT_ENCRYPT)
- {
- uchar buf[MY_AES_BLOCK_SIZE];
- memcpy(buf, source + source_length - tail, tail);
- memset(buf + tail, MY_AES_BLOCK_SIZE - tail, MY_AES_BLOCK_SIZE - tail);
- ctx.Process(dest + *dest_length, buf, MY_AES_BLOCK_SIZE);
- *dest_length+= MY_AES_BLOCK_SIZE;
- }
- else
- {
- int n= dest[source_length - 1];
- if (tail || n == 0 || n > MY_AES_BLOCK_SIZE)
- return MY_AES_BAD_DATA;
- *dest_length-= n;
- }
- }
-
-#else // HAVE_OPENSSL
- int fin;
- struct MyCTX ctx;
-
if (unlikely(!cipher))
return MY_AES_BAD_KEYSIZE;
- if (!EVP_CipherInit_ex(&ctx, cipher, NULL, key, iv, dir))
+ if (!EVP_CipherInit_ex(&ctx, cipher, NULL, key, iv, encrypt))
return MY_AES_OPENSSL_ERROR;
- EVP_CIPHER_CTX_set_padding(&ctx, !no_padding);
+ DBUG_ASSERT(EVP_CIPHER_CTX_key_length(&ctx) == (int)klen);
+ DBUG_ASSERT(EVP_CIPHER_CTX_iv_length(&ctx) <= (int)ivlen);
- DBUG_ASSERT(EVP_CIPHER_CTX_key_length(&ctx) == (int)key_length);
- DBUG_ASSERT(EVP_CIPHER_CTX_iv_length(&ctx) <= (int)iv_length);
- DBUG_ASSERT(EVP_CIPHER_CTX_block_size(&ctx) == MY_AES_BLOCK_SIZE);
-
- /* use built-in OpenSSL padding, if possible */
- if (!EVP_CipherUpdate(&ctx, dest, (int*)dest_length,
- source, source_length - (no_padding ? tail : 0)))
+ return MY_AES_OK;
+ }
+ virtual int update(const uchar *src, uint slen, uchar *dst, uint *dlen)
+ {
+ if (!EVP_CipherUpdate(&ctx, dst, (int*)dlen, src, slen))
return MY_AES_OPENSSL_ERROR;
- if (!EVP_CipherFinal_ex(&ctx, dest + *dest_length, &fin))
+ return MY_AES_OK;
+ }
+ virtual int finish(uchar *dst, uint *dlen)
+ {
+ if (!EVP_CipherFinal_ex(&ctx, dst, (int*)dlen))
return MY_AES_BAD_DATA;
- *dest_length += fin;
+ return MY_AES_OK;
+ }
+};
-#endif
+class MyCTX_nopad : public MyCTX
+{
+public:
+ const uchar *key;
+ int klen;
+
+ MyCTX_nopad() : MyCTX() { }
+ ~MyCTX_nopad() { }
+
+ int init(const EVP_CIPHER *cipher, int encrypt, const uchar *key, uint klen,
+ const uchar *iv, uint ivlen)
+ {
+ compile_time_assert(MY_AES_CTX_SIZE >= sizeof(MyCTX_nopad));
+ this->key= key;
+ this->klen= klen;
+ int res= MyCTX::init(cipher, encrypt, key, klen, iv, ivlen);
+ memcpy(ctx.oiv, iv, ivlen); // in ECB mode OpenSSL doesn't do that itself
+ EVP_CIPHER_CTX_set_padding(&ctx, 0);
+ return res;
}
- if (no_padding)
+ int finish(uchar *dst, uint *dlen)
{
- if (tail)
+ if (ctx.buf_len)
{
/*
Not much we can do, block ciphers cannot encrypt data that aren't
a multiple of the block length. At least not without padding.
Let's do something CTR-like for the last partial block.
*/
-
uchar mask[MY_AES_BLOCK_SIZE];
uint mlen;
- DBUG_ASSERT(iv_length >= sizeof(mask));
- my_aes_encrypt_ecb(iv, sizeof(mask), mask, &mlen,
- key, key_length, 0, 0, 1);
+ my_aes_crypt(MY_AES_ECB, ENCRYPTION_FLAG_ENCRYPT | ENCRYPTION_FLAG_NOPAD,
+ ctx.oiv, sizeof(mask), mask, &mlen, key, klen, 0, 0);
DBUG_ASSERT(mlen == sizeof(mask));
- const uchar *s= source + source_length - tail;
- const uchar *e= source + source_length;
- uchar *d= dest + source_length - tail;
- const uchar *m= mask;
- while (s < e)
- *d++ = *s++ ^ *m++;
+ for (int i=0; i < ctx.buf_len; i++)
+ dst[i]= ctx.buf[i] ^ mask[i];
}
- *dest_length= source_length;
+ *dlen= ctx.buf_len;
+ return MY_AES_OK;
}
+};
- return MY_AES_OK;
-}
-
-C_MODE_START
+#define make_aes_dispatcher(mode) \
+ static inline const EVP_CIPHER *aes_ ## mode(uint klen) \
+ { \
+ switch (klen) { \
+ case 16: return EVP_aes_128_ ## mode(); \
+ case 24: return EVP_aes_192_ ## mode(); \
+ case 32: return EVP_aes_256_ ## mode(); \
+ default: return 0; \
+ } \
+ }
+make_aes_dispatcher(ecb)
+make_aes_dispatcher(cbc)
#ifdef HAVE_EncryptAes128Ctr
make_aes_dispatcher(ctr)
-
-/*
- special simplified implementation for CTR, because it's a stream cipher
- (doesn't need padding, always encrypts the specified number of bytes), and
- because encrypting and decrypting code is exactly the same (courtesy of XOR)
-*/
-int my_aes_encrypt_ctr(const uchar* source, uint source_length,
- uchar* dest, uint* dest_length,
- const uchar* key, uint key_length,
- const uchar* iv, uint iv_length)
-{
- CipherMode cipher= aes_ctr(key_length);
- struct MyCTX ctx;
- int fin __attribute__((unused));
-
- if (unlikely(!cipher))
- return MY_AES_BAD_KEYSIZE;
-
- if (!EVP_CipherInit_ex(&ctx, cipher, NULL, key, iv, CRYPT_ENCRYPT))
- return MY_AES_OPENSSL_ERROR;
-
- DBUG_ASSERT(EVP_CIPHER_CTX_key_length(&ctx) == (int)key_length);
- DBUG_ASSERT(EVP_CIPHER_CTX_iv_length(&ctx) <= (int)iv_length);
- DBUG_ASSERT(EVP_CIPHER_CTX_block_size(&ctx) == 1);
-
- if (!EVP_CipherUpdate(&ctx, dest, (int*)dest_length, source, source_length))
- return MY_AES_OPENSSL_ERROR;
-
- DBUG_ASSERT(EVP_CipherFinal_ex(&ctx, dest + *dest_length, &fin));
- DBUG_ASSERT(fin == 0);
-
- return MY_AES_OK;
-}
-
#endif /* HAVE_EncryptAes128Ctr */
-
#ifdef HAVE_EncryptAes128Gcm
make_aes_dispatcher(gcm)
@@ -218,145 +134,146 @@ make_aes_dispatcher(gcm)
- IV tail (over 12 bytes) goes to AAD
- the tag is appended to the ciphertext
*/
-int do_gcm(const uchar* source, uint source_length,
- uchar* dest, uint* dest_length,
- const uchar* key, uint key_length,
- const uchar* iv, uint iv_length, Dir dir)
-{
- CipherMode cipher= aes_gcm(key_length);
- struct MyCTX ctx;
- int fin;
- uint real_iv_length;
-
- if (unlikely(!cipher))
- return MY_AES_BAD_KEYSIZE;
-
- if (!EVP_CipherInit_ex(&ctx, cipher, NULL, key, iv, dir))
- return MY_AES_OPENSSL_ERROR;
- real_iv_length= EVP_CIPHER_CTX_iv_length(&ctx);
-
- DBUG_ASSERT(EVP_CIPHER_CTX_key_length(&ctx) == (int)key_length);
- DBUG_ASSERT(real_iv_length <= iv_length);
- DBUG_ASSERT(EVP_CIPHER_CTX_block_size(&ctx) == 1);
-
- if (dir == CRYPT_DECRYPT)
+class MyCTX_gcm : public MyCTX
+{
+public:
+ const uchar *aad;
+ int aadlen;
+ MyCTX_gcm() : MyCTX() { }
+ ~MyCTX_gcm() { }
+
+ int init(const EVP_CIPHER *cipher, int encrypt, const uchar *key, uint klen,
+ const uchar *iv, uint ivlen)
{
- source_length-= MY_AES_BLOCK_SIZE;
- if(!EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_GCM_SET_TAG, MY_AES_BLOCK_SIZE,
- (void*)(source + source_length)))
- return MY_AES_OPENSSL_ERROR;
+ compile_time_assert(MY_AES_CTX_SIZE >= sizeof(MyCTX_gcm));
+ int res= MyCTX::init(cipher, encrypt, key, klen, iv, ivlen);
+ int real_ivlen= EVP_CIPHER_CTX_iv_length(&ctx);
+ aad= iv + real_ivlen;
+ aadlen= ivlen - real_ivlen;
+ return res;
}
- if (real_iv_length < iv_length)
+ int update(const uchar *src, uint slen, uchar *dst, uint *dlen)
{
- if (!EVP_CipherUpdate(&ctx, NULL, &fin,
- iv + real_iv_length, iv_length - real_iv_length))
+ /*
+ note that this GCM class cannot do streaming decryption, because
+ it needs the tag (which is located at the end of encrypted data)
+ before decrypting the data. it can encrypt data piecewise, like, first
+ half, then the second half, but it must decrypt all at once
+ */
+ if (!ctx.encrypt)
+ {
+ slen-= MY_AES_BLOCK_SIZE;
+ if(!EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_GCM_SET_TAG, MY_AES_BLOCK_SIZE,
+ (void*)(src + slen)))
+ return MY_AES_OPENSSL_ERROR;
+ }
+ int unused;
+ if (aadlen && !EVP_CipherUpdate(&ctx, NULL, &unused, aad, aadlen))
return MY_AES_OPENSSL_ERROR;
+ aadlen= 0;
+ return MyCTX::update(src, slen, dst, dlen);
}
- if (!EVP_CipherUpdate(&ctx, dest, (int*)dest_length, source, source_length))
- return MY_AES_OPENSSL_ERROR;
-
- if (!EVP_CipherFinal_ex(&ctx, dest + *dest_length, &fin))
- return MY_AES_BAD_DATA;
- DBUG_ASSERT(fin == 0);
-
- if (dir == CRYPT_ENCRYPT)
+ int finish(uchar *dst, uint *dlen)
{
- if(!EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_GCM_GET_TAG, MY_AES_BLOCK_SIZE,
- dest + *dest_length))
- return MY_AES_OPENSSL_ERROR;
- *dest_length+= MY_AES_BLOCK_SIZE;
- }
-
- return MY_AES_OK;
-}
+ int fin;
+ if (!EVP_CipherFinal_ex(&ctx, dst, &fin))
+ return MY_AES_BAD_DATA;
+ DBUG_ASSERT(fin == 0);
-int my_aes_encrypt_gcm(const uchar* source, uint source_length,
- uchar* dest, uint* dest_length,
- const uchar* key, uint key_length,
- const uchar* iv, uint iv_length)
-{
- return do_gcm(source, source_length, dest, dest_length,
- key, key_length, iv, iv_length, CRYPT_ENCRYPT);
-}
+ if (ctx.encrypt)
+ {
+ if(!EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_GCM_GET_TAG, MY_AES_BLOCK_SIZE, dst))
+ return MY_AES_OPENSSL_ERROR;
+ *dlen= MY_AES_BLOCK_SIZE;
+ }
+ else
+ *dlen= 0;
+ return MY_AES_OK;
+ }
+};
-int my_aes_decrypt_gcm(const uchar* source, uint source_length,
- uchar* dest, uint* dest_length,
- const uchar* key, uint key_length,
- const uchar* iv, uint iv_length)
-{
- return do_gcm(source, source_length, dest, dest_length,
- key, key_length, iv, iv_length, CRYPT_DECRYPT);
-}
+#endif
+const EVP_CIPHER *(*ciphers[])(uint)= {
+ aes_ecb, aes_cbc
+#ifdef HAVE_EncryptAes128Ctr
+ , aes_ctr
+#ifdef HAVE_EncryptAes128Gcm
+ , aes_gcm
+#endif
#endif
+};
+
+extern "C" {
-int my_aes_encrypt_ecb(const uchar* source, uint source_length,
- uchar* dest, uint* dest_length,
- const uchar* key, uint key_length,
- const uchar* iv, uint iv_length,
- int no_padding)
+int my_aes_crypt_init(void *ctx, enum my_aes_mode mode, int flags,
+ const unsigned char* key, unsigned int klen,
+ const unsigned char* iv, unsigned int ivlen)
{
- return block_crypt(aes_ecb(key_length), CRYPT_ENCRYPT, source, source_length,
- dest, dest_length, key, key_length, iv, iv_length, no_padding);
+#ifdef HAVE_EncryptAes128Ctr
+#ifdef HAVE_EncryptAes128Gcm
+ if (mode == MY_AES_GCM)
+ if (flags & ENCRYPTION_FLAG_NOPAD)
+ return MY_AES_OPENSSL_ERROR;
+ else
+ new (ctx) MyCTX_gcm();
+ else
+#endif
+ if (mode == MY_AES_CTR)
+ new (ctx) MyCTX();
+ else
+#endif
+ if (flags & ENCRYPTION_FLAG_NOPAD)
+ new (ctx) MyCTX_nopad();
+ else
+ new (ctx) MyCTX();
+ return ((MyCTX*)ctx)->init(ciphers[mode](klen), flags & 1,
+ key, klen, iv, ivlen);
}
-int my_aes_decrypt_ecb(const uchar* source, uint source_length,
- uchar* dest, uint* dest_length,
- const uchar* key, uint key_length,
- const uchar* iv, uint iv_length,
- int no_padding)
+int my_aes_crypt_update(void *ctx, const uchar *src, uint slen,
+ uchar *dst, uint *dlen)
{
- return block_crypt(aes_ecb(key_length), CRYPT_DECRYPT, source, source_length,
- dest, dest_length, key, key_length, iv, iv_length, no_padding);
+ return ((MyCTX*)ctx)->update(src, slen, dst, dlen);
}
-int my_aes_encrypt_cbc(const uchar* source, uint source_length,
- uchar* dest, uint* dest_length,
- const uchar* key, uint key_length,
- const uchar* iv, uint iv_length,
- int no_padding)
+int my_aes_crypt_finish(void *ctx, uchar *dst, uint *dlen)
{
- return block_crypt(aes_cbc(key_length), CRYPT_ENCRYPT, source, source_length,
- dest, dest_length, key, key_length, iv, iv_length, no_padding);
+ int res= ((MyCTX*)ctx)->finish(dst, dlen);
+ ((MyCTX*)ctx)->~MyCTX();
+ return res;
}
-int my_aes_decrypt_cbc(const uchar* source, uint source_length,
- uchar* dest, uint* dest_length,
- const uchar* key, uint key_length,
- const uchar* iv, uint iv_length,
- int no_padding)
+int my_aes_crypt(enum my_aes_mode mode, int flags,
+ const uchar *src, uint slen, uchar *dst, uint *dlen,
+ const uchar *key, uint klen, const uchar *iv, uint ivlen)
{
- return block_crypt(aes_cbc(key_length), CRYPT_DECRYPT, source, source_length,
- dest, dest_length, key, key_length, iv, iv_length, no_padding);
+ void *ctx= alloca(MY_AES_CTX_SIZE);
+ int res1, res2;
+ uint d1, d2;
+ if ((res1= my_aes_crypt_init(ctx, mode, flags, key, klen, iv, ivlen)))
+ return res1;
+ res1= my_aes_crypt_update(ctx, src, slen, dst, &d1);
+ res2= my_aes_crypt_finish(ctx, dst + d1, &d2);
+ *dlen= d1 + d2;
+ return res1 ? res1 : res2;
}
-C_MODE_END
-
-#if defined(HAVE_YASSL)
-
+#ifdef HAVE_YASSL
#include <random.hpp>
-
-C_MODE_START
-
int my_random_bytes(uchar* buf, int num)
{
TaoCrypt::RandomNumberGenerator rand;
rand.GenerateBlock((TaoCrypt::byte*) buf, num);
return MY_AES_OK;
}
-
-C_MODE_END
-
-#else /* OpenSSL */
-
+#else
#include <openssl/rand.h>
-C_MODE_START
-
-int my_random_bytes(uchar* buf, int num)
+int my_random_bytes(uchar *buf, int num)
{
/*
Unfortunately RAND_bytes manual page does not provide any guarantees
@@ -364,30 +281,12 @@ int my_random_bytes(uchar* buf, int num)
instead of whatever random engine is currently set in OpenSSL. That way
we are guaranteed to have a non-blocking random.
*/
- RAND_METHOD* rand = RAND_SSLeay();
+ RAND_METHOD *rand = RAND_SSLeay();
if (rand == NULL || rand->bytes(buf, num) != 1)
return MY_AES_OPENSSL_ERROR;
return MY_AES_OK;
}
+#endif
-C_MODE_END
-#endif /* HAVE_YASSL */
-
-/**
- Get size of buffer which will be large enough for encrypted data
-
- The buffer should be sufficiently large to fit encrypted data
- independently from the encryption algorithm and mode. With padding up to
- MY_AES_BLOCK_SIZE bytes can be added. With GCM, exactly MY_AES_BLOCK_SIZE
- bytes are added.
-
- The actual length of the encrypted data is returned from the encryption
- function (e.g. from my_aes_encrypt_cbc).
-
- @return required buffer size
-*/
-
-uint my_aes_get_size(uint source_length)
-{
- return source_length + MY_AES_BLOCK_SIZE;
}
+
diff --git a/mysys_ssl/yassl.cc b/mysys_ssl/yassl.cc
new file mode 100644
index 00000000000..9717870fe26
--- /dev/null
+++ b/mysys_ssl/yassl.cc
@@ -0,0 +1,194 @@
+/*
+ Copyright (c) 2015 MariaDB Corporation
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/*
+ The very minimal subset of OpenSSL's EVP* functions.
+ Just enough for my_crypt.cc to work.
+
+ On the other hand, where it has to implement OpenSSL functionality,
+ it tries to be compatible (e.g. same flags and struct member names).
+*/
+
+#include <openssl/ssl.h>
+#include "aes.hpp"
+
+using yaSSL::yaERR_remove_state;
+
+#define EVP_CIPH_ECB_MODE 0x1
+#define EVP_CIPH_CBC_MODE 0x2
+#define EVP_CIPH_NO_PADDING 0x100
+
+/*
+ note that TaoCrypt::AES object is not explicitly put into EVP_CIPHER_CTX.
+ That's because we need to control when TaoCrypt::AES constructor and
+ destructor are called.
+*/
+typedef struct
+{
+ ulong flags;
+ int encrypt;
+ int key_len;
+ int buf_len;
+ int final_used;
+ uchar tao_buf[sizeof(TaoCrypt::AES)]; // TaoCrypt::AES object
+ uchar oiv[TaoCrypt::AES::BLOCK_SIZE]; // original IV
+ uchar buf[TaoCrypt::AES::BLOCK_SIZE]; // last partial input block
+ uchar final[TaoCrypt::AES::BLOCK_SIZE]; // last decrypted (output) block
+} EVP_CIPHER_CTX;
+
+typedef struct {
+ TaoCrypt::Mode mode;
+ TaoCrypt::word32 key_len;
+} EVP_CIPHER;
+
+#define gen_cipher(mode, MODE, len) \
+ static const EVP_CIPHER *EVP_aes_ ## len ## _ ## mode() \
+ { static const EVP_CIPHER c={TaoCrypt::MODE, len/8}; return &c; }
+
+gen_cipher(ecb,ECB,128)
+gen_cipher(ecb,ECB,192)
+gen_cipher(ecb,ECB,256)
+gen_cipher(cbc,CBC,128)
+gen_cipher(cbc,CBC,192)
+gen_cipher(cbc,CBC,256)
+
+static inline TaoCrypt::AES *TAO(EVP_CIPHER_CTX *ctx)
+{
+ return (TaoCrypt::AES *)(ctx->tao_buf);
+}
+
+static void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx)
+{
+ ctx->final_used= ctx->buf_len= ctx->flags= 0;
+}
+
+static int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *ctx)
+{
+ TAO(ctx)->~AES();
+ return 1;
+}
+
+static int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *ctx, int pad)
+{
+ if (pad)
+ ctx->flags&= ~EVP_CIPH_NO_PADDING;
+ else
+ ctx->flags|= EVP_CIPH_NO_PADDING;
+ return 1;
+}
+
+static int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
+ void *, const uchar *key, const uchar *iv, int enc)
+{
+ new (ctx->tao_buf) TaoCrypt::AES(enc ? TaoCrypt::ENCRYPTION
+ : TaoCrypt::DECRYPTION, cipher->mode);
+ TAO(ctx)->SetKey(key, cipher->key_len);
+ if (iv)
+ {
+ TAO(ctx)->SetIV(iv);
+ memcpy(ctx->oiv, iv, TaoCrypt::AES::BLOCK_SIZE);
+ }
+ ctx->encrypt= enc;
+ ctx->key_len= cipher->key_len;
+ ctx->flags|= cipher->mode == TaoCrypt::CBC ? EVP_CIPH_CBC_MODE : EVP_CIPH_ECB_MODE;
+ return 1;
+}
+
+static int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx)
+{
+ return ctx->key_len;
+}
+
+static int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx)
+{
+ return ctx->flags & EVP_CIPH_ECB_MODE ? 0 : TaoCrypt::AES::BLOCK_SIZE;
+}
+
+static void do_whole_blocks(EVP_CIPHER_CTX *ctx, uchar *out, int *outl,
+ const uchar *in, int inl)
+{
+ DBUG_ASSERT(inl);
+ DBUG_ASSERT(inl % TaoCrypt::AES::BLOCK_SIZE == 0);
+ if (ctx->encrypt || (ctx->flags & EVP_CIPH_NO_PADDING))
+ {
+ TAO(ctx)->Process(out, in, inl);
+ *outl+= inl;
+ return;
+ }
+ /* 'final' is only needed when decrypting with padding */
+ if (ctx->final_used)
+ {
+ memcpy(out, ctx->final, TaoCrypt::AES::BLOCK_SIZE);
+ *outl+= TaoCrypt::AES::BLOCK_SIZE;
+ out+= TaoCrypt::AES::BLOCK_SIZE;
+ }
+ inl-= TaoCrypt::AES::BLOCK_SIZE;
+ TAO(ctx)->Process(out, in, inl);
+ *outl+= inl;
+ TAO(ctx)->Process(ctx->final, in + inl, TaoCrypt::AES::BLOCK_SIZE);
+ ctx->final_used= 1;
+}
+
+static int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, uchar *out, int *outl,
+ const uchar *in, int inl)
+{
+ *outl= 0;
+ if (ctx->buf_len)
+ {
+ int prefixl= TaoCrypt::AES::BLOCK_SIZE - ctx->buf_len;
+ if (prefixl > inl)
+ {
+ memcpy(ctx->buf + ctx->buf_len, in, inl);
+ ctx->buf_len+= inl;
+ return 1;
+ }
+ memcpy(ctx->buf + ctx->buf_len, in, prefixl);
+ do_whole_blocks(ctx, out, outl, ctx->buf, TaoCrypt::AES::BLOCK_SIZE);
+ in+= prefixl;
+ inl-= prefixl;
+ out+= *outl;
+ }
+ ctx->buf_len= inl % TaoCrypt::AES::BLOCK_SIZE;
+ inl-= ctx->buf_len;
+ memcpy(ctx->buf, in + inl, ctx->buf_len);
+ if (inl)
+ do_whole_blocks(ctx, out, outl, in, inl);
+ return 1;
+}
+
+static int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, uchar *out, int *outl)
+{
+ if (ctx->flags & EVP_CIPH_NO_PADDING)
+ return ctx->buf_len == 0;
+
+ // PKCS#7 padding
+ *outl= 0;
+ if (ctx->encrypt)
+ {
+ int v= TaoCrypt::AES::BLOCK_SIZE - ctx->buf_len;
+ memset(ctx->buf + ctx->buf_len, v, v);
+ do_whole_blocks(ctx, out, outl, ctx->buf, TaoCrypt::AES::BLOCK_SIZE);
+ return 1;
+ }
+ int n= ctx->final[TaoCrypt::AES::BLOCK_SIZE - 1];
+ if (ctx->buf_len || !ctx->final_used ||
+ n < 1 || n > TaoCrypt::AES::BLOCK_SIZE)
+ return 0;
+ *outl= TaoCrypt::AES::BLOCK_SIZE - n;
+ memcpy(out, ctx->final, *outl);
+ return 1;
+}
+
diff --git a/packaging/WiX/AdminBackground.jpg b/packaging/WiX/AdminBackground.jpg
deleted file mode 100644
index 847dc6cdbed..00000000000
--- a/packaging/WiX/AdminBackground.jpg
+++ /dev/null
Binary files differ
diff --git a/packaging/WiX/AdminHeader.jpg b/packaging/WiX/AdminHeader.jpg
deleted file mode 100644
index 6e2e33d404f..00000000000
--- a/packaging/WiX/AdminHeader.jpg
+++ /dev/null
Binary files differ
diff --git a/packaging/WiX/CMakeLists.txt b/packaging/WiX/CMakeLists.txt
deleted file mode 100644
index a5970703720..00000000000
--- a/packaging/WiX/CMakeLists.txt
+++ /dev/null
@@ -1,119 +0,0 @@
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-IF(NOT WIN32)
- RETURN()
-ENDIF()
-
-FIND_PATH(WIX_DIR heat.exe
- $ENV{WIX_DIR}/bin
- $ENV{ProgramFiles}/wix/bin
- "$ENV{ProgramFiles}/Windows Installer XML v3/bin"
- "$ENV{ProgramFiles}/Windows Installer XML v3.5/bin"
-)
-
-IF(NOT WIX_DIR)
- IF(NOT _WIX_DIR_CHECKED)
- SET(_WIX_DIR_CHECKED 1 CACHE INTERNAL "")
- MESSAGE(STATUS "Cannot find wix 3, installer project will not be generated")
- ENDIF()
- RETURN()
-ENDIF()
-
-ADD_SUBDIRECTORY(ca)
-
-# extra.wxs.in needs DATADIR_MYSQL_FILES and DATADIR_PERFORMANCE_SCHEMA_FILES, i.e
-# Wix-compatible file lists for ${builddir}\sql\data\{mysql,performance_schema}
-
-FOREACH(dir mysql performance_schema)
- FILE(GLOB files ${CMAKE_BINARY_DIR}/sql/data/${dir}/*)
- SET(filelist)
- FOREACH(f ${files})
- IF(NOT f MATCHES ".rule")
- FILE(TO_NATIVE_PATH "${f}" file_native_path)
- GET_FILENAME_COMPONENT(file_name "${f}" NAME)
- SET(filelist
-"${filelist}
-<File Id='${file_name}' Source='${file_native_path}'/>")
- ENDIF()
- ENDFOREACH()
- STRING(TOUPPER ${dir} DIR_UPPER)
- SET(DATADIR_${DIR_UPPER}_FILES "${filelist}")
-ENDFOREACH()
-
-
-FIND_PROGRAM(HEAT_EXECUTABLE heat ${WIX_DIR})
-FIND_PROGRAM(CANDLE_EXECUTABLE candle ${WIX_DIR})
-FIND_PROGRAM(LIGHT_EXECUTABLE light ${WIX_DIR})
-
-# WiX wants the license text as rtf; if there is no rtf license,
-# we create a fake one from the plain text COPYING file.
-IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.rtf")
- SET(COPYING_RTF "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.rtf")
-ELSE()
- IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../LICENSE.mysql")
- SET(LICENSE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../../LICENSE.mysql")
- ELSE()
- SET(LICENSE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../../COPYING")
- ENDIF()
- FILE(READ ${LICENSE_FILE} CONTENTS)
- STRING(REGEX REPLACE "\n" "\\\\par\n" CONTENTS "${CONTENTS}")
- STRING(REGEX REPLACE "\t" "\\\\tab" CONTENTS "${CONTENTS}")
- FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf" "{\\rtf1\\ansi\\deff0{\\fonttbl{\\f0\\fnil\\fcharset0 Courier New;}}\\viewkind4\\uc1\\pard\\lang1031\\f0\\fs15")
- FILE(APPEND "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf" "${CONTENTS}")
- FILE(APPEND "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf" "\n}\n")
- SET(COPYING_RTF "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf")
-ENDIF()
-GET_TARGET_PROPERTY(WIXCA_LOCATION wixca LOCATION)
-SET(CPACK_WIX_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/CPackWixConfig.cmake)
-SET(CPACK_WIX_INCLUDE "${CMAKE_CURRENT_BINARY_DIR}/extra.wxs;${CMAKE_CURRENT_SOURCE_DIR}/custom_ui.wxs")
-
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/create_msi.cmake.in
- ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake
- @ONLY)
-
-
-IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
- SET(WixWin64 " Win64='yes'")
-ELSE()
- SET(WixWin64)
-ENDIF()
-
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/extra.wxs.in
- ${CMAKE_CURRENT_BINARY_DIR}/extra.wxs)
-
-IF(CMAKE_GENERATOR MATCHES "Visual Studio")
- SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_CFG_INTDIR}")
-ENDIF()
-
-
-ADD_CUSTOM_TARGET(
- MSI
- COMMAND set VS_UNICODE_OUTPUT=
- COMMAND ${CMAKE_COMMAND}
- ${CONFIG_PARAM}
- -P ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake
-)
-ADD_DEPENDENCIES(MSI wixca)
-
-ADD_CUSTOM_TARGET(
- MSI_ESSENTIALS
- COMMAND set VS_UNICODE_OUTPUT=
- COMMAND ${CMAKE_COMMAND} -DESSENTIALS=1
- ${CONFIG_PARAM}
- -P ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake
-)
-ADD_DEPENDENCIES(MSI_ESSENTIALS wixca)
-
diff --git a/packaging/WiX/CPackWixConfig.cmake b/packaging/WiX/CPackWixConfig.cmake
deleted file mode 100644
index c782b7cd17a..00000000000
--- a/packaging/WiX/CPackWixConfig.cmake
+++ /dev/null
@@ -1,119 +0,0 @@
-# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-IF(ESSENTIALS)
- SET(CPACK_COMPONENTS_USED "Server;Client;DataFiles")
- SET(CPACK_WIX_UI "WixUI_InstallDir")
- IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
- SET(CPACK_PACKAGE_FILE_NAME "mysql-essential-${VERSION}-winx64")
- ELSE()
- SET(CPACK_PACKAGE_FILE_NAME "mysql-essential-${VERSION}-win32")
- ENDIF()
-ELSE()
- SET(CPACK_COMPONENTS_USED
- "Server;Client;DataFiles;Development;SharedLibraries;Documentation;IniFiles;Readme;Server_Scripts;DebugBinaries")
-ENDIF()
-
-
-# Some components like Embedded are optional
-# We will build MSI without embedded if it was not selected for build
-#(need to modify CPACK_COMPONENTS_ALL for that)
-SET(CPACK_ALL)
-FOREACH(comp1 ${CPACK_COMPONENTS_USED})
- SET(found)
- FOREACH(comp2 ${CPACK_COMPONENTS_ALL})
- IF(comp1 STREQUAL comp2)
- SET(found 1)
- BREAK()
- ENDIF()
- ENDFOREACH()
- IF(found)
- SET(CPACK_ALL ${CPACK_ALL} ${comp1})
- ENDIF()
-ENDFOREACH()
-SET(CPACK_COMPONENTS_ALL ${CPACK_ALL})
-
-# Always install (hidden), includes Readme files
-SET(CPACK_COMPONENT_GROUP_ALWAYSINSTALL_HIDDEN 1)
-SET(CPACK_COMPONENT_README_GROUP "AlwaysInstall")
-
-# Feature MySQL Server
-SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DISPLAY_NAME "MySQL Server")
-SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_EXPANDED "1")
-SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DESCRIPTION "Install MySQL Server")
- # Subfeature "Server" (hidden)
- SET(CPACK_COMPONENT_SERVER_GROUP "MySQLServer")
- SET(CPACK_COMPONENT_SERVER_HIDDEN 1)
- # Subfeature "Client"
- SET(CPACK_COMPONENT_CLIENT_GROUP "MySQLServer")
- SET(CPACK_COMPONENT_CLIENT_DISPLAY_NAME "Client Programs")
- SET(CPACK_COMPONENT_CLIENT_DESCRIPTION
- "Various helpful (commandline) tools including the mysql command line client" )
- # Subfeature "Debug binaries"
- SET(CPACK_COMPONENT_DEBUGBINARIES_GROUP "MySQLServer")
- SET(CPACK_COMPONENT_DEBUGBINARIES_DISPLAY_NAME "Debug binaries")
- SET(CPACK_COMPONENT_DEBUGBINARIES_DESCRIPTION
- "Debug/trace versions of executables and libraries" )
- #SET(CPACK_COMPONENT_DEBUGBINARIES_WIX_LEVEL 2)
-
-
- #Subfeature "Data Files"
- SET(CPACK_COMPONENT_DATAFILES_GROUP "MySQLServer")
- SET(CPACK_COMPONENT_DATAFILES_DISPLAY_NAME "Server data files")
- SET(CPACK_COMPONENT_DATAFILES_DESCRIPTION "Server data files" )
- SET(CPACK_COMPONENT_DATAFILES_HIDDEN 1)
-
-
-#Feature "Devel"
-SET(CPACK_COMPONENT_GROUP_DEVEL_DISPLAY_NAME "Development Components")
-SET(CPACK_COMPONENT_GROUP_DEVEL_DESCRIPTION "Installs C/C++ header files and libraries")
- #Subfeature "Development"
- SET(CPACK_COMPONENT_DEVELOPMENT_GROUP "Devel")
- SET(CPACK_COMPONENT_DEVELOPMENT_HIDDEN 1)
-
- #Subfeature "Shared libraries"
- SET(CPACK_COMPONENT_SHAREDLIBRARIES_GROUP "Devel")
- SET(CPACK_COMPONENT_SHAREDLIBRARIES_DISPLAY_NAME "Client C API library (shared)")
- SET(CPACK_COMPONENT_SHAREDLIBRARIES_DESCRIPTION "Installs shared client library")
-
- #Subfeature "Embedded"
- SET(CPACK_COMPONENT_EMBEDDED_GROUP "Devel")
- SET(CPACK_COMPONENT_EMBEDDED_DISPLAY_NAME "Embedded server library")
- SET(CPACK_COMPONENT_EMBEDDED_DESCRIPTION "Installs embedded server library")
- SET(CPACK_COMPONENT_EMBEDDED_WIX_LEVEL 2)
-
-#Feature Debug Symbols
-SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_DISPLAY_NAME "Debug Symbols")
-SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_DESCRIPTION "Installs Debug Symbols")
-SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_WIX_LEVEL 2)
- SET(CPACK_COMPONENT_DEBUGINFO_GROUP "DebugSymbols")
- SET(CPACK_COMPONENT_DEBUGINFO_HIDDEN 1)
-
-#Feature Documentation
-SET(CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME "Documentation")
-SET(CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION "Installs documentation")
-SET(CPACK_COMPONENT_DOCUMENTATION_WIX_LEVEL 2)
-
-#Feature tests
-SET(CPACK_COMPONENT_TEST_DISPLAY_NAME "Tests")
-SET(CPACK_COMPONENT_TEST_DESCRIPTION "Installs unittests (requires Perl to run)")
-SET(CPACK_COMPONENT_TEST_WIX_LEVEL 2)
-
-
-#Feature Misc (hidden, installs only if everything is installed)
-SET(CPACK_COMPONENT_GROUP_MISC_HIDDEN 1)
-SET(CPACK_COMPONENT_GROUP_MISC_WIX_LEVEL 100)
- SET(CPACK_COMPONENT_INIFILES_GROUP "Misc")
- SET(CPACK_COMPONENT_SERVER_SCRIPTS_GROUP "Misc")
diff --git a/packaging/WiX/MySQLServer.ico b/packaging/WiX/MySQLServer.ico
deleted file mode 100644
index a471afcda95..00000000000
--- a/packaging/WiX/MySQLServer.ico
+++ /dev/null
Binary files differ
diff --git a/packaging/WiX/ca/CMakeLists.txt b/packaging/WiX/ca/CMakeLists.txt
deleted file mode 100644
index 81622a1d158..00000000000
--- a/packaging/WiX/ca/CMakeLists.txt
+++ /dev/null
@@ -1,55 +0,0 @@
-# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-INCLUDE_DIRECTORIES(${WIX_DIR}/../SDK/inc ${WIX_DIR}/SDK/inc)
-LINK_DIRECTORIES(${WIX_DIR}/../SDK/lib ${WIX_DIR}/SDK/lib)
-
-SET(WIXCA_SOURCES CustomAction.cpp CustomAction.def)
-
-IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
- SET(WIX_ARCH_SUFFIX "_x64")
-ELSE()
- SET(WIX_ARCH_SUFFIX)
-ENDIF()
-
-IF(MSVC_VERSION EQUAL 1400)
- SET(WIX35_MSVC_SUFFIX "_2005")
-ELSEIF(MSVC_VERSION EQUAL 1500)
- SET(WIX35_MSVC_SUFFIX "_2008")
-ELSEIF(MSVC_VERSION EQUAL 1600)
- SET(WIX35_MSVC_SUFFIX "_2010")
-ELSE()
- # When next VS is out, add the correct version here
- MESSAGE(FATAL_ERROR "Unknown VS version")
-ENDIF()
-
-MESSAGE(STATUS "Searching for wcautil${WIX_ARCH_SUFFIX} or wcautil${WIX35_MSVC_SUFFIX}${WIX_ARCH_SUFFIX} in ${WIX_DIR}/../SDK/lib ${WIX_DIR}/SDK/lib")
-MESSAGE(STATUS "Searching for dutil${WIX_ARCH_SUFFIX} or dutil${WIX35_MSVC_SUFFIX}${WIX_ARCH_SUFFIX} in ${WIX_DIR}/../SDK/lib ${WIX_DIR}/SDK/lib")
-
-FIND_LIBRARY(WIX_WCAUTIL_LIBRARY
- NAMES wcautil${WIX_ARCH_SUFFIX} wcautil${WIX35_MSVC_SUFFIX}${WIX_ARCH_SUFFIX}
- HINTS ${WIX_DIR}/../SDK/lib ${WIX_DIR}/SDK/lib)
-
-FIND_LIBRARY(WIX_DUTIL_LIBRARY
- NAMES dutil${WIX_ARCH_SUFFIX} dutil${WIX35_MSVC_SUFFIX}${WIX_ARCH_SUFFIX}
- PATHS ${WIX_DIR}/../SDK/lib ${WIX_DIR}/SDK/lib)
-
-MESSAGE(STATUS "Found: ${WIX_WCAUTIL_LIBRARY}")
-MESSAGE(STATUS "Found: ${WIX_DUTIL_LIBRARY}")
-
-ADD_VERSION_INFO(wixca SHARED WIXCA_SOURCES)
-ADD_LIBRARY(wixca SHARED EXCLUDE_FROM_ALL ${WIXCA_SOURCES})
-TARGET_LINK_LIBRARIES(wixca ${WIX_WCAUTIL_LIBRARY} ${WIX_DUTIL_LIBRARY}
- msi version )
diff --git a/packaging/WiX/ca/CustomAction.cpp b/packaging/WiX/ca/CustomAction.cpp
deleted file mode 100644
index 444e003c3f2..00000000000
--- a/packaging/WiX/ca/CustomAction.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-
-#ifndef UNICODE
-#define UNICODE
-#endif
-
-#include <windows.h>
-#include <winreg.h>
-#include <msi.h>
-#include <msiquery.h>
-#include <wcautil.h>
-#include <string.h>
-#include <strsafe.h>
-
-/*
- * Search the registry for a service whose ImagePath starts
- * with our install directory. Stop and remove it if requested.
- */
-static TCHAR last_service_name[128];
-int remove_service(TCHAR *installdir, int check_only) {
- HKEY hKey;
- int done = 0;
-
- if(wcslen(installdir) < 3) {
- WcaLog(LOGMSG_STANDARD, "INSTALLDIR is suspiciously short, better not do anything.");
- return 0;
- }
-
- if(check_only == 0) {
- WcaLog(LOGMSG_STANDARD, "Determining number of matching services...");
- int servicecount = remove_service(installdir, 1);
- if(servicecount <= 0) {
- WcaLog(LOGMSG_STANDARD, "No services found, not removing anything.");
- return 0;
- } else if(servicecount == 1) {
- TCHAR buf[256];
- swprintf_s(buf, sizeof(buf), TEXT("There is a service called '%ls' set up to run from this installation. Do you wish me to stop and remove that service?"), last_service_name);
- int rc = MessageBox(NULL, buf, TEXT("Removing MySQL Server"), MB_ICONQUESTION|MB_YESNOCANCEL|MB_SYSTEMMODAL);
- if(rc == IDCANCEL) return -1;
- if(rc != IDYES) return 0;
- } else if(servicecount > 0) {
- TCHAR buf[256];
- swprintf_s(buf, sizeof(buf), TEXT("There appear to be %d services set up to run from this installation. Do you wish me to stop and remove those services?"), servicecount);
- int rc = MessageBox(NULL, buf, TEXT("Removing MySQL Server"), MB_ICONQUESTION|MB_YESNOCANCEL|MB_SYSTEMMODAL);
- if(rc == IDCANCEL) return -1;
- if(rc != IDYES) return 0;
- }
- }
-
- if(check_only == -1) check_only = 0;
-
- WcaLog(LOGMSG_STANDARD, "Looking for service...");
- WcaLog(LOGMSG_STANDARD, "INSTALLDIR = %ls", installdir);
- if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\services"), 0, KEY_READ, &hKey)==ERROR_SUCCESS) {
- DWORD index = 0;
- TCHAR keyname[1024];
- DWORD keylen = sizeof(keyname);
- FILETIME t;
- /* Go through all services in the registry */
- while(RegEnumKeyExW(hKey, index, keyname, &keylen, NULL, NULL, NULL, &t) == ERROR_SUCCESS) {
- HKEY hServiceKey = 0;
- TCHAR path[1024];
- DWORD pathlen = sizeof(path)-1;
- if (RegOpenKeyExW(hKey, keyname, NULL, KEY_READ, &hServiceKey) == ERROR_SUCCESS) {
- /* Look at the ImagePath value of each service */
- if (RegQueryValueExW(hServiceKey, TEXT("ImagePath"), NULL, NULL, (LPBYTE)path, &pathlen) == ERROR_SUCCESS) {
- path[pathlen] = 0;
- TCHAR *p = path;
- if(p[0] == '"') p += 1;
- /* See if it is similar to our install directory */
- if(wcsncmp(p, installdir, wcslen(installdir)) == 0) {
- WcaLog(LOGMSG_STANDARD, "Found service '%ls' with ImagePath '%ls'.", keyname, path);
- swprintf_s(last_service_name, sizeof(last_service_name), TEXT("%ls"), keyname);
- /* If we are supposed to stop and remove the service... */
- if(!check_only) {
- WcaLog(LOGMSG_STANDARD, "Trying to stop the service.");
- SC_HANDLE hSCM = NULL;
- hSCM = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
- if(hSCM != NULL) {
- SC_HANDLE hService = NULL;
- hService = OpenService(hSCM, keyname, SERVICE_STOP|SERVICE_QUERY_STATUS|DELETE);
- if(hService != NULL) {
- WcaLog(LOGMSG_STANDARD, "Waiting for the service to stop...");
- SERVICE_STATUS status;
- /* Attempt to stop the service */
- if(ControlService(hService, SERVICE_CONTROL_STOP, &status)) {
- /* Now wait until it's stopped */
- while("it's one big, mean and cruel world out there") {
- if(!QueryServiceStatus(hService, &status)) break;
- if(status.dwCurrentState == SERVICE_STOPPED) break;
- Sleep(1000);
- }
- WcaLog(LOGMSG_STANDARD, "Stopped the service.");
- }
- /* Mark the service for deletion */
- DeleteService(hService);
- CloseServiceHandle(hService);
- }
- CloseServiceHandle(hSCM);
- }
- }
- done++;
- }
- }
- RegCloseKey(hServiceKey);
- }
- index++;
- keylen = sizeof(keyname)-1;
- }
- RegCloseKey(hKey);
- } else {
- WcaLog(LOGMSG_STANDARD, "Can't seem to go through the list of installed services in the registry.");
- }
- return done;
-}
-
-UINT wrap(MSIHANDLE hInstall, char *name, int check_only) {
- HRESULT hr = S_OK;
- UINT er = ERROR_SUCCESS;
-
- hr = WcaInitialize(hInstall, name);
- ExitOnFailure(hr, "Failed to initialize");
-
- WcaLog(LOGMSG_STANDARD, "Initialized.");
-
- TCHAR INSTALLDIR[1024];
- DWORD INSTALLDIR_size = sizeof(INSTALLDIR);
- if(MsiGetPropertyW(hInstall, TEXT("CustomActionData"), INSTALLDIR, &INSTALLDIR_size) == ERROR_SUCCESS) {
- int rc = remove_service(INSTALLDIR, check_only);
- if(rc < 0) {
- er = ERROR_CANCELLED;
- }
- } else {
- er = ERROR_CANT_ACCESS_FILE;
- }
-
-LExit:
- return WcaFinalize(er);
-}
-
-UINT __stdcall RemoveServiceNoninteractive(MSIHANDLE hInstall)
-{
- return wrap(hInstall, "RemoveServiceNoninteractive", -1);
-}
-
-UINT __stdcall RemoveService(MSIHANDLE hInstall)
-{
- return wrap(hInstall, "RemoveService", 0);
-}
-
-UINT __stdcall TestService(MSIHANDLE hInstall)
-{
- return wrap(hInstall, "TestService", 1);
-}
-
-/* DllMain - Initialize and cleanup WiX custom action utils */
-extern "C" BOOL WINAPI DllMain(
- __in HINSTANCE hInst,
- __in ULONG ulReason,
- __in LPVOID
- )
-{
- switch(ulReason)
- {
- case DLL_PROCESS_ATTACH:
- WcaGlobalInitialize(hInst);
- break;
-
- case DLL_PROCESS_DETACH:
- WcaGlobalFinalize();
- break;
- }
-
- return TRUE;
-}
diff --git a/packaging/WiX/ca/CustomAction.def b/packaging/WiX/ca/CustomAction.def
deleted file mode 100644
index 5f5e6630013..00000000000
--- a/packaging/WiX/ca/CustomAction.def
+++ /dev/null
@@ -1,8 +0,0 @@
-LIBRARY "wixca"
-VERSION 1.0
-
-EXPORTS
-
-RemoveService
-RemoveServiceNoninteractive
-TestService
diff --git a/packaging/WiX/create_msi.cmake.in b/packaging/WiX/create_msi.cmake.in
deleted file mode 100644
index 8de271fc1cf..00000000000
--- a/packaging/WiX/create_msi.cmake.in
+++ /dev/null
@@ -1,398 +0,0 @@
-# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@")
-SET(CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
-SET(CANDLE_EXECUTABLE "@CANDLE_EXECUTABLE@")
-SET(LIGHT_EXECUTABLE "@LIGHT_EXECUTABLE@")
-SET(CMAKE_COMMAND "@CMAKE_COMMAND@")
-SET(CMAKE_CFG_INTDIR "@CMAKE_CFG_INTDIR@")
-SET(VERSION "@VERSION@")
-SET(MAJOR_VERSION "@MAJOR_VERSION@")
-SET(MINOR_VERSION "@MINOR_VERSION@")
-SET(PATCH_VERSION "@PATCH_VERSION@")
-SET(CMAKE_SIZEOF_VOID_P @CMAKE_SIZEOF_VOID_P@)
-SET(MANUFACTURER "@MANUFACTURER@")
-SET(WIXCA_LOCATION "@WIXCA_LOCATION@")
-SET(COPYING_RTF "@COPYING_RTF@")
-SET(CPACK_WIX_CONFIG "@CPACK_WIX_CONFIG@")
-SET(CPACK_WIX_INCLUDE "@CPACK_WIX_INCLUDE@")
-
-LIST(APPEND EXCLUDE_DIRS
- bin/debug
- data/test
- lib/plugin/debug
- mysql-test
- scripts
- sql-bench
-)
-
-LIST(APPEND EXCLUDE_FILES
- bin/echo.exe
- bin/mysql_client_test_embedded.exe
- bin/mysqld-debug.exe
- bin/mysqltest_embedded.exe
- bin/replace.exe
- lib/debug/mysqlserver.lib
- lib/libmysqld.dll
- lib/libmysqld.lib
- lib/mysqlserver.lib
- lib/mysqlservices.lib
-)
-
-IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
- SET(Win64 " Win64='yes'")
- SET(Platform x64)
- SET(PlatformProgramFilesFolder ProgramFiles64Folder)
-ELSE()
- SET(Platform x86)
- SET(PlatformProgramFilesFolder ProgramFilesFolder)
- SET(Win64)
-ENDIF()
-
-SET(ENV{VS_UNICODE_OUTPUT})
-
-# Switch off the monolithic install
-EXECUTE_PROCESS(
- COMMAND ${CMAKE_COMMAND} -DCPACK_MONOLITHIC_INSTALL=0 ${CMAKE_BINARY_DIR}
- OUTPUT_QUIET
-)
-
-INCLUDE(${CMAKE_BINARY_DIR}/CPackConfig.cmake)
-
-IF(CPACK_WIX_CONFIG)
- INCLUDE(${CPACK_WIX_CONFIG})
-ENDIF()
-
-IF(NOT CPACK_WIX_UI)
- SET(CPACK_WIX_UI "WixUI_Mondo_Custom")
-ENDIF()
-
-SET(WIX_FEATURES)
-FOREACH(comp ${CPACK_COMPONENTS_ALL})
- STRING(TOUPPER "${comp}" comp_upper)
- IF(NOT CPACK_COMPONENT_${comp_upper}_GROUP)
- SET(WIX_FEATURE_${comp_upper}_COMPONENTS "${comp}")
- SET(CPACK_COMPONENT_${comp_upper}_HIDDEN 1)
- SET(CPACK_COMPONENT_GROUP_${comp_upper}_DISPLAY_NAME ${CPACK_COMPONENT_${comp_upper}_DISPLAY_NAME})
- SET(CPACK_COMPONENT_GROUP_${comp_upper}_DESCRIPTION ${CPACK_COMPONENT_${comp_upper}_DESCRIPTION})
- SET(CPACK_COMPONENT_GROUP_${comp_upper}_WIX_LEVEL ${CPACK_COMPONENT_${comp_upper}_WIX_LEVEL})
- SET(WIX_FEATURES ${WIX_FEATURES} WIX_FEATURE_${comp_upper})
- ELSE()
- SET(FEATURE_NAME WIX_FEATURE_${CPACK_COMPONENT_${comp_upper}_GROUP})
- SET(WIX_FEATURES ${WIX_FEATURES} ${FEATURE_NAME})
- LIST(APPEND ${FEATURE_NAME}_COMPONENTS ${comp})
- ENDIF()
-ENDFOREACH()
-
-LIST(REMOVE_DUPLICATES WIX_FEATURES)
-
-SET(CPACK_WIX_FEATURES)
-
-FOREACH(f ${WIX_FEATURES})
- STRING(TOUPPER "${f}" f_upper)
- STRING(REPLACE "WIX_FEATURE_" "" f_upper ${f_upper})
- IF (CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
- SET(TITLE ${CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME})
- ELSE()
- SET(TITLE CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
- ENDIF()
-
- IF (CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
- SET(DESCRIPTION ${CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION})
- ELSE()
- SET(DESCRIPTION CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
- ENDIF()
- IF(CPACK_COMPONENT_${f_upper}_WIX_LEVEL)
- SET(Level ${CPACK_COMPONENT_${f_upper}_WIX_LEVEL})
- ELSE()
- SET(Level 1)
- ENDIF()
- IF(CPACK_COMPONENT_GROUP_${f_upper}_HIDDEN)
- SET(DISPLAY "Display='hidden'")
- SET(TITLE ${f_upper})
- SET(DESCRIPTION ${f_upper})
- ELSE()
- SET(DISPLAY)
- IF(CPACK_COMPONENT_GROUP_${f_upper}_EXPANDED)
- SET(DISPLAY "Display='expand'")
- ENDIF()
- IF (CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
- SET(TITLE ${CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME})
- ELSE()
- SET(TITLE CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
- ENDIF()
- IF (CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
- SET(DESCRIPTION ${CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION})
- ELSE()
- SET(DESCRIPTION CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
- ENDIF()
- ENDIF()
-
- SET(CPACK_WIX_FEATURES
- "${CPACK_WIX_FEATURES}
- <Feature Id='${f_upper}'
- Title='${TITLE}'
- Description='${DESCRIPTION}'
- ConfigurableDirectory='INSTALLDIR'
- Level='${Level}' ${DISPLAY} >"
- )
- FOREACH(c ${${f}_COMPONENTS})
- STRING(TOUPPER "${c}" c_upper)
- IF (CPACK_COMPONENT_${c_upper}_DISPLAY_NAME)
- SET(TITLE ${CPACK_COMPONENT_${c_upper}_DISPLAY_NAME})
- ELSE()
- SET(TITLE CPACK_COMPONENT_${c_upper}_DISPLAY_NAME)
- ENDIF()
-
- IF (CPACK_COMPONENT_${c_upper}_DESCRIPTION)
- SET(DESCRIPTION ${CPACK_COMPONENT_${c_upper}_DESCRIPTION})
- ELSE()
- SET(DESCRIPTION CPACK_COMPONENT_${c_upper}_DESCRIPTION)
- ENDIF()
- IF(CPACK_COMPONENT_${c_upper}_WIX_LEVEL)
- SET(Level ${CPACK_COMPONENT_${c_upper}_WIX_LEVEL})
- ELSE()
- SET(Level 1)
- ENDIF()
- IF(CPACK_COMPONENT_${c_upper}_HIDDEN)
- SET(CPACK_WIX_FEATURES
- "${CPACK_WIX_FEATURES}
- <ComponentGroupRef Id='componentgroup.${c}'/>")
- ELSE()
- SET(CPACK_WIX_FEATURES
- "${CPACK_WIX_FEATURES}
- <Feature Id='${c}'
- Title='${TITLE}'
- Description='${DESCRIPTION}'
- ConfigurableDirectory='INSTALLDIR'
- Level='${Level}'>
- <ComponentGroupRef Id='componentgroup.${c}'/>
- </Feature>")
- ENDIF()
-
- ENDFOREACH()
- SET(CPACK_WIX_FEATURES
- "${CPACK_WIX_FEATURES}
- </Feature>
- ")
-ENDFOREACH()
-
-
-IF(CMAKE_INSTALL_CONFIG_NAME)
- STRING(REPLACE "${CMAKE_CFG_INTDIR}" "${CMAKE_INSTALL_CONFIG_NAME}"
- WIXCA_LOCATION "${WIXCA_LOCATION}")
- SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_INSTALL_CONFIG_NAME}")
-ENDIF()
-
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_server.wxs.in
- ${CMAKE_CURRENT_BINARY_DIR}/mysql_server.wxs)
-
-
-FOREACH(comp ${CPACK_COMPONENTS_ALL})
- SET(ENV{DESTDIR} testinstall/${comp})
- SET(DIRS ${DIRS} testinstall/${comp})
- EXECUTE_PROCESS(
- COMMAND ${CMAKE_COMMAND} ${CONFIG_PARAM} -DCMAKE_INSTALL_COMPONENT=${comp}
- -DCMAKE_INSTALL_PREFIX= -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
- OUTPUT_QUIET
- )
-ENDFOREACH()
-
-MACRO(GENERATE_GUID VarName)
- EXECUTE_PROCESS(COMMAND uuidgen -c
- OUTPUT_VARIABLE ${VarName}
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-ENDMACRO()
-
-SET(INC_VAR 0)
-MACRO(MAKE_WIX_IDENTIFIER str varname)
- STRING(REPLACE "/" "." ${varname} "${str}")
- STRING(REGEX REPLACE "[^a-zA-Z_0-9.]" "_" ${varname} "${${varname}}")
- STRING(LENGTH "${${varname}}" len)
- # Identifier should be smaller than 72 character
- # We have to cut down the length to 70 chars, since we add 2 char prefix
- # pretty often
- IF(len GREATER 70)
- STRING(SUBSTRING "${${varname}}" 0 67 shortstr)
- MATH(EXPR INC_VAR ${INC_VAR}+1)
- SET(${varname} "${shortstr}${INC_VAR}")
- ENDIF()
-ENDMACRO()
-
-
-FUNCTION(TRAVERSE_FILES dir topdir file file_comp dir_root)
- FILE(RELATIVE_PATH dir_rel ${topdir} ${dir})
- IF(dir_rel)
- LIST(FIND EXCLUDE_DIRS ${dir_rel} TO_EXCLUDE)
- IF(NOT TO_EXCLUDE EQUAL -1)
- MESSAGE(STATUS "excluding directory: ${dir_rel}")
- RETURN()
- ENDIF()
- ENDIF()
- FILE(GLOB all_files ${dir}/*)
- IF(NOT all_files)
- RETURN()
- ENDIF()
- IF(dir_rel)
- MAKE_DIRECTORY(${dir_root}/${dir_rel})
- MAKE_WIX_IDENTIFIER("${dir_rel}" id)
- SET(DirectoryRefId "D.${id}")
- ELSE()
- SET(DirectoryRefId "INSTALLDIR")
- ENDIF()
- FILE(APPEND ${file} "<DirectoryRef Id='${DirectoryRefId}'>\n")
-
- SET(NONEXEFILES)
- FOREACH(f ${all_files})
- IF(NOT IS_DIRECTORY ${f})
- FILE(RELATIVE_PATH rel ${topdir} ${f})
- SET(TO_EXCLUDE)
- IF(rel MATCHES "\\.pdb$")
- SET(TO_EXCLUDE TRUE)
- ELSE()
- LIST(FIND EXCLUDE_FILES ${rel} RES)
- IF(NOT RES EQUAL -1)
- SET(TO_EXCLUDE TRUE)
- ENDIF()
- ENDIF()
- IF(TO_EXCLUDE)
- MESSAGE(STATUS "excluding file: ${rel}")
- ELSE()
- MAKE_WIX_IDENTIFIER("${rel}" id)
- FILE(TO_NATIVE_PATH ${f} f_native)
- GET_FILENAME_COMPONENT(f_ext "${f}" EXT)
- # According to MSDN each DLL or EXE should be in the own component
- IF(f_ext MATCHES ".exe" OR f_ext MATCHES ".dll")
-
- FILE(APPEND ${file} " <Component Id='C.${id}' Guid='*' ${Win64}>\n")
- FILE(APPEND ${file} " <File Id='F.${id}' KeyPath='yes' Source='${f_native}'/>\n")
- FILE(APPEND ${file} " </Component>\n")
- FILE(APPEND ${file_comp} " <ComponentRef Id='C.${id}'/>\n")
- ELSE()
- SET(NONEXEFILES "${NONEXEFILES}\n<File Id='F.${id}' Source='${f_native}'/>" )
- ENDIF()
- ENDIF()
- ENDIF()
- ENDFOREACH()
- FILE(APPEND ${file} "</DirectoryRef>\n")
- IF(NONEXEFILES)
- GENERATE_GUID(guid)
- SET(ComponentId "C._files_${COMP_NAME}.${DirectoryRefId}")
- FILE(APPEND ${file}
- "<DirectoryRef Id='${DirectoryRefId}'>\n<Component Guid='${guid}' Id='${ComponentId}' ${Win64}>${NONEXEFILES}\n</Component></DirectoryRef>\n")
- FILE(APPEND ${file_comp} " <ComponentRef Id='${ComponentId}'/>\n")
- ENDIF()
- FOREACH(f ${all_files})
- IF(IS_DIRECTORY ${f})
- TRAVERSE_FILES(${f} ${topdir} ${file} ${file_comp} ${dir_root})
- ENDIF()
- ENDFOREACH()
-ENDFUNCTION()
-
-FUNCTION(TRAVERSE_DIRECTORIES dir topdir file prefix)
- FILE(RELATIVE_PATH rel ${topdir} ${dir})
- IF(rel)
- MAKE_WIX_IDENTIFIER("${rel}" id)
- GET_FILENAME_COMPONENT(name ${dir} NAME)
- FILE(APPEND ${file} "${prefix}<Directory Id='D.${id}' Name='${name}'>\n")
- ENDIF()
- FILE(GLOB all_files ${dir}/*)
- FOREACH(f ${all_files})
- IF(IS_DIRECTORY ${f})
- TRAVERSE_DIRECTORIES(${f} ${topdir} ${file} "${prefix} ")
- ENDIF()
- ENDFOREACH()
- IF(rel)
- FILE(APPEND ${file} "${prefix}</Directory>\n")
- ENDIF()
-ENDFUNCTION()
-
-SET(CPACK_WIX_COMPONENTS)
-SET(CPACK_WIX_COMPONENT_GROUPS)
-GET_FILENAME_COMPONENT(abs . ABSOLUTE)
-FOREACH(d ${DIRS})
- GET_FILENAME_COMPONENT(d ${d} ABSOLUTE)
- GET_FILENAME_COMPONENT(d_name ${d} NAME)
- FILE(WRITE ${abs}/${d_name}_component_group.wxs "<ComponentGroup Id='componentgroup.${d_name}'>")
- SET(COMP_NAME ${d_name})
- TRAVERSE_FILES(${d} ${d} ${abs}/${d_name}.wxs ${abs}/${d_name}_component_group.wxs "${abs}/dirs")
- FILE(APPEND ${abs}/${d_name}_component_group.wxs "</ComponentGroup>")
- IF(EXISTS ${d_name}.wxs)
- FILE(READ ${d_name}.wxs WIX_TMP)
- SET(CPACK_WIX_COMPONENTS "${CPACK_WIX_COMPONENTS}\n${WIX_TMP}")
- FILE(REMOVE ${d_name}.wxs)
- ENDIF()
-
- FILE(READ ${d_name}_component_group.wxs WIX_TMP)
-
- SET(CPACK_WIX_COMPONENT_GROUPS "${CPACK_WIX_COMPONENT_GROUPS}\n${WIX_TMP}")
- FILE(REMOVE ${d_name}_component_group.wxs)
-ENDFOREACH()
-
-FILE(WRITE directories.wxs "<DirectoryRef Id='INSTALLDIR'>\n")
-TRAVERSE_DIRECTORIES(${abs}/dirs ${abs}/dirs directories.wxs "")
-FILE(APPEND directories.wxs "</DirectoryRef>\n")
-
-FILE(READ directories.wxs CPACK_WIX_DIRECTORIES)
-FILE(REMOVE directories.wxs)
-
-
-FOREACH(src ${CPACK_WIX_INCLUDE})
-SET(CPACK_WIX_INCLUDES
-"${CPACK_WIX_INCLUDES}
- <?include ${src}?>"
-)
-ENDFOREACH()
-
-
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_server.wxs.in
- ${CMAKE_CURRENT_BINARY_DIR}/mysql_server.wxs)
-
-SET(EXTRA_CANDLE_ARGS)
-IF("$ENV{EXTRA_CANDLE_ARGS}")
- SET(EXTRA_CANDLE_ARGS "$ENV{EXTRA_CANDLE_ARGS}")
-ENDIF()
-
-SET(EXTRA_LIGHT_ARGS)
-IF("$ENV{EXTRA_LIGHT_ARGS}")
- SET(EXTRA_LIGHT_ARGS "$ENV{EXTRA_LIGHT_ARGS}")
-ENDIF()
-
-FILE(REMOVE mysql_server.wixobj)
-EXECUTE_PROCESS(
- COMMAND ${CANDLE_EXECUTABLE} -ext WixUtilExtension mysql_server.wxs ${EXTRA_CANDLE_ARGS}
- RESULT_VARIABLE CANDLE_RESULT
-)
-
-IF(CANDLE_RESULT)
- MESSAGE(FATAL_ERROR "ERROR: can't run candle")
-ENDIF()
-
-EXECUTE_PROCESS(
- COMMAND ${LIGHT_EXECUTABLE} -ext WixUIExtension -ext WixUtilExtension
- mysql_server.wixobj -out ${CPACK_PACKAGE_FILE_NAME}.msi
- ${EXTRA_LIGHT_ARGS}
- RESULT_VARIABLE LIGHT_RESULT
-)
-
-IF(LIGHT_RESULT)
- MESSAGE(FATAL_ERROR "ERROR: can't run light")
-ENDIF()
-
-# Switch monolithic install on again
-EXECUTE_PROCESS(
- COMMAND ${CMAKE_COMMAND} -DCPACK_MONOLITHIC_INSTALL=1 ${CMAKE_BINARY_DIR}
-)
diff --git a/packaging/WiX/custom_ui.wxs b/packaging/WiX/custom_ui.wxs
deleted file mode 100644
index a28c3c9b8a1..00000000000
--- a/packaging/WiX/custom_ui.wxs
+++ /dev/null
@@ -1,115 +0,0 @@
-<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
- xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
-
-<!--
- Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--->
-
- <UI Id="WixUI_Mondo_Custom">
- <Dialog Id="CustomWelcomeDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
- <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
- <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
- </Control>
- <Control Id="Next" Type="PushButton" X="220" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
- <Publish Event="NewDialog" Value="LicenseAgreementDlg">NOT OLDERVERSIONBEINGUPGRADED</Publish>
- <Publish Event="NewDialog" Value="UpgradeDlg">OLDERVERSIONBEINGUPGRADED</Publish>
- </Control>
- <Control Id="Back" Type="PushButton" X="156" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" Disabled="yes" />
- <Control Id="Description" Type="Text" X="135" Y="80" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgDescription)" />
- <Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgTitle)" />
- <Control Id="CopyrightText" Type="Text" X="135" Y="200" Width="220" Height="40" Transparent="yes" Text="Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved." />
- <Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="!(loc.WelcomeDlgBitmap)" />
- <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
- </Dialog>
-
- <Dialog Id="UpgradeDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
- <Control Id="Install" Type="PushButton" ElevationShield="yes" X="212" Y="243" Width="80" Height="17" Default="yes" Text="Upgrade">
- <Publish Event="EndDialog" Value="Return"><![CDATA[OutOfDiskSpace <> 1]]></Publish>
- <Publish Event="SpawnDialog" Value="OutOfRbDiskDlg">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND (PROMPTROLLBACKCOST="P" OR NOT PROMPTROLLBACKCOST)</Publish>
- <Publish Event="EndDialog" Value="Return">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"</Publish>
- <Publish Event="EnableRollback" Value="False">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"</Publish>
- <Publish Event="SpawnDialog" Value="OutOfDiskDlg">(OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 1) OR (OutOfDiskSpace = 1 AND PROMPTROLLBACKCOST="F")</Publish>
- </Control>
- <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
- <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
- </Control>
- <Control Id="Back" Type="PushButton" X="156" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)">
- <Condition Action="default">WixUI_InstallMode = "Remove"</Condition>
- </Control>
- <Control Id="InstallTitle" Type="Text" X="15" Y="15" Width="300" Height="15" Transparent="yes" NoPrefix="yes" Hidden="yes" Text="!(loc.VerifyReadyDlgInstallTitle)">
- <Condition Action="show">NOT Installed</Condition>
- </Control>
- <Control Id="InstallText" Type="Text" X="25" Y="70" Width="320" Height="80" Hidden="yes" Text="!(loc.VerifyReadyDlgInstallText)">
- <Condition Action="show">NOT Installed</Condition>
- </Control>
- <Control Id="UpgradeText" Type="Text" X="25" Y="70" Width="320" Height="80" Hidden="no" NoPrefix="yes"
- Text="Click Upgrade to upgrade your installation from version [OLDERVERSION] to version [ProductVersion]. Click Cancel to exit the upgrade."/>
- <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.VerifyReadyDlgBannerBitmap)" />
- <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
- <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
- </Dialog>
-
- <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
- <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
- <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
-
- <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
- <Property Id="WixUI_Mode" Value="Mondo" />
-
- <DialogRef Id="ErrorDlg" />
- <DialogRef Id="FatalError" />
- <DialogRef Id="FilesInUse" />
- <DialogRef Id="MsiRMFilesInUse" />
- <DialogRef Id="PrepareDlg" />
- <DialogRef Id="ProgressDlg" />
- <DialogRef Id="ResumeDlg" />
- <DialogRef Id="UserExit" />
-
- <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
-
- <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="CustomWelcomeDlg">1</Publish>
- <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg" Order="2">LicenseAccepted = "1"</Publish>
-
- <Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
- <Publish Dialog="SetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
- <Publish Dialog="SetupTypeDlg" Control="CustomButton" Event="NewDialog" Value="CustomizeDlg">1</Publish>
- <Publish Dialog="SetupTypeDlg" Control="CompleteButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
-
- <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="1">WixUI_InstallMode = "Change"</Publish>
- <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallCustom"</Publish>
- <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
-
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1">WixUI_InstallMode = "InstallCustom"</Publish>
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"</Publish>
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="3">WixUI_InstallMode = "Change"</Publish>
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="4">WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"</Publish>
-
- <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
-
- <Publish Dialog="MaintenanceTypeDlg" Control="ChangeButton" Event="NewDialog" Value="CustomizeDlg">1</Publish>
- <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
- <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
- <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
-
- <Publish Dialog="UpgradeDlg" Control="Back" Event="NewDialog" Value="CustomWelcomeDlg">1</Publish>
-
- <InstallUISequence>
- <Show Dialog="CustomWelcomeDlg" Before="ProgressDlg">NOT Installed</Show>
- </InstallUISequence>
- </UI>
-
- <UIRef Id="WixUI_Common" />
-</Include>
diff --git a/packaging/WiX/extra.wxs.in b/packaging/WiX/extra.wxs.in
deleted file mode 100644
index 91bf3f64b8e..00000000000
--- a/packaging/WiX/extra.wxs.in
+++ /dev/null
@@ -1,81 +0,0 @@
-<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
- xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
-
-<!--
- Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--->
-
- <!-- Datafiles that installation will copy to CommonAppData (initial database)
- They are declared Permanent and NeverOverwrite since it is user data -->
- <DirectoryRef Id='TARGETDIR'>
- <Directory Id="CommonAppDataFolder">
- <Directory Id="datadir.mysql" Name="MySQL">
- <Directory Id="datadir.mysql.mysqlserver"
- Name="MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@">
- <Directory Id="DATADIR" Name=".">
- <Component Id="component.datadir" Guid="d3491319-5dbc-4477-95f3-4f809ef1dd2d">
- <CreateFolder>
- <util:PermissionEx User="[LogonUser]" GenericAll="yes" />
- </CreateFolder>
- </Component>
- <Directory Id="datadir.mysql.mysqlserver.data" Name="data">
- <Directory Id="datadir.mysql.mysqlserver.data.mysql" Name="mysql">
- <Component Id="component.datadir.mysql"
- Guid="19ec0f1f-1a7f-424e-a788-b09346c0a709"
- Permanent="yes" NeverOverwrite="yes">
- <CreateFolder>
- <util:PermissionEx User="[LogonUser]" GenericAll="yes" />
- </CreateFolder>
- @DATADIR_MYSQL_FILES@
- </Component>
- </Directory>
- <Directory Id="datadir.mysql.mysqlserver.data.performance_schema"
- Name="performance_schema">
- <Component Id="component.datadir.performance_schema"
- Guid="af2a6776-2655-431f-a748-9e9f4645acc3"
- Permanent="yes" NeverOverwrite="yes">
- <CreateFolder>
- <util:PermissionEx User="[LogonUser]" GenericAll="yes" />
- </CreateFolder>
- @DATADIR_PERFORMANCE_SCHEMA_FILES@
- </Component>
- </Directory>
- <Directory Id="datadir.mysql.mysqlserver.data.test" Name="test">
- <Component Id="component.datadir.test" Guid="52fa9f0a-fcd1-420a-b2ac-95a8f70ad20a">
- <CreateFolder/>
- </Component>
- </Directory>
- </Directory>
- </Directory>
- </Directory>
- </Directory>
- </Directory>
- </DirectoryRef>
-
- <Feature Id='UserEditableDataFiles'
- Title='Server data files'
- Description='Server data files'
- ConfigurableDirectory='DATADIR'
- Level='1'>
- <ComponentRef Id="component.datadir"/>
- <ComponentRef Id="component.datadir.mysql"/>
- <ComponentRef Id="component.datadir.performance_schema"/>
- <ComponentRef Id="component.datadir.test"/>
- </Feature>
-</Include>
-
-
-
diff --git a/packaging/WiX/mysql_server.wxs.in b/packaging/WiX/mysql_server.wxs.in
deleted file mode 100644
index 1802baedf3b..00000000000
--- a/packaging/WiX/mysql_server.wxs.in
+++ /dev/null
@@ -1,196 +0,0 @@
-<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
- xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
-
-<!--
- Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--->
-
- <Product
- Id="*"
- UpgradeCode="49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3"
- Name="MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@"
- Version="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
- Language="1033"
- Manufacturer="@MANUFACTURER@">
-
- <Package Id='*'
- Keywords='Installer'
- Description="MySQL Database Server"
- Manufacturer='@MANUFACTURER@'
- InstallerVersion='200'
- Languages='1033'
- Compressed='yes'
- SummaryCodepage='1252'
- Platform='@Platform@'
- InstallScope="perMachine"/>
-
- <Media Id='1' Cabinet='product.cab' EmbedCab='yes' />
-
- <!-- Upgrade -->
- <Upgrade Id="49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3">
- <UpgradeVersion
- Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.0"
- IncludeMinimum="yes"
- Maximum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
- IncludeMaximum="yes"
- Property="OLDERVERSIONBEINGUPGRADED"
- MigrateFeatures="yes"
- />
- <UpgradeVersion
- Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
- IncludeMinimum="no"
- OnlyDetect="yes"
- Property="NEWERVERSIONDETECTED" />
- </Upgrade>
- <Condition Message="A later version of [ProductName] is already installed. Setup will now exit.">
- NOT NEWERVERSIONDETECTED OR Installed
- </Condition>
- <InstallExecuteSequence>
- <RemoveExistingProducts After="InstallInitialize"/>
- </InstallExecuteSequence>
-
- <!-- Save/restore install location -->
- <CustomAction Id="SaveTargetDir" Property="ARPINSTALLLOCATION" Value="[INSTALLDIR]" />
- <InstallExecuteSequence>
- <Custom Action="SaveTargetDir" After="InstallValidate">
- NOT
- Installed
- </Custom>
- </InstallExecuteSequence>
- <InstallUISequence>
- <!-- App search is what does FindInstallLocation, and it is dependent on FindRelatedProducts -->
- <AppSearch After="FindRelatedProducts"/>
- </InstallUISequence>
-
- <!-- Find previous installation -->
- <Property Id="INSTALLDIR">
- <RegistrySearch Id="FindInstallLocation"
- Root="HKLM"
- Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]"
- Name="InstallLocation"
- Type="raw" />
- </Property>
- <?if @Platform@ != "x64" ?>
- <Property Id="OLDERVERSION">
- <RegistrySearch Id="FindOlderVersion"
- Root="HKLM"
- Win64 = "no"
- Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]"
- Name="DisplayVersion"
- Type="raw" />
- </Property>
- <?else ?>
- <Property Id="OLDERVERSION">
- <RegistrySearch Id="FindOlderVersion"
- Root="HKLM"
- Win64 = "yes"
- Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]"
- Name="DisplayVersion"
- Type="raw" />
- </Property>
- <?endif ?>
- <Property Id="DATADIR">
- <RegistrySearch Id="FindDataDir"
- Root="HKLM"
- Key="SOFTWARE\MySQL AB\[ProductName]"
- Name="DataLocation"
- Type="raw" />
- </Property>
- <Property Id="INSTALLDIR2">
- <RegistrySearch Id="FindInstallLocation2"
- Root="HKLM"
- Key="SOFTWARE\MySQL AB\[ProductName]"
- Name="Location"
- Type="raw" />
- </Property>
- <CustomAction Id="SetInstallDir2" Property="INSTALLDIR" Value="[INSTALLDIR2]" />
- <InstallUISequence>
- <Custom Action="SetInstallDir2" After="AppSearch">INSTALLDIR2</Custom>
- </InstallUISequence>
-
-
- <!-- UI -->
- <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"></Property>
- <UIRef Id="@CPACK_WIX_UI@" />
- <UIRef Id="WixUI_ErrorProgressText" />
- <WixVariable
- Id="WixUIBannerBmp"
- Value="@CMAKE_CURRENT_SOURCE_DIR@/AdminHeader.jpg" />
- <WixVariable
- Id="WixUIDialogBmp"
- Value="@CMAKE_CURRENT_SOURCE_DIR@/AdminBackground.jpg" />
- <Icon
- Id="icon.ico"
- SourceFile="@CMAKE_CURRENT_SOURCE_DIR@/MySQLServer.ico"/>
- <Property
- Id="ARPPRODUCTICON"
- Value="icon.ico" />
-
- <!-- License -->
- <WixVariable
- Id="WixUILicenseRtf"
- Value="@COPYING_RTF@"/>
-
- <!-- How to remove the service on uninstall -->
- <Binary Id='wixca.dll' SourceFile='@WIXCA_LOCATION@' />
- <CustomAction Id="UnregisterProperty" Property="UnregisterService" Value="[INSTALLDIR]" Return="check" />
- <CustomAction Id="UnregisterPropertySilent" Property="UnregisterServiceSilently" Value="[INSTALLDIR]" Return="check" />
- <CustomAction Id="UnregisterService"
- BinaryKey="wixca.dll"
- DllEntry="RemoveService"
- Execute="deferred"
- Impersonate="no"
- Return="check" />
- <CustomAction Id="UnregisterServiceSilently"
- BinaryKey="wixca.dll"
- DllEntry="RemoveServiceNoninteractive"
- Execute="deferred"
- Impersonate="no"
- Return="check" />
- <InstallExecuteSequence>
- <Custom Action="UnregisterProperty" After="InstallInitialize">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL"</Custom>
- <Custom Action="UnregisterPropertySilent" After="InstallInitialize">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL"</Custom>
- <Custom Action="UnregisterService" After="UnregisterProperty">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL" And UILevel&gt;4</Custom>
- <Custom Action="UnregisterServiceSilently" After="UnregisterPropertySilent">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL" And UILevel&lt;=4</Custom>
- </InstallExecuteSequence>
-
- <!-- Installation root-->
- <Directory Id='TARGETDIR' Name='SourceDir'>
- <Directory Id='@PlatformProgramFilesFolder@'>
- <Directory Id='directory.MySQL' Name='MySQL'>
- <Directory Id='INSTALLDIR' Name='MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@'>
- </Directory>
- </Directory>
- </Directory>
- </Directory>
-
- <!-- CPACK_WIX_FEATURES -->
- @CPACK_WIX_FEATURES@
-
- <!-- CPACK_WIX_DIRECTORIES -->
- @CPACK_WIX_DIRECTORIES@
-
- <!--CPACK_WIX_COMPONENTS-->
- @CPACK_WIX_COMPONENTS@
-
- <!--CPACK_WIX_COMPONENTS_GROUPS -->
- @CPACK_WIX_COMPONENT_GROUPS@
-
- <!--CPACK_WIX_INCLUDES -->
- @CPACK_WIX_INCLUDES@
- </Product>
-
-</Wix>
diff --git a/packaging/solaris/CMakeLists.txt b/packaging/solaris/CMakeLists.txt
deleted file mode 100644
index 2a29d876567..00000000000
--- a/packaging/solaris/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-
-# Any files in this directory are auxiliary files for Solaris "pkg" packages.
-# They will be configured during "pkg" creation, not during (binary) build.
-
-IF(NOT CMAKE_SYSTEM_NAME MATCHES "SunOS")
- RETURN()
-ENDIF()
-
-# Currently, this expands to "support-files/" in most layouts,
-# but to "/usr/share/mysql/" in a RPM.
-# It is important not to pollute "/usr/bin".
-SET(inst_location ${INSTALL_SUPPORTFILESDIR})
-
-FOREACH(script postinstall-solaris)
- CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${script}.sh
- ${CMAKE_CURRENT_BINARY_DIR}/${script} COPYONLY )
-
- INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${script}
- DESTINATION ${inst_location}/solaris COMPONENT Server_Scripts)
-ENDFOREACH()
diff --git a/packaging/solaris/postinstall-solaris.sh b/packaging/solaris/postinstall-solaris.sh
deleted file mode 100644
index b024d94f158..00000000000
--- a/packaging/solaris/postinstall-solaris.sh
+++ /dev/null
@@ -1,123 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#
-# Solaris post install script
-#
-
-#if [ /usr/man/bin/makewhatis ] ; then
-# /usr/man/bin/makewhatis "$BASEDIR/mysql/man"
-#fi
-
-mygroup=mysql
-myuser=mysql
-mydatadir=/var/lib/mysql
-basedir=@@basedir@@
-
-if [ -n "$BASEDIR" ] ; then
- basedir="$BASEDIR"
-fi
-
-# What MySQL calls "basedir" and what pkgadd tools calls "basedir"
-# is not the same thing. The default pkgadd base directory is /opt/mysql,
-# the MySQL one "/opt/mysql/mysql".
-
-mybasedir="$basedir/@@instdir@@"
-mystart1="$mybasedir/support-files/mysql.server"
-myinstdb="$mybasedir/scripts/mysql_install_db"
-mystart=/etc/init.d/mysql
-
-# Check: Is this a first installation, or an upgrade ?
-
-if [ -d "$mydatadir/mysql" ] ; then
- : # If the directory for system table files exists, we assume an upgrade.
-else
- INSTALL=new # This is a new installation, the directory will soon be created.
-fi
-
-# Create data directory if needed
-
-[ -d "$mydatadir" ] || mkdir -p -m 755 "$mydatadir" || exit 1
-[ -d "$mydatadir/mysql" ] || mkdir "$mydatadir/mysql" || exit 1
-[ -d "$mydatadir/test" ] || mkdir "$mydatadir/test" || exit 1
-
-# Set the data directory to the right user/group
-
-chown -R $myuser:$mygroup $mydatadir
-
-# Solaris patch 119255 (somewhere around revision 42) changes the behaviour
-# of pkgadd to set TMPDIR internally to a root-owned install directory. This
-# has the unfortunate side effect of breaking running mysql_install_db with
-# the --user=mysql argument as mysqld uses TMPDIR if set, and is unable to
-# write temporary tables to that directory. To work around this issue, we
-# create a subdirectory inside TMPDIR (if set) for mysqld to write to.
-#
-# Idea from Ben Hekster <heksterb@gmail.com> in bug#31164
-
-if [ -n "$TMPDIR" ] ; then
- savetmpdir="$TMPDIR"
- TMPDIR="$TMPDIR/mysql.$$"
- export TMPDIR
- mkdir "$TMPDIR"
- chown $myuser:$mygroup "$TMPDIR"
-fi
-
-if [ -n "$INSTALL" ] ; then
- # We install/update the system tables
- (
- cd "$mybasedir"
- scripts/mysql_install_db \
- --rpm \
- --user=mysql \
- --basedir="$mybasedir" \
- --datadir=$mydatadir
- )
-fi
-
-if [ -n "$savetmpdir" ] ; then
- TMPDIR="$savetmpdir"
-fi
-
-# ----------------------------------------------------------------------
-
-# Handle situation there is old start script installed already
-
-# If old start script is a soft link, we just remove it
-[ -h "$mystart" ] && rm -f "$mystart"
-
-# If old start script is a file, we rename it
-[ -f "$mystart" ] && mv -f "$mystart" "$mystart.old.$$"
-
-# ----------------------------------------------------------------------
-
-# We create a copy of an unmodified start script,
-# as a reference for the one maybe modifying it
-
-cp -f "$mystart1.in" "$mystart.in" || exit 1
-
-# We rewrite some scripts
-
-for script in "$mystart" "$mystart1" "$myinstdb" ; do
- script_in="$script.in"
- sed -e "s,@basedir@,$mybasedir,g" \
- -e "s,@datadir@,$mydatadir,g" "$script_in" > "$script"
- chmod u+x $script
-done
-
-rm -f "$mystart.in"
-
-exit 0
-
diff --git a/pcre/RunTest.bat b/pcre/RunTest.bat
index 35d7f71f9e8..8f290f59130 100644
--- a/pcre/RunTest.bat
+++ b/pcre/RunTest.bat
@@ -1,616 +1,616 @@
-@echo off
-@rem This file must use CRLF linebreaks to function properly
-@rem and requires both pcretest and pcregrep
-@rem This file was originally contributed by Ralf Junker, and touched up by
-@rem Daniel Richard G. Tests 10-12 added by Philip H.
-@rem Philip H also changed test 3 to use "wintest" files.
-@rem
-@rem Updated by Tom Fortmann to support explicit test numbers on the command line.
-@rem Added argument validation and added error reporting.
-@rem
-@rem MS Windows batch file to run pcretest on testfiles with the correct
-@rem options.
-@rem
-@rem Sheri Pierce added logic to skip feature dependent tests
-@rem tests 4 5 9 15 and 18 require utf support
-@rem tests 6 7 10 16 and 19 require ucp support
-@rem 11 requires ucp and link size 2
-@rem 12 requires presence of jit support
-@rem 13 requires absence of jit support
-@rem Sheri P also added override tests for study and jit testing
-@rem Zoltan Herczeg added libpcre16 support
-@rem Zoltan Herczeg added libpcre32 support
-
-setlocal enabledelayedexpansion
-if [%srcdir%]==[] (
-if exist testdata\ set srcdir=.)
-if [%srcdir%]==[] (
-if exist ..\testdata\ set srcdir=..)
-if [%srcdir%]==[] (
-if exist ..\..\testdata\ set srcdir=..\..)
-if NOT exist %srcdir%\testdata\ (
-Error: echo distribution testdata folder not found!
-call :conferror
-exit /b 1
-goto :eof
-)
-
-if [%pcretest%]==[] set pcretest=.\pcretest.exe
-
-echo source dir is %srcdir%
-echo pcretest=%pcretest%
-
-if NOT exist %pcretest% (
-echo Error: %pcretest% not found!
-echo.
-call :conferror
-exit /b 1
-)
-
-%pcretest% -C linksize >NUL
-set link_size=%ERRORLEVEL%
-%pcretest% -C pcre8 >NUL
-set support8=%ERRORLEVEL%
-%pcretest% -C pcre16 >NUL
-set support16=%ERRORLEVEL%
-%pcretest% -C pcre32 >NUL
-set support32=%ERRORLEVEL%
-%pcretest% -C utf >NUL
-set utf=%ERRORLEVEL%
-%pcretest% -C ucp >NUL
-set ucp=%ERRORLEVEL%
-%pcretest% -C jit >NUL
-set jit=%ERRORLEVEL%
-
-if %support8% EQU 1 (
-if not exist testout8 md testout8
-if not exist testoutstudy8 md testoutstudy8
-if not exist testoutjit8 md testoutjit8
-)
-
-if %support16% EQU 1 (
-if not exist testout16 md testout16
-if not exist testoutstudy16 md testoutstudy16
-if not exist testoutjit16 md testoutjit16
-)
-
-if %support16% EQU 1 (
-if not exist testout32 md testout32
-if not exist testoutstudy32 md testoutstudy32
-if not exist testoutjit32 md testoutjit32
-)
-
-set do1=no
-set do2=no
-set do3=no
-set do4=no
-set do5=no
-set do6=no
-set do7=no
-set do8=no
-set do9=no
-set do10=no
-set do11=no
-set do12=no
-set do13=no
-set do14=no
-set do15=no
-set do16=no
-set do17=no
-set do18=no
-set do19=no
-set do20=no
-set do21=no
-set do22=no
-set do23=no
-set do24=no
-set do25=no
-set do26=no
-set all=yes
-
-for %%a in (%*) do (
- set valid=no
- for %%v in (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) do if %%v == %%a set valid=yes
- if "!valid!" == "yes" (
- set do%%a=yes
- set all=no
-) else (
- echo Invalid test number - %%a!
- echo Usage %0 [ test_number ] ...
- echo Where test_number is one or more optional test numbers 1 through 26, default is all tests.
- exit /b 1
-)
-)
-set failed="no"
-
-if "%all%" == "yes" (
- set do1=yes
- set do2=yes
- set do3=yes
- set do4=yes
- set do5=yes
- set do6=yes
- set do7=yes
- set do8=yes
- set do9=yes
- set do10=yes
- set do11=yes
- set do12=yes
- set do13=yes
- set do14=yes
- set do15=yes
- set do16=yes
- set do17=yes
- set do18=yes
- set do19=yes
- set do20=yes
- set do21=yes
- set do22=yes
- set do23=yes
- set do24=yes
- set do25=yes
- set do26=yes
-)
-
-@echo RunTest.bat's pcretest output is written to newly created subfolders named
-@echo testout, testoutstudy and testoutjit.
-@echo.
-
-set mode=
-set bits=8
-
-:nextMode
-if "%mode%" == "" (
- if %support8% EQU 0 goto modeSkip
- echo.
- echo ---- Testing 8-bit library ----
- echo.
-)
-if "%mode%" == "-16" (
- if %support16% EQU 0 goto modeSkip
- echo.
- echo ---- Testing 16-bit library ----
- echo.
-)
-if "%mode%" == "-32" (
- if %support32% EQU 0 goto modeSkip
- echo.
- echo ---- Testing 32-bit library ----
- echo.
-)
-if "%do1%" == "yes" call :do1
-if "%do2%" == "yes" call :do2
-if "%do3%" == "yes" call :do3
-if "%do4%" == "yes" call :do4
-if "%do5%" == "yes" call :do5
-if "%do6%" == "yes" call :do6
-if "%do7%" == "yes" call :do7
-if "%do8%" == "yes" call :do8
-if "%do9%" == "yes" call :do9
-if "%do10%" == "yes" call :do10
-if "%do11%" == "yes" call :do11
-if "%do12%" == "yes" call :do12
-if "%do13%" == "yes" call :do13
-if "%do14%" == "yes" call :do14
-if "%do15%" == "yes" call :do15
-if "%do16%" == "yes" call :do16
-if "%do17%" == "yes" call :do17
-if "%do18%" == "yes" call :do18
-if "%do19%" == "yes" call :do19
-if "%do20%" == "yes" call :do20
-if "%do21%" == "yes" call :do21
-if "%do22%" == "yes" call :do22
-if "%do23%" == "yes" call :do23
-if "%do24%" == "yes" call :do24
-if "%do25%" == "yes" call :do25
-if "%do26%" == "yes" call :do26
-:modeSkip
-if "%mode%" == "" (
- set mode=-16
- set bits=16
- goto nextMode
-)
-if "%mode%" == "-16" (
- set mode=-32
- set bits=32
- goto nextMode
-)
-
-@rem If mode is -32, testing is finished
-if %failed% == "yes" (
-echo In above output, one or more of the various tests failed!
-exit /b 1
-)
-echo All OK
-goto :eof
-
-:runsub
-@rem Function to execute pcretest and compare the output
-@rem Arguments are as follows:
-@rem
-@rem 1 = test number
-@rem 2 = outputdir
-@rem 3 = test name use double quotes
-@rem 4 - 9 = pcretest options
-
-if [%1] == [] (
- echo Missing test number argument!
- exit /b 1
-)
-
-if [%2] == [] (
- echo Missing outputdir!
- exit /b 1
-)
-
-if [%3] == [] (
- echo Missing test name argument!
- exit /b 1
-)
-
-set testinput=testinput%1
-set testoutput=testoutput%1
-if exist %srcdir%\testdata\win%testinput% (
- set testinput=wintestinput%1
- set testoutput=wintestoutput%1
-)
-
-echo Test %1: %3
-%pcretest% %mode% %4 %5 %6 %7 %8 %9 %srcdir%\testdata\%testinput% >%2%bits%\%testoutput%
-if errorlevel 1 (
- echo. failed executing command-line:
- echo. %pcretest% %mode% %4 %5 %6 %7 %8 %9 %srcdir%\testdata\%testinput% ^>%2%bits%\%testoutput%
- set failed="yes"
- goto :eof
-)
-
-set type=
-if [%1]==[11] (
- set type=-%bits%
-)
-if [%1]==[18] (
- set type=-%bits%
-)
-if [%1]==[21] (
- set type=-%bits%
-)
-if [%1]==[22] (
- set type=-%bits%
-)
-
-fc /n %srcdir%\testdata\%testoutput%%type% %2%bits%\%testoutput% >NUL
-
-if errorlevel 1 (
- echo. failed comparison: fc /n %srcdir%\testdata\%testoutput% %2%bits%\%testoutput%
- if [%1]==[2] (
- echo.
- echo ** Test 2 requires a lot of stack. PCRE can be configured to
- echo ** use heap for recursion. Otherwise, to pass Test 2
- echo ** you generally need to allocate 8 mb stack to PCRE.
- echo ** See the 'pcrestack' page for a discussion of PCRE's
- echo ** stack usage.
- echo.
-)
- if [%1]==[3] (
- echo.
- echo ** Test 3 failure usually means french locale is not
- echo ** available on the system, rather than a bug or problem with PCRE.
- echo.
- goto :eof
-)
-
- set failed="yes"
- goto :eof
-)
-
-echo. Passed.
-goto :eof
-
-:do1
-call :runsub 1 testout "Main functionality (Compatible with Perl >= 5.10)" -q
-call :runsub 1 testoutstudy "Test with Study Override" -q -s
-if %jit% EQU 1 call :runsub 1 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do2
- call :runsub 2 testout "API, errors, internals, and non-Perl stuff" -q
- call :runsub 2 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 2 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do3
- call :runsub 3 testout "Locale-specific features" -q
- call :runsub 3 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 3 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do4
-if %utf% EQU 0 (
- echo Test 4 Skipped due to absence of UTF-%bits% support.
- goto :eof
-)
- call :runsub 4 testout "UTF-%bits% support - (Compatible with Perl >= 5.10)" -q
- call :runsub 4 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 4 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do5
-if %utf% EQU 0 (
- echo Test 5 Skipped due to absence of UTF-%bits% support.
- goto :eof
-)
- call :runsub 5 testout "API, internals, and non-Perl stuff for UTF-%bits%" -q
- call :runsub 5 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 5 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do6
-if %ucp% EQU 0 (
- echo Test 6 Skipped due to absence of Unicode property support.
- goto :eof
-)
- call :runsub 6 testout "Unicode property support (Compatible with Perl >= 5.10)" -q
- call :runsub 6 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 6 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do7
-if %ucp% EQU 0 (
- echo Test 7 Skipped due to absence of Unicode property support.
- goto :eof
-)
- call :runsub 7 testout "API, internals, and non-Perl stuff for Unicode property support" -q
- call :runsub 7 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 7 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do8
- call :runsub 8 testout "DFA matching main functionality" -q -dfa
- call :runsub 8 testoutstudy "Test with Study Override" -q -dfa -s
-goto :eof
-
-:do9
-if %utf% EQU 0 (
- echo Test 9 Skipped due to absence of UTF-%bits% support.
- goto :eof
-)
- call :runsub 9 testout "DFA matching with UTF-%bits%" -q -dfa
- call :runsub 9 testoutstudy "Test with Study Override" -q -dfa -s
- goto :eof
-
-:do10
-if %ucp% EQU 0 (
- echo Test 10 Skipped due to absence of Unicode property support.
- goto :eof
-)
- call :runsub 10 testout "DFA matching with Unicode properties" -q -dfa
- call :runsub 10 testoutstudy "Test with Study Override" -q -dfa -s
-goto :eof
-
-:do11
-if NOT %link_size% EQU 2 (
- echo Test 11 Skipped because link size is not 2.
- goto :eof
-)
-if %ucp% EQU 0 (
- echo Test 11 Skipped due to absence of Unicode property support.
- goto :eof
-)
- call :runsub 11 testout "Internal offsets and code size tests" -q
- call :runsub 11 testoutstudy "Test with Study Override" -q -s
-goto :eof
-
-:do12
-if %jit% EQU 0 (
- echo Test 12 Skipped due to absence of JIT support.
- goto :eof
-)
- call :runsub 12 testout "JIT-specific features (JIT available)" -q
-goto :eof
-
-:do13
-if %jit% EQU 1 (
- echo Test 13 Skipped due to presence of JIT support.
- goto :eof
-)
- call :runsub 13 testout "JIT-specific features (JIT not available)" -q
-goto :eof
-
-:do14
-if NOT %bits% EQU 8 (
- echo Test 14 Skipped when running 16/32-bit tests.
- goto :eof
-)
- copy /Y %srcdir%\testdata\saved16 testsaved16
- copy /Y %srcdir%\testdata\saved32 testsaved32
- call :runsub 14 testout "Specials for the basic 8-bit library" -q
- call :runsub 14 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 14 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do15
-if NOT %bits% EQU 8 (
- echo Test 15 Skipped when running 16/32-bit tests.
- goto :eof
-)
-if %utf% EQU 0 (
- echo Test 15 Skipped due to absence of UTF-%bits% support.
- goto :eof
-)
- call :runsub 15 testout "Specials for the 8-bit library with UTF-%bits% support" -q
- call :runsub 15 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 15 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do16
-if NOT %bits% EQU 8 (
- echo Test 16 Skipped when running 16/32-bit tests.
- goto :eof
-)
-if %ucp% EQU 0 (
- echo Test 16 Skipped due to absence of Unicode property support.
- goto :eof
-)
- call :runsub 16 testout "Specials for the 8-bit library with Unicode propery support" -q
- call :runsub 16 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 16 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do17
-if %bits% EQU 8 (
- echo Test 17 Skipped when running 8-bit tests.
- goto :eof
-)
- call :runsub 17 testout "Specials for the basic 16/32-bit library" -q
- call :runsub 17 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 17 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do18
-if %bits% EQU 8 (
- echo Test 18 Skipped when running 8-bit tests.
- goto :eof
-)
-if %utf% EQU 0 (
- echo Test 18 Skipped due to absence of UTF-%bits% support.
- goto :eof
-)
- call :runsub 18 testout "Specials for the 16/32-bit library with UTF-%bits% support" -q
- call :runsub 18 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 18 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do19
-if %bits% EQU 8 (
- echo Test 19 Skipped when running 8-bit tests.
- goto :eof
-)
-if %ucp% EQU 0 (
- echo Test 19 Skipped due to absence of Unicode property support.
- goto :eof
-)
- call :runsub 19 testout "Specials for the 16/32-bit library with Unicode property support" -q
- call :runsub 19 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 19 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do20
-if %bits% EQU 8 (
- echo Test 20 Skipped when running 8-bit tests.
- goto :eof
-)
- call :runsub 20 testout "DFA specials for the basic 16/32-bit library" -q -dfa
- call :runsub 20 testoutstudy "Test with Study Override" -q -dfa -s
-goto :eof
-
-:do21
-if %bits% EQU 8 (
- echo Test 21 Skipped when running 8-bit tests.
- goto :eof
-)
-if NOT %link_size% EQU 2 (
- echo Test 21 Skipped because link size is not 2.
- goto :eof
-)
-copy /Y %srcdir%\testdata\saved8 testsaved8
-copy /Y %srcdir%\testdata\saved16LE-1 testsaved16LE-1
-copy /Y %srcdir%\testdata\saved16BE-1 testsaved16BE-1
-copy /Y %srcdir%\testdata\saved32LE-1 testsaved32LE-1
-copy /Y %srcdir%\testdata\saved32BE-1 testsaved32BE-1
-call :runsub 21 testout "Reloads for the basic 16/32-bit library" -q
-call :runsub 21 testoutstudy "Test with Study Override" -q -s
-if %jit% EQU 1 call :runsub 21 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do22
-if %bits% EQU 8 (
- echo Test 22 Skipped when running 8-bit tests.
- goto :eof
-)
-if %utf% EQU 0 (
- echo Test 22 Skipped due to absence of UTF-%bits% support.
- goto :eof
-)
-if NOT %link_size% EQU 2 (
- echo Test 22 Skipped because link size is not 2.
- goto :eof
-)
-copy /Y %srcdir%\testdata\saved16LE-2 testsaved16LE-2
-copy /Y %srcdir%\testdata\saved16BE-2 testsaved16BE-2
-copy /Y %srcdir%\testdata\saved32LE-2 testsaved32LE-2
-copy /Y %srcdir%\testdata\saved32BE-2 testsaved32BE-2
-call :runsub 22 testout "Reloads for the 16/32-bit library with UTF-16/32 support" -q
-call :runsub 22 testoutstudy "Test with Study Override" -q -s
-if %jit% EQU 1 call :runsub 22 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do23
-if NOT %bits% EQU 16 (
- echo Test 23 Skipped when running 8/32-bit tests.
- goto :eof
-)
-call :runsub 23 testout "Specials for the 16-bit library" -q
-call :runsub 23 testoutstudy "Test with Study Override" -q -s
-if %jit% EQU 1 call :runsub 23 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do24
-if NOT %bits% EQU 16 (
- echo Test 24 Skipped when running 8/32-bit tests.
- goto :eof
-)
-if %utf% EQU 0 (
- echo Test 24 Skipped due to absence of UTF-%bits% support.
- goto :eof
-)
-call :runsub 24 testout "Specials for the 16-bit library with UTF-16 support" -q
-call :runsub 24 testoutstudy "Test with Study Override" -q -s
-if %jit% EQU 1 call :runsub 24 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do25
-if NOT %bits% EQU 32 (
- echo Test 25 Skipped when running 8/16-bit tests.
- goto :eof
-)
-call :runsub 25 testout "Specials for the 32-bit library" -q
-call :runsub 25 testoutstudy "Test with Study Override" -q -s
-if %jit% EQU 1 call :runsub 25 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do26
-if NOT %bits% EQU 32 (
- echo Test 26 Skipped when running 8/16-bit tests.
- goto :eof
-)
-if %utf% EQU 0 (
- echo Test 26 Skipped due to absence of UTF-%bits% support.
- goto :eof
-)
-call :runsub 26 testout "Specials for the 32-bit library with UTF-32 support" -q
-call :runsub 26 testoutstudy "Test with Study Override" -q -s
-if %jit% EQU 1 call :runsub 26 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:conferror
-@echo.
-@echo Either your build is incomplete or you have a configuration error.
-@echo.
-@echo If configured with cmake and executed via "make test" or the MSVC "RUN_TESTS"
-@echo project, pcre_test.bat defines variables and automatically calls RunTest.bat.
-@echo For manual testing of all available features, after configuring with cmake
-@echo and building, you can run the built pcre_test.bat. For best results with
-@echo cmake builds and tests avoid directories with full path names that include
-@echo spaces for source or build.
-@echo.
-@echo Otherwise, if the build dir is in a subdir of the source dir, testdata needed
-@echo for input and verification should be found automatically when (from the
-@echo location of the the built exes) you call RunTest.bat. By default RunTest.bat
-@echo runs all tests compatible with the linked pcre library but it can be given
-@echo a test number as an argument.
-@echo.
-@echo If the build dir is not under the source dir you can either copy your exes
-@echo to the source folder or copy RunTest.bat and the testdata folder to the
-@echo location of your built exes and then run RunTest.bat.
-@echo.
-goto :eof
+@echo off
+@rem This file must use CRLF linebreaks to function properly
+@rem and requires both pcretest and pcregrep
+@rem This file was originally contributed by Ralf Junker, and touched up by
+@rem Daniel Richard G. Tests 10-12 added by Philip H.
+@rem Philip H also changed test 3 to use "wintest" files.
+@rem
+@rem Updated by Tom Fortmann to support explicit test numbers on the command line.
+@rem Added argument validation and added error reporting.
+@rem
+@rem MS Windows batch file to run pcretest on testfiles with the correct
+@rem options.
+@rem
+@rem Sheri Pierce added logic to skip feature dependent tests
+@rem tests 4 5 9 15 and 18 require utf support
+@rem tests 6 7 10 16 and 19 require ucp support
+@rem 11 requires ucp and link size 2
+@rem 12 requires presence of jit support
+@rem 13 requires absence of jit support
+@rem Sheri P also added override tests for study and jit testing
+@rem Zoltan Herczeg added libpcre16 support
+@rem Zoltan Herczeg added libpcre32 support
+
+setlocal enabledelayedexpansion
+if [%srcdir%]==[] (
+if exist testdata\ set srcdir=.)
+if [%srcdir%]==[] (
+if exist ..\testdata\ set srcdir=..)
+if [%srcdir%]==[] (
+if exist ..\..\testdata\ set srcdir=..\..)
+if NOT exist %srcdir%\testdata\ (
+Error: echo distribution testdata folder not found!
+call :conferror
+exit /b 1
+goto :eof
+)
+
+if [%pcretest%]==[] set pcretest=.\pcretest.exe
+
+echo source dir is %srcdir%
+echo pcretest=%pcretest%
+
+if NOT exist %pcretest% (
+echo Error: %pcretest% not found!
+echo.
+call :conferror
+exit /b 1
+)
+
+%pcretest% -C linksize >NUL
+set link_size=%ERRORLEVEL%
+%pcretest% -C pcre8 >NUL
+set support8=%ERRORLEVEL%
+%pcretest% -C pcre16 >NUL
+set support16=%ERRORLEVEL%
+%pcretest% -C pcre32 >NUL
+set support32=%ERRORLEVEL%
+%pcretest% -C utf >NUL
+set utf=%ERRORLEVEL%
+%pcretest% -C ucp >NUL
+set ucp=%ERRORLEVEL%
+%pcretest% -C jit >NUL
+set jit=%ERRORLEVEL%
+
+if %support8% EQU 1 (
+if not exist testout8 md testout8
+if not exist testoutstudy8 md testoutstudy8
+if not exist testoutjit8 md testoutjit8
+)
+
+if %support16% EQU 1 (
+if not exist testout16 md testout16
+if not exist testoutstudy16 md testoutstudy16
+if not exist testoutjit16 md testoutjit16
+)
+
+if %support16% EQU 1 (
+if not exist testout32 md testout32
+if not exist testoutstudy32 md testoutstudy32
+if not exist testoutjit32 md testoutjit32
+)
+
+set do1=no
+set do2=no
+set do3=no
+set do4=no
+set do5=no
+set do6=no
+set do7=no
+set do8=no
+set do9=no
+set do10=no
+set do11=no
+set do12=no
+set do13=no
+set do14=no
+set do15=no
+set do16=no
+set do17=no
+set do18=no
+set do19=no
+set do20=no
+set do21=no
+set do22=no
+set do23=no
+set do24=no
+set do25=no
+set do26=no
+set all=yes
+
+for %%a in (%*) do (
+ set valid=no
+ for %%v in (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) do if %%v == %%a set valid=yes
+ if "!valid!" == "yes" (
+ set do%%a=yes
+ set all=no
+) else (
+ echo Invalid test number - %%a!
+ echo Usage %0 [ test_number ] ...
+ echo Where test_number is one or more optional test numbers 1 through 26, default is all tests.
+ exit /b 1
+)
+)
+set failed="no"
+
+if "%all%" == "yes" (
+ set do1=yes
+ set do2=yes
+ set do3=yes
+ set do4=yes
+ set do5=yes
+ set do6=yes
+ set do7=yes
+ set do8=yes
+ set do9=yes
+ set do10=yes
+ set do11=yes
+ set do12=yes
+ set do13=yes
+ set do14=yes
+ set do15=yes
+ set do16=yes
+ set do17=yes
+ set do18=yes
+ set do19=yes
+ set do20=yes
+ set do21=yes
+ set do22=yes
+ set do23=yes
+ set do24=yes
+ set do25=yes
+ set do26=yes
+)
+
+@echo RunTest.bat's pcretest output is written to newly created subfolders named
+@echo testout, testoutstudy and testoutjit.
+@echo.
+
+set mode=
+set bits=8
+
+:nextMode
+if "%mode%" == "" (
+ if %support8% EQU 0 goto modeSkip
+ echo.
+ echo ---- Testing 8-bit library ----
+ echo.
+)
+if "%mode%" == "-16" (
+ if %support16% EQU 0 goto modeSkip
+ echo.
+ echo ---- Testing 16-bit library ----
+ echo.
+)
+if "%mode%" == "-32" (
+ if %support32% EQU 0 goto modeSkip
+ echo.
+ echo ---- Testing 32-bit library ----
+ echo.
+)
+if "%do1%" == "yes" call :do1
+if "%do2%" == "yes" call :do2
+if "%do3%" == "yes" call :do3
+if "%do4%" == "yes" call :do4
+if "%do5%" == "yes" call :do5
+if "%do6%" == "yes" call :do6
+if "%do7%" == "yes" call :do7
+if "%do8%" == "yes" call :do8
+if "%do9%" == "yes" call :do9
+if "%do10%" == "yes" call :do10
+if "%do11%" == "yes" call :do11
+if "%do12%" == "yes" call :do12
+if "%do13%" == "yes" call :do13
+if "%do14%" == "yes" call :do14
+if "%do15%" == "yes" call :do15
+if "%do16%" == "yes" call :do16
+if "%do17%" == "yes" call :do17
+if "%do18%" == "yes" call :do18
+if "%do19%" == "yes" call :do19
+if "%do20%" == "yes" call :do20
+if "%do21%" == "yes" call :do21
+if "%do22%" == "yes" call :do22
+if "%do23%" == "yes" call :do23
+if "%do24%" == "yes" call :do24
+if "%do25%" == "yes" call :do25
+if "%do26%" == "yes" call :do26
+:modeSkip
+if "%mode%" == "" (
+ set mode=-16
+ set bits=16
+ goto nextMode
+)
+if "%mode%" == "-16" (
+ set mode=-32
+ set bits=32
+ goto nextMode
+)
+
+@rem If mode is -32, testing is finished
+if %failed% == "yes" (
+echo In above output, one or more of the various tests failed!
+exit /b 1
+)
+echo All OK
+goto :eof
+
+:runsub
+@rem Function to execute pcretest and compare the output
+@rem Arguments are as follows:
+@rem
+@rem 1 = test number
+@rem 2 = outputdir
+@rem 3 = test name use double quotes
+@rem 4 - 9 = pcretest options
+
+if [%1] == [] (
+ echo Missing test number argument!
+ exit /b 1
+)
+
+if [%2] == [] (
+ echo Missing outputdir!
+ exit /b 1
+)
+
+if [%3] == [] (
+ echo Missing test name argument!
+ exit /b 1
+)
+
+set testinput=testinput%1
+set testoutput=testoutput%1
+if exist %srcdir%\testdata\win%testinput% (
+ set testinput=wintestinput%1
+ set testoutput=wintestoutput%1
+)
+
+echo Test %1: %3
+%pcretest% %mode% %4 %5 %6 %7 %8 %9 %srcdir%\testdata\%testinput% >%2%bits%\%testoutput%
+if errorlevel 1 (
+ echo. failed executing command-line:
+ echo. %pcretest% %mode% %4 %5 %6 %7 %8 %9 %srcdir%\testdata\%testinput% ^>%2%bits%\%testoutput%
+ set failed="yes"
+ goto :eof
+)
+
+set type=
+if [%1]==[11] (
+ set type=-%bits%
+)
+if [%1]==[18] (
+ set type=-%bits%
+)
+if [%1]==[21] (
+ set type=-%bits%
+)
+if [%1]==[22] (
+ set type=-%bits%
+)
+
+fc /n %srcdir%\testdata\%testoutput%%type% %2%bits%\%testoutput% >NUL
+
+if errorlevel 1 (
+ echo. failed comparison: fc /n %srcdir%\testdata\%testoutput% %2%bits%\%testoutput%
+ if [%1]==[2] (
+ echo.
+ echo ** Test 2 requires a lot of stack. PCRE can be configured to
+ echo ** use heap for recursion. Otherwise, to pass Test 2
+ echo ** you generally need to allocate 8 mb stack to PCRE.
+ echo ** See the 'pcrestack' page for a discussion of PCRE's
+ echo ** stack usage.
+ echo.
+)
+ if [%1]==[3] (
+ echo.
+ echo ** Test 3 failure usually means french locale is not
+ echo ** available on the system, rather than a bug or problem with PCRE.
+ echo.
+ goto :eof
+)
+
+ set failed="yes"
+ goto :eof
+)
+
+echo. Passed.
+goto :eof
+
+:do1
+call :runsub 1 testout "Main functionality (Compatible with Perl >= 5.10)" -q
+call :runsub 1 testoutstudy "Test with Study Override" -q -s
+if %jit% EQU 1 call :runsub 1 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do2
+ call :runsub 2 testout "API, errors, internals, and non-Perl stuff" -q
+ call :runsub 2 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 2 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do3
+ call :runsub 3 testout "Locale-specific features" -q
+ call :runsub 3 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 3 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do4
+if %utf% EQU 0 (
+ echo Test 4 Skipped due to absence of UTF-%bits% support.
+ goto :eof
+)
+ call :runsub 4 testout "UTF-%bits% support - (Compatible with Perl >= 5.10)" -q
+ call :runsub 4 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 4 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do5
+if %utf% EQU 0 (
+ echo Test 5 Skipped due to absence of UTF-%bits% support.
+ goto :eof
+)
+ call :runsub 5 testout "API, internals, and non-Perl stuff for UTF-%bits%" -q
+ call :runsub 5 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 5 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do6
+if %ucp% EQU 0 (
+ echo Test 6 Skipped due to absence of Unicode property support.
+ goto :eof
+)
+ call :runsub 6 testout "Unicode property support (Compatible with Perl >= 5.10)" -q
+ call :runsub 6 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 6 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do7
+if %ucp% EQU 0 (
+ echo Test 7 Skipped due to absence of Unicode property support.
+ goto :eof
+)
+ call :runsub 7 testout "API, internals, and non-Perl stuff for Unicode property support" -q
+ call :runsub 7 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 7 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do8
+ call :runsub 8 testout "DFA matching main functionality" -q -dfa
+ call :runsub 8 testoutstudy "Test with Study Override" -q -dfa -s
+goto :eof
+
+:do9
+if %utf% EQU 0 (
+ echo Test 9 Skipped due to absence of UTF-%bits% support.
+ goto :eof
+)
+ call :runsub 9 testout "DFA matching with UTF-%bits%" -q -dfa
+ call :runsub 9 testoutstudy "Test with Study Override" -q -dfa -s
+ goto :eof
+
+:do10
+if %ucp% EQU 0 (
+ echo Test 10 Skipped due to absence of Unicode property support.
+ goto :eof
+)
+ call :runsub 10 testout "DFA matching with Unicode properties" -q -dfa
+ call :runsub 10 testoutstudy "Test with Study Override" -q -dfa -s
+goto :eof
+
+:do11
+if NOT %link_size% EQU 2 (
+ echo Test 11 Skipped because link size is not 2.
+ goto :eof
+)
+if %ucp% EQU 0 (
+ echo Test 11 Skipped due to absence of Unicode property support.
+ goto :eof
+)
+ call :runsub 11 testout "Internal offsets and code size tests" -q
+ call :runsub 11 testoutstudy "Test with Study Override" -q -s
+goto :eof
+
+:do12
+if %jit% EQU 0 (
+ echo Test 12 Skipped due to absence of JIT support.
+ goto :eof
+)
+ call :runsub 12 testout "JIT-specific features (JIT available)" -q
+goto :eof
+
+:do13
+if %jit% EQU 1 (
+ echo Test 13 Skipped due to presence of JIT support.
+ goto :eof
+)
+ call :runsub 13 testout "JIT-specific features (JIT not available)" -q
+goto :eof
+
+:do14
+if NOT %bits% EQU 8 (
+ echo Test 14 Skipped when running 16/32-bit tests.
+ goto :eof
+)
+ copy /Y %srcdir%\testdata\saved16 testsaved16
+ copy /Y %srcdir%\testdata\saved32 testsaved32
+ call :runsub 14 testout "Specials for the basic 8-bit library" -q
+ call :runsub 14 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 14 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do15
+if NOT %bits% EQU 8 (
+ echo Test 15 Skipped when running 16/32-bit tests.
+ goto :eof
+)
+if %utf% EQU 0 (
+ echo Test 15 Skipped due to absence of UTF-%bits% support.
+ goto :eof
+)
+ call :runsub 15 testout "Specials for the 8-bit library with UTF-%bits% support" -q
+ call :runsub 15 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 15 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do16
+if NOT %bits% EQU 8 (
+ echo Test 16 Skipped when running 16/32-bit tests.
+ goto :eof
+)
+if %ucp% EQU 0 (
+ echo Test 16 Skipped due to absence of Unicode property support.
+ goto :eof
+)
+ call :runsub 16 testout "Specials for the 8-bit library with Unicode propery support" -q
+ call :runsub 16 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 16 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do17
+if %bits% EQU 8 (
+ echo Test 17 Skipped when running 8-bit tests.
+ goto :eof
+)
+ call :runsub 17 testout "Specials for the basic 16/32-bit library" -q
+ call :runsub 17 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 17 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do18
+if %bits% EQU 8 (
+ echo Test 18 Skipped when running 8-bit tests.
+ goto :eof
+)
+if %utf% EQU 0 (
+ echo Test 18 Skipped due to absence of UTF-%bits% support.
+ goto :eof
+)
+ call :runsub 18 testout "Specials for the 16/32-bit library with UTF-%bits% support" -q
+ call :runsub 18 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 18 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do19
+if %bits% EQU 8 (
+ echo Test 19 Skipped when running 8-bit tests.
+ goto :eof
+)
+if %ucp% EQU 0 (
+ echo Test 19 Skipped due to absence of Unicode property support.
+ goto :eof
+)
+ call :runsub 19 testout "Specials for the 16/32-bit library with Unicode property support" -q
+ call :runsub 19 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 19 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do20
+if %bits% EQU 8 (
+ echo Test 20 Skipped when running 8-bit tests.
+ goto :eof
+)
+ call :runsub 20 testout "DFA specials for the basic 16/32-bit library" -q -dfa
+ call :runsub 20 testoutstudy "Test with Study Override" -q -dfa -s
+goto :eof
+
+:do21
+if %bits% EQU 8 (
+ echo Test 21 Skipped when running 8-bit tests.
+ goto :eof
+)
+if NOT %link_size% EQU 2 (
+ echo Test 21 Skipped because link size is not 2.
+ goto :eof
+)
+copy /Y %srcdir%\testdata\saved8 testsaved8
+copy /Y %srcdir%\testdata\saved16LE-1 testsaved16LE-1
+copy /Y %srcdir%\testdata\saved16BE-1 testsaved16BE-1
+copy /Y %srcdir%\testdata\saved32LE-1 testsaved32LE-1
+copy /Y %srcdir%\testdata\saved32BE-1 testsaved32BE-1
+call :runsub 21 testout "Reloads for the basic 16/32-bit library" -q
+call :runsub 21 testoutstudy "Test with Study Override" -q -s
+if %jit% EQU 1 call :runsub 21 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do22
+if %bits% EQU 8 (
+ echo Test 22 Skipped when running 8-bit tests.
+ goto :eof
+)
+if %utf% EQU 0 (
+ echo Test 22 Skipped due to absence of UTF-%bits% support.
+ goto :eof
+)
+if NOT %link_size% EQU 2 (
+ echo Test 22 Skipped because link size is not 2.
+ goto :eof
+)
+copy /Y %srcdir%\testdata\saved16LE-2 testsaved16LE-2
+copy /Y %srcdir%\testdata\saved16BE-2 testsaved16BE-2
+copy /Y %srcdir%\testdata\saved32LE-2 testsaved32LE-2
+copy /Y %srcdir%\testdata\saved32BE-2 testsaved32BE-2
+call :runsub 22 testout "Reloads for the 16/32-bit library with UTF-16/32 support" -q
+call :runsub 22 testoutstudy "Test with Study Override" -q -s
+if %jit% EQU 1 call :runsub 22 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do23
+if NOT %bits% EQU 16 (
+ echo Test 23 Skipped when running 8/32-bit tests.
+ goto :eof
+)
+call :runsub 23 testout "Specials for the 16-bit library" -q
+call :runsub 23 testoutstudy "Test with Study Override" -q -s
+if %jit% EQU 1 call :runsub 23 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do24
+if NOT %bits% EQU 16 (
+ echo Test 24 Skipped when running 8/32-bit tests.
+ goto :eof
+)
+if %utf% EQU 0 (
+ echo Test 24 Skipped due to absence of UTF-%bits% support.
+ goto :eof
+)
+call :runsub 24 testout "Specials for the 16-bit library with UTF-16 support" -q
+call :runsub 24 testoutstudy "Test with Study Override" -q -s
+if %jit% EQU 1 call :runsub 24 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do25
+if NOT %bits% EQU 32 (
+ echo Test 25 Skipped when running 8/16-bit tests.
+ goto :eof
+)
+call :runsub 25 testout "Specials for the 32-bit library" -q
+call :runsub 25 testoutstudy "Test with Study Override" -q -s
+if %jit% EQU 1 call :runsub 25 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do26
+if NOT %bits% EQU 32 (
+ echo Test 26 Skipped when running 8/16-bit tests.
+ goto :eof
+)
+if %utf% EQU 0 (
+ echo Test 26 Skipped due to absence of UTF-%bits% support.
+ goto :eof
+)
+call :runsub 26 testout "Specials for the 32-bit library with UTF-32 support" -q
+call :runsub 26 testoutstudy "Test with Study Override" -q -s
+if %jit% EQU 1 call :runsub 26 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:conferror
+@echo.
+@echo Either your build is incomplete or you have a configuration error.
+@echo.
+@echo If configured with cmake and executed via "make test" or the MSVC "RUN_TESTS"
+@echo project, pcre_test.bat defines variables and automatically calls RunTest.bat.
+@echo For manual testing of all available features, after configuring with cmake
+@echo and building, you can run the built pcre_test.bat. For best results with
+@echo cmake builds and tests avoid directories with full path names that include
+@echo spaces for source or build.
+@echo.
+@echo Otherwise, if the build dir is in a subdir of the source dir, testdata needed
+@echo for input and verification should be found automatically when (from the
+@echo location of the the built exes) you call RunTest.bat. By default RunTest.bat
+@echo runs all tests compatible with the linked pcre library but it can be given
+@echo a test number as an argument.
+@echo.
+@echo If the build dir is not under the source dir you can either copy your exes
+@echo to the source folder or copy RunTest.bat and the testdata folder to the
+@echo location of your built exes and then run RunTest.bat.
+@echo.
+goto :eof
diff --git a/plugin/auth_dialog/CMakeLists.txt b/plugin/auth_dialog/CMakeLists.txt
index 9b4dcfd99bf..a23518060be 100644
--- a/plugin/auth_dialog/CMakeLists.txt
+++ b/plugin/auth_dialog/CMakeLists.txt
@@ -15,4 +15,4 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
MYSQL_ADD_PLUGIN(dialog dialog.c ${CMAKE_SOURCE_DIR}/libmysql/get_password.c
- MODULE_ONLY COMPONENT SharedLibraries)
+ MODULE_ONLY COMPONENT ClientPlugins)
diff --git a/plugin/auth_dialog/dialog.c b/plugin/auth_dialog/dialog.c
index 0fa5ab93a35..da937ea6e91 100644
--- a/plugin/auth_dialog/dialog.c
+++ b/plugin/auth_dialog/dialog.c
@@ -25,6 +25,8 @@
the answer back to the server. No encryption is involved,
the answers are sent in clear text.
*/
+#define _GNU_SOURCE 1 /* for RTLD_DEFAULT */
+
#include <my_global.h>
#include <mysql/client_plugin.h>
#include <mysql.h>
diff --git a/plugin/auth_examples/CMakeLists.txt b/plugin/auth_examples/CMakeLists.txt
index f6c2b637067..c7b7e5be62d 100644
--- a/plugin/auth_examples/CMakeLists.txt
+++ b/plugin/auth_examples/CMakeLists.txt
@@ -30,4 +30,4 @@ MYSQL_ADD_PLUGIN(qa_auth_client qa_auth_client.c
MYSQL_ADD_PLUGIN(auth_0x0100 auth_0x0100.c MODULE_ONLY COMPONENT Test)
MYSQL_ADD_PLUGIN(mysql_clear_password clear_password_client.c
- MODULE_ONLY COMPONENT SharedLibraries)
+ MODULE_ONLY COMPONENT ClientPlugins)
diff --git a/plugin/auth_pam/auth_pam.c b/plugin/auth_pam/auth_pam.c
index fbca8bf9e93..3e3462d3ba0 100644
--- a/plugin/auth_pam/auth_pam.c
+++ b/plugin/auth_pam/auth_pam.c
@@ -98,7 +98,8 @@ static int conv(int n, const struct pam_message **msg,
if (pkt_len < 0)
return PAM_CONV_ERR;
/* allocate and copy the reply to the response array */
- (*resp)[i].resp = strndup((char*)pkt, pkt_len);
+ if (!((*resp)[i].resp= strndup((char*) pkt, pkt_len)))
+ return PAM_CONV_ERR;
param->ptr = param->buf + 1;
}
}
diff --git a/plugin/debug_key_management/debug_key_management_plugin.cc b/plugin/debug_key_management/debug_key_management_plugin.cc
index 33e0c6ab318..23ff78dece2 100644
--- a/plugin/debug_key_management/debug_key_management_plugin.cc
+++ b/plugin/debug_key_management/debug_key_management_plugin.cc
@@ -74,7 +74,8 @@ struct st_mariadb_encryption debug_key_management_plugin= {
MariaDB_ENCRYPTION_INTERFACE_VERSION,
get_latest_key_version,
get_key,
- 0, 0 // use default encrypt/decrypt functions
+ // use default encrypt/decrypt functions
+ 0, 0, 0, 0, 0
};
/*
diff --git a/plugin/example_key_management/example_key_management_plugin.cc b/plugin/example_key_management/example_key_management_plugin.cc
index 32fa135d33a..fb19710c0ef 100644
--- a/plugin/example_key_management/example_key_management_plugin.cc
+++ b/plugin/example_key_management/example_key_management_plugin.cc
@@ -77,26 +77,24 @@ get_key(unsigned int key_id, unsigned int version,
/*
for the sake of an example, let's use different encryption algorithms/modes
- for different keys.
+ for different keys versions:
*/
-int encrypt(const unsigned char* src, unsigned int slen,
- unsigned char* dst, unsigned int* dlen,
- const unsigned char* key, unsigned int klen,
- const unsigned char* iv, unsigned int ivlen,
- int no_padding, unsigned int keyid, unsigned int key_version)
+static inline enum my_aes_mode mode(unsigned int key_version)
{
- return ((key_version & 1) ? my_aes_encrypt_cbc : my_aes_encrypt_ecb)
- (src, slen, dst, dlen, key, klen, iv, ivlen, no_padding);
+ return key_version & 1 ? MY_AES_ECB : MY_AES_CBC;
}
-int decrypt(const unsigned char* src, unsigned int slen,
- unsigned char* dst, unsigned int* dlen,
- const unsigned char* key, unsigned int klen,
- const unsigned char* iv, unsigned int ivlen,
- int no_padding, unsigned int keyid, unsigned int key_version)
+int ctx_init(void *ctx, const unsigned char* key, unsigned int klen, const
+ unsigned char* iv, unsigned int ivlen, int flags, unsigned int
+ key_id, unsigned int key_version)
{
- return ((key_version & 1) ? my_aes_decrypt_cbc : my_aes_decrypt_ecb)
- (src, slen, dst, dlen, key, klen, iv, ivlen, no_padding);
+ return my_aes_crypt_init(ctx, mode(key_version), flags, key, klen, iv, ivlen);
+}
+
+static unsigned int get_length(unsigned int slen, unsigned int key_id,
+ unsigned int key_version)
+{
+ return my_aes_get_size(mode(key_version), slen);
}
static int example_key_management_plugin_init(void *p)
@@ -119,8 +117,11 @@ struct st_mariadb_encryption example_key_management_plugin= {
MariaDB_ENCRYPTION_INTERFACE_VERSION,
get_latest_key_version,
get_key,
- encrypt,
- decrypt
+ (uint (*)(unsigned int, unsigned int))my_aes_ctx_size,
+ ctx_init,
+ my_aes_crypt_update,
+ my_aes_crypt_finish,
+ get_length
};
/*
diff --git a/plugin/feedback/feedback.cc b/plugin/feedback/feedback.cc
index f644bd597d9..053d68eb66d 100644
--- a/plugin/feedback/feedback.cc
+++ b/plugin/feedback/feedback.cc
@@ -99,25 +99,28 @@ static COND* make_cond(THD *thd, TABLE_LIST *tables, LEX_STRING *filter)
nrc.init();
nrc.resolve_in_table_list_only(tables);
- res= new Item_cond_or();
+ res= new (thd->mem_root) Item_cond_or(thd);
if (!res)
return OOM;
for (; filter->str; filter++)
{
- Item_field *fld= new Item_field(&nrc, db, table, field);
- Item_string *pattern= new Item_string(filter->str, filter->length, cs);
- Item_string *escape= new Item_string("\\", 1, cs);
+ Item_field *fld= new (thd->mem_root) Item_field(thd, &nrc, db, table,
+ field);
+ Item_string *pattern= new (thd->mem_root) Item_string(thd, filter->str,
+ filter->length, cs);
+ Item_string *escape= new (thd->mem_root) Item_string(thd, "\\", 1, cs);
if (!fld || !pattern || !escape)
return OOM;
- Item_func_like *like= new Item_func_like(fld, pattern, escape, 0);
+ Item_func_like *like= new (thd->mem_root) Item_func_like(thd, fld, pattern,
+ escape, 0);
if (!like)
return OOM;
- res->add(like);
+ res->add(like, thd->mem_root);
}
if (res->fix_fields(thd, (Item**)&res))
diff --git a/plugin/file_key_management/file_key_management_plugin.cc b/plugin/file_key_management/file_key_management_plugin.cc
index 53cb4069a95..970fae9c189 100644
--- a/plugin/file_key_management/file_key_management_plugin.cc
+++ b/plugin/file_key_management/file_key_management_plugin.cc
@@ -113,65 +113,59 @@ static unsigned int get_key_from_key_file(unsigned int key_id,
return 0;
}
-struct st_mariadb_encryption file_key_management_plugin= {
- MariaDB_ENCRYPTION_INTERFACE_VERSION,
- get_latest_version,
- get_key_from_key_file,
- 0,0
-};
+// let's simplify the condition below
+#ifndef HAVE_EncryptAes128Gcm
+#define MY_AES_GCM MY_AES_CTR
+#ifndef HAVE_EncryptAes128Ctr
+#define MY_AES_CTR MY_AES_CBC
+#endif
+#endif
-#ifdef HAVE_EncryptAes128Gcm
-/*
- use AES-CTR when cyphertext length must be the same as plaintext length,
- and AES-GCM when cyphertext can be longer than plaintext.
-*/
-static int ctr_gcm_encrypt(const unsigned char* src, unsigned int slen,
- unsigned char* dst, unsigned int* dlen,
- const unsigned char* key, unsigned int klen,
- const unsigned char* iv, unsigned int ivlen,
- int no_padding, unsigned int keyid, unsigned int key_version)
+static inline enum my_aes_mode mode(int flags)
{
- return (no_padding ? my_aes_encrypt_ctr : my_aes_encrypt_gcm)
- (src, slen, dst, dlen, key, klen, iv, ivlen);
+ /*
+ If encryption_algorithm is AES_CTR then
+ if no-padding, use AES_CTR
+ else use AES_GCM (like CTR but appends a "checksum" block)
+ else
+ use AES_CBC
+ */
+ if (encryption_algorithm)
+ if (flags & ENCRYPTION_FLAG_NOPAD)
+ return MY_AES_CTR;
+ else
+ return MY_AES_GCM;
+ else
+ return MY_AES_CBC;
}
-static int ctr_gcm_decrypt(const unsigned char* src, unsigned int slen,
- unsigned char* dst, unsigned int* dlen,
- const unsigned char* key, unsigned int klen,
- const unsigned char* iv, unsigned int ivlen,
- int no_padding, unsigned int keyid, unsigned int key_version)
+static int ctx_init(void *ctx, const unsigned char* key, unsigned int klen,
+ const unsigned char* iv, unsigned int ivlen, int flags,
+ unsigned int key_id, unsigned int key_version)
{
- return (no_padding ? my_aes_decrypt_ctr : my_aes_decrypt_gcm)
- (src, slen, dst, dlen, key, klen, iv, ivlen);
+ return my_aes_crypt_init(ctx, mode(flags), flags, key, klen, iv, ivlen);
+}
+
+static unsigned int get_length(unsigned int slen, unsigned int key_id,
+ unsigned int key_version)
+{
+ return my_aes_get_size(mode(0), slen);
}
-#endif
+
+struct st_mariadb_encryption file_key_management_plugin= {
+ MariaDB_ENCRYPTION_INTERFACE_VERSION,
+ get_latest_version,
+ get_key_from_key_file,
+ (uint (*)(unsigned int, unsigned int))my_aes_ctx_size,
+ ctx_init,
+ my_aes_crypt_update,
+ my_aes_crypt_finish,
+ get_length
+};
static int file_key_management_plugin_init(void *p)
{
Parser parser(filename, filekey);
- switch (encryption_algorithm) {
- case 0: // AES_CBC
- file_key_management_plugin.encrypt=
- (encrypt_decrypt_func)my_aes_encrypt_cbc;
- file_key_management_plugin.decrypt=
- (encrypt_decrypt_func)my_aes_decrypt_cbc;
- break;
-#ifdef HAVE_EncryptAes128Ctr
- case 1: // AES_CTR
-#ifdef HAVE_EncryptAes128Gcm
- file_key_management_plugin.encrypt= ctr_gcm_encrypt;
- file_key_management_plugin.decrypt= ctr_gcm_decrypt;
-#else
- file_key_management_plugin.encrypt=
- (encrypt_decrypt_func)my_aes_encrypt_ctr;
- file_key_management_plugin.decrypt=
- (encrypt_decrypt_func)my_aes_decrypt_ctr;
-#endif
- break;
-#endif
- default:
- return 1; // cannot happen
- }
return parser.parse(&keys);
}
diff --git a/plugin/file_key_management/parser.cc b/plugin/file_key_management/parser.cc
index 552dd7df970..9204f39326d 100644
--- a/plugin/file_key_management/parser.cc
+++ b/plugin/file_key_management/parser.cc
@@ -336,10 +336,11 @@ char* Parser::read_and_decrypt_file(const char *secret)
bytes_to_key(buffer + OpenSSL_prefix_len, secret, key, iv);
uint32 d_size;
- if (my_aes_decrypt_cbc(buffer + OpenSSL_prefix_len + OpenSSL_salt_len,
- file_size - OpenSSL_prefix_len - OpenSSL_salt_len,
- decrypted, &d_size, key, OpenSSL_key_len,
- iv, OpenSSL_iv_len, 0))
+ if (my_aes_crypt(MY_AES_CBC, ENCRYPTION_FLAG_DECRYPT,
+ buffer + OpenSSL_prefix_len + OpenSSL_salt_len,
+ file_size - OpenSSL_prefix_len - OpenSSL_salt_len,
+ decrypted, &d_size, key, OpenSSL_key_len,
+ iv, OpenSSL_iv_len))
{
my_printf_error(EE_READ, "Cannot decrypt %s. Wrong key?", MYF(ME_NOREFRESH), filename);
diff --git a/plugin/handler_socket/CMakeLists.txt b/plugin/handler_socket/CMakeLists.txt
index 358139eda1e..2e7caa80897 100644
--- a/plugin/handler_socket/CMakeLists.txt
+++ b/plugin/handler_socket/CMakeLists.txt
@@ -6,9 +6,7 @@ IF(WIN32)
ENDIF()
#Remove -fno-implicit-templates from compiler flags(handlersocket would not work with it)
-IF(CMAKE_COMPILER_IS_GNUCXX)
- STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
-ENDIF()
+STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
INCLUDE_DIRECTORIES(libhsclient)
diff --git a/plugin/handler_socket/handlersocket/database.cpp b/plugin/handler_socket/handlersocket/database.cpp
index 36feeaecf07..8ea7b5061a1 100644
--- a/plugin/handler_socket/handlersocket/database.cpp
+++ b/plugin/handler_socket/handlersocket/database.cpp
@@ -106,10 +106,10 @@ struct tablevec_entry {
struct expr_user_lock : private noncopyable {
expr_user_lock(THD *thd, int timeout)
- : lck_key("handlersocket_wr", 16, &my_charset_latin1),
- lck_timeout(timeout),
- lck_func_get_lock(&lck_key, &lck_timeout),
- lck_func_release_lock(&lck_key)
+ : lck_key(thd, "handlersocket_wr", 16, &my_charset_latin1),
+ lck_timeout(thd, timeout),
+ lck_func_get_lock(thd, &lck_key, &lck_timeout),
+ lck_func_release_lock(thd, &lck_key)
{
lck_key.fix_fields(thd, 0);
lck_timeout.fix_fields(thd, 0);
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c
index 84626c02f8c..1c91c66759d 100644
--- a/plugin/server_audit/server_audit.c
+++ b/plugin/server_audit/server_audit.c
@@ -1128,6 +1128,8 @@ static size_t escape_string(const char *str, unsigned int len,
*(result++)= '\\';
*(result++)= '\\';
}
+ else if (is_space(*str))
+ *(result++)= ' ';
else
*(result++)= *str;
str++;
@@ -1183,9 +1185,15 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len,
for (c=0; c<d_len; c++)
result[c]= is_space(str[c]) ? ' ' : str[c];
- memmove(result + d_len, "*****", 5);
- result+= d_len + 5;
- b_char= *(next_s++);
+ if (*next_s)
+ {
+ memmove(result + d_len, "*****", 5);
+ result+= d_len + 5;
+ b_char= *(next_s++);
+ }
+ else
+ result+= d_len;
+
while (*next_s)
{
if (*next_s == b_char)
diff --git a/plugin/win_auth_client/CMakeLists.txt b/plugin/win_auth_client/CMakeLists.txt
index 75ee55117bd..5d72d24d6ad 100644
--- a/plugin/win_auth_client/CMakeLists.txt
+++ b/plugin/win_auth_client/CMakeLists.txt
@@ -29,7 +29,7 @@ IF(WIN32)
MYSQL_ADD_PLUGIN(authentication_windows_client ${PLUGIN_SOURCES} ${HEADERS}
LINK_LIBRARIES Secur32
- MODULE_ONLY COMPONENT SharedLibraries)
+ MODULE_ONLY COMPONENT ClientPlugins)
#IF(MSVC)
# INSTALL_DEBUG_TARGET(auth_win_client DESTINATION ${INSTALL_LIBDIR}/debug)
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index 68a051f7249..13fc69912f6 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -149,22 +149,16 @@ SET(CONFIGURE_LINE "Built using CMake")
# Also required for mysqlbug, autoconf only supports --version so for now we
# just explicitly require GNU
-IF(CMAKE_COMPILER_IS_GNUCC)
- EXECUTE_PROCESS(
- COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} --version
- COMMAND sed 1q
- OUTPUT_VARIABLE CC_VERSION)
-ELSE()
- SET(CC_VERSION "")
-ENDIF()
-IF(CMAKE_COMPILER_IS_GNUCXX)
- EXECUTE_PROCESS(
- COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} --version
- COMMAND sed 1q
- OUTPUT_VARIABLE CXX_VERSION)
-ELSE()
- SET(CXX_VERSION "")
-ENDIF()
+EXECUTE_PROCESS(
+ COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} --version
+ COMMAND sed 1q
+ ERROR_QUIET
+ OUTPUT_VARIABLE CC_VERSION)
+EXECUTE_PROCESS(
+ COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} --version
+ COMMAND sed 1q
+ ERROR_QUIET
+ OUTPUT_VARIABLE CXX_VERSION)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysqlbug.sh
${CMAKE_CURRENT_BINARY_DIR}/mysqlbug ESCAPE_QUOTES @ONLY)
diff --git a/scripts/fill_help_tables.sql b/scripts/fill_help_tables.sql
index 15f29c8adc3..f8055867b5c 100644
--- a/scripts/fill_help_tables.sql
+++ b/scripts/fill_help_tables.sql
@@ -25,6 +25,7 @@ set names 'utf8';
set sql_log_bin = 0;
+use mysql;
delete from help_topic;
delete from help_category;
delete from help_keyword;
@@ -70,514 +71,514 @@ insert into help_category (help_category_id,name,parent_category_id,url) values
insert into help_category (help_category_id,name,parent_category_id,url) values (38,'Functions',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (39,'Data Definition',35,'');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (0,16,'MIN','Syntax:\nMIN([DISTINCT] expr)\n\nReturns the minimum value of expr. MIN() may take a string argument; in\nsuch cases, it returns the minimum string value. See\nhttp://dev.mysql.com/doc/refman/5.5/en/mysql-indexes.html. The DISTINCT\nkeyword can be used to find the minimum of the distinct values of expr,\nhowever, this produces the same result as omitting DISTINCT.\n\nMIN() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','mysql> SELECT student_name, MIN(test_score), MAX(test_score)\n -> FROM student\n -> GROUP BY student_name;\n','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (1,27,'JOIN','MySQL supports the following JOIN syntaxes for the table_references\npart of SELECT statements and multiple-table DELETE and UPDATE\nstatements:\n\ntable_references:\n table_reference [, table_reference] ...\n\ntable_reference:\n table_factor\n | join_table\n\ntable_factor:\n tbl_name [[AS] alias] [index_hint_list]\n | table_subquery [AS] alias\n | ( table_references )\n | { OJ table_reference LEFT OUTER JOIN table_reference\n ON conditional_expr }\n\njoin_table:\n table_reference [INNER | CROSS] JOIN table_factor [join_condition]\n | table_reference STRAIGHT_JOIN table_factor\n | table_reference STRAIGHT_JOIN table_factor ON conditional_expr\n | table_reference {LEFT|RIGHT} [OUTER] JOIN table_reference join_condition\n | table_reference NATURAL [{LEFT|RIGHT} [OUTER]] JOIN table_factor\n\njoin_condition:\n ON conditional_expr\n | USING (column_list)\n\nindex_hint_list:\n index_hint [, index_hint] ...\n\nindex_hint:\n USE {INDEX|KEY}\n [FOR {JOIN|ORDER BY|GROUP BY}] ([index_list])\n | IGNORE {INDEX|KEY}\n [FOR {JOIN|ORDER BY|GROUP BY}] (index_list)\n | FORCE {INDEX|KEY}\n [FOR {JOIN|ORDER BY|GROUP BY}] (index_list)\n\nindex_list:\n index_name [, index_name] ...\n\nA table reference is also known as a join expression.\n\nThe syntax of table_factor is extended in comparison with the SQL\nStandard. The latter accepts only table_reference, not a list of them\ninside a pair of parentheses.\n\nThis is a conservative extension if we consider each comma in a list of\ntable_reference items as equivalent to an inner join. For example:\n\nSELECT * FROM t1 LEFT JOIN (t2, t3, t4)\n ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)\n\nis equivalent to:\n\nSELECT * FROM t1 LEFT JOIN (t2 CROSS JOIN t3 CROSS JOIN t4)\n ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)\n\nIn MySQL, JOIN, CROSS JOIN, and INNER JOIN are syntactic equivalents\n(they can replace each other). In standard SQL, they are not\nequivalent. INNER JOIN is used with an ON clause, CROSS JOIN is used\notherwise.\n\nIn general, parentheses can be ignored in join expressions containing\nonly inner join operations. MySQL also supports nested joins (see\nhttp://dev.mysql.com/doc/refman/5.5/en/nested-join-optimization.html).\n\nIndex hints can be specified to affect how the MySQL optimizer makes\nuse of indexes. For more information, see\nhttp://dev.mysql.com/doc/refman/5.5/en/index-hints.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/join.html\n\n','SELECT left_tbl.*\n FROM left_tbl LEFT JOIN right_tbl ON left_tbl.id = right_tbl.id\n WHERE right_tbl.id IS NULL;\n','http://dev.mysql.com/doc/refman/5.5/en/join.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (2,37,'HEX','Syntax:\nHEX(str), HEX(N)\n\nFor a string argument str, HEX() returns a hexadecimal string\nrepresentation of str where each character in str is converted to two\nhexadecimal digits. The inverse of this operation is performed by the\nUNHEX() function.\n\nFor a numeric argument N, HEX() returns a hexadecimal string\nrepresentation of the value of N treated as a longlong (BIGINT) number.\nThis is equivalent to CONV(N,10,16). The inverse of this operation is\nperformed by CONV(HEX(N),16,10).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT 0x616263, HEX(\'abc\'), UNHEX(HEX(\'abc\'));\n -> \'abc\', 616263, \'abc\'\nmysql> SELECT HEX(255), CONV(HEX(255),16,10);\n -> \'FF\', 255\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (3,27,'REPLACE','Syntax:\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [(col_name,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n\nOr:\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name\n SET col_name={expr | DEFAULT}, ...\n\nOr:\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [(col_name,...)]\n SELECT ...\n\nREPLACE works exactly like INSERT, except that if an old row in the\ntable has the same value as a new row for a PRIMARY KEY or a UNIQUE\nindex, the old row is deleted before the new row is inserted. See [HELP\nINSERT].\n\nREPLACE is a MySQL extension to the SQL standard. It either inserts, or\ndeletes and inserts. For another MySQL extension to standard SQL---that\neither inserts or updates---see\nhttp://dev.mysql.com/doc/refman/5.5/en/insert-on-duplicate.html.\n\nNote that unless the table has a PRIMARY KEY or UNIQUE index, using a\nREPLACE statement makes no sense. It becomes equivalent to INSERT,\nbecause there is no index to be used to determine whether a new row\nduplicates another.\n\nValues for all columns are taken from the values specified in the\nREPLACE statement. Any missing columns are set to their default values,\njust as happens for INSERT. You cannot refer to values from the current\nrow and use them in the new row. If you use an assignment such as SET\ncol_name = col_name + 1, the reference to the column name on the right\nhand side is treated as DEFAULT(col_name), so the assignment is\nequivalent to SET col_name = DEFAULT(col_name) + 1.\n\nTo use REPLACE, you must have both the INSERT and DELETE privileges for\nthe table.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/replace.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/replace.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (4,30,'CONTAINS','Contains(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 completely contains g2. This\ntests the opposite relationship as Within().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (5,36,'SRID','SRID(g)\n\nReturns an integer indicating the Spatial Reference System ID for the\ngeometry value g.\n\nIn MySQL, the SRID value is just an integer associated with the\ngeometry value. All calculations are done assuming Euclidean (planar)\ngeometry.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions\n\n','mysql> SELECT SRID(GeomFromText(\'LineString(1 1,2 2)\',101));\n+-----------------------------------------------+\n| SRID(GeomFromText(\'LineString(1 1,2 2)\',101)) |\n+-----------------------------------------------+\n| 101 |\n+-----------------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (6,31,'CURRENT_TIMESTAMP','Syntax:\nCURRENT_TIMESTAMP, CURRENT_TIMESTAMP()\n\nCURRENT_TIMESTAMP and CURRENT_TIMESTAMP() are synonyms for NOW().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (7,26,'SHOW CONTRIBUTORS','Syntax:\nSHOW CONTRIBUTORS\n\nThe SHOW CONTRIBUTORS statement displays information about the people\nwho contribute to MySQL source or to causes that we support. For each\ncontributor, it displays Name, Location, and Comment values.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-contributors.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-contributors.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (8,16,'VARIANCE','Syntax:\nVARIANCE(expr)\n\nReturns the population standard variance of expr. This is an extension\nto standard SQL. The standard SQL function VAR_POP() can be used\ninstead.\n\nVARIANCE() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (9,39,'DROP SERVER','Syntax:\nDROP SERVER [ IF EXISTS ] server_name\n\nDrops the server definition for the server named server_name. The\ncorresponding row within the mysql.servers table will be deleted. This\nstatement requires the SUPER privilege.\n\nDropping a server for a table does not affect any FEDERATED tables that\nused this connection information when they were created. See [HELP\nCREATE SERVER].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-server.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-server.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (10,26,'SHOW AUTHORS','Syntax:\nSHOW AUTHORS\n\nThe SHOW AUTHORS statement displays information about the people who\nwork on MySQL. For each author, it displays Name, Location, and Comment\nvalues.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-authors.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-authors.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (11,16,'VAR_SAMP','Syntax:\nVAR_SAMP(expr)\n\nReturns the sample variance of expr. That is, the denominator is the\nnumber of rows minus one.\n\nVAR_SAMP() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (12,37,'CONCAT','Syntax:\nCONCAT(str1,str2,...)\n\nReturns the string that results from concatenating the arguments. May\nhave one or more arguments. If all arguments are nonbinary strings, the\nresult is a nonbinary string. If the arguments include any binary\nstrings, the result is a binary string. A numeric argument is converted\nto its equivalent string form. This is a nonbinary string as of MySQL\n5.5.3. Before 5.5.3, it is a binary string; to to avoid that and\nproduce a nonbinary string, you can use an explicit type cast, as in\nthis example:\n\nSELECT CONCAT(CAST(int_col AS CHAR), char_col);\n\nCONCAT() returns NULL if any argument is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT CONCAT(\'My\', \'S\', \'QL\');\n -> \'MySQL\'\nmysql> SELECT CONCAT(\'My\', NULL, \'QL\');\n -> NULL\nmysql> SELECT CONCAT(14.3);\n -> \'14.3\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (13,34,'GEOMETRY HIERARCHY','Geometry is the base class. It is an abstract class. The instantiable\nsubclasses of Geometry are restricted to zero-, one-, and\ntwo-dimensional geometric objects that exist in two-dimensional\ncoordinate space. All instantiable geometry classes are defined so that\nvalid instances of a geometry class are topologically closed (that is,\nall defined geometries include their boundary).\n\nThe base Geometry class has subclasses for Point, Curve, Surface, and\nGeometryCollection:\n\no Point represents zero-dimensional objects.\n\no Curve represents one-dimensional objects, and has subclass\n LineString, with sub-subclasses Line and LinearRing.\n\no Surface is designed for two-dimensional objects and has subclass\n Polygon.\n\no GeometryCollection has specialized zero-, one-, and two-dimensional\n collection classes named MultiPoint, MultiLineString, and\n MultiPolygon for modeling geometries corresponding to collections of\n Points, LineStrings, and Polygons, respectively. MultiCurve and\n MultiSurface are introduced as abstract superclasses that generalize\n the collection interfaces to handle Curves and Surfaces.\n\nGeometry, Curve, Surface, MultiCurve, and MultiSurface are defined as\nnoninstantiable classes. They define a common set of methods for their\nsubclasses and are included for extensibility.\n\nPoint, LineString, Polygon, GeometryCollection, MultiPoint,\nMultiLineString, and MultiPolygon are instantiable classes.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/gis-geometry-class-hierarchy.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/gis-geometry-class-hierarchy.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (14,37,'CHAR FUNCTION','Syntax:\nCHAR(N,... [USING charset_name])\n\nCHAR() interprets each argument N as an integer and returns a string\nconsisting of the characters given by the code values of those\nintegers. NULL values are skipped.\nBy default, CHAR() returns a binary string. To produce a string in a\ngiven character set, use the optional USING clause:\n\nmysql> SELECT CHARSET(CHAR(0x65)), CHARSET(CHAR(0x65 USING utf8));\n+---------------------+--------------------------------+\n| CHARSET(CHAR(0x65)) | CHARSET(CHAR(0x65 USING utf8)) |\n+---------------------+--------------------------------+\n| binary | utf8 |\n+---------------------+--------------------------------+\n\nIf USING is given and the result string is illegal for the given\ncharacter set, a warning is issued. Also, if strict SQL mode is\nenabled, the result from CHAR() becomes NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT CHAR(77,121,83,81,\'76\');\n -> \'MySQL\'\nmysql> SELECT CHAR(77,77.3,\'77.3\');\n -> \'MMM\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (15,22,'DATETIME','DATETIME\n\nA date and time combination. The supported range is \'1000-01-01\n00:00:00\' to \'9999-12-31 23:59:59\'. MySQL displays DATETIME values in\n\'YYYY-MM-DD HH:MM:SS\' format, but permits assignment of values to\nDATETIME columns using either strings or numbers.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (16,26,'SHOW CREATE TRIGGER','Syntax:\nSHOW CREATE TRIGGER trigger_name\n\nThis statement shows a CREATE TRIGGER statement that creates the given\ntrigger.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-create-trigger.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-create-trigger.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (17,26,'SHOW CREATE PROCEDURE','Syntax:\nSHOW CREATE PROCEDURE proc_name\n\nThis statement is a MySQL extension. It returns the exact string that\ncan be used to re-create the named stored procedure. A similar\nstatement, SHOW CREATE FUNCTION, displays information about stored\nfunctions (see [HELP SHOW CREATE FUNCTION]).\n\nBoth statements require that you be the owner of the routine or have\nSELECT access to the mysql.proc table. If you do not have privileges\nfor the routine itself, the value displayed for the Create Procedure or\nCreate Function field will be NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-create-procedure.html\n\n','mysql> SHOW CREATE PROCEDURE test.simpleproc\\G\n*************************** 1. row ***************************\n Procedure: simpleproc\n sql_mode:\n Create Procedure: CREATE PROCEDURE `simpleproc`(OUT param1 INT)\n BEGIN\n SELECT COUNT(*) INTO param1 FROM t;\n END\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\nmysql> SHOW CREATE FUNCTION test.hello\\G\n*************************** 1. row ***************************\n Function: hello\n sql_mode:\n Create Function: CREATE FUNCTION `hello`(s CHAR(20))\n RETURNS CHAR(50)\n RETURN CONCAT(\'Hello, \',s,\'!\')\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n','http://dev.mysql.com/doc/refman/5.5/en/show-create-procedure.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (18,23,'OPEN','Syntax:\nOPEN cursor_name\n\nThis statement opens a previously declared cursor. For an example, see\nhttp://dev.mysql.com/doc/refman/5.5/en/cursors.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/open.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/open.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (19,22,'INTEGER','INTEGER[(M)] [UNSIGNED] [ZEROFILL]\n\nThis type is a synonym for INT.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (20,37,'LOWER','Syntax:\nLOWER(str)\n\nReturns the string str with all characters changed to lowercase\naccording to the current character set mapping. The default is latin1\n(cp1252 West European).\n\nmysql> SELECT LOWER(\'QUADRATICALLY\');\n -> \'quadratically\'\n\nLOWER() (and UPPER()) are ineffective when applied to binary strings\n(BINARY, VARBINARY, BLOB). To perform lettercase conversion, convert\nthe string to a nonbinary string:\n\nmysql> SET @str = BINARY \'New York\';\nmysql> SELECT LOWER(@str), LOWER(CONVERT(@str USING latin1));\n+-------------+-----------------------------------+\n| LOWER(@str) | LOWER(CONVERT(@str USING latin1)) |\n+-------------+-----------------------------------+\n| New York | new york |\n+-------------+-----------------------------------+\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (21,26,'SHOW COLUMNS','Syntax:\nSHOW [FULL] COLUMNS {FROM | IN} tbl_name [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW COLUMNS displays information about the columns in a given table.\nIt also works for views. The LIKE clause, if present, indicates which\ncolumn names to match. The WHERE clause can be given to select rows\nusing more general conditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html.\n\nSHOW COLUMNS displays information only for those columns for which you\nhave some privilege.\n\nmysql> SHOW COLUMNS FROM City;\n+------------+----------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+------------+----------+------+-----+---------+----------------+\n| Id | int(11) | NO | PRI | NULL | auto_increment |\n| Name | char(35) | NO | | | |\n| Country | char(3) | NO | UNI | | |\n| District | char(20) | YES | MUL | | |\n| Population | int(11) | NO | | 0 | |\n+------------+----------+------+-----+---------+----------------+\n5 rows in set (0.00 sec)\n\nIf the data types differ from what you expect them to be based on a\nCREATE TABLE statement, note that MySQL sometimes changes data types\nwhen you create or alter a table. The conditions under which this\noccurs are described in\nhttp://dev.mysql.com/doc/refman/5.5/en/silent-column-changes.html.\n\nThe FULL keyword causes the output to include the column collation and\ncomments, as well as the privileges you have for each column.\n\nYou can use db_name.tbl_name as an alternative to the tbl_name FROM\ndb_name syntax. In other words, these two statements are equivalent:\n\nmysql> SHOW COLUMNS FROM mytable FROM mydb;\nmysql> SHOW COLUMNS FROM mydb.mytable;\n\nSHOW COLUMNS displays the following values for each table column:\n\nField indicates the column name.\n\nType indicates the column data type.\n\nCollation indicates the collation for nonbinary string columns, or NULL\nfor other columns. This value is displayed only if you use the FULL\nkeyword.\n\nThe Null field contains YES if NULL values can be stored in the column,\nNO if not.\n\nThe Key field indicates whether the column is indexed:\n\no If Key is empty, the column either is not indexed or is indexed only\n as a secondary column in a multiple-column, nonunique index.\n\no If Key is PRI, the column is a PRIMARY KEY or is one of the columns\n in a multiple-column PRIMARY KEY.\n\no If Key is UNI, the column is the first column of a UNIQUE index. (A\n UNIQUE index permits multiple NULL values, but you can tell whether\n the column permits NULL by checking the Null field.)\n\no If Key is MUL, the column is the first column of a nonunique index in\n which multiple occurrences of a given value are permitted within the\n column.\n\nIf more than one of the Key values applies to a given column of a\ntable, Key displays the one with the highest priority, in the order\nPRI, UNI, MUL.\n\nA UNIQUE index may be displayed as PRI if it cannot contain NULL values\nand there is no PRIMARY KEY in the table. A UNIQUE index may display as\nMUL if several columns form a composite UNIQUE index; although the\ncombination of the columns is unique, each column can still hold\nmultiple occurrences of a given value.\n\nThe Default field indicates the default value that is assigned to the\ncolumn. This is NULL if the column has an explicit default of NULL, or\nif the column definition has no DEFAULT clause.\n\nThe Extra field contains any additional information that is available\nabout a given column. The value is nonempty in these cases:\nauto_increment for columns that have the AUTO_INCREMENT attribute; on\nupdate CURRENT_TIMESTAMP for TIMESTAMP columns that have the ON UPDATE\nCURRENT_TIMESTAMP attribute.\n\nPrivileges indicates the privileges you have for the column. This value\nis displayed only if you use the FULL keyword.\n\nComment indicates any comment the column has. This value is displayed\nonly if you use the FULL keyword.\n\nSHOW FIELDS is a synonym for SHOW COLUMNS. You can also list a table\'s\ncolumns with the mysqlshow db_name tbl_name command.\n\nThe DESCRIBE statement provides information similar to SHOW COLUMNS.\nSee [HELP DESCRIBE].\n\nThe SHOW CREATE TABLE, SHOW TABLE STATUS, and SHOW INDEX statements\nalso provide information about tables. See [HELP SHOW].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-columns.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-columns.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (22,39,'CREATE TRIGGER','Syntax:\nCREATE\n [DEFINER = { user | CURRENT_USER }]\n TRIGGER trigger_name trigger_time trigger_event\n ON tbl_name FOR EACH ROW trigger_body\n\nThis statement creates a new trigger. A trigger is a named database\nobject that is associated with a table, and that activates when a\nparticular event occurs for the table. The trigger becomes associated\nwith the table named tbl_name, which must refer to a permanent table.\nYou cannot associate a trigger with a TEMPORARY table or a view.\n\nCREATE TRIGGER requires the TRIGGER privilege for the table associated\nwith the trigger. The statement might also require the SUPER privilege,\ndepending on the DEFINER value, as described later in this section. If\nbinary logging is enabled, CREATE TRIGGER might require the SUPER\nprivilege, as described in\nhttp://dev.mysql.com/doc/refman/5.5/en/stored-programs-logging.html.\n\nThe DEFINER clause determines the security context to be used when\nchecking access privileges at trigger activation time. See later in\nthis section for more information.\n\ntrigger_time is the trigger action time. It can be BEFORE or AFTER to\nindicate that the trigger activates before or after each row to be\nmodified.\n\ntrigger_event indicates the kind of statement that activates the\ntrigger. The trigger_event can be one of the following:\n\no INSERT: The trigger is activated whenever a new row is inserted into\n the table; for example, through INSERT, LOAD DATA, and REPLACE\n statements.\n\no UPDATE: The trigger is activated whenever a row is modified; for\n example, through UPDATE statements.\n\no DELETE: The trigger is activated whenever a row is deleted from the\n table; for example, through DELETE and REPLACE statements. However,\n DROP TABLE and TRUNCATE TABLE statements on the table do not activate\n this trigger, because they do not use DELETE. Dropping a partition\n does not activate DELETE triggers, either. See [HELP TRUNCATE TABLE].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-trigger.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/create-trigger.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (23,31,'MONTH','Syntax:\nMONTH(date)\n\nReturns the month for date, in the range 1 to 12 for January to\nDecember, or 0 for dates such as \'0000-00-00\' or \'2008-00-00\' that have\na zero month part.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT MONTH(\'2008-02-03\');\n -> 2\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (24,22,'TINYINT','TINYINT[(M)] [UNSIGNED] [ZEROFILL]\n\nA very small integer. The signed range is -128 to 127. The unsigned\nrange is 0 to 255.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (25,26,'SHOW TRIGGERS','Syntax:\nSHOW TRIGGERS [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW TRIGGERS lists the triggers currently defined for tables in a\ndatabase (the default database unless a FROM clause is given). This\nstatement returns results only for databases and tables for which you\nhave the TRIGGER privilege. The LIKE clause, if present, indicates\nwhich table names to match and causes the statement to display triggers\nfor those tables. The WHERE clause can be given to select rows using\nmore general conditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html.\n\nFor the trigger ins_sum as defined in\nhttp://dev.mysql.com/doc/refman/5.5/en/triggers.html, the output of\nthis statement is as shown here:\n\nmysql> SHOW TRIGGERS LIKE \'acc%\'\\G\n*************************** 1. row ***************************\n Trigger: ins_sum\n Event: INSERT\n Table: account\n Statement: SET @sum = @sum + NEW.amount\n Timing: BEFORE\n Created: NULL\n sql_mode:\n Definer: myname@localhost\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\ncharacter_set_client is the session value of the character_set_client\nsystem variable when the trigger was created. collation_connection is\nthe session value of the collation_connection system variable when the\ntrigger was created. Database Collation is the collation of the\ndatabase with which the trigger is associated.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-triggers.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-triggers.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (26,14,'MASTER_POS_WAIT','Syntax:\nMASTER_POS_WAIT(log_name,log_pos[,timeout])\n\nThis function is useful for control of master/slave synchronization. It\nblocks until the slave has read and applied all updates up to the\nspecified position in the master log. The return value is the number of\nlog events the slave had to wait for to advance to the specified\nposition. The function returns NULL if the slave SQL thread is not\nstarted, the slave\'s master information is not initialized, the\narguments are incorrect, or an error occurs. It returns -1 if the\ntimeout has been exceeded. If the slave SQL thread stops while\nMASTER_POS_WAIT() is waiting, the function returns NULL. If the slave\nis past the specified position, the function returns immediately.\n\nIf a timeout value is specified, MASTER_POS_WAIT() stops waiting when\ntimeout seconds have elapsed. timeout must be greater than 0; a zero or\nnegative timeout means no timeout.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (27,37,'REGEXP','Syntax:\nexpr REGEXP pat, expr RLIKE pat\n\nPerforms a pattern match of a string expression expr against a pattern\npat. The pattern can be an extended regular expression. The syntax for\nregular expressions is discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/regexp.html. Returns 1 if expr\nmatches pat; otherwise it returns 0. If either expr or pat is NULL, the\nresult is NULL. RLIKE is a synonym for REGEXP, provided for mSQL\ncompatibility.\n\nThe pattern need not be a literal string. For example, it can be\nspecified as a string expression or table column.\n\n*Note*: Because MySQL uses the C escape syntax in strings (for example,\n"\\n" to represent the newline character), you must double any "\\" that\nyou use in your REGEXP strings.\n\nREGEXP is not case sensitive, except when used with binary strings.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/regexp.html\n\n','mysql> SELECT \'Monty!\' REGEXP \'.*\';\n -> 1\nmysql> SELECT \'new*\\n*line\' REGEXP \'new\\\\*.\\\\*line\';\n -> 1\nmysql> SELECT \'a\' REGEXP \'A\', \'a\' REGEXP BINARY \'A\';\n -> 1 0\nmysql> SELECT \'a\' REGEXP \'^[a-d]\';\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/regexp.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (28,23,'IF STATEMENT','Syntax:\nIF search_condition THEN statement_list\n [ELSEIF search_condition THEN statement_list] ...\n [ELSE statement_list]\nEND IF\n\nThe IF statement for stored programs implements a basic conditional\nconstruct.\n\n*Note*: There is also an IF() function, which differs from the IF\nstatement described here. See\nhttp://dev.mysql.com/doc/refman/5.5/en/control-flow-functions.html. The\nIF statement can have THEN, ELSE, and ELSEIF clauses, and it is\nterminated with END IF.\n\nIf the search_condition evaluates to true, the corresponding THEN or\nELSEIF clause statement_list executes. If no search_condition matches,\nthe ELSE clause statement_list executes.\n\nEach statement_list consists of one or more SQL statements; an empty\nstatement_list is not permitted.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/if.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/if.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (29,19,'^','Syntax:\n^\n\nBitwise XOR:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html\n\n','mysql> SELECT 1 ^ 1;\n -> 0\nmysql> SELECT 1 ^ 0;\n -> 1\nmysql> SELECT 11 ^ 3;\n -> 8\n','http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (30,39,'DROP VIEW','Syntax:\nDROP VIEW [IF EXISTS]\n view_name [, view_name] ...\n [RESTRICT | CASCADE]\n\nDROP VIEW removes one or more views. You must have the DROP privilege\nfor each view. If any of the views named in the argument list do not\nexist, MySQL returns an error indicating by name which nonexisting\nviews it was unable to drop, but it also drops all of the views in the\nlist that do exist.\n\nThe IF EXISTS clause prevents an error from occurring for views that\ndon\'t exist. When this clause is given, a NOTE is generated for each\nnonexistent view. See [HELP SHOW WARNINGS].\n\nRESTRICT and CASCADE, if given, are parsed and ignored.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-view.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-view.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (31,30,'WITHIN','Within(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 is spatially within g2. This\ntests the opposite relationship as Contains().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (32,31,'WEEK','Syntax:\nWEEK(date[,mode])\n\nThis function returns the week number for date. The two-argument form\nof WEEK() enables you to specify whether the week starts on Sunday or\nMonday and whether the return value should be in the range from 0 to 53\nor from 1 to 53. If the mode argument is omitted, the value of the\ndefault_week_format system variable is used. See\nhttp://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT WEEK(\'2008-02-20\');\n -> 7\nmysql> SELECT WEEK(\'2008-02-20\',0);\n -> 7\nmysql> SELECT WEEK(\'2008-02-20\',1);\n -> 8\nmysql> SELECT WEEK(\'2008-12-31\',1);\n -> 53\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (33,26,'SHOW PLUGINS','Syntax:\nSHOW PLUGINS\n\nSHOW PLUGINS displays information about server plugins. Plugin\ninformation is also available in the INFORMATION_SCHEMA.PLUGINS table.\nSee http://dev.mysql.com/doc/refman/5.5/en/plugins-table.html.\n\nExample of SHOW PLUGINS output:\n\nmysql> SHOW PLUGINS\\G\n*************************** 1. row ***************************\n Name: binlog\n Status: ACTIVE\n Type: STORAGE ENGINE\nLibrary: NULL\nLicense: GPL\n*************************** 2. row ***************************\n Name: CSV\n Status: ACTIVE\n Type: STORAGE ENGINE\nLibrary: NULL\nLicense: GPL\n*************************** 3. row ***************************\n Name: MEMORY\n Status: ACTIVE\n Type: STORAGE ENGINE\nLibrary: NULL\nLicense: GPL\n*************************** 4. row ***************************\n Name: MyISAM\n Status: ACTIVE\n Type: STORAGE ENGINE\nLibrary: NULL\nLicense: GPL\n...\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-plugins.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-plugins.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (34,21,'DROP FUNCTION UDF','Syntax:\nDROP FUNCTION function_name\n\nThis statement drops the user-defined function (UDF) named\nfunction_name.\n\nTo drop a function, you must have the DELETE privilege for the mysql\ndatabase. This is because DROP FUNCTION removes a row from the\nmysql.func system table that records the function\'s name, type, and\nshared library name.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-function-udf.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-function-udf.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (35,8,'PREPARE','Syntax:\nPREPARE stmt_name FROM preparable_stmt\n\nThe PREPARE statement prepares a statement and assigns it a name,\nstmt_name, by which to refer to the statement later. Statement names\nare not case sensitive. preparable_stmt is either a string literal or a\nuser variable that contains the text of the statement. The text must\nrepresent a single SQL statement, not multiple statements. Within the\nstatement, "?" characters can be used as parameter markers to indicate\nwhere data values are to be bound to the query later when you execute\nit. The "?" characters should not be enclosed within quotation marks,\neven if you intend to bind them to string values. Parameter markers can\nbe used only where data values should appear, not for SQL keywords,\nidentifiers, and so forth.\n\nIf a prepared statement with the given name already exists, it is\ndeallocated implicitly before the new statement is prepared. This means\nthat if the new statement contains an error and cannot be prepared, an\nerror is returned and no statement with the given name exists.\n\nA prepared statement is executed with EXECUTE and released with\nDEALLOCATE PREPARE.\n\nThe scope of a prepared statement is the session within which it is\ncreated. Other sessions cannot see it.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/prepare.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/prepare.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (36,8,'LOCK','Syntax:\nLOCK TABLES\n tbl_name [[AS] alias] lock_type\n [, tbl_name [[AS] alias] lock_type] ...\n\nlock_type:\n READ [LOCAL]\n | [LOW_PRIORITY] WRITE\n\nUNLOCK TABLES\n\nMySQL enables client sessions to acquire table locks explicitly for the\npurpose of cooperating with other sessions for access to tables, or to\nprevent other sessions from modifying tables during periods when a\nsession requires exclusive access to them. A session can acquire or\nrelease locks only for itself. One session cannot acquire locks for\nanother session or release locks held by another session.\n\nLocks may be used to emulate transactions or to get more speed when\nupdating tables. This is explained in more detail later in this\nsection.\n\nLOCK TABLES explicitly acquires table locks for the current client\nsession. Table locks can be acquired for base tables or views. You must\nhave the LOCK TABLES privilege, and the SELECT privilege for each\nobject to be locked.\n\nFor view locking, LOCK TABLES adds all base tables used in the view to\nthe set of tables to be locked and locks them automatically. If you\nlock a table explicitly with LOCK TABLES, any tables used in triggers\nare also locked implicitly, as described in\nhttp://dev.mysql.com/doc/refman/5.5/en/lock-tables-and-triggers.html.\n\nUNLOCK TABLES explicitly releases any table locks held by the current\nsession. LOCK TABLES implicitly releases any table locks held by the\ncurrent session before acquiring new locks.\n\nAnother use for UNLOCK TABLES is to release the global read lock\nacquired with the FLUSH TABLES WITH READ LOCK statement, which enables\nyou to lock all tables in all databases. See [HELP FLUSH]. (This is a\nvery convenient way to get backups if you have a file system such as\nVeritas that can take snapshots in time.)\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/lock-tables.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/lock-tables.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (37,37,'UPDATEXML','Syntax:\nUpdateXML(xml_target, xpath_expr, new_xml)\n\nThis function replaces a single portion of a given fragment of XML\nmarkup xml_target with a new XML fragment new_xml, and then returns the\nchanged XML. The portion of xml_target that is replaced matches an\nXPath expression xpath_expr supplied by the user. In MySQL 5.5, the\nXPath expression can contain at most 127 characters. (This limitation\nis lifted in MySQL 5.6.)\n\nIf no expression matching xpath_expr is found, or if multiple matches\nare found, the function returns the original xml_target XML fragment.\nAll three arguments should be strings.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/xml-functions.html\n\n','mysql> SELECT\n -> UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'/a\', \'<e>fff</e>\') AS val1,\n -> UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'/b\', \'<e>fff</e>\') AS val2,\n -> UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'//b\', \'<e>fff</e>\') AS val3,\n -> UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'/a/d\', \'<e>fff</e>\') AS val4,\n -> UpdateXML(\'<a><d></d><b>ccc</b><d></d></a>\', \'/a/d\', \'<e>fff</e>\') AS val5\n -> \\G\n\n*************************** 1. row ***************************\nval1: <e>fff</e>\nval2: <a><b>ccc</b><d></d></a>\nval3: <a><e>fff</e><d></d></a>\nval4: <a><b>ccc</b><e>fff</e></a>\nval5: <a><d></d><b>ccc</b><d></d></a>\n','http://dev.mysql.com/doc/refman/5.5/en/xml-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (38,8,'RESET SLAVE','Syntax:\nRESET SLAVE [ALL]\n\nRESET SLAVE makes the slave forget its replication position in the\nmaster\'s binary log. This statement is meant to be used for a clean\nstart: It deletes the master.info and relay-log.info files, all the\nrelay log files, and starts a new relay log file. To use RESET SLAVE,\nthe slave replication threads must be stopped (use STOP SLAVE if\nnecessary).\n\n*Note*: All relay log files are deleted, even if they have not been\ncompletely executed by the slave SQL thread. (This is a condition\nlikely to exist on a replication slave if you have issued a STOP SLAVE\nstatement or if the slave is highly loaded.)\n\nIn MySQL 5.5 (unlike the case in MySQL 5.1 and earlier), RESET SLAVE\ndoes not change any replication connection parameters such as master\nhost, master port, master user, or master password, which are retained\nin memory. This means that START SLAVE can be issued without requiring\na CHANGE MASTER TO statement following RESET SLAVE.\n\nIn MySQL 5.5.16 and later, you can use RESET SLAVE ALL to reset these\nconnection parameters (Bug #11809016). Connection parameters are also\nreset if the slave mysqld is shut down.\n\nIf the slave SQL thread was in the middle of replicating temporary\ntables when it was stopped, and RESET SLAVE is issued, these replicated\ntemporary tables are deleted on the slave.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/reset-slave.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/reset-slave.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (39,26,'SHOW BINARY LOGS','Syntax:\nSHOW BINARY LOGS\nSHOW MASTER LOGS\n\nLists the binary log files on the server. This statement is used as\npart of the procedure described in [HELP PURGE BINARY LOGS], that shows\nhow to determine which logs can be purged.\n\nmysql> SHOW BINARY LOGS;\n+---------------+-----------+\n| Log_name | File_size |\n+---------------+-----------+\n| binlog.000015 | 724935 |\n| binlog.000016 | 733481 |\n+---------------+-----------+\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-binary-logs.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-binary-logs.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (40,24,'POLYGON','Polygon(ls1,ls2,...)\n\nConstructs a Polygon value from a number of LineString or WKB\nLineString arguments. If any argument does not represent a LinearRing\n(that is, not a closed and simple LineString), the return value is\nNULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (41,31,'MINUTE','Syntax:\nMINUTE(time)\n\nReturns the minute for time, in the range 0 to 59.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT MINUTE(\'2008-02-03 10:05:03\');\n -> 5\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (42,31,'DAY','Syntax:\nDAY(date)\n\nDAY() is a synonym for DAYOFMONTH().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (43,37,'MID','Syntax:\nMID(str,pos,len)\n\nMID(str,pos,len) is a synonym for SUBSTRING(str,pos,len).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (44,14,'UUID','Syntax:\nUUID()\n\nReturns a Universal Unique Identifier (UUID) generated according to\n"DCE 1.1: Remote Procedure Call" (Appendix A) CAE (Common Applications\nEnvironment) Specifications published by The Open Group in October 1997\n(Document Number C706,\nhttp://www.opengroup.org/public/pubs/catalog/c706.htm).\n\nA UUID is designed as a number that is globally unique in space and\ntime. Two calls to UUID() are expected to generate two different\nvalues, even if these calls are performed on two separate computers\nthat are not connected to each other.\n\nA UUID is a 128-bit number represented by a utf8 string of five\nhexadecimal numbers in aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee format:\n\no The first three numbers are generated from a timestamp.\n\no The fourth number preserves temporal uniqueness in case the timestamp\n value loses monotonicity (for example, due to daylight saving time).\n\no The fifth number is an IEEE 802 node number that provides spatial\n uniqueness. A random number is substituted if the latter is not\n available (for example, because the host computer has no Ethernet\n card, or we do not know how to find the hardware address of an\n interface on your operating system). In this case, spatial uniqueness\n cannot be guaranteed. Nevertheless, a collision should have very low\n probability.\n\n Currently, the MAC address of an interface is taken into account only\n on FreeBSD and Linux. On other operating systems, MySQL uses a\n randomly generated 48-bit number.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','mysql> SELECT UUID();\n -> \'6ccd780c-baba-1026-9564-0040f4311e29\'\n','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (45,24,'LINESTRING','LineString(pt1,pt2,...)\n\nConstructs a LineString value from a number of Point or WKB Point\narguments. If the number of arguments is less than two, the return\nvalue is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (46,14,'SLEEP','Syntax:\nSLEEP(duration)\n\nSleeps (pauses) for the number of seconds given by the duration\nargument, then returns 0. If SLEEP() is interrupted, it returns 1. The\nduration may have a fractional part given in microseconds.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (47,17,'CONNECTION_ID','Syntax:\nCONNECTION_ID()\n\nReturns the connection ID (thread ID) for the connection. Every\nconnection has an ID that is unique among the set of currently\nconnected clients.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','mysql> SELECT CONNECTION_ID();\n -> 23786\n','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (48,27,'DELETE','Syntax:\nSingle-table syntax:\n\nDELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name\n [WHERE where_condition]\n [ORDER BY ...]\n [LIMIT row_count]\n\nMultiple-table syntax:\n\nDELETE [LOW_PRIORITY] [QUICK] [IGNORE]\n tbl_name[.*] [, tbl_name[.*]] ...\n FROM table_references\n [WHERE where_condition]\n\nOr:\n\nDELETE [LOW_PRIORITY] [QUICK] [IGNORE]\n FROM tbl_name[.*] [, tbl_name[.*]] ...\n USING table_references\n [WHERE where_condition]\n\nFor the single-table syntax, the DELETE statement deletes rows from\ntbl_name and returns a count of the number of deleted rows. This count\ncan be obtained by calling the ROW_COUNT() function (see\nhttp://dev.mysql.com/doc/refman/5.5/en/information-functions.html). The\nWHERE clause, if given, specifies the conditions that identify which\nrows to delete. With no WHERE clause, all rows are deleted. If the\nORDER BY clause is specified, the rows are deleted in the order that is\nspecified. The LIMIT clause places a limit on the number of rows that\ncan be deleted.\n\nFor the multiple-table syntax, DELETE deletes from each tbl_name the\nrows that satisfy the conditions. In this case, ORDER BY and LIMIT\ncannot be used.\n\nwhere_condition is an expression that evaluates to true for each row to\nbe deleted. It is specified as described in\nhttp://dev.mysql.com/doc/refman/5.5/en/select.html.\n\nCurrently, you cannot delete from a table and select from the same\ntable in a subquery.\n\nYou need the DELETE privilege on a table to delete rows from it. You\nneed only the SELECT privilege for any columns that are only read, such\nas those named in the WHERE clause.\n\nAs stated, a DELETE statement with no WHERE clause deletes all rows. A\nfaster way to do this, when you do not need to know the number of\ndeleted rows, is to use TRUNCATE TABLE. However, within a transaction\nor if you have a lock on the table, TRUNCATE TABLE cannot be used\nwhereas DELETE can. See [HELP TRUNCATE TABLE], and [HELP LOCK].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/delete.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/delete.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (49,4,'ROUND','Syntax:\nROUND(X), ROUND(X,D)\n\nRounds the argument X to D decimal places. The rounding algorithm\ndepends on the data type of X. D defaults to 0 if not specified. D can\nbe negative to cause D digits left of the decimal point of the value X\nto become zero.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT ROUND(-1.23);\n -> -1\nmysql> SELECT ROUND(-1.58);\n -> -2\nmysql> SELECT ROUND(1.58);\n -> 2\nmysql> SELECT ROUND(1.298, 1);\n -> 1.3\nmysql> SELECT ROUND(1.298, 0);\n -> 1\nmysql> SELECT ROUND(23.298, -1);\n -> 20\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (50,7,'NULLIF','Syntax:\nNULLIF(expr1,expr2)\n\nReturns NULL if expr1 = expr2 is true, otherwise returns expr1. This is\nthe same as CASE WHEN expr1 = expr2 THEN NULL ELSE expr1 END.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/control-flow-functions.html\n\n','mysql> SELECT NULLIF(1,1);\n -> NULL\nmysql> SELECT NULLIF(1,2);\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/control-flow-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (51,23,'CLOSE','Syntax:\nCLOSE cursor_name\n\nThis statement closes a previously opened cursor. For an example, see\nhttp://dev.mysql.com/doc/refman/5.5/en/cursors.html.\n\nAn error occurs if the cursor is not open.\n\nIf not closed explicitly, a cursor is closed at the end of the BEGIN\n... END block in which it was declared.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/close.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/close.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (52,8,'STOP SLAVE','Syntax:\nSTOP SLAVE [thread_types]\n\nthread_types:\n [thread_type [, thread_type] ... ]\n\nthread_type: IO_THREAD | SQL_THREAD\n\nStops the slave threads. STOP SLAVE requires the SUPER privilege.\nRecommended best practice is to execute STOP SLAVE on the slave before\nstopping the slave server (see\nhttp://dev.mysql.com/doc/refman/5.5/en/server-shutdown.html, for more\ninformation).\n\nWhen using the row-based logging format: You should execute STOP SLAVE\non the slave prior to shutting down the slave server if you are\nreplicating any tables that use a nontransactional storage engine (see\nthe Note later in this section). In MySQL 5.5.9 and later, you can also\nuse STOP SLAVE SQL_THREAD for this purpose.\n\nLike START SLAVE, this statement may be used with the IO_THREAD and\nSQL_THREAD options to name the thread or threads to be stopped.\n\n*Note*: In MySQL 5.5, STOP SLAVE waits until the current replication\nevent group affecting one or more non-transactional tables has finished\nexecuting (if there is any such replication group), or until the user\nissues a KILL QUERY or KILL CONNECTION statement. (Bug #319, Bug\n#38205)\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/stop-slave.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/stop-slave.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (53,31,'TIMEDIFF','Syntax:\nTIMEDIFF(expr1,expr2)\n\nTIMEDIFF() returns expr1 - expr2 expressed as a time value. expr1 and\nexpr2 are time or date-and-time expressions, but both must be of the\nsame type.\n\nThe result returned by TIMEDIFF() is limited to the range allowed for\nTIME values. Alternatively, you can use either of the functions\nTIMESTAMPDIFF() and UNIX_TIMESTAMP(), both of which return integers.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT TIMEDIFF(\'2000:01:01 00:00:00\',\n -> \'2000:01:01 00:00:00.000001\');\n -> \'-00:00:00.000001\'\nmysql> SELECT TIMEDIFF(\'2008-12-31 23:59:59.000001\',\n -> \'2008-12-30 01:01:01.000002\');\n -> \'46:58:57.999999\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (54,37,'REPLACE FUNCTION','Syntax:\nREPLACE(str,from_str,to_str)\n\nReturns the string str with all occurrences of the string from_str\nreplaced by the string to_str. REPLACE() performs a case-sensitive\nmatch when searching for from_str.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT REPLACE(\'www.mysql.com\', \'w\', \'Ww\');\n -> \'WwWwWw.mysql.com\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (55,28,'USE','Syntax:\nUSE db_name\n\nThe USE db_name statement tells MySQL to use the db_name database as\nthe default (current) database for subsequent statements. The database\nremains the default until the end of the session or another USE\nstatement is issued:\n\nUSE db1;\nSELECT COUNT(*) FROM mytable; # selects from db1.mytable\nUSE db2;\nSELECT COUNT(*) FROM mytable; # selects from db2.mytable\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/use.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/use.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (56,3,'LINEFROMTEXT','LineFromText(wkt[,srid]), LineStringFromText(wkt[,srid])\n\nConstructs a LINESTRING value using its WKT representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (57,7,'CASE OPERATOR','Syntax:\nCASE value WHEN [compare_value] THEN result [WHEN [compare_value] THEN\nresult ...] [ELSE result] END\n\nCASE WHEN [condition] THEN result [WHEN [condition] THEN result ...]\n[ELSE result] END\n\nThe first version returns the result where value=compare_value. The\nsecond version returns the result for the first condition that is true.\nIf there was no matching result value, the result after ELSE is\nreturned, or NULL if there is no ELSE part.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/control-flow-functions.html\n\n','mysql> SELECT CASE 1 WHEN 1 THEN \'one\'\n -> WHEN 2 THEN \'two\' ELSE \'more\' END;\n -> \'one\'\nmysql> SELECT CASE WHEN 1>0 THEN \'true\' ELSE \'false\' END;\n -> \'true\'\nmysql> SELECT CASE BINARY \'B\'\n -> WHEN \'a\' THEN 1 WHEN \'b\' THEN 2 END;\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/control-flow-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (58,26,'SHOW MASTER STATUS','Syntax:\nSHOW MASTER STATUS\n\nThis statement provides status information about the binary log files\nof the master. It requires either the SUPER or REPLICATION CLIENT\nprivilege.\n\nExample:\n\nmysql> SHOW MASTER STATUS;\n+---------------+----------+--------------+------------------+\n| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |\n+---------------+----------+--------------+------------------+\n| mysql-bin.003 | 73 | test | manual,mysql |\n+---------------+----------+--------------+------------------+\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-master-status.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-master-status.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (59,31,'ADDTIME','Syntax:\nADDTIME(expr1,expr2)\n\nADDTIME() adds expr2 to expr1 and returns the result. expr1 is a time\nor datetime expression, and expr2 is a time expression.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT ADDTIME(\'2007-12-31 23:59:59.999999\', \'1 1:1:1.000002\');\n -> \'2008-01-02 01:01:01.000001\'\nmysql> SELECT ADDTIME(\'01:00:00.999999\', \'02:00:00.999998\');\n -> \'03:00:01.999997\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (60,34,'SPATIAL','For MyISAM tables, MySQL can create spatial indexes using syntax\nsimilar to that for creating regular indexes, but extended with the\nSPATIAL keyword. Currently, columns in spatial indexes must be declared\nNOT NULL. The following examples demonstrate how to create spatial\nindexes:\n\no With CREATE TABLE:\n\nCREATE TABLE geom (g GEOMETRY NOT NULL, SPATIAL INDEX(g)) ENGINE=MyISAM;\n\no With ALTER TABLE:\n\nALTER TABLE geom ADD SPATIAL INDEX(g);\n\no With CREATE INDEX:\n\nCREATE SPATIAL INDEX sp_index ON geom (g);\n\nFor MyISAM tables, SPATIAL INDEX creates an R-tree index. For storage\nengines that support nonspatial indexing of spatial columns, the engine\ncreates a B-tree index. A B-tree index on spatial values will be useful\nfor exact-value lookups, but not for range scans.\n\nFor more information on indexing spatial columns, see [HELP CREATE\nINDEX].\n\nTo drop spatial indexes, use ALTER TABLE or DROP INDEX:\n\no With ALTER TABLE:\n\nALTER TABLE geom DROP INDEX g;\n\no With DROP INDEX:\n\nDROP INDEX sp_index ON geom;\n\nExample: Suppose that a table geom contains more than 32,000\ngeometries, which are stored in the column g of type GEOMETRY. The\ntable also has an AUTO_INCREMENT column fid for storing object ID\nvalues.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-indexes.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-indexes.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (61,31,'TO_SECONDS','Syntax:\nTO_SECONDS(expr)\n\nGiven a date or datetime expr, returns a the number of seconds since\nthe year 0. If expr is not a valid date or datetime value, returns\nNULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT TO_SECONDS(950501);\n -> 62966505600\nmysql> SELECT TO_SECONDS(\'2009-11-29\');\n -> 63426672000\nmysql> SELECT TO_SECONDS(\'2009-11-29 13:43:32\');\n -> 63426721412\nmysql> SELECT TO_SECONDS( NOW() );\n -> 63426721458\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (62,31,'TIMESTAMPDIFF','Syntax:\nTIMESTAMPDIFF(unit,datetime_expr1,datetime_expr2)\n\nReturns datetime_expr2 - datetime_expr1, where datetime_expr1 and\ndatetime_expr2 are date or datetime expressions. One expression may be\na date and the other a datetime; a date value is treated as a datetime\nhaving the time part \'00:00:00\' where necessary. The unit for the\nresult (an integer) is given by the unit argument. The legal values for\nunit are the same as those listed in the description of the\nTIMESTAMPADD() function.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT TIMESTAMPDIFF(MONTH,\'2003-02-01\',\'2003-05-01\');\n -> 3\nmysql> SELECT TIMESTAMPDIFF(YEAR,\'2002-05-01\',\'2001-01-01\');\n -> -1\nmysql> SELECT TIMESTAMPDIFF(MINUTE,\'2003-02-01\',\'2003-05-01 12:05:55\');\n -> 128885\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (63,37,'UPPER','Syntax:\nUPPER(str)\n\nReturns the string str with all characters changed to uppercase\naccording to the current character set mapping. The default is latin1\n(cp1252 West European).\n\nmysql> SELECT UPPER(\'Hej\');\n -> \'HEJ\'\n\nSee the description of LOWER() for information that also applies to\nUPPER(), such as information about how to perform lettercase conversion\nof binary strings (BINARY, VARBINARY, BLOB) for which these functions\nare ineffective.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (64,31,'FROM_UNIXTIME','Syntax:\nFROM_UNIXTIME(unix_timestamp), FROM_UNIXTIME(unix_timestamp,format)\n\nReturns a representation of the unix_timestamp argument as a value in\n\'YYYY-MM-DD HH:MM:SS\' or YYYYMMDDHHMMSS.uuuuuu format, depending on\nwhether the function is used in a string or numeric context. The value\nis expressed in the current time zone. unix_timestamp is an internal\ntimestamp value such as is produced by the UNIX_TIMESTAMP() function.\n\nIf format is given, the result is formatted according to the format\nstring, which is used the same way as listed in the entry for the\nDATE_FORMAT() function.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT FROM_UNIXTIME(1196440219);\n -> \'2007-11-30 10:30:19\'\nmysql> SELECT FROM_UNIXTIME(1196440219) + 0;\n -> 20071130103019.000000\nmysql> SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(),\n -> \'%Y %D %M %h:%i:%s %x\');\n -> \'2007 30th November 10:30:59 2007\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (65,22,'MEDIUMBLOB','MEDIUMBLOB\n\nA BLOB column with a maximum length of 16,777,215 (224 - 1) bytes. Each\nMEDIUMBLOB value is stored using a 3-byte length prefix that indicates\nthe number of bytes in the value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (66,12,'SHA2','Syntax:\nSHA2(str, hash_length)\n\nCalculates the SHA-2 family of hash functions (SHA-224, SHA-256,\nSHA-384, and SHA-512). The first argument is the cleartext string to be\nhashed. The second argument indicates the desired bit length of the\nresult, which must have a value of 224, 256, 384, 512, or 0 (which is\nequivalent to 256). If either argument is NULL or the hash length is\nnot one of the permitted values, the return value is NULL. Otherwise,\nthe function result is a hash value containing the desired number of\nbits. See the notes at the beginning of this section about storing hash\nvalues efficiently.\n\nAs of MySQL 5.5.6, the return value is a nonbinary string in the\nconnection character set. Before 5.5.6, the return value is a binary\nstring; see the notes at the beginning of this section about using the\nvalue as a nonbinary string.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','mysql> SELECT SHA2(\'abc\', 224);\n -> \'23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7\'\n','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (67,7,'IFNULL','Syntax:\nIFNULL(expr1,expr2)\n\nIf expr1 is not NULL, IFNULL() returns expr1; otherwise it returns\nexpr2. IFNULL() returns a numeric or string value, depending on the\ncontext in which it is used.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/control-flow-functions.html\n\n','mysql> SELECT IFNULL(1,0);\n -> 1\nmysql> SELECT IFNULL(NULL,10);\n -> 10\nmysql> SELECT IFNULL(1/0,10);\n -> 10\nmysql> SELECT IFNULL(1/0,\'yes\');\n -> \'yes\'\n','http://dev.mysql.com/doc/refman/5.5/en/control-flow-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (68,26,'SHOW FUNCTION CODE','Syntax:\nSHOW FUNCTION CODE func_name\n\nThis statement is similar to SHOW PROCEDURE CODE but for stored\nfunctions. See [HELP SHOW PROCEDURE CODE].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-function-code.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-function-code.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (69,26,'SHOW ERRORS','Syntax:\nSHOW ERRORS [LIMIT [offset,] row_count]\nSHOW COUNT(*) ERRORS\n\nThis statement is similar to SHOW WARNINGS, except that it displays\ninformation only for errors, rather than for errors, warnings, and\nnotes.\n\nThe LIMIT clause has the same syntax as for the SELECT statement. See\nhttp://dev.mysql.com/doc/refman/5.5/en/select.html.\n\nThe SHOW COUNT(*) ERRORS statement displays the number of errors. You\ncan also retrieve this number from the error_count variable:\n\nSHOW COUNT(*) ERRORS;\nSELECT @@error_count;\n\nSHOW ERRORS and error_count apply only to errors, not warnings or\nnotes. In other respects, they are similar to SHOW WARNINGS and\nwarning_count. In particular, SHOW ERRORS cannot display information\nfor more than max_error_count messages, and error_count can exceed the\nvalue of max_error_count if the number of errors exceeds\nmax_error_count.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-errors.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-errors.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (70,18,'LEAST','Syntax:\nLEAST(value1,value2,...)\n\nWith two or more arguments, returns the smallest (minimum-valued)\nargument. The arguments are compared using the following rules:\n\no If any argument is NULL, the result is NULL. No comparison is needed.\n\no If the return value is used in an INTEGER context or all arguments\n are integer-valued, they are compared as integers.\n\no If the return value is used in a REAL context or all arguments are\n real-valued, they are compared as reals.\n\no If the arguments comprise a mix of numbers and strings, they are\n compared as numbers.\n\no If any argument is a nonbinary (character) string, the arguments are\n compared as nonbinary strings.\n\no In all other cases, the arguments are compared as binary strings.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT LEAST(2,0);\n -> 0\nmysql> SELECT LEAST(34.0,3.0,5.0,767.0);\n -> 3.0\nmysql> SELECT LEAST(\'B\',\'A\',\'C\');\n -> \'A\'\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (71,18,'=','=\n\nEqual:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 1 = 0;\n -> 0\nmysql> SELECT \'0\' = 0;\n -> 1\nmysql> SELECT \'0.0\' = 0;\n -> 1\nmysql> SELECT \'0.01\' = 0;\n -> 0\nmysql> SELECT \'.01\' = 0.01;\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (72,37,'REVERSE','Syntax:\nREVERSE(str)\n\nReturns the string str with the order of the characters reversed.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT REVERSE(\'abc\');\n -> \'cba\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (73,18,'ISNULL','Syntax:\nISNULL(expr)\n\nIf expr is NULL, ISNULL() returns 1, otherwise it returns 0.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT ISNULL(1+1);\n -> 0\nmysql> SELECT ISNULL(1/0);\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (74,22,'BINARY','BINARY(M)\n\nThe BINARY type is similar to the CHAR type, but stores binary byte\nstrings rather than nonbinary character strings. M represents the\ncolumn length in bytes.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (75,22,'BLOB DATA TYPE','A BLOB is a binary large object that can hold a variable amount of\ndata. The four BLOB types are TINYBLOB, BLOB, MEDIUMBLOB, and LONGBLOB.\nThese differ only in the maximum length of the values they can hold.\nThe four TEXT types are TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT. These\ncorrespond to the four BLOB types and have the same maximum lengths and\nstorage requirements. See\nhttp://dev.mysql.com/doc/refman/5.5/en/storage-requirements.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/blob.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/blob.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (76,36,'BOUNDARY','Boundary(g)\n\nReturns a geometry that is the closure of the combinatorial boundary of\nthe geometry value g.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (77,10,'CREATE USER','Syntax:\nCREATE USER user_specification\n [, user_specification] ...\n\nuser_specification:\n user\n [\n IDENTIFIED BY [PASSWORD] \'password\'\n | IDENTIFIED WITH auth_plugin [AS \'auth_string\']\n ]\n\nThe CREATE USER statement creates new MySQL accounts. To use it, you\nmust have the global CREATE USER privilege or the INSERT privilege for\nthe mysql database. For each account, CREATE USER creates a new row in\nthe mysql.user table and assigns the account no privileges. An error\noccurs if the account already exists.\n\nEach account name uses the format described in\nhttp://dev.mysql.com/doc/refman/5.5/en/account-names.html. For example:\n\nCREATE USER \'jeffrey\'@\'localhost\' IDENTIFIED BY \'mypass\';\n\nIf you specify only the user name part of the account name, a host name\npart of \'%\' is used.\n\nThe user specification may indicate how the user should authenticate\nwhen connecting to the server:\n\no To enable the user to connect with no password (which is insecure),\n include no IDENTIFIED BY clause:\n\nCREATE USER \'jeffrey\'@\'localhost\';\n\n In this case, the account uses built-in authentication and clients\n must provide no password.\n\no To assign a password, use IDENTIFIED BY with the literal plaintext\n password value:\n\nCREATE USER \'jeffrey\'@\'localhost\' IDENTIFIED BY \'mypass\';\n\n The account uses built-in authentication and clients must match the\n given password.\n\no To avoid specifying the plaintext password if you know its hash value\n (the value that PASSWORD() would return for the password), specify\n the hash value preceded by the keyword PASSWORD:\n\nCREATE USER \'jeffrey\'@\'localhost\'\nIDENTIFIED BY PASSWORD \'*90E462C37378CED12064BB3388827D2BA3A9B689\';\n\n The account uses built-in authentication and clients must match the\n given password.\n\no To authenticate the account using a specific authentication plugin,\n use IDENTIFIED WITH, where auth_plugin is the plugin name. It can be\n an unquoted name or a quoted string literal. \'auth_string\' is an\n optional quoted string literal to pass to the plugin. The plugin\n interprets the meaning of the string, so its format is plugin\n specific. Consult the documentation for a given plugin for\n information about the authentication string values it accepts.\n\nCREATE USER \'jeffrey\'@\'localhost\'\nIDENTIFIED WITH my_auth_plugin;\n\n For connections that use this account, the server invokes the named\n plugin and clients must provide credentials as required for the\n authentication method that the plugin implements. If the server\n cannot find the plugin, either at account-creation time or connect\n time, an error occurs. IDENTIFIED WITH can be used as of MySQL 5.5.7.\n\nThe IDENTIFIED BY and IDENTIFIED WITH clauses are mutually exclusive,\nso at most one of them can be specified for a given user.\n\nFor additional information about setting passwords, see\nhttp://dev.mysql.com/doc/refman/5.5/en/assigning-passwords.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-user.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/create-user.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (78,24,'POINT','Point(x,y)\n\nConstructs a Point using its coordinates.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (79,17,'CURRENT_USER','Syntax:\nCURRENT_USER, CURRENT_USER()\n\nReturns the user name and host name combination for the MySQL account\nthat the server used to authenticate the current client. This account\ndetermines your access privileges. The return value is a string in the\nutf8 character set.\n\nThe value of CURRENT_USER() can differ from the value of USER().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','mysql> SELECT USER();\n -> \'davida@localhost\'\nmysql> SELECT * FROM mysql.user;\nERROR 1044: Access denied for user \'\'@\'localhost\' to\ndatabase \'mysql\'\nmysql> SELECT CURRENT_USER();\n -> \'@localhost\'\n','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (80,37,'LCASE','Syntax:\nLCASE(str)\n\nLCASE() is a synonym for LOWER().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (81,18,'<=','Syntax:\n<=\n\nLess than or equal:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 0.1 <= 2;\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (82,26,'SHOW PROFILES','Syntax:\nSHOW PROFILES\n\nThe SHOW PROFILES statement, together with SHOW PROFILE, displays\nprofiling information that indicates resource usage for statements\nexecuted during the course of the current session. For more\ninformation, see [HELP SHOW PROFILE].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-profiles.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-profiles.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (83,27,'UPDATE','Syntax:\nSingle-table syntax:\n\nUPDATE [LOW_PRIORITY] [IGNORE] table_reference\n SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] ...\n [WHERE where_condition]\n [ORDER BY ...]\n [LIMIT row_count]\n\nMultiple-table syntax:\n\nUPDATE [LOW_PRIORITY] [IGNORE] table_references\n SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] ...\n [WHERE where_condition]\n\nFor the single-table syntax, the UPDATE statement updates columns of\nexisting rows in the named table with new values. The SET clause\nindicates which columns to modify and the values they should be given.\nEach value can be given as an expression, or the keyword DEFAULT to set\na column explicitly to its default value. The WHERE clause, if given,\nspecifies the conditions that identify which rows to update. With no\nWHERE clause, all rows are updated. If the ORDER BY clause is\nspecified, the rows are updated in the order that is specified. The\nLIMIT clause places a limit on the number of rows that can be updated.\n\nFor the multiple-table syntax, UPDATE updates rows in each table named\nin table_references that satisfy the conditions. In this case, ORDER BY\nand LIMIT cannot be used.\n\nwhere_condition is an expression that evaluates to true for each row to\nbe updated. For expression syntax, see\nhttp://dev.mysql.com/doc/refman/5.5/en/expressions.html.\n\ntable_references and where_condition are is specified as described in\nhttp://dev.mysql.com/doc/refman/5.5/en/select.html.\n\nYou need the UPDATE privilege only for columns referenced in an UPDATE\nthat are actually updated. You need only the SELECT privilege for any\ncolumns that are read but not modified.\n\nThe UPDATE statement supports the following modifiers:\n\no With the LOW_PRIORITY keyword, execution of the UPDATE is delayed\n until no other clients are reading from the table. This affects only\n storage engines that use only table-level locking (such as MyISAM,\n MEMORY, and MERGE).\n\no With the IGNORE keyword, the update statement does not abort even if\n errors occur during the update. Rows for which duplicate-key\n conflicts occur are not updated. Rows for which columns are updated\n to values that would cause data conversion errors are updated to the\n closest valid values instead.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/update.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/update.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (84,18,'IS NOT NULL','Syntax:\nIS NOT NULL\n\nTests whether a value is not NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 1 IS NOT NULL, 0 IS NOT NULL, NULL IS NOT NULL;\n -> 1, 1, 0\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (85,23,'CASE STATEMENT','Syntax:\nCASE case_value\n WHEN when_value THEN statement_list\n [WHEN when_value THEN statement_list] ...\n [ELSE statement_list]\nEND CASE\n\nOr:\n\nCASE\n WHEN search_condition THEN statement_list\n [WHEN search_condition THEN statement_list] ...\n [ELSE statement_list]\nEND CASE\n\nThe CASE statement for stored programs implements a complex conditional\nconstruct.\n\n*Note*: There is also a CASE expression, which differs from the CASE\nstatement described here. See\nhttp://dev.mysql.com/doc/refman/5.5/en/control-flow-functions.html. The\nCASE statement cannot have an ELSE NULL clause, and it is terminated\nwith END CASE instead of END.\n\nFor the first syntax, case_value is an expression. This value is\ncompared to the when_value expression in each WHEN clause until one of\nthem is equal. When an equal when_value is found, the corresponding\nTHEN clause statement_list executes. If no when_value is equal, the\nELSE clause statement_list executes, if there is one.\n\nThis syntax cannot be used to test for equality with NULL because NULL\n= NULL is false. See\nhttp://dev.mysql.com/doc/refman/5.5/en/working-with-null.html.\n\nFor the second syntax, each WHEN clause search_condition expression is\nevaluated until one is true, at which point its corresponding THEN\nclause statement_list executes. If no search_condition is equal, the\nELSE clause statement_list executes, if there is one.\n\nIf no when_value or search_condition matches the value tested and the\nCASE statement contains no ELSE clause, a Case not found for CASE\nstatement error results.\n\nEach statement_list consists of one or more SQL statements; an empty\nstatement_list is not permitted.\n\nTo handle situations where no value is matched by any WHEN clause, use\nan ELSE containing an empty BEGIN ... END block, as shown in this\nexample. (The indentation used here in the ELSE clause is for purposes\nof clarity only, and is not otherwise significant.)\n\nDELIMITER |\n\nCREATE PROCEDURE p()\n BEGIN\n DECLARE v INT DEFAULT 1;\n\n CASE v\n WHEN 2 THEN SELECT v;\n WHEN 3 THEN SELECT 0;\n ELSE\n BEGIN\n END;\n END CASE;\n END;\n |\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/case.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/case.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (86,8,'EXECUTE STATEMENT','Syntax:\nEXECUTE stmt_name\n [USING @var_name [, @var_name] ...]\n\nAfter preparing a statement with PREPARE, you execute it with an\nEXECUTE statement that refers to the prepared statement name. If the\nprepared statement contains any parameter markers, you must supply a\nUSING clause that lists user variables containing the values to be\nbound to the parameters. Parameter values can be supplied only by user\nvariables, and the USING clause must name exactly as many variables as\nthe number of parameter markers in the statement.\n\nYou can execute a given prepared statement multiple times, passing\ndifferent variables to it or setting the variables to different values\nbefore each execution.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/execute.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/execute.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (87,39,'DROP INDEX','Syntax:\nDROP [ONLINE|OFFLINE] INDEX index_name ON tbl_name\n\nDROP INDEX drops the index named index_name from the table tbl_name.\nThis statement is mapped to an ALTER TABLE statement to drop the index.\nSee [HELP ALTER TABLE].\n\nTo drop a primary key, the index name is always PRIMARY, which must be\nspecified as a quoted identifier because PRIMARY is a reserved word:\n\nDROP INDEX `PRIMARY` ON t;\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-index.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-index.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (88,37,'MATCH AGAINST','Syntax:\nMATCH (col1,col2,...) AGAINST (expr [search_modifier])\n\nMySQL has support for full-text indexing and searching:\n\no A full-text index in MySQL is an index of type FULLTEXT.\n\no Full-text indexes can be used only with MyISAM tables, and can be\n created only for CHAR, VARCHAR, or TEXT columns.\n\no A FULLTEXT index definition can be given in the CREATE TABLE\n statement when a table is created, or added later using ALTER TABLE\n or CREATE INDEX.\n\no For large data sets, it is much faster to load your data into a table\n that has no FULLTEXT index and then create the index after that, than\n to load data into a table that has an existing FULLTEXT index.\n\nFull-text searching is performed using MATCH() ... AGAINST syntax.\nMATCH() takes a comma-separated list that names the columns to be\nsearched. AGAINST takes a string to search for, and an optional\nmodifier that indicates what type of search to perform. The search\nstring must be a literal string, not a variable or a column name. There\nare three types of full-text searches:\n\no A natural language search interprets the search string as a phrase in\n natural human language (a phrase in free text). There are no special\n operators. The stopword list applies. In addition, words that are\n present in 50% or more of the rows are considered common and do not\n match.\n\n Full-text searches are natural language searches if the IN NATURAL\n LANGUAGE MODE modifier is given or if no modifier is given. For more\n information, see\n http://dev.mysql.com/doc/refman/5.5/en/fulltext-natural-language.html\n .\n\no A boolean search interprets the search string using the rules of a\n special query language. The string contains the words to search for.\n It can also contain operators that specify requirements such that a\n word must be present or absent in matching rows, or that it should be\n weighted higher or lower than usual. Common words such as "some" or\n "then" are stopwords and do not match if present in the search\n string. The IN BOOLEAN MODE modifier specifies a boolean search. For\n more information, see\n http://dev.mysql.com/doc/refman/5.5/en/fulltext-boolean.html.\n\no A query expansion search is a modification of a natural language\n search. The search string is used to perform a natural language\n search. Then words from the most relevant rows returned by the search\n are added to the search string and the search is done again. The\n query returns the rows from the second search. The IN NATURAL\n LANGUAGE MODE WITH QUERY EXPANSION or WITH QUERY EXPANSION modifier\n specifies a query expansion search. For more information, see\n http://dev.mysql.com/doc/refman/5.5/en/fulltext-query-expansion.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/fulltext-search.html\n\n','mysql> SELECT id, body, MATCH (title,body) AGAINST\n -> (\'Security implications of running MySQL as root\'\n -> IN NATURAL LANGUAGE MODE) AS score\n -> FROM articles WHERE MATCH (title,body) AGAINST\n -> (\'Security implications of running MySQL as root\'\n -> IN NATURAL LANGUAGE MODE);\n+----+-------------------------------------+-----------------+\n| id | body | score |\n+----+-------------------------------------+-----------------+\n| 4 | 1. Never run mysqld as root. 2. ... | 1.5219271183014 |\n| 6 | When configured properly, MySQL ... | 1.3114095926285 |\n+----+-------------------------------------+-----------------+\n2 rows in set (0.00 sec)\n','http://dev.mysql.com/doc/refman/5.5/en/fulltext-search.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (89,39,'CREATE EVENT','Syntax:\nCREATE\n [DEFINER = { user | CURRENT_USER }]\n EVENT\n [IF NOT EXISTS]\n event_name\n ON SCHEDULE schedule\n [ON COMPLETION [NOT] PRESERVE]\n [ENABLE | DISABLE | DISABLE ON SLAVE]\n [COMMENT \'comment\']\n DO event_body;\n\nschedule:\n AT timestamp [+ INTERVAL interval] ...\n | EVERY interval\n [STARTS timestamp [+ INTERVAL interval] ...]\n [ENDS timestamp [+ INTERVAL interval] ...]\n\ninterval:\n quantity {YEAR | QUARTER | MONTH | DAY | HOUR | MINUTE |\n WEEK | SECOND | YEAR_MONTH | DAY_HOUR | DAY_MINUTE |\n DAY_SECOND | HOUR_MINUTE | HOUR_SECOND | MINUTE_SECOND}\n\nThis statement creates and schedules a new event. The event will not\nrun unless the Event Scheduler is enabled. For information about\nchecking Event Scheduler status and enabling it if necessary, see\nhttp://dev.mysql.com/doc/refman/5.5/en/events-configuration.html.\n\nCREATE EVENT requires the EVENT privilege for the schema in which the\nevent is to be created. It might also require the SUPER privilege,\ndepending on the DEFINER value, as described later in this section.\n\nThe minimum requirements for a valid CREATE EVENT statement are as\nfollows:\n\no The keywords CREATE EVENT plus an event name, which uniquely\n identifies the event in a database schema.\n\no An ON SCHEDULE clause, which determines when and how often the event\n executes.\n\no A DO clause, which contains the SQL statement to be executed by an\n event.\n\nThis is an example of a minimal CREATE EVENT statement:\n\nCREATE EVENT myevent\n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR\n DO\n UPDATE myschema.mytable SET mycol = mycol + 1;\n\nThe previous statement creates an event named myevent. This event\nexecutes once---one hour following its creation---by running an SQL\nstatement that increments the value of the myschema.mytable table\'s\nmycol column by 1.\n\nThe event_name must be a valid MySQL identifier with a maximum length\nof 64 characters. Event names are not case sensitive, so you cannot\nhave two events named myevent and MyEvent in the same schema. In\ngeneral, the rules governing event names are the same as those for\nnames of stored routines. See\nhttp://dev.mysql.com/doc/refman/5.5/en/identifiers.html.\n\nAn event is associated with a schema. If no schema is indicated as part\nof event_name, the default (current) schema is assumed. To create an\nevent in a specific schema, qualify the event name with a schema using\nschema_name.event_name syntax.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-event.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/create-event.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (90,4,'ABS','Syntax:\nABS(X)\n\nReturns the absolute value of X.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT ABS(2);\n -> 2\nmysql> SELECT ABS(-32);\n -> 32\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (91,32,'POLYFROMWKB','PolyFromWKB(wkb[,srid]), PolygonFromWKB(wkb[,srid])\n\nConstructs a POLYGON value using its WKB representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (92,37,'NOT LIKE','Syntax:\nexpr NOT LIKE pat [ESCAPE \'escape_char\']\n\nThis is the same as NOT (expr LIKE pat [ESCAPE \'escape_char\']).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-comparison-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-comparison-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (93,37,'SPACE','Syntax:\nSPACE(N)\n\nReturns a string consisting of N space characters.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT SPACE(6);\n -> \' \'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (94,6,'MBR DEFINITION','Its MBR (Minimum Bounding Rectangle), or Envelope. This is the bounding\ngeometry, formed by the minimum and maximum (X,Y) coordinates:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/gis-class-geometry.html\n\n','((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))\n','http://dev.mysql.com/doc/refman/5.5/en/gis-class-geometry.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (95,24,'GEOMETRYCOLLECTION','GeometryCollection(g1,g2,...)\n\nConstructs a GeometryCollection.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (96,16,'MAX','Syntax:\nMAX([DISTINCT] expr)\n\nReturns the maximum value of expr. MAX() may take a string argument; in\nsuch cases, it returns the maximum string value. See\nhttp://dev.mysql.com/doc/refman/5.5/en/mysql-indexes.html. The DISTINCT\nkeyword can be used to find the maximum of the distinct values of expr,\nhowever, this produces the same result as omitting DISTINCT.\n\nMAX() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','mysql> SELECT student_name, MIN(test_score), MAX(test_score)\n -> FROM student\n -> GROUP BY student_name;\n','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (97,21,'CREATE FUNCTION UDF','Syntax:\nCREATE [AGGREGATE] FUNCTION function_name RETURNS {STRING|INTEGER|REAL|DECIMAL}\n SONAME shared_library_name\n\nA user-defined function (UDF) is a way to extend MySQL with a new\nfunction that works like a native (built-in) MySQL function such as\nABS() or CONCAT().\n\nfunction_name is the name that should be used in SQL statements to\ninvoke the function. The RETURNS clause indicates the type of the\nfunction\'s return value. DECIMAL is a legal value after RETURNS, but\ncurrently DECIMAL functions return string values and should be written\nlike STRING functions.\n\nshared_library_name is the basename of the shared object file that\ncontains the code that implements the function. The file must be\nlocated in the plugin directory. This directory is given by the value\nof the plugin_dir system variable. For more information, see\nhttp://dev.mysql.com/doc/refman/5.5/en/udf-compiling.html.\n\nTo create a function, you must have the INSERT privilege for the mysql\ndatabase. This is necessary because CREATE FUNCTION adds a row to the\nmysql.func system table that records the function\'s name, type, and\nshared library name. If you do not have this table, you should run the\nmysql_upgrade command to create it. See\nhttp://dev.mysql.com/doc/refman/5.5/en/mysql-upgrade.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-function-udf.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/create-function-udf.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (98,4,'*','Syntax:\n*\n\nMultiplication:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html\n\n','mysql> SELECT 3*5;\n -> 15\nmysql> SELECT 18014398509481984*18014398509481984.0;\n -> 324518553658426726783156020576256.0\nmysql> SELECT 18014398509481984*18014398509481984;\n -> 0\n','http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (99,22,'TIMESTAMP','TIMESTAMP\n\nA timestamp. The range is \'1970-01-01 00:00:01\' UTC to \'2038-01-19\n03:14:07\' UTC. TIMESTAMP values are stored as the number of seconds\nsince the epoch (\'1970-01-01 00:00:00\' UTC). A TIMESTAMP cannot\nrepresent the value \'1970-01-01 00:00:00\' because that is equivalent to\n0 seconds from the epoch and the value 0 is reserved for representing\n\'0000-00-00 00:00:00\', the "zero" TIMESTAMP value.\n\nUnless specified otherwise, the first TIMESTAMP column in a table is\ndefined to be automatically set to the date and time of the most recent\nmodification if not explicitly assigned a value. This makes TIMESTAMP\nuseful for recording the timestamp of an INSERT or UPDATE operation.\nYou can also set any TIMESTAMP column to the current date and time by\nassigning it a NULL value, unless it has been defined with the NULL\nattribute to permit NULL values. The automatic initialization and\nupdating to the current date and time can be specified using DEFAULT\nCURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP clauses, as described\nin\nhttp://dev.mysql.com/doc/refman/5.5/en/timestamp-initialization.html.\n\n*Note*: The TIMESTAMP format that was used prior to MySQL 4.1 is not\nsupported in MySQL 5.5; see MySQL 3.23, 4.0, 4.1 Reference Manual for\ninformation regarding the old format.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (100,12,'DES_DECRYPT','Syntax:\nDES_DECRYPT(crypt_str[,key_str])\n\nDecrypts a string encrypted with DES_ENCRYPT(). If an error occurs,\nthis function returns NULL.\n\nThis function works only if MySQL has been configured with SSL support.\nSee http://dev.mysql.com/doc/refman/5.5/en/ssl-connections.html.\n\nIf no key_str argument is given, DES_DECRYPT() examines the first byte\nof the encrypted string to determine the DES key number that was used\nto encrypt the original string, and then reads the key from the DES key\nfile to decrypt the message. For this to work, the user must have the\nSUPER privilege. The key file can be specified with the --des-key-file\nserver option.\n\nIf you pass this function a key_str argument, that string is used as\nthe key for decrypting the message.\n\nIf the crypt_str argument does not appear to be an encrypted string,\nMySQL returns the given crypt_str.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (101,26,'CACHE INDEX','Syntax:\nCACHE INDEX\n tbl_index_list [, tbl_index_list] ...\n [PARTITION (partition_list | ALL)]\n IN key_cache_name\n\ntbl_index_list:\n tbl_name [[INDEX|KEY] (index_name[, index_name] ...)]\n\npartition_list:\n partition_name[, partition_name][, ...]\n\nThe CACHE INDEX statement assigns table indexes to a specific key\ncache. It is used only for MyISAM tables. After the indexes have been\nassigned, they can be preloaded into the cache if desired with LOAD\nINDEX INTO CACHE.\n\nThe following statement assigns indexes from the tables t1, t2, and t3\nto the key cache named hot_cache:\n\nmysql> CACHE INDEX t1, t2, t3 IN hot_cache;\n+---------+--------------------+----------+----------+\n| Table | Op | Msg_type | Msg_text |\n+---------+--------------------+----------+----------+\n| test.t1 | assign_to_keycache | status | OK |\n| test.t2 | assign_to_keycache | status | OK |\n| test.t3 | assign_to_keycache | status | OK |\n+---------+--------------------+----------+----------+\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/cache-index.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/cache-index.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (102,13,'ENDPOINT','EndPoint(ls)\n\nReturns the Point that is the endpoint of the LineString value ls.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#linestring-property-functions\n\n','mysql> SET @ls = \'LineString(1 1,2 2,3 3)\';\nmysql> SELECT AsText(EndPoint(GeomFromText(@ls)));\n+-------------------------------------+\n| AsText(EndPoint(GeomFromText(@ls))) |\n+-------------------------------------+\n| POINT(3 3) |\n+-------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#linestring-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (103,12,'COMPRESS','Syntax:\nCOMPRESS(string_to_compress)\n\nCompresses a string and returns the result as a binary string. This\nfunction requires MySQL to have been compiled with a compression\nlibrary such as zlib. Otherwise, the return value is always NULL. The\ncompressed string can be uncompressed with UNCOMPRESS().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','mysql> SELECT LENGTH(COMPRESS(REPEAT(\'a\',1000)));\n -> 21\nmysql> SELECT LENGTH(COMPRESS(\'\'));\n -> 0\nmysql> SELECT LENGTH(COMPRESS(\'a\'));\n -> 13\nmysql> SELECT LENGTH(COMPRESS(REPEAT(\'a\',16)));\n -> 15\n','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (104,27,'INSERT','Syntax:\nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [(col_name,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n [ ON DUPLICATE KEY UPDATE\n col_name=expr\n [, col_name=expr] ... ]\n\nOr:\n\nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name\n SET col_name={expr | DEFAULT}, ...\n [ ON DUPLICATE KEY UPDATE\n col_name=expr\n [, col_name=expr] ... ]\n\nOr:\n\nINSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [(col_name,...)]\n SELECT ...\n [ ON DUPLICATE KEY UPDATE\n col_name=expr\n [, col_name=expr] ... ]\n\nINSERT inserts new rows into an existing table. The INSERT ... VALUES\nand INSERT ... SET forms of the statement insert rows based on\nexplicitly specified values. The INSERT ... SELECT form inserts rows\nselected from another table or tables. INSERT ... SELECT is discussed\nfurther in [HELP INSERT SELECT].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/insert.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/insert.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (105,16,'COUNT','Syntax:\nCOUNT(expr)\n\nReturns a count of the number of non-NULL values of expr in the rows\nretrieved by a SELECT statement. The result is a BIGINT value.\n\nCOUNT() returns 0 if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','mysql> SELECT student.student_name,COUNT(*)\n -> FROM student,course\n -> WHERE student.student_id=course.student_id\n -> GROUP BY student_name;\n','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (106,27,'HANDLER','Syntax:\nHANDLER tbl_name OPEN [ [AS] alias]\n\nHANDLER tbl_name READ index_name { = | <= | >= | < | > } (value1,value2,...)\n [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name READ index_name { FIRST | NEXT | PREV | LAST }\n [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name READ { FIRST | NEXT }\n [ WHERE where_condition ] [LIMIT ... ]\n\nHANDLER tbl_name CLOSE\n\nThe HANDLER statement provides direct access to table storage engine\ninterfaces. It is available for MyISAM and InnoDB tables.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/handler.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/handler.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (107,3,'MLINEFROMTEXT','MLineFromText(wkt[,srid]), MultiLineStringFromText(wkt[,srid])\n\nConstructs a MULTILINESTRING value using its WKT representation and\nSRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (108,32,'GEOMCOLLFROMWKB','GeomCollFromWKB(wkb[,srid]), GeometryCollectionFromWKB(wkb[,srid])\n\nConstructs a GEOMETRYCOLLECTION value using its WKB representation and\nSRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (0,16,'MIN','Syntax:\nMIN([DISTINCT] expr)\n\nReturns the minimum value of expr. MIN() may take a string argument; in\nsuch cases, it returns the minimum string value.\nThe DISTINCT keyword can be used to find the minimum of the distinct values\nof expr, however, this produces the same result as omitting DISTINCT.\n\nMIN() returns NULL if there were no matching rows.\n\nURL: https://mariadb.com/kb/en/min/\n\n','MariaDB> SELECT student_name, MIN(test_score), MAX(test_score)\n -> FROM student\n -> GROUP BY student_name;\n','https://mariadb.com/kb/en/min/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (1,27,'JOIN','MySQL supports the following JOIN syntaxes for the table_references\npart of SELECT statements and multiple-table DELETE and UPDATE\nstatements:\n\ntable_references:\n table_reference [, table_reference] ...\n\ntable_reference:\n table_factor\n | join_table\n\ntable_factor:\n tbl_name [[AS] alias] [index_hint_list]\n | table_subquery [AS] alias\n | ( table_references )\n | { OJ table_reference LEFT OUTER JOIN table_reference\n ON conditional_expr }\n\njoin_table:\n table_reference [INNER | CROSS] JOIN table_factor [join_condition]\n | table_reference STRAIGHT_JOIN table_factor\n | table_reference STRAIGHT_JOIN table_factor ON conditional_expr\n | table_reference {LEFT|RIGHT} [OUTER] JOIN table_reference join_condition\n | table_reference NATURAL [{LEFT|RIGHT} [OUTER]] JOIN table_factor\n\njoin_condition:\n ON conditional_expr\n | USING (column_list)\n\nindex_hint_list:\n index_hint [, index_hint] ...\n\nindex_hint:\n USE {INDEX|KEY}\n [FOR {JOIN|ORDER BY|GROUP BY}] ([index_list])\n | IGNORE {INDEX|KEY}\n [FOR {JOIN|ORDER BY|GROUP BY}] (index_list)\n | FORCE {INDEX|KEY}\n [FOR {JOIN|ORDER BY|GROUP BY}] (index_list)\n\nindex_list:\n index_name [, index_name] ...\n\nA table reference is also known as a join expression.\n\nThe syntax of table_factor is extended in comparison with the SQL\nStandard. The latter accepts only table_reference, not a list of them\ninside a pair of parentheses.\n\nThis is a conservative extension if we consider each comma in a list of\ntable_reference items as equivalent to an inner join. For example:\n\nSELECT * FROM t1 LEFT JOIN (t2, t3, t4)\n ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)\n\nis equivalent to:\n\nSELECT * FROM t1 LEFT JOIN (t2 CROSS JOIN t3 CROSS JOIN t4)\n ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)\n\nIn MySQL, JOIN, CROSS JOIN, and INNER JOIN are syntactic equivalents\n(they can replace each other). In standard SQL, they are not\nequivalent. INNER JOIN is used with an ON clause, CROSS JOIN is used\notherwise.\n\nIn general, parentheses can be ignored in join expressions containing\nonly inner join operations.\n\nIndex hints can be specified to affect how the MySQL optimizer makes\nuse of indexes. For more information, see\nhttps://mariadb.com/kb/en/how-to-force-query-plans/.\n\nURL: https://mariadb.com/kb/en/join-syntax/\n\n','SELECT left_tbl.*\n FROM left_tbl LEFT JOIN right_tbl ON left_tbl.id = right_tbl.id\n WHERE right_tbl.id IS NULL;\n','https://mariadb.com/kb/en/join-syntax/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (2,37,'HEX','Syntax:\nHEX(str), HEX(N)\n\nFor a string argument str, HEX() returns a hexadecimal string\nrepresentation of str where each character in str is converted to two\nhexadecimal digits. The inverse of this operation is performed by the\nUNHEX() function.\n\nFor a numeric argument N, HEX() returns a hexadecimal string\nrepresentation of the value of N treated as a longlong (BIGINT) number.\nThis is equivalent to CONV(N,10,16). The inverse of this operation is\nperformed by CONV(HEX(N),16,10).\n\nURL: https://mariadb.com/kb/en/hex/\n\n','MariaDB> SELECT 0x616263, HEX(\'abc\'), UNHEX(HEX(\'abc\'));\n -> \'abc\', 616263, \'abc\'\nMariaDB> SELECT HEX(255), CONV(HEX(255),16,10);\n -> \'FF\', 255\n','https://mariadb.com/kb/en/hex/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (3,27,'REPLACE','Syntax:\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [(col_name,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n\nOr:\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name\n SET col_name={expr | DEFAULT}, ...\n\nOr:\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [(col_name,...)]\n SELECT ...\n\nREPLACE works exactly like INSERT, except that if an old row in the\ntable has the same value as a new row for a PRIMARY KEY or a UNIQUE\nindex, the old row is deleted before the new row is inserted. See [HELP\nINSERT].\n\nREPLACE is a MySQL extension to the SQL standard. It either inserts, or\ndeletes and inserts. For another MySQL extension to standard SQL---that\neither inserts or updates---see\nhttps://mariadb.com/kb/en/insert-on-duplicate-key-update/.\n\nNote that unless the table has a PRIMARY KEY or UNIQUE index, using a\nREPLACE statement makes no sense. It becomes equivalent to INSERT,\nbecause there is no index to be used to determine whether a new row\nduplicates another.\n\nValues for all columns are taken from the values specified in the\nREPLACE statement. Any missing columns are set to their default values,\njust as happens for INSERT. You cannot refer to values from the current\nrow and use them in the new row. If you use an assignment such as SET\ncol_name = col_name + 1, the reference to the column name on the right\nhand side is treated as DEFAULT(col_name), so the assignment is\nequivalent to SET col_name = DEFAULT(col_name) + 1.\n\nTo use REPLACE, you must have both the INSERT and DELETE privileges for\nthe table.\n\nURL: https://mariadb.com/kb/en/replace/\n\n','','https://mariadb.com/kb/en/replace/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (4,30,'CONTAINS','Contains(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 completely contains g2. This\ntests the opposite relationship as Within().\n\nURL: https://mariadb.com/kb/en/contains/\n\n','','https://mariadb.com/kb/en/contains/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (5,36,'SRID','SRID(g)\n\nReturns an integer indicating the Spatial Reference System ID for the\ngeometry value g.\n\nIn MySQL, the SRID value is just an integer associated with the\ngeometry value. All calculations are done assuming Euclidean (planar)\ngeometry.\n\nURL: https://mariadb.com/kb/en/srid/\n\n','MariaDB> SELECT SRID(GeomFromText(\'LineString(1 1,2 2)\',101));\n+-----------------------------------------------+\n| SRID(GeomFromText(\'LineString(1 1,2 2)\',101)) |\n+-----------------------------------------------+\n| 101 |\n+-----------------------------------------------+\n','https://mariadb.com/kb/en/srid/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (6,31,'CURRENT_TIMESTAMP','Syntax:\nCURRENT_TIMESTAMP, CURRENT_TIMESTAMP()\n\nCURRENT_TIMESTAMP and CURRENT_TIMESTAMP() are synonyms for NOW().\n\nURL: https://mariadb.com/kb/en/current_timestamp/\n\n','','https://mariadb.com/kb/en/current_timestamp/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (7,26,'SHOW CONTRIBUTORS','Syntax:\nSHOW CONTRIBUTORS\n\nThe SHOW CONTRIBUTORS statement displays information about the people\nwho contribute to MySQL source or to causes that we support. For each\ncontributor, it displays Name, Location, and Comment values.\n\nURL: https://mariadb.com/kb/en/show-contributors/\n\n','','https://mariadb.com/kb/en/show-contributors/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (8,16,'VARIANCE','Syntax:\nVARIANCE(expr)\n\nReturns the population standard variance of expr. This is an extension\nto standard SQL. The standard SQL function VAR_POP() can be used\ninstead.\n\nVARIANCE() returns NULL if there were no matching rows.\n\nURL: https://mariadb.com/kb/en/variance/\n\n','','https://mariadb.com/kb/en/variance/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (9,39,'DROP SERVER','Syntax:\nDROP SERVER [ IF EXISTS ] server_name\n\nDrops the server definition for the server named server_name. The\ncorresponding row within the mysql.servers table will be deleted. This\nstatement requires the SUPER privilege.\n\nDropping a server for a table does not affect any FEDERATED tables that\nused this connection information when they were created. See [HELP\nCREATE SERVER].\n\nURL: https://mariadb.com/kb/en/drop-server/\n\n','','https://mariadb.com/kb/en/drop-server/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (10,26,'SHOW AUTHORS','Syntax:\nSHOW AUTHORS\n\nThe SHOW AUTHORS statement displays information about the people who\nwork on MySQL. For each author, it displays Name, Location, and Comment\nvalues.\n\nURL: https://mariadb.com/kb/en/show-authors/\n\n','','https://mariadb.com/kb/en/show-authors/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (11,16,'VAR_SAMP','Syntax:\nVAR_SAMP(expr)\n\nReturns the sample variance of expr. That is, the denominator is the\nnumber of rows minus one.\n\nVAR_SAMP() returns NULL if there were no matching rows.\n\nURL: https://mariadb.com/kb/en/var_samp/\n\n','','https://mariadb.com/kb/en/var_samp/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (12,37,'CONCAT','Syntax:\nCONCAT(str1,str2,...)\n\nReturns the string that results from concatenating the arguments. May\nhave one or more arguments. If all arguments are nonbinary strings, the\nresult is a nonbinary string. If the arguments include any binary\nstrings, the result is a binary string. A numeric argument is converted\nto its equivalent string form. This is a nonbinary string as of MySQL\n5.5.3. Before 5.5.3, it is a binary string; to to avoid that and\nproduce a nonbinary string, you can use an explicit type cast, as in\nthis example:\n\nSELECT CONCAT(CAST(int_col AS CHAR), char_col);\n\nCONCAT() returns NULL if any argument is NULL.\n\nURL: https://mariadb.com/kb/en/concat/\n\n','MariaDB> SELECT CONCAT(\'My\', \'S\', \'QL\');\n -> \'MySQL\'\nMariaDB> SELECT CONCAT(\'My\', NULL, \'QL\');\n -> NULL\nMariaDB> SELECT CONCAT(14.3);\n -> \'14.3\'\n','https://mariadb.com/kb/en/concat/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (13,34,'GEOMETRY HIERARCHY','Geometry is the base class. It is an abstract class. The instantiable\nsubclasses of Geometry are restricted to zero-, one-, and\ntwo-dimensional geometric objects that exist in two-dimensional\ncoordinate space. All instantiable geometry classes are defined so that\nvalid instances of a geometry class are topologically closed (that is,\nall defined geometries include their boundary).\n\nThe base Geometry class has subclasses for Point, Curve, Surface, and\nGeometryCollection:\n\no Point represents zero-dimensional objects.\n\no Curve represents one-dimensional objects, and has subclass\n LineString, with sub-subclasses Line and LinearRing.\n\no Surface is designed for two-dimensional objects and has subclass\n Polygon.\n\no GeometryCollection has specialized zero-, one-, and two-dimensional\n collection classes named MultiPoint, MultiLineString, and\n MultiPolygon for modeling geometries corresponding to collections of\n Points, LineStrings, and Polygons, respectively. MultiCurve and\n MultiSurface are introduced as abstract superclasses that generalize\n the collection interfaces to handle Curves and Surfaces.\n\nGeometry, Curve, Surface, MultiCurve, and MultiSurface are defined as\nnoninstantiable classes. They define a common set of methods for their\nsubclasses and are included for extensibility.\n\nPoint, LineString, Polygon, GeometryCollection, MultiPoint,\nMultiLineString, and MultiPolygon are instantiable classes.\n\nURL: https://mariadb.com/kb/en/geometry-hierarchy/\n\n','','https://mariadb.com/kb/en/geometry-hierarchy/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (14,37,'CHAR FUNCTION','Syntax:\nCHAR(N,... [USING charset_name])\n\nCHAR() interprets each argument N as an integer and returns a string\nconsisting of the characters given by the code values of those\nintegers. NULL values are skipped.\nBy default, CHAR() returns a binary string. To produce a string in a\ngiven character set, use the optional USING clause:\n\nMariaDB> SELECT CHARSET(CHAR(0x65)), CHARSET(CHAR(0x65 USING utf8));\n+---------------------+--------------------------------+\n| CHARSET(CHAR(0x65)) | CHARSET(CHAR(0x65 USING utf8)) |\n+---------------------+--------------------------------+\n| binary | utf8 |\n+---------------------+--------------------------------+\n\nIf USING is given and the result string is illegal for the given\ncharacter set, a warning is issued. Also, if strict SQL mode is\nenabled, the result from CHAR() becomes NULL.\n\nURL: https://mariadb.com/kb/en/char-function/\n\n','MariaDB> SELECT CHAR(77,121,83,81,\'76\');\n -> \'MySQL\'\nMariaDB> SELECT CHAR(77,77.3,\'77.3\');\n -> \'MMM\'\n','https://mariadb.com/kb/en/char-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (15,22,'DATETIME','DATETIME\n\nA date and time combination. The supported range is \'1000-01-01\n00:00:00\' to \'9999-12-31 23:59:59\'. MySQL displays DATETIME values in\n\'YYYY-MM-DD HH:MM:SS\' format, but permits assignment of values to\nDATETIME columns using either strings or numbers.\n\nURL: https://mariadb.com/kb/en/datetime/\n\n','','https://mariadb.com/kb/en/datetime/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (16,26,'SHOW CREATE TRIGGER','Syntax:\nSHOW CREATE TRIGGER trigger_name\n\nThis statement shows a CREATE TRIGGER statement that creates the given\ntrigger.\n\nURL: https://mariadb.com/kb/en/show-create-trigger/\n\n','','https://mariadb.com/kb/en/show-create-trigger/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (17,26,'SHOW CREATE PROCEDURE','Syntax:\nSHOW CREATE PROCEDURE proc_name\n\nThis statement is a MySQL extension. It returns the exact string that\ncan be used to re-create the named stored procedure. A similar\nstatement, SHOW CREATE FUNCTION, displays information about stored\nfunctions (see [HELP SHOW CREATE FUNCTION]).\n\nBoth statements require that you be the owner of the routine or have\nSELECT access to the mysql.proc table. If you do not have privileges\nfor the routine itself, the value displayed for the Create Procedure or\nCreate Function field will be NULL.\n\nURL: https://mariadb.com/kb/en/show-create-procedure/\n\n','MariaDB> SHOW CREATE PROCEDURE test.simpleproc\\G\n*************************** 1. row ***************************\n Procedure: simpleproc\n sql_mode:\n Create Procedure: CREATE PROCEDURE `simpleproc`(OUT param1 INT)\n BEGIN\n SELECT COUNT(*) INTO param1 FROM t;\n END\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\nMariaDB> SHOW CREATE FUNCTION test.hello\\G\n*************************** 1. row ***************************\n Function: hello\n sql_mode:\n Create Function: CREATE FUNCTION `hello`(s CHAR(20))\n RETURNS CHAR(50)\n RETURN CONCAT(\'Hello, \',s,\'!\')\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n','https://mariadb.com/kb/en/show-create-procedure/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (18,23,'OPEN','Syntax:\nOPEN cursor_name\n\nThis statement opens a previously declared cursor. For an example, see\nhttps://mariadb.com/kb/en/cursor-overview/.\n\nURL: https://mariadb.com/kb/en/open/\n\n','','https://mariadb.com/kb/en/open/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (19,22,'INTEGER','INTEGER[(M)] [UNSIGNED] [ZEROFILL]\n\nThis type is a synonym for INT.\n\nURL: https://mariadb.com/kb/en/sql_language-data_types-int\n\n','','https://mariadb.com/kb/en/sql_language-data_types-int');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (20,37,'LOWER','Syntax:\nLOWER(str)\n\nReturns the string str with all characters changed to lowercase\naccording to the current character set mapping. The default is latin1\n(cp1252 West European).\n\nMariaDB> SELECT LOWER(\'QUADRATICALLY\');\n -> \'quadratically\'\n\nLOWER() (and UPPER()) are ineffective when applied to binary strings\n(BINARY, VARBINARY, BLOB). To perform lettercase conversion, convert\nthe string to a nonbinary string:\n\nMariaDB> SET @str = BINARY \'New York\';\nMariaDB> SELECT LOWER(@str), LOWER(CONVERT(@str USING latin1));\n+-------------+-----------------------------------+\n| LOWER(@str) | LOWER(CONVERT(@str USING latin1)) |\n+-------------+-----------------------------------+\n| New York | new york |\n+-------------+-----------------------------------+\n\nURL: https://mariadb.com/kb/en/lower/\n\n','','https://mariadb.com/kb/en/lower/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (21,26,'SHOW COLUMNS','Syntax:\nSHOW [FULL] COLUMNS {FROM | IN} tbl_name [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW COLUMNS displays information about the columns in a given table.\nIt also works for views. The LIKE clause, if present, indicates which\ncolumn names to match. The WHERE clause can be given to select rows\nusing more general conditions, as discussed in\nhttps://mariadb.com/kb/en/extended-show/.\n\nSHOW COLUMNS displays information only for those columns for which you\nhave some privilege.\n\nMariaDB> SHOW COLUMNS FROM City;\n+------------+----------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+------------+----------+------+-----+---------+----------------+\n| Id | int(11) | NO | PRI | NULL | auto_increment |\n| Name | char(35) | NO | | | |\n| Country | char(3) | NO | UNI | | |\n| District | char(20) | YES | MUL | | |\n| Population | int(11) | NO | | 0 | |\n+------------+----------+------+-----+---------+----------------+\n5 rows in set (0.00 sec)\n\nIf the data types differ from what you expect them to be based on a\nCREATE TABLE statement, note that MySQL sometimes changes data types\nwhen you create or alter a table. The conditions under which this\noccurs are described in\nhttps://mariadb.com/kb/en/silent-column-changes/.\n\nThe FULL keyword causes the output to include the column collation and\ncomments, as well as the privileges you have for each column.\n\nYou can use db_name.tbl_name as an alternative to the tbl_name FROM\ndb_name syntax. In other words, these two statements are equivalent:\n\nMariaDB> SHOW COLUMNS FROM mytable FROM mydb;\nMariaDB> SHOW COLUMNS FROM mydb.mytable;\n\nSHOW COLUMNS displays the following values for each table column:\n\nField indicates the column name.\n\nType indicates the column data type.\n\nCollation indicates the collation for nonbinary string columns, or NULL\nfor other columns. This value is displayed only if you use the FULL\nkeyword.\n\nThe Null field contains YES if NULL values can be stored in the column,\nNO if not.\n\nThe Key field indicates whether the column is indexed:\n\no If Key is empty, the column either is not indexed or is indexed only\n as a secondary column in a multiple-column, nonunique index.\n\no If Key is PRI, the column is a PRIMARY KEY or is one of the columns\n in a multiple-column PRIMARY KEY.\n\no If Key is UNI, the column is the first column of a UNIQUE index. (A\n UNIQUE index permits multiple NULL values, but you can tell whether\n the column permits NULL by checking the Null field.)\n\no If Key is MUL, the column is the first column of a nonunique index in\n which multiple occurrences of a given value are permitted within the\n column.\n\nIf more than one of the Key values applies to a given column of a\ntable, Key displays the one with the highest priority, in the order\nPRI, UNI, MUL.\n\nA UNIQUE index may be displayed as PRI if it cannot contain NULL values\nand there is no PRIMARY KEY in the table. A UNIQUE index may display as\nMUL if several columns form a composite UNIQUE index; although the\ncombination of the columns is unique, each column can still hold\nmultiple occurrences of a given value.\n\nThe Default field indicates the default value that is assigned to the\ncolumn. This is NULL if the column has an explicit default of NULL, or\nif the column definition has no DEFAULT clause.\n\nThe Extra field contains any additional information that is available\nabout a given column. The value is nonempty in these cases:\nauto_increment for columns that have the AUTO_INCREMENT attribute; on\nupdate CURRENT_TIMESTAMP for TIMESTAMP columns that have the ON UPDATE\nCURRENT_TIMESTAMP attribute.\n\nPrivileges indicates the privileges you have for the column. This value\nis displayed only if you use the FULL keyword.\n\nComment indicates any comment the column has. This value is displayed\nonly if you use the FULL keyword.\n\nSHOW FIELDS is a synonym for SHOW COLUMNS. You can also list a table\'s\ncolumns with the mysqlshow db_name tbl_name command.\n\nThe DESCRIBE statement provides information similar to SHOW COLUMNS.\nSee [HELP DESCRIBE].\n\nThe SHOW CREATE TABLE, SHOW TABLE STATUS, and SHOW INDEX statements\nalso provide information about tables. See [HELP SHOW].\n\nURL: https://mariadb.com/kb/en/show-columns/\n\n','','https://mariadb.com/kb/en/show-columns/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (22,39,'CREATE TRIGGER','Syntax:\nCREATE\n [DEFINER = { user | CURRENT_USER }]\n TRIGGER trigger_name trigger_time trigger_event\n ON tbl_name FOR EACH ROW trigger_body\n\nThis statement creates a new trigger. A trigger is a named database\nobject that is associated with a table, and that activates when a\nparticular event occurs for the table. The trigger becomes associated\nwith the table named tbl_name, which must refer to a permanent table.\nYou cannot associate a trigger with a TEMPORARY table or a view.\n\nCREATE TRIGGER requires the TRIGGER privilege for the table associated\nwith the trigger. The statement might also require the SUPER privilege,\ndepending on the DEFINER value, as described later in this section. If\nbinary logging is enabled, CREATE TRIGGER might require the SUPER\nprivilege, as described in\nhttps://mariadb.com/kb/en/binary-logging-of-stored-routines/.\n\nThe DEFINER clause determines the security context to be used when\nchecking access privileges at trigger activation time. See later in\nthis section for more information.\n\ntrigger_time is the trigger action time. It can be BEFORE or AFTER to\nindicate that the trigger activates before or after each row to be\nmodified.\n\ntrigger_event indicates the kind of statement that activates the\ntrigger. The trigger_event can be one of the following:\n\no INSERT: The trigger is activated whenever a new row is inserted into\n the table; for example, through INSERT, LOAD DATA, and REPLACE\n statements.\n\no UPDATE: The trigger is activated whenever a row is modified; for\n example, through UPDATE statements.\n\no DELETE: The trigger is activated whenever a row is deleted from the\n table; for example, through DELETE and REPLACE statements. However,\n DROP TABLE and TRUNCATE TABLE statements on the table do not activate\n this trigger, because they do not use DELETE. Dropping a partition\n does not activate DELETE triggers, either. See [HELP TRUNCATE TABLE].\n\nURL: https://mariadb.com/kb/en/create-trigger/\n\n','','https://mariadb.com/kb/en/create-trigger/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (23,31,'MONTH','Syntax:\nMONTH(date)\n\nReturns the month for date, in the range 1 to 12 for January to\nDecember, or 0 for dates such as \'0000-00-00\' or \'2008-00-00\' that have\na zero month part.\n\nURL: https://mariadb.com/kb/en/month/\n\n','MariaDB> SELECT MONTH(\'2008-02-03\');\n -> 2\n','https://mariadb.com/kb/en/month/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (24,22,'TINYINT','TINYINT[(M)] [UNSIGNED] [ZEROFILL]\n\nA very small integer. The signed range is -128 to 127. The unsigned\nrange is 0 to 255.\n\nURL: https://mariadb.com/kb/en/tinyint/\n\n','','https://mariadb.com/kb/en/tinyint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (25,26,'SHOW TRIGGERS','Syntax:\nSHOW TRIGGERS [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW TRIGGERS lists the triggers currently defined for tables in a\ndatabase (the default database unless a FROM clause is given). This\nstatement returns results only for databases and tables for which you\nhave the TRIGGER privilege. The LIKE clause, if present, indicates\nwhich table names to match and causes the statement to display triggers\nfor those tables. The WHERE clause can be given to select rows using\nmore general conditions, as discussed in\nhttps://mariadb.com/kb/en/extended-show/.\n\nFor the trigger ins_sum as defined in\nhttps://mariadb.com/kb/en/triggers/, the output of\nthis statement is as shown here:\n\nMariaDB> SHOW TRIGGERS LIKE \'acc%\'\\G\n*************************** 1. row ***************************\n Trigger: ins_sum\n Event: INSERT\n Table: account\n Statement: SET @sum = @sum + NEW.amount\n Timing: BEFORE\n Created: NULL\n sql_mode:\n Definer: myname@localhost\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\ncharacter_set_client is the session value of the character_set_client\nsystem variable when the trigger was created. collation_connection is\nthe session value of the collation_connection system variable when the\ntrigger was created. Database Collation is the collation of the\ndatabase with which the trigger is associated.\n\nURL: https://mariadb.com/kb/en/show-triggers/\n\n','','https://mariadb.com/kb/en/show-triggers/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (26,14,'MASTER_POS_WAIT','Syntax:\nMASTER_POS_WAIT(log_name,log_pos[,timeout])\n\nThis function is useful for control of master/slave synchronization. It\nblocks until the slave has read and applied all updates up to the\nspecified position in the master log. The return value is the number of\nlog events the slave had to wait for to advance to the specified\nposition. The function returns NULL if the slave SQL thread is not\nstarted, the slave\'s master information is not initialized, the\narguments are incorrect, or an error occurs. It returns -1 if the\ntimeout has been exceeded. If the slave SQL thread stops while\nMASTER_POS_WAIT() is waiting, the function returns NULL. If the slave\nis past the specified position, the function returns immediately.\n\nIf a timeout value is specified, MASTER_POS_WAIT() stops waiting when\ntimeout seconds have elapsed. timeout must be greater than 0; a zero or\nnegative timeout means no timeout.\n\nURL: https://mariadb.com/kb/en/master_pos_wait/\n\n','','https://mariadb.com/kb/en/master_pos_wait/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (27,37,'REGEXP','Syntax:\nexpr REGEXP pat, expr RLIKE pat\n\nPerforms a pattern match of a string expression expr against a pattern\npat. The pattern can be an extended regular expression. The syntax for\nregular expressions is discussed in\nhttps://mariadb.com/kb/en/regexp/. Returns 1 if expr\nmatches pat; otherwise it returns 0. If either expr or pat is NULL, the\nresult is NULL. RLIKE is a synonym for REGEXP, provided for mSQL\ncompatibility.\n\nThe pattern need not be a literal string. For example, it can be\nspecified as a string expression or table column.\n\n*Note*: Because MySQL uses the C escape syntax in strings (for example,\n"\\n" to represent the newline character), you must double any "\\" that\nyou use in your REGEXP strings.\n\nREGEXP is not case sensitive, except when used with binary strings.\n\nURL: https://mariadb.com/kb/en/regexp/\n\n','MariaDB> SELECT \'Monty!\' REGEXP \'.*\';\n -> 1\nMariaDB> SELECT \'new*\\n*line\' REGEXP \'new\\\\*.\\\\*line\';\n -> 1\nMariaDB> SELECT \'a\' REGEXP \'A\', \'a\' REGEXP BINARY \'A\';\n -> 1 0\nMariaDB> SELECT \'a\' REGEXP \'^[a-d]\';\n -> 1\n','https://mariadb.com/kb/en/regexp/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (28,23,'IF STATEMENT','Syntax:\nIF search_condition THEN statement_list\n [ELSEIF search_condition THEN statement_list] ...\n [ELSE statement_list]\nEND IF\n\nThe IF statement for stored programs implements a basic conditional\nconstruct.\n\n*Note*: There is also an IF() function, which differs from the IF\nstatement described here. See\nhttps://mariadb.com/kb/en/if-function/. The\nIF statement can have THEN, ELSE, and ELSEIF clauses, and it is\nterminated with END IF.\n\nIf the search_condition evaluates to true, the corresponding THEN or\nELSEIF clause statement_list executes. If no search_condition matches,\nthe ELSE clause statement_list executes.\n\nEach statement_list consists of one or more SQL statements; an empty\nstatement_list is not permitted.\n\nURL: https://mariadb.com/kb/en/if-statement/\n\n','','https://mariadb.com/kb/en/if-statement/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (29,19,'^','Syntax:\n^\n\nBitwise XOR:\n\nURL: https://mariadb.com/kb/en/bitwise-xor/\n\n','MariaDB> SELECT 1 ^ 1;\n -> 0\nMariaDB> SELECT 1 ^ 0;\n -> 1\nMariaDB> SELECT 11 ^ 3;\n -> 8\n','https://mariadb.com/kb/en/bitwise-xor/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (30,39,'DROP VIEW','Syntax:\nDROP VIEW [IF EXISTS]\n view_name [, view_name] ...\n [RESTRICT | CASCADE]\n\nDROP VIEW removes one or more views. You must have the DROP privilege\nfor each view. If any of the views named in the argument list do not\nexist, MySQL returns an error indicating by name which nonexisting\nviews it was unable to drop, but it also drops all of the views in the\nlist that do exist.\n\nThe IF EXISTS clause prevents an error from occurring for views that\ndon\'t exist. When this clause is given, a NOTE is generated for each\nnonexistent view. See [HELP SHOW WARNINGS].\n\nRESTRICT and CASCADE, if given, are parsed and ignored.\n\nURL: https://mariadb.com/kb/en/drop-view/\n\n','','https://mariadb.com/kb/en/drop-view/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (31,30,'WITHIN','Within(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 is spatially within g2. This\ntests the opposite relationship as Contains().\n\nURL: https://mariadb.com/kb/en/within/\n\n','','https://mariadb.com/kb/en/within/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (32,31,'WEEK','Syntax:\nWEEK(date[,mode])\n\nThis function returns the week number for date. The two-argument form\nof WEEK() enables you to specify whether the week starts on Sunday or\nMonday and whether the return value should be in the range from 0 to 53\nor from 1 to 53. If the mode argument is omitted, the value of the\ndefault_week_format system variable is used. See\nhttps://mariadb.com/kb/en/server-system-variables/.\n\nURL: https://mariadb.com/kb/en/week/\n\n','MariaDB> SELECT WEEK(\'2008-02-20\');\n -> 7\nMariaDB> SELECT WEEK(\'2008-02-20\',0);\n -> 7\nMariaDB> SELECT WEEK(\'2008-02-20\',1);\n -> 8\nMariaDB> SELECT WEEK(\'2008-12-31\',1);\n -> 53\n','https://mariadb.com/kb/en/week/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (33,26,'SHOW PLUGINS','Syntax:\nSHOW PLUGINS\n\nSHOW PLUGINS displays information about server plugins. Plugin\ninformation is also available in the INFORMATION_SCHEMA.PLUGINS table.\nSee https://mariadb.com/kb/en/information_schemaplugins-table/.\n\nExample of SHOW PLUGINS output:\n\nMariaDB> SHOW PLUGINS\\G\n*************************** 1. row ***************************\n Name: binlog\n Status: ACTIVE\n Type: STORAGE ENGINE\nLibrary: NULL\nLicense: GPL\n*************************** 2. row ***************************\n Name: CSV\n Status: ACTIVE\n Type: STORAGE ENGINE\nLibrary: NULL\nLicense: GPL\n*************************** 3. row ***************************\n Name: MEMORY\n Status: ACTIVE\n Type: STORAGE ENGINE\nLibrary: NULL\nLicense: GPL\n*************************** 4. row ***************************\n Name: MyISAM\n Status: ACTIVE\n Type: STORAGE ENGINE\nLibrary: NULL\nLicense: GPL\n...\n\nURL: https://mariadb.com/kb/en/show-plugins/\n\n','','https://mariadb.com/kb/en/show-plugins/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (34,21,'DROP FUNCTION UDF','Syntax:\nDROP FUNCTION function_name\n\nThis statement drops the user-defined function (UDF) named\nfunction_name.\n\nTo drop a function, you must have the DELETE privilege for the mysql\ndatabase. This is because DROP FUNCTION removes a row from the\nmysql.func system table that records the function\'s name, type, and\nshared library name.\n\nURL: https://mariadb.com/kb/en/drop-function-udf/\n\n','','https://mariadb.com/kb/en/drop-function-udf/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (35,8,'PREPARE','Syntax:\nPREPARE stmt_name FROM preparable_stmt\n\nThe PREPARE statement prepares a statement and assigns it a name,\nstmt_name, by which to refer to the statement later. Statement names\nare not case sensitive. preparable_stmt is either a string literal or a\nuser variable that contains the text of the statement. The text must\nrepresent a single SQL statement, not multiple statements. Within the\nstatement, "?" characters can be used as parameter markers to indicate\nwhere data values are to be bound to the query later when you execute\nit. The "?" characters should not be enclosed within quotation marks,\neven if you intend to bind them to string values. Parameter markers can\nbe used only where data values should appear, not for SQL keywords,\nidentifiers, and so forth.\n\nIf a prepared statement with the given name already exists, it is\ndeallocated implicitly before the new statement is prepared. This means\nthat if the new statement contains an error and cannot be prepared, an\nerror is returned and no statement with the given name exists.\n\nA prepared statement is executed with EXECUTE and released with\nDEALLOCATE PREPARE.\n\nThe scope of a prepared statement is the session within which it is\ncreated. Other sessions cannot see it.\n\nURL: https://mariadb.com/kb/en/prepare-statement/\n\n','','https://mariadb.com/kb/en/prepare-statement/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (36,8,'LOCK','Syntax:\nLOCK TABLES\n tbl_name [[AS] alias] lock_type\n [, tbl_name [[AS] alias] lock_type] ...\n\nlock_type:\n READ [LOCAL]\n | [LOW_PRIORITY] WRITE\n\nUNLOCK TABLES\n\nMySQL enables client sessions to acquire table locks explicitly for the\npurpose of cooperating with other sessions for access to tables, or to\nprevent other sessions from modifying tables during periods when a\nsession requires exclusive access to them. A session can acquire or\nrelease locks only for itself. One session cannot acquire locks for\nanother session or release locks held by another session.\n\nLocks may be used to emulate transactions or to get more speed when\nupdating tables. This is explained in more detail later in this\nsection.\n\nLOCK TABLES explicitly acquires table locks for the current client\nsession. Table locks can be acquired for base tables or views. You must\nhave the LOCK TABLES privilege, and the SELECT privilege for each\nobject to be locked.\n\nFor view locking, LOCK TABLES adds all base tables used in the view to\nthe set of tables to be locked and locks them automatically. If you\nlock a table explicitly with LOCK TABLES, any tables used in triggers\nare also locked implicitly, as described in\nhttps://mariadb.com/kb/en/triggers-and-implicit-locks/.\n\nUNLOCK TABLES explicitly releases any table locks held by the current\nsession. LOCK TABLES implicitly releases any table locks held by the\ncurrent session before acquiring new locks.\n\nAnother use for UNLOCK TABLES is to release the global read lock\nacquired with the FLUSH TABLES WITH READ LOCK statement, which enables\nyou to lock all tables in all databases. See [HELP FLUSH]. (This is a\nvery convenient way to get backups if you have a file system such as\nVeritas that can take snapshots in time.)\n\nURL: https://mariadb.com/kb/en/transactions-lock/\n\n','','https://mariadb.com/kb/en/transactions-lock/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (37,37,'UPDATEXML','Syntax:\nUpdateXML(xml_target, xpath_expr, new_xml)\n\nThis function replaces a single portion of a given fragment of XML\nmarkup xml_target with a new XML fragment new_xml, and then returns the\nchanged XML. The portion of xml_target that is replaced matches an\nXPath expression xpath_expr supplied by the user. In MySQL 5.5, the\nXPath expression can contain at most 127 characters. (This limitation\nis lifted in MySQL 5.6.)\n\nIf no expression matching xpath_expr is found, or if multiple matches\nare found, the function returns the original xml_target XML fragment.\nAll three arguments should be strings.\n\nURL: https://mariadb.com/kb/en/updatexml/\n\n','MariaDB> SELECT\n -> UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'/a\', \'<e>fff</e>\') AS val1,\n -> UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'/b\', \'<e>fff</e>\') AS val2,\n -> UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'//b\', \'<e>fff</e>\') AS val3,\n -> UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'/a/d\', \'<e>fff</e>\') AS val4,\n -> UpdateXML(\'<a><d></d><b>ccc</b><d></d></a>\', \'/a/d\', \'<e>fff</e>\') AS val5\n -> \\G\n\n*************************** 1. row ***************************\nval1: <e>fff</e>\nval2: <a><b>ccc</b><d></d></a>\nval3: <a><e>fff</e><d></d></a>\nval4: <a><b>ccc</b><e>fff</e></a>\nval5: <a><d></d><b>ccc</b><d></d></a>\n','https://mariadb.com/kb/en/updatexml/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (38,8,'RESET SLAVE','Syntax:\nRESET SLAVE [ALL]\n\nRESET SLAVE makes the slave forget its replication position in the\nmaster\'s binary log. This statement is meant to be used for a clean\nstart: It deletes the master.info and relay-log.info files, all the\nrelay log files, and starts a new relay log file. To use RESET SLAVE,\nthe slave replication threads must be stopped (use STOP SLAVE if\nnecessary).\n\n*Note*: All relay log files are deleted, even if they have not been\ncompletely executed by the slave SQL thread. (This is a condition\nlikely to exist on a replication slave if you have issued a STOP SLAVE\nstatement or if the slave is highly loaded.)\n\nIn MySQL 5.5 (unlike the case in MySQL 5.1 and earlier), RESET SLAVE\ndoes not change any replication connection parameters such as master\nhost, master port, master user, or master password, which are retained\nin memory. This means that START SLAVE can be issued without requiring\na CHANGE MASTER TO statement following RESET SLAVE.\n\nIn MySQL 5.5.16 and later, you can use RESET SLAVE ALL to reset these\nconnection parameters (Bug #11809016). Connection parameters are also\nreset if the slave mysqld is shut down.\n\nIf the slave SQL thread was in the middle of replicating temporary\ntables when it was stopped, and RESET SLAVE is issued, these replicated\ntemporary tables are deleted on the slave.\n\nURL: https://mariadb.com/kb/en/reset-slave-connection_name/\n\n','','https://mariadb.com/kb/en/reset-slave-connection_name/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (39,26,'SHOW BINARY LOGS','Syntax:\nSHOW BINARY LOGS\nSHOW MASTER LOGS\n\nLists the binary log files on the server. This statement is used as\npart of the procedure described in [HELP PURGE BINARY LOGS], that shows\nhow to determine which logs can be purged.\n\nMariaDB> SHOW BINARY LOGS;\n+---------------+-----------+\n| Log_name | File_size |\n+---------------+-----------+\n| binlog.000015 | 724935 |\n| binlog.000016 | 733481 |\n+---------------+-----------+\n\nURL: https://mariadb.com/kb/en/show-binary-logs/\n\n','','https://mariadb.com/kb/en/show-binary-logs/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (40,24,'POLYGON','Polygon(ls1,ls2,...)\n\nConstructs a Polygon value from a number of LineString or WKB\nLineString arguments. If any argument does not represent a LinearRing\n(that is, not a closed and simple LineString), the return value is\nNULL.\n\nURL: https://mariadb.com/kb/en/polygon/\n\n','','https://mariadb.com/kb/en/polygon/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (41,31,'MINUTE','Syntax:\nMINUTE(time)\n\nReturns the minute for time, in the range 0 to 59.\n\nURL: https://mariadb.com/kb/en/minute/\n\n','MariaDB> SELECT MINUTE(\'2008-02-03 10:05:03\');\n -> 5\n','https://mariadb.com/kb/en/minute/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (42,31,'DAY','Syntax:\nDAY(date)\n\nDAY() is a synonym for DAYOFMONTH().\n\nURL: https://mariadb.com/kb/en/day/\n\n','','https://mariadb.com/kb/en/day/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (43,37,'MID','Syntax:\nMID(str,pos,len)\n\nMID(str,pos,len) is a synonym for SUBSTRING(str,pos,len).\n\nURL: https://mariadb.com/kb/en/mid/\n\n','','https://mariadb.com/kb/en/mid/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (44,14,'UUID','Syntax:\nUUID()\n\nReturns a Universal Unique Identifier (UUID) generated according to\n"DCE 1.1: Remote Procedure Call" (Appendix A) CAE (Common Applications\nEnvironment) Specifications published by The Open Group in October 1997\n(Document Number C706,\nhttp://www.opengroup.org/public/pubs/catalog/c706.htm).\n\nA UUID is designed as a number that is globally unique in space and\ntime. Two calls to UUID() are expected to generate two different\nvalues, even if these calls are performed on two separate computers\nthat are not connected to each other.\n\nA UUID is a 128-bit number represented by a utf8 string of five\nhexadecimal numbers in aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee format:\n\no The first three numbers are generated from a timestamp.\n\no The fourth number preserves temporal uniqueness in case the timestamp\n value loses monotonicity (for example, due to daylight saving time).\n\no The fifth number is an IEEE 802 node number that provides spatial\n uniqueness. A random number is substituted if the latter is not\n available (for example, because the host computer has no Ethernet\n card, or we do not know how to find the hardware address of an\n interface on your operating system). In this case, spatial uniqueness\n cannot be guaranteed. Nevertheless, a collision should have very low\n probability.\n\n Currently, the MAC address of an interface is taken into account only\n on FreeBSD and Linux. On other operating systems, MySQL uses a\n randomly generated 48-bit number.\n\nURL: https://mariadb.com/kb/en/uuid/\n\n','MariaDB> SELECT UUID();\n -> \'6ccd780c-baba-1026-9564-0040f4311e29\'\n','https://mariadb.com/kb/en/uuid/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (45,24,'LINESTRING','LineString(pt1,pt2,...)\n\nConstructs a LineString value from a number of Point or WKB Point\narguments. If the number of arguments is less than two, the return\nvalue is NULL.\n\nURL: https://mariadb.com/kb/en/linestring/\n\n','','https://mariadb.com/kb/en/linestring/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (46,14,'SLEEP','Syntax:\nSLEEP(duration)\n\nSleeps (pauses) for the number of seconds given by the duration\nargument, then returns 0. If SLEEP() is interrupted, it returns 1. The\nduration may have a fractional part given in microseconds.\n\nURL: https://mariadb.com/kb/en/sleep/\n\n','','https://mariadb.com/kb/en/sleep/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (47,17,'CONNECTION_ID','Syntax:\nCONNECTION_ID()\n\nReturns the connection ID (thread ID) for the connection. Every\nconnection has an ID that is unique among the set of currently\nconnected clients.\n\nURL: https://mariadb.com/kb/en/connection_id/\n\n','MariaDB> SELECT CONNECTION_ID();\n -> 23786\n','https://mariadb.com/kb/en/connection_id/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (48,27,'DELETE','Syntax:\nSingle-table syntax:\n\nDELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name\n [WHERE where_condition]\n [ORDER BY ...]\n [LIMIT row_count]\n\nMultiple-table syntax:\n\nDELETE [LOW_PRIORITY] [QUICK] [IGNORE]\n tbl_name[.*] [, tbl_name[.*]] ...\n FROM table_references\n [WHERE where_condition]\n\nOr:\n\nDELETE [LOW_PRIORITY] [QUICK] [IGNORE]\n FROM tbl_name[.*] [, tbl_name[.*]] ...\n USING table_references\n [WHERE where_condition]\n\nFor the single-table syntax, the DELETE statement deletes rows from\ntbl_name and returns a count of the number of deleted rows. This count\ncan be obtained by calling the ROW_COUNT() function (see\nhttps://mariadb.com/kb/en/information-functions-row_count/). The\nWHERE clause, if given, specifies the conditions that identify which\nrows to delete. With no WHERE clause, all rows are deleted. If the\nORDER BY clause is specified, the rows are deleted in the order that is\nspecified. The LIMIT clause places a limit on the number of rows that\ncan be deleted.\n\nFor the multiple-table syntax, DELETE deletes from each tbl_name the\nrows that satisfy the conditions. In this case, ORDER BY and LIMIT\ncannot be used.\n\nwhere_condition is an expression that evaluates to true for each row to\nbe deleted. It is specified as described in\nhttps://mariadb.com/kb/en/select/.\n\nCurrently, you cannot delete from a table and select from the same\ntable in a subquery.\n\nYou need the DELETE privilege on a table to delete rows from it. You\nneed only the SELECT privilege for any columns that are only read, such\nas those named in the WHERE clause.\n\nAs stated, a DELETE statement with no WHERE clause deletes all rows. A\nfaster way to do this, when you do not need to know the number of\ndeleted rows, is to use TRUNCATE TABLE. However, within a transaction\nor if you have a lock on the table, TRUNCATE TABLE cannot be used\nwhereas DELETE can. See [HELP TRUNCATE TABLE], and [HELP LOCK].\n\nURL: https://mariadb.com/kb/en/delete/\n\n','','https://mariadb.com/kb/en/delete/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (49,4,'ROUND','Syntax:\nROUND(X), ROUND(X,D)\n\nRounds the argument X to D decimal places. The rounding algorithm\ndepends on the data type of X. D defaults to 0 if not specified. D can\nbe negative to cause D digits left of the decimal point of the value X\nto become zero.\n\nURL: https://mariadb.com/kb/en/round/\n\n','MariaDB> SELECT ROUND(-1.23);\n -> -1\nMariaDB> SELECT ROUND(-1.58);\n -> -2\nMariaDB> SELECT ROUND(1.58);\n -> 2\nMariaDB> SELECT ROUND(1.298, 1);\n -> 1.3\nMariaDB> SELECT ROUND(1.298, 0);\n -> 1\nMariaDB> SELECT ROUND(23.298, -1);\n -> 20\n','https://mariadb.com/kb/en/round/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (50,7,'NULLIF','Syntax:\nNULLIF(expr1,expr2)\n\nReturns NULL if expr1 = expr2 is true, otherwise returns expr1. This is\nthe same as CASE WHEN expr1 = expr2 THEN NULL ELSE expr1 END.\n\nURL: https://mariadb.com/kb/en/nullif/\n\n','MariaDB> SELECT NULLIF(1,1);\n -> NULL\nMariaDB> SELECT NULLIF(1,2);\n -> 1\n','https://mariadb.com/kb/en/nullif/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (51,23,'CLOSE','Syntax:\nCLOSE cursor_name\n\nThis statement closes a previously opened cursor. For an example, see\nhttps://mariadb.com/kb/en/cursor-overview/.\n\nAn error occurs if the cursor is not open.\n\nIf not closed explicitly, a cursor is closed at the end of the BEGIN\n... END block in which it was declared.\n\nURL: https://mariadb.com/kb/en/close/\n\n','','https://mariadb.com/kb/en/close/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (52,8,'STOP SLAVE','Syntax:\nSTOP SLAVE [thread_types]\n\nthread_types:\n [thread_type [, thread_type] ... ]\n\nthread_type: IO_THREAD | SQL_THREAD\n\nStops the slave threads. STOP SLAVE requires the SUPER privilege.\nRecommended best practice is to execute STOP SLAVE on the slave before\nstopping the slave server (see\nhttp://dev.mysql.com/doc/refman/5.5/en/server-shutdown.html, for more\ninformation).\n\nWhen using the row-based logging format: You should execute STOP SLAVE\non the slave prior to shutting down the slave server if you are\nreplicating any tables that use a nontransactional storage engine (see\nthe Note later in this section). In MySQL 5.5.9 and later, you can also\nuse STOP SLAVE SQL_THREAD for this purpose.\n\nLike START SLAVE, this statement may be used with the IO_THREAD and\nSQL_THREAD options to name the thread or threads to be stopped.\n\n*Note*: In MySQL 5.5, STOP SLAVE waits until the current replication\nevent group affecting one or more non-transactional tables has finished\nexecuting (if there is any such replication group), or until the user\nissues a KILL QUERY or KILL CONNECTION statement. (Bug #319, Bug\n#38205)\n\nURL: https://mariadb.com/kb/en/stop-slave/\n\n','','https://mariadb.com/kb/en/stop-slave/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (53,31,'TIMEDIFF','Syntax:\nTIMEDIFF(expr1,expr2)\n\nTIMEDIFF() returns expr1 - expr2 expressed as a time value. expr1 and\nexpr2 are time or date-and-time expressions, but both must be of the\nsame type.\n\nThe result returned by TIMEDIFF() is limited to the range allowed for\nTIME values. Alternatively, you can use either of the functions\nTIMESTAMPDIFF() and UNIX_TIMESTAMP(), both of which return integers.\n\nURL: https://mariadb.com/kb/en/timediff/\n\n','MariaDB> SELECT TIMEDIFF(\'2000:01:01 00:00:00\',\n -> \'2000:01:01 00:00:00.000001\');\n -> \'-00:00:00.000001\'\nMariaDB> SELECT TIMEDIFF(\'2008-12-31 23:59:59.000001\',\n -> \'2008-12-30 01:01:01.000002\');\n -> \'46:58:57.999999\'\n','https://mariadb.com/kb/en/timediff/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (54,37,'REPLACE FUNCTION','Syntax:\nREPLACE(str,from_str,to_str)\n\nReturns the string str with all occurrences of the string from_str\nreplaced by the string to_str. REPLACE() performs a case-sensitive\nmatch when searching for from_str.\n\nURL: https://mariadb.com/kb/en/replace-function/\n\n','MariaDB> SELECT REPLACE(\'www.mariadb.org\', \'w\', \'Ww\');\n -> \'WwWwWw.mariadb.org\'\n','https://mariadb.com/kb/en/replace-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (55,28,'USE','Syntax:\nUSE db_name\n\nThe USE db_name statement tells MySQL to use the db_name database as\nthe default (current) database for subsequent statements. The database\nremains the default until the end of the session or another USE\nstatement is issued:\n\nUSE db1;\nSELECT COUNT(*) FROM mytable; # selects from db1.mytable\nUSE db2;\nSELECT COUNT(*) FROM mytable; # selects from db2.mytable\n\nURL: https://mariadb.com/kb/en/use/\n\n','','https://mariadb.com/kb/en/use/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (56,3,'LINEFROMTEXT','LineFromText(wkt[,srid]), LineStringFromText(wkt[,srid])\n\nConstructs a LINESTRING value using its WKT representation and SRID.\n\nURL: https://mariadb.com/kb/en/linefromtext/\n\n','','https://mariadb.com/kb/en/linefromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (57,7,'CASE OPERATOR','Syntax:\nCASE value WHEN [compare_value] THEN result [WHEN [compare_value] THEN\nresult ...] [ELSE result] END\n\nCASE WHEN [condition] THEN result [WHEN [condition] THEN result ...]\n[ELSE result] END\n\nThe first version returns the result where value=compare_value. The\nsecond version returns the result for the first condition that is true.\nIf there was no matching result value, the result after ELSE is\nreturned, or NULL if there is no ELSE part.\n\nURL: https://mariadb.com/kb/en/case-operator/\n\n','MariaDB> SELECT CASE 1 WHEN 1 THEN \'one\'\n -> WHEN 2 THEN \'two\' ELSE \'more\' END;\n -> \'one\'\nMariaDB> SELECT CASE WHEN 1>0 THEN \'true\' ELSE \'false\' END;\n -> \'true\'\nMariaDB> SELECT CASE BINARY \'B\'\n -> WHEN \'a\' THEN 1 WHEN \'b\' THEN 2 END;\n -> NULL\n','https://mariadb.com/kb/en/case-operator/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (58,26,'SHOW MASTER STATUS','Syntax:\nSHOW MASTER STATUS\n\nThis statement provides status information about the binary log files\nof the master. It requires either the SUPER or REPLICATION CLIENT\nprivilege.\n\nExample:\n\nMariaDB> SHOW MASTER STATUS;\n+---------------+----------+--------------+------------------+\n| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |\n+---------------+----------+--------------+------------------+\n| mysql-bin.003 | 73 | test | manual,mysql |\n+---------------+----------+--------------+------------------+\n\nURL: https://mariadb.com/kb/en/show-master-status/\n\n','','https://mariadb.com/kb/en/show-master-status/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (59,31,'ADDTIME','Syntax:\nADDTIME(expr1,expr2)\n\nADDTIME() adds expr2 to expr1 and returns the result. expr1 is a time\nor datetime expression, and expr2 is a time expression.\n\nURL: https://mariadb.com/kb/en/addtime/\n\n','MariaDB> SELECT ADDTIME(\'2007-12-31 23:59:59.999999\', \'1 1:1:1.000002\');\n -> \'2008-01-02 01:01:01.000001\'\nMariaDB> SELECT ADDTIME(\'01:00:00.999999\', \'02:00:00.999998\');\n -> \'03:00:01.999997\'\n','https://mariadb.com/kb/en/addtime/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (60,34,'SPATIAL','For MyISAM tables, MySQL can create spatial indexes using syntax\nsimilar to that for creating regular indexes, but extended with the\nSPATIAL keyword. Currently, columns in spatial indexes must be declared\nNOT NULL. The following examples demonstrate how to create spatial\nindexes:\n\no With CREATE TABLE:\n\nCREATE TABLE geom (g GEOMETRY NOT NULL, SPATIAL INDEX(g)) ENGINE=MyISAM;\n\no With ALTER TABLE:\n\nALTER TABLE geom ADD SPATIAL INDEX(g);\n\no With CREATE INDEX:\n\nCREATE SPATIAL INDEX sp_index ON geom (g);\n\nFor MyISAM tables, SPATIAL INDEX creates an R-tree index. For storage\nengines that support nonspatial indexing of spatial columns, the engine\ncreates a B-tree index. A B-tree index on spatial values will be useful\nfor exact-value lookups, but not for range scans.\n\nFor more information on indexing spatial columns, see [HELP CREATE\nINDEX].\n\nTo drop spatial indexes, use ALTER TABLE or DROP INDEX:\n\no With ALTER TABLE:\n\nALTER TABLE geom DROP INDEX g;\n\no With DROP INDEX:\n\nDROP INDEX sp_index ON geom;\n\nExample: Suppose that a table geom contains more than 32,000\ngeometries, which are stored in the column g of type GEOMETRY. The\ntable also has an AUTO_INCREMENT column fid for storing object ID\nvalues.\n\nURL: https://mariadb.com/kb/en/spatial/\n\n','','https://mariadb.com/kb/en/spatial/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (61,31,'TO_SECONDS','Syntax:\nTO_SECONDS(expr)\n\nGiven a date or datetime expr, returns a the number of seconds since\nthe year 0. If expr is not a valid date or datetime value, returns\nNULL.\n\nURL: https://mariadb.com/kb/en/to_seconds/\n\n','MariaDB> SELECT TO_SECONDS(950501);\n -> 62966505600\nMariaDB> SELECT TO_SECONDS(\'2009-11-29\');\n -> 63426672000\nMariaDB> SELECT TO_SECONDS(\'2009-11-29 13:43:32\');\n -> 63426721412\nMariaDB> SELECT TO_SECONDS( NOW() );\n -> 63426721458\n','https://mariadb.com/kb/en/to_seconds/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (62,31,'TIMESTAMPDIFF','Syntax:\nTIMESTAMPDIFF(unit,datetime_expr1,datetime_expr2)\n\nReturns datetime_expr2 - datetime_expr1, where datetime_expr1 and\ndatetime_expr2 are date or datetime expressions. One expression may be\na date and the other a datetime; a date value is treated as a datetime\nhaving the time part \'00:00:00\' where necessary. The unit for the\nresult (an integer) is given by the unit argument. The legal values for\nunit are the same as those listed in the description of the\nTIMESTAMPADD() function.\n\nURL: https://mariadb.com/kb/en/timestampdiff/\n\n','MariaDB> SELECT TIMESTAMPDIFF(MONTH,\'2003-02-01\',\'2003-05-01\');\n -> 3\nMariaDB> SELECT TIMESTAMPDIFF(YEAR,\'2002-05-01\',\'2001-01-01\');\n -> -1\nMariaDB> SELECT TIMESTAMPDIFF(MINUTE,\'2003-02-01\',\'2003-05-01 12:05:55\');\n -> 128885\n','https://mariadb.com/kb/en/timestampdiff/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (63,37,'UPPER','Syntax:\nUPPER(str)\n\nReturns the string str with all characters changed to uppercase\naccording to the current character set mapping. The default is latin1\n(cp1252 West European).\n\nMariaDB> SELECT UPPER(\'Hej\');\n -> \'HEJ\'\n\nSee the description of LOWER() for information that also applies to\nUPPER(), such as information about how to perform lettercase conversion\nof binary strings (BINARY, VARBINARY, BLOB) for which these functions\nare ineffective.\n\nURL: https://mariadb.com/kb/en/upper/\n\n','','https://mariadb.com/kb/en/upper/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (64,31,'FROM_UNIXTIME','Syntax:\nFROM_UNIXTIME(unix_timestamp), FROM_UNIXTIME(unix_timestamp,format)\n\nReturns a representation of the unix_timestamp argument as a value in\n\'YYYY-MM-DD HH:MM:SS\' or YYYYMMDDHHMMSS.uuuuuu format, depending on\nwhether the function is used in a string or numeric context. The value\nis expressed in the current time zone. unix_timestamp is an internal\ntimestamp value such as is produced by the UNIX_TIMESTAMP() function.\n\nIf format is given, the result is formatted according to the format\nstring, which is used the same way as listed in the entry for the\nDATE_FORMAT() function.\n\nURL: https://mariadb.com/kb/en/from_unixtime/\n\n','MariaDB> SELECT FROM_UNIXTIME(1196440219);\n -> \'2007-11-30 10:30:19\'\nMariaDB> SELECT FROM_UNIXTIME(1196440219) + 0;\n -> 20071130103019.000000\nMariaDB> SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(),\n -> \'%Y %D %M %h:%i:%s %x\');\n -> \'2007 30th November 10:30:59 2007\'\n','https://mariadb.com/kb/en/from_unixtime/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (65,22,'MEDIUMBLOB','MEDIUMBLOB\n\nA BLOB column with a maximum length of 16,777,215 (224 - 1) bytes. Each\nMEDIUMBLOB value is stored using a 3-byte length prefix that indicates\nthe number of bytes in the value.\n\nURL: https://mariadb.com/kb/en/mediumblob/\n\n','','https://mariadb.com/kb/en/mediumblob/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (66,12,'SHA2','Syntax:\nSHA2(str, hash_length)\n\nCalculates the SHA-2 family of hash functions (SHA-224, SHA-256,\nSHA-384, and SHA-512). The first argument is the cleartext string to be\nhashed. The second argument indicates the desired bit length of the\nresult, which must have a value of 224, 256, 384, 512, or 0 (which is\nequivalent to 256). If either argument is NULL or the hash length is\nnot one of the permitted values, the return value is NULL. Otherwise,\nthe function result is a hash value containing the desired number of\nbits. See the notes at the beginning of this section about storing hash\nvalues efficiently.\n\nAs of MySQL 5.5.6, the return value is a nonbinary string in the\nconnection character set. Before 5.5.6, the return value is a binary\nstring; see the notes at the beginning of this section about using the\nvalue as a nonbinary string.\n\nURL: https://mariadb.com/kb/en/sha2/\n\n','MariaDB> SELECT SHA2(\'abc\', 224);\n -> \'23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7\'\n','https://mariadb.com/kb/en/sha2/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (67,7,'IFNULL','Syntax:\nIFNULL(expr1,expr2)\n\nIf expr1 is not NULL, IFNULL() returns expr1; otherwise it returns\nexpr2. IFNULL() returns a numeric or string value, depending on the\ncontext in which it is used.\n\nURL: https://mariadb.com/kb/en/ifnull/\n\n','MariaDB> SELECT IFNULL(1,0);\n -> 1\nMariaDB> SELECT IFNULL(NULL,10);\n -> 10\nMariaDB> SELECT IFNULL(1/0,10);\n -> 10\nMariaDB> SELECT IFNULL(1/0,\'yes\');\n -> \'yes\'\n','https://mariadb.com/kb/en/ifnull/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (68,26,'SHOW FUNCTION CODE','Syntax:\nSHOW FUNCTION CODE func_name\n\nThis statement is similar to SHOW PROCEDURE CODE but for stored\nfunctions. See [HELP SHOW PROCEDURE CODE].\n\nURL: https://mariadb.com/kb/en/show-function-code/\n\n','','https://mariadb.com/kb/en/show-function-code/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (69,26,'SHOW ERRORS','Syntax:\nSHOW ERRORS [LIMIT [offset,] row_count]\nSHOW COUNT(*) ERRORS\n\nThis statement is similar to SHOW WARNINGS, except that it displays\ninformation only for errors, rather than for errors, warnings, and\nnotes.\n\nThe LIMIT clause has the same syntax as for the SELECT statement. See\nhttps://mariadb.com/kb/en/select/.\n\nThe SHOW COUNT(*) ERRORS statement displays the number of errors. You\ncan also retrieve this number from the error_count variable:\n\nSHOW COUNT(*) ERRORS;\nSELECT @@error_count;\n\nSHOW ERRORS and error_count apply only to errors, not warnings or\nnotes. In other respects, they are similar to SHOW WARNINGS and\nwarning_count. In particular, SHOW ERRORS cannot display information\nfor more than max_error_count messages, and error_count can exceed the\nvalue of max_error_count if the number of errors exceeds\nmax_error_count.\n\nURL: https://mariadb.com/kb/en/show-errors/\n\n','','https://mariadb.com/kb/en/show-errors/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (70,18,'LEAST','Syntax:\nLEAST(value1,value2,...)\n\nWith two or more arguments, returns the smallest (minimum-valued)\nargument. The arguments are compared using the following rules:\n\no If any argument is NULL, the result is NULL. No comparison is needed.\n\no If the return value is used in an INTEGER context or all arguments\n are integer-valued, they are compared as integers.\n\no If the return value is used in a REAL context or all arguments are\n real-valued, they are compared as reals.\n\no If the arguments comprise a mix of numbers and strings, they are\n compared as numbers.\n\no If any argument is a nonbinary (character) string, the arguments are\n compared as nonbinary strings.\n\no In all other cases, the arguments are compared as binary strings.\n\nURL: https://mariadb.com/kb/en/least/\n\n','MariaDB> SELECT LEAST(2,0);\n -> 0\nMariaDB> SELECT LEAST(34.0,3.0,5.0,767.0);\n -> 3.0\nMariaDB> SELECT LEAST(\'B\',\'A\',\'C\');\n -> \'A\'\n','https://mariadb.com/kb/en/least/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (71,18,'=','=\n\nEqual:\n\nURL: https://mariadb.com/kb/en/equal/\n\n','MariaDB> SELECT 1 = 0;\n -> 0\nMariaDB> SELECT \'0\' = 0;\n -> 1\nMariaDB> SELECT \'0.0\' = 0;\n -> 1\nMariaDB> SELECT \'0.01\' = 0;\n -> 0\nMariaDB> SELECT \'.01\' = 0.01;\n -> 1\n','https://mariadb.com/kb/en/equal/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (72,37,'REVERSE','Syntax:\nREVERSE(str)\n\nReturns the string str with the order of the characters reversed.\n\nURL: https://mariadb.com/kb/en/reverse/\n\n','MariaDB> SELECT REVERSE(\'abc\');\n -> \'cba\'\n','https://mariadb.com/kb/en/reverse/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (73,18,'ISNULL','Syntax:\nISNULL(expr)\n\nIf expr is NULL, ISNULL() returns 1, otherwise it returns 0.\n\nURL: https://mariadb.com/kb/en/isnull/\n\n','MariaDB> SELECT ISNULL(1+1);\n -> 0\nMariaDB> SELECT ISNULL(1/0);\n -> 1\n','https://mariadb.com/kb/en/isnull/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (74,22,'BINARY','BINARY(M)\n\nThe BINARY type is similar to the CHAR type, but stores binary byte\nstrings rather than nonbinary character strings. M represents the\ncolumn length in bytes.\n\nURL: https://mariadb.com/kb/en/binary/\n\n','','https://mariadb.com/kb/en/binary/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (75,22,'BLOB DATA TYPE','A BLOB is a binary large object that can hold a variable amount of\ndata. The four BLOB types are TINYBLOB, BLOB, MEDIUMBLOB, and LONGBLOB.\nThese differ only in the maximum length of the values they can hold.\nThe four TEXT types are TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT. These\ncorrespond to the four BLOB types and have the same maximum lengths and\nstorage requirements. See\nhttps://mariadb.com/kb/en/data-type-storage-requirements/.\n\nURL: https://mariadb.com/kb/en/sql_language-data_types-blob/\n\n','','https://mariadb.com/kb/en/sql_language-data_types-blob/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (76,36,'BOUNDARY','Boundary(g)\n\nReturns a geometry that is the closure of the combinatorial boundary of\nthe geometry value g.\n\nURL: https://mariadb.com/kb/en/boundary/\n\n','','https://mariadb.com/kb/en/boundary/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (77,10,'CREATE USER','Syntax:\nCREATE USER user_specification\n [, user_specification] ...\n\nuser_specification:\n user\n [\n IDENTIFIED BY [PASSWORD] \'password\'\n | IDENTIFIED WITH auth_plugin [AS \'auth_string\']\n ]\n\nThe CREATE USER statement creates new MySQL accounts. To use it, you\nmust have the global CREATE USER privilege or the INSERT privilege for\nthe mysql database. For each account, CREATE USER creates a new row in\nthe mysql.user table and assigns the account no privileges. An error\noccurs if the account already exists.\n\nEach account name uses the format described in\nhttps://mariadb.com/kb/en/create-user#account-names. For example:\n\nCREATE USER \'jeffrey\'@\'localhost\' IDENTIFIED BY \'mypass\';\n\nIf you specify only the user name part of the account name, a host name\npart of \'%\' is used.\n\nThe user specification may indicate how the user should authenticate\nwhen connecting to the server:\n\no To enable the user to connect with no password (which is insecure),\n include no IDENTIFIED BY clause:\n\nCREATE USER \'jeffrey\'@\'localhost\';\n\n In this case, the account uses built-in authentication and clients\n must provide no password.\n\no To assign a password, use IDENTIFIED BY with the literal plaintext\n password value:\n\nCREATE USER \'jeffrey\'@\'localhost\' IDENTIFIED BY \'mypass\';\n\n The account uses built-in authentication and clients must match the\n given password.\n\no To avoid specifying the plaintext password if you know its hash value\n (the value that PASSWORD() would return for the password), specify\n the hash value preceded by the keyword PASSWORD:\n\nCREATE USER \'jeffrey\'@\'localhost\'\nIDENTIFIED BY PASSWORD \'*90E462C37378CED12064BB3388827D2BA3A9B689\';\n\n The account uses built-in authentication and clients must match the\n given password.\n\no To authenticate the account using a specific authentication plugin,\n use IDENTIFIED WITH, where auth_plugin is the plugin name. It can be\n an unquoted name or a quoted string literal. \'auth_string\' is an\n optional quoted string literal to pass to the plugin. The plugin\n interprets the meaning of the string, so its format is plugin\n specific. Consult the documentation for a given plugin for\n information about the authentication string values it accepts.\n\nCREATE USER \'jeffrey\'@\'localhost\'\nIDENTIFIED WITH my_auth_plugin;\n\n For connections that use this account, the server invokes the named\n plugin and clients must provide credentials as required for the\n authentication method that the plugin implements. If the server\n cannot find the plugin, either at account-creation time or connect\n time, an error occurs. IDENTIFIED WITH can be used as of MySQL 5.5.7.\n\nThe IDENTIFIED BY and IDENTIFIED WITH clauses are mutually exclusive,\nso at most one of them can be specified for a given user.\n\nFor additional information about setting passwords, see\nhttps://mariadb.com/kb/en/create-user/.\n\nURL: https://mariadb.com/kb/en/create-user/\n\n','','https://mariadb.com/kb/en/create-user/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (78,24,'POINT','Point(x,y)\n\nConstructs a Point using its coordinates.\n\nURL: https://mariadb.com/kb/en/point/\n\n','','https://mariadb.com/kb/en/point/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (79,17,'CURRENT_USER','Syntax:\nCURRENT_USER, CURRENT_USER()\n\nReturns the user name and host name combination for the MySQL account\nthat the server used to authenticate the current client. This account\ndetermines your access privileges. The return value is a string in the\nutf8 character set.\n\nThe value of CURRENT_USER() can differ from the value of USER().\n\nURL: https://mariadb.com/kb/en/current_user/\n\n','MariaDB> SELECT USER();\n -> \'davida@localhost\'\nMariaDB> SELECT * FROM mysql.user;\nERROR 1044: Access denied for user \'\'@\'localhost\' to\ndatabase \'mysql\'\nMariaDB> SELECT CURRENT_USER();\n -> \'@localhost\'\n','https://mariadb.com/kb/en/current_user/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (80,37,'LCASE','Syntax:\nLCASE(str)\n\nLCASE() is a synonym for LOWER().\n\nURL: https://mariadb.com/kb/en/lcase/\n\n','','https://mariadb.com/kb/en/lcase/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (81,18,'<=','Syntax:\n<=\n\nLess than or equal:\n\nURL: https://mariadb.com/kb/en/less-than-or-equal/\n\n','MariaDB> SELECT 0.1 <= 2;\n -> 1\n','https://mariadb.com/kb/en/less-than-or-equal/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (82,26,'SHOW PROFILES','Syntax:\nSHOW PROFILES\n\nThe SHOW PROFILES statement, together with SHOW PROFILE, displays\nprofiling information that indicates resource usage for statements\nexecuted during the course of the current session. For more\ninformation, see [HELP SHOW PROFILE].\n\nURL: https://mariadb.com/kb/en/show-profiles/\n\n','','https://mariadb.com/kb/en/show-profiles/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (83,27,'UPDATE','Syntax:\nSingle-table syntax:\n\nUPDATE [LOW_PRIORITY] [IGNORE] table_reference\n SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] ...\n [WHERE where_condition]\n [ORDER BY ...]\n [LIMIT row_count]\n\nMultiple-table syntax:\n\nUPDATE [LOW_PRIORITY] [IGNORE] table_references\n SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] ...\n [WHERE where_condition]\n\nFor the single-table syntax, the UPDATE statement updates columns of\nexisting rows in the named table with new values. The SET clause\nindicates which columns to modify and the values they should be given.\nEach value can be given as an expression, or the keyword DEFAULT to set\na column explicitly to its default value. The WHERE clause, if given,\nspecifies the conditions that identify which rows to update. With no\nWHERE clause, all rows are updated. If the ORDER BY clause is\nspecified, the rows are updated in the order that is specified. The\nLIMIT clause places a limit on the number of rows that can be updated.\n\nFor the multiple-table syntax, UPDATE updates rows in each table named\nin table_references that satisfy the conditions. In this case, ORDER BY\nand LIMIT cannot be used.\n\nwhere_condition is an expression that evaluates to true for each row to\nbe updated. For expression syntax, see\nhttp://dev.mysql.com/doc/refman/5.5/en/expressions.html.\n\ntable_references and where_condition are is specified as described in\nhttps://mariadb.com/kb/en/select/.\n\nYou need the UPDATE privilege only for columns referenced in an UPDATE\nthat are actually updated. You need only the SELECT privilege for any\ncolumns that are read but not modified.\n\nThe UPDATE statement supports the following modifiers:\n\no With the LOW_PRIORITY keyword, execution of the UPDATE is delayed\n until no other clients are reading from the table. This affects only\n storage engines that use only table-level locking (such as MyISAM,\n MEMORY, and MERGE).\n\no With the IGNORE keyword, the update statement does not abort even if\n errors occur during the update. Rows for which duplicate-key\n conflicts occur are not updated. Rows for which columns are updated\n to values that would cause data conversion errors are updated to the\n closest valid values instead.\n\nURL: https://mariadb.com/kb/en/update/\n\n','','https://mariadb.com/kb/en/update/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (84,18,'IS NOT NULL','Syntax:\nIS NOT NULL\n\nTests whether a value is not NULL.\n\nURL: https://mariadb.com/kb/en/is-not-null/\n\n','MariaDB> SELECT 1 IS NOT NULL, 0 IS NOT NULL, NULL IS NOT NULL;\n -> 1, 1, 0\n','https://mariadb.com/kb/en/is-not-null/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (85,23,'CASE STATEMENT','Syntax:\nCASE case_value\n WHEN when_value THEN statement_list\n [WHEN when_value THEN statement_list] ...\n [ELSE statement_list]\nEND CASE\n\nOr:\n\nCASE\n WHEN search_condition THEN statement_list\n [WHEN search_condition THEN statement_list] ...\n [ELSE statement_list]\nEND CASE\n\nThe CASE statement for stored programs implements a complex conditional\nconstruct.\n\n*Note*: There is also a CASE expression, which differs from the CASE\nstatement described here. See\nhttps://mariadb.com/kb/en/case-operator/. The\nCASE statement cannot have an ELSE NULL clause, and it is terminated\nwith END CASE instead of END.\n\nFor the first syntax, case_value is an expression. This value is\ncompared to the when_value expression in each WHEN clause until one of\nthem is equal. When an equal when_value is found, the corresponding\nTHEN clause statement_list executes. If no when_value is equal, the\nELSE clause statement_list executes, if there is one.\n\nThis syntax cannot be used to test for equality with NULL because NULL\n= NULL is false. See\nhttps://mariadb.com/kb/en/null-values/.\n\nFor the second syntax, each WHEN clause search_condition expression is\nevaluated until one is true, at which point its corresponding THEN\nclause statement_list executes. If no search_condition is equal, the\nELSE clause statement_list executes, if there is one.\n\nIf no when_value or search_condition matches the value tested and the\nCASE statement contains no ELSE clause, a Case not found for CASE\nstatement error results.\n\nEach statement_list consists of one or more SQL statements; an empty\nstatement_list is not permitted.\n\nTo handle situations where no value is matched by any WHEN clause, use\nan ELSE containing an empty BEGIN ... END block, as shown in this\nexample. (The indentation used here in the ELSE clause is for purposes\nof clarity only, and is not otherwise significant.)\n\nDELIMITER |\n\nCREATE PROCEDURE p()\n BEGIN\n DECLARE v INT DEFAULT 1;\n\n CASE v\n WHEN 2 THEN SELECT v;\n WHEN 3 THEN SELECT 0;\n ELSE\n BEGIN\n END;\n END CASE;\n END;\n |\n\nURL: https://mariadb.com/kb/en/case-statement/\n\n','','https://mariadb.com/kb/en/case-statement/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (86,8,'EXECUTE STATEMENT','Syntax:\nEXECUTE stmt_name\n [USING @var_name [, @var_name] ...]\n\nAfter preparing a statement with PREPARE, you execute it with an\nEXECUTE statement that refers to the prepared statement name. If the\nprepared statement contains any parameter markers, you must supply a\nUSING clause that lists user variables containing the values to be\nbound to the parameters. Parameter values can be supplied only by user\nvariables, and the USING clause must name exactly as many variables as\nthe number of parameter markers in the statement.\n\nYou can execute a given prepared statement multiple times, passing\ndifferent variables to it or setting the variables to different values\nbefore each execution.\n\nURL: https://mariadb.com/kb/en/execute-statement/\n\n','','https://mariadb.com/kb/en/execute-statement/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (87,39,'DROP INDEX','Syntax:\nDROP [ONLINE|OFFLINE] INDEX index_name ON tbl_name\n\nDROP INDEX drops the index named index_name from the table tbl_name.\nThis statement is mapped to an ALTER TABLE statement to drop the index.\nSee [HELP ALTER TABLE].\n\nTo drop a primary key, the index name is always PRIMARY, which must be\nspecified as a quoted identifier because PRIMARY is a reserved word:\n\nDROP INDEX `PRIMARY` ON t;\n\nURL: https://mariadb.com/kb/en/drop-index/\n\n','','https://mariadb.com/kb/en/drop-index/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (88,37,'MATCH AGAINST','Syntax:\nMATCH (col1,col2,...) AGAINST (expr [search_modifier])\n\nMySQL has support for full-text indexing and searching:\n\no A full-text index in MySQL is an index of type FULLTEXT.\n\no Full-text indexes can be used only with MyISAM tables, and can be\n created only for CHAR, VARCHAR, or TEXT columns.\n\no A FULLTEXT index definition can be given in the CREATE TABLE\n statement when a table is created, or added later using ALTER TABLE\n or CREATE INDEX.\n\no For large data sets, it is much faster to load your data into a table\n that has no FULLTEXT index and then create the index after that, than\n to load data into a table that has an existing FULLTEXT index.\n\nFull-text searching is performed using MATCH() ... AGAINST syntax.\nMATCH() takes a comma-separated list that names the columns to be\nsearched. AGAINST takes a string to search for, and an optional\nmodifier that indicates what type of search to perform. The search\nstring must be a literal string, not a variable or a column name. There\nare three types of full-text searches:\n\no A natural language search interprets the search string as a phrase in\n natural human language (a phrase in free text). There are no special\n operators. The stopword list applies. In addition, words that are\n present in 50% or more of the rows are considered common and do not\n match.\n\n Full-text searches are natural language searches if the IN NATURAL\n LANGUAGE MODE modifier is given or if no modifier is given. For more\n information, see\n https://mariadb.com/kb/en/fulltext-index-overview#in-natural-language-mode\n .\n\no A boolean search interprets the search string using the rules of a\n special query language. The string contains the words to search for.\n It can also contain operators that specify requirements such that a\n word must be present or absent in matching rows, or that it should be\n weighted higher or lower than usual. Common words such as "some" or\n "then" are stopwords and do not match if present in the search\n string. The IN BOOLEAN MODE modifier specifies a boolean search. For\n more information, see\n https://mariadb.com/kb/en/fulltext-index-overview#in-boolean-mode.\n\no A query expansion search is a modification of a natural language\n search. The search string is used to perform a natural language\n search. Then words from the most relevant rows returned by the search\n are added to the search string and the search is done again. The\n query returns the rows from the second search. The IN NATURAL\n LANGUAGE MODE WITH QUERY EXPANSION or WITH QUERY EXPANSION modifier\n specifies a query expansion search. For more information, see\n https://mariadb.com/kb/en/fulltext-index-overview#with-query-expansion.\n\nURL: https://mariadb.com/kb/en/match-against/\n\n','MariaDB> SELECT id, body, MATCH (title,body) AGAINST\n -> (\'Security implications of running MySQL as root\'\n -> IN NATURAL LANGUAGE MODE) AS score\n -> FROM articles WHERE MATCH (title,body) AGAINST\n -> (\'Security implications of running MySQL as root\'\n -> IN NATURAL LANGUAGE MODE);\n+----+-------------------------------------+-----------------+\n| id | body | score |\n+----+-------------------------------------+-----------------+\n| 4 | 1. Never run mysqld as root. 2. ... | 1.5219271183014 |\n| 6 | When configured properly, MySQL ... | 1.3114095926285 |\n+----+-------------------------------------+-----------------+\n2 rows in set (0.00 sec)\n','https://mariadb.com/kb/en/match-against/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (89,39,'CREATE EVENT','Syntax:\nCREATE\n [DEFINER = { user | CURRENT_USER }]\n EVENT\n [IF NOT EXISTS]\n event_name\n ON SCHEDULE schedule\n [ON COMPLETION [NOT] PRESERVE]\n [ENABLE | DISABLE | DISABLE ON SLAVE]\n [COMMENT \'comment\']\n DO event_body;\n\nschedule:\n AT timestamp [+ INTERVAL interval] ...\n | EVERY interval\n [STARTS timestamp [+ INTERVAL interval] ...]\n [ENDS timestamp [+ INTERVAL interval] ...]\n\ninterval:\n quantity {YEAR | QUARTER | MONTH | DAY | HOUR | MINUTE |\n WEEK | SECOND | YEAR_MONTH | DAY_HOUR | DAY_MINUTE |\n DAY_SECOND | HOUR_MINUTE | HOUR_SECOND | MINUTE_SECOND}\n\nThis statement creates and schedules a new event. The event will not\nrun unless the Event Scheduler is enabled. For information about\nchecking Event Scheduler status and enabling it if necessary, see\nhttps://mariadb.com/kb/en/events/.\n\nCREATE EVENT requires the EVENT privilege for the schema in which the\nevent is to be created. It might also require the SUPER privilege,\ndepending on the DEFINER value, as described later in this section.\n\nThe minimum requirements for a valid CREATE EVENT statement are as\nfollows:\n\no The keywords CREATE EVENT plus an event name, which uniquely\n identifies the event in a database schema.\n\no An ON SCHEDULE clause, which determines when and how often the event\n executes.\n\no A DO clause, which contains the SQL statement to be executed by an\n event.\n\nThis is an example of a minimal CREATE EVENT statement:\n\nCREATE EVENT myevent\n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR\n DO\n UPDATE myschema.mytable SET mycol = mycol + 1;\n\nThe previous statement creates an event named myevent. This event\nexecutes once---one hour following its creation---by running an SQL\nstatement that increments the value of the myschema.mytable table\'s\nmycol column by 1.\n\nThe event_name must be a valid MySQL identifier with a maximum length\nof 64 characters. Event names are not case sensitive, so you cannot\nhave two events named myevent and MyEvent in the same schema. In\ngeneral, the rules governing event names are the same as those for\nnames of stored routines. See\nhttps://mariadb.com/kb/en/identifier-names/.\n\nAn event is associated with a schema. If no schema is indicated as part\nof event_name, the default (current) schema is assumed. To create an\nevent in a specific schema, qualify the event name with a schema using\nschema_name.event_name syntax.\n\nURL: https://mariadb.com/kb/en/create-event/\n\n','','https://mariadb.com/kb/en/create-event/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (90,4,'ABS','Syntax:\nABS(X)\n\nReturns the absolute value of X.\n\nURL: https://mariadb.com/kb/en/abs/\n\n','MariaDB> SELECT ABS(2);\n -> 2\nMariaDB> SELECT ABS(-32);\n -> 32\n','https://mariadb.com/kb/en/abs/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (91,32,'POLYFROMWKB','PolyFromWKB(wkb[,srid]), PolygonFromWKB(wkb[,srid])\n\nConstructs a POLYGON value using its WKB representation and SRID.\n\nURL: https://mariadb.com/kb/en/polyfromwkb/\n\n','','https://mariadb.com/kb/en/polyfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (92,37,'NOT LIKE','Syntax:\nexpr NOT LIKE pat [ESCAPE \'escape_char\']\n\nThis is the same as NOT (expr LIKE pat [ESCAPE \'escape_char\']).\n\nURL: https://mariadb.com/kb/en/not-like/\n\n','','https://mariadb.com/kb/en/not-like/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (93,37,'SPACE','Syntax:\nSPACE(N)\n\nReturns a string consisting of N space characters.\n\nURL: https://mariadb.com/kb/en/space/\n\n','MariaDB> SELECT SPACE(6);\n -> \' \'\n','https://mariadb.com/kb/en/space/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (94,6,'MBR DEFINITION','Its MBR (Minimum Bounding Rectangle), or Envelope. This is the bounding\ngeometry, formed by the minimum and maximum (X,Y) coordinates:\n\nURL: https://mariadb.com/kb/en/mbr-definition/\n\n','((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))\n','https://mariadb.com/kb/en/mbr-definition/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (95,24,'GEOMETRYCOLLECTION','GeometryCollection(g1,g2,...)\n\nConstructs a GeometryCollection.\n\nURL: https://mariadb.com/kb/en/geometrycollection/\n\n','','https://mariadb.com/kb/en/geometrycollection/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (96,16,'MAX','Syntax:\nMAX([DISTINCT] expr)\n\nReturns the maximum value of expr. MAX() may take a string argument; in\nsuch cases, it returns the maximum string value. See\nhttps://mariadb.com/kb/en/max/. The DISTINCT\nkeyword can be used to find the maximum of the distinct values of expr,\nhowever, this produces the same result as omitting DISTINCT.\n\nMAX() returns NULL if there were no matching rows.\n\nURL: https://mariadb.com/kb/en/max/\n\n','MariaDB> SELECT student_name, MIN(test_score), MAX(test_score)\n -> FROM student\n -> GROUP BY student_name;\n','https://mariadb.com/kb/en/max/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (97,21,'CREATE FUNCTION UDF','Syntax:\nCREATE [AGGREGATE] FUNCTION function_name RETURNS {STRING|INTEGER|REAL|DECIMAL}\n SONAME shared_library_name\n\nA user-defined function (UDF) is a way to extend MySQL with a new\nfunction that works like a native (built-in) MySQL function such as\nABS() or CONCAT().\n\nfunction_name is the name that should be used in SQL statements to\ninvoke the function. The RETURNS clause indicates the type of the\nfunction\'s return value. DECIMAL is a legal value after RETURNS, but\ncurrently DECIMAL functions return string values and should be written\nlike STRING functions.\n\nshared_library_name is the basename of the shared object file that\ncontains the code that implements the function. The file must be\nlocated in the plugin directory. This directory is given by the value\nof the plugin_dir system variable. For more information, see\nhttp://dev.mysql.com/doc/refman/5.5/en/udf-compiling.html.\n\nTo create a function, you must have the INSERT privilege for the mysql\ndatabase. This is necessary because CREATE FUNCTION adds a row to the\nmysql.func system table that records the function\'s name, type, and\nshared library name. If you do not have this table, you should run the\nmysql_upgrade command to create it. See\nhttps://mariadb.com/kb/en/mysql_upgrade/.\n\nURL: https://mariadb.com/kb/en/create-function-udf/\n\n','','https://mariadb.com/kb/en/create-function-udf/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (98,4,'*','Syntax:\n*\n\nMultiplication:\n\nURL: https://mariadb.com/kb/en/multiplication-operator/\n\n','MariaDB> SELECT 3*5;\n -> 15\nMariaDB> SELECT 18014398509481984*18014398509481984.0;\n -> 324518553658426726783156020576256.0\nMariaDB> SELECT 18014398509481984*18014398509481984;\n -> 0\n','https://mariadb.com/kb/en/multiplication-operator/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (99,22,'TIMESTAMP','TIMESTAMP\n\nA timestamp. The range is \'1970-01-01 00:00:01\' UTC to \'2038-01-19\n03:14:07\' UTC. TIMESTAMP values are stored as the number of seconds\nsince the epoch (\'1970-01-01 00:00:00\' UTC). A TIMESTAMP cannot\nrepresent the value \'1970-01-01 00:00:00\' because that is equivalent to\n0 seconds from the epoch and the value 0 is reserved for representing\n\'0000-00-00 00:00:00\', the "zero" TIMESTAMP value.\n\nUnless specified otherwise, the first TIMESTAMP column in a table is\ndefined to be automatically set to the date and time of the most recent\nmodification if not explicitly assigned a value. This makes TIMESTAMP\nuseful for recording the timestamp of an INSERT or UPDATE operation.\nYou can also set any TIMESTAMP column to the current date and time by\nassigning it a NULL value, unless it has been defined with the NULL\nattribute to permit NULL values. The automatic initialization and\nupdating to the current date and time can be specified using DEFAULT\nCURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP clauses, as described\nin\nhttps://mariadb.com/kb/en/timestamp/.\n\n*Note*: The TIMESTAMP format that was used prior to MySQL 4.1 is not\nsupported in MySQL 5.5; see MySQL 3.23, 4.0, 4.1 Reference Manual for\ninformation regarding the old format.\n\nURL: https://mariadb.com/kb/en/timestamp/\n\n','','https://mariadb.com/kb/en/timestamp/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (100,12,'DES_DECRYPT','Syntax:\nDES_DECRYPT(crypt_str[,key_str])\n\nDecrypts a string encrypted with DES_ENCRYPT(). If an error occurs,\nthis function returns NULL.\n\nThis function works only if MySQL has been configured with SSL support.\nSee https://mariadb.com/kb/en/ssl-connections/.\n\nIf no key_str argument is given, DES_DECRYPT() examines the first byte\nof the encrypted string to determine the DES key number that was used\nto encrypt the original string, and then reads the key from the DES key\nfile to decrypt the message. For this to work, the user must have the\nSUPER privilege. The key file can be specified with the --des-key-file\nserver option.\n\nIf you pass this function a key_str argument, that string is used as\nthe key for decrypting the message.\n\nIf the crypt_str argument does not appear to be an encrypted string,\nMySQL returns the given crypt_str.\n\nURL: https://mariadb.com/kb/en/des_decrypt/\n\n','','https://mariadb.com/kb/en/des_decrypt/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (101,26,'CACHE INDEX','Syntax:\nCACHE INDEX\n tbl_index_list [, tbl_index_list] ...\n [PARTITION (partition_list | ALL)]\n IN key_cache_name\n\ntbl_index_list:\n tbl_name [[INDEX|KEY] (index_name[, index_name] ...)]\n\npartition_list:\n partition_name[, partition_name][, ...]\n\nThe CACHE INDEX statement assigns table indexes to a specific key\ncache. It is used only for MyISAM tables. After the indexes have been\nassigned, they can be preloaded into the cache if desired with LOAD\nINDEX INTO CACHE.\n\nThe following statement assigns indexes from the tables t1, t2, and t3\nto the key cache named hot_cache:\n\nMariaDB> CACHE INDEX t1, t2, t3 IN hot_cache;\n+---------+--------------------+----------+----------+\n| Table | Op | Msg_type | Msg_text |\n+---------+--------------------+----------+----------+\n| test.t1 | assign_to_keycache | status | OK |\n| test.t2 | assign_to_keycache | status | OK |\n| test.t3 | assign_to_keycache | status | OK |\n+---------+--------------------+----------+----------+\n\nURL: https://mariadb.com/kb/en/cache-index/\n\n','','https://mariadb.com/kb/en/cache-index/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (102,13,'ENDPOINT','EndPoint(ls)\n\nReturns the Point that is the endpoint of the LineString value ls.\n\nURL: https://mariadb.com/kb/en/endpoint/\n\n','MariaDB> SET @ls = \'LineString(1 1,2 2,3 3)\';\nMariaDB> SELECT AsText(EndPoint(GeomFromText(@ls)));\n+-------------------------------------+\n| AsText(EndPoint(GeomFromText(@ls))) |\n+-------------------------------------+\n| POINT(3 3) |\n+-------------------------------------+\n','https://mariadb.com/kb/en/endpoint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (103,12,'COMPRESS','Syntax:\nCOMPRESS(string_to_compress)\n\nCompresses a string and returns the result as a binary string. This\nfunction requires MySQL to have been compiled with a compression\nlibrary such as zlib. Otherwise, the return value is always NULL. The\ncompressed string can be uncompressed with UNCOMPRESS().\n\nURL: https://mariadb.com/kb/en/compress/\n\n','MariaDB> SELECT LENGTH(COMPRESS(REPEAT(\'a\',1000)));\n -> 21\nMariaDB> SELECT LENGTH(COMPRESS(\'\'));\n -> 0\nMariaDB> SELECT LENGTH(COMPRESS(\'a\'));\n -> 13\nMariaDB> SELECT LENGTH(COMPRESS(REPEAT(\'a\',16)));\n -> 15\n','https://mariadb.com/kb/en/compress/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (104,27,'INSERT','Syntax:\nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [(col_name,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n [ ON DUPLICATE KEY UPDATE\n col_name=expr\n [, col_name=expr] ... ]\n\nOr:\n\nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name\n SET col_name={expr | DEFAULT}, ...\n [ ON DUPLICATE KEY UPDATE\n col_name=expr\n [, col_name=expr] ... ]\n\nOr:\n\nINSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [(col_name,...)]\n SELECT ...\n [ ON DUPLICATE KEY UPDATE\n col_name=expr\n [, col_name=expr] ... ]\n\nINSERT inserts new rows into an existing table. The INSERT ... VALUES\nand INSERT ... SET forms of the statement insert rows based on\nexplicitly specified values. The INSERT ... SELECT form inserts rows\nselected from another table or tables. INSERT ... SELECT is discussed\nfurther in [HELP INSERT SELECT].\n\nURL: https://mariadb.com/kb/en/insert/\n\n','','https://mariadb.com/kb/en/insert/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (105,16,'COUNT','Syntax:\nCOUNT(expr)\n\nReturns a count of the number of non-NULL values of expr in the rows\nretrieved by a SELECT statement. The result is a BIGINT value.\n\nCOUNT() returns 0 if there were no matching rows.\n\nURL: https://mariadb.com/kb/en/count/\n\n','MariaDB> SELECT student.student_name,COUNT(*)\n -> FROM student,course\n -> WHERE student.student_id=course.student_id\n -> GROUP BY student_name;\n','https://mariadb.com/kb/en/count/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (106,27,'HANDLER','Syntax:\nHANDLER tbl_name OPEN [ [AS] alias]\n\nHANDLER tbl_name READ index_name { = | <= | >= | < | > } (value1,value2,...)\n [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name READ index_name { FIRST | NEXT | PREV | LAST }\n [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name READ { FIRST | NEXT }\n [ WHERE where_condition ] [LIMIT ... ]\n\nHANDLER tbl_name CLOSE\n\nThe HANDLER statement provides direct access to table storage engine\ninterfaces. It is available for MyISAM and InnoDB tables.\n\nURL: https://mariadb.com/kb/en/handler-commands/\n\n','','https://mariadb.com/kb/en/handler-commands/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (107,3,'MLINEFROMTEXT','MLineFromText(wkt[,srid]), MultiLineStringFromText(wkt[,srid])\n\nConstructs a MULTILINESTRING value using its WKT representation and\nSRID.\n\nURL: https://mariadb.com/kb/en/mlinefromtext/\n\n','','https://mariadb.com/kb/en/mlinefromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (108,32,'GEOMCOLLFROMWKB','GeomCollFromWKB(wkb[,srid]), GeometryCollectionFromWKB(wkb[,srid])\n\nConstructs a GEOMETRYCOLLECTION value using its WKB representation and\nSRID.\n\nURL: https://mariadb.com/kb/en/geomcollfromwkb/\n\n','','https://mariadb.com/kb/en/geomcollfromwkb/');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (109,9,'HELP_DATE','This help information was generated from the MySQL 5.5 Reference Manual\non: 2012-08-25\n','','');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (110,39,'RENAME TABLE','Syntax:\nRENAME TABLE tbl_name TO new_tbl_name\n [, tbl_name2 TO new_tbl_name2] ...\n\nThis statement renames one or more tables.\n\nThe rename operation is done atomically, which means that no other\nsession can access any of the tables while the rename is running. For\nexample, if you have an existing table old_table, you can create\nanother table new_table that has the same structure but is empty, and\nthen replace the existing table with the empty one as follows (assuming\nthat backup_table does not already exist):\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/rename-table.html\n\n','CREATE TABLE new_table (...);\nRENAME TABLE old_table TO backup_table, new_table TO old_table;\n','http://dev.mysql.com/doc/refman/5.5/en/rename-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (111,22,'BOOLEAN','BOOL, BOOLEAN\n\nThese types are synonyms for TINYINT(1). A value of zero is considered\nfalse. Nonzero values are considered true:\n\nmysql> SELECT IF(0, \'true\', \'false\');\n+------------------------+\n| IF(0, \'true\', \'false\') |\n+------------------------+\n| false |\n+------------------------+\n\nmysql> SELECT IF(1, \'true\', \'false\');\n+------------------------+\n| IF(1, \'true\', \'false\') |\n+------------------------+\n| true |\n+------------------------+\n\nmysql> SELECT IF(2, \'true\', \'false\');\n+------------------------+\n| IF(2, \'true\', \'false\') |\n+------------------------+\n| true |\n+------------------------+\n\nHowever, the values TRUE and FALSE are merely aliases for 1 and 0,\nrespectively, as shown here:\n\nmysql> SELECT IF(0 = FALSE, \'true\', \'false\');\n+--------------------------------+\n| IF(0 = FALSE, \'true\', \'false\') |\n+--------------------------------+\n| true |\n+--------------------------------+\n\nmysql> SELECT IF(1 = TRUE, \'true\', \'false\');\n+-------------------------------+\n| IF(1 = TRUE, \'true\', \'false\') |\n+-------------------------------+\n| true |\n+-------------------------------+\n\nmysql> SELECT IF(2 = TRUE, \'true\', \'false\');\n+-------------------------------+\n| IF(2 = TRUE, \'true\', \'false\') |\n+-------------------------------+\n| false |\n+-------------------------------+\n\nmysql> SELECT IF(2 = FALSE, \'true\', \'false\');\n+--------------------------------+\n| IF(2 = FALSE, \'true\', \'false\') |\n+--------------------------------+\n| false |\n+--------------------------------+\n\nThe last two statements display the results shown because 2 is equal to\nneither 1 nor 0.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (112,14,'DEFAULT','Syntax:\nDEFAULT(col_name)\n\nReturns the default value for a table column. An error results if the\ncolumn has no default value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','mysql> UPDATE t SET i = DEFAULT(i)+1 WHERE id < 100;\n','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (113,4,'MOD','Syntax:\nMOD(N,M), N % M, N MOD M\n\nModulo operation. Returns the remainder of N divided by M.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT MOD(234, 10);\n -> 4\nmysql> SELECT 253 % 7;\n -> 1\nmysql> SELECT MOD(29,9);\n -> 2\nmysql> SELECT 29 MOD 9;\n -> 2\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (114,22,'TINYTEXT','TINYTEXT [CHARACTER SET charset_name] [COLLATE collation_name]\n\nA TEXT column with a maximum length of 255 (28 - 1) characters. The\neffective maximum length is less if the value contains multi-byte\ncharacters. Each TINYTEXT value is stored using a 1-byte length prefix\nthat indicates the number of bytes in the value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (115,20,'OPTIMIZE TABLE','Syntax:\nOPTIMIZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n\nOPTIMIZE TABLE should be used if you have deleted a large part of a\ntable or if you have made many changes to a table with variable-length\nrows (tables that have VARCHAR, VARBINARY, BLOB, or TEXT columns).\nDeleted rows are maintained in a linked list and subsequent INSERT\noperations reuse old row positions. You can use OPTIMIZE TABLE to\nreclaim the unused space and to defragment the data file. After\nextensive changes to a table, this statement may also improve\nperformance of statements that use the table, sometimes significantly.\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nOPTIMIZE TABLE is supported for partitioned tables, and you can use\nALTER TABLE ... OPTIMIZE PARTITION to optimize one or more partitions;\nfor more information, see [HELP ALTER TABLE], and\nhttp://dev.mysql.com/doc/refman/5.5/en/partitioning-maintenance.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/optimize-table.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/optimize-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (116,12,'DECODE','Syntax:\nDECODE(crypt_str,pass_str)\n\nDecrypts the encrypted string crypt_str using pass_str as the password.\ncrypt_str should be a string returned from ENCODE().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (117,18,'<=>','Syntax:\n<=>\n\nNULL-safe equal. This operator performs an equality comparison like the\n= operator, but returns 1 rather than NULL if both operands are NULL,\nand 0 rather than NULL if one operand is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 1 <=> 1, NULL <=> NULL, 1 <=> NULL;\n -> 1, 1, 0\nmysql> SELECT 1 = 1, NULL = NULL, 1 = NULL;\n -> 1, NULL, NULL\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (118,28,'HELP STATEMENT','Syntax:\nHELP \'search_string\'\n\nThe HELP statement returns online information from the MySQL Reference\nmanual. Its proper operation requires that the help tables in the mysql\ndatabase be initialized with help topic information (see\nhttp://dev.mysql.com/doc/refman/5.5/en/server-side-help-support.html).\n\nThe HELP statement searches the help tables for the given search string\nand displays the result of the search. The search string is not case\nsensitive.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/help.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/help.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (119,26,'RESET','Syntax:\nRESET reset_option [, reset_option] ...\n\nThe RESET statement is used to clear the state of various server\noperations. You must have the RELOAD privilege to execute RESET.\n\nRESET acts as a stronger version of the FLUSH statement. See [HELP\nFLUSH].\n\nThe RESET statement causes an implicit commit. See\nhttp://dev.mysql.com/doc/refman/5.5/en/implicit-commit.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/reset.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/reset.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (120,14,'GET_LOCK','Syntax:\nGET_LOCK(str,timeout)\n\nTries to obtain a lock with a name given by the string str, using a\ntimeout of timeout seconds. Returns 1 if the lock was obtained\nsuccessfully, 0 if the attempt timed out (for example, because another\nclient has previously locked the name), or NULL if an error occurred\n(such as running out of memory or the thread was killed with mysqladmin\nkill). If you have a lock obtained with GET_LOCK(), it is released when\nyou execute RELEASE_LOCK(), execute a new GET_LOCK(), or your\nconnection terminates (either normally or abnormally). Locks obtained\nwith GET_LOCK() do not interact with transactions. That is, committing\na transaction does not release any such locks obtained during the\ntransaction.\n\nThis function can be used to implement application locks or to simulate\nrecord locks. Names are locked on a server-wide basis. If a name has\nbeen locked by one client, GET_LOCK() blocks any request by another\nclient for a lock with the same name. This enables clients that agree\non a given lock name to use the name to perform cooperative advisory\nlocking. But be aware that it also enables a client that is not among\nthe set of cooperating clients to lock a name, either inadvertently or\ndeliberately, and thus prevent any of the cooperating clients from\nlocking that name. One way to reduce the likelihood of this is to use\nlock names that are database-specific or application-specific. For\nexample, use lock names of the form db_name.str or app_name.str.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','mysql> SELECT GET_LOCK(\'lock1\',10);\n -> 1\nmysql> SELECT IS_FREE_LOCK(\'lock2\');\n -> 1\nmysql> SELECT GET_LOCK(\'lock2\',10);\n -> 1\nmysql> SELECT RELEASE_LOCK(\'lock2\');\n -> 1\nmysql> SELECT RELEASE_LOCK(\'lock1\');\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (121,37,'UCASE','Syntax:\nUCASE(str)\n\nUCASE() is a synonym for UPPER().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (122,26,'SHOW BINLOG EVENTS','Syntax:\nSHOW BINLOG EVENTS\n [IN \'log_name\'] [FROM pos] [LIMIT [offset,] row_count]\n\nShows the events in the binary log. If you do not specify \'log_name\',\nthe first binary log is displayed.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-binlog-events.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-binlog-events.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (123,32,'MPOLYFROMWKB','MPolyFromWKB(wkb[,srid]), MultiPolygonFromWKB(wkb[,srid])\n\nConstructs a MULTIPOLYGON value using its WKB representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (124,23,'ITERATE','Syntax:\nITERATE label\n\nITERATE can appear only within LOOP, REPEAT, and WHILE statements.\nITERATE means "start the loop again."\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/iterate.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/iterate.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (125,27,'DO','Syntax:\nDO expr [, expr] ...\n\nDO executes the expressions but does not return any results. In most\nrespects, DO is shorthand for SELECT expr, ..., but has the advantage\nthat it is slightly faster when you do not care about the result.\n\nDO is useful primarily with functions that have side effects, such as\nRELEASE_LOCK().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/do.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/do.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (126,31,'CURTIME','Syntax:\nCURTIME()\n\nReturns the current time as a value in \'HH:MM:SS\' or HHMMSS.uuuuuu\nformat, depending on whether the function is used in a string or\nnumeric context. The value is expressed in the current time zone.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT CURTIME();\n -> \'23:50:26\'\nmysql> SELECT CURTIME() + 0;\n -> 235026.000000\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (127,37,'CHAR_LENGTH','Syntax:\nCHAR_LENGTH(str)\n\nReturns the length of the string str, measured in characters. A\nmulti-byte character counts as a single character. This means that for\na string containing five 2-byte characters, LENGTH() returns 10,\nwhereas CHAR_LENGTH() returns 5.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (128,22,'BIGINT','BIGINT[(M)] [UNSIGNED] [ZEROFILL]\n\nA large integer. The signed range is -9223372036854775808 to\n9223372036854775807. The unsigned range is 0 to 18446744073709551615.\n\nSERIAL is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (129,26,'SET','Syntax:\nSET variable_assignment [, variable_assignment] ...\n\nvariable_assignment:\n user_var_name = expr\n | [GLOBAL | SESSION] system_var_name = expr\n | [@@global. | @@session. | @@]system_var_name = expr\n\nThe SET statement assigns values to different types of variables that\naffect the operation of the server or your client. Older versions of\nMySQL employed SET OPTION, but this syntax is deprecated in favor of\nSET without OPTION.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/set-statement.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/set-statement.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (130,27,'LOAD XML','Syntax:\nLOAD XML [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE \'file_name\'\n [REPLACE | IGNORE]\n INTO TABLE [db_name.]tbl_name\n [CHARACTER SET charset_name]\n [ROWS IDENTIFIED BY \'<tagname>\']\n [IGNORE number {LINES | ROWS}]\n [(column_or_user_var,...)]\n [SET col_name = expr,...]\n\nThe LOAD XML statement reads data from an XML file into a table. The\nfile_name must be given as a literal string. The tagname in the\noptional ROWS IDENTIFIED BY clause must also be given as a literal\nstring, and must be surrounded by angle brackets (< and >).\n\nLOAD XML acts as the complement of running the mysql client in XML\noutput mode (that is, starting the client with the --xml option). To\nwrite data from a table to an XML file, use a command such as the\nfollowing one from the system shell:\n\nshell> mysql --xml -e \'SELECT * FROM mytable\' > file.xml\n\nTo read the file back into a table, use LOAD XML INFILE. By default,\nthe <row> element is considered to be the equivalent of a database\ntable row; this can be changed using the ROWS IDENTIFIED BY clause.\n\nThis statement supports three different XML formats:\n\no Column names as attributes and column values as attribute values:\n\n<row column1="value1" column2="value2" .../>\n\no Column names as tags and column values as the content of these tags:\n\n<row>\n <column1>value1</column1>\n <column2>value2</column2>\n</row>\n\no Column names are the name attributes of <field> tags, and values are\n the contents of these tags:\n\n<row>\n <field name=\'column1\'>value1</field>\n <field name=\'column2\'>value2</field>\n</row>\n\n This is the format used by other MySQL tools, such as mysqldump.\n\nAll 3 formats can be used in the same XML file; the import routine\nautomatically detects the format for each row and interprets it\ncorrectly. Tags are matched based on the tag or attribute name and the\ncolumn name.\n\nThe following clauses work essentially the same way for LOAD XML as\nthey do for LOAD DATA:\n\no LOW_PRIORITY or CONCURRENT\n\no LOCAL\n\no REPLACE or IGNORE\n\no CHARACTER SET\n\no (column_or_user_var,...)\n\no SET\n\nSee [HELP LOAD DATA], for more information about these clauses.\n\nThe IGNORE number LINES or IGNORE number ROWS clause causes the first\nnumber rows in the XML file to be skipped. It is analogous to the LOAD\nDATA statement\'s IGNORE ... LINES clause.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/load-xml.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/load-xml.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (131,4,'CONV','Syntax:\nCONV(N,from_base,to_base)\n\nConverts numbers between different number bases. Returns a string\nrepresentation of the number N, converted from base from_base to base\nto_base. Returns NULL if any argument is NULL. The argument N is\ninterpreted as an integer, but may be specified as an integer or a\nstring. The minimum base is 2 and the maximum base is 36. If to_base is\na negative number, N is regarded as a signed number. Otherwise, N is\ntreated as unsigned. CONV() works with 64-bit precision.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT CONV(\'a\',16,2);\n -> \'1010\'\nmysql> SELECT CONV(\'6E\',18,8);\n -> \'172\'\nmysql> SELECT CONV(-17,10,-18);\n -> \'-H\'\nmysql> SELECT CONV(10+\'10\'+\'10\'+0xa,10,10);\n -> \'40\'\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (132,22,'DATE','DATE\n\nA date. The supported range is \'1000-01-01\' to \'9999-12-31\'. MySQL\ndisplays DATE values in \'YYYY-MM-DD\' format, but permits assignment of\nvalues to DATE columns using either strings or numbers.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (133,15,'ASSIGN-VALUE','Syntax:\n:=\n\nAssignment operator. Causes the user variable on the left hand side of\nthe operator to take on the value to its right. The value on the right\nhand side may be a literal value, another variable storing a value, or\nany legal expression that yields a scalar value, including the result\nof a query (provided that this value is a scalar value). You can\nperform multiple assignments in the same SET statement. You can perform\nmultiple assignments in the same statement-\n\nUnlike =, the := operator is never interpreted as a comparison\noperator. This means you can use := in any valid SQL statement (not\njust in SET statements) to assign a value to a variable.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/assignment-operators.html\n\n','mysql> SELECT @var1, @var2;\n -> NULL, NULL\nmysql> SELECT @var1 := 1, @var2;\n -> 1, NULL\nmysql> SELECT @var1, @var2;\n -> 1, NULL\nmysql> SELECT @var1, @var2 := @var1;\n -> 1, 1\nmysql> SELECT @var1, @var2;\n -> 1, 1\n\nmysql> SELECT @var1:=COUNT(*) FROM t1;\n -> 4\nmysql> SELECT @var1;\n -> 4\n','http://dev.mysql.com/doc/refman/5.5/en/assignment-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (134,26,'SHOW OPEN TABLES','Syntax:\nSHOW OPEN TABLES [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW OPEN TABLES lists the non-TEMPORARY tables that are currently open\nin the table cache. See\nhttp://dev.mysql.com/doc/refman/5.5/en/table-cache.html. The FROM\nclause, if present, restricts the tables shown to those present in the\ndb_name database. The LIKE clause, if present, indicates which table\nnames to match. The WHERE clause can be given to select rows using more\ngeneral conditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-open-tables.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-open-tables.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (135,31,'EXTRACT','Syntax:\nEXTRACT(unit FROM date)\n\nThe EXTRACT() function uses the same kinds of unit specifiers as\nDATE_ADD() or DATE_SUB(), but extracts parts from the date rather than\nperforming date arithmetic.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT EXTRACT(YEAR FROM \'2009-07-02\');\n -> 2009\nmysql> SELECT EXTRACT(YEAR_MONTH FROM \'2009-07-02 01:02:03\');\n -> 200907\nmysql> SELECT EXTRACT(DAY_MINUTE FROM \'2009-07-02 01:02:03\');\n -> 20102\nmysql> SELECT EXTRACT(MICROSECOND\n -> FROM \'2003-01-02 10:30:00.000123\');\n -> 123\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (136,12,'ENCRYPT','Syntax:\nENCRYPT(str[,salt])\n\nEncrypts str using the Unix crypt() system call and returns a binary\nstring. The salt argument must be a string with at least two characters\nor the result will be NULL. If no salt argument is given, a random\nvalue is used.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','mysql> SELECT ENCRYPT(\'hello\');\n -> \'VxuFAJXVARROc\'\n','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (137,26,'SHOW STATUS','Syntax:\nSHOW [GLOBAL | SESSION] STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW STATUS provides server status information. This information also\ncan be obtained using the mysqladmin extended-status command. The LIKE\nclause, if present, indicates which variable names to match. The WHERE\nclause can be given to select rows using more general conditions, as\ndiscussed in http://dev.mysql.com/doc/refman/5.5/en/extended-show.html.\nThis statement does not require any privilege. It requires only the\nability to connect to the server.\nWith a LIKE clause, the statement displays only rows for those\nvariables with names that match the pattern:\n\nmysql> SHOW STATUS LIKE \'Key%\';\n+--------------------+----------+\n| Variable_name | Value |\n+--------------------+----------+\n| Key_blocks_used | 14955 |\n| Key_read_requests | 96854827 |\n| Key_reads | 162040 |\n| Key_write_requests | 7589728 |\n| Key_writes | 3813196 |\n+--------------------+----------+\n\nWith the GLOBAL modifier, SHOW STATUS displays the status values for\nall connections to MySQL. With SESSION, it displays the status values\nfor the current connection. If no modifier is present, the default is\nSESSION. LOCAL is a synonym for SESSION.\n\nSome status variables have only a global value. For these, you get the\nsame value for both GLOBAL and SESSION. The scope for each status\nvariable is listed at\nhttp://dev.mysql.com/doc/refman/5.5/en/server-status-variables.html.\n\nEach invocation of the SHOW STATUS statement uses an internal temporary\ntable and increments the global Created_tmp_tables value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-status.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-status.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (138,37,'EXTRACTVALUE','Syntax:\nExtractValue(xml_frag, xpath_expr)\n\nExtractValue() takes two string arguments, a fragment of XML markup\nxml_frag and an XPath expression xpath_expr (also known as a locator);\nit returns the text (CDATA) of the first text node which is a child of\nthe elements or elements matched by the XPath expression. In MySQL 5.5,\nthe XPath expression can contain at most 127 characters. (This\nlimitation is lifted in MySQL 5.6.)\n\nUsing this function is the equivalent of performing a match using the\nxpath_expr after appending /text(). In other words,\nExtractValue(\'<a><b>Sakila</b></a>\', \'/a/b\') and\nExtractValue(\'<a><b>Sakila</b></a>\', \'/a/b/text()\') produce the same\nresult.\n\nIf multiple matches are found, the content of the first child text node\nof each matching element is returned (in the order matched) as a\nsingle, space-delimited string.\n\nIf no matching text node is found for the expression (including the\nimplicit /text())---for whatever reason, as long as xpath_expr is\nvalid, and xml_frag consists of elements which are properly nested and\nclosed---an empty string is returned. No distinction is made between a\nmatch on an empty element and no match at all. This is by design.\n\nIf you need to determine whether no matching element was found in\nxml_frag or such an element was found but contained no child text\nnodes, you should test the result of an expression that uses the XPath\ncount() function. For example, both of these statements return an empty\nstring, as shown here:\n\nmysql> SELECT ExtractValue(\'<a><b/></a>\', \'/a/b\');\n+-------------------------------------+\n| ExtractValue(\'<a><b/></a>\', \'/a/b\') |\n+-------------------------------------+\n| |\n+-------------------------------------+\n1 row in set (0.00 sec)\n\nmysql> SELECT ExtractValue(\'<a><c/></a>\', \'/a/b\');\n+-------------------------------------+\n| ExtractValue(\'<a><c/></a>\', \'/a/b\') |\n+-------------------------------------+\n| |\n+-------------------------------------+\n1 row in set (0.00 sec)\n\nHowever, you can determine whether there was actually a matching\nelement using the following:\n\nmysql> SELECT ExtractValue(\'<a><b/></a>\', \'count(/a/b)\');\n+-------------------------------------+\n| ExtractValue(\'<a><b/></a>\', \'count(/a/b)\') |\n+-------------------------------------+\n| 1 |\n+-------------------------------------+\n1 row in set (0.00 sec)\n\nmysql> SELECT ExtractValue(\'<a><c/></a>\', \'count(/a/b)\');\n+-------------------------------------+\n| ExtractValue(\'<a><c/></a>\', \'count(/a/b)\') |\n+-------------------------------------+\n| 0 |\n+-------------------------------------+\n1 row in set (0.01 sec)\n\n*Important*: ExtractValue() returns only CDATA, and does not return any\ntags that might be contained within a matching tag, nor any of their\ncontent (see the result returned as val1 in the following example).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/xml-functions.html\n\n','mysql> SELECT\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/a\') AS val1,\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/a/b\') AS val2,\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'//b\') AS val3,\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/b\') AS val4,\n -> ExtractValue(\'<a>ccc<b>ddd</b><b>eee</b></a>\', \'//b\') AS val5;\n\n+------+------+------+------+---------+\n| val1 | val2 | val3 | val4 | val5 |\n+------+------+------+------+---------+\n| ccc | ddd | ddd | | ddd eee |\n+------+------+------+------+---------+\n','http://dev.mysql.com/doc/refman/5.5/en/xml-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (139,12,'OLD_PASSWORD','Syntax:\nOLD_PASSWORD(str)\n\nOLD_PASSWORD() was added when the implementation of PASSWORD() was\nchanged in MySQL 4.1 to improve security. OLD_PASSWORD() returns the\nvalue of the pre-4.1 implementation of PASSWORD() as a string, and is\nintended to permit you to reset passwords for any pre-4.1 clients that\nneed to connect to your version 5.5 MySQL server without locking them\nout. See http://dev.mysql.com/doc/refman/5.5/en/password-hashing.html.\n\nAs of MySQL 5.5.3, the return value is a nonbinary string in the\nconnection character set. Before 5.5.3, the return value is a binary\nstring.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (140,37,'FORMAT','Syntax:\nFORMAT(X,D[,locale])\n\nFormats the number X to a format like \'#,###,###.##\', rounded to D\ndecimal places, and returns the result as a string. If D is 0, the\nresult has no decimal point or fractional part.\n\nThe optional third parameter enables a locale to be specified to be\nused for the result number\'s decimal point, thousands separator, and\ngrouping between separators. Permissible locale values are the same as\nthe legal values for the lc_time_names system variable (see\nhttp://dev.mysql.com/doc/refman/5.5/en/locale-support.html). If no\nlocale is specified, the default is \'en_US\'.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT FORMAT(12332.123456, 4);\n -> \'12,332.1235\'\nmysql> SELECT FORMAT(12332.1,4);\n -> \'12,332.1000\'\nmysql> SELECT FORMAT(12332.2,0);\n -> \'12,332\'\nmysql> SELECT FORMAT(12332.2,2,\'de_DE\');\n -> \'12.332,20\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (141,15,'||','Syntax:\nOR, ||\n\nLogical OR. When both operands are non-NULL, the result is 1 if any\noperand is nonzero, and 0 otherwise. With a NULL operand, the result is\n1 if the other operand is nonzero, and NULL otherwise. If both operands\nare NULL, the result is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/logical-operators.html\n\n','mysql> SELECT 1 || 1;\n -> 1\nmysql> SELECT 1 || 0;\n -> 1\nmysql> SELECT 0 || 0;\n -> 0\nmysql> SELECT 0 || NULL;\n -> NULL\nmysql> SELECT 1 || NULL;\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/logical-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (142,37,'BIT_LENGTH','Syntax:\nBIT_LENGTH(str)\n\nReturns the length of the string str in bits.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT BIT_LENGTH(\'text\');\n -> 32\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (143,2,'EXTERIORRING','ExteriorRing(poly)\n\nReturns the exterior ring of the Polygon value poly as a LineString.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#polygon-property-functions\n\n','mysql> SET @poly =\n -> \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))\';\nmysql> SELECT AsText(ExteriorRing(GeomFromText(@poly)));\n+-------------------------------------------+\n| AsText(ExteriorRing(GeomFromText(@poly))) |\n+-------------------------------------------+\n| LINESTRING(0 0,0 3,3 3,3 0,0 0) |\n+-------------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#polygon-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (144,32,'GEOMFROMWKB','GeomFromWKB(wkb[,srid]), GeometryFromWKB(wkb[,srid])\n\nConstructs a geometry value of any type using its WKB representation\nand SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (145,26,'SHOW SLAVE HOSTS','Syntax:\nSHOW SLAVE HOSTS\n\nDisplays a list of replication slaves currently registered with the\nmaster. (Before MySQL 5.5.3, only slaves started with the\n--report-host=host_name option are visible in this list.)\n\nThe list is displayed on any server (not just the master server). The\noutput looks like this:\n\nmysql> SHOW SLAVE HOSTS;\n+------------+-----------+------+-----------+\n| Server_id | Host | Port | Master_id |\n+------------+-----------+------+-----------+\n| 192168010 | iconnect2 | 3306 | 192168011 |\n| 1921680101 | athena | 3306 | 192168011 |\n+------------+-----------+------+-----------+\n\no Server_id: The unique server ID of the slave server, as configured in\n the server\'s option file, or on the command line with\n --server-id=value.\n\no Host: The host name of the slave server, as configured in the\n server\'s option file, or on the command line with\n --report-host=host_name. Note that this can differ from the machine\n name as configured in the operating system.\n\no Port: The port the slave server is listening on.\n\n In MySQL 5.5.23 and later, a zero in this column means that the slave\n port (--report-port) was not set. Prior to MySQL 5.5.23, 3306 was\n used as the default in such cases (Bug #13333431).\n\no Master_id: The unique server ID of the master server that the slave\n server is replicating from.\n\nSome MySQL versions report another variable, Rpl_recovery_rank. This\nvariable was never used, and was removed in MySQL 5.5.3. (Bug #13963)\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-slave-hosts.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-slave-hosts.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (146,8,'START TRANSACTION','Syntax:\nSTART TRANSACTION [WITH CONSISTENT SNAPSHOT]\nBEGIN [WORK]\nCOMMIT [WORK] [AND [NO] CHAIN] [[NO] RELEASE]\nROLLBACK [WORK] [AND [NO] CHAIN] [[NO] RELEASE]\nSET autocommit = {0 | 1}\n\nThese statements provide control over use of transactions:\n\no START TRANSACTION or BEGIN start a new transaction.\n\no COMMIT commits the current transaction, making its changes permanent.\n\no ROLLBACK rolls back the current transaction, canceling its changes.\n\no SET autocommit disables or enables the default autocommit mode for\n the current session.\n\nBy default, MySQL runs with autocommit mode enabled. This means that as\nsoon as you execute a statement that updates (modifies) a table, MySQL\nstores the update on disk to make it permanent. The change cannot be\nrolled back.\n\nTo disable autocommit mode implicitly for a single series of\nstatements, use the START TRANSACTION statement:\n\nSTART TRANSACTION;\nSELECT @A:=SUM(salary) FROM table1 WHERE type=1;\nUPDATE table2 SET summary=@A WHERE type=1;\nCOMMIT;\n\nWith START TRANSACTION, autocommit remains disabled until you end the\ntransaction with COMMIT or ROLLBACK. The autocommit mode then reverts\nto its previous state.\n\nYou can also begin a transaction like this:\n\nSTART TRANSACTION WITH CONSISTENT SNAPSHOT;\n\nThe WITH CONSISTENT SNAPSHOT option starts a consistent read for\nstorage engines that are capable of it. This applies only to InnoDB.\nThe effect is the same as issuing a START TRANSACTION followed by a\nSELECT from any InnoDB table. See\nhttp://dev.mysql.com/doc/refman/5.5/en/innodb-consistent-read.html. The\nWITH CONSISTENT SNAPSHOT option does not change the current transaction\nisolation level, so it provides a consistent snapshot only if the\ncurrent isolation level is one that permits consistent read (REPEATABLE\nREAD or SERIALIZABLE).\n\n*Important*: Many APIs used for writing MySQL client applications (such\nas JDBC) provide their own methods for starting transactions that can\n(and sometimes should) be used instead of sending a START TRANSACTION\nstatement from the client. See\nhttp://dev.mysql.com/doc/refman/5.5/en/connectors-apis.html, or the\ndocumentation for your API, for more information.\n\nTo disable autocommit mode explicitly, use the following statement:\n\nSET autocommit=0;\n\nAfter disabling autocommit mode by setting the autocommit variable to\nzero, changes to transaction-safe tables (such as those for InnoDB or\nNDBCLUSTER) are not made permanent immediately. You must use COMMIT to\nstore your changes to disk or ROLLBACK to ignore the changes.\n\nautocommit is a session variable and must be set for each session. To\ndisable autocommit mode for each new connection, see the description of\nthe autocommit system variable at\nhttp://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html.\n\nBEGIN and BEGIN WORK are supported as aliases of START TRANSACTION for\ninitiating a transaction. START TRANSACTION is standard SQL syntax and\nis the recommended way to start an ad-hoc transaction.\n\nThe BEGIN statement differs from the use of the BEGIN keyword that\nstarts a BEGIN ... END compound statement. The latter does not begin a\ntransaction. See [HELP BEGIN END].\n\n*Note*: Within all stored programs (stored procedures and functions,\ntriggers, and events), the parser treats BEGIN [WORK] as the beginning\nof a BEGIN ... END block. Begin a transaction in this context with\nSTART TRANSACTION instead.\n\nThe optional WORK keyword is supported for COMMIT and ROLLBACK, as are\nthe CHAIN and RELEASE clauses. CHAIN and RELEASE can be used for\nadditional control over transaction completion. The value of the\ncompletion_type system variable determines the default completion\nbehavior. See\nhttp://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html.\n\nThe AND CHAIN clause causes a new transaction to begin as soon as the\ncurrent one ends, and the new transaction has the same isolation level\nas the just-terminated transaction. The RELEASE clause causes the\nserver to disconnect the current client session after terminating the\ncurrent transaction. Including the NO keyword suppresses CHAIN or\nRELEASE completion, which can be useful if the completion_type system\nvariable is set to cause chaining or release completion by default.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/commit.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/commit.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (147,18,'BETWEEN AND','Syntax:\nexpr BETWEEN min AND max\n\nIf expr is greater than or equal to min and expr is less than or equal\nto max, BETWEEN returns 1, otherwise it returns 0. This is equivalent\nto the expression (min <= expr AND expr <= max) if all the arguments\nare of the same type. Otherwise type conversion takes place according\nto the rules described in\nhttp://dev.mysql.com/doc/refman/5.5/en/type-conversion.html, but\napplied to all the three arguments.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 2 BETWEEN 1 AND 3, 2 BETWEEN 3 and 1;\n -> 1, 0\nmysql> SELECT 1 BETWEEN 2 AND 3;\n -> 0\nmysql> SELECT \'b\' BETWEEN \'a\' AND \'c\';\n -> 1\nmysql> SELECT 2 BETWEEN 2 AND \'3\';\n -> 1\nmysql> SELECT 2 BETWEEN 2 AND \'x-3\';\n -> 0\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (148,24,'MULTIPOLYGON','MultiPolygon(poly1,poly2,...)\n\nConstructs a MultiPolygon value from a set of Polygon or WKB Polygon\narguments.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (149,31,'TIME_FORMAT','Syntax:\nTIME_FORMAT(time,format)\n\nThis is used like the DATE_FORMAT() function, but the format string may\ncontain format specifiers only for hours, minutes, seconds, and\nmicroseconds. Other specifiers produce a NULL value or 0.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT TIME_FORMAT(\'100:00:00\', \'%H %k %h %I %l\');\n -> \'100 100 04 04 4\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (150,37,'LEFT','Syntax:\nLEFT(str,len)\n\nReturns the leftmost len characters from the string str, or NULL if any\nargument is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT LEFT(\'foobarbar\', 5);\n -> \'fooba\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (151,26,'FLUSH QUERY CACHE','You can defragment the query cache to better utilize its memory with\nthe FLUSH QUERY CACHE statement. The statement does not remove any\nqueries from the cache.\n\nThe RESET QUERY CACHE statement removes all query results from the\nquery cache. The FLUSH TABLES statement also does this.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/query-cache-status-and-maintenance.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/query-cache-status-and-maintenance.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (152,22,'SET DATA TYPE','SET(\'value1\',\'value2\',...) [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n\nA set. A string object that can have zero or more values, each of which\nmust be chosen from the list of values \'value1\', \'value2\', ... A SET\ncolumn can have a maximum of 64 members. SET values are represented\ninternally as integers.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (153,4,'RAND','Syntax:\nRAND(), RAND(N)\n\nReturns a random floating-point value v in the range 0 <= v < 1.0. If a\nconstant integer argument N is specified, it is used as the seed value,\nwhich produces a repeatable sequence of column values. In the following\nexample, note that the sequences of values produced by RAND(3) is the\nsame both places where it occurs.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> CREATE TABLE t (i INT);\nQuery OK, 0 rows affected (0.42 sec)\n\nmysql> INSERT INTO t VALUES(1),(2),(3);\nQuery OK, 3 rows affected (0.00 sec)\nRecords: 3 Duplicates: 0 Warnings: 0\n\nmysql> SELECT i, RAND() FROM t;\n+------+------------------+\n| i | RAND() |\n+------+------------------+\n| 1 | 0.61914388706828 |\n| 2 | 0.93845168309142 |\n| 3 | 0.83482678498591 |\n+------+------------------+\n3 rows in set (0.00 sec)\n\nmysql> SELECT i, RAND(3) FROM t;\n+------+------------------+\n| i | RAND(3) |\n+------+------------------+\n| 1 | 0.90576975597606 |\n| 2 | 0.37307905813035 |\n| 3 | 0.14808605345719 |\n+------+------------------+\n3 rows in set (0.00 sec)\n\nmysql> SELECT i, RAND() FROM t;\n+------+------------------+\n| i | RAND() |\n+------+------------------+\n| 1 | 0.35877890638893 |\n| 2 | 0.28941420772058 |\n| 3 | 0.37073435016976 |\n+------+------------------+\n3 rows in set (0.00 sec)\n\nmysql> SELECT i, RAND(3) FROM t;\n+------+------------------+\n| i | RAND(3) |\n+------+------------------+\n| 1 | 0.90576975597606 |\n| 2 | 0.37307905813035 |\n| 3 | 0.14808605345719 |\n+------+------------------+\n3 rows in set (0.01 sec)\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (154,37,'RPAD','Syntax:\nRPAD(str,len,padstr)\n\nReturns the string str, right-padded with the string padstr to a length\nof len characters. If str is longer than len, the return value is\nshortened to len characters.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT RPAD(\'hi\',5,\'?\');\n -> \'hi???\'\nmysql> SELECT RPAD(\'hi\',1,\'?\');\n -> \'h\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (155,39,'CREATE DATABASE','Syntax:\nCREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name\n [create_specification] ...\n\ncreate_specification:\n [DEFAULT] CHARACTER SET [=] charset_name\n | [DEFAULT] COLLATE [=] collation_name\n\nCREATE DATABASE creates a database with the given name. To use this\nstatement, you need the CREATE privilege for the database. CREATE\nSCHEMA is a synonym for CREATE DATABASE.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-database.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/create-database.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (156,22,'DEC','DEC[(M[,D])] [UNSIGNED] [ZEROFILL], NUMERIC[(M[,D])] [UNSIGNED]\n[ZEROFILL], FIXED[(M[,D])] [UNSIGNED] [ZEROFILL]\n\nThese types are synonyms for DECIMAL. The FIXED synonym is available\nfor compatibility with other database systems.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (157,16,'VAR_POP','Syntax:\nVAR_POP(expr)\n\nReturns the population standard variance of expr. It considers rows as\nthe whole population, not as a sample, so it has the number of rows as\nthe denominator. You can also use VARIANCE(), which is equivalent but\nis not standard SQL.\n\nVAR_POP() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (158,37,'ELT','Syntax:\nELT(N,str1,str2,str3,...)\n\nReturns str1 if N = 1, str2 if N = 2, and so on. Returns NULL if N is\nless than 1 or greater than the number of arguments. ELT() is the\ncomplement of FIELD().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT ELT(1, \'ej\', \'Heja\', \'hej\', \'foo\');\n -> \'ej\'\nmysql> SELECT ELT(4, \'ej\', \'Heja\', \'hej\', \'foo\');\n -> \'foo\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (159,39,'ALTER VIEW','Syntax:\nALTER\n [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]\n [DEFINER = { user | CURRENT_USER }]\n [SQL SECURITY { DEFINER | INVOKER }]\n VIEW view_name [(column_list)]\n AS select_statement\n [WITH [CASCADED | LOCAL] CHECK OPTION]\n\nThis statement changes the definition of a view, which must exist. The\nsyntax is similar to that for CREATE VIEW and the effect is the same as\nfor CREATE OR REPLACE VIEW. See [HELP CREATE VIEW]. This statement\nrequires the CREATE VIEW and DROP privileges for the view, and some\nprivilege for each column referred to in the SELECT statement. ALTER\nVIEW is permitted only to the definer or users with the SUPER\nprivilege.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/alter-view.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/alter-view.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (160,26,'SHOW DATABASES','Syntax:\nSHOW {DATABASES | SCHEMAS}\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW DATABASES lists the databases on the MySQL server host. SHOW\nSCHEMAS is a synonym for SHOW DATABASES. The LIKE clause, if present,\nindicates which database names to match. The WHERE clause can be given\nto select rows using more general conditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html.\n\nYou see only those databases for which you have some kind of privilege,\nunless you have the global SHOW DATABASES privilege. You can also get\nthis list using the mysqlshow command.\n\nIf the server was started with the --skip-show-database option, you\ncannot use this statement at all unless you have the SHOW DATABASES\nprivilege.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-databases.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-databases.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (161,19,'~','Syntax:\n~\n\nInvert all bits.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html\n\n','mysql> SELECT 5 & ~1;\n -> 4\n','http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (162,22,'TEXT','TEXT[(M)] [CHARACTER SET charset_name] [COLLATE collation_name]\n\nA TEXT column with a maximum length of 65,535 (216 - 1) characters. The\neffective maximum length is less if the value contains multi-byte\ncharacters. Each TEXT value is stored using a 2-byte length prefix that\nindicates the number of bytes in the value.\n\nAn optional length M can be given for this type. If this is done, MySQL\ncreates the column as the smallest TEXT type large enough to hold\nvalues M characters long.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (163,37,'CONCAT_WS','Syntax:\nCONCAT_WS(separator,str1,str2,...)\n\nCONCAT_WS() stands for Concatenate With Separator and is a special form\nof CONCAT(). The first argument is the separator for the rest of the\narguments. The separator is added between the strings to be\nconcatenated. The separator can be a string, as can the rest of the\narguments. If the separator is NULL, the result is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT CONCAT_WS(\',\',\'First name\',\'Second name\',\'Last Name\');\n -> \'First name,Second name,Last Name\'\nmysql> SELECT CONCAT_WS(\',\',\'First name\',NULL,\'Last Name\');\n -> \'First name,Last Name\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (164,17,'ROW_COUNT','Syntax:\nROW_COUNT()\n\nBefore MySQL 5.5.5, ROW_COUNT() returns the number of rows changed,\ndeleted, or inserted by the last statement if it was an UPDATE, DELETE,\nor INSERT. For other statements, the value may not be meaningful.\n\nAs of MySQL 5.5.5, ROW_COUNT() returns a value as follows:\n\no DDL statements: 0. This applies to statements such as CREATE TABLE or\n DROP TABLE.\n\no DML statements other than SELECT: The number of affected rows. This\n applies to statements such as UPDATE, INSERT, or DELETE (as before),\n but now also to statements such as ALTER TABLE and LOAD DATA INFILE.\n\no SELECT: -1 if the statement returns a result set, or the number of\n rows "affected" if it does not. For example, for SELECT * FROM t1,\n ROW_COUNT() returns -1. For SELECT * FROM t1 INTO OUTFILE\n \'file_name\', ROW_COUNT() returns the number of rows written to the\n file.\n\no SIGNAL statements: 0.\n\nFor UPDATE statements, the affected-rows value by default is the number\nof rows actually changed. If you specify the CLIENT_FOUND_ROWS flag to\nmysql_real_connect() when connecting to mysqld, the affected-rows value\nis the number of rows "found"; that is, matched by the WHERE clause.\n\nFor REPLACE statements, the affected-rows value is 2 if the new row\nreplaced an old row, because in this case, one row was inserted after\nthe duplicate was deleted.\n\nFor INSERT ... ON DUPLICATE KEY UPDATE statements, the affected-rows\nvalue is 1 if the row is inserted as a new row and 2 if an existing row\nis updated.\n\nThe ROW_COUNT() value is similar to the value from the\nmysql_affected_rows() C API function and the row count that the mysql\nclient displays following statement execution.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','mysql> INSERT INTO t VALUES(1),(2),(3);\nQuery OK, 3 rows affected (0.00 sec)\nRecords: 3 Duplicates: 0 Warnings: 0\n\nmysql> SELECT ROW_COUNT();\n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 3 |\n+-------------+\n1 row in set (0.00 sec)\n\nmysql> DELETE FROM t WHERE i IN(1,2);\nQuery OK, 2 rows affected (0.00 sec)\n\nmysql> SELECT ROW_COUNT();\n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 2 |\n+-------------+\n1 row in set (0.00 sec)\n','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (165,4,'ASIN','Syntax:\nASIN(X)\n\nReturns the arc sine of X, that is, the value whose sine is X. Returns\nNULL if X is not in the range -1 to 1.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT ASIN(0.2);\n -> 0.20135792079033\nmysql> SELECT ASIN(\'foo\');\n\n+-------------+\n| ASIN(\'foo\') |\n+-------------+\n| 0 |\n+-------------+\n1 row in set, 1 warning (0.00 sec)\n\nmysql> SHOW WARNINGS;\n+---------+------+-----------------------------------------+\n| Level | Code | Message |\n+---------+------+-----------------------------------------+\n| Warning | 1292 | Truncated incorrect DOUBLE value: \'foo\' |\n+---------+------+-----------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (166,4,'SIGN','Syntax:\nSIGN(X)\n\nReturns the sign of the argument as -1, 0, or 1, depending on whether X\nis negative, zero, or positive.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT SIGN(-32);\n -> -1\nmysql> SELECT SIGN(0);\n -> 0\nmysql> SELECT SIGN(234);\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (167,31,'SEC_TO_TIME','Syntax:\nSEC_TO_TIME(seconds)\n\nReturns the seconds argument, converted to hours, minutes, and seconds,\nas a TIME value. The range of the result is constrained to that of the\nTIME data type. A warning occurs if the argument corresponds to a value\noutside that range.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT SEC_TO_TIME(2378);\n -> \'00:39:38\'\nmysql> SELECT SEC_TO_TIME(2378) + 0;\n -> 3938\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (168,22,'FLOAT','FLOAT[(M,D)] [UNSIGNED] [ZEROFILL]\n\nA small (single-precision) floating-point number. Permissible values\nare -3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to\n3.402823466E+38. These are the theoretical limits, based on the IEEE\nstandard. The actual range might be slightly smaller depending on your\nhardware or operating system.\n\nM is the total number of digits and D is the number of digits following\nthe decimal point. If M and D are omitted, values are stored to the\nlimits permitted by the hardware. A single-precision floating-point\nnumber is accurate to approximately 7 decimal places.\n\nUNSIGNED, if specified, disallows negative values.\n\nUsing FLOAT might give you some unexpected problems because all\ncalculations in MySQL are done with double precision. See\nhttp://dev.mysql.com/doc/refman/5.5/en/no-matching-rows.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (169,37,'LOCATE','Syntax:\nLOCATE(substr,str), LOCATE(substr,str,pos)\n\nThe first syntax returns the position of the first occurrence of\nsubstring substr in string str. The second syntax returns the position\nof the first occurrence of substring substr in string str, starting at\nposition pos. Returns 0 if substr is not in str.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT LOCATE(\'bar\', \'foobarbar\');\n -> 4\nmysql> SELECT LOCATE(\'xbar\', \'foobar\');\n -> 0\nmysql> SELECT LOCATE(\'bar\', \'foobarbar\', 5);\n -> 7\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (170,26,'SHOW EVENTS','Syntax:\nSHOW EVENTS [{FROM | IN} schema_name]\n [LIKE \'pattern\' | WHERE expr]\n\nThis statement displays information about Event Manager events. It\nrequires the EVENT privilege for the database from which the events are\nto be shown.\n\nIn its simplest form, SHOW EVENTS lists all of the events in the\ncurrent schema:\n\nmysql> SELECT CURRENT_USER(), SCHEMA();\n+----------------+----------+\n| CURRENT_USER() | SCHEMA() |\n+----------------+----------+\n| jon@ghidora | myschema |\n+----------------+----------+\n1 row in set (0.00 sec)\n\nmysql> SHOW EVENTS\\G\n*************************** 1. row ***************************\n Db: myschema\n Name: e_daily\n Definer: jon@ghidora\n Time zone: SYSTEM\n Type: RECURRING\n Execute at: NULL\n Interval value: 10\n Interval field: SECOND\n Starts: 2006-02-09 10:41:23\n Ends: NULL\n Status: ENABLED\n Originator: 0\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\nTo see events for a specific schema, use the FROM clause. For example,\nto see events for the test schema, use the following statement:\n\nSHOW EVENTS FROM test;\n\nThe LIKE clause, if present, indicates which event names to match. The\nWHERE clause can be given to select rows using more general conditions,\nas discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-events.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-events.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (171,17,'CHARSET','Syntax:\nCHARSET(str)\n\nReturns the character set of the string argument.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','mysql> SELECT CHARSET(\'abc\');\n -> \'latin1\'\nmysql> SELECT CHARSET(CONVERT(\'abc\' USING utf8));\n -> \'utf8\'\nmysql> SELECT CHARSET(USER());\n -> \'utf8\'\n','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (172,31,'SUBDATE','Syntax:\nSUBDATE(date,INTERVAL expr unit), SUBDATE(expr,days)\n\nWhen invoked with the INTERVAL form of the second argument, SUBDATE()\nis a synonym for DATE_SUB(). For information on the INTERVAL unit\nargument, see the discussion for DATE_ADD().\n\nmysql> SELECT DATE_SUB(\'2008-01-02\', INTERVAL 31 DAY);\n -> \'2007-12-02\'\nmysql> SELECT SUBDATE(\'2008-01-02\', INTERVAL 31 DAY);\n -> \'2007-12-02\'\n\nThe second form enables the use of an integer value for days. In such\ncases, it is interpreted as the number of days to be subtracted from\nthe date or datetime expression expr.\n\nmysql> SELECT SUBDATE(\'2008-01-02 12:00:00\', 31);\n -> \'2007-12-02 12:00:00\'\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (173,31,'DAYOFYEAR','Syntax:\nDAYOFYEAR(date)\n\nReturns the day of the year for date, in the range 1 to 366.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT DAYOFYEAR(\'2007-02-03\');\n -> 34\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (174,4,'%','Syntax:\nN % M, N MOD M\n\nModulo operation. Returns the remainder of N divided by M. For more\ninformation, see the description for the MOD() function in\nhttp://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (175,22,'LONGTEXT','LONGTEXT [CHARACTER SET charset_name] [COLLATE collation_name]\n\nA TEXT column with a maximum length of 4,294,967,295 or 4GB (232 - 1)\ncharacters. The effective maximum length is less if the value contains\nmulti-byte characters. The effective maximum length of LONGTEXT columns\nalso depends on the configured maximum packet size in the client/server\nprotocol and available memory. Each LONGTEXT value is stored using a\n4-byte length prefix that indicates the number of bytes in the value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (176,26,'KILL','Syntax:\nKILL [CONNECTION | QUERY] thread_id\n\nEach connection to mysqld runs in a separate thread. You can see which\nthreads are running with the SHOW PROCESSLIST statement and kill a\nthread with the KILL thread_id statement.\n\nKILL permits an optional CONNECTION or QUERY modifier:\n\no KILL CONNECTION is the same as KILL with no modifier: It terminates\n the connection associated with the given thread_id.\n\no KILL QUERY terminates the statement that the connection is currently\n executing, but leaves the connection itself intact.\n\nIf you have the PROCESS privilege, you can see all threads. If you have\nthe SUPER privilege, you can kill all threads and statements.\nOtherwise, you can see and kill only your own threads and statements.\n\nYou can also use the mysqladmin processlist and mysqladmin kill\ncommands to examine and kill threads.\n\n*Note*: You cannot use KILL with the Embedded MySQL Server library\nbecause the embedded server merely runs inside the threads of the host\napplication. It does not create any connection threads of its own.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/kill.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/kill.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (177,30,'DISJOINT','Disjoint(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 is spatially disjoint from (does\nnot intersect) g2.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (178,3,'ASTEXT','AsText(g), AsWKT(g)\n\nConverts a value in internal geometry format to its WKT representation\nand returns the string result.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-to-convert-geometries-between-formats.html\n\n','mysql> SET @g = \'LineString(1 1,2 2,3 3)\';\nmysql> SELECT AsText(GeomFromText(@g));\n+--------------------------+\n| AsText(GeomFromText(@g)) |\n+--------------------------+\n| LINESTRING(1 1,2 2,3 3) |\n+--------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/functions-to-convert-geometries-between-formats.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (179,37,'LPAD','Syntax:\nLPAD(str,len,padstr)\n\nReturns the string str, left-padded with the string padstr to a length\nof len characters. If str is longer than len, the return value is\nshortened to len characters.\n\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT LPAD(\'hi\',4,\'??\');\n -> \'??hi\'\nmysql> SELECT LPAD(\'hi\',1,\'??\');\n -> \'h\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (180,23,'DECLARE CONDITION','Syntax:\nDECLARE condition_name CONDITION FOR condition_value\n\ncondition_value:\n mysql_error_code\n | SQLSTATE [VALUE] sqlstate_value\n\nThe DECLARE ... CONDITION statement declares a named error condition,\nassociating a name with a condition that needs specific handling. The\nname can be referred to in a subsequent DECLARE ... HANDLER statement\n(see [HELP DECLARE HANDLER]).\n\nCondition declarations must appear before cursor or handler\ndeclarations.\n\nThe condition_value for DECLARE ... CONDITION can be a MySQL error code\n(a number) or an SQLSTATE value (a 5-character string literal). You\nshould not use MySQL error code 0 or SQLSTATE values that begin with\n\'00\', because those indicate success rather than an error condition.\nFor a list of MySQL error codes and SQLSTATE values, see\nhttp://dev.mysql.com/doc/refman/5.5/en/error-messages-server.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/declare-condition.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/declare-condition.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (181,30,'OVERLAPS','Overlaps(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 spatially overlaps g2. The term\nspatially overlaps is used if two geometries intersect and their\nintersection results in a geometry of the same dimension but not equal\nto either of the given geometries.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (182,8,'SET GLOBAL SQL_SLAVE_SKIP_COUNTER','Syntax:\nSET GLOBAL sql_slave_skip_counter = N\n\nThis statement skips the next N events from the master. This is useful\nfor recovering from replication stops caused by a statement.\n\nThis statement is valid only when the slave threads are not running.\nOtherwise, it produces an error.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/set-global-sql-slave-skip-counter.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/set-global-sql-slave-skip-counter.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (183,25,'NUMGEOMETRIES','NumGeometries(gc)\n\nReturns the number of geometries in the GeometryCollection value gc.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#geometrycollection-property-functions\n\n','mysql> SET @gc = \'GeometryCollection(Point(1 1),LineString(2 2, 3 3))\';\nmysql> SELECT NumGeometries(GeomFromText(@gc));\n+----------------------------------+\n| NumGeometries(GeomFromText(@gc)) |\n+----------------------------------+\n| 2 |\n+----------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#geometrycollection-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (184,31,'MONTHNAME','Syntax:\nMONTHNAME(date)\n\nReturns the full name of the month for date. The language used for the\nname is controlled by the value of the lc_time_names system variable\n(http://dev.mysql.com/doc/refman/5.5/en/locale-support.html).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT MONTHNAME(\'2008-02-03\');\n -> \'February\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (185,8,'CHANGE MASTER TO','Syntax:\nCHANGE MASTER TO option [, option] ...\n\noption:\n MASTER_BIND = \'interface_name\'\n | MASTER_HOST = \'host_name\'\n | MASTER_USER = \'user_name\'\n | MASTER_PASSWORD = \'password\'\n | MASTER_PORT = port_num\n | MASTER_CONNECT_RETRY = interval\n | MASTER_HEARTBEAT_PERIOD = interval\n | MASTER_LOG_FILE = \'master_log_name\'\n | MASTER_LOG_POS = master_log_pos\n | RELAY_LOG_FILE = \'relay_log_name\'\n | RELAY_LOG_POS = relay_log_pos\n | MASTER_SSL = {0|1}\n | MASTER_SSL_CA = \'ca_file_name\'\n | MASTER_SSL_CAPATH = \'ca_directory_name\'\n | MASTER_SSL_CERT = \'cert_file_name\'\n | MASTER_SSL_KEY = \'key_file_name\'\n | MASTER_SSL_CIPHER = \'cipher_list\'\n | MASTER_SSL_VERIFY_SERVER_CERT = {0|1}\n | IGNORE_SERVER_IDS = (server_id_list)\n\nserver_id_list:\n [server_id [, server_id] ... ]\n\nCHANGE MASTER TO changes the parameters that the slave server uses for\nconnecting to the master server, for reading the master binary log, and\nreading the slave relay log. It also updates the contents of the\nmaster.info and relay-log.info files. To use CHANGE MASTER TO, the\nslave replication threads must be stopped (use STOP SLAVE if\nnecessary).\n\nOptions not specified retain their value, except as indicated in the\nfollowing discussion. Thus, in most cases, there is no need to specify\noptions that do not change. For example, if the password to connect to\nyour MySQL master has changed, you just need to issue these statements\nto tell the slave about the new password:\n\nSTOP SLAVE; -- if replication was running\nCHANGE MASTER TO MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE; -- if you want to restart replication\n\nMASTER_HOST, MASTER_USER, MASTER_PASSWORD, and MASTER_PORT provide\ninformation to the slave about how to connect to its master:\n\no MASTER_HOST and MASTER_PORT are the host name (or IP address) of the\n master host and its TCP/IP port.\n\n *Note*: Replication cannot use Unix socket files. You must be able to\n connect to the master MySQL server using TCP/IP.\n\n If you specify the MASTER_HOST or MASTER_PORT option, the slave\n assumes that the master server is different from before (even if the\n option value is the same as its current value.) In this case, the old\n values for the master binary log file name and position are\n considered no longer applicable, so if you do not specify\n MASTER_LOG_FILE and MASTER_LOG_POS in the statement,\n MASTER_LOG_FILE=\'\' and MASTER_LOG_POS=4 are silently appended to it.\n\n Setting MASTER_HOST=\'\' (that is, setting its value explicitly to an\n empty string) is not the same as not setting MASTER_HOST at all.\n Beginning with MySQL 5.5, trying to set MASTER_HOST to an empty\n string fails with an error. Previously, setting MASTER_HOST to an\n empty string caused START SLAVE subsequently to fail. (Bug #28796)\n\no MASTER_USER and MASTER_PASSWORD are the user name and password of the\n account to use for connecting to the master.\n\n In MySQL 5.5.20 and later, MASTER_USER cannot be made empty; setting\n MASTER_USER = \'\' or leaving it unset when setting a value for for\n MASTER_PASSWORD causes an error (Bug #13427949).\n\n Currently, a password used for a replication slave account is\n effectively limited to 32 characters in length; the password can be\n longer, but any excess characters are truncated. This is not due to\n any limit imposed by the MySQL Server generally, but rather is an\n issue specific to MySQL Replication. (For more information, see Bug\n #43439.)\n\n The text of a running CHANGE MASTER TO statement, including values\n for MASTER_USER and MASTER_PASSWORD, can be seen in the output of a\n concurrent SHOW PROCESSLIST statement.\n\nThe MASTER_SSL_xxx options provide information about using SSL for the\nconnection. They correspond to the --ssl-xxx options described in\nhttp://dev.mysql.com/doc/refman/5.5/en/ssl-options.html, and\nhttp://dev.mysql.com/doc/refman/5.5/en/replication-solutions-ssl.html.\nThese options can be changed even on slaves that are compiled without\nSSL support. They are saved to the master.info file, but are ignored if\nthe slave does not have SSL support enabled.\n\nMASTER_CONNECT_RETRY specifies how many seconds to wait between connect\nretries. The default is 60. The number of reconnection attempts is\nlimited by the --master-retry-count server option; for more\ninformation, see\nhttp://dev.mysql.com/doc/refman/5.5/en/replication-options.html.\n\nThe MASTER_BIND option is available in MySQL Cluster NDB 7.2 and later,\nbut is not supported in mainline MySQL 5.5.\n\nMASTER_BIND is for use on replication slaves having multiple network\ninterfaces, and determines which of the slave\'s network interfaces is\nchosen for connecting to the master.\n\nMASTER_HEARTBEAT_PERIOD sets the interval in seconds between\nreplication heartbeats. Whenever the master\'s binary log is updated\nwith an event, the waiting period for the next heartbeat is reset.\ninterval is a decimal value having the range 0 to 4294967 seconds and a\nresolution in milliseconds; the smallest nonzero value is 0.001.\nHeartbeats are sent by the master only if there are no unsent events in\nthe binary log file for a period longer than interval.\n\nSetting interval to 0 disables heartbeats altogether. The default value\nfor interval is equal to the value of slave_net_timeout divided by 2.\n\nSetting @@global.slave_net_timeout to a value less than that of the\ncurrent heartbeat interval results in a warning being issued. The\neffect of issuing RESET SLAVE on the heartbeat interval is to reset it\nto the default value.\n\nMASTER_LOG_FILE and MASTER_LOG_POS are the coordinates at which the\nslave I/O thread should begin reading from the master the next time the\nthread starts. RELAY_LOG_FILE and RELAY_LOG_POS are the coordinates at\nwhich the slave SQL thread should begin reading from the relay log the\nnext time the thread starts. If you specify either of MASTER_LOG_FILE\nor MASTER_LOG_POS, you cannot specify RELAY_LOG_FILE or RELAY_LOG_POS.\nIf neither of MASTER_LOG_FILE or MASTER_LOG_POS is specified, the slave\nuses the last coordinates of the slave SQL thread before CHANGE MASTER\nTO was issued. This ensures that there is no discontinuity in\nreplication, even if the slave SQL thread was late compared to the\nslave I/O thread, when you merely want to change, say, the password to\nuse.\n\nCHANGE MASTER TO deletes all relay log files and starts a new one,\nunless you specify RELAY_LOG_FILE or RELAY_LOG_POS. In that case, relay\nlog files are kept; the relay_log_purge global variable is set silently\nto 0.\n\nPrior to MySQL 5.5, RELAY_LOG_FILE required an absolute path. In MySQL\n5.5, the path can be relative, in which case the path is assumed to be\nrelative to the slave\'s data directory. (Bug #12190)\n\nIGNORE_SERVER_IDS was added in MySQL 5.5. This option takes a\ncomma-separated list of 0 or more server IDs. Events originating from\nthe corresponding servers are ignored, with the exception of log\nrotation and deletion events, which are still recorded in the relay\nlog.\n\nIn circular replication, the originating server normally acts as the\nterminator of its own events, so that they are not applied more than\nonce. Thus, this option is useful in circular replication when one of\nthe servers in the circle is removed. Suppose that you have a circular\nreplication setup with 4 servers, having server IDs 1, 2, 3, and 4, and\nserver 3 fails. When bridging the gap by starting replication from\nserver 2 to server 4, you can include IGNORE_SERVER_IDS = (3) in the\nCHANGE MASTER TO statement that you issue on server 4 to tell it to use\nserver 2 as its master instead of server 3. Doing so causes it to\nignore and not to propagate any statements that originated with the\nserver that is no longer in use.\n\nIf a CHANGE MASTER TO statement is issued without any IGNORE_SERVER_IDS\noption, any existing list is preserved; RESET SLAVE also has no effect\non the server ID list. To clear the list of ignored servers, it is\nnecessary to use the option with an empty list:\n\nCHANGE MASTER TO IGNORE_SERVER_IDS = ();\n\nIf IGNORE_SERVER_IDS contains the server\'s own ID and the server was\nstarted with the --replicate-same-server-id option enabled, an error\nresults.\n\nAlso beginning with MySQL 5.5, the master.info file and the output of\nSHOW SLAVE STATUS are extended to provide the list of servers that are\ncurrently ignored. For more information, see\nhttp://dev.mysql.com/doc/refman/5.5/en/slave-logs-status.html, and\n[HELP SHOW SLAVE STATUS].\n\nBeginning with MySQL 5.5.5, invoking CHANGE MASTER TO causes the\nprevious values for MASTER_HOST, MASTER_PORT, MASTER_LOG_FILE, and\nMASTER_LOG_POS to be written to the error log, along with other\ninformation about the slave\'s state prior to execution.\n\nCHANGE MASTER TO is useful for setting up a slave when you have the\nsnapshot of the master and have recorded the master binary log\ncoordinates corresponding to the time of the snapshot. After loading\nthe snapshot into the slave to synchronize it to the slave, you can run\nCHANGE MASTER TO MASTER_LOG_FILE=\'log_name\', MASTER_LOG_POS=log_pos on\nthe slave to specify the coordinates at which the slave should begin\nreading the master binary log.\n\nThe following example changes the master server the slave uses and\nestablishes the master binary log coordinates from which the slave\nbegins reading. This is used when you want to set up the slave to\nreplicate the master:\n\nCHANGE MASTER TO\n MASTER_HOST=\'master2.mycompany.com\',\n MASTER_USER=\'replication\',\n MASTER_PASSWORD=\'bigs3cret\',\n MASTER_PORT=3306,\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4,\n MASTER_CONNECT_RETRY=10;\n\nThe next example shows an operation that is less frequently employed.\nIt is used when the slave has relay log files that you want it to\nexecute again for some reason. To do this, the master need not be\nreachable. You need only use CHANGE MASTER TO and start the SQL thread\n(START SLAVE SQL_THREAD):\n\nCHANGE MASTER TO\n RELAY_LOG_FILE=\'slave-relay-bin.006\',\n RELAY_LOG_POS=4025;\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/change-master-to.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/change-master-to.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (186,39,'DROP DATABASE','Syntax:\nDROP {DATABASE | SCHEMA} [IF EXISTS] db_name\n\nDROP DATABASE drops all tables in the database and deletes the\ndatabase. Be very careful with this statement! To use DROP DATABASE,\nyou need the DROP privilege on the database. DROP SCHEMA is a synonym\nfor DROP DATABASE.\n\n*Important*: When a database is dropped, user privileges on the\ndatabase are not automatically dropped. See [HELP GRANT].\n\nIF EXISTS is used to prevent an error from occurring if the database\ndoes not exist.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-database.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-database.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (187,6,'MBREQUAL','MBREqual(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 are the same.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (188,31,'TIMESTAMP FUNCTION','Syntax:\nTIMESTAMP(expr), TIMESTAMP(expr1,expr2)\n\nWith a single argument, this function returns the date or datetime\nexpression expr as a datetime value. With two arguments, it adds the\ntime expression expr2 to the date or datetime expression expr1 and\nreturns the result as a datetime value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT TIMESTAMP(\'2003-12-31\');\n -> \'2003-12-31 00:00:00\'\nmysql> SELECT TIMESTAMP(\'2003-12-31 12:00:00\',\'12:00:00\');\n -> \'2004-01-01 00:00:00\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (189,33,'PROCEDURE ANALYSE','Syntax:\nANALYSE([max_elements[,max_memory]])\n\nANALYSE() examines the result from a query and returns an analysis of\nthe results that suggests optimal data types for each column that may\nhelp reduce table sizes. To obtain this analysis, append PROCEDURE\nANALYSE to the end of a SELECT statement:\n\nSELECT ... FROM ... WHERE ... PROCEDURE ANALYSE([max_elements,[max_memory]])\n\nFor example:\n\nSELECT col1, col2 FROM table1 PROCEDURE ANALYSE(10, 2000);\n\nThe results show some statistics for the values returned by the query,\nand propose an optimal data type for the columns. This can be helpful\nfor checking your existing tables, or after importing new data. You may\nneed to try different settings for the arguments so that PROCEDURE\nANALYSE() does not suggest the ENUM data type when it is not\nappropriate.\n\nThe arguments are optional and are used as follows:\n\no max_elements (default 256) is the maximum number of distinct values\n that ANALYSE() notices per column. This is used by ANALYSE() to check\n whether the optimal data type should be of type ENUM; if there are\n more than max_elements distinct values, then ENUM is not a suggested\n type.\n\no max_memory (default 8192) is the maximum amount of memory that\n ANALYSE() should allocate per column while trying to find all\n distinct values.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/procedure-analyse.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/procedure-analyse.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (110,39,'RENAME TABLE','Syntax:\nRENAME TABLE tbl_name TO new_tbl_name\n [, tbl_name2 TO new_tbl_name2] ...\n\nThis statement renames one or more tables.\n\nThe rename operation is done atomically, which means that no other\nsession can access any of the tables while the rename is running. For\nexample, if you have an existing table old_table, you can create\nanother table new_table that has the same structure but is empty, and\nthen replace the existing table with the empty one as follows (assuming\nthat backup_table does not already exist):\n\nURL: https://mariadb.com/kb/en/rename-table/\n\n','CREATE TABLE new_table (...);\nRENAME TABLE old_table TO backup_table, new_table TO old_table;\n','https://mariadb.com/kb/en/rename-table/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (111,22,'BOOLEAN','BOOL, BOOLEAN\n\nThese types are synonyms for TINYINT(1). A value of zero is considered\nfalse. Nonzero values are considered true:\n\nMariaDB> SELECT IF(0, \'true\', \'false\');\n+------------------------+\n| IF(0, \'true\', \'false\') |\n+------------------------+\n| false |\n+------------------------+\n\nMariaDB> SELECT IF(1, \'true\', \'false\');\n+------------------------+\n| IF(1, \'true\', \'false\') |\n+------------------------+\n| true |\n+------------------------+\n\nMariaDB> SELECT IF(2, \'true\', \'false\');\n+------------------------+\n| IF(2, \'true\', \'false\') |\n+------------------------+\n| true |\n+------------------------+\n\nHowever, the values TRUE and FALSE are merely aliases for 1 and 0,\nrespectively, as shown here:\n\nMariaDB> SELECT IF(0 = FALSE, \'true\', \'false\');\n+--------------------------------+\n| IF(0 = FALSE, \'true\', \'false\') |\n+--------------------------------+\n| true |\n+--------------------------------+\n\nMariaDB> SELECT IF(1 = TRUE, \'true\', \'false\');\n+-------------------------------+\n| IF(1 = TRUE, \'true\', \'false\') |\n+-------------------------------+\n| true |\n+-------------------------------+\n\nMariaDB> SELECT IF(2 = TRUE, \'true\', \'false\');\n+-------------------------------+\n| IF(2 = TRUE, \'true\', \'false\') |\n+-------------------------------+\n| false |\n+-------------------------------+\n\nMariaDB> SELECT IF(2 = FALSE, \'true\', \'false\');\n+--------------------------------+\n| IF(2 = FALSE, \'true\', \'false\') |\n+--------------------------------+\n| false |\n+--------------------------------+\n\nThe last two statements display the results shown because 2 is equal to\nneither 1 nor 0.\n\nURL: https://mariadb.com/kb/en/boolean/\n\n','','https://mariadb.com/kb/en/boolean/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (112,14,'DEFAULT','Syntax:\nDEFAULT(col_name)\n\nReturns the default value for a table column. An error results if the\ncolumn has no default value.\n\nURL: https://mariadb.com/kb/en/default/\n\n','MariaDB> UPDATE t SET i = DEFAULT(i)+1 WHERE id < 100;\n','https://mariadb.com/kb/en/default/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (113,4,'MOD','Syntax:\nMOD(N,M), N % M, N MOD M\n\nModulo operation. Returns the remainder of N divided by M.\n\nURL: https://mariadb.com/kb/en/mod/\n\n','MariaDB> SELECT MOD(234, 10);\n -> 4\nMariaDB> SELECT 253 % 7;\n -> 1\nMariaDB> SELECT MOD(29,9);\n -> 2\nMariaDB> SELECT 29 MOD 9;\n -> 2\n','https://mariadb.com/kb/en/mod/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (114,22,'TINYTEXT','TINYTEXT [CHARACTER SET charset_name] [COLLATE collation_name]\n\nA TEXT column with a maximum length of 255 (28 - 1) characters. The\neffective maximum length is less if the value contains multi-byte\ncharacters. Each TINYTEXT value is stored using a 1-byte length prefix\nthat indicates the number of bytes in the value.\n\nURL: https://mariadb.com/kb/en/tinytext/\n\n','','https://mariadb.com/kb/en/tinytext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (115,20,'OPTIMIZE TABLE','Syntax:\nOPTIMIZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n\nOPTIMIZE TABLE should be used if you have deleted a large part of a\ntable or if you have made many changes to a table with variable-length\nrows (tables that have VARCHAR, VARBINARY, BLOB, or TEXT columns).\nDeleted rows are maintained in a linked list and subsequent INSERT\noperations reuse old row positions. You can use OPTIMIZE TABLE to\nreclaim the unused space and to defragment the data file. After\nextensive changes to a table, this statement may also improve\nperformance of statements that use the table, sometimes significantly.\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nOPTIMIZE TABLE is supported for partitioned tables, and you can use\nALTER TABLE ... OPTIMIZE PARTITION to optimize one or more partitions;\nfor more information, see [HELP ALTER TABLE], and\nhttp://dev.mysql.com/doc/refman/5.5/en/partitioning-maintenance.html.\n\nURL: https://mariadb.com/kb/en/optimize-table/\n\n','','https://mariadb.com/kb/en/optimize-table/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (116,12,'DECODE','Syntax:\nDECODE(crypt_str,pass_str)\n\nDecrypts the encrypted string crypt_str using pass_str as the password.\ncrypt_str should be a string returned from ENCODE().\n\nURL: https://mariadb.com/kb/en/decode/\n\n','','https://mariadb.com/kb/en/decode/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (117,18,'<=>','Syntax:\n<=>\n\nNULL-safe equal. This operator performs an equality comparison like the\n= operator, but returns 1 rather than NULL if both operands are NULL,\nand 0 rather than NULL if one operand is NULL.\n\nURL: https://mariadb.com/kb/en/null-safe-equal/\n\n','MariaDB> SELECT 1 <=> 1, NULL <=> NULL, 1 <=> NULL;\n -> 1, 1, 0\nMariaDB> SELECT 1 = 1, NULL = NULL, 1 = NULL;\n -> 1, NULL, NULL\n','https://mariadb.com/kb/en/null-safe-equal/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (118,28,'HELP STATEMENT','Syntax:\nHELP \'search_string\'\n\nThe HELP statement returns online information from the MySQL Reference\nmanual. Its proper operation requires that the help tables in the mysql\ndatabase be initialized with help topic information.\n\nThe HELP statement searches the help tables for the given search string\nand displays the result of the search. The search string is not case\nsensitive.\n\nURL: https://mariadb.com/kb/en/help-command/\n\n','','https://mariadb.com/kb/en/help-command/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (119,26,'RESET','Syntax:\nRESET reset_option [, reset_option] ...\n\nThe RESET statement is used to clear the state of various server\noperations. You must have the RELOAD privilege to execute RESET.\n\nRESET acts as a stronger version of the FLUSH statement. See [HELP\nFLUSH].\n\nThe RESET statement causes an implicit commit. See\nhttps://mariadb.com/kb/en/sql-statements-that-cause-an-implicit-commit/.\n\nURL: https://mariadb.com/kb/en/reset/\n\n','','https://mariadb.com/kb/en/reset/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (120,14,'GET_LOCK','Syntax:\nGET_LOCK(str,timeout)\n\nTries to obtain a lock with a name given by the string str, using a\ntimeout of timeout seconds. Returns 1 if the lock was obtained\nsuccessfully, 0 if the attempt timed out (for example, because another\nclient has previously locked the name), or NULL if an error occurred\n(such as running out of memory or the thread was killed with mysqladmin\nkill). If you have a lock obtained with GET_LOCK(), it is released when\nyou execute RELEASE_LOCK(), execute a new GET_LOCK(), or your\nconnection terminates (either normally or abnormally). Locks obtained\nwith GET_LOCK() do not interact with transactions. That is, committing\na transaction does not release any such locks obtained during the\ntransaction.\n\nThis function can be used to implement application locks or to simulate\nrecord locks. Names are locked on a server-wide basis. If a name has\nbeen locked by one client, GET_LOCK() blocks any request by another\nclient for a lock with the same name. This enables clients that agree\non a given lock name to use the name to perform cooperative advisory\nlocking. But be aware that it also enables a client that is not among\nthe set of cooperating clients to lock a name, either inadvertently or\ndeliberately, and thus prevent any of the cooperating clients from\nlocking that name. One way to reduce the likelihood of this is to use\nlock names that are database-specific or application-specific. For\nexample, use lock names of the form db_name.str or app_name.str.\n\nURL: https://mariadb.com/kb/en/get_lock/\n\n','MariaDB> SELECT GET_LOCK(\'lock1\',10);\n -> 1\nMariaDB> SELECT IS_FREE_LOCK(\'lock2\');\n -> 1\nMariaDB> SELECT GET_LOCK(\'lock2\',10);\n -> 1\nMariaDB> SELECT RELEASE_LOCK(\'lock2\');\n -> 1\nMariaDB> SELECT RELEASE_LOCK(\'lock1\');\n -> NULL\n','https://mariadb.com/kb/en/get_lock/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (121,37,'UCASE','Syntax:\nUCASE(str)\n\nUCASE() is a synonym for UPPER().\n\nURL: https://mariadb.com/kb/en/ucase/\n\n','','https://mariadb.com/kb/en/ucase/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (122,26,'SHOW BINLOG EVENTS','Syntax:\nSHOW BINLOG EVENTS\n [IN \'log_name\'] [FROM pos] [LIMIT [offset,] row_count]\n\nShows the events in the binary log. If you do not specify \'log_name\',\nthe first binary log is displayed.\n\nURL: https://mariadb.com/kb/en/show-binlog-events/\n\n','','https://mariadb.com/kb/en/show-binlog-events/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (123,32,'MPOLYFROMWKB','MPolyFromWKB(wkb[,srid]), MultiPolygonFromWKB(wkb[,srid])\n\nConstructs a MULTIPOLYGON value using its WKB representation and SRID.\n\nURL: https://mariadb.com/kb/en/mpolyfromwkb/\n\n','','https://mariadb.com/kb/en/mpolyfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (124,23,'ITERATE','Syntax:\nITERATE label\n\nITERATE can appear only within LOOP, REPEAT, and WHILE statements.\nITERATE means "start the loop again."\n\nURL: https://mariadb.com/kb/en/iterate/\n\n','','https://mariadb.com/kb/en/iterate/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (125,27,'DO','Syntax:\nDO expr [, expr] ...\n\nDO executes the expressions but does not return any results. In most\nrespects, DO is shorthand for SELECT expr, ..., but has the advantage\nthat it is slightly faster when you do not care about the result.\n\nDO is useful primarily with functions that have side effects, such as\nRELEASE_LOCK().\n\nURL: https://mariadb.com/kb/en/do/\n\n','','https://mariadb.com/kb/en/do/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (126,31,'CURTIME','Syntax:\nCURTIME()\n\nReturns the current time as a value in \'HH:MM:SS\' or HHMMSS.uuuuuu\nformat, depending on whether the function is used in a string or\nnumeric context. The value is expressed in the current time zone.\n\nURL: https://mariadb.com/kb/en/curtime/\n\n','MariaDB> SELECT CURTIME();\n -> \'23:50:26\'\nMariaDB> SELECT CURTIME() + 0;\n -> 235026.000000\n','https://mariadb.com/kb/en/curtime/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (127,37,'CHAR_LENGTH','Syntax:\nCHAR_LENGTH(str)\n\nReturns the length of the string str, measured in characters. A\nmulti-byte character counts as a single character. This means that for\na string containing five 2-byte characters, LENGTH() returns 10,\nwhereas CHAR_LENGTH() returns 5.\n\nURL: https://mariadb.com/kb/en/char_length/\n\n','','https://mariadb.com/kb/en/char_length/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (128,22,'BIGINT','BIGINT[(M)] [UNSIGNED] [ZEROFILL]\n\nA large integer. The signed range is -9223372036854775808 to\n9223372036854775807. The unsigned range is 0 to 18446744073709551615.\n\nSERIAL is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE.\n\nURL: https://mariadb.com/kb/en/bigint/\n\n','','https://mariadb.com/kb/en/bigint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (129,26,'SET','Syntax:\nSET variable_assignment [, variable_assignment] ...\n\nvariable_assignment:\n user_var_name = expr\n | [GLOBAL | SESSION] system_var_name = expr\n | [@@global. | @@session. | @@]system_var_name = expr\n\nThe SET statement assigns values to different types of variables that\naffect the operation of the server or your client. Older versions of\nMySQL employed SET OPTION, but this syntax is deprecated in favor of\nSET without OPTION.\n\nURL: https://mariadb.com/kb/en/set/\n\n','','https://mariadb.com/kb/en/set/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (130,27,'LOAD XML','Syntax:\nLOAD XML [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE \'file_name\'\n [REPLACE | IGNORE]\n INTO TABLE [db_name.]tbl_name\n [CHARACTER SET charset_name]\n [ROWS IDENTIFIED BY \'<tagname>\']\n [IGNORE number {LINES | ROWS}]\n [(column_or_user_var,...)]\n [SET col_name = expr,...]\n\nThe LOAD XML statement reads data from an XML file into a table. The\nfile_name must be given as a literal string. The tagname in the\noptional ROWS IDENTIFIED BY clause must also be given as a literal\nstring, and must be surrounded by angle brackets (< and >).\n\nLOAD XML acts as the complement of running the mysql client in XML\noutput mode (that is, starting the client with the --xml option). To\nwrite data from a table to an XML file, use a command such as the\nfollowing one from the system shell:\n\nshell> mysql --xml -e \'SELECT * FROM mytable\' > file.xml\n\nTo read the file back into a table, use LOAD XML INFILE. By default,\nthe <row> element is considered to be the equivalent of a database\ntable row; this can be changed using the ROWS IDENTIFIED BY clause.\n\nThis statement supports three different XML formats:\n\no Column names as attributes and column values as attribute values:\n\n<row column1="value1" column2="value2" .../>\n\no Column names as tags and column values as the content of these tags:\n\n<row>\n <column1>value1</column1>\n <column2>value2</column2>\n</row>\n\no Column names are the name attributes of <field> tags, and values are\n the contents of these tags:\n\n<row>\n <field name=\'column1\'>value1</field>\n <field name=\'column2\'>value2</field>\n</row>\n\n This is the format used by other MySQL tools, such as mysqldump.\n\nAll 3 formats can be used in the same XML file; the import routine\nautomatically detects the format for each row and interprets it\ncorrectly. Tags are matched based on the tag or attribute name and the\ncolumn name.\n\nThe following clauses work essentially the same way for LOAD XML as\nthey do for LOAD DATA:\n\no LOW_PRIORITY or CONCURRENT\n\no LOCAL\n\no REPLACE or IGNORE\n\no CHARACTER SET\n\no (column_or_user_var,...)\n\no SET\n\nSee [HELP LOAD DATA], for more information about these clauses.\n\nThe IGNORE number LINES or IGNORE number ROWS clause causes the first\nnumber rows in the XML file to be skipped. It is analogous to the LOAD\nDATA statement\'s IGNORE ... LINES clause.\n\nURL: https://mariadb.com/kb/en/load-xml/\n\n','','https://mariadb.com/kb/en/load-xml/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (131,4,'CONV','Syntax:\nCONV(N,from_base,to_base)\n\nConverts numbers between different number bases. Returns a string\nrepresentation of the number N, converted from base from_base to base\nto_base. Returns NULL if any argument is NULL. The argument N is\ninterpreted as an integer, but may be specified as an integer or a\nstring. The minimum base is 2 and the maximum base is 36. If to_base is\na negative number, N is regarded as a signed number. Otherwise, N is\ntreated as unsigned. CONV() works with 64-bit precision.\n\nURL: https://mariadb.com/kb/en/conv/\n\n','MariaDB> SELECT CONV(\'a\',16,2);\n -> \'1010\'\nMariaDB> SELECT CONV(\'6E\',18,8);\n -> \'172\'\nMariaDB> SELECT CONV(-17,10,-18);\n -> \'-H\'\nMariaDB> SELECT CONV(10+\'10\'+\'10\'+0xa,10,10);\n -> \'40\'\n','https://mariadb.com/kb/en/conv/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (132,22,'DATE','DATE\n\nA date. The supported range is \'1000-01-01\' to \'9999-12-31\'. MySQL\ndisplays DATE values in \'YYYY-MM-DD\' format, but permits assignment of\nvalues to DATE columns using either strings or numbers.\n\nURL: https://mariadb.com/kb/en/date/\n\n','','https://mariadb.com/kb/en/date/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (133,15,'ASSIGN-VALUE','Syntax:\n:=\n\nAssignment operator. Causes the user variable on the left hand side of\nthe operator to take on the value to its right. The value on the right\nhand side may be a literal value, another variable storing a value, or\nany legal expression that yields a scalar value, including the result\nof a query (provided that this value is a scalar value). You can\nperform multiple assignments in the same SET statement. You can perform\nmultiple assignments in the same statement-\n\nUnlike =, the := operator is never interpreted as a comparison\noperator. This means you can use := in any valid SQL statement (not\njust in SET statements) to assign a value to a variable.\n\nURL: https://mariadb.com/kb/en/assignment-operator/\n\n','MariaDB> SELECT @var1, @var2;\n -> NULL, NULL\nMariaDB> SELECT @var1 := 1, @var2;\n -> 1, NULL\nMariaDB> SELECT @var1, @var2;\n -> 1, NULL\nMariaDB> SELECT @var1, @var2 := @var1;\n -> 1, 1\nMariaDB> SELECT @var1, @var2;\n -> 1, 1\n\nMariaDB> SELECT @var1:=COUNT(*) FROM t1;\n -> 4\nMariaDB> SELECT @var1;\n -> 4\n','https://mariadb.com/kb/en/assignment-operator/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (134,26,'SHOW OPEN TABLES','Syntax:\nSHOW OPEN TABLES [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW OPEN TABLES lists the non-TEMPORARY tables that are currently open\nin the table cache. See\nhttp://dev.mysql.com/doc/refman/5.5/en/table-cache.html. The FROM\nclause, if present, restricts the tables shown to those present in the\ndb_name database. The LIKE clause, if present, indicates which table\nnames to match. The WHERE clause can be given to select rows using more\ngeneral conditions, as discussed in\nhttps://mariadb.com/kb/en/extended-show/.\n\nURL: https://mariadb.com/kb/en/show-open-tables/\n\n','','https://mariadb.com/kb/en/show-open-tables/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (135,31,'EXTRACT','Syntax:\nEXTRACT(unit FROM date)\n\nThe EXTRACT() function uses the same kinds of unit specifiers as\nDATE_ADD() or DATE_SUB(), but extracts parts from the date rather than\nperforming date arithmetic.\n\nURL: https://mariadb.com/kb/en/extract/\n\n','MariaDB> SELECT EXTRACT(YEAR FROM \'2009-07-02\');\n -> 2009\nMariaDB> SELECT EXTRACT(YEAR_MONTH FROM \'2009-07-02 01:02:03\');\n -> 200907\nMariaDB> SELECT EXTRACT(DAY_MINUTE FROM \'2009-07-02 01:02:03\');\n -> 20102\nMariaDB> SELECT EXTRACT(MICROSECOND\n -> FROM \'2003-01-02 10:30:00.000123\');\n -> 123\n','https://mariadb.com/kb/en/extract/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (136,12,'ENCRYPT','Syntax:\nENCRYPT(str[,salt])\n\nEncrypts str using the Unix crypt() system call and returns a binary\nstring. The salt argument must be a string with at least two characters\nor the result will be NULL. If no salt argument is given, a random\nvalue is used.\n\nURL: https://mariadb.com/kb/en/encrypt/\n\n','MariaDB> SELECT ENCRYPT(\'hello\');\n -> \'VxuFAJXVARROc\'\n','https://mariadb.com/kb/en/encrypt/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (137,26,'SHOW STATUS','Syntax:\nSHOW [GLOBAL | SESSION] STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW STATUS provides server status information. This information also\ncan be obtained using the mysqladmin extended-status command. The LIKE\nclause, if present, indicates which variable names to match. The WHERE\nclause can be given to select rows using more general conditions, as\ndiscussed in https://mariadb.com/kb/en/extended-show/.\nThis statement does not require any privilege. It requires only the\nability to connect to the server.\nWith a LIKE clause, the statement displays only rows for those\nvariables with names that match the pattern:\n\nMariaDB> SHOW STATUS LIKE \'Key%\';\n+--------------------+----------+\n| Variable_name | Value |\n+--------------------+----------+\n| Key_blocks_used | 14955 |\n| Key_read_requests | 96854827 |\n| Key_reads | 162040 |\n| Key_write_requests | 7589728 |\n| Key_writes | 3813196 |\n+--------------------+----------+\n\nWith the GLOBAL modifier, SHOW STATUS displays the status values for\nall connections to MySQL. With SESSION, it displays the status values\nfor the current connection. If no modifier is present, the default is\nSESSION. LOCAL is a synonym for SESSION.\n\nSome status variables have only a global value. For these, you get the\nsame value for both GLOBAL and SESSION. The scope for each status\nvariable is listed at\nhttps://mariadb.com/kb/en/server-status-variables/.\n\nEach invocation of the SHOW STATUS statement uses an internal temporary\ntable and increments the global Created_tmp_tables value.\n\nURL: https://mariadb.com/kb/en/show-status/\n\n','','https://mariadb.com/kb/en/show-status/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (138,37,'EXTRACTVALUE','Syntax:\nExtractValue(xml_frag, xpath_expr)\n\nExtractValue() takes two string arguments, a fragment of XML markup\nxml_frag and an XPath expression xpath_expr (also known as a locator);\nit returns the text (CDATA) of the first text node which is a child of\nthe elements or elements matched by the XPath expression. In MySQL 5.5,\nthe XPath expression can contain at most 127 characters. (This\nlimitation is lifted in MySQL 5.6.)\n\nUsing this function is the equivalent of performing a match using the\nxpath_expr after appending /text(). In other words,\nExtractValue(\'<a><b>Sakila</b></a>\', \'/a/b\') and\nExtractValue(\'<a><b>Sakila</b></a>\', \'/a/b/text()\') produce the same\nresult.\n\nIf multiple matches are found, the content of the first child text node\nof each matching element is returned (in the order matched) as a\nsingle, space-delimited string.\n\nIf no matching text node is found for the expression (including the\nimplicit /text())---for whatever reason, as long as xpath_expr is\nvalid, and xml_frag consists of elements which are properly nested and\nclosed---an empty string is returned. No distinction is made between a\nmatch on an empty element and no match at all. This is by design.\n\nIf you need to determine whether no matching element was found in\nxml_frag or such an element was found but contained no child text\nnodes, you should test the result of an expression that uses the XPath\ncount() function. For example, both of these statements return an empty\nstring, as shown here:\n\nMariaDB> SELECT ExtractValue(\'<a><b/></a>\', \'/a/b\');\n+-------------------------------------+\n| ExtractValue(\'<a><b/></a>\', \'/a/b\') |\n+-------------------------------------+\n| |\n+-------------------------------------+\n1 row in set (0.00 sec)\n\nMariaDB> SELECT ExtractValue(\'<a><c/></a>\', \'/a/b\');\n+-------------------------------------+\n| ExtractValue(\'<a><c/></a>\', \'/a/b\') |\n+-------------------------------------+\n| |\n+-------------------------------------+\n1 row in set (0.00 sec)\n\nHowever, you can determine whether there was actually a matching\nelement using the following:\n\nMariaDB> SELECT ExtractValue(\'<a><b/></a>\', \'count(/a/b)\');\n+-------------------------------------+\n| ExtractValue(\'<a><b/></a>\', \'count(/a/b)\') |\n+-------------------------------------+\n| 1 |\n+-------------------------------------+\n1 row in set (0.00 sec)\n\nMariaDB> SELECT ExtractValue(\'<a><c/></a>\', \'count(/a/b)\');\n+-------------------------------------+\n| ExtractValue(\'<a><c/></a>\', \'count(/a/b)\') |\n+-------------------------------------+\n| 0 |\n+-------------------------------------+\n1 row in set (0.01 sec)\n\n*Important*: ExtractValue() returns only CDATA, and does not return any\ntags that might be contained within a matching tag, nor any of their\ncontent (see the result returned as val1 in the following example).\n\nURL: https://mariadb.com/kb/en/extractvalue/\n\n','MariaDB> SELECT\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/a\') AS val1,\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/a/b\') AS val2,\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'//b\') AS val3,\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/b\') AS val4,\n -> ExtractValue(\'<a>ccc<b>ddd</b><b>eee</b></a>\', \'//b\') AS val5;\n\n+------+------+------+------+---------+\n| val1 | val2 | val3 | val4 | val5 |\n+------+------+------+------+---------+\n| ccc | ddd | ddd | | ddd eee |\n+------+------+------+------+---------+\n','https://mariadb.com/kb/en/extractvalue/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (139,12,'OLD_PASSWORD','Syntax:\nOLD_PASSWORD(str)\n\nOLD_PASSWORD() was added when the implementation of PASSWORD() was\nchanged in MySQL 4.1 to improve security. OLD_PASSWORD() returns the\nvalue of the pre-4.1 implementation of PASSWORD() as a string, and is\nintended to permit you to reset passwords for any pre-4.1 clients that\nneed to connect to your version 5.5 MySQL server without locking them\nout. See http://dev.mysql.com/doc/refman/5.1/en/password-hashing.html.\n\nAs of MySQL 5.5.3, the return value is a nonbinary string in the\nconnection character set. Before 5.5.3, the return value is a binary\nstring.\n\nURL: https://mariadb.com/kb/en/old_password/\n\n','','https://mariadb.com/kb/en/old_password/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (140,37,'FORMAT','Syntax:\nFORMAT(X,D[,locale])\n\nFormats the number X to a format like \'#,###,###.##\', rounded to D\ndecimal places, and returns the result as a string. If D is 0, the\nresult has no decimal point or fractional part.\n\nThe optional third parameter enables a locale to be specified to be\nused for the result number\'s decimal point, thousands separator, and\ngrouping between separators. Permissible locale values are the same as\nthe legal values for the lc_time_names system variable (see\nhttps://mariadb.com/kb/en/server-locale/). If no\nlocale is specified, the default is \'en_US\'.\n\nURL: https://mariadb.com/kb/en/format/\n\n','MariaDB> SELECT FORMAT(12332.123456, 4);\n -> \'12,332.1235\'\nMariaDB> SELECT FORMAT(12332.1,4);\n -> \'12,332.1000\'\nMariaDB> SELECT FORMAT(12332.2,0);\n -> \'12,332\'\nMariaDB> SELECT FORMAT(12332.2,2,\'de_DE\');\n -> \'12.332,20\'\n','https://mariadb.com/kb/en/format/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (141,15,'||','Syntax:\nOR, ||\n\nLogical OR. When both operands are non-NULL, the result is 1 if any\noperand is nonzero, and 0 otherwise. With a NULL operand, the result is\n1 if the other operand is nonzero, and NULL otherwise. If both operands\nare NULL, the result is NULL.\n\nURL: https://mariadb.com/kb/en/or/\n\n','MariaDB> SELECT 1 || 1;\n -> 1\nMariaDB> SELECT 1 || 0;\n -> 1\nMariaDB> SELECT 0 || 0;\n -> 0\nMariaDB> SELECT 0 || NULL;\n -> NULL\nMariaDB> SELECT 1 || NULL;\n -> 1\n','https://mariadb.com/kb/en/or/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (142,37,'BIT_LENGTH','Syntax:\nBIT_LENGTH(str)\n\nReturns the length of the string str in bits.\n\nURL: https://mariadb.com/kb/en/bit_length/\n\n','MariaDB> SELECT BIT_LENGTH(\'text\');\n -> 32\n','https://mariadb.com/kb/en/bit_length/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (143,2,'EXTERIORRING','ExteriorRing(poly)\n\nReturns the exterior ring of the Polygon value poly as a LineString.\n\nURL: https://mariadb.com/kb/en/exteriorring/\n\n','MariaDB> SET @poly =\n -> \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))\';\nMariaDB> SELECT AsText(ExteriorRing(GeomFromText(@poly)));\n+-------------------------------------------+\n| AsText(ExteriorRing(GeomFromText(@poly))) |\n+-------------------------------------------+\n| LINESTRING(0 0,0 3,3 3,3 0,0 0) |\n+-------------------------------------------+\n','https://mariadb.com/kb/en/exteriorring/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (144,32,'GEOMFROMWKB','GeomFromWKB(wkb[,srid]), GeometryFromWKB(wkb[,srid])\n\nConstructs a geometry value of any type using its WKB representation\nand SRID.\n\nURL: https://mariadb.com/kb/en/geomfromwkb/\n\n','','https://mariadb.com/kb/en/geomfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (145,26,'SHOW SLAVE HOSTS','Syntax:\nSHOW SLAVE HOSTS\n\nDisplays a list of replication slaves currently registered with the\nmaster. (Before MySQL 5.5.3, only slaves started with the\n--report-host=host_name option are visible in this list.)\n\nThe list is displayed on any server (not just the master server). The\noutput looks like this:\n\nMariaDB> SHOW SLAVE HOSTS;\n+------------+-----------+------+-----------+\n| Server_id | Host | Port | Master_id |\n+------------+-----------+------+-----------+\n| 192168010 | iconnect2 | 3306 | 192168011 |\n| 1921680101 | athena | 3306 | 192168011 |\n+------------+-----------+------+-----------+\n\no Server_id: The unique server ID of the slave server, as configured in\n the server\'s option file, or on the command line with\n --server-id=value.\n\no Host: The host name of the slave server, as configured in the\n server\'s option file, or on the command line with\n --report-host=host_name. Note that this can differ from the machine\n name as configured in the operating system.\n\no Port: The port the slave server is listening on.\n\n In MySQL 5.5.23 and later, a zero in this column means that the slave\n port (--report-port) was not set. Prior to MySQL 5.5.23, 3306 was\n used as the default in such cases (Bug #13333431).\n\no Master_id: The unique server ID of the master server that the slave\n server is replicating from.\n\nSome MySQL versions report another variable, Rpl_recovery_rank. This\nvariable was never used, and was removed in MySQL 5.5.3. (Bug #13963)\n\nURL: https://mariadb.com/kb/en/show-slave-hosts/\n\n','','https://mariadb.com/kb/en/show-slave-hosts/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (146,8,'START TRANSACTION','Syntax:\nSTART TRANSACTION [WITH CONSISTENT SNAPSHOT]\nBEGIN [WORK]\nCOMMIT [WORK] [AND [NO] CHAIN] [[NO] RELEASE]\nROLLBACK [WORK] [AND [NO] CHAIN] [[NO] RELEASE]\nSET autocommit = {0 | 1}\n\nThese statements provide control over use of transactions:\n\no START TRANSACTION or BEGIN start a new transaction.\n\no COMMIT commits the current transaction, making its changes permanent.\n\no ROLLBACK rolls back the current transaction, canceling its changes.\n\no SET autocommit disables or enables the default autocommit mode for\n the current session.\n\nBy default, MySQL runs with autocommit mode enabled. This means that as\nsoon as you execute a statement that updates (modifies) a table, MySQL\nstores the update on disk to make it permanent. The change cannot be\nrolled back.\n\nTo disable autocommit mode implicitly for a single series of\nstatements, use the START TRANSACTION statement:\n\nSTART TRANSACTION;\nSELECT @A:=SUM(salary) FROM table1 WHERE type=1;\nUPDATE table2 SET summary=@A WHERE type=1;\nCOMMIT;\n\nWith START TRANSACTION, autocommit remains disabled until you end the\ntransaction with COMMIT or ROLLBACK. The autocommit mode then reverts\nto its previous state.\n\nYou can also begin a transaction like this:\n\nSTART TRANSACTION WITH CONSISTENT SNAPSHOT;\n\nThe WITH CONSISTENT SNAPSHOT option starts a consistent read for\nstorage engines that are capable of it. This applies only to InnoDB.\nThe effect is the same as issuing a START TRANSACTION followed by a\nSELECT from any InnoDB table. See\nhttp://dev.mysql.com/doc/refman/5.5/en/innodb-consistent-read.html. The\nWITH CONSISTENT SNAPSHOT option does not change the current transaction\nisolation level, so it provides a consistent snapshot only if the\ncurrent isolation level is one that permits consistent read (REPEATABLE\nREAD or SERIALIZABLE).\n\n*Important*: Many APIs used for writing MySQL client applications (such\nas JDBC) provide their own methods for starting transactions that can\n(and sometimes should) be used instead of sending a START TRANSACTION\nstatement from the client. See\nhttp://dev.mysql.com/doc/refman/5.5/en/connectors-apis.html, or the\ndocumentation for your API, for more information.\n\nTo disable autocommit mode explicitly, use the following statement:\n\nSET autocommit=0;\n\nAfter disabling autocommit mode by setting the autocommit variable to\nzero, changes to transaction-safe tables (such as those for InnoDB) are not made permanent immediately. You must use COMMIT to\nstore your changes to disk or ROLLBACK to ignore the changes.\n\nautocommit is a session variable and must be set for each session. To\ndisable autocommit mode for each new connection, see the description of\nthe autocommit system variable at\nhttps://mariadb.com/kb/en/server-system-variables/.\n\nBEGIN and BEGIN WORK are supported as aliases of START TRANSACTION for\ninitiating a transaction. START TRANSACTION is standard SQL syntax and\nis the recommended way to start an ad-hoc transaction.\n\nThe BEGIN statement differs from the use of the BEGIN keyword that\nstarts a BEGIN ... END compound statement. The latter does not begin a\ntransaction. See [HELP BEGIN END].\n\n*Note*: Within all stored programs (stored procedures and functions,\ntriggers, and events), the parser treats BEGIN [WORK] as the beginning\nof a BEGIN ... END block. Begin a transaction in this context with\nSTART TRANSACTION instead.\n\nThe optional WORK keyword is supported for COMMIT and ROLLBACK, as are\nthe CHAIN and RELEASE clauses. CHAIN and RELEASE can be used for\nadditional control over transaction completion. The value of the\ncompletion_type system variable determines the default completion\nbehavior. See\nhttps://mariadb.com/kb/en/server-system-variables/.\n\nThe AND CHAIN clause causes a new transaction to begin as soon as the\ncurrent one ends, and the new transaction has the same isolation level\nas the just-terminated transaction. The RELEASE clause causes the\nserver to disconnect the current client session after terminating the\ncurrent transaction. Including the NO keyword suppresses CHAIN or\nRELEASE completion, which can be useful if the completion_type system\nvariable is set to cause chaining or release completion by default.\n\nURL: https://mariadb.com/kb/en/start-transaction/\n\n','','https://mariadb.com/kb/en/start-transaction/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (147,18,'BETWEEN AND','Syntax:\nexpr BETWEEN min AND max\n\nIf expr is greater than or equal to min and expr is less than or equal\nto max, BETWEEN returns 1, otherwise it returns 0. This is equivalent\nto the expression (min <= expr AND expr <= max) if all the arguments\nare of the same type. Otherwise type conversion takes place according\nto the rules described in\nhttps://mariadb.com/kb/en/type-conversion/, but\napplied to all the three arguments.\n\nURL: https://mariadb.com/kb/en/between-and/\n\n','MariaDB> SELECT 2 BETWEEN 1 AND 3, 2 BETWEEN 3 and 1;\n -> 1, 0\nMariaDB> SELECT 1 BETWEEN 2 AND 3;\n -> 0\nMariaDB> SELECT \'b\' BETWEEN \'a\' AND \'c\';\n -> 1\nMariaDB> SELECT 2 BETWEEN 2 AND \'3\';\n -> 1\nMariaDB> SELECT 2 BETWEEN 2 AND \'x-3\';\n -> 0\n','https://mariadb.com/kb/en/between-and/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (148,24,'MULTIPOLYGON','MultiPolygon(poly1,poly2,...)\n\nConstructs a MultiPolygon value from a set of Polygon or WKB Polygon\narguments.\n\nURL: https://mariadb.com/kb/en/multipolygon/\n\n','','https://mariadb.com/kb/en/multipolygon/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (149,31,'TIME_FORMAT','Syntax:\nTIME_FORMAT(time,format)\n\nThis is used like the DATE_FORMAT() function, but the format string may\ncontain format specifiers only for hours, minutes, seconds, and\nmicroseconds. Other specifiers produce a NULL value or 0.\n\nURL: https://mariadb.com/kb/en/time_format/\n\n','MariaDB> SELECT TIME_FORMAT(\'100:00:00\', \'%H %k %h %I %l\');\n -> \'100 100 04 04 4\'\n','https://mariadb.com/kb/en/time_format/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (150,37,'LEFT','Syntax:\nLEFT(str,len)\n\nReturns the leftmost len characters from the string str, or NULL if any\nargument is NULL.\n\nURL: https://mariadb.com/kb/en/left/\n\n','MariaDB> SELECT LEFT(\'foobarbar\', 5);\n -> \'fooba\'\n','https://mariadb.com/kb/en/left/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (151,26,'FLUSH QUERY CACHE','You can defragment the query cache to better utilize its memory with\nthe FLUSH QUERY CACHE statement. The statement does not remove any\nqueries from the cache.\n\nThe RESET QUERY CACHE statement removes all query results from the\nquery cache. The FLUSH TABLES statement also does this.\n\nURL: https://mariadb.com/kb/en/flush-query-cache/\n\n','','https://mariadb.com/kb/en/flush-query-cache/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (152,22,'SET DATA TYPE','SET(\'value1\',\'value2\',...) [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n\nA set. A string object that can have zero or more values, each of which\nmust be chosen from the list of values \'value1\', \'value2\', ... A SET\ncolumn can have a maximum of 64 members. SET values are represented\ninternally as integers.\n\nURL: https://mariadb.com/kb/en/set-data-type/\n\n','','https://mariadb.com/kb/en/set-data-type/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (153,4,'RAND','Syntax:\nRAND(), RAND(N)\n\nReturns a random floating-point value v in the range 0 <= v < 1.0. If a\nconstant integer argument N is specified, it is used as the seed value,\nwhich produces a repeatable sequence of column values. In the following\nexample, note that the sequences of values produced by RAND(3) is the\nsame both places where it occurs.\n\nURL: https://mariadb.com/kb/en/rand/\n\n','MariaDB> CREATE TABLE t (i INT);\nQuery OK, 0 rows affected (0.42 sec)\n\nMariaDB> INSERT INTO t VALUES(1),(2),(3);\nQuery OK, 3 rows affected (0.00 sec)\nRecords: 3 Duplicates: 0 Warnings: 0\n\nMariaDB> SELECT i, RAND() FROM t;\n+------+------------------+\n| i | RAND() |\n+------+------------------+\n| 1 | 0.61914388706828 |\n| 2 | 0.93845168309142 |\n| 3 | 0.83482678498591 |\n+------+------------------+\n3 rows in set (0.00 sec)\n\nMariaDB> SELECT i, RAND(3) FROM t;\n+------+------------------+\n| i | RAND(3) |\n+------+------------------+\n| 1 | 0.90576975597606 |\n| 2 | 0.37307905813035 |\n| 3 | 0.14808605345719 |\n+------+------------------+\n3 rows in set (0.00 sec)\n\nMariaDB> SELECT i, RAND() FROM t;\n+------+------------------+\n| i | RAND() |\n+------+------------------+\n| 1 | 0.35877890638893 |\n| 2 | 0.28941420772058 |\n| 3 | 0.37073435016976 |\n+------+------------------+\n3 rows in set (0.00 sec)\n\nMariaDB> SELECT i, RAND(3) FROM t;\n+------+------------------+\n| i | RAND(3) |\n+------+------------------+\n| 1 | 0.90576975597606 |\n| 2 | 0.37307905813035 |\n| 3 | 0.14808605345719 |\n+------+------------------+\n3 rows in set (0.01 sec)\n','https://mariadb.com/kb/en/rand/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (154,37,'RPAD','Syntax:\nRPAD(str,len,padstr)\n\nReturns the string str, right-padded with the string padstr to a length\nof len characters. If str is longer than len, the return value is\nshortened to len characters.\n\nURL: https://mariadb.com/kb/en/rpad/\n\n','MariaDB> SELECT RPAD(\'hi\',5,\'?\');\n -> \'hi???\'\nMariaDB> SELECT RPAD(\'hi\',1,\'?\');\n -> \'h\'\n','https://mariadb.com/kb/en/rpad/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (155,39,'CREATE DATABASE','Syntax:\nCREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name\n [create_specification] ...\n\ncreate_specification:\n [DEFAULT] CHARACTER SET [=] charset_name\n | [DEFAULT] COLLATE [=] collation_name\n\nCREATE DATABASE creates a database with the given name. To use this\nstatement, you need the CREATE privilege for the database. CREATE\nSCHEMA is a synonym for CREATE DATABASE.\n\nURL: https://mariadb.com/kb/en/create-database/\n\n','','https://mariadb.com/kb/en/create-database/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (156,22,'DEC','DEC[(M[,D])] [UNSIGNED] [ZEROFILL], NUMERIC[(M[,D])] [UNSIGNED]\n[ZEROFILL], FIXED[(M[,D])] [UNSIGNED] [ZEROFILL]\n\nThese types are synonyms for DECIMAL. The FIXED synonym is available\nfor compatibility with other database systems.\n\nURL: https://mariadb.com/kb/en/dec-numeric-fixed/\n\n','','https://mariadb.com/kb/en/dec-numeric-fixed/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (157,16,'VAR_POP','Syntax:\nVAR_POP(expr)\n\nReturns the population standard variance of expr. It considers rows as\nthe whole population, not as a sample, so it has the number of rows as\nthe denominator. You can also use VARIANCE(), which is equivalent but\nis not standard SQL.\n\nVAR_POP() returns NULL if there were no matching rows.\n\nURL: https://mariadb.com/kb/en/var_pop/\n\n','','https://mariadb.com/kb/en/var_pop/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (158,37,'ELT','Syntax:\nELT(N,str1,str2,str3,...)\n\nReturns str1 if N = 1, str2 if N = 2, and so on. Returns NULL if N is\nless than 1 or greater than the number of arguments. ELT() is the\ncomplement of FIELD().\n\nURL: https://mariadb.com/kb/en/elt/.html\n\n','MariaDB> SELECT ELT(1, \'ej\', \'Heja\', \'hej\', \'foo\');\n -> \'ej\'\nMariaDB> SELECT ELT(4, \'ej\', \'Heja\', \'hej\', \'foo\');\n -> \'foo\'\n','https://mariadb.com/kb/en/elt/.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (159,39,'ALTER VIEW','Syntax:\nALTER\n [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]\n [DEFINER = { user | CURRENT_USER }]\n [SQL SECURITY { DEFINER | INVOKER }]\n VIEW view_name [(column_list)]\n AS select_statement\n [WITH [CASCADED | LOCAL] CHECK OPTION]\n\nThis statement changes the definition of a view, which must exist. The\nsyntax is similar to that for CREATE VIEW and the effect is the same as\nfor CREATE OR REPLACE VIEW. See [HELP CREATE VIEW]. This statement\nrequires the CREATE VIEW and DROP privileges for the view, and some\nprivilege for each column referred to in the SELECT statement. ALTER\nVIEW is permitted only to the definer or users with the SUPER\nprivilege.\n\nURL: https://mariadb.com/kb/en/alter-view/\n\n','','https://mariadb.com/kb/en/alter-view/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (160,26,'SHOW DATABASES','Syntax:\nSHOW {DATABASES | SCHEMAS}\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW DATABASES lists the databases on the MySQL server host. SHOW\nSCHEMAS is a synonym for SHOW DATABASES. The LIKE clause, if present,\nindicates which database names to match. The WHERE clause can be given\nto select rows using more general conditions, as discussed in\nhttps://mariadb.com/kb/en/extended-show/.\n\nYou see only those databases for which you have some kind of privilege,\nunless you have the global SHOW DATABASES privilege. You can also get\nthis list using the mysqlshow command.\n\nIf the server was started with the --skip-show-database option, you\ncannot use this statement at all unless you have the SHOW DATABASES\nprivilege.\n\nURL: https://mariadb.com/kb/en/show-databases/\n\n','','https://mariadb.com/kb/en/show-databases/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (161,19,'~','Syntax:\n~\n\nInvert all bits.\n\nURL: https://mariadb.com/kb/en/3489/\n\n','MariaDB> SELECT 5 & ~1;\n -> 4\n','https://mariadb.com/kb/en/3489/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (162,22,'TEXT','TEXT[(M)] [CHARACTER SET charset_name] [COLLATE collation_name]\n\nA TEXT column with a maximum length of 65,535 (216 - 1) characters. The\neffective maximum length is less if the value contains multi-byte\ncharacters. Each TEXT value is stored using a 2-byte length prefix that\nindicates the number of bytes in the value.\n\nAn optional length M can be given for this type. If this is done, MySQL\ncreates the column as the smallest TEXT type large enough to hold\nvalues M characters long.\n\nURL: https://mariadb.com/kb/en/text/\n\n','','https://mariadb.com/kb/en/text/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (163,37,'CONCAT_WS','Syntax:\nCONCAT_WS(separator,str1,str2,...)\n\nCONCAT_WS() stands for Concatenate With Separator and is a special form\nof CONCAT(). The first argument is the separator for the rest of the\narguments. The separator is added between the strings to be\nconcatenated. The separator can be a string, as can the rest of the\narguments. If the separator is NULL, the result is NULL.\n\nURL: https://mariadb.com/kb/en/concat_ws/\n\n','MariaDB> SELECT CONCAT_WS(\',\',\'First name\',\'Second name\',\'Last Name\');\n -> \'First name,Second name,Last Name\'\nMariaDB> SELECT CONCAT_WS(\',\',\'First name\',NULL,\'Last Name\');\n -> \'First name,Last Name\'\n','https://mariadb.com/kb/en/concat_ws/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (164,17,'ROW_COUNT','Syntax:\nROW_COUNT()\n\nBefore MySQL 5.5.5, ROW_COUNT() returns the number of rows changed,\ndeleted, or inserted by the last statement if it was an UPDATE, DELETE,\nor INSERT. For other statements, the value may not be meaningful.\n\nAs of MySQL 5.5.5, ROW_COUNT() returns a value as follows:\n\no DDL statements: 0. This applies to statements such as CREATE TABLE or\n DROP TABLE.\n\no DML statements other than SELECT: The number of affected rows. This\n applies to statements such as UPDATE, INSERT, or DELETE (as before),\n but now also to statements such as ALTER TABLE and LOAD DATA INFILE.\n\no SELECT: -1 if the statement returns a result set, or the number of\n rows "affected" if it does not. For example, for SELECT * FROM t1,\n ROW_COUNT() returns -1. For SELECT * FROM t1 INTO OUTFILE\n \'file_name\', ROW_COUNT() returns the number of rows written to the\n file.\n\no SIGNAL statements: 0.\n\nFor UPDATE statements, the affected-rows value by default is the number\nof rows actually changed. If you specify the CLIENT_FOUND_ROWS flag to\nmysql_real_connect() when connecting to mysqld, the affected-rows value\nis the number of rows "found"; that is, matched by the WHERE clause.\n\nFor REPLACE statements, the affected-rows value is 2 if the new row\nreplaced an old row, because in this case, one row was inserted after\nthe duplicate was deleted.\n\nFor INSERT ... ON DUPLICATE KEY UPDATE statements, the affected-rows\nvalue is 1 if the row is inserted as a new row and 2 if an existing row\nis updated.\n\nThe ROW_COUNT() value is similar to the value from the\nmysql_affected_rows() C API function and the row count that the mysql\nclient displays following statement execution.\n\nURL: https://mariadb.com/kb/en/information-functions-row_count/\n\n','MariaDB> INSERT INTO t VALUES(1),(2),(3);\nQuery OK, 3 rows affected (0.00 sec)\nRecords: 3 Duplicates: 0 Warnings: 0\n\nMariaDB> SELECT ROW_COUNT();\n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 3 |\n+-------------+\n1 row in set (0.00 sec)\n\nMariaDB> DELETE FROM t WHERE i IN(1,2);\nQuery OK, 2 rows affected (0.00 sec)\n\nMariaDB> SELECT ROW_COUNT();\n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 2 |\n+-------------+\n1 row in set (0.00 sec)\n','https://mariadb.com/kb/en/information-functions-row_count/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (165,4,'ASIN','Syntax:\nASIN(X)\n\nReturns the arc sine of X, that is, the value whose sine is X. Returns\nNULL if X is not in the range -1 to 1.\n\nURL: https://mariadb.com/kb/en/asin/\n\n','MariaDB> SELECT ASIN(0.2);\n -> 0.20135792079033\nMariaDB> SELECT ASIN(\'foo\');\n\n+-------------+\n| ASIN(\'foo\') |\n+-------------+\n| 0 |\n+-------------+\n1 row in set, 1 warning (0.00 sec)\n\nMariaDB> SHOW WARNINGS;\n+---------+------+-----------------------------------------+\n| Level | Code | Message |\n+---------+------+-----------------------------------------+\n| Warning | 1292 | Truncated incorrect DOUBLE value: \'foo\' |\n+---------+------+-----------------------------------------+\n','https://mariadb.com/kb/en/asin/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (166,4,'SIGN','Syntax:\nSIGN(X)\n\nReturns the sign of the argument as -1, 0, or 1, depending on whether X\nis negative, zero, or positive.\n\nURL: https://mariadb.com/kb/en/sign/\n\n','MariaDB> SELECT SIGN(-32);\n -> -1\nMariaDB> SELECT SIGN(0);\n -> 0\nMariaDB> SELECT SIGN(234);\n -> 1\n','https://mariadb.com/kb/en/sign/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (167,31,'SEC_TO_TIME','Syntax:\nSEC_TO_TIME(seconds)\n\nReturns the seconds argument, converted to hours, minutes, and seconds,\nas a TIME value. The range of the result is constrained to that of the\nTIME data type. A warning occurs if the argument corresponds to a value\noutside that range.\n\nURL: https://mariadb.com/kb/en/sec_to_time/\n\n','MariaDB> SELECT SEC_TO_TIME(2378);\n -> \'00:39:38\'\nMariaDB> SELECT SEC_TO_TIME(2378) + 0;\n -> 3938\n','https://mariadb.com/kb/en/sec_to_time/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (168,22,'FLOAT','FLOAT[(M,D)] [UNSIGNED] [ZEROFILL]\n\nA small (single-precision) floating-point number. Permissible values\nare -3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to\n3.402823466E+38. These are the theoretical limits, based on the IEEE\nstandard. The actual range might be slightly smaller depending on your\nhardware or operating system.\n\nM is the total number of digits and D is the number of digits following\nthe decimal point. If M and D are omitted, values are stored to the\nlimits permitted by the hardware. A single-precision floating-point\nnumber is accurate to approximately 7 decimal places.\n\nUNSIGNED, if specified, disallows negative values.\n\nUsing FLOAT might give you some unexpected problems because all\ncalculations in MySQL are done with double precision. See\nhttps://mariadb.com/kb/en/floating-point-accuracy/.\n\nURL: https://mariadb.com/kb/en/float/\n\n','','https://mariadb.com/kb/en/float/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (169,37,'LOCATE','Syntax:\nLOCATE(substr,str), LOCATE(substr,str,pos)\n\nThe first syntax returns the position of the first occurrence of\nsubstring substr in string str. The second syntax returns the position\nof the first occurrence of substring substr in string str, starting at\nposition pos. Returns 0 if substr is not in str.\n\nURL: https://mariadb.com/kb/en/locate/\n\n','MariaDB> SELECT LOCATE(\'bar\', \'foobarbar\');\n -> 4\nMariaDB> SELECT LOCATE(\'xbar\', \'foobar\');\n -> 0\nMariaDB> SELECT LOCATE(\'bar\', \'foobarbar\', 5);\n -> 7\n','https://mariadb.com/kb/en/locate/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (170,26,'SHOW EVENTS','Syntax:\nSHOW EVENTS [{FROM | IN} schema_name]\n [LIKE \'pattern\' | WHERE expr]\n\nThis statement displays information about Event Manager events. It\nrequires the EVENT privilege for the database from which the events are\nto be shown.\n\nIn its simplest form, SHOW EVENTS lists all of the events in the\ncurrent schema:\n\nMariaDB> SELECT CURRENT_USER(), SCHEMA();\n+----------------+----------+\n| CURRENT_USER() | SCHEMA() |\n+----------------+----------+\n| jon@ghidora | myschema |\n+----------------+----------+\n1 row in set (0.00 sec)\n\nMariaDB> SHOW EVENTS\\G\n*************************** 1. row ***************************\n Db: myschema\n Name: e_daily\n Definer: jon@ghidora\n Time zone: SYSTEM\n Type: RECURRING\n Execute at: NULL\n Interval value: 10\n Interval field: SECOND\n Starts: 2006-02-09 10:41:23\n Ends: NULL\n Status: ENABLED\n Originator: 0\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\nTo see events for a specific schema, use the FROM clause. For example,\nto see events for the test schema, use the following statement:\n\nSHOW EVENTS FROM test;\n\nThe LIKE clause, if present, indicates which event names to match. The\nWHERE clause can be given to select rows using more general conditions,\nas discussed in\nhttps://mariadb.com/kb/en/extended-show/.\n\nURL: https://mariadb.com/kb/en/show-events/\n\n','','https://mariadb.com/kb/en/show-events/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (171,17,'CHARSET','Syntax:\nCHARSET(str)\n\nReturns the character set of the string argument.\n\nURL: https://mariadb.com/kb/en/charset/\n\n','MariaDB> SELECT CHARSET(\'abc\');\n -> \'latin1\'\nMariaDB> SELECT CHARSET(CONVERT(\'abc\' USING utf8));\n -> \'utf8\'\nMariaDB> SELECT CHARSET(USER());\n -> \'utf8\'\n','https://mariadb.com/kb/en/charset/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (172,31,'SUBDATE','Syntax:\nSUBDATE(date,INTERVAL expr unit), SUBDATE(expr,days)\n\nWhen invoked with the INTERVAL form of the second argument, SUBDATE()\nis a synonym for DATE_SUB(). For information on the INTERVAL unit\nargument, see the discussion for DATE_ADD().\n\nMariaDB> SELECT DATE_SUB(\'2008-01-02\', INTERVAL 31 DAY);\n -> \'2007-12-02\'\nMariaDB> SELECT SUBDATE(\'2008-01-02\', INTERVAL 31 DAY);\n -> \'2007-12-02\'\n\nThe second form enables the use of an integer value for days. In such\ncases, it is interpreted as the number of days to be subtracted from\nthe date or datetime expression expr.\n\nMariaDB> SELECT SUBDATE(\'2008-01-02 12:00:00\', 31);\n -> \'2007-12-02 12:00:00\'\n\nURL: https://mariadb.com/kb/en/subdate/\n\n','','https://mariadb.com/kb/en/subdate/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (173,31,'DAYOFYEAR','Syntax:\nDAYOFYEAR(date)\n\nReturns the day of the year for date, in the range 1 to 366.\n\nURL: https://mariadb.com/kb/en/dayofyear/\n\n','MariaDB> SELECT DAYOFYEAR(\'2007-02-03\');\n -> 34\n','https://mariadb.com/kb/en/dayofyear/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (174,4,'%','Syntax:\nN % M, N MOD M\n\nModulo operation. Returns the remainder of N divided by M. For more\ninformation, see the description for the MOD() function in\nhttps://mariadb.com/kb/en/mod/.\n\nURL: https://mariadb.com/kb/en/modulo-operator/\n\n','','https://mariadb.com/kb/en/modulo-operator/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (175,22,'LONGTEXT','LONGTEXT [CHARACTER SET charset_name] [COLLATE collation_name]\n\nA TEXT column with a maximum length of 4,294,967,295 or 4GB (232 - 1)\ncharacters. The effective maximum length is less if the value contains\nmulti-byte characters. The effective maximum length of LONGTEXT columns\nalso depends on the configured maximum packet size in the client/server\nprotocol and available memory. Each LONGTEXT value is stored using a\n4-byte length prefix that indicates the number of bytes in the value.\n\nURL: https://mariadb.com/kb/en/longtext/\n\n','','https://mariadb.com/kb/en/longtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (176,26,'KILL','Syntax:\nKILL [CONNECTION | QUERY] thread_id\n\nEach connection to mysqld runs in a separate thread. You can see which\nthreads are running with the SHOW PROCESSLIST statement and kill a\nthread with the KILL thread_id statement.\n\nKILL permits an optional CONNECTION or QUERY modifier:\n\no KILL CONNECTION is the same as KILL with no modifier: It terminates\n the connection associated with the given thread_id.\n\no KILL QUERY terminates the statement that the connection is currently\n executing, but leaves the connection itself intact.\n\nIf you have the PROCESS privilege, you can see all threads. If you have\nthe SUPER privilege, you can kill all threads and statements.\nOtherwise, you can see and kill only your own threads and statements.\n\nYou can also use the mysqladmin processlist and mysqladmin kill\ncommands to examine and kill threads.\n\n*Note*: You cannot use KILL with the Embedded MySQL Server library\nbecause the embedded server merely runs inside the threads of the host\napplication. It does not create any connection threads of its own.\n\nURL: https://mariadb.com/kb/en/data-manipulation-kill-connection-query/\n\n','','https://mariadb.com/kb/en/data-manipulation-kill-connection-query/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (177,30,'DISJOINT','Disjoint(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 is spatially disjoint from (does\nnot intersect) g2.\n\nURL: https://mariadb.com/kb/en/disjoint/\n\n','','https://mariadb.com/kb/en/disjoint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (178,3,'ASTEXT','AsText(g), AsWKT(g)\n\nConverts a value in internal geometry format to its WKT representation\nand returns the string result.\n\nURL: https://mariadb.com/kb/en/astext/\n\n','MariaDB> SET @g = \'LineString(1 1,2 2,3 3)\';\nMariaDB> SELECT AsText(GeomFromText(@g));\n+--------------------------+\n| AsText(GeomFromText(@g)) |\n+--------------------------+\n| LINESTRING(1 1,2 2,3 3) |\n+--------------------------+\n','https://mariadb.com/kb/en/astext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (179,37,'LPAD','Syntax:\nLPAD(str,len,padstr)\n\nReturns the string str, left-padded with the string padstr to a length\nof len characters. If str is longer than len, the return value is\nshortened to len characters.\n\n\nURL: https://mariadb.com/kb/en/lpad/\n\n','MariaDB> SELECT LPAD(\'hi\',4,\'??\');\n -> \'??hi\'\nMariaDB> SELECT LPAD(\'hi\',1,\'??\');\n -> \'h\'\n','https://mariadb.com/kb/en/lpad/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (180,23,'DECLARE CONDITION','Syntax:\nDECLARE condition_name CONDITION FOR condition_value\n\ncondition_value:\n mysql_error_code\n | SQLSTATE [VALUE] sqlstate_value\n\nThe DECLARE ... CONDITION statement declares a named error condition,\nassociating a name with a condition that needs specific handling. The\nname can be referred to in a subsequent DECLARE ... HANDLER statement\n(see [HELP DECLARE HANDLER]).\n\nCondition declarations must appear before cursor or handler\ndeclarations.\n\nThe condition_value for DECLARE ... CONDITION can be a MySQL error code\n(a number) or an SQLSTATE value (a 5-character string literal). You\nshould not use MySQL error code 0 or SQLSTATE values that begin with\n\'00\', because those indicate success rather than an error condition.\nFor a list of MySQL error codes and SQLSTATE values, see\nhttps://mariadb.com/kb/en/mariadb-error-codes/.\n\nURL: https://mariadb.com/kb/en/declare-condition/\n\n','','https://mariadb.com/kb/en/declare-condition/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (181,30,'OVERLAPS','Overlaps(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 spatially overlaps g2. The term\nspatially overlaps is used if two geometries intersect and their\nintersection results in a geometry of the same dimension but not equal\nto either of the given geometries.\n\nURL: https://mariadb.com/kb/en/overlaps/\n\n','','https://mariadb.com/kb/en/overlaps/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (182,8,'SET GLOBAL SQL_SLAVE_SKIP_COUNTER','Syntax:\nSET GLOBAL sql_slave_skip_counter = N\n\nThis statement skips the next N events from the master. This is useful\nfor recovering from replication stops caused by a statement.\n\nThis statement is valid only when the slave threads are not running.\nOtherwise, it produces an error.\n\nURL: https://mariadb.com/kb/en/set-global-sql_slave_skip_counter/\n\n','','https://mariadb.com/kb/en/set-global-sql_slave_skip_counter/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (183,25,'NUMGEOMETRIES','NumGeometries(gc)\n\nReturns the number of geometries in the GeometryCollection value gc.\n\nURL: https://mariadb.com/kb/en/numgeometries/\n\n','MariaDB> SET @gc = \'GeometryCollection(Point(1 1),LineString(2 2, 3 3))\';\nMariaDB> SELECT NumGeometries(GeomFromText(@gc));\n+----------------------------------+\n| NumGeometries(GeomFromText(@gc)) |\n+----------------------------------+\n| 2 |\n+----------------------------------+\n','https://mariadb.com/kb/en/numgeometries/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (184,31,'MONTHNAME','Syntax:\nMONTHNAME(date)\n\nReturns the full name of the month for date. The language used for the\nname is controlled by the value of the lc_time_names system variable\n(https://mariadb.com/kb/en/server-locale/).\n\nURL: https://mariadb.com/kb/en/monthname/\n\n','MariaDB> SELECT MONTHNAME(\'2008-02-03\');\n -> \'February\'\n','https://mariadb.com/kb/en/monthname/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (185,8,'CHANGE MASTER TO','Syntax:\nCHANGE MASTER TO option [, option] ...\n\noption:\n MASTER_BIND = \'interface_name\'\n | MASTER_HOST = \'host_name\'\n | MASTER_USER = \'user_name\'\n | MASTER_PASSWORD = \'password\'\n | MASTER_PORT = port_num\n | MASTER_CONNECT_RETRY = interval\n | MASTER_HEARTBEAT_PERIOD = interval\n | MASTER_LOG_FILE = \'master_log_name\'\n | MASTER_LOG_POS = master_log_pos\n | RELAY_LOG_FILE = \'relay_log_name\'\n | RELAY_LOG_POS = relay_log_pos\n | MASTER_SSL = {0|1}\n | MASTER_SSL_CA = \'ca_file_name\'\n | MASTER_SSL_CAPATH = \'ca_directory_name\'\n | MASTER_SSL_CERT = \'cert_file_name\'\n | MASTER_SSL_KEY = \'key_file_name\'\n | MASTER_SSL_CIPHER = \'cipher_list\'\n | MASTER_SSL_VERIFY_SERVER_CERT = {0|1}\n | IGNORE_SERVER_IDS = (server_id_list)\n\nserver_id_list:\n [server_id [, server_id] ... ]\n\nCHANGE MASTER TO changes the parameters that the slave server uses for\nconnecting to the master server, for reading the master binary log, and\nreading the slave relay log. It also updates the contents of the\nmaster.info and relay-log.info files. To use CHANGE MASTER TO, the\nslave replication threads must be stopped (use STOP SLAVE if\nnecessary).\n\nOptions not specified retain their value, except as indicated in the\nfollowing discussion. Thus, in most cases, there is no need to specify\noptions that do not change. For example, if the password to connect to\nyour MySQL master has changed, you just need to issue these statements\nto tell the slave about the new password:\n\nSTOP SLAVE; -- if replication was running\nCHANGE MASTER TO MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE; -- if you want to restart replication\n\nMASTER_HOST, MASTER_USER, MASTER_PASSWORD, and MASTER_PORT provide\ninformation to the slave about how to connect to its master:\n\no MASTER_HOST and MASTER_PORT are the host name (or IP address) of the\n master host and its TCP/IP port.\n\n *Note*: Replication cannot use Unix socket files. You must be able to\n connect to the master MySQL server using TCP/IP.\n\n If you specify the MASTER_HOST or MASTER_PORT option, the slave\n assumes that the master server is different from before (even if the\n option value is the same as its current value.) In this case, the old\n values for the master binary log file name and position are\n considered no longer applicable, so if you do not specify\n MASTER_LOG_FILE and MASTER_LOG_POS in the statement,\n MASTER_LOG_FILE=\'\' and MASTER_LOG_POS=4 are silently appended to it.\n\n Setting MASTER_HOST=\'\' (that is, setting its value explicitly to an\n empty string) is not the same as not setting MASTER_HOST at all.\n Beginning with MySQL 5.5, trying to set MASTER_HOST to an empty\n string fails with an error. Previously, setting MASTER_HOST to an\n empty string caused START SLAVE subsequently to fail. (Bug #28796)\n\no MASTER_USER and MASTER_PASSWORD are the user name and password of the\n account to use for connecting to the master.\n\n In MySQL 5.5.20 and later, MASTER_USER cannot be made empty; setting\n MASTER_USER = \'\' or leaving it unset when setting a value for for\n MASTER_PASSWORD causes an error (Bug #13427949).\n\n Currently, a password used for a replication slave account is\n effectively limited to 32 characters in length; the password can be\n longer, but any excess characters are truncated. This is not due to\n any limit imposed by the MySQL Server generally, but rather is an\n issue specific to MySQL Replication. (For more information, see Bug\n #43439.)\n\n The text of a running CHANGE MASTER TO statement, including values\n for MASTER_USER and MASTER_PASSWORD, can be seen in the output of a\n concurrent SHOW PROCESSLIST statement.\n\nThe MASTER_SSL_xxx options provide information about using SSL for the\nconnection. They correspond to the --ssl-xxx options described in\nhttps://mariadb.com/kb/en/ssl-server-system-variables/, and\nhttp://dev.mysql.com/doc/refman/5.5/en/replication-solutions-ssl.html.\nThese options can be changed even on slaves that are compiled without\nSSL support. They are saved to the master.info file, but are ignored if\nthe slave does not have SSL support enabled.\n\nMASTER_CONNECT_RETRY specifies how many seconds to wait between connect\nretries. The default is 60. The number of reconnection attempts is\nlimited by the --master-retry-count server option; for more\ninformation, see\nhttps://mariadb.com/kb/en/replication-and-binary-log-server-system-variables/.\n\nMASTER_HEARTBEAT_PERIOD sets the interval in seconds between\nreplication heartbeats. Whenever the master\'s binary log is updated\nwith an event, the waiting period for the next heartbeat is reset.\ninterval is a decimal value having the range 0 to 4294967 seconds and a\nresolution in milliseconds; the smallest nonzero value is 0.001.\nHeartbeats are sent by the master only if there are no unsent events in\nthe binary log file for a period longer than interval.\n\nSetting interval to 0 disables heartbeats altogether. The default value\nfor interval is equal to the value of slave_net_timeout divided by 2.\n\nSetting @@global.slave_net_timeout to a value less than that of the\ncurrent heartbeat interval results in a warning being issued. The\neffect of issuing RESET SLAVE on the heartbeat interval is to reset it\nto the default value.\n\nMASTER_LOG_FILE and MASTER_LOG_POS are the coordinates at which the\nslave I/O thread should begin reading from the master the next time the\nthread starts. RELAY_LOG_FILE and RELAY_LOG_POS are the coordinates at\nwhich the slave SQL thread should begin reading from the relay log the\nnext time the thread starts. If you specify either of MASTER_LOG_FILE\nor MASTER_LOG_POS, you cannot specify RELAY_LOG_FILE or RELAY_LOG_POS.\nIf neither of MASTER_LOG_FILE or MASTER_LOG_POS is specified, the slave\nuses the last coordinates of the slave SQL thread before CHANGE MASTER\nTO was issued. This ensures that there is no discontinuity in\nreplication, even if the slave SQL thread was late compared to the\nslave I/O thread, when you merely want to change, say, the password to\nuse.\n\nCHANGE MASTER TO deletes all relay log files and starts a new one,\nunless you specify RELAY_LOG_FILE or RELAY_LOG_POS. In that case, relay\nlog files are kept; the relay_log_purge global variable is set silently\nto 0.\n\nPrior to MySQL 5.5, RELAY_LOG_FILE required an absolute path. In MySQL\n5.5, the path can be relative, in which case the path is assumed to be\nrelative to the slave\'s data directory. (Bug #12190)\n\nIGNORE_SERVER_IDS was added in MySQL 5.5. This option takes a\ncomma-separated list of 0 or more server IDs. Events originating from\nthe corresponding servers are ignored, with the exception of log\nrotation and deletion events, which are still recorded in the relay\nlog.\n\nIn circular replication, the originating server normally acts as the\nterminator of its own events, so that they are not applied more than\nonce. Thus, this option is useful in circular replication when one of\nthe servers in the circle is removed. Suppose that you have a circular\nreplication setup with 4 servers, having server IDs 1, 2, 3, and 4, and\nserver 3 fails. When bridging the gap by starting replication from\nserver 2 to server 4, you can include IGNORE_SERVER_IDS = (3) in the\nCHANGE MASTER TO statement that you issue on server 4 to tell it to use\nserver 2 as its master instead of server 3. Doing so causes it to\nignore and not to propagate any statements that originated with the\nserver that is no longer in use.\n\nIf a CHANGE MASTER TO statement is issued without any IGNORE_SERVER_IDS\noption, any existing list is preserved; RESET SLAVE also has no effect\non the server ID list. To clear the list of ignored servers, it is\nnecessary to use the option with an empty list:\n\nCHANGE MASTER TO IGNORE_SERVER_IDS = ();\n\nIf IGNORE_SERVER_IDS contains the server\'s own ID and the server was\nstarted with the --replicate-same-server-id option enabled, an error\nresults.\n\nAlso beginning with MySQL 5.5, the master.info file and the output of\nSHOW SLAVE STATUS are extended to provide the list of servers that are\ncurrently ignored. For more information, see\nhttps://mariadb.com/kb/en/show-slave-status/, and\n[HELP SHOW SLAVE STATUS].\n\nBeginning with MySQL 5.5.5, invoking CHANGE MASTER TO causes the\nprevious values for MASTER_HOST, MASTER_PORT, MASTER_LOG_FILE, and\nMASTER_LOG_POS to be written to the error log, along with other\ninformation about the slave\'s state prior to execution.\n\nCHANGE MASTER TO is useful for setting up a slave when you have the\nsnapshot of the master and have recorded the master binary log\ncoordinates corresponding to the time of the snapshot. After loading\nthe snapshot into the slave to synchronize it to the slave, you can run\nCHANGE MASTER TO MASTER_LOG_FILE=\'log_name\', MASTER_LOG_POS=log_pos on\nthe slave to specify the coordinates at which the slave should begin\nreading the master binary log.\n\nThe following example changes the master server the slave uses and\nestablishes the master binary log coordinates from which the slave\nbegins reading. This is used when you want to set up the slave to\nreplicate the master:\n\nCHANGE MASTER TO\n MASTER_HOST=\'master2.mycompany.com\',\n MASTER_USER=\'replication\',\n MASTER_PASSWORD=\'bigs3cret\',\n MASTER_PORT=3306,\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4,\n MASTER_CONNECT_RETRY=10;\n\nThe next example shows an operation that is less frequently employed.\nIt is used when the slave has relay log files that you want it to\nexecute again for some reason. To do this, the master need not be\nreachable. You need only use CHANGE MASTER TO and start the SQL thread\n(START SLAVE SQL_THREAD):\n\nCHANGE MASTER TO\n RELAY_LOG_FILE=\'slave-relay-bin.006\',\n RELAY_LOG_POS=4025;\n\nURL: https://mariadb.com/kb/en/change-master-to/\n\n','','https://mariadb.com/kb/en/change-master-to/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (186,39,'DROP DATABASE','Syntax:\nDROP {DATABASE | SCHEMA} [IF EXISTS] db_name\n\nDROP DATABASE drops all tables in the database and deletes the\ndatabase. Be very careful with this statement! To use DROP DATABASE,\nyou need the DROP privilege on the database. DROP SCHEMA is a synonym\nfor DROP DATABASE.\n\n*Important*: When a database is dropped, user privileges on the\ndatabase are not automatically dropped. See [HELP GRANT].\n\nIF EXISTS is used to prevent an error from occurring if the database\ndoes not exist.\n\nURL: https://mariadb.com/kb/en/drop-database/\n\n','','https://mariadb.com/kb/en/drop-database/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (187,6,'MBREQUAL','MBREqual(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 are the same.\n\nURL: https://mariadb.com/kb/en/mbrequal/\n\n','','https://mariadb.com/kb/en/mbrequal/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (188,31,'TIMESTAMP FUNCTION','Syntax:\nTIMESTAMP(expr), TIMESTAMP(expr1,expr2)\n\nWith a single argument, this function returns the date or datetime\nexpression expr as a datetime value. With two arguments, it adds the\ntime expression expr2 to the date or datetime expression expr1 and\nreturns the result as a datetime value.\n\nURL: https://mariadb.com/kb/en/timestamp-function/\n\n','MariaDB> SELECT TIMESTAMP(\'2003-12-31\');\n -> \'2003-12-31 00:00:00\'\nMariaDB> SELECT TIMESTAMP(\'2003-12-31 12:00:00\',\'12:00:00\');\n -> \'2004-01-01 00:00:00\'\n','https://mariadb.com/kb/en/timestamp-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (189,33,'PROCEDURE ANALYSE','Syntax:\nANALYSE([max_elements[,max_memory]])\n\nANALYSE() examines the result from a query and returns an analysis of\nthe results that suggests optimal data types for each column that may\nhelp reduce table sizes. To obtain this analysis, append PROCEDURE\nANALYSE to the end of a SELECT statement:\n\nSELECT ... FROM ... WHERE ... PROCEDURE ANALYSE([max_elements,[max_memory]])\n\nFor example:\n\nSELECT col1, col2 FROM table1 PROCEDURE ANALYSE(10, 2000);\n\nThe results show some statistics for the values returned by the query,\nand propose an optimal data type for the columns. This can be helpful\nfor checking your existing tables, or after importing new data. You may\nneed to try different settings for the arguments so that PROCEDURE\nANALYSE() does not suggest the ENUM data type when it is not\nappropriate.\n\nThe arguments are optional and are used as follows:\n\no max_elements (default 256) is the maximum number of distinct values\n that ANALYSE() notices per column. This is used by ANALYSE() to check\n whether the optimal data type should be of type ENUM; if there are\n more than max_elements distinct values, then ENUM is not a suggested\n type.\n\no max_memory (default 8192) is the maximum amount of memory that\n ANALYSE() should allocate per column while trying to find all\n distinct values.\n\nURL: https://mariadb.com/kb/en/procedure-analyse/\n\n','','https://mariadb.com/kb/en/procedure-analyse/');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (190,9,'HELP_VERSION','This help information was generated from the MySQL 5.5 Reference Manual\non: 2012-08-25 (revision: 31914)\n\nThis information applies to MySQL 5.5 through 5.5.29.\n','','');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (191,37,'CHARACTER_LENGTH','Syntax:\nCHARACTER_LENGTH(str)\n\nCHARACTER_LENGTH() is a synonym for CHAR_LENGTH().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (192,26,'SHOW GRANTS','Syntax:\nSHOW GRANTS [FOR user]\n\nThis statement lists the GRANT statement or statements that must be\nissued to duplicate the privileges that are granted to a MySQL user\naccount. The account is named using the same format as for the GRANT\nstatement; for example, \'jeffrey\'@\'localhost\'. If you specify only the\nuser name part of the account name, a host name part of \'%\' is used.\nFor additional information about specifying account names, see [HELP\nGRANT].\n\nmysql> SHOW GRANTS FOR \'root\'@\'localhost\';\n+---------------------------------------------------------------------+\n| Grants for root@localhost |\n+---------------------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'root\'@\'localhost\' WITH GRANT OPTION |\n+---------------------------------------------------------------------+\n\nTo list the privileges granted to the account that you are using to\nconnect to the server, you can use any of the following statements:\n\nSHOW GRANTS;\nSHOW GRANTS FOR CURRENT_USER;\nSHOW GRANTS FOR CURRENT_USER();\n\nIf SHOW GRANTS FOR CURRENT_USER (or any of the equivalent syntaxes) is\nused in DEFINER context, such as within a stored procedure that is\ndefined with SQL SECURITY DEFINER), the grants displayed are those of\nthe definer and not the invoker.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-grants.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-grants.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (193,26,'SHOW PRIVILEGES','Syntax:\nSHOW PRIVILEGES\n\nSHOW PRIVILEGES shows the list of system privileges that the MySQL\nserver supports. The exact list of privileges depends on the version of\nyour server.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-privileges.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-privileges.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (194,39,'CREATE TABLESPACE','Syntax:\nCREATE TABLESPACE tablespace_name\n ADD DATAFILE \'file_name\'\n USE LOGFILE GROUP logfile_group\n [EXTENT_SIZE [=] extent_size]\n [INITIAL_SIZE [=] initial_size]\n [AUTOEXTEND_SIZE [=] autoextend_size]\n [MAX_SIZE [=] max_size]\n [NODEGROUP [=] nodegroup_id]\n [WAIT]\n [COMMENT [=] comment_text]\n ENGINE [=] engine_name\n\nThis statement is used to create a tablespace, which can contain one or\nmore data files, providing storage space for tables. One data file is\ncreated and added to the tablespace using this statement. Additional\ndata files may be added to the tablespace by using the ALTER TABLESPACE\nstatement (see [HELP ALTER TABLESPACE]). For rules covering the naming\nof tablespaces, see\nhttp://dev.mysql.com/doc/refman/5.5/en/identifiers.html.\n\n*Note*: All MySQL Cluster Disk Data objects share the same namespace.\nThis means that each Disk Data object must be uniquely named (and not\nmerely each Disk Data object of a given type). For example, you cannot\nhave a tablespace and a log file group with the same name, or a\ntablespace and a data file with the same name.\n\nA log file group of one or more UNDO log files must be assigned to the\ntablespace to be created with the USE LOGFILE GROUP clause.\nlogfile_group must be an existing log file group created with CREATE\nLOGFILE GROUP (see\nhttp://dev.mysql.com/doc/refman/5.5/en/create-logfile-group.html).\nMultiple tablespaces may use the same log file group for UNDO logging.\n\nThe EXTENT_SIZE sets the size, in bytes, of the extents used by any\nfiles belonging to the tablespace. The default value is 1M. The minimum\nsize is 32K, and theoretical maximum is 2G, although the practical\nmaximum size depends on a number of factors. In most cases, changing\nthe extent size does not have any measurable effect on performance, and\nthe default value is recommended for all but the most unusual\nsituations.\n\nAn extent is a unit of disk space allocation. One extent is filled with\nas much data as that extent can contain before another extent is used.\nIn theory, up to 65,535 (64K) extents may used per data file; however,\nthe recommended maximum is 32,768 (32K). The recommended maximum size\nfor a single data file is 32G---that is, 32K extents x 1 MB per extent.\nIn addition, once an extent is allocated to a given partition, it\ncannot be used to store data from a different partition; an extent\ncannot store data from more than one partition. This means, for example\nthat a tablespace having a single datafile whose INITIAL_SIZE is 256 MB\nand whose EXTENT_SIZE is 128M has just two extents, and so can be used\nto store data from at most two different disk data table partitions.\n\nYou can see how many extents remain free in a given data file by\nquerying the INFORMATION_SCHEMA.FILES table, and so derive an estimate\nfor how much space remains free in the file. For further discussion and\nexamples, see http://dev.mysql.com/doc/refman/5.5/en/files-table.html.\n\nThe INITIAL_SIZE parameter sets the data file\'s total size in bytes.\nOnce the file has been created, its size cannot be changed; however,\nyou can add more data files to the tablespace using ALTER TABLESPACE\n... ADD DATAFILE. See [HELP ALTER TABLESPACE].\n\nINITIAL_SIZE is optional; its default value is 128M.\n\nOn 32-bit systems, the maximum supported value for INITIAL_SIZE is 4G.\n(Bug #29186)\n\nWhen setting EXTENT_SIZE or INITIAL_SIZE (either or both), you may\noptionally follow the number with a one-letter abbreviation for an\norder of magnitude, similar to those used in my.cnf. Generally, this is\none of the letters M (for megabytes) or G (for gigabytes).\n\nINITIAL_SIZE, EXTENT_SIZE, and UNDO_BUFFER_SIZE are subject to rounding\nas follows:\n\no EXTENT_SIZE and UNDO_BUFFER_SIZE are each rounded up to the nearest\n whole multiple of 32K.\n\no INITIAL_SIZE is rounded down to the nearest whole multiple of 32K.\n\n For data files, INITIAL_SIZE is subject to further rounding; the\n result just obtained is rounded up to the nearest whole multiple of\n EXTENT_SIZE (after any rounding).\n\nThe rounding just described is done explicitly, and a warning is issued\nby the MySQL Server when any such rounding is performed. The rounded\nvalues are also used by the NDB kernel for calculating\nINFORMATION_SCHEMA.FILES column values and other purposes. However, to\navoid an unexpected result, we suggest that you always use whole\nmultiples of 32K in specifying these options.\n\nAUTOEXTEND_SIZE, MAX_SIZE, NODEGROUP, WAIT, and COMMENT are parsed but\nignored, and so currently have no effect. These options are intended\nfor future expansion.\n\nThe ENGINE parameter determines the storage engine which uses this\ntablespace, with engine_name being the name of the storage engine.\nCurrently, engine_name must be one of the values NDB or NDBCLUSTER.\n\nWhen CREATE TABLESPACE is used with ENGINE = NDB, a tablespace and\nassociated data file are created on each Cluster data node. You can\nverify that the data files were created and obtain information about\nthem by querying the INFORMATION_SCHEMA.FILES table. For example:\n\nmysql> SELECT LOGFILE_GROUP_NAME, FILE_NAME, EXTRA\n -> FROM INFORMATION_SCHEMA.FILES\n -> WHERE TABLESPACE_NAME = \'newts\' AND FILE_TYPE = \'DATAFILE\';\n+--------------------+-------------+----------------+\n| LOGFILE_GROUP_NAME | FILE_NAME | EXTRA |\n+--------------------+-------------+----------------+\n| lg_3 | newdata.dat | CLUSTER_NODE=3 |\n| lg_3 | newdata.dat | CLUSTER_NODE=4 |\n+--------------------+-------------+----------------+\n2 rows in set (0.01 sec)\n\n(See http://dev.mysql.com/doc/refman/5.5/en/files-table.html.)\n\nCREATE TABLESPACE is useful only with Disk Data storage for MySQL\nCluster. See\nhttp://dev.mysql.com/doc/refman/5.5/en/mysql-cluster-disk-data.html.\n\nTo drop a primary key, the index name is always PRIMARY, which must be\nspecified as a quoted identifier because PRIMARY is a reserved word:\n\nDROP INDEX `PRIMARY` ON t;\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-tablespace.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/create-tablespace.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (195,37,'INSERT FUNCTION','Syntax:\nINSERT(str,pos,len,newstr)\n\nReturns the string str, with the substring beginning at position pos\nand len characters long replaced by the string newstr. Returns the\noriginal string if pos is not within the length of the string. Replaces\nthe rest of the string from position pos if len is not within the\nlength of the rest of the string. Returns NULL if any argument is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT INSERT(\'Quadratic\', 3, 4, \'What\');\n -> \'QuWhattic\'\nmysql> SELECT INSERT(\'Quadratic\', -1, 4, \'What\');\n -> \'Quadratic\'\nmysql> SELECT INSERT(\'Quadratic\', 3, 100, \'What\');\n -> \'QuWhat\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (196,4,'CRC32','Syntax:\nCRC32(expr)\n\nComputes a cyclic redundancy check value and returns a 32-bit unsigned\nvalue. The result is NULL if the argument is NULL. The argument is\nexpected to be a string and (if possible) is treated as one if it is\nnot.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT CRC32(\'MySQL\');\n -> 3259397556\nmysql> SELECT CRC32(\'mysql\');\n -> 2501908538\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (197,15,'XOR','Syntax:\nXOR\n\nLogical XOR. Returns NULL if either operand is NULL. For non-NULL\noperands, evaluates to 1 if an odd number of operands is nonzero,\notherwise 0 is returned.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/logical-operators.html\n\n','mysql> SELECT 1 XOR 1;\n -> 0\nmysql> SELECT 1 XOR 0;\n -> 1\nmysql> SELECT 1 XOR NULL;\n -> NULL\nmysql> SELECT 1 XOR 1 XOR 1;\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/logical-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (198,13,'STARTPOINT','StartPoint(ls)\n\nReturns the Point that is the start point of the LineString value ls.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#linestring-property-functions\n\n','mysql> SET @ls = \'LineString(1 1,2 2,3 3)\';\nmysql> SELECT AsText(StartPoint(GeomFromText(@ls)));\n+---------------------------------------+\n| AsText(StartPoint(GeomFromText(@ls))) |\n+---------------------------------------+\n| POINT(1 1) |\n+---------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#linestring-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (199,10,'GRANT','Syntax:\nGRANT\n priv_type [(column_list)]\n [, priv_type [(column_list)]] ...\n ON [object_type] priv_level\n TO user_specification [, user_specification] ...\n [REQUIRE {NONE | ssl_option [[AND] ssl_option] ...}]\n [WITH with_option ...]\n\nGRANT PROXY ON user_specification\n TO user_specification [, user_specification] ...\n [WITH GRANT OPTION]\n\nobject_type:\n TABLE\n | FUNCTION\n | PROCEDURE\n\npriv_level:\n *\n | *.*\n | db_name.*\n | db_name.tbl_name\n | tbl_name\n | db_name.routine_name\n\nuser_specification:\n user\n [\n IDENTIFIED BY [PASSWORD] \'password\'\n | IDENTIFIED WITH auth_plugin [AS \'auth_string\']\n ]\n\nssl_option:\n SSL\n | X509\n | CIPHER \'cipher\'\n | ISSUER \'issuer\'\n | SUBJECT \'subject\'\n\nwith_option:\n GRANT OPTION\n | MAX_QUERIES_PER_HOUR count\n | MAX_UPDATES_PER_HOUR count\n | MAX_CONNECTIONS_PER_HOUR count\n | MAX_USER_CONNECTIONS count\n\nThe GRANT statement grants privileges to MySQL user accounts. GRANT\nalso serves to specify other account characteristics such as use of\nsecure connections and limits on access to server resources. To use\nGRANT, you must have the GRANT OPTION privilege, and you must have the\nprivileges that you are granting.\n\nNormally, a database administrator first uses CREATE USER to create an\naccount, then GRANT to define its privileges and characteristics. For\nexample:\n\nCREATE USER \'jeffrey\'@\'localhost\' IDENTIFIED BY \'mypass\';\nGRANT ALL ON db1.* TO \'jeffrey\'@\'localhost\';\nGRANT SELECT ON db2.invoice TO \'jeffrey\'@\'localhost\';\nGRANT USAGE ON *.* TO \'jeffrey\'@\'localhost\' WITH MAX_QUERIES_PER_HOUR 90;\n\nHowever, if an account named in a GRANT statement does not already\nexist, GRANT may create it under the conditions described later in the\ndiscussion of the NO_AUTO_CREATE_USER SQL mode.\n\nThe REVOKE statement is related to GRANT and enables administrators to\nremove account privileges. See [HELP REVOKE].\n\nWhen successfully executed from the mysql program, GRANT responds with\nQuery OK, 0 rows affected. To determine what privileges result from the\noperation, use SHOW GRANTS. See [HELP SHOW GRANTS].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/grant.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/grant.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (200,23,'DECLARE VARIABLE','Syntax:\nDECLARE var_name [, var_name] ... type [DEFAULT value]\n\nThis statement declares local variables within stored programs. To\nprovide a default value for a variable, include a DEFAULT clause. The\nvalue can be specified as an expression; it need not be a constant. If\nthe DEFAULT clause is missing, the initial value is NULL.\n\nLocal variables are treated like stored routine parameters with respect\nto data type and overflow checking. See [HELP CREATE PROCEDURE].\n\nVariable declarations must appear before cursor or handler\ndeclarations.\n\nLocal variable names are not case sensitive. Permissible characters and\nquoting rules are the same as for other identifiers, as described in\nhttp://dev.mysql.com/doc/refman/5.5/en/identifiers.html.\n\nThe scope of a local variable is the BEGIN ... END block within which\nit is declared. The variable can be referred to in blocks nested within\nthe declaring block, except those blocks that declare a variable with\nthe same name.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/declare-local-variable.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/declare-local-variable.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (201,3,'MPOLYFROMTEXT','MPolyFromText(wkt[,srid]), MultiPolygonFromText(wkt[,srid])\n\nConstructs a MULTIPOLYGON value using its WKT representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (202,6,'MBRINTERSECTS','MBRIntersects(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 intersect.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (203,16,'BIT_OR','Syntax:\nBIT_OR(expr)\n\nReturns the bitwise OR of all bits in expr. The calculation is\nperformed with 64-bit (BIGINT) precision.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (204,31,'YEARWEEK','Syntax:\nYEARWEEK(date), YEARWEEK(date,mode)\n\nReturns year and week for a date. The mode argument works exactly like\nthe mode argument to WEEK(). The year in the result may be different\nfrom the year in the date argument for the first and the last week of\nthe year.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT YEARWEEK(\'1987-01-01\');\n -> 198653\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (205,18,'NOT BETWEEN','Syntax:\nexpr NOT BETWEEN min AND max\n\nThis is the same as NOT (expr BETWEEN min AND max).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (206,18,'IS NOT','Syntax:\nIS NOT boolean_value\n\nTests a value against a boolean value, where boolean_value can be TRUE,\nFALSE, or UNKNOWN.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 1 IS NOT UNKNOWN, 0 IS NOT UNKNOWN, NULL IS NOT UNKNOWN;\n -> 1, 1, 0\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (207,4,'LOG10','Syntax:\nLOG10(X)\n\nReturns the base-10 logarithm of X.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT LOG10(2);\n -> 0.30102999566398\nmysql> SELECT LOG10(100);\n -> 2\nmysql> SELECT LOG10(-100);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (208,4,'SQRT','Syntax:\nSQRT(X)\n\nReturns the square root of a nonnegative number X.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT SQRT(4);\n -> 2\nmysql> SELECT SQRT(20);\n -> 4.4721359549996\nmysql> SELECT SQRT(-16);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (209,22,'DECIMAL','DECIMAL[(M[,D])] [UNSIGNED] [ZEROFILL]\n\nA packed "exact" fixed-point number. M is the total number of digits\n(the precision) and D is the number of digits after the decimal point\n(the scale). The decimal point and (for negative numbers) the "-" sign\nare not counted in M. If D is 0, values have no decimal point or\nfractional part. The maximum number of digits (M) for DECIMAL is 65.\nThe maximum number of supported decimals (D) is 30. If D is omitted,\nthe default is 0. If M is omitted, the default is 10.\n\nUNSIGNED, if specified, disallows negative values.\n\nAll basic calculations (+, -, *, /) with DECIMAL columns are done with\na precision of 65 digits.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (210,39,'CREATE INDEX','Syntax:\nCREATE [ONLINE|OFFLINE] [UNIQUE|FULLTEXT|SPATIAL] INDEX index_name\n [index_type]\n ON tbl_name (index_col_name,...)\n [index_option] ...\n\nindex_col_name:\n col_name [(length)] [ASC | DESC]\n\nindex_type:\n USING {BTREE | HASH}\n\nindex_option:\n KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n | COMMENT \'string\'\n\nCREATE INDEX is mapped to an ALTER TABLE statement to create indexes.\nSee [HELP ALTER TABLE]. CREATE INDEX cannot be used to create a PRIMARY\nKEY; use ALTER TABLE instead. For more information about indexes, see\nhttp://dev.mysql.com/doc/refman/5.5/en/mysql-indexes.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-index.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/create-index.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (211,39,'CREATE FUNCTION','The CREATE FUNCTION statement is used to create stored functions and\nuser-defined functions (UDFs):\n\no For information about creating stored functions, see [HELP CREATE\n PROCEDURE].\n\no For information about creating user-defined functions, see [HELP\n CREATE FUNCTION UDF].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-function.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/create-function.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (212,39,'ALTER DATABASE','Syntax:\nALTER {DATABASE | SCHEMA} [db_name]\n alter_specification ...\nALTER {DATABASE | SCHEMA} db_name\n UPGRADE DATA DIRECTORY NAME\n\nalter_specification:\n [DEFAULT] CHARACTER SET [=] charset_name\n | [DEFAULT] COLLATE [=] collation_name\n\nALTER DATABASE enables you to change the overall characteristics of a\ndatabase. These characteristics are stored in the db.opt file in the\ndatabase directory. To use ALTER DATABASE, you need the ALTER privilege\non the database. ALTER SCHEMA is a synonym for ALTER DATABASE.\n\nThe database name can be omitted from the first syntax, in which case\nthe statement applies to the default database.\n\nNational Language Characteristics\n\nThe CHARACTER SET clause changes the default database character set.\nThe COLLATE clause changes the default database collation.\nhttp://dev.mysql.com/doc/refman/5.5/en/charset.html, discusses\ncharacter set and collation names.\n\nYou can see what character sets and collations are available using,\nrespectively, the SHOW CHARACTER SET and SHOW COLLATION statements. See\n[HELP SHOW CHARACTER SET], and [HELP SHOW COLLATION], for more\ninformation.\n\nIf you change the default character set or collation for a database,\nstored routines that use the database defaults must be dropped and\nrecreated so that they use the new defaults. (In a stored routine,\nvariables with character data types use the database defaults if the\ncharacter set or collation are not specified explicitly. See [HELP\nCREATE PROCEDURE].)\n\nUpgrading from Versions Older than MySQL 5.1\n\nThe syntax that includes the UPGRADE DATA DIRECTORY NAME clause updates\nthe name of the directory associated with the database to use the\nencoding implemented in MySQL 5.1 for mapping database names to\ndatabase directory names (see\nhttp://dev.mysql.com/doc/refman/5.5/en/identifier-mapping.html). This\nclause is for use under these conditions:\n\no It is intended when upgrading MySQL to 5.1 or later from older\n versions.\n\no It is intended to update a database directory name to the current\n encoding format if the name contains special characters that need\n encoding.\n\no The statement is used by mysqlcheck (as invoked by mysql_upgrade).\n\nFor example, if a database in MySQL 5.0 has the name a-b-c, the name\ncontains instances of the - (dash) character. In MySQL 5.0, the\ndatabase directory is also named a-b-c, which is not necessarily safe\nfor all file systems. In MySQL 5.1 and later, the same database name is\nencoded as a@002db@002dc to produce a file system-neutral directory\nname.\n\nWhen a MySQL installation is upgraded to MySQL 5.1 or later from an\nolder version,the server displays a name such as a-b-c (which is in the\nold format) as #mysql50#a-b-c, and you must refer to the name using the\n#mysql50# prefix. Use UPGRADE DATA DIRECTORY NAME in this case to\nexplicitly tell the server to re-encode the database directory name to\nthe current encoding format:\n\nALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;\n\nAfter executing this statement, you can refer to the database as a-b-c\nwithout the special #mysql50# prefix.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/alter-database.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/alter-database.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (213,25,'GEOMETRYN','GeometryN(gc,N)\n\nReturns the N-th geometry in the GeometryCollection value gc.\nGeometries are numbered beginning with 1.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#geometrycollection-property-functions\n\n','mysql> SET @gc = \'GeometryCollection(Point(1 1),LineString(2 2, 3 3))\';\nmysql> SELECT AsText(GeometryN(GeomFromText(@gc),1));\n+----------------------------------------+\n| AsText(GeometryN(GeomFromText(@gc),1)) |\n+----------------------------------------+\n| POINT(1 1) |\n+----------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#geometrycollection-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (214,19,'<<','Syntax:\n<<\n\nShifts a longlong (BIGINT) number to the left.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html\n\n','mysql> SELECT 1 << 2;\n -> 4\n','http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (215,26,'SHOW TABLE STATUS','Syntax:\nSHOW TABLE STATUS [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW TABLE STATUS works likes SHOW TABLES, but provides a lot of\ninformation about each non-TEMPORARY table. You can also get this list\nusing the mysqlshow --status db_name command. The LIKE clause, if\npresent, indicates which table names to match. The WHERE clause can be\ngiven to select rows using more general conditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-table-status.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-table-status.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (216,12,'MD5','Syntax:\nMD5(str)\n\nCalculates an MD5 128-bit checksum for the string. The value is\nreturned as a string of 32 hex digits, or NULL if the argument was\nNULL. The return value can, for example, be used as a hash key. See the\nnotes at the beginning of this section about storing hash values\nefficiently.\n\nAs of MySQL 5.5.3, the return value is a nonbinary string in the\nconnection character set. Before 5.5.3, the return value is a binary\nstring; see the notes at the beginning of this section about using the\nvalue as a nonbinary string.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','mysql> SELECT MD5(\'testing\');\n -> \'ae2b1fca515949e5d54fb22b8ed95575\'\n','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (217,18,'<','Syntax:\n<\n\nLess than:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 2 < 2;\n -> 0\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (218,31,'UNIX_TIMESTAMP','Syntax:\nUNIX_TIMESTAMP(), UNIX_TIMESTAMP(date)\n\nIf called with no argument, returns a Unix timestamp (seconds since\n\'1970-01-01 00:00:00\' UTC) as an unsigned integer. If UNIX_TIMESTAMP()\nis called with a date argument, it returns the value of the argument as\nseconds since \'1970-01-01 00:00:00\' UTC. date may be a DATE string, a\nDATETIME string, a TIMESTAMP, or a number in the format YYMMDD or\nYYYYMMDD. The server interprets date as a value in the current time\nzone and converts it to an internal value in UTC. Clients can set their\ntime zone as described in\nhttp://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT UNIX_TIMESTAMP();\n -> 1196440210\nmysql> SELECT UNIX_TIMESTAMP(\'2007-11-30 10:30:19\');\n -> 1196440219\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (219,31,'DAYOFMONTH','Syntax:\nDAYOFMONTH(date)\n\nReturns the day of the month for date, in the range 1 to 31, or 0 for\ndates such as \'0000-00-00\' or \'2008-00-00\' that have a zero day part.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT DAYOFMONTH(\'2007-02-03\');\n -> 3\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (220,37,'ASCII','Syntax:\nASCII(str)\n\nReturns the numeric value of the leftmost character of the string str.\nReturns 0 if str is the empty string. Returns NULL if str is NULL.\nASCII() works for 8-bit characters.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT ASCII(\'2\');\n -> 50\nmysql> SELECT ASCII(2);\n -> 50\nmysql> SELECT ASCII(\'dx\');\n -> 100\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (221,4,'DIV','Syntax:\nDIV\n\nInteger division. Similar to FLOOR(), but is safe with BIGINT values.\n\nAs of MySQL 5.5.3, if either operand has a noninteger type, the\noperands are converted to DECIMAL and divided using DECIMAL arithmetic\nbefore converting the result to BIGINT. If the result exceeds BIGINT\nrange, an error occurs. Before MySQL 5.5.3, incorrect results may occur\nfor noninteger operands that exceed BIGINT range.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html\n\n','mysql> SELECT 5 DIV 2;\n -> 2\n','http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (222,10,'RENAME USER','Syntax:\nRENAME USER old_user TO new_user\n [, old_user TO new_user] ...\n\nThe RENAME USER statement renames existing MySQL accounts. To use it,\nyou must have the global CREATE USER privilege or the UPDATE privilege\nfor the mysql database. An error occurs if any old account does not\nexist or any new account exists. Each account name uses the format\ndescribed in http://dev.mysql.com/doc/refman/5.5/en/account-names.html.\nFor example:\n\nRENAME USER \'jeffrey\'@\'localhost\' TO \'jeff\'@\'127.0.0.1\';\n\nIf you specify only the user name part of the account name, a host name\npart of \'%\' is used.\n\nRENAME USER causes the privileges held by the old user to be those held\nby the new user. However, RENAME USER does not automatically drop or\ninvalidate databases or objects within them that the old user created.\nThis includes stored programs or views for which the DEFINER attribute\nnames the old user. Attempts to access such objects may produce an\nerror if they execute in definer security context. (For information\nabout security context, see\nhttp://dev.mysql.com/doc/refman/5.5/en/stored-programs-security.html.)\n\nThe privilege changes take effect as indicated in\nhttp://dev.mysql.com/doc/refman/5.5/en/privilege-changes.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/rename-user.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/rename-user.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (223,26,'SHOW SLAVE STATUS','Syntax:\nSHOW SLAVE STATUS\n\nThis statement provides status information on essential parameters of\nthe slave threads. It requires either the SUPER or REPLICATION CLIENT\nprivilege.\n\nIf you issue this statement using the mysql client, you can use a \\G\nstatement terminator rather than a semicolon to obtain a more readable\nvertical layout:\n\nmysql> SHOW SLAVE STATUS\\G\n*************************** 1. row ***************************\n Slave_IO_State: Waiting for master to send event\n Master_Host: localhost\n Master_User: root\n Master_Port: 3306\n Connect_Retry: 3\n Master_Log_File: gbichot-bin.005\n Read_Master_Log_Pos: 79\n Relay_Log_File: gbichot-relay-bin.005\n Relay_Log_Pos: 548\n Relay_Master_Log_File: gbichot-bin.005\n Slave_IO_Running: Yes\n Slave_SQL_Running: Yes\n Replicate_Do_DB:\n Replicate_Ignore_DB:\n Replicate_Do_Table:\n Replicate_Ignore_Table:\n Replicate_Wild_Do_Table:\n Replicate_Wild_Ignore_Table:\n Last_Errno: 0\n Last_Error:\n Skip_Counter: 0\n Exec_Master_Log_Pos: 79\n Relay_Log_Space: 552\n Until_Condition: None\n Until_Log_File:\n Until_Log_Pos: 0\n Master_SSL_Allowed: No\n Master_SSL_CA_File:\n Master_SSL_CA_Path:\n Master_SSL_Cert:\n Master_SSL_Cipher:\n Master_SSL_Key:\n Seconds_Behind_Master: 8\nMaster_SSL_Verify_Server_Cert: No\n Last_IO_Errno: 0\n Last_IO_Error:\n Last_SQL_Errno: 0\n Last_SQL_Error:\n Replicate_Ignore_Server_Ids: 0\n Master_Server_Id: 1\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-slave-status.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-slave-status.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (224,34,'GEOMETRY','MySQL provides a standard way of creating spatial columns for geometry\ntypes, for example, with CREATE TABLE or ALTER TABLE. Currently,\nspatial columns are supported for MyISAM, InnoDB, NDB, and ARCHIVE\ntables. See also the annotations about spatial indexes under [HELP\nSPATIAL].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-columns.html\n\n','CREATE TABLE geom (g GEOMETRY);\n','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-columns.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (225,13,'NUMPOINTS','NumPoints(ls)\n\nReturns the number of Point objects in the LineString value ls.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#linestring-property-functions\n\n','mysql> SET @ls = \'LineString(1 1,2 2,3 3)\';\nmysql> SELECT NumPoints(GeomFromText(@ls));\n+------------------------------+\n| NumPoints(GeomFromText(@ls)) |\n+------------------------------+\n| 3 |\n+------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#linestring-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (226,39,'ALTER LOGFILE GROUP','Syntax:\nALTER LOGFILE GROUP logfile_group\n ADD UNDOFILE \'file_name\'\n [INITIAL_SIZE [=] size]\n [WAIT]\n ENGINE [=] engine_name\n\nThis statement adds an UNDO file named \'file_name\' to an existing log\nfile group logfile_group. An ALTER LOGFILE GROUP statement has one and\nonly one ADD UNDOFILE clause. No DROP UNDOFILE clause is currently\nsupported.\n\n*Note*: All MySQL Cluster Disk Data objects share the same namespace.\nThis means that each Disk Data object must be uniquely named (and not\nmerely each Disk Data object of a given type). For example, you cannot\nhave a tablespace and an undo log file with the same name, or an undo\nlog file and a data file with the same name.\n\nThe optional INITIAL_SIZE parameter sets the UNDO file\'s initial size\nin bytes; if not specified, the initial size default to 128M (128\nmegabytes). You may optionally follow size with a one-letter\nabbreviation for an order of magnitude, similar to those used in\nmy.cnf. Generally, this is one of the letters M (for megabytes) or G\n(for gigabytes).\n\nOn 32-bit systems, the maximum supported value for INITIAL_SIZE is 4G.\n(Bug #29186)\n\nThe minimum permitted value for INITIAL_SIZE is 1M. (Bug #29574)\n\n*Note*: WAIT is parsed but otherwise ignored. This keyword currently\nhas no effect, and is intended for future expansion.\n\nThe ENGINE parameter (required) determines the storage engine which is\nused by this log file group, with engine_name being the name of the\nstorage engine. Currently, the only accepted values for engine_name are\n"NDBCLUSTER" and "NDB". The two values are equivalent.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/alter-logfile-group.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/alter-logfile-group.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (227,19,'&','Syntax:\n&\n\nBitwise AND:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html\n\n','mysql> SELECT 29 & 15;\n -> 13\n','http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (228,31,'LOCALTIMESTAMP','Syntax:\nLOCALTIMESTAMP, LOCALTIMESTAMP()\n\nLOCALTIMESTAMP and LOCALTIMESTAMP() are synonyms for NOW().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (229,15,'ASSIGN-EQUAL','Syntax:\n=\n\nThis operator is used to perform value assignments in two cases,\ndescribed in the next two paragraphs.\n\nWithin a SET statement, = is treated as an assignment operator that\ncauses the user variable on the left hand side of the operator to take\non the value to its right. (In other words, when used in a SET\nstatement, = is treated identically to :=.) The value on the right hand\nside may be a literal value, another variable storing a value, or any\nlegal expression that yields a scalar value, including the result of a\nquery (provided that this value is a scalar value). You can perform\nmultiple assignments in the same SET statement.\n\nIn the SET clause of an UPDATE statement, = also acts as an assignment\noperator; in this case, however, it causes the column named on the left\nhand side of the operator to assume the value given to the right,\nprovided any WHERE conditions that are part of the UPDATE are met. You\ncan make multiple assignments in the same SET clause of an UPDATE\nstatement.\n\nIn any other context, = is treated as a comparison operator.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/assignment-operators.html\n\n','mysql> SELECT @var1, @var2;\n -> NULL, NULL\nmysql> SELECT @var1 := 1, @var2;\n -> 1, NULL\nmysql> SELECT @var1, @var2;\n -> 1, NULL\nmysql> SELECT @var1, @var2 := @var1;\n -> 1, 1\nmysql> SELECT @var1, @var2;\n -> 1, 1\n','http://dev.mysql.com/doc/refman/5.5/en/assignment-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (230,37,'CONVERT','Syntax:\nCONVERT(expr,type), CONVERT(expr USING transcoding_name)\n\nThe CONVERT() and CAST() functions take an expression of any type and\nproduce a result value of a specified type.\n\nThe type for the result can be one of the following values:\n\no BINARY[(N)]\n\no CHAR[(N)]\n\no DATE\n\no DATETIME\n\no DECIMAL[(M[,D])]\n\no SIGNED [INTEGER]\n\no TIME\n\no UNSIGNED [INTEGER]\n\nBINARY produces a string with the BINARY data type. See\nhttp://dev.mysql.com/doc/refman/5.5/en/binary-varbinary.html for a\ndescription of how this affects comparisons. If the optional length N\nis given, BINARY(N) causes the cast to use no more than N bytes of the\nargument. Values shorter than N bytes are padded with 0x00 bytes to a\nlength of N.\n\nCHAR(N) causes the cast to use no more than N characters of the\nargument.\n\nCAST() and CONVERT(... USING ...) are standard SQL syntax. The\nnon-USING form of CONVERT() is ODBC syntax.\n\nCONVERT() with USING is used to convert data between different\ncharacter sets. In MySQL, transcoding names are the same as the\ncorresponding character set names. For example, this statement converts\nthe string \'abc\' in the default character set to the corresponding\nstring in the utf8 character set:\n\nSELECT CONVERT(\'abc\' USING utf8);\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/cast-functions.html\n\n','SELECT enum_col FROM tbl_name ORDER BY CAST(enum_col AS CHAR);\n','http://dev.mysql.com/doc/refman/5.5/en/cast-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (231,31,'ADDDATE','Syntax:\nADDDATE(date,INTERVAL expr unit), ADDDATE(expr,days)\n\nWhen invoked with the INTERVAL form of the second argument, ADDDATE()\nis a synonym for DATE_ADD(). The related function SUBDATE() is a\nsynonym for DATE_SUB(). For information on the INTERVAL unit argument,\nsee the discussion for DATE_ADD().\n\nmysql> SELECT DATE_ADD(\'2008-01-02\', INTERVAL 31 DAY);\n -> \'2008-02-02\'\nmysql> SELECT ADDDATE(\'2008-01-02\', INTERVAL 31 DAY);\n -> \'2008-02-02\'\n\nWhen invoked with the days form of the second argument, MySQL treats it\nas an integer number of days to be added to expr.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT ADDDATE(\'2008-01-02\', 31);\n -> \'2008-02-02\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (232,23,'REPEAT LOOP','Syntax:\n[begin_label:] REPEAT\n statement_list\nUNTIL search_condition\nEND REPEAT [end_label]\n\nThe statement list within a REPEAT statement is repeated until the\nsearch_condition expression is true. Thus, a REPEAT always enters the\nloop at least once. statement_list consists of one or more statements,\neach terminated by a semicolon (;) statement delimiter.\n\nA REPEAT statement can be labeled. For the rules regarding label use,\nsee [HELP labels].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/repeat.html\n\n','mysql> delimiter //\n\nmysql> CREATE PROCEDURE dorepeat(p1 INT)\n -> BEGIN\n -> SET @x = 0;\n -> REPEAT\n -> SET @x = @x + 1;\n -> UNTIL @x > p1 END REPEAT;\n -> END\n -> //\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> CALL dorepeat(1000)//\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SELECT @x//\n+------+\n| @x |\n+------+\n| 1001 |\n+------+\n1 row in set (0.00 sec)\n','http://dev.mysql.com/doc/refman/5.5/en/repeat.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (233,39,'ALTER FUNCTION','Syntax:\nALTER FUNCTION func_name [characteristic ...]\n\ncharacteristic:\n COMMENT \'string\'\n | LANGUAGE SQL\n | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }\n | SQL SECURITY { DEFINER | INVOKER }\n\nThis statement can be used to change the characteristics of a stored\nfunction. More than one change may be specified in an ALTER FUNCTION\nstatement. However, you cannot change the parameters or body of a\nstored function using this statement; to make such changes, you must\ndrop and re-create the function using DROP FUNCTION and CREATE\nFUNCTION.\n\nYou must have the ALTER ROUTINE privilege for the function. (That\nprivilege is granted automatically to the function creator.) If binary\nlogging is enabled, the ALTER FUNCTION statement might also require the\nSUPER privilege, as described in\nhttp://dev.mysql.com/doc/refman/5.5/en/stored-programs-logging.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/alter-function.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/alter-function.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (234,22,'SMALLINT','SMALLINT[(M)] [UNSIGNED] [ZEROFILL]\n\nA small integer. The signed range is -32768 to 32767. The unsigned\nrange is 0 to 65535.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (235,22,'DOUBLE PRECISION','DOUBLE PRECISION[(M,D)] [UNSIGNED] [ZEROFILL], REAL[(M,D)] [UNSIGNED]\n[ZEROFILL]\n\nThese types are synonyms for DOUBLE. Exception: If the REAL_AS_FLOAT\nSQL mode is enabled, REAL is a synonym for FLOAT rather than DOUBLE.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (236,37,'ORD','Syntax:\nORD(str)\n\nIf the leftmost character of the string str is a multi-byte character,\nreturns the code for that character, calculated from the numeric values\nof its constituent bytes using this formula:\n\n (1st byte code)\n+ (2nd byte code * 256)\n+ (3rd byte code * 2562) ...\n\nIf the leftmost character is not a multi-byte character, ORD() returns\nthe same value as the ASCII() function.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT ORD(\'2\');\n -> 50\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (237,8,'DEALLOCATE PREPARE','Syntax:\n{DEALLOCATE | DROP} PREPARE stmt_name\n\nTo deallocate a prepared statement produced with PREPARE, use a\nDEALLOCATE PREPARE statement that refers to the prepared statement\nname. Attempting to execute a prepared statement after deallocating it\nresults in an error.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/deallocate-prepare.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/deallocate-prepare.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (238,36,'ENVELOPE','Envelope(g)\n\nReturns the Minimum Bounding Rectangle (MBR) for the geometry value g.\nThe result is returned as a Polygon value.\n\nThe polygon is defined by the corner points of the bounding box:\n\nPOLYGON((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions\n\n','mysql> SELECT AsText(Envelope(GeomFromText(\'LineString(1 1,2 2)\')));\n+-------------------------------------------------------+\n| AsText(Envelope(GeomFromText(\'LineString(1 1,2 2)\'))) |\n+-------------------------------------------------------+\n| POLYGON((1 1,2 1,2 2,1 2,1 1)) |\n+-------------------------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (239,14,'IS_FREE_LOCK','Syntax:\nIS_FREE_LOCK(str)\n\nChecks whether the lock named str is free to use (that is, not locked).\nReturns 1 if the lock is free (no one is using the lock), 0 if the lock\nis in use, and NULL if an error occurs (such as an incorrect argument).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (240,30,'TOUCHES','Touches(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 spatially touches g2. Two\ngeometries spatially touch if the interiors of the geometries do not\nintersect, but the boundary of one of the geometries intersects either\nthe boundary or the interior of the other.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (241,14,'INET_ATON','Syntax:\nINET_ATON(expr)\n\nGiven the dotted-quad representation of an IPv4 network address as a\nstring, returns an integer that represents the numeric value of the\naddress in network byte order (big endian). INET_ATON() returns NULL if\nit does not understand its argument.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','mysql> SELECT INET_ATON(\'10.0.5.9\');\n -> 167773449\n','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (242,12,'UNCOMPRESS','Syntax:\nUNCOMPRESS(string_to_uncompress)\n\nUncompresses a string compressed by the COMPRESS() function. If the\nargument is not a compressed value, the result is NULL. This function\nrequires MySQL to have been compiled with a compression library such as\nzlib. Otherwise, the return value is always NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','mysql> SELECT UNCOMPRESS(COMPRESS(\'any string\'));\n -> \'any string\'\nmysql> SELECT UNCOMPRESS(\'any string\');\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (243,22,'AUTO_INCREMENT','The AUTO_INCREMENT attribute can be used to generate a unique identity\nfor new rows:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/example-auto-increment.html\n\n','CREATE TABLE animals (\n id MEDIUMINT NOT NULL AUTO_INCREMENT,\n name CHAR(30) NOT NULL,\n PRIMARY KEY (id)\n);\n\nINSERT INTO animals (name) VALUES\n (\'dog\'),(\'cat\'),(\'penguin\'),\n (\'lax\'),(\'whale\'),(\'ostrich\');\n\nSELECT * FROM animals;\n','http://dev.mysql.com/doc/refman/5.5/en/example-auto-increment.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (244,36,'ISSIMPLE','IsSimple(g)\n\nCurrently, this function is a placeholder and should not be used. If\nimplemented, its behavior will be as described in the next paragraph.\n\nReturns 1 if the geometry value g has no anomalous geometric points,\nsuch as self-intersection or self-tangency. IsSimple() returns 0 if the\nargument is not simple, and -1 if it is NULL.\n\nThe description of each instantiable geometric class given earlier in\nthe chapter includes the specific conditions that cause an instance of\nthat class to be classified as not simple. (See [HELP Geometry\nhierarchy].)\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (245,4,'- BINARY','Syntax:\n-\n\nSubtraction:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html\n\n','mysql> SELECT 3-5;\n -> -2\n','http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (246,3,'GEOMCOLLFROMTEXT','GeomCollFromText(wkt[,srid]), GeometryCollectionFromText(wkt[,srid])\n\nConstructs a GEOMETRYCOLLECTION value using its WKT representation and\nSRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (247,3,'WKT DEFINITION','The Well-Known Text (WKT) representation of Geometry is designed to\nexchange geometry data in ASCII form. For a Backus-Naur grammar that\nspecifies the formal production rules for writing WKT values, see the\nOpenGIS specification document referenced in\nhttp://dev.mysql.com/doc/refman/5.5/en/spatial-extensions.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/gis-wkt-format.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/gis-wkt-format.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (248,31,'CURRENT_TIME','Syntax:\nCURRENT_TIME, CURRENT_TIME()\n\nCURRENT_TIME and CURRENT_TIME() are synonyms for CURTIME().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (249,10,'REVOKE','Syntax:\nREVOKE\n priv_type [(column_list)]\n [, priv_type [(column_list)]] ...\n ON [object_type] priv_level\n FROM user [, user] ...\n\nREVOKE ALL PRIVILEGES, GRANT OPTION\n FROM user [, user] ...\n\nREVOKE PROXY ON user\n FROM user [, user] ...\n\nThe REVOKE statement enables system administrators to revoke privileges\nfrom MySQL accounts. Each account name uses the format described in\nhttp://dev.mysql.com/doc/refman/5.5/en/account-names.html. For example:\n\nREVOKE INSERT ON *.* FROM \'jeffrey\'@\'localhost\';\n\nIf you specify only the user name part of the account name, a host name\npart of \'%\' is used.\n\nFor details on the levels at which privileges exist, the permissible\npriv_type and priv_level values, and the syntax for specifying users\nand passwords, see [HELP GRANT]\n\nTo use the first REVOKE syntax, you must have the GRANT OPTION\nprivilege, and you must have the privileges that you are revoking.\n\nTo revoke all privileges, use the second syntax, which drops all\nglobal, database, table, column, and routine privileges for the named\nuser or users:\n\nREVOKE ALL PRIVILEGES, GRANT OPTION FROM user [, user] ...\n\nTo use this REVOKE syntax, you must have the global CREATE USER\nprivilege or the UPDATE privilege for the mysql database.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/revoke.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/revoke.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (250,17,'LAST_INSERT_ID','Syntax:\nLAST_INSERT_ID(), LAST_INSERT_ID(expr)\n\nLAST_INSERT_ID() (with no argument) returns a BIGINT (64-bit) value\nrepresenting the first automatically generated value successfully\ninserted for an AUTO_INCREMENT column as a result of the most recently\nexecuted INSERT statement. The value of LAST_INSERT_ID() remains\nunchanged if no rows are successfully inserted.\n\nFor example, after inserting a row that generates an AUTO_INCREMENT\nvalue, you can get the value like this:\n\nmysql> SELECT LAST_INSERT_ID();\n -> 195\n\nThe currently executing statement does not affect the value of\nLAST_INSERT_ID(). Suppose that you generate an AUTO_INCREMENT value\nwith one statement, and then refer to LAST_INSERT_ID() in a\nmultiple-row INSERT statement that inserts rows into a table with its\nown AUTO_INCREMENT column. The value of LAST_INSERT_ID() will remain\nstable in the second statement; its value for the second and later rows\nis not affected by the earlier row insertions. (However, if you mix\nreferences to LAST_INSERT_ID() and LAST_INSERT_ID(expr), the effect is\nundefined.)\n\nIf the previous statement returned an error, the value of\nLAST_INSERT_ID() is undefined. For transactional tables, if the\nstatement is rolled back due to an error, the value of LAST_INSERT_ID()\nis left undefined. For manual ROLLBACK, the value of LAST_INSERT_ID()\nis not restored to that before the transaction; it remains as it was at\nthe point of the ROLLBACK.\n\nWithin the body of a stored routine (procedure or function) or a\ntrigger, the value of LAST_INSERT_ID() changes the same way as for\nstatements executed outside the body of these kinds of objects. The\neffect of a stored routine or trigger upon the value of\nLAST_INSERT_ID() that is seen by following statements depends on the\nkind of routine:\n\no If a stored procedure executes statements that change the value of\n LAST_INSERT_ID(), the changed value is seen by statements that follow\n the procedure call.\n\no For stored functions and triggers that change the value, the value is\n restored when the function or trigger ends, so following statements\n will not see a changed value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (251,31,'LAST_DAY','Syntax:\nLAST_DAY(date)\n\nTakes a date or datetime value and returns the corresponding value for\nthe last day of the month. Returns NULL if the argument is invalid.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT LAST_DAY(\'2003-02-05\');\n -> \'2003-02-28\'\nmysql> SELECT LAST_DAY(\'2004-02-05\');\n -> \'2004-02-29\'\nmysql> SELECT LAST_DAY(\'2004-01-01 01:01:01\');\n -> \'2004-01-31\'\nmysql> SELECT LAST_DAY(\'2003-03-32\');\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (252,22,'MEDIUMINT','MEDIUMINT[(M)] [UNSIGNED] [ZEROFILL]\n\nA medium-sized integer. The signed range is -8388608 to 8388607. The\nunsigned range is 0 to 16777215.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (253,4,'FLOOR','Syntax:\nFLOOR(X)\n\nReturns the largest integer value not greater than X.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT FLOOR(1.23);\n -> 1\nmysql> SELECT FLOOR(-1.23);\n -> -2\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (254,37,'RTRIM','Syntax:\nRTRIM(str)\n\nReturns the string str with trailing space characters removed.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT RTRIM(\'barbar \');\n -> \'barbar\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (255,28,'EXPLAIN','Syntax:\nEXPLAIN [explain_type] SELECT select_options\n\nexplain_type:\n EXTENDED\n | PARTITIONS\n\nOr:\n\nEXPLAIN tbl_name\n\nThe EXPLAIN statement can be used either as a way to obtain information\nabout how MySQL executes a statement, or as a synonym for DESCRIBE:\n\no When you precede a SELECT statement with the keyword EXPLAIN, MySQL\n displays information from the optimizer about the query execution\n plan. That is, MySQL explains how it would process the statement,\n including information about how tables are joined and in which order.\n EXPLAIN EXTENDED can be used to obtain additional information.\n\n For information about using EXPLAIN and EXPLAIN EXTENDED to obtain\n query execution plan information, see\n http://dev.mysql.com/doc/refman/5.5/en/using-explain.html.\n\no EXPLAIN PARTITIONS is useful only when examining queries involving\n partitioned tables. For details, see\n http://dev.mysql.com/doc/refman/5.5/en/partitioning-info.html.\n\no EXPLAIN tbl_name is synonymous with DESCRIBE tbl_name or SHOW COLUMNS\n FROM tbl_name. For information about DESCRIBE and SHOW COLUMNS, see\n [HELP DESCRIBE], and [HELP SHOW COLUMNS].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/explain.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/explain.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (256,4,'DEGREES','Syntax:\nDEGREES(X)\n\nReturns the argument X, converted from radians to degrees.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT DEGREES(PI());\n -> 180\nmysql> SELECT DEGREES(PI() / 2);\n -> 90\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (257,22,'VARCHAR','[NATIONAL] VARCHAR(M) [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n\nA variable-length string. M represents the maximum column length in\ncharacters. The range of M is 0 to 65,535. The effective maximum length\nof a VARCHAR is subject to the maximum row size (65,535 bytes, which is\nshared among all columns) and the character set used. For example, utf8\ncharacters can require up to three bytes per character, so a VARCHAR\ncolumn that uses the utf8 character set can be declared to be a maximum\nof 21,844 characters. See\nhttp://dev.mysql.com/doc/refman/5.5/en/column-count-limit.html.\n\nMySQL stores VARCHAR values as a 1-byte or 2-byte length prefix plus\ndata. The length prefix indicates the number of bytes in the value. A\nVARCHAR column uses one length byte if values require no more than 255\nbytes, two length bytes if values may require more than 255 bytes.\n\n*Note*: MySQL 5.5 follows the standard SQL specification, and does not\nremove trailing spaces from VARCHAR values.\n\nVARCHAR is shorthand for CHARACTER VARYING. NATIONAL VARCHAR is the\nstandard SQL way to define that a VARCHAR column should use some\npredefined character set. MySQL 4.1 and up uses utf8 as this predefined\ncharacter set.\nhttp://dev.mysql.com/doc/refman/5.5/en/charset-national.html. NVARCHAR\nis shorthand for NATIONAL VARCHAR.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (258,37,'UNHEX','Syntax:\n\nUNHEX(str)\n\nFor a string argument str, UNHEX(str) performs the inverse operation of\nHEX(str). That is, it interprets each pair of characters in the\nargument as a hexadecimal number and converts it to the character\nrepresented by the number. The return value is a binary string.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT UNHEX(\'4D7953514C\');\n -> \'MySQL\'\nmysql> SELECT 0x4D7953514C;\n -> \'MySQL\'\nmysql> SELECT UNHEX(HEX(\'string\'));\n -> \'string\'\nmysql> SELECT HEX(UNHEX(\'1267\'));\n -> \'1267\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (259,4,'- UNARY','Syntax:\n-\n\nUnary minus. This operator changes the sign of the operand.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html\n\n','mysql> SELECT - 2;\n -> -2\n','http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (260,16,'STD','Syntax:\nSTD(expr)\n\nReturns the population standard deviation of expr. This is an extension\nto standard SQL. The standard SQL function STDDEV_POP() can be used\ninstead.\n\nThis function returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (261,4,'COS','Syntax:\nCOS(X)\n\nReturns the cosine of X, where X is given in radians.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT COS(PI());\n -> -1\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (262,31,'DATE FUNCTION','Syntax:\nDATE(expr)\n\nExtracts the date part of the date or datetime expression expr.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT DATE(\'2003-12-31 01:02:03\');\n -> \'2003-12-31\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (263,39,'DROP TRIGGER','Syntax:\nDROP TRIGGER [IF EXISTS] [schema_name.]trigger_name\n\nThis statement drops a trigger. The schema (database) name is optional.\nIf the schema is omitted, the trigger is dropped from the default\nschema. DROP TRIGGER requires the TRIGGER privilege for the table\nassociated with the trigger.\n\nUse IF EXISTS to prevent an error from occurring for a trigger that\ndoes not exist. A NOTE is generated for a nonexistent trigger when\nusing IF EXISTS. See [HELP SHOW WARNINGS].\n\nTriggers for a table are also dropped if you drop the table.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-trigger.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-trigger.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (264,8,'RESET MASTER','Syntax:\nRESET MASTER\n\nDeletes all binary log files listed in the index file, resets the\nbinary log index file to be empty, and creates a new binary log file.\nThis statement is intended to be used only when the master is started\nfor the first time.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/reset-master.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/reset-master.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (265,4,'TAN','Syntax:\nTAN(X)\n\nReturns the tangent of X, where X is given in radians.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT TAN(PI());\n -> -1.2246063538224e-16\nmysql> SELECT TAN(PI()+1);\n -> 1.5574077246549\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (266,4,'PI','Syntax:\nPI()\n\nReturns the value of π (pi). The default number of decimal places\ndisplayed is seven, but MySQL uses the full double-precision value\ninternally.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT PI();\n -> 3.141593\nmysql> SELECT PI()+0.000000000000000000;\n -> 3.141592653589793116\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (267,31,'WEEKOFYEAR','Syntax:\nWEEKOFYEAR(date)\n\nReturns the calendar week of the date as a number in the range from 1\nto 53. WEEKOFYEAR() is a compatibility function that is equivalent to\nWEEK(date,3).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT WEEKOFYEAR(\'2008-02-20\');\n -> 8\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (268,4,'/','Syntax:\n/\n\nDivision:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html\n\n','mysql> SELECT 3/5;\n -> 0.60\n','http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (269,8,'PURGE BINARY LOGS','Syntax:\nPURGE { BINARY | MASTER } LOGS\n { TO \'log_name\' | BEFORE datetime_expr }\n\nThe binary log is a set of files that contain information about data\nmodifications made by the MySQL server. The log consists of a set of\nbinary log files, plus an index file (see\nhttp://dev.mysql.com/doc/refman/5.5/en/binary-log.html).\n\nThe PURGE BINARY LOGS statement deletes all the binary log files listed\nin the log index file prior to the specified log file name or date.\nBINARY and MASTER are synonyms. Deleted log files also are removed from\nthe list recorded in the index file, so that the given log file becomes\nthe first in the list.\n\nThis statement has no effect if the server was not started with the\n--log-bin option to enable binary logging.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/purge-binary-logs.html\n\n','PURGE BINARY LOGS TO \'mysql-bin.010\';\nPURGE BINARY LOGS BEFORE \'2008-04-02 22:46:26\';\n','http://dev.mysql.com/doc/refman/5.5/en/purge-binary-logs.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (270,16,'STDDEV_SAMP','Syntax:\nSTDDEV_SAMP(expr)\n\nReturns the sample standard deviation of expr (the square root of\nVAR_SAMP().\n\nSTDDEV_SAMP() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (271,17,'SCHEMA','Syntax:\nSCHEMA()\n\nThis function is a synonym for DATABASE().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (272,32,'MLINEFROMWKB','MLineFromWKB(wkb[,srid]), MultiLineStringFromWKB(wkb[,srid])\n\nConstructs a MULTILINESTRING value using its WKB representation and\nSRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (273,4,'LOG2','Syntax:\nLOG2(X)\n\nReturns the base-2 logarithm of X.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT LOG2(65536);\n -> 16\nmysql> SELECT LOG2(-100);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (274,31,'SUBTIME','Syntax:\nSUBTIME(expr1,expr2)\n\nSUBTIME() returns expr1 - expr2 expressed as a value in the same format\nas expr1. expr1 is a time or datetime expression, and expr2 is a time\nexpression.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT SUBTIME(\'2007-12-31 23:59:59.999999\',\'1 1:1:1.000002\');\n -> \'2007-12-30 22:58:58.999997\'\nmysql> SELECT SUBTIME(\'01:00:00.999999\', \'02:00:00.999998\');\n -> \'-00:59:59.999999\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (275,12,'UNCOMPRESSED_LENGTH','Syntax:\nUNCOMPRESSED_LENGTH(compressed_string)\n\nReturns the length that the compressed string had before being\ncompressed.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','mysql> SELECT UNCOMPRESSED_LENGTH(COMPRESS(REPEAT(\'a\',30)));\n -> 30\n','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (276,39,'DROP TABLE','Syntax:\nDROP [TEMPORARY] TABLE [IF EXISTS]\n tbl_name [, tbl_name] ...\n [RESTRICT | CASCADE]\n\nDROP TABLE removes one or more tables. You must have the DROP privilege\nfor each table. All table data and the table definition are removed, so\nbe careful with this statement! If any of the tables named in the\nargument list do not exist, MySQL returns an error indicating by name\nwhich nonexisting tables it was unable to drop, but it also drops all\nof the tables in the list that do exist.\n\n*Important*: When a table is dropped, user privileges on the table are\nnot automatically dropped. See [HELP GRANT].\n\nNote that for a partitioned table, DROP TABLE permanently removes the\ntable definition, all of its partitions, and all of the data which was\nstored in those partitions. It also removes the partitioning definition\n(.par) file associated with the dropped table.\n\nUse IF EXISTS to prevent an error from occurring for tables that do not\nexist. A NOTE is generated for each nonexistent table when using IF\nEXISTS. See [HELP SHOW WARNINGS].\n\nRESTRICT and CASCADE are permitted to make porting easier. In MySQL\n5.5, they do nothing.\n\n*Note*: DROP TABLE automatically commits the current active\ntransaction, unless you use the TEMPORARY keyword.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-table.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (277,4,'POW','Syntax:\nPOW(X,Y)\n\nReturns the value of X raised to the power of Y.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT POW(2,2);\n -> 4\nmysql> SELECT POW(2,-2);\n -> 0.25\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (278,26,'SHOW CREATE TABLE','Syntax:\nSHOW CREATE TABLE tbl_name\n\nShows the CREATE TABLE statement that creates the given table. To use\nthis statement, you must have some privilege for the table. This\nstatement also works with views.\nSHOW CREATE TABLE quotes table and column names according to the value\nof the sql_quote_show_create option. See\nhttp://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-create-table.html\n\n','mysql> SHOW CREATE TABLE t\\G\n*************************** 1. row ***************************\n Table: t\nCreate Table: CREATE TABLE t (\n id INT(11) default NULL auto_increment,\n s char(60) default NULL,\n PRIMARY KEY (id)\n) ENGINE=MyISAM\n','http://dev.mysql.com/doc/refman/5.5/en/show-create-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (279,27,'DUAL','You are permitted to specify DUAL as a dummy table name in situations\nwhere no tables are referenced:\n\nmysql> SELECT 1 + 1 FROM DUAL;\n -> 2\n\nDUAL is purely for the convenience of people who require that all\nSELECT statements should have FROM and possibly other clauses. MySQL\nmay ignore the clauses. MySQL does not require FROM DUAL if no tables\nare referenced.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/select.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/select.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (280,37,'INSTR','Syntax:\nINSTR(str,substr)\n\nReturns the position of the first occurrence of substring substr in\nstring str. This is the same as the two-argument form of LOCATE(),\nexcept that the order of the arguments is reversed.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT INSTR(\'foobarbar\', \'bar\');\n -> 4\nmysql> SELECT INSTR(\'xbar\', \'foobar\');\n -> 0\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (281,31,'NOW','Syntax:\nNOW()\n\nReturns the current date and time as a value in \'YYYY-MM-DD HH:MM:SS\'\nor YYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is\nused in a string or numeric context. The value is expressed in the\ncurrent time zone.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT NOW();\n -> \'2007-12-15 23:50:26\'\nmysql> SELECT NOW() + 0;\n -> 20071215235026.000000\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (282,26,'SHOW ENGINES','Syntax:\nSHOW [STORAGE] ENGINES\n\nSHOW ENGINES displays status information about the server\'s storage\nengines. This is particularly useful for checking whether a storage\nengine is supported, or to see what the default engine is.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-engines.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-engines.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (283,18,'>=','Syntax:\n>=\n\nGreater than or equal:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 2 >= 2;\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (284,4,'EXP','Syntax:\nEXP(X)\n\nReturns the value of e (the base of natural logarithms) raised to the\npower of X. The inverse of this function is LOG() (using a single\nargument only) or LN().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT EXP(2);\n -> 7.3890560989307\nmysql> SELECT EXP(-2);\n -> 0.13533528323661\nmysql> SELECT EXP(0);\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (285,22,'LONGBLOB','LONGBLOB\n\nA BLOB column with a maximum length of 4,294,967,295 or 4GB (232 - 1)\nbytes. The effective maximum length of LONGBLOB columns depends on the\nconfigured maximum packet size in the client/server protocol and\navailable memory. Each LONGBLOB value is stored using a 4-byte length\nprefix that indicates the number of bytes in the value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (286,13,'POINTN','PointN(ls,N)\n\nReturns the N-th Point in the Linestring value ls. Points are numbered\nbeginning with 1.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#linestring-property-functions\n\n','mysql> SET @ls = \'LineString(1 1,2 2,3 3)\';\nmysql> SELECT AsText(PointN(GeomFromText(@ls),2));\n+-------------------------------------+\n| AsText(PointN(GeomFromText(@ls),2)) |\n+-------------------------------------+\n| POINT(2 2) |\n+-------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#linestring-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (287,22,'YEAR DATA TYPE','YEAR[(2|4)]\n\nA year in two-digit or four-digit format. The default is four-digit\nformat. YEAR(2) or YEAR(4) differ in display format, but have the same\nrange of values. In four-digit format, values display as 1901 to 2155,\nand 0000. In two-digit format, values display as 70 to 69, representing\nyears from 1970 to 2069. MySQL displays YEAR values in YYYY or\nYYformat, but permits assignment of values to YEAR columns using either\nstrings or numbers.\n\n*Note*: The YEAR(2) data type has certain issues that you should\nconsider before choosing to use it. As of MySQL 5.5.27, YEAR(2) is\ndeprecated. For more information, see\nhttp://dev.mysql.com/doc/refman/5.5/en/migrating-to-year4.html.\n\nFor additional information about YEAR display format and inerpretation\nof input values, see http://dev.mysql.com/doc/refman/5.5/en/year.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (288,16,'SUM','Syntax:\nSUM([DISTINCT] expr)\n\nReturns the sum of expr. If the return set has no rows, SUM() returns\nNULL. The DISTINCT keyword can be used to sum only the distinct values\nof expr.\n\nSUM() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (289,37,'OCT','Syntax:\nOCT(N)\n\nReturns a string representation of the octal value of N, where N is a\nlonglong (BIGINT) number. This is equivalent to CONV(N,10,8). Returns\nNULL if N is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT OCT(12);\n -> \'14\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (290,31,'SYSDATE','Syntax:\nSYSDATE()\n\nReturns the current date and time as a value in \'YYYY-MM-DD HH:MM:SS\'\nor YYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is\nused in a string or numeric context.\n\nSYSDATE() returns the time at which it executes. This differs from the\nbehavior for NOW(), which returns a constant time that indicates the\ntime at which the statement began to execute. (Within a stored function\nor trigger, NOW() returns the time at which the function or triggering\nstatement began to execute.)\n\nmysql> SELECT NOW(), SLEEP(2), NOW();\n+---------------------+----------+---------------------+\n| NOW() | SLEEP(2) | NOW() |\n+---------------------+----------+---------------------+\n| 2006-04-12 13:47:36 | 0 | 2006-04-12 13:47:36 |\n+---------------------+----------+---------------------+\n\nmysql> SELECT SYSDATE(), SLEEP(2), SYSDATE();\n+---------------------+----------+---------------------+\n| SYSDATE() | SLEEP(2) | SYSDATE() |\n+---------------------+----------+---------------------+\n| 2006-04-12 13:47:44 | 0 | 2006-04-12 13:47:46 |\n+---------------------+----------+---------------------+\n\nIn addition, the SET TIMESTAMP statement affects the value returned by\nNOW() but not by SYSDATE(). This means that timestamp settings in the\nbinary log have no effect on invocations of SYSDATE().\n\nBecause SYSDATE() can return different values even within the same\nstatement, and is not affected by SET TIMESTAMP, it is nondeterministic\nand therefore unsafe for replication if statement-based binary logging\nis used. If that is a problem, you can use row-based logging.\n\nAlternatively, you can use the --sysdate-is-now option to cause\nSYSDATE() to be an alias for NOW(). This works if the option is used on\nboth the master and the slave.\n\nThe nondeterministic nature of SYSDATE() also means that indexes cannot\nbe used for evaluating expressions that refer to it.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (291,5,'UNINSTALL PLUGIN','Syntax:\nUNINSTALL PLUGIN plugin_name\n\nThis statement removes an installed server plugin. It requires the\nDELETE privilege for the mysql.plugin table.\n\nplugin_name must be the name of some plugin that is listed in the\nmysql.plugin table. The server executes the plugin\'s deinitialization\nfunction and removes the row for the plugin from the mysql.plugin\ntable, so that subsequent server restarts will not load and initialize\nthe plugin. UNINSTALL PLUGIN does not remove the plugin\'s shared\nlibrary file.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/uninstall-plugin.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/uninstall-plugin.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (292,32,'ASBINARY','AsBinary(g), AsWKB(g)\n\nConverts a value in internal geometry format to its WKB representation\nand returns the binary result.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-to-convert-geometries-between-formats.html\n\n','SELECT AsBinary(g) FROM geom;\n','http://dev.mysql.com/doc/refman/5.5/en/functions-to-convert-geometries-between-formats.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (293,37,'REPEAT FUNCTION','Syntax:\nREPEAT(str,count)\n\nReturns a string consisting of the string str repeated count times. If\ncount is less than 1, returns an empty string. Returns NULL if str or\ncount are NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT REPEAT(\'MySQL\', 3);\n -> \'MySQLMySQLMySQL\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (294,26,'SHOW TABLES','Syntax:\nSHOW [FULL] TABLES [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW TABLES lists the non-TEMPORARY tables in a given database. You can\nalso get this list using the mysqlshow db_name command. The LIKE\nclause, if present, indicates which table names to match. The WHERE\nclause can be given to select rows using more general conditions, as\ndiscussed in http://dev.mysql.com/doc/refman/5.5/en/extended-show.html.\n\nThis statement also lists any views in the database. The FULL modifier\nis supported such that SHOW FULL TABLES displays a second output\ncolumn. Values for the second column are BASE TABLE for a table and\nVIEW for a view.\n\nIf you have no privileges for a base table or view, it does not show up\nin the output from SHOW TABLES or mysqlshow db_name.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-tables.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-tables.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (295,31,'MAKEDATE','Syntax:\nMAKEDATE(year,dayofyear)\n\nReturns a date, given year and day-of-year values. dayofyear must be\ngreater than 0 or the result is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT MAKEDATE(2011,31), MAKEDATE(2011,32);\n -> \'2011-01-31\', \'2011-02-01\'\nmysql> SELECT MAKEDATE(2011,365), MAKEDATE(2014,365);\n -> \'2011-12-31\', \'2014-12-31\'\nmysql> SELECT MAKEDATE(2011,0);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (296,37,'BINARY OPERATOR','Syntax:\nBINARY\n\nThe BINARY operator casts the string following it to a binary string.\nThis is an easy way to force a column comparison to be done byte by\nbyte rather than character by character. This causes the comparison to\nbe case sensitive even if the column is not defined as BINARY or BLOB.\nBINARY also causes trailing spaces to be significant.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/cast-functions.html\n\n','mysql> SELECT \'a\' = \'A\';\n -> 1\nmysql> SELECT BINARY \'a\' = \'A\';\n -> 0\nmysql> SELECT \'a\' = \'a \';\n -> 1\nmysql> SELECT BINARY \'a\' = \'a \';\n -> 0\n','http://dev.mysql.com/doc/refman/5.5/en/cast-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (297,6,'MBROVERLAPS','MBROverlaps(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 overlap. The term spatially overlaps is\nused if two geometries intersect and their intersection results in a\ngeometry of the same dimension but not equal to either of the given\ngeometries.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (298,37,'SOUNDEX','Syntax:\nSOUNDEX(str)\n\nReturns a soundex string from str. Two strings that sound almost the\nsame should have identical soundex strings. A standard soundex string\nis four characters long, but the SOUNDEX() function returns an\narbitrarily long string. You can use SUBSTRING() on the result to get a\nstandard soundex string. All nonalphabetic characters in str are\nignored. All international alphabetic characters outside the A-Z range\nare treated as vowels.\n\n*Important*: When using SOUNDEX(), you should be aware of the following\nlimitations:\n\no This function, as currently implemented, is intended to work well\n with strings that are in the English language only. Strings in other\n languages may not produce reliable results.\n\no This function is not guaranteed to provide consistent results with\n strings that use multi-byte character sets, including utf-8.\n\n We hope to remove these limitations in a future release. See Bug\n #22638 for more information.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT SOUNDEX(\'Hello\');\n -> \'H400\'\nmysql> SELECT SOUNDEX(\'Quadratically\');\n -> \'Q36324\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (299,6,'MBRTOUCHES','MBRTouches(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 touch. Two geometries spatially touch if\nthe interiors of the geometries do not intersect, but the boundary of\none of the geometries intersects either the boundary or the interior of\nthe other.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (300,39,'DROP EVENT','Syntax:\nDROP EVENT [IF EXISTS] event_name\n\nThis statement drops the event named event_name. The event immediately\nceases being active, and is deleted completely from the server.\n\nIf the event does not exist, the error ERROR 1517 (HY000): Unknown\nevent \'event_name\' results. You can override this and cause the\nstatement to generate a warning for nonexistent events instead using IF\nEXISTS.\n\nThis statement requires the EVENT privilege for the schema to which the\nevent to be dropped belongs.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-event.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-event.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (301,27,'INSERT SELECT','Syntax:\nINSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [(col_name,...)]\n SELECT ...\n [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]\n\nWith INSERT ... SELECT, you can quickly insert many rows into a table\nfrom one or many tables. For example:\n\nINSERT INTO tbl_temp2 (fld_id)\n SELECT tbl_temp1.fld_order_id\n FROM tbl_temp1 WHERE tbl_temp1.fld_order_id > 100;\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/insert-select.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/insert-select.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (302,39,'CREATE PROCEDURE','Syntax:\nCREATE\n [DEFINER = { user | CURRENT_USER }]\n PROCEDURE sp_name ([proc_parameter[,...]])\n [characteristic ...] routine_body\n\nCREATE\n [DEFINER = { user | CURRENT_USER }]\n FUNCTION sp_name ([func_parameter[,...]])\n RETURNS type\n [characteristic ...] routine_body\n\nproc_parameter:\n [ IN | OUT | INOUT ] param_name type\n\nfunc_parameter:\n param_name type\n\ntype:\n Any valid MySQL data type\n\ncharacteristic:\n COMMENT \'string\'\n | LANGUAGE SQL\n | [NOT] DETERMINISTIC\n | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }\n | SQL SECURITY { DEFINER | INVOKER }\n\nroutine_body:\n Valid SQL routine statement\n\nThese statements create stored routines. By default, a routine is\nassociated with the default database. To associate the routine\nexplicitly with a given database, specify the name as db_name.sp_name\nwhen you create it.\n\nThe CREATE FUNCTION statement is also used in MySQL to support UDFs\n(user-defined functions). See\nhttp://dev.mysql.com/doc/refman/5.5/en/adding-functions.html. A UDF can\nbe regarded as an external stored function. Stored functions share\ntheir namespace with UDFs. See\nhttp://dev.mysql.com/doc/refman/5.5/en/function-resolution.html, for\nthe rules describing how the server interprets references to different\nkinds of functions.\n\nTo invoke a stored procedure, use the CALL statement (see [HELP CALL]).\nTo invoke a stored function, refer to it in an expression. The function\nreturns a value during expression evaluation.\n\nCREATE PROCEDURE and CREATE FUNCTION require the CREATE ROUTINE\nprivilege. They might also require the SUPER privilege, depending on\nthe DEFINER value, as described later in this section. If binary\nlogging is enabled, CREATE FUNCTION might require the SUPER privilege,\nas described in\nhttp://dev.mysql.com/doc/refman/5.5/en/stored-programs-logging.html.\n\nBy default, MySQL automatically grants the ALTER ROUTINE and EXECUTE\nprivileges to the routine creator. This behavior can be changed by\ndisabling the automatic_sp_privileges system variable. See\nhttp://dev.mysql.com/doc/refman/5.5/en/stored-routines-privileges.html.\n\nThe DEFINER and SQL SECURITY clauses specify the security context to be\nused when checking access privileges at routine execution time, as\ndescribed later in this section.\n\nIf the routine name is the same as the name of a built-in SQL function,\na syntax error occurs unless you use a space between the name and the\nfollowing parenthesis when defining the routine or invoking it later.\nFor this reason, avoid using the names of existing SQL functions for\nyour own stored routines.\n\nThe IGNORE_SPACE SQL mode applies to built-in functions, not to stored\nroutines. It is always permissible to have spaces after a stored\nroutine name, regardless of whether IGNORE_SPACE is enabled.\n\nThe parameter list enclosed within parentheses must always be present.\nIf there are no parameters, an empty parameter list of () should be\nused. Parameter names are not case sensitive.\n\nEach parameter is an IN parameter by default. To specify otherwise for\na parameter, use the keyword OUT or INOUT before the parameter name.\n\n*Note*: Specifying a parameter as IN, OUT, or INOUT is valid only for a\nPROCEDURE. For a FUNCTION, parameters are always regarded as IN\nparameters.\n\nAn IN parameter passes a value into a procedure. The procedure might\nmodify the value, but the modification is not visible to the caller\nwhen the procedure returns. An OUT parameter passes a value from the\nprocedure back to the caller. Its initial value is NULL within the\nprocedure, and its value is visible to the caller when the procedure\nreturns. An INOUT parameter is initialized by the caller, can be\nmodified by the procedure, and any change made by the procedure is\nvisible to the caller when the procedure returns.\n\nFor each OUT or INOUT parameter, pass a user-defined variable in the\nCALL statement that invokes the procedure so that you can obtain its\nvalue when the procedure returns. If you are calling the procedure from\nwithin another stored procedure or function, you can also pass a\nroutine parameter or local routine variable as an IN or INOUT\nparameter.\n\nThe following example shows a simple stored procedure that uses an OUT\nparameter:\n\nmysql> delimiter //\n\nmysql> CREATE PROCEDURE simpleproc (OUT param1 INT)\n -> BEGIN\n -> SELECT COUNT(*) INTO param1 FROM t;\n -> END//\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> delimiter ;\n\nmysql> CALL simpleproc(@a);\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SELECT @a;\n+------+\n| @a |\n+------+\n| 3 |\n+------+\n1 row in set (0.00 sec)\n\nThe example uses the mysql client delimiter command to change the\nstatement delimiter from ; to // while the procedure is being defined.\nThis enables the ; delimiter used in the procedure body to be passed\nthrough to the server rather than being interpreted by mysql itself.\nSee\nhttp://dev.mysql.com/doc/refman/5.5/en/stored-programs-defining.html.\n\nThe RETURNS clause may be specified only for a FUNCTION, for which it\nis mandatory. It indicates the return type of the function, and the\nfunction body must contain a RETURN value statement. If the RETURN\nstatement returns a value of a different type, the value is coerced to\nthe proper type. For example, if a function specifies an ENUM or SET\nvalue in the RETURNS clause, but the RETURN statement returns an\ninteger, the value returned from the function is the string for the\ncorresponding ENUM member of set of SET members.\n\nThe following example function takes a parameter, performs an operation\nusing an SQL function, and returns the result. In this case, it is\nunnecessary to use delimiter because the function definition contains\nno internal ; statement delimiters:\n\nmysql> CREATE FUNCTION hello (s CHAR(20))\nmysql> RETURNS CHAR(50) DETERMINISTIC\n -> RETURN CONCAT(\'Hello, \',s,\'!\');\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SELECT hello(\'world\');\n+----------------+\n| hello(\'world\') |\n+----------------+\n| Hello, world! |\n+----------------+\n1 row in set (0.00 sec)\n\nParameter types and function return types can be declared to use any\nvalid data type, except that the COLLATE attribute cannot be used prior\nto MySQL 5.5.3. As of 5.5.3, COLLATE can be used if preceded by the\nCHARACTER SET attribute.\n\nThe routine_body consists of a valid SQL routine statement. This can be\na simple statement such as SELECT or INSERT, or a compound statement\nwritten using BEGIN and END. Compound statements can contain\ndeclarations, loops, and other control structure statements. The syntax\nfor these statements is described in\nhttp://dev.mysql.com/doc/refman/5.5/en/sql-syntax-compound-statements.h\ntml.\n\nMySQL permits routines to contain DDL statements, such as CREATE and\nDROP. MySQL also permits stored procedures (but not stored functions)\nto contain SQL transaction statements such as COMMIT. Stored functions\nmay not contain statements that perform explicit or implicit commit or\nrollback. Support for these statements is not required by the SQL\nstandard, which states that each DBMS vendor may decide whether to\npermit them.\n\nStatements that return a result set can be used within a stored\nprocedure but not within a stored function. This prohibition includes\nSELECT statements that do not have an INTO var_list clause and other\nstatements such as SHOW, EXPLAIN, and CHECK TABLE. For statements that\ncan be determined at function definition time to return a result set, a\nNot allowed to return a result set from a function error occurs\n(ER_SP_NO_RETSET). For statements that can be determined only at\nruntime to return a result set, a PROCEDURE %s can\'t return a result\nset in the given context error occurs (ER_SP_BADSELECT).\n\nUSE statements within stored routines are not permitted. When a routine\nis invoked, an implicit USE db_name is performed (and undone when the\nroutine terminates). The causes the routine to have the given default\ndatabase while it executes. References to objects in databases other\nthan the routine default database should be qualified with the\nappropriate database name.\n\nFor additional information about statements that are not permitted in\nstored routines, see\nhttp://dev.mysql.com/doc/refman/5.5/en/stored-program-restrictions.html\n.\n\nFor information about invoking stored procedures from within programs\nwritten in a language that has a MySQL interface, see [HELP CALL].\n\nMySQL stores the sql_mode system variable setting that is in effect at\nthe time a routine is created, and always executes the routine with\nthis setting in force, regardless of the server SQL mode in effect when\nthe routine is invoked.\n\nThe switch from the SQL mode of the invoker to that of the routine\noccurs after evaluation of arguments and assignment of the resulting\nvalues to routine parameters. If you define a routine in strict SQL\nmode but invoke it in nonstrict mode, assignment of arguments to\nroutine parameters does not take place in strict mode. If you require\nthat expressions passed to a routine be assigned in strict SQL mode,\nyou should invoke the routine with strict mode in effect.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-procedure.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/create-procedure.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (303,22,'VARBINARY','VARBINARY(M)\n\nThe VARBINARY type is similar to the VARCHAR type, but stores binary\nbyte strings rather than nonbinary character strings. M represents the\nmaximum column length in bytes.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (304,26,'LOAD INDEX','Syntax:\nLOAD INDEX INTO CACHE\n tbl_index_list [, tbl_index_list] ...\n\ntbl_index_list:\n tbl_name\n [PARTITION (partition_list | ALL)]\n [[INDEX|KEY] (index_name[, index_name] ...)]\n [IGNORE LEAVES]\n\npartition_list:\n partition_name[, partition_name][, ...]\n\nThe LOAD INDEX INTO CACHE statement preloads a table index into the key\ncache to which it has been assigned by an explicit CACHE INDEX\nstatement, or into the default key cache otherwise.\n\nLOAD INDEX INTO CACHE is used only for MyISAM tables. In MySQL 5.5, it\nis also supported for partitioned MyISAM tables; in addition, indexes\non partitioned tables can be preloaded for one, several, or all\npartitions.\n\nThe IGNORE LEAVES modifier causes only blocks for the nonleaf nodes of\nthe index to be preloaded.\n\nIGNORE LEAVES is also supported for partitioned MyISAM tables.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/load-index.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/load-index.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (305,27,'UNION','Syntax:\nSELECT ...\nUNION [ALL | DISTINCT] SELECT ...\n[UNION [ALL | DISTINCT] SELECT ...]\n\nUNION is used to combine the result from multiple SELECT statements\ninto a single result set.\n\nThe column names from the first SELECT statement are used as the column\nnames for the results returned. Selected columns listed in\ncorresponding positions of each SELECT statement should have the same\ndata type. (For example, the first column selected by the first\nstatement should have the same type as the first column selected by the\nother statements.)\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/union.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/union.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (306,31,'TO_DAYS','Syntax:\nTO_DAYS(date)\n\nGiven a date date, returns a day number (the number of days since year\n0).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT TO_DAYS(950501);\n -> 728779\nmysql> SELECT TO_DAYS(\'2007-10-07\');\n -> 733321\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (307,37,'NOT REGEXP','Syntax:\nexpr NOT REGEXP pat, expr NOT RLIKE pat\n\nThis is the same as NOT (expr REGEXP pat).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/regexp.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/regexp.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (308,26,'SHOW INDEX','Syntax:\nSHOW {INDEX | INDEXES | KEYS}\n {FROM | IN} tbl_name\n [{FROM | IN} db_name]\n [WHERE expr]\n\nSHOW INDEX returns table index information. The format resembles that\nof the SQLStatistics call in ODBC. This statement requires some\nprivilege for any column in the table.\nYou can use db_name.tbl_name as an alternative to the tbl_name FROM\ndb_name syntax. These two statements are equivalent:\n\nSHOW INDEX FROM mytable FROM mydb;\nSHOW INDEX FROM mydb.mytable;\n\nThe WHERE clause can be given to select rows using more general\nconditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html.\n\nYou can also list a table\'s indexes with the mysqlshow -k db_name\ntbl_name command.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-index.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-index.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (309,26,'SHOW CREATE DATABASE','Syntax:\nSHOW CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name\n\nShows the CREATE DATABASE statement that creates the given database. If\nthe SHOW statement includes an IF NOT EXISTS clause, the output too\nincludes such a clause. SHOW CREATE SCHEMA is a synonym for SHOW CREATE\nDATABASE.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-create-database.html\n\n','mysql> SHOW CREATE DATABASE test\\G\n*************************** 1. row ***************************\n Database: test\nCreate Database: CREATE DATABASE `test`\n /*!40100 DEFAULT CHARACTER SET latin1 */\n\nmysql> SHOW CREATE SCHEMA test\\G\n*************************** 1. row ***************************\n Database: test\nCreate Database: CREATE DATABASE `test`\n /*!40100 DEFAULT CHARACTER SET latin1 */\n','http://dev.mysql.com/doc/refman/5.5/en/show-create-database.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (310,23,'LEAVE','Syntax:\nLEAVE label\n\nThis statement is used to exit the flow control construct that has the\ngiven label. If the label is for the outermost stored program block,\nLEAVE exits the program.\n\nLEAVE can be used within BEGIN ... END or loop constructs (LOOP,\nREPEAT, WHILE).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/leave.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/leave.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (311,18,'NOT IN','Syntax:\nexpr NOT IN (value,...)\n\nThis is the same as NOT (expr IN (value,...)).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (312,15,'!','Syntax:\nNOT, !\n\nLogical NOT. Evaluates to 1 if the operand is 0, to 0 if the operand is\nnonzero, and NOT NULL returns NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/logical-operators.html\n\n','mysql> SELECT NOT 10;\n -> 0\nmysql> SELECT NOT 0;\n -> 1\nmysql> SELECT NOT NULL;\n -> NULL\nmysql> SELECT ! (1+1);\n -> 0\nmysql> SELECT ! 1+1;\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/logical-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (313,23,'DECLARE HANDLER','Syntax:\nDECLARE handler_action HANDLER\n FOR condition_value [, condition_value] ...\n statement\n\nhandler_action:\n CONTINUE\n | EXIT\n | UNDO\n\ncondition_value:\n mysql_error_code\n | SQLSTATE [VALUE] sqlstate_value\n | condition_name\n | SQLWARNING\n | NOT FOUND\n | SQLEXCEPTION\n\nThe DECLARE ... HANDLER statement specifies a handler that deals with\none or more conditions. If one of these conditions occurs, the\nspecified statement executes. statement can be a simple statement such\nas SET var_name = value, or a compound statement written using BEGIN\nand END (see [HELP BEGIN END]).\n\nHandler declarations must appear after variable or condition\ndeclarations.\n\nThe handler_action value indicates what action the handler takes after\nexecution of the handler statement:\n\no CONTINUE: Execution of the current program continues.\n\no EXIT: Execution terminates for the BEGIN ... END compound statement\n in which the handler is declared. This is true even if the condition\n occurs in an inner block.\n\no UNDO: Not supported.\n\nThe condition_value for DECLARE ... HANDLER indicates the specific\ncondition or class of conditions that activates the handler:\n\no A MySQL error code (a number) or an SQLSTATE value (a 5-character\n string literal). You should not use MySQL error code 0 or SQLSTATE\n values that begin with \'00\', because those indicate success rather\n than an error condition. For a list of MySQL error codes and SQLSTATE\n values, see\n http://dev.mysql.com/doc/refman/5.5/en/error-messages-server.html.\n\no A condition name previously specified with DECLARE ... CONDITION. A\n condition name can be associated with a MySQL error code or SQLSTATE\n value. See [HELP DECLARE CONDITION].\n\no SQLWARNING is shorthand for the class of SQLSTATE values that begin\n with \'01\'.\n\no NOT FOUND is shorthand for the class of SQLSTATE values that begin\n with \'02\'. This is relevant within the context of cursors and is used\n to control what happens when a cursor reaches the end of a data set.\n If no more rows are available, a No Data condition occurs with\n SQLSTATE value \'02000\'. To detect this condition, you can set up a\n handler for it (or for a NOT FOUND condition). For an example, see\n http://dev.mysql.com/doc/refman/5.5/en/cursors.html. This condition\n also occurs for SELECT ... INTO var_list statements that retrieve no\n rows.\n\no SQLEXCEPTION is shorthand for the class of SQLSTATE values that do\n not begin with \'00\', \'01\', or \'02\'.\n\nIf a condition occurs for which no handler has been declared, the\naction taken depends on the condition class:\n\no For SQLEXCEPTION conditions, the stored program terminates at the\n statement that raised the condition, as if there were an EXIT\n handler. If the program was called by another stored program, the\n calling program handles the condition using the handler selection\n rules applied to its own handlers.\n\no For SQLWARNING conditions, the program continues executing, as if\n there were a CONTINUE handler.\n\no For NOT FOUND conditions, if the condition was raised normally, the\n action is CONTINUE. If it was raised by SIGNAL or RESIGNAL, the\n action is EXIT.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/declare-handler.html\n\n','mysql> CREATE TABLE test.t (s1 INT, PRIMARY KEY (s1));\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> delimiter //\n\nmysql> CREATE PROCEDURE handlerdemo ()\n -> BEGIN\n -> DECLARE CONTINUE HANDLER FOR SQLSTATE \'23000\' SET @x2 = 1;\n -> SET @x = 1;\n -> INSERT INTO test.t VALUES (1);\n -> SET @x = 2;\n -> INSERT INTO test.t VALUES (1);\n -> SET @x = 3;\n -> END;\n -> //\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> CALL handlerdemo()//\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SELECT @x//\n +------+\n | @x |\n +------+\n | 3 |\n +------+\n 1 row in set (0.00 sec)\n','http://dev.mysql.com/doc/refman/5.5/en/declare-handler.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (314,22,'DOUBLE','DOUBLE[(M,D)] [UNSIGNED] [ZEROFILL]\n\nA normal-size (double-precision) floating-point number. Permissible\nvalues are -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and\n2.2250738585072014E-308 to 1.7976931348623157E+308. These are the\ntheoretical limits, based on the IEEE standard. The actual range might\nbe slightly smaller depending on your hardware or operating system.\n\nM is the total number of digits and D is the number of digits following\nthe decimal point. If M and D are omitted, values are stored to the\nlimits permitted by the hardware. A double-precision floating-point\nnumber is accurate to approximately 15 decimal places.\n\nUNSIGNED, if specified, disallows negative values.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (315,22,'TIME','TIME\n\nA time. The range is \'-838:59:59\' to \'838:59:59\'. MySQL displays TIME\nvalues in \'HH:MM:SS\' format, but permits assignment of values to TIME\ncolumns using either strings or numbers.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (316,15,'&&','Syntax:\nAND, &&\n\nLogical AND. Evaluates to 1 if all operands are nonzero and not NULL,\nto 0 if one or more operands are 0, otherwise NULL is returned.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/logical-operators.html\n\n','mysql> SELECT 1 && 1;\n -> 1\nmysql> SELECT 1 && 0;\n -> 0\nmysql> SELECT 1 && NULL;\n -> NULL\nmysql> SELECT 0 && NULL;\n -> 0\nmysql> SELECT NULL && 0;\n -> 0\n','http://dev.mysql.com/doc/refman/5.5/en/logical-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (317,11,'X','X(p)\n\nReturns the X-coordinate value for the Point object p as a\ndouble-precision number.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#point-property-functions\n\n','mysql> SELECT X(POINT(56.7, 53.34));\n+-----------------------+\n| X(POINT(56.7, 53.34)) |\n+-----------------------+\n| 56.7 |\n+-----------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#point-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (318,17,'SYSTEM_USER','Syntax:\nSYSTEM_USER()\n\nSYSTEM_USER() is a synonym for USER().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (319,17,'FOUND_ROWS','Syntax:\nFOUND_ROWS()\n\nA SELECT statement may include a LIMIT clause to restrict the number of\nrows the server returns to the client. In some cases, it is desirable\nto know how many rows the statement would have returned without the\nLIMIT, but without running the statement again. To obtain this row\ncount, include a SQL_CALC_FOUND_ROWS option in the SELECT statement,\nand then invoke FOUND_ROWS() afterward:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','mysql> SELECT SQL_CALC_FOUND_ROWS * FROM tbl_name\n -> WHERE id > 100 LIMIT 10;\nmysql> SELECT FOUND_ROWS();\n','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (320,30,'CROSSES','Crosses(g1,g2)\n\nReturns 1 if g1 spatially crosses g2. Returns NULL if g1 is a Polygon\nor a MultiPolygon, or if g2 is a Point or a MultiPoint. Otherwise,\nreturns 0.\n\nThe term spatially crosses denotes a spatial relation between two given\ngeometries that has the following properties:\n\no The two geometries intersect\n\no Their intersection results in a geometry that has a dimension that is\n one less than the maximum dimension of the two given geometries\n\no Their intersection is not equal to either of the two given geometries\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (321,39,'TRUNCATE TABLE','Syntax:\nTRUNCATE [TABLE] tbl_name\n\nTRUNCATE TABLE empties a table completely. It requires the DROP\nprivilege.\n\nLogically, TRUNCATE TABLE is similar to a DELETE statement that deletes\nall rows, or a sequence of DROP TABLE and CREATE TABLE statements. To\nachieve high performance, it bypasses the DML method of deleting data.\nThus, it cannot be rolled back, it does not cause ON DELETE triggers to\nfire, and it cannot be performed for InnoDB tables with parent-child\nforeign key relationships.\n\nAlthough TRUNCATE TABLE is similar to DELETE, it is classified as a DDL\nstatement rather than a DML statement. It differs from DELETE in the\nfollowing ways in MySQL 5.5:\n\no Truncate operations drop and re-create the table, which is much\n faster than deleting rows one by one, particularly for large tables.\n\no Truncate operations cause an implicit commit, and so cannot be rolled\n back.\n\no Truncation operations cannot be performed if the session holds an\n active table lock.\n\no TRUNCATE TABLE fails for an InnoDB table if there are any FOREIGN KEY\n constraints from other tables that reference the table. Foreign key\n constraints between columns of the same table are permitted.\n\no Truncation operations do not return a meaningful value for the number\n of deleted rows. The usual result is "0 rows affected," which should\n be interpreted as "no information."\n\no As long as the table format file tbl_name.frm is valid, the table can\n be re-created as an empty table with TRUNCATE TABLE, even if the data\n or index files have become corrupted.\n\no Any AUTO_INCREMENT value is reset to its start value. This is true\n even for MyISAM and InnoDB, which normally do not reuse sequence\n values.\n\no When used with partitioned tables, TRUNCATE TABLE preserves the\n partitioning; that is, the data and index files are dropped and\n re-created, while the partition definitions (.par) file is\n unaffected.\n\no The TRUNCATE TABLE statement does not invoke ON DELETE triggers.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/truncate-table.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/truncate-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (322,16,'BIT_XOR','Syntax:\nBIT_XOR(expr)\n\nReturns the bitwise XOR of all bits in expr. The calculation is\nperformed with 64-bit (BIGINT) precision.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (323,31,'CURRENT_DATE','Syntax:\nCURRENT_DATE, CURRENT_DATE()\n\nCURRENT_DATE and CURRENT_DATE() are synonyms for CURDATE().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (324,8,'START SLAVE','Syntax:\nSTART SLAVE [thread_types]\n\nSTART SLAVE [SQL_THREAD] UNTIL\n MASTER_LOG_FILE = \'log_name\', MASTER_LOG_POS = log_pos\n\nSTART SLAVE [SQL_THREAD] UNTIL\n RELAY_LOG_FILE = \'log_name\', RELAY_LOG_POS = log_pos\n\nthread_types:\n [thread_type [, thread_type] ... ]\n\nthread_type: IO_THREAD | SQL_THREAD\n\nSTART SLAVE with no thread_type options starts both of the slave\nthreads. The I/O thread reads events from the master server and stores\nthem in the relay log. The SQL thread reads events from the relay log\nand executes them. START SLAVE requires the SUPER privilege.\n\nIf START SLAVE succeeds in starting the slave threads, it returns\nwithout any error. However, even in that case, it might be that the\nslave threads start and then later stop (for example, because they do\nnot manage to connect to the master or read its binary log, or some\nother problem). START SLAVE does not warn you about this. You must\ncheck the slave\'s error log for error messages generated by the slave\nthreads, or check that they are running satisfactorily with SHOW SLAVE\nSTATUS.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/start-slave.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/start-slave.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (325,2,'AREA','Area(poly)\n\nReturns as a double-precision number the area of the Polygon value\npoly, as measured in its spatial reference system.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#polygon-property-functions\n\n','mysql> SET @poly = \'Polygon((0 0,0 3,3 0,0 0),(1 1,1 2,2 1,1 1))\';\nmysql> SELECT Area(GeomFromText(@poly));\n+---------------------------+\n| Area(GeomFromText(@poly)) |\n+---------------------------+\n| 4 |\n+---------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#polygon-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (326,26,'FLUSH','Syntax:\nFLUSH [NO_WRITE_TO_BINLOG | LOCAL]\n flush_option [, flush_option] ...\n\nThe FLUSH statement has several variant forms that clear or reload\nvarious internal caches, flush tables, or acquire locks. To execute\nFLUSH, you must have the RELOAD privilege. Specific flush options might\nrequire additional privileges, as described later.\n\nBy default, the server writes FLUSH statements to the binary log so\nthat they replicate to replication slaves. To suppress logging, use the\noptional NO_WRITE_TO_BINLOG keyword or its alias LOCAL.\n\n*Note*: FLUSH LOGS, FLUSH MASTER, FLUSH SLAVE, and FLUSH TABLES WITH\nREAD LOCK (with or without a table list) are not written to the binary\nlog in any case because they would cause problems if replicated to a\nslave.\n\nThe FLUSH statement causes an implicit commit. See\nhttp://dev.mysql.com/doc/refman/5.5/en/implicit-commit.html.\n\nThe RESET statement is similar to FLUSH. See [HELP RESET], for\ninformation about using the RESET statement with replication.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/flush.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/flush.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (327,23,'BEGIN END','Syntax:\n[begin_label:] BEGIN\n [statement_list]\nEND [end_label]\n\nBEGIN ... END syntax is used for writing compound statements, which can\nappear within stored programs (stored procedures and functions,\ntriggers, and events). A compound statement can contain multiple\nstatements, enclosed by the BEGIN and END keywords. statement_list\nrepresents a list of one or more statements, each terminated by a\nsemicolon (;) statement delimiter. The statement_list itself is\noptional, so the empty compound statement (BEGIN END) is legal.\n\nBEGIN ... END blocks can be nested.\n\nUse of multiple statements requires that a client is able to send\nstatement strings containing the ; statement delimiter. In the mysql\ncommand-line client, this is handled with the delimiter command.\nChanging the ; end-of-statement delimiter (for example, to //) permit ;\nto be used in a program body. For an example, see\nhttp://dev.mysql.com/doc/refman/5.5/en/stored-programs-defining.html.\n\nA BEGIN ... END block can be labeled. See [HELP labels].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/begin-end.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/begin-end.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (328,26,'SHOW PROCEDURE STATUS','Syntax:\nSHOW PROCEDURE STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nThis statement is a MySQL extension. It returns characteristics of a\nstored procedure, such as the database, name, type, creator, creation\nand modification dates, and character set information. A similar\nstatement, SHOW FUNCTION STATUS, displays information about stored\nfunctions (see [HELP SHOW FUNCTION STATUS]).\n\nThe LIKE clause, if present, indicates which procedure or function\nnames to match. The WHERE clause can be given to select rows using more\ngeneral conditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-procedure-status.html\n\n','mysql> SHOW PROCEDURE STATUS LIKE \'sp1\'\\G\n*************************** 1. row ***************************\n Db: test\n Name: sp1\n Type: PROCEDURE\n Definer: testuser@localhost\n Modified: 2004-08-03 15:29:37\n Created: 2004-08-03 15:29:37\n Security_type: DEFINER\n Comment:\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n','http://dev.mysql.com/doc/refman/5.5/en/show-procedure-status.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (329,28,'DESCRIBE','Syntax:\n{DESCRIBE | DESC} tbl_name [col_name | wild]\n\nDESCRIBE provides information about the columns in a table. It is a\nshortcut for SHOW COLUMNS FROM. These statements also display\ninformation for views. (See [HELP SHOW COLUMNS].)\n\ncol_name can be a column name, or a string containing the SQL "%" and\n"_" wildcard characters to obtain output only for the columns with\nnames matching the string. There is no need to enclose the string\nwithin quotation marks unless it contains spaces or other special\ncharacters.\n\nmysql> DESCRIBE City;\n+------------+----------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+------------+----------+------+-----+---------+----------------+\n| Id | int(11) | NO | PRI | NULL | auto_increment |\n| Name | char(35) | NO | | | |\n| Country | char(3) | NO | UNI | | |\n| District | char(20) | YES | MUL | | |\n| Population | int(11) | NO | | 0 | |\n+------------+----------+------+-----+---------+----------------+\n5 rows in set (0.00 sec)\n\nThe description for SHOW COLUMNS provides more information about the\noutput columns (see [HELP SHOW COLUMNS]).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/describe.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/describe.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (330,26,'SHOW WARNINGS','Syntax:\nSHOW WARNINGS [LIMIT [offset,] row_count]\nSHOW COUNT(*) WARNINGS\n\nSHOW WARNINGS shows information about the conditions (errors, warnings,\nand notes) that resulted from the last statement in the current session\nthat generated messages. It shows nothing if the last statement used a\ntable and generated no messages. (That is, a statement that uses a\ntable but generates no messages clears the message list.) Statements\nthat do not use tables and do not generate messages have no effect on\nthe message list.\n\nWarnings are generated for DML statements such as INSERT, UPDATE, and\nLOAD DATA INFILE as well as DDL statements such as CREATE TABLE and\nALTER TABLE.\n\nSHOW WARNINGS is also used following EXPLAIN EXTENDED, to display the\nextra information generated by EXPLAIN when the EXTENDED keyword is\nused. See http://dev.mysql.com/doc/refman/5.5/en/explain-extended.html.\n\nThe LIMIT clause has the same syntax as for the SELECT statement. See\nhttp://dev.mysql.com/doc/refman/5.5/en/select.html.\n\nA related statement, SHOW ERRORS, shows only the error conditions (it\nexcludes warnings and notes). See [HELP SHOW ERRORS].\n\nThe SHOW COUNT(*) WARNINGS statement displays the total number of\nerrors, warnings, and notes. You can also retrieve this number from the\nwarning_count system variable:\n\nSHOW COUNT(*) WARNINGS;\nSELECT @@warning_count;\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-warnings.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-warnings.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (331,10,'DROP USER','Syntax:\nDROP USER user [, user] ...\n\nThe DROP USER statement removes one or more MySQL accounts and their\nprivileges. It removes privilege rows for the account from all grant\ntables. To use this statement, you must have the global CREATE USER\nprivilege or the DELETE privilege for the mysql database. Each account\nname uses the format described in\nhttp://dev.mysql.com/doc/refman/5.5/en/account-names.html. For example:\n\nDROP USER \'jeffrey\'@\'localhost\';\n\nIf you specify only the user name part of the account name, a host name\npart of \'%\' is used.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-user.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-user.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (332,16,'STDDEV_POP','Syntax:\nSTDDEV_POP(expr)\n\nReturns the population standard deviation of expr (the square root of\nVAR_POP()). You can also use STD() or STDDEV(), which are equivalent\nbut not standard SQL.\n\nSTDDEV_POP() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (333,26,'SHOW CHARACTER SET','Syntax:\nSHOW CHARACTER SET\n [LIKE \'pattern\' | WHERE expr]\n\nThe SHOW CHARACTER SET statement shows all available character sets.\nThe LIKE clause, if present, indicates which character set names to\nmatch. The WHERE clause can be given to select rows using more general\nconditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html. For example:\n\nmysql> SHOW CHARACTER SET LIKE \'latin%\';\n+---------+-----------------------------+-------------------+--------+\n| Charset | Description | Default collation | Maxlen |\n+---------+-----------------------------+-------------------+--------+\n| latin1 | cp1252 West European | latin1_swedish_ci | 1 |\n| latin2 | ISO 8859-2 Central European | latin2_general_ci | 1 |\n| latin5 | ISO 8859-9 Turkish | latin5_turkish_ci | 1 |\n| latin7 | ISO 8859-13 Baltic | latin7_general_ci | 1 |\n+---------+-----------------------------+-------------------+--------+\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-character-set.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-character-set.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (334,37,'SUBSTRING','Syntax:\nSUBSTRING(str,pos), SUBSTRING(str FROM pos), SUBSTRING(str,pos,len),\nSUBSTRING(str FROM pos FOR len)\n\nThe forms without a len argument return a substring from string str\nstarting at position pos. The forms with a len argument return a\nsubstring len characters long from string str, starting at position\npos. The forms that use FROM are standard SQL syntax. It is also\npossible to use a negative value for pos. In this case, the beginning\nof the substring is pos characters from the end of the string, rather\nthan the beginning. A negative value may be used for pos in any of the\nforms of this function.\n\nFor all forms of SUBSTRING(), the position of the first character in\nthe string from which the substring is to be extracted is reckoned as\n1.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT SUBSTRING(\'Quadratically\',5);\n -> \'ratically\'\nmysql> SELECT SUBSTRING(\'foobarbar\' FROM 4);\n -> \'barbar\'\nmysql> SELECT SUBSTRING(\'Quadratically\',5,6);\n -> \'ratica\'\nmysql> SELECT SUBSTRING(\'Sakila\', -3);\n -> \'ila\'\nmysql> SELECT SUBSTRING(\'Sakila\', -5, 3);\n -> \'aki\'\nmysql> SELECT SUBSTRING(\'Sakila\' FROM -4 FOR 2);\n -> \'ki\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (335,36,'ISEMPTY','IsEmpty(g)\n\nReturns 1 if the geometry value g is the empty geometry, 0 if it is not\nempty, and -1 if the argument is NULL. If the geometry is empty, it\nrepresents the empty point set.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (336,26,'SHOW FUNCTION STATUS','Syntax:\nSHOW FUNCTION STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nThis statement is similar to SHOW PROCEDURE STATUS but for stored\nfunctions. See [HELP SHOW PROCEDURE STATUS].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-function-status.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-function-status.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (337,37,'LTRIM','Syntax:\nLTRIM(str)\n\nReturns the string str with leading space characters removed.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT LTRIM(\' barbar\');\n -> \'barbar\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (338,30,'INTERSECTS','Intersects(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 spatially intersects g2.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (339,27,'CALL','Syntax:\nCALL sp_name([parameter[,...]])\nCALL sp_name[()]\n\nThe CALL statement invokes a stored procedure that was defined\npreviously with CREATE PROCEDURE.\n\nStored procedures that take no arguments can be invoked without\nparentheses. That is, CALL p() and CALL p are equivalent.\n\nCALL can pass back values to its caller using parameters that are\ndeclared as OUT or INOUT parameters. When the procedure returns, a\nclient program can also obtain the number of rows affected for the\nfinal statement executed within the routine: At the SQL level, call the\nROW_COUNT() function; from the C API, call the mysql_affected_rows()\nfunction.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/call.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/call.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (340,6,'MBRDISJOINT','MBRDisjoint(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 are disjoint (do not intersect).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (341,14,'VALUES','Syntax:\nVALUES(col_name)\n\nIn an INSERT ... ON DUPLICATE KEY UPDATE statement, you can use the\nVALUES(col_name) function in the UPDATE clause to refer to column\nvalues from the INSERT portion of the statement. In other words,\nVALUES(col_name) in the UPDATE clause refers to the value of col_name\nthat would be inserted, had no duplicate-key conflict occurred. This\nfunction is especially useful in multiple-row inserts. The VALUES()\nfunction is meaningful only in the ON DUPLICATE KEY UPDATE clause of\nINSERT statements and returns NULL otherwise. See\nhttp://dev.mysql.com/doc/refman/5.5/en/insert-on-duplicate.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','mysql> INSERT INTO table (a,b,c) VALUES (1,2,3),(4,5,6)\n -> ON DUPLICATE KEY UPDATE c=VALUES(a)+VALUES(b);\n','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (342,37,'SUBSTRING_INDEX','Syntax:\nSUBSTRING_INDEX(str,delim,count)\n\nReturns the substring from string str before count occurrences of the\ndelimiter delim. If count is positive, everything to the left of the\nfinal delimiter (counting from the left) is returned. If count is\nnegative, everything to the right of the final delimiter (counting from\nthe right) is returned. SUBSTRING_INDEX() performs a case-sensitive\nmatch when searching for delim.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT SUBSTRING_INDEX(\'www.mysql.com\', \'.\', 2);\n -> \'www.mysql\'\nmysql> SELECT SUBSTRING_INDEX(\'www.mysql.com\', \'.\', -2);\n -> \'mysql.com\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (343,12,'ENCODE','Syntax:\nENCODE(str,pass_str)\n\nEncrypt str using pass_str as the password. To decrypt the result, use\nDECODE().\n\nThe result is a binary string of the same length as str.\n\nThe strength of the encryption is based on how good the random\ngenerator is. It should suffice for short strings.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (344,23,'LOOP','Syntax:\n[begin_label:] LOOP\n statement_list\nEND LOOP [end_label]\n\nLOOP implements a simple loop construct, enabling repeated execution of\nthe statement list, which consists of one or more statements, each\nterminated by a semicolon (;) statement delimiter. The statements\nwithin the loop are repeated until the loop is terminated. Usually,\nthis is accomplished with a LEAVE statement. Within a stored function,\nRETURN can also be used, which exits the function entirely.\n\nNeglecting to include a loop-termination statement results in an\ninfinite loop.\n\nA LOOP statement can be labeled. For the rules regarding label use, see\n[HELP labels].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/loop.html\n\n','CREATE PROCEDURE doiterate(p1 INT)\nBEGIN\n label1: LOOP\n SET p1 = p1 + 1;\n IF p1 < 10 THEN\n ITERATE label1;\n END IF;\n LEAVE label1;\n END LOOP label1;\n SET @x = p1;\nEND;\n','http://dev.mysql.com/doc/refman/5.5/en/loop.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (345,4,'TRUNCATE','Syntax:\nTRUNCATE(X,D)\n\nReturns the number X, truncated to D decimal places. If D is 0, the\nresult has no decimal point or fractional part. D can be negative to\ncause D digits left of the decimal point of the value X to become zero.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT TRUNCATE(1.223,1);\n -> 1.2\nmysql> SELECT TRUNCATE(1.999,1);\n -> 1.9\nmysql> SELECT TRUNCATE(1.999,0);\n -> 1\nmysql> SELECT TRUNCATE(-1.999,1);\n -> -1.9\nmysql> SELECT TRUNCATE(122,-2);\n -> 100\nmysql> SELECT TRUNCATE(10.28*100,0);\n -> 1028\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (346,31,'TIMESTAMPADD','Syntax:\nTIMESTAMPADD(unit,interval,datetime_expr)\n\nAdds the integer expression interval to the date or datetime expression\ndatetime_expr. The unit for interval is given by the unit argument,\nwhich should be one of the following values: MICROSECOND\n(microseconds), SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or\nYEAR.\n\nIt is possible to use FRAC_SECOND in place of MICROSECOND, but\nFRAC_SECOND is deprecated. FRAC_SECOND was removed in MySQL 5.5.3.\n\nThe unit value may be specified using one of keywords as shown, or with\na prefix of SQL_TSI_. For example, DAY and SQL_TSI_DAY both are legal.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT TIMESTAMPADD(MINUTE,1,\'2003-01-02\');\n -> \'2003-01-02 00:01:00\'\nmysql> SELECT TIMESTAMPADD(WEEK,1,\'2003-01-02\');\n -> \'2003-01-09\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (347,26,'SHOW','SHOW has many forms that provide information about databases, tables,\ncolumns, or status information about the server. This section describes\nthose following:\n\nSHOW AUTHORS\nSHOW {BINARY | MASTER} LOGS\nSHOW BINLOG EVENTS [IN \'log_name\'] [FROM pos] [LIMIT [offset,] row_count]\nSHOW CHARACTER SET [like_or_where]\nSHOW COLLATION [like_or_where]\nSHOW [FULL] COLUMNS FROM tbl_name [FROM db_name] [like_or_where]\nSHOW CONTRIBUTORS\nSHOW CREATE DATABASE db_name\nSHOW CREATE EVENT event_name\nSHOW CREATE FUNCTION func_name\nSHOW CREATE PROCEDURE proc_name\nSHOW CREATE TABLE tbl_name\nSHOW CREATE TRIGGER trigger_name\nSHOW CREATE VIEW view_name\nSHOW DATABASES [like_or_where]\nSHOW ENGINE engine_name {STATUS | MUTEX}\nSHOW [STORAGE] ENGINES\nSHOW ERRORS [LIMIT [offset,] row_count]\nSHOW EVENTS\nSHOW FUNCTION CODE func_name\nSHOW FUNCTION STATUS [like_or_where]\nSHOW GRANTS FOR user\nSHOW INDEX FROM tbl_name [FROM db_name]\nSHOW MASTER STATUS\nSHOW OPEN TABLES [FROM db_name] [like_or_where]\nSHOW PLUGINS\nSHOW PROCEDURE CODE proc_name\nSHOW PROCEDURE STATUS [like_or_where]\nSHOW PRIVILEGES\nSHOW [FULL] PROCESSLIST\nSHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]\nSHOW PROFILES\nSHOW SLAVE HOSTS\nSHOW SLAVE STATUS\nSHOW [GLOBAL | SESSION] STATUS [like_or_where]\nSHOW TABLE STATUS [FROM db_name] [like_or_where]\nSHOW [FULL] TABLES [FROM db_name] [like_or_where]\nSHOW TRIGGERS [FROM db_name] [like_or_where]\nSHOW [GLOBAL | SESSION] VARIABLES [like_or_where]\nSHOW WARNINGS [LIMIT [offset,] row_count]\n\nlike_or_where:\n LIKE \'pattern\'\n | WHERE expr\n\nIf the syntax for a given SHOW statement includes a LIKE \'pattern\'\npart, \'pattern\' is a string that can contain the SQL "%" and "_"\nwildcard characters. The pattern is useful for restricting statement\noutput to matching values.\n\nSeveral SHOW statements also accept a WHERE clause that provides more\nflexibility in specifying which rows to display. See\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (348,18,'GREATEST','Syntax:\nGREATEST(value1,value2,...)\n\nWith two or more arguments, returns the largest (maximum-valued)\nargument. The arguments are compared using the same rules as for\nLEAST().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT GREATEST(2,0);\n -> 2\nmysql> SELECT GREATEST(34.0,3.0,5.0,767.0);\n -> 767.0\nmysql> SELECT GREATEST(\'B\',\'A\',\'C\');\n -> \'C\'\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (349,26,'SHOW VARIABLES','Syntax:\nSHOW [GLOBAL | SESSION] VARIABLES\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW VARIABLES shows the values of MySQL system variables. This\ninformation also can be obtained using the mysqladmin variables\ncommand. The LIKE clause, if present, indicates which variable names to\nmatch. The WHERE clause can be given to select rows using more general\nconditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html. This\nstatement does not require any privilege. It requires only the ability\nto connect to the server.\n\nWith the GLOBAL modifier, SHOW VARIABLES displays the values that are\nused for new connections to MySQL. As of MySQL 5.5.3, if a variable has\nno global value, no value is displayed. Before 5.5.3, the session value\nis displayed. With SESSION, SHOW VARIABLES displays the values that are\nin effect for the current connection. If no modifier is present, the\ndefault is SESSION. LOCAL is a synonym for SESSION.\nWith a LIKE clause, the statement displays only rows for those\nvariables with names that match the pattern. To obtain the row for a\nspecific variable, use a LIKE clause as shown:\n\nSHOW VARIABLES LIKE \'max_join_size\';\nSHOW SESSION VARIABLES LIKE \'max_join_size\';\n\nTo get a list of variables whose name match a pattern, use the "%"\nwildcard character in a LIKE clause:\n\nSHOW VARIABLES LIKE \'%size%\';\nSHOW GLOBAL VARIABLES LIKE \'%size%\';\n\nWildcard characters can be used in any position within the pattern to\nbe matched. Strictly speaking, because "_" is a wildcard that matches\nany single character, you should escape it as "\\_" to match it\nliterally. In practice, this is rarely necessary.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-variables.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-variables.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (350,26,'BINLOG','Syntax:\nBINLOG \'str\'\n\nBINLOG is an internal-use statement. It is generated by the mysqlbinlog\nprogram as the printable representation of certain events in binary log\nfiles. (See http://dev.mysql.com/doc/refman/5.5/en/mysqlbinlog.html.)\nThe \'str\' value is a base 64-encoded string the that server decodes to\ndetermine the data change indicated by the corresponding event. This\nstatement requires the SUPER privilege.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/binlog.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/binlog.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (351,16,'BIT_AND','Syntax:\nBIT_AND(expr)\n\nReturns the bitwise AND of all bits in expr. The calculation is\nperformed with 64-bit (BIGINT) precision.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (352,31,'SECOND','Syntax:\nSECOND(time)\n\nReturns the second for time, in the range 0 to 59.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT SECOND(\'10:05:03\');\n -> 3\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (353,4,'ATAN2','Syntax:\nATAN(Y,X), ATAN2(Y,X)\n\nReturns the arc tangent of the two variables X and Y. It is similar to\ncalculating the arc tangent of Y / X, except that the signs of both\narguments are used to determine the quadrant of the result.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT ATAN(-2,2);\n -> -0.78539816339745\nmysql> SELECT ATAN2(PI(),0);\n -> 1.5707963267949\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (354,6,'MBRCONTAINS','MBRContains(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangle of g1\ncontains the Minimum Bounding Rectangle of g2. This tests the opposite\nrelationship as MBRWithin().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr\n\n','mysql> SET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nmysql> SET @g2 = GeomFromText(\'Point(1 1)\');\nmysql> SELECT MBRContains(@g1,@g2), MBRContains(@g2,@g1);\n----------------------+----------------------+\n| MBRContains(@g1,@g2) | MBRContains(@g2,@g1) |\n+----------------------+----------------------+\n| 1 | 0 |\n+----------------------+----------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (355,31,'HOUR','Syntax:\nHOUR(time)\n\nReturns the hour for time. The range of the return value is 0 to 23 for\ntime-of-day values. However, the range of TIME values actually is much\nlarger, so HOUR can return values greater than 23.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT HOUR(\'10:05:03\');\n -> 10\nmysql> SELECT HOUR(\'272:59:59\');\n -> 272\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (356,27,'SELECT','Syntax:\nSELECT\n [ALL | DISTINCT | DISTINCTROW ]\n [HIGH_PRIORITY]\n [STRAIGHT_JOIN]\n [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]\n [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]\n select_expr [, select_expr ...]\n [FROM table_references\n [WHERE where_condition]\n [GROUP BY {col_name | expr | position}\n [ASC | DESC], ... [WITH ROLLUP]]\n [HAVING where_condition]\n [ORDER BY {col_name | expr | position}\n [ASC | DESC], ...]\n [LIMIT {[offset,] row_count | row_count OFFSET offset}]\n [PROCEDURE procedure_name(argument_list)]\n [INTO OUTFILE \'file_name\'\n [CHARACTER SET charset_name]\n export_options\n | INTO DUMPFILE \'file_name\'\n | INTO var_name [, var_name]]\n [FOR UPDATE | LOCK IN SHARE MODE]]\n\nSELECT is used to retrieve rows selected from one or more tables, and\ncan include UNION statements and subqueries. See [HELP UNION], and\nhttp://dev.mysql.com/doc/refman/5.5/en/subqueries.html.\n\nThe most commonly used clauses of SELECT statements are these:\n\no Each select_expr indicates a column that you want to retrieve. There\n must be at least one select_expr.\n\no table_references indicates the table or tables from which to retrieve\n rows. Its syntax is described in [HELP JOIN].\n\no The WHERE clause, if given, indicates the condition or conditions\n that rows must satisfy to be selected. where_condition is an\n expression that evaluates to true for each row to be selected. The\n statement selects all rows if there is no WHERE clause.\n\n In the WHERE expression, you can use any of the functions and\n operators that MySQL supports, except for aggregate (summary)\n functions. See\n http://dev.mysql.com/doc/refman/5.5/en/expressions.html, and\n http://dev.mysql.com/doc/refman/5.5/en/functions.html.\n\nSELECT can also be used to retrieve rows computed without reference to\nany table.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/select.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/select.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (357,4,'COT','Syntax:\nCOT(X)\n\nReturns the cotangent of X.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT COT(12);\n -> -1.5726734063977\nmysql> SELECT COT(0);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (358,26,'SHOW CREATE EVENT','Syntax:\nSHOW CREATE EVENT event_name\n\nThis statement displays the CREATE EVENT statement needed to re-create\na given event. It requires the EVENT privilege for the database from\nwhich the event is to be shown. For example (using the same event\ne_daily defined and then altered in [HELP SHOW EVENTS]):\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-create-event.html\n\n','mysql> SHOW CREATE EVENT test.e_daily\\G\n*************************** 1. row ***************************\n Event: e_daily\n sql_mode:\n time_zone: SYSTEM\n Create Event: CREATE EVENT `e_daily`\n ON SCHEDULE EVERY 1 DAY\n STARTS CURRENT_TIMESTAMP + INTERVAL 6 HOUR\n ON COMPLETION NOT PRESERVE\n ENABLE\n COMMENT \'Saves total number of sessions then\n clears the table each day\'\n DO BEGIN\n INSERT INTO site_activity.totals (time, total)\n SELECT CURRENT_TIMESTAMP, COUNT(*)\n FROM site_activity.sessions;\n DELETE FROM site_activity.sessions;\n END\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n','http://dev.mysql.com/doc/refman/5.5/en/show-create-event.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (359,37,'LOAD_FILE','Syntax:\nLOAD_FILE(file_name)\n\nReads the file and returns the file contents as a string. To use this\nfunction, the file must be located on the server host, you must specify\nthe full path name to the file, and you must have the FILE privilege.\nThe file must be readable by all and its size less than\nmax_allowed_packet bytes. If the secure_file_priv system variable is\nset to a nonempty directory name, the file to be loaded must be located\nin that directory.\n\nIf the file does not exist or cannot be read because one of the\npreceding conditions is not satisfied, the function returns NULL.\n\nThe character_set_filesystem system variable controls interpretation of\nfile names that are given as literal strings.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> UPDATE t\n SET blob_col=LOAD_FILE(\'/tmp/picture\')\n WHERE id=1;\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (360,3,'POINTFROMTEXT','PointFromText(wkt[,srid])\n\nConstructs a POINT value using its WKT representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (361,16,'GROUP_CONCAT','Syntax:\nGROUP_CONCAT(expr)\n\nThis function returns a string result with the concatenated non-NULL\nvalues from a group. It returns NULL if there are no non-NULL values.\nThe full syntax is as follows:\n\nGROUP_CONCAT([DISTINCT] expr [,expr ...]\n [ORDER BY {unsigned_integer | col_name | expr}\n [ASC | DESC] [,col_name ...]]\n [SEPARATOR str_val])\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','mysql> SELECT student_name,\n -> GROUP_CONCAT(test_score)\n -> FROM student\n -> GROUP BY student_name;\n','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (362,31,'DATE_FORMAT','Syntax:\nDATE_FORMAT(date,format)\n\nFormats the date value according to the format string.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT DATE_FORMAT(\'2009-10-04 22:23:00\', \'%W %M %Y\');\n -> \'Sunday October 2009\'\nmysql> SELECT DATE_FORMAT(\'2007-10-04 22:23:00\', \'%H:%i:%s\');\n -> \'22:23:00\'\nmysql> SELECT DATE_FORMAT(\'1900-10-04 22:23:00\',\n -> \'%D %y %a %d %m %b %j\');\n -> \'4th 00 Thu 04 10 Oct 277\'\nmysql> SELECT DATE_FORMAT(\'1997-10-04 22:23:00\',\n -> \'%H %k %I %r %T %S %w\');\n -> \'22 22 10 10:23:00 PM 22:23:00 00 6\'\nmysql> SELECT DATE_FORMAT(\'1999-01-01\', \'%X %V\');\n -> \'1998 52\'\nmysql> SELECT DATE_FORMAT(\'2006-06-00\', \'%d\');\n -> \'00\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (363,17,'BENCHMARK','Syntax:\nBENCHMARK(count,expr)\n\nThe BENCHMARK() function executes the expression expr repeatedly count\ntimes. It may be used to time how quickly MySQL processes the\nexpression. The result value is always 0. The intended use is from\nwithin the mysql client, which reports query execution times:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','mysql> SELECT BENCHMARK(1000000,ENCODE(\'hello\',\'goodbye\'));\n+----------------------------------------------+\n| BENCHMARK(1000000,ENCODE(\'hello\',\'goodbye\')) |\n+----------------------------------------------+\n| 0 |\n+----------------------------------------------+\n1 row in set (4.74 sec)\n','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (364,31,'YEAR','Syntax:\nYEAR(date)\n\nReturns the year for date, in the range 1000 to 9999, or 0 for the\n"zero" date.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT YEAR(\'1987-01-01\');\n -> 1987\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (365,26,'SHOW ENGINE','Syntax:\nSHOW ENGINE engine_name {STATUS | MUTEX}\n\nSHOW ENGINE displays operational information about a storage engine.\nThe following statements currently are supported:\n\nSHOW ENGINE INNODB STATUS\nSHOW ENGINE INNODB MUTEX\nSHOW ENGINE {NDB | NDBCLUSTER} STATUS\nSHOW ENGINE PERFORMANCE_SCHEMA STATUS\n\nSHOW ENGINE INNODB STATUS displays extensive information from the\nstandard InnoDB Monitor about the state of the InnoDB storage engine.\nFor information about the standard monitor and other InnoDB Monitors\nthat provide information about InnoDB processing, see\nhttp://dev.mysql.com/doc/refman/5.5/en/innodb-monitors.html.\n\nSHOW ENGINE INNODB MUTEX displays InnoDB mutex statistics. The\nstatement displays the following fields:\n\no Type\n\n Always InnoDB.\n\no Name\n\n The source file where the mutex is implemented, and the line number\n in the file where the mutex is created. The line number may change\n depending on your version of MySQL.\n\no Status\n\n The mutex status. This field displays several values if UNIV_DEBUG\n was defined at MySQL compilation time (for example, in include/univ.i\n in the InnoDB part of the MySQL source tree). If UNIV_DEBUG was not\n defined, the statement displays only the os_waits value. In the\n latter case (without UNIV_DEBUG), the information on which the output\n is based is insufficient to distinguish regular mutexes and mutexes\n that protect rw-locks (which permit multiple readers or a single\n writer). Consequently, the output may appear to contain multiple rows\n for the same mutex.\n\n o count indicates how many times the mutex was requested.\n\n o spin_waits indicates how many times the spinlock had to run.\n\n o spin_rounds indicates the number of spinlock rounds. (spin_rounds\n divided by spin_waits provides the average round count.)\n\n o os_waits indicates the number of operating system waits. This\n occurs when the spinlock did not work (the mutex was not locked\n during the spinlock and it was necessary to yield to the operating\n system and wait).\n\n o os_yields indicates the number of times a the thread trying to lock\n a mutex gave up its timeslice and yielded to the operating system\n (on the presumption that permitting other threads to run will free\n the mutex so that it can be locked).\n\n o os_wait_times indicates the amount of time (in ms) spent in\n operating system waits, if the timed_mutexes system variable is 1\n (ON). If timed_mutexes is 0 (OFF), timing is disabled, so\n os_wait_times is 0. timed_mutexes is off by default.\n\nInformation from this statement can be used to diagnose system\nproblems. For example, large values of spin_waits and spin_rounds may\nindicate scalability problems.\n\nUse SHOW ENGINE PERFORMANCE_SCHEMA STATUS to inspect the internal\noperation of the Performance Schema code:\n\nmysql> SHOW ENGINE PERFORMANCE_SCHEMA STATUS\\G\n...\n*************************** 3. row ***************************\n Type: performance_schema\n Name: events_waits_history.row_size\nStatus: 76\n*************************** 4. row ***************************\n Type: performance_schema\n Name: events_waits_history.row_count\nStatus: 10000\n*************************** 5. row ***************************\n Type: performance_schema\n Name: events_waits_history.memory\nStatus: 760000\n...\n*************************** 57. row ***************************\n Type: performance_schema\n Name: performance_schema.memory\nStatus: 26459600\n...\n\nThe intent of this statement is to help the DBA to understand the\neffects that different options have on memory requirements.\n\nName values consist of two parts, which name an internal buffer and an\nattribute of the buffer, respectively:\n\no Internal buffers that are exposed as a table in the\n performance_schema database are named after the table. Examples:\n events_waits_history.row_size, mutex_instances.row_count.\n\no Internal buffers that are not exposed as a table are named within\n parentheses. Examples: (pfs_cond_class).row_size,\n (pfs_mutex_class).memory.\n\no Values that apply to the Performance Schema as a whole begin with\n performance_schema. Example: performance_schema.memory.\n\nAttributes have these meanings:\n\no row_size cannot be changed. It is the size of the internal record\n used by the implementation.\n\no row_count can be changed depending on the configuration options.\n\no For a table, tbl_name.memory is the product of row_size multiplied by\n row_count. For the Performance Schema as a whole,\n performance_schema.memory is the sum of all the memory used (the sum\n of all other memory values).\n\nIn some cases, there is a direct relationship between a configuration\nparameter and a SHOW ENGINE value. For example,\nevents_waits_history_long.row_count corresponds to\nperformance_schema_events_waits_history_long_size. In other cases, the\nrelationship is more complex. For example,\nevents_waits_history.row_count corresponds to\nperformance_schema_events_waits_history_size (the number of rows per\nthread) multiplied by performance_schema_max_thread_instances ( the\nnumber of threads).\n\nIf the server has the NDBCLUSTER storage engine enabled, SHOW ENGINE\nNDB STATUS displays cluster status information such as the number of\nconnected data nodes, the cluster connectstring, and cluster binlog\nepochs, as well as counts of various Cluster API objects created by the\nMySQL Server when connected to the cluster. Sample output from this\nstatement is shown here:\n\nmysql> SHOW ENGINE NDB STATUS;\n+------------+-----------------------+--------------------------------------------------+\n| Type | Name | Status |\n+------------+-----------------------+--------------------------------------------------+\n| ndbcluster | connection | cluster_node_id=7,\n connected_host=192.168.0.103, connected_port=1186, number_of_data_nodes=4,\n number_of_ready_data_nodes=3, connect_count=0 |\n| ndbcluster | NdbTransaction | created=6, free=0, sizeof=212 |\n| ndbcluster | NdbOperation | created=8, free=8, sizeof=660 |\n| ndbcluster | NdbIndexScanOperation | created=1, free=1, sizeof=744 |\n| ndbcluster | NdbIndexOperation | created=0, free=0, sizeof=664 |\n| ndbcluster | NdbRecAttr | created=1285, free=1285, sizeof=60 |\n| ndbcluster | NdbApiSignal | created=16, free=16, sizeof=136 |\n| ndbcluster | NdbLabel | created=0, free=0, sizeof=196 |\n| ndbcluster | NdbBranch | created=0, free=0, sizeof=24 |\n| ndbcluster | NdbSubroutine | created=0, free=0, sizeof=68 |\n| ndbcluster | NdbCall | created=0, free=0, sizeof=16 |\n| ndbcluster | NdbBlob | created=1, free=1, sizeof=264 |\n| ndbcluster | NdbReceiver | created=4, free=0, sizeof=68 |\n| ndbcluster | binlog | latest_epoch=155467, latest_trans_epoch=148126,\n latest_received_binlog_epoch=0, latest_handled_binlog_epoch=0,\n latest_applied_binlog_epoch=0 |\n+------------+-----------------------+--------------------------------------------------+\n\nThe rows with connection and binlog in the Name column were added to\nthe output of this statement in MySQL 5.1. The Status column in each of\nthese rows provides information about the MySQL server\'s connection to\nthe cluster and about the cluster binary log\'s status, respectively.\nThe Status information is in the form of comma-delimited set of\nname/value pairs.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-engine.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-engine.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (366,14,'NAME_CONST','Syntax:\nNAME_CONST(name,value)\n\nReturns the given value. When used to produce a result set column,\nNAME_CONST() causes the column to have the given name. The arguments\nshould be constants.\n\nmysql> SELECT NAME_CONST(\'myname\', 14);\n+--------+\n| myname |\n+--------+\n| 14 |\n+--------+\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (367,14,'RELEASE_LOCK','Syntax:\nRELEASE_LOCK(str)\n\nReleases the lock named by the string str that was obtained with\nGET_LOCK(). Returns 1 if the lock was released, 0 if the lock was not\nestablished by this thread (in which case the lock is not released),\nand NULL if the named lock did not exist. The lock does not exist if it\nwas never obtained by a call to GET_LOCK() or if it has previously been\nreleased.\n\nThe DO statement is convenient to use with RELEASE_LOCK(). See [HELP\nDO].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (368,18,'IS NULL','Syntax:\nIS NULL\n\nTests whether a value is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 1 IS NULL, 0 IS NULL, NULL IS NULL;\n -> 0, 0, 1\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (369,31,'CONVERT_TZ','Syntax:\nCONVERT_TZ(dt,from_tz,to_tz)\n\nCONVERT_TZ() converts a datetime value dt from the time zone given by\nfrom_tz to the time zone given by to_tz and returns the resulting\nvalue. Time zones are specified as described in\nhttp://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html. This\nfunction returns NULL if the arguments are invalid.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT CONVERT_TZ(\'2004-01-01 12:00:00\',\'GMT\',\'MET\');\n -> \'2004-01-01 13:00:00\'\nmysql> SELECT CONVERT_TZ(\'2004-01-01 12:00:00\',\'+00:00\',\'+10:00\');\n -> \'2004-01-01 22:00:00\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (370,31,'TIME_TO_SEC','Syntax:\nTIME_TO_SEC(time)\n\nReturns the time argument, converted to seconds.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT TIME_TO_SEC(\'22:23:00\');\n -> 80580\nmysql> SELECT TIME_TO_SEC(\'00:39:38\');\n -> 2378\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (371,31,'WEEKDAY','Syntax:\nWEEKDAY(date)\n\nReturns the weekday index for date (0 = Monday, 1 = Tuesday, ... 6 =\nSunday).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT WEEKDAY(\'2008-02-03 22:23:00\');\n -> 6\nmysql> SELECT WEEKDAY(\'2007-11-06\');\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (372,37,'EXPORT_SET','Syntax:\nEXPORT_SET(bits,on,off[,separator[,number_of_bits]])\n\nReturns a string such that for every bit set in the value bits, you get\nan on string and for every bit not set in the value, you get an off\nstring. Bits in bits are examined from right to left (from low-order to\nhigh-order bits). Strings are added to the result from left to right,\nseparated by the separator string (the default being the comma\ncharacter ","). The number of bits examined is given by number_of_bits,\nwhich has a default of 64 if not specified. number_of_bits is silently\nclipped to 64 if larger than 64. It is treated as an unsigned integer,\nso a value of -1 is effectively the same as 64.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT EXPORT_SET(5,\'Y\',\'N\',\',\',4);\n -> \'Y,N,Y,N\'\nmysql> SELECT EXPORT_SET(6,\'1\',\'0\',\',\',10);\n -> \'0,1,1,0,0,0,0,0,0,0\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (373,39,'ALTER SERVER','Syntax:\nALTER SERVER server_name\n OPTIONS (option [, option] ...)\n\nAlters the server information for server_name, adjusting any of the\noptions permitted in the CREATE SERVER statement. See [HELP CREATE\nSERVER]. The corresponding fields in the mysql.servers table are\nupdated accordingly. This statement requires the SUPER privilege.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/alter-server.html\n\n','ALTER SERVER s OPTIONS (USER \'sally\');\n','http://dev.mysql.com/doc/refman/5.5/en/alter-server.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (374,23,'RESIGNAL','Syntax:\nRESIGNAL [condition_value]\n [SET signal_information_item\n [, signal_information_item] ...]\n\ncondition_value:\n SQLSTATE [VALUE] sqlstate_value\n | condition_name\n\nsignal_information_item:\n condition_information_item_name = simple_value_specification\n\ncondition_information_item_name:\n CLASS_ORIGIN\n | SUBCLASS_ORIGIN\n | MESSAGE_TEXT\n | MYSQL_ERRNO\n | CONSTRAINT_CATALOG\n | CONSTRAINT_SCHEMA\n | CONSTRAINT_NAME\n | CATALOG_NAME\n | SCHEMA_NAME\n | TABLE_NAME\n | COLUMN_NAME\n | CURSOR_NAME\n\ncondition_name, simple_value_specification:\n (see following discussion)\n\nRESIGNAL passes on the error condition information that is available\nduring execution of a condition handler within a compound statement\ninside a stored procedure or function, trigger, or event. RESIGNAL may\nchange some or all information before passing it on. RESIGNAL is\nrelated to SIGNAL, but instead of originating a condition as SIGNAL\ndoes, RESIGNAL relays existing condition information, possibly after\nmodifying it.\n\nRESIGNAL makes it possible to both handle an error and return the error\ninformation. Otherwise, by executing an SQL statement within the\nhandler, information that caused the handler\'s activation is destroyed.\nRESIGNAL also can make some procedures shorter if a given handler can\nhandle part of a situation, then pass the condition "up the line" to\nanother handler.\n\nNo special privileges are required to execute the RESIGNAL statement.\n\nFor condition_value and signal_information_item, the definitions and\nrules are the same for RESIGNAL as for SIGNAL (see [HELP SIGNAL]).\n\nThe RESIGNAL statement takes condition_value and SET clauses, both of\nwhich are optional. This leads to several possible uses:\n\no RESIGNAL alone:\n\nRESIGNAL;\n\no RESIGNAL with new signal information:\n\nRESIGNAL SET signal_information_item [, signal_information_item] ...;\n\no RESIGNAL with a condition value and possibly new signal information:\n\nRESIGNAL condition_value\n [SET signal_information_item [, signal_information_item] ...];\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/resignal.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/resignal.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (375,31,'TIME FUNCTION','Syntax:\nTIME(expr)\n\nExtracts the time part of the time or datetime expression expr and\nreturns it as a string.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT TIME(\'2003-12-31 01:02:03\');\n -> \'01:02:03\'\nmysql> SELECT TIME(\'2003-12-31 01:02:03.000123\');\n -> \'01:02:03.000123\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (376,31,'DATE_ADD','Syntax:\nDATE_ADD(date,INTERVAL expr unit), DATE_SUB(date,INTERVAL expr unit)\n\nThese functions perform date arithmetic. The date argument specifies\nthe starting date or datetime value. expr is an expression specifying\nthe interval value to be added or subtracted from the starting date.\nexpr is a string; it may start with a "-" for negative intervals. unit\nis a keyword indicating the units in which the expression should be\ninterpreted.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT \'2008-12-31 23:59:59\' + INTERVAL 1 SECOND;\n -> \'2009-01-01 00:00:00\'\nmysql> SELECT INTERVAL 1 DAY + \'2008-12-31\';\n -> \'2009-01-01\'\nmysql> SELECT \'2005-01-01\' - INTERVAL 1 SECOND;\n -> \'2004-12-31 23:59:59\'\nmysql> SELECT DATE_ADD(\'2000-12-31 23:59:59\',\n -> INTERVAL 1 SECOND);\n -> \'2001-01-01 00:00:00\'\nmysql> SELECT DATE_ADD(\'2010-12-31 23:59:59\',\n -> INTERVAL 1 DAY);\n -> \'2011-01-01 23:59:59\'\nmysql> SELECT DATE_ADD(\'2100-12-31 23:59:59\',\n -> INTERVAL \'1:1\' MINUTE_SECOND);\n -> \'2101-01-01 00:01:00\'\nmysql> SELECT DATE_SUB(\'2005-01-01 00:00:00\',\n -> INTERVAL \'1 1:1:1\' DAY_SECOND);\n -> \'2004-12-30 22:58:59\'\nmysql> SELECT DATE_ADD(\'1900-01-01 00:00:00\',\n -> INTERVAL \'-1 10\' DAY_HOUR);\n -> \'1899-12-30 14:00:00\'\nmysql> SELECT DATE_SUB(\'1998-01-02\', INTERVAL 31 DAY);\n -> \'1997-12-02\'\nmysql> SELECT DATE_ADD(\'1992-12-31 23:59:59.000002\',\n -> INTERVAL \'1.999999\' SECOND_MICROSECOND);\n -> \'1993-01-01 00:00:01.000001\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (377,37,'CAST','Syntax:\nCAST(expr AS type)\n\nThe CAST() function takes an expression of any type and produces a\nresult value of a specified type, similar to CONVERT(). See the\ndescription of CONVERT() for more information.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/cast-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/cast-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (378,37,'SOUNDS LIKE','Syntax:\nexpr1 SOUNDS LIKE expr2\n\nThis is the same as SOUNDEX(expr1) = SOUNDEX(expr2).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (379,31,'PERIOD_DIFF','Syntax:\nPERIOD_DIFF(P1,P2)\n\nReturns the number of months between periods P1 and P2. P1 and P2\nshould be in the format YYMM or YYYYMM. Note that the period arguments\nP1 and P2 are not date values.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT PERIOD_DIFF(200802,200703);\n -> 11\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (380,37,'LIKE','Syntax:\nexpr LIKE pat [ESCAPE \'escape_char\']\n\nPattern matching using SQL simple regular expression comparison.\nReturns 1 (TRUE) or 0 (FALSE). If either expr or pat is NULL, the\nresult is NULL.\n\nThe pattern need not be a literal string. For example, it can be\nspecified as a string expression or table column.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-comparison-functions.html\n\n','mysql> SELECT \'David!\' LIKE \'David_\';\n -> 1\nmysql> SELECT \'David!\' LIKE \'%D%v%\';\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/string-comparison-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (381,24,'MULTIPOINT','MultiPoint(pt1,pt2,...)\n\nConstructs a MultiPoint value using Point or WKB Point arguments.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (382,19,'>>','Syntax:\n>>\n\nShifts a longlong (BIGINT) number to the right.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html\n\n','mysql> SELECT 4 >> 2;\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (383,23,'FETCH','Syntax:\nFETCH [[NEXT] FROM] cursor_name INTO var_name [, var_name] ...\n\nThis statement fetches the next row for the SELECT statement associated\nwith the specified cursor (which must be open), and advances the cursor\npointer. If a row exists, the fetched columns are stored in the named\nvariables. The number of columns retrieved by the SELECT statement must\nmatch the number of output variables specified in the FETCH statement.\n\nIf no more rows are available, a No Data condition occurs with SQLSTATE\nvalue \'02000\'. To detect this condition, you can set up a handler for\nit (or for a NOT FOUND condition). For an example, see\nhttp://dev.mysql.com/doc/refman/5.5/en/cursors.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/fetch.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/fetch.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (384,16,'AVG','Syntax:\nAVG([DISTINCT] expr)\n\nReturns the average value of expr. The DISTINCT option can be used to\nreturn the average of the distinct values of expr.\n\nAVG() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','mysql> SELECT student_name, AVG(test_score)\n -> FROM student\n -> GROUP BY student_name;\n','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (385,29,'TRUE FALSE','The constants TRUE and FALSE evaluate to 1 and 0, respectively. The\nconstant names can be written in any lettercase.\n\nmysql> SELECT TRUE, true, FALSE, false;\n -> 1, 1, 0, 0\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/boolean-literals.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/boolean-literals.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (386,6,'MBRWITHIN','MBRWithin(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangle of g1\nis within the Minimum Bounding Rectangle of g2. This tests the opposite\nrelationship as MBRContains().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr\n\n','mysql> SET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nmysql> SET @g2 = GeomFromText(\'Polygon((0 0,0 5,5 5,5 0,0 0))\');\nmysql> SELECT MBRWithin(@g1,@g2), MBRWithin(@g2,@g1);\n+--------------------+--------------------+\n| MBRWithin(@g1,@g2) | MBRWithin(@g2,@g1) |\n+--------------------+--------------------+\n| 1 | 0 |\n+--------------------+--------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (387,17,'SESSION_USER','Syntax:\nSESSION_USER()\n\nSESSION_USER() is a synonym for USER().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (388,18,'IN','Syntax:\nexpr IN (value,...)\n\nReturns 1 if expr is equal to any of the values in the IN list, else\nreturns 0. If all values are constants, they are evaluated according to\nthe type of expr and sorted. The search for the item then is done using\na binary search. This means IN is very quick if the IN value list\nconsists entirely of constants. Otherwise, type conversion takes place\naccording to the rules described in\nhttp://dev.mysql.com/doc/refman/5.5/en/type-conversion.html, but\napplied to all the arguments.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 2 IN (0,3,5,7);\n -> 0\nmysql> SELECT \'wefwf\' IN (\'wee\',\'wefwf\',\'weg\');\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (389,37,'QUOTE','Syntax:\nQUOTE(str)\n\nQuotes a string to produce a result that can be used as a properly\nescaped data value in an SQL statement. The string is returned enclosed\nby single quotation marks and with each instance of backslash ("\\"),\nsingle quote ("\'"), ASCII NUL, and Control+Z preceded by a backslash.\nIf the argument is NULL, the return value is the word "NULL" without\nenclosing single quotation marks.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT QUOTE(\'Don\\\'t!\');\n -> \'Don\\\'t!\'\nmysql> SELECT QUOTE(NULL);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (390,26,'HELP COMMAND','Syntax:\nmysql> help search_string\n\nIf you provide an argument to the help command, mysql uses it as a\nsearch string to access server-side help from the contents of the MySQL\nReference Manual. The proper operation of this command requires that\nthe help tables in the mysql database be initialized with help topic\ninformation (see\nhttp://dev.mysql.com/doc/refman/5.5/en/server-side-help-support.html).\n\nIf there is no match for the search string, the search fails:\n\nmysql> help me\n\nNothing found\nPlease try to run \'help contents\' for a list of all accessible topics\n\nUse help contents to see a list of the help categories:\n\nmysql> help contents\nYou asked for help about help category: "Contents"\nFor more information, type \'help <item>\', where <item> is one of the\nfollowing categories:\n Account Management\n Administration\n Data Definition\n Data Manipulation\n Data Types\n Functions\n Functions and Modifiers for Use with GROUP BY\n Geographic Features\n Language Structure\n Plugins\n Storage Engines\n Stored Routines\n Table Maintenance\n Transactions\n Triggers\n\nIf the search string matches multiple items, mysql shows a list of\nmatching topics:\n\nmysql> help logs\nMany help items for your request exist.\nTo make a more specific request, please type \'help <item>\',\nwhere <item> is one of the following topics:\n SHOW\n SHOW BINARY LOGS\n SHOW ENGINE\n SHOW LOGS\n\nUse a topic as the search string to see the help entry for that topic:\n\nmysql> help show binary logs\nName: \'SHOW BINARY LOGS\'\nDescription:\nSyntax:\nSHOW BINARY LOGS\nSHOW MASTER LOGS\n\nLists the binary log files on the server. This statement is used as\npart of the procedure described in [purge-binary-logs], that shows how\nto determine which logs can be purged.\n\nmysql> SHOW BINARY LOGS;\n+---------------+-----------+\n| Log_name | File_size |\n+---------------+-----------+\n| binlog.000015 | 724935 |\n| binlog.000016 | 733481 |\n+---------------+-----------+\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mysql-server-side-help.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/mysql-server-side-help.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (391,31,'QUARTER','Syntax:\nQUARTER(date)\n\nReturns the quarter of the year for date, in the range 1 to 4.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT QUARTER(\'2008-04-01\');\n -> 2\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (392,37,'POSITION','Syntax:\nPOSITION(substr IN str)\n\nPOSITION(substr IN str) is a synonym for LOCATE(substr,str).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (393,26,'SHOW CREATE FUNCTION','Syntax:\nSHOW CREATE FUNCTION func_name\n\nThis statement is similar to SHOW CREATE PROCEDURE but for stored\nfunctions. See [HELP SHOW CREATE PROCEDURE].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-create-function.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-create-function.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (394,14,'IS_USED_LOCK','Syntax:\nIS_USED_LOCK(str)\n\nChecks whether the lock named str is in use (that is, locked). If so,\nit returns the connection identifier of the client that holds the lock.\nOtherwise, it returns NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (395,3,'POLYFROMTEXT','PolyFromText(wkt[,srid]), PolygonFromText(wkt[,srid])\n\nConstructs a POLYGON value using its WKT representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (396,12,'DES_ENCRYPT','Syntax:\nDES_ENCRYPT(str[,{key_num|key_str}])\n\nEncrypts the string with the given key using the Triple-DES algorithm.\n\nThis function works only if MySQL has been configured with SSL support.\nSee http://dev.mysql.com/doc/refman/5.5/en/ssl-connections.html.\n\nThe encryption key to use is chosen based on the second argument to\nDES_ENCRYPT(), if one was given. With no argument, the first key from\nthe DES key file is used. With a key_num argument, the given key number\n(0 to 9) from the DES key file is used. With a key_str argument, the\ngiven key string is used to encrypt str.\n\nThe key file can be specified with the --des-key-file server option.\n\nThe return string is a binary string where the first character is\nCHAR(128 | key_num). If an error occurs, DES_ENCRYPT() returns NULL.\n\nThe 128 is added to make it easier to recognize an encrypted key. If\nyou use a string key, key_num is 127.\n\nThe string length for the result is given by this formula:\n\nnew_len = orig_len + (8 - (orig_len % 8)) + 1\n\nEach line in the DES key file has the following format:\n\nkey_num des_key_str\n\nEach key_num value must be a number in the range from 0 to 9. Lines in\nthe file may be in any order. des_key_str is the string that is used to\nencrypt the message. There should be at least one space between the\nnumber and the key. The first key is the default key that is used if\nyou do not specify any key argument to DES_ENCRYPT().\n\nYou can tell MySQL to read new key values from the key file with the\nFLUSH DES_KEY_FILE statement. This requires the RELOAD privilege.\n\nOne benefit of having a set of default keys is that it gives\napplications a way to check for the existence of encrypted column\nvalues, without giving the end user the right to decrypt those values.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','mysql> SELECT customer_address FROM customer_table \n > WHERE crypted_credit_card = DES_ENCRYPT(\'credit_card_number\');\n','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (397,4,'CEIL','Syntax:\nCEIL(X)\n\nCEIL() is a synonym for CEILING().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (398,37,'LENGTH','Syntax:\nLENGTH(str)\n\nReturns the length of the string str, measured in bytes. A multi-byte\ncharacter counts as multiple bytes. This means that for a string\ncontaining five 2-byte characters, LENGTH() returns 10, whereas\nCHAR_LENGTH() returns 5.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT LENGTH(\'text\');\n -> 4\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (399,31,'STR_TO_DATE','Syntax:\nSTR_TO_DATE(str,format)\n\nThis is the inverse of the DATE_FORMAT() function. It takes a string\nstr and a format string format. STR_TO_DATE() returns a DATETIME value\nif the format string contains both date and time parts, or a DATE or\nTIME value if the string contains only date or time parts. If the date,\ntime, or datetime value extracted from str is illegal, STR_TO_DATE()\nreturns NULL and produces a warning.\n\nThe server scans str attempting to match format to it. The format\nstring can contain literal characters and format specifiers beginning\nwith %. Literal characters in format must match literally in str.\nFormat specifiers in format must match a date or time part in str. For\nthe specifiers that can be used in format, see the DATE_FORMAT()\nfunction description.\n\nmysql> SELECT STR_TO_DATE(\'01,5,2013\',\'%d,%m,%Y\');\n -> \'2013-05-01\'\nmysql> SELECT STR_TO_DATE(\'May 1, 2013\',\'%M %d,%Y\');\n -> \'2013-05-01\'\n\nScanning starts at the beginning of str and fails if format is found\nnot to match. Extra characters at the end of str are ignored.\n\nmysql> SELECT STR_TO_DATE(\'a09:30:17\',\'a%h:%i:%s\');\n -> \'09:30:17\'\nmysql> SELECT STR_TO_DATE(\'a09:30:17\',\'%h:%i:%s\');\n -> NULL\nmysql> SELECT STR_TO_DATE(\'09:30:17a\',\'%h:%i:%s\');\n -> \'09:30:17\'\n\nUnspecified date or time parts have a value of 0, so incompletely\nspecified values in str produce a result with some or all parts set to\n0:\n\nmysql> SELECT STR_TO_DATE(\'abc\',\'abc\');\n -> \'0000-00-00\'\nmysql> SELECT STR_TO_DATE(\'9\',\'%m\');\n -> \'0000-09-00\'\nmysql> SELECT STR_TO_DATE(\'9\',\'%s\');\n -> \'00:00:09\'\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (400,11,'Y','Y(p)\n\nReturns the Y-coordinate value for the Point object p as a\ndouble-precision number.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#point-property-functions\n\n','mysql> SELECT Y(POINT(56.7, 53.34));\n+-----------------------+\n| Y(POINT(56.7, 53.34)) |\n+-----------------------+\n| 53.34 |\n+-----------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#point-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (401,20,'CHECKSUM TABLE','Syntax:\nCHECKSUM TABLE tbl_name [, tbl_name] ... [ QUICK | EXTENDED ]\n\nCHECKSUM TABLE reports a table checksum. This statement requires the\nSELECT privilege for the table.\n\nWith QUICK, the live table checksum is reported if it is available, or\nNULL otherwise. This is very fast. A live checksum is enabled by\nspecifying the CHECKSUM=1 table option when you create the table;\ncurrently, this is supported only for MyISAM tables. See [HELP CREATE\nTABLE].\n\nWith EXTENDED, the entire table is read row by row and the checksum is\ncalculated. This can be very slow for large tables.\n\nIf neither QUICK nor EXTENDED is specified, MySQL returns a live\nchecksum if the table storage engine supports it and scans the table\notherwise.\n\nFor a nonexistent table, CHECKSUM TABLE returns NULL and generates a\nwarning.\n\nIn MySQL 5.5, CHECKSUM TABLE returns 0 for partitioned tables unless\nyou include the EXTENDED option. This issue is resolved in MySQL 5.6.\n(Bug #11933226, Bug #60681)\n\nThe checksum value depends on the table row format. If the row format\nchanges, the checksum also changes. For example, the storage format for\nVARCHAR changed between MySQL 4.1 and 5.0, so if a 4.1 table is\nupgraded to MySQL 5.0, the checksum value may change.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/checksum-table.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/checksum-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (402,2,'NUMINTERIORRINGS','NumInteriorRings(poly)\n\nReturns the number of interior rings in the Polygon value poly.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#polygon-property-functions\n\n','mysql> SET @poly =\n -> \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))\';\nmysql> SELECT NumInteriorRings(GeomFromText(@poly));\n+---------------------------------------+\n| NumInteriorRings(GeomFromText(@poly)) |\n+---------------------------------------+\n| 1 |\n+---------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#polygon-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (403,2,'INTERIORRINGN','InteriorRingN(poly,N)\n\nReturns the N-th interior ring for the Polygon value poly as a\nLineString. Rings are numbered beginning with 1.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#polygon-property-functions\n\n','mysql> SET @poly =\n -> \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))\';\nmysql> SELECT AsText(InteriorRingN(GeomFromText(@poly),1));\n+----------------------------------------------+\n| AsText(InteriorRingN(GeomFromText(@poly),1)) |\n+----------------------------------------------+\n| LINESTRING(1 1,1 2,2 2,2 1,1 1) |\n+----------------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#polygon-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (404,31,'UTC_TIME','Syntax:\nUTC_TIME, UTC_TIME()\n\nReturns the current UTC time as a value in \'HH:MM:SS\' or HHMMSS.uuuuuu\nformat, depending on whether the function is used in a string or\nnumeric context.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT UTC_TIME(), UTC_TIME() + 0;\n -> \'18:07:53\', 180753.000000\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (405,39,'DROP FUNCTION','The DROP FUNCTION statement is used to drop stored functions and\nuser-defined functions (UDFs):\n\no For information about dropping stored functions, see [HELP DROP\n PROCEDURE].\n\no For information about dropping user-defined functions, see [HELP DROP\n FUNCTION UDF].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-function.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-function.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (406,39,'ALTER EVENT','Syntax:\nALTER\n [DEFINER = { user | CURRENT_USER }]\n EVENT event_name\n [ON SCHEDULE schedule]\n [ON COMPLETION [NOT] PRESERVE]\n [RENAME TO new_event_name]\n [ENABLE | DISABLE | DISABLE ON SLAVE]\n [COMMENT \'comment\']\n [DO event_body]\n\nThe ALTER EVENT statement changes one or more of the characteristics of\nan existing event without the need to drop and recreate it. The syntax\nfor each of the DEFINER, ON SCHEDULE, ON COMPLETION, COMMENT, ENABLE /\nDISABLE, and DO clauses is exactly the same as when used with CREATE\nEVENT. (See [HELP CREATE EVENT].)\n\nAny user can alter an event defined on a database for which that user\nhas the EVENT privilege. When a user executes a successful ALTER EVENT\nstatement, that user becomes the definer for the affected event.\n\nALTER EVENT works only with an existing event:\n\nmysql> ALTER EVENT no_such_event \n > ON SCHEDULE \n > EVERY \'2:3\' DAY_HOUR;\nERROR 1517 (HY000): Unknown event \'no_such_event\'\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/alter-event.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/alter-event.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (407,16,'STDDEV','Syntax:\nSTDDEV(expr)\n\nReturns the population standard deviation of expr. This function is\nprovided for compatibility with Oracle. The standard SQL function\nSTDDEV_POP() can be used instead.\n\nThis function returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (408,31,'DATE_SUB','Syntax:\nDATE_SUB(date,INTERVAL expr unit)\n\nSee the description for DATE_ADD().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (409,31,'PERIOD_ADD','Syntax:\nPERIOD_ADD(P,N)\n\nAdds N months to period P (in the format YYMM or YYYYMM). Returns a\nvalue in the format YYYYMM. Note that the period argument P is not a\ndate value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT PERIOD_ADD(200801,2);\n -> 200803\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (410,19,'|','Syntax:\n|\n\nBitwise OR:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html\n\n','mysql> SELECT 29 | 15;\n -> 31\n','http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (411,3,'GEOMFROMTEXT','GeomFromText(wkt[,srid]), GeometryFromText(wkt[,srid])\n\nConstructs a geometry value of any type using its WKT representation\nand SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (412,14,'UUID_SHORT','Syntax:\nUUID_SHORT()\n\nReturns a "short" universal identifier as a 64-bit unsigned integer\n(rather than a string-form 128-bit identifier as returned by the UUID()\nfunction).\n\nThe value of UUID_SHORT() is guaranteed to be unique if the following\nconditions hold:\n\no The server_id of the current host is unique among your set of master\n and slave servers\n\no server_id is between 0 and 255\n\no You do not set back your system time for your server between mysqld\n restarts\n\no You do not invoke UUID_SHORT() on average more than 16 million times\n per second between mysqld restarts\n\nThe UUID_SHORT() return value is constructed this way:\n\n (server_id & 255) << 56\n+ (server_startup_time_in_seconds << 24)\n+ incremented_variable++;\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','mysql> SELECT UUID_SHORT();\n -> 92395783831158784\n','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (413,37,'RIGHT','Syntax:\nRIGHT(str,len)\n\nReturns the rightmost len characters from the string str, or NULL if\nany argument is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT RIGHT(\'foobarbar\', 4);\n -> \'rbar\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (414,31,'DATEDIFF','Syntax:\nDATEDIFF(expr1,expr2)\n\nDATEDIFF() returns expr1 - expr2 expressed as a value in days from one\ndate to the other. expr1 and expr2 are date or date-and-time\nexpressions. Only the date parts of the values are used in the\ncalculation.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT DATEDIFF(\'2007-12-31 23:59:59\',\'2007-12-30\');\n -> 1\nmysql> SELECT DATEDIFF(\'2010-11-30 23:59:59\',\'2010-12-31\');\n -> -31\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (415,39,'DROP TABLESPACE','Syntax:\nDROP TABLESPACE tablespace_name\n ENGINE [=] engine_name\n\nThis statement drops a tablespace that was previously created using\nCREATE TABLESPACE (see [HELP CREATE TABLESPACE]).\n\n*Important*: The tablespace to be dropped must not contain any data\nfiles; in other words, before you can drop a tablespace, you must first\ndrop each of its data files using ALTER TABLESPACE ... DROP DATAFILE\n(see [HELP ALTER TABLESPACE]).\n\nThe ENGINE clause (required) specifies the storage engine used by the\ntablespace. Currently, the only accepted values for engine_name are NDB\nand NDBCLUSTER.\n\nDROP TABLESPACE is useful only with Disk Data storage for MySQL\nCluster. See\nhttp://dev.mysql.com/doc/refman/5.5/en/mysql-cluster-disk-data.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-tablespace.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-tablespace.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (416,39,'DROP PROCEDURE','Syntax:\nDROP {PROCEDURE | FUNCTION} [IF EXISTS] sp_name\n\nThis statement is used to drop a stored procedure or function. That is,\nthe specified routine is removed from the server. You must have the\nALTER ROUTINE privilege for the routine. (If the\nautomatic_sp_privileges system variable is enabled, that privilege and\nEXECUTE are granted automatically to the routine creator when the\nroutine is created and dropped from the creator when the routine is\ndropped. See\nhttp://dev.mysql.com/doc/refman/5.5/en/stored-routines-privileges.html.\n)\n\nThe IF EXISTS clause is a MySQL extension. It prevents an error from\noccurring if the procedure or function does not exist. A warning is\nproduced that can be viewed with SHOW WARNINGS.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-procedure.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-procedure.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (417,20,'CHECK TABLE','Syntax:\nCHECK TABLE tbl_name [, tbl_name] ... [option] ...\n\noption = {FOR UPGRADE | QUICK | FAST | MEDIUM | EXTENDED | CHANGED}\n\nCHECK TABLE checks a table or tables for errors. CHECK TABLE works for\nInnoDB, MyISAM, ARCHIVE, and CSV tables. For MyISAM tables, the key\nstatistics are updated as well.\n\nTo check a table, you must have some privilege for it.\n\nCHECK TABLE can also check views for problems, such as tables that are\nreferenced in the view definition that no longer exist.\n\nCHECK TABLE is supported for partitioned tables, and you can use ALTER\nTABLE ... CHECK PARTITION to check one or more partitions; for more\ninformation, see [HELP ALTER TABLE], and\nhttp://dev.mysql.com/doc/refman/5.5/en/partitioning-maintenance.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/check-table.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/check-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (418,37,'BIN','Syntax:\nBIN(N)\n\nReturns a string representation of the binary value of N, where N is a\nlonglong (BIGINT) number. This is equivalent to CONV(N,10,2). Returns\nNULL if N is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT BIN(12);\n -> \'1100\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (419,5,'INSTALL PLUGIN','Syntax:\nINSTALL PLUGIN plugin_name SONAME \'shared_library_name\'\n\nThis statement installs a server plugin. It requires the INSERT\nprivilege for the mysql.plugin table.\n\nplugin_name is the name of the plugin as defined in the plugin\ndescriptor structure contained in the library file (see\nhttp://dev.mysql.com/doc/refman/5.5/en/plugin-data-structures.html).\nPlugin names are not case sensitive. For maximal compatibility, plugin\nnames should be limited to ASCII letters, digits, and underscore\nbecause they are used in C source files, shell command lines, M4 and\nBourne shell scripts, and SQL environments.\n\nshared_library_name is the name of the shared library that contains the\nplugin code. The name includes the file name extension (for example,\nlibmyplugin.so, libmyplugin.dll, or libmyplugin.dylib).\n\nThe shared library must be located in the plugin directory (the\ndirectory named by the plugin_dir system variable). The library must be\nin the plugin directory itself, not in a subdirectory. By default,\nplugin_dir is the plugin directory under the directory named by the\npkglibdir configuration variable, but it can be changed by setting the\nvalue of plugin_dir at server startup. For example, set its value in a\nmy.cnf file:\n\n[mysqld]\nplugin_dir=/path/to/plugin/directory\n\nIf the value of plugin_dir is a relative path name, it is taken to be\nrelative to the MySQL base directory (the value of the basedir system\nvariable).\n\nINSTALL PLUGIN loads and initializes the plugin code to make the plugin\navailable for use. A plugin is initialized by executing its\ninitialization function, which handles any setup that the plugin must\nperform before it can be used. When the server shuts down, it executes\nthe deinitialization function for each plugin that is loaded so that\nthe plugin has a change to perform any final cleanup.\n\nINSTALL PLUGIN also registers the plugin by adding a line that\nindicates the plugin name and library file name to the mysql.plugin\ntable. At server startup, the server loads and initializes any plugin\nthat is listed in the mysql.plugin table. This means that a plugin is\ninstalled with INSTALL PLUGIN only once, not every time the server\nstarts. Plugin loading at startup does not occur if the server is\nstarted with the --skip-grant-tables option.\n\nA plugin library can contain multiple plugins. For each of them to be\ninstalled, use a separate INSTALL PLUGIN statement. Each statement\nnames a different plugin, but all of them specify the same library\nname.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/install-plugin.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/install-plugin.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (420,23,'DECLARE CURSOR','Syntax:\nDECLARE cursor_name CURSOR FOR select_statement\n\nThis statement declares a cursor and associates it with a SELECT\nstatement that retrieves the rows to be traversed by the cursor. To\nfetch the rows later, use a FETCH statement. The number of columns\nretrieved by the SELECT statement must match the number of output\nvariables specified in the FETCH statement.\n\nThe SELECT statement cannot have an INTO clause.\n\nCursor declarations must appear before handler declarations and after\nvariable and condition declarations.\n\nA stored program may contain multiple cursor declarations, but each\ncursor declared in a given block must have a unique name. For an\nexample, see http://dev.mysql.com/doc/refman/5.5/en/cursors.html.\n\nFor information available through SHOW statements, it is possible in\nmany cases to obtain equivalent information by using a cursor with an\nINFORMATION_SCHEMA table.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/declare-cursor.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/declare-cursor.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (421,27,'LOAD DATA','Syntax:\nLOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE \'file_name\'\n [REPLACE | IGNORE]\n INTO TABLE tbl_name\n [CHARACTER SET charset_name]\n [{FIELDS | COLUMNS}\n [TERMINATED BY \'string\']\n [[OPTIONALLY] ENCLOSED BY \'char\']\n [ESCAPED BY \'char\']\n ]\n [LINES\n [STARTING BY \'string\']\n [TERMINATED BY \'string\']\n ]\n [IGNORE number {LINES | ROWS}]\n [(col_name_or_user_var,...)]\n [SET col_name = expr,...]\n\nThe LOAD DATA INFILE statement reads rows from a text file into a table\nat a very high speed. The file name must be given as a literal string.\n\nLOAD DATA INFILE is the complement of SELECT ... INTO OUTFILE. (See\nhttp://dev.mysql.com/doc/refman/5.5/en/select-into.html.) To write data\nfrom a table to a file, use SELECT ... INTO OUTFILE. To read the file\nback into a table, use LOAD DATA INFILE. The syntax of the FIELDS and\nLINES clauses is the same for both statements. Both clauses are\noptional, but FIELDS must precede LINES if both are specified.\n\nFor more information about the efficiency of INSERT versus LOAD DATA\nINFILE and speeding up LOAD DATA INFILE, see\nhttp://dev.mysql.com/doc/refman/5.5/en/insert-speed.html.\n\nThe character set indicated by the character_set_database system\nvariable is used to interpret the information in the file. SET NAMES\nand the setting of character_set_client do not affect interpretation of\ninput. If the contents of the input file use a character set that\ndiffers from the default, it is usually preferable to specify the\ncharacter set of the file by using the CHARACTER SET clause. A\ncharacter set of binary specifies "no conversion."\n\nLOAD DATA INFILE interprets all fields in the file as having the same\ncharacter set, regardless of the data types of the columns into which\nfield values are loaded. For proper interpretation of file contents,\nyou must ensure that it was written with the correct character set. For\nexample, if you write a data file with mysqldump -T or by issuing a\nSELECT ... INTO OUTFILE statement in mysql, be sure to use a\n--default-character-set option with mysqldump or mysql so that output\nis written in the character set to be used when the file is loaded with\nLOAD DATA INFILE.\n\n*Note*: It is not possible to load data files that use the ucs2, utf16,\nor utf32 character set.\n\nThe character_set_filesystem system variable controls the\ninterpretation of the file name.\n\nYou can also load data files by using the mysqlimport utility; it\noperates by sending a LOAD DATA INFILE statement to the server. The\n--local option causes mysqlimport to read data files from the client\nhost. You can specify the --compress option to get better performance\nover slow networks if the client and server support the compressed\nprotocol. See http://dev.mysql.com/doc/refman/5.5/en/mysqlimport.html.\n\nIf you use LOW_PRIORITY, execution of the LOAD DATA statement is\ndelayed until no other clients are reading from the table. This affects\nonly storage engines that use only table-level locking (such as MyISAM,\nMEMORY, and MERGE).\n\nIf you specify CONCURRENT with a MyISAM table that satisfies the\ncondition for concurrent inserts (that is, it contains no free blocks\nin the middle), other threads can retrieve data from the table while\nLOAD DATA is executing. Using this option affects the performance of\nLOAD DATA a bit, even if no other thread is using the table at the same\ntime.\n\nPrior to MySQL 5.5.1, CONCURRENT was not replicated when using\nstatement-based replication (see Bug #34628). However, it is replicated\nwhen using row-based replication, regardless of the version. See\nhttp://dev.mysql.com/doc/refman/5.5/en/replication-features-load-data.h\ntml, for more information.\n\nThe LOCAL keyword, if specified, is interpreted with respect to the\nclient end of the connection:\n\no If LOCAL is specified, the file is read by the client program on the\n client host and sent to the server. The file can be given as a full\n path name to specify its exact location. If given as a relative path\n name, the name is interpreted relative to the directory in which the\n client program was started.\n\n When using LOCAL with LOAD DATA, a copy of the file is created in the\n server\'s temporary directory. This is not the directory determined by\n the value of tmpdir or slave_load_tmpdir, but rather the operating\n system\'s temporary directory, and is not configurable in the MySQL\n Server. (Typically the system temporary directory is /tmp on Linux\n systems and C:\\WINDOWS\\TEMP on Windows.) Lack of sufficient space for\n the copy in this directory can cause the LOAD DATA LOCAL statement to\n fail.\n\no If LOCAL is not specified, the file must be located on the server\n host and is read directly by the server. The server uses the\n following rules to locate the file:\n\n o If the file name is an absolute path name, the server uses it as\n given.\n\n o If the file name is a relative path name with one or more leading\n components, the server searches for the file relative to the\n server\'s data directory.\n\n o If a file name with no leading components is given, the server\n looks for the file in the database directory of the default\n database.\n\nNote that, in the non-LOCAL case, these rules mean that a file named as\n./myfile.txt is read from the server\'s data directory, whereas the file\nnamed as myfile.txt is read from the database directory of the default\ndatabase. For example, if db1 is the default database, the following\nLOAD DATA statement reads the file data.txt from the database directory\nfor db1, even though the statement explicitly loads the file into a\ntable in the db2 database:\n\nLOAD DATA INFILE \'data.txt\' INTO TABLE db2.my_table;\n\nWindows path names are specified using forward slashes rather than\nbackslashes. If you do use backslashes, you must double them.\n\nFor security reasons, when reading text files located on the server,\nthe files must either reside in the database directory or be readable\nby all. Also, to use LOAD DATA INFILE on server files, you must have\nthe FILE privilege. See\nhttp://dev.mysql.com/doc/refman/5.5/en/privileges-provided.html. For\nnon-LOCAL load operations, if the secure_file_priv system variable is\nset to a nonempty directory name, the file to be loaded must be located\nin that directory.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/load-data.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/load-data.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (422,24,'MULTILINESTRING','MultiLineString(ls1,ls2,...)\n\nConstructs a MultiLineString value using LineString or WKB LineString\narguments.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (423,31,'LOCALTIME','Syntax:\nLOCALTIME, LOCALTIME()\n\nLOCALTIME and LOCALTIME() are synonyms for NOW().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (424,26,'SHOW RELAYLOG EVENTS','Syntax:\nSHOW RELAYLOG EVENTS\n [IN \'log_name\'] [FROM pos] [LIMIT [offset,] row_count]\n\nShows the events in the relay log of a replication slave. If you do not\nspecify \'log_name\', the first relay log is displayed. This statement\nhas no effect on the master.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-relaylog-events.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-relaylog-events.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (425,3,'MPOINTFROMTEXT','MPointFromText(wkt[,srid]), MultiPointFromText(wkt[,srid])\n\nConstructs a MULTIPOINT value using its WKT representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (426,22,'BLOB','BLOB[(M)]\n\nA BLOB column with a maximum length of 65,535 (216 - 1) bytes. Each\nBLOB value is stored using a 2-byte length prefix that indicates the\nnumber of bytes in the value.\n\nAn optional length M can be given for this type. If this is done, MySQL\ncreates the column as the smallest BLOB type large enough to hold\nvalues M bytes long.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (427,12,'SHA1','Syntax:\nSHA1(str), SHA(str)\n\nCalculates an SHA-1 160-bit checksum for the string, as described in\nRFC 3174 (Secure Hash Algorithm). The value is returned as a string of\n40 hex digits, or NULL if the argument was NULL. One of the possible\nuses for this function is as a hash key. See the notes at the beginning\nof this section about storing hash values efficiently. You can also use\nSHA1() as a cryptographic function for storing passwords. SHA() is\nsynonymous with SHA1().\n\nAs of MySQL 5.5.3, the return value is a nonbinary string in the\nconnection character set. Before 5.5.3, the return value is a binary\nstring; see the notes at the beginning of this section about using the\nvalue as a nonbinary string.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','mysql> SELECT SHA1(\'abc\');\n -> \'a9993e364706816aba3e25717850c26c9cd0d89d\'\n','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (428,37,'SUBSTR','Syntax:\nSUBSTR(str,pos), SUBSTR(str FROM pos), SUBSTR(str,pos,len), SUBSTR(str\nFROM pos FOR len)\n\nSUBSTR() is a synonym for SUBSTRING().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (429,12,'PASSWORD','Syntax:\nPASSWORD(str)\n\nCalculates and returns a hashed password string from the plaintext\npassword str and returns a nonbinary string in the connection character\nset (a binary string before MySQL 5.5.3), or NULL if the argument is\nNULL. This function is the SQL interface to the algorithm used by the\nserver to encrypt MySQL passwords for storage in the mysql.user grant\ntable.\n\nThe password hashing method used by PASSWORD() depends on the value of\nthe old_passwords system variable:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','mysql> SET old_passwords = 0;\nmysql> SELECT PASSWORD(\'mypass\');\n+-------------------------------------------+\n| PASSWORD(\'mypass\') |\n+-------------------------------------------+\n| *6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4 |\n+-------------------------------------------+\n\nmysql> SET old_passwords = 1;\nmysql> SELECT PASSWORD(\'mypass\');\n+--------------------+\n| PASSWORD(\'mypass\') |\n+--------------------+\n| 6f8c114b58f2ce9e |\n+--------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (430,22,'CHAR','[NATIONAL] CHAR[(M)] [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n\nA fixed-length string that is always right-padded with spaces to the\nspecified length when stored. M represents the column length in\ncharacters. The range of M is 0 to 255. If M is omitted, the length is\n1.\n\n*Note*: Trailing spaces are removed when CHAR values are retrieved\nunless the PAD_CHAR_TO_FULL_LENGTH SQL mode is enabled.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (431,31,'UTC_DATE','Syntax:\nUTC_DATE, UTC_DATE()\n\nReturns the current UTC date as a value in \'YYYY-MM-DD\' or YYYYMMDD\nformat, depending on whether the function is used in a string or\nnumeric context.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT UTC_DATE(), UTC_DATE() + 0;\n -> \'2003-08-14\', 20030814\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (432,36,'DIMENSION','Dimension(g)\n\nReturns the inherent dimension of the geometry value g. The result can\nbe -1, 0, 1, or 2. The meaning of these values is given in\nhttp://dev.mysql.com/doc/refman/5.5/en/gis-class-geometry.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions\n\n','mysql> SELECT Dimension(GeomFromText(\'LineString(1 1,2 2)\'));\n+------------------------------------------------+\n| Dimension(GeomFromText(\'LineString(1 1,2 2)\')) |\n+------------------------------------------------+\n| 1 |\n+------------------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (433,16,'COUNT DISTINCT','Syntax:\nCOUNT(DISTINCT expr,[expr...])\n\nReturns a count of the number of rows with different non-NULL expr\nvalues.\n\nCOUNT(DISTINCT) returns 0 if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','mysql> SELECT COUNT(DISTINCT results) FROM student;\n','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (434,22,'BIT','BIT[(M)]\n\nA bit-field type. M indicates the number of bits per value, from 1 to\n64. The default is 1 if M is omitted.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (435,30,'EQUALS','Equals(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 is spatially equal to g2.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (436,26,'SHOW CREATE VIEW','Syntax:\nSHOW CREATE VIEW view_name\n\nThis statement shows a CREATE VIEW statement that creates the given\nview.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-create-view.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-create-view.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (437,18,'INTERVAL','Syntax:\nINTERVAL(N,N1,N2,N3,...)\n\nReturns 0 if N < N1, 1 if N < N2 and so on or -1 if N is NULL. All\narguments are treated as integers. It is required that N1 < N2 < N3 <\n... < Nn for this function to work correctly. This is because a binary\nsearch is used (very fast).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT INTERVAL(23, 1, 15, 17, 30, 44, 200);\n -> 3\nmysql> SELECT INTERVAL(10, 1, 10, 100, 1000);\n -> 2\nmysql> SELECT INTERVAL(22, 23, 30, 44, 200);\n -> 0\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (438,31,'FROM_DAYS','Syntax:\nFROM_DAYS(N)\n\nGiven a day number N, returns a DATE value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT FROM_DAYS(730669);\n -> \'2007-07-03\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (439,39,'ALTER PROCEDURE','Syntax:\nALTER PROCEDURE proc_name [characteristic ...]\n\ncharacteristic:\n COMMENT \'string\'\n | LANGUAGE SQL\n | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }\n | SQL SECURITY { DEFINER | INVOKER }\n\nThis statement can be used to change the characteristics of a stored\nprocedure. More than one change may be specified in an ALTER PROCEDURE\nstatement. However, you cannot change the parameters or body of a\nstored procedure using this statement; to make such changes, you must\ndrop and re-create the procedure using DROP PROCEDURE and CREATE\nPROCEDURE.\n\nYou must have the ALTER ROUTINE privilege for the procedure. By\ndefault, that privilege is granted automatically to the procedure\ncreator. This behavior can be changed by disabling the\nautomatic_sp_privileges system variable. See\nhttp://dev.mysql.com/doc/refman/5.5/en/stored-routines-privileges.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/alter-procedure.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/alter-procedure.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (440,19,'BIT_COUNT','Syntax:\nBIT_COUNT(N)\n\nReturns the number of bits that are set in the argument N.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html\n\n','mysql> SELECT BIT_COUNT(29), BIT_COUNT(b\'101010\');\n -> 4, 3\n','http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (441,37,'OCTET_LENGTH','Syntax:\nOCTET_LENGTH(str)\n\nOCTET_LENGTH() is a synonym for LENGTH().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (442,31,'UTC_TIMESTAMP','Syntax:\nUTC_TIMESTAMP, UTC_TIMESTAMP()\n\nReturns the current UTC date and time as a value in \'YYYY-MM-DD\nHH:MM:SS\' or YYYYMMDDHHMMSS.uuuuuu format, depending on whether the\nfunction is used in a string or numeric context.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT UTC_TIMESTAMP(), UTC_TIMESTAMP() + 0;\n -> \'2003-08-14 18:08:04\', 20030814180804.000000\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (443,12,'AES_ENCRYPT','Syntax:\nAES_ENCRYPT(str,key_str)\n\nAES_ENCRYPT() and AES_DECRYPT() enable encryption and decryption of\ndata using the official AES (Advanced Encryption Standard) algorithm,\npreviously known as "Rijndael." Encoding with a 128-bit key length is\nused, but you can extend it up to 256 bits by modifying the source. We\nchose 128 bits because it is much faster and it is secure enough for\nmost purposes.\n\nAES_ENCRYPT() encrypts a string and returns a binary string.\nAES_DECRYPT() decrypts the encrypted string and returns the original\nstring. The input arguments may be any length. If either argument is\nNULL, the result of this function is also NULL.\n\nBecause AES is a block-level algorithm, padding is used to encode\nuneven length strings and so the result string length may be calculated\nusing this formula:\n\n16 * (trunc(string_length / 16) + 1)\n\nIf AES_DECRYPT() detects invalid data or incorrect padding, it returns\nNULL. However, it is possible for AES_DECRYPT() to return a non-NULL\nvalue (possibly garbage) if the input data or the key is invalid.\n\nYou can use the AES functions to store data in an encrypted form by\nmodifying your queries:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','INSERT INTO t VALUES (1,AES_ENCRYPT(\'text\',\'password\'));\n','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (444,4,'+','Syntax:\n+\n\nAddition:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html\n\n','mysql> SELECT 3+5;\n -> 8\n','http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (445,14,'INET_NTOA','Syntax:\nINET_NTOA(expr)\n\nGiven a numeric IPv4 network address in network byte order, returns the\ndotted-quad representation of the address as a string. INET_NTOA()\nreturns NULL if it does not understand its argument.\n\nAs of MySQL 5.5.3, the return value is a nonbinary string in the\nconnection character set. Before 5.5.3, the return value is a binary\nstring.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','mysql> SELECT INET_NTOA(167773449);\n -> \'10.0.5.9\'\n','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (446,4,'ACOS','Syntax:\nACOS(X)\n\nReturns the arc cosine of X, that is, the value whose cosine is X.\nReturns NULL if X is not in the range -1 to 1.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT ACOS(1);\n -> 0\nmysql> SELECT ACOS(1.0001);\n -> NULL\nmysql> SELECT ACOS(0);\n -> 1.5707963267949\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (447,8,'ISOLATION','Syntax:\nSET [GLOBAL | SESSION] TRANSACTION ISOLATION LEVEL\n {\n REPEATABLE READ\n | READ COMMITTED\n | READ UNCOMMITTED\n | SERIALIZABLE\n }\n\nThis statement sets the transaction isolation level, used for\noperations on InnoDB tables.\n\nScope of the Isolation Level\n\nYou can set the isolation level globally, for the current session, or\nfor the next transaction:\n\no With the GLOBAL keyword, the statement sets the default transaction\n level globally for all subsequent sessions. Existing sessions are\n unaffected.\n\no With the SESSION keyword, the statement sets the default transaction\n level for all subsequent transactions performed within the current\n session.\n\no Without any SESSION or GLOBAL keyword, the statement sets the\n isolation level for the next (not started) transaction performed\n within the current session.\n\nA change to the global default isolation level requires the SUPER\nprivilege. Any session is free to change its session isolation level\n(even in the middle of a transaction), or the isolation level for its\nnext transaction.\n\nSET TRANSACTION ISOLATION LEVEL without GLOBAL or SESSION is not\npermitted while there is an active transaction:\n\nmysql> START TRANSACTION;\nQuery OK, 0 rows affected (0.02 sec)\n\nmysql> SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;\nERROR 1568 (25001): Transaction isolation level can\'t be changed\nwhile a transaction is in progress\n\nTo set the global default isolation level at server startup, use the\n--transaction-isolation=level option to mysqld on the command line or\nin an option file. Values of level for this option use dashes rather\nthan spaces, so the permissible values are READ-UNCOMMITTED,\nREAD-COMMITTED, REPEATABLE-READ, or SERIALIZABLE. For example, to set\nthe default isolation level to REPEATABLE READ, use these lines in the\n[mysqld] section of an option file:\n\n[mysqld]\ntransaction-isolation = REPEATABLE-READ\n\nIt is possible to check or set the global and session transaction\nisolation levels at runtime by using the tx_isolation system variable:\n\nSELECT @@GLOBAL.tx_isolation, @@tx_isolation;\nSET GLOBAL tx_isolation=\'REPEATABLE-READ\';\nSET SESSION tx_isolation=\'SERIALIZABLE\';\n\nDetails and Usage of Isolation Levels\n\nInnoDB supports each of the transaction isolation levels described here\nusing different locking strategies. You can enforce a high degree of\nconsistency with the default REPEATABLE READ level, for operations on\ncrucial data where ACID compliance is important. Or you can relax the\nconsistency rules with READ COMMITTED or even READ UNCOMMITTED, in\nsituations such as bulk reporting where precise consistency and\nrepeatable results are less important than minimizing the amount of\noverhead for locking. SERIALIZABLE enforces even stricter rules than\nREPEATABLE READ, and is used mainly in specialized situations, such as\nwith XA transactions and for troubleshooting issues with concurrency\nand deadlocks.\n\nFor full information about how these isolation levels work with InnoDB\ntransactions, see\nhttp://dev.mysql.com/doc/refman/5.5/en/innodb-transaction-model.html.\nIn particular, for additional information about InnoDB record-level\nlocks and how it uses them to execute various types of statements, see\nhttp://dev.mysql.com/doc/refman/5.5/en/innodb-record-level-locks.html\nand http://dev.mysql.com/doc/refman/5.5/en/innodb-locks-set.html.\n\nThe following list describes how MySQL supports the different\ntransaction levels. The list goes from the most commonly used level to\nthe least used.\n\no REPEATABLE READ\n\n This is the default isolation level for InnoDB. For consistent reads,\n there is an important difference from the READ COMMITTED isolation\n level: All consistent reads within the same transaction read the\n snapshot established by the first read. This convention means that if\n you issue several plain (nonlocking) SELECT statements within the\n same transaction, these SELECT statements are consistent also with\n respect to each other. See\n http://dev.mysql.com/doc/refman/5.5/en/innodb-consistent-read.html.\n\n For locking reads (SELECT with FOR UPDATE or LOCK IN SHARE MODE),\n UPDATE, and DELETE statements, locking depends on whether the\n statement uses a unique index with a unique search condition, or a\n range-type search condition. For a unique index with a unique search\n condition, InnoDB locks only the index record found, not the gap\n before it. For other search conditions, InnoDB locks the index range\n scanned, using gap locks or next-key (gap plus index-record) locks to\n block insertions by other sessions into the gaps covered by the\n range.\n\no READ COMMITTED\n\n A somewhat Oracle-like isolation level with respect to consistent\n (nonlocking) reads: Each consistent read, even within the same\n transaction, sets and reads its own fresh snapshot. See\n http://dev.mysql.com/doc/refman/5.5/en/innodb-consistent-read.html.\n\n For locking reads (SELECT with FOR UPDATE or LOCK IN SHARE MODE),\n InnoDB locks only index records, not the gaps before them, and thus\n permits the free insertion of new records next to locked records. For\n UPDATE and DELETE statements, locking depends on whether the\n statement uses a unique index with a unique search condition (such as\n WHERE id = 100), or a range-type search condition (such as WHERE id >\n 100). For a unique index with a unique search condition, InnoDB locks\n only the index record found, not the gap before it. For range-type\n searches, InnoDB locks the index range scanned, using gap locks or\n next-key (gap plus index-record) locks to block insertions by other\n sessions into the gaps covered by the range. This is necessary\n because "phantom rows" must be blocked for MySQL replication and\n recovery to work.\n\n *Note*: In MySQL 5.5, if the READ COMMITTED isolation level is used\n or the innodb_locks_unsafe_for_binlog system variable is enabled,\n there is no InnoDB gap locking except for foreign-key constraint\n checking and duplicate-key checking. Also, record locks for\n nonmatching rows are released after MySQL has evaluated the WHERE\n condition. If you use READ COMMITTED or enable\n innodb_locks_unsafe_for_binlog, you must use row-based binary\n logging.\n\no READ UNCOMMITTED\n\n SELECT statements are performed in a nonlocking fashion, but a\n possible earlier version of a row might be used. Thus, using this\n isolation level, such reads are not consistent. This is also called a\n "dirty read." Otherwise, this isolation level works like READ\n COMMITTED.\n\no SERIALIZABLE\n\n This level is like REPEATABLE READ, but InnoDB implicitly converts\n all plain SELECT statements to SELECT ... LOCK IN SHARE MODE if\n autocommit is disabled. If autocommit is enabled, the SELECT is its\n own transaction. It therefore is known to be read only and can be\n serialized if performed as a consistent (nonlocking) read and need\n not block for other transactions. (To force a plain SELECT to block\n if other transactions have modified the selected rows, disable\n autocommit.)\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/set-transaction.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/set-transaction.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (448,4,'CEILING','Syntax:\nCEILING(X)\n\nReturns the smallest integer value not less than X.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT CEILING(1.23);\n -> 2\nmysql> SELECT CEILING(-1.23);\n -> -1\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (449,4,'SIN','Syntax:\nSIN(X)\n\nReturns the sine of X, where X is given in radians.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT SIN(PI());\n -> 1.2246063538224e-16\nmysql> SELECT ROUND(SIN(PI()));\n -> 0\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (450,31,'DAYOFWEEK','Syntax:\nDAYOFWEEK(date)\n\nReturns the weekday index for date (1 = Sunday, 2 = Monday, ..., 7 =\nSaturday). These index values correspond to the ODBC standard.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT DAYOFWEEK(\'2007-02-03\');\n -> 7\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (451,26,'SHOW PROCESSLIST','Syntax:\nSHOW [FULL] PROCESSLIST\n\nSHOW PROCESSLIST shows you which threads are running. You can also get\nthis information from the INFORMATION_SCHEMA PROCESSLIST table or the\nmysqladmin processlist command. If you have the PROCESS privilege, you\ncan see all threads. Otherwise, you can see only your own threads (that\nis, threads associated with the MySQL account that you are using). If\nyou do not use the FULL keyword, only the first 100 characters of each\nstatement are shown in the Info field.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-processlist.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-processlist.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (452,32,'LINEFROMWKB','LineFromWKB(wkb[,srid]), LineStringFromWKB(wkb[,srid])\n\nConstructs a LINESTRING value using its WKB representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (453,36,'GEOMETRYTYPE','GeometryType(g)\n\nReturns as a binary string the name of the geometry type of which the\ngeometry instance g is a member. The name corresponds to one of the\ninstantiable Geometry subclasses.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions\n\n','mysql> SELECT GeometryType(GeomFromText(\'POINT(1 1)\'));\n+------------------------------------------+\n| GeometryType(GeomFromText(\'POINT(1 1)\')) |\n+------------------------------------------+\n| POINT |\n+------------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (454,39,'CREATE VIEW','Syntax:\nCREATE\n [OR REPLACE]\n [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]\n [DEFINER = { user | CURRENT_USER }]\n [SQL SECURITY { DEFINER | INVOKER }]\n VIEW view_name [(column_list)]\n AS select_statement\n [WITH [CASCADED | LOCAL] CHECK OPTION]\n\nThe CREATE VIEW statement creates a new view, or replaces an existing\none if the OR REPLACE clause is given. If the view does not exist,\nCREATE OR REPLACE VIEW is the same as CREATE VIEW. If the view does\nexist, CREATE OR REPLACE VIEW is the same as ALTER VIEW.\n\nThe select_statement is a SELECT statement that provides the definition\nof the view. (When you select from the view, you select in effect using\nthe SELECT statement.) select_statement can select from base tables or\nother views.\n\nThe view definition is "frozen" at creation time, so changes to the\nunderlying tables afterward do not affect the view definition. For\nexample, if a view is defined as SELECT * on a table, new columns added\nto the table later do not become part of the view.\n\nThe ALGORITHM clause affects how MySQL processes the view. The DEFINER\nand SQL SECURITY clauses specify the security context to be used when\nchecking access privileges at view invocation time. The WITH CHECK\nOPTION clause can be given to constrain inserts or updates to rows in\ntables referenced by the view. These clauses are described later in\nthis section.\n\nThe CREATE VIEW statement requires the CREATE VIEW privilege for the\nview, and some privilege for each column selected by the SELECT\nstatement. For columns used elsewhere in the SELECT statement you must\nhave the SELECT privilege. If the OR REPLACE clause is present, you\nmust also have the DROP privilege for the view. CREATE VIEW might also\nrequire the SUPER privilege, depending on the DEFINER value, as\ndescribed later in this section.\n\nWhen a view is referenced, privilege checking occurs as described later\nin this section.\n\nA view belongs to a database. By default, a new view is created in the\ndefault database. To create the view explicitly in a given database,\nspecify the name as db_name.view_name when you create it:\n\nmysql> CREATE VIEW test.v AS SELECT * FROM t;\n\nWithin a database, base tables and views share the same namespace, so a\nbase table and a view cannot have the same name.\n\nColumns retrieved by the SELECT statement can be simple references to\ntable columns. They can also be expressions that use functions,\nconstant values, operators, and so forth.\n\nViews must have unique column names with no duplicates, just like base\ntables. By default, the names of the columns retrieved by the SELECT\nstatement are used for the view column names. To define explicit names\nfor the view columns, the optional column_list clause can be given as a\nlist of comma-separated identifiers. The number of names in column_list\nmust be the same as the number of columns retrieved by the SELECT\nstatement.\n\nUnqualified table or view names in the SELECT statement are interpreted\nwith respect to the default database. A view can refer to tables or\nviews in other databases by qualifying the table or view name with the\nproper database name.\n\nA view can be created from many kinds of SELECT statements. It can\nrefer to base tables or other views. It can use joins, UNION, and\nsubqueries. The SELECT need not even refer to any tables. The following\nexample defines a view that selects two columns from another table, as\nwell as an expression calculated from those columns:\n\nmysql> CREATE TABLE t (qty INT, price INT);\nmysql> INSERT INTO t VALUES(3, 50);\nmysql> CREATE VIEW v AS SELECT qty, price, qty*price AS value FROM t;\nmysql> SELECT * FROM v;\n+------+-------+-------+\n| qty | price | value |\n+------+-------+-------+\n| 3 | 50 | 150 |\n+------+-------+-------+\n\nA view definition is subject to the following restrictions:\n\no The SELECT statement cannot contain a subquery in the FROM clause.\n\no The SELECT statement cannot refer to system or user variables.\n\no Within a stored program, the definition cannot refer to program\n parameters or local variables.\n\no The SELECT statement cannot refer to prepared statement parameters.\n\no Any table or view referred to in the definition must exist. However,\n after a view has been created, it is possible to drop a table or view\n that the definition refers to. In this case, use of the view results\n in an error. To check a view definition for problems of this kind,\n use the CHECK TABLE statement.\n\no The definition cannot refer to a TEMPORARY table, and you cannot\n create a TEMPORARY view.\n\no Any tables named in the view definition must exist at definition\n time.\n\no You cannot associate a trigger with a view.\n\no Aliases for column names in the SELECT statement are checked against\n the maximum column length of 64 characters (not the maximum alias\n length of 256 characters).\n\nORDER BY is permitted in a view definition, but it is ignored if you\nselect from a view using a statement that has its own ORDER BY.\n\nFor other options or clauses in the definition, they are added to the\noptions or clauses of the statement that references the view, but the\neffect is undefined. For example, if a view definition includes a LIMIT\nclause, and you select from the view using a statement that has its own\nLIMIT clause, it is undefined which limit applies. This same principle\napplies to options such as ALL, DISTINCT, or SQL_SMALL_RESULT that\nfollow the SELECT keyword, and to clauses such as INTO, FOR UPDATE,\nLOCK IN SHARE MODE, and PROCEDURE.\n\nIf you create a view and then change the query processing environment\nby changing system variables, that may affect the results that you get\nfrom the view:\n\nmysql> CREATE VIEW v (mycol) AS SELECT \'abc\';\nQuery OK, 0 rows affected (0.01 sec)\n\nmysql> SET sql_mode = \'\';\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SELECT "mycol" FROM v;\n+-------+\n| mycol |\n+-------+\n| mycol |\n+-------+\n1 row in set (0.01 sec)\n\nmysql> SET sql_mode = \'ANSI_QUOTES\';\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SELECT "mycol" FROM v;\n+-------+\n| mycol |\n+-------+\n| abc |\n+-------+\n1 row in set (0.00 sec)\n\nThe DEFINER and SQL SECURITY clauses determine which MySQL account to\nuse when checking access privileges for the view when a statement is\nexecuted that references the view. The valid SQL SECURITY\ncharacteristic values are DEFINER and INVOKER. These indicate that the\nrequired privileges must be held by the user who defined or invoked the\nview, respectively. The default SQL SECURITY value is DEFINER.\n\nIf a user value is given for the DEFINER clause, it should be a MySQL\naccount specified as \'user_name\'@\'host_name\' (the same format used in\nthe GRANT statement), CURRENT_USER, or CURRENT_USER(). The default\nDEFINER value is the user who executes the CREATE VIEW statement. This\nis the same as specifying DEFINER = CURRENT_USER explicitly.\n\nIf you specify the DEFINER clause, these rules determine the valid\nDEFINER user values:\n\no If you do not have the SUPER privilege, the only valid user value is\n your own account, either specified literally or by using\n CURRENT_USER. You cannot set the definer to some other account.\n\no If you have the SUPER privilege, you can specify any syntactically\n valid account name. If the account does not actually exist, a warning\n is generated.\n\no Although it is possible to create a view with a nonexistent DEFINER\n account, an error occurs when the view is referenced if the SQL\n SECURITY value is DEFINER but the definer account does not exist.\n\nFor more information about view security, see\nhttp://dev.mysql.com/doc/refman/5.5/en/stored-programs-security.html.\n\nWithin a view definition, CURRENT_USER returns the view\'s DEFINER value\nby default. For views defined with the SQL SECURITY INVOKER\ncharacteristic, CURRENT_USER returns the account for the view\'s\ninvoker. For information about user auditing within views, see\nhttp://dev.mysql.com/doc/refman/5.5/en/account-activity-auditing.html.\n\nWithin a stored routine that is defined with the SQL SECURITY DEFINER\ncharacteristic, CURRENT_USER returns the routine\'s DEFINER value. This\nalso affects a view defined within such a routine, if the view\ndefinition contains a DEFINER value of CURRENT_USER.\n\nView privileges are checked like this:\n\no At view definition time, the view creator must have the privileges\n needed to use the top-level objects accessed by the view. For\n example, if the view definition refers to table columns, the creator\n must have some privilege for each column in the select list of the\n definition, and the SELECT privilege for each column used elsewhere\n in the definition. If the definition refers to a stored function,\n only the privileges needed to invoke the function can be checked. The\n privileges required at function invocation time can be checked only\n as it executes: For different invocations, different execution paths\n within the function might be taken.\n\no The user who references a view must have appropriate privileges to\n access it (SELECT to select from it, INSERT to insert into it, and so\n forth.)\n\no When a view has been referenced, privileges for objects accessed by\n the view are checked against the privileges held by the view DEFINER\n account or invoker, depending on whether the SQL SECURITY\n characteristic is DEFINER or INVOKER, respectively.\n\no If reference to a view causes execution of a stored function,\n privilege checking for statements executed within the function depend\n on whether the function SQL SECURITY characteristic is DEFINER or\n INVOKER. If the security characteristic is DEFINER, the function runs\n with the privileges of the DEFINER account. If the characteristic is\n INVOKER, the function runs with the privileges determined by the\n view\'s SQL SECURITY characteristic.\n\nExample: A view might depend on a stored function, and that function\nmight invoke other stored routines. For example, the following view\ninvokes a stored function f():\n\nCREATE VIEW v AS SELECT * FROM t WHERE t.id = f(t.name);\n\nSuppose that f() contains a statement such as this:\n\nIF name IS NULL then\n CALL p1();\nELSE\n CALL p2();\nEND IF;\n\nThe privileges required for executing statements within f() need to be\nchecked when f() executes. This might mean that privileges are needed\nfor p1() or p2(), depending on the execution path within f(). Those\nprivileges must be checked at runtime, and the user who must possess\nthe privileges is determined by the SQL SECURITY values of the view v\nand the function f().\n\nThe DEFINER and SQL SECURITY clauses for views are extensions to\nstandard SQL. In standard SQL, views are handled using the rules for\nSQL SECURITY DEFINER. The standard says that the definer of the view,\nwhich is the same as the owner of the view\'s schema, gets applicable\nprivileges on the view (for example, SELECT) and may grant them. MySQL\nhas no concept of a schema "owner", so MySQL adds a clause to identify\nthe definer. The DEFINER clause is an extension where the intent is to\nhave what the standard has; that is, a permanent record of who defined\nthe view. This is why the default DEFINER value is the account of the\nview creator.\n\nThe optional ALGORITHM clause is a MySQL extension to standard SQL. It\naffects how MySQL processes the view. ALGORITHM takes three values:\nMERGE, TEMPTABLE, or UNDEFINED. The default algorithm is UNDEFINED if\nno ALGORITHM clause is present. For more information, see\nhttp://dev.mysql.com/doc/refman/5.5/en/view-algorithms.html.\n\nSome views are updatable. That is, you can use them in statements such\nas UPDATE, DELETE, or INSERT to update the contents of the underlying\ntable. For a view to be updatable, there must be a one-to-one\nrelationship between the rows in the view and the rows in the\nunderlying table. There are also certain other constructs that make a\nview nonupdatable.\n\nThe WITH CHECK OPTION clause can be given for an updatable view to\nprevent inserts or updates to rows except those for which the WHERE\nclause in the select_statement is true.\n\nIn a WITH CHECK OPTION clause for an updatable view, the LOCAL and\nCASCADED keywords determine the scope of check testing when the view is\ndefined in terms of another view. The LOCAL keyword restricts the CHECK\nOPTION only to the view being defined. CASCADED causes the checks for\nunderlying views to be evaluated as well. When neither keyword is\ngiven, the default is CASCADED.\n\nFor more information about updatable views and the WITH CHECK OPTION\nclause, see\nhttp://dev.mysql.com/doc/refman/5.5/en/view-updatability.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-view.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/create-view.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (455,37,'TRIM','Syntax:\nTRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str), TRIM([remstr\nFROM] str)\n\nReturns the string str with all remstr prefixes or suffixes removed. If\nnone of the specifiers BOTH, LEADING, or TRAILING is given, BOTH is\nassumed. remstr is optional and, if not specified, spaces are removed.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT TRIM(\' bar \');\n -> \'bar\'\nmysql> SELECT TRIM(LEADING \'x\' FROM \'xxxbarxxx\');\n -> \'barxxx\'\nmysql> SELECT TRIM(BOTH \'x\' FROM \'xxxbarxxx\');\n -> \'bar\'\nmysql> SELECT TRIM(TRAILING \'xyz\' FROM \'barxxyz\');\n -> \'barx\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (456,18,'IS','Syntax:\nIS boolean_value\n\nTests a value against a boolean value, where boolean_value can be TRUE,\nFALSE, or UNKNOWN.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 1 IS TRUE, 0 IS FALSE, NULL IS UNKNOWN;\n -> 1, 1, 1\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (457,31,'GET_FORMAT','Syntax:\nGET_FORMAT({DATE|TIME|DATETIME}, {\'EUR\'|\'USA\'|\'JIS\'|\'ISO\'|\'INTERNAL\'})\n\nReturns a format string. This function is useful in combination with\nthe DATE_FORMAT() and the STR_TO_DATE() functions.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT DATE_FORMAT(\'2003-10-03\',GET_FORMAT(DATE,\'EUR\'));\n -> \'03.10.2003\'\nmysql> SELECT STR_TO_DATE(\'10.31.2003\',GET_FORMAT(DATE,\'USA\'));\n -> \'2003-10-31\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (458,22,'TINYBLOB','TINYBLOB\n\nA BLOB column with a maximum length of 255 (28 - 1) bytes. Each\nTINYBLOB value is stored using a 1-byte length prefix that indicates\nthe number of bytes in the value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (459,23,'SIGNAL','Syntax:\nSIGNAL condition_value\n [SET signal_information_item\n [, signal_information_item] ...]\n\ncondition_value:\n SQLSTATE [VALUE] sqlstate_value\n | condition_name\n\nsignal_information_item:\n condition_information_item_name = simple_value_specification\n\ncondition_information_item_name:\n CLASS_ORIGIN\n | SUBCLASS_ORIGIN\n | MESSAGE_TEXT\n | MYSQL_ERRNO\n | CONSTRAINT_CATALOG\n | CONSTRAINT_SCHEMA\n | CONSTRAINT_NAME\n | CATALOG_NAME\n | SCHEMA_NAME\n | TABLE_NAME\n | COLUMN_NAME\n | CURSOR_NAME\n\ncondition_name, simple_value_specification:\n (see following discussion)\n\nSIGNAL is the way to "return" an error. SIGNAL provides error\ninformation to a handler, to an outer portion of the application, or to\nthe client. Also, it provides control over the error\'s characteristics\n(error number, SQLSTATE value, message). Without SIGNAL, it is\nnecessary to resort to workarounds such as deliberately referring to a\nnonexistent table to cause a routine to return an error.\n\nNo special privileges are required to execute the SIGNAL statement.\n\nThe condition_value in a SIGNAL statement indicates the error value to\nbe returned. It can be an SQLSTATE value (a 5-character string literal)\nor a condition_name that refers to a named condition previously defined\nwith DECLARE ... CONDITION (see [HELP DECLARE CONDITION]).\n\nAn SQLSTATE value can indicate errors, warnings, or "not found." The\nfirst two characters of the value indicate its error class, as\ndiscussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/signal.html#signal-condition-inf\normation-items. Some signal values cause statement termination; see\nhttp://dev.mysql.com/doc/refman/5.5/en/signal.html#signal-effects.\n\nThe SQLSTATE value for a SIGNAL statement should not start with \'00\'\nbecause such values indicate success and are not valid for signaling an\nerror. This is true whether the SQLSTATE value is specified directly in\nthe SIGNAL statement or in a named condition referred to in the\nstatement. If the value is invalid, a Bad SQLSTATE error occurs.\n\nTo signal a generic SQLSTATE value, use \'45000\', which means "unhandled\nuser-defined exception."\n\nThe SIGNAL statement optionally includes a SET clause that contains\nmultiple signal items, in a comma-separated list of\ncondition_information_item_name = simple_value_specification\nassignments.\n\nEach condition_information_item_name may be specified only once in the\nSET clause. Otherwise, a Duplicate condition information item error\noccurs.\n\nValid simple_value_specification designators can be specified using\nstored procedure or function parameters, stored program local variables\ndeclared with DECLARE, user-defined variables, system variables, or\nliterals. A character literal may include a _charset introducer.\n\nFor information about permissible condition_information_item_name\nvalues, see\nhttp://dev.mysql.com/doc/refman/5.5/en/signal.html#signal-condition-inf\normation-items.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/signal.html\n\n','CREATE PROCEDURE p (pval INT)\nBEGIN\n DECLARE specialty CONDITION FOR SQLSTATE \'45000\';\n IF pval = 0 THEN\n SIGNAL SQLSTATE \'01000\';\n ELSEIF pval = 1 THEN\n SIGNAL SQLSTATE \'45000\'\n SET MESSAGE_TEXT = \'An error occurred\';\n ELSEIF pval = 2 THEN\n SIGNAL specialty\n SET MESSAGE_TEXT = \'An error occurred\';\n ELSE\n SIGNAL SQLSTATE \'01000\'\n SET MESSAGE_TEXT = \'A warning occurred\', MYSQL_ERRNO = 1000;\n SIGNAL SQLSTATE \'45000\'\n SET MESSAGE_TEXT = \'An error occurred\', MYSQL_ERRNO = 1001;\n END IF;\nEND;\n','http://dev.mysql.com/doc/refman/5.5/en/signal.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (460,8,'SAVEPOINT','Syntax:\nSAVEPOINT identifier\nROLLBACK [WORK] TO [SAVEPOINT] identifier\nRELEASE SAVEPOINT identifier\n\nInnoDB supports the SQL statements SAVEPOINT, ROLLBACK TO SAVEPOINT,\nRELEASE SAVEPOINT and the optional WORK keyword for ROLLBACK.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/savepoint.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/savepoint.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (461,17,'USER','Syntax:\nUSER()\n\nReturns the current MySQL user name and host name as a string in the\nutf8 character set.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','mysql> SELECT USER();\n -> \'davida@localhost\'\n','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (462,23,'LABELS','Syntax:\n[begin_label:] BEGIN\n [statement_list]\nEND [end_label]\n\n[begin_label:] LOOP\n statement_list\nEND LOOP [end_label]\n\n[begin_label:] REPEAT\n statement_list\nUNTIL search_condition\nEND REPEAT [end_label]\n\n[begin_label:] WHILE search_condition DO\n statement_list\nEND WHILE [end_label]\n\nLabels are permitted for BEGIN ... END blocks and for the LOOP, REPEAT,\nand WHILE statements. Label use for those statements follows these\nrules:\n\no begin_label must be followed by a colon.\n\no begin_label can be given without end_label. If end_label is present,\n it must be the same as begin_label.\n\no end_label cannot be given without begin_label.\n\no Labels at the same nesting level must be distinct.\n\no Labels can be up to 16 characters long.\n\nTo refer to a label within the labeled construct, use an ITERATE or\nLEAVE statement. The following example uses those statements to\ncontinue iterating or terminate the loop:\n\nCREATE PROCEDURE doiterate(p1 INT)\nBEGIN\n label1: LOOP\n SET p1 = p1 + 1;\n IF p1 < 10 THEN ITERATE label1; END IF;\n LEAVE label1;\n END LOOP label1;\nEND;\n\nThe scope of a block label does not include the code for handlers\ndeclared within the block. For details, see [HELP DECLARE HANDLER].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/statement-labels.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/statement-labels.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (463,39,'ALTER TABLE','Syntax:\nALTER [ONLINE | OFFLINE] [IGNORE] TABLE tbl_name\n [alter_specification [, alter_specification] ...]\n [partition_options]\n\nalter_specification:\n table_options\n | ADD [COLUMN] col_name column_definition\n [FIRST | AFTER col_name ]\n | ADD [COLUMN] (col_name column_definition,...)\n | ADD {INDEX|KEY} [index_name]\n [index_type] (index_col_name,...) [index_option] ...\n | ADD [CONSTRAINT [symbol]] PRIMARY KEY\n [index_type] (index_col_name,...) [index_option] ...\n | ADD [CONSTRAINT [symbol]]\n UNIQUE [INDEX|KEY] [index_name]\n [index_type] (index_col_name,...) [index_option] ...\n | ADD FULLTEXT [INDEX|KEY] [index_name]\n (index_col_name,...) [index_option] ...\n | ADD SPATIAL [INDEX|KEY] [index_name]\n (index_col_name,...) [index_option] ...\n | ADD [CONSTRAINT [symbol]]\n FOREIGN KEY [index_name] (index_col_name,...)\n reference_definition\n | ALTER [COLUMN] col_name {SET DEFAULT literal | DROP DEFAULT}\n | CHANGE [COLUMN] old_col_name new_col_name column_definition\n [FIRST|AFTER col_name]\n | MODIFY [COLUMN] col_name column_definition\n [FIRST | AFTER col_name]\n | DROP [COLUMN] col_name\n | DROP PRIMARY KEY\n | DROP {INDEX|KEY} index_name\n | DROP FOREIGN KEY fk_symbol\n | MAX_ROWS = rows\n | DISABLE KEYS\n | ENABLE KEYS\n | RENAME [TO|AS] new_tbl_name\n | ORDER BY col_name [, col_name] ...\n | CONVERT TO CHARACTER SET charset_name [COLLATE collation_name]\n | [DEFAULT] CHARACTER SET [=] charset_name [COLLATE [=] collation_name]\n | DISCARD TABLESPACE\n | IMPORT TABLESPACE\n | FORCE\n | ADD PARTITION (partition_definition)\n | DROP PARTITION partition_names\n | TRUNCATE PARTITION {partition_names | ALL}\n | COALESCE PARTITION number\n | REORGANIZE PARTITION [partition_names INTO (partition_definitions)]\n | ANALYZE PARTITION {partition_names | ALL}\n | CHECK PARTITION {partition_names | ALL}\n | OPTIMIZE PARTITION {partition_names | ALL}\n | REBUILD PARTITION {partition_names | ALL}\n | REPAIR PARTITION {partition_names | ALL}\n | PARTITION BY partitioning_expression\n | REMOVE PARTITIONING\n\nindex_col_name:\n col_name [(length)] [ASC | DESC]\n\nindex_type:\n USING {BTREE | HASH}\n\nindex_option:\n KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n | COMMENT \'string\'\n\ntable_options:\n table_option [[,] table_option] ... (see CREATE TABLE options)\n\npartition_options:\n (see CREATE TABLE options)\n\nALTER TABLE changes the structure of a table. For example, you can add\nor delete columns, create or destroy indexes, change the type of\nexisting columns, or rename columns or the table itself. You can also\nchange characteristics such as the storage engine used for the table or\nthe table comment.\n\nPartitioning-related clauses for ALTER TABLE can be used with\npartitioned tables for repartitioning, for adding, dropping, merging,\nand splitting partitions, and for performing partitioning maintenance.\nFor more information, see\nhttp://dev.mysql.com/doc/refman/5.5/en/alter-table-partition-operations\n.html.\n\nFollowing the table name, specify the alterations to be made. If none\nare given, ALTER TABLE does nothing.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/alter-table.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/alter-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (464,32,'MPOINTFROMWKB','MPointFromWKB(wkb[,srid]), MultiPointFromWKB(wkb[,srid])\n\nConstructs a MULTIPOINT value using its WKB representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (465,22,'CHAR BYTE','The CHAR BYTE data type is an alias for the BINARY data type. This is a\ncompatibility feature.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (466,20,'REPAIR TABLE','Syntax:\nREPAIR [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n [QUICK] [EXTENDED] [USE_FRM]\n\nREPAIR TABLE repairs a possibly corrupted table. By default, it has the\nsame effect as myisamchk --recover tbl_name. REPAIR TABLE works for\nMyISAM, ARCHIVE, and CSV tables. See\nhttp://dev.mysql.com/doc/refman/5.5/en/myisam-storage-engine.html, and\nhttp://dev.mysql.com/doc/refman/5.5/en/archive-storage-engine.html, and\nhttp://dev.mysql.com/doc/refman/5.5/en/csv-storage-engine.html\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nREPAIR TABLE is supported for partitioned tables. However, the USE_FRM\noption cannot be used with this statement on a partitioned table.\n\nYou can use ALTER TABLE ... REPAIR PARTITION to repair one or more\npartitions; for more information, see [HELP ALTER TABLE], and\nhttp://dev.mysql.com/doc/refman/5.5/en/partitioning-maintenance.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/repair-table.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/repair-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (467,39,'MERGE','The MERGE storage engine, also known as the MRG_MyISAM engine, is a\ncollection of identical MyISAM tables that can be used as one.\n"Identical" means that all tables have identical column and index\ninformation. You cannot merge MyISAM tables in which the columns are\nlisted in a different order, do not have exactly the same columns, or\nhave the indexes in different order. However, any or all of the MyISAM\ntables can be compressed with myisampack. See\nhttp://dev.mysql.com/doc/refman/5.5/en/myisampack.html. Differences in\ntable options such as AVG_ROW_LENGTH, MAX_ROWS, or PACK_KEYS do not\nmatter.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/merge-storage-engine.html\n\n','mysql> CREATE TABLE t1 (\n -> a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n -> message CHAR(20)) ENGINE=MyISAM;\nmysql> CREATE TABLE t2 (\n -> a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n -> message CHAR(20)) ENGINE=MyISAM;\nmysql> INSERT INTO t1 (message) VALUES (\'Testing\'),(\'table\'),(\'t1\');\nmysql> INSERT INTO t2 (message) VALUES (\'Testing\'),(\'table\'),(\'t2\');\nmysql> CREATE TABLE total (\n -> a INT NOT NULL AUTO_INCREMENT,\n -> message CHAR(20), INDEX(a))\n -> ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;\n','http://dev.mysql.com/doc/refman/5.5/en/merge-storage-engine.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (468,39,'CREATE TABLE','Syntax:\nCREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n (create_definition,...)\n [table_options]\n [partition_options]\n\nOr:\n\nCREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n [(create_definition,...)]\n [table_options]\n [partition_options]\n select_statement\n\nOr:\n\nCREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n { LIKE old_tbl_name | (LIKE old_tbl_name) }\n\ncreate_definition:\n col_name column_definition\n | [CONSTRAINT [symbol]] PRIMARY KEY [index_type] (index_col_name,...)\n [index_option] ...\n | {INDEX|KEY} [index_name] [index_type] (index_col_name,...)\n [index_option] ...\n | [CONSTRAINT [symbol]] UNIQUE [INDEX|KEY]\n [index_name] [index_type] (index_col_name,...)\n [index_option] ...\n | {FULLTEXT|SPATIAL} [INDEX|KEY] [index_name] (index_col_name,...)\n [index_option] ...\n | [CONSTRAINT [symbol]] FOREIGN KEY\n [index_name] (index_col_name,...) reference_definition\n | CHECK (expr)\n\ncolumn_definition:\n data_type [NOT NULL | NULL] [DEFAULT default_value]\n [AUTO_INCREMENT] [UNIQUE [KEY] | [PRIMARY] KEY]\n [COMMENT \'string\']\n [COLUMN_FORMAT {FIXED|DYNAMIC|DEFAULT}]\n [STORAGE {DISK|MEMORY|DEFAULT}]\n [reference_definition]\n\ndata_type:\n BIT[(length)]\n | TINYINT[(length)] [UNSIGNED] [ZEROFILL]\n | SMALLINT[(length)] [UNSIGNED] [ZEROFILL]\n | MEDIUMINT[(length)] [UNSIGNED] [ZEROFILL]\n | INT[(length)] [UNSIGNED] [ZEROFILL]\n | INTEGER[(length)] [UNSIGNED] [ZEROFILL]\n | BIGINT[(length)] [UNSIGNED] [ZEROFILL]\n | REAL[(length,decimals)] [UNSIGNED] [ZEROFILL]\n | DOUBLE[(length,decimals)] [UNSIGNED] [ZEROFILL]\n | FLOAT[(length,decimals)] [UNSIGNED] [ZEROFILL]\n | DECIMAL[(length[,decimals])] [UNSIGNED] [ZEROFILL]\n | NUMERIC[(length[,decimals])] [UNSIGNED] [ZEROFILL]\n | DATE\n | TIME\n | TIMESTAMP\n | DATETIME\n | YEAR\n | CHAR[(length)]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | VARCHAR(length)\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | BINARY[(length)]\n | VARBINARY(length)\n | TINYBLOB\n | BLOB\n | MEDIUMBLOB\n | LONGBLOB\n | TINYTEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | TEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | MEDIUMTEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | LONGTEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | ENUM(value1,value2,value3,...)\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | SET(value1,value2,value3,...)\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | spatial_type\n\nindex_col_name:\n col_name [(length)] [ASC | DESC]\n\nindex_type:\n USING {BTREE | HASH}\n\nindex_option:\n KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n | COMMENT \'string\'\n\nreference_definition:\n REFERENCES tbl_name (index_col_name,...)\n [MATCH FULL | MATCH PARTIAL | MATCH SIMPLE]\n [ON DELETE reference_option]\n [ON UPDATE reference_option]\n\nreference_option:\n RESTRICT | CASCADE | SET NULL | NO ACTION\n\ntable_options:\n table_option [[,] table_option] ...\n\ntable_option:\n ENGINE [=] engine_name\n | AUTO_INCREMENT [=] value\n | AVG_ROW_LENGTH [=] value\n | [DEFAULT] CHARACTER SET [=] charset_name\n | CHECKSUM [=] {0 | 1}\n | [DEFAULT] COLLATE [=] collation_name\n | COMMENT [=] \'string\'\n | CONNECTION [=] \'connect_string\'\n | DATA DIRECTORY [=] \'absolute path to directory\'\n | DELAY_KEY_WRITE [=] {0 | 1}\n | INDEX DIRECTORY [=] \'absolute path to directory\'\n | INSERT_METHOD [=] { NO | FIRST | LAST }\n | KEY_BLOCK_SIZE [=] value\n | MAX_ROWS [=] value\n | MIN_ROWS [=] value\n | PACK_KEYS [=] {0 | 1 | DEFAULT}\n | PASSWORD [=] \'string\'\n | ROW_FORMAT [=] {DEFAULT|DYNAMIC|FIXED|COMPRESSED|REDUNDANT|COMPACT}\n | TABLESPACE tablespace_name [STORAGE {DISK|MEMORY|DEFAULT}]\n | UNION [=] (tbl_name[,tbl_name]...)\n\npartition_options:\n PARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list)\n | RANGE{(expr) | COLUMNS(column_list)}\n | LIST{(expr) | COLUMNS(column_list)} }\n [PARTITIONS num]\n [SUBPARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list) }\n [SUBPARTITIONS num]\n ]\n [(partition_definition [, partition_definition] ...)]\n\npartition_definition:\n PARTITION partition_name\n [VALUES \n {LESS THAN {(expr | value_list) | MAXVALUE} \n | \n IN (value_list)}]\n [[STORAGE] ENGINE [=] engine_name]\n [COMMENT [=] \'comment_text\' ]\n [DATA DIRECTORY [=] \'data_dir\']\n [INDEX DIRECTORY [=] \'index_dir\']\n [MAX_ROWS [=] max_number_of_rows]\n [MIN_ROWS [=] min_number_of_rows]\n [TABLESPACE [=] tablespace_name]\n [NODEGROUP [=] node_group_id]\n [(subpartition_definition [, subpartition_definition] ...)]\n\nsubpartition_definition:\n SUBPARTITION logical_name\n [[STORAGE] ENGINE [=] engine_name]\n [COMMENT [=] \'comment_text\' ]\n [DATA DIRECTORY [=] \'data_dir\']\n [INDEX DIRECTORY [=] \'index_dir\']\n [MAX_ROWS [=] max_number_of_rows]\n [MIN_ROWS [=] min_number_of_rows]\n [TABLESPACE [=] tablespace_name]\n [NODEGROUP [=] node_group_id]\n\nselect_statement:\n [IGNORE | REPLACE] [AS] SELECT ... (Some valid select statement)\n\nCREATE TABLE creates a table with the given name. You must have the\nCREATE privilege for the table.\n\nRules for permissible table names are given in\nhttp://dev.mysql.com/doc/refman/5.5/en/identifiers.html. By default,\nthe table is created in the default database, using the InnoDB storage\nengine. An error occurs if the table exists, if there is no default\ndatabase, or if the database does not exist.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-table.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/create-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (469,18,'>','Syntax:\n>\n\nGreater than:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 2 > 2;\n -> 0\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (470,20,'ANALYZE TABLE','Syntax:\nANALYZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n\nANALYZE TABLE analyzes and stores the key distribution for a table.\nDuring the analysis, the table is locked with a read lock for InnoDB\nand MyISAM. This statement works with InnoDB, NDB, and MyISAM tables.\nFor MyISAM tables, this statement is equivalent to using myisamchk\n--analyze.\n\nFor more information on how the analysis works within InnoDB, see\nhttp://dev.mysql.com/doc/refman/5.5/en/innodb-restrictions.html.\n\nMySQL uses the stored key distribution to decide the order in which\ntables should be joined when you perform a join on something other than\na constant. In addition, key distributions can be used when deciding\nwhich indexes to use for a specific table within a query.\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nANALYZE TABLE is supported for partitioned tables, and you can use\nALTER TABLE ... ANALYZE PARTITION to analyze one or more partitions;\nfor more information, see [HELP ALTER TABLE], and\nhttp://dev.mysql.com/doc/refman/5.5/en/partitioning-maintenance.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/analyze-table.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/analyze-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (471,31,'MICROSECOND','Syntax:\nMICROSECOND(expr)\n\nReturns the microseconds from the time or datetime expression expr as a\nnumber in the range from 0 to 999999.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT MICROSECOND(\'12:00:00.123456\');\n -> 123456\nmysql> SELECT MICROSECOND(\'2009-12-31 23:59:59.000010\');\n -> 10\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (472,39,'CONSTRAINT','InnoDB supports foreign keys, which let you cross-reference related\ndata across tables, and foreign key constraints, which help keep this\nspread-out data consistent. The syntax for an InnoDB foreign key\nconstraint definition in the CREATE TABLE or ALTER TABLE statement\nlooks like this:\n\n[CONSTRAINT [symbol]] FOREIGN KEY\n [index_name] (index_col_name, ...)\n REFERENCES tbl_name (index_col_name,...)\n [ON DELETE reference_option]\n [ON UPDATE reference_option]\n\nreference_option:\n RESTRICT | CASCADE | SET NULL | NO ACTION\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/innodb-foreign-key-constraints.html\n\n','CREATE TABLE product (category INT NOT NULL, id INT NOT NULL,\n price DECIMAL,\n PRIMARY KEY(category, id)) ENGINE=INNODB;\nCREATE TABLE customer (id INT NOT NULL,\n PRIMARY KEY (id)) ENGINE=INNODB;\nCREATE TABLE product_order (no INT NOT NULL AUTO_INCREMENT,\n product_category INT NOT NULL,\n product_id INT NOT NULL,\n customer_id INT NOT NULL,\n PRIMARY KEY(no),\n INDEX (product_category, product_id),\n FOREIGN KEY (product_category, product_id)\n REFERENCES product(category, id)\n ON UPDATE CASCADE ON DELETE RESTRICT,\n INDEX (customer_id),\n FOREIGN KEY (customer_id)\n REFERENCES customer(id)) ENGINE=INNODB;\n','http://dev.mysql.com/doc/refman/5.5/en/innodb-foreign-key-constraints.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (473,39,'CREATE SERVER','Syntax:\nCREATE SERVER server_name\n FOREIGN DATA WRAPPER wrapper_name\n OPTIONS (option [, option] ...)\n\noption:\n { HOST character-literal\n | DATABASE character-literal\n | USER character-literal\n | PASSWORD character-literal\n | SOCKET character-literal\n | OWNER character-literal\n | PORT numeric-literal }\n\nThis statement creates the definition of a server for use with the\nFEDERATED storage engine. The CREATE SERVER statement creates a new row\nwithin the servers table within the mysql database. This statement\nrequires the SUPER privilege.\n\nThe server_name should be a unique reference to the server. Server\ndefinitions are global within the scope of the server, it is not\npossible to qualify the server definition to a specific database.\nserver_name has a maximum length of 64 characters (names longer than 64\ncharacters are silently truncated), and is case insensitive. You may\nspecify the name as a quoted string.\n\nThe wrapper_name should be mysql, and may be quoted with single\nquotation marks. Other values for wrapper_name are not currently\nsupported.\n\nFor each option you must specify either a character literal or numeric\nliteral. Character literals are UTF-8, support a maximum length of 64\ncharacters and default to a blank (empty) string. String literals are\nsilently truncated to 64 characters. Numeric literals must be a number\nbetween 0 and 9999, default value is 0.\n\n*Note*: Note that the OWNER option is currently not applied, and has no\neffect on the ownership or operation of the server connection that is\ncreated.\n\nThe CREATE SERVER statement creates an entry in the mysql.servers table\nthat can later be used with the CREATE TABLE statement when creating a\nFEDERATED table. The options that you specify will be used to populate\nthe columns in the mysql.servers table. The table columns are\nServer_name, Host, Db, Username, Password, Port and Socket.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-server.html\n\n','CREATE SERVER s\nFOREIGN DATA WRAPPER mysql\nOPTIONS (USER \'Remote\', HOST \'192.168.1.106\', DATABASE \'test\');\n','http://dev.mysql.com/doc/refman/5.5/en/create-server.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (474,37,'FIELD','Syntax:\nFIELD(str,str1,str2,str3,...)\n\nReturns the index (position) of str in the str1, str2, str3, ... list.\nReturns 0 if str is not found.\n\nIf all arguments to FIELD() are strings, all arguments are compared as\nstrings. If all arguments are numbers, they are compared as numbers.\nOtherwise, the arguments are compared as double.\n\nIf str is NULL, the return value is 0 because NULL fails equality\ncomparison with any value. FIELD() is the complement of ELT().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT FIELD(\'ej\', \'Hej\', \'ej\', \'Heja\', \'hej\', \'foo\');\n -> 2\nmysql> SELECT FIELD(\'fo\', \'Hej\', \'ej\', \'Heja\', \'hej\', \'foo\');\n -> 0\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (475,31,'MAKETIME','Syntax:\nMAKETIME(hour,minute,second)\n\nReturns a time value calculated from the hour, minute, and second\narguments.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT MAKETIME(12,15,30);\n -> \'12:15:30\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (476,31,'CURDATE','Syntax:\nCURDATE()\n\nReturns the current date as a value in \'YYYY-MM-DD\' or YYYYMMDD format,\ndepending on whether the function is used in a string or numeric\ncontext.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT CURDATE();\n -> \'2008-06-13\'\nmysql> SELECT CURDATE() + 0;\n -> 20080613\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (477,10,'SET PASSWORD','Syntax:\nSET PASSWORD [FOR user] =\n {\n PASSWORD(\'cleartext password\')\n | OLD_PASSWORD(\'cleartext password\')\n | \'encrypted password\'\n }\n\nThe SET PASSWORD statement assigns a password to an existing MySQL user\naccount. When the read_only system variable is enabled, the SUPER\nprivilege is required to use SET PASSWORD, in addition to whatever\nother privileges might be required.\n\nIf the password is specified using the PASSWORD() or OLD_PASSWORD()\nfunction, the cleartext (unencrypted) password should be given as the\nargument to the function, which hashes the password and returns the\nencrypted password string. If the password is specified without using\neither function, it should be the already encrypted password value as a\nliteral string. In all cases, the encrypted password string must be in\nthe format required by the authentication method used for the account.\n\nThe old_passwords system variable value determines the hashing method\nused by PASSWORD(). If you specify the password using that function and\nSET PASSWORD rejects the password as not being in the correct format,\nit may be necessary to set old_passwords to change the hashing method.\nFor descriptions of the permitted values, see\nhttp://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html.\n\nWith no FOR user clause, this statement sets the password for the\ncurrent user. (To see which account the server authenticated you as,\ninvoke the CURRENT_USER() function.) Any client who successfully\nconnects to the server using a nonanonymous account can change the\npassword for that account.\n\nWith a FOR user clause, this statement sets the password for the named\nuser. You must have the UPDATE privilege for the mysql database to do\nthis. The user account name uses the format described in\nhttp://dev.mysql.com/doc/refman/5.5/en/account-names.html. The user\nvalue should be given as \'user_name\'@\'host_name\', where \'user_name\' and\n\'host_name\' are exactly as listed in the User and Host columns of the\nmysql.user table row. (If you specify only a user name, a host name of\n\'%\' is used.) For example, to set the password for an account with User\nand Host column values of \'bob\' and \'%.example.org\', write the\nstatement like this:\n\nSET PASSWORD FOR \'bob\'@\'%.example.org\' = PASSWORD(\'cleartext password\');\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/set-password.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/set-password.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (478,39,'ALTER TABLESPACE','Syntax:\nALTER TABLESPACE tablespace_name\n {ADD|DROP} DATAFILE \'file_name\'\n [INITIAL_SIZE [=] size]\n [WAIT]\n ENGINE [=] engine_name\n\nThis statement can be used either to add a new data file, or to drop a\ndata file from a tablespace.\n\nThe ADD DATAFILE variant enables you to specify an initial size using\nan INITIAL_SIZE clause, where size is measured in bytes; the default\nvalue is 128M (128 megabytes). You may optionally follow this integer\nvalue with a one-letter abbreviation for an order of magnitude, similar\nto those used in my.cnf. Generally, this is one of the letters M (for\nmegabytes) or G (for gigabytes).\n\n*Note*: All MySQL Cluster Disk Data objects share the same namespace.\nThis means that each Disk Data object must be uniquely named (and not\nmerely each Disk Data object of a given type). For example, you cannot\nhave a tablespace and an data file with the same name, or an undo log\nfile and a tablespace with the same name.\n\nOn 32-bit systems, the maximum supported value for INITIAL_SIZE is 4G.\n(Bug #29186)\n\nINITIAL_SIZE is rounded, explicitly, as for CREATE TABLESPACE.\n\nOnce a data file has been created, its size cannot be changed; however,\nyou can add more data files to the tablespace using additional ALTER\nTABLESPACE ... ADD DATAFILE statements.\n\nUsing DROP DATAFILE with ALTER TABLESPACE drops the data file\n\'file_name\' from the tablespace. You cannot drop a data file from a\ntablespace which is in use by any table; in other words, the data file\nmust be empty (no extents used). See\nhttp://dev.mysql.com/doc/refman/5.5/en/mysql-cluster-disk-data-objects.\nhtml. In addition, any data file to be dropped must previously have\nbeen added to the tablespace with CREATE TABLESPACE or ALTER\nTABLESPACE.\n\nBoth ALTER TABLESPACE ... ADD DATAFILE and ALTER TABLESPACE ... DROP\nDATAFILE require an ENGINE clause which specifies the storage engine\nused by the tablespace. Currently, the only accepted values for\nengine_name are NDB and NDBCLUSTER.\n\nWAIT is parsed but otherwise ignored, and so has no effect in MySQL\n5.5. It is intended for future expansion.\n\nWhen ALTER TABLESPACE ... ADD DATAFILE is used with ENGINE = NDB, a\ndata file is created on each Cluster data node. You can verify that the\ndata files were created and obtain information about them by querying\nthe INFORMATION_SCHEMA.FILES table. For example, the following query\nshows all data files belonging to the tablespace named newts:\n\nmysql> SELECT LOGFILE_GROUP_NAME, FILE_NAME, EXTRA\n -> FROM INFORMATION_SCHEMA.FILES\n -> WHERE TABLESPACE_NAME = \'newts\' AND FILE_TYPE = \'DATAFILE\';\n+--------------------+--------------+----------------+\n| LOGFILE_GROUP_NAME | FILE_NAME | EXTRA |\n+--------------------+--------------+----------------+\n| lg_3 | newdata.dat | CLUSTER_NODE=3 |\n| lg_3 | newdata.dat | CLUSTER_NODE=4 |\n| lg_3 | newdata2.dat | CLUSTER_NODE=3 |\n| lg_3 | newdata2.dat | CLUSTER_NODE=4 |\n+--------------------+--------------+----------------+\n2 rows in set (0.03 sec)\n\nSee http://dev.mysql.com/doc/refman/5.5/en/files-table.html.\n\nALTER TABLESPACE is useful only with Disk Data storage for MySQL\nCluster. See\nhttp://dev.mysql.com/doc/refman/5.5/en/mysql-cluster-disk-data.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/alter-tablespace.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/alter-tablespace.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (479,7,'IF FUNCTION','Syntax:\nIF(expr1,expr2,expr3)\n\nIf expr1 is TRUE (expr1 <> 0 and expr1 <> NULL) then IF() returns\nexpr2; otherwise it returns expr3. IF() returns a numeric or string\nvalue, depending on the context in which it is used.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/control-flow-functions.html\n\n','mysql> SELECT IF(1>2,2,3);\n -> 3\nmysql> SELECT IF(1<2,\'yes\',\'no\');\n -> \'yes\'\nmysql> SELECT IF(STRCMP(\'test\',\'test1\'),\'no\',\'yes\');\n -> \'no\'\n','http://dev.mysql.com/doc/refman/5.5/en/control-flow-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (480,22,'ENUM','ENUM(\'value1\',\'value2\',...) [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n\nAn enumeration. A string object that can have only one value, chosen\nfrom the list of values \'value1\', \'value2\', ..., NULL or the special \'\'\nerror value. An ENUM column can have a maximum of 65,535 distinct\nvalues. ENUM values are represented internally as integers.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (481,17,'DATABASE','Syntax:\nDATABASE()\n\nReturns the default (current) database name as a string in the utf8\ncharacter set. If there is no default database, DATABASE() returns\nNULL. Within a stored routine, the default database is the database\nthat the routine is associated with, which is not necessarily the same\nas the database that is the default in the calling context.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','mysql> SELECT DATABASE();\n -> \'test\'\n','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (482,32,'POINTFROMWKB','PointFromWKB(wkb[,srid])\n\nConstructs a POINT value using its WKB representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (483,4,'POWER','Syntax:\nPOWER(X,Y)\n\nThis is a synonym for POW().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (484,4,'ATAN','Syntax:\nATAN(X)\n\nReturns the arc tangent of X, that is, the value whose tangent is X.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT ATAN(2);\n -> 1.1071487177941\nmysql> SELECT ATAN(-2);\n -> -1.1071487177941\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (485,37,'STRCMP','Syntax:\nSTRCMP(expr1,expr2)\n\nSTRCMP() returns 0 if the strings are the same, -1 if the first\nargument is smaller than the second according to the current sort\norder, and 1 otherwise.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-comparison-functions.html\n\n','mysql> SELECT STRCMP(\'text\', \'text2\');\n -> -1\nmysql> SELECT STRCMP(\'text2\', \'text\');\n -> 1\nmysql> SELECT STRCMP(\'text\', \'text\');\n -> 0\n','http://dev.mysql.com/doc/refman/5.5/en/string-comparison-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (486,27,'INSERT DELAYED','Syntax:\nINSERT DELAYED ...\n\nThe DELAYED option for the INSERT statement is a MySQL extension to\nstandard SQL that is very useful if you have clients that cannot or\nneed not wait for the INSERT to complete. This is a common situation\nwhen you use MySQL for logging and you also periodically run SELECT and\nUPDATE statements that take a long time to complete.\n\nWhen a client uses INSERT DELAYED, it gets an okay from the server at\nonce, and the row is queued to be inserted when the table is not in use\nby any other thread.\n\nAnother major benefit of using INSERT DELAYED is that inserts from many\nclients are bundled together and written in one block. This is much\nfaster than performing many separate inserts.\n\nNote that INSERT DELAYED is slower than a normal INSERT if the table is\nnot otherwise in use. There is also the additional overhead for the\nserver to handle a separate thread for each table for which there are\ndelayed rows. This means that you should use INSERT DELAYED only when\nyou are really sure that you need it.\n\nThe queued rows are held only in memory until they are inserted into\nthe table. This means that if you terminate mysqld forcibly (for\nexample, with kill -9) or if mysqld dies unexpectedly, any queued rows\nthat have not been written to disk are lost.\n\nThere are some constraints on the use of DELAYED:\n\no INSERT DELAYED works only with MyISAM, MEMORY, ARCHIVE, and BLACKHOLE\n tables. For engines that do not support DELAYED, an error occurs.\n\no An error occurs for INSERT DELAYED if used with a table that has been\n locked with LOCK TABLES because the insert must be handled by a\n separate thread, not by the session that holds the lock.\n\no For MyISAM tables, if there are no free blocks in the middle of the\n data file, concurrent SELECT and INSERT statements are supported.\n Under these circumstances, you very seldom need to use INSERT DELAYED\n with MyISAM.\n\no INSERT DELAYED should be used only for INSERT statements that specify\n value lists. The server ignores DELAYED for INSERT ... SELECT or\n INSERT ... ON DUPLICATE KEY UPDATE statements.\n\no Because the INSERT DELAYED statement returns immediately, before the\n rows are inserted, you cannot use LAST_INSERT_ID() to get the\n AUTO_INCREMENT value that the statement might generate.\n\no DELAYED rows are not visible to SELECT statements until they actually\n have been inserted.\n\no Prior to MySQL 5.5.7, INSERT DELAYED was treated as a normal INSERT\n if the statement inserted multiple rows, binary logging was enabled,\n and the global logging format was statement-based (that is, whenever\n binlog_format was set to STATEMENT). Beginning with MySQL 5.5.7,\n INSERT DELAYED is always handled as a simple INSERT (that is, without\n the DELAYED option) whenever the value of binlog_format is STATEMENT\n or MIXED. (In the latter case, the statement no longer triggers a\n switch to row-based logging, and so is logged using the\n statement-based format.)\n\n This does not apply when using row-based binary logging mode\n (binlog_format set to ROW), in which INSERT DELAYED statements are\n always executed using the DELAYED option as specified, and logged as\n row-update events.\n\no DELAYED is ignored on slave replication servers, so that INSERT\n DELAYED is treated as a normal INSERT on slaves. This is because\n DELAYED could cause the slave to have different data than the master.\n\no Pending INSERT DELAYED statements are lost if a table is write locked\n and ALTER TABLE is used to modify the table structure.\n\no INSERT DELAYED is not supported for views.\n\no INSERT DELAYED is not supported for partitioned tables.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/insert-delayed.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/insert-delayed.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (487,26,'SHOW PROFILE','Syntax:\nSHOW PROFILE [type [, type] ... ]\n [FOR QUERY n]\n [LIMIT row_count [OFFSET offset]]\n\ntype:\n ALL\n | BLOCK IO\n | CONTEXT SWITCHES\n | CPU\n | IPC\n | MEMORY\n | PAGE FAULTS\n | SOURCE\n | SWAPS\n\nThe SHOW PROFILE and SHOW PROFILES statements display profiling\ninformation that indicates resource usage for statements executed\nduring the course of the current session.\n\nProfiling is controlled by the profiling session variable, which has a\ndefault value of 0 (OFF). Profiling is enabled by setting profiling to\n1 or ON:\n\nmysql> SET profiling = 1;\n\nSHOW PROFILES displays a list of the most recent statements sent to the\nserver. The size of the list is controlled by the\nprofiling_history_size session variable, which has a default value of\n15. The maximum value is 100. Setting the value to 0 has the practical\neffect of disabling profiling.\n\nAll statements are profiled except SHOW PROFILE and SHOW PROFILES, so\nyou will find neither of those statements in the profile list.\nMalformed statements are profiled. For example, SHOW PROFILING is an\nillegal statement, and a syntax error occurs if you try to execute it,\nbut it will show up in the profiling list.\n\nSHOW PROFILE displays detailed information about a single statement.\nWithout the FOR QUERY n clause, the output pertains to the most\nrecently executed statement. If FOR QUERY n is included, SHOW PROFILE\ndisplays information for statement n. The values of n correspond to the\nQuery_ID values displayed by SHOW PROFILES.\n\nThe LIMIT row_count clause may be given to limit the output to\nrow_count rows. If LIMIT is given, OFFSET offset may be added to begin\nthe output offset rows into the full set of rows.\n\nBy default, SHOW PROFILE displays Status and Duration columns. The\nStatus values are like the State values displayed by SHOW PROCESSLIST,\nalthough there might be some minor differences in interpretion for the\ntwo statements for some status values (see\nhttp://dev.mysql.com/doc/refman/5.5/en/thread-information.html).\n\nOptional type values may be specified to display specific additional\ntypes of information:\n\no ALL displays all information\n\no BLOCK IO displays counts for block input and output operations\n\no CONTEXT SWITCHES displays counts for voluntary and involuntary\n context switches\n\no CPU displays user and system CPU usage times\n\no IPC displays counts for messages sent and received\n\no MEMORY is not currently implemented\n\no PAGE FAULTS displays counts for major and minor page faults\n\no SOURCE displays the names of functions from the source code, together\n with the name and line number of the file in which the function\n occurs\n\no SWAPS displays swap counts\n\nProfiling is enabled per session. When a session ends, its profiling\ninformation is lost.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-profile.html\n\n','mysql> SELECT @@profiling;\n+-------------+\n| @@profiling |\n+-------------+\n| 0 |\n+-------------+\n1 row in set (0.00 sec)\n\nmysql> SET profiling = 1;\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> DROP TABLE IF EXISTS t1;\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n\nmysql> CREATE TABLE T1 (id INT);\nQuery OK, 0 rows affected (0.01 sec)\n\nmysql> SHOW PROFILES;\n+----------+----------+--------------------------+\n| Query_ID | Duration | Query |\n+----------+----------+--------------------------+\n| 0 | 0.000088 | SET PROFILING = 1 |\n| 1 | 0.000136 | DROP TABLE IF EXISTS t1 |\n| 2 | 0.011947 | CREATE TABLE t1 (id INT) |\n+----------+----------+--------------------------+\n3 rows in set (0.00 sec)\n\nmysql> SHOW PROFILE;\n+----------------------+----------+\n| Status | Duration |\n+----------------------+----------+\n| checking permissions | 0.000040 |\n| creating table | 0.000056 |\n| After create | 0.011363 |\n| query end | 0.000375 |\n| freeing items | 0.000089 |\n| logging slow query | 0.000019 |\n| cleaning up | 0.000005 |\n+----------------------+----------+\n7 rows in set (0.00 sec)\n\nmysql> SHOW PROFILE FOR QUERY 1;\n+--------------------+----------+\n| Status | Duration |\n+--------------------+----------+\n| query end | 0.000107 |\n| freeing items | 0.000008 |\n| logging slow query | 0.000015 |\n| cleaning up | 0.000006 |\n+--------------------+----------+\n4 rows in set (0.00 sec)\n\nmysql> SHOW PROFILE CPU FOR QUERY 2;\n+----------------------+----------+----------+------------+\n| Status | Duration | CPU_user | CPU_system |\n+----------------------+----------+----------+------------+\n| checking permissions | 0.000040 | 0.000038 | 0.000002 |\n| creating table | 0.000056 | 0.000028 | 0.000028 |\n| After create | 0.011363 | 0.000217 | 0.001571 |\n| query end | 0.000375 | 0.000013 | 0.000028 |\n| freeing items | 0.000089 | 0.000010 | 0.000014 |\n| logging slow query | 0.000019 | 0.000009 | 0.000010 |\n| cleaning up | 0.000005 | 0.000003 | 0.000002 |\n+----------------------+----------+----------+------------+\n7 rows in set (0.00 sec)\n','http://dev.mysql.com/doc/refman/5.5/en/show-profile.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (488,26,'SHOW PROCEDURE CODE','Syntax:\nSHOW PROCEDURE CODE proc_name\n\nThis statement is a MySQL extension that is available only for servers\nthat have been built with debugging support. It displays a\nrepresentation of the internal implementation of the named stored\nprocedure. A similar statement, SHOW FUNCTION CODE, displays\ninformation about stored functions (see [HELP SHOW FUNCTION CODE]).\n\nBoth statements require that you be the owner of the routine or have\nSELECT access to the mysql.proc table.\n\nIf the named routine is available, each statement produces a result\nset. Each row in the result set corresponds to one "instruction" in the\nroutine. The first column is Pos, which is an ordinal number beginning\nwith 0. The second column is Instruction, which contains an SQL\nstatement (usually changed from the original source), or a directive\nwhich has meaning only to the stored-routine handler.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-procedure-code.html\n\n','mysql> DELIMITER //\nmysql> CREATE PROCEDURE p1 ()\n -> BEGIN\n -> DECLARE fanta INT DEFAULT 55;\n -> DROP TABLE t2;\n -> LOOP\n -> INSERT INTO t3 VALUES (fanta);\n -> END LOOP;\n -> END//\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SHOW PROCEDURE CODE p1//\n+-----+----------------------------------------+\n| Pos | Instruction |\n+-----+----------------------------------------+\n| 0 | set fanta@0 55 |\n| 1 | stmt 9 "DROP TABLE t2" |\n| 2 | stmt 5 "INSERT INTO t3 VALUES (fanta)" |\n| 3 | jump 2 |\n+-----+----------------------------------------+\n4 rows in set (0.00 sec)\n','http://dev.mysql.com/doc/refman/5.5/en/show-procedure-code.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (489,22,'MEDIUMTEXT','MEDIUMTEXT [CHARACTER SET charset_name] [COLLATE collation_name]\n\nA TEXT column with a maximum length of 16,777,215 (224 - 1) characters.\nThe effective maximum length is less if the value contains multi-byte\ncharacters. Each MEDIUMTEXT value is stored using a 3-byte length\nprefix that indicates the number of bytes in the value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (490,4,'LN','Syntax:\nLN(X)\n\nReturns the natural logarithm of X; that is, the base-e logarithm of X.\nIf X is less than or equal to 0, then NULL is returned.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT LN(2);\n -> 0.69314718055995\nmysql> SELECT LN(-2);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (491,23,'RETURN','Syntax:\nRETURN expr\n\nThe RETURN statement terminates execution of a stored function and\nreturns the value expr to the function caller. There must be at least\none RETURN statement in a stored function. There may be more than one\nif the function has multiple exit points.\n\nThis statement is not used in stored procedures, triggers, or events.\nThe LEAVE statement can be used to exit a stored program of those\ntypes.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/return.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/return.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (492,26,'SHOW COLLATION','Syntax:\nSHOW COLLATION\n [LIKE \'pattern\' | WHERE expr]\n\nThis statement lists collations supported by the server. By default,\nthe output from SHOW COLLATION includes all available collations. The\nLIKE clause, if present, indicates which collation names to match. The\nWHERE clause can be given to select rows using more general conditions,\nas discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html. For example:\n\nmysql> SHOW COLLATION LIKE \'latin1%\';\n+-------------------+---------+----+---------+----------+---------+\n| Collation | Charset | Id | Default | Compiled | Sortlen |\n+-------------------+---------+----+---------+----------+---------+\n| latin1_german1_ci | latin1 | 5 | | | 0 |\n| latin1_swedish_ci | latin1 | 8 | Yes | Yes | 0 |\n| latin1_danish_ci | latin1 | 15 | | | 0 |\n| latin1_german2_ci | latin1 | 31 | | Yes | 2 |\n| latin1_bin | latin1 | 47 | | Yes | 0 |\n| latin1_general_ci | latin1 | 48 | | | 0 |\n| latin1_general_cs | latin1 | 49 | | | 0 |\n| latin1_spanish_ci | latin1 | 94 | | | 0 |\n+-------------------+---------+----+---------+----------+---------+\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-collation.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-collation.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (493,4,'LOG','Syntax:\nLOG(X), LOG(B,X)\n\nIf called with one parameter, this function returns the natural\nlogarithm of X. If X is less than or equal to 0, then NULL is returned.\n\nThe inverse of this function (when called with a single argument) is\nthe EXP() function.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT LOG(2);\n -> 0.69314718055995\nmysql> SELECT LOG(-2);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (494,8,'SET SQL_LOG_BIN','Syntax:\nSET sql_log_bin = {0|1}\n\nThe sql_log_bin variable controls whether logging to the binary log is\ndone. The default value is 1 (do logging). To change logging for the\ncurrent session, change the session value of this variable. The session\nuser must have the SUPER privilege to set this variable.\n\nBeginning with MySQL 5.5.5, it is no longer possible to set\n@@session.sql_log_bin within a transaction or subquery. (Bug #53437)\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/set-sql-log-bin.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/set-sql-log-bin.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (495,18,'!=','Syntax:\n<>, !=\n\nNot equal:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT \'.01\' <> \'0.01\';\n -> 1\nmysql> SELECT .01 <> \'0.01\';\n -> 0\nmysql> SELECT \'zapp\' <> \'zappp\';\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (496,23,'WHILE','Syntax:\n[begin_label:] WHILE search_condition DO\n statement_list\nEND WHILE [end_label]\n\nThe statement list within a WHILE statement is repeated as long as the\nsearch_condition expression is true. statement_list consists of one or\nmore SQL statements, each terminated by a semicolon (;) statement\ndelimiter.\n\nA WHILE statement can be labeled. For the rules regarding label use,\nsee [HELP labels].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/while.html\n\n','CREATE PROCEDURE dowhile()\nBEGIN\n DECLARE v1 INT DEFAULT 5;\n\n WHILE v1 > 0 DO\n ...\n SET v1 = v1 - 1;\n END WHILE;\nEND;\n','http://dev.mysql.com/doc/refman/5.5/en/while.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (497,12,'AES_DECRYPT','Syntax:\nAES_DECRYPT(crypt_str,key_str)\n\nThis function decrypts data using the official AES (Advanced Encryption\nStandard) algorithm. For more information, see the description of\nAES_ENCRYPT().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (498,31,'DAYNAME','Syntax:\nDAYNAME(date)\n\nReturns the name of the weekday for date. The language used for the\nname is controlled by the value of the lc_time_names system variable\n(http://dev.mysql.com/doc/refman/5.5/en/locale-support.html).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT DAYNAME(\'2007-02-03\');\n -> \'Saturday\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (499,17,'COERCIBILITY','Syntax:\nCOERCIBILITY(str)\n\nReturns the collation coercibility value of the string argument.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','mysql> SELECT COERCIBILITY(\'abc\' COLLATE latin1_swedish_ci);\n -> 0\nmysql> SELECT COERCIBILITY(USER());\n -> 3\nmysql> SELECT COERCIBILITY(\'abc\');\n -> 4\n','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (500,22,'INT','INT[(M)] [UNSIGNED] [ZEROFILL]\n\nA normal-size integer. The signed range is -2147483648 to 2147483647.\nThe unsigned range is 0 to 4294967295.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (501,13,'GLENGTH','GLength(ls)\n\nReturns as a double-precision number the length of the LineString value\nls in its associated spatial reference.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#linestring-property-functions\n\n','mysql> SET @ls = \'LineString(1 1,2 2,3 3)\';\nmysql> SELECT GLength(GeomFromText(@ls));\n+----------------------------+\n| GLength(GeomFromText(@ls)) |\n+----------------------------+\n| 2.8284271247462 |\n+----------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#linestring-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (502,4,'RADIANS','Syntax:\nRADIANS(X)\n\nReturns the argument X, converted from degrees to radians. (Note that\nπ radians equals 180 degrees.)\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT RADIANS(90);\n -> 1.5707963267949\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (503,17,'COLLATION','Syntax:\nCOLLATION(str)\n\nReturns the collation of the string argument.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','mysql> SELECT COLLATION(\'abc\');\n -> \'latin1_swedish_ci\'\nmysql> SELECT COLLATION(_utf8\'abc\');\n -> \'utf8_general_ci\'\n','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (504,18,'COALESCE','Syntax:\nCOALESCE(value,...)\n\nReturns the first non-NULL value in the list, or NULL if there are no\nnon-NULL values.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT COALESCE(NULL,1);\n -> 1\nmysql> SELECT COALESCE(NULL,NULL,NULL);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (505,17,'VERSION','Syntax:\nVERSION()\n\nReturns a string that indicates the MySQL server version. The string\nuses the utf8 character set. The value might have a suffix in addition\nto the version number. See the description of the version system\nvariable in\nhttp://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','mysql> SELECT VERSION();\n -> \'5.5.29-standard\'\n','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (506,37,'MAKE_SET','Syntax:\nMAKE_SET(bits,str1,str2,...)\n\nReturns a set value (a string containing substrings separated by ","\ncharacters) consisting of the strings that have the corresponding bit\nin bits set. str1 corresponds to bit 0, str2 to bit 1, and so on. NULL\nvalues in str1, str2, ... are not appended to the result.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT MAKE_SET(1,\'a\',\'b\',\'c\');\n -> \'a\'\nmysql> SELECT MAKE_SET(1 | 4,\'hello\',\'nice\',\'world\');\n -> \'hello,world\'\nmysql> SELECT MAKE_SET(1 | 4,\'hello\',\'nice\',NULL,\'world\');\n -> \'hello\'\nmysql> SELECT MAKE_SET(0,\'a\',\'b\',\'c\');\n -> \'\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (507,37,'FIND_IN_SET','Syntax:\nFIND_IN_SET(str,strlist)\n\nReturns a value in the range of 1 to N if the string str is in the\nstring list strlist consisting of N substrings. A string list is a\nstring composed of substrings separated by "," characters. If the first\nargument is a constant string and the second is a column of type SET,\nthe FIND_IN_SET() function is optimized to use bit arithmetic. Returns\n0 if str is not in strlist or if strlist is the empty string. Returns\nNULL if either argument is NULL. This function does not work properly\nif the first argument contains a comma (",") character.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT FIND_IN_SET(\'b\',\'a,b,c,d\');\n -> 2\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (191,37,'CHARACTER_LENGTH','Syntax:\nCHARACTER_LENGTH(str)\n\nCHARACTER_LENGTH() is a synonym for CHAR_LENGTH().\n\nURL: https://mariadb.com/kb/en/character_length/\n\n','','https://mariadb.com/kb/en/character_length/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (192,26,'SHOW GRANTS','Syntax:\nSHOW GRANTS [FOR user]\n\nThis statement lists the GRANT statement or statements that must be\nissued to duplicate the privileges that are granted to a MySQL user\naccount. The account is named using the same format as for the GRANT\nstatement; for example, \'jeffrey\'@\'localhost\'. If you specify only the\nuser name part of the account name, a host name part of \'%\' is used.\nFor additional information about specifying account names, see [HELP\nGRANT].\n\nMariaDB> SHOW GRANTS FOR \'root\'@\'localhost\';\n+---------------------------------------------------------------------+\n| Grants for root@localhost |\n+---------------------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'root\'@\'localhost\' WITH GRANT OPTION |\n+---------------------------------------------------------------------+\n\nTo list the privileges granted to the account that you are using to\nconnect to the server, you can use any of the following statements:\n\nSHOW GRANTS;\nSHOW GRANTS FOR CURRENT_USER;\nSHOW GRANTS FOR CURRENT_USER();\n\nIf SHOW GRANTS FOR CURRENT_USER (or any of the equivalent syntaxes) is\nused in DEFINER context, such as within a stored procedure that is\ndefined with SQL SECURITY DEFINER), the grants displayed are those of\nthe definer and not the invoker.\n\nURL: https://mariadb.com/kb/en/show-grants/\n\n','','https://mariadb.com/kb/en/show-grants/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (193,26,'SHOW PRIVILEGES','Syntax:\nSHOW PRIVILEGES\n\nSHOW PRIVILEGES shows the list of system privileges that the MySQL\nserver supports. The exact list of privileges depends on the version of\nyour server.\n\nURL: https://mariadb.com/kb/en/show-privileges/\n\n','','https://mariadb.com/kb/en/show-privileges/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (194,39,'CREATE TABLESPACE','Syntax:\nCREATE TABLESPACE tablespace_name\n ADD DATAFILE \'file_name\'\n USE LOGFILE GROUP logfile_group\n [EXTENT_SIZE [=] extent_size]\n [INITIAL_SIZE [=] initial_size]\n [AUTOEXTEND_SIZE [=] autoextend_size]\n [MAX_SIZE [=] max_size]\n [NODEGROUP [=] nodegroup_id]\n [WAIT]\n [COMMENT [=] comment_text]\n ENGINE [=] engine_name\n\nThis statement is used with NDB cluster, which is not supported by MariaDB.','','https://mariadb.com/kb/en/create-tablespace/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (195,37,'INSERT FUNCTION','Syntax:\nINSERT(str,pos,len,newstr)\n\nReturns the string str, with the substring beginning at position pos\nand len characters long replaced by the string newstr. Returns the\noriginal string if pos is not within the length of the string. Replaces\nthe rest of the string from position pos if len is not within the\nlength of the rest of the string. Returns NULL if any argument is NULL.\n\nURL: https://mariadb.com/kb/en/insert-function/\n\n','MariaDB> SELECT INSERT(\'Quadratic\', 3, 4, \'What\');\n -> \'QuWhattic\'\nMariaDB> SELECT INSERT(\'Quadratic\', -1, 4, \'What\');\n -> \'Quadratic\'\nMariaDB> SELECT INSERT(\'Quadratic\', 3, 100, \'What\');\n -> \'QuWhat\'\n','https://mariadb.com/kb/en/insert-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (196,4,'CRC32','Syntax:\nCRC32(expr)\n\nComputes a cyclic redundancy check value and returns a 32-bit unsigned\nvalue. The result is NULL if the argument is NULL. The argument is\nexpected to be a string and (if possible) is treated as one if it is\nnot.\n\nURL: https://mariadb.com/kb/en/crc32/\n\n','MariaDB> SELECT CRC32(\'MySQL\');\n -> 3259397556\nMariaDB> SELECT CRC32(\'mysql\');\n -> 2501908538\n','https://mariadb.com/kb/en/crc32/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (197,15,'XOR','Syntax:\nXOR\n\nLogical XOR. Returns NULL if either operand is NULL. For non-NULL\noperands, evaluates to 1 if an odd number of operands is nonzero,\notherwise 0 is returned.\n\nURL: https://mariadb.com/kb/en/xor/\n\n','MariaDB> SELECT 1 XOR 1;\n -> 0\nMariaDB> SELECT 1 XOR 0;\n -> 1\nMariaDB> SELECT 1 XOR NULL;\n -> NULL\nMariaDB> SELECT 1 XOR 1 XOR 1;\n -> 1\n','https://mariadb.com/kb/en/xor/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (198,13,'STARTPOINT','StartPoint(ls)\n\nReturns the Point that is the start point of the LineString value ls.\n\nURL: https://mariadb.com/kb/en/startpoint/\n\n','MariaDB> SET @ls = \'LineString(1 1,2 2,3 3)\';\nMariaDB> SELECT AsText(StartPoint(GeomFromText(@ls)));\n+---------------------------------------+\n| AsText(StartPoint(GeomFromText(@ls))) |\n+---------------------------------------+\n| POINT(1 1) |\n+---------------------------------------+\n','https://mariadb.com/kb/en/startpoint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (199,10,'GRANT','Syntax:\nGRANT\n priv_type [(column_list)]\n [, priv_type [(column_list)]] ...\n ON [object_type] priv_level\n TO user_specification [, user_specification] ...\n [REQUIRE {NONE | ssl_option [[AND] ssl_option] ...}]\n [WITH with_option ...]\n\nGRANT PROXY ON user_specification\n TO user_specification [, user_specification] ...\n [WITH GRANT OPTION]\n\nobject_type:\n TABLE\n | FUNCTION\n | PROCEDURE\n\npriv_level:\n *\n | *.*\n | db_name.*\n | db_name.tbl_name\n | tbl_name\n | db_name.routine_name\n\nuser_specification:\n user\n [\n IDENTIFIED BY [PASSWORD] \'password\'\n | IDENTIFIED WITH auth_plugin [AS \'auth_string\']\n ]\n\nssl_option:\n SSL\n | X509\n | CIPHER \'cipher\'\n | ISSUER \'issuer\'\n | SUBJECT \'subject\'\n\nwith_option:\n GRANT OPTION\n | MAX_QUERIES_PER_HOUR count\n | MAX_UPDATES_PER_HOUR count\n | MAX_CONNECTIONS_PER_HOUR count\n | MAX_USER_CONNECTIONS count\n\nThe GRANT statement grants privileges to MySQL user accounts. GRANT\nalso serves to specify other account characteristics such as use of\nsecure connections and limits on access to server resources. To use\nGRANT, you must have the GRANT OPTION privilege, and you must have the\nprivileges that you are granting.\n\nNormally, a database administrator first uses CREATE USER to create an\naccount, then GRANT to define its privileges and characteristics. For\nexample:\n\nCREATE USER \'jeffrey\'@\'localhost\' IDENTIFIED BY \'mypass\';\nGRANT ALL ON db1.* TO \'jeffrey\'@\'localhost\';\nGRANT SELECT ON db2.invoice TO \'jeffrey\'@\'localhost\';\nGRANT USAGE ON *.* TO \'jeffrey\'@\'localhost\' WITH MAX_QUERIES_PER_HOUR 90;\n\nHowever, if an account named in a GRANT statement does not already\nexist, GRANT may create it under the conditions described later in the\ndiscussion of the NO_AUTO_CREATE_USER SQL mode.\n\nThe REVOKE statement is related to GRANT and enables administrators to\nremove account privileges. See [HELP REVOKE].\n\nWhen successfully executed from the mysql program, GRANT responds with\nQuery OK, 0 rows affected. To determine what privileges result from the\noperation, use SHOW GRANTS. See [HELP SHOW GRANTS].\n\nURL: https://mariadb.com/kb/en/grant/\n\n','','https://mariadb.com/kb/en/grant/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (200,23,'DECLARE VARIABLE','Syntax:\nDECLARE var_name [, var_name] ... type [DEFAULT value]\n\nThis statement declares local variables within stored programs. To\nprovide a default value for a variable, include a DEFAULT clause. The\nvalue can be specified as an expression; it need not be a constant. If\nthe DEFAULT clause is missing, the initial value is NULL.\n\nLocal variables are treated like stored routine parameters with respect\nto data type and overflow checking. See [HELP CREATE PROCEDURE].\n\nVariable declarations must appear before cursor or handler\ndeclarations.\n\nLocal variable names are not case sensitive. Permissible characters and\nquoting rules are the same as for other identifiers, as described in\nhttps://mariadb.com/kb/en/identifier-names/.\n\nThe scope of a local variable is the BEGIN ... END block within which\nit is declared. The variable can be referred to in blocks nested within\nthe declaring block, except those blocks that declare a variable with\nthe same name.\n\nURL: https://mariadb.com/kb/en/declare-variable/\n\n','','https://mariadb.com/kb/en/declare-variable/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (201,3,'MPOLYFROMTEXT','MPolyFromText(wkt[,srid]), MultiPolygonFromText(wkt[,srid])\n\nConstructs a MULTIPOLYGON value using its WKT representation and SRID.\n\nURL: https://mariadb.com/kb/en/mpolyfromtext/\n\n','','https://mariadb.com/kb/en/mpolyfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (202,6,'MBRINTERSECTS','MBRIntersects(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 intersect.\n\nURL: https://mariadb.com/kb/en/mbrintersects/\n\n','','https://mariadb.com/kb/en/mbrintersects/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (203,16,'BIT_OR','Syntax:\nBIT_OR(expr)\n\nReturns the bitwise OR of all bits in expr. The calculation is\nperformed with 64-bit (BIGINT) precision.\n\nURL: https://mariadb.com/kb/en/bit_or/\n\n','','https://mariadb.com/kb/en/bit_or/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (204,31,'YEARWEEK','Syntax:\nYEARWEEK(date), YEARWEEK(date,mode)\n\nReturns year and week for a date. The mode argument works exactly like\nthe mode argument to WEEK(). The year in the result may be different\nfrom the year in the date argument for the first and the last week of\nthe year.\n\nURL: https://mariadb.com/kb/en/yearweek/\n\n','MariaDB> SELECT YEARWEEK(\'1987-01-01\');\n -> 198653\n','https://mariadb.com/kb/en/yearweek/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (205,18,'NOT BETWEEN','Syntax:\nexpr NOT BETWEEN min AND max\n\nThis is the same as NOT (expr BETWEEN min AND max).\n\nURL: https://mariadb.com/kb/en/not-between/\n\n','','https://mariadb.com/kb/en/not-between/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (206,18,'IS NOT','Syntax:\nIS NOT boolean_value\n\nTests a value against a boolean value, where boolean_value can be TRUE,\nFALSE, or UNKNOWN.\n\nURL: https://mariadb.com/kb/en/is-not/\n\n','MariaDB> SELECT 1 IS NOT UNKNOWN, 0 IS NOT UNKNOWN, NULL IS NOT UNKNOWN;\n -> 1, 1, 0\n','https://mariadb.com/kb/en/is-not/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (207,4,'LOG10','Syntax:\nLOG10(X)\n\nReturns the base-10 logarithm of X.\n\nURL: https://mariadb.com/kb/en/log10/\n\n','MariaDB> SELECT LOG10(2);\n -> 0.30102999566398\nMariaDB> SELECT LOG10(100);\n -> 2\nMariaDB> SELECT LOG10(-100);\n -> NULL\n','https://mariadb.com/kb/en/log10/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (208,4,'SQRT','Syntax:\nSQRT(X)\n\nReturns the square root of a nonnegative number X.\n\nURL: https://mariadb.com/kb/en/sqrt/\n\n','MariaDB> SELECT SQRT(4);\n -> 2\nMariaDB> SELECT SQRT(20);\n -> 4.4721359549996\nMariaDB> SELECT SQRT(-16);\n -> NULL\n','https://mariadb.com/kb/en/sqrt/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (209,22,'DECIMAL','DECIMAL[(M[,D])] [UNSIGNED] [ZEROFILL]\n\nA packed "exact" fixed-point number. M is the total number of digits\n(the precision) and D is the number of digits after the decimal point\n(the scale). The decimal point and (for negative numbers) the "-" sign\nare not counted in M. If D is 0, values have no decimal point or\nfractional part. The maximum number of digits (M) for DECIMAL is 65.\nThe maximum number of supported decimals (D) is 30. If D is omitted,\nthe default is 0. If M is omitted, the default is 10.\n\nUNSIGNED, if specified, disallows negative values.\n\nAll basic calculations (+, -, *, /) with DECIMAL columns are done with\na precision of 65 digits.\n\nURL: https://mariadb.com/kb/en/decimal/\n\n','','https://mariadb.com/kb/en/decimal/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (210,39,'CREATE INDEX','Syntax:\nCREATE [ONLINE|OFFLINE] [UNIQUE|FULLTEXT|SPATIAL] INDEX index_name\n [index_type]\n ON tbl_name (index_col_name,...)\n [index_option] ...\n\nindex_col_name:\n col_name [(length)] [ASC | DESC]\n\nindex_type:\n USING {BTREE | HASH}\n\nindex_option:\n KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n | COMMENT \'string\'\n\nCREATE INDEX is mapped to an ALTER TABLE statement to create indexes.\nSee [HELP ALTER TABLE]. CREATE INDEX cannot be used to create a PRIMARY\nKEY; use ALTER TABLE instead. For more information about indexes, see\nhttps://mariadb.com/kb/en/optimization-and-indexes/.\n\nURL: https://mariadb.com/kb/en/create-index/\n\n','','https://mariadb.com/kb/en/create-index/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (211,39,'CREATE FUNCTION','The CREATE FUNCTION statement is used to create stored functions and\nuser-defined functions (UDFs):\n\no For information about creating stored functions, see [HELP CREATE\n PROCEDURE].\n\no For information about creating user-defined functions, see [HELP\n CREATE FUNCTION UDF].\n\nURL: https://mariadb.com/kb/en/create-function/\n\n','','https://mariadb.com/kb/en/create-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (212,39,'ALTER DATABASE','Syntax:\nALTER {DATABASE | SCHEMA} [db_name]\n alter_specification ...\nALTER {DATABASE | SCHEMA} db_name\n UPGRADE DATA DIRECTORY NAME\n\nalter_specification:\n [DEFAULT] CHARACTER SET [=] charset_name\n | [DEFAULT] COLLATE [=] collation_name\n\nALTER DATABASE enables you to change the overall characteristics of a\ndatabase. These characteristics are stored in the db.opt file in the\ndatabase directory. To use ALTER DATABASE, you need the ALTER privilege\non the database. ALTER SCHEMA is a synonym for ALTER DATABASE.\n\nThe database name can be omitted from the first syntax, in which case\nthe statement applies to the default database.\n\nNational Language Characteristics\n\nThe CHARACTER SET clause changes the default database character set.\nThe COLLATE clause changes the default database collation.\nhttps://mariadb.com/kb/en/data-types-character-sets-and-collations/, discusses\ncharacter set and collation names.\n\nYou can see what character sets and collations are available using,\nrespectively, the SHOW CHARACTER SET and SHOW COLLATION statements. See\n[HELP SHOW CHARACTER SET], and [HELP SHOW COLLATION], for more\ninformation.\n\nIf you change the default character set or collation for a database,\nstored routines that use the database defaults must be dropped and\nrecreated so that they use the new defaults. (In a stored routine,\nvariables with character data types use the database defaults if the\ncharacter set or collation are not specified explicitly. See [HELP\nCREATE PROCEDURE].)\n\nUpgrading from Versions Older than MySQL 5.1\n\nThe syntax that includes the UPGRADE DATA DIRECTORY NAME clause updates\nthe name of the directory associated with the database to use the\nencoding implemented in MySQL 5.1 for mapping database names to\ndatabase directory names (see\nhttps://mariadb.com/kb/en/identifier-to-file-name-mapping/). This\nclause is for use under these conditions:\n\no It is intended when upgrading MySQL to 5.1 or later from older\n versions.\n\no It is intended to update a database directory name to the current\n encoding format if the name contains special characters that need\n encoding.\n\no The statement is used by mysqlcheck (as invoked by mysql_upgrade).\n\nFor example, if a database in MySQL 5.0 has the name a-b-c, the name\ncontains instances of the - (dash) character. In MySQL 5.0, the\ndatabase directory is also named a-b-c, which is not necessarily safe\nfor all file systems. In MySQL 5.1 and later, the same database name is\nencoded as a@002db@002dc to produce a file system-neutral directory\nname.\n\nWhen a MySQL installation is upgraded to MySQL 5.1 or later from an\nolder version,the server displays a name such as a-b-c (which is in the\nold format) as #mysql50#a-b-c, and you must refer to the name using the\n#mysql50# prefix. Use UPGRADE DATA DIRECTORY NAME in this case to\nexplicitly tell the server to re-encode the database directory name to\nthe current encoding format:\n\nALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;\n\nAfter executing this statement, you can refer to the database as a-b-c\nwithout the special #mysql50# prefix.\n\nURL: https://mariadb.com/kb/en/alter-database/\n\n','','https://mariadb.com/kb/en/alter-database/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (213,25,'GEOMETRYN','GeometryN(gc,N)\n\nReturns the N-th geometry in the GeometryCollection value gc.\nGeometries are numbered beginning with 1.\n\nURL: https://mariadb.com/kb/en/geometryn/\n\n','MariaDB> SET @gc = \'GeometryCollection(Point(1 1),LineString(2 2, 3 3))\';\nMariaDB> SELECT AsText(GeometryN(GeomFromText(@gc),1));\n+----------------------------------------+\n| AsText(GeometryN(GeomFromText(@gc),1)) |\n+----------------------------------------+\n| POINT(1 1) |\n+----------------------------------------+\n','https://mariadb.com/kb/en/geometryn/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (214,19,'<<','Syntax:\n<<\n\nShifts a longlong (BIGINT) number to the left.\n\nURL: https://mariadb.com/kb/en/shift-left/\n\n','MariaDB> SELECT 1 << 2;\n -> 4\n','https://mariadb.com/kb/en/shift-left/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (215,26,'SHOW TABLE STATUS','Syntax:\nSHOW TABLE STATUS [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW TABLE STATUS works likes SHOW TABLES, but provides a lot of\ninformation about each non-TEMPORARY table. You can also get this list\nusing the mysqlshow --status db_name command. The LIKE clause, if\npresent, indicates which table names to match. The WHERE clause can be\ngiven to select rows using more general conditions, as discussed in\nhttps://mariadb.com/kb/en/extended-show/.\n\nURL: https://mariadb.com/kb/en/show-table-status/\n\n','','https://mariadb.com/kb/en/show-table-status/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (216,12,'MD5','Syntax:\nMD5(str)\n\nCalculates an MD5 128-bit checksum for the string. The value is\nreturned as a string of 32 hex digits, or NULL if the argument was\nNULL. The return value can, for example, be used as a hash key. See the\nnotes at the beginning of this section about storing hash values\nefficiently.\n\nAs of MySQL 5.5.3, the return value is a nonbinary string in the\nconnection character set. Before 5.5.3, the return value is a binary\nstring; see the notes at the beginning of this section about using the\nvalue as a nonbinary string.\n\nURL: https://mariadb.com/kb/en/md5/\n\n','MariaDB> SELECT MD5(\'testing\');\n -> \'ae2b1fca515949e5d54fb22b8ed95575\'\n','https://mariadb.com/kb/en/md5/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (217,18,'<','Syntax:\n<\n\nLess than:\n\nURL: https://mariadb.com/kb/en/less-than/\n\n','MariaDB> SELECT 2 < 2;\n -> 0\n','https://mariadb.com/kb/en/less-than/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (218,31,'UNIX_TIMESTAMP','Syntax:\nUNIX_TIMESTAMP(), UNIX_TIMESTAMP(date)\n\nIf called with no argument, returns a Unix timestamp (seconds since\n\'1970-01-01 00:00:00\' UTC) as an unsigned integer. If UNIX_TIMESTAMP()\nis called with a date argument, it returns the value of the argument as\nseconds since \'1970-01-01 00:00:00\' UTC. date may be a DATE string, a\nDATETIME string, a TIMESTAMP, or a number in the format YYMMDD or\nYYYYMMDD. The server interprets date as a value in the current time\nzone and converts it to an internal value in UTC. Clients can set their\ntime zone as described in\nhttps://mariadb.com/kb/en/time-zones/.\n\nURL: https://mariadb.com/kb/en/unix_timestamp/\n\n','MariaDB> SELECT UNIX_TIMESTAMP();\n -> 1196440210\nMariaDB> SELECT UNIX_TIMESTAMP(\'2007-11-30 10:30:19\');\n -> 1196440219\n','https://mariadb.com/kb/en/unix_timestamp/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (219,31,'DAYOFMONTH','Syntax:\nDAYOFMONTH(date)\n\nReturns the day of the month for date, in the range 1 to 31, or 0 for\ndates such as \'0000-00-00\' or \'2008-00-00\' that have a zero day part.\n\nURL: https://mariadb.com/kb/en/dayofmonth/\n\n','MariaDB> SELECT DAYOFMONTH(\'2007-02-03\');\n -> 3\n','https://mariadb.com/kb/en/dayofmonth/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (220,37,'ASCII','Syntax:\nASCII(str)\n\nReturns the numeric value of the leftmost character of the string str.\nReturns 0 if str is the empty string. Returns NULL if str is NULL.\nASCII() works for 8-bit characters.\n\nURL: https://mariadb.com/kb/en/ascii/\n\n','MariaDB> SELECT ASCII(\'2\');\n -> 50\nMariaDB> SELECT ASCII(2);\n -> 50\nMariaDB> SELECT ASCII(\'dx\');\n -> 100\n','https://mariadb.com/kb/en/ascii/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (221,4,'DIV','Syntax:\nDIV\n\nInteger division. Similar to FLOOR(), but is safe with BIGINT values.\n\nAs of MySQL 5.5.3, if either operand has a noninteger type, the\noperands are converted to DECIMAL and divided using DECIMAL arithmetic\nbefore converting the result to BIGINT. If the result exceeds BIGINT\nrange, an error occurs. Before MySQL 5.5.3, incorrect results may occur\nfor noninteger operands that exceed BIGINT range.\n\nURL: https://mariadb.com/kb/en/div/\n\n','MariaDB> SELECT 5 DIV 2;\n -> 2\n','https://mariadb.com/kb/en/div/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (222,10,'RENAME USER','Syntax:\nRENAME USER old_user TO new_user\n [, old_user TO new_user] ...\n\nThe RENAME USER statement renames existing MySQL accounts. To use it,\nyou must have the global CREATE USER privilege or the UPDATE privilege\nfor the mysql database. An error occurs if any old account does not\nexist or any new account exists. Each account name uses the format\ndescribed in https://mariadb.com/kb/en/create-user/#account-names.\nFor example:\n\nRENAME USER \'jeffrey\'@\'localhost\' TO \'jeff\'@\'127.0.0.1\';\n\nIf you specify only the user name part of the account name, a host name\npart of \'%\' is used.\n\nRENAME USER causes the privileges held by the old user to be those held\nby the new user. However, RENAME USER does not automatically drop or\ninvalidate databases or objects within them that the old user created.\nThis includes stored programs or views for which the DEFINER attribute\nnames the old user. Attempts to access such objects may produce an\nerror if they execute in definer security context. (For information\nabout security context, see\nhttps://mariadb.com/kb/en/stored-routine-privileges/.)\n\nThe privilege changes take effect as indicated in\nhttp://dev.mysql.com/doc/refman/5.5/en/privilege-changes.html.\n\nURL: https://mariadb.com/kb/en/rename-user/\n\n','','https://mariadb.com/kb/en/rename-user/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (223,26,'SHOW SLAVE STATUS','Syntax:\nSHOW SLAVE STATUS\n\nThis statement provides status information on essential parameters of\nthe slave threads. It requires either the SUPER or REPLICATION CLIENT\nprivilege.\n\nIf you issue this statement using the mysql client, you can use a \\G\nstatement terminator rather than a semicolon to obtain a more readable\nvertical layout:\n\nMariaDB> SHOW SLAVE STATUS\\G\n*************************** 1. row ***************************\n Slave_IO_State: Waiting for master to send event\n Master_Host: localhost\n Master_User: root\n Master_Port: 3306\n Connect_Retry: 3\n Master_Log_File: gbichot-bin.005\n Read_Master_Log_Pos: 79\n Relay_Log_File: gbichot-relay-bin.005\n Relay_Log_Pos: 548\n Relay_Master_Log_File: gbichot-bin.005\n Slave_IO_Running: Yes\n Slave_SQL_Running: Yes\n Replicate_Do_DB:\n Replicate_Ignore_DB:\n Replicate_Do_Table:\n Replicate_Ignore_Table:\n Replicate_Wild_Do_Table:\n Replicate_Wild_Ignore_Table:\n Last_Errno: 0\n Last_Error:\n Skip_Counter: 0\n Exec_Master_Log_Pos: 79\n Relay_Log_Space: 552\n Until_Condition: None\n Until_Log_File:\n Until_Log_Pos: 0\n Master_SSL_Allowed: No\n Master_SSL_CA_File:\n Master_SSL_CA_Path:\n Master_SSL_Cert:\n Master_SSL_Cipher:\n Master_SSL_Key:\n Seconds_Behind_Master: 8\nMaster_SSL_Verify_Server_Cert: No\n Last_IO_Errno: 0\n Last_IO_Error:\n Last_SQL_Errno: 0\n Last_SQL_Error:\n Replicate_Ignore_Server_Ids: 0\n Master_Server_Id: 1\n\nURL: https://mariadb.com/kb/en/show-slave-status/\n\n','','https://mariadb.com/kb/en/show-slave-status/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (224,34,'GEOMETRY','MySQL provides a standard way of creating spatial columns for geometry\ntypes, for example, with CREATE TABLE or ALTER TABLE. Currently,\nspatial columns are supported for MyISAM, Aria, InnoDB and ARCHIVE\ntables. See also the annotations about spatial indexes under [HELP\nSPATIAL].\n\nURL: https://mariadb.com/kb/en/gis-functionality/\n\n','CREATE TABLE geom (g GEOMETRY);\n','https://mariadb.com/kb/en/gis-functionality/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (225,13,'NUMPOINTS','NumPoints(ls)\n\nReturns the number of Point objects in the LineString value ls.\n\nURL: https://mariadb.com/kb/en/numpoints/\n\n','MariaDB> SET @ls = \'LineString(1 1,2 2,3 3)\';\nMariaDB> SELECT NumPoints(GeomFromText(@ls));\n+------------------------------+\n| NumPoints(GeomFromText(@ls)) |\n+------------------------------+\n| 3 |\n+------------------------------+\n','https://mariadb.com/kb/en/numpoints/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (226,39,'ALTER LOGFILE GROUP','Syntax:\nALTER LOGFILE GROUP logfile_group\n ADD UNDOFILE \'file_name\'\n [INITIAL_SIZE [=] size]\n [WAIT]\n ENGINE [=] engine_name\n\nThis statement is used with NDB cluster, which is not supported by MariaDB.\n','','https://mariadb.com/kb/en/alter-logfile-group/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (227,19,'&','Syntax:\n&\n\nBitwise AND:\n\nURL: https://mariadb.com/kb/en/bitwise_and/\n\n','MariaDB> SELECT 29 & 15;\n -> 13\n','https://mariadb.com/kb/en/bitwise_and/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (228,31,'LOCALTIMESTAMP','Syntax:\nLOCALTIMESTAMP, LOCALTIMESTAMP()\n\nLOCALTIMESTAMP and LOCALTIMESTAMP() are synonyms for NOW().\n\nURL: https://mariadb.com/kb/en/localtimestamp/\n\n','','https://mariadb.com/kb/en/localtimestamp/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (229,15,'ASSIGN-EQUAL','Syntax:\n=\n\nThis operator is used to perform value assignments in two cases,\ndescribed in the next two paragraphs.\n\nWithin a SET statement, = is treated as an assignment operator that\ncauses the user variable on the left hand side of the operator to take\non the value to its right. (In other words, when used in a SET\nstatement, = is treated identically to :=.) The value on the right hand\nside may be a literal value, another variable storing a value, or any\nlegal expression that yields a scalar value, including the result of a\nquery (provided that this value is a scalar value). You can perform\nmultiple assignments in the same SET statement.\n\nIn the SET clause of an UPDATE statement, = also acts as an assignment\noperator; in this case, however, it causes the column named on the left\nhand side of the operator to assume the value given to the right,\nprovided any WHERE conditions that are part of the UPDATE are met. You\ncan make multiple assignments in the same SET clause of an UPDATE\nstatement.\n\nIn any other context, = is treated as a comparison operator.\n\nURL: https://mariadb.com/kb/en/assignment-operators-assignment-operator/\n\n','MariaDB> SELECT @var1, @var2;\n -> NULL, NULL\nMariaDB> SELECT @var1 := 1, @var2;\n -> 1, NULL\nMariaDB> SELECT @var1, @var2;\n -> 1, NULL\nMariaDB> SELECT @var1, @var2 := @var1;\n -> 1, 1\nMariaDB> SELECT @var1, @var2;\n -> 1, 1\n','https://mariadb.com/kb/en/assignment-operators-assignment-operator/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (230,37,'CONVERT','Syntax:\nCONVERT(expr,type), CONVERT(expr USING transcoding_name)\n\nThe CONVERT() and CAST() functions take an expression of any type and\nproduce a result value of a specified type.\n\nThe type for the result can be one of the following values:\n\no BINARY[(N)]\n\no CHAR[(N)]\n\no DATE\n\no DATETIME\n\no DECIMAL[(M[,D])]\n\no SIGNED [INTEGER]\n\no TIME\n\no UNSIGNED [INTEGER]\n\nBINARY produces a string with the BINARY data type. See\nhttps://mariadb.com/kb/en/binary/ for a\ndescription of how this affects comparisons. If the optional length N\nis given, BINARY(N) causes the cast to use no more than N bytes of the\nargument. Values shorter than N bytes are padded with 0x00 bytes to a\nlength of N.\n\nCHAR(N) causes the cast to use no more than N characters of the\nargument.\n\nCAST() and CONVERT(... USING ...) are standard SQL syntax. The\nnon-USING form of CONVERT() is ODBC syntax.\n\nCONVERT() with USING is used to convert data between different\ncharacter sets. In MySQL, transcoding names are the same as the\ncorresponding character set names. For example, this statement converts\nthe string \'abc\' in the default character set to the corresponding\nstring in the utf8 character set:\n\nSELECT CONVERT(\'abc\' USING utf8);\n\nURL: https://mariadb.com/kb/en/convert/\n\n','SELECT enum_col FROM tbl_name ORDER BY CAST(enum_col AS CHAR);\n','https://mariadb.com/kb/en/convert/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (231,31,'ADDDATE','Syntax:\nADDDATE(date,INTERVAL expr unit), ADDDATE(expr,days)\n\nWhen invoked with the INTERVAL form of the second argument, ADDDATE()\nis a synonym for DATE_ADD(). The related function SUBDATE() is a\nsynonym for DATE_SUB(). For information on the INTERVAL unit argument,\nsee the discussion for DATE_ADD().\n\nMariaDB> SELECT DATE_ADD(\'2008-01-02\', INTERVAL 31 DAY);\n -> \'2008-02-02\'\nMariaDB> SELECT ADDDATE(\'2008-01-02\', INTERVAL 31 DAY);\n -> \'2008-02-02\'\n\nWhen invoked with the days form of the second argument, MySQL treats it\nas an integer number of days to be added to expr.\n\nURL: https://mariadb.com/kb/en/adddate/\n\n','MariaDB> SELECT ADDDATE(\'2008-01-02\', 31);\n -> \'2008-02-02\'\n','https://mariadb.com/kb/en/adddate/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (232,23,'REPEAT LOOP','Syntax:\n[begin_label:] REPEAT\n statement_list\nUNTIL search_condition\nEND REPEAT [end_label]\n\nThe statement list within a REPEAT statement is repeated until the\nsearch_condition expression is true. Thus, a REPEAT always enters the\nloop at least once. statement_list consists of one or more statements,\neach terminated by a semicolon (;) statement delimiter.\n\nA REPEAT statement can be labeled. For the rules regarding label use,\nsee [HELP labels].\n\nURL: https://mariadb.com/kb/en/repeat-loop/\n\n','MariaDB> delimiter //\n\nMariaDB> CREATE PROCEDURE dorepeat(p1 INT)\n -> BEGIN\n -> SET @x = 0;\n -> REPEAT\n -> SET @x = @x + 1;\n -> UNTIL @x > p1 END REPEAT;\n -> END\n -> //\nQuery OK, 0 rows affected (0.00 sec)\n\nMariaDB> CALL dorepeat(1000)//\nQuery OK, 0 rows affected (0.00 sec)\n\nMariaDB> SELECT @x//\n+------+\n| @x |\n+------+\n| 1001 |\n+------+\n1 row in set (0.00 sec)\n','https://mariadb.com/kb/en/repeat-loop/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (233,39,'ALTER FUNCTION','Syntax:\nALTER FUNCTION func_name [characteristic ...]\n\ncharacteristic:\n COMMENT \'string\'\n | LANGUAGE SQL\n | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }\n | SQL SECURITY { DEFINER | INVOKER }\n\nThis statement can be used to change the characteristics of a stored\nfunction. More than one change may be specified in an ALTER FUNCTION\nstatement. However, you cannot change the parameters or body of a\nstored function using this statement; to make such changes, you must\ndrop and re-create the function using DROP FUNCTION and CREATE\nFUNCTION.\n\nYou must have the ALTER ROUTINE privilege for the function. (That\nprivilege is granted automatically to the function creator.) If binary\nlogging is enabled, the ALTER FUNCTION statement might also require the\nSUPER privilege, as described in\nhttps://mariadb.com/kb/en/binary-logging-of-stored-routines/.\n\nURL: https://mariadb.com/kb/en/alter-function/\n\n','','https://mariadb.com/kb/en/alter-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (234,22,'SMALLINT','SMALLINT[(M)] [UNSIGNED] [ZEROFILL]\n\nA small integer. The signed range is -32768 to 32767. The unsigned\nrange is 0 to 65535.\n\nURL: https://mariadb.com/kb/en/smallint/\n\n','','https://mariadb.com/kb/en/smallint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (235,22,'DOUBLE PRECISION','DOUBLE PRECISION[(M,D)] [UNSIGNED] [ZEROFILL], REAL[(M,D)] [UNSIGNED]\n[ZEROFILL]\n\nThese types are synonyms for DOUBLE. Exception: If the REAL_AS_FLOAT\nSQL mode is enabled, REAL is a synonym for FLOAT rather than DOUBLE.\n\nURL: https://mariadb.com/kb/en/double-precision/\n\n','','https://mariadb.com/kb/en/double-precision/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (236,37,'ORD','Syntax:\nORD(str)\n\nIf the leftmost character of the string str is a multi-byte character,\nreturns the code for that character, calculated from the numeric values\nof its constituent bytes using this formula:\n\n (1st byte code)\n+ (2nd byte code * 256)\n+ (3rd byte code * 2562) ...\n\nIf the leftmost character is not a multi-byte character, ORD() returns\nthe same value as the ASCII() function.\n\nURL: https://mariadb.com/kb/en/ord/\n\n','MariaDB> SELECT ORD(\'2\');\n -> 50\n','https://mariadb.com/kb/en/ord/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (237,8,'DEALLOCATE PREPARE','Syntax:\n{DEALLOCATE | DROP} PREPARE stmt_name\n\nTo deallocate a prepared statement produced with PREPARE, use a\nDEALLOCATE PREPARE statement that refers to the prepared statement\nname. Attempting to execute a prepared statement after deallocating it\nresults in an error.\n\nURL: https://mariadb.com/kb/en/deallocate-drop-prepared-statement/\n\n','','https://mariadb.com/kb/en/deallocate-drop-prepared-statement/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (238,36,'ENVELOPE','Envelope(g)\n\nReturns the Minimum Bounding Rectangle (MBR) for the geometry value g.\nThe result is returned as a Polygon value.\n\nThe polygon is defined by the corner points of the bounding box:\n\nPOLYGON((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))\n\nURL: https://mariadb.com/kb/en/envelope/\n\n','MariaDB> SELECT AsText(Envelope(GeomFromText(\'LineString(1 1,2 2)\')));\n+-------------------------------------------------------+\n| AsText(Envelope(GeomFromText(\'LineString(1 1,2 2)\'))) |\n+-------------------------------------------------------+\n| POLYGON((1 1,2 1,2 2,1 2,1 1)) |\n+-------------------------------------------------------+\n','https://mariadb.com/kb/en/envelope/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (239,14,'IS_FREE_LOCK','Syntax:\nIS_FREE_LOCK(str)\n\nChecks whether the lock named str is free to use (that is, not locked).\nReturns 1 if the lock is free (no one is using the lock), 0 if the lock\nis in use, and NULL if an error occurs (such as an incorrect argument).\n\nURL: https://mariadb.com/kb/en/is_free_lock/\n\n','','https://mariadb.com/kb/en/is_free_lock/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (240,30,'TOUCHES','Touches(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 spatially touches g2. Two\ngeometries spatially touch if the interiors of the geometries do not\nintersect, but the boundary of one of the geometries intersects either\nthe boundary or the interior of the other.\n\nURL: https://mariadb.com/kb/en/touches/\n\n','','https://mariadb.com/kb/en/touches/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (241,14,'INET_ATON','Syntax:\nINET_ATON(expr)\n\nGiven the dotted-quad representation of an IPv4 network address as a\nstring, returns an integer that represents the numeric value of the\naddress in network byte order (big endian). INET_ATON() returns NULL if\nit does not understand its argument.\n\nURL: https://mariadb.com/kb/en/inet_aton/\n\n','MariaDB> SELECT INET_ATON(\'10.0.5.9\');\n -> 167773449\n','https://mariadb.com/kb/en/inet_aton/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (242,12,'UNCOMPRESS','Syntax:\nUNCOMPRESS(string_to_uncompress)\n\nUncompresses a string compressed by the COMPRESS() function. If the\nargument is not a compressed value, the result is NULL. This function\nrequires MySQL to have been compiled with a compression library such as\nzlib. Otherwise, the return value is always NULL.\n\nURL: https://mariadb.com/kb/en/uncompress/\n\n','MariaDB> SELECT UNCOMPRESS(COMPRESS(\'any string\'));\n -> \'any string\'\nMariaDB> SELECT UNCOMPRESS(\'any string\');\n -> NULL\n','https://mariadb.com/kb/en/uncompress/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (243,22,'AUTO_INCREMENT','The AUTO_INCREMENT attribute can be used to generate a unique identity\nfor new rows:\n\nURL: https://mariadb.com/kb/en/auto_increment/\n\n','CREATE TABLE animals (\n id MEDIUMINT NOT NULL AUTO_INCREMENT,\n name CHAR(30) NOT NULL,\n PRIMARY KEY (id)\n);\n\nINSERT INTO animals (name) VALUES\n (\'dog\'),(\'cat\'),(\'penguin\'),\n (\'lax\'),(\'whale\'),(\'ostrich\');\n\nSELECT * FROM animals;\n','https://mariadb.com/kb/en/auto_increment/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (244,36,'ISSIMPLE','IsSimple(g)\n\nCurrently, this function is a placeholder and should not be used. If\nimplemented, its behavior will be as described in the next paragraph.\n\nReturns 1 if the geometry value g has no anomalous geometric points,\nsuch as self-intersection or self-tangency. IsSimple() returns 0 if the\nargument is not simple, and -1 if it is NULL.\n\nThe description of each instantiable geometric class given earlier in\nthe chapter includes the specific conditions that cause an instance of\nthat class to be classified as not simple. (See [HELP Geometry\nhierarchy].)\n\nURL: https://mariadb.com/kb/en/issimple/\n\n','','https://mariadb.com/kb/en/issimple/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (245,4,'- BINARY','Syntax:\n-\n\nSubtraction:\n\nURL: https://mariadb.com/kb/en/subtraction-operator-/\n\n','MariaDB> SELECT 3-5;\n -> -2\n','https://mariadb.com/kb/en/subtraction-operator-/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (246,3,'GEOMCOLLFROMTEXT','GeomCollFromText(wkt[,srid]), GeometryCollectionFromText(wkt[,srid])\n\nConstructs a GEOMETRYCOLLECTION value using its WKT representation and\nSRID.\n\nURL: https://mariadb.com/kb/en/geomcollfromtext/\n\n','','https://mariadb.com/kb/en/geomcollfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (247,3,'WKT DEFINITION','The Well-Known Text (WKT) representation of Geometry is designed to\nexchange geometry data in ASCII form. For a Backus-Naur grammar that\nspecifies the formal production rules for writing WKT values, see the\nOpenGIS specification document referenced in\nhttps://mariadb.com/kb/en/gis-resources/.\n\nURL: https://mariadb.com/kb/en/wkt-definition/\n\n','','https://mariadb.com/kb/en/wkt-definition/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (248,31,'CURRENT_TIME','Syntax:\nCURRENT_TIME, CURRENT_TIME()\n\nCURRENT_TIME and CURRENT_TIME() are synonyms for CURTIME().\n\nURL: https://mariadb.com/kb/en/current_time/\n\n','','https://mariadb.com/kb/en/current_time/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (249,10,'REVOKE','Syntax:\nREVOKE\n priv_type [(column_list)]\n [, priv_type [(column_list)]] ...\n ON [object_type] priv_level\n FROM user [, user] ...\n\nREVOKE ALL PRIVILEGES, GRANT OPTION\n FROM user [, user] ...\n\nREVOKE PROXY ON user\n FROM user [, user] ...\n\nThe REVOKE statement enables system administrators to revoke privileges\nfrom MySQL accounts. Each account name uses the format described in\nhttps://mariadb.com/kb/en/create-user#account-names. For example:\n\nREVOKE INSERT ON *.* FROM \'jeffrey\'@\'localhost\';\n\nIf you specify only the user name part of the account name, a host name\npart of \'%\' is used.\n\nFor details on the levels at which privileges exist, the permissible\npriv_type and priv_level values, and the syntax for specifying users\nand passwords, see [HELP GRANT]\n\nTo use the first REVOKE syntax, you must have the GRANT OPTION\nprivilege, and you must have the privileges that you are revoking.\n\nTo revoke all privileges, use the second syntax, which drops all\nglobal, database, table, column, and routine privileges for the named\nuser or users:\n\nREVOKE ALL PRIVILEGES, GRANT OPTION FROM user [, user] ...\n\nTo use this REVOKE syntax, you must have the global CREATE USER\nprivilege or the UPDATE privilege for the mysql database.\n\nURL: https://mariadb.com/kb/en/revoke/\n\n','','https://mariadb.com/kb/en/revoke/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (250,17,'LAST_INSERT_ID','Syntax:\nLAST_INSERT_ID(), LAST_INSERT_ID(expr)\n\nLAST_INSERT_ID() (with no argument) returns a BIGINT (64-bit) value\nrepresenting the first automatically generated value successfully\ninserted for an AUTO_INCREMENT column as a result of the most recently\nexecuted INSERT statement. The value of LAST_INSERT_ID() remains\nunchanged if no rows are successfully inserted.\n\nFor example, after inserting a row that generates an AUTO_INCREMENT\nvalue, you can get the value like this:\n\nMariaDB> SELECT LAST_INSERT_ID();\n -> 195\n\nThe currently executing statement does not affect the value of\nLAST_INSERT_ID(). Suppose that you generate an AUTO_INCREMENT value\nwith one statement, and then refer to LAST_INSERT_ID() in a\nmultiple-row INSERT statement that inserts rows into a table with its\nown AUTO_INCREMENT column. The value of LAST_INSERT_ID() will remain\nstable in the second statement; its value for the second and later rows\nis not affected by the earlier row insertions. (However, if you mix\nreferences to LAST_INSERT_ID() and LAST_INSERT_ID(expr), the effect is\nundefined.)\n\nIf the previous statement returned an error, the value of\nLAST_INSERT_ID() is undefined. For transactional tables, if the\nstatement is rolled back due to an error, the value of LAST_INSERT_ID()\nis left undefined. For manual ROLLBACK, the value of LAST_INSERT_ID()\nis not restored to that before the transaction; it remains as it was at\nthe point of the ROLLBACK.\n\nWithin the body of a stored routine (procedure or function) or a\ntrigger, the value of LAST_INSERT_ID() changes the same way as for\nstatements executed outside the body of these kinds of objects. The\neffect of a stored routine or trigger upon the value of\nLAST_INSERT_ID() that is seen by following statements depends on the\nkind of routine:\n\no If a stored procedure executes statements that change the value of\n LAST_INSERT_ID(), the changed value is seen by statements that follow\n the procedure call.\n\no For stored functions and triggers that change the value, the value is\n restored when the function or trigger ends, so following statements\n will not see a changed value.\n\nURL: https://mariadb.com/kb/en/last_insert_id/\n\n','','https://mariadb.com/kb/en/last_insert_id/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (251,31,'LAST_DAY','Syntax:\nLAST_DAY(date)\n\nTakes a date or datetime value and returns the corresponding value for\nthe last day of the month. Returns NULL if the argument is invalid.\n\nURL: https://mariadb.com/kb/en/last_day/\n\n','MariaDB> SELECT LAST_DAY(\'2003-02-05\');\n -> \'2003-02-28\'\nMariaDB> SELECT LAST_DAY(\'2004-02-05\');\n -> \'2004-02-29\'\nMariaDB> SELECT LAST_DAY(\'2004-01-01 01:01:01\');\n -> \'2004-01-31\'\nMariaDB> SELECT LAST_DAY(\'2003-03-32\');\n -> NULL\n','https://mariadb.com/kb/en/last_day/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (252,22,'MEDIUMINT','MEDIUMINT[(M)] [UNSIGNED] [ZEROFILL]\n\nA medium-sized integer. The signed range is -8388608 to 8388607. The\nunsigned range is 0 to 16777215.\n\nURL: https://mariadb.com/kb/en/mediumint/\n\n','','https://mariadb.com/kb/en/mediumint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (253,4,'FLOOR','Syntax:\nFLOOR(X)\n\nReturns the largest integer value not greater than X.\n\nURL: https://mariadb.com/kb/en/floor/\n\n','MariaDB> SELECT FLOOR(1.23);\n -> 1\nMariaDB> SELECT FLOOR(-1.23);\n -> -2\n','https://mariadb.com/kb/en/floor/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (254,37,'RTRIM','Syntax:\nRTRIM(str)\n\nReturns the string str with trailing space characters removed.\n\nURL: https://mariadb.com/kb/en/rtrim/\n\n','MariaDB> SELECT RTRIM(\'barbar \');\n -> \'barbar\'\n','https://mariadb.com/kb/en/rtrim/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (255,28,'EXPLAIN','Syntax:\nEXPLAIN [explain_type] SELECT select_options\n\nexplain_type:\n EXTENDED\n | PARTITIONS\n\nOr:\n\nEXPLAIN tbl_name\n\nThe EXPLAIN statement can be used either as a way to obtain information\nabout how MySQL executes a statement, or as a synonym for DESCRIBE:\n\no When you precede a SELECT statement with the keyword EXPLAIN, MySQL\n displays information from the optimizer about the query execution\n plan. That is, MySQL explains how it would process the statement,\n including information about how tables are joined and in which order.\n EXPLAIN EXTENDED can be used to obtain additional information.\n\n For information about using EXPLAIN and EXPLAIN EXTENDED to obtain\n query execution plan information, see\n https://mariadb.com/kb/en/explain/.\n\no EXPLAIN PARTITIONS is useful only when examining queries involving\n partitioned tables. For details, see\n http://dev.mysql.com/doc/refman/5.5/en/partitioning-info.html.\n\no EXPLAIN tbl_name is synonymous with DESCRIBE tbl_name or SHOW COLUMNS\n FROM tbl_name. For information about DESCRIBE and SHOW COLUMNS, see\n [HELP DESCRIBE], and [HELP SHOW COLUMNS].\n\nURL: https://mariadb.com/kb/en/explain/\n\n','','https://mariadb.com/kb/en/explain/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (256,4,'DEGREES','Syntax:\nDEGREES(X)\n\nReturns the argument X, converted from radians to degrees.\n\nURL: https://mariadb.com/kb/en/degrees/\n\n','MariaDB> SELECT DEGREES(PI());\n -> 180\nMariaDB> SELECT DEGREES(PI() / 2);\n -> 90\n','https://mariadb.com/kb/en/degrees/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (257,22,'VARCHAR','[NATIONAL] VARCHAR(M) [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n\nA variable-length string. M represents the maximum column length in\ncharacters. The range of M is 0 to 65,535. The effective maximum length\nof a VARCHAR is subject to the maximum row size (65,535 bytes, which is\nshared among all columns) and the character set used. For example, utf8\ncharacters can require up to three bytes per character, so a VARCHAR\ncolumn that uses the utf8 character set can be declared to be a maximum\nof 21,844 characters. See\nhttp://dev.mysql.com/doc/refman/5.5/en/column-count-limit.html.\n\nMySQL stores VARCHAR values as a 1-byte or 2-byte length prefix plus\ndata. The length prefix indicates the number of bytes in the value. A\nVARCHAR column uses one length byte if values require no more than 255\nbytes, two length bytes if values may require more than 255 bytes.\n\n*Note*: MySQL 5.5 follows the standard SQL specification, and does not\nremove trailing spaces from VARCHAR values.\n\nVARCHAR is shorthand for CHARACTER VARYING. NATIONAL VARCHAR is the\nstandard SQL way to define that a VARCHAR column should use some\npredefined character set. MySQL 4.1 and up uses utf8 as this predefined\ncharacter set.\nhttps://mariadb.com/kb/en/varchar/. NVARCHAR\nis shorthand for NATIONAL VARCHAR.\n\nURL: https://mariadb.com/kb/en/varchar/\n\n','','https://mariadb.com/kb/en/varchar/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (258,37,'UNHEX','Syntax:\n\nUNHEX(str)\n\nFor a string argument str, UNHEX(str) performs the inverse operation of\nHEX(str). That is, it interprets each pair of characters in the\nargument as a hexadecimal number and converts it to the character\nrepresented by the number. The return value is a binary string.\n\nURL: https://mariadb.com/kb/en/unhex/\n\n','MariaDB> SELECT UNHEX(\'4D7953514C\');\n -> \'MySQL\'\nMariaDB> SELECT 0x4D7953514C;\n -> \'MySQL\'\nMariaDB> SELECT UNHEX(HEX(\'string\'));\n -> \'string\'\nMariaDB> SELECT HEX(UNHEX(\'1267\'));\n -> \'1267\'\n','https://mariadb.com/kb/en/unhex/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (259,4,'- UNARY','Syntax:\n-\n\nUnary minus. This operator changes the sign of the operand.\n\nURL: https://mariadb.com/kb/en/subtraction-operator-/\n\n','MariaDB> SELECT - 2;\n -> -2\n','https://mariadb.com/kb/en/subtraction-operator-/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (260,16,'STD','Syntax:\nSTD(expr)\n\nReturns the population standard deviation of expr. This is an extension\nto standard SQL. The standard SQL function STDDEV_POP() can be used\ninstead.\n\nThis function returns NULL if there were no matching rows.\n\nURL: https://mariadb.com/kb/en/std/\n\n','','https://mariadb.com/kb/en/std/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (261,4,'COS','Syntax:\nCOS(X)\n\nReturns the cosine of X, where X is given in radians.\n\nURL: https://mariadb.com/kb/en/cos/\n\n','MariaDB> SELECT COS(PI());\n -> -1\n','https://mariadb.com/kb/en/cos/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (262,31,'DATE FUNCTION','Syntax:\nDATE(expr)\n\nExtracts the date part of the date or datetime expression expr.\n\nURL: https://mariadb.com/kb/en/date-function/\n\n','MariaDB> SELECT DATE(\'2003-12-31 01:02:03\');\n -> \'2003-12-31\'\n','https://mariadb.com/kb/en/date-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (263,39,'DROP TRIGGER','Syntax:\nDROP TRIGGER [IF EXISTS] [schema_name.]trigger_name\n\nThis statement drops a trigger. The schema (database) name is optional.\nIf the schema is omitted, the trigger is dropped from the default\nschema. DROP TRIGGER requires the TRIGGER privilege for the table\nassociated with the trigger.\n\nUse IF EXISTS to prevent an error from occurring for a trigger that\ndoes not exist. A NOTE is generated for a nonexistent trigger when\nusing IF EXISTS. See [HELP SHOW WARNINGS].\n\nTriggers for a table are also dropped if you drop the table.\n\nURL: https://mariadb.com/kb/en/drop-trigger/\n\n','','https://mariadb.com/kb/en/drop-trigger/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (264,8,'RESET MASTER','Syntax:\nRESET MASTER\n\nDeletes all binary log files listed in the index file, resets the\nbinary log index file to be empty, and creates a new binary log file.\nThis statement is intended to be used only when the master is started\nfor the first time.\n\nURL: https://mariadb.com/kb/en/reset-master/\n\n','','https://mariadb.com/kb/en/reset-master/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (265,4,'TAN','Syntax:\nTAN(X)\n\nReturns the tangent of X, where X is given in radians.\n\nURL: https://mariadb.com/kb/en/tan/\n\n','MariaDB> SELECT TAN(PI());\n -> -1.2246063538224e-16\nMariaDB> SELECT TAN(PI()+1);\n -> 1.5574077246549\n','https://mariadb.com/kb/en/tan/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (266,4,'PI','Syntax:\nPI()\n\nReturns the value of π (pi). The default number of decimal places\ndisplayed is seven, but MySQL uses the full double-precision value\ninternally.\n\nURL: https://mariadb.com/kb/en/pi/\n\n','MariaDB> SELECT PI();\n -> 3.141593\nMariaDB> SELECT PI()+0.000000000000000000;\n -> 3.141592653589793116\n','https://mariadb.com/kb/en/pi/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (267,31,'WEEKOFYEAR','Syntax:\nWEEKOFYEAR(date)\n\nReturns the calendar week of the date as a number in the range from 1\nto 53. WEEKOFYEAR() is a compatibility function that is equivalent to\nWEEK(date,3).\n\nURL: https://mariadb.com/kb/en/weekofyear/\n\n','MariaDB> SELECT WEEKOFYEAR(\'2008-02-20\');\n -> 8\n','https://mariadb.com/kb/en/weekofyear/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (268,4,'/','Syntax:\n/\n\nDivision:\n\nURL: https://mariadb.com/kb/en/division-operator/\n\n','MariaDB> SELECT 3/5;\n -> 0.60\n','https://mariadb.com/kb/en/division-operator/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (269,8,'PURGE BINARY LOGS','Syntax:\nPURGE { BINARY | MASTER } LOGS\n { TO \'log_name\' | BEFORE datetime_expr }\n\nThe binary log is a set of files that contain information about data\nmodifications made by the MySQL server. The log consists of a set of\nbinary log files, plus an index file (see\nhttps://mariadb.com/kb/en/overview-of-the-binary-log/).\n\nThe PURGE BINARY LOGS statement deletes all the binary log files listed\nin the log index file prior to the specified log file name or date.\nBINARY and MASTER are synonyms. Deleted log files also are removed from\nthe list recorded in the index file, so that the given log file becomes\nthe first in the list.\n\nThis statement has no effect if the server was not started with the\n--log-bin option to enable binary logging.\n\nURL: https://mariadb.com/kb/en/sql-commands-purge-logs/\n\n','PURGE BINARY LOGS TO \'mysql-bin.010\';\nPURGE BINARY LOGS BEFORE \'2008-04-02 22:46:26\';\n','https://mariadb.com/kb/en/sql-commands-purge-logs/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (270,16,'STDDEV_SAMP','Syntax:\nSTDDEV_SAMP(expr)\n\nReturns the sample standard deviation of expr (the square root of\nVAR_SAMP().\n\nSTDDEV_SAMP() returns NULL if there were no matching rows.\n\nURL: https://mariadb.com/kb/en/stddev_samp/\n\n','','https://mariadb.com/kb/en/stddev_samp/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (271,17,'SCHEMA','Syntax:\nSCHEMA()\n\nThis function is a synonym for DATABASE().\n\nURL: https://mariadb.com/kb/en/schema/\n\n','','https://mariadb.com/kb/en/schema/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (272,32,'MLINEFROMWKB','MLineFromWKB(wkb[,srid]), MultiLineStringFromWKB(wkb[,srid])\n\nConstructs a MULTILINESTRING value using its WKB representation and\nSRID.\n\nURL: https://mariadb.com/kb/en/mlinefromwkb/\n\n','','https://mariadb.com/kb/en/mlinefromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (273,4,'LOG2','Syntax:\nLOG2(X)\n\nReturns the base-2 logarithm of X.\n\nURL: https://mariadb.com/kb/en/log2/\n\n','MariaDB> SELECT LOG2(65536);\n -> 16\nMariaDB> SELECT LOG2(-100);\n -> NULL\n','https://mariadb.com/kb/en/log2/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (274,31,'SUBTIME','Syntax:\nSUBTIME(expr1,expr2)\n\nSUBTIME() returns expr1 - expr2 expressed as a value in the same format\nas expr1. expr1 is a time or datetime expression, and expr2 is a time\nexpression.\n\nURL: https://mariadb.com/kb/en/subtime/\n\n','MariaDB> SELECT SUBTIME(\'2007-12-31 23:59:59.999999\',\'1 1:1:1.000002\');\n -> \'2007-12-30 22:58:58.999997\'\nMariaDB> SELECT SUBTIME(\'01:00:00.999999\', \'02:00:00.999998\');\n -> \'-00:59:59.999999\'\n','https://mariadb.com/kb/en/subtime/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (275,12,'UNCOMPRESSED_LENGTH','Syntax:\nUNCOMPRESSED_LENGTH(compressed_string)\n\nReturns the length that the compressed string had before being\ncompressed.\n\nURL: https://mariadb.com/kb/en/uncompressed_length/\n\n','MariaDB> SELECT UNCOMPRESSED_LENGTH(COMPRESS(REPEAT(\'a\',30)));\n -> 30\n','https://mariadb.com/kb/en/uncompressed_length/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (276,39,'DROP TABLE','Syntax:\nDROP [TEMPORARY] TABLE [IF EXISTS]\n tbl_name [, tbl_name] ...\n [RESTRICT | CASCADE]\n\nDROP TABLE removes one or more tables. You must have the DROP privilege\nfor each table. All table data and the table definition are removed, so\nbe careful with this statement! If any of the tables named in the\nargument list do not exist, MySQL returns an error indicating by name\nwhich nonexisting tables it was unable to drop, but it also drops all\nof the tables in the list that do exist.\n\n*Important*: When a table is dropped, user privileges on the table are\nnot automatically dropped. See [HELP GRANT].\n\nNote that for a partitioned table, DROP TABLE permanently removes the\ntable definition, all of its partitions, and all of the data which was\nstored in those partitions. It also removes the partitioning definition\n(.par) file associated with the dropped table.\n\nUse IF EXISTS to prevent an error from occurring for tables that do not\nexist. A NOTE is generated for each nonexistent table when using IF\nEXISTS. See [HELP SHOW WARNINGS].\n\nRESTRICT and CASCADE are permitted to make porting easier. In MySQL\n5.5, they do nothing.\n\n*Note*: DROP TABLE automatically commits the current active\ntransaction, unless you use the TEMPORARY keyword.\n\nURL: https://mariadb.com/kb/en/drop-table/\n\n','','https://mariadb.com/kb/en/drop-table/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (277,4,'POW','Syntax:\nPOW(X,Y)\n\nReturns the value of X raised to the power of Y.\n\nURL: https://mariadb.com/kb/en/pow/\n\n','MariaDB> SELECT POW(2,2);\n -> 4\nMariaDB> SELECT POW(2,-2);\n -> 0.25\n','https://mariadb.com/kb/en/pow/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (278,26,'SHOW CREATE TABLE','Syntax:\nSHOW CREATE TABLE tbl_name\n\nShows the CREATE TABLE statement that creates the given table. To use\nthis statement, you must have some privilege for the table. This\nstatement also works with views.\nSHOW CREATE TABLE quotes table and column names according to the value\nof the sql_quote_show_create option. See\nhttps://mariadb.com/kb/en/server-system-variables/.\n\nURL: https://mariadb.com/kb/en/show-create-table/\n\n','MariaDB> SHOW CREATE TABLE t\\G\n*************************** 1. row ***************************\n Table: t\nCreate Table: CREATE TABLE t (\n id INT(11) default NULL auto_increment,\n s char(60) default NULL,\n PRIMARY KEY (id)\n) ENGINE=MyISAM\n','https://mariadb.com/kb/en/show-create-table/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (279,27,'DUAL','You are permitted to specify DUAL as a dummy table name in situations\nwhere no tables are referenced:\n\nMariaDB> SELECT 1 + 1 FROM DUAL;\n -> 2\n\nDUAL is purely for the convenience of people who require that all\nSELECT statements should have FROM and possibly other clauses. MySQL\nmay ignore the clauses. MySQL does not require FROM DUAL if no tables\nare referenced.\n\nURL: https://mariadb.com/kb/en/dual/\n\n','','https://mariadb.com/kb/en/dual/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (280,37,'INSTR','Syntax:\nINSTR(str,substr)\n\nReturns the position of the first occurrence of substring substr in\nstring str. This is the same as the two-argument form of LOCATE(),\nexcept that the order of the arguments is reversed.\n\nURL: https://mariadb.com/kb/en/instr/\n\n','MariaDB> SELECT INSTR(\'foobarbar\', \'bar\');\n -> 4\nMariaDB> SELECT INSTR(\'xbar\', \'foobar\');\n -> 0\n','https://mariadb.com/kb/en/instr/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (281,31,'NOW','Syntax:\nNOW()\n\nReturns the current date and time as a value in \'YYYY-MM-DD HH:MM:SS\'\nor YYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is\nused in a string or numeric context. The value is expressed in the\ncurrent time zone.\n\nURL: https://mariadb.com/kb/en/now/\n\n','MariaDB> SELECT NOW();\n -> \'2007-12-15 23:50:26\'\nMariaDB> SELECT NOW() + 0;\n -> 20071215235026.000000\n','https://mariadb.com/kb/en/now/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (282,26,'SHOW ENGINES','Syntax:\nSHOW [STORAGE] ENGINES\n\nSHOW ENGINES displays status information about the server\'s storage\nengines. This is particularly useful for checking whether a storage\nengine is supported, or to see what the default engine is.\n\nURL: https://mariadb.com/kb/en/show-engines/\n\n','','https://mariadb.com/kb/en/show-engines/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (283,18,'>=','Syntax:\n>=\n\nGreater than or equal:\n\nURL: https://mariadb.com/kb/en/greater-than-or-equal/\n\n','MariaDB> SELECT 2 >= 2;\n -> 1\n','https://mariadb.com/kb/en/greater-than-or-equal/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (284,4,'EXP','Syntax:\nEXP(X)\n\nReturns the value of e (the base of natural logarithms) raised to the\npower of X. The inverse of this function is LOG() (using a single\nargument only) or LN().\n\nURL: https://mariadb.com/kb/en/exp/\n\n','MariaDB> SELECT EXP(2);\n -> 7.3890560989307\nMariaDB> SELECT EXP(-2);\n -> 0.13533528323661\nMariaDB> SELECT EXP(0);\n -> 1\n','https://mariadb.com/kb/en/exp/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (285,22,'LONGBLOB','LONGBLOB\n\nA BLOB column with a maximum length of 4,294,967,295 or 4GB (232 - 1)\nbytes. The effective maximum length of LONGBLOB columns depends on the\nconfigured maximum packet size in the client/server protocol and\navailable memory. Each LONGBLOB value is stored using a 4-byte length\nprefix that indicates the number of bytes in the value.\n\nURL: https://mariadb.com/kb/en/longblob/\n\n','','https://mariadb.com/kb/en/longblob/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (286,13,'POINTN','PointN(ls,N)\n\nReturns the N-th Point in the Linestring value ls. Points are numbered\nbeginning with 1.\n\nURL: https://mariadb.com/kb/en/pointn/\n\n','MariaDB> SET @ls = \'LineString(1 1,2 2,3 3)\';\nMariaDB> SELECT AsText(PointN(GeomFromText(@ls),2));\n+-------------------------------------+\n| AsText(PointN(GeomFromText(@ls),2)) |\n+-------------------------------------+\n| POINT(2 2) |\n+-------------------------------------+\n','https://mariadb.com/kb/en/pointn/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (287,22,'YEAR DATA TYPE','YEAR[(2|4)]\n\nA year in two-digit or four-digit format. The default is four-digit\nformat. YEAR(2) or YEAR(4) differ in display format, but have the same\nrange of values. In four-digit format, values display as 1901 to 2155,\nand 0000. In two-digit format, values display as 70 to 69, representing\nyears from 1970 to 2069. MySQL displays YEAR values in YYYY or\nYYformat, but permits assignment of values to YEAR columns using either\nstrings or numbers.\n\n*Note*: The YEAR(2) data type has certain issues that you should\nconsider before choosing to use it. As of MySQL 5.5.27, YEAR(2) is\ndeprecated. For more information, see\nhttp://dev.mysql.com/doc/refman/5.5/en/migrating-to-year4.html.\n\nFor additional information about YEAR display format and inerpretation\nof input values, see https://mariadb.com/kb/en/year-data-type/.\n\nURL: https://mariadb.com/kb/en/year-data-type/\n\n','','https://mariadb.com/kb/en/year-data-type/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (288,16,'SUM','Syntax:\nSUM([DISTINCT] expr)\n\nReturns the sum of expr. If the return set has no rows, SUM() returns\nNULL. The DISTINCT keyword can be used to sum only the distinct values\nof expr.\n\nSUM() returns NULL if there were no matching rows.\n\nURL: https://mariadb.com/kb/en/sum/\n\n','','https://mariadb.com/kb/en/sum/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (289,37,'OCT','Syntax:\nOCT(N)\n\nReturns a string representation of the octal value of N, where N is a\nlonglong (BIGINT) number. This is equivalent to CONV(N,10,8). Returns\nNULL if N is NULL.\n\nURL: https://mariadb.com/kb/en/oct/\n\n','MariaDB> SELECT OCT(12);\n -> \'14\'\n','https://mariadb.com/kb/en/oct/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (290,31,'SYSDATE','Syntax:\nSYSDATE()\n\nReturns the current date and time as a value in \'YYYY-MM-DD HH:MM:SS\'\nor YYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is\nused in a string or numeric context.\n\nSYSDATE() returns the time at which it executes. This differs from the\nbehavior for NOW(), which returns a constant time that indicates the\ntime at which the statement began to execute. (Within a stored function\nor trigger, NOW() returns the time at which the function or triggering\nstatement began to execute.)\n\nMariaDB> SELECT NOW(), SLEEP(2), NOW();\n+---------------------+----------+---------------------+\n| NOW() | SLEEP(2) | NOW() |\n+---------------------+----------+---------------------+\n| 2006-04-12 13:47:36 | 0 | 2006-04-12 13:47:36 |\n+---------------------+----------+---------------------+\n\nMariaDB> SELECT SYSDATE(), SLEEP(2), SYSDATE();\n+---------------------+----------+---------------------+\n| SYSDATE() | SLEEP(2) | SYSDATE() |\n+---------------------+----------+---------------------+\n| 2006-04-12 13:47:44 | 0 | 2006-04-12 13:47:46 |\n+---------------------+----------+---------------------+\n\nIn addition, the SET TIMESTAMP statement affects the value returned by\nNOW() but not by SYSDATE(). This means that timestamp settings in the\nbinary log have no effect on invocations of SYSDATE().\n\nBecause SYSDATE() can return different values even within the same\nstatement, and is not affected by SET TIMESTAMP, it is nondeterministic\nand therefore unsafe for replication if statement-based binary logging\nis used. If that is a problem, you can use row-based logging.\n\nAlternatively, you can use the --sysdate-is-now option to cause\nSYSDATE() to be an alias for NOW(). This works if the option is used on\nboth the master and the slave.\n\nThe nondeterministic nature of SYSDATE() also means that indexes cannot\nbe used for evaluating expressions that refer to it.\n\nURL: https://mariadb.com/kb/en/sysdate/\n\n','','https://mariadb.com/kb/en/sysdate/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (291,5,'UNINSTALL PLUGIN','Syntax:\nUNINSTALL PLUGIN plugin_name\n\nThis statement removes an installed server plugin. It requires the\nDELETE privilege for the mysql.plugin table.\n\nplugin_name must be the name of some plugin that is listed in the\nmysql.plugin table. The server executes the plugin\'s deinitialization\nfunction and removes the row for the plugin from the mysql.plugin\ntable, so that subsequent server restarts will not load and initialize\nthe plugin. UNINSTALL PLUGIN does not remove the plugin\'s shared\nlibrary file.\n\nURL: https://mariadb.com/kb/en/uninstall-plugin/\n\n','','https://mariadb.com/kb/en/uninstall-plugin/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (292,32,'ASBINARY','AsBinary(g), AsWKB(g)\n\nConverts a value in internal geometry format to its WKB representation\nand returns the binary result.\n\nURL: https://mariadb.com/kb/en/asbinary/\n\n','SELECT AsBinary(g) FROM geom;\n','https://mariadb.com/kb/en/asbinary/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (293,37,'REPEAT FUNCTION','Syntax:\nREPEAT(str,count)\n\nReturns a string consisting of the string str repeated count times. If\ncount is less than 1, returns an empty string. Returns NULL if str or\ncount are NULL.\n\nURL: https://mariadb.com/kb/en/repeat-function/\n\n','MariaDB> SELECT REPEAT(\'MySQL\', 3);\n -> \'MySQLMySQLMySQL\'\n','https://mariadb.com/kb/en/repeat-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (294,26,'SHOW TABLES','Syntax:\nSHOW [FULL] TABLES [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW TABLES lists the non-TEMPORARY tables in a given database. You can\nalso get this list using the mysqlshow db_name command. The LIKE\nclause, if present, indicates which table names to match. The WHERE\nclause can be given to select rows using more general conditions, as\ndiscussed in https://mariadb.com/kb/en/extended-show/.\n\nThis statement also lists any views in the database. The FULL modifier\nis supported such that SHOW FULL TABLES displays a second output\ncolumn. Values for the second column are BASE TABLE for a table and\nVIEW for a view.\n\nIf you have no privileges for a base table or view, it does not show up\nin the output from SHOW TABLES or mysqlshow db_name.\n\nURL: https://mariadb.com/kb/en/show-tables/\n\n','','https://mariadb.com/kb/en/show-tables/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (295,31,'MAKEDATE','Syntax:\nMAKEDATE(year,dayofyear)\n\nReturns a date, given year and day-of-year values. dayofyear must be\ngreater than 0 or the result is NULL.\n\nURL: https://mariadb.com/kb/en/makedate/\n\n','MariaDB> SELECT MAKEDATE(2011,31), MAKEDATE(2011,32);\n -> \'2011-01-31\', \'2011-02-01\'\nMariaDB> SELECT MAKEDATE(2011,365), MAKEDATE(2014,365);\n -> \'2011-12-31\', \'2014-12-31\'\nMariaDB> SELECT MAKEDATE(2011,0);\n -> NULL\n','https://mariadb.com/kb/en/makedate/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (296,37,'BINARY OPERATOR','Syntax:\nBINARY\n\nThe BINARY operator casts the string following it to a binary string.\nThis is an easy way to force a column comparison to be done byte by\nbyte rather than character by character. This causes the comparison to\nbe case sensitive even if the column is not defined as BINARY or BLOB.\nBINARY also causes trailing spaces to be significant.\n\nURL: https://mariadb.com/kb/en/binary-operator/\n\n','MariaDB> SELECT \'a\' = \'A\';\n -> 1\nMariaDB> SELECT BINARY \'a\' = \'A\';\n -> 0\nMariaDB> SELECT \'a\' = \'a \';\n -> 1\nMariaDB> SELECT BINARY \'a\' = \'a \';\n -> 0\n','https://mariadb.com/kb/en/binary-operator/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (297,6,'MBROVERLAPS','MBROverlaps(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 overlap. The term spatially overlaps is\nused if two geometries intersect and their intersection results in a\ngeometry of the same dimension but not equal to either of the given\ngeometries.\n\nURL: https://mariadb.com/kb/en/mbroverlaps/\n\n','','https://mariadb.com/kb/en/mbroverlaps/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (298,37,'SOUNDEX','Syntax:\nSOUNDEX(str)\n\nReturns a soundex string from str. Two strings that sound almost the\nsame should have identical soundex strings. A standard soundex string\nis four characters long, but the SOUNDEX() function returns an\narbitrarily long string. You can use SUBSTRING() on the result to get a\nstandard soundex string. All nonalphabetic characters in str are\nignored. All international alphabetic characters outside the A-Z range\nare treated as vowels.\n\n*Important*: When using SOUNDEX(), you should be aware of the following\nlimitations:\n\no This function, as currently implemented, is intended to work well\n with strings that are in the English language only. Strings in other\n languages may not produce reliable results.\n\no This function is not guaranteed to provide consistent results with\n strings that use multi-byte character sets, including utf-8.\n\n We hope to remove these limitations in a future release. See Bug\n #22638 for more information.\n\nURL: https://mariadb.com/kb/en/soundex/\n\n','MariaDB> SELECT SOUNDEX(\'Hello\');\n -> \'H400\'\nMariaDB> SELECT SOUNDEX(\'Quadratically\');\n -> \'Q36324\'\n','https://mariadb.com/kb/en/soundex/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (299,6,'MBRTOUCHES','MBRTouches(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 touch. Two geometries spatially touch if\nthe interiors of the geometries do not intersect, but the boundary of\none of the geometries intersects either the boundary or the interior of\nthe other.\n\nURL: https://mariadb.com/kb/en/mbrtouches/\n\n','','https://mariadb.com/kb/en/mbrtouches/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (300,39,'DROP EVENT','Syntax:\nDROP EVENT [IF EXISTS] event_name\n\nThis statement drops the event named event_name. The event immediately\nceases being active, and is deleted completely from the server.\n\nIf the event does not exist, the error ERROR 1517 (HY000): Unknown\nevent \'event_name\' results. You can override this and cause the\nstatement to generate a warning for nonexistent events instead using IF\nEXISTS.\n\nThis statement requires the EVENT privilege for the schema to which the\nevent to be dropped belongs.\n\nURL: https://mariadb.com/kb/en/drop-event/\n\n','','https://mariadb.com/kb/en/drop-event/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (301,27,'INSERT SELECT','Syntax:\nINSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [(col_name,...)]\n SELECT ...\n [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]\n\nWith INSERT ... SELECT, you can quickly insert many rows into a table\nfrom one or many tables. For example:\n\nINSERT INTO tbl_temp2 (fld_id)\n SELECT tbl_temp1.fld_order_id\n FROM tbl_temp1 WHERE tbl_temp1.fld_order_id > 100;\n\nURL: https://mariadb.com/kb/en/insert-select/\n\n','','https://mariadb.com/kb/en/insert-select/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (302,39,'CREATE PROCEDURE','Syntax:\nCREATE\n [DEFINER = { user | CURRENT_USER }]\n PROCEDURE sp_name ([proc_parameter[,...]])\n [characteristic ...] routine_body\n\nCREATE\n [DEFINER = { user | CURRENT_USER }]\n FUNCTION sp_name ([func_parameter[,...]])\n RETURNS type\n [characteristic ...] routine_body\n\nproc_parameter:\n [ IN | OUT | INOUT ] param_name type\n\nfunc_parameter:\n param_name type\n\ntype:\n Any valid MySQL data type\n\ncharacteristic:\n COMMENT \'string\'\n | LANGUAGE SQL\n | [NOT] DETERMINISTIC\n | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }\n | SQL SECURITY { DEFINER | INVOKER }\n\nroutine_body:\n Valid SQL routine statement\n\nThese statements create stored routines. By default, a routine is\nassociated with the default database. To associate the routine\nexplicitly with a given database, specify the name as db_name.sp_name\nwhen you create it.\n\nThe CREATE FUNCTION statement is also used in MySQL to support UDFs\n(user-defined functions). See\nhttps://mariadb.com/kb/en/create-function-udf/. A UDF can\nbe regarded as an external stored function. Stored functions share\ntheir namespace with UDFs. See\nhttp://dev.mysql.com/doc/refman/5.5/en/function-resolution.html, for\nthe rules describing how the server interprets references to different\nkinds of functions.\n\nTo invoke a stored procedure, use the CALL statement (see [HELP CALL]).\nTo invoke a stored function, refer to it in an expression. The function\nreturns a value during expression evaluation.\n\nCREATE PROCEDURE and CREATE FUNCTION require the CREATE ROUTINE\nprivilege. They might also require the SUPER privilege, depending on\nthe DEFINER value, as described later in this section. If binary\nlogging is enabled, CREATE FUNCTION might require the SUPER privilege,\nas described in\nhttps://mariadb.com/kb/en/binary-logging-of-stored-routines/.\n\nBy default, MySQL automatically grants the ALTER ROUTINE and EXECUTE\nprivileges to the routine creator. This behavior can be changed by\ndisabling the automatic_sp_privileges system variable. See\nhttps://mariadb.com/kb/en/stored-routine-privileges/.\n\nThe DEFINER and SQL SECURITY clauses specify the security context to be\nused when checking access privileges at routine execution time, as\ndescribed later in this section.\n\nIf the routine name is the same as the name of a built-in SQL function,\na syntax error occurs unless you use a space between the name and the\nfollowing parenthesis when defining the routine or invoking it later.\nFor this reason, avoid using the names of existing SQL functions for\nyour own stored routines.\n\nThe IGNORE_SPACE SQL mode applies to built-in functions, not to stored\nroutines. It is always permissible to have spaces after a stored\nroutine name, regardless of whether IGNORE_SPACE is enabled.\n\nThe parameter list enclosed within parentheses must always be present.\nIf there are no parameters, an empty parameter list of () should be\nused. Parameter names are not case sensitive.\n\nEach parameter is an IN parameter by default. To specify otherwise for\na parameter, use the keyword OUT or INOUT before the parameter name.\n\n*Note*: Specifying a parameter as IN, OUT, or INOUT is valid only for a\nPROCEDURE. For a FUNCTION, parameters are always regarded as IN\nparameters.\n\nAn IN parameter passes a value into a procedure. The procedure might\nmodify the value, but the modification is not visible to the caller\nwhen the procedure returns. An OUT parameter passes a value from the\nprocedure back to the caller. Its initial value is NULL within the\nprocedure, and its value is visible to the caller when the procedure\nreturns. An INOUT parameter is initialized by the caller, can be\nmodified by the procedure, and any change made by the procedure is\nvisible to the caller when the procedure returns.\n\nFor each OUT or INOUT parameter, pass a user-defined variable in the\nCALL statement that invokes the procedure so that you can obtain its\nvalue when the procedure returns. If you are calling the procedure from\nwithin another stored procedure or function, you can also pass a\nroutine parameter or local routine variable as an IN or INOUT\nparameter.\n\nThe following example shows a simple stored procedure that uses an OUT\nparameter:\n\nMariaDB> delimiter //\n\nMariaDB> CREATE PROCEDURE simpleproc (OUT param1 INT)\n -> BEGIN\n -> SELECT COUNT(*) INTO param1 FROM t;\n -> END//\nQuery OK, 0 rows affected (0.00 sec)\n\nMariaDB> delimiter ;\n\nMariaDB> CALL simpleproc(@a);\nQuery OK, 0 rows affected (0.00 sec)\n\nMariaDB> SELECT @a;\n+------+\n| @a |\n+------+\n| 3 |\n+------+\n1 row in set (0.00 sec)\n\nThe example uses the mysql client delimiter command to change the\nstatement delimiter from ; to // while the procedure is being defined.\nThis enables the ; delimiter used in the procedure body to be passed\nthrough to the server rather than being interpreted by mysql itself.\nSee\nhttps://mariadb.com/kb/en/stored-procedure-overview/.\n\nThe RETURNS clause may be specified only for a FUNCTION, for which it\nis mandatory. It indicates the return type of the function, and the\nfunction body must contain a RETURN value statement. If the RETURN\nstatement returns a value of a different type, the value is coerced to\nthe proper type. For example, if a function specifies an ENUM or SET\nvalue in the RETURNS clause, but the RETURN statement returns an\ninteger, the value returned from the function is the string for the\ncorresponding ENUM member of set of SET members.\n\nThe following example function takes a parameter, performs an operation\nusing an SQL function, and returns the result. In this case, it is\nunnecessary to use delimiter because the function definition contains\nno internal ; statement delimiters:\n\nMariaDB> CREATE FUNCTION hello (s CHAR(20))\nMariaDB> RETURNS CHAR(50) DETERMINISTIC\n -> RETURN CONCAT(\'Hello, \',s,\'!\');\nQuery OK, 0 rows affected (0.00 sec)\n\nMariaDB> SELECT hello(\'world\');\n+----------------+\n| hello(\'world\') |\n+----------------+\n| Hello, world! |\n+----------------+\n1 row in set (0.00 sec)\n\nParameter types and function return types can be declared to use any\nvalid data type, except that the COLLATE attribute cannot be used prior\nto MySQL 5.5.3. As of 5.5.3, COLLATE can be used if preceded by the\nCHARACTER SET attribute.\n\nThe routine_body consists of a valid SQL routine statement. This can be\na simple statement such as SELECT or INSERT, or a compound statement\nwritten using BEGIN and END. Compound statements can contain\ndeclarations, loops, and other control structure statements. The syntax\nfor these statements is described in\nhttps://mariadb.com/kb/programmatic-and-compound-statements.\n\nMySQL permits routines to contain DDL statements, such as CREATE and\nDROP. MySQL also permits stored procedures (but not stored functions)\nto contain SQL transaction statements such as COMMIT. Stored functions\nmay not contain statements that perform explicit or implicit commit or\nrollback. Support for these statements is not required by the SQL\nstandard, which states that each DBMS vendor may decide whether to\npermit them.\n\nStatements that return a result set can be used within a stored\nprocedure but not within a stored function. This prohibition includes\nSELECT statements that do not have an INTO var_list clause and other\nstatements such as SHOW, EXPLAIN, and CHECK TABLE. For statements that\ncan be determined at function definition time to return a result set, a\nNot allowed to return a result set from a function error occurs\n(ER_SP_NO_RETSET). For statements that can be determined only at\nruntime to return a result set, a PROCEDURE %s can\'t return a result\nset in the given context error occurs (ER_SP_BADSELECT).\n\nUSE statements within stored routines are not permitted. When a routine\nis invoked, an implicit USE db_name is performed (and undone when the\nroutine terminates). The causes the routine to have the given default\ndatabase while it executes. References to objects in databases other\nthan the routine default database should be qualified with the\nappropriate database name.\n\nFor additional information about statements that are not permitted in\nstored routines, see\nhttps://mariadb.com/kb/en/stored-routine-privileges/\n.\n\nFor information about invoking stored procedures from within programs\nwritten in a language that has a MySQL interface, see [HELP CALL].\n\nMySQL stores the sql_mode system variable setting that is in effect at\nthe time a routine is created, and always executes the routine with\nthis setting in force, regardless of the server SQL mode in effect when\nthe routine is invoked.\n\nThe switch from the SQL mode of the invoker to that of the routine\noccurs after evaluation of arguments and assignment of the resulting\nvalues to routine parameters. If you define a routine in strict SQL\nmode but invoke it in nonstrict mode, assignment of arguments to\nroutine parameters does not take place in strict mode. If you require\nthat expressions passed to a routine be assigned in strict SQL mode,\nyou should invoke the routine with strict mode in effect.\n\nURL: https://mariadb.com/kb/en/create-procedure/\n\n','','https://mariadb.com/kb/en/create-procedure/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (303,22,'VARBINARY','VARBINARY(M)\n\nThe VARBINARY type is similar to the VARCHAR type, but stores binary\nbyte strings rather than nonbinary character strings. M represents the\nmaximum column length in bytes.\n\nURL: https://mariadb.com/kb/en/varbinary/\n\n','','https://mariadb.com/kb/en/varbinary/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (304,26,'LOAD INDEX','Syntax:\nLOAD INDEX INTO CACHE\n tbl_index_list [, tbl_index_list] ...\n\ntbl_index_list:\n tbl_name\n [PARTITION (partition_list | ALL)]\n [[INDEX|KEY] (index_name[, index_name] ...)]\n [IGNORE LEAVES]\n\npartition_list:\n partition_name[, partition_name][, ...]\n\nThe LOAD INDEX INTO CACHE statement preloads a table index into the key\ncache to which it has been assigned by an explicit CACHE INDEX\nstatement, or into the default key cache otherwise.\n\nLOAD INDEX INTO CACHE is used only for MyISAM tables. In MySQL 5.5, it\nis also supported for partitioned MyISAM tables; in addition, indexes\non partitioned tables can be preloaded for one, several, or all\npartitions.\n\nThe IGNORE LEAVES modifier causes only blocks for the nonleaf nodes of\nthe index to be preloaded.\n\nIGNORE LEAVES is also supported for partitioned MyISAM tables.\n\nURL: https://mariadb.com/kb/en/load-index/\n\n','','https://mariadb.com/kb/en/load-index/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (305,27,'UNION','Syntax:\nSELECT ...\nUNION [ALL | DISTINCT] SELECT ...\n[UNION [ALL | DISTINCT] SELECT ...]\n\nUNION is used to combine the result from multiple SELECT statements\ninto a single result set.\n\nThe column names from the first SELECT statement are used as the column\nnames for the results returned. Selected columns listed in\ncorresponding positions of each SELECT statement should have the same\ndata type. (For example, the first column selected by the first\nstatement should have the same type as the first column selected by the\nother statements.)\n\nURL: https://mariadb.com/kb/en/union/\n\n','','https://mariadb.com/kb/en/union/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (306,31,'TO_DAYS','Syntax:\nTO_DAYS(date)\n\nGiven a date date, returns a day number (the number of days since year\n0).\n\nURL: https://mariadb.com/kb/en/to_days/\n\n','MariaDB> SELECT TO_DAYS(950501);\n -> 728779\nMariaDB> SELECT TO_DAYS(\'2007-10-07\');\n -> 733321\n','https://mariadb.com/kb/en/to_days/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (307,37,'NOT REGEXP','Syntax:\nexpr NOT REGEXP pat, expr NOT RLIKE pat\n\nThis is the same as NOT (expr REGEXP pat).\n\nURL: https://mariadb.com/kb/en/not-regexp/\n\n','','https://mariadb.com/kb/en/not-regexp/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (308,26,'SHOW INDEX','Syntax:\nSHOW {INDEX | INDEXES | KEYS}\n {FROM | IN} tbl_name\n [{FROM | IN} db_name]\n [WHERE expr]\n\nSHOW INDEX returns table index information. The format resembles that\nof the SQLStatistics call in ODBC. This statement requires some\nprivilege for any column in the table.\nYou can use db_name.tbl_name as an alternative to the tbl_name FROM\ndb_name syntax. These two statements are equivalent:\n\nSHOW INDEX FROM mytable FROM mydb;\nSHOW INDEX FROM mydb.mytable;\n\nThe WHERE clause can be given to select rows using more general\nconditions, as discussed in\nhttps://mariadb.com/kb/en/extended-show/.\n\nYou can also list a table\'s indexes with the mysqlshow -k db_name\ntbl_name command.\n\nURL: https://mariadb.com/kb/en/show-index/\n\n','','https://mariadb.com/kb/en/show-index/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (309,26,'SHOW CREATE DATABASE','Syntax:\nSHOW CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name\n\nShows the CREATE DATABASE statement that creates the given database. If\nthe SHOW statement includes an IF NOT EXISTS clause, the output too\nincludes such a clause. SHOW CREATE SCHEMA is a synonym for SHOW CREATE\nDATABASE.\n\nURL: https://mariadb.com/kb/en/show-create-database/\n\n','MariaDB> SHOW CREATE DATABASE test\\G\n*************************** 1. row ***************************\n Database: test\nCreate Database: CREATE DATABASE `test`\n /*!40100 DEFAULT CHARACTER SET latin1 */\n\nMariaDB> SHOW CREATE SCHEMA test\\G\n*************************** 1. row ***************************\n Database: test\nCreate Database: CREATE DATABASE `test`\n /*!40100 DEFAULT CHARACTER SET latin1 */\n','https://mariadb.com/kb/en/show-create-database/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (310,23,'LEAVE','Syntax:\nLEAVE label\n\nThis statement is used to exit the flow control construct that has the\ngiven label. If the label is for the outermost stored program block,\nLEAVE exits the program.\n\nLEAVE can be used within BEGIN ... END or loop constructs (LOOP,\nREPEAT, WHILE).\n\nURL: https://mariadb.com/kb/en/leave/\n\n','','https://mariadb.com/kb/en/leave/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (311,18,'NOT IN','Syntax:\nexpr NOT IN (value,...)\n\nThis is the same as NOT (expr IN (value,...)).\n\nURL: https://mariadb.com/kb/en/not-in/\n\n','','https://mariadb.com/kb/en/not-in/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (312,15,'!','Syntax:\nNOT, !\n\nLogical NOT. Evaluates to 1 if the operand is 0, to 0 if the operand is\nnonzero, and NOT NULL returns NULL.\n\nURL: https://mariadb.com/kb/en/not/\n\n','MariaDB> SELECT NOT 10;\n -> 0\nMariaDB> SELECT NOT 0;\n -> 1\nMariaDB> SELECT NOT NULL;\n -> NULL\nMariaDB> SELECT ! (1+1);\n -> 0\nMariaDB> SELECT ! 1+1;\n -> 1\n','https://mariadb.com/kb/en/not/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (313,23,'DECLARE HANDLER','Syntax:\nDECLARE handler_action HANDLER\n FOR condition_value [, condition_value] ...\n statement\n\nhandler_action:\n CONTINUE\n | EXIT\n | UNDO\n\ncondition_value:\n mysql_error_code\n | SQLSTATE [VALUE] sqlstate_value\n | condition_name\n | SQLWARNING\n | NOT FOUND\n | SQLEXCEPTION\n\nThe DECLARE ... HANDLER statement specifies a handler that deals with\none or more conditions. If one of these conditions occurs, the\nspecified statement executes. statement can be a simple statement such\nas SET var_name = value, or a compound statement written using BEGIN\nand END (see [HELP BEGIN END]).\n\nHandler declarations must appear after variable or condition\ndeclarations.\n\nThe handler_action value indicates what action the handler takes after\nexecution of the handler statement:\n\no CONTINUE: Execution of the current program continues.\n\no EXIT: Execution terminates for the BEGIN ... END compound statement\n in which the handler is declared. This is true even if the condition\n occurs in an inner block.\n\no UNDO: Not supported.\n\nThe condition_value for DECLARE ... HANDLER indicates the specific\ncondition or class of conditions that activates the handler:\n\no A MySQL error code (a number) or an SQLSTATE value (a 5-character\n string literal). You should not use MySQL error code 0 or SQLSTATE\n values that begin with \'00\', because those indicate success rather\n than an error condition. For a list of MySQL error codes and SQLSTATE\n values, see\n https://mariadb.com/kb/en/mariadb-error-codes/.\n\no A condition name previously specified with DECLARE ... CONDITION. A\n condition name can be associated with a MySQL error code or SQLSTATE\n value. See [HELP DECLARE CONDITION].\n\no SQLWARNING is shorthand for the class of SQLSTATE values that begin\n with \'01\'.\n\no NOT FOUND is shorthand for the class of SQLSTATE values that begin\n with \'02\'. This is relevant within the context of cursors and is used\n to control what happens when a cursor reaches the end of a data set.\n If no more rows are available, a No Data condition occurs with\n SQLSTATE value \'02000\'. To detect this condition, you can set up a\n handler for it (or for a NOT FOUND condition). For an example, see\n https://mariadb.com/kb/en/cursor-overview/. This condition\n also occurs for SELECT ... INTO var_list statements that retrieve no\n rows.\n\no SQLEXCEPTION is shorthand for the class of SQLSTATE values that do\n not begin with \'00\', \'01\', or \'02\'.\n\nIf a condition occurs for which no handler has been declared, the\naction taken depends on the condition class:\n\no For SQLEXCEPTION conditions, the stored program terminates at the\n statement that raised the condition, as if there were an EXIT\n handler. If the program was called by another stored program, the\n calling program handles the condition using the handler selection\n rules applied to its own handlers.\n\no For SQLWARNING conditions, the program continues executing, as if\n there were a CONTINUE handler.\n\no For NOT FOUND conditions, if the condition was raised normally, the\n action is CONTINUE. If it was raised by SIGNAL or RESIGNAL, the\n action is EXIT.\n\nURL: https://mariadb.com/kb/en/declare-handler/\n\n','MariaDB> CREATE TABLE test.t (s1 INT, PRIMARY KEY (s1));\nQuery OK, 0 rows affected (0.00 sec)\n\nMariaDB> delimiter //\n\nMariaDB> CREATE PROCEDURE handlerdemo ()\n -> BEGIN\n -> DECLARE CONTINUE HANDLER FOR SQLSTATE \'23000\' SET @x2 = 1;\n -> SET @x = 1;\n -> INSERT INTO test.t VALUES (1);\n -> SET @x = 2;\n -> INSERT INTO test.t VALUES (1);\n -> SET @x = 3;\n -> END;\n -> //\nQuery OK, 0 rows affected (0.00 sec)\n\nMariaDB> CALL handlerdemo()//\nQuery OK, 0 rows affected (0.00 sec)\n\nMariaDB> SELECT @x//\n +------+\n | @x |\n +------+\n | 3 |\n +------+\n 1 row in set (0.00 sec)\n','https://mariadb.com/kb/en/declare-handler/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (314,22,'DOUBLE','DOUBLE[(M,D)] [UNSIGNED] [ZEROFILL]\n\nA normal-size (double-precision) floating-point number. Permissible\nvalues are -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and\n2.2250738585072014E-308 to 1.7976931348623157E+308. These are the\ntheoretical limits, based on the IEEE standard. The actual range might\nbe slightly smaller depending on your hardware or operating system.\n\nM is the total number of digits and D is the number of digits following\nthe decimal point. If M and D are omitted, values are stored to the\nlimits permitted by the hardware. A double-precision floating-point\nnumber is accurate to approximately 15 decimal places.\n\nUNSIGNED, if specified, disallows negative values.\n\nURL: https://mariadb.com/kb/en/double/\n\n','','https://mariadb.com/kb/en/double/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (315,22,'TIME','TIME\n\nA time. The range is \'-838:59:59\' to \'838:59:59\'. MySQL displays TIME\nvalues in \'HH:MM:SS\' format, but permits assignment of values to TIME\ncolumns using either strings or numbers.\n\nURL: https://mariadb.com/kb/en/time/\n\n','','https://mariadb.com/kb/en/time/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (316,15,'&&','Syntax:\nAND, &&\n\nLogical AND. Evaluates to 1 if all operands are nonzero and not NULL,\nto 0 if one or more operands are 0, otherwise NULL is returned.\n\nURL: https://mariadb.com/kb/en/and/\n\n','MariaDB> SELECT 1 && 1;\n -> 1\nMariaDB> SELECT 1 && 0;\n -> 0\nMariaDB> SELECT 1 && NULL;\n -> NULL\nMariaDB> SELECT 0 && NULL;\n -> 0\nMariaDB> SELECT NULL && 0;\n -> 0\n','https://mariadb.com/kb/en/and/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (317,11,'X','X(p)\n\nReturns the X-coordinate value for the Point object p as a\ndouble-precision number.\n\nURL: https://mariadb.com/kb/en/x/\n\n','MariaDB> SELECT X(POINT(56.7, 53.34));\n+-----------------------+\n| X(POINT(56.7, 53.34)) |\n+-----------------------+\n| 56.7 |\n+-----------------------+\n','https://mariadb.com/kb/en/x/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (318,17,'SYSTEM_USER','Syntax:\nSYSTEM_USER()\n\nSYSTEM_USER() is a synonym for USER().\n\nURL: https://mariadb.com/kb/en/system_user/\n\n','','https://mariadb.com/kb/en/system_user/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (319,17,'FOUND_ROWS','Syntax:\nFOUND_ROWS()\n\nA SELECT statement may include a LIMIT clause to restrict the number of\nrows the server returns to the client. In some cases, it is desirable\nto know how many rows the statement would have returned without the\nLIMIT, but without running the statement again. To obtain this row\ncount, include a SQL_CALC_FOUND_ROWS option in the SELECT statement,\nand then invoke FOUND_ROWS() afterward:\n\nURL: https://mariadb.com/kb/en/found_rows/\n\n','MariaDB> SELECT SQL_CALC_FOUND_ROWS * FROM tbl_name\n -> WHERE id > 100 LIMIT 10;\nMariaDB> SELECT FOUND_ROWS();\n','https://mariadb.com/kb/en/found_rows/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (320,30,'CROSSES','Crosses(g1,g2)\n\nReturns 1 if g1 spatially crosses g2. Returns NULL if g1 is a Polygon\nor a MultiPolygon, or if g2 is a Point or a MultiPoint. Otherwise,\nreturns 0.\n\nThe term spatially crosses denotes a spatial relation between two given\ngeometries that has the following properties:\n\no The two geometries intersect\n\no Their intersection results in a geometry that has a dimension that is\n one less than the maximum dimension of the two given geometries\n\no Their intersection is not equal to either of the two given geometries\n\nURL: https://mariadb.com/kb/en/crosses/\n\n','','https://mariadb.com/kb/en/crosses/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (321,39,'TRUNCATE TABLE','Syntax:\nTRUNCATE [TABLE] tbl_name\n\nTRUNCATE TABLE empties a table completely. It requires the DROP\nprivilege.\n\nLogically, TRUNCATE TABLE is similar to a DELETE statement that deletes\nall rows, or a sequence of DROP TABLE and CREATE TABLE statements. To\nachieve high performance, it bypasses the DML method of deleting data.\nThus, it cannot be rolled back, it does not cause ON DELETE triggers to\nfire, and it cannot be performed for InnoDB tables with parent-child\nforeign key relationships.\n\nAlthough TRUNCATE TABLE is similar to DELETE, it is classified as a DDL\nstatement rather than a DML statement. It differs from DELETE in the\nfollowing ways in MySQL 5.5:\n\no Truncate operations drop and re-create the table, which is much\n faster than deleting rows one by one, particularly for large tables.\n\no Truncate operations cause an implicit commit, and so cannot be rolled\n back.\n\no Truncation operations cannot be performed if the session holds an\n active table lock.\n\no TRUNCATE TABLE fails for an InnoDB table if there are any FOREIGN KEY\n constraints from other tables that reference the table. Foreign key\n constraints between columns of the same table are permitted.\n\no Truncation operations do not return a meaningful value for the number\n of deleted rows. The usual result is "0 rows affected," which should\n be interpreted as "no information."\n\no As long as the table format file tbl_name.frm is valid, the table can\n be re-created as an empty table with TRUNCATE TABLE, even if the data\n or index files have become corrupted.\n\no Any AUTO_INCREMENT value is reset to its start value. This is true\n even for MyISAM and InnoDB, which normally do not reuse sequence\n values.\n\no When used with partitioned tables, TRUNCATE TABLE preserves the\n partitioning; that is, the data and index files are dropped and\n re-created, while the partition definitions (.par) file is\n unaffected.\n\no The TRUNCATE TABLE statement does not invoke ON DELETE triggers.\n\nURL: https://mariadb.com/kb/en/truncate-table/\n\n','','https://mariadb.com/kb/en/truncate-table/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (322,16,'BIT_XOR','Syntax:\nBIT_XOR(expr)\n\nReturns the bitwise XOR of all bits in expr. The calculation is\nperformed with 64-bit (BIGINT) precision.\n\nURL: https://mariadb.com/kb/en/bit_xor/\n\n','','https://mariadb.com/kb/en/bit_xor/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (323,31,'CURRENT_DATE','Syntax:\nCURRENT_DATE, CURRENT_DATE()\n\nCURRENT_DATE and CURRENT_DATE() are synonyms for CURDATE().\n\nURL: https://mariadb.com/kb/en/current_date/\n\n','','https://mariadb.com/kb/en/current_date/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (324,8,'START SLAVE','Syntax:\nSTART SLAVE [thread_types]\n\nSTART SLAVE [SQL_THREAD] UNTIL\n MASTER_LOG_FILE = \'log_name\', MASTER_LOG_POS = log_pos\n\nSTART SLAVE [SQL_THREAD] UNTIL\n RELAY_LOG_FILE = \'log_name\', RELAY_LOG_POS = log_pos\n\nthread_types:\n [thread_type [, thread_type] ... ]\n\nthread_type: IO_THREAD | SQL_THREAD\n\nSTART SLAVE with no thread_type options starts both of the slave\nthreads. The I/O thread reads events from the master server and stores\nthem in the relay log. The SQL thread reads events from the relay log\nand executes them. START SLAVE requires the SUPER privilege.\n\nIf START SLAVE succeeds in starting the slave threads, it returns\nwithout any error. However, even in that case, it might be that the\nslave threads start and then later stop (for example, because they do\nnot manage to connect to the master or read its binary log, or some\nother problem). START SLAVE does not warn you about this. You must\ncheck the slave\'s error log for error messages generated by the slave\nthreads, or check that they are running satisfactorily with SHOW SLAVE\nSTATUS.\n\nURL: https://mariadb.com/kb/en/start-slave/\n\n','','https://mariadb.com/kb/en/start-slave/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (325,2,'AREA','Area(poly)\n\nReturns as a double-precision number the area of the Polygon value\npoly, as measured in its spatial reference system.\n\nURL: https://mariadb.com/kb/en/area/\n\n','MariaDB> SET @poly = \'Polygon((0 0,0 3,3 0,0 0),(1 1,1 2,2 1,1 1))\';\nMariaDB> SELECT Area(GeomFromText(@poly));\n+---------------------------+\n| Area(GeomFromText(@poly)) |\n+---------------------------+\n| 4 |\n+---------------------------+\n','https://mariadb.com/kb/en/area/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (326,26,'FLUSH','Syntax:\nFLUSH [NO_WRITE_TO_BINLOG | LOCAL]\n flush_option [, flush_option] ...\n\nThe FLUSH statement has several variant forms that clear or reload\nvarious internal caches, flush tables, or acquire locks. To execute\nFLUSH, you must have the RELOAD privilege. Specific flush options might\nrequire additional privileges, as described later.\n\nBy default, the server writes FLUSH statements to the binary log so\nthat they replicate to replication slaves. To suppress logging, use the\noptional NO_WRITE_TO_BINLOG keyword or its alias LOCAL.\n\n*Note*: FLUSH LOGS, FLUSH MASTER, FLUSH SLAVE, and FLUSH TABLES WITH\nREAD LOCK (with or without a table list) are not written to the binary\nlog in any case because they would cause problems if replicated to a\nslave.\n\nThe FLUSH statement causes an implicit commit. See\nhttp://dev.mysql.com/doc/refman/5.5/en/implicit-commit.html.\n\nThe RESET statement is similar to FLUSH. See [HELP RESET], for\ninformation about using the RESET statement with replication.\n\nURL: https://mariadb.com/kb/en/flush/\n\n','','https://mariadb.com/kb/en/flush/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (327,23,'BEGIN END','Syntax:\n[begin_label:] BEGIN\n [statement_list]\nEND [end_label]\n\nBEGIN ... END syntax is used for writing compound statements, which can\nappear within stored programs (stored procedures and functions,\ntriggers, and events). A compound statement can contain multiple\nstatements, enclosed by the BEGIN and END keywords. statement_list\nrepresents a list of one or more statements, each terminated by a\nsemicolon (;) statement delimiter. The statement_list itself is\noptional, so the empty compound statement (BEGIN END) is legal.\n\nBEGIN ... END blocks can be nested.\n\nUse of multiple statements requires that a client is able to send\nstatement strings containing the ; statement delimiter. In the mysql\ncommand-line client, this is handled with the delimiter command.\nChanging the ; end-of-statement delimiter (for example, to //) permit ;\nto be used in a program body. For an example, see\nhttps://mariadb.com/kb/en/stored-procedure-overview/.\n\nA BEGIN ... END block can be labeled. See [HELP labels].\n\nURL: https://mariadb.com/kb/en/begin-end/\n\n','','https://mariadb.com/kb/en/begin-end/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (328,26,'SHOW PROCEDURE STATUS','Syntax:\nSHOW PROCEDURE STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nThis statement is a MySQL extension. It returns characteristics of a\nstored procedure, such as the database, name, type, creator, creation\nand modification dates, and character set information. A similar\nstatement, SHOW FUNCTION STATUS, displays information about stored\nfunctions (see [HELP SHOW FUNCTION STATUS]).\n\nThe LIKE clause, if present, indicates which procedure or function\nnames to match. The WHERE clause can be given to select rows using more\ngeneral conditions, as discussed in\nhttps://mariadb.com/kb/en/extended-show/.\n\nURL: https://mariadb.com/kb/en/show-procedure-status/\n\n','MariaDB> SHOW PROCEDURE STATUS LIKE \'sp1\'\\G\n*************************** 1. row ***************************\n Db: test\n Name: sp1\n Type: PROCEDURE\n Definer: testuser@localhost\n Modified: 2004-08-03 15:29:37\n Created: 2004-08-03 15:29:37\n Security_type: DEFINER\n Comment:\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n','https://mariadb.com/kb/en/show-procedure-status/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (329,28,'DESCRIBE','Syntax:\n{DESCRIBE | DESC} tbl_name [col_name | wild]\n\nDESCRIBE provides information about the columns in a table. It is a\nshortcut for SHOW COLUMNS FROM. These statements also display\ninformation for views. (See [HELP SHOW COLUMNS].)\n\ncol_name can be a column name, or a string containing the SQL "%" and\n"_" wildcard characters to obtain output only for the columns with\nnames matching the string. There is no need to enclose the string\nwithin quotation marks unless it contains spaces or other special\ncharacters.\n\nMariaDB> DESCRIBE City;\n+------------+----------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+------------+----------+------+-----+---------+----------------+\n| Id | int(11) | NO | PRI | NULL | auto_increment |\n| Name | char(35) | NO | | | |\n| Country | char(3) | NO | UNI | | |\n| District | char(20) | YES | MUL | | |\n| Population | int(11) | NO | | 0 | |\n+------------+----------+------+-----+---------+----------------+\n5 rows in set (0.00 sec)\n\nThe description for SHOW COLUMNS provides more information about the\noutput columns (see [HELP SHOW COLUMNS]).\n\nURL: https://mariadb.com/kb/en/describe/\n\n','','https://mariadb.com/kb/en/describe/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (330,26,'SHOW WARNINGS','Syntax:\nSHOW WARNINGS [LIMIT [offset,] row_count]\nSHOW COUNT(*) WARNINGS\n\nSHOW WARNINGS shows information about the conditions (errors, warnings,\nand notes) that resulted from the last statement in the current session\nthat generated messages. It shows nothing if the last statement used a\ntable and generated no messages. (That is, a statement that uses a\ntable but generates no messages clears the message list.) Statements\nthat do not use tables and do not generate messages have no effect on\nthe message list.\n\nWarnings are generated for DML statements such as INSERT, UPDATE, and\nLOAD DATA INFILE as well as DDL statements such as CREATE TABLE and\nALTER TABLE.\n\nSHOW WARNINGS is also used following EXPLAIN EXTENDED, to display the\nextra information generated by EXPLAIN when the EXTENDED keyword is\nused. See https://mariadb.com/kb/en/explain#explain-extended.\n\nThe LIMIT clause has the same syntax as for the SELECT statement. See\nhttps://mariadb.com/kb/en/select/.\n\nA related statement, SHOW ERRORS, shows only the error conditions (it\nexcludes warnings and notes). See [HELP SHOW ERRORS].\n\nThe SHOW COUNT(*) WARNINGS statement displays the total number of\nerrors, warnings, and notes. You can also retrieve this number from the\nwarning_count system variable:\n\nSHOW COUNT(*) WARNINGS;\nSELECT @@warning_count;\n\nURL: https://mariadb.com/kb/en/show-warnings/\n\n','','https://mariadb.com/kb/en/show-warnings/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (331,10,'DROP USER','Syntax:\nDROP USER user [, user] ...\n\nThe DROP USER statement removes one or more MySQL accounts and their\nprivileges. It removes privilege rows for the account from all grant\ntables. To use this statement, you must have the global CREATE USER\nprivilege or the DELETE privilege for the mysql database. Each account\nname uses the format described in\nhttps://mariadb.com/kb/en/create-user#account-names. For example:\n\nDROP USER \'jeffrey\'@\'localhost\';\n\nIf you specify only the user name part of the account name, a host name\npart of \'%\' is used.\n\nURL: https://mariadb.com/kb/en/drop-user/\n\n','','https://mariadb.com/kb/en/drop-user/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (332,16,'STDDEV_POP','Syntax:\nSTDDEV_POP(expr)\n\nReturns the population standard deviation of expr (the square root of\nVAR_POP()). You can also use STD() or STDDEV(), which are equivalent\nbut not standard SQL.\n\nSTDDEV_POP() returns NULL if there were no matching rows.\n\nURL: https://mariadb.com/kb/en/stddev_pop/\n\n','','https://mariadb.com/kb/en/stddev_pop/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (333,26,'SHOW CHARACTER SET','Syntax:\nSHOW CHARACTER SET\n [LIKE \'pattern\' | WHERE expr]\n\nThe SHOW CHARACTER SET statement shows all available character sets.\nThe LIKE clause, if present, indicates which character set names to\nmatch. The WHERE clause can be given to select rows using more general\nconditions, as discussed in\nhttps://mariadb.com/kb/en/extended-show/. For example:\n\nMariaDB> SHOW CHARACTER SET LIKE \'latin%\';\n+---------+-----------------------------+-------------------+--------+\n| Charset | Description | Default collation | Maxlen |\n+---------+-----------------------------+-------------------+--------+\n| latin1 | cp1252 West European | latin1_swedish_ci | 1 |\n| latin2 | ISO 8859-2 Central European | latin2_general_ci | 1 |\n| latin5 | ISO 8859-9 Turkish | latin5_turkish_ci | 1 |\n| latin7 | ISO 8859-13 Baltic | latin7_general_ci | 1 |\n+---------+-----------------------------+-------------------+--------+\n\nURL: https://mariadb.com/kb/en/show-character-set/\n\n','','https://mariadb.com/kb/en/show-character-set/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (334,37,'SUBSTRING','Syntax:\nSUBSTRING(str,pos), SUBSTRING(str FROM pos), SUBSTRING(str,pos,len),\nSUBSTRING(str FROM pos FOR len)\n\nThe forms without a len argument return a substring from string str\nstarting at position pos. The forms with a len argument return a\nsubstring len characters long from string str, starting at position\npos. The forms that use FROM are standard SQL syntax. It is also\npossible to use a negative value for pos. In this case, the beginning\nof the substring is pos characters from the end of the string, rather\nthan the beginning. A negative value may be used for pos in any of the\nforms of this function.\n\nFor all forms of SUBSTRING(), the position of the first character in\nthe string from which the substring is to be extracted is reckoned as\n1.\n\nURL: https://mariadb.com/kb/en/substring/\n\n','MariaDB> SELECT SUBSTRING(\'Quadratically\',5);\n -> \'ratically\'\nMariaDB> SELECT SUBSTRING(\'foobarbar\' FROM 4);\n -> \'barbar\'\nMariaDB> SELECT SUBSTRING(\'Quadratically\',5,6);\n -> \'ratica\'\nMariaDB> SELECT SUBSTRING(\'Sakila\', -3);\n -> \'ila\'\nMariaDB> SELECT SUBSTRING(\'Sakila\', -5, 3);\n -> \'aki\'\nMariaDB> SELECT SUBSTRING(\'Sakila\' FROM -4 FOR 2);\n -> \'ki\'\n','https://mariadb.com/kb/en/substring/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (335,36,'ISEMPTY','IsEmpty(g)\n\nReturns 1 if the geometry value g is the empty geometry, 0 if it is not\nempty, and -1 if the argument is NULL. If the geometry is empty, it\nrepresents the empty point set.\n\nURL: https://mariadb.com/kb/en/isempty/\n\n','','https://mariadb.com/kb/en/isempty/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (336,26,'SHOW FUNCTION STATUS','Syntax:\nSHOW FUNCTION STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nThis statement is similar to SHOW PROCEDURE STATUS but for stored\nfunctions. See [HELP SHOW PROCEDURE STATUS].\n\nURL: https://mariadb.com/kb/en/show-function-status/\n\n','','https://mariadb.com/kb/en/show-function-status/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (337,37,'LTRIM','Syntax:\nLTRIM(str)\n\nReturns the string str with leading space characters removed.\n\nURL: https://mariadb.com/kb/en/ltrim/\n\n','MariaDB> SELECT LTRIM(\' barbar\');\n -> \'barbar\'\n','https://mariadb.com/kb/en/ltrim/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (338,30,'INTERSECTS','Intersects(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 spatially intersects g2.\n\nURL: https://mariadb.com/kb/en/intersects/\n\n','','https://mariadb.com/kb/en/intersects/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (339,27,'CALL','Syntax:\nCALL sp_name([parameter[,...]])\nCALL sp_name[()]\n\nThe CALL statement invokes a stored procedure that was defined\npreviously with CREATE PROCEDURE.\n\nStored procedures that take no arguments can be invoked without\nparentheses. That is, CALL p() and CALL p are equivalent.\n\nCALL can pass back values to its caller using parameters that are\ndeclared as OUT or INOUT parameters. When the procedure returns, a\nclient program can also obtain the number of rows affected for the\nfinal statement executed within the routine: At the SQL level, call the\nROW_COUNT() function; from the C API, call the mysql_affected_rows()\nfunction.\n\nURL: https://mariadb.com/kb/en/call/\n\n','','https://mariadb.com/kb/en/call/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (340,6,'MBRDISJOINT','MBRDisjoint(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 are disjoint (do not intersect).\n\nURL: https://mariadb.com/kb/en/mbrdisjoint/\n\n','','https://mariadb.com/kb/en/mbrdisjoint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (341,14,'VALUES','Syntax:\nVALUES(col_name)\n\nIn an INSERT ... ON DUPLICATE KEY UPDATE statement, you can use the\nVALUES(col_name) function in the UPDATE clause to refer to column\nvalues from the INSERT portion of the statement. In other words,\nVALUES(col_name) in the UPDATE clause refers to the value of col_name\nthat would be inserted, had no duplicate-key conflict occurred. This\nfunction is especially useful in multiple-row inserts. The VALUES()\nfunction is meaningful only in the ON DUPLICATE KEY UPDATE clause of\nINSERT statements and returns NULL otherwise. See\nhttps://mariadb.com/kb/en/insert-on-duplicate-key-update/.\n\nURL: https://mariadb.com/kb/en/values/\n\n','MariaDB> INSERT INTO table (a,b,c) VALUES (1,2,3),(4,5,6)\n -> ON DUPLICATE KEY UPDATE c=VALUES(a)+VALUES(b);\n','https://mariadb.com/kb/en/values/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (342,37,'SUBSTRING_INDEX','Syntax:\nSUBSTRING_INDEX(str,delim,count)\n\nReturns the substring from string str before count occurrences of the\ndelimiter delim. If count is positive, everything to the left of the\nfinal delimiter (counting from the left) is returned. If count is\nnegative, everything to the right of the final delimiter (counting from\nthe right) is returned. SUBSTRING_INDEX() performs a case-sensitive\nmatch when searching for delim.\n\nURL: https://mariadb.com/kb/en/substring_index/\n\n','MariaDB> SELECT SUBSTRING_INDEX(\'www.mariadb.org\', \'.\', 2);\n -> \'www.mariadb\'\nMariaDB> SELECT SUBSTRING_INDEX(\'www.mariadb.org\', \'.\', -2);\n -> \'mariadb.org\'\n','https://mariadb.com/kb/en/substring_index/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (343,12,'ENCODE','Syntax:\nENCODE(str,pass_str)\n\nEncrypt str using pass_str as the password. To decrypt the result, use\nDECODE().\n\nThe result is a binary string of the same length as str.\n\nThe strength of the encryption is based on how good the random\ngenerator is. It should suffice for short strings.\n\nURL: https://mariadb.com/kb/en/encode/\n\n','','https://mariadb.com/kb/en/encode/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (344,23,'LOOP','Syntax:\n[begin_label:] LOOP\n statement_list\nEND LOOP [end_label]\n\nLOOP implements a simple loop construct, enabling repeated execution of\nthe statement list, which consists of one or more statements, each\nterminated by a semicolon (;) statement delimiter. The statements\nwithin the loop are repeated until the loop is terminated. Usually,\nthis is accomplished with a LEAVE statement. Within a stored function,\nRETURN can also be used, which exits the function entirely.\n\nNeglecting to include a loop-termination statement results in an\ninfinite loop.\n\nA LOOP statement can be labeled. For the rules regarding label use, see\n[HELP labels].\n\nURL: https://mariadb.com/kb/en/loop/\n\n','CREATE PROCEDURE doiterate(p1 INT)\nBEGIN\n label1: LOOP\n SET p1 = p1 + 1;\n IF p1 < 10 THEN\n ITERATE label1;\n END IF;\n LEAVE label1;\n END LOOP label1;\n SET @x = p1;\nEND;\n','https://mariadb.com/kb/en/loop/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (345,4,'TRUNCATE','Syntax:\nTRUNCATE(X,D)\n\nReturns the number X, truncated to D decimal places. If D is 0, the\nresult has no decimal point or fractional part. D can be negative to\ncause D digits left of the decimal point of the value X to become zero.\n\nURL: https://mariadb.com/kb/en/truncate/\n\n','MariaDB> SELECT TRUNCATE(1.223,1);\n -> 1.2\nMariaDB> SELECT TRUNCATE(1.999,1);\n -> 1.9\nMariaDB> SELECT TRUNCATE(1.999,0);\n -> 1\nMariaDB> SELECT TRUNCATE(-1.999,1);\n -> -1.9\nMariaDB> SELECT TRUNCATE(122,-2);\n -> 100\nMariaDB> SELECT TRUNCATE(10.28*100,0);\n -> 1028\n','https://mariadb.com/kb/en/truncate/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (346,31,'TIMESTAMPADD','Syntax:\nTIMESTAMPADD(unit,interval,datetime_expr)\n\nAdds the integer expression interval to the date or datetime expression\ndatetime_expr. The unit for interval is given by the unit argument,\nwhich should be one of the following values: MICROSECOND\n(microseconds), SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or\nYEAR.\n\nIt is possible to use FRAC_SECOND in place of MICROSECOND, but\nFRAC_SECOND is deprecated. FRAC_SECOND was removed in MySQL 5.5.3.\n\nThe unit value may be specified using one of keywords as shown, or with\na prefix of SQL_TSI_. For example, DAY and SQL_TSI_DAY both are legal.\n\nURL: https://mariadb.com/kb/en/timestampadd/\n\n','MariaDB> SELECT TIMESTAMPADD(MINUTE,1,\'2003-01-02\');\n -> \'2003-01-02 00:01:00\'\nMariaDB> SELECT TIMESTAMPADD(WEEK,1,\'2003-01-02\');\n -> \'2003-01-09\'\n','https://mariadb.com/kb/en/timestampadd/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (347,26,'SHOW','SHOW has many forms that provide information about databases, tables,\ncolumns, or status information about the server. This section describes\nthose following:\n\nSHOW AUTHORS\nSHOW {BINARY | MASTER} LOGS\nSHOW BINLOG EVENTS [IN \'log_name\'] [FROM pos] [LIMIT [offset,] row_count]\nSHOW CHARACTER SET [like_or_where]\nSHOW COLLATION [like_or_where]\nSHOW [FULL] COLUMNS FROM tbl_name [FROM db_name] [like_or_where]\nSHOW CONTRIBUTORS\nSHOW CREATE DATABASE db_name\nSHOW CREATE EVENT event_name\nSHOW CREATE FUNCTION func_name\nSHOW CREATE PROCEDURE proc_name\nSHOW CREATE TABLE tbl_name\nSHOW CREATE TRIGGER trigger_name\nSHOW CREATE VIEW view_name\nSHOW DATABASES [like_or_where]\nSHOW ENGINE engine_name {STATUS | MUTEX}\nSHOW [STORAGE] ENGINES\nSHOW ERRORS [LIMIT [offset,] row_count]\nSHOW EVENTS\nSHOW FUNCTION CODE func_name\nSHOW FUNCTION STATUS [like_or_where]\nSHOW GRANTS FOR user\nSHOW INDEX FROM tbl_name [FROM db_name]\nSHOW MASTER STATUS\nSHOW OPEN TABLES [FROM db_name] [like_or_where]\nSHOW PLUGINS\nSHOW PROCEDURE CODE proc_name\nSHOW PROCEDURE STATUS [like_or_where]\nSHOW PRIVILEGES\nSHOW [FULL] PROCESSLIST\nSHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]\nSHOW PROFILES\nSHOW SLAVE HOSTS\nSHOW SLAVE STATUS\nSHOW [GLOBAL | SESSION] STATUS [like_or_where]\nSHOW TABLE STATUS [FROM db_name] [like_or_where]\nSHOW [FULL] TABLES [FROM db_name] [like_or_where]\nSHOW TRIGGERS [FROM db_name] [like_or_where]\nSHOW [GLOBAL | SESSION] VARIABLES [like_or_where]\nSHOW WARNINGS [LIMIT [offset,] row_count]\n\nlike_or_where:\n LIKE \'pattern\'\n | WHERE expr\n\nIf the syntax for a given SHOW statement includes a LIKE \'pattern\'\npart, \'pattern\' is a string that can contain the SQL "%" and "_"\nwildcard characters. The pattern is useful for restricting statement\noutput to matching values.\n\nSeveral SHOW statements also accept a WHERE clause that provides more\nflexibility in specifying which rows to display. See\nhttps://mariadb.com/kb/en/extended-show/.\n\nURL: https://mariadb.com/kb/en/show/\n\n','','https://mariadb.com/kb/en/show/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (348,18,'GREATEST','Syntax:\nGREATEST(value1,value2,...)\n\nWith two or more arguments, returns the largest (maximum-valued)\nargument. The arguments are compared using the same rules as for\nLEAST().\n\nURL: https://mariadb.com/kb/en/greatest/\n\n','MariaDB> SELECT GREATEST(2,0);\n -> 2\nMariaDB> SELECT GREATEST(34.0,3.0,5.0,767.0);\n -> 767.0\nMariaDB> SELECT GREATEST(\'B\',\'A\',\'C\');\n -> \'C\'\n','https://mariadb.com/kb/en/greatest/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (349,26,'SHOW VARIABLES','Syntax:\nSHOW [GLOBAL | SESSION] VARIABLES\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW VARIABLES shows the values of MySQL system variables. This\ninformation also can be obtained using the mysqladmin variables\ncommand. The LIKE clause, if present, indicates which variable names to\nmatch. The WHERE clause can be given to select rows using more general\nconditions, as discussed in\nhttps://mariadb.com/kb/en/extended-show/. This\nstatement does not require any privilege. It requires only the ability\nto connect to the server.\n\nWith the GLOBAL modifier, SHOW VARIABLES displays the values that are\nused for new connections to MySQL. As of MySQL 5.5.3, if a variable has\nno global value, no value is displayed. Before 5.5.3, the session value\nis displayed. With SESSION, SHOW VARIABLES displays the values that are\nin effect for the current connection. If no modifier is present, the\ndefault is SESSION. LOCAL is a synonym for SESSION.\nWith a LIKE clause, the statement displays only rows for those\nvariables with names that match the pattern. To obtain the row for a\nspecific variable, use a LIKE clause as shown:\n\nSHOW VARIABLES LIKE \'max_join_size\';\nSHOW SESSION VARIABLES LIKE \'max_join_size\';\n\nTo get a list of variables whose name match a pattern, use the "%"\nwildcard character in a LIKE clause:\n\nSHOW VARIABLES LIKE \'%size%\';\nSHOW GLOBAL VARIABLES LIKE \'%size%\';\n\nWildcard characters can be used in any position within the pattern to\nbe matched. Strictly speaking, because "_" is a wildcard that matches\nany single character, you should escape it as "\\_" to match it\nliterally. In practice, this is rarely necessary.\n\nURL: https://mariadb.com/kb/en/show-variables/\n\n','','https://mariadb.com/kb/en/show-variables/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (350,26,'BINLOG','Syntax:\nBINLOG \'str\'\n\nBINLOG is an internal-use statement. It is generated by the mysqlbinlog\nprogram as the printable representation of certain events in binary log\nfiles. (See https://mariadb.com/kb/en/mysqlbinlog/.)\nThe \'str\' value is a base 64-encoded string the that server decodes to\ndetermine the data change indicated by the corresponding event. This\nstatement requires the SUPER privilege.\n\nURL: https://mariadb.com/kb/en/binlog/\n\n','','https://mariadb.com/kb/en/binlog/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (351,16,'BIT_AND','Syntax:\nBIT_AND(expr)\n\nReturns the bitwise AND of all bits in expr. The calculation is\nperformed with 64-bit (BIGINT) precision.\n\nURL: https://mariadb.com/kb/en/bit_and/\n\n','','https://mariadb.com/kb/en/bit_and/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (352,31,'SECOND','Syntax:\nSECOND(time)\n\nReturns the second for time, in the range 0 to 59.\n\nURL: https://mariadb.com/kb/en/second/\n\n','MariaDB> SELECT SECOND(\'10:05:03\');\n -> 3\n','https://mariadb.com/kb/en/second/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (353,4,'ATAN2','Syntax:\nATAN(Y,X), ATAN2(Y,X)\n\nReturns the arc tangent of the two variables X and Y. It is similar to\ncalculating the arc tangent of Y / X, except that the signs of both\narguments are used to determine the quadrant of the result.\n\nURL: https://mariadb.com/kb/en/atan2/\n\n','MariaDB> SELECT ATAN(-2,2);\n -> -0.78539816339745\nMariaDB> SELECT ATAN2(PI(),0);\n -> 1.5707963267949\n','https://mariadb.com/kb/en/atan2/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (354,6,'MBRCONTAINS','MBRContains(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangle of g1\ncontains the Minimum Bounding Rectangle of g2. This tests the opposite\nrelationship as MBRWithin().\n\nURL: https://mariadb.com/kb/en/mbrcontains/\n\n','MariaDB> SET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nMariaDB> SET @g2 = GeomFromText(\'Point(1 1)\');\nMariaDB> SELECT MBRContains(@g1,@g2), MBRContains(@g2,@g1);\n----------------------+----------------------+\n| MBRContains(@g1,@g2) | MBRContains(@g2,@g1) |\n+----------------------+----------------------+\n| 1 | 0 |\n+----------------------+----------------------+\n','https://mariadb.com/kb/en/mbrcontains/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (355,31,'HOUR','Syntax:\nHOUR(time)\n\nReturns the hour for time. The range of the return value is 0 to 23 for\ntime-of-day values. However, the range of TIME values actually is much\nlarger, so HOUR can return values greater than 23.\n\nURL: https://mariadb.com/kb/en/hour/\n\n','MariaDB> SELECT HOUR(\'10:05:03\');\n -> 10\nMariaDB> SELECT HOUR(\'272:59:59\');\n -> 272\n','https://mariadb.com/kb/en/hour/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (356,27,'SELECT','Syntax:\nSELECT\n [ALL | DISTINCT | DISTINCTROW ]\n [HIGH_PRIORITY]\n [STRAIGHT_JOIN]\n [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]\n [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]\n select_expr [, select_expr ...]\n [FROM table_references\n [WHERE where_condition]\n [GROUP BY {col_name | expr | position}\n [ASC | DESC], ... [WITH ROLLUP]]\n [HAVING where_condition]\n [ORDER BY {col_name | expr | position}\n [ASC | DESC], ...]\n [LIMIT {[offset,] row_count | row_count OFFSET offset}]\n [PROCEDURE procedure_name(argument_list)]\n [INTO OUTFILE \'file_name\'\n [CHARACTER SET charset_name]\n export_options\n | INTO DUMPFILE \'file_name\'\n | INTO var_name [, var_name]]\n [FOR UPDATE | LOCK IN SHARE MODE]]\n\nSELECT is used to retrieve rows selected from one or more tables, and\ncan include UNION statements and subqueries. See [HELP UNION], and\nhttps://mariadb.com/kb/en/subqueries/.\n\nThe most commonly used clauses of SELECT statements are these:\n\no Each select_expr indicates a column that you want to retrieve. There\n must be at least one select_expr.\n\no table_references indicates the table or tables from which to retrieve\n rows. Its syntax is described in [HELP JOIN].\n\no The WHERE clause, if given, indicates the condition or conditions\n that rows must satisfy to be selected. where_condition is an\n expression that evaluates to true for each row to be selected. The\n statement selects all rows if there is no WHERE clause.\n\n In the WHERE expression, you can use any of the functions and\n operators that MySQL supports, except for aggregate (summary)\n functions. See\n https://mariadb.com/kb/en/select#select-expressions, and\n https://mariadb.com/kb/en/functions-and-operators/.\n\nSELECT can also be used to retrieve rows computed without reference to\nany table.\n\nURL: https://mariadb.com/kb/en/select/\n\n','','https://mariadb.com/kb/en/select/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (357,4,'COT','Syntax:\nCOT(X)\n\nReturns the cotangent of X.\n\nURL: https://mariadb.com/kb/en/cot/\n\n','MariaDB> SELECT COT(12);\n -> -1.5726734063977\nMariaDB> SELECT COT(0);\n -> NULL\n','https://mariadb.com/kb/en/cot/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (358,26,'SHOW CREATE EVENT','Syntax:\nSHOW CREATE EVENT event_name\n\nThis statement displays the CREATE EVENT statement needed to re-create\na given event. It requires the EVENT privilege for the database from\nwhich the event is to be shown. For example (using the same event\ne_daily defined and then altered in [HELP SHOW EVENTS]):\n\nURL: https://mariadb.com/kb/en/show-create-event/\n\n','MariaDB> SHOW CREATE EVENT test.e_daily\\G\n*************************** 1. row ***************************\n Event: e_daily\n sql_mode:\n time_zone: SYSTEM\n Create Event: CREATE EVENT `e_daily`\n ON SCHEDULE EVERY 1 DAY\n STARTS CURRENT_TIMESTAMP + INTERVAL 6 HOUR\n ON COMPLETION NOT PRESERVE\n ENABLE\n COMMENT \'Saves total number of sessions then\n clears the table each day\'\n DO BEGIN\n INSERT INTO site_activity.totals (time, total)\n SELECT CURRENT_TIMESTAMP, COUNT(*)\n FROM site_activity.sessions;\n DELETE FROM site_activity.sessions;\n END\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n','https://mariadb.com/kb/en/show-create-event/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (359,37,'LOAD_FILE','Syntax:\nLOAD_FILE(file_name)\n\nReads the file and returns the file contents as a string. To use this\nfunction, the file must be located on the server host, you must specify\nthe full path name to the file, and you must have the FILE privilege.\nThe file must be readable by all and its size less than\nmax_allowed_packet bytes. If the secure_file_priv system variable is\nset to a nonempty directory name, the file to be loaded must be located\nin that directory.\n\nIf the file does not exist or cannot be read because one of the\npreceding conditions is not satisfied, the function returns NULL.\n\nThe character_set_filesystem system variable controls interpretation of\nfile names that are given as literal strings.\n\nURL: https://mariadb.com/kb/en/load_file/\n\n','MariaDB> UPDATE t\n SET blob_col=LOAD_FILE(\'/tmp/picture\')\n WHERE id=1;\n','https://mariadb.com/kb/en/load_file/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (360,3,'POINTFROMTEXT','PointFromText(wkt[,srid])\n\nConstructs a POINT value using its WKT representation and SRID.\n\nURL: https://mariadb.com/kb/en/pointfromtext/\n\n','','https://mariadb.com/kb/en/pointfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (361,16,'GROUP_CONCAT','Syntax:\nGROUP_CONCAT(expr)\n\nThis function returns a string result with the concatenated non-NULL\nvalues from a group. It returns NULL if there are no non-NULL values.\nThe full syntax is as follows:\n\nGROUP_CONCAT([DISTINCT] expr [,expr ...]\n [ORDER BY {unsigned_integer | col_name | expr}\n [ASC | DESC] [,col_name ...]]\n [SEPARATOR str_val])\n\nURL: https://mariadb.com/kb/en/group_concat/\n\n','MariaDB> SELECT student_name,\n -> GROUP_CONCAT(test_score)\n -> FROM student\n -> GROUP BY student_name;\n','https://mariadb.com/kb/en/group_concat/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (362,31,'DATE_FORMAT','Syntax:\nDATE_FORMAT(date,format)\n\nFormats the date value according to the format string.\n\nURL: https://mariadb.com/kb/en/date_format/\n\n','MariaDB> SELECT DATE_FORMAT(\'2009-10-04 22:23:00\', \'%W %M %Y\');\n -> \'Sunday October 2009\'\nMariaDB> SELECT DATE_FORMAT(\'2007-10-04 22:23:00\', \'%H:%i:%s\');\n -> \'22:23:00\'\nMariaDB> SELECT DATE_FORMAT(\'1900-10-04 22:23:00\',\n -> \'%D %y %a %d %m %b %j\');\n -> \'4th 00 Thu 04 10 Oct 277\'\nMariaDB> SELECT DATE_FORMAT(\'1997-10-04 22:23:00\',\n -> \'%H %k %I %r %T %S %w\');\n -> \'22 22 10 10:23:00 PM 22:23:00 00 6\'\nMariaDB> SELECT DATE_FORMAT(\'1999-01-01\', \'%X %V\');\n -> \'1998 52\'\nMariaDB> SELECT DATE_FORMAT(\'2006-06-00\', \'%d\');\n -> \'00\'\n','https://mariadb.com/kb/en/date_format/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (363,17,'BENCHMARK','Syntax:\nBENCHMARK(count,expr)\n\nThe BENCHMARK() function executes the expression expr repeatedly count\ntimes. It may be used to time how quickly MySQL processes the\nexpression. The result value is always 0. The intended use is from\nwithin the mysql client, which reports query execution times:\n\nURL: https://mariadb.com/kb/en/benchmark/\n\n','MariaDB> SELECT BENCHMARK(1000000,ENCODE(\'hello\',\'goodbye\'));\n+----------------------------------------------+\n| BENCHMARK(1000000,ENCODE(\'hello\',\'goodbye\')) |\n+----------------------------------------------+\n| 0 |\n+----------------------------------------------+\n1 row in set (4.74 sec)\n','https://mariadb.com/kb/en/benchmark/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (364,31,'YEAR','Syntax:\nYEAR(date)\n\nReturns the year for date, in the range 1000 to 9999, or 0 for the\n"zero" date.\n\nURL: https://mariadb.com/kb/en/year/\n\n','MariaDB> SELECT YEAR(\'1987-01-01\');\n -> 1987\n','https://mariadb.com/kb/en/year/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (365,26,'SHOW ENGINE','Syntax:\nSHOW ENGINE engine_name {STATUS | MUTEX}\n\nSHOW ENGINE displays operational information about a storage engine.\nThe following statements currently are supported:\n\nSHOW ENGINE INNODB STATUS\nSHOW ENGINE INNODB MUTEX\nSHOW ENGINE PERFORMANCE_SCHEMA STATUS\n\nSHOW ENGINE INNODB STATUS displays extensive information from the\nstandard InnoDB Monitor about the state of the InnoDB storage engine.\nFor information about the standard monitor and other InnoDB Monitors\nthat provide information about InnoDB processing, see\nhttp://dev.mysql.com/doc/refman/5.5/en/innodb-monitors.html.\n\nSHOW ENGINE INNODB MUTEX displays InnoDB mutex statistics. The\nstatement displays the following fields:\n\no Type\n\n Always InnoDB.\n\no Name\n\n The source file where the mutex is implemented, and the line number\n in the file where the mutex is created. The line number may change\n depending on your version of MySQL.\n\no Status\n\n The mutex status. This field displays several values if UNIV_DEBUG\n was defined at MySQL compilation time (for example, in include/univ.i\n in the InnoDB part of the MySQL source tree). If UNIV_DEBUG was not\n defined, the statement displays only the os_waits value. In the\n latter case (without UNIV_DEBUG), the information on which the output\n is based is insufficient to distinguish regular mutexes and mutexes\n that protect rw-locks (which permit multiple readers or a single\n writer). Consequently, the output may appear to contain multiple rows\n for the same mutex.\n\n o count indicates how many times the mutex was requested.\n\n o spin_waits indicates how many times the spinlock had to run.\n\n o spin_rounds indicates the number of spinlock rounds. (spin_rounds\n divided by spin_waits provides the average round count.)\n\n o os_waits indicates the number of operating system waits. This\n occurs when the spinlock did not work (the mutex was not locked\n during the spinlock and it was necessary to yield to the operating\n system and wait).\n\n o os_yields indicates the number of times a the thread trying to lock\n a mutex gave up its timeslice and yielded to the operating system\n (on the presumption that permitting other threads to run will free\n the mutex so that it can be locked).\n\n o os_wait_times indicates the amount of time (in ms) spent in\n operating system waits, if the timed_mutexes system variable is 1\n (ON). If timed_mutexes is 0 (OFF), timing is disabled, so\n os_wait_times is 0. timed_mutexes is off by default.\n\nInformation from this statement can be used to diagnose system\nproblems. For example, large values of spin_waits and spin_rounds may\nindicate scalability problems.\n\nUse SHOW ENGINE PERFORMANCE_SCHEMA STATUS to inspect the internal\noperation of the Performance Schema code:\n\nMariaDB> SHOW ENGINE PERFORMANCE_SCHEMA STATUS\\G\n...\n*************************** 3. row ***************************\n Type: performance_schema\n Name: events_waits_history.row_size\nStatus: 76\n*************************** 4. row ***************************\n Type: performance_schema\n Name: events_waits_history.row_count\nStatus: 10000\n*************************** 5. row ***************************\n Type: performance_schema\n Name: events_waits_history.memory\nStatus: 760000\n...\n*************************** 57. row ***************************\n Type: performance_schema\n Name: performance_schema.memory\nStatus: 26459600\n...\n\nThe intent of this statement is to help the DBA to understand the\neffects that different options have on memory requirements.\n\nName values consist of two parts, which name an internal buffer and an\nattribute of the buffer, respectively:\n\no Internal buffers that are exposed as a table in the\n performance_schema database are named after the table. Examples:\n events_waits_history.row_size, mutex_instances.row_count.\n\no Internal buffers that are not exposed as a table are named within\n parentheses. Examples: (pfs_cond_class).row_size,\n (pfs_mutex_class).memory.\n\no Values that apply to the Performance Schema as a whole begin with\n performance_schema. Example: performance_schema.memory.\n\nAttributes have these meanings:\n\no row_size cannot be changed. It is the size of the internal record\n used by the implementation.\n\no row_count can be changed depending on the configuration options.\n\no For a table, tbl_name.memory is the product of row_size multiplied by\n row_count. For the Performance Schema as a whole,\n performance_schema.memory is the sum of all the memory used (the sum\n of all other memory values).\n\nIn some cases, there is a direct relationship between a configuration\nparameter and a SHOW ENGINE value. For example,\nevents_waits_history_long.row_count corresponds to\nperformance_schema_events_waits_history_long_size. In other cases, the\nrelationship is more complex. For example,\nevents_waits_history.row_count corresponds to\nperformance_schema_events_waits_history_size (the number of rows per\nthread) multiplied by performance_schema_max_thread_instances ( the\nnumber of threads).\n\nURL: https://mariadb.com/kb/en/show-engine/\n\n','','https://mariadb.com/kb/en/show-engine/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (366,14,'NAME_CONST','Syntax:\nNAME_CONST(name,value)\n\nReturns the given value. When used to produce a result set column,\nNAME_CONST() causes the column to have the given name. The arguments\nshould be constants.\n\nMariaDB> SELECT NAME_CONST(\'myname\', 14);\n+--------+\n| myname |\n+--------+\n| 14 |\n+--------+\n\nURL: https://mariadb.com/kb/en/name_const/\n\n','','https://mariadb.com/kb/en/name_const/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (367,14,'RELEASE_LOCK','Syntax:\nRELEASE_LOCK(str)\n\nReleases the lock named by the string str that was obtained with\nGET_LOCK(). Returns 1 if the lock was released, 0 if the lock was not\nestablished by this thread (in which case the lock is not released),\nand NULL if the named lock did not exist. The lock does not exist if it\nwas never obtained by a call to GET_LOCK() or if it has previously been\nreleased.\n\nThe DO statement is convenient to use with RELEASE_LOCK(). See [HELP\nDO].\n\nURL: https://mariadb.com/kb/en/release_lock/\n\n','','https://mariadb.com/kb/en/release_lock/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (368,18,'IS NULL','Syntax:\nIS NULL\n\nTests whether a value is NULL.\n\nURL: https://mariadb.com/kb/en/is-null/\n\n','MariaDB> SELECT 1 IS NULL, 0 IS NULL, NULL IS NULL;\n -> 0, 0, 1\n','https://mariadb.com/kb/en/is-null/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (369,31,'CONVERT_TZ','Syntax:\nCONVERT_TZ(dt,from_tz,to_tz)\n\nCONVERT_TZ() converts a datetime value dt from the time zone given by\nfrom_tz to the time zone given by to_tz and returns the resulting\nvalue. Time zones are specified as described in\nhttps://mariadb.com/kb/en/time-zones/. This\nfunction returns NULL if the arguments are invalid.\n\nURL: https://mariadb.com/kb/en/convert_tz/\n\n','MariaDB> SELECT CONVERT_TZ(\'2004-01-01 12:00:00\',\'GMT\',\'MET\');\n -> \'2004-01-01 13:00:00\'\nMariaDB> SELECT CONVERT_TZ(\'2004-01-01 12:00:00\',\'+00:00\',\'+10:00\');\n -> \'2004-01-01 22:00:00\'\n','https://mariadb.com/kb/en/convert_tz/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (370,31,'TIME_TO_SEC','Syntax:\nTIME_TO_SEC(time)\n\nReturns the time argument, converted to seconds.\n\nURL: https://mariadb.com/kb/en/time_to_sec/\n\n','MariaDB> SELECT TIME_TO_SEC(\'22:23:00\');\n -> 80580\nMariaDB> SELECT TIME_TO_SEC(\'00:39:38\');\n -> 2378\n','https://mariadb.com/kb/en/time_to_sec/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (371,31,'WEEKDAY','Syntax:\nWEEKDAY(date)\n\nReturns the weekday index for date (0 = Monday, 1 = Tuesday, ... 6 =\nSunday).\n\nURL: https://mariadb.com/kb/en/weekday/\n\n','MariaDB> SELECT WEEKDAY(\'2008-02-03 22:23:00\');\n -> 6\nMariaDB> SELECT WEEKDAY(\'2007-11-06\');\n -> 1\n','https://mariadb.com/kb/en/weekday/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (372,37,'EXPORT_SET','Syntax:\nEXPORT_SET(bits,on,off[,separator[,number_of_bits]])\n\nReturns a string such that for every bit set in the value bits, you get\nan on string and for every bit not set in the value, you get an off\nstring. Bits in bits are examined from right to left (from low-order to\nhigh-order bits). Strings are added to the result from left to right,\nseparated by the separator string (the default being the comma\ncharacter ","). The number of bits examined is given by number_of_bits,\nwhich has a default of 64 if not specified. number_of_bits is silently\nclipped to 64 if larger than 64. It is treated as an unsigned integer,\nso a value of -1 is effectively the same as 64.\n\nURL: https://mariadb.com/kb/en/export_set/\n\n','MariaDB> SELECT EXPORT_SET(5,\'Y\',\'N\',\',\',4);\n -> \'Y,N,Y,N\'\nMariaDB> SELECT EXPORT_SET(6,\'1\',\'0\',\',\',10);\n -> \'0,1,1,0,0,0,0,0,0,0\'\n','https://mariadb.com/kb/en/export_set/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (373,39,'ALTER SERVER','Syntax:\nALTER SERVER server_name\n OPTIONS (option [, option] ...)\n\nAlters the server information for server_name, adjusting any of the\noptions permitted in the CREATE SERVER statement. See [HELP CREATE\nSERVER]. The corresponding fields in the mysql.servers table are\nupdated accordingly. This statement requires the SUPER privilege.\n\nURL: https://mariadb.com/kb/en/alter-server/\n\n','ALTER SERVER s OPTIONS (USER \'sally\');\n','https://mariadb.com/kb/en/alter-server/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (374,23,'RESIGNAL','Syntax:\nRESIGNAL [condition_value]\n [SET signal_information_item\n [, signal_information_item] ...]\n\ncondition_value:\n SQLSTATE [VALUE] sqlstate_value\n | condition_name\n\nsignal_information_item:\n condition_information_item_name = simple_value_specification\n\ncondition_information_item_name:\n CLASS_ORIGIN\n | SUBCLASS_ORIGIN\n | MESSAGE_TEXT\n | MYSQL_ERRNO\n | CONSTRAINT_CATALOG\n | CONSTRAINT_SCHEMA\n | CONSTRAINT_NAME\n | CATALOG_NAME\n | SCHEMA_NAME\n | TABLE_NAME\n | COLUMN_NAME\n | CURSOR_NAME\n\ncondition_name, simple_value_specification:\n (see following discussion)\n\nRESIGNAL passes on the error condition information that is available\nduring execution of a condition handler within a compound statement\ninside a stored procedure or function, trigger, or event. RESIGNAL may\nchange some or all information before passing it on. RESIGNAL is\nrelated to SIGNAL, but instead of originating a condition as SIGNAL\ndoes, RESIGNAL relays existing condition information, possibly after\nmodifying it.\n\nRESIGNAL makes it possible to both handle an error and return the error\ninformation. Otherwise, by executing an SQL statement within the\nhandler, information that caused the handler\'s activation is destroyed.\nRESIGNAL also can make some procedures shorter if a given handler can\nhandle part of a situation, then pass the condition "up the line" to\nanother handler.\n\nNo special privileges are required to execute the RESIGNAL statement.\n\nFor condition_value and signal_information_item, the definitions and\nrules are the same for RESIGNAL as for SIGNAL (see [HELP SIGNAL]).\n\nThe RESIGNAL statement takes condition_value and SET clauses, both of\nwhich are optional. This leads to several possible uses:\n\no RESIGNAL alone:\n\nRESIGNAL;\n\no RESIGNAL with new signal information:\n\nRESIGNAL SET signal_information_item [, signal_information_item] ...;\n\no RESIGNAL with a condition value and possibly new signal information:\n\nRESIGNAL condition_value\n [SET signal_information_item [, signal_information_item] ...];\n\nURL: https://mariadb.com/kb/en/resignal/\n\n','','https://mariadb.com/kb/en/resignal/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (375,31,'TIME FUNCTION','Syntax:\nTIME(expr)\n\nExtracts the time part of the time or datetime expression expr and\nreturns it as a string.\n\nURL: https://mariadb.com/kb/en/time-function/\n\n','MariaDB> SELECT TIME(\'2003-12-31 01:02:03\');\n -> \'01:02:03\'\nMariaDB> SELECT TIME(\'2003-12-31 01:02:03.000123\');\n -> \'01:02:03.000123\'\n','https://mariadb.com/kb/en/time-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (376,31,'DATE_ADD','Syntax:\nDATE_ADD(date,INTERVAL expr unit), DATE_SUB(date,INTERVAL expr unit)\n\nThese functions perform date arithmetic. The date argument specifies\nthe starting date or datetime value. expr is an expression specifying\nthe interval value to be added or subtracted from the starting date.\nexpr is a string; it may start with a "-" for negative intervals. unit\nis a keyword indicating the units in which the expression should be\ninterpreted.\n\nURL: https://mariadb.com/kb/en/date_add/\n\n','MariaDB> SELECT \'2008-12-31 23:59:59\' + INTERVAL 1 SECOND;\n -> \'2009-01-01 00:00:00\'\nMariaDB> SELECT INTERVAL 1 DAY + \'2008-12-31\';\n -> \'2009-01-01\'\nMariaDB> SELECT \'2005-01-01\' - INTERVAL 1 SECOND;\n -> \'2004-12-31 23:59:59\'\nMariaDB> SELECT DATE_ADD(\'2000-12-31 23:59:59\',\n -> INTERVAL 1 SECOND);\n -> \'2001-01-01 00:00:00\'\nMariaDB> SELECT DATE_ADD(\'2010-12-31 23:59:59\',\n -> INTERVAL 1 DAY);\n -> \'2011-01-01 23:59:59\'\nMariaDB> SELECT DATE_ADD(\'2100-12-31 23:59:59\',\n -> INTERVAL \'1:1\' MINUTE_SECOND);\n -> \'2101-01-01 00:01:00\'\nMariaDB> SELECT DATE_SUB(\'2005-01-01 00:00:00\',\n -> INTERVAL \'1 1:1:1\' DAY_SECOND);\n -> \'2004-12-30 22:58:59\'\nMariaDB> SELECT DATE_ADD(\'1900-01-01 00:00:00\',\n -> INTERVAL \'-1 10\' DAY_HOUR);\n -> \'1899-12-30 14:00:00\'\nMariaDB> SELECT DATE_SUB(\'1998-01-02\', INTERVAL 31 DAY);\n -> \'1997-12-02\'\nMariaDB> SELECT DATE_ADD(\'1992-12-31 23:59:59.000002\',\n -> INTERVAL \'1.999999\' SECOND_MICROSECOND);\n -> \'1993-01-01 00:00:01.000001\'\n','https://mariadb.com/kb/en/date_add/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (377,37,'CAST','Syntax:\nCAST(expr AS type)\n\nThe CAST() function takes an expression of any type and produces a\nresult value of a specified type, similar to CONVERT(). See the\ndescription of CONVERT() for more information.\n\nURL: https://mariadb.com/kb/en/cast/\n\n','','https://mariadb.com/kb/en/cast/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (378,37,'SOUNDS LIKE','Syntax:\nexpr1 SOUNDS LIKE expr2\n\nThis is the same as SOUNDEX(expr1) = SOUNDEX(expr2).\n\nURL: https://mariadb.com/kb/en/sounds-like/\n\n','','https://mariadb.com/kb/en/sounds-like/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (379,31,'PERIOD_DIFF','Syntax:\nPERIOD_DIFF(P1,P2)\n\nReturns the number of months between periods P1 and P2. P1 and P2\nshould be in the format YYMM or YYYYMM. Note that the period arguments\nP1 and P2 are not date values.\n\nURL: https://mariadb.com/kb/en/period_diff/\n\n','MariaDB> SELECT PERIOD_DIFF(200802,200703);\n -> 11\n','https://mariadb.com/kb/en/period_diff/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (380,37,'LIKE','Syntax:\nexpr LIKE pat [ESCAPE \'escape_char\']\n\nPattern matching using SQL simple regular expression comparison.\nReturns 1 (TRUE) or 0 (FALSE). If either expr or pat is NULL, the\nresult is NULL.\n\nThe pattern need not be a literal string. For example, it can be\nspecified as a string expression or table column.\n\nURL: https://mariadb.com/kb/en/like/\n\n','MariaDB> SELECT \'David!\' LIKE \'David_\';\n -> 1\nMariaDB> SELECT \'David!\' LIKE \'%D%v%\';\n -> 1\n','https://mariadb.com/kb/en/like/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (381,24,'MULTIPOINT','MultiPoint(pt1,pt2,...)\n\nConstructs a MultiPoint value using Point or WKB Point arguments.\n\nURL: https://mariadb.com/kb/en/multipoint/\n\n','','https://mariadb.com/kb/en/multipoint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (382,19,'>>','Syntax:\n>>\n\nShifts a longlong (BIGINT) number to the right.\n\nURL: https://mariadb.com/kb/en/shift-right/\n\n','MariaDB> SELECT 4 >> 2;\n -> 1\n','https://mariadb.com/kb/en/shift-right/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (383,23,'FETCH','Syntax:\nFETCH [[NEXT] FROM] cursor_name INTO var_name [, var_name] ...\n\nThis statement fetches the next row for the SELECT statement associated\nwith the specified cursor (which must be open), and advances the cursor\npointer. If a row exists, the fetched columns are stored in the named\nvariables. The number of columns retrieved by the SELECT statement must\nmatch the number of output variables specified in the FETCH statement.\n\nIf no more rows are available, a No Data condition occurs with SQLSTATE\nvalue \'02000\'. To detect this condition, you can set up a handler for\nit (or for a NOT FOUND condition). For an example, see\nhttps://mariadb.com/kb/en/cursor-overview/.\n\nURL: https://mariadb.com/kb/en/fetch/\n\n','','https://mariadb.com/kb/en/fetch/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (384,16,'AVG','Syntax:\nAVG([DISTINCT] expr)\n\nReturns the average value of expr. The DISTINCT option can be used to\nreturn the average of the distinct values of expr.\n\nAVG() returns NULL if there were no matching rows.\n\nURL: https://mariadb.com/kb/en/avg/\n\n','MariaDB> SELECT student_name, AVG(test_score)\n -> FROM student\n -> GROUP BY student_name;\n','https://mariadb.com/kb/en/avg/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (385,29,'TRUE FALSE','The constants TRUE and FALSE evaluate to 1 and 0, respectively. The\nconstant names can be written in any lettercase.\n\nMariaDB> SELECT TRUE, true, FALSE, false;\n -> 1, 1, 0, 0\n\nURL: https://mariadb.com/kb/en/true-false/\n\n','','https://mariadb.com/kb/en/true-false/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (386,6,'MBRWITHIN','MBRWithin(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangle of g1\nis within the Minimum Bounding Rectangle of g2. This tests the opposite\nrelationship as MBRContains().\n\nURL: https://mariadb.com/kb/en/mbrwithin/\n\n','MariaDB> SET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nMariaDB> SET @g2 = GeomFromText(\'Polygon((0 0,0 5,5 5,5 0,0 0))\');\nMariaDB> SELECT MBRWithin(@g1,@g2), MBRWithin(@g2,@g1);\n+--------------------+--------------------+\n| MBRWithin(@g1,@g2) | MBRWithin(@g2,@g1) |\n+--------------------+--------------------+\n| 1 | 0 |\n+--------------------+--------------------+\n','https://mariadb.com/kb/en/mbrwithin/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (387,17,'SESSION_USER','Syntax:\nSESSION_USER()\n\nSESSION_USER() is a synonym for USER().\n\nURL: https://mariadb.com/kb/en/session_user/\n\n','','https://mariadb.com/kb/en/session_user/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (388,18,'IN','Syntax:\nexpr IN (value,...)\n\nReturns 1 if expr is equal to any of the values in the IN list, else\nreturns 0. If all values are constants, they are evaluated according to\nthe type of expr and sorted. The search for the item then is done using\na binary search. This means IN is very quick if the IN value list\nconsists entirely of constants. Otherwise, type conversion takes place\naccording to the rules described in\nhttps://mariadb.com/kb/en/type-conversion/, but\napplied to all the arguments.\n\nURL: https://mariadb.com/kb/en/in/\n\n','MariaDB> SELECT 2 IN (0,3,5,7);\n -> 0\nMariaDB> SELECT \'wefwf\' IN (\'wee\',\'wefwf\',\'weg\');\n -> 1\n','https://mariadb.com/kb/en/in/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (389,37,'QUOTE','Syntax:\nQUOTE(str)\n\nQuotes a string to produce a result that can be used as a properly\nescaped data value in an SQL statement. The string is returned enclosed\nby single quotation marks and with each instance of backslash ("\\"),\nsingle quote ("\'"), ASCII NUL, and Control+Z preceded by a backslash.\nIf the argument is NULL, the return value is the word "NULL" without\nenclosing single quotation marks.\n\nURL: https://mariadb.com/kb/en/quote/\n\n','MariaDB> SELECT QUOTE(\'Don\\\'t!\');\n -> \'Don\\\'t!\'\nMariaDB> SELECT QUOTE(NULL);\n -> NULL\n','https://mariadb.com/kb/en/quote/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (390,26,'HELP COMMAND','Syntax:\nMariaDB> help search_string\n\nIf you provide an argument to the help command, mysql uses it as a\nsearch string to access server-side help from the contents of the MySQL\nReference Manual. The proper operation of this command requires that\nthe help tables in the mysql database be initialized with help topic\ninformation .\n\nIf there is no match for the search string, the search fails:\n\nMariaDB> help me\n\nNothing found\nPlease try to run \'help contents\' for a list of all accessible topics\n\nUse help contents to see a list of the help categories:\n\nMariaDB> help contents\nYou asked for help about help category: "Contents"\nFor more information, type \'help <item>\', where <item> is one of the\nfollowing categories:\n Account Management\n Administration\n Data Definition\n Data Manipulation\n Data Types\n Functions\n Functions and Modifiers for Use with GROUP BY\n Geographic Features\n Language Structure\n Plugins\n Storage Engines\n Stored Routines\n Table Maintenance\n Transactions\n Triggers\n\nIf the search string matches multiple items, mysql shows a list of\nmatching topics:\n\nMariaDB> help logs\nMany help items for your request exist.\nTo make a more specific request, please type \'help <item>\',\nwhere <item> is one of the following topics:\n SHOW\n SHOW BINARY LOGS\n SHOW ENGINE\n SHOW LOGS\n\nUse a topic as the search string to see the help entry for that topic:\n\nMariaDB> help show binary logs\nName: \'SHOW BINARY LOGS\'\nDescription:\nSyntax:\nSHOW BINARY LOGS\nSHOW MASTER LOGS\n\nLists the binary log files on the server. This statement is used as\npart of the procedure described in [purge-binary-logs], that shows how\nto determine which logs can be purged.\n\nMariaDB> SHOW BINARY LOGS;\n+---------------+-----------+\n| Log_name | File_size |\n+---------------+-----------+\n| binlog.000015 | 724935 |\n| binlog.000016 | 733481 |\n+---------------+-----------+\n\nURL: https://mariadb.com/kb/en/help-command/\n\n','','https://mariadb.com/kb/en/help-command/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (391,31,'QUARTER','Syntax:\nQUARTER(date)\n\nReturns the quarter of the year for date, in the range 1 to 4.\n\nURL: https://mariadb.com/kb/en/quarter/\n\n','MariaDB> SELECT QUARTER(\'2008-04-01\');\n -> 2\n','https://mariadb.com/kb/en/quarter/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (392,37,'POSITION','Syntax:\nPOSITION(substr IN str)\n\nPOSITION(substr IN str) is a synonym for LOCATE(substr,str).\n\nURL: https://mariadb.com/kb/en/position/\n\n','','https://mariadb.com/kb/en/position/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (393,26,'SHOW CREATE FUNCTION','Syntax:\nSHOW CREATE FUNCTION func_name\n\nThis statement is similar to SHOW CREATE PROCEDURE but for stored\nfunctions. See [HELP SHOW CREATE PROCEDURE].\n\nURL: https://mariadb.com/kb/en/show-create-function/\n\n','','https://mariadb.com/kb/en/show-create-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (394,14,'IS_USED_LOCK','Syntax:\nIS_USED_LOCK(str)\n\nChecks whether the lock named str is in use (that is, locked). If so,\nit returns the connection identifier of the client that holds the lock.\nOtherwise, it returns NULL.\n\nURL: https://mariadb.com/kb/en/is_used_lock/\n\n','','https://mariadb.com/kb/en/is_used_lock/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (395,3,'POLYFROMTEXT','PolyFromText(wkt[,srid]), PolygonFromText(wkt[,srid])\n\nConstructs a POLYGON value using its WKT representation and SRID.\n\nURL: https://mariadb.com/kb/en/polyfromtext/\n\n','','https://mariadb.com/kb/en/polyfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (396,12,'DES_ENCRYPT','Syntax:\nDES_ENCRYPT(str[,{key_num|key_str}])\n\nEncrypts the string with the given key using the Triple-DES algorithm.\n\nThis function works only if MySQL has been configured with SSL support.\nSee https://mariadb.com/kb/en/ssl-connections/.\n\nThe encryption key to use is chosen based on the second argument to\nDES_ENCRYPT(), if one was given. With no argument, the first key from\nthe DES key file is used. With a key_num argument, the given key number\n(0 to 9) from the DES key file is used. With a key_str argument, the\ngiven key string is used to encrypt str.\n\nThe key file can be specified with the --des-key-file server option.\n\nThe return string is a binary string where the first character is\nCHAR(128 | key_num). If an error occurs, DES_ENCRYPT() returns NULL.\n\nThe 128 is added to make it easier to recognize an encrypted key. If\nyou use a string key, key_num is 127.\n\nThe string length for the result is given by this formula:\n\nnew_len = orig_len + (8 - (orig_len % 8)) + 1\n\nEach line in the DES key file has the following format:\n\nkey_num des_key_str\n\nEach key_num value must be a number in the range from 0 to 9. Lines in\nthe file may be in any order. des_key_str is the string that is used to\nencrypt the message. There should be at least one space between the\nnumber and the key. The first key is the default key that is used if\nyou do not specify any key argument to DES_ENCRYPT().\n\nYou can tell MySQL to read new key values from the key file with the\nFLUSH DES_KEY_FILE statement. This requires the RELOAD privilege.\n\nOne benefit of having a set of default keys is that it gives\napplications a way to check for the existence of encrypted column\nvalues, without giving the end user the right to decrypt those values.\n\nURL: https://mariadb.com/kb/en/des_encrypt/\n\n','MariaDB> SELECT customer_address FROM customer_table \n > WHERE crypted_credit_card = DES_ENCRYPT(\'credit_card_number\');\n','https://mariadb.com/kb/en/des_encrypt/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (397,4,'CEIL','Syntax:\nCEIL(X)\n\nCEIL() is a synonym for CEILING().\n\nURL: https://mariadb.com/kb/en/ceil/\n\n','','https://mariadb.com/kb/en/ceil/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (398,37,'LENGTH','Syntax:\nLENGTH(str)\n\nReturns the length of the string str, measured in bytes. A multi-byte\ncharacter counts as multiple bytes. This means that for a string\ncontaining five 2-byte characters, LENGTH() returns 10, whereas\nCHAR_LENGTH() returns 5.\n\nURL: https://mariadb.com/kb/en/length/\n\n','MariaDB> SELECT LENGTH(\'text\');\n -> 4\n','https://mariadb.com/kb/en/length/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (399,31,'STR_TO_DATE','Syntax:\nSTR_TO_DATE(str,format)\n\nThis is the inverse of the DATE_FORMAT() function. It takes a string\nstr and a format string format. STR_TO_DATE() returns a DATETIME value\nif the format string contains both date and time parts, or a DATE or\nTIME value if the string contains only date or time parts. If the date,\ntime, or datetime value extracted from str is illegal, STR_TO_DATE()\nreturns NULL and produces a warning.\n\nThe server scans str attempting to match format to it. The format\nstring can contain literal characters and format specifiers beginning\nwith %. Literal characters in format must match literally in str.\nFormat specifiers in format must match a date or time part in str. For\nthe specifiers that can be used in format, see the DATE_FORMAT()\nfunction description.\n\nMariaDB> SELECT STR_TO_DATE(\'01,5,2013\',\'%d,%m,%Y\');\n -> \'2013-05-01\'\nMariaDB> SELECT STR_TO_DATE(\'May 1, 2013\',\'%M %d,%Y\');\n -> \'2013-05-01\'\n\nScanning starts at the beginning of str and fails if format is found\nnot to match. Extra characters at the end of str are ignored.\n\nMariaDB> SELECT STR_TO_DATE(\'a09:30:17\',\'a%h:%i:%s\');\n -> \'09:30:17\'\nMariaDB> SELECT STR_TO_DATE(\'a09:30:17\',\'%h:%i:%s\');\n -> NULL\nMariaDB> SELECT STR_TO_DATE(\'09:30:17a\',\'%h:%i:%s\');\n -> \'09:30:17\'\n\nUnspecified date or time parts have a value of 0, so incompletely\nspecified values in str produce a result with some or all parts set to\n0:\n\nMariaDB> SELECT STR_TO_DATE(\'abc\',\'abc\');\n -> \'0000-00-00\'\nMariaDB> SELECT STR_TO_DATE(\'9\',\'%m\');\n -> \'0000-09-00\'\nMariaDB> SELECT STR_TO_DATE(\'9\',\'%s\');\n -> \'00:00:09\'\n\nURL: https://mariadb.com/kb/en/str_to_date/\n\n','','https://mariadb.com/kb/en/str_to_date/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (400,11,'Y','Y(p)\n\nReturns the Y-coordinate value for the Point object p as a\ndouble-precision number.\n\nURL: https://mariadb.com/kb/en/y/\n\n','MariaDB> SELECT Y(POINT(56.7, 53.34));\n+-----------------------+\n| Y(POINT(56.7, 53.34)) |\n+-----------------------+\n| 53.34 |\n+-----------------------+\n','https://mariadb.com/kb/en/y/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (401,20,'CHECKSUM TABLE','Syntax:\nCHECKSUM TABLE tbl_name [, tbl_name] ... [ QUICK | EXTENDED ]\n\nCHECKSUM TABLE reports a table checksum. This statement requires the\nSELECT privilege for the table.\n\nWith QUICK, the live table checksum is reported if it is available, or\nNULL otherwise. This is very fast. A live checksum is enabled by\nspecifying the CHECKSUM=1 table option when you create the table;\ncurrently, this is supported only for MyISAM tables. See [HELP CREATE\nTABLE].\n\nWith EXTENDED, the entire table is read row by row and the checksum is\ncalculated. This can be very slow for large tables.\n\nIf neither QUICK nor EXTENDED is specified, MySQL returns a live\nchecksum if the table storage engine supports it and scans the table\notherwise.\n\nFor a nonexistent table, CHECKSUM TABLE returns NULL and generates a\nwarning.\n\nIn MySQL 5.5, CHECKSUM TABLE returns 0 for partitioned tables unless\nyou include the EXTENDED option. This issue is resolved in MySQL 5.6.\n(Bug #11933226, Bug #60681)\n\nThe checksum value depends on the table row format. If the row format\nchanges, the checksum also changes. For example, the storage format for\nVARCHAR changed between MySQL 4.1 and 5.0, so if a 4.1 table is\nupgraded to MySQL 5.0, the checksum value may change.\n\nURL: https://mariadb.com/kb/en/checksum-table/\n\n','','https://mariadb.com/kb/en/checksum-table/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (402,2,'NUMINTERIORRINGS','NumInteriorRings(poly)\n\nReturns the number of interior rings in the Polygon value poly.\n\nURL: https://mariadb.com/kb/en/numinteriorrings/\n\n','MariaDB> SET @poly =\n -> \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))\';\nMariaDB> SELECT NumInteriorRings(GeomFromText(@poly));\n+---------------------------------------+\n| NumInteriorRings(GeomFromText(@poly)) |\n+---------------------------------------+\n| 1 |\n+---------------------------------------+\n','https://mariadb.com/kb/en/numinteriorrings/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (403,2,'INTERIORRINGN','InteriorRingN(poly,N)\n\nReturns the N-th interior ring for the Polygon value poly as a\nLineString. Rings are numbered beginning with 1.\n\nURL: https://mariadb.com/kb/en/interiorringn/\n\n','MariaDB> SET @poly =\n -> \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))\';\nMariaDB> SELECT AsText(InteriorRingN(GeomFromText(@poly),1));\n+----------------------------------------------+\n| AsText(InteriorRingN(GeomFromText(@poly),1)) |\n+----------------------------------------------+\n| LINESTRING(1 1,1 2,2 2,2 1,1 1) |\n+----------------------------------------------+\n','https://mariadb.com/kb/en/interiorringn/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (404,31,'UTC_TIME','Syntax:\nUTC_TIME, UTC_TIME()\n\nReturns the current UTC time as a value in \'HH:MM:SS\' or HHMMSS.uuuuuu\nformat, depending on whether the function is used in a string or\nnumeric context.\n\nURL: https://mariadb.com/kb/en/utc_time/\n\n','MariaDB> SELECT UTC_TIME(), UTC_TIME() + 0;\n -> \'18:07:53\', 180753.000000\n','https://mariadb.com/kb/en/utc_time/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (405,39,'DROP FUNCTION','The DROP FUNCTION statement is used to drop stored functions and\nuser-defined functions (UDFs):\n\no For information about dropping stored functions, see [HELP DROP\n PROCEDURE].\n\no For information about dropping user-defined functions, see [HELP DROP\n FUNCTION UDF].\n\nURL: https://mariadb.com/kb/en/drop-function/\n\n','','https://mariadb.com/kb/en/drop-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (406,39,'ALTER EVENT','Syntax:\nALTER\n [DEFINER = { user | CURRENT_USER }]\n EVENT event_name\n [ON SCHEDULE schedule]\n [ON COMPLETION [NOT] PRESERVE]\n [RENAME TO new_event_name]\n [ENABLE | DISABLE | DISABLE ON SLAVE]\n [COMMENT \'comment\']\n [DO event_body]\n\nThe ALTER EVENT statement changes one or more of the characteristics of\nan existing event without the need to drop and recreate it. The syntax\nfor each of the DEFINER, ON SCHEDULE, ON COMPLETION, COMMENT, ENABLE /\nDISABLE, and DO clauses is exactly the same as when used with CREATE\nEVENT. (See [HELP CREATE EVENT].)\n\nAny user can alter an event defined on a database for which that user\nhas the EVENT privilege. When a user executes a successful ALTER EVENT\nstatement, that user becomes the definer for the affected event.\n\nALTER EVENT works only with an existing event:\n\nMariaDB> ALTER EVENT no_such_event \n > ON SCHEDULE \n > EVERY \'2:3\' DAY_HOUR;\nERROR 1517 (HY000): Unknown event \'no_such_event\'\n\nURL: https://mariadb.com/kb/en/alter-event/\n\n','','https://mariadb.com/kb/en/alter-event/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (407,16,'STDDEV','Syntax:\nSTDDEV(expr)\n\nReturns the population standard deviation of expr. This function is\nprovided for compatibility with Oracle. The standard SQL function\nSTDDEV_POP() can be used instead.\n\nThis function returns NULL if there were no matching rows.\n\nURL: https://mariadb.com/kb/en/stddev/\n\n','','https://mariadb.com/kb/en/stddev/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (408,31,'DATE_SUB','Syntax:\nDATE_SUB(date,INTERVAL expr unit)\n\nSee the description for DATE_ADD().\n\nURL: https://mariadb.com/kb/en/date_sub/\n\n','','https://mariadb.com/kb/en/date_sub/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (409,31,'PERIOD_ADD','Syntax:\nPERIOD_ADD(P,N)\n\nAdds N months to period P (in the format YYMM or YYYYMM). Returns a\nvalue in the format YYYYMM. Note that the period argument P is not a\ndate value.\n\nURL: https://mariadb.com/kb/en/period_add/\n\n','MariaDB> SELECT PERIOD_ADD(200801,2);\n -> 200803\n','https://mariadb.com/kb/en/period_add/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (410,19,'|','Syntax:\n|\n\nBitwise OR:\n\nURL: https://mariadb.com/kb/en/bitwise-or/\n\n','MariaDB> SELECT 29 | 15;\n -> 31\n','https://mariadb.com/kb/en/bitwise-or/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (411,3,'GEOMFROMTEXT','GeomFromText(wkt[,srid]), GeometryFromText(wkt[,srid])\n\nConstructs a geometry value of any type using its WKT representation\nand SRID.\n\nURL: https://mariadb.com/kb/en/geomfromtext/\n\n','','https://mariadb.com/kb/en/geomfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (412,14,'UUID_SHORT','Syntax:\nUUID_SHORT()\n\nReturns a "short" universal identifier as a 64-bit unsigned integer\n(rather than a string-form 128-bit identifier as returned by the UUID()\nfunction).\n\nThe value of UUID_SHORT() is guaranteed to be unique if the following\nconditions hold:\n\no The server_id of the current host is unique among your set of master\n and slave servers\n\no server_id is between 0 and 255\n\no You do not set back your system time for your server between mysqld\n restarts\n\no You do not invoke UUID_SHORT() on average more than 16 million times\n per second between mysqld restarts\n\nThe UUID_SHORT() return value is constructed this way:\n\n (server_id & 255) << 56\n+ (server_startup_time_in_seconds << 24)\n+ incremented_variable++;\n\nURL: https://mariadb.com/kb/en/uuid_short/\n\n','MariaDB> SELECT UUID_SHORT();\n -> 92395783831158784\n','https://mariadb.com/kb/en/uuid_short/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (413,37,'RIGHT','Syntax:\nRIGHT(str,len)\n\nReturns the rightmost len characters from the string str, or NULL if\nany argument is NULL.\n\nURL: https://mariadb.com/kb/en/right/\n\n','MariaDB> SELECT RIGHT(\'foobarbar\', 4);\n -> \'rbar\'\n','https://mariadb.com/kb/en/right/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (414,31,'DATEDIFF','Syntax:\nDATEDIFF(expr1,expr2)\n\nDATEDIFF() returns expr1 - expr2 expressed as a value in days from one\ndate to the other. expr1 and expr2 are date or date-and-time\nexpressions. Only the date parts of the values are used in the\ncalculation.\n\nURL: https://mariadb.com/kb/en/datediff/\n\n','MariaDB> SELECT DATEDIFF(\'2007-12-31 23:59:59\',\'2007-12-30\');\n -> 1\nMariaDB> SELECT DATEDIFF(\'2010-11-30 23:59:59\',\'2010-12-31\');\n -> -31\n','https://mariadb.com/kb/en/datediff/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (415,39,'DROP TABLESPACE','Syntax:\nDROP TABLESPACE tablespace_name\n ENGINE [=] engine_name\n\nThis statement is used with NDB cluster, which is not supported by MariaDB.\n\nURL: https://mariadb.com/kb/en/drop-tablespace/\n\n','','https://mariadb.com/kb/en/drop-tablespace/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (416,39,'DROP PROCEDURE','Syntax:\nDROP {PROCEDURE | FUNCTION} [IF EXISTS] sp_name\n\nThis statement is used to drop a stored procedure or function. That is,\nthe specified routine is removed from the server. You must have the\nALTER ROUTINE privilege for the routine. (If the\nautomatic_sp_privileges system variable is enabled, that privilege and\nEXECUTE are granted automatically to the routine creator when the\nroutine is created and dropped from the creator when the routine is\ndropped. See\nhttps://mariadb.com/kb/en/stored-routine-privileges/.\n)\n\nThe IF EXISTS clause is a MySQL extension. It prevents an error from\noccurring if the procedure or function does not exist. A warning is\nproduced that can be viewed with SHOW WARNINGS.\n\nURL: https://mariadb.com/kb/en/drop-procedure/\n\n','','https://mariadb.com/kb/en/drop-procedure/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (417,20,'CHECK TABLE','Syntax:\nCHECK TABLE tbl_name [, tbl_name] ... [option] ...\n\noption = {FOR UPGRADE | QUICK | FAST | MEDIUM | EXTENDED | CHANGED}\n\nCHECK TABLE checks a table or tables for errors. CHECK TABLE works for\nInnoDB, MyISAM, ARCHIVE, and CSV tables. For MyISAM tables, the key\nstatistics are updated as well.\n\nTo check a table, you must have some privilege for it.\n\nCHECK TABLE can also check views for problems, such as tables that are\nreferenced in the view definition that no longer exist.\n\nCHECK TABLE is supported for partitioned tables, and you can use ALTER\nTABLE ... CHECK PARTITION to check one or more partitions; for more\ninformation, see [HELP ALTER TABLE].\n\nURL: https://mariadb.com/kb/en/sql-commands-check-table/\n\n','','https://mariadb.com/kb/en/sql-commands-check-table/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (418,37,'BIN','Syntax:\nBIN(N)\n\nReturns a string representation of the binary value of N, where N is a\nlonglong (BIGINT) number. This is equivalent to CONV(N,10,2). Returns\nNULL if N is NULL.\n\nURL: https://mariadb.com/kb/en/bin/\n\n','MariaDB> SELECT BIN(12);\n -> \'1100\'\n','https://mariadb.com/kb/en/bin/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (419,5,'INSTALL PLUGIN','Syntax:\nINSTALL PLUGIN plugin_name SONAME \'shared_library_name\'\n\nThis statement installs a server plugin. It requires the INSERT\nprivilege for the mysql.plugin table.\n\nplugin_name is the name of the plugin as defined in the plugin\ndescriptor structure contained in the library file (see\nhttp://dev.mysql.com/doc/refman/5.5/en/plugin-data-structures.html).\nPlugin names are not case sensitive. For maximal compatibility, plugin\nnames should be limited to ASCII letters, digits, and underscore\nbecause they are used in C source files, shell command lines, M4 and\nBourne shell scripts, and SQL environments.\n\nshared_library_name is the name of the shared library that contains the\nplugin code. The name includes the file name extension (for example,\nlibmyplugin.so, libmyplugin.dll, or libmyplugin.dylib).\n\nThe shared library must be located in the plugin directory (the\ndirectory named by the plugin_dir system variable). The library must be\nin the plugin directory itself, not in a subdirectory. By default,\nplugin_dir is the plugin directory under the directory named by the\npkglibdir configuration variable, but it can be changed by setting the\nvalue of plugin_dir at server startup. For example, set its value in a\nmy.cnf file:\n\n[mysqld]\nplugin_dir=/path/to/plugin/directory\n\nIf the value of plugin_dir is a relative path name, it is taken to be\nrelative to the MySQL base directory (the value of the basedir system\nvariable).\n\nINSTALL PLUGIN loads and initializes the plugin code to make the plugin\navailable for use. A plugin is initialized by executing its\ninitialization function, which handles any setup that the plugin must\nperform before it can be used. When the server shuts down, it executes\nthe deinitialization function for each plugin that is loaded so that\nthe plugin has a change to perform any final cleanup.\n\nINSTALL PLUGIN also registers the plugin by adding a line that\nindicates the plugin name and library file name to the mysql.plugin\ntable. At server startup, the server loads and initializes any plugin\nthat is listed in the mysql.plugin table. This means that a plugin is\ninstalled with INSTALL PLUGIN only once, not every time the server\nstarts. Plugin loading at startup does not occur if the server is\nstarted with the --skip-grant-tables option.\n\nA plugin library can contain multiple plugins. For each of them to be\ninstalled, use a separate INSTALL PLUGIN statement. Each statement\nnames a different plugin, but all of them specify the same library\nname.\n\nURL: https://mariadb.com/kb/en/install-plugin/\n\n','','https://mariadb.com/kb/en/install-plugin/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (420,23,'DECLARE CURSOR','Syntax:\nDECLARE cursor_name CURSOR FOR select_statement\n\nThis statement declares a cursor and associates it with a SELECT\nstatement that retrieves the rows to be traversed by the cursor. To\nfetch the rows later, use a FETCH statement. The number of columns\nretrieved by the SELECT statement must match the number of output\nvariables specified in the FETCH statement.\n\nThe SELECT statement cannot have an INTO clause.\n\nCursor declarations must appear before handler declarations and after\nvariable and condition declarations.\n\nA stored program may contain multiple cursor declarations, but each\ncursor declared in a given block must have a unique name. For an\nexample, see https://mariadb.com/kb/en/programmatic-and-compound-statements-cursors/.\n\nFor information available through SHOW statements, it is possible in\nmany cases to obtain equivalent information by using a cursor with an\nINFORMATION_SCHEMA table.\n\nURL: https://mariadb.com/kb/en/declare-cursor/\n\n','','https://mariadb.com/kb/en/declare-cursor/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (421,27,'LOAD DATA','Syntax:\nLOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE \'file_name\'\n [REPLACE | IGNORE]\n INTO TABLE tbl_name\n [CHARACTER SET charset_name]\n [{FIELDS | COLUMNS}\n [TERMINATED BY \'string\']\n [[OPTIONALLY] ENCLOSED BY \'char\']\n [ESCAPED BY \'char\']\n ]\n [LINES\n [STARTING BY \'string\']\n [TERMINATED BY \'string\']\n ]\n [IGNORE number {LINES | ROWS}]\n [(col_name_or_user_var,...)]\n [SET col_name = expr,...]\n\nThe LOAD DATA INFILE statement reads rows from a text file into a table\nat a very high speed. The file name must be given as a literal string.\n\nLOAD DATA INFILE is the complement of SELECT ... INTO OUTFILE. (See\nhttps://mariadb.com/kb/en/select-into/.) To write data\nfrom a table to a file, use SELECT ... INTO OUTFILE. To read the file\nback into a table, use LOAD DATA INFILE. The syntax of the FIELDS and\nLINES clauses is the same for both statements. Both clauses are\noptional, but FIELDS must precede LINES if both are specified.\n\nFor more information about the efficiency of INSERT versus LOAD DATA\nINFILE and speeding up LOAD DATA INFILE, see\nhttp://dev.mysql.com/doc/refman/5.5/en/insert-speed.html.\n\nThe character set indicated by the character_set_database system\nvariable is used to interpret the information in the file. SET NAMES\nand the setting of character_set_client do not affect interpretation of\ninput. If the contents of the input file use a character set that\ndiffers from the default, it is usually preferable to specify the\ncharacter set of the file by using the CHARACTER SET clause. A\ncharacter set of binary specifies "no conversion."\n\nLOAD DATA INFILE interprets all fields in the file as having the same\ncharacter set, regardless of the data types of the columns into which\nfield values are loaded. For proper interpretation of file contents,\nyou must ensure that it was written with the correct character set. For\nexample, if you write a data file with mysqldump -T or by issuing a\nSELECT ... INTO OUTFILE statement in mysql, be sure to use a\n--default-character-set option with mysqldump or mysql so that output\nis written in the character set to be used when the file is loaded with\nLOAD DATA INFILE.\n\n*Note*: It is not possible to load data files that use the ucs2, utf16,\nor utf32 character set.\n\nThe character_set_filesystem system variable controls the\ninterpretation of the file name.\n\nYou can also load data files by using the mysqlimport utility; it\noperates by sending a LOAD DATA INFILE statement to the server. The\n--local option causes mysqlimport to read data files from the client\nhost. You can specify the --compress option to get better performance\nover slow networks if the client and server support the compressed\nprotocol. See https://mariadb.com/kb/en/mysqlimport/.\n\nIf you use LOW_PRIORITY, execution of the LOAD DATA statement is\ndelayed until no other clients are reading from the table. This affects\nonly storage engines that use only table-level locking (such as MyISAM,\nMEMORY, and MERGE).\n\nIf you specify CONCURRENT with a MyISAM table that satisfies the\ncondition for concurrent inserts (that is, it contains no free blocks\nin the middle), other threads can retrieve data from the table while\nLOAD DATA is executing. Using this option affects the performance of\nLOAD DATA a bit, even if no other thread is using the table at the same\ntime.\n\nPrior to MySQL 5.5.1, CONCURRENT was not replicated when using\nstatement-based replication (see Bug #34628). However, it is replicated\nwhen using row-based replication, regardless of the version. See\nhttp://dev.mysql.com/doc/refman/5.5/en/replication-features-load-data.h\ntml, for more information.\n\nThe LOCAL keyword, if specified, is interpreted with respect to the\nclient end of the connection:\n\no If LOCAL is specified, the file is read by the client program on the\n client host and sent to the server. The file can be given as a full\n path name to specify its exact location. If given as a relative path\n name, the name is interpreted relative to the directory in which the\n client program was started.\n\n When using LOCAL with LOAD DATA, a copy of the file is created in the\n server\'s temporary directory. This is not the directory determined by\n the value of tmpdir or slave_load_tmpdir, but rather the operating\n system\'s temporary directory, and is not configurable in the MySQL\n Server. (Typically the system temporary directory is /tmp on Linux\n systems and C:\\WINDOWS\\TEMP on Windows.) Lack of sufficient space for\n the copy in this directory can cause the LOAD DATA LOCAL statement to\n fail.\n\no If LOCAL is not specified, the file must be located on the server\n host and is read directly by the server. The server uses the\n following rules to locate the file:\n\n o If the file name is an absolute path name, the server uses it as\n given.\n\n o If the file name is a relative path name with one or more leading\n components, the server searches for the file relative to the\n server\'s data directory.\n\n o If a file name with no leading components is given, the server\n looks for the file in the database directory of the default\n database.\n\nNote that, in the non-LOCAL case, these rules mean that a file named as\n./myfile.txt is read from the server\'s data directory, whereas the file\nnamed as myfile.txt is read from the database directory of the default\ndatabase. For example, if db1 is the default database, the following\nLOAD DATA statement reads the file data.txt from the database directory\nfor db1, even though the statement explicitly loads the file into a\ntable in the db2 database:\n\nLOAD DATA INFILE \'data.txt\' INTO TABLE db2.my_table;\n\nWindows path names are specified using forward slashes rather than\nbackslashes. If you do use backslashes, you must double them.\n\nFor security reasons, when reading text files located on the server,\nthe files must either reside in the database directory or be readable\nby all. Also, to use LOAD DATA INFILE on server files, you must have\nthe FILE privilege. See\nhttps://mariadb.com/kb/en/grant/. For\nnon-LOCAL load operations, if the secure_file_priv system variable is\nset to a nonempty directory name, the file to be loaded must be located\nin that directory.\n\nURL: https://mariadb.com/kb/en/load-data-infile/\n\n','','https://mariadb.com/kb/en/load-data-infile/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (422,24,'MULTILINESTRING','MultiLineString(ls1,ls2,...)\n\nConstructs a MultiLineString value using LineString or WKB LineString\narguments.\n\nURL: https://mariadb.com/kb/en/multilinestring/\n\n','','https://mariadb.com/kb/en/multilinestring/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (423,31,'LOCALTIME','Syntax:\nLOCALTIME, LOCALTIME()\n\nLOCALTIME and LOCALTIME() are synonyms for NOW().\n\nURL: https://mariadb.com/kb/en/localtime/\n\n','','https://mariadb.com/kb/en/localtime/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (424,26,'SHOW RELAYLOG EVENTS','Syntax:\nSHOW RELAYLOG EVENTS\n [IN \'log_name\'] [FROM pos] [LIMIT [offset,] row_count]\n\nShows the events in the relay log of a replication slave. If you do not\nspecify \'log_name\', the first relay log is displayed. This statement\nhas no effect on the master.\n\nURL: https://mariadb.com/kb/en/show-relaylog-events/\n\n','','https://mariadb.com/kb/en/show-relaylog-events/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (425,3,'MPOINTFROMTEXT','MPointFromText(wkt[,srid]), MultiPointFromText(wkt[,srid])\n\nConstructs a MULTIPOINT value using its WKT representation and SRID.\n\nURL: https://mariadb.com/kb/en/mpointfromtext/\n\n','','https://mariadb.com/kb/en/mpointfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (426,22,'BLOB','BLOB[(M)]\n\nA BLOB column with a maximum length of 65,535 (216 - 1) bytes. Each\nBLOB value is stored using a 2-byte length prefix that indicates the\nnumber of bytes in the value.\n\nAn optional length M can be given for this type. If this is done, MySQL\ncreates the column as the smallest BLOB type large enough to hold\nvalues M bytes long.\n\nURL: https://mariadb.com/kb/en/blob/\n\n','','https://mariadb.com/kb/en/blob/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (427,12,'SHA1','Syntax:\nSHA1(str), SHA(str)\n\nCalculates an SHA-1 160-bit checksum for the string, as described in\nRFC 3174 (Secure Hash Algorithm). The value is returned as a string of\n40 hex digits, or NULL if the argument was NULL. One of the possible\nuses for this function is as a hash key. See the notes at the beginning\nof this section about storing hash values efficiently. You can also use\nSHA1() as a cryptographic function for storing passwords. SHA() is\nsynonymous with SHA1().\n\nAs of MySQL 5.5.3, the return value is a nonbinary string in the\nconnection character set. Before 5.5.3, the return value is a binary\nstring; see the notes at the beginning of this section about using the\nvalue as a nonbinary string.\n\nURL: https://mariadb.com/kb/en/sha1/\n\n','MariaDB> SELECT SHA1(\'abc\');\n -> \'a9993e364706816aba3e25717850c26c9cd0d89d\'\n','https://mariadb.com/kb/en/sha1/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (428,37,'SUBSTR','Syntax:\nSUBSTR(str,pos), SUBSTR(str FROM pos), SUBSTR(str,pos,len), SUBSTR(str\nFROM pos FOR len)\n\nSUBSTR() is a synonym for SUBSTRING().\n\nURL: https://mariadb.com/kb/en/substr/\n\n','','https://mariadb.com/kb/en/substr/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (429,12,'PASSWORD','Syntax:\nPASSWORD(str)\n\nCalculates and returns a hashed password string from the plaintext\npassword str and returns a nonbinary string in the connection character\nset (a binary string before MySQL 5.5.3), or NULL if the argument is\nNULL. This function is the SQL interface to the algorithm used by the\nserver to encrypt MySQL passwords for storage in the mysql.user grant\ntable.\n\nThe password hashing method used by PASSWORD() depends on the value of\nthe old_passwords system variable:\n\nURL: https://mariadb.com/kb/en/password/\n\n','MariaDB> SET old_passwords = 0;\nMariaDB> SELECT PASSWORD(\'mypass\');\n+-------------------------------------------+\n| PASSWORD(\'mypass\') |\n+-------------------------------------------+\n| *6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4 |\n+-------------------------------------------+\n\nMariaDB> SET old_passwords = 1;\nMariaDB> SELECT PASSWORD(\'mypass\');\n+--------------------+\n| PASSWORD(\'mypass\') |\n+--------------------+\n| 6f8c114b58f2ce9e |\n+--------------------+\n','https://mariadb.com/kb/en/password/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (430,22,'CHAR','[NATIONAL] CHAR[(M)] [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n\nA fixed-length string that is always right-padded with spaces to the\nspecified length when stored. M represents the column length in\ncharacters. The range of M is 0 to 255. If M is omitted, the length is\n1.\n\n*Note*: Trailing spaces are removed when CHAR values are retrieved\nunless the PAD_CHAR_TO_FULL_LENGTH SQL mode is enabled.\n\nURL: https://mariadb.com/kb/en/char/\n\n','','https://mariadb.com/kb/en/char/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (431,31,'UTC_DATE','Syntax:\nUTC_DATE, UTC_DATE()\n\nReturns the current UTC date as a value in \'YYYY-MM-DD\' or YYYYMMDD\nformat, depending on whether the function is used in a string or\nnumeric context.\n\nURL: https://mariadb.com/kb/en/utc_date/\n\n','MariaDB> SELECT UTC_DATE(), UTC_DATE() + 0;\n -> \'2003-08-14\', 20030814\n','https://mariadb.com/kb/en/utc_date/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (432,36,'DIMENSION','Dimension(g)\n\nReturns the inherent dimension of the geometry value g. The result can\nbe -1, 0, 1, or 2. The meaning of these values is given in\nhttps://mariadb.com/kb/en/dimension/.\n\nURL: https://mariadb.com/kb/en/dimension/\n\n','MariaDB> SELECT Dimension(GeomFromText(\'LineString(1 1,2 2)\'));\n+------------------------------------------------+\n| Dimension(GeomFromText(\'LineString(1 1,2 2)\')) |\n+------------------------------------------------+\n| 1 |\n+------------------------------------------------+\n','https://mariadb.com/kb/en/dimension/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (433,16,'COUNT DISTINCT','Syntax:\nCOUNT(DISTINCT expr,[expr...])\n\nReturns a count of the number of rows with different non-NULL expr\nvalues.\n\nCOUNT(DISTINCT) returns 0 if there were no matching rows.\n\nURL: https://mariadb.com/kb/en/count-distinct/\n\n','MariaDB> SELECT COUNT(DISTINCT results) FROM student;\n','https://mariadb.com/kb/en/count-distinct/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (434,22,'BIT','BIT[(M)]\n\nA bit-field type. M indicates the number of bits per value, from 1 to\n64. The default is 1 if M is omitted.\n\nURL: https://mariadb.com/kb/en/bit/\n\n','','https://mariadb.com/kb/en/bit/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (435,30,'EQUALS','Equals(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 is spatially equal to g2.\n\nURL: https://mariadb.com/kb/en/equals/\n\n','','https://mariadb.com/kb/en/equals/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (436,26,'SHOW CREATE VIEW','Syntax:\nSHOW CREATE VIEW view_name\n\nThis statement shows a CREATE VIEW statement that creates the given\nview.\n\nURL: https://mariadb.com/kb/en/show-create-view/\n\n','','https://mariadb.com/kb/en/show-create-view/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (437,18,'INTERVAL','Syntax:\nINTERVAL(N,N1,N2,N3,...)\n\nReturns 0 if N < N1, 1 if N < N2 and so on or -1 if N is NULL. All\narguments are treated as integers. It is required that N1 < N2 < N3 <\n... < Nn for this function to work correctly. This is because a binary\nsearch is used (very fast).\n\nURL: https://mariadb.com/kb/en/interval/\n\n','MariaDB> SELECT INTERVAL(23, 1, 15, 17, 30, 44, 200);\n -> 3\nMariaDB> SELECT INTERVAL(10, 1, 10, 100, 1000);\n -> 2\nMariaDB> SELECT INTERVAL(22, 23, 30, 44, 200);\n -> 0\n','https://mariadb.com/kb/en/interval/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (438,31,'FROM_DAYS','Syntax:\nFROM_DAYS(N)\n\nGiven a day number N, returns a DATE value.\n\nURL: https://mariadb.com/kb/en/from_days/\n\n','MariaDB> SELECT FROM_DAYS(730669);\n -> \'2007-07-03\'\n','https://mariadb.com/kb/en/from_days/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (439,39,'ALTER PROCEDURE','Syntax:\nALTER PROCEDURE proc_name [characteristic ...]\n\ncharacteristic:\n COMMENT \'string\'\n | LANGUAGE SQL\n | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }\n | SQL SECURITY { DEFINER | INVOKER }\n\nThis statement can be used to change the characteristics of a stored\nprocedure. More than one change may be specified in an ALTER PROCEDURE\nstatement. However, you cannot change the parameters or body of a\nstored procedure using this statement; to make such changes, you must\ndrop and re-create the procedure using DROP PROCEDURE and CREATE\nPROCEDURE.\n\nYou must have the ALTER ROUTINE privilege for the procedure. By\ndefault, that privilege is granted automatically to the procedure\ncreator. This behavior can be changed by disabling the\nautomatic_sp_privileges system variable. See\nhttps://mariadb.com/kb/en/stored-routine-privileges/.\n\nURL: https://mariadb.com/kb/en/alter-procedure/\n\n','','https://mariadb.com/kb/en/alter-procedure/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (440,19,'BIT_COUNT','Syntax:\nBIT_COUNT(N)\n\nReturns the number of bits that are set in the argument N.\n\nURL: https://mariadb.com/kb/en/bit_count/\n\n','MariaDB> SELECT BIT_COUNT(29), BIT_COUNT(b\'101010\');\n -> 4, 3\n','https://mariadb.com/kb/en/bit_count/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (441,37,'OCTET_LENGTH','Syntax:\nOCTET_LENGTH(str)\n\nOCTET_LENGTH() is a synonym for LENGTH().\n\nURL: https://mariadb.com/kb/en/octet_length/\n\n','','https://mariadb.com/kb/en/octet_length/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (442,31,'UTC_TIMESTAMP','Syntax:\nUTC_TIMESTAMP, UTC_TIMESTAMP()\n\nReturns the current UTC date and time as a value in \'YYYY-MM-DD\nHH:MM:SS\' or YYYYMMDDHHMMSS.uuuuuu format, depending on whether the\nfunction is used in a string or numeric context.\n\nURL: https://mariadb.com/kb/en/utc_timestamp/\n\n','MariaDB> SELECT UTC_TIMESTAMP(), UTC_TIMESTAMP() + 0;\n -> \'2003-08-14 18:08:04\', 20030814180804.000000\n','https://mariadb.com/kb/en/utc_timestamp/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (443,12,'AES_ENCRYPT','Syntax:\nAES_ENCRYPT(str,key_str)\n\nAES_ENCRYPT() and AES_DECRYPT() enable encryption and decryption of\ndata using the official AES (Advanced Encryption Standard) algorithm,\npreviously known as "Rijndael." Encoding with a 128-bit key length is\nused, but you can extend it up to 256 bits by modifying the source. We\nchose 128 bits because it is much faster and it is secure enough for\nmost purposes.\n\nAES_ENCRYPT() encrypts a string and returns a binary string.\nAES_DECRYPT() decrypts the encrypted string and returns the original\nstring. The input arguments may be any length. If either argument is\nNULL, the result of this function is also NULL.\n\nBecause AES is a block-level algorithm, padding is used to encode\nuneven length strings and so the result string length may be calculated\nusing this formula:\n\n16 * (trunc(string_length / 16) + 1)\n\nIf AES_DECRYPT() detects invalid data or incorrect padding, it returns\nNULL. However, it is possible for AES_DECRYPT() to return a non-NULL\nvalue (possibly garbage) if the input data or the key is invalid.\n\nYou can use the AES functions to store data in an encrypted form by\nmodifying your queries:\n\nURL: https://mariadb.com/kb/en/aes_encrypt/\n\n','INSERT INTO t VALUES (1,AES_ENCRYPT(\'text\',\'password\'));\n','https://mariadb.com/kb/en/aes_encrypt/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (444,4,'+','Syntax:\n+\n\nAddition:\n\nURL: https://mariadb.com/kb/en/addition-operator/\n\n','MariaDB> SELECT 3+5;\n -> 8\n','https://mariadb.com/kb/en/addition-operator/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (445,14,'INET_NTOA','Syntax:\nINET_NTOA(expr)\n\nGiven a numeric IPv4 network address in network byte order, returns the\ndotted-quad representation of the address as a string. INET_NTOA()\nreturns NULL if it does not understand its argument.\n\nAs of MySQL 5.5.3, the return value is a nonbinary string in the\nconnection character set. Before 5.5.3, the return value is a binary\nstring.\n\nURL: https://mariadb.com/kb/en/inet_ntoa/\n\n','MariaDB> SELECT INET_NTOA(167773449);\n -> \'10.0.5.9\'\n','https://mariadb.com/kb/en/inet_ntoa/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (446,4,'ACOS','Syntax:\nACOS(X)\n\nReturns the arc cosine of X, that is, the value whose cosine is X.\nReturns NULL if X is not in the range -1 to 1.\n\nURL: https://mariadb.com/kb/en/acos/\n\n','MariaDB> SELECT ACOS(1);\n -> 0\nMariaDB> SELECT ACOS(1.0001);\n -> NULL\nMariaDB> SELECT ACOS(0);\n -> 1.5707963267949\n','https://mariadb.com/kb/en/acos/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (447,8,'ISOLATION','Syntax:\nSET [GLOBAL | SESSION] TRANSACTION ISOLATION LEVEL\n {\n REPEATABLE READ\n | READ COMMITTED\n | READ UNCOMMITTED\n | SERIALIZABLE\n }\n\nThis statement sets the transaction isolation level, used for\noperations on InnoDB tables.\n\nScope of the Isolation Level\n\nYou can set the isolation level globally, for the current session, or\nfor the next transaction:\n\no With the GLOBAL keyword, the statement sets the default transaction\n level globally for all subsequent sessions. Existing sessions are\n unaffected.\n\no With the SESSION keyword, the statement sets the default transaction\n level for all subsequent transactions performed within the current\n session.\n\no Without any SESSION or GLOBAL keyword, the statement sets the\n isolation level for the next (not started) transaction performed\n within the current session.\n\nA change to the global default isolation level requires the SUPER\nprivilege. Any session is free to change its session isolation level\n(even in the middle of a transaction), or the isolation level for its\nnext transaction.\n\nSET TRANSACTION ISOLATION LEVEL without GLOBAL or SESSION is not\npermitted while there is an active transaction:\n\nMariaDB> START TRANSACTION;\nQuery OK, 0 rows affected (0.02 sec)\n\nMariaDB> SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;\nERROR 1568 (25001): Transaction isolation level can\'t be changed\nwhile a transaction is in progress\n\nTo set the global default isolation level at server startup, use the\n--transaction-isolation=level option to mysqld on the command line or\nin an option file. Values of level for this option use dashes rather\nthan spaces, so the permissible values are READ-UNCOMMITTED,\nREAD-COMMITTED, REPEATABLE-READ, or SERIALIZABLE. For example, to set\nthe default isolation level to REPEATABLE READ, use these lines in the\n[mysqld] section of an option file:\n\n[mysqld]\ntransaction-isolation = REPEATABLE-READ\n\nIt is possible to check or set the global and session transaction\nisolation levels at runtime by using the tx_isolation system variable:\n\nSELECT @@GLOBAL.tx_isolation, @@tx_isolation;\nSET GLOBAL tx_isolation=\'REPEATABLE-READ\';\nSET SESSION tx_isolation=\'SERIALIZABLE\';\n\nDetails and Usage of Isolation Levels\n\nInnoDB supports each of the transaction isolation levels described here\nusing different locking strategies. You can enforce a high degree of\nconsistency with the default REPEATABLE READ level, for operations on\ncrucial data where ACID compliance is important. Or you can relax the\nconsistency rules with READ COMMITTED or even READ UNCOMMITTED, in\nsituations such as bulk reporting where precise consistency and\nrepeatable results are less important than minimizing the amount of\noverhead for locking. SERIALIZABLE enforces even stricter rules than\nREPEATABLE READ, and is used mainly in specialized situations, such as\nwith XA transactions and for troubleshooting issues with concurrency\nand deadlocks.\n\nFor full information about how these isolation levels work with InnoDB\ntransactions, see\nhttp://dev.mysql.com/doc/refman/5.1/en/innodb-transaction-model.html.\nIn particular, for additional information about InnoDB record-level\nlocks and how it uses them to execute various types of statements, see\nhttp://dev.mysql.com/doc/refman/5.5/en/innodb-record-level-locks.html\nand http://dev.mysql.com/doc/refman/5.5/en/innodb-locks-set.html.\n\nThe following list describes how MySQL supports the different\ntransaction levels. The list goes from the most commonly used level to\nthe least used.\n\no REPEATABLE READ\n\n This is the default isolation level for InnoDB. For consistent reads,\n there is an important difference from the READ COMMITTED isolation\n level: All consistent reads within the same transaction read the\n snapshot established by the first read. This convention means that if\n you issue several plain (nonlocking) SELECT statements within the\n same transaction, these SELECT statements are consistent also with\n respect to each other. See\n http://dev.mysql.com/doc/refman/5.5/en/innodb-consistent-read.html.\n\n For locking reads (SELECT with FOR UPDATE or LOCK IN SHARE MODE),\n UPDATE, and DELETE statements, locking depends on whether the\n statement uses a unique index with a unique search condition, or a\n range-type search condition. For a unique index with a unique search\n condition, InnoDB locks only the index record found, not the gap\n before it. For other search conditions, InnoDB locks the index range\n scanned, using gap locks or next-key (gap plus index-record) locks to\n block insertions by other sessions into the gaps covered by the\n range.\n\no READ COMMITTED\n\n A somewhat Oracle-like isolation level with respect to consistent\n (nonlocking) reads: Each consistent read, even within the same\n transaction, sets and reads its own fresh snapshot. See\n http://dev.mysql.com/doc/refman/5.5/en/innodb-consistent-read.html.\n\n For locking reads (SELECT with FOR UPDATE or LOCK IN SHARE MODE),\n InnoDB locks only index records, not the gaps before them, and thus\n permits the free insertion of new records next to locked records. For\n UPDATE and DELETE statements, locking depends on whether the\n statement uses a unique index with a unique search condition (such as\n WHERE id = 100), or a range-type search condition (such as WHERE id >\n 100). For a unique index with a unique search condition, InnoDB locks\n only the index record found, not the gap before it. For range-type\n searches, InnoDB locks the index range scanned, using gap locks or\n next-key (gap plus index-record) locks to block insertions by other\n sessions into the gaps covered by the range. This is necessary\n because "phantom rows" must be blocked for MySQL replication and\n recovery to work.\n\n *Note*: In MySQL 5.5, if the READ COMMITTED isolation level is used\n or the innodb_locks_unsafe_for_binlog system variable is enabled,\n there is no InnoDB gap locking except for foreign-key constraint\n checking and duplicate-key checking. Also, record locks for\n nonmatching rows are released after MySQL has evaluated the WHERE\n condition. If you use READ COMMITTED or enable\n innodb_locks_unsafe_for_binlog, you must use row-based binary\n logging.\n\no READ UNCOMMITTED\n\n SELECT statements are performed in a nonlocking fashion, but a\n possible earlier version of a row might be used. Thus, using this\n isolation level, such reads are not consistent. This is also called a\n "dirty read." Otherwise, this isolation level works like READ\n COMMITTED.\n\no SERIALIZABLE\n\n This level is like REPEATABLE READ, but InnoDB implicitly converts\n all plain SELECT statements to SELECT ... LOCK IN SHARE MODE if\n autocommit is disabled. If autocommit is enabled, the SELECT is its\n own transaction. It therefore is known to be read only and can be\n serialized if performed as a consistent (nonlocking) read and need\n not block for other transactions. (To force a plain SELECT to block\n if other transactions have modified the selected rows, disable\n autocommit.)\n\nURL: https://mariadb.com/kb/en/set-transaction-isolation-level/\n\n','','https://mariadb.com/kb/en/set-transaction-isolation-level/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (448,4,'CEILING','Syntax:\nCEILING(X)\n\nReturns the smallest integer value not less than X.\n\nURL: https://mariadb.com/kb/en/ceiling/\n\n','MariaDB> SELECT CEILING(1.23);\n -> 2\nMariaDB> SELECT CEILING(-1.23);\n -> -1\n','https://mariadb.com/kb/en/ceiling/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (449,4,'SIN','Syntax:\nSIN(X)\n\nReturns the sine of X, where X is given in radians.\n\nURL: https://mariadb.com/kb/en/sin/\n\n','MariaDB> SELECT SIN(PI());\n -> 1.2246063538224e-16\nMariaDB> SELECT ROUND(SIN(PI()));\n -> 0\n','https://mariadb.com/kb/en/sin/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (450,31,'DAYOFWEEK','Syntax:\nDAYOFWEEK(date)\n\nReturns the weekday index for date (1 = Sunday, 2 = Monday, ..., 7 =\nSaturday). These index values correspond to the ODBC standard.\n\nURL: https://mariadb.com/kb/en/dayofweek/\n\n','MariaDB> SELECT DAYOFWEEK(\'2007-02-03\');\n -> 7\n','https://mariadb.com/kb/en/dayofweek/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (451,26,'SHOW PROCESSLIST','Syntax:\nSHOW [FULL] PROCESSLIST\n\nSHOW PROCESSLIST shows you which threads are running. You can also get\nthis information from the INFORMATION_SCHEMA PROCESSLIST table or the\nmysqladmin processlist command. If you have the PROCESS privilege, you\ncan see all threads. Otherwise, you can see only your own threads (that\nis, threads associated with the MySQL account that you are using). If\nyou do not use the FULL keyword, only the first 100 characters of each\nstatement are shown in the Info field.\n\nURL: https://mariadb.com/kb/en/show-processlist/\n\n','','https://mariadb.com/kb/en/show-processlist/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (452,32,'LINEFROMWKB','LineFromWKB(wkb[,srid]), LineStringFromWKB(wkb[,srid])\n\nConstructs a LINESTRING value using its WKB representation and SRID.\n\nURL: https://mariadb.com/kb/en/linefromwkb/\n\n','','https://mariadb.com/kb/en/linefromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (453,36,'GEOMETRYTYPE','GeometryType(g)\n\nReturns as a binary string the name of the geometry type of which the\ngeometry instance g is a member. The name corresponds to one of the\ninstantiable Geometry subclasses.\n\nURL: https://mariadb.com/kb/en/geometrytype/\n\n','MariaDB> SELECT GeometryType(GeomFromText(\'POINT(1 1)\'));\n+------------------------------------------+\n| GeometryType(GeomFromText(\'POINT(1 1)\')) |\n+------------------------------------------+\n| POINT |\n+------------------------------------------+\n','https://mariadb.com/kb/en/geometrytype/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (454,39,'CREATE VIEW','Syntax:\nCREATE\n [OR REPLACE]\n [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]\n [DEFINER = { user | CURRENT_USER }]\n [SQL SECURITY { DEFINER | INVOKER }]\n VIEW view_name [(column_list)]\n AS select_statement\n [WITH [CASCADED | LOCAL] CHECK OPTION]\n\nThe CREATE VIEW statement creates a new view, or replaces an existing\none if the OR REPLACE clause is given. If the view does not exist,\nCREATE OR REPLACE VIEW is the same as CREATE VIEW. If the view does\nexist, CREATE OR REPLACE VIEW is the same as ALTER VIEW.\n\nThe select_statement is a SELECT statement that provides the definition\nof the view. (When you select from the view, you select in effect using\nthe SELECT statement.) select_statement can select from base tables or\nother views.\n\nThe view definition is "frozen" at creation time, so changes to the\nunderlying tables afterward do not affect the view definition. For\nexample, if a view is defined as SELECT * on a table, new columns added\nto the table later do not become part of the view.\n\nThe ALGORITHM clause affects how MySQL processes the view. The DEFINER\nand SQL SECURITY clauses specify the security context to be used when\nchecking access privileges at view invocation time. The WITH CHECK\nOPTION clause can be given to constrain inserts or updates to rows in\ntables referenced by the view. These clauses are described later in\nthis section.\n\nThe CREATE VIEW statement requires the CREATE VIEW privilege for the\nview, and some privilege for each column selected by the SELECT\nstatement. For columns used elsewhere in the SELECT statement you must\nhave the SELECT privilege. If the OR REPLACE clause is present, you\nmust also have the DROP privilege for the view. CREATE VIEW might also\nrequire the SUPER privilege, depending on the DEFINER value, as\ndescribed later in this section.\n\nWhen a view is referenced, privilege checking occurs as described later\nin this section.\n\nA view belongs to a database. By default, a new view is created in the\ndefault database. To create the view explicitly in a given database,\nspecify the name as db_name.view_name when you create it:\n\nMariaDB> CREATE VIEW test.v AS SELECT * FROM t;\n\nWithin a database, base tables and views share the same namespace, so a\nbase table and a view cannot have the same name.\n\nColumns retrieved by the SELECT statement can be simple references to\ntable columns. They can also be expressions that use functions,\nconstant values, operators, and so forth.\n\nViews must have unique column names with no duplicates, just like base\ntables. By default, the names of the columns retrieved by the SELECT\nstatement are used for the view column names. To define explicit names\nfor the view columns, the optional column_list clause can be given as a\nlist of comma-separated identifiers. The number of names in column_list\nmust be the same as the number of columns retrieved by the SELECT\nstatement.\n\nUnqualified table or view names in the SELECT statement are interpreted\nwith respect to the default database. A view can refer to tables or\nviews in other databases by qualifying the table or view name with the\nproper database name.\n\nA view can be created from many kinds of SELECT statements. It can\nrefer to base tables or other views. It can use joins, UNION, and\nsubqueries. The SELECT need not even refer to any tables. The following\nexample defines a view that selects two columns from another table, as\nwell as an expression calculated from those columns:\n\nMariaDB> CREATE TABLE t (qty INT, price INT);\nMariaDB> INSERT INTO t VALUES(3, 50);\nMariaDB> CREATE VIEW v AS SELECT qty, price, qty*price AS value FROM t;\nMariaDB> SELECT * FROM v;\n+------+-------+-------+\n| qty | price | value |\n+------+-------+-------+\n| 3 | 50 | 150 |\n+------+-------+-------+\n\nA view definition is subject to the following restrictions:\n\no The SELECT statement cannot contain a subquery in the FROM clause.\n\no The SELECT statement cannot refer to system or user variables.\n\no Within a stored program, the definition cannot refer to program\n parameters or local variables.\n\no The SELECT statement cannot refer to prepared statement parameters.\n\no Any table or view referred to in the definition must exist. However,\n after a view has been created, it is possible to drop a table or view\n that the definition refers to. In this case, use of the view results\n in an error. To check a view definition for problems of this kind,\n use the CHECK TABLE statement.\n\no The definition cannot refer to a TEMPORARY table, and you cannot\n create a TEMPORARY view.\n\no Any tables named in the view definition must exist at definition\n time.\n\no You cannot associate a trigger with a view.\n\no Aliases for column names in the SELECT statement are checked against\n the maximum column length of 64 characters (not the maximum alias\n length of 256 characters).\n\nORDER BY is permitted in a view definition, but it is ignored if you\nselect from a view using a statement that has its own ORDER BY.\n\nFor other options or clauses in the definition, they are added to the\noptions or clauses of the statement that references the view, but the\neffect is undefined. For example, if a view definition includes a LIMIT\nclause, and you select from the view using a statement that has its own\nLIMIT clause, it is undefined which limit applies. This same principle\napplies to options such as ALL, DISTINCT, or SQL_SMALL_RESULT that\nfollow the SELECT keyword, and to clauses such as INTO, FOR UPDATE,\nLOCK IN SHARE MODE, and PROCEDURE.\n\nIf you create a view and then change the query processing environment\nby changing system variables, that may affect the results that you get\nfrom the view:\n\nMariaDB> CREATE VIEW v (mycol) AS SELECT \'abc\';\nQuery OK, 0 rows affected (0.01 sec)\n\nMariaDB> SET sql_mode = \'\';\nQuery OK, 0 rows affected (0.00 sec)\n\nMariaDB> SELECT "mycol" FROM v;\n+-------+\n| mycol |\n+-------+\n| mycol |\n+-------+\n1 row in set (0.01 sec)\n\nMariaDB> SET sql_mode = \'ANSI_QUOTES\';\nQuery OK, 0 rows affected (0.00 sec)\n\nMariaDB> SELECT "mycol" FROM v;\n+-------+\n| mycol |\n+-------+\n| abc |\n+-------+\n1 row in set (0.00 sec)\n\nThe DEFINER and SQL SECURITY clauses determine which MySQL account to\nuse when checking access privileges for the view when a statement is\nexecuted that references the view. The valid SQL SECURITY\ncharacteristic values are DEFINER and INVOKER. These indicate that the\nrequired privileges must be held by the user who defined or invoked the\nview, respectively. The default SQL SECURITY value is DEFINER.\n\nIf a user value is given for the DEFINER clause, it should be a MySQL\naccount specified as \'user_name\'@\'host_name\' (the same format used in\nthe GRANT statement), CURRENT_USER, or CURRENT_USER(). The default\nDEFINER value is the user who executes the CREATE VIEW statement. This\nis the same as specifying DEFINER = CURRENT_USER explicitly.\n\nIf you specify the DEFINER clause, these rules determine the valid\nDEFINER user values:\n\no If you do not have the SUPER privilege, the only valid user value is\n your own account, either specified literally or by using\n CURRENT_USER. You cannot set the definer to some other account.\n\no If you have the SUPER privilege, you can specify any syntactically\n valid account name. If the account does not actually exist, a warning\n is generated.\n\no Although it is possible to create a view with a nonexistent DEFINER\n account, an error occurs when the view is referenced if the SQL\n SECURITY value is DEFINER but the definer account does not exist.\n\nFor more information about view security, see\nhttps://mariadb.com/kb/en/stored-routine-privileges/.\n\nWithin a view definition, CURRENT_USER returns the view\'s DEFINER value\nby default. For views defined with the SQL SECURITY INVOKER\ncharacteristic, CURRENT_USER returns the account for the view\'s\ninvoker. For information about user auditing within views, see\nhttp://dev.mysql.com/doc/refman/5.5/en/account-activity-auditing.html.\n\nWithin a stored routine that is defined with the SQL SECURITY DEFINER\ncharacteristic, CURRENT_USER returns the routine\'s DEFINER value. This\nalso affects a view defined within such a routine, if the view\ndefinition contains a DEFINER value of CURRENT_USER.\n\nView privileges are checked like this:\n\no At view definition time, the view creator must have the privileges\n needed to use the top-level objects accessed by the view. For\n example, if the view definition refers to table columns, the creator\n must have some privilege for each column in the select list of the\n definition, and the SELECT privilege for each column used elsewhere\n in the definition. If the definition refers to a stored function,\n only the privileges needed to invoke the function can be checked. The\n privileges required at function invocation time can be checked only\n as it executes: For different invocations, different execution paths\n within the function might be taken.\n\no The user who references a view must have appropriate privileges to\n access it (SELECT to select from it, INSERT to insert into it, and so\n forth.)\n\no When a view has been referenced, privileges for objects accessed by\n the view are checked against the privileges held by the view DEFINER\n account or invoker, depending on whether the SQL SECURITY\n characteristic is DEFINER or INVOKER, respectively.\n\no If reference to a view causes execution of a stored function,\n privilege checking for statements executed within the function depend\n on whether the function SQL SECURITY characteristic is DEFINER or\n INVOKER. If the security characteristic is DEFINER, the function runs\n with the privileges of the DEFINER account. If the characteristic is\n INVOKER, the function runs with the privileges determined by the\n view\'s SQL SECURITY characteristic.\n\nExample: A view might depend on a stored function, and that function\nmight invoke other stored routines. For example, the following view\ninvokes a stored function f():\n\nCREATE VIEW v AS SELECT * FROM t WHERE t.id = f(t.name);\n\nSuppose that f() contains a statement such as this:\n\nIF name IS NULL then\n CALL p1();\nELSE\n CALL p2();\nEND IF;\n\nThe privileges required for executing statements within f() need to be\nchecked when f() executes. This might mean that privileges are needed\nfor p1() or p2(), depending on the execution path within f(). Those\nprivileges must be checked at runtime, and the user who must possess\nthe privileges is determined by the SQL SECURITY values of the view v\nand the function f().\n\nThe DEFINER and SQL SECURITY clauses for views are extensions to\nstandard SQL. In standard SQL, views are handled using the rules for\nSQL SECURITY DEFINER. The standard says that the definer of the view,\nwhich is the same as the owner of the view\'s schema, gets applicable\nprivileges on the view (for example, SELECT) and may grant them. MySQL\nhas no concept of a schema "owner", so MySQL adds a clause to identify\nthe definer. The DEFINER clause is an extension where the intent is to\nhave what the standard has; that is, a permanent record of who defined\nthe view. This is why the default DEFINER value is the account of the\nview creator.\n\nThe optional ALGORITHM clause is a MySQL extension to standard SQL. It\naffects how MySQL processes the view. ALGORITHM takes three values:\nMERGE, TEMPTABLE, or UNDEFINED. The default algorithm is UNDEFINED if\nno ALGORITHM clause is present. For more information, see\nhttps://mariadb.com/kb/en/view-algorithms/.\n\nSome views are updatable. That is, you can use them in statements such\nas UPDATE, DELETE, or INSERT to update the contents of the underlying\ntable. For a view to be updatable, there must be a one-to-one\nrelationship between the rows in the view and the rows in the\nunderlying table. There are also certain other constructs that make a\nview nonupdatable.\n\nThe WITH CHECK OPTION clause can be given for an updatable view to\nprevent inserts or updates to rows except those for which the WHERE\nclause in the select_statement is true.\n\nIn a WITH CHECK OPTION clause for an updatable view, the LOCAL and\nCASCADED keywords determine the scope of check testing when the view is\ndefined in terms of another view. The LOCAL keyword restricts the CHECK\nOPTION only to the view being defined. CASCADED causes the checks for\nunderlying views to be evaluated as well. When neither keyword is\ngiven, the default is CASCADED.\n\nFor more information about updatable views and the WITH CHECK OPTION\nclause, see\nhttps://mariadb.com/kb/en/inserting-and-updating-with-views/.\n\nURL: https://mariadb.com/kb/en/create-view/\n\n','','https://mariadb.com/kb/en/create-view/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (455,37,'TRIM','Syntax:\nTRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str), TRIM([remstr\nFROM] str)\n\nReturns the string str with all remstr prefixes or suffixes removed. If\nnone of the specifiers BOTH, LEADING, or TRAILING is given, BOTH is\nassumed. remstr is optional and, if not specified, spaces are removed.\n\nURL: https://mariadb.com/kb/en/trim/\n\n','MariaDB> SELECT TRIM(\' bar \');\n -> \'bar\'\nMariaDB> SELECT TRIM(LEADING \'x\' FROM \'xxxbarxxx\');\n -> \'barxxx\'\nMariaDB> SELECT TRIM(BOTH \'x\' FROM \'xxxbarxxx\');\n -> \'bar\'\nMariaDB> SELECT TRIM(TRAILING \'xyz\' FROM \'barxxyz\');\n -> \'barx\'\n','https://mariadb.com/kb/en/trim/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (456,18,'IS','Syntax:\nIS boolean_value\n\nTests a value against a boolean value, where boolean_value can be TRUE,\nFALSE, or UNKNOWN.\n\nURL: https://mariadb.com/kb/en/is/\n\n','MariaDB> SELECT 1 IS TRUE, 0 IS FALSE, NULL IS UNKNOWN;\n -> 1, 1, 1\n','https://mariadb.com/kb/en/is/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (457,31,'GET_FORMAT','Syntax:\nGET_FORMAT({DATE|TIME|DATETIME}, {\'EUR\'|\'USA\'|\'JIS\'|\'ISO\'|\'INTERNAL\'})\n\nReturns a format string. This function is useful in combination with\nthe DATE_FORMAT() and the STR_TO_DATE() functions.\n\nURL: https://mariadb.com/kb/en/get_format/\n\n','MariaDB> SELECT DATE_FORMAT(\'2003-10-03\',GET_FORMAT(DATE,\'EUR\'));\n -> \'03.10.2003\'\nMariaDB> SELECT STR_TO_DATE(\'10.31.2003\',GET_FORMAT(DATE,\'USA\'));\n -> \'2003-10-31\'\n','https://mariadb.com/kb/en/get_format/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (458,22,'TINYBLOB','TINYBLOB\n\nA BLOB column with a maximum length of 255 (28 - 1) bytes. Each\nTINYBLOB value is stored using a 1-byte length prefix that indicates\nthe number of bytes in the value.\n\nURL: https://mariadb.com/kb/en/tinyblob/\n\n','','https://mariadb.com/kb/en/tinyblob/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (459,23,'SIGNAL','Syntax:\nSIGNAL condition_value\n [SET signal_information_item\n [, signal_information_item] ...]\n\ncondition_value:\n SQLSTATE [VALUE] sqlstate_value\n | condition_name\n\nsignal_information_item:\n condition_information_item_name = simple_value_specification\n\ncondition_information_item_name:\n CLASS_ORIGIN\n | SUBCLASS_ORIGIN\n | MESSAGE_TEXT\n | MYSQL_ERRNO\n | CONSTRAINT_CATALOG\n | CONSTRAINT_SCHEMA\n | CONSTRAINT_NAME\n | CATALOG_NAME\n | SCHEMA_NAME\n | TABLE_NAME\n | COLUMN_NAME\n | CURSOR_NAME\n\ncondition_name, simple_value_specification:\n (see following discussion)\n\nSIGNAL is the way to "return" an error. SIGNAL provides error\ninformation to a handler, to an outer portion of the application, or to\nthe client. Also, it provides control over the error\'s characteristics\n(error number, SQLSTATE value, message). Without SIGNAL, it is\nnecessary to resort to workarounds such as deliberately referring to a\nnonexistent table to cause a routine to return an error.\n\nNo special privileges are required to execute the SIGNAL statement.\n\nThe condition_value in a SIGNAL statement indicates the error value to\nbe returned. It can be an SQLSTATE value (a 5-character string literal)\nor a condition_name that refers to a named condition previously defined\nwith DECLARE ... CONDITION (see [HELP DECLARE CONDITION]).\n\nAn SQLSTATE value can indicate errors, warnings, or "not found." The\nfirst two characters of the value indicate its error class, as\ndiscussed in\nhttps://mariadb.com/kb/en/signal/#signal-condition-inf\normation-items. Some signal values cause statement termination; see\nhttps://mariadb.com/kb/en/signal/#signal-effects.\n\nThe SQLSTATE value for a SIGNAL statement should not start with \'00\'\nbecause such values indicate success and are not valid for signaling an\nerror. This is true whether the SQLSTATE value is specified directly in\nthe SIGNAL statement or in a named condition referred to in the\nstatement. If the value is invalid, a Bad SQLSTATE error occurs.\n\nTo signal a generic SQLSTATE value, use \'45000\', which means "unhandled\nuser-defined exception."\n\nThe SIGNAL statement optionally includes a SET clause that contains\nmultiple signal items, in a comma-separated list of\ncondition_information_item_name = simple_value_specification\nassignments.\n\nEach condition_information_item_name may be specified only once in the\nSET clause. Otherwise, a Duplicate condition information item error\noccurs.\n\nValid simple_value_specification designators can be specified using\nstored procedure or function parameters, stored program local variables\ndeclared with DECLARE, user-defined variables, system variables, or\nliterals. A character literal may include a _charset introducer.\n\nFor information about permissible condition_information_item_name\nvalues, see\nhttps://mariadb.com/kb/en/signal/#signal-condition-inf\normation-items.\n\nURL: https://mariadb.com/kb/en/signal/\n\n','CREATE PROCEDURE p (pval INT)\nBEGIN\n DECLARE specialty CONDITION FOR SQLSTATE \'45000\';\n IF pval = 0 THEN\n SIGNAL SQLSTATE \'01000\';\n ELSEIF pval = 1 THEN\n SIGNAL SQLSTATE \'45000\'\n SET MESSAGE_TEXT = \'An error occurred\';\n ELSEIF pval = 2 THEN\n SIGNAL specialty\n SET MESSAGE_TEXT = \'An error occurred\';\n ELSE\n SIGNAL SQLSTATE \'01000\'\n SET MESSAGE_TEXT = \'A warning occurred\', MYSQL_ERRNO = 1000;\n SIGNAL SQLSTATE \'45000\'\n SET MESSAGE_TEXT = \'An error occurred\', MYSQL_ERRNO = 1001;\n END IF;\nEND;\n','https://mariadb.com/kb/en/signal/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (460,8,'SAVEPOINT','Syntax:\nSAVEPOINT identifier\nROLLBACK [WORK] TO [SAVEPOINT] identifier\nRELEASE SAVEPOINT identifier\n\nInnoDB supports the SQL statements SAVEPOINT, ROLLBACK TO SAVEPOINT,\nRELEASE SAVEPOINT and the optional WORK keyword for ROLLBACK.\n\nURL: https://mariadb.com/kb/en/savepoint/\n\n','','https://mariadb.com/kb/en/savepoint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (461,17,'USER','Syntax:\nUSER()\n\nReturns the current MySQL user name and host name as a string in the\nutf8 character set.\n\nURL: https://mariadb.com/kb/en/user/\n\n','MariaDB> SELECT USER();\n -> \'davida@localhost\'\n','https://mariadb.com/kb/en/user/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (462,23,'LABELS','Syntax:\n[begin_label:] BEGIN\n [statement_list]\nEND [end_label]\n\n[begin_label:] LOOP\n statement_list\nEND LOOP [end_label]\n\n[begin_label:] REPEAT\n statement_list\nUNTIL search_condition\nEND REPEAT [end_label]\n\n[begin_label:] WHILE search_condition DO\n statement_list\nEND WHILE [end_label]\n\nLabels are permitted for BEGIN ... END blocks and for the LOOP, REPEAT,\nand WHILE statements. Label use for those statements follows these\nrules:\n\no begin_label must be followed by a colon.\n\no begin_label can be given without end_label. If end_label is present,\n it must be the same as begin_label.\n\no end_label cannot be given without begin_label.\n\no Labels at the same nesting level must be distinct.\n\no Labels can be up to 16 characters long.\n\nTo refer to a label within the labeled construct, use an ITERATE or\nLEAVE statement. The following example uses those statements to\ncontinue iterating or terminate the loop:\n\nCREATE PROCEDURE doiterate(p1 INT)\nBEGIN\n label1: LOOP\n SET p1 = p1 + 1;\n IF p1 < 10 THEN ITERATE label1; END IF;\n LEAVE label1;\n END LOOP label1;\nEND;\n\nThe scope of a block label does not include the code for handlers\ndeclared within the block. For details, see [HELP DECLARE HANDLER].\n\nURL: https://mariadb.com/kb/en/labels/\n\n','','https://mariadb.com/kb/en/labels/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (463,39,'ALTER TABLE','Syntax:\nALTER [ONLINE | OFFLINE] [IGNORE] TABLE tbl_name\n [alter_specification [, alter_specification] ...]\n [partition_options]\n\nalter_specification:\n table_options\n | ADD [COLUMN] col_name column_definition\n [FIRST | AFTER col_name ]\n | ADD [COLUMN] (col_name column_definition,...)\n | ADD {INDEX|KEY} [index_name]\n [index_type] (index_col_name,...) [index_option] ...\n | ADD [CONSTRAINT [symbol]] PRIMARY KEY\n [index_type] (index_col_name,...) [index_option] ...\n | ADD [CONSTRAINT [symbol]]\n UNIQUE [INDEX|KEY] [index_name]\n [index_type] (index_col_name,...) [index_option] ...\n | ADD FULLTEXT [INDEX|KEY] [index_name]\n (index_col_name,...) [index_option] ...\n | ADD SPATIAL [INDEX|KEY] [index_name]\n (index_col_name,...) [index_option] ...\n | ADD [CONSTRAINT [symbol]]\n FOREIGN KEY [index_name] (index_col_name,...)\n reference_definition\n | ALTER [COLUMN] col_name {SET DEFAULT literal | DROP DEFAULT}\n | CHANGE [COLUMN] old_col_name new_col_name column_definition\n [FIRST|AFTER col_name]\n | MODIFY [COLUMN] col_name column_definition\n [FIRST | AFTER col_name]\n | DROP [COLUMN] col_name\n | DROP PRIMARY KEY\n | DROP {INDEX|KEY} index_name\n | DROP FOREIGN KEY fk_symbol\n | MAX_ROWS = rows\n | DISABLE KEYS\n | ENABLE KEYS\n | RENAME [TO|AS] new_tbl_name\n | ORDER BY col_name [, col_name] ...\n | CONVERT TO CHARACTER SET charset_name [COLLATE collation_name]\n | [DEFAULT] CHARACTER SET [=] charset_name [COLLATE [=] collation_name]\n | DISCARD TABLESPACE\n | IMPORT TABLESPACE\n | FORCE\n | ADD PARTITION (partition_definition)\n | DROP PARTITION partition_names\n | TRUNCATE PARTITION {partition_names | ALL}\n | COALESCE PARTITION number\n | REORGANIZE PARTITION [partition_names INTO (partition_definitions)]\n | ANALYZE PARTITION {partition_names | ALL}\n | CHECK PARTITION {partition_names | ALL}\n | OPTIMIZE PARTITION {partition_names | ALL}\n | REBUILD PARTITION {partition_names | ALL}\n | REPAIR PARTITION {partition_names | ALL}\n | PARTITION BY partitioning_expression\n | REMOVE PARTITIONING\n\nindex_col_name:\n col_name [(length)] [ASC | DESC]\n\nindex_type:\n USING {BTREE | HASH}\n\nindex_option:\n KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n | COMMENT \'string\'\n\ntable_options:\n table_option [[,] table_option] ... (see CREATE TABLE options)\n\npartition_options:\n (see CREATE TABLE options)\n\nALTER TABLE changes the structure of a table. For example, you can add\nor delete columns, create or destroy indexes, change the type of\nexisting columns, or rename columns or the table itself. You can also\nchange characteristics such as the storage engine used for the table or\nthe table comment.\n\nPartitioning-related clauses for ALTER TABLE can be used with\npartitioned tables for repartitioning, for adding, dropping, merging,\nand splitting partitions, and for performing partitioning maintenance.\nFor more information, see\nhttp://dev.mysql.com/doc/refman/5.5/en/alter-table-partition-operations\n.html.\n\nFollowing the table name, specify the alterations to be made. If none\nare given, ALTER TABLE does nothing.\n\nURL: https://mariadb.com/kb/en/alter-table/\n\n','','https://mariadb.com/kb/en/alter-table/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (464,32,'MPOINTFROMWKB','MPointFromWKB(wkb[,srid]), MultiPointFromWKB(wkb[,srid])\n\nConstructs a MULTIPOINT value using its WKB representation and SRID.\n\nURL: https://mariadb.com/kb/en/mpointfromwkb/\n\n','','https://mariadb.com/kb/en/mpointfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (465,22,'CHAR BYTE','The CHAR BYTE data type is an alias for the BINARY data type. This is a\ncompatibility feature.\n\nURL: https://mariadb.com/kb/en/char-byte/\n\n','','https://mariadb.com/kb/en/char-byte/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (466,20,'REPAIR TABLE','Syntax:\nREPAIR [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n [QUICK] [EXTENDED] [USE_FRM]\n\nREPAIR TABLE repairs a possibly corrupted table. By default, it has the\nsame effect as myisamchk --recover tbl_name. REPAIR TABLE works for\nMyISAM, ARCHIVE, and CSV tables. See\nhttps://mariadb.com/kb/en/myisam-storage-engine/, and\nhttps://mariadb.com/kb/en/archive/, and\nhttps://mariadb.com/kb/en/csv/\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nREPAIR TABLE is supported for partitioned tables. However, the USE_FRM\noption cannot be used with this statement on a partitioned table.\n\nYou can use ALTER TABLE ... REPAIR PARTITION to repair one or more\npartitions; for more information, see [HELP ALTER TABLE], and\nhttp://dev.mysql.com/doc/refman/5.5/en/partitioning-maintenance.html.\n\nURL: https://mariadb.com/kb/en/repair-table/\n\n','','https://mariadb.com/kb/en/repair-table/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (467,39,'MERGE','The MERGE storage engine, also known as the MRG_MyISAM engine, is a\ncollection of identical MyISAM tables that can be used as one.\n"Identical" means that all tables have identical column and index\ninformation. You cannot merge MyISAM tables in which the columns are\nlisted in a different order, do not have exactly the same columns, or\nhave the indexes in different order. However, any or all of the MyISAM\ntables can be compressed with myisampack. See\nhttps://mariadb.com/kb/en/myisampack/. Differences in\ntable options such as AVG_ROW_LENGTH, MAX_ROWS, or PACK_KEYS do not\nmatter.\n\nURL: https://mariadb.com/kb/en/merge/\n\n','MariaDB> CREATE TABLE t1 (\n -> a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n -> message CHAR(20)) ENGINE=MyISAM;\nMariaDB> CREATE TABLE t2 (\n -> a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n -> message CHAR(20)) ENGINE=MyISAM;\nMariaDB> INSERT INTO t1 (message) VALUES (\'Testing\'),(\'table\'),(\'t1\');\nMariaDB> INSERT INTO t2 (message) VALUES (\'Testing\'),(\'table\'),(\'t2\');\nMariaDB> CREATE TABLE total (\n -> a INT NOT NULL AUTO_INCREMENT,\n -> message CHAR(20), INDEX(a))\n -> ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;\n','https://mariadb.com/kb/en/merge/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (468,39,'CREATE TABLE','Syntax:\nCREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n (create_definition,...)\n [table_options]\n [partition_options]\n\nOr:\n\nCREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n [(create_definition,...)]\n [table_options]\n [partition_options]\n select_statement\n\nOr:\n\nCREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n { LIKE old_tbl_name | (LIKE old_tbl_name) }\n\ncreate_definition:\n col_name column_definition\n | [CONSTRAINT [symbol]] PRIMARY KEY [index_type] (index_col_name,...)\n [index_option] ...\n | {INDEX|KEY} [index_name] [index_type] (index_col_name,...)\n [index_option] ...\n | [CONSTRAINT [symbol]] UNIQUE [INDEX|KEY]\n [index_name] [index_type] (index_col_name,...)\n [index_option] ...\n | {FULLTEXT|SPATIAL} [INDEX|KEY] [index_name] (index_col_name,...)\n [index_option] ...\n | [CONSTRAINT [symbol]] FOREIGN KEY\n [index_name] (index_col_name,...) reference_definition\n | CHECK (expr)\n\ncolumn_definition:\n data_type [NOT NULL | NULL] [DEFAULT default_value]\n [AUTO_INCREMENT] [UNIQUE [KEY] | [PRIMARY] KEY]\n [COMMENT \'string\']\n [COLUMN_FORMAT {FIXED|DYNAMIC|DEFAULT}]\n [STORAGE {DISK|MEMORY|DEFAULT}]\n [reference_definition]\n\ndata_type:\n BIT[(length)]\n | TINYINT[(length)] [UNSIGNED] [ZEROFILL]\n | SMALLINT[(length)] [UNSIGNED] [ZEROFILL]\n | MEDIUMINT[(length)] [UNSIGNED] [ZEROFILL]\n | INT[(length)] [UNSIGNED] [ZEROFILL]\n | INTEGER[(length)] [UNSIGNED] [ZEROFILL]\n | BIGINT[(length)] [UNSIGNED] [ZEROFILL]\n | REAL[(length,decimals)] [UNSIGNED] [ZEROFILL]\n | DOUBLE[(length,decimals)] [UNSIGNED] [ZEROFILL]\n | FLOAT[(length,decimals)] [UNSIGNED] [ZEROFILL]\n | DECIMAL[(length[,decimals])] [UNSIGNED] [ZEROFILL]\n | NUMERIC[(length[,decimals])] [UNSIGNED] [ZEROFILL]\n | DATE\n | TIME\n | TIMESTAMP\n | DATETIME\n | YEAR\n | CHAR[(length)]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | VARCHAR(length)\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | BINARY[(length)]\n | VARBINARY(length)\n | TINYBLOB\n | BLOB\n | MEDIUMBLOB\n | LONGBLOB\n | TINYTEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | TEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | MEDIUMTEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | LONGTEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | ENUM(value1,value2,value3,...)\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | SET(value1,value2,value3,...)\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | spatial_type\n\nindex_col_name:\n col_name [(length)] [ASC | DESC]\n\nindex_type:\n USING {BTREE | HASH}\n\nindex_option:\n KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n | COMMENT \'string\'\n\nreference_definition:\n REFERENCES tbl_name (index_col_name,...)\n [MATCH FULL | MATCH PARTIAL | MATCH SIMPLE]\n [ON DELETE reference_option]\n [ON UPDATE reference_option]\n\nreference_option:\n RESTRICT | CASCADE | SET NULL | NO ACTION\n\ntable_options:\n table_option [[,] table_option] ...\n\ntable_option:\n ENGINE [=] engine_name\n | AUTO_INCREMENT [=] value\n | AVG_ROW_LENGTH [=] value\n | [DEFAULT] CHARACTER SET [=] charset_name\n | CHECKSUM [=] {0 | 1}\n | [DEFAULT] COLLATE [=] collation_name\n | COMMENT [=] \'string\'\n | CONNECTION [=] \'connect_string\'\n | DATA DIRECTORY [=] \'absolute path to directory\'\n | DELAY_KEY_WRITE [=] {0 | 1}\n | INDEX DIRECTORY [=] \'absolute path to directory\'\n | INSERT_METHOD [=] { NO | FIRST | LAST }\n | KEY_BLOCK_SIZE [=] value\n | MAX_ROWS [=] value\n | MIN_ROWS [=] value\n | PACK_KEYS [=] {0 | 1 | DEFAULT}\n | PASSWORD [=] \'string\'\n | ROW_FORMAT [=] {DEFAULT|DYNAMIC|FIXED|COMPRESSED|REDUNDANT|COMPACT}\n | TABLESPACE tablespace_name [STORAGE {DISK|MEMORY|DEFAULT}]\n | UNION [=] (tbl_name[,tbl_name]...)\n\npartition_options:\n PARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list)\n | RANGE{(expr) | COLUMNS(column_list)}\n | LIST{(expr) | COLUMNS(column_list)} }\n [PARTITIONS num]\n [SUBPARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list) }\n [SUBPARTITIONS num]\n ]\n [(partition_definition [, partition_definition] ...)]\n\npartition_definition:\n PARTITION partition_name\n [VALUES \n {LESS THAN {(expr | value_list) | MAXVALUE} \n | \n IN (value_list)}]\n [[STORAGE] ENGINE [=] engine_name]\n [COMMENT [=] \'comment_text\' ]\n [DATA DIRECTORY [=] \'data_dir\']\n [INDEX DIRECTORY [=] \'index_dir\']\n [MAX_ROWS [=] max_number_of_rows]\n [MIN_ROWS [=] min_number_of_rows]\n [TABLESPACE [=] tablespace_name]\n [NODEGROUP [=] node_group_id]\n [(subpartition_definition [, subpartition_definition] ...)]\n\nsubpartition_definition:\n SUBPARTITION logical_name\n [[STORAGE] ENGINE [=] engine_name]\n [COMMENT [=] \'comment_text\' ]\n [DATA DIRECTORY [=] \'data_dir\']\n [INDEX DIRECTORY [=] \'index_dir\']\n [MAX_ROWS [=] max_number_of_rows]\n [MIN_ROWS [=] min_number_of_rows]\n [TABLESPACE [=] tablespace_name]\n [NODEGROUP [=] node_group_id]\n\nselect_statement:\n [IGNORE | REPLACE] [AS] SELECT ... (Some valid select statement)\n\nCREATE TABLE creates a table with the given name. You must have the\nCREATE privilege for the table.\n\nRules for permissible table names are given in\nhttps://mariadb.com/kb/en/identifier-names/. By default,\nthe table is created in the default database, using the InnoDB storage\nengine. An error occurs if the table exists, if there is no default\ndatabase, or if the database does not exist.\n\nURL: https://mariadb.com/kb/en/create-table/\n\n','','https://mariadb.com/kb/en/create-table/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (469,18,'>','Syntax:\n>\n\nGreater than:\n\nURL: https://mariadb.com/kb/en/greater-than/\n\n','MariaDB> SELECT 2 > 2;\n -> 0\n','https://mariadb.com/kb/en/greater-than/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (470,20,'ANALYZE TABLE','Syntax:\nANALYZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n\nANALYZE TABLE analyzes and stores the key distribution for a table.\nDuring the analysis, the table is locked with a read lock for InnoDB\nand MyISAM. This statement works with InnoDB, Aria and MyISAM tables.\nFor MyISAM tables, this statement is equivalent to using myisamchk\n--analyze.\n\nFor more information on how the analysis works within InnoDB, see\nhttp://dev.mysql.com/doc/refman/5.5/en/innodb-restrictions.html.\n\nMySQL uses the stored key distribution to decide the order in which\ntables should be joined when you perform a join on something other than\na constant. In addition, key distributions can be used when deciding\nwhich indexes to use for a specific table within a query.\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nANALYZE TABLE is supported for partitioned tables, and you can use\nALTER TABLE ... ANALYZE PARTITION to analyze one or more partitions;\nfor more information, see [HELP ALTER TABLE], and\nhttp://dev.mysql.com/doc/refman/5.5/en/partitioning-maintenance.html.\n\nURL: https://mariadb.com/kb/en/analyze-table/\n\n','','https://mariadb.com/kb/en/analyze-table/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (471,31,'MICROSECOND','Syntax:\nMICROSECOND(expr)\n\nReturns the microseconds from the time or datetime expression expr as a\nnumber in the range from 0 to 999999.\n\nURL: https://mariadb.com/kb/en/microsecond/\n\n','MariaDB> SELECT MICROSECOND(\'12:00:00.123456\');\n -> 123456\nMariaDB> SELECT MICROSECOND(\'2009-12-31 23:59:59.000010\');\n -> 10\n','https://mariadb.com/kb/en/microsecond/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (472,39,'CONSTRAINT','InnoDB supports foreign keys, which let you cross-reference related\ndata across tables, and foreign key constraints, which help keep this\nspread-out data consistent. The syntax for an InnoDB foreign key\nconstraint definition in the CREATE TABLE or ALTER TABLE statement\nlooks like this:\n\n[CONSTRAINT [symbol]] FOREIGN KEY\n [index_name] (index_col_name, ...)\n REFERENCES tbl_name (index_col_name,...)\n [ON DELETE reference_option]\n [ON UPDATE reference_option]\n\nreference_option:\n RESTRICT | CASCADE | SET NULL | NO ACTION\n\nURL: https://mariadb.com/kb/en/constraint/\n\n','CREATE TABLE product (category INT NOT NULL, id INT NOT NULL,\n price DECIMAL,\n PRIMARY KEY(category, id)) ENGINE=INNODB;\nCREATE TABLE customer (id INT NOT NULL,\n PRIMARY KEY (id)) ENGINE=INNODB;\nCREATE TABLE product_order (no INT NOT NULL AUTO_INCREMENT,\n product_category INT NOT NULL,\n product_id INT NOT NULL,\n customer_id INT NOT NULL,\n PRIMARY KEY(no),\n INDEX (product_category, product_id),\n FOREIGN KEY (product_category, product_id)\n REFERENCES product(category, id)\n ON UPDATE CASCADE ON DELETE RESTRICT,\n INDEX (customer_id),\n FOREIGN KEY (customer_id)\n REFERENCES customer(id)) ENGINE=INNODB;\n','https://mariadb.com/kb/en/constraint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (473,39,'CREATE SERVER','Syntax:\nCREATE SERVER server_name\n FOREIGN DATA WRAPPER wrapper_name\n OPTIONS (option [, option] ...)\n\noption:\n { HOST character-literal\n | DATABASE character-literal\n | USER character-literal\n | PASSWORD character-literal\n | SOCKET character-literal\n | OWNER character-literal\n | PORT numeric-literal }\n\nThis statement creates the definition of a server for use with the\nFEDERATED storage engine. The CREATE SERVER statement creates a new row\nwithin the servers table within the mysql database. This statement\nrequires the SUPER privilege.\n\nThe server_name should be a unique reference to the server. Server\ndefinitions are global within the scope of the server, it is not\npossible to qualify the server definition to a specific database.\nserver_name has a maximum length of 64 characters (names longer than 64\ncharacters are silently truncated), and is case insensitive. You may\nspecify the name as a quoted string.\n\nThe wrapper_name should be mysql, and may be quoted with single\nquotation marks. Other values for wrapper_name are not currently\nsupported.\n\nFor each option you must specify either a character literal or numeric\nliteral. Character literals are UTF-8, support a maximum length of 64\ncharacters and default to a blank (empty) string. String literals are\nsilently truncated to 64 characters. Numeric literals must be a number\nbetween 0 and 9999, default value is 0.\n\n*Note*: Note that the OWNER option is currently not applied, and has no\neffect on the ownership or operation of the server connection that is\ncreated.\n\nThe CREATE SERVER statement creates an entry in the mysql.servers table\nthat can later be used with the CREATE TABLE statement when creating a\nFEDERATED table. The options that you specify will be used to populate\nthe columns in the mysql.servers table. The table columns are\nServer_name, Host, Db, Username, Password, Port and Socket.\n\nURL: https://mariadb.com/kb/en/create-server/\n\n','CREATE SERVER s\nFOREIGN DATA WRAPPER mysql\nOPTIONS (USER \'Remote\', HOST \'192.168.1.106\', DATABASE \'test\');\n','https://mariadb.com/kb/en/create-server/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (474,37,'FIELD','Syntax:\nFIELD(str,str1,str2,str3,...)\n\nReturns the index (position) of str in the str1, str2, str3, ... list.\nReturns 0 if str is not found.\n\nIf all arguments to FIELD() are strings, all arguments are compared as\nstrings. If all arguments are numbers, they are compared as numbers.\nOtherwise, the arguments are compared as double.\n\nIf str is NULL, the return value is 0 because NULL fails equality\ncomparison with any value. FIELD() is the complement of ELT().\n\nURL: https://mariadb.com/kb/en/field/\n\n','MariaDB> SELECT FIELD(\'ej\', \'Hej\', \'ej\', \'Heja\', \'hej\', \'foo\');\n -> 2\nMariaDB> SELECT FIELD(\'fo\', \'Hej\', \'ej\', \'Heja\', \'hej\', \'foo\');\n -> 0\n','https://mariadb.com/kb/en/field/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (475,31,'MAKETIME','Syntax:\nMAKETIME(hour,minute,second)\n\nReturns a time value calculated from the hour, minute, and second\narguments.\n\nURL: https://mariadb.com/kb/en/maketime/\n\n','MariaDB> SELECT MAKETIME(12,15,30);\n -> \'12:15:30\'\n','https://mariadb.com/kb/en/maketime/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (476,31,'CURDATE','Syntax:\nCURDATE()\n\nReturns the current date as a value in \'YYYY-MM-DD\' or YYYYMMDD format,\ndepending on whether the function is used in a string or numeric\ncontext.\n\nURL: https://mariadb.com/kb/en/curdate/\n\n','MariaDB> SELECT CURDATE();\n -> \'2008-06-13\'\nMariaDB> SELECT CURDATE() + 0;\n -> 20080613\n','https://mariadb.com/kb/en/curdate/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (477,10,'SET PASSWORD','Syntax:\nSET PASSWORD [FOR user] =\n {\n PASSWORD(\'cleartext password\')\n | OLD_PASSWORD(\'cleartext password\')\n | \'encrypted password\'\n }\n\nThe SET PASSWORD statement assigns a password to an existing MySQL user\naccount. When the read_only system variable is enabled, the SUPER\nprivilege is required to use SET PASSWORD, in addition to whatever\nother privileges might be required.\n\nIf the password is specified using the PASSWORD() or OLD_PASSWORD()\nfunction, the cleartext (unencrypted) password should be given as the\nargument to the function, which hashes the password and returns the\nencrypted password string. If the password is specified without using\neither function, it should be the already encrypted password value as a\nliteral string. In all cases, the encrypted password string must be in\nthe format required by the authentication method used for the account.\n\nThe old_passwords system variable value determines the hashing method\nused by PASSWORD(). If you specify the password using that function and\nSET PASSWORD rejects the password as not being in the correct format,\nit may be necessary to set old_passwords to change the hashing method.\nFor descriptions of the permitted values, see\nhttps://mariadb.com/kb/en/server-system-variables#old_passwords.\n\nWith no FOR user clause, this statement sets the password for the\ncurrent user. (To see which account the server authenticated you as,\ninvoke the CURRENT_USER() function.) Any client who successfully\nconnects to the server using a nonanonymous account can change the\npassword for that account.\n\nWith a FOR user clause, this statement sets the password for the named\nuser. You must have the UPDATE privilege for the mysql database to do\nthis. The user account name uses the format described in\nhttps://mariadb.com/kb/en/create-user#account-names. The user\nvalue should be given as \'user_name\'@\'host_name\', where \'user_name\' and\n\'host_name\' are exactly as listed in the User and Host columns of the\nmysql.user table row. (If you specify only a user name, a host name of\n\'%\' is used.) For example, to set the password for an account with User\nand Host column values of \'bob\' and \'%.example.org\', write the\nstatement like this:\n\nSET PASSWORD FOR \'bob\'@\'%.example.org\' = PASSWORD(\'cleartext password\');\n\nURL: https://mariadb.com/kb/en/set-password/\n\n','','https://mariadb.com/kb/en/set-password/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (478,39,'ALTER TABLESPACE','Syntax:\nALTER TABLESPACE tablespace_name\n {ADD|DROP} DATAFILE \'file_name\'\n [INITIAL_SIZE [=] size]\n [WAIT]\n ENGINE [=] engine_name\n\nThis statement is used with NDB cluster, which is not supported by MariaDB.\n\nURL: https://mariadb.com/kb/en/alter-tablespace/\n\n','','https://mariadb.com/kb/en/alter-tablespace/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (479,7,'IF FUNCTION','Syntax:\nIF(expr1,expr2,expr3)\n\nIf expr1 is TRUE (expr1 <> 0 and expr1 <> NULL) then IF() returns\nexpr2; otherwise it returns expr3. IF() returns a numeric or string\nvalue, depending on the context in which it is used.\n\nURL: https://mariadb.com/kb/en/if-function/\n\n','MariaDB> SELECT IF(1>2,2,3);\n -> 3\nMariaDB> SELECT IF(1<2,\'yes\',\'no\');\n -> \'yes\'\nMariaDB> SELECT IF(STRCMP(\'test\',\'test1\'),\'no\',\'yes\');\n -> \'no\'\n','https://mariadb.com/kb/en/if-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (480,22,'ENUM','ENUM(\'value1\',\'value2\',...) [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n\nAn enumeration. A string object that can have only one value, chosen\nfrom the list of values \'value1\', \'value2\', ..., NULL or the special \'\'\nerror value. An ENUM column can have a maximum of 65,535 distinct\nvalues. ENUM values are represented internally as integers.\n\nURL: https://mariadb.com/kb/en/enum/\n\n','','https://mariadb.com/kb/en/enum/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (481,17,'DATABASE','Syntax:\nDATABASE()\n\nReturns the default (current) database name as a string in the utf8\ncharacter set. If there is no default database, DATABASE() returns\nNULL. Within a stored routine, the default database is the database\nthat the routine is associated with, which is not necessarily the same\nas the database that is the default in the calling context.\n\nURL: https://mariadb.com/kb/en/database/\n\n','MariaDB> SELECT DATABASE();\n -> \'test\'\n','https://mariadb.com/kb/en/database/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (482,32,'POINTFROMWKB','PointFromWKB(wkb[,srid])\n\nConstructs a POINT value using its WKB representation and SRID.\n\nURL: https://mariadb.com/kb/en/pointfromwkb/\n\n','','https://mariadb.com/kb/en/pointfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (483,4,'POWER','Syntax:\nPOWER(X,Y)\n\nThis is a synonym for POW().\n\nURL: https://mariadb.com/kb/en/power/\n\n','','https://mariadb.com/kb/en/power/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (484,4,'ATAN','Syntax:\nATAN(X)\n\nReturns the arc tangent of X, that is, the value whose tangent is X.\n\nURL: https://mariadb.com/kb/en/atan/\n\n','MariaDB> SELECT ATAN(2);\n -> 1.1071487177941\nMariaDB> SELECT ATAN(-2);\n -> -1.1071487177941\n','https://mariadb.com/kb/en/atan/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (485,37,'STRCMP','Syntax:\nSTRCMP(expr1,expr2)\n\nSTRCMP() returns 0 if the strings are the same, -1 if the first\nargument is smaller than the second according to the current sort\norder, and 1 otherwise.\n\nURL: https://mariadb.com/kb/en/strcmp/\n\n','MariaDB> SELECT STRCMP(\'text\', \'text2\');\n -> -1\nMariaDB> SELECT STRCMP(\'text2\', \'text\');\n -> 1\nMariaDB> SELECT STRCMP(\'text\', \'text\');\n -> 0\n','https://mariadb.com/kb/en/strcmp/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (486,27,'INSERT DELAYED','Syntax:\nINSERT DELAYED ...\n\nThe DELAYED option for the INSERT statement is a MySQL extension to\nstandard SQL that is very useful if you have clients that cannot or\nneed not wait for the INSERT to complete. This is a common situation\nwhen you use MySQL for logging and you also periodically run SELECT and\nUPDATE statements that take a long time to complete.\n\nWhen a client uses INSERT DELAYED, it gets an okay from the server at\nonce, and the row is queued to be inserted when the table is not in use\nby any other thread.\n\nAnother major benefit of using INSERT DELAYED is that inserts from many\nclients are bundled together and written in one block. This is much\nfaster than performing many separate inserts.\n\nNote that INSERT DELAYED is slower than a normal INSERT if the table is\nnot otherwise in use. There is also the additional overhead for the\nserver to handle a separate thread for each table for which there are\ndelayed rows. This means that you should use INSERT DELAYED only when\nyou are really sure that you need it.\n\nThe queued rows are held only in memory until they are inserted into\nthe table. This means that if you terminate mysqld forcibly (for\nexample, with kill -9) or if mysqld dies unexpectedly, any queued rows\nthat have not been written to disk are lost.\n\nThere are some constraints on the use of DELAYED:\n\no INSERT DELAYED works only with MyISAM, MEMORY, ARCHIVE, and BLACKHOLE\n tables. For engines that do not support DELAYED, an error occurs.\n\no An error occurs for INSERT DELAYED if used with a table that has been\n locked with LOCK TABLES because the insert must be handled by a\n separate thread, not by the session that holds the lock.\n\no For MyISAM tables, if there are no free blocks in the middle of the\n data file, concurrent SELECT and INSERT statements are supported.\n Under these circumstances, you very seldom need to use INSERT DELAYED\n with MyISAM.\n\no INSERT DELAYED should be used only for INSERT statements that specify\n value lists. The server ignores DELAYED for INSERT ... SELECT or\n INSERT ... ON DUPLICATE KEY UPDATE statements.\n\no Because the INSERT DELAYED statement returns immediately, before the\n rows are inserted, you cannot use LAST_INSERT_ID() to get the\n AUTO_INCREMENT value that the statement might generate.\n\no DELAYED rows are not visible to SELECT statements until they actually\n have been inserted.\n\no Prior to MySQL 5.5.7, INSERT DELAYED was treated as a normal INSERT\n if the statement inserted multiple rows, binary logging was enabled,\n and the global logging format was statement-based (that is, whenever\n binlog_format was set to STATEMENT). Beginning with MySQL 5.5.7,\n INSERT DELAYED is always handled as a simple INSERT (that is, without\n the DELAYED option) whenever the value of binlog_format is STATEMENT\n or MIXED. (In the latter case, the statement no longer triggers a\n switch to row-based logging, and so is logged using the\n statement-based format.)\n\n This does not apply when using row-based binary logging mode\n (binlog_format set to ROW), in which INSERT DELAYED statements are\n always executed using the DELAYED option as specified, and logged as\n row-update events.\n\no DELAYED is ignored on slave replication servers, so that INSERT\n DELAYED is treated as a normal INSERT on slaves. This is because\n DELAYED could cause the slave to have different data than the master.\n\no Pending INSERT DELAYED statements are lost if a table is write locked\n and ALTER TABLE is used to modify the table structure.\n\no INSERT DELAYED is not supported for views.\n\no INSERT DELAYED is not supported for partitioned tables.\n\nURL: https://mariadb.com/kb/en/insert-delayed/\n\n','','https://mariadb.com/kb/en/insert-delayed/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (487,26,'SHOW PROFILE','Syntax:\nSHOW PROFILE [type [, type] ... ]\n [FOR QUERY n]\n [LIMIT row_count [OFFSET offset]]\n\ntype:\n ALL\n | BLOCK IO\n | CONTEXT SWITCHES\n | CPU\n | IPC\n | MEMORY\n | PAGE FAULTS\n | SOURCE\n | SWAPS\n\nThe SHOW PROFILE and SHOW PROFILES statements display profiling\ninformation that indicates resource usage for statements executed\nduring the course of the current session.\n\nProfiling is controlled by the profiling session variable, which has a\ndefault value of 0 (OFF). Profiling is enabled by setting profiling to\n1 or ON:\n\nMariaDB> SET profiling = 1;\n\nSHOW PROFILES displays a list of the most recent statements sent to the\nserver. The size of the list is controlled by the\nprofiling_history_size session variable, which has a default value of\n15. The maximum value is 100. Setting the value to 0 has the practical\neffect of disabling profiling.\n\nAll statements are profiled except SHOW PROFILE and SHOW PROFILES, so\nyou will find neither of those statements in the profile list.\nMalformed statements are profiled. For example, SHOW PROFILING is an\nillegal statement, and a syntax error occurs if you try to execute it,\nbut it will show up in the profiling list.\n\nSHOW PROFILE displays detailed information about a single statement.\nWithout the FOR QUERY n clause, the output pertains to the most\nrecently executed statement. If FOR QUERY n is included, SHOW PROFILE\ndisplays information for statement n. The values of n correspond to the\nQuery_ID values displayed by SHOW PROFILES.\n\nThe LIMIT row_count clause may be given to limit the output to\nrow_count rows. If LIMIT is given, OFFSET offset may be added to begin\nthe output offset rows into the full set of rows.\n\nBy default, SHOW PROFILE displays Status and Duration columns. The\nStatus values are like the State values displayed by SHOW PROCESSLIST,\nalthough there might be some minor differences in interpretion for the\ntwo statements for some status values (see\nhttp://dev.mysql.com/doc/refman/5.5/en/thread-information.html).\n\nOptional type values may be specified to display specific additional\ntypes of information:\n\no ALL displays all information\n\no BLOCK IO displays counts for block input and output operations\n\no CONTEXT SWITCHES displays counts for voluntary and involuntary\n context switches\n\no CPU displays user and system CPU usage times\n\no IPC displays counts for messages sent and received\n\no MEMORY is not currently implemented\n\no PAGE FAULTS displays counts for major and minor page faults\n\no SOURCE displays the names of functions from the source code, together\n with the name and line number of the file in which the function\n occurs\n\no SWAPS displays swap counts\n\nProfiling is enabled per session. When a session ends, its profiling\ninformation is lost.\n\nURL: https://mariadb.com/kb/en/show-profile/\n\n','MariaDB> SELECT @@profiling;\n+-------------+\n| @@profiling |\n+-------------+\n| 0 |\n+-------------+\n1 row in set (0.00 sec)\n\nMariaDB> SET profiling = 1;\nQuery OK, 0 rows affected (0.00 sec)\n\nMariaDB> DROP TABLE IF EXISTS t1;\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n\nMariaDB> CREATE TABLE T1 (id INT);\nQuery OK, 0 rows affected (0.01 sec)\n\nMariaDB> SHOW PROFILES;\n+----------+----------+--------------------------+\n| Query_ID | Duration | Query |\n+----------+----------+--------------------------+\n| 0 | 0.000088 | SET PROFILING = 1 |\n| 1 | 0.000136 | DROP TABLE IF EXISTS t1 |\n| 2 | 0.011947 | CREATE TABLE t1 (id INT) |\n+----------+----------+--------------------------+\n3 rows in set (0.00 sec)\n\nMariaDB> SHOW PROFILE;\n+----------------------+----------+\n| Status | Duration |\n+----------------------+----------+\n| checking permissions | 0.000040 |\n| creating table | 0.000056 |\n| After create | 0.011363 |\n| query end | 0.000375 |\n| freeing items | 0.000089 |\n| logging slow query | 0.000019 |\n| cleaning up | 0.000005 |\n+----------------------+----------+\n7 rows in set (0.00 sec)\n\nMariaDB> SHOW PROFILE FOR QUERY 1;\n+--------------------+----------+\n| Status | Duration |\n+--------------------+----------+\n| query end | 0.000107 |\n| freeing items | 0.000008 |\n| logging slow query | 0.000015 |\n| cleaning up | 0.000006 |\n+--------------------+----------+\n4 rows in set (0.00 sec)\n\nMariaDB> SHOW PROFILE CPU FOR QUERY 2;\n+----------------------+----------+----------+------------+\n| Status | Duration | CPU_user | CPU_system |\n+----------------------+----------+----------+------------+\n| checking permissions | 0.000040 | 0.000038 | 0.000002 |\n| creating table | 0.000056 | 0.000028 | 0.000028 |\n| After create | 0.011363 | 0.000217 | 0.001571 |\n| query end | 0.000375 | 0.000013 | 0.000028 |\n| freeing items | 0.000089 | 0.000010 | 0.000014 |\n| logging slow query | 0.000019 | 0.000009 | 0.000010 |\n| cleaning up | 0.000005 | 0.000003 | 0.000002 |\n+----------------------+----------+----------+------------+\n7 rows in set (0.00 sec)\n','https://mariadb.com/kb/en/show-profile/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (488,26,'SHOW PROCEDURE CODE','Syntax:\nSHOW PROCEDURE CODE proc_name\n\nThis statement is a MySQL extension that is available only for servers\nthat have been built with debugging support. It displays a\nrepresentation of the internal implementation of the named stored\nprocedure. A similar statement, SHOW FUNCTION CODE, displays\ninformation about stored functions (see [HELP SHOW FUNCTION CODE]).\n\nBoth statements require that you be the owner of the routine or have\nSELECT access to the mysql.proc table.\n\nIf the named routine is available, each statement produces a result\nset. Each row in the result set corresponds to one "instruction" in the\nroutine. The first column is Pos, which is an ordinal number beginning\nwith 0. The second column is Instruction, which contains an SQL\nstatement (usually changed from the original source), or a directive\nwhich has meaning only to the stored-routine handler.\n\nURL: https://mariadb.com/kb/en/show-procedure-code/\n\n','MariaDB> DELIMITER //\nMariaDB> CREATE PROCEDURE p1 ()\n -> BEGIN\n -> DECLARE fanta INT DEFAULT 55;\n -> DROP TABLE t2;\n -> LOOP\n -> INSERT INTO t3 VALUES (fanta);\n -> END LOOP;\n -> END//\nQuery OK, 0 rows affected (0.00 sec)\n\nMariaDB> SHOW PROCEDURE CODE p1//\n+-----+----------------------------------------+\n| Pos | Instruction |\n+-----+----------------------------------------+\n| 0 | set fanta@0 55 |\n| 1 | stmt 9 "DROP TABLE t2" |\n| 2 | stmt 5 "INSERT INTO t3 VALUES (fanta)" |\n| 3 | jump 2 |\n+-----+----------------------------------------+\n4 rows in set (0.00 sec)\n','https://mariadb.com/kb/en/show-procedure-code/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (489,22,'MEDIUMTEXT','MEDIUMTEXT [CHARACTER SET charset_name] [COLLATE collation_name]\n\nA TEXT column with a maximum length of 16,777,215 (224 - 1) characters.\nThe effective maximum length is less if the value contains multi-byte\ncharacters. Each MEDIUMTEXT value is stored using a 3-byte length\nprefix that indicates the number of bytes in the value.\n\nURL: https://mariadb.com/kb/en/mediumtext/\n\n','','https://mariadb.com/kb/en/mediumtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (490,4,'LN','Syntax:\nLN(X)\n\nReturns the natural logarithm of X; that is, the base-e logarithm of X.\nIf X is less than or equal to 0, then NULL is returned.\n\nURL: https://mariadb.com/kb/en/ln/\n\n','MariaDB> SELECT LN(2);\n -> 0.69314718055995\nMariaDB> SELECT LN(-2);\n -> NULL\n','https://mariadb.com/kb/en/ln/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (491,23,'RETURN','Syntax:\nRETURN expr\n\nThe RETURN statement terminates execution of a stored function and\nreturns the value expr to the function caller. There must be at least\none RETURN statement in a stored function. There may be more than one\nif the function has multiple exit points.\n\nThis statement is not used in stored procedures, triggers, or events.\nThe LEAVE statement can be used to exit a stored program of those\ntypes.\n\nURL: https://mariadb.com/kb/en/return/\n\n','','https://mariadb.com/kb/en/return/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (492,26,'SHOW COLLATION','Syntax:\nSHOW COLLATION\n [LIKE \'pattern\' | WHERE expr]\n\nThis statement lists collations supported by the server. By default,\nthe output from SHOW COLLATION includes all available collations. The\nLIKE clause, if present, indicates which collation names to match. The\nWHERE clause can be given to select rows using more general conditions,\nas discussed in\nhttps://mariadb.com/kb/en/extended-show/. For example:\n\nMariaDB> SHOW COLLATION LIKE \'latin1%\';\n+-------------------+---------+----+---------+----------+---------+\n| Collation | Charset | Id | Default | Compiled | Sortlen |\n+-------------------+---------+----+---------+----------+---------+\n| latin1_german1_ci | latin1 | 5 | | | 0 |\n| latin1_swedish_ci | latin1 | 8 | Yes | Yes | 0 |\n| latin1_danish_ci | latin1 | 15 | | | 0 |\n| latin1_german2_ci | latin1 | 31 | | Yes | 2 |\n| latin1_bin | latin1 | 47 | | Yes | 0 |\n| latin1_general_ci | latin1 | 48 | | | 0 |\n| latin1_general_cs | latin1 | 49 | | | 0 |\n| latin1_spanish_ci | latin1 | 94 | | | 0 |\n+-------------------+---------+----+---------+----------+---------+\n\nURL: https://mariadb.com/kb/en/show-collation/\n\n','','https://mariadb.com/kb/en/show-collation/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (493,4,'LOG','Syntax:\nLOG(X), LOG(B,X)\n\nIf called with one parameter, this function returns the natural\nlogarithm of X. If X is less than or equal to 0, then NULL is returned.\n\nThe inverse of this function (when called with a single argument) is\nthe EXP() function.\n\nURL: https://mariadb.com/kb/en/log/\n\n','MariaDB> SELECT LOG(2);\n -> 0.69314718055995\nMariaDB> SELECT LOG(-2);\n -> NULL\n','https://mariadb.com/kb/en/log/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (494,8,'SET SQL_LOG_BIN','Syntax:\nSET sql_log_bin = {0|1}\n\nThe sql_log_bin variable controls whether logging to the binary log is\ndone. The default value is 1 (do logging). To change logging for the\ncurrent session, change the session value of this variable. The session\nuser must have the SUPER privilege to set this variable.\n\nBeginning with MySQL 5.5.5, it is no longer possible to set\n@@session.sql_log_bin within a transaction or subquery. (Bug #53437)\n\nURL: https://mariadb.com/kb/en/set-sql_log_bin/\n\n','','https://mariadb.com/kb/en/set-sql_log_bin/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (495,18,'!=','Syntax:\n<>, !=\n\nNot equal:\n\nURL: https://mariadb.com/kb/en/not-equal/\n\n','MariaDB> SELECT \'.01\' <> \'0.01\';\n -> 1\nMariaDB> SELECT .01 <> \'0.01\';\n -> 0\nMariaDB> SELECT \'zapp\' <> \'zappp\';\n -> 1\n','https://mariadb.com/kb/en/not-equal/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (496,23,'WHILE','Syntax:\n[begin_label:] WHILE search_condition DO\n statement_list\nEND WHILE [end_label]\n\nThe statement list within a WHILE statement is repeated as long as the\nsearch_condition expression is true. statement_list consists of one or\nmore SQL statements, each terminated by a semicolon (;) statement\ndelimiter.\n\nA WHILE statement can be labeled. For the rules regarding label use,\nsee [HELP labels].\n\nURL: https://mariadb.com/kb/en/while/\n\n','CREATE PROCEDURE dowhile()\nBEGIN\n DECLARE v1 INT DEFAULT 5;\n\n WHILE v1 > 0 DO\n ...\n SET v1 = v1 - 1;\n END WHILE;\nEND;\n','https://mariadb.com/kb/en/while/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (497,12,'AES_DECRYPT','Syntax:\nAES_DECRYPT(crypt_str,key_str)\n\nThis function decrypts data using the official AES (Advanced Encryption\nStandard) algorithm. For more information, see the description of\nAES_ENCRYPT().\n\nURL: https://mariadb.com/kb/en/aes_decrypt/\n\n','','https://mariadb.com/kb/en/aes_decrypt/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (498,31,'DAYNAME','Syntax:\nDAYNAME(date)\n\nReturns the name of the weekday for date. The language used for the\nname is controlled by the value of the lc_time_names system variable\n(https://mariadb.com/kb/en/server-system-variables#lc_time_names).\n\nURL: https://mariadb.com/kb/en/dayname/\n\n','MariaDB> SELECT DAYNAME(\'2007-02-03\');\n -> \'Saturday\'\n','https://mariadb.com/kb/en/dayname/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (499,17,'COERCIBILITY','Syntax:\nCOERCIBILITY(str)\n\nReturns the collation coercibility value of the string argument.\n\nURL: https://mariadb.com/kb/en/coercibility/\n\n','MariaDB> SELECT COERCIBILITY(\'abc\' COLLATE latin1_swedish_ci);\n -> 0\nMariaDB> SELECT COERCIBILITY(USER());\n -> 3\nMariaDB> SELECT COERCIBILITY(\'abc\');\n -> 4\n','https://mariadb.com/kb/en/coercibility/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (500,22,'INT','INT[(M)] [UNSIGNED] [ZEROFILL]\n\nA normal-size integer. The signed range is -2147483648 to 2147483647.\nThe unsigned range is 0 to 4294967295.\n\nURL: https://mariadb.com/kb/en/int/\n\n','','https://mariadb.com/kb/en/int/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (501,13,'GLENGTH','GLength(ls)\n\nReturns as a double-precision number the length of the LineString value\nls in its associated spatial reference.\n\nURL: https://mariadb.com/kb/en/glength/\n\n','MariaDB> SET @ls = \'LineString(1 1,2 2,3 3)\';\nMariaDB> SELECT GLength(GeomFromText(@ls));\n+----------------------------+\n| GLength(GeomFromText(@ls)) |\n+----------------------------+\n| 2.8284271247462 |\n+----------------------------+\n','https://mariadb.com/kb/en/glength/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (502,4,'RADIANS','Syntax:\nRADIANS(X)\n\nReturns the argument X, converted from degrees to radians. (Note that\nπ radians equals 180 degrees.)\n\nURL: https://mariadb.com/kb/en/radians/\n\n','MariaDB> SELECT RADIANS(90);\n -> 1.5707963267949\n','https://mariadb.com/kb/en/radians/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (503,17,'COLLATION','Syntax:\nCOLLATION(str)\n\nReturns the collation of the string argument.\n\nURL: https://mariadb.com/kb/en/collation/\n\n','MariaDB> SELECT COLLATION(\'abc\');\n -> \'latin1_swedish_ci\'\nMariaDB> SELECT COLLATION(_utf8\'abc\');\n -> \'utf8_general_ci\'\n','https://mariadb.com/kb/en/collation/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (504,18,'COALESCE','Syntax:\nCOALESCE(value,...)\n\nReturns the first non-NULL value in the list, or NULL if there are no\nnon-NULL values.\n\nURL: https://mariadb.com/kb/en/coalesce/\n\n','MariaDB> SELECT COALESCE(NULL,1);\n -> 1\nMariaDB> SELECT COALESCE(NULL,NULL,NULL);\n -> NULL\n','https://mariadb.com/kb/en/coalesce/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (505,17,'VERSION','Syntax:\nVERSION()\n\nReturns a string that indicates the MySQL server version. The string\nuses the utf8 character set. The value might have a suffix in addition\nto the version number. See the description of the version system\nvariable in\nhttps://mariadb.com/kb/en/server-system-variables#version.\n\nURL: https://mariadb.com/kb/en/version/\n\n','MariaDB> SELECT VERSION();\n -> \'5.5.29-standard\'\n','https://mariadb.com/kb/en/version/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (506,37,'MAKE_SET','Syntax:\nMAKE_SET(bits,str1,str2,...)\n\nReturns a set value (a string containing substrings separated by ","\ncharacters) consisting of the strings that have the corresponding bit\nin bits set. str1 corresponds to bit 0, str2 to bit 1, and so on. NULL\nvalues in str1, str2, ... are not appended to the result.\n\nURL: https://mariadb.com/kb/en/make_set/\n\n','MariaDB> SELECT MAKE_SET(1,\'a\',\'b\',\'c\');\n -> \'a\'\nMariaDB> SELECT MAKE_SET(1 | 4,\'hello\',\'nice\',\'world\');\n -> \'hello,world\'\nMariaDB> SELECT MAKE_SET(1 | 4,\'hello\',\'nice\',NULL,\'world\');\n -> \'hello\'\nMariaDB> SELECT MAKE_SET(0,\'a\',\'b\',\'c\');\n -> \'\'\n','https://mariadb.com/kb/en/make_set/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (507,37,'FIND_IN_SET','Syntax:\nFIND_IN_SET(str,strlist)\n\nReturns a value in the range of 1 to N if the string str is in the\nstring list strlist consisting of N substrings. A string list is a\nstring composed of substrings separated by "," characters. If the first\nargument is a constant string and the second is a column of type SET,\nthe FIND_IN_SET() function is optimized to use bit arithmetic. Returns\n0 if str is not in strlist or if strlist is the empty string. Returns\nNULL if either argument is NULL. This function does not work properly\nif the first argument contains a comma (",") character.\n\nURL: https://mariadb.com/kb/en/find_in_set/\n\n','MariaDB> SELECT FIND_IN_SET(\'b\',\'a,b,c,d\');\n -> 2\n','https://mariadb.com/kb/en/find_in_set/');
insert into help_keyword (help_keyword_id,name) values (0,'JOIN');
insert into help_keyword (help_keyword_id,name) values (1,'HOST');
@@ -2072,4 +2073,3 @@ insert into help_relation (help_topic_id,help_keyword_id) values (209,461);
insert into help_relation (help_topic_id,help_keyword_id) values (468,461);
insert into help_relation (help_topic_id,help_keyword_id) values (201,462);
insert into help_relation (help_topic_id,help_keyword_id) values (468,463);
-
diff --git a/scripts/mysql_install_db.pl.in b/scripts/mysql_install_db.pl.in
index 8a3492c8756..d1c4aaa1906 100644
--- a/scripts/mysql_install_db.pl.in
+++ b/scripts/mysql_install_db.pl.in
@@ -428,6 +428,7 @@ my $mysqld_install_cmd_line = quote_options($mysqld_bootstrap,
"--max_allowed_packet=8M",
"--default-storage-engine=MyISAM",
"--net_buffer_length=16K",
+ "--enforce-storage-engine=\"\"",
@args,
);
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index 15750ff5e90..967e7648f0c 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -417,7 +417,7 @@ mysqld_bootstrap="${MYSQLD_BOOTSTRAP-$mysqld}"
mysqld_install_cmd_line()
{
"$mysqld_bootstrap" $defaults "$mysqld_opt" --bootstrap \
- "--basedir=$basedir" "--datadir=$ldata" --log-warnings=0 \
+ "--basedir=$basedir" "--datadir=$ldata" --log-warnings=0 --enforce-storage-engine="" \
$args --max_allowed_packet=8M \
--net_buffer_length=16K
}
diff --git a/scripts/mysql_secure_installation.sh b/scripts/mysql_secure_installation.sh
index 8eca327028e..d91e31cda48 100644
--- a/scripts/mysql_secure_installation.sh
+++ b/scripts/mysql_secure_installation.sh
@@ -25,6 +25,9 @@ echo_n=
echo_c=
basedir=
bindir=
+defaults_file=
+defaults_extra_file=
+no_defaults=
parse_arg()
{
@@ -47,8 +50,9 @@ parse_arguments()
do
case "$arg" in
--basedir=*) basedir=`parse_arg "$arg"` ;;
- --no-defaults|--defaults-file=*|--defaults-extra-file=*)
- defaults="$arg" ;;
+ --defaults-file=*) defaults_file="$arg" ;;
+ --defaults-extra-file=*) defaults_extra_file="$arg" ;;
+ --no-defaults) no_defaults="$arg" ;;
*)
if test -n "$pick_args"
then
@@ -167,7 +171,7 @@ fi
# Now we can get arguments from the group [client] and [client-server]
# in the my.cfg file, then re-run to merge with command line arguments.
-parse_arguments `$print_defaults $defaults client client-server client-mariadb`
+parse_arguments `$print_defaults $defaults_file $defaults_extra_file $no_defaults client client-server client-mariadb`
parse_arguments PICK-ARGS-FROM-ARGV "$@"
# Configure paths to support files
@@ -204,7 +208,7 @@ prepare() {
do_query() {
echo "$1" >$command
#sed 's,^,> ,' < $command # Debugging
- $mysql_command --defaults-file=$config <$command
+ $mysql_command --defaults-file=$config $defaults_extra_file $no_defaults $args <$command
return $?
}
@@ -228,6 +232,10 @@ basic_single_escape () {
echo "$1" | sed 's/\(['"'"'\]\)/\\\1/g'
}
+#
+# create a simple my.cnf file to be able to pass the root password to the mysql
+# client without putting it on the command line
+#
make_config() {
echo "# mysql_secure_installation config file" >$config
echo "[mysql]" >>$config
@@ -235,6 +243,12 @@ make_config() {
esc_pass=`basic_single_escape "$rootpass"`
echo "password='$esc_pass'" >>$config
#sed 's,^,> ,' < $config # Debugging
+
+ if test -n "$defaults_file"
+ then
+ dfile=`parse_arg "$defaults_file"`
+ cat "$dfile" >>$config
+ fi
}
get_root_password() {
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index a98abe6629b..c96fc4567f0 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -30,6 +30,7 @@ user='@MYSQLD_USER@'
pid_file=
err_log=
err_log_base=
+skip_err_log=0
syslog_tag_mysqld=mysqld
syslog_tag_mysqld_safe=mysqld_safe
@@ -292,7 +293,14 @@ parse_arguments() {
# these might have been set in a [mysqld_safe] section of my.cnf
# they are added to mysqld command line to override settings from my.cnf
- --log[-_]error=*) err_log="$val" ;;
+ --skip[-_]log[-_]error)
+ err_log=;
+ skip_err_log=1;
+ ;;
+ --log[-_]error=*)
+ err_log="$val";
+ skip_err_log=0;
+ ;;
--port=*) mysql_tcp_port="$val" ;;
--socket=*) mysql_unix_port="$val" ;;
@@ -649,6 +657,11 @@ then
fi
fi
+if [ $skip_err_log -eq 1 ]
+then
+ append_arg_to_args "--skip-log-error"
+fi
+
if [ -n "$err_log" -o $want_syslog -eq 0 ]
then
if [ -n "$err_log" ]
diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh
index d30ca0773f9..78060f70ca5 100644
--- a/scripts/wsrep_sst_common.sh
+++ b/scripts/wsrep_sst_common.sh
@@ -105,13 +105,39 @@ done
readonly WSREP_SST_OPT_BYPASS
readonly WSREP_SST_OPT_BINLOG
+# try to use my_print_defaults, mysql and mysqldump that come with the sources
+# (for MTR suite)
+SCRIPTS_DIR="$(cd $(dirname "$0"); pwd -P)"
+EXTRA_DIR="$SCRIPTS_DIR/../extra"
+CLIENT_DIR="$SCRIPTS_DIR/../client"
+
+if [ -x "$CLIENT_DIR/mysql" ]; then
+ MYSQL_CLIENT="$CLIENT_DIR/mysql"
+else
+ MYSQL_CLIENT=$(which mysql)
+fi
+
+if [ -x "$CLIENT_DIR/mysqldump" ]; then
+ MYSQLDUMP="$CLIENT_DIR/mysqldump"
+else
+ MYSQLDUMP=$(which mysqldump)
+fi
+
+if [ -x "$SCRIPTS_DIR/my_print_defaults" ]; then
+ MY_PRINT_DEFAULTS="$SCRIPTS_DIR/my_print_defaults"
+elif [ -x "$EXTRA_DIR/my_print_defaults" ]; then
+ MY_PRINT_DEFAULTS="$EXTRA_DIR/my_print_defaults"
+else
+ MY_PRINT_DEFAULTS=$(which my_print_defaults)
+fi
+
readonly WSREP_SST_OPT_CONF="$WSREP_SST_OPT_DEFAULT $WSREP_SST_OPT_EXTRA_DEFAULT"
-readonly my_print_defaults="my_print_defaults $WSREP_SST_OPT_CONF"
+MY_PRINT_DEFAULTS="$MY_PRINT_DEFAULTS $WSREP_SST_OPT_CONF"
# State Snapshot Transfer authentication password was displayed in the ps output. Bug fixed #1200727.
-if $my_print_defaults sst | grep -q "wsrep_sst_auth";then
+if $MY_PRINT_DEFAULTS sst | grep -q "wsrep_sst_auth";then
if [ -z "$WSREP_SST_OPT_AUTH" -o "$WSREP_SST_OPT_AUTH" = "(null)" ];then
- WSREP_SST_OPT_AUTH=$($my_print_defaults sst | grep -- "--wsrep_sst_auth" | cut -d= -f2)
+ WSREP_SST_OPT_AUTH=$($MY_PRINT_DEFAULTS sst | grep -- "--wsrep_sst_auth" | cut -d= -f2)
fi
fi
@@ -128,7 +154,7 @@ wsrep_log()
# echo everything to stderr so that it gets into common error log
# deliberately made to look different from the rest of the log
local readonly tst="$(date +%Y%m%d\ %H:%M:%S.%N | cut -b -21)"
- echo "$tst WSREP_SST: " >&2
+ echo "WSREP_SST: $* ($tst)" >&2
}
wsrep_log_error()
diff --git a/scripts/wsrep_sst_mysqldump.sh b/scripts/wsrep_sst_mysqldump.sh
index d7fb6756663..a05e42f31b3 100644
--- a/scripts/wsrep_sst_mysqldump.sh
+++ b/scripts/wsrep_sst_mysqldump.sh
@@ -57,9 +57,9 @@ then
fi
# Check client version
-if ! mysql --version | grep 'Distrib 10' >/dev/null
+if ! $MYSQL_CLIENT --version | grep 'Distrib 10.1' >/dev/null
then
- mysql --version >&2
+ $MYSQL_CLIENT --version >&2
wsrep_log_error "this operation requires MySQL client version 10 or newer"
exit $EINVAL
fi
@@ -109,10 +109,10 @@ fi
# Retrieve the donor's @@global.gtid_binlog_state.
GTID_BINLOG_STATE=$(echo "SHOW GLOBAL VARIABLES LIKE 'gtid_binlog_state'" |\
-mysql $AUTH -S$WSREP_SST_OPT_SOCKET --disable-reconnect --connect_timeout=10 |\
+$MYSQL_CLIENT $AUTH -S$WSREP_SST_OPT_SOCKET --disable-reconnect --connect_timeout=10 |\
tail -1 | awk -F ' ' '{ print $2 }')
-MYSQL="mysql $AUTH -h$WSREP_SST_OPT_HOST -P$WSREP_SST_OPT_PORT "\
+MYSQL="$MYSQL_CLIENT $AUTH -h$WSREP_SST_OPT_HOST -P$WSREP_SST_OPT_PORT "\
"--disable-reconnect --connect_timeout=10"
# Check if binary logging is enabled on the joiner node.
@@ -144,7 +144,7 @@ then
fi
# NOTE: we don't use --routines here because we're dumping mysql.proc table
-MYSQLDUMP="mysqldump $AUTH -S$WSREP_SST_OPT_SOCKET \
+MYSQLDUMP="$MYSQLDUMP $AUTH -S$WSREP_SST_OPT_SOCKET \
--add-drop-database --add-drop-table --skip-add-locks --create-options \
--disable-keys --extended-insert --skip-lock-tables --quick --set-charset \
--skip-comments --flush-privileges --all-databases"
diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh
index 576ce212261..ee63fe04fe7 100644
--- a/scripts/wsrep_sst_rsync.sh
+++ b/scripts/wsrep_sst_rsync.sh
@@ -92,7 +92,7 @@ fi
WSREP_LOG_DIR=${WSREP_LOG_DIR:-""}
# if WSREP_LOG_DIR env. variable is not set, try to get it from my.cnf
if [ -z "$WSREP_LOG_DIR" ]; then
- WSREP_LOG_DIR=$($my_print_defaults --mysqld \
+ WSREP_LOG_DIR=$($MY_PRINT_DEFAULTS --mysqld \
| grep -- '--innodb[-_]log[-_]group[-_]home[-_]dir=' \
| cut -b 29- )
fi
diff --git a/scripts/wsrep_sst_xtrabackup-v2.sh b/scripts/wsrep_sst_xtrabackup-v2.sh
index 3b4efb2422f..bba187ed2f9 100644
--- a/scripts/wsrep_sst_xtrabackup-v2.sh
+++ b/scripts/wsrep_sst_xtrabackup-v2.sh
@@ -117,7 +117,7 @@ get_keys()
fi
if [[ $encrypt -eq 0 ]];then
- if $my_print_defaults xtrabackup | grep -q encrypt;then
+ if $MY_PRINT_DEFAULTS xtrabackup | grep -q encrypt;then
wsrep_log_error "Unexpected option combination. SST may fail. Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html "
fi
return
@@ -230,7 +230,7 @@ parse_cnf()
{
local group=$1
local var=$2
- reval=$($my_print_defaults $group | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2-)
+ reval=$($MY_PRINT_DEFAULTS $group | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2-)
if [[ -z $reval ]];then
[[ -n $3 ]] && reval=$3
fi
@@ -241,7 +241,7 @@ get_footprint()
{
pushd $WSREP_SST_OPT_DATA 1>/dev/null
payload=$(find . -regex '.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' -type f -print0 | du --files0-from=- --block-size=1 -c | awk 'END { print $1 }')
- if $my_print_defaults xtrabackup | grep -q -- "--compress";then
+ if $MY_PRINT_DEFAULTS xtrabackup | grep -q -- "--compress";then
# QuickLZ has around 50% compression ratio
# When compression/compaction used, the progress is only an approximate.
payload=$(( payload*1/2 ))
@@ -282,7 +282,7 @@ read_cnf()
progress=$(parse_cnf sst progress "")
rebuild=$(parse_cnf sst rebuild 0)
ttime=$(parse_cnf sst time 0)
- cpat=$(parse_cnf sst cpat '.*galera\.cache$\|.*sst_in_progress$\|.*grastate\.dat$\|.*\.err$\|.*\.log$\|.*RPM_UPGRADE_MARKER$\|.*RPM_UPGRADE_HISTORY$')
+ cpat=$(parse_cnf sst cpat '.*galera\.cache$\|.*sst_in_progress$\|.*grastate\.dat$\|.*gvwstate\.dat$\|.*\.err$\|.*\.log$\|.*RPM_UPGRADE_MARKER$\|.*RPM_UPGRADE_HISTORY$')
incremental=$(parse_cnf sst incremental 0)
ealgo=$(parse_cnf xtrabackup encrypt "")
ekey=$(parse_cnf xtrabackup encrypt-key "")
@@ -443,8 +443,8 @@ check_extra()
{
local use_socket=1
if [[ $uextra -eq 1 ]];then
- if $my_print_defaults --mysqld | tr '_' '-' | grep -- "--thread-handling=" | grep -q 'pool-of-threads';then
- local eport=$($my_print_defaults --mysqld | tr '_' '-' | grep -- "--extra-port=" | cut -d= -f2)
+ if $MY_PRINT_DEFAULTS --mysqld | tr '_' '-' | grep -- "--thread-handling=" | grep -q 'pool-of-threads';then
+ local eport=$($MY_PRINT_DEFAULTS --mysqld | tr '_' '-' | grep -- "--extra-port=" | cut -d= -f2)
if [[ -n $eport ]];then
# Xtrabackup works only locally.
# Hence, setting host to 127.0.0.1 unconditionally.
@@ -550,7 +550,7 @@ setup_ports
get_stream
get_transfer
-if ${INNOBACKUPEX_BIN} /tmp --help | grep -q -- '--version-check'; then
+if ${INNOBACKUPEX_BIN} /tmp --help | grep -- '--version-check' >/dev/null ; then
disver="--no-version-check"
fi
@@ -790,6 +790,7 @@ then
wsrep_log_info "Cleaning the binlog directory $binlog_dir as well"
find $binlog_dir -maxdepth 1 -type f -regex $pattern -exec rm -fv {} 1>&2 \+
rm $binlog_dir/*.index || true
+ rm $binlog_dir/*.state || true
fi
fi
@@ -875,7 +876,7 @@ then
mv $DATA/${BINLOG_FILENAME}.* $BINLOG_DIRNAME/ 2>/dev/null || true
pushd $BINLOG_DIRNAME &>/dev/null
- for bfiles in $(ls -1 ${BINLOG_FILENAME}.*);do
+ for bfiles in $(ls -1 ${BINLOG_FILENAME}.[0-9]*);do
echo ${BINLOG_DIRNAME}/${bfiles} >> ${BINLOG_FILENAME}.index
done
popd &> /dev/null
diff --git a/scripts/wsrep_sst_xtrabackup.sh b/scripts/wsrep_sst_xtrabackup.sh
index 131eda765de..4b22c227dd5 100644
--- a/scripts/wsrep_sst_xtrabackup.sh
+++ b/scripts/wsrep_sst_xtrabackup.sh
@@ -100,7 +100,7 @@ get_keys()
fi
if [[ $encrypt -eq 0 ]];then
- if $my_print_defaults xtrabackup | grep -q encrypt;then
+ if $MY_PRINT_DEFAULTS xtrabackup | grep -q encrypt;then
wsrep_log_error "Unexpected option combination. SST may fail. Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html "
fi
return
@@ -195,7 +195,7 @@ parse_cnf()
{
local group=$1
local var=$2
- reval=$($my_print_defaults $group | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2-)
+ reval=$($MY_PRINT_DEFAULTS $group | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2-)
if [[ -z $reval ]];then
[[ -n $3 ]] && reval=$3
fi
@@ -206,7 +206,7 @@ get_footprint()
{
pushd $WSREP_SST_OPT_DATA 1>/dev/null
payload=$(find . -regex '.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' -type f -print0 | du --files0-from=- --block-size=1 -c | awk 'END { print $1 }')
- if $my_print_defaults xtrabackup | grep -q -- "--compress";then
+ if $MY_PRINT_DEFAULTS xtrabackup | grep -q -- "--compress";then
# QuickLZ has around 50% compression ratio
# When compression/compaction used, the progress is only an approximate.
payload=$(( payload*1/2 ))
@@ -385,8 +385,8 @@ check_extra()
{
local use_socket=1
if [[ $uextra -eq 1 ]];then
- if $my_print_defaults --mysqld | tr '_' '-' | grep -- "--thread-handling=" | grep -q 'pool-of-threads';then
- local eport=$($my_print_defaults --mysqld | tr '_' '-' | grep -- "--extra-port=" | cut -d= -f2)
+ if $MY_PRINT_DEFAULTS --mysqld | tr '_' '-' | grep -- "--thread-handling=" | grep -q 'pool-of-threads';then
+ local eport=$($MY_PRINT_DEFAULTS --mysqld | tr '_' '-' | grep -- "--extra-port=" | cut -d= -f2)
if [[ -n $eport ]];then
# Xtrabackup works only locally.
# Hence, setting host to 127.0.0.1 unconditionally.
diff --git a/sql-common/client.c b/sql-common/client.c
index 3816a4ea135..609eef5d8b7 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1848,6 +1848,7 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) ,
mysql_options(mysql, MYSQL_OPT_SSL_CAPATH, capath) |
mysql_options(mysql, MYSQL_OPT_SSL_CIPHER, cipher) ?
1 : 0);
+ mysql->options.use_ssl= TRUE;
#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */
DBUG_RETURN(result);
}
@@ -2652,16 +2653,10 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio,
mysql->client_flag|= CLIENT_MULTI_RESULTS;
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
- if (mysql->options.ssl_key || mysql->options.ssl_cert ||
- mysql->options.ssl_ca || mysql->options.ssl_capath ||
- mysql->options.ssl_cipher ||
- (mysql->options.extension &&
- (mysql->options.extension->ssl_crl ||
- mysql->options.extension->ssl_crlpath)))
- mysql->options.use_ssl= 1;
if (mysql->options.use_ssl)
mysql->client_flag|= CLIENT_SSL;
#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY*/
+
if (mpvio->db)
mysql->client_flag|= CLIENT_CONNECT_WITH_DB;
@@ -2690,6 +2685,23 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio,
end= buff+5;
}
#ifdef HAVE_OPENSSL
+
+ /*
+ If client uses ssl and client also has to verify the server
+ certificate, a ssl connection is required.
+ If the server does not support ssl, we abort the connection.
+ */
+ if (mysql->options.use_ssl &&
+ (mysql->client_flag & CLIENT_SSL_VERIFY_SERVER_CERT) &&
+ !(mysql->server_capabilities & CLIENT_SSL))
+ {
+ set_mysql_extended_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate,
+ ER(CR_SSL_CONNECTION_ERROR),
+ "SSL is required, but the server does not "
+ "support it");
+ goto error;
+ }
+
if (mysql->client_flag & CLIENT_SSL)
{
/* Do the SSL layering. */
@@ -3539,7 +3551,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
if (mysql->options.extension && mysql->options.extension->async_context)
net->vio->async_context= mysql->options.extension->async_context;
- if (my_net_init(net, net->vio, MYF(0)))
+ if (my_net_init(net, net->vio, 0, MYF(0)))
{
vio_delete(net->vio);
net->vio = 0;
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index 6a011df795a..28757a2c96c 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -1314,16 +1314,8 @@ int number_to_time(my_bool neg, ulonglong nr, ulong sec_part,
MYSQL_TIME *ltime, int *was_cut)
{
if (nr > 9999999 && nr < 99991231235959ULL && neg == 0)
- {
- if (number_to_datetime(nr, sec_part, ltime,
- TIME_INVALID_DATES, was_cut) < 0)
- return -1;
-
- ltime->year= ltime->month= ltime->day= 0;
- ltime->time_type= MYSQL_TIMESTAMP_TIME;
- *was_cut= MYSQL_TIME_NOTE_TRUNCATED;
- return 0;
- }
+ return number_to_datetime(nr, sec_part, ltime,
+ TIME_INVALID_DATES, was_cut) < 0 ? -1 : 0;
*was_cut= 0;
ltime->year= ltime->month= ltime->day= 0;
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index 2eb65837992..033a0e04ccf 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -28,6 +28,7 @@ IF(WITH_WSREP AND NOT EMBEDDED_LIBRARY)
wsrep_binlog.cc
wsrep_applier.cc
wsrep_thd.cc
+ wsrep_xid.cc
)
SET(WSREP_LIB wsrep)
ELSE()
@@ -82,7 +83,7 @@ SET (SQL_SOURCE
filesort_utils.cc
filesort.cc gstream.cc sha2.cc
signal_handler.cc
- handler.cc hash_filo.h sql_plugin_services.h
+ handler.cc hash_filo.h
hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc
item_create.cc item_func.cc item_geofunc.cc item_row.cc
item_strfunc.cc item_subselect.cc item_sum.cc item_timefunc.cc
diff --git a/sql/create_options.cc b/sql/create_options.cc
index c3796710f78..66515be05b8 100644
--- a/sql/create_options.cc
+++ b/sql/create_options.cc
@@ -88,7 +88,7 @@ static bool report_wrong_value(THD *thd, const char *name, const char *val,
}
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_BAD_OPTION_VALUE,
- ER(ER_BAD_OPTION_VALUE), val, name);
+ ER_THD(thd, ER_BAD_OPTION_VALUE), val, name);
return 0;
}
@@ -111,7 +111,8 @@ static bool report_unknown_option(THD *thd, engine_option_value *val,
}
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_UNKNOWN_OPTION, ER(ER_UNKNOWN_OPTION), val->name.str);
+ ER_UNKNOWN_OPTION, ER_THD(thd, ER_UNKNOWN_OPTION),
+ val->name.str);
DBUG_RETURN(FALSE);
}
diff --git a/sql/debug_sync.cc b/sql/debug_sync.cc
index 2ace83ca751..8b3412eb732 100644
--- a/sql/debug_sync.cc
+++ b/sql/debug_sync.cc
@@ -1451,7 +1451,8 @@ static void debug_sync_execute(THD *thd, st_debug_sync_action *action)
const bool save_abort_on_warning= thd->abort_on_warning;
thd->abort_on_warning= false;
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_DEBUG_SYNC_TIMEOUT, ER(ER_DEBUG_SYNC_TIMEOUT));
+ ER_DEBUG_SYNC_TIMEOUT,
+ ER_THD(thd, ER_DEBUG_SYNC_TIMEOUT));
thd->abort_on_warning= save_abort_on_warning;
DBUG_EXECUTE_IF("debug_sync_abort_on_timeout", DBUG_ABORT(););
break;
diff --git a/sql/derror.cc b/sql/derror.cc
index 7ac068300f9..bc4b89493aa 100644
--- a/sql/derror.cc
+++ b/sql/derror.cc
@@ -244,20 +244,20 @@ static void init_myfunc_errs()
init_glob_errs(); /* Initiate english errors */
if (!(specialflag & SPECIAL_ENGLISH))
{
- EE(EE_FILENOTFOUND) = ER(ER_FILE_NOT_FOUND);
- EE(EE_CANTCREATEFILE) = ER(ER_CANT_CREATE_FILE);
- EE(EE_READ) = ER(ER_ERROR_ON_READ);
- EE(EE_WRITE) = ER(ER_ERROR_ON_WRITE);
- EE(EE_BADCLOSE) = ER(ER_ERROR_ON_CLOSE);
- EE(EE_OUTOFMEMORY) = ER(ER_OUTOFMEMORY);
- EE(EE_DELETE) = ER(ER_CANT_DELETE_FILE);
- EE(EE_LINK) = ER(ER_ERROR_ON_RENAME);
- EE(EE_EOFERR) = ER(ER_UNEXPECTED_EOF);
- EE(EE_CANTLOCK) = ER(ER_CANT_LOCK);
- EE(EE_DIR) = ER(ER_CANT_READ_DIR);
- EE(EE_STAT) = ER(ER_CANT_GET_STAT);
- EE(EE_GETWD) = ER(ER_CANT_GET_WD);
- EE(EE_SETWD) = ER(ER_CANT_SET_WD);
- EE(EE_DISK_FULL) = ER(ER_DISK_FULL);
+ EE(EE_FILENOTFOUND) = ER_DEFAULT(ER_FILE_NOT_FOUND);
+ EE(EE_CANTCREATEFILE) = ER_DEFAULT(ER_CANT_CREATE_FILE);
+ EE(EE_READ) = ER_DEFAULT(ER_ERROR_ON_READ);
+ EE(EE_WRITE) = ER_DEFAULT(ER_ERROR_ON_WRITE);
+ EE(EE_BADCLOSE) = ER_DEFAULT(ER_ERROR_ON_CLOSE);
+ EE(EE_OUTOFMEMORY) = ER_DEFAULT(ER_OUTOFMEMORY);
+ EE(EE_DELETE) = ER_DEFAULT(ER_CANT_DELETE_FILE);
+ EE(EE_LINK) = ER_DEFAULT(ER_ERROR_ON_RENAME);
+ EE(EE_EOFERR) = ER_DEFAULT(ER_UNEXPECTED_EOF);
+ EE(EE_CANTLOCK) = ER_DEFAULT(ER_CANT_LOCK);
+ EE(EE_DIR) = ER_DEFAULT(ER_CANT_READ_DIR);
+ EE(EE_STAT) = ER_DEFAULT(ER_CANT_GET_STAT);
+ EE(EE_GETWD) = ER_DEFAULT(ER_CANT_GET_WD);
+ EE(EE_SETWD) = ER_DEFAULT(ER_CANT_SET_WD);
+ EE(EE_DISK_FULL) = ER_DEFAULT(ER_DISK_FULL);
}
}
diff --git a/sql/encryption.cc b/sql/encryption.cc
index 520eb8b898f..209b092b0a4 100644
--- a/sql/encryption.cc
+++ b/sql/encryption.cc
@@ -19,37 +19,27 @@
#include "sql_plugin.h"
#include <my_crypt.h>
-void init_io_cache_encryption();
-
/* there can be only one encryption plugin enabled */
static plugin_ref encryption_manager= 0;
struct encryption_service_st encryption_handler;
-unsigned int has_key_id(uint id)
-{
- return encryption_key_get_latest_version(id) != ENCRYPTION_KEY_VERSION_INVALID;
-}
-
-unsigned int has_key_version(uint id, uint version)
-{
- uint unused;
- return encryption_key_get(id, version, NULL, &unused) != ENCRYPTION_KEY_VERSION_INVALID;
-}
-
uint no_key(uint)
{
return ENCRYPTION_KEY_VERSION_INVALID;
}
-static int no_crypt(const uchar* source, uint source_length,
- uchar* dest, uint* dest_length,
- const uchar* key, uint key_length,
- const uchar* iv, uint iv_length,
- int no_padding, uint key_id, uint key_version)
+static int ctx_init(void *ctx, const unsigned char* key, unsigned int klen,
+ const unsigned char* iv, unsigned int ivlen, int flags,
+ unsigned int key_id, unsigned int key_version)
{
- return 1;
+ return my_aes_crypt_init(ctx, MY_AES_CBC, flags, key, klen, iv, ivlen);
}
+static unsigned int get_length(unsigned int slen, unsigned int key_id,
+ unsigned int key_version)
+{
+ return my_aes_get_size(MY_AES_CBC, slen);
+}
int initialize_encryption_plugin(st_plugin_int *plugin)
{
@@ -67,13 +57,21 @@ int initialize_encryption_plugin(st_plugin_int *plugin)
st_mariadb_encryption *handle=
(struct st_mariadb_encryption*) plugin->plugin->info;
- encryption_handler.encryption_encrypt_func=
- handle->encrypt ? handle->encrypt
- : (encrypt_decrypt_func)my_aes_encrypt_cbc;
+ encryption_handler.encryption_ctx_size_func=
+ handle->crypt_ctx_size ? handle->crypt_ctx_size :
+ (uint (*)(unsigned int, unsigned int))my_aes_ctx_size;
+
+ encryption_handler.encryption_ctx_init_func=
+ handle->crypt_ctx_init ? handle->crypt_ctx_init : ctx_init;
- encryption_handler.encryption_decrypt_func=
- handle->decrypt ? handle->decrypt
- : (encrypt_decrypt_func)my_aes_decrypt_cbc;
+ encryption_handler.encryption_ctx_update_func=
+ handle->crypt_ctx_update ? handle->crypt_ctx_update : my_aes_crypt_update;
+
+ encryption_handler.encryption_ctx_finish_func=
+ handle->crypt_ctx_finish ? handle->crypt_ctx_finish : my_aes_crypt_finish;
+
+ encryption_handler.encryption_encrypted_length_func=
+ handle->encrypted_length ? handle->encrypted_length : get_length;
encryption_handler.encryption_key_get_func=
handle->get_key;
@@ -81,17 +79,11 @@ int initialize_encryption_plugin(st_plugin_int *plugin)
encryption_handler.encryption_key_get_latest_version_func=
handle->get_latest_key_version; // must be the last
- init_io_cache_encryption();
-
return 0;
}
int finalize_encryption_plugin(st_plugin_int *plugin)
{
- encryption_handler.encryption_encrypt_func= no_crypt;
- encryption_handler.encryption_decrypt_func= no_crypt;
- encryption_handler.encryption_key_id_exists_func= has_key_id;
- encryption_handler.encryption_key_version_exists_func= has_key_version;
encryption_handler.encryption_key_get_func=
(uint (*)(uint, uint, uchar*, uint*))no_key;
encryption_handler.encryption_key_get_latest_version_func= no_key;
@@ -104,7 +96,6 @@ int finalize_encryption_plugin(st_plugin_int *plugin)
if (encryption_manager)
plugin_unlock(NULL, encryption_manager);
encryption_manager= 0;
- init_io_cache_encryption();
return 0;
}
@@ -144,8 +135,9 @@ static uint scheme_get_key(st_encryption_scheme *scheme,
goto ret;
/* Now generate the local key by encrypting IV using the global key */
- rc = my_aes_encrypt_ecb(scheme->iv, sizeof(scheme->iv), key->key, &key_len,
- global_key, global_key_len, NULL, 0, 1);
+ rc = my_aes_crypt(MY_AES_ECB, ENCRYPTION_FLAG_ENCRYPT | ENCRYPTION_FLAG_NOPAD,
+ scheme->iv, sizeof(scheme->iv), key->key, &key_len,
+ global_key, global_key_len, NULL, 0);
DBUG_ASSERT(key_len == sizeof(key->key));
@@ -169,7 +161,7 @@ int do_crypt(const unsigned char* src, unsigned int slen,
struct st_encryption_scheme *scheme,
unsigned int key_version, unsigned int i32_1,
unsigned int i32_2, unsigned long long i64,
- encrypt_decrypt_func crypt)
+ int flag)
{
compile_time_assert(ENCRYPTION_SCHEME_KEY_INVALID ==
(int)ENCRYPTION_KEY_VERSION_INVALID);
@@ -197,8 +189,8 @@ int do_crypt(const unsigned char* src, unsigned int slen,
int4store(iv + 4, i32_2);
int8store(iv + 8, i64);
- return crypt(src, slen, dst, dlen, key.key, sizeof(key.key),
- iv, sizeof(iv), 1, scheme->key_id, key_version);
+ return encryption_crypt(src, slen, dst, dlen, key.key, sizeof(key.key),
+ iv, sizeof(iv), flag, scheme->key_id, key_version);
}
int encryption_scheme_encrypt(const unsigned char* src, unsigned int slen,
@@ -208,7 +200,7 @@ int encryption_scheme_encrypt(const unsigned char* src, unsigned int slen,
unsigned int i32_2, unsigned long long i64)
{
return do_crypt(src, slen, dst, dlen, scheme, key_version, i32_1,
- i32_2, i64, encryption_handler.encryption_encrypt_func);
+ i32_2, i64, ENCRYPTION_FLAG_NOPAD | ENCRYPTION_FLAG_ENCRYPT);
}
@@ -219,5 +211,5 @@ int encryption_scheme_decrypt(const unsigned char* src, unsigned int slen,
unsigned int i32_2, unsigned long long i64)
{
return do_crypt(src, slen, dst, dlen, scheme, key_version, i32_1,
- i32_2, i64, encryption_handler.encryption_decrypt_func);
+ i32_2, i64, ENCRYPTION_FLAG_NOPAD | ENCRYPTION_FLAG_DECRYPT);
}
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc
index 571652de861..9e1ee6f30f9 100644
--- a/sql/event_data_objects.cc
+++ b/sql/event_data_objects.cc
@@ -610,7 +610,7 @@ Event_timed::load_from_row(THD *thd, TABLE *table)
push_warning_printf(thd,
Sql_condition::WARN_LEVEL_WARN,
ER_EVENT_INVALID_CREATION_CTX,
- ER(ER_EVENT_INVALID_CREATION_CTX),
+ ER_THD(thd, ER_EVENT_INVALID_CREATION_CTX),
(const char *) dbname.str,
(const char *) name.str);
}
diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc
index 53b3e96c323..e39f727800a 100644
--- a/sql/event_db_repository.cc
+++ b/sql/event_db_repository.cc
@@ -695,7 +695,8 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
{
*event_already_exists= true;
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_EVENT_ALREADY_EXISTS, ER(ER_EVENT_ALREADY_EXISTS),
+ ER_EVENT_ALREADY_EXISTS,
+ ER_THD(thd, ER_EVENT_ALREADY_EXISTS),
parse_data->name.str);
ret= 0;
goto end;
@@ -922,7 +923,7 @@ Event_db_repository::drop_event(THD *thd, LEX_STRING db, LEX_STRING name,
}
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST),
+ ER_SP_DOES_NOT_EXIST, ER_THD(thd, ER_SP_DOES_NOT_EXIST),
"Event", name.str);
ret= 0;
diff --git a/sql/event_parse_data.cc b/sql/event_parse_data.cc
index c2b460f02ab..6c123c8e641 100644
--- a/sql/event_parse_data.cc
+++ b/sql/event_parse_data.cc
@@ -129,7 +129,7 @@ Event_parse_data::check_if_in_the_past(THD *thd, my_time_t ltime_utc)
case SQLCOM_CREATE_EVENT:
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_EVENT_CANNOT_CREATE_IN_THE_PAST,
- ER(ER_EVENT_CANNOT_CREATE_IN_THE_PAST));
+ ER_THD(thd, ER_EVENT_CANNOT_CREATE_IN_THE_PAST));
break;
case SQLCOM_ALTER_EVENT:
my_error(ER_EVENT_CANNOT_ALTER_IN_THE_PAST, MYF(0));
@@ -146,7 +146,7 @@ Event_parse_data::check_if_in_the_past(THD *thd, my_time_t ltime_utc)
status_changed= true;
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_EVENT_EXEC_TIME_IN_THE_PAST,
- ER(ER_EVENT_EXEC_TIME_IN_THE_PAST));
+ ER_THD(thd, ER_EVENT_EXEC_TIME_IN_THE_PAST));
}
}
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc
index e369904cbe5..95c5f6d9047 100644
--- a/sql/event_scheduler.cc
+++ b/sql/event_scheduler.cc
@@ -186,7 +186,7 @@ pre_init_event_thread(THD* thd)
thd->security_ctx->master_access= 0;
thd->security_ctx->db_access= 0;
thd->security_ctx->host_or_ip= (char*)my_localhost;
- my_net_init(&thd->net, NULL, MYF(MY_THREAD_SPECIFIC));
+ my_net_init(&thd->net, NULL, thd, MYF(MY_THREAD_SPECIFIC));
thd->security_ctx->set_user((char*)"event_scheduler");
thd->net.read_timeout= slave_net_timeout;
thd->variables.option_bits|= OPTION_AUTO_IS_NULL;
diff --git a/sql/events.cc b/sql/events.cc
index d1cbd297809..2bb112867bf 100644
--- a/sql/events.cc
+++ b/sql/events.cc
@@ -632,36 +632,45 @@ send_show_create_event(THD *thd, Event_timed *et, Protocol *protocol)
List<Item> field_list;
LEX_STRING sql_mode;
const String *tz_name;
-
+ MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("send_show_create_event");
show_str.length(0);
if (et->get_create_event(thd, &show_str))
DBUG_RETURN(TRUE);
- field_list.push_back(new Item_empty_string("Event", NAME_CHAR_LEN));
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Event", NAME_CHAR_LEN),
+ mem_root);
if (sql_mode_string_representation(thd, et->sql_mode, &sql_mode))
DBUG_RETURN(TRUE);
- field_list.push_back(new Item_empty_string("sql_mode", (uint) sql_mode.length));
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "sql_mode",
+ (uint) sql_mode.length), mem_root);
tz_name= et->time_zone->get_name();
- field_list.push_back(new Item_empty_string("time_zone",
- tz_name->length()));
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "time_zone", tz_name->length()),
+ mem_root);
- field_list.push_back(new Item_empty_string("Create Event",
- show_str.length()));
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Create Event",
+ show_str.length()), mem_root);
- field_list.push_back(
- new Item_empty_string("character_set_client", MY_CS_NAME_SIZE));
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "character_set_client",
+ MY_CS_NAME_SIZE), mem_root);
- field_list.push_back(
- new Item_empty_string("collation_connection", MY_CS_NAME_SIZE));
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "collation_connection",
+ MY_CS_NAME_SIZE), mem_root);
- field_list.push_back(
- new Item_empty_string("Database Collation", MY_CS_NAME_SIZE));
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Database Collation",
+ MY_CS_NAME_SIZE), mem_root);
if (protocol->send_result_set_metadata(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
diff --git a/sql/field.cc b/sql/field.cc
index fe673469269..bacab1f79f4 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -1055,37 +1055,6 @@ Item_result Field::result_merge_type(enum_field_types field_type)
*****************************************************************************/
/**
- Output a warning for erroneous conversion of strings to numerical
- values. For use with ER_TRUNCATED_WRONG_VALUE[_FOR_FIELD]
-
- @param thd THD object
- @param str pointer to string that failed to be converted
- @param length length of string
- @param cs charset for string
- @param typestr string describing type converted to
- @param error error value to output
- @param field_name (for *_FOR_FIELD) name of field
- @param row_num (for *_FOR_FIELD) row number
- */
-static void push_numerical_conversion_warning(THD* thd, const char* str,
- uint length, CHARSET_INFO* cs,
- const char* typestr, int error,
- const char* field_name="UNKNOWN",
- ulong row_num=0)
-{
- char buf[MY_MAX(MY_MAX(DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE,
- LONGLONG_TO_STRING_CONVERSION_BUFFER_SIZE),
- DECIMAL_TO_STRING_CONVERSION_BUFFER_SIZE)];
-
- String tmp(buf, sizeof(buf), cs);
- tmp.copy(str, length, cs);
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- error, ER(error), typestr, tmp.c_ptr(),
- field_name, row_num);
-}
-
-
-/**
Check whether a field type can be partially indexed by a key.
This is a static method, rather than a virtual function, because we need
@@ -1246,10 +1215,80 @@ double Field::pos_in_interval_val_str(Field *min, Field *max, uint data_offset)
}
+bool Field::test_if_equality_guarantees_uniqueness(const Item *item) const
+{
+ DBUG_ASSERT(cmp_type() != STRING_RESULT); // For STRING_RESULT see Field_str
+ /*
+ We use result_type() rather than cmp_type() in the below condition,
+ because it covers a special case that string literals guarantee uniqueness
+ for temporal columns, so the query:
+ WHERE temporal_column='string'
+ cannot return multiple distinct temporal values.
+ QQ: perhaps we could allow INT/DECIMAL/DOUBLE types for temporal items.
+ */
+ return result_type() == item->result_type();
+}
+
+
+/**
+ Check whether a field item can be substituted for an equal item
+
+ @details
+ The function checks whether a substitution of a field item for
+ an equal item is valid.
+
+ @param arg *arg != NULL <-> the field is in the context
+ where substitution for an equal item is valid
+
+ @note
+ The following statement is not always true:
+ @n
+ x=y => F(x)=F(x/y).
+ @n
+ This means substitution of an item for an equal item not always
+ yields an equavalent condition. Here's an example:
+ @code
+ 'a'='a '
+ (LENGTH('a')=1) != (LENGTH('a ')=2)
+ @endcode
+ Such a substitution is surely valid if either the substituted
+ field is not of a STRING type or if it is an argument of
+ a comparison predicate.
+
+ @retval
+ TRUE substitution is valid
+ @retval
+ FALSE otherwise
+*/
+
+bool Field::can_be_substituted_to_equal_item(const Context &ctx,
+ const Item_equal *item_equal)
+{
+ DBUG_ASSERT(item_equal->compare_type() != STRING_RESULT);
+ DBUG_ASSERT(cmp_type() != STRING_RESULT);
+ switch (ctx.subst_constraint()) {
+ case ANY_SUBST:
+ /*
+ Disable const propagation for items used in different comparison contexts.
+ This must be done because, for example, Item_hex_string->val_int() is not
+ the same as (Item_hex_string->val_str() in BINARY column)->val_int().
+ We cannot simply disable the replacement in a particular context (
+ e.g. <bin_col> = <int_col> AND <bin_col> = <hex_string>) since
+ Items don't know the context they are in and there are functions like
+ IF (<hex_string>, 'yes', 'no').
+ */
+ return ctx.compare_type() == item_equal->compare_type();
+ case IDENTITY_SUBST:
+ return true;
+ }
+ return false;
+}
+
+
/*
This handles all numeric and BIT data types.
*/
-bool Field::can_optimize_keypart_ref(const Item_func *cond,
+bool Field::can_optimize_keypart_ref(const Item_bool_func *cond,
const Item *item) const
{
DBUG_ASSERT(cmp_type() != STRING_RESULT);
@@ -1261,7 +1300,7 @@ bool Field::can_optimize_keypart_ref(const Item_func *cond,
/*
This handles all numeric and BIT data types.
*/
-bool Field::can_optimize_group_min_max(const Item_bool_func2 *cond,
+bool Field::can_optimize_group_min_max(const Item_bool_func *cond,
const Item *const_item) const
{
DBUG_ASSERT(cmp_type() != STRING_RESULT);
@@ -1288,7 +1327,7 @@ Field_num::Field_num(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
}
-void Field_num::prepend_zeros(String *value)
+void Field_num::prepend_zeros(String *value) const
{
int diff;
if ((diff= (int) (field_length - value->length())) > 0)
@@ -1302,49 +1341,149 @@ void Field_num::prepend_zeros(String *value)
}
}
+
+Item *Field_num::get_equal_zerofill_const_item(THD *thd, const Context &ctx,
+ Item *const_item)
+{
+ switch (ctx.subst_constraint()) {
+ case IDENTITY_SUBST:
+ return NULL; // Not safe to propagate if not in comparison. See MDEV-8369.
+ case ANY_SUBST:
+ break;
+ }
+ DBUG_ASSERT(const_item->const_item());
+ DBUG_ASSERT(ctx.compare_type() != STRING_RESULT);
+ return const_item;
+}
+
+
/**
- Test if given number is a int.
+ Contruct warning parameters using thd->no_errors
+ to determine whether to generate or suppress warnings.
+ We can get here in a query like this:
+ SELECT COUNT(@@basedir);
+ from Item_func_get_system_var::update_null_value().
+*/
+Value_source::Warn_filter::Warn_filter(const THD *thd)
+ :m_want_warning_edom(!thd->no_errors),
+ m_want_note_truncated_spaces(!thd->no_errors)
+{ }
+
+
+/**
+ Check string-to-number conversion and produce a warning if
+ - could not convert any digits (EDOM-alike error)
+ - found garbage at the end of the string
+ - found trailing spaces (a note)
+ See also Field_num::check_edom_and_truncation() for a similar function.
+
+ @param thd - the thread
+ @param filter - which warnings/notes are allowed
+ @param type - name of the data type (e.g. "INTEGER", "DECIMAL", "DOUBLE")
+ @param cs - character set of the original string
+ @param str - the original string
+ @param end - the end of the string
+
+ Unlike Field_num::check_edom_and_truncation(), this function does not
+ distinguish between EDOM and truncation and reports the same warning for
+ both cases. Perhaps we should eventually print different warnings, to make
+ the explicit CAST work closer to the implicit cast in Field_xxx::store().
+*/
+void
+Value_source::Converter_string_to_number::check_edom_and_truncation(THD *thd,
+ Warn_filter filter,
+ const char *type,
+ CHARSET_INFO *cs,
+ const char *str,
+ size_t length) const
+{
+ DBUG_ASSERT(str <= m_end_of_num);
+ DBUG_ASSERT(m_end_of_num <= str + length);
+ if (m_edom || (m_end_of_num < str + length &&
+ !check_if_only_end_space(cs, m_end_of_num, str + length)))
+ {
+ // EDOM or important trailing data truncation
+ if (filter.want_warning_edom())
+ {
+ /*
+ We can use err.ptr() here as ErrConvString is guranteed to put an
+ end \0 here.
+ */
+ THD *wthd= thd ? thd : current_thd;
+ push_warning_printf(wthd, Sql_condition::WARN_LEVEL_WARN,
+ ER_TRUNCATED_WRONG_VALUE,
+ ER_THD(wthd, ER_TRUNCATED_WRONG_VALUE), type,
+ ErrConvString(str, length, cs).ptr());
+ }
+ }
+ else if (m_end_of_num < str + length)
+ {
+ // Unimportant trailing data (spaces) truncation
+ if (filter.want_note_truncated_spaces())
+ {
+ THD *wthd= thd ? thd : current_thd;
+ push_warning_printf(wthd, Sql_condition::WARN_LEVEL_NOTE,
+ ER_TRUNCATED_WRONG_VALUE,
+ ER_THD(wthd, ER_TRUNCATED_WRONG_VALUE), type,
+ ErrConvString(str, length, cs).ptr());
+ }
+ }
+}
- @todo
- Make this multi-byte-character safe
- @param str String to test
+/**
+ Check a string-to-number conversion routine result and generate warnings
+ in case when it:
+ - could not convert any digits
+ - found garbage at the end of the string.
+
+ @param type Data type name (e.g. "decimal", "integer", "double")
+ @param edom Indicates that the string-to-number routine retuned
+ an error code equivalent to EDOM (value out of domain),
+ i.e. the string fully consisted of garbage and the
+ conversion routine could not get any digits from it.
+ @param str The original string
@param length Length of 'str'
- @param int_end Pointer to char after last used digit
- @param cs Character set
+ @param cs Character set
+ @param end Pointer to char after last used digit
@note
- This is called after one has called strntoull10rnd() function.
+ This is called after one has called one of the following functions:
+ - strntoull10rnd()
+ - my_strntod()
+ - str2my_decimal()
@retval
- 0 OK
+ 0 OK
@retval
- 1 error: empty string or wrong integer.
+ 1 error: could not scan any digits (EDOM),
+ e.g. empty string, or garbage.
@retval
- 2 error: garbage at the end of string.
+ 2 error: scanned some digits,
+ but then found garbage at the end of the string.
*/
-int Field_num::check_int(CHARSET_INFO *cs, const char *str, int length,
- const char *int_end, int error)
+
+int Field_num::check_edom_and_truncation(const char *type, bool edom,
+ CHARSET_INFO *cs,
+ const char *str, uint length,
+ const char *end)
{
- /* Test if we get an empty string or wrong integer */
- if (str == int_end || error == MY_ERRNO_EDOM)
+ /* Test if we get an empty string or garbage */
+ if (edom)
{
ErrConvString err(str, length, cs);
- push_warning_printf(get_thd(), Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
- ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
- "integer", err.ptr(), field_name,
- (ulong) table->in_use->get_stmt_da()->
- current_row_for_warning());
+ set_warning_truncated_wrong_value(type, err.ptr());
return 1;
}
/* Test if we have garbage at the end of the given string. */
- if (test_if_important_data(cs, int_end, str + length))
+ if (test_if_important_data(cs, end, str + length))
{
- set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
return 2;
}
+ if (end < str + length)
+ set_note(WARN_DATA_TRUNCATED, 1);
return 0;
}
@@ -1411,11 +1550,29 @@ bool Field_num::get_int(CHARSET_INFO *cs, const char *from, uint len,
return 0;
out_of_range:
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
return 1;
}
+double Field_real::get_double(const char *str, uint length, CHARSET_INFO *cs,
+ int *error)
+{
+ char *end;
+ double nr= my_strntod(cs,(char*) str, length, &end, error);
+ if (*error)
+ {
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
+ *error= 1;
+ }
+ else if (get_thd()->count_cuted_fields &&
+ check_edom_and_truncation("double", str == end,
+ cs, str, length, end))
+ *error= 1;
+ return nr;
+}
+
+
/**
Process decimal library return codes and issue warnings for overflow and
truncation.
@@ -1432,12 +1589,12 @@ int Field::warn_if_overflow(int op_result)
{
if (op_result == E_DEC_OVERFLOW)
{
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
return 1;
}
if (op_result == E_DEC_TRUNCATED)
{
- set_warning(Sql_condition::WARN_LEVEL_NOTE, WARN_DATA_TRUNCATED, 1);
+ set_note(WARN_DATA_TRUNCATED, 1);
/* We return 0 here as this is not a critical issue */
}
return 0;
@@ -1763,7 +1920,7 @@ longlong Field::convert_decimal2longlong(const my_decimal *val,
{
if (val->sign())
{
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
i= 0;
*err= 1;
}
@@ -1848,6 +2005,49 @@ Field_str::Field_str(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
}
+bool Field_str::test_if_equality_guarantees_uniqueness(const Item *item) const
+{
+ /*
+ Can't guarantee uniqueness when comparing a CHAR/VARCHAR/TEXT,
+ BINARY/VARBINARY/BLOB, ENUM,SET columns to an item with cmp_type()
+ of INT_RESULT, DOUBLE_RESULT, DECIMAL_RESULT or TIME_RESULT.
+ Example:
+ SELECT * FROM t1 WHERE varchar_column=DATE'2001-01-01'
+ return non-unuque values, e.g. '2001-01-01' and '2001-01-01x'.
+ */
+ if (!field_charset->coll->propagate(field_charset, 0, 0) ||
+ item->cmp_type() != STRING_RESULT)
+ return false;
+ /*
+ Can't guarantee uniqueness when comparing to
+ an item of a different collation.
+ Example:
+ SELECT * FROM t1
+ WHERE latin1_bin_column = _latin1'A' COLLATE latin1_swedish_ci
+ return non-unique values 'a' and 'A'.
+ */
+ DTCollation tmp(field_charset, field_derivation, repertoire());
+ return !tmp.aggregate(item->collation) && tmp.collation == field_charset;
+}
+
+
+bool Field_str::can_be_substituted_to_equal_item(const Context &ctx,
+ const Item_equal *item_equal)
+{
+ DBUG_ASSERT(item_equal->compare_type() == STRING_RESULT);
+ switch (ctx.subst_constraint()) {
+ case ANY_SUBST:
+ return ctx.compare_type() == item_equal->compare_type() &&
+ (ctx.compare_type() != STRING_RESULT ||
+ ctx.compare_collation() == item_equal->compare_collation());
+ case IDENTITY_SUBST:
+ return ((charset()->state & MY_CS_BINSORT) &&
+ (charset()->state & MY_CS_NOPAD));
+ }
+ return false;
+}
+
+
void Field_num::make_field(Send_field *field)
{
Field::make_field(field);
@@ -1963,8 +2163,8 @@ bool Field::optimize_range(uint idx, uint part)
}
-Field *Field::new_field(MEM_ROOT *root, TABLE *new_table,
- bool keep_type __attribute__((unused)))
+Field *Field::make_new_field(MEM_ROOT *root, TABLE *new_table,
+ bool keep_type __attribute__((unused)))
{
Field *tmp;
if (!(tmp= (Field*) memdup_root(root,(char*) this,size_of())))
@@ -1993,7 +2193,7 @@ Field *Field::new_key_field(MEM_ROOT *root, TABLE *new_table,
uchar *new_null_ptr, uint new_null_bit)
{
Field *tmp;
- if ((tmp= new_field(root, new_table, table == new_table)))
+ if ((tmp= make_new_field(root, new_table, table == new_table)))
{
tmp->ptr= new_ptr;
tmp->null_ptr= new_null_ptr;
@@ -2071,7 +2271,7 @@ void Field_decimal::overflow(bool negative)
uint len=field_length;
uchar *to=ptr, filler= '9';
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
if (negative)
{
if (!unsigned_flag)
@@ -2179,7 +2379,7 @@ int Field_decimal::store(const char *from_arg, uint len, CHARSET_INFO *cs)
from++;
if (from == end)
{
- set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
is_cuted_fields_incr=1;
}
else if (*from == '+' || *from == '-') // Found some sign ?
@@ -2255,7 +2455,7 @@ int Field_decimal::store(const char *from_arg, uint len, CHARSET_INFO *cs)
for (;from != end && my_isspace(&my_charset_bin, *from); from++) ;
if (from != end) // If still something left, warn
{
- set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
is_cuted_fields_incr=1;
}
}
@@ -2433,8 +2633,7 @@ int Field_decimal::store(const char *from_arg, uint len, CHARSET_INFO *cs)
if (tmp_char != '0') // Losing a non zero digit ?
{
if (!is_cuted_fields_incr)
- set_warning(Sql_condition::WARN_LEVEL_WARN,
- WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
return 0;
}
continue;
@@ -2456,7 +2655,7 @@ int Field_decimal::store(const char *from_arg, uint len, CHARSET_INFO *cs)
This is a note, not a warning, as we don't want to abort
when we cut decimals in strict mode
*/
- set_warning(Sql_condition::WARN_LEVEL_NOTE, WARN_DATA_TRUNCATED, 1);
+ set_note(WARN_DATA_TRUNCATED, 1);
}
return 0;
}
@@ -2657,7 +2856,7 @@ void Field_decimal::sql_type(String &res) const
if (dec)
tmp--;
res.length(cs->cset->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
- "decimal(%d,%d)",tmp,dec));
+ "decimal(%d,%d)/*old*/",tmp,dec));
add_zerofill_and_unsigned(res);
}
@@ -2701,7 +2900,7 @@ Field_new_decimal::Field_new_decimal(uint32 len_arg,
}
-Field *Field_new_decimal::create_from_item (Item *item)
+Field *Field_new_decimal::create_from_item(MEM_ROOT *mem_root, Item *item)
{
uint8 dec= item->decimals;
uint8 intg= item->decimal_precision() - dec;
@@ -2740,8 +2939,9 @@ Field *Field_new_decimal::create_from_item (Item *item)
/* Corrected value fits. */
len= required_length;
}
- return new Field_new_decimal(len, item->maybe_null, item->name,
- dec, item->unsigned_flag);
+ return new (mem_root)
+ Field_new_decimal(len, item->maybe_null, item->name,
+ dec, item->unsigned_flag);
}
@@ -2806,7 +3006,7 @@ bool Field_new_decimal::store_value(const my_decimal *decimal_value)
if (unsigned_flag && decimal_value->sign())
{
DBUG_PRINT("info", ("unsigned overflow"));
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
decimal_value= &decimal_zero;
}
@@ -2838,47 +3038,60 @@ int Field_new_decimal::store(const char *from, uint length,
CHARSET_INFO *charset_arg)
{
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
- int err;
my_decimal decimal_value;
THD *thd= get_thd();
DBUG_ENTER("Field_new_decimal::store(char*)");
- if ((err= str2my_decimal(E_DEC_FATAL_ERROR &
- ~(E_DEC_OVERFLOW | E_DEC_BAD_NUM),
+ const char *end;
+ int err= str2my_decimal(E_DEC_FATAL_ERROR &
+ ~(E_DEC_OVERFLOW | E_DEC_BAD_NUM),
from, length, charset_arg,
- &decimal_value)) &&
- thd->abort_on_warning)
+ &decimal_value, &end);
+
+ if (err == E_DEC_OVERFLOW) // Too many digits (>81) in the integer part
{
- ErrConvString errmsg(from, length, charset_arg);
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
- ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
- "decimal", errmsg.ptr(), field_name,
- static_cast<ulong>(thd->get_stmt_da()->
- current_row_for_warning()));
- DBUG_RETURN(err);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
+ if (!thd->abort_on_warning)
+ {
+ set_value_on_overflow(&decimal_value, decimal_value.sign());
+ store_decimal(&decimal_value);
+ }
+ DBUG_RETURN(1);
}
- switch (err) {
- case E_DEC_TRUNCATED:
- set_warning(Sql_condition::WARN_LEVEL_NOTE, WARN_DATA_TRUNCATED, 1);
- break;
- case E_DEC_OVERFLOW:
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
- set_value_on_overflow(&decimal_value, decimal_value.sign());
- break;
- case E_DEC_BAD_NUM:
+ if (thd->count_cuted_fields)
+ {
+ if (check_edom_and_truncation("decimal",
+ err && err != E_DEC_TRUNCATED,
+ charset_arg, from, length, end))
{
- ErrConvString errmsg(from, length, charset_arg);
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
- ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
- "decimal", errmsg.ptr(), field_name,
- static_cast<ulong>(thd->get_stmt_da()->
- current_row_for_warning()));
- my_decimal_set_zero(&decimal_value);
- break;
+ if (!thd->abort_on_warning)
+ {
+ if (err && err != E_DEC_TRUNCATED)
+ {
+ /*
+ If check_decimal() failed because of EDOM-alike error,
+ (e.g. E_DEC_BAD_NUM), we have to initialize decimal_value to zero.
+ Note: if check_decimal() failed because of truncation,
+ decimal_value is alreay properly initialized.
+ */
+ my_decimal_set_zero(&decimal_value);
+ /*
+ TODO: check str2my_decimal() with HF. It seems to do
+ decimal_make_zero() on fatal errors, so my_decimal_set_zero()
+ is probably not needed here.
+ */
+ }
+ store_decimal(&decimal_value);
+ }
+ DBUG_RETURN(1);
}
+ /*
+ E_DEC_TRUNCATED means minor truncation '1e-1000000000000' -> 0.0
+ A note should be enough.
+ */
+ if (err == E_DEC_TRUNCATED)
+ set_note(WARN_DATA_TRUNCATED, 1);
}
#ifndef DBUG_OFF
@@ -2887,7 +3100,7 @@ int Field_new_decimal::store(const char *from, uint length,
dbug_decimal_as_string(dbug_buff, &decimal_value)));
#endif
store_value(&decimal_value);
- DBUG_RETURN(err);
+ DBUG_RETURN(0);
}
@@ -2951,7 +3164,7 @@ int Field_new_decimal::store_decimal(const my_decimal *decimal_value)
}
-int Field_new_decimal::store_time_dec(MYSQL_TIME *ltime, uint dec)
+int Field_new_decimal::store_time_dec(MYSQL_TIME *ltime, uint dec_arg)
{
my_decimal decimal_value;
return store_value(date2my_decimal(ltime, &decimal_value));
@@ -3147,7 +3360,41 @@ Field_new_decimal::unpack(uchar* to, const uchar *from, const uchar *from_end,
return from+len;
}
-int Field_num::store_time_dec(MYSQL_TIME *ltime, uint dec)
+
+Item *Field_new_decimal::get_equal_const_item(THD *thd, const Context &ctx,
+ Item *const_item)
+{
+ if (flags & ZEROFILL_FLAG)
+ return Field_num::get_equal_zerofill_const_item(thd, ctx, const_item);
+ switch (ctx.subst_constraint()) {
+ case IDENTITY_SUBST:
+ if (const_item->field_type() != MYSQL_TYPE_NEWDECIMAL ||
+ const_item->decimal_scale() != decimals())
+ {
+ my_decimal *val, val_buffer, val_buffer2;
+ if (!(val= const_item->val_decimal(&val_buffer)))
+ {
+ DBUG_ASSERT(0);
+ return const_item;
+ }
+ /*
+ Truncate or extend the decimal value to the scale of the field.
+ See comments about truncation in the same place in
+ Field_time::get_equal_const_item().
+ */
+ my_decimal_round(E_DEC_FATAL_ERROR, val, decimals(), true, &val_buffer2);
+ return new (thd->mem_root) Item_decimal(thd, field_name, &val_buffer2,
+ decimals(), field_length);
+ }
+ break;
+ case ANY_SUBST:
+ break;
+ }
+ return const_item;
+}
+
+
+int Field_num::store_time_dec(MYSQL_TIME *ltime, uint dec_arg)
{
longlong v= TIME_to_ulonglong(ltime);
if (ltime->neg == 0)
@@ -3182,13 +3429,13 @@ int Field_tiny::store(double nr)
if (nr < 0.0)
{
*ptr=0;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if (nr > 255.0)
{
*ptr= (uchar) 255;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3199,13 +3446,13 @@ int Field_tiny::store(double nr)
if (nr < -128.0)
{
*ptr= (uchar) -128;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if (nr > 127.0)
{
*ptr=127;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3225,13 +3472,13 @@ int Field_tiny::store(longlong nr, bool unsigned_val)
if (nr < 0 && !unsigned_val)
{
*ptr= 0;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if ((ulonglong) nr > (ulonglong) 255)
{
*ptr= (char) 255;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3244,13 +3491,13 @@ int Field_tiny::store(longlong nr, bool unsigned_val)
if (nr < -128)
{
*ptr= (char) -128;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if (nr > 127)
{
*ptr=127;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3361,13 +3608,13 @@ int Field_short::store(double nr)
if (nr < 0)
{
res=0;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if (nr > (double) UINT_MAX16)
{
res=(int16) UINT_MAX16;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3378,13 +3625,13 @@ int Field_short::store(double nr)
if (nr < (double) INT_MIN16)
{
res=INT_MIN16;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if (nr > (double) INT_MAX16)
{
res=INT_MAX16;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3406,13 +3653,13 @@ int Field_short::store(longlong nr, bool unsigned_val)
if (nr < 0L && !unsigned_val)
{
res=0;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if ((ulonglong) nr > (ulonglong) UINT_MAX16)
{
res=(int16) UINT_MAX16;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3426,13 +3673,13 @@ int Field_short::store(longlong nr, bool unsigned_val)
if (nr < INT_MIN16)
{
res=INT_MIN16;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if (nr > (longlong) INT_MAX16)
{
res=INT_MAX16;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3549,14 +3796,14 @@ int Field_medium::store(double nr)
if (nr < 0)
{
int3store(ptr,0);
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if (nr >= (double) (long) (1L << 24))
{
uint32 tmp=(uint32) (1L << 24)-1L;
int3store(ptr,tmp);
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3568,14 +3815,14 @@ int Field_medium::store(double nr)
{
long tmp=(long) INT_MIN24;
int3store(ptr,tmp);
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if (nr > (double) INT_MAX24)
{
long tmp=(long) INT_MAX24;
int3store(ptr,tmp);
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3595,14 +3842,14 @@ int Field_medium::store(longlong nr, bool unsigned_val)
if (nr < 0 && !unsigned_val)
{
int3store(ptr,0);
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if ((ulonglong) nr >= (ulonglong) (long) (1L << 24))
{
long tmp= (long) (1L << 24)-1L;
int3store(ptr,tmp);
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3617,14 +3864,14 @@ int Field_medium::store(longlong nr, bool unsigned_val)
{
long tmp= (long) INT_MIN24;
int3store(ptr,tmp);
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if (nr > (longlong) INT_MAX24)
{
long tmp=(long) INT_MAX24;
int3store(ptr,tmp);
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3746,7 +3993,7 @@ int Field_long::store(double nr)
else if (nr > (double) UINT_MAX32)
{
res= UINT_MAX32;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3768,7 +4015,7 @@ int Field_long::store(double nr)
res=(int32) (longlong) nr;
}
if (error)
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
int4store(ptr,res);
return error;
@@ -3814,7 +4061,7 @@ int Field_long::store(longlong nr, bool unsigned_val)
res=(int32) nr;
}
if (error)
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
int4store(ptr,res);
return error;
@@ -3913,7 +4160,7 @@ int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs)
tmp= cs->cset->strntoull10rnd(cs,from,len,unsigned_flag,&end,&error);
if (error == MY_ERRNO_ERANGE)
{
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if (get_thd()->count_cuted_fields &&
@@ -3935,7 +4182,7 @@ int Field_longlong::store(double nr)
res= double_to_longlong(nr, unsigned_flag, &error);
if (error)
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
int8store(ptr,res);
return error;
@@ -3956,7 +4203,7 @@ int Field_longlong::store(longlong nr, bool unsigned_val)
if (unsigned_flag != unsigned_val)
{
nr= unsigned_flag ? (ulonglong) 0 : (ulonglong) LONGLONG_MAX;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
}
@@ -4065,16 +4312,7 @@ void Field_longlong::sql_type(String &res) const
int Field_float::store(const char *from,uint len,CHARSET_INFO *cs)
{
int error;
- char *end;
- double nr= my_strntod(cs,(char*) from,len,&end,&error);
- if (error || (!len || ((uint) (end-from) != len &&
- get_thd()->count_cuted_fields)))
- {
- set_warning(Sql_condition::WARN_LEVEL_WARN,
- (error ? ER_WARN_DATA_OUT_OF_RANGE : WARN_DATA_TRUNCATED), 1);
- error= error ? 1 : 2;
- }
- Field_float::store(nr);
+ Field_float::store(get_double(from, len, cs, &error));
return error;
}
@@ -4087,7 +4325,7 @@ int Field_float::store(double nr)
unsigned_flag, FLT_MAX);
if (error)
{
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
if (error < 0) // Wrong double value
{
error= 1;
@@ -4253,16 +4491,7 @@ void Field_float::sql_type(String &res) const
int Field_double::store(const char *from,uint len,CHARSET_INFO *cs)
{
int error;
- char *end;
- double nr= my_strntod(cs,(char*) from, len, &end, &error);
- if (error || (!len || ((uint) (end-from) != len &&
- get_thd()->count_cuted_fields)))
- {
- set_warning(Sql_condition::WARN_LEVEL_WARN,
- (error ? ER_WARN_DATA_OUT_OF_RANGE : WARN_DATA_TRUNCATED), 1);
- error= error ? 1 : 2;
- }
- Field_double::store(nr);
+ Field_double::store(get_double(from, len, cs, &error));
return error;
}
@@ -4275,7 +4504,7 @@ int Field_double::store(double nr)
unsigned_flag, DBL_MAX);
if (error)
{
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
if (error < 0) // Wrong double value
{
error= 1;
@@ -4414,7 +4643,7 @@ int Field_real::store_decimal(const my_decimal *dm)
return store(dbl);
}
-int Field_real::store_time_dec(MYSQL_TIME *ltime, uint dec)
+int Field_real::store_time_dec(MYSQL_TIME *ltime, uint dec_arg)
{
return store(TIME_to_double(ltime));
}
@@ -4439,10 +4668,11 @@ longlong Field_double::val_int(void)
res= double_to_longlong(j, 0, &error);
if (error)
{
+ THD *thd= get_thd();
ErrConvDouble err(j);
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE,
- ER(ER_TRUNCATED_WRONG_VALUE), "INTEGER",
+ ER_THD(thd, ER_TRUNCATED_WRONG_VALUE), "INTEGER",
err.ptr());
}
return res;
@@ -4465,6 +4695,26 @@ bool Field_real::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
}
+Item *Field_real::get_equal_const_item(THD *thd, const Context &ctx,
+ Item *const_item)
+{
+ if (flags & ZEROFILL_FLAG)
+ return Field_num::get_equal_zerofill_const_item(thd, ctx, const_item);
+ switch (ctx.subst_constraint()) {
+ case IDENTITY_SUBST:
+ if (const_item->decimal_scale() != Field_real::decimals())
+ {
+ double val= const_item->val_real();
+ return new (thd->mem_root) Item_float(thd, val, Field_real::decimals());
+ }
+ break;
+ case ANY_SUBST:
+ break;
+ }
+ return const_item;
+}
+
+
String *Field_double::val_str(String *val_buffer,
String *val_ptr __attribute__((unused)))
{
@@ -4616,11 +4866,12 @@ Field_timestamp::Field_timestamp(uchar *ptr_arg, uint32 len_arg,
}
-my_time_t Field_timestamp::get_timestamp(ulong *sec_part) const
+my_time_t Field_timestamp::get_timestamp(const uchar *pos,
+ ulong *sec_part) const
{
ASSERT_COLUMN_MARKED_FOR_READ;
*sec_part= 0;
- return sint4korr(ptr);
+ return sint4korr(pos);
}
@@ -4636,7 +4887,7 @@ int Field_timestamp::store_TIME_with_warning(THD *thd, MYSQL_TIME *l_time,
if (MYSQL_TIME_WARN_HAVE_WARNINGS(was_cut) || !have_smth_to_conv)
{
error= 1;
- set_datetime_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED,
+ set_datetime_warning(WARN_DATA_TRUNCATED,
str, MYSQL_TIMESTAMP_DATETIME, 1);
}
else if (MYSQL_TIME_WARN_HAVE_NOTES(was_cut))
@@ -4654,7 +4905,7 @@ int Field_timestamp::store_TIME_with_warning(THD *thd, MYSQL_TIME *l_time,
conversion_error= ER_WARN_DATA_OUT_OF_RANGE;
if (conversion_error)
{
- set_datetime_warning(Sql_condition::WARN_LEVEL_WARN, conversion_error,
+ set_datetime_warning(conversion_error,
str, MYSQL_TIMESTAMP_DATETIME, !error);
error= 1;
}
@@ -4832,6 +5083,16 @@ String *Field_timestamp::val_str(String *val_buffer, String *val_ptr)
}
+bool
+Field_timestamp::validate_value_in_record(THD *thd, const uchar *record) const
+{
+ DBUG_ASSERT(!is_null_in_record(record));
+ ulong sec_part;
+ return !get_timestamp(ptr_in_record(record), &sec_part) && !sec_part &&
+ (sql_mode_for_dates(thd) & TIME_NO_ZERO_DATE) != 0;
+}
+
+
bool Field_timestamp::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
{
THD *thd= get_thd();
@@ -4894,9 +5155,8 @@ void Field_timestamp::sql_type(String &res) const
int Field_timestamp::set_time()
{
- THD *thd= get_thd();
set_notnull();
- store_TIME(thd->query_start(), 0);
+ store_TIME(get_thd()->query_start(), 0);
return 0;
}
@@ -5014,11 +5274,12 @@ void Field_timestamp_hires::store_TIME(my_time_t timestamp, ulong sec_part)
store_bigendian(sec_part_shift(sec_part, dec), ptr+4, sec_part_bytes[dec]);
}
-my_time_t Field_timestamp_hires::get_timestamp(ulong *sec_part) const
+my_time_t Field_timestamp_hires::get_timestamp(const uchar *pos,
+ ulong *sec_part) const
{
ASSERT_COLUMN_MARKED_FOR_READ;
- *sec_part= (long)sec_part_unshift(read_bigendian(ptr+4, sec_part_bytes[dec]), dec);
- return mi_uint4korr(ptr);
+ *sec_part= (long)sec_part_unshift(read_bigendian(pos+4, sec_part_bytes[dec]), dec);
+ return mi_uint4korr(pos);
}
double Field_timestamp_with_dec::val_real(void)
@@ -5056,8 +5317,8 @@ int Field_timestamp::store_decimal(const my_decimal *d)
}
else
tmp= number_to_datetime(nr, sec_part, &ltime, TIME_NO_ZERO_IN_DATE |
- (thd->variables.sql_mode &
- MODE_NO_ZERO_DATE), &error);
+ (thd->variables.sql_mode &
+ MODE_NO_ZERO_DATE), &error);
return store_TIME_with_warning(thd, &ltime, &str, error, tmp != -1);
}
@@ -5118,10 +5379,11 @@ void Field_timestampf::store_TIME(my_time_t timestamp, ulong sec_part)
}
-my_time_t Field_timestampf::get_timestamp(ulong *sec_part) const
+my_time_t Field_timestampf::get_timestamp(const uchar *pos,
+ ulong *sec_part) const
{
struct timeval tm;
- my_timestamp_from_binary(&tm, ptr, dec);
+ my_timestamp_from_binary(&tm, pos, dec);
*sec_part= tm.tv_usec;
return tm.tv_sec;
}
@@ -5153,7 +5415,7 @@ void Field_temporal::set_warnings(Sql_condition::enum_warning_level trunc_level,
set_datetime_warning(trunc_level, WARN_DATA_TRUNCATED,
str, mysql_type_to_time_type(type()), 1);
if (was_cut & MYSQL_TIME_WARN_OUT_OF_RANGE)
- set_datetime_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE,
+ set_datetime_warning(ER_WARN_DATA_OUT_OF_RANGE,
str, mysql_type_to_time_type(type()), 1);
}
@@ -5257,19 +5519,30 @@ int Field_temporal_with_date::store_time_dec(MYSQL_TIME *ltime, uint dec)
*/
have_smth_to_conv= false;
error= MYSQL_TIME_WARN_OUT_OF_RANGE;
- goto store;
}
-
- /*
- We don't perform range checking here since values stored in TIME
- structure always fit into DATETIME range.
- */
- have_smth_to_conv= !check_date(&l_time, pack_time(&l_time) != 0,
- sql_mode_for_dates(current_thd), &error);
-store:
+ else
+ {
+ /*
+ We don't perform range checking here since values stored in TIME
+ structure always fit into DATETIME range.
+ */
+ have_smth_to_conv= !check_date(&l_time, pack_time(&l_time) != 0,
+ sql_mode_for_dates(get_thd()), &error);
+ }
return store_TIME_with_warning(&l_time, &str, error, have_smth_to_conv);
}
+
+bool
+Field_temporal_with_date::validate_value_in_record(THD *thd,
+ const uchar *record) const
+{
+ DBUG_ASSERT(!is_null_in_record(record));
+ MYSQL_TIME ltime;
+ return get_TIME(&ltime, ptr_in_record(record), sql_mode_for_dates(thd));
+}
+
+
my_decimal *Field_temporal::val_decimal(my_decimal *d)
{
MYSQL_TIME ltime;
@@ -5282,20 +5555,50 @@ my_decimal *Field_temporal::val_decimal(my_decimal *d)
}
-bool Field_temporal::can_optimize_keypart_ref(const Item_func *cond,
+bool Field_temporal::can_optimize_keypart_ref(const Item_bool_func *cond,
const Item *value) const
{
return true; // Field is of TIME_RESULT, which supersedes everything else.
}
-bool Field_temporal::can_optimize_group_min_max(const Item_bool_func2 *cond,
+bool Field_temporal::can_optimize_group_min_max(const Item_bool_func *cond,
const Item *const_item) const
{
return true; // Field is of TIME_RESULT, which supersedes everything else.
}
+Item *Field_temporal::get_equal_const_item_datetime(THD *thd,
+ const Context &ctx,
+ Item *const_item)
+{
+ switch (ctx.subst_constraint()) {
+ case IDENTITY_SUBST:
+ if ((const_item->field_type() != MYSQL_TYPE_DATETIME &&
+ const_item->field_type() != MYSQL_TYPE_TIMESTAMP) ||
+ const_item->decimals != decimals())
+ {
+ MYSQL_TIME ltime;
+ if (const_item->field_type() == MYSQL_TYPE_TIME ?
+ const_item->get_date_with_conversion(&ltime, 0) :
+ const_item->get_date(&ltime, 0))
+ return NULL;
+ /*
+ See comments about truncation in the same place in
+ Field_time::get_equal_const_item().
+ */
+ return new (thd->mem_root) Item_datetime_literal(thd, &ltime,
+ decimals());
+ }
+ break;
+ case ANY_SUBST:
+ break;
+ }
+ return const_item;
+}
+
+
/****************************************************************************
** time type
** In string context: HH:MM:SS
@@ -5489,7 +5792,7 @@ bool Field_time::check_zero_in_date_with_warn(ulonglong fuzzydate)
THD *thd= get_thd();
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_DATA_OUT_OF_RANGE,
- ER(ER_WARN_DATA_OUT_OF_RANGE), field_name,
+ ER_THD(thd, ER_WARN_DATA_OUT_OF_RANGE), field_name,
thd->get_stmt_da()->current_row_for_warning());
return true;
}
@@ -5588,6 +5891,63 @@ int Field_time::store_decimal(const my_decimal *d)
return store_TIME_with_warning(&ltime, &str, was_cut, have_smth_to_conv);
}
+
+Item *Field_time::get_equal_const_item(THD *thd, const Context &ctx,
+ Item *const_item)
+{
+ switch (ctx.subst_constraint()) {
+ case ANY_SUBST:
+ if (const_item->field_type() != MYSQL_TYPE_TIME)
+ {
+ MYSQL_TIME ltime;
+ // Get the value of const_item with conversion from DATETIME to TIME
+ if (const_item->get_time_with_conversion(thd, &ltime, TIME_TIME_ONLY))
+ return NULL;
+ /*
+ Replace a DATE/DATETIME constant to a TIME constant:
+ WHERE LENGTH(time_column)=8
+ AND time_column=TIMESTAMP'2015-08-30 10:20:30';
+ to:
+ WHERE LENGTH(time_column)=10
+ AND time_column=TIME'10:20:30'
+
+ (assuming CURRENT_DATE is '2015-08-30'
+ */
+ return new (thd->mem_root) Item_time_literal(thd, &ltime,
+ ltime.second_part ?
+ TIME_SECOND_PART_DIGITS :
+ 0);
+ }
+ break;
+ case IDENTITY_SUBST:
+ if (const_item->field_type() != MYSQL_TYPE_TIME ||
+ const_item->decimals != decimals())
+ {
+ MYSQL_TIME ltime;
+ if (const_item->get_time_with_conversion(thd, &ltime, TIME_TIME_ONLY))
+ return NULL;
+ /*
+ Note, the value returned in "ltime" can have more fractional
+ digits that decimals(). The Item_time_literal constructor will
+ truncate these digits. We could disallow propagation is such
+ cases, but it's still useful (and safe) to optimize:
+ WHERE time0_column='00:00:00.123' AND LENGTH(a)=12
+ to
+ WHERE time0_column='00:00:00.123' AND LENGTH(TIME'00:00:00')=12
+ and then to
+ WHERE FALSE
+ The original WHERE would do the full table scan (in case of no keys).
+ The optimized WHERE will return with "Impossible WHERE", without
+ having to do the full table scan.
+ */
+ return new (thd->mem_root) Item_time_literal(thd, &ltime, decimals());
+ }
+ break;
+ }
+ return const_item;
+}
+
+
uint32 Field_time_hires::pack_length() const
{
return time_hires_bytes[dec];
@@ -5696,7 +6056,7 @@ int Field_year::store(const char *from, uint len,CHARSET_INFO *cs)
error == MY_ERRNO_ERANGE)
{
*ptr=0;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
return 1;
}
if (get_thd()->count_cuted_fields &&
@@ -5739,7 +6099,7 @@ int Field_year::store(longlong nr, bool unsigned_val)
if (nr < 0 || (nr >= 100 && nr <= 1900) || nr > 2155)
{
*ptr= 0;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
return 1;
}
if (nr != 0 || field_length != 4) // 0000 -> 0; 00 -> 2000
@@ -5754,14 +6114,13 @@ int Field_year::store(longlong nr, bool unsigned_val)
}
-int Field_year::store_time_dec(MYSQL_TIME *ltime, uint dec)
+int Field_year::store_time_dec(MYSQL_TIME *ltime, uint dec_arg)
{
ErrConvTime str(ltime);
if (Field_year::store(ltime->year, 0))
return 1;
- set_datetime_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED,
- &str, ltime->time_type, 1);
+ set_datetime_warning(WARN_DATA_TRUNCATED, &str, ltime->time_type, 1);
return 0;
}
@@ -5865,18 +6224,25 @@ longlong Field_date::val_int(void)
}
+bool Field_date::get_TIME(MYSQL_TIME *ltime, const uchar *pos,
+ ulonglong fuzzydate) const
+{
+ ASSERT_COLUMN_MARKED_FOR_READ;
+ int32 tmp= sint4korr(pos);
+ ltime->year= (int) ((uint32) tmp/10000L % 10000);
+ ltime->month= (int) ((uint32) tmp/100 % 100);
+ ltime->day= (int) ((uint32) tmp % 100);
+ ltime->time_type= MYSQL_TIMESTAMP_DATE;
+ ltime->hour= ltime->minute= ltime->second= ltime->second_part= ltime->neg= 0;
+ return validate_MMDD(tmp, ltime->month, ltime->day, fuzzydate);
+}
+
+
String *Field_date::val_str(String *val_buffer,
String *val_ptr __attribute__((unused)))
{
- ASSERT_COLUMN_MARKED_FOR_READ;
MYSQL_TIME ltime;
- int32 tmp;
- tmp=sint4korr(ptr);
- ltime.neg= 0;
- ltime.year= (int) ((uint32) tmp/10000L % 10000);
- ltime.month= (int) ((uint32) tmp/100 % 100);
- ltime.day= (int) ((uint32) tmp % 100);
-
+ get_TIME(&ltime, ptr, 0);
val_buffer->alloc(MAX_DATE_STRING_REP_LENGTH);
uint length= (uint) my_date_to_str(&ltime,
const_cast<char*>(val_buffer->ptr()));
@@ -5977,19 +6343,17 @@ String *Field_newdate::val_str(String *val_buffer,
}
-bool Field_newdate::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
+bool Field_newdate::get_TIME(MYSQL_TIME *ltime, const uchar *pos,
+ ulonglong fuzzydate) const
{
- uint32 tmp=(uint32) uint3korr(ptr);
+ ASSERT_COLUMN_MARKED_FOR_READ;
+ uint32 tmp=(uint32) uint3korr(pos);
ltime->day= tmp & 31;
ltime->month= (tmp >> 5) & 15;
ltime->year= (tmp >> 9);
ltime->time_type= MYSQL_TIMESTAMP_DATE;
ltime->hour= ltime->minute= ltime->second= ltime->second_part= ltime->neg= 0;
- if (!tmp)
- return fuzzydate & TIME_NO_ZERO_DATE;
- if (!ltime->month || !ltime->day)
- return fuzzydate & TIME_NO_ZERO_IN_DATE;
- return 0;
+ return validate_MMDD(tmp, ltime->month, ltime->day, fuzzydate);
}
@@ -6016,6 +6380,56 @@ void Field_newdate::sql_type(String &res) const
}
+Item *Field_newdate::get_equal_const_item(THD *thd, const Context &ctx,
+ Item *const_item)
+{
+ switch (ctx.subst_constraint()) {
+ case ANY_SUBST:
+ if (!is_temporal_type_with_date(const_item->field_type()))
+ {
+ MYSQL_TIME ltime;
+ // Get the value of const_item with conversion from TIME to DATETIME
+ if (const_item->get_date_with_conversion(&ltime,
+ TIME_FUZZY_DATES | TIME_INVALID_DATES))
+ return NULL;
+ /*
+ Replace the constant to a DATE or DATETIME constant.
+ Example:
+ WHERE LENGTH(date_column)=10
+ AND date_column=TIME'10:20:30';
+ to:
+ WHERE LENGTH(date_column)=10
+ AND date_column=TIMESTAMP'2015-08-30 10:20:30'
+
+ (assuming CURRENT_DATE is '2015-08-30'
+ */
+ if (non_zero_hhmmssuu(&ltime))
+ return new (thd->mem_root)
+ Item_datetime_literal_for_invalid_dates(thd, &ltime,
+ ltime.second_part ?
+ TIME_SECOND_PART_DIGITS : 0);
+ datetime_to_date(&ltime);
+ return new (thd->mem_root)
+ Item_date_literal_for_invalid_dates(thd, &ltime);
+ }
+ break;
+ case IDENTITY_SUBST:
+ if (const_item->field_type() != MYSQL_TYPE_DATE)
+ {
+ MYSQL_TIME ltime;
+ if (const_item->field_type() == MYSQL_TYPE_TIME ?
+ const_item->get_date_with_conversion(&ltime, 0) :
+ const_item->get_date(&ltime, 0))
+ return NULL;
+ datetime_to_date(&ltime);
+ return new (thd->mem_root) Item_date_literal(thd, &ltime);
+ }
+ break;
+ }
+ return const_item;
+}
+
+
/****************************************************************************
** datetime type
** In string context: YYYY-MM-DD HH:MM:DD
@@ -6097,9 +6511,11 @@ String *Field_datetime::val_str(String *val_buffer,
return val_buffer;
}
-bool Field_datetime::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
+bool Field_datetime::get_TIME(MYSQL_TIME *ltime, const uchar *pos,
+ ulonglong fuzzydate) const
{
- longlong tmp=Field_datetime::val_int();
+ ASSERT_COLUMN_MARKED_FOR_READ;
+ longlong tmp= sint8korr(pos);
uint32 part1,part2;
part1=(uint32) (tmp/1000000LL);
part2=(uint32) (tmp - (ulonglong) part1*1000000LL);
@@ -6113,13 +6529,10 @@ bool Field_datetime::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
ltime->day= (int) (part1%100);
ltime->month= (int) (part1/100%100);
ltime->year= (int) (part1/10000);
- if (!tmp)
- return fuzzydate & TIME_NO_ZERO_DATE;
- if (!ltime->month || !ltime->day)
- return fuzzydate & TIME_NO_ZERO_IN_DATE;
- return 0;
+ return validate_MMDD(tmp, ltime->month, ltime->day, fuzzydate);
}
+
int Field_datetime::cmp(const uchar *a_ptr, const uchar *b_ptr)
{
longlong a,b;
@@ -6231,17 +6644,17 @@ String *Field_datetime_with_dec::val_str(String *str,
return str;
}
-bool Field_datetime_hires::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
+
+bool Field_datetime_hires::get_TIME(MYSQL_TIME *ltime, const uchar *pos,
+ ulonglong fuzzydate) const
{
- ulonglong packed= read_bigendian(ptr, Field_datetime_hires::pack_length());
+ ASSERT_COLUMN_MARKED_FOR_READ;
+ ulonglong packed= read_bigendian(pos, Field_datetime_hires::pack_length());
unpack_time(sec_part_unshift(packed, dec), ltime);
- if (!packed)
- return fuzzydate & TIME_NO_ZERO_DATE;
- if (!ltime->month || !ltime->day)
- return fuzzydate & TIME_NO_ZERO_IN_DATE;
- return 0;
+ return validate_MMDD(packed, ltime->month, ltime->day, fuzzydate);
}
+
uint32 Field_datetime_hires::pack_length() const
{
return datetime_hires_bytes[dec];
@@ -6278,18 +6691,15 @@ void Field_datetimef::store_TIME(MYSQL_TIME *ltime)
my_datetime_packed_to_binary(tmp, ptr, dec);
}
-bool Field_datetimef::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
+bool Field_datetimef::get_TIME(MYSQL_TIME *ltime, const uchar *pos,
+ ulonglong fuzzydate) const
{
- longlong tmp= my_datetime_packed_from_binary(ptr, dec);
+ ASSERT_COLUMN_MARKED_FOR_READ;
+ longlong tmp= my_datetime_packed_from_binary(pos, dec);
TIME_from_longlong_datetime_packed(ltime, tmp);
- if (!tmp)
- return fuzzydate & TIME_NO_ZERO_DATE;
- if (!ltime->month || !ltime->day)
- return fuzzydate & TIME_NO_ZERO_IN_DATE;
- return false;
+ return validate_MMDD(tmp, ltime->month, ltime->day, fuzzydate);
}
-
/****************************************************************************
** string type
** A string may be varchar or binary
@@ -6332,14 +6742,7 @@ Field_longstr::check_string_copy_error(const String_copier *copier,
return FALSE;
convert_to_printable(tmp, sizeof(tmp), pos, (end - pos), cs, 6);
-
- THD *thd= get_thd();
- push_warning_printf(thd,
- Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
- ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
- "string", tmp, field_name,
- thd->get_stmt_da()->current_row_for_warning());
+ set_warning_truncated_wrong_value("string", tmp);
return TRUE;
}
@@ -6374,14 +6777,14 @@ Field_longstr::report_if_important_data(const char *pstr, const char *end,
if (test_if_important_data(field_charset, pstr, end))
{
if (thd->abort_on_warning)
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_DATA_TOO_LONG, 1);
+ set_warning(ER_DATA_TOO_LONG, 1);
else
- set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
return 2;
}
else if (count_spaces)
{ /* If we lost only spaces then produce a NOTE, not a WARNING */
- set_warning(Sql_condition::WARN_LEVEL_NOTE, WARN_DATA_TRUNCATED, 1);
+ set_note(WARN_DATA_TRUNCATED, 1);
return 2;
}
}
@@ -6438,9 +6841,9 @@ int Field_str::store(double nr)
if (error)
{
if (get_thd()->abort_on_warning)
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_DATA_TOO_LONG, 1);
+ set_warning(ER_DATA_TOO_LONG, 1);
else
- set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
}
return store(buff, length, &my_charset_numeric);
}
@@ -6488,7 +6891,7 @@ uint32 Field_longstr::max_data_length() const
bool
-Field_longstr::cmp_to_string_with_same_collation(const Item_func *cond,
+Field_longstr::cmp_to_string_with_same_collation(const Item_bool_func *cond,
const Item *item) const
{
return item->cmp_type() == STRING_RESULT &&
@@ -6497,7 +6900,7 @@ Field_longstr::cmp_to_string_with_same_collation(const Item_func *cond,
bool
-Field_longstr::cmp_to_string_with_stricter_collation(const Item_func *cond,
+Field_longstr::cmp_to_string_with_stricter_collation(const Item_bool_func *cond,
const Item *item) const
{
return item->cmp_type() == STRING_RESULT &&
@@ -6506,7 +6909,7 @@ Field_longstr::cmp_to_string_with_stricter_collation(const Item_func *cond,
}
-bool Field_longstr::can_optimize_keypart_ref(const Item_func *cond,
+bool Field_longstr::can_optimize_keypart_ref(const Item_bool_func *cond,
const Item *item) const
{
DBUG_ASSERT(cmp_type() == STRING_RESULT);
@@ -6514,7 +6917,7 @@ bool Field_longstr::can_optimize_keypart_ref(const Item_func *cond,
}
-bool Field_longstr::can_optimize_hash_join(const Item_func *cond,
+bool Field_longstr::can_optimize_hash_join(const Item_bool_func *cond,
const Item *item) const
{
DBUG_ASSERT(cmp_type() == STRING_RESULT);
@@ -6522,7 +6925,7 @@ bool Field_longstr::can_optimize_hash_join(const Item_func *cond,
}
-bool Field_longstr::can_optimize_group_min_max(const Item_bool_func2 *cond,
+bool Field_longstr::can_optimize_group_min_max(const Item_bool_func *cond,
const Item *const_item) const
{
/*
@@ -6534,51 +6937,41 @@ bool Field_longstr::can_optimize_group_min_max(const Item_bool_func2 *cond,
}
+/**
+ This overrides the default behavior of the parent constructor
+ Warn_filter(thd) to suppress notes about trailing spaces in case of CHAR(N),
+ as they are truncated during val_str().
+ We still do want truncation notes in case of BINARY(N),
+ as trailing spaces are not truncated in val_str().
+*/
+Field_string::Warn_filter_string::Warn_filter_string(const THD *thd,
+ const Field_string *field)
+ :Warn_filter(!thd->no_errors,
+ !thd->no_errors &&
+ field->Field_string::charset() == &my_charset_bin)
+{ }
+
+
double Field_string::val_real(void)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- int error;
- char *end;
- CHARSET_INFO *cs= charset();
- double result;
-
- result= my_strntod(cs,(char*) ptr,field_length,&end,&error);
- if (!get_thd()->no_errors &&
- (error || (field_length != (uint32)(end - (char*) ptr) &&
- !check_if_only_end_space(cs, end,
- (char*) ptr + field_length))))
- {
- ErrConvString err((char*) ptr, field_length, cs);
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE,
- ER(ER_TRUNCATED_WRONG_VALUE), "DOUBLE",
- err.ptr());
- }
- return result;
+ THD *thd= get_thd();
+ return Converter_strntod_with_warn(get_thd(),
+ Warn_filter_string(thd, this),
+ Field_string::charset(),
+ (const char *) ptr,
+ field_length).result();
}
longlong Field_string::val_int(void)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- int error;
- char *end;
- CHARSET_INFO *cs= charset();
- longlong result;
-
- result= my_strntoll(cs, (char*) ptr,field_length,10,&end,&error);
- if (!get_thd()->no_errors &&
- (error || (field_length != (uint32)(end - (char*) ptr) &&
- !check_if_only_end_space(cs, end,
- (char*) ptr + field_length))))
- {
- ErrConvString err((char*) ptr, field_length, cs);
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE,
- ER(ER_TRUNCATED_WRONG_VALUE),
- "INTEGER", err.ptr());
- }
- return result;
+ THD *thd= get_thd();
+ return Converter_strntoll_with_warn(thd, Warn_filter_string(thd, this),
+ Field_string::charset(),
+ (const char *) ptr,
+ field_length).result();
}
@@ -6604,17 +6997,13 @@ String *Field_string::val_str(String *val_buffer __attribute__((unused)),
my_decimal *Field_string::val_decimal(my_decimal *decimal_value)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- int err= str2my_decimal(E_DEC_FATAL_ERROR, (char*) ptr, field_length,
- charset(), decimal_value);
- if (!get_thd()->no_errors && err)
- {
- ErrConvString errmsg((char*) ptr, field_length, charset());
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE,
- ER(ER_TRUNCATED_WRONG_VALUE),
- "DECIMAL", errmsg.ptr());
- }
-
+ THD *thd= get_thd();
+ Converter_str2my_decimal_with_warn(thd,
+ Warn_filter_string(thd, this),
+ E_DEC_FATAL_ERROR,
+ Field_string::charset(),
+ (const char *) ptr,
+ field_length, decimal_value);
return decimal_value;
}
@@ -6878,14 +7267,15 @@ uint Field_string::get_key_image(uchar *buff, uint length, imagetype type_arg)
}
-Field *Field_string::new_field(MEM_ROOT *root, TABLE *new_table,
- bool keep_type)
+Field *Field_string::make_new_field(MEM_ROOT *root, TABLE *new_table,
+ bool keep_type)
{
Field *field;
if (type() != MYSQL_TYPE_VAR_STRING || keep_type)
- field= Field::new_field(root, new_table, keep_type);
- else if ((field= new Field_varstring(field_length, maybe_null(), field_name,
- new_table->s, charset())))
+ field= Field::make_new_field(root, new_table, keep_type);
+ else if ((field= new (root) Field_varstring(field_length, maybe_null(),
+ field_name,
+ new_table->s, charset())))
{
/*
Old VARCHAR field which should be modified to a VARCHAR on copy
@@ -6894,10 +7284,11 @@ Field *Field_string::new_field(MEM_ROOT *root, TABLE *new_table,
*/
field->init(new_table);
/*
- Normally orig_table is different from table only if field was created
- via ::new_field. Here we alter the type of field, so ::new_field is
- not applicable. But we still need to preserve the original field
- metadata for the client-server protocol.
+ Normally orig_table is different from table only if field was
+ created via ::make_new_field. Here we alter the type of field,
+ so ::make_new_field is not applicable. But we still need to
+ preserve the original field metadata for the client-server
+ protocol.
*/
field->orig_table= orig_table;
}
@@ -6978,54 +7369,30 @@ int Field_varstring::store(longlong nr, bool unsigned_val)
double Field_varstring::val_real(void)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- int error;
- char *end;
- double result;
- CHARSET_INFO* cs= charset();
-
- uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
- result= my_strntod(cs, (char*)ptr+length_bytes, length, &end, &error);
-
- if (!get_thd()->no_errors &&
- (error || (length != (uint)(end - (char*)ptr+length_bytes) &&
- !check_if_only_end_space(cs, end, (char*)ptr+length_bytes+length))))
- {
- push_numerical_conversion_warning(current_thd, (char*)ptr+length_bytes,
- length, cs,"DOUBLE",
- ER_TRUNCATED_WRONG_VALUE);
- }
- return result;
+ THD *thd= get_thd();
+ return Converter_strntod_with_warn(thd, Warn_filter(thd),
+ Field_varstring::charset(),
+ (const char *) get_data(),
+ get_length()).result();
}
longlong Field_varstring::val_int(void)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- int error;
- char *end;
- CHARSET_INFO *cs= charset();
-
- uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
- longlong result= my_strntoll(cs, (char*) ptr+length_bytes, length, 10,
- &end, &error);
-
- if (!get_thd()->no_errors &&
- (error || (length != (uint)(end - (char*)ptr+length_bytes) &&
- !check_if_only_end_space(cs, end, (char*)ptr+length_bytes+length))))
- {
- push_numerical_conversion_warning(current_thd, (char*)ptr+length_bytes,
- length, cs, "INTEGER",
- ER_TRUNCATED_WRONG_VALUE);
- }
- return result;
+ THD *thd= get_thd();
+ return Converter_strntoll_with_warn(thd, Warn_filter(thd),
+ Field_varstring::charset(),
+ (const char *) get_data(),
+ get_length()).result();
}
+
String *Field_varstring::val_str(String *val_buffer __attribute__((unused)),
String *val_ptr)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
- val_ptr->set((const char*) ptr+length_bytes, length, field_charset);
+ val_ptr->set((const char*) get_data(), get_length(), field_charset);
return val_ptr;
}
@@ -7033,18 +7400,14 @@ String *Field_varstring::val_str(String *val_buffer __attribute__((unused)),
my_decimal *Field_varstring::val_decimal(my_decimal *decimal_value)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- CHARSET_INFO *cs= charset();
- uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
- int error= str2my_decimal(E_DEC_FATAL_ERROR, (char*) ptr+length_bytes, length,
- cs, decimal_value);
-
- if (!get_thd()->no_errors && error)
- {
- push_numerical_conversion_warning(current_thd, (char*)ptr+length_bytes,
- length, cs, "DECIMAL",
- ER_TRUNCATED_WRONG_VALUE);
- }
+ THD *thd= get_thd();
+ Converter_str2my_decimal_with_warn(thd, Warn_filter(thd),
+ E_DEC_FATAL_ERROR,
+ Field_varstring::charset(),
+ (const char *) get_data(),
+ get_length(), decimal_value);
return decimal_value;
+
}
@@ -7263,7 +7626,8 @@ uint Field_varstring::max_packed_col_length(uint max_length)
return (max_length > 255 ? 2 : 1)+max_length;
}
-uint Field_varstring::get_key_image(uchar *buff, uint length, imagetype type)
+uint Field_varstring::get_key_image(uchar *buff, uint length,
+ imagetype type_arg)
{
uint f_length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
uint local_char_length= length / field_charset->mbmaxlen;
@@ -7317,11 +7681,12 @@ int Field_varstring::cmp_binary(const uchar *a_ptr, const uchar *b_ptr,
}
-Field *Field_varstring::new_field(MEM_ROOT *root, TABLE *new_table,
- bool keep_type)
+Field *Field_varstring::make_new_field(MEM_ROOT *root, TABLE *new_table,
+ bool keep_type)
{
- Field_varstring *res= (Field_varstring*) Field::new_field(root, new_table,
- keep_type);
+ Field_varstring *res= (Field_varstring*) Field::make_new_field(root,
+ new_table,
+ keep_type);
if (res)
res->length_bytes= length_bytes;
return res;
@@ -7496,32 +7861,31 @@ int Field_blob::store(longlong nr, bool unsigned_val)
double Field_blob::val_real(void)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- int not_used;
- char *end_not_used, *blob;
- uint32 length;
- CHARSET_INFO *cs;
-
+ char *blob;
memcpy(&blob, ptr+packlength, sizeof(char*));
if (!blob)
return 0.0;
- length= get_length(ptr);
- cs= charset();
- return my_strntod(cs, blob, length, &end_not_used, &not_used);
+ THD *thd= get_thd();
+ return Converter_strntod_with_warn(thd, Warn_filter(thd),
+ Field_blob::charset(),
+ blob, get_length(ptr)).result();
}
longlong Field_blob::val_int(void)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- int not_used;
char *blob;
memcpy(&blob, ptr+packlength, sizeof(char*));
if (!blob)
return 0;
- uint32 length=get_length(ptr);
- return my_strntoll(charset(),blob,length,10,NULL,&not_used);
+ THD *thd= get_thd();
+ return Converter_strntoll_with_warn(thd, Warn_filter(thd),
+ Field_blob::charset(),
+ blob, get_length(ptr)).result();
}
+
String *Field_blob::val_str(String *val_buffer __attribute__((unused)),
String *val_ptr)
{
@@ -7550,8 +7914,11 @@ my_decimal *Field_blob::val_decimal(my_decimal *decimal_value)
else
length= get_length(ptr);
- str2my_decimal(E_DEC_FATAL_ERROR, blob, length, charset(),
- decimal_value);
+ THD *thd= get_thd();
+ Converter_str2my_decimal_with_warn(thd, Warn_filter(thd),
+ E_DEC_FATAL_ERROR,
+ Field_blob::charset(),
+ blob, length, decimal_value);
return decimal_value;
}
@@ -7717,7 +8084,7 @@ int Field_blob::do_save_field_metadata(uchar *metadata_ptr)
uint32 Field_blob::sort_length() const
{
- return (uint32) (current_thd->variables.max_sort_length +
+ return (uint32) (get_thd()->variables.max_sort_length +
(field_charset == &my_charset_bin ? 0 : packlength));
}
@@ -7996,7 +8363,7 @@ void Field_geom::sql_type(String &res) const
int Field_geom::store(double nr)
{
my_message(ER_CANT_CREATE_GEOMETRY_OBJECT,
- ER(ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0));
+ ER_THD(get_thd(), ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0));
return -1;
}
@@ -8004,7 +8371,7 @@ int Field_geom::store(double nr)
int Field_geom::store(longlong nr, bool unsigned_val)
{
my_message(ER_CANT_CREATE_GEOMETRY_OBJECT,
- ER(ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0));
+ ER_THD(get_thd(), ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0));
return -1;
}
@@ -8012,7 +8379,7 @@ int Field_geom::store(longlong nr, bool unsigned_val)
int Field_geom::store_decimal(const my_decimal *)
{
my_message(ER_CANT_CREATE_GEOMETRY_OBJECT,
- ER(ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0));
+ ER_THD(get_thd(), ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0));
return -1;
}
@@ -8039,10 +8406,13 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
(uint32) geom_type != wkb_type)
{
my_printf_error(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
- ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD), MYF(0),
- Geometry::ci_collection[geom_type]->m_name.str,
- Geometry::ci_collection[wkb_type]->m_name.str, field_name,
- (ulong) table->in_use->get_stmt_da()->current_row_for_warning());
+ ER_THD(get_thd(), ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
+ MYF(0),
+ Geometry::ci_collection[geom_type]->m_name.str,
+ Geometry::ci_collection[wkb_type]->m_name.str,
+ field_name,
+ (ulong) table->in_use->get_stmt_da()->
+ current_row_for_warning());
goto err_exit;
}
@@ -8059,12 +8429,20 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
err:
my_message(ER_CANT_CREATE_GEOMETRY_OBJECT,
- ER(ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0));
+ ER_THD(get_thd(), ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0));
err_exit:
bzero(ptr, Field_blob::pack_length());
return -1;
}
+Field::geometry_type Field_geom::geometry_type_merge(geometry_type a,
+ geometry_type b)
+{
+ if (a == b)
+ return a;
+ return Field::GEOM_GEOMETRY;
+}
+
#endif /*HAVE_SPATIAL*/
/****************************************************************************
@@ -8125,13 +8503,13 @@ int Field_enum::store(const char *from,uint length,CHARSET_INFO *cs)
if (err || end != from+length || tmp > typelib->count)
{
tmp=0;
- set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
}
if (!get_thd()->count_cuted_fields)
err= 0;
}
else
- set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
}
store_type((ulonglong) tmp);
return err;
@@ -8150,7 +8528,7 @@ int Field_enum::store(longlong nr, bool unsigned_val)
int error= 0;
if ((ulonglong) nr > typelib->count || nr == 0)
{
- set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
if (nr != 0 || get_thd()->count_cuted_fields)
{
nr= 0;
@@ -8254,10 +8632,11 @@ void Field_enum::sql_type(String &res) const
}
-Field *Field_enum::new_field(MEM_ROOT *root, TABLE *new_table,
- bool keep_type)
+Field *Field_enum::make_new_field(MEM_ROOT *root, TABLE *new_table,
+ bool keep_type)
{
- Field_enum *res= (Field_enum*) Field::new_field(root, new_table, keep_type);
+ Field_enum *res= (Field_enum*) Field::make_new_field(root, new_table,
+ keep_type);
if (res)
res->typelib= copy_typelib(root, typelib);
return res;
@@ -8303,11 +8682,11 @@ int Field_set::store(const char *from,uint length,CHARSET_INFO *cs)
tmp > (ulonglong) (((longlong) 1 << typelib->count) - (longlong) 1))
{
tmp=0;
- set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
}
}
else if (got_warning)
- set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
store_type(tmp);
return err;
}
@@ -8327,7 +8706,7 @@ int Field_set::store(longlong nr, bool unsigned_val)
if ((ulonglong) nr > max_nr)
{
nr&= max_nr;
- set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
error=1;
}
store_type((ulonglong) nr);
@@ -8543,7 +8922,7 @@ uint Field_num::is_equal(Create_field *new_field)
}
-bool Field_enum::can_optimize_keypart_ref(const Item_func *cond,
+bool Field_enum::can_optimize_keypart_ref(const Item_bool_func *cond,
const Item *item) const
{
DBUG_ASSERT(cmp_type() == INT_RESULT);
@@ -8558,8 +8937,7 @@ bool Field_enum::can_optimize_keypart_ref(const Item_func *cond,
case REAL_RESULT:
return true;
case STRING_RESULT:
- return charset() == ((Item_func*)cond)->compare_collation();
- case IMPOSSIBLE_RESULT:
+ return charset() == cond->compare_collation();
case ROW_RESULT:
DBUG_ASSERT(0);
break;
@@ -8704,9 +9082,9 @@ int Field_bit::store(const char *from, uint length, CHARSET_INFO *cs)
set_rec_bits((1 << bit_len) - 1, bit_ptr, bit_ofs, bit_len);
memset(ptr, 0xff, bytes_in_rec);
if (get_thd()->really_abort_on_warning())
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_DATA_TOO_LONG, 1);
+ set_warning(ER_DATA_TOO_LONG, 1);
else
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
return 1;
}
/* delta is >= -1 here */
@@ -8882,9 +9260,9 @@ uint Field_bit::get_key_image(uchar *buff, uint length, imagetype type_arg)
*buff++= bits;
length--;
}
- uint data_length = MY_MIN(length, bytes_in_rec);
- memcpy(buff, ptr, data_length);
- return data_length + 1;
+ uint tmp_data_length = MY_MIN(length, bytes_in_rec);
+ memcpy(buff, ptr, tmp_data_length);
+ return tmp_data_length + 1;
}
@@ -9100,8 +9478,8 @@ void Field_bit::set_default()
{
if (bit_len > 0)
{
- my_ptrdiff_t const offset= table->s->default_values - table->record[0];
- uchar bits= get_rec_bits(bit_ptr + offset, bit_ofs, bit_len);
+ my_ptrdiff_t const col_offset= table->s->default_values - table->record[0];
+ uchar bits= get_rec_bits(bit_ptr + col_offset, bit_ofs, bit_len);
set_rec_bits(bits, bit_ptr, bit_ofs, bit_len);
}
Field::set_default();
@@ -9141,9 +9519,9 @@ int Field_bit_as_char::store(const char *from, uint length, CHARSET_INFO *cs)
if (bits)
*ptr&= ((1 << bits) - 1); /* set first uchar */
if (get_thd()->really_abort_on_warning())
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_DATA_TOO_LONG, 1);
+ set_warning(ER_DATA_TOO_LONG, 1);
else
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
return 1;
}
bzero(ptr, delta);
@@ -9445,14 +9823,6 @@ bool Create_field::check(THD *thd)
sql_type= vcol_info->get_real_type();
}
- /*
- Set NO_DEFAULT_VALUE_FLAG if this field doesn't have a default value and
- it is NOT NULL, not an AUTO_INCREMENT field and not a TIMESTAMP.
- */
- if (!def && unireg_check == Field::NONE &&
- (flags & NOT_NULL_FLAG) && !is_timestamp_type(sql_type))
- flags|= NO_DEFAULT_VALUE_FLAG;
-
sign_len= flags & UNSIGNED_FLAG ? 0 : 1;
switch (sql_type) {
@@ -9537,7 +9907,7 @@ bool Create_field::check(THD *thd)
*/
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_BLOB_CANT_HAVE_DEFAULT,
- ER(ER_BLOB_CANT_HAVE_DEFAULT),
+ ER_THD(thd, ER_BLOB_CANT_HAVE_DEFAULT),
field_name);
}
def= 0;
@@ -9645,6 +10015,16 @@ bool Create_field::check(THD *thd)
/* Remember the value of length */
char_length= length;
+ /*
+ Set NO_DEFAULT_VALUE_FLAG if this field doesn't have a default value and
+ it is NOT NULL, not an AUTO_INCREMENT field and not a TIMESTAMP.
+ We need to do this check here and in mysql_create_prepare_table() as
+ sp_head::fill_field_definition() calls this function.
+ */
+ if (!def && unireg_check == Field::NONE &&
+ (flags & NOT_NULL_FLAG) && !is_timestamp_type(sql_type))
+ flags|= NO_DEFAULT_VALUE_FLAG;
+
if (!(flags & BLOB_FLAG) &&
((length > max_field_charlength &&
(sql_type != MYSQL_TYPE_VARCHAR || def)) ||
@@ -9756,7 +10136,9 @@ uint pack_length_to_packflag(uint type)
}
-Field *make_field(TABLE_SHARE *share, uchar *ptr, uint32 field_length,
+Field *make_field(TABLE_SHARE *share,
+ MEM_ROOT *mem_root,
+ uchar *ptr, uint32 field_length,
uchar *null_pos, uchar null_bit,
uint pack_flag,
enum_field_types field_type,
@@ -9768,6 +10150,7 @@ Field *make_field(TABLE_SHARE *share, uchar *ptr, uint32 field_length,
{
uchar *UNINIT_VAR(bit_ptr);
uchar UNINIT_VAR(bit_offset);
+
if (field_type == MYSQL_TYPE_BIT && !f_bit_as_char(pack_flag))
{
bit_ptr= null_pos;
@@ -9804,16 +10187,18 @@ Field *make_field(TABLE_SHARE *share, uchar *ptr, uint32 field_length,
if (field_type == MYSQL_TYPE_STRING ||
field_type == MYSQL_TYPE_DECIMAL || // 3.23 or 4.0 string
field_type == MYSQL_TYPE_VAR_STRING)
- return new Field_string(ptr,field_length,null_pos,null_bit,
- unireg_check, field_name,
- field_charset);
+ return new (mem_root)
+ Field_string(ptr,field_length,null_pos,null_bit,
+ unireg_check, field_name,
+ field_charset);
if (field_type == MYSQL_TYPE_VARCHAR)
- return new Field_varstring(ptr,field_length,
- HA_VARCHAR_PACKLENGTH(field_length),
- null_pos,null_bit,
- unireg_check, field_name,
- share,
- field_charset);
+ return new (mem_root)
+ Field_varstring(ptr,field_length,
+ HA_VARCHAR_PACKLENGTH(field_length),
+ null_pos,null_bit,
+ unireg_check, field_name,
+ share,
+ field_charset);
return 0; // Error
}
@@ -9825,138 +10210,160 @@ Field *make_field(TABLE_SHARE *share, uchar *ptr, uint32 field_length,
if (f_is_geom(pack_flag))
{
status_var_increment(current_thd->status_var.feature_gis);
- return new Field_geom(ptr,null_pos,null_bit,
- unireg_check, field_name, share,
- pack_length, geom_type, srid);
+ return new (mem_root)
+ Field_geom(ptr,null_pos,null_bit,
+ unireg_check, field_name, share,
+ pack_length, geom_type, srid);
}
#endif
if (f_is_blob(pack_flag))
- return new Field_blob(ptr,null_pos,null_bit,
- unireg_check, field_name, share,
- pack_length, field_charset);
+ return new (mem_root)
+ Field_blob(ptr,null_pos,null_bit,
+ unireg_check, field_name, share,
+ pack_length, field_charset);
if (interval)
{
if (f_is_enum(pack_flag))
- return new Field_enum(ptr,field_length,null_pos,null_bit,
- unireg_check, field_name,
- pack_length, interval, field_charset);
+ return new (mem_root)
+ Field_enum(ptr,field_length,null_pos,null_bit,
+ unireg_check, field_name,
+ pack_length, interval, field_charset);
else
- return new Field_set(ptr,field_length,null_pos,null_bit,
- unireg_check, field_name,
- pack_length, interval, field_charset);
+ return new (mem_root)
+ Field_set(ptr,field_length,null_pos,null_bit,
+ unireg_check, field_name,
+ pack_length, interval, field_charset);
}
}
switch (field_type) {
case MYSQL_TYPE_DECIMAL:
- return new Field_decimal(ptr,field_length,null_pos,null_bit,
- unireg_check, field_name,
- f_decimals(pack_flag),
- f_is_zerofill(pack_flag) != 0,
- f_is_dec(pack_flag) == 0);
+ return new (mem_root)
+ Field_decimal(ptr,field_length,null_pos,null_bit,
+ unireg_check, field_name,
+ f_decimals(pack_flag),
+ f_is_zerofill(pack_flag) != 0,
+ f_is_dec(pack_flag) == 0);
case MYSQL_TYPE_NEWDECIMAL:
- return new Field_new_decimal(ptr,field_length,null_pos,null_bit,
- unireg_check, field_name,
- f_decimals(pack_flag),
- f_is_zerofill(pack_flag) != 0,
- f_is_dec(pack_flag) == 0);
+ return new (mem_root)
+ Field_new_decimal(ptr,field_length,null_pos,null_bit,
+ unireg_check, field_name,
+ f_decimals(pack_flag),
+ f_is_zerofill(pack_flag) != 0,
+ f_is_dec(pack_flag) == 0);
case MYSQL_TYPE_FLOAT:
- return new Field_float(ptr,field_length,null_pos,null_bit,
- unireg_check, field_name,
- f_decimals(pack_flag),
- f_is_zerofill(pack_flag) != 0,
- f_is_dec(pack_flag)== 0);
+ return new (mem_root)
+ Field_float(ptr,field_length,null_pos,null_bit,
+ unireg_check, field_name,
+ f_decimals(pack_flag),
+ f_is_zerofill(pack_flag) != 0,
+ f_is_dec(pack_flag)== 0);
case MYSQL_TYPE_DOUBLE:
- return new Field_double(ptr,field_length,null_pos,null_bit,
- unireg_check, field_name,
- f_decimals(pack_flag),
- f_is_zerofill(pack_flag) != 0,
- f_is_dec(pack_flag)== 0);
+ return new (mem_root)
+ Field_double(ptr,field_length,null_pos,null_bit,
+ unireg_check, field_name,
+ f_decimals(pack_flag),
+ f_is_zerofill(pack_flag) != 0,
+ f_is_dec(pack_flag)== 0);
case MYSQL_TYPE_TINY:
- return new Field_tiny(ptr,field_length,null_pos,null_bit,
- unireg_check, field_name,
- f_is_zerofill(pack_flag) != 0,
- f_is_dec(pack_flag) == 0);
+ return new (mem_root)
+ Field_tiny(ptr,field_length,null_pos,null_bit,
+ unireg_check, field_name,
+ f_is_zerofill(pack_flag) != 0,
+ f_is_dec(pack_flag) == 0);
case MYSQL_TYPE_SHORT:
- return new Field_short(ptr,field_length,null_pos,null_bit,
- unireg_check, field_name,
- f_is_zerofill(pack_flag) != 0,
- f_is_dec(pack_flag) == 0);
+ return new (mem_root)
+ Field_short(ptr,field_length,null_pos,null_bit,
+ unireg_check, field_name,
+ f_is_zerofill(pack_flag) != 0,
+ f_is_dec(pack_flag) == 0);
case MYSQL_TYPE_INT24:
- return new Field_medium(ptr,field_length,null_pos,null_bit,
- unireg_check, field_name,
- f_is_zerofill(pack_flag) != 0,
- f_is_dec(pack_flag) == 0);
+ return new (mem_root)
+ Field_medium(ptr,field_length,null_pos,null_bit,
+ unireg_check, field_name,
+ f_is_zerofill(pack_flag) != 0,
+ f_is_dec(pack_flag) == 0);
case MYSQL_TYPE_LONG:
- return new Field_long(ptr,field_length,null_pos,null_bit,
- unireg_check, field_name,
- f_is_zerofill(pack_flag) != 0,
- f_is_dec(pack_flag) == 0);
+ return new (mem_root)
+ Field_long(ptr,field_length,null_pos,null_bit,
+ unireg_check, field_name,
+ f_is_zerofill(pack_flag) != 0,
+ f_is_dec(pack_flag) == 0);
case MYSQL_TYPE_LONGLONG:
- return new Field_longlong(ptr,field_length,null_pos,null_bit,
- unireg_check, field_name,
- f_is_zerofill(pack_flag) != 0,
- f_is_dec(pack_flag) == 0);
+ return new (mem_root)
+ Field_longlong(ptr,field_length,null_pos,null_bit,
+ unireg_check, field_name,
+ f_is_zerofill(pack_flag) != 0,
+ f_is_dec(pack_flag) == 0);
case MYSQL_TYPE_TIMESTAMP:
{
uint dec= field_length > MAX_DATETIME_WIDTH ?
field_length - MAX_DATETIME_WIDTH - 1: 0;
- return new_Field_timestamp(ptr, null_pos, null_bit, unireg_check,
+ return new_Field_timestamp(mem_root, ptr, null_pos, null_bit, unireg_check,
field_name, share, dec);
}
case MYSQL_TYPE_TIMESTAMP2:
{
uint dec= field_length > MAX_DATETIME_WIDTH ?
field_length - MAX_DATETIME_WIDTH - 1: 0;
- return new Field_timestampf(ptr, null_pos, null_bit, unireg_check,
- field_name, share, dec);
+ return new (mem_root)
+ Field_timestampf(ptr, null_pos, null_bit, unireg_check,
+ field_name, share, dec);
}
case MYSQL_TYPE_YEAR:
- return new Field_year(ptr,field_length,null_pos,null_bit,
- unireg_check, field_name);
+ return new (mem_root)
+ Field_year(ptr,field_length,null_pos,null_bit,
+ unireg_check, field_name);
case MYSQL_TYPE_DATE:
- return new Field_date(ptr,null_pos,null_bit,
- unireg_check, field_name);
+ return new (mem_root)
+ Field_date(ptr,null_pos,null_bit,
+ unireg_check, field_name);
case MYSQL_TYPE_NEWDATE:
- return new Field_newdate(ptr,null_pos,null_bit,
- unireg_check, field_name);
+ return new (mem_root)
+ Field_newdate(ptr,null_pos,null_bit,
+ unireg_check, field_name);
case MYSQL_TYPE_TIME:
{
uint dec= field_length > MIN_TIME_WIDTH ?
field_length - MIN_TIME_WIDTH - 1: 0;
- return new_Field_time(ptr, null_pos, null_bit, unireg_check,
+ return new_Field_time(mem_root, ptr, null_pos, null_bit, unireg_check,
field_name, dec);
}
case MYSQL_TYPE_TIME2:
{
uint dec= field_length > MIN_TIME_WIDTH ?
field_length - MIN_TIME_WIDTH - 1: 0;
- return new Field_timef(ptr, null_pos, null_bit, unireg_check,
- field_name, dec);
+ return new (mem_root)
+ Field_timef(ptr, null_pos, null_bit, unireg_check,
+ field_name, dec);
}
case MYSQL_TYPE_DATETIME:
{
uint dec= field_length > MAX_DATETIME_WIDTH ?
field_length - MAX_DATETIME_WIDTH - 1: 0;
- return new_Field_datetime(ptr, null_pos, null_bit, unireg_check,
+ return new_Field_datetime(mem_root, ptr, null_pos, null_bit, unireg_check,
field_name, dec);
}
case MYSQL_TYPE_DATETIME2:
{
uint dec= field_length > MAX_DATETIME_WIDTH ?
field_length - MAX_DATETIME_WIDTH - 1: 0;
- return new Field_datetimef(ptr, null_pos, null_bit, unireg_check,
- field_name, dec);
+ return new (mem_root)
+ Field_datetimef(ptr, null_pos, null_bit, unireg_check,
+ field_name, dec);
}
case MYSQL_TYPE_NULL:
- return new Field_null(ptr, field_length, unireg_check, field_name,
- field_charset);
+ return new (mem_root)
+ Field_null(ptr, field_length, unireg_check, field_name,
+ field_charset);
case MYSQL_TYPE_BIT:
- return f_bit_as_char(pack_flag) ?
- new Field_bit_as_char(ptr, field_length, null_pos, null_bit,
- unireg_check, field_name) :
- new Field_bit(ptr, field_length, null_pos, null_bit, bit_ptr,
- bit_offset, unireg_check, field_name);
+ return (f_bit_as_char(pack_flag) ?
+ new (mem_root)
+ Field_bit_as_char(ptr, field_length, null_pos, null_bit,
+ unireg_check, field_name) :
+ new (mem_root)
+ Field_bit(ptr, field_length, null_pos, null_bit, bit_ptr,
+ bit_offset, unireg_check, field_name));
default: // Impossible (Wrong version)
break;
@@ -9967,7 +10374,7 @@ Field *make_field(TABLE_SHARE *share, uchar *ptr, uint32 field_length,
/** Create a field suitable for create of table. */
-Create_field::Create_field(Field *old_field,Field *orig_field)
+Create_field::Create_field(THD *thd, Field *old_field, Field *orig_field)
{
field= old_field;
field_name=change=old_field->field_name;
@@ -10021,9 +10428,9 @@ Create_field::Create_field(Field *old_field,Field *orig_field)
{
char buff[sizeof("YEAR()") + MY_INT64_NUM_DECIMAL_DIGITS + 1];
my_snprintf(buff, sizeof(buff), "YEAR(%lu)", length);
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_NOTE,
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_WARN_DEPRECATED_SYNTAX,
- ER(ER_WARN_DEPRECATED_SYNTAX),
+ ER_THD(thd, ER_WARN_DEPRECATED_SYNTAX),
buff, "YEAR(4)");
}
break;
@@ -10069,21 +10476,15 @@ Create_field::Create_field(Field *old_field,Field *orig_field)
}
if (!default_now) // Give a constant default
{
- char buff[MAX_FIELD_WIDTH];
- String tmp(buff,sizeof(buff), charset);
-
/* Get the value from default_values */
- my_ptrdiff_t diff= orig_field->table->default_values_offset();
- orig_field->move_field_offset(diff); // Points now at default_values
- if (!orig_field->is_real_null())
+ const uchar *dv= orig_field->table->s->default_values;
+ if (!orig_field->is_null_in_record(dv))
{
- char buff[MAX_FIELD_WIDTH], *pos;
- String tmp(buff, sizeof(buff), charset), *res;
- res= orig_field->val_str(&tmp);
- pos= (char*) sql_strmake(res->ptr(), res->length());
- def= new Item_string(pos, res->length(), charset);
+ StringBuffer<MAX_FIELD_WIDTH> tmp(charset);
+ String *res= orig_field->val_str(&tmp, orig_field->ptr_in_record(dv));
+ char *pos= (char*) sql_strmake(res->ptr(), res->length());
+ def= new (thd->mem_root) Item_string(thd, pos, res->length(), charset);
}
- orig_field->move_field_offset(-diff); // Back to record[0]
}
}
}
@@ -10193,11 +10594,11 @@ Field::set_warning(Sql_condition::enum_warning_level level, uint code,
If this field was created only for type conversion purposes it
will have table == NULL.
*/
- THD *thd= table ? table->in_use : current_thd;
+ THD *thd= get_thd();
if (thd->count_cuted_fields)
{
thd->cuted_fields+= cut_increment;
- push_warning_printf(thd, level, code, ER(code), field_name,
+ push_warning_printf(thd, level, code, ER_THD(thd, code), field_name,
thd->get_stmt_da()->current_row_for_warning());
return 0;
}
@@ -10226,6 +10627,7 @@ Field::set_warning(Sql_condition::enum_warning_level level, uint code,
void Field::set_datetime_warning(Sql_condition::enum_warning_level level,
uint code, const ErrConv *str,
timestamp_type ts_type, int cuted_increment)
+ const
{
THD *thd= get_thd();
if (thd->really_abort_on_warning() && level >= Sql_condition::WARN_LEVEL_WARN)
@@ -10235,6 +10637,19 @@ void Field::set_datetime_warning(Sql_condition::enum_warning_level level,
}
+void Field::set_warning_truncated_wrong_value(const char *type_arg,
+ const char *value)
+{
+ THD *thd= get_thd();
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
+ ER_THD(thd, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
+ type_arg, value, field_name,
+ static_cast<ulong>(thd->get_stmt_da()->
+ current_row_for_warning()));
+}
+
+
/*
@brief
Return possible keys for a field
@@ -10283,3 +10698,22 @@ void Field::set_explicit_default(Item *value)
return;
set_has_explicit_value();
}
+
+
+bool Field::validate_value_in_record_with_warn(THD *thd, const uchar *record)
+{
+ my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
+ bool rc;
+ if ((rc= validate_value_in_record(thd, record)))
+ {
+ // Get and report val_str() for the DEFAULT value
+ StringBuffer<MAX_FIELD_WIDTH> tmp;
+ val_str(&tmp, ptr_in_record(record));
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_INVALID_DEFAULT_VALUE_FOR_FIELD,
+ ER_THD(thd, ER_INVALID_DEFAULT_VALUE_FOR_FIELD),
+ ErrConvString(&tmp).ptr(), field_name);
+ }
+ dbug_tmp_restore_column_map(table->read_set, old_map);
+ return rc;
+}
diff --git a/sql/field.h b/sql/field.h
index dac10abd50a..7b76512bc69 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/*
- Because of the function new_field() all field classes that have static
+ Because of the function make_new_field() all field classes that have static
variables must declare the size_of() member function.
*/
@@ -40,7 +40,8 @@ class Field;
class Column_statistics;
class Column_statistics_collected;
class Item_func;
-class Item_bool_func2;
+class Item_bool_func;
+class Item_equal;
enum enum_check_fields
{
@@ -50,6 +51,302 @@ enum enum_check_fields
};
+/*
+ Common declarations for Field and Item
+*/
+class Value_source
+{
+protected:
+
+ // Parameters for warning and note generation
+ class Warn_filter
+ {
+ bool m_want_warning_edom;
+ bool m_want_note_truncated_spaces;
+ public:
+ Warn_filter(bool want_warning_edom, bool want_note_truncated_spaces) :
+ m_want_warning_edom(want_warning_edom),
+ m_want_note_truncated_spaces(want_note_truncated_spaces)
+ { }
+ Warn_filter(const THD *thd);
+ bool want_warning_edom() const
+ { return m_want_warning_edom; }
+ bool want_note_truncated_spaces() const
+ { return m_want_note_truncated_spaces; }
+ };
+ class Warn_filter_all: public Warn_filter
+ {
+ public:
+ Warn_filter_all() :Warn_filter(true, true) { }
+ };
+
+
+ // String-to-number converters
+ class Converter_string_to_number
+ {
+ protected:
+ char *m_end_of_num; // Where the low-level conversion routine stopped
+ int m_error; // The error code returned by the low-level routine
+ bool m_edom; // If EDOM-alike error happened during conversion
+ /**
+ Check string-to-number conversion and produce a warning if
+ - could not convert any digits (EDOM-alike error)
+ - found garbage at the end of the string
+ - found extra spaces at the end (a note)
+ See also Field_num::check_edom_and_truncation() for a similar function.
+
+ @param thd - the thread that will be used to generate warnings.
+ Can be NULL (which means current_thd will be used
+ if a warning is really necessary).
+ @param type - name of the data type
+ (e.g. "INTEGER", "DECIMAL", "DOUBLE")
+ @param cs - character set of the original string
+ @param str - the original string
+ @param end - the end of the string
+ @param allow_notes - tells if trailing space notes should be displayed
+ or suppressed.
+
+ Unlike Field_num::check_edom_and_truncation(), this function does not
+ distinguish between EDOM and truncation and reports the same warning for
+ both cases. Perhaps we should eventually print different warnings,
+ to make the explicit CAST work closer to the implicit cast in
+ Field_xxx::store().
+ */
+ void check_edom_and_truncation(THD *thd, Warn_filter filter,
+ const char *type,
+ CHARSET_INFO *cs,
+ const char *str,
+ size_t length) const;
+ public:
+ int error() const { return m_error; }
+ };
+
+ class Converter_strntod: public Converter_string_to_number
+ {
+ double m_result;
+ public:
+ Converter_strntod(CHARSET_INFO *cs, const char *str, size_t length)
+ {
+ m_result= my_strntod(cs, (char *) str, length, &m_end_of_num, &m_error);
+ // strntod() does not set an error if the input string was empty
+ m_edom= m_error !=0 || str == m_end_of_num;
+ }
+ double result() const { return m_result; }
+ };
+
+ class Converter_string_to_longlong: public Converter_string_to_number
+ {
+ protected:
+ longlong m_result;
+ public:
+ longlong result() const { return m_result; }
+ };
+
+ class Converter_strntoll: public Converter_string_to_longlong
+ {
+ public:
+ Converter_strntoll(CHARSET_INFO *cs, const char *str, size_t length)
+ {
+ m_result= my_strntoll(cs, str, length, 10, &m_end_of_num, &m_error);
+ /*
+ All non-zero errors means EDOM error.
+ strntoll() does not set an error if the input string was empty.
+ Check it here.
+ Notice the different with the same condition in Converter_strntoll10.
+ */
+ m_edom= m_error != 0 || str == m_end_of_num;
+ }
+ };
+
+ class Converter_strtoll10: public Converter_string_to_longlong
+ {
+ public:
+ Converter_strtoll10(CHARSET_INFO *cs, const char *str, size_t length)
+ {
+ m_end_of_num= (char *) str + length;
+ m_result= (*(cs->cset->strtoll10))(cs, str, &m_end_of_num, &m_error);
+ /*
+ Negative error means "good negative number".
+ Only a positive m_error value means a real error.
+ strtoll10() sets error to MY_ERRNO_EDOM in case of an empty string,
+ so we don't have to additionally catch empty strings here.
+ */
+ m_edom= m_error > 0;
+ }
+ };
+
+ class Converter_str2my_decimal: public Converter_string_to_number
+ {
+ public:
+ Converter_str2my_decimal(uint mask,
+ CHARSET_INFO *cs, const char *str, size_t length,
+ my_decimal *buf)
+ {
+ m_error= str2my_decimal(mask, str, length, cs,
+ buf, (const char **) &m_end_of_num);
+ // E_DEC_TRUNCATED means a very minor truncation: '1e-100' -> 0
+ m_edom= m_error && m_error != E_DEC_TRUNCATED;
+ }
+ };
+
+
+ // String-to-number converters with automatic warning generation
+ class Converter_strntod_with_warn: public Converter_strntod
+ {
+ public:
+ Converter_strntod_with_warn(THD *thd, Warn_filter filter,
+ CHARSET_INFO *cs,
+ const char *str, size_t length)
+ :Converter_strntod(cs, str, length)
+ {
+ check_edom_and_truncation(thd, filter, "DOUBLE", cs, str, length);
+ }
+ };
+
+ class Converter_strntoll_with_warn: public Converter_strntoll
+ {
+ public:
+ Converter_strntoll_with_warn(THD *thd, Warn_filter filter,
+ CHARSET_INFO *cs,
+ const char *str, size_t length)
+ :Converter_strntoll(cs, str, length)
+ {
+ check_edom_and_truncation(thd, filter, "INTEGER", cs, str, length);
+ }
+ };
+
+ class Converter_strtoll10_with_warn: public Converter_strtoll10
+ {
+ public:
+ Converter_strtoll10_with_warn(THD *thd, Warn_filter filter,
+ CHARSET_INFO *cs,
+ const char *str, size_t length)
+ :Converter_strtoll10(cs, str, length)
+ {
+ check_edom_and_truncation(thd, filter, "INTEGER", cs, str, length);
+ }
+ };
+
+ class Converter_str2my_decimal_with_warn: public Converter_str2my_decimal
+ {
+ public:
+ Converter_str2my_decimal_with_warn(THD *thd, Warn_filter filter,
+ uint mask, CHARSET_INFO *cs,
+ const char *str, size_t length,
+ my_decimal *buf)
+ :Converter_str2my_decimal(mask, cs, str, length, buf)
+ {
+ check_edom_and_truncation(thd, filter, "DECIMAL", cs, str, length);
+ }
+ };
+
+
+ // String-to-number convertion methods for the old code compatibility
+ longlong longlong_from_string_with_check(CHARSET_INFO *cs, const char *cptr,
+ const char *end) const
+ {
+ /*
+ TODO: Give error if we wanted a signed integer and we got an unsigned
+ one
+
+ Notice, longlong_from_string_with_check() honors thd->no_error, because
+ it's used to handle queries like this:
+ SELECT COUNT(@@basedir);
+ and is called when Item_func_get_system_var::update_null_value()
+ suppresses warnings and then calls val_int().
+ The other methods {double|decimal}_from_string_with_check() ignore
+ thd->no_errors, because they are not used for update_null_value()
+ and they always allow all kind of warnings.
+ */
+ THD *thd= current_thd;
+ return Converter_strtoll10_with_warn(thd, Warn_filter(thd),
+ cs, cptr, end - cptr).result();
+ }
+
+ double double_from_string_with_check(CHARSET_INFO *cs, const char *cptr,
+ const char *end) const
+ {
+ return Converter_strntod_with_warn(NULL, Warn_filter_all(),
+ cs, cptr, end - cptr).result();
+ }
+ my_decimal *decimal_from_string_with_check(my_decimal *decimal_value,
+ CHARSET_INFO *cs,
+ const char *cptr,
+ const char *end)
+ {
+ Converter_str2my_decimal_with_warn(NULL, Warn_filter_all(),
+ E_DEC_FATAL_ERROR & ~E_DEC_BAD_NUM,
+ cs, cptr, end - cptr, decimal_value);
+ return decimal_value;
+ }
+ // End of String-to-number conversion methods
+
+public:
+ /*
+ The enumeration Subst_constraint is currently used only in implementations
+ of the virtual function subst_argument_checker.
+ */
+ enum Subst_constraint
+ {
+ ANY_SUBST, /* Any substitution for a field is allowed */
+ IDENTITY_SUBST /* Substitution for a field is allowed if any two
+ different values of the field type are not equal */
+ };
+ /*
+ Item context attributes.
+ Comparison functions pass their attributes to propagate_equal_fields().
+ For exmple, for string comparison, the collation of the comparison
+ operation is important inside propagate_equal_fields().
+ */
+ class Context
+ {
+ /*
+ Which type of propagation is allowed:
+ - ANY_SUBST (loose equality, according to the collation), or
+ - IDENTITY_SUBST (strict binary equality).
+ */
+ Subst_constraint m_subst_constraint;
+ /*
+ Comparison type.
+ Impostant only when ANY_SUBSTS.
+ */
+ Item_result m_compare_type;
+ /*
+ Collation of the comparison operation.
+ Important only when ANY_SUBST.
+ */
+ CHARSET_INFO *m_compare_collation;
+ public:
+ Context(Subst_constraint subst, Item_result type, CHARSET_INFO *cs)
+ :m_subst_constraint(subst),
+ m_compare_type(type),
+ m_compare_collation(cs) { }
+ Subst_constraint subst_constraint() const { return m_subst_constraint; }
+ Item_result compare_type() const
+ {
+ DBUG_ASSERT(m_subst_constraint == ANY_SUBST);
+ return m_compare_type;
+ }
+ CHARSET_INFO *compare_collation() const
+ {
+ DBUG_ASSERT(m_subst_constraint == ANY_SUBST);
+ return m_compare_collation;
+ }
+ };
+ class Context_identity: public Context
+ { // Use this to request only exact value, no invariants.
+ public:
+ Context_identity()
+ :Context(IDENTITY_SUBST, STRING_RESULT, &my_charset_bin) { }
+ };
+ class Context_boolean: public Context
+ { // Use this when an item is [a part of] a boolean expression
+ public:
+ Context_boolean() :Context(ANY_SUBST, INT_RESULT, &my_charset_bin) { }
+ };
+};
+
+
enum Derivation
{
DERIVATION_IGNORABLE= 6,
@@ -61,6 +358,7 @@ enum Derivation
DERIVATION_EXPLICIT= 0
};
+
#define STORAGE_TYPE_MASK 7
#define COLUMN_FORMAT_MASK 7
#define COLUMN_FORMAT_SHIFT 3
@@ -287,7 +585,7 @@ public:
}
};
-class Field
+class Field: public Value_source
{
Field(const Item &); /* Prevent use of these */
void operator=(Field &);
@@ -518,6 +816,11 @@ public:
virtual int reset(void) { bzero(ptr,pack_length()); return 0; }
virtual void reset_fields() {}
+ const uchar *ptr_in_record(const uchar *record) const
+ {
+ my_ptrdiff_t l_offset= (my_ptrdiff_t) (record - table->record[0]);
+ return ptr + l_offset;
+ }
virtual void set_default()
{
my_ptrdiff_t l_offset= (my_ptrdiff_t) (table->s->default_values -
@@ -727,7 +1030,8 @@ public:
null_bit= p_null_bit;
}
- inline THD *get_thd() { return table ? table->in_use : current_thd; }
+ inline THD *get_thd() const
+ { return likely(table) ? table->in_use : current_thd; }
enum {
LAST_NULL_BYTE_UNDEF= 0
@@ -760,8 +1064,8 @@ public:
virtual void sort_string(uchar *buff,uint length)=0;
virtual bool optimize_range(uint idx, uint part);
virtual void free() {}
- virtual Field *new_field(MEM_ROOT *root, TABLE *new_table,
- bool keep_type);
+ virtual Field *make_new_field(MEM_ROOT *root, TABLE *new_table,
+ bool keep_type);
virtual Field *new_key_field(MEM_ROOT *root, TABLE *new_table,
uchar *new_ptr, uint32 length,
uchar *new_null_ptr, uint new_null_bit);
@@ -895,14 +1199,32 @@ public:
virtual int set_time() { return 1; }
bool set_warning(Sql_condition::enum_warning_level, unsigned int code,
int cuted_increment) const;
+protected:
+ bool set_warning(unsigned int code, int cuted_increment) const
+ {
+ return set_warning(Sql_condition::WARN_LEVEL_WARN, code, cuted_increment);
+ }
+ bool set_note(unsigned int code, int cuted_increment) const
+ {
+ return set_warning(Sql_condition::WARN_LEVEL_NOTE, code, cuted_increment);
+ }
void set_datetime_warning(Sql_condition::enum_warning_level, uint code,
const ErrConv *str, timestamp_type ts_type,
- int cuted_increment);
+ int cuted_increment) const;
+ void set_datetime_warning(uint code,
+ const ErrConv *str, timestamp_type ts_type,
+ int cuted_increment) const
+ {
+ set_datetime_warning(Sql_condition::WARN_LEVEL_WARN, code, str, ts_type,
+ cuted_increment);
+ }
+ void set_warning_truncated_wrong_value(const char *type, const char *value);
inline bool check_overflow(int op_result)
{
return (op_result == E_DEC_OVERFLOW);
}
int warn_if_overflow(int op_result);
+public:
void set_table_name(String *alias)
{
table_name= &alias->Ptr;
@@ -964,6 +1286,15 @@ public:
flags |= (column_format_arg << FIELD_FLAGS_COLUMN_FORMAT);
}
+ /*
+ Validate a non-null field value stored in the given record
+ according to the current thread settings, e.g. sql_mode.
+ @param thd - the thread
+ @param record - the record to check in
+ */
+ virtual bool validate_value_in_record(THD *thd, const uchar *record) const
+ { return false; }
+ bool validate_value_in_record_with_warn(THD *thd, const uchar *record);
key_map get_possible_keys();
/* Hash value */
@@ -979,16 +1310,38 @@ public:
return (double) 0.5;
}
- virtual bool can_optimize_keypart_ref(const Item_func *cond,
+ /*
+ Check if comparison between the field and an item unambiguously
+ identifies a distinct field value.
+
+ Example1: SELECT * FROM t1 WHERE int_column=10;
+ This example returns distinct integer value of 10.
+
+ Example2: SELECT * FROM t1 WHERE varchar_column=DATE'2001-01-01'
+ This example returns non-distinct values.
+ Comparison as DATE will return '2001-01-01' and '2001-01-01x',
+ but these two values are not equal to each other as VARCHARs.
+ See also the function with the same name in sql_select.cc.
+ */
+ virtual bool test_if_equality_guarantees_uniqueness(const Item *const_item)
+ const;
+ virtual bool can_be_substituted_to_equal_item(const Context &ctx,
+ const Item_equal *item);
+ virtual Item *get_equal_const_item(THD *thd, const Context &ctx,
+ Item *const_item)
+ {
+ return const_item;
+ }
+ virtual bool can_optimize_keypart_ref(const Item_bool_func *cond,
const Item *item) const;
- virtual bool can_optimize_hash_join(const Item_func *cond,
+ virtual bool can_optimize_hash_join(const Item_bool_func *cond,
const Item *item) const
{
return can_optimize_keypart_ref(cond, item);
}
- virtual bool can_optimize_group_min_max(const Item_bool_func2 *cond,
+ virtual bool can_optimize_group_min_max(const Item_bool_func *cond,
const Item *const_item) const;
- bool can_optimize_outer_join_table_elimination(const Item_func *cond,
+ bool can_optimize_outer_join_table_elimination(const Item_bool_func *cond,
const Item *item) const
{
// Exactly the same rules with REF access
@@ -1078,6 +1431,24 @@ protected:
class Field_num :public Field {
+protected:
+ int check_edom_and_truncation(const char *type, bool edom,
+ CHARSET_INFO *cs,
+ const char *str, uint length,
+ const char *end_of_num);
+ int check_int(CHARSET_INFO *cs, const char *str, uint length,
+ const char *int_end, int error)
+ {
+ return check_edom_and_truncation("integer",
+ error == MY_ERRNO_EDOM || str == int_end,
+ cs, str, length, int_end);
+ }
+ bool get_int(CHARSET_INFO *cs, const char *from, uint len,
+ longlong *rnd, ulonglong unsigned_max,
+ longlong signed_min, longlong signed_max);
+ void prepend_zeros(String *value) const;
+ Item *get_equal_zerofill_const_item(THD *thd, const Context &ctx,
+ Item *const_item);
public:
const uint8 dec;
bool zerofill,unsigned_flag; // Purify cannot handle bit fields
@@ -1089,7 +1460,12 @@ public:
enum Derivation derivation(void) const { return DERIVATION_NUMERIC; }
uint repertoire(void) const { return MY_REPERTOIRE_NUMERIC; }
CHARSET_INFO *charset(void) const { return &my_charset_numeric; }
- void prepend_zeros(String *value);
+ Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item)
+ {
+ return (flags & ZEROFILL_FLAG) ?
+ get_equal_zerofill_const_item(thd, ctx, const_item) :
+ const_item;
+ }
void add_zerofill_and_unsigned(String &res) const;
friend class Create_field;
void make_field(Send_field *);
@@ -1107,11 +1483,6 @@ public:
return length;
}
int store_time_dec(MYSQL_TIME *ltime, uint dec);
- int check_int(CHARSET_INFO *cs, const char *str, int length,
- const char *int_end, int error);
- bool get_int(CHARSET_INFO *cs, const char *from, uint len,
- longlong *rnd, ulonglong unsigned_max,
- longlong signed_min, longlong signed_max);
double pos_in_interval(Field *min, Field *max)
{
return pos_in_interval_val_real(min, max);
@@ -1124,6 +1495,8 @@ protected:
CHARSET_INFO *field_charset;
enum Derivation field_derivation;
public:
+ bool can_be_substituted_to_equal_item(const Context &ctx,
+ const Item_equal *item_equal);
Field_str(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, utype unireg_check_arg,
const char *field_name_arg, CHARSET_INFO *charset);
@@ -1154,6 +1527,7 @@ public:
{
return pos_in_interval_val_str(min, max, length_size());
}
+ bool test_if_equality_guarantees_uniqueness(const Item *const_item) const;
};
/* base class for Field_string, Field_varstring and Field_blob */
@@ -1174,9 +1548,9 @@ protected:
return report_if_important_data(copier->source_end_pos(),
end, count_spaces);
}
- bool cmp_to_string_with_same_collation(const Item_func *cond,
+ bool cmp_to_string_with_same_collation(const Item_bool_func *cond,
const Item *item) const;
- bool cmp_to_string_with_stricter_collation(const Item_func *cond,
+ bool cmp_to_string_with_stricter_collation(const Item_bool_func *cond,
const Item *item) const;
public:
Field_longstr(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
@@ -1189,14 +1563,18 @@ public:
int store_decimal(const my_decimal *d);
uint32 max_data_length() const;
bool match_collation_to_optimize_range() const { return true; }
- bool can_optimize_keypart_ref(const Item_func *cond, const Item *item) const;
- bool can_optimize_hash_join(const Item_func *cond, const Item *item) const;
- bool can_optimize_group_min_max(const Item_bool_func2 *cond,
+ bool can_optimize_keypart_ref(const Item_bool_func *cond,
+ const Item *item) const;
+ bool can_optimize_hash_join(const Item_bool_func *cond,
+ const Item *item) const;
+ bool can_optimize_group_min_max(const Item_bool_func *cond,
const Item *const_item) const;
};
/* base class for float and double and decimal (old one) */
class Field_real :public Field_num {
+protected:
+ double get_double(const char *str, uint length, CHARSET_INFO *cs, int *err);
public:
bool not_fixed;
@@ -1215,6 +1593,7 @@ public:
my_decimal *val_decimal(my_decimal *);
uint32 max_display_length() { return field_length; }
uint size_of() const { return sizeof(*this); }
+ Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item);
};
@@ -1299,7 +1678,8 @@ public:
uint16 mflags, int *order_var);
uint is_equal(Create_field *new_field);
virtual const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end, uint param_data);
- static Field *create_from_item (Item *);
+ static Field *create_from_item(MEM_ROOT *root, Item *);
+ Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item);
};
@@ -1620,12 +2000,13 @@ public:
uint size_of() const { return sizeof(*this); }
uint32 max_display_length() { return 4; }
void move_field_offset(my_ptrdiff_t ptr_diff) {}
- bool can_optimize_keypart_ref(const Item_func *cond, const Item *item) const
+ bool can_optimize_keypart_ref(const Item_bool_func *cond,
+ const Item *item) const
{
DBUG_ASSERT(0);
return false;
}
- bool can_optimize_group_min_max(const Item_bool_func2 *cond,
+ bool can_optimize_group_min_max(const Item_bool_func *cond,
const Item *const_item) const
{
DBUG_ASSERT(0);
@@ -1635,6 +2016,9 @@ public:
class Field_temporal: public Field {
+protected:
+ Item *get_equal_const_item_datetime(THD *thd, const Context &ctx,
+ Item *const_item);
public:
Field_temporal(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, utype unireg_check_arg,
@@ -1663,8 +2047,9 @@ public:
{
return pos_in_interval_val_real(min, max);
}
- bool can_optimize_keypart_ref(const Item_func *cond, const Item *item) const;
- bool can_optimize_group_min_max(const Item_bool_func2 *cond,
+ bool can_optimize_keypart_ref(const Item_bool_func *cond,
+ const Item *item) const;
+ bool can_optimize_group_min_max(const Item_bool_func *cond,
const Item *const_item) const;
};
@@ -1681,6 +2066,17 @@ protected:
int store_TIME_with_warning(MYSQL_TIME *ltime, const ErrConv *str,
int was_cut, int have_smth_to_conv);
virtual void store_TIME(MYSQL_TIME *ltime) = 0;
+ virtual bool get_TIME(MYSQL_TIME *ltime, const uchar *pos,
+ ulonglong fuzzydate) const = 0;
+ bool validate_MMDD(bool not_zero_date, uint month, uint day,
+ ulonglong fuzzydate) const
+ {
+ if (!not_zero_date)
+ return fuzzydate & TIME_NO_ZERO_DATE;
+ if (!month || !day)
+ return fuzzydate & TIME_NO_ZERO_IN_DATE;
+ return false;
+ }
public:
Field_temporal_with_date(uchar *ptr_arg, uint32 len_arg,
uchar *null_ptr_arg, uchar null_bit_arg,
@@ -1694,6 +2090,7 @@ public:
int store(longlong nr, bool unsigned_val);
int store_time_dec(MYSQL_TIME *ltime, uint dec);
int store_decimal(const my_decimal *);
+ bool validate_value_in_record(THD *thd, const uchar *record) const;
};
@@ -1746,7 +2143,11 @@ public:
return res;
}
/* Get TIMESTAMP field value as seconds since begging of Unix Epoch */
- virtual my_time_t get_timestamp(ulong *sec_part) const;
+ virtual my_time_t get_timestamp(const uchar *pos, ulong *sec_part) const;
+ my_time_t get_timestamp(ulong *sec_part) const
+ {
+ return get_timestamp(ptr, sec_part);
+ }
virtual void store_TIME(my_time_t timestamp, ulong sec_part)
{
int4store(ptr,timestamp);
@@ -1762,6 +2163,11 @@ public:
{
return unpack_int32(to, from, from_end);
}
+ bool validate_value_in_record(THD *thd, const uchar *record) const;
+ Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item)
+ {
+ return get_equal_const_item_datetime(thd, ctx, const_item);
+ }
uint size_of() const { return sizeof(*this); }
};
@@ -1819,7 +2225,7 @@ public:
{
DBUG_ASSERT(dec);
}
- my_time_t get_timestamp(ulong *sec_part) const;
+ my_time_t get_timestamp(const uchar *pos, ulong *sec_part) const;
void store_TIME(my_time_t timestamp, ulong sec_part);
int cmp(const uchar *,const uchar *);
uint32 pack_length() const;
@@ -1863,7 +2269,7 @@ public:
return memcmp(a_ptr, b_ptr, pack_length());
}
void store_TIME(my_time_t timestamp, ulong sec_part);
- my_time_t get_timestamp(ulong *sec_part) const;
+ my_time_t get_timestamp(const uchar *pos, ulong *sec_part) const;
uint size_of() const { return sizeof(*this); }
};
@@ -1893,6 +2299,7 @@ public:
class Field_date :public Field_temporal_with_date {
void store_TIME(MYSQL_TIME *ltime);
+ bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, ulonglong fuzzydate) const;
public:
Field_date(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg)
@@ -1901,6 +2308,8 @@ public:
enum_field_types type() const { return MYSQL_TYPE_DATE;}
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
int reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; }
+ bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
+ { return Field_date::get_TIME(ltime, ptr, fuzzydate); }
double val_real(void);
longlong val_int(void);
String *val_str(String*,String *);
@@ -1925,6 +2334,7 @@ public:
class Field_newdate :public Field_temporal_with_date {
void store_TIME(MYSQL_TIME *ltime);
+ bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, ulonglong fuzzydate) const;
public:
Field_newdate(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg)
@@ -1943,8 +2353,10 @@ public:
void sort_string(uchar *buff,uint length);
uint32 pack_length() const { return 3; }
void sql_type(String &str) const;
- bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
+ bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
+ { return Field_newdate::get_TIME(ltime, ptr, fuzzydate); }
uint size_of() const { return sizeof(*this); }
+ Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item);
};
@@ -1988,6 +2400,7 @@ public:
Field *new_key_field(MEM_ROOT *root, TABLE *new_table,
uchar *new_ptr, uint32 length,
uchar *new_null_ptr, uint new_null_bit);
+ Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item);
};
@@ -2094,6 +2507,7 @@ public:
class Field_datetime :public Field_temporal_with_date {
void store_TIME(MYSQL_TIME *ltime);
+ bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, ulonglong fuzzydate) const;
public:
Field_datetime(uchar *ptr_arg, uint length_arg, uchar *null_ptr_arg,
uchar null_bit_arg, enum utype unireg_check_arg,
@@ -2111,7 +2525,8 @@ public:
void sort_string(uchar *buff,uint length);
uint32 pack_length() const { return 8; }
void sql_type(String &str) const;
- bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
+ bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
+ { return Field_datetime::get_TIME(ltime, ptr, fuzzydate); }
virtual int set_time();
virtual void set_default()
{
@@ -2144,6 +2559,10 @@ public:
{
return unpack_int64(to, from, from_end);
}
+ Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item)
+ {
+ return get_equal_const_item_datetime(thd, ctx, const_item);
+ }
uint size_of() const { return sizeof(*this); }
};
@@ -2191,6 +2610,7 @@ public:
*/
class Field_datetime_hires :public Field_datetime_with_dec {
void store_TIME(MYSQL_TIME *ltime);
+ bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, ulonglong fuzzydate) const;
public:
Field_datetime_hires(uchar *ptr_arg, uchar *null_ptr_arg,
uchar null_bit_arg, enum utype unireg_check_arg,
@@ -2202,7 +2622,8 @@ public:
}
int cmp(const uchar *,const uchar *);
uint32 pack_length() const;
- bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
+ bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
+ { return Field_datetime_hires::get_TIME(ltime, ptr, fuzzydate); }
uint size_of() const { return sizeof(*this); }
};
@@ -2212,6 +2633,7 @@ public:
*/
class Field_datetimef :public Field_datetime_with_dec {
void store_TIME(MYSQL_TIME *ltime);
+ bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, ulonglong fuzzydate) const;
int do_save_field_metadata(uchar *metadata_ptr)
{
*metadata_ptr= decimals();
@@ -2242,54 +2664,65 @@ public:
return memcmp(a_ptr, b_ptr, pack_length());
}
int reset();
- bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
+ bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
+ { return Field_datetimef::get_TIME(ltime, ptr, fuzzydate); }
uint size_of() const { return sizeof(*this); }
};
static inline Field_timestamp *
-new_Field_timestamp(uchar *ptr, uchar *null_ptr, uchar null_bit,
+new_Field_timestamp(MEM_ROOT *root,uchar *ptr, uchar *null_ptr, uchar null_bit,
enum Field::utype unireg_check, const char *field_name,
TABLE_SHARE *share, uint dec)
{
if (dec==0)
- return new Field_timestamp(ptr, MAX_DATETIME_WIDTH, null_ptr, null_bit,
- unireg_check, field_name, share);
+ return new (root)
+ Field_timestamp(ptr, MAX_DATETIME_WIDTH, null_ptr,
+ null_bit, unireg_check, field_name, share);
if (dec == NOT_FIXED_DEC)
dec= MAX_DATETIME_PRECISION;
- return new Field_timestamp_hires(ptr, null_ptr, null_bit, unireg_check,
- field_name, share, dec);
+ return new (root)
+ Field_timestamp_hires(ptr, null_ptr, null_bit, unireg_check,
+ field_name, share, dec);
}
static inline Field_time *
-new_Field_time(uchar *ptr, uchar *null_ptr, uchar null_bit,
+new_Field_time(MEM_ROOT *root, uchar *ptr, uchar *null_ptr, uchar null_bit,
enum Field::utype unireg_check, const char *field_name,
uint dec)
{
if (dec == 0)
- return new Field_time(ptr, MIN_TIME_WIDTH, null_ptr, null_bit,
- unireg_check, field_name);
+ return new (root)
+ Field_time(ptr, MIN_TIME_WIDTH, null_ptr, null_bit, unireg_check,
+ field_name);
if (dec == NOT_FIXED_DEC)
dec= MAX_DATETIME_PRECISION;
- return new Field_time_hires(ptr, null_ptr, null_bit,
- unireg_check, field_name, dec);
+ return new (root)
+ Field_time_hires(ptr, null_ptr, null_bit, unireg_check, field_name, dec);
}
static inline Field_datetime *
-new_Field_datetime(uchar *ptr, uchar *null_ptr, uchar null_bit,
+new_Field_datetime(MEM_ROOT *root, uchar *ptr, uchar *null_ptr, uchar null_bit,
enum Field::utype unireg_check,
const char *field_name, uint dec)
{
if (dec == 0)
- return new Field_datetime(ptr, MAX_DATETIME_WIDTH, null_ptr, null_bit,
- unireg_check, field_name);
+ return new (root)
+ Field_datetime(ptr, MAX_DATETIME_WIDTH, null_ptr, null_bit,
+ unireg_check, field_name);
if (dec == NOT_FIXED_DEC)
dec= MAX_DATETIME_PRECISION;
- return new Field_datetime_hires(ptr, null_ptr, null_bit,
- unireg_check, field_name, dec);
+ return new (root)
+ Field_datetime_hires(ptr, null_ptr, null_bit,
+ unireg_check, field_name, dec);
}
class Field_string :public Field_longstr {
+ class Warn_filter_string: public Warn_filter
+ {
+ public:
+ Warn_filter_string(const THD *thd, const Field_string *field);
+ };
public:
bool can_alter_field_type;
Field_string(uchar *ptr_arg, uint32 len_arg,uchar *null_ptr_arg,
@@ -2355,7 +2788,7 @@ public:
enum_field_types real_type() const { return MYSQL_TYPE_STRING; }
bool has_charset(void) const
{ return charset() == &my_charset_bin ? FALSE : TRUE; }
- Field *new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type);
+ Field *make_new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type);
virtual uint get_key_image(uchar *buff,uint length, imagetype type);
private:
int do_save_field_metadata(uchar *first_byte);
@@ -2363,6 +2796,14 @@ private:
class Field_varstring :public Field_longstr {
+ uchar *get_data() const
+ {
+ return ptr + length_bytes;
+ }
+ uint get_length() const
+ {
+ return length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
+ }
public:
/*
The maximum space available in a Field_varstring, in bytes. See
@@ -2433,7 +2874,7 @@ public:
enum_field_types real_type() const { return MYSQL_TYPE_VARCHAR; }
bool has_charset(void) const
{ return charset() == &my_charset_bin ? FALSE : TRUE; }
- Field *new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type);
+ Field *make_new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type);
Field *new_key_field(MEM_ROOT *root, TABLE *new_table,
uchar *new_ptr, uint32 length,
uchar *new_null_ptr, uint new_null_bit);
@@ -2652,6 +3093,7 @@ public:
int reset(void) { return Field_blob::reset() || !maybe_null(); }
geometry_type get_geometry_type() { return geom_type; };
+ static geometry_type geometry_type_merge(geometry_type, geometry_type);
uint get_srid() { return srid; }
};
@@ -2679,7 +3121,7 @@ public:
{
flags|=ENUM_FLAG;
}
- Field *new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type);
+ Field *make_new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type);
enum_field_types type() const { return MYSQL_TYPE_STRING; }
enum Item_result cmp_type () const { return INT_RESULT; }
enum ha_base_keytype key_type() const;
@@ -2711,8 +3153,9 @@ public:
virtual const uchar *unpack(uchar *to, const uchar *from,
const uchar *from_end, uint param_data);
- bool can_optimize_keypart_ref(const Item_func *cond, const Item *item) const;
- bool can_optimize_group_min_max(const Item_bool_func2 *cond,
+ bool can_optimize_keypart_ref(const Item_bool_func *cond,
+ const Item *item) const;
+ bool can_optimize_group_min_max(const Item_bool_func *cond,
const Item *const_item) const
{
/*
@@ -2988,7 +3431,7 @@ public:
interval_list.empty();
}
- Create_field(Field *field, Field *orig_field);
+ Create_field(THD *thd, Field *field, Field *orig_field);
/* Used to make a clone of this object for ALTER/CREATE TABLE */
Create_field *clone(MEM_ROOT *mem_root) const;
void create_length_to_internal_length(void);
@@ -3022,6 +3465,14 @@ public:
{
return 255 - FRM_VCOL_HEADER_SIZE(interval != NULL);
}
+
+ bool has_default_function() const
+ {
+ return (unireg_check == Field::TIMESTAMP_DN_FIELD ||
+ unireg_check == Field::TIMESTAMP_DNUN_FIELD ||
+ unireg_check == Field::TIMESTAMP_UN_FIELD ||
+ unireg_check == Field::NEXT_NUMBER);
+ }
};
@@ -3087,7 +3538,8 @@ public:
};
-Field *make_field(TABLE_SHARE *share, uchar *ptr, uint32 field_length,
+Field *make_field(TABLE_SHARE *share, MEM_ROOT *mem_root,
+ uchar *ptr, uint32 field_length,
uchar *null_pos, uchar null_bit,
uint pack_flag, enum_field_types field_type,
CHARSET_INFO *cs,
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index e31f7c5f005..14f2947eba7 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -859,7 +859,8 @@ bool memcpy_field_possible(Field *to,Field *from)
from->charset() == to->charset() &&
(!sql_mode_for_dates(to->table->in_use) ||
(from->type()!= MYSQL_TYPE_DATE &&
- from->type()!= MYSQL_TYPE_DATETIME)) &&
+ from->type()!= MYSQL_TYPE_DATETIME &&
+ from->type()!= MYSQL_TYPE_TIMESTAMP)) &&
(from_real_type != MYSQL_TYPE_VARCHAR ||
((Field_varstring*)from)->length_bytes ==
((Field_varstring*)to)->length_bytes));
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 2bce61ba3f6..ef91e227928 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
- Copyright (c) 2009, 2014, Monty Program Ab.
+/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2015, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@ if (my_b_write((file),(uchar*) (from),param->ref_length)) \
static uchar *read_buffpek_from_file(IO_CACHE *buffer_file, uint count,
uchar *buf);
-static ha_rows find_all_keys(Sort_param *param,SQL_SELECT *select,
+static ha_rows find_all_keys(THD *thd, Sort_param *param, SQL_SELECT *select,
Filesort_info *fs_info,
IO_CACHE *buffer_file,
IO_CACHE *tempfile,
@@ -294,7 +294,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
param.sort_form= table;
param.end=(param.local_sortorder=sortorder)+s_length;
- num_rows= find_all_keys(&param, select,
+ num_rows= find_all_keys(thd, &param, select,
&table_sort,
&buffpek_pointers,
&tempfile,
@@ -371,7 +371,6 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
err:
my_free(param.tmp_buffer);
- tracker->report_merge_passes_at_end(thd->query_plan_fsort_passes);
if (!subselect || !subselect->is_uncacheable())
{
table_sort.free_sort_buffer();
@@ -393,6 +392,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
outfile->end_of_file=save_pos;
}
}
+ tracker->report_merge_passes_at_end(thd->query_plan_fsort_passes);
if (error)
{
int kill_errno= thd->killed_errno();
@@ -409,7 +409,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
"%s: %s",
MYF(0),
ER_THD(thd, ER_FILSORT_ABORT),
- kill_errno ? ER(kill_errno) :
+ kill_errno ? ER_THD(thd, kill_errno) :
thd->killed == ABORT_QUERY ? "" :
thd->get_stmt_da()->message());
@@ -447,10 +447,11 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
void filesort_free_buffers(TABLE *table, bool full)
{
DBUG_ENTER("filesort_free_buffers");
+
my_free(table->sort.record_pointers);
table->sort.record_pointers= NULL;
- if (full)
+ if (unlikely(full))
{
table->sort.free_sort_buffer();
my_free(table->sort.buffpek);
@@ -458,10 +459,14 @@ void filesort_free_buffers(TABLE *table, bool full)
table->sort.buffpek_len= 0;
}
- my_free(table->sort.addon_buf);
- my_free(table->sort.addon_field);
- table->sort.addon_buf= NULL;
- table->sort.addon_field= NULL;
+ /* addon_buf is only allocated if addon_field is set */
+ if (unlikely(table->sort.addon_field))
+ {
+ my_free(table->sort.addon_field);
+ my_free(table->sort.addon_buf);
+ table->sort.addon_buf= NULL;
+ table->sort.addon_field= NULL;
+ }
DBUG_VOID_RETURN;
}
@@ -667,7 +672,7 @@ static void dbug_print_record(TABLE *table, bool print_rowid)
HA_POS_ERROR on error.
*/
-static ha_rows find_all_keys(Sort_param *param, SQL_SELECT *select,
+static ha_rows find_all_keys(THD *thd, Sort_param *param, SQL_SELECT *select,
Filesort_info *fs_info,
IO_CACHE *buffpek_pointers,
IO_CACHE *tempfile,
@@ -679,7 +684,6 @@ static ha_rows find_all_keys(Sort_param *param, SQL_SELECT *select,
uchar *ref_pos,*next_pos,ref_buff[MAX_REFLENGTH];
my_off_t record;
TABLE *sort_form;
- THD *thd= current_thd;
handler *file;
MY_BITMAP *save_read_set, *save_write_set, *save_vcol_set;
diff --git a/sql/gcalc_tools.cc b/sql/gcalc_tools.cc
index 2d770fd45d6..5aac8a71249 100644
--- a/sql/gcalc_tools.cc
+++ b/sql/gcalc_tools.cc
@@ -143,6 +143,9 @@ int Gcalc_function::count_internal(const char *cur_func, uint set_type,
{
if (set_type == 0)
result= i_states[n_shape] | b_states[n_shape];
+ /* the last call for the count_internal outside of all shapes. */
+ else if (set_type == 1)
+ result= 0;
else if (set_type == op_border)
result= b_states[n_shape];
else if (set_type == op_internals)
@@ -158,7 +161,8 @@ int Gcalc_function::count_internal(const char *cur_func, uint set_type,
if (next_func == op_border || next_func == op_internals)
{
- result= count_internal(cur_func, next_func, &cur_func);
+ result= count_internal(cur_func,
+ (set_type == 1) ? set_type : next_func, &cur_func);
goto exit;
}
@@ -180,16 +184,34 @@ int Gcalc_function::count_internal(const char *cur_func, uint set_type,
switch (next_func)
{
case op_union:
- result= result | next_res;
+ if (result == result_true || next_res == result_true)
+ result= result_true;
+ else if (result == result_unknown || next_res == result_unknown)
+ result= result_unknown;
+ else
+ result= result_false;
break;
case op_intersection:
- result= result & next_res;
+ if (result == result_false || next_res == result_false)
+ result= result_false;
+ else if (result == result_unknown || next_res == result_unknown)
+ result= result_unknown;
+ else
+ result= result_true;
break;
case op_symdifference:
- result= result ^ next_res;
+ if (result == result_unknown || next_res == result_unknown)
+ result= result_unknown;
+ else
+ result= result ^ next_res;
break;
case op_difference:
- result= result & !next_res;
+ if (result == result_false || next_res == result_true)
+ result= result_false;
+ else if (result == result_unknown || next_res == result_unknown)
+ result= result_unknown;
+ else
+ result= result_true;
break;
default:
GCALC_DBUG_ASSERT(FALSE);
@@ -197,24 +219,35 @@ int Gcalc_function::count_internal(const char *cur_func, uint set_type,
}
exit:
- result^= mask;
+ if (result != result_unknown)
+ result^= mask;
if (v_state != v_empty)
{
switch (v_state)
{
case v_find_t:
- if (result)
+ if (result == result_true)
{
c_op= (c_op & ~v_mask) | v_t_found;
int4store(sav_cur_func, c_op);
- };
+ }
+ else
+ {
+ if (set_type != 1)
+ result= result_unknown;
+ }
break;
case v_find_f:
- if (!result)
+ if (result == result_false)
{
c_op= (c_op & ~v_mask) | v_f_found;
int4store(sav_cur_func, c_op);
- };
+ }
+ else
+ {
+ if (set_type != 1)
+ result= result_unknown;
+ }
break;
case v_t_found:
result= 1;
@@ -264,6 +297,7 @@ int Gcalc_function::check_function(Gcalc_scan_iterator &scan_it)
{
const Gcalc_scan_iterator::point *eq_start, *cur_eq;
const Gcalc_scan_iterator::event_point *events;
+ int result;
GCALC_DBUG_ENTER("Gcalc_function::check_function");
while (scan_it.more_points())
@@ -288,8 +322,8 @@ int Gcalc_function::check_function(Gcalc_scan_iterator &scan_it)
if (events->event == scev_end)
set_b_state(events->get_shape());
- if (count())
- GCALC_DBUG_RETURN(1);
+ if ((result= count()) != result_unknown)
+ GCALC_DBUG_RETURN(result);
clear_b_states();
continue;
}
@@ -307,8 +341,8 @@ int Gcalc_function::check_function(Gcalc_scan_iterator &scan_it)
set_i_state(si);
}
- if (count())
- GCALC_DBUG_RETURN(1);
+ if ((result= count()) != result_unknown)
+ GCALC_DBUG_RETURN(result);
/* Set back states changed in the loop above. */
for (events= scan_it.get_events(); events; events= events->get_next())
@@ -316,10 +350,10 @@ int Gcalc_function::check_function(Gcalc_scan_iterator &scan_it)
gcalc_shape_info si= events->get_shape();
if (events->event == scev_thread ||
events->event == scev_end ||
- events->event == scev_single_point ||
- (get_shape_kind(si) == Gcalc_function::shape_polygon))
+ get_shape_kind(si) == Gcalc_function::shape_polygon)
clear_b_state(si);
- else if (get_shape_kind(si) == Gcalc_function::shape_line)
+ else if (events->event == scev_single_point ||
+ get_shape_kind(si) == Gcalc_function::shape_line)
clear_i_state(si);
}
@@ -343,8 +377,8 @@ int Gcalc_function::check_function(Gcalc_scan_iterator &scan_it)
else
invert_i_state(si);
}
- if (count())
- GCALC_DBUG_RETURN(1);
+ if ((result= count()) != result_unknown)
+ GCALC_DBUG_RETURN(result);
for (cur_eq= eq_start; cur_eq != pit.point(); cur_eq= cur_eq->get_next())
{
@@ -357,12 +391,13 @@ int Gcalc_function::check_function(Gcalc_scan_iterator &scan_it)
else
invert_i_state(cur_eq->get_shape());
}
- if (count())
- GCALC_DBUG_RETURN(1);
+ if ((result= count()) != result_unknown)
+ GCALC_DBUG_RETURN(result);
+
eq_start= pit.point();
} while (pit.point() != scan_it.get_event_end());
}
- GCALC_DBUG_RETURN(0);
+ GCALC_DBUG_RETURN(count_last());
}
diff --git a/sql/gcalc_tools.h b/sql/gcalc_tools.h
index 12ee56732a2..9e9b580b359 100644
--- a/sql/gcalc_tools.h
+++ b/sql/gcalc_tools.h
@@ -82,6 +82,12 @@ public:
shape_polygon= 2,
shape_hole= 3
};
+ enum count_result
+ {
+ result_false= 0,
+ result_true= 1,
+ result_unknown= 2
+ };
Gcalc_function() : n_shapes(0) {}
gcalc_shape_info add_new_shape(uint32 shape_id, shape_type shape_kind);
/*
@@ -116,6 +122,8 @@ public:
int get_b_state(gcalc_shape_info shape) { return b_states[shape]; }
int count()
{ return count_internal(function_buffer.ptr(), 0, 0); }
+ int count_last()
+ { return count_internal(function_buffer.ptr(), 1, 0); }
void clear_i_states();
void clear_b_states();
void reset();
diff --git a/sql/gen_lex_token.cc b/sql/gen_lex_token.cc
index 01a54b1b086..eefe9163819 100644
--- a/sql/gen_lex_token.cc
+++ b/sql/gen_lex_token.cc
@@ -56,6 +56,7 @@ int tok_row_single_value= 0;
int tok_row_single_value_list= 0;
int tok_row_multiple_value= 0;
int tok_row_multiple_value_list= 0;
+int tok_ident= 0;
int tok_unused= 0;
void set_token(int tok, const char *str)
@@ -213,6 +214,10 @@ void compute_tokens()
set_token(tok_row_multiple_value_list, "(...) /* , ... */");
max_token_seen++;
+ tok_ident= max_token_seen;
+ set_token(tok_ident, "(tok_id)");
+
+ max_token_seen++;
tok_unused= max_token_seen;
set_token(tok_unused, "UNUSED");
@@ -323,6 +328,7 @@ void print_tokens()
printf("#define TOK_ROW_SINGLE_VALUE_LIST %d\n", tok_row_single_value_list);
printf("#define TOK_ROW_MULTIPLE_VALUE %d\n", tok_row_multiple_value);
printf("#define TOK_ROW_MULTIPLE_VALUE_LIST %d\n", tok_row_multiple_value_list);
+ printf("#define TOK_IDENT %d\n", tok_ident);
printf("#define TOK_UNUSED %d\n", tok_unused);
}
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index f0b0c0b324a..043f7fb280b 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -1693,8 +1693,8 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
} while (++i < num_parts);
}
if (m_reorged_parts &&
- !(m_reorged_file= (handler**)sql_calloc(sizeof(handler*)*
- (m_reorged_parts + 1))))
+ !(m_reorged_file= (handler**) thd->calloc(sizeof(handler*)*
+ (m_reorged_parts + 1))))
{
mem_alloc_error(sizeof(handler*)*(m_reorged_parts+1));
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -1725,8 +1725,9 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
}
} while (++i < num_parts);
}
- if (!(new_file_array= (handler**)sql_calloc(sizeof(handler*)*
- (2*(num_remain_partitions + 1)))))
+ if (!(new_file_array= ((handler**)
+ thd->calloc(sizeof(handler*)*
+ (2*(num_remain_partitions + 1))))))
{
mem_alloc_error(sizeof(handler*)*2*(num_remain_partitions+1));
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -1810,7 +1811,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
if (p_share_refs->init(num_subparts))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- if (m_new_partitions_share_refs.push_back(p_share_refs))
+ if (m_new_partitions_share_refs.push_back(p_share_refs, thd->mem_root))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
do
{
@@ -2399,7 +2400,7 @@ reg_query_cache_dependant_table(THD *thd,
DBUG_RETURN(TRUE);
}
(++(*block_table))->n= ++(*n);
- if (!cache->insert_table(cache_key_len,
+ if (!cache->insert_table(thd, cache_key_len,
cache_key, (*block_table),
table_share->db.length,
(uint8) (cache_key_len -
@@ -8018,7 +8019,8 @@ void ha_partition::print_error(int error, myf errflag)
table->s->table_name.str,
str.c_ptr_safe());
- max_length= (MYSQL_ERRMSG_SIZE - (uint) strlen(ER(ER_ROW_IN_WRONG_PARTITION)));
+ max_length= (MYSQL_ERRMSG_SIZE -
+ (uint) strlen(ER_THD(thd, ER_ROW_IN_WRONG_PARTITION)));
if (str.length() >= max_length)
{
str.length(max_length-4);
@@ -8822,7 +8824,7 @@ int ha_partition::indexes_are_disabled(void)
@retval != 0 Error
*/
-int ha_partition::check_misplaced_rows(uint read_part_id, bool repair)
+int ha_partition::check_misplaced_rows(uint read_part_id, bool do_repair)
{
int result= 0;
uint32 correct_part_id;
@@ -8833,7 +8835,7 @@ int ha_partition::check_misplaced_rows(uint read_part_id, bool repair)
DBUG_ASSERT(m_file);
- if (repair)
+ if (do_repair)
{
/* We must read the full row, if we need to move it! */
bitmap_set_all(table->read_set);
@@ -8878,7 +8880,7 @@ int ha_partition::check_misplaced_rows(uint read_part_id, bool repair)
if (correct_part_id != read_part_id)
{
num_misplaced_rows++;
- if (!repair)
+ if (!do_repair)
{
/* Check. */
print_admin_msg(ha_thd(), MYSQL_ERRMSG_SIZE, "error",
diff --git a/sql/handler.cc b/sql/handler.cc
index 8d69a93c2c1..1d1dae75164 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -53,6 +53,7 @@
#include "wsrep_mysqld.h"
#include "wsrep.h"
+#include "wsrep_xid.h"
/*
While we have legacy_db_type, we have this array to
@@ -1192,7 +1193,7 @@ int ha_prepare(THD *thd)
else
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_GET_ERRNO, ER(ER_GET_ERRNO),
+ ER_GET_ERRNO, ER_THD(thd, ER_GET_ERRNO),
HA_ERR_WRONG_COMMAND,
ha_resolve_storage_engine_name(ht));
@@ -1306,7 +1307,7 @@ int ha_commit_trans(THD *thd, bool all)
DBUG_EXECUTE_IF("warn_during_ha_commit_trans",
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARNING_NOT_COMPLETE_ROLLBACK,
- ER(ER_WARNING_NOT_COMPLETE_ROLLBACK)););
+ ER_THD(thd, ER_WARNING_NOT_COMPLETE_ROLLBACK)););
DBUG_PRINT("info",
("all: %d thd->in_sub_stmt: %d ha_info: %p is_real_trans: %d",
@@ -1437,7 +1438,7 @@ int ha_commit_trans(THD *thd, bool all)
if (!error && WSREP_ON && wsrep_is_wsrep_xid(&thd->transaction.xid_state.xid))
{
// xid was rewritten by wsrep
- xid= wsrep_xid_seqno(&thd->transaction.xid_state.xid);
+ xid= wsrep_xid_seqno(thd->transaction.xid_state.xid);
}
if (!is_real_trans)
@@ -1614,6 +1615,26 @@ int ha_rollback_trans(THD *thd, bool all)
DBUG_ASSERT(thd->transaction.stmt.ha_list == NULL ||
trans == &thd->transaction.stmt);
+#ifdef HAVE_REPLICATION
+ if (is_real_trans)
+ {
+ /*
+ In parallel replication, if we need to rollback during commit, we must
+ first inform following transactions that we are going to abort our commit
+ attempt. Otherwise those following transactions can run too early, and
+ possibly cause replication to fail. See comments in retry_event_group().
+
+ There were several bugs with this in the past that were very hard to
+ track down (MDEV-7458, MDEV-8302). So we add here an assertion for
+ rollback without signalling following transactions. And in release
+ builds, we explicitly do the signalling before rolling back.
+ */
+ DBUG_ASSERT(!(thd->rgi_slave && thd->rgi_slave->did_mark_start_commit));
+ if (thd->rgi_slave && thd->rgi_slave->did_mark_start_commit)
+ thd->rgi_slave->unmark_start_commit();
+ }
+#endif
+
if (thd->in_sub_stmt)
{
DBUG_ASSERT(0);
@@ -1685,7 +1706,7 @@ int ha_rollback_trans(THD *thd, bool all)
!thd->slave_thread && thd->killed < KILL_CONNECTION)
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARNING_NOT_COMPLETE_ROLLBACK,
- ER(ER_WARNING_NOT_COMPLETE_ROLLBACK));
+ ER_THD(thd, ER_WARNING_NOT_COMPLETE_ROLLBACK));
(void) RUN_HOOK(transaction, after_rollback, (thd, FALSE));
DBUG_RETURN(error);
}
@@ -1830,8 +1851,8 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin,
for (int i=0; i < got; i ++)
{
my_xid x= WSREP_ON && wsrep_is_wsrep_xid(&info->list[i]) ?
- wsrep_xid_seqno(&info->list[i]) :
- info->list[i].get_my_xid();
+ wsrep_xid_seqno(info->list[i]) :
+ info->list[i].get_my_xid();
if (!x) // not "mine" - that is generated by external TM
{
#ifndef DBUG_OFF
@@ -1960,12 +1981,21 @@ bool mysql_xa_recover(THD *thd)
{
List<Item> field_list;
Protocol *protocol= thd->protocol;
+ MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("mysql_xa_recover");
- field_list.push_back(new Item_int("formatID", 0, MY_INT32_NUM_DECIMAL_DIGITS));
- field_list.push_back(new Item_int("gtrid_length", 0, MY_INT32_NUM_DECIMAL_DIGITS));
- field_list.push_back(new Item_int("bqual_length", 0, MY_INT32_NUM_DECIMAL_DIGITS));
- field_list.push_back(new Item_empty_string("data",XIDDATASIZE));
+ field_list.push_back(new (mem_root)
+ Item_int(thd, "formatID", 0,
+ MY_INT32_NUM_DECIMAL_DIGITS), mem_root);
+ field_list.push_back(new (mem_root)
+ Item_int(thd, "gtrid_length", 0,
+ MY_INT32_NUM_DECIMAL_DIGITS), mem_root);
+ field_list.push_back(new (mem_root)
+ Item_int(thd, "bqual_length", 0,
+ MY_INT32_NUM_DECIMAL_DIGITS), mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "data",
+ XIDDATASIZE), mem_root);
if (protocol->send_result_set_metadata(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
@@ -2296,44 +2326,11 @@ const char *get_canonical_filename(handler *file, const char *path,
}
-/**
- An interceptor to hijack the text of the error message without
- setting an error in the thread. We need the text to present it
- in the form of a warning to the user.
-*/
-
-struct Ha_delete_table_error_handler: public Internal_error_handler
-{
-public:
- virtual bool handle_condition(THD *thd,
- uint sql_errno,
- const char* sqlstate,
- Sql_condition::enum_warning_level level,
- const char* msg,
- Sql_condition ** cond_hdl);
- char buff[MYSQL_ERRMSG_SIZE];
-};
+/** delete a table in the engine
-
-bool
-Ha_delete_table_error_handler::
-handle_condition(THD *,
- uint,
- const char*,
- Sql_condition::enum_warning_level,
- const char* msg,
- Sql_condition ** cond_hdl)
-{
- *cond_hdl= NULL;
- /* Grab the error message */
- strmake_buf(buff, msg);
- return TRUE;
-}
-
-
-/** @brief
- This should return ENOENT if the file doesn't exists.
- The .frm file will be deleted only if we return 0 or ENOENT
+ @note
+ ENOENT and HA_ERR_NO_SUCH_TABLE are not considered errors.
+ The .frm file will be deleted only if we return 0.
*/
int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
const char *db, const char *alias, bool generate_warning)
@@ -2348,47 +2345,38 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
/* table_type is NULL in ALTER TABLE when renaming only .frm files */
if (table_type == NULL || table_type == view_pseudo_hton ||
! (file=get_new_handler((TABLE_SHARE*)0, thd->mem_root, table_type)))
- DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
+ DBUG_RETURN(0);
bzero((char*) &dummy_table, sizeof(dummy_table));
bzero((char*) &dummy_share, sizeof(dummy_share));
dummy_table.s= &dummy_share;
path= get_canonical_filename(file, path, tmp_path);
- if ((error= file->ha_delete_table(path)) && generate_warning)
+ if ((error= file->ha_delete_table(path)))
{
/*
- Because file->print_error() use my_error() to generate the error message
- we use an internal error handler to intercept it and store the text
- in a temporary buffer. Later the message will be presented to user
- as a warning.
+ it's not an error if the table doesn't exist in the engine.
+ warn the user, but still report DROP being a success
*/
- Ha_delete_table_error_handler ha_delete_table_error_handler;
-
- /* Fill up strucutures that print_error may need */
- dummy_share.path.str= (char*) path;
- dummy_share.path.length= strlen(path);
- dummy_share.normalized_path= dummy_share.path;
- dummy_share.db.str= (char*) db;
- dummy_share.db.length= strlen(db);
- dummy_share.table_name.str= (char*) alias;
- dummy_share.table_name.length= strlen(alias);
- dummy_table.alias.set(alias, dummy_share.table_name.length,
- table_alias_charset);
-
- file->change_table_ptr(&dummy_table, &dummy_share);
-
- thd->push_internal_handler(&ha_delete_table_error_handler);
- file->print_error(error, 0);
+ bool intercept= error == ENOENT || error == HA_ERR_NO_SUCH_TABLE;
- thd->pop_internal_handler();
-
- /*
- XXX: should we convert *all* errors to warnings here?
- What if the error is fatal?
- */
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, error,
- ha_delete_table_error_handler.buff);
+ if (!intercept || generate_warning)
+ {
+ /* Fill up strucutures that print_error may need */
+ dummy_share.path.str= (char*) path;
+ dummy_share.path.length= strlen(path);
+ dummy_share.normalized_path= dummy_share.path;
+ dummy_share.db.str= (char*) db;
+ dummy_share.db.length= strlen(db);
+ dummy_share.table_name.str= (char*) alias;
+ dummy_share.table_name.length= strlen(alias);
+ dummy_table.alias.set(alias, dummy_share.table_name.length,
+ table_alias_charset);
+ file->change_table_ptr(&dummy_table, &dummy_share);
+ file->print_error(error, MYF(intercept ? ME_JUST_WARNING : 0));
+ }
+ if (intercept)
+ error= 0;
}
delete file;
@@ -3328,7 +3316,9 @@ void print_keydup_error(TABLE *table, KEY *key, const char *msg, myf errflag)
void print_keydup_error(TABLE *table, KEY *key, myf errflag)
{
- print_keydup_error(table, key, ER(ER_DUP_ENTRY_WITH_KEY_NAME), errflag);
+ print_keydup_error(table, key,
+ ER_THD(table->in_use, ER_DUP_ENTRY_WITH_KEY_NAME),
+ errflag);
}
@@ -3507,14 +3497,18 @@ void handler::print_error(int error, myf errflag)
{
String str;
get_error_message(error, &str);
- my_error(ER_ROW_IS_REFERENCED_2, errflag, str.c_ptr_safe());
+ my_printf_error(ER_ROW_IS_REFERENCED_2,
+ ER(str.length() ? ER_ROW_IS_REFERENCED_2 : ER_ROW_IS_REFERENCED),
+ errflag, str.c_ptr_safe());
DBUG_VOID_RETURN;
}
case HA_ERR_NO_REFERENCED_ROW:
{
String str;
get_error_message(error, &str);
- my_error(ER_NO_REFERENCED_ROW_2, errflag, str.c_ptr_safe());
+ my_printf_error(ER_NO_REFERENCED_ROW_2,
+ ER(str.length() ? ER_NO_REFERENCED_ROW_2 : ER_NO_REFERENCED_ROW),
+ errflag, str.c_ptr_safe());
DBUG_VOID_RETURN;
}
case HA_ERR_TABLE_DEF_CHANGED:
@@ -4320,13 +4314,13 @@ handler::ha_drop_table(const char *name)
*/
int
-handler::ha_create(const char *name, TABLE *form, HA_CREATE_INFO *info)
+handler::ha_create(const char *name, TABLE *form, HA_CREATE_INFO *info_arg)
{
DBUG_ASSERT(m_lock_type == F_UNLCK);
mark_trx_read_write();
- int error= create(name, form, info);
+ int error= create(name, form, info_arg);
if (!error &&
- !(info->options & (HA_LEX_CREATE_TMP_TABLE | HA_CREATE_TMP_ALTER)))
+ !(info_arg->options & (HA_LEX_CREATE_TMP_TABLE | HA_CREATE_TMP_ALTER)))
mysql_audit_create_table(form);
return error;
}
@@ -4339,7 +4333,8 @@ handler::ha_create(const char *name, TABLE *form, HA_CREATE_INFO *info)
*/
int
-handler::ha_create_partitioning_metadata(const char *name, const char *old_name,
+handler::ha_create_partitioning_metadata(const char *name,
+ const char *old_name,
int action_flag)
{
/*
@@ -4363,12 +4358,13 @@ handler::ha_create_partitioning_metadata(const char *name, const char *old_name,
int
handler::ha_change_partitions(HA_CREATE_INFO *create_info,
- const char *path,
- ulonglong * const copied,
- ulonglong * const deleted,
- const uchar *pack_frm_data,
- size_t pack_frm_len)
-{ /*
+ const char *path,
+ ulonglong * const copied,
+ ulonglong * const deleted,
+ const uchar *pack_frm_data,
+ size_t pack_frm_len)
+{
+ /*
Must have at least RDLCK or be a TMP table. Read lock is needed to read
from current partitions and write lock will be taken on new partitions.
*/
@@ -5534,11 +5530,16 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat)
{
List<Item> field_list;
Protocol *protocol= thd->protocol;
+ MEM_ROOT *mem_root= thd->mem_root;
bool result;
- field_list.push_back(new Item_empty_string("Type",10));
- field_list.push_back(new Item_empty_string("Name",FN_REFLEN));
- field_list.push_back(new Item_empty_string("Status",10));
+ field_list.push_back(new (mem_root) Item_empty_string(thd, "Type", 10),
+ mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Name", FN_REFLEN), mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Status", 10),
+ mem_root);
if (protocol->send_result_set_metadata(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
@@ -5601,13 +5602,31 @@ static bool check_table_binlog_row_based(THD *thd, TABLE *table)
DBUG_ASSERT(table->s->cached_row_logging_check == 0 ||
table->s->cached_row_logging_check == 1);
- return thd->is_current_stmt_binlog_format_row() &&
+ return (thd->is_current_stmt_binlog_format_row() &&
table->s->cached_row_logging_check &&
+#ifdef WITH_WSREP
+ /*
+ Wsrep partially enables binary logging if it have not been
+ explicitly turned on. As a result we return 'true' if we are in
+ wsrep binlog emulation mode and the current thread is not a wsrep
+ applier or replayer thread. This decision is not affected by
+ @@sql_log_bin as we want the events to make into the binlog
+ cache only to filter them later before they make into binary log
+ file.
+
+ However, we do return 'false' if binary logging was temporarily
+ turned off (see tmp_disable_binlog(A)).
+
+ Otherwise, return 'true' if binary logging is on.
+ */
+ (thd->variables.sql_log_bin_off != 1) &&
+ ((WSREP_EMULATE_BINLOG(thd) && (thd->wsrep_exec_mode != REPL_RECV)) ||
+ ((WSREP(thd) || (thd->variables.option_bits & OPTION_BIN_LOG)) &&
+ mysql_bin_log.is_open())));
+#else
(thd->variables.option_bits & OPTION_BIN_LOG) &&
- /* applier and replayer should not binlog */
- ((IF_WSREP(WSREP_EMULATE_BINLOG(thd) &&
- thd->wsrep_exec_mode != REPL_RECV, 0)) ||
- mysql_bin_log.is_open());
+ mysql_bin_log.is_open());
+#endif
}
@@ -5696,8 +5715,7 @@ static int write_locked_table_maps(THD *thd)
}
-typedef bool Log_func(THD*, TABLE*, bool, MY_BITMAP*,
- uint, const uchar*, const uchar*);
+typedef bool Log_func(THD*, TABLE*, bool, const uchar*, const uchar*);
static int binlog_log_row(TABLE* table,
const uchar *before_record,
@@ -5714,40 +5732,24 @@ static int binlog_log_row(TABLE* table,
if (check_table_binlog_row_based(thd, table))
{
- MY_BITMAP cols;
- /* Potential buffer on the stack for the bitmap */
- uint32 bitbuf[BITMAP_STACKBUF_SIZE/sizeof(uint32)];
- uint n_fields= table->s->fields;
- my_bool use_bitbuf= n_fields <= sizeof(bitbuf)*8;
-
/*
If there are no table maps written to the binary log, this is
the first row handled in this statement. In that case, we need
to write table maps for all locked tables to the binary log.
*/
- if (likely(!(error= my_bitmap_init(&cols,
- use_bitbuf ? bitbuf : NULL,
- (n_fields + 7) & ~7UL,
- FALSE))))
+ if (likely(!(error= write_locked_table_maps(thd))))
{
- bitmap_set_all(&cols);
- if (likely(!(error= write_locked_table_maps(thd))))
- {
- /*
- We need to have a transactional behavior for SQLCOM_CREATE_TABLE
- (i.e. CREATE TABLE... SELECT * FROM TABLE) in order to keep a
- compatible behavior with the STMT based replication even when
- the table is not transactional. In other words, if the operation
- fails while executing the insert phase nothing is written to the
- binlog.
- */
- bool const has_trans= thd->lex->sql_command == SQLCOM_CREATE_TABLE ||
- table->file->has_transactions();
- error= (*log_func)(thd, table, has_trans, &cols, table->s->fields,
- before_record, after_record);
- }
- if (!use_bitbuf)
- my_bitmap_free(&cols);
+ /*
+ We need to have a transactional behavior for SQLCOM_CREATE_TABLE
+ (i.e. CREATE TABLE... SELECT * FROM TABLE) in order to keep a
+ compatible behavior with the STMT based replication even when
+ the table is not transactional. In other words, if the operation
+ fails while executing the insert phase nothing is written to the
+ binlog.
+ */
+ bool const has_trans= thd->lex->sql_command == SQLCOM_CREATE_TABLE ||
+ table->file->has_transactions();
+ error= (*log_func)(thd, table, has_trans, before_record, after_record);
}
}
return error ? HA_ERR_RBR_LOGGING_FAILED : 0;
@@ -6064,7 +6066,7 @@ int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal)
{
DBUG_ENTER("ha_abort_transaction");
if (!WSREP(bf_thd) &&
- !(wsrep_OSU_method_options == WSREP_OSU_RSU &&
+ !(bf_thd->variables.wsrep_OSU_method == WSREP_OSU_RSU &&
bf_thd->wsrep_exec_mode == TOTAL_ORDER)) {
DBUG_RETURN(0);
}
@@ -6076,9 +6078,17 @@ int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal)
{
handlerton *hton= ha_info->ht();
if (!hton->abort_transaction)
- WSREP_WARN("cannot abort transaction");
+ {
+ /* Skip warning for binlog SE */
+ if (hton->db_type != DB_TYPE_BINLOG)
+ {
+ WSREP_WARN("Cannot abort transaction.");
+ }
+ }
else
+ {
hton->abort_transaction(hton, bf_thd, victim_thd, signal);
+ }
ha_info_next= ha_info->next();
}
DBUG_RETURN(0);
diff --git a/sql/handler.h b/sql/handler.h
index 279bfafd3b9..749c1aaf497 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -1740,10 +1740,10 @@ struct Table_specification_st: public HA_CREATE_INFO,
HA_CREATE_INFO::init();
DDL_options_st::init();
}
- void init(DDL_options_st::Options options)
+ void init(DDL_options_st::Options options_arg)
{
HA_CREATE_INFO::init();
- DDL_options_st::init(options);
+ DDL_options_st::init(options_arg);
}
/*
Quick initialization, for parser.
diff --git a/sql/hostname.cc b/sql/hostname.cc
index 1879d056623..656663a9692 100644
--- a/sql/hostname.cc
+++ b/sql/hostname.cc
@@ -27,7 +27,7 @@
#include <my_global.h>
#include "sql_priv.h"
#include "hostname.h"
-#include "my_global.h"
+#include "unireg.h"
#ifndef __WIN__
#include <netdb.h> // getservbyname, servent
#endif
diff --git a/sql/item.cc b/sql/item.cc
index 16249582b75..a8641216573 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -97,7 +97,6 @@ bool Item::val_bool()
return val_real() != 0.0;
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0);
return 0; // Wrong (but safe)
}
@@ -111,6 +110,8 @@ bool Item::val_bool()
*/
bool Item::get_date_with_conversion(MYSQL_TIME *ltime, ulonglong fuzzydate)
{
+ THD *thd= current_thd;
+
/*
Some TIME type items return error when trying to do get_date()
without TIME_TIME_ONLY set (e.g. Item_field for Field_time).
@@ -119,7 +120,7 @@ bool Item::get_date_with_conversion(MYSQL_TIME *ltime, ulonglong fuzzydate)
and leave it to get_date() to check date.
*/
ulonglong time_flag= (field_type() == MYSQL_TYPE_TIME &&
- !(current_thd->variables.old_behavior & OLD_MODE_ZERO_DATE_TIME_CAST)) ?
+ !(thd->variables.old_behavior & OLD_MODE_ZERO_DATE_TIME_CAST)) ?
TIME_TIME_ONLY : 0;
if (get_date(ltime, fuzzydate | time_flag))
return true;
@@ -127,7 +128,7 @@ bool Item::get_date_with_conversion(MYSQL_TIME *ltime, ulonglong fuzzydate)
!(fuzzydate & TIME_TIME_ONLY))
{
MYSQL_TIME tmp;
- if (time_to_datetime_with_warn(current_thd, ltime, &tmp, fuzzydate))
+ if (time_to_datetime_with_warn(thd, ltime, &tmp, fuzzydate))
return null_value= true;
*ltime= tmp;
}
@@ -135,6 +136,48 @@ bool Item::get_date_with_conversion(MYSQL_TIME *ltime, ulonglong fuzzydate)
}
+/**
+ Get date/time/datetime.
+ If DATETIME or DATE result is returned, it's converted to TIME.
+*/
+bool Item::get_time_with_conversion(THD *thd, MYSQL_TIME *ltime,
+ ulonglong fuzzydate)
+{
+ if (get_date(ltime, fuzzydate))
+ return true;
+ if (ltime->time_type != MYSQL_TIMESTAMP_TIME)
+ {
+ MYSQL_TIME ltime2;
+ if ((thd->variables.old_behavior & OLD_MODE_ZERO_DATE_TIME_CAST) &&
+ (ltime->year || ltime->day || ltime->month))
+ {
+ /*
+ Old mode conversion from DATETIME with non-zero YYYYMMDD part
+ to TIME works very inconsistently. Possible variants:
+ - truncate the YYYYMMDD part
+ - add (MM*33+DD)*24 to hours
+ - add (MM*31+DD)*24 to hours
+ Let's return NULL here, to disallow equal field propagation.
+ Note, If we start to use this method in more pieces of the code other
+ than eqial field propagation, we should probably return
+ NULL only if some flag in fuzzydate is set.
+ */
+ return (null_value= true);
+ }
+ if (datetime_to_time_with_warn(thd, ltime, &ltime2, TIME_SECOND_PART_DIGITS))
+ {
+ /*
+ Time difference between CURRENT_DATE and ltime
+ did not fit into the supported TIME range
+ */
+ return (null_value= true);
+ }
+ *ltime= ltime2;
+ }
+ return false;
+}
+
+
/*
For the items which don't have its own fast val_str_ascii()
implementation we provide a generic slower version,
@@ -274,17 +317,8 @@ my_decimal *Item::val_decimal_from_string(my_decimal *decimal_value)
if (!(res= val_str(&str_value)))
return 0;
- if (str2my_decimal(E_DEC_FATAL_ERROR & ~E_DEC_BAD_NUM,
- res->ptr(), res->length(), res->charset(),
- decimal_value) & E_DEC_BAD_NUM)
- {
- ErrConvString err(res);
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE,
- ER(ER_TRUNCATED_WRONG_VALUE), "DECIMAL",
- err.ptr());
- }
- return decimal_value;
+ return decimal_from_string_with_check(decimal_value,
+ res->charset(), res->ptr(), res->end());
}
@@ -410,20 +444,19 @@ int Item::save_str_value_in_field(Field *field, String *result)
}
-Item::Item():
+Item::Item(THD *thd):
is_expensive_cache(-1), rsize(0), name(0), orig_name(0), name_length(0),
fixed(0), is_autogenerated_name(TRUE)
{
+ DBUG_ASSERT(thd);
marker= 0;
maybe_null=null_value=with_sum_func=with_field=0;
in_rollup= 0;
with_subselect= 0;
- cmp_context= IMPOSSIBLE_RESULT;
/* Initially this item is not attached to any JOIN_TAB. */
join_tab_idx= MAX_TABLES;
/* Put item in free list so that we can free all items at end */
- THD *thd= current_thd;
next= thd->free_list;
thd->free_list= this;
/*
@@ -465,8 +498,7 @@ Item::Item(THD *thd, Item *item):
with_field(item->with_field),
fixed(item->fixed),
is_autogenerated_name(item->is_autogenerated_name),
- with_subselect(item->has_subquery()),
- cmp_context(item->cmp_context)
+ with_subselect(item->has_subquery())
{
next= thd->free_list; // Put in free list
thd->free_list= this;
@@ -488,7 +520,7 @@ uint Item::decimal_precision() const
}
-uint Item::temporal_precision(enum_field_types type)
+uint Item::temporal_precision(enum_field_types type_arg)
{
if (const_item() && result_type() == STRING_RESULT &&
!is_temporal_type(field_type()))
@@ -498,7 +530,7 @@ uint Item::temporal_precision(enum_field_types type)
MYSQL_TIME_STATUS status;
DBUG_ASSERT(fixed);
if ((tmp= val_str(&buf)) &&
- !(type == MYSQL_TYPE_TIME ?
+ !(type_arg == MYSQL_TYPE_TIME ?
str_to_time(tmp->charset(), tmp->ptr(), tmp->length(),
&ltime, TIME_TIME_ONLY, &status) :
str_to_datetime(tmp->charset(), tmp->ptr(), tmp->length(),
@@ -542,7 +574,6 @@ void Item::print_value(String *str)
break;
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0);
}
}
@@ -633,7 +664,7 @@ Item_result Item::cmp_type() const
return TIME_RESULT;
};
DBUG_ASSERT(0);
- return IMPOSSIBLE_RESULT;
+ return STRING_RESULT;
}
/**
@@ -665,11 +696,11 @@ Item_result Item::cmp_type() const
pointer to newly allocated item is returned.
*/
-Item* Item::transform(Item_transformer transformer, uchar *arg)
+Item* Item::transform(THD *thd, Item_transformer transformer, uchar *arg)
{
- DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
+ DBUG_ASSERT(!thd->stmt_arena->is_stmt_prepare());
- return (this->*transformer)(arg);
+ return (this->*transformer)(thd, arg);
}
@@ -692,7 +723,7 @@ Item* Item::set_expr_cache(THD *thd)
{
DBUG_ENTER("Item::set_expr_cache");
Item_cache_wrapper *wrapper;
- if ((wrapper= new Item_cache_wrapper(this)) &&
+ if ((wrapper= new (thd->mem_root) Item_cache_wrapper(thd, this)) &&
!wrapper->fix_fields(thd, (Item**)&wrapper))
{
if (wrapper->set_cache(thd))
@@ -703,10 +734,11 @@ Item* Item::set_expr_cache(THD *thd)
}
-Item_ident::Item_ident(Name_resolution_context *context_arg,
+Item_ident::Item_ident(THD *thd, Name_resolution_context *context_arg,
const char *db_name_arg,const char *table_name_arg,
const char *field_name_arg)
- :orig_db_name(db_name_arg), orig_table_name(table_name_arg),
+ :Item_result_field(thd), orig_db_name(db_name_arg),
+ orig_table_name(table_name_arg),
orig_field_name(field_name_arg), context(context_arg),
db_name(db_name_arg), table_name(table_name_arg),
field_name(field_name_arg),
@@ -717,8 +749,9 @@ Item_ident::Item_ident(Name_resolution_context *context_arg,
}
-Item_ident::Item_ident(TABLE_LIST *view_arg, const char *field_name_arg)
- :orig_db_name(NullS), orig_table_name(view_arg->table_name),
+Item_ident::Item_ident(THD *thd, TABLE_LIST *view_arg, const char *field_name_arg)
+ :Item_result_field(thd), orig_db_name(NullS),
+ orig_table_name(view_arg->table_name),
orig_field_name(field_name_arg), context(&view_arg->view->select_lex.context),
db_name(NullS), table_name(view_arg->alias),
field_name(field_name_arg),
@@ -962,16 +995,19 @@ void Item::set_name(const char *str, uint length, CHARSET_INFO *cs)
if (str != str_start && !is_autogenerated_name)
{
char buff[SAFE_NAME_LEN];
+ THD *thd= current_thd;
+
strmake(buff, str_start,
MY_MIN(sizeof(buff)-1, length + (int) (str-str_start)));
if (length == 0)
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_NAME_BECOMES_EMPTY, ER(ER_NAME_BECOMES_EMPTY),
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_NAME_BECOMES_EMPTY,
+ ER_THD(thd, ER_NAME_BECOMES_EMPTY),
buff);
else
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_REMOVED_SPACES, ER(ER_REMOVED_SPACES),
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_REMOVED_SPACES, ER_THD(thd, ER_REMOVED_SPACES),
buff);
}
if (!my_charset_same(cs, system_charset_info))
@@ -1036,16 +1072,52 @@ bool Item::eq(const Item *item, bool binary_cmp) const
}
-Item *Item::safe_charset_converter(CHARSET_INFO *tocs)
+Item *Item::safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
{
if (!needs_charset_converter(tocs))
return this;
- Item_func_conv_charset *conv= new Item_func_conv_charset(this, tocs, 1);
+ Item_func_conv_charset *conv= new (thd->mem_root) Item_func_conv_charset(thd, this, tocs, 1);
return conv->safe ? conv : NULL;
}
/**
+ Some pieces of the code do not support changing of
+ Item_cache to other Item types.
+
+ Example:
+ Item_singlerow_subselect has "Item_cache **row".
+ Creating of Item_func_conv_charset followed by THD::change_item_tree()
+ should not change row[i] from Item_cache directly to Item_func_conv_charset,
+ because Item_singlerow_subselect later calls Item_cache-specific methods,
+ e.g. row[i]->store() and row[i]->cache_value().
+
+ Let's wrap Item_func_conv_charset in a new Item_cache,
+ so the Item_cache-specific methods can still be used for
+ Item_singlerow_subselect::row[i] safely.
+
+ As a bonus we cache the converted value, instead of converting every time
+
+ TODO: we should eventually check all other use cases of change_item_tree().
+ Perhaps some more potentially dangerous substitution examples exist.
+*/
+Item *Item_cache::safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
+{
+ if (!example)
+ return Item::safe_charset_converter(thd, tocs);
+ Item *conv= example->safe_charset_converter(thd, tocs);
+ if (conv == example)
+ return this;
+ Item_cache *cache;
+ if (!conv || !(cache= new (thd->mem_root) Item_cache_str(thd, conv)))
+ return NULL; // Safe conversion is not possible, or OEM
+ cache->setup(thd, conv);
+ cache->fixed= false; // Make Item::fix_fields() happy
+ return cache;
+}
+
+
+/**
@details
Created mostly for mysql_prepare_table(). Important
when a string ENUM/SET column is described with a numeric default value:
@@ -1056,7 +1128,7 @@ Item *Item::safe_charset_converter(CHARSET_INFO *tocs)
the latter returns a non-fixed Item, so val_str() crashes afterwards.
Override Item_num method, to return a fixed item.
*/
-Item *Item_num::safe_charset_converter(CHARSET_INFO *tocs)
+Item *Item_num::safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
{
/*
Item_num returns pure ASCII result,
@@ -1067,7 +1139,7 @@ Item *Item_num::safe_charset_converter(CHARSET_INFO *tocs)
return this;
Item *conv;
- if ((conv= const_charset_converter(tocs, true)))
+ if ((conv= const_charset_converter(thd, tocs, true)))
conv->fix_char_length(max_char_length());
return conv;
}
@@ -1085,7 +1157,7 @@ Item *Item_num::safe_charset_converter(CHARSET_INFO *tocs)
NULL, if safe conversion is not possible, or
a new item representing the converted constant.
*/
-Item *Item::const_charset_converter(CHARSET_INFO *tocs,
+Item *Item::const_charset_converter(THD *thd, CHARSET_INFO *tocs,
bool lossless,
const char *func_name)
{
@@ -1093,8 +1165,10 @@ Item *Item::const_charset_converter(CHARSET_INFO *tocs,
DBUG_ASSERT(fixed);
StringBuffer<64>tmp;
String *s= val_str(&tmp);
+ MEM_ROOT *mem_root= thd->mem_root;
+
if (!s)
- return new Item_null((char *) func_name, tocs);
+ return new (mem_root) Item_null(thd, (char *) func_name, tocs);
if (!needs_charset_converter(s->length(), tocs))
{
@@ -1105,14 +1179,16 @@ Item *Item::const_charset_converter(CHARSET_INFO *tocs,
}
uint conv_errors;
- Item_string *conv= func_name ?
- new Item_static_string_func(func_name,
- s, tocs, &conv_errors,
- collation.derivation,
- collation.repertoire) :
- new Item_string(s, tocs, &conv_errors,
- collation.derivation,
- collation.repertoire);
+ Item_string *conv= (func_name ?
+ new (mem_root)
+ Item_static_string_func(thd, func_name,
+ s, tocs, &conv_errors,
+ collation.derivation,
+ collation.repertoire) :
+ new (mem_root)
+ Item_string(thd, s, tocs, &conv_errors,
+ collation.derivation,
+ collation.repertoire));
if (!conv || (conv_errors && lossless))
{
@@ -1131,7 +1207,7 @@ Item *Item::const_charset_converter(CHARSET_INFO *tocs,
}
-Item *Item_param::safe_charset_converter(CHARSET_INFO *tocs)
+Item *Item_param::safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
{
/*
Return "this" if in prepare. result_type may change at execition time,
@@ -1145,7 +1221,7 @@ Item *Item_param::safe_charset_converter(CHARSET_INFO *tocs)
and INT_RESULT at execution time.
*/
return !const_item() || state == NULL_VALUE ?
- this : const_charset_converter(tocs, true);
+ this : const_charset_converter(thd, tocs, true);
}
@@ -1278,9 +1354,9 @@ int Item::save_in_field_no_warnings(Field *field, bool no_conversions)
Item_sp_variable methods
*****************************************************************************/
-Item_sp_variable::Item_sp_variable(char *sp_var_name_str,
- uint sp_var_name_length)
- :m_thd(0)
+Item_sp_variable::Item_sp_variable(THD *thd, char *sp_var_name_str,
+ uint sp_var_name_length):
+ Item(thd), m_thd(0)
#ifndef DBUG_OFF
, m_sp(0)
#endif
@@ -1385,13 +1461,13 @@ bool Item_sp_variable::is_null()
Item_splocal methods
*****************************************************************************/
-Item_splocal::Item_splocal(const LEX_STRING &sp_var_name,
+Item_splocal::Item_splocal(THD *thd, const LEX_STRING &sp_var_name,
uint sp_var_idx,
enum_field_types sp_var_type,
- uint pos_in_q, uint len_in_q)
- :Item_sp_variable(sp_var_name.str, sp_var_name.length),
- Rewritable_query_parameter(pos_in_q, len_in_q),
- m_var_idx(sp_var_idx)
+ uint pos_in_q, uint len_in_q):
+ Item_sp_variable(thd, sp_var_name.str, sp_var_name.length),
+ Rewritable_query_parameter(pos_in_q, len_in_q),
+ m_var_idx(sp_var_idx)
{
maybe_null= TRUE;
@@ -1447,9 +1523,9 @@ bool Item_splocal::set_value(THD *thd, sp_rcontext *ctx, Item **it)
Item_case_expr methods
*****************************************************************************/
-Item_case_expr::Item_case_expr(uint case_expr_id)
- :Item_sp_variable( C_STRING_WITH_LEN("case_expr")),
- m_case_expr_id(case_expr_id)
+Item_case_expr::Item_case_expr(THD *thd, uint case_expr_id):
+ Item_sp_variable(thd, C_STRING_WITH_LEN("case_expr")),
+ m_case_expr_id(case_expr_id)
{
}
@@ -1537,8 +1613,8 @@ bool Item_name_const::is_null()
}
-Item_name_const::Item_name_const(Item *name_arg, Item *val):
- value_item(val), name_item(name_arg)
+Item_name_const::Item_name_const(THD *thd, Item *name_arg, Item *val):
+ Item(thd), value_item(val), name_item(name_arg)
{
Item::maybe_null= TRUE;
valid_args= true;
@@ -1649,9 +1725,10 @@ void Item_name_const::print(String *str, enum_query_type query_type)
class Item_aggregate_ref : public Item_ref
{
public:
- Item_aggregate_ref(Name_resolution_context *context_arg, Item **item,
- const char *table_name_arg, const char *field_name_arg)
- :Item_ref(context_arg, item, table_name_arg, field_name_arg) {}
+ Item_aggregate_ref(THD *thd, Name_resolution_context *context_arg,
+ Item **item, const char *table_name_arg,
+ const char *field_name_arg):
+ Item_ref(thd, context_arg, item, table_name_arg, field_name_arg) {}
virtual inline void print (String *str, enum_query_type query_type)
{
@@ -1669,74 +1746,105 @@ public:
@param thd Thread handler
@param ref_pointer_array Pointer to array of reference fields
- @param fields All fields in select
+ @param fields All fields in select
@param ref Pointer to item
- @param skip_registered <=> function be must skipped for registered
- SUM items
+ @param split_flags Zero or more of the following flags
+ SPLIT_FUNC_SKIP_REGISTERED:
+ Function be must skipped for registered SUM
+ SUM items
+ SPLIT_SUM_SELECT
+ We are called on the select level and have to
+ register items operated on sum function
@note
- This is from split_sum_func2() for items that should be split
-
All found SUM items are added FIRST in the fields list and
we replace the item with a reference.
+ If this is an item in the SELECT list then we also have to split out
+ all arguments to functions used together with the sum function.
+ For example in case of SELECT A*sum(B) we have to split out both
+ A and sum(B).
+ This is not needed for ORDER BY, GROUP BY or HAVING as all references
+ to items in the select list are already of type REF
+
thd->fatal_error() may be called if we are out of memory
*/
void Item::split_sum_func2(THD *thd, Item **ref_pointer_array,
List<Item> &fields, Item **ref,
- bool skip_registered)
+ uint split_flags)
{
- /* An item of type Item_sum is registered <=> ref_by != 0 */
- if (type() == SUM_FUNC_ITEM && skip_registered &&
- ((Item_sum *) this)->ref_by)
- return;
- if ((type() != SUM_FUNC_ITEM && with_sum_func) ||
- (type() == FUNC_ITEM &&
- (((Item_func *) this)->functype() == Item_func::ISNOTNULLTEST_FUNC ||
- ((Item_func *) this)->functype() == Item_func::TRIG_COND_FUNC)))
+ if (unlikely(type() == SUM_FUNC_ITEM))
{
- /* Will split complicated items and ignore simple ones */
- split_sum_func(thd, ref_pointer_array, fields);
+ /* An item of type Item_sum is registered if ref_by != 0 */
+ if ((split_flags & SPLIT_SUM_SKIP_REGISTERED) &&
+ ((Item_sum *) this)->ref_by)
+ return;
}
- else if ((type() == SUM_FUNC_ITEM || (used_tables() & ~PARAM_TABLE_BIT)) &&
- type() != SUBSELECT_ITEM &&
- (type() != REF_ITEM ||
- ((Item_ref*)this)->ref_type() == Item_ref::VIEW_REF))
+ else
{
- /*
- Replace item with a reference so that we can easily calculate
- it (in case of sum functions) or copy it (in case of fields)
-
- The test above is to ensure we don't do a reference for things
- that are constants (PARAM_TABLE_BIT is in effect a constant)
- or already referenced (for example an item in HAVING)
- Exception is Item_direct_view_ref which we need to convert to
- Item_ref to allow fields from view being stored in tmp table.
- */
- Item_aggregate_ref *item_ref;
- uint el= fields.elements;
- /*
- If this is an item_ref, get the original item
- This is a safety measure if this is called for things that is
- already a reference.
- */
- Item *real_itm= real_item();
+ /* Not a SUM() function */
+ if (unlikely((!with_sum_func && !(split_flags & SPLIT_SUM_SELECT))))
+ {
+ /*
+ This is not a SUM function and there are no SUM functions inside.
+ Nothing more to do.
+ */
+ return;
+ }
+ if (likely(with_sum_func ||
+ (type() == FUNC_ITEM &&
+ (((Item_func *) this)->functype() ==
+ Item_func::ISNOTNULLTEST_FUNC ||
+ ((Item_func *) this)->functype() ==
+ Item_func::TRIG_COND_FUNC))))
+ {
+ /* Will call split_sum_func2() for all items */
+ split_sum_func(thd, ref_pointer_array, fields, split_flags);
+ return;
+ }
- ref_pointer_array[el]= real_itm;
- if (!(item_ref= new Item_aggregate_ref(&thd->lex->current_select->context,
- ref_pointer_array + el, 0, name)))
- return; // fatal_error is set
- if (type() == SUM_FUNC_ITEM)
- item_ref->depended_from= ((Item_sum *) this)->depended_from();
- fields.push_front(real_itm);
- thd->change_item_tree(ref, item_ref);
+ if (unlikely((!(used_tables() & ~PARAM_TABLE_BIT) ||
+ type() == SUBSELECT_ITEM ||
+ (type() == REF_ITEM &&
+ ((Item_ref*)this)->ref_type() != Item_ref::VIEW_REF))))
+ return;
}
+
+ /*
+ Replace item with a reference so that we can easily calculate
+ it (in case of sum functions) or copy it (in case of fields)
+
+ The test above is to ensure we don't do a reference for things
+ that are constants (PARAM_TABLE_BIT is in effect a constant)
+ or already referenced (for example an item in HAVING)
+ Exception is Item_direct_view_ref which we need to convert to
+ Item_ref to allow fields from view being stored in tmp table.
+ */
+ Item_aggregate_ref *item_ref;
+ uint el= fields.elements;
+ /*
+ If this is an item_ref, get the original item
+ This is a safety measure if this is called for things that is
+ already a reference.
+ */
+ Item *real_itm= real_item();
+
+ ref_pointer_array[el]= real_itm;
+ if (!(item_ref= (new (thd->mem_root)
+ Item_aggregate_ref(thd,
+ &thd->lex->current_select->context,
+ ref_pointer_array + el, 0, name))))
+ return; // fatal_error is set
+ if (type() == SUM_FUNC_ITEM)
+ item_ref->depended_from= ((Item_sum *) this)->depended_from();
+ fields.push_front(real_itm);
+ thd->change_item_tree(ref, item_ref);
}
static bool
-left_is_superset(DTCollation *left, DTCollation *right)
+left_is_superset(const DTCollation *left, const DTCollation *right)
{
/* Allow convert to Unicode */
if (left->collation->state & MY_CS_UNICODE &&
@@ -1795,7 +1903,7 @@ left_is_superset(DTCollation *left, DTCollation *right)
@endcode
*/
-bool DTCollation::aggregate(DTCollation &dt, uint flags)
+bool DTCollation::aggregate(const DTCollation &dt, uint flags)
{
if (!my_charset_same(collation, dt.collation))
{
@@ -2014,11 +2122,11 @@ bool agg_item_set_converter(DTCollation &coll, const char *fname,
for (i= 0, arg= args; i < nargs; i++, arg+= item_sep)
{
- Item* conv= (*arg)->safe_charset_converter(coll.collation);
+ Item* conv= (*arg)->safe_charset_converter(thd, coll.collation);
if (conv == *arg)
continue;
if (!conv && ((*arg)->collation.repertoire == MY_REPERTOIRE_ASCII))
- conv= new Item_func_conv_charset(*arg, coll.collation, 1);
+ conv= new (thd->mem_root) Item_func_conv_charset(thd, *arg, coll.collation, 1);
if (!conv)
{
@@ -2116,8 +2224,8 @@ void Item_ident_for_show::make_field(Send_field *tmp_field)
/**********************************************/
-Item_field::Item_field(Field *f)
- :Item_ident(0, NullS, *f->table_name, f->field_name),
+Item_field::Item_field(THD *thd, Field *f)
+ :Item_ident(thd, 0, NullS, *f->table_name, f->field_name),
item_equal(0), no_const_subst(0),
have_privileges(0), any_privileges(0)
{
@@ -2140,7 +2248,7 @@ Item_field::Item_field(Field *f)
Item_field::Item_field(THD *thd, Name_resolution_context *context_arg,
Field *f)
- :Item_ident(context_arg, f->table->s->db.str, *f->table_name, f->field_name),
+ :Item_ident(thd, context_arg, f->table->s->db.str, *f->table_name, f->field_name),
item_equal(0), no_const_subst(0),
have_privileges(0), any_privileges(0)
{
@@ -2180,14 +2288,14 @@ Item_field::Item_field(THD *thd, Name_resolution_context *context_arg,
}
-Item_field::Item_field(Name_resolution_context *context_arg,
+Item_field::Item_field(THD *thd, Name_resolution_context *context_arg,
const char *db_arg,const char *table_name_arg,
const char *field_name_arg)
- :Item_ident(context_arg, db_arg,table_name_arg,field_name_arg),
+ :Item_ident(thd, context_arg, db_arg, table_name_arg, field_name_arg),
field(0), item_equal(0), no_const_subst(0),
have_privileges(0), any_privileges(0)
{
- SELECT_LEX *select= current_thd->lex->current_select;
+ SELECT_LEX *select= thd->lex->current_select;
collation.set(DERIVATION_IMPLICIT);
if (select && select->parsing_place != IN_HAVING)
select->select_n_where_fields++;
@@ -2319,18 +2427,21 @@ const char *Item_ident::full_name() const
char *tmp;
if (!table_name || !field_name)
return field_name ? field_name : name ? name : "tmp_field";
+
if (db_name && db_name[0])
{
- tmp=(char*) sql_alloc((uint) strlen(db_name)+(uint) strlen(table_name)+
- (uint) strlen(field_name)+3);
+ THD *thd= current_thd;
+ tmp=(char*) thd->alloc((uint) strlen(db_name)+(uint) strlen(table_name)+
+ (uint) strlen(field_name)+3);
strxmov(tmp,db_name,".",table_name,".",field_name,NullS);
}
else
{
if (table_name[0])
{
- tmp= (char*) sql_alloc((uint) strlen(table_name) +
- (uint) strlen(field_name) + 2);
+ THD *thd= current_thd;
+ tmp= (char*) thd->alloc((uint) strlen(table_name) +
+ (uint) strlen(field_name) + 2);
strxmov(tmp, table_name, ".", field_name, NullS);
}
else
@@ -2374,8 +2485,8 @@ void Item_ident::print(String *str, enum_query_type query_type)
When printing EXPLAIN, don't print database name when it's the same as
current database.
*/
- bool skip_db= (query_type & QT_EXPLAIN) && thd->db &&
- !strcmp(thd->db, db_name);
+ bool skip_db= (query_type & QT_ITEM_IDENT_SKIP_CURRENT_DATABASE) &&
+ thd->db && !strcmp(thd->db, db_name);
if (!skip_db &&
!(cached_table && cached_table->belong_to_view &&
cached_table->belong_to_view->compact_view_format))
@@ -2515,7 +2626,6 @@ bool Item_field::val_bool_result()
return result_field->val_real() != 0.0;
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0);
return 0; // Shut up compiler
}
@@ -2531,11 +2641,11 @@ bool Item_field::is_null_result()
bool Item_field::eq(const Item *item, bool binary_cmp) const
{
- Item *real_item= ((Item *) item)->real_item();
- if (real_item->type() != FIELD_ITEM)
+ Item *real_item2= ((Item *) item)->real_item();
+ if (real_item2->type() != FIELD_ITEM)
return 0;
- Item_field *item_field= (Item_field*) real_item;
+ Item_field *item_field= (Item_field*) real_item2;
if (item_field->field && field)
return item_field->field == field;
/*
@@ -2612,7 +2722,8 @@ longlong Item_field::val_int_endpoint(bool left_endp, bool *incl_endp)
This is always 'signed'. Unsigned values are created with Item_uint()
*/
-Item_int::Item_int(const char *str_arg, uint length)
+Item_int::Item_int(THD *thd, const char *str_arg, uint length):
+ Item_num(thd)
{
char *end_ptr= (char*) str_arg + length;
int error;
@@ -2645,15 +2756,15 @@ void Item_int::print(String *str, enum_query_type query_type)
}
-Item_uint::Item_uint(const char *str_arg, uint length):
- Item_int(str_arg, length)
+Item_uint::Item_uint(THD *thd, const char *str_arg, uint length):
+ Item_int(thd, str_arg, length)
{
unsigned_flag= 1;
}
-Item_uint::Item_uint(const char *str_arg, longlong i, uint length):
- Item_int(str_arg, i, length)
+Item_uint::Item_uint(THD *thd, const char *str_arg, longlong i, uint length):
+ Item_int(thd, str_arg, i, length)
{
unsigned_flag= 1;
}
@@ -2676,8 +2787,9 @@ void Item_uint::print(String *str, enum_query_type query_type)
}
-Item_decimal::Item_decimal(const char *str_arg, uint length,
- CHARSET_INFO *charset)
+Item_decimal::Item_decimal(THD *thd, const char *str_arg, uint length,
+ CHARSET_INFO *charset):
+ Item_num(thd)
{
str2my_decimal(E_DEC_FATAL_ERROR, str_arg, length, charset, &decimal_value);
name= (char*) str_arg;
@@ -2689,7 +2801,8 @@ Item_decimal::Item_decimal(const char *str_arg, uint length,
unsigned_flag);
}
-Item_decimal::Item_decimal(longlong val, bool unsig)
+Item_decimal::Item_decimal(THD *thd, longlong val, bool unsig):
+ Item_num(thd)
{
int2my_decimal(E_DEC_FATAL_ERROR, val, unsig, &decimal_value);
decimals= (uint8) decimal_value.frac;
@@ -2701,7 +2814,8 @@ Item_decimal::Item_decimal(longlong val, bool unsig)
}
-Item_decimal::Item_decimal(double val, int precision, int scale)
+Item_decimal::Item_decimal(THD *thd, double val, int precision, int scale):
+ Item_num(thd)
{
double2my_decimal(E_DEC_FATAL_ERROR, val, &decimal_value);
decimals= (uint8) decimal_value.frac;
@@ -2713,8 +2827,9 @@ Item_decimal::Item_decimal(double val, int precision, int scale)
}
-Item_decimal::Item_decimal(const char *str, const my_decimal *val_arg,
- uint decimal_par, uint length)
+Item_decimal::Item_decimal(THD *thd, const char *str, const my_decimal *val_arg,
+ uint decimal_par, uint length):
+ Item_num(thd)
{
my_decimal2decimal(val_arg, &decimal_value);
name= (char*) str;
@@ -2724,7 +2839,8 @@ Item_decimal::Item_decimal(const char *str, const my_decimal *val_arg,
}
-Item_decimal::Item_decimal(my_decimal *value_par)
+Item_decimal::Item_decimal(THD *thd, my_decimal *value_par):
+ Item_num(thd)
{
my_decimal2decimal(value_par, &decimal_value);
decimals= (uint8) decimal_value.frac;
@@ -2736,7 +2852,8 @@ Item_decimal::Item_decimal(my_decimal *value_par)
}
-Item_decimal::Item_decimal(const uchar *bin, int precision, int scale)
+Item_decimal::Item_decimal(THD *thd, const uchar *bin, int precision, int scale):
+ Item_num(thd)
{
binary2my_decimal(E_DEC_FATAL_ERROR, bin,
&decimal_value, precision, scale);
@@ -2805,6 +2922,13 @@ void Item_decimal::set_decimal_value(my_decimal *value_par)
}
+Item *Item_decimal::clone_item(THD *thd)
+{
+ return new (thd->mem_root) Item_decimal(thd, name, &decimal_value, decimals,
+ max_length);
+}
+
+
String *Item_float::val_str(String *str)
{
// following assert is redundant, because fixed=1 assigned in constructor
@@ -2823,6 +2947,13 @@ my_decimal *Item_float::val_decimal(my_decimal *decimal_value)
}
+Item *Item_float::clone_item(THD *thd)
+{
+ return new (thd->mem_root) Item_float(thd, name, value, decimals,
+ max_length);
+}
+
+
void Item_string::print(String *str, enum_query_type query_type)
{
const bool print_introducer=
@@ -2887,32 +3018,6 @@ void Item_string::print(String *str, enum_query_type query_type)
}
-double
-double_from_string_with_check(CHARSET_INFO *cs, const char *cptr,
- const char *end)
-{
- int error;
- char *end_of_num= (char*) end;
- double tmp;
-
- tmp= my_strntod(cs, (char*) cptr, end - cptr, &end_of_num, &error);
- if (error || (end != end_of_num &&
- !check_if_only_end_space(cs, end_of_num, end)))
- {
- ErrConvString err(cptr, end - cptr, cs);
- /*
- We can use err.ptr() here as ErrConvString is guranteed to put an
- end \0 here.
- */
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE,
- ER(ER_TRUNCATED_WRONG_VALUE), "DOUBLE",
- err.ptr());
- }
- return tmp;
-}
-
-
double Item_string::val_real()
{
DBUG_ASSERT(fixed == 1);
@@ -2923,33 +3028,6 @@ double Item_string::val_real()
}
-longlong
-longlong_from_string_with_check(CHARSET_INFO *cs, const char *cptr,
- const char *end)
-{
- int err;
- longlong tmp;
- char *end_of_num= (char*) end;
-
- tmp= (*(cs->cset->strtoll10))(cs, cptr, &end_of_num, &err);
- /*
- TODO: Give error if we wanted a signed integer and we got an unsigned
- one
- */
- if (!current_thd->no_errors &&
- (err > 0 ||
- (end != end_of_num && !check_if_only_end_space(cs, end_of_num, end))))
- {
- ErrConvString err(cptr, end - cptr, cs);
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE,
- ER(ER_TRUNCATED_WRONG_VALUE), "INTEGER",
- err.ptr());
- }
- return tmp;
-}
-
-
/**
@todo
Give error if we wanted a signed integer and we got an unsigned one
@@ -2997,11 +3075,16 @@ my_decimal *Item_null::val_decimal(my_decimal *decimal_value)
}
-Item *Item_null::safe_charset_converter(CHARSET_INFO *tocs)
+Item *Item_null::safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
{
return this;
}
+Item *Item_null::clone_item(THD *thd)
+{
+ return new (thd->mem_root) Item_null(thd, name);
+}
+
/*********************** Item_param related ******************************/
/**
@@ -3018,7 +3101,8 @@ default_set_param_func(Item_param *param,
}
-Item_param::Item_param(uint pos_in_query_arg) :
+Item_param::Item_param(THD *thd, uint pos_in_query_arg):
+ Item_basic_value(thd),
Rewritable_query_parameter(pos_in_query_arg, 1),
state(NO_VALUE),
item_result_type(STRING_RESULT),
@@ -3286,7 +3370,6 @@ bool Item_param::set_from_user_var(THD *thd, const user_var_entry *entry)
}
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0);
set_null();
}
@@ -3615,24 +3698,28 @@ bool Item_param::basic_const_item() const
}
+/* see comments in the header file */
+
Item *
-Item_param::clone_item()
+Item_param::clone_item(THD *thd)
{
- /* see comments in the header file */
+ MEM_ROOT *mem_root= thd->mem_root;
switch (state) {
case NULL_VALUE:
- return new Item_null(name);
+ return new (mem_root) Item_null(thd, name);
case INT_VALUE:
return (unsigned_flag ?
- new Item_uint(name, value.integer, max_length) :
- new Item_int(name, value.integer, max_length));
+ new (mem_root) Item_uint(thd, name, value.integer, max_length) :
+ new (mem_root) Item_int(thd, name, value.integer, max_length));
case REAL_VALUE:
- return new Item_float(name, value.real, decimals, max_length);
+ return new (mem_root) Item_float(thd, name, value.real, decimals,
+ max_length);
case STRING_VALUE:
case LONG_DATA_VALUE:
- return new Item_string(name, str_value.c_ptr_quick(), str_value.length(),
- str_value.charset(),
- collation.derivation, collation.repertoire);
+ return new (mem_root) Item_string(thd, name, str_value.c_ptr_quick(),
+ str_value.length(), str_value.charset(),
+ collation.derivation,
+ collation.repertoire);
case TIME_VALUE:
break;
case NO_VALUE:
@@ -3884,22 +3971,23 @@ bool Item_param::append_for_log(THD *thd, String *str)
Item_copy
****************************************************************************/
-Item_copy *Item_copy::create (Item *item)
+Item_copy *Item_copy::create(THD *thd, Item *item)
{
+ MEM_ROOT *mem_root= thd->mem_root;
switch (item->result_type())
{
case STRING_RESULT:
- return new Item_copy_string (item);
- case REAL_RESULT:
- return new Item_copy_float (item);
+ return new (mem_root) Item_copy_string(thd, item);
+ case REAL_RESULT:
+ return new (mem_root) Item_copy_float(thd, item);
case INT_RESULT:
- return item->unsigned_flag ?
- new Item_copy_uint (item) : new Item_copy_int (item);
+ return item->unsigned_flag ?
+ new (mem_root) Item_copy_uint(thd, item) :
+ new (mem_root) Item_copy_int(thd, item);
case DECIMAL_RESULT:
- return new Item_copy_decimal (item);
+ return new (mem_root) Item_copy_decimal(thd, item);
case TIME_RESULT:
case ROW_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT (0);
}
/* should not happen */
@@ -4202,26 +4290,32 @@ static bool mark_as_dependent(THD *thd, SELECT_LEX *last, SELECT_LEX *current,
Item_ident *resolved_item,
Item_ident *mark_item)
{
- const char *db_name= (resolved_item->db_name ?
- resolved_item->db_name : "");
- const char *table_name= (resolved_item->table_name ?
- resolved_item->table_name : "");
+ DBUG_ENTER("mark_as_dependent");
+
/* store pointer on SELECT_LEX from which item is dependent */
if (mark_item && mark_item->can_be_depended)
+ {
+ DBUG_PRINT("info", ("mark_item: %p lex: %p", mark_item, last));
mark_item->depended_from= last;
- if (current->mark_as_dependent(thd, last, /** resolved_item psergey-thu
- **/mark_item))
- return TRUE;
+ }
+ if (current->mark_as_dependent(thd, last,
+ /** resolved_item psergey-thu **/ mark_item))
+ DBUG_RETURN(TRUE);
if (thd->lex->describe & DESCRIBE_EXTENDED)
{
+ const char *db_name= (resolved_item->db_name ?
+ resolved_item->db_name : "");
+ const char *table_name= (resolved_item->table_name ?
+ resolved_item->table_name : "");
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_WARN_FIELD_RESOLVED, ER(ER_WARN_FIELD_RESOLVED),
- db_name, (db_name[0] ? "." : ""),
- table_name, (table_name [0] ? "." : ""),
- resolved_item->field_name,
- current->select_number, last->select_number);
+ ER_WARN_FIELD_RESOLVED,
+ ER_THD(thd,ER_WARN_FIELD_RESOLVED),
+ db_name, (db_name[0] ? "." : ""),
+ table_name, (table_name [0] ? "." : ""),
+ resolved_item->field_name,
+ current->select_number, last->select_number);
}
- return FALSE;
+ DBUG_RETURN(FALSE);
}
@@ -4462,9 +4556,10 @@ resolve_ref_in_select_and_group(THD *thd, Item_ident *ref, SELECT_LEX *select)
!((*group_by_ref)->eq(*select_ref, 0)))
{
ambiguous_fields= TRUE;
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_NON_UNIQ_ERROR,
- ER(ER_NON_UNIQ_ERROR), ref->full_name(),
- current_thd->where);
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_NON_UNIQ_ERROR,
+ ER_THD(thd,ER_NON_UNIQ_ERROR), ref->full_name(),
+ thd->where);
}
}
@@ -4670,7 +4765,7 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
non aggregated fields of the outer select.
*/
marker= select->cur_pos_in_select_list;
- select->non_agg_fields.push_back(this);
+ select->join->non_agg_fields.push_back(this, thd->mem_root);
}
if (*from_field != view_ref_found)
{
@@ -4692,10 +4787,10 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
fix_inner_refs() function.
*/
;
- if (!(rf= new Item_outer_ref(context, this)))
+ if (!(rf= new (thd->mem_root) Item_outer_ref(thd, context, this)))
return -1;
thd->change_item_tree(reference, rf);
- select->inner_refs_list.push_back(rf);
+ select->inner_refs_list.push_back(rf, thd->mem_root);
rf->in_sum_func= thd->lex->in_sum_func;
}
/*
@@ -4799,20 +4894,24 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
save= *ref;
*ref= NULL; // Don't call set_properties()
rf= (place == IN_HAVING ?
- new Item_ref(context, ref, (char*) table_name,
- (char*) field_name, alias_name_used) :
+ new (thd->mem_root)
+ Item_ref(thd, context, ref, (char*) table_name,
+ (char*) field_name, alias_name_used) :
(!select->group_list.elements ?
- new Item_direct_ref(context, ref, (char*) table_name,
- (char*) field_name, alias_name_used) :
- new Item_outer_ref(context, ref, (char*) table_name,
- (char*) field_name, alias_name_used)));
+ new (thd->mem_root)
+ Item_direct_ref(thd, context, ref, (char*) table_name,
+ (char*) field_name, alias_name_used) :
+ new (thd->mem_root)
+ Item_outer_ref(thd, context, ref, (char*) table_name,
+ (char*) field_name, alias_name_used)));
*ref= save;
if (!rf)
return -1;
if (place != IN_HAVING && select->group_list.elements)
{
- outer_context->select_lex->inner_refs_list.push_back((Item_outer_ref*)rf);
+ outer_context->select_lex->inner_refs_list.push_back((Item_outer_ref*)rf,
+ thd->mem_root);
((Item_outer_ref*)rf)->in_sum_func= thd->lex->in_sum_func;
}
thd->change_item_tree(reference, rf);
@@ -4838,7 +4937,7 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
if (last_checked_context->select_lex->having_fix_field)
{
Item_ref *rf;
- rf= new Item_ref(context, (*from_field)->table->s->db.str,
+ rf= new (thd->mem_root) Item_ref(thd, context, (*from_field)->table->s->db.str,
(*from_field)->table->alias.c_ptr(),
(char*) field_name);
if (!rf)
@@ -4934,7 +5033,8 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
{
uint counter;
enum_resolution_type resolution;
- Item** res= find_item_in_list(this, thd->lex->current_select->item_list,
+ Item** res= find_item_in_list(this,
+ thd->lex->current_select->item_list,
&counter, REPORT_EXCEPT_NOT_FOUND,
&resolution);
if (!res)
@@ -4958,7 +5058,7 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
{
/* The column to which we link isn't valid. */
my_error(ER_BAD_FIELD_ERROR, MYF(0), (*res)->name,
- current_thd->where);
+ thd->where);
return(1);
}
@@ -4972,11 +5072,13 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
Item_ref to point to the Item in the select list and replace the
Item_field created by the parser with the new Item_ref.
*/
- Item_ref *rf= new Item_ref(context, db_name,table_name,field_name);
+ Item_ref *rf= new (thd->mem_root)
+ Item_ref(thd, context, db_name, table_name,
+ field_name);
if (!rf)
return 1;
- bool ret= rf->fix_fields(thd, (Item **) &rf) || rf->check_cols(1);
- if (ret)
+ bool err= rf->fix_fields(thd, (Item **) &rf) || rf->check_cols(1);
+ if (err)
return TRUE;
SELECT_LEX *select= thd->lex->current_select;
@@ -5082,9 +5184,10 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
fixed= 1;
if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY &&
!outer_fixed && !thd->lex->in_sum_func &&
- thd->lex->current_select->cur_pos_in_select_list != UNDEF_POS)
+ thd->lex->current_select->cur_pos_in_select_list != UNDEF_POS &&
+ thd->lex->current_select->join)
{
- thd->lex->current_select->non_agg_fields.push_back(this);
+ thd->lex->current_select->join->non_agg_fields.push_back(this, thd->mem_root);
marker= thd->lex->current_select->cur_pos_in_select_list;
}
mark_non_agg_field:
@@ -5120,7 +5223,7 @@ mark_non_agg_field:
else
{
if (outer_fixed)
- thd->lex->in_sum_func->outer_fields.push_back(this);
+ thd->lex->in_sum_func->outer_fields.push_back(this, thd->mem_root);
else if (thd->lex->in_sum_func->nest_level !=
thd->lex->current_select->nest_level)
select_lex->set_non_agg_field_used(true);
@@ -5205,75 +5308,6 @@ Item_equal *Item_field::find_item_equal(COND_EQUAL *cond_equal)
/**
- Check whether a field item can be substituted for an equal item
-
- @details
- The function checks whether a substitution of a field item for
- an equal item is valid.
-
- @param arg *arg != NULL <-> the field is in the context
- where substitution for an equal item is valid
-
- @note
- The following statement is not always true:
- @n
- x=y => F(x)=F(x/y).
- @n
- This means substitution of an item for an equal item not always
- yields an equavalent condition. Here's an example:
- @code
- 'a'='a '
- (LENGTH('a')=1) != (LENGTH('a ')=2)
- @endcode
- Such a substitution is surely valid if either the substituted
- field is not of a STRING type or if it is an argument of
- a comparison predicate.
-
- @retval
- TRUE substitution is valid
- @retval
- FALSE otherwise
-*/
-
-bool Item_field::subst_argument_checker(uchar **arg)
-{
- return *arg &&
- (*arg == (uchar *) Item::ANY_SUBST ||
- result_type() != STRING_RESULT ||
- (field->flags & BINARY_FLAG));
-}
-
-
-/**
- Convert a numeric value to a zero-filled string
-
- @param[in,out] item the item to operate on
- @param field The field that this value is equated to
-
- This function converts a numeric value to a string. In this conversion
- the zero-fill flag of the field is taken into account.
- This is required so the resulting string value can be used instead of
- the field reference when propagating equalities.
-*/
-
-static void convert_zerofill_number_to_string(Item **item, Field_num *field)
-{
- char buff[MAX_FIELD_WIDTH],*pos;
- String tmp(buff,sizeof(buff), field->charset()), *res;
-
- res= (*item)->val_str(&tmp);
- if ((*item)->is_null())
- *item= new Item_null();
- else
- {
- field->prepend_zeros(res);
- pos= (char *) sql_strmake (res->ptr(), res->length());
- *item= new Item_string(pos, res->length(), field->charset());
- }
-}
-
-
-/**
Set a pointer to the multiple equality the field reference belongs to
(if any).
@@ -5297,31 +5331,42 @@ static void convert_zerofill_number_to_string(Item **item, Field_num *field)
- pointer to the field item, otherwise.
*/
-Item *Item_field::equal_fields_propagator(uchar *arg)
+Item *Item_field::propagate_equal_fields(THD *thd,
+ const Context &ctx,
+ COND_EQUAL *arg)
{
- if (no_const_subst)
+ if (no_const_subst || !(item_equal= find_item_equal(arg)))
return this;
- item_equal= find_item_equal((COND_EQUAL *) arg);
- Item *item= 0;
- if (item_equal)
- item= item_equal->get_const();
- /*
- Disable const propagation for items used in different comparison contexts.
- This must be done because, for example, Item_hex_string->val_int() is not
- the same as (Item_hex_string->val_str() in BINARY column)->val_int().
- We cannot simply disable the replacement in a particular context (
- e.g. <bin_col> = <int_col> AND <bin_col> = <hex_string>) since
- Items don't know the context they are in and there are functions like
- IF (<hex_string>, 'yes', 'no').
- */
- if (!item || !has_compatible_context(item))
- item= this;
- else if (field && (field->flags & ZEROFILL_FLAG) && IS_NUM(field->type()))
+ if (!field->can_be_substituted_to_equal_item(ctx, item_equal))
{
- if (item && (cmp_context == STRING_RESULT || cmp_context == IMPOSSIBLE_RESULT))
- convert_zerofill_number_to_string(&item, (Field_num *)field);
- else
- item= this;
+ item_equal= NULL;
+ return this;
+ }
+ Item *item= item_equal->get_const();
+ if (!item)
+ {
+ /*
+ The found Item_equal is Okey, but it does not have a constant
+ item yet. Keep this->item_equal point to the found Item_equal.
+ */
+ return this;
+ }
+ if (!(item= field->get_equal_const_item(thd, ctx, item)))
+ {
+ /*
+ Could not do safe conversion from the original constant item
+ to a field-compatible constant item.
+ For example, we tried to optimize:
+ WHERE date_column=' garbage ' AND LENGTH(date_column)=8;
+ to
+ WHERE date_column=' garbage ' AND LENGTH(DATE'XXXX-YY-ZZ');
+ but failed to create a valid DATE literal from the given string literal.
+
+ Do not do constant propagation in such cases and unlink
+ "this" from the found Item_equal (as this equality not usefull).
+ */
+ item_equal= NULL;
+ return this;
}
return item;
}
@@ -5367,17 +5412,28 @@ bool Item_field::set_no_const_sub(uchar *arg)
- this - otherwise.
*/
-Item *Item_field::replace_equal_field(uchar *arg)
+Item *Item_field::replace_equal_field(THD *thd, uchar *arg)
{
REPLACE_EQUAL_FIELD_ARG* param= (REPLACE_EQUAL_FIELD_ARG*)arg;
if (item_equal && item_equal == param->item_equal)
{
- Item *const_item= item_equal->get_const();
- if (const_item)
+ Item *const_item2= item_equal->get_const();
+ if (const_item2)
{
- if (!has_compatible_context(const_item))
- return this;
- return const_item;
+ /*
+ Currently we don't allow to create Item_equal with compare_type()
+ different from its Item_field's cmp_type().
+ Field_xxx::test_if_equality_guarantees_uniqueness() prevent this.
+ Also, Item_field::propagate_equal_fields() does not allow to assign
+ this->item_equal to any instances of Item_equal if "this" is used
+ in a non-native comparison context, or with an incompatible collation.
+ So the fact that we have (item_equal != NULL) means that the currently
+ processed function (the owner of "this") uses the field in its native
+ comparison context, and it's safe to replace it to the constant from
+ item_equal.
+ */
+ DBUG_ASSERT(cmp_type() == item_equal->compare_type());
+ return const_item2;
}
Item_field *subst=
(Item_field *)(item_equal->get_first(param->context_tab, this));
@@ -5442,7 +5498,6 @@ enum_field_types Item::field_type() const
case REAL_RESULT: return MYSQL_TYPE_DOUBLE;
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0);
return MYSQL_TYPE_VARCHAR;
}
@@ -5489,8 +5544,10 @@ String *Item::check_well_formed_result(String *str, bool send_error)
{
str->length(wlen);
}
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_INVALID_CHARACTER_STRING,
- ER(ER_INVALID_CHARACTER_STRING), cs->csname, hexbuf);
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_INVALID_CHARACTER_STRING,
+ ER_THD(thd, ER_INVALID_CHARACTER_STRING), cs->csname,
+ hexbuf);
}
return str;
}
@@ -5511,7 +5568,7 @@ String_copier_for_item::copy_with_warn(CHARSET_INFO *dstcs, String *dst,
ErrConvString err(pos, src_length - (pos - src), &my_charset_bin);
push_warning_printf(m_thd, Sql_condition::WARN_LEVEL_WARN,
ER_INVALID_CHARACTER_STRING,
- ER(ER_INVALID_CHARACTER_STRING),
+ ER_THD(m_thd, ER_INVALID_CHARACTER_STRING),
srccs == &my_charset_bin ?
dstcs->csname : srccs->csname,
err.ptr());
@@ -5526,7 +5583,7 @@ String_copier_for_item::copy_with_warn(CHARSET_INFO *dstcs, String *dst,
octet2hex(buf, pos, mblen);
push_warning_printf(m_thd, Sql_condition::WARN_LEVEL_WARN,
ER_CANNOT_CONVERT_CHARACTER,
- ER(ER_CANNOT_CONVERT_CHARACTER),
+ ER_THD(m_thd, ER_CANNOT_CONVERT_CHARACTER),
srccs->csname, buf, dstcs->csname);
return m_thd->is_strict_mode();
}
@@ -5591,22 +5648,26 @@ bool Item::eq_by_collation(Item *item, bool binary_cmp, CHARSET_INFO *cs)
Field *Item::make_string_field(TABLE *table)
{
Field *field;
+ MEM_ROOT *mem_root= table->in_use->mem_root;
+
DBUG_ASSERT(collation.collation);
/*
Note: the following check is repeated in
subquery_types_allow_materialization():
*/
if (too_big_for_varchar())
- field= new Field_blob(max_length, maybe_null, name,
- collation.collation, TRUE);
+ field= new (mem_root)
+ Field_blob(max_length, maybe_null, name,
+ collation.collation, TRUE);
/* Item_type_holder holds the exact type, do not change it */
else if (max_length > 0 &&
(type() != Item::TYPE_HOLDER || field_type() != MYSQL_TYPE_STRING))
- field= new Field_varstring(max_length, maybe_null, name, table->s,
- collation.collation);
+ field= new (mem_root)
+ Field_varstring(max_length, maybe_null, name, table->s,
+ collation.collation);
else
- field= new Field_string(max_length, maybe_null, name,
- collation.collation);
+ field= new (mem_root)
+ Field_string(max_length, maybe_null, name, collation.collation);
if (field)
field->init(table);
return field;
@@ -5632,63 +5693,74 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length)
*/
uchar *null_ptr= maybe_null ? (uchar*) "" : 0;
Field *field;
+ MEM_ROOT *mem_root= table->in_use->mem_root;
switch (field_type()) {
case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_NEWDECIMAL:
- field= Field_new_decimal::create_from_item(this);
+ field= Field_new_decimal::create_from_item(mem_root, this);
break;
case MYSQL_TYPE_TINY:
- field= new Field_tiny((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
- name, 0, unsigned_flag);
+ field= new (mem_root)
+ Field_tiny((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
+ name, 0, unsigned_flag);
break;
case MYSQL_TYPE_SHORT:
- field= new Field_short((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
- name, 0, unsigned_flag);
+ field= new (mem_root)
+ Field_short((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
+ name, 0, unsigned_flag);
break;
case MYSQL_TYPE_LONG:
- field= new Field_long((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
- name, 0, unsigned_flag);
+ field= new (mem_root)
+ Field_long((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
+ name, 0, unsigned_flag);
break;
#ifdef HAVE_LONG_LONG
case MYSQL_TYPE_LONGLONG:
- field= new Field_longlong((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
- name, 0, unsigned_flag);
+ field= new (mem_root)
+ Field_longlong((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
+ name, 0, unsigned_flag);
break;
#endif
case MYSQL_TYPE_FLOAT:
- field= new Field_float((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
- name, decimals, 0, unsigned_flag);
+ field= new (mem_root)
+ Field_float((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
+ name, decimals, 0, unsigned_flag);
break;
case MYSQL_TYPE_DOUBLE:
- field= new Field_double((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
- name, decimals, 0, unsigned_flag);
+ field= new (mem_root)
+ Field_double((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
+ name, decimals, 0, unsigned_flag);
break;
case MYSQL_TYPE_INT24:
- field= new Field_medium((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
- name, 0, unsigned_flag);
+ field= new (mem_root)
+ Field_medium((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
+ name, 0, unsigned_flag);
break;
case MYSQL_TYPE_NEWDATE:
case MYSQL_TYPE_DATE:
- field= new Field_newdate(0, null_ptr, 0, Field::NONE, name);
+ field= new (mem_root)
+ Field_newdate(0, null_ptr, 0, Field::NONE, name);
break;
case MYSQL_TYPE_TIME:
- field= new_Field_time(0, null_ptr, 0, Field::NONE, name, decimals);
+ field= new_Field_time(mem_root, 0, null_ptr, 0, Field::NONE, name,
+ decimals);
break;
case MYSQL_TYPE_TIMESTAMP:
- field= new_Field_timestamp(0, null_ptr, 0,
+ field= new_Field_timestamp(mem_root, 0, null_ptr, 0,
Field::NONE, name, 0, decimals);
break;
case MYSQL_TYPE_DATETIME:
- field= new_Field_datetime(0, null_ptr, 0, Field::NONE, name, decimals);
+ field= new_Field_datetime(mem_root, 0, null_ptr, 0, Field::NONE, name,
+ decimals);
break;
case MYSQL_TYPE_YEAR:
- field= new Field_year((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
- name);
+ field= new (mem_root)
+ Field_year((uchar*) 0, max_length, null_ptr, 0, Field::NONE, name);
break;
case MYSQL_TYPE_BIT:
- field= new Field_bit_as_char(NULL, max_length, null_ptr, 0,
- Field::NONE, name);
+ field= new (mem_root)
+ Field_bit_as_char(NULL, max_length, null_ptr, 0, Field::NONE, name);
break;
default:
/* This case should never be chosen */
@@ -5698,8 +5770,8 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length)
case MYSQL_TYPE_STRING:
if (fixed_length && !too_big_for_varchar())
{
- field= new Field_string(max_length, maybe_null, name,
- collation.collation);
+ field= new (mem_root)
+ Field_string(max_length, maybe_null, name, collation.collation);
break;
}
/* Fall through to make_string_field() */
@@ -5713,15 +5785,16 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length)
case MYSQL_TYPE_LONG_BLOB:
case MYSQL_TYPE_BLOB:
if (this->type() == Item::TYPE_HOLDER)
- field= new Field_blob(max_length, maybe_null, name, collation.collation,
- 1);
+ field= new (mem_root)
+ Field_blob(max_length, maybe_null, name, collation.collation, 1);
else
- field= new Field_blob(max_length, maybe_null, name, collation.collation);
+ field= new (mem_root)
+ Field_blob(max_length, maybe_null, name, collation.collation);
break; // Blob handled outside of case
#ifdef HAVE_SPATIAL
case MYSQL_TYPE_GEOMETRY:
- field= new Field_geom(max_length, maybe_null,
- name, table->s, get_geometry_type());
+ field= new (mem_root)
+ Field_geom(max_length, maybe_null, name, table->s, get_geometry_type());
#endif /* HAVE_SPATIAL */
}
if (field)
@@ -5954,6 +6027,14 @@ int Item_string::save_in_field(Field *field, bool no_conversions)
}
+Item *Item_string::clone_item(THD *thd)
+{
+ return new (thd->mem_root)
+ Item_string(thd, name, str_value.ptr(),
+ str_value.length(), collation.collation);
+}
+
+
static int save_int_value_in_field (Field *field, longlong nr,
bool null_value, bool unsigned_flag)
{
@@ -5970,6 +6051,12 @@ int Item_int::save_in_field(Field *field, bool no_conversions)
}
+Item *Item_int::clone_item(THD *thd)
+{
+ return new (thd->mem_root) Item_int(thd, name, value, max_length);
+}
+
+
void Item_datetime::set(longlong packed)
{
unpack_time(packed, &ltime);
@@ -5993,7 +6080,7 @@ int Item_decimal::save_in_field(Field *field, bool no_conversions)
}
-Item *Item_int_with_ref::clone_item()
+Item *Item_int_with_ref::clone_item(THD *thd)
{
DBUG_ASSERT(ref->const_item());
/*
@@ -6001,18 +6088,25 @@ Item *Item_int_with_ref::clone_item()
parameter markers.
*/
return (ref->unsigned_flag ?
- new Item_uint(ref->name, ref->val_int(), ref->max_length) :
- new Item_int(ref->name, ref->val_int(), ref->max_length));
+ new (thd->mem_root)
+ Item_uint(thd, ref->name, ref->val_int(), ref->max_length) :
+ new (thd->mem_root)
+ Item_int(thd, ref->name, ref->val_int(), ref->max_length));
}
-Item_num *Item_uint::neg()
+Item_num *Item_uint::neg(THD *thd)
{
- Item_decimal *item= new Item_decimal(value, 1);
- return item->neg();
+ Item_decimal *item= new (thd->mem_root) Item_decimal(thd, value, 1);
+ return item->neg(thd);
}
+Item *Item_uint::clone_item(THD *thd)
+{
+ return new (thd->mem_root) Item_uint(thd, name, value, max_length);
+}
+
static uint nr_of_decimals(const char *str, const char *end)
{
const char *decimal_point;
@@ -6067,7 +6161,8 @@ static uint nr_of_decimals(const char *str, const char *end)
Item->name should be fixed to use LEX_STRING eventually.
*/
-Item_float::Item_float(const char *str_arg, uint length)
+Item_float::Item_float(THD *thd, const char *str_arg, uint length):
+ Item_num(thd)
{
int error;
char *end_not_used;
@@ -6118,10 +6213,11 @@ inline uint char_val(char X)
}
-void Item_hex_constant::hex_string_init(const char *str, uint str_length)
+void Item_hex_constant::hex_string_init(THD *thd, const char *str,
+ uint str_length)
{
max_length=(str_length+1)/2;
- char *ptr=(char*) sql_alloc(max_length+1);
+ char *ptr=(char*) thd->alloc(max_length+1);
if (!ptr)
{
str_value.set("", 0, &my_charset_bin);
@@ -6210,15 +6306,16 @@ void Item_hex_string::print(String *str, enum_query_type query_type)
In number context this is a longlong value.
*/
-Item_bin_string::Item_bin_string(const char *str, uint str_length)
+Item_bin_string::Item_bin_string(THD *thd, const char *str, uint str_length):
+ Item_hex_hybrid(thd)
{
const char *end= str + str_length - 1;
+ char *ptr;
uchar bits= 0;
uint power= 1;
max_length= (str_length + 7) >> 3;
- char *ptr= (char*) sql_alloc(max_length + 1);
- if (!ptr)
+ if (!(ptr= (char*) thd->alloc(max_length + 1)))
return;
str_value.set(ptr, max_length, &my_charset_bin);
@@ -6268,6 +6365,12 @@ void Item_date_literal::print(String *str, enum_query_type query_type)
}
+Item *Item_date_literal::clone_item(THD *thd)
+{
+ return new (thd->mem_root) Item_date_literal(thd, &cached_time);
+}
+
+
bool Item_date_literal::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
{
DBUG_ASSERT(fixed);
@@ -6288,6 +6391,12 @@ void Item_datetime_literal::print(String *str, enum_query_type query_type)
}
+Item *Item_datetime_literal::clone_item(THD *thd)
+{
+ return new (thd->mem_root) Item_datetime_literal(thd, &cached_time, decimals);
+}
+
+
bool Item_datetime_literal::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
{
DBUG_ASSERT(fixed);
@@ -6308,6 +6417,12 @@ void Item_time_literal::print(String *str, enum_query_type query_type)
}
+Item *Item_time_literal::clone_item(THD *thd)
+{
+ return new (thd->mem_root) Item_time_literal(thd, &cached_time, decimals);
+}
+
+
bool Item_time_literal::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
{
DBUG_ASSERT(fixed);
@@ -6492,15 +6607,15 @@ bool Item::cache_const_expr_analyzer(uchar **arg)
@return this otherwise.
*/
-Item* Item::cache_const_expr_transformer(uchar *arg)
+Item* Item::cache_const_expr_transformer(THD *thd, uchar *arg)
{
if (*(bool*)arg)
{
*((bool*)arg)= FALSE;
- Item_cache *cache= Item_cache::get_cache(this);
+ Item_cache *cache= Item_cache::get_cache(thd, this);
if (!cache)
return NULL;
- cache->setup(this);
+ cache->setup(thd, this);
cache->store(this);
return cache;
}
@@ -6521,6 +6636,18 @@ bool Item_field::send(Protocol *protocol, String *buffer)
}
+Item* Item::propagate_equal_fields_and_change_item_tree(THD *thd,
+ const Context &ctx,
+ COND_EQUAL *cond,
+ Item **place)
+{
+ Item *item= propagate_equal_fields(thd, ctx, cond);
+ if (item && item != this)
+ thd->change_item_tree(place, item);
+ return item;
+}
+
+
void Item_field::update_null_value()
{
/*
@@ -6559,7 +6686,7 @@ void Item_field::update_null_value()
this field otherwise
*/
-Item *Item_field::update_value_transformer(uchar *select_arg)
+Item *Item_field::update_value_transformer(THD *thd, uchar *select_arg)
{
SELECT_LEX *select= (SELECT_LEX*)select_arg;
DBUG_ASSERT(fixed);
@@ -6573,9 +6700,10 @@ Item *Item_field::update_value_transformer(uchar *select_arg)
Item_ref *ref;
ref_pointer_array[el]= (Item*)this;
- all_fields->push_front((Item*)this);
- ref= new Item_ref(&select->context, ref_pointer_array + el,
- table_name, field_name);
+ all_fields->push_front((Item*)this, thd->mem_root);
+ ref= new (thd->mem_root)
+ Item_ref(thd, &select->context, ref_pointer_array + el,
+ table_name, field_name);
return ref;
}
return this;
@@ -6593,18 +6721,18 @@ void Item_field::print(String *str, enum_query_type query_type)
}
-Item_ref::Item_ref(Name_resolution_context *context_arg,
+Item_ref::Item_ref(THD *thd, Name_resolution_context *context_arg,
Item **item, const char *table_name_arg,
const char *field_name_arg,
- bool alias_name_used_arg)
- :Item_ident(context_arg, NullS, table_name_arg, field_name_arg),
- ref(item), reference_trough_name(0)
+ bool alias_name_used_arg):
+ Item_ident(thd, context_arg, NullS, table_name_arg, field_name_arg),
+ ref(item), reference_trough_name(0)
{
alias_name_used= alias_name_used_arg;
/*
This constructor used to create some internals references over fixed items
*/
- if (ref && *ref && (*ref)->fixed)
+ if ((set_properties_only= (ref && *ref && (*ref)->fixed)))
set_properties();
}
@@ -6639,16 +6767,16 @@ public:
}
};
-Item_ref::Item_ref(TABLE_LIST *view_arg, Item **item,
- const char *field_name_arg, bool alias_name_used_arg)
- :Item_ident(view_arg, field_name_arg),
- ref(item), reference_trough_name(0)
+Item_ref::Item_ref(THD *thd, TABLE_LIST *view_arg, Item **item,
+ const char *field_name_arg, bool alias_name_used_arg):
+ Item_ident(thd, view_arg, field_name_arg),
+ ref(item), reference_trough_name(0)
{
alias_name_used= alias_name_used_arg;
/*
This constructor is used to create some internal references over fixed items
*/
- if (ref && *ref && (*ref)->fixed)
+ if ((set_properties_only= (ref && *ref && (*ref)->fixed)))
set_properties();
}
@@ -6723,7 +6851,11 @@ bool Item_ref::fix_fields(THD *thd, Item **reference)
DBUG_ASSERT(fixed == 0);
SELECT_LEX *current_sel= thd->lex->current_select;
- if (!ref || ref == not_found_item)
+ if (set_properties_only)
+ {
+ /* do nothing */
+ }
+ else if (!ref || ref == not_found_item)
{
DBUG_ASSERT(reference_trough_name != 0);
if (!(ref= resolve_ref_in_select_and_group(thd, this,
@@ -6741,7 +6873,7 @@ bool Item_ref::fix_fields(THD *thd, Item **reference)
{
/* The current reference cannot be resolved in this query. */
my_error(ER_BAD_FIELD_ERROR,MYF(0),
- this->full_name(), current_thd->where);
+ this->full_name(), thd->where);
goto error;
}
@@ -6868,11 +7000,11 @@ bool Item_ref::fix_fields(THD *thd, Item **reference)
if (from_field != not_found_field)
{
Item_field* fld;
- if (!(fld= new Item_field(from_field)))
+ if (!(fld= new (thd->mem_root) Item_field(thd, from_field)))
goto error;
thd->change_item_tree(reference, fld);
mark_as_dependent(thd, last_checked_context->select_lex,
- thd->lex->current_select, fld, fld);
+ current_sel, fld, fld);
/*
A reference is resolved to a nest level that's outer or the same as
the nest level of the enclosing set function : adjust the value of
@@ -6889,7 +7021,7 @@ bool Item_ref::fix_fields(THD *thd, Item **reference)
{
/* The item was not a table field and not a reference */
my_error(ER_BAD_FIELD_ERROR, MYF(0),
- this->full_name(), current_thd->where);
+ this->full_name(), thd->where);
goto error;
}
/* Should be checked in resolve_ref_in_select_and_group(). */
@@ -7005,13 +7137,13 @@ void Item_ref::cleanup()
@retval NULL Out of memory error
*/
-Item* Item_ref::transform(Item_transformer transformer, uchar *arg)
+Item* Item_ref::transform(THD *thd, Item_transformer transformer, uchar *arg)
{
- DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
+ DBUG_ASSERT(!thd->stmt_arena->is_stmt_prepare());
DBUG_ASSERT((*ref) != NULL);
/* Transform the object we are referencing. */
- Item *new_item= (*ref)->transform(transformer, arg);
+ Item *new_item= (*ref)->transform(thd, transformer, arg);
if (!new_item)
return NULL;
@@ -7022,10 +7154,10 @@ Item* Item_ref::transform(Item_transformer transformer, uchar *arg)
change records at each execution.
*/
if (*ref != new_item)
- current_thd->change_item_tree(ref, new_item);
+ thd->change_item_tree(ref, new_item);
/* Transform the item ref object. */
- return (this->*transformer)(arg);
+ return (this->*transformer)(thd, arg);
}
@@ -7051,7 +7183,7 @@ Item* Item_ref::transform(Item_transformer transformer, uchar *arg)
@return Item returned as the result of transformation of the Item_ref object
*/
-Item* Item_ref::compile(Item_analyzer analyzer, uchar **arg_p,
+Item* Item_ref::compile(THD *thd, Item_analyzer analyzer, uchar **arg_p,
Item_transformer transformer, uchar *arg_t)
{
/* Analyze this Item object. */
@@ -7063,13 +7195,13 @@ Item* Item_ref::compile(Item_analyzer analyzer, uchar **arg_p,
if (*arg_p)
{
uchar *arg_v= *arg_p;
- Item *new_item= (*ref)->compile(analyzer, &arg_v, transformer, arg_t);
+ Item *new_item= (*ref)->compile(thd, analyzer, &arg_v, transformer, arg_t);
if (new_item && *ref != new_item)
- current_thd->change_item_tree(ref, new_item);
+ thd->change_item_tree(ref, new_item);
}
/* Transform this Item object. */
- return (this->*transformer)(arg_t);
+ return (this->*transformer)(thd, arg_t);
}
@@ -7180,7 +7312,6 @@ bool Item_ref::val_bool_result()
return result_field->val_real() != 0.0;
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0);
}
}
@@ -7315,7 +7446,7 @@ Item *Item_ref::get_tmp_table_item(THD *thd)
if (!result_field)
return (*ref)->get_tmp_table_item(thd);
- Item_field *item= new Item_field(result_field);
+ Item_field *item= new (thd->mem_root) Item_field(thd, result_field);
if (item)
{
item->table_name= table_name;
@@ -7400,8 +7531,8 @@ Item_cache_wrapper::~Item_cache_wrapper()
DBUG_ASSERT(expr_cache == 0);
}
-Item_cache_wrapper::Item_cache_wrapper(Item *item_arg)
-:orig_item(item_arg), expr_cache(NULL), expr_value(NULL)
+Item_cache_wrapper::Item_cache_wrapper(THD *thd, Item *item_arg):
+ Item_result_field(thd), orig_item(item_arg), expr_cache(NULL), expr_value(NULL)
{
DBUG_ASSERT(orig_item->fixed);
Type_std_attributes::set(orig_item);
@@ -7412,8 +7543,8 @@ Item_cache_wrapper::Item_cache_wrapper(Item *item_arg)
name_length= item_arg->name_length;
with_subselect= orig_item->with_subselect;
- if ((expr_value= Item_cache::get_cache(orig_item)))
- expr_value->setup(orig_item);
+ if ((expr_value= Item_cache::get_cache(thd, orig_item)))
+ expr_value->setup(thd, orig_item);
fixed= 1;
}
@@ -7435,7 +7566,7 @@ void Item_cache_wrapper::init_on_demand()
void Item_cache_wrapper::print(String *str, enum_query_type query_type)
{
- if (query_type == QT_EXPLAIN)
+ if (query_type & QT_ITEM_CACHE_WRAPPER_SKIP_DETAILS)
{
/* Don't print the cache in EXPLAIN EXTENDED */
orig_item->print(str, query_type);
@@ -7518,6 +7649,19 @@ bool Item_cache_wrapper::set_cache(THD *thd)
DBUG_RETURN(expr_cache == NULL);
}
+Expression_cache_tracker* Item_cache_wrapper::init_tracker(MEM_ROOT *mem_root)
+{
+ if (expr_cache)
+ {
+ Expression_cache_tracker* tracker=
+ new(mem_root) Expression_cache_tracker(expr_cache);
+ if (tracker)
+ ((Expression_cache_tmptable *)expr_cache)->set_tracker(tracker);
+ return tracker;
+ }
+ return NULL;
+}
+
/**
Check if the current values of the parameters are in the expression cache
@@ -7780,11 +7924,11 @@ int Item_cache_wrapper::save_in_field(Field *to, bool no_conversions)
}
-Item* Item_cache_wrapper::get_tmp_table_item(THD *thd_arg)
+Item* Item_cache_wrapper::get_tmp_table_item(THD *thd)
{
if (!orig_item->with_sum_func && !orig_item->const_item())
- return new Item_field(result_field);
- return copy_or_same(thd_arg);
+ return new (thd->mem_root) Item_field(thd, result_field);
+ return copy_or_same(thd);
}
@@ -7869,12 +8013,13 @@ bool Item_outer_ref::fix_fields(THD *thd, Item **reference)
}
-void Item_outer_ref::fix_after_pullout(st_select_lex *new_parent, Item **ref)
+void Item_outer_ref::fix_after_pullout(st_select_lex *new_parent,
+ Item **ref_arg)
{
if (get_depended_from() == new_parent)
{
- *ref= outer_ref;
- (*ref)->fix_after_pullout(new_parent, ref);
+ *ref_arg= outer_ref;
+ (*ref_arg)->fix_after_pullout(new_parent, ref_arg);
}
}
@@ -7908,12 +8053,12 @@ bool Item_outer_ref::check_inner_refs_processor(uchar *arg)
{
List_iterator_fast<Item_outer_ref> *it=
((List_iterator_fast<Item_outer_ref> *) arg);
- Item_outer_ref *ref;
- while ((ref= (*it)++))
+ Item_outer_ref *tmp_ref;
+ while ((tmp_ref= (*it)++))
{
- if (ref == this)
+ if (tmp_ref == this)
{
- ref->found_in_group_by= 1;
+ tmp_ref->found_in_group_by= 1;
break;
}
}
@@ -7964,43 +8109,6 @@ Item_equal *Item_direct_view_ref::find_item_equal(COND_EQUAL *cond_equal)
/**
- Check whether a reference to field item can be substituted for an equal item
-
- @details
- The function checks whether a substitution of a reference to field item for
- an equal item is valid.
-
- @param arg *arg != NULL <-> the reference is in the context
- where substitution for an equal item is valid
-
- @note
- See also the note for Item_field::subst_argument_checker
-
- @retval
- TRUE substitution is valid
- @retval
- FALSE otherwise
-*/
-bool Item_direct_view_ref::subst_argument_checker(uchar **arg)
-{
- bool res= FALSE;
- if (*arg)
- {
- Item *item= real_item();
- if (item->type() == FIELD_ITEM &&
- (*arg == (uchar *) Item::ANY_SUBST ||
- result_type() != STRING_RESULT ||
- (((Item_field *) item)->field->flags & BINARY_FLAG)))
- res= TRUE;
- }
- /* Block any substitution into the wrapped object */
- if (*arg)
- *arg= NULL;
- return res;
-}
-
-
-/**
Set a pointer to the multiple equality the view field reference belongs to
(if any).
@@ -8020,7 +8128,7 @@ bool Item_direct_view_ref::subst_argument_checker(uchar **arg)
of the compile method.
@note
- The function calls Item_field::equal_fields_propagator for the field item
+ The function calls Item_field::propagate_equal_fields() for the field item
this->real_item() to do the job. Then it takes the pointer to equal_item
from this field item and assigns it to this->item_equal.
@@ -8029,12 +8137,14 @@ bool Item_direct_view_ref::subst_argument_checker(uchar **arg)
- pointer to the field item, otherwise.
*/
-Item *Item_direct_view_ref::equal_fields_propagator(uchar *arg)
+Item *Item_direct_view_ref::propagate_equal_fields(THD *thd,
+ const Context &ctx,
+ COND_EQUAL *cond)
{
Item *field_item= real_item();
if (field_item->type() != FIELD_ITEM)
return this;
- Item *item= field_item->equal_fields_propagator(arg);
+ Item *item= field_item->propagate_equal_fields(thd, ctx, cond);
set_item_equal(field_item->get_item_equal());
field_item->set_item_equal(NULL);
if (item != field_item)
@@ -8073,13 +8183,13 @@ Item *Item_direct_view_ref::equal_fields_propagator(uchar *arg)
- this - otherwise.
*/
-Item *Item_direct_view_ref::replace_equal_field(uchar *arg)
+Item *Item_direct_view_ref::replace_equal_field(THD *thd, uchar *arg)
{
Item *field_item= real_item();
if (field_item->type() != FIELD_ITEM)
return this;
field_item->set_item_equal(item_equal);
- Item *item= field_item->replace_equal_field(arg);
+ Item *item= field_item->replace_equal_field(thd, arg);
field_item->set_item_equal(0);
return item != field_item ? item : this;
}
@@ -8121,9 +8231,10 @@ bool Item_default_value::fix_fields(THD *thd, Item **items)
my_error(ER_NO_DEFAULT_FOR_FIELD, MYF(0), field_arg->field->field_name);
goto error;
}
- if (!(def_field= (Field*) sql_alloc(field_arg->field->size_of())))
+ if (!(def_field= (Field*) thd->alloc(field_arg->field->size_of())))
goto error;
- memcpy((void *)def_field, (void *)field_arg->field, field_arg->field->size_of());
+ memcpy((void *)def_field, (void *)field_arg->field,
+ field_arg->field->size_of());
def_field->move_field_offset((my_ptrdiff_t)
(def_field->table->s->default_values -
def_field->table->record[0]));
@@ -8153,38 +8264,44 @@ int Item_default_value::save_in_field(Field *field_arg, bool no_conversions)
{
if (!arg)
{
+ THD *thd= field_arg->table->in_use;
+
if (field_arg->flags & NO_DEFAULT_VALUE_FLAG &&
field_arg->real_type() != MYSQL_TYPE_ENUM)
{
if (field_arg->reset())
{
my_message(ER_CANT_CREATE_GEOMETRY_OBJECT,
- ER(ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0));
+ ER_THD(thd, ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0));
return -1;
}
if (context->error_processor == &view_error_processor)
{
TABLE_LIST *view= field_arg->table->pos_in_table_list->top_table();
- push_warning_printf(field_arg->table->in_use,
+ push_warning_printf(thd,
Sql_condition::WARN_LEVEL_WARN,
ER_NO_DEFAULT_FOR_VIEW_FIELD,
- ER(ER_NO_DEFAULT_FOR_VIEW_FIELD),
+ ER_THD(thd, ER_NO_DEFAULT_FOR_VIEW_FIELD),
view->view_db.str,
view->view_name.str);
}
else
{
- push_warning_printf(field_arg->table->in_use,
+ push_warning_printf(thd,
Sql_condition::WARN_LEVEL_WARN,
ER_NO_DEFAULT_FOR_FIELD,
- ER(ER_NO_DEFAULT_FOR_FIELD),
+ ER_THD(thd, ER_NO_DEFAULT_FOR_FIELD),
field_arg->field_name);
}
return 1;
}
field_arg->set_default();
- return 0;
+ return
+ !field_arg->is_null_in_record(field_arg->table->s->default_values) &&
+ field_arg->validate_value_in_record_with_warn(thd,
+ field_arg->table->s->default_values) &&
+ thd->is_error() ? -1 : 0;
}
return Item_field::save_in_field(field_arg, no_conversions);
}
@@ -8195,9 +8312,10 @@ int Item_default_value::save_in_field(Field *field_arg, bool no_conversions)
same time it can replace some nodes in the tree.
*/
-Item *Item_default_value::transform(Item_transformer transformer, uchar *args)
+Item *Item_default_value::transform(THD *thd, Item_transformer transformer,
+ uchar *args)
{
- DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
+ DBUG_ASSERT(!thd->stmt_arena->is_stmt_prepare());
/*
If the value of arg is NULL, then this object represents a constant,
@@ -8206,7 +8324,7 @@ Item *Item_default_value::transform(Item_transformer transformer, uchar *args)
if (!arg)
return 0;
- Item *new_item= arg->transform(transformer, args);
+ Item *new_item= arg->transform(thd, transformer, args);
if (!new_item)
return 0;
@@ -8217,8 +8335,8 @@ Item *Item_default_value::transform(Item_transformer transformer, uchar *args)
change records at each execution.
*/
if (arg != new_item)
- current_thd->change_item_tree(&arg, new_item);
- return (this->*transformer)(args);
+ thd->change_item_tree(&arg, new_item);
+ return (this->*transformer)(thd, args);
}
@@ -8256,10 +8374,11 @@ bool Item_insert_value::fix_fields(THD *thd, Item **items)
if (field_arg->field->table->insert_values)
{
- Field *def_field= (Field*) sql_alloc(field_arg->field->size_of());
+ Field *def_field= (Field*) thd->alloc(field_arg->field->size_of());
if (!def_field)
return TRUE;
- memcpy((void *)def_field, (void *)field_arg->field, field_arg->field->size_of());
+ memcpy((void *)def_field, (void *)field_arg->field,
+ field_arg->field->size_of());
def_field->move_field_offset((my_ptrdiff_t)
(def_field->table->insert_values -
def_field->table->record[0]));
@@ -8463,11 +8582,13 @@ Item_result item_cmp_type(Item_result a,Item_result b)
void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
{
Item *item= *ref;
- Item *new_item= NULL;
if (item->basic_const_item())
return; // Can't be better
- Item_result res_type=item_cmp_type(comp_item->cmp_type(), item->cmp_type());
+
+ Item *new_item= NULL;
+ Item_result res_type= item_cmp_type(comp_item, item);
char *name=item->name; // Alloced by sql_alloc
+ MEM_ROOT *mem_root= thd->mem_root;
switch (res_type) {
case TIME_RESULT:
@@ -8475,9 +8596,10 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
bool is_null;
Item **ref_copy= ref;
/* the following call creates a constant and puts it in new_item */
- get_datetime_value(thd, &ref_copy, &new_item, comp_item, &is_null);
+ enum_field_types type= item->field_type_for_temporal_comparison(comp_item);
+ get_datetime_value(thd, &ref_copy, &new_item, type, &is_null);
if (is_null)
- new_item= new Item_null(name);
+ new_item= new (mem_root) Item_null(thd, name);
break;
}
case STRING_RESULT:
@@ -8486,12 +8608,12 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
String tmp(buff,sizeof(buff),&my_charset_bin),*result;
result=item->val_str(&tmp);
if (item->null_value)
- new_item= new Item_null(name);
+ new_item= new (mem_root) Item_null(thd, name);
else
{
uint length= result->length();
char *tmp_str= sql_strmake(result->ptr(), length);
- new_item= new Item_string(name, tmp_str, length, result->charset());
+ new_item= new (mem_root) Item_string(thd, name, tmp_str, length, result->charset());
}
break;
}
@@ -8500,8 +8622,8 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
longlong result=item->val_int();
uint length=item->max_length;
bool null_value=item->null_value;
- new_item= (null_value ? (Item*) new Item_null(name) :
- (Item*) new Item_int(name, result, length));
+ new_item= (null_value ? (Item*) new (mem_root) Item_null(thd, name) :
+ (Item*) new (mem_root) Item_int(thd, name, result, length));
break;
}
case ROW_RESULT:
@@ -8539,8 +8661,8 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
double result= item->val_real();
uint length=item->max_length,decimals=item->decimals;
bool null_value=item->null_value;
- new_item= (null_value ? (Item*) new Item_null(name) : (Item*)
- new Item_float(name, result, decimals, length));
+ new_item= (null_value ? (Item*) new (mem_root) Item_null(thd, name) : (Item*)
+ new (mem_root) Item_float(thd, name, result, decimals, length));
break;
}
case DECIMAL_RESULT:
@@ -8550,13 +8672,10 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
uint length= item->max_length, decimals= item->decimals;
bool null_value= item->null_value;
new_item= (null_value ?
- (Item*) new Item_null(name) :
- (Item*) new Item_decimal(name, result, length, decimals));
+ (Item*) new (mem_root) Item_null(thd, name) :
+ (Item*) new (mem_root) Item_decimal(thd, name, result, length, decimals));
break;
}
- case IMPOSSIBLE_RESULT:
- DBUG_ASSERT(0);
- break;
}
if (new_item)
thd->change_item_tree(ref, new_item);
@@ -8676,9 +8795,9 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item)
return 0;
}
-Item_cache* Item_cache::get_cache(const Item *item)
+Item_cache* Item_cache::get_cache(THD *thd, const Item *item)
{
- return get_cache(item, item->cmp_type());
+ return get_cache(thd, item, item->cmp_type());
}
@@ -8691,24 +8810,23 @@ Item_cache* Item_cache::get_cache(const Item *item)
@return cache item
*/
-Item_cache* Item_cache::get_cache(const Item *item, const Item_result type)
+Item_cache* Item_cache::get_cache(THD *thd, const Item *item,
+ const Item_result type)
{
+ MEM_ROOT *mem_root= thd->mem_root;
switch (type) {
case INT_RESULT:
- return new Item_cache_int(item->field_type());
+ return new (mem_root) Item_cache_int(thd, item->field_type());
case REAL_RESULT:
- return new Item_cache_real();
+ return new (mem_root) Item_cache_real(thd);
case DECIMAL_RESULT:
- return new Item_cache_decimal();
+ return new (mem_root) Item_cache_decimal(thd);
case STRING_RESULT:
- return new Item_cache_str(item);
+ return new (mem_root) Item_cache_str(thd, item);
case ROW_RESULT:
- return new Item_cache_row();
+ return new (mem_root) Item_cache_row(thd);
case TIME_RESULT:
- return new Item_cache_temporal(item->field_type());
- case IMPOSSIBLE_RESULT:
- DBUG_ASSERT(0);
- break;
+ return new (mem_root) Item_cache_temporal(thd, item->field_type());
}
return 0; // Impossible
}
@@ -8810,17 +8928,34 @@ int Item_cache_int::save_in_field(Field *field, bool no_conversions)
}
-Item_cache_temporal::Item_cache_temporal(enum_field_types field_type_arg):
- Item_cache_int(field_type_arg)
+Item_cache_temporal::Item_cache_temporal(THD *thd,
+ enum_field_types field_type_arg):
+ Item_cache_int(thd, field_type_arg)
{
if (mysql_type_to_time_type(cached_field_type) == MYSQL_TIMESTAMP_ERROR)
cached_field_type= MYSQL_TYPE_DATETIME;
}
-longlong Item_cache_temporal::val_temporal_packed()
+longlong Item_cache_temporal::val_datetime_packed()
{
DBUG_ASSERT(fixed == 1);
+ if (Item_cache_temporal::field_type() == MYSQL_TYPE_TIME)
+ return Item::val_datetime_packed(); // TIME-to-DATETIME conversion needed
+ if ((!value_cached && !cache_value()) || null_value)
+ {
+ null_value= TRUE;
+ return 0;
+ }
+ return value;
+}
+
+
+longlong Item_cache_temporal::val_time_packed()
+{
+ DBUG_ASSERT(fixed == 1);
+ if (Item_cache_temporal::field_type() != MYSQL_TYPE_TIME)
+ return Item::val_time_packed(); // DATETIME-to-TIME conversion needed
if ((!value_cached && !cache_value()) || null_value)
{
null_value= TRUE;
@@ -8928,16 +9063,25 @@ int Item_cache_temporal::save_in_field(Field *field, bool no_conversions)
}
-void Item_cache_temporal::store_packed(longlong val_arg, Item *example)
+void Item_cache_temporal::store_packed(longlong val_arg, Item *example_arg)
{
/* An explicit values is given, save it. */
- store(example);
+ store(example_arg);
value_cached= true;
value= val_arg;
null_value= false;
}
+Item *Item_cache_temporal::clone_item(THD *thd)
+{
+ Item_cache_temporal *item= new (thd->mem_root)
+ Item_cache_temporal(thd, cached_field_type);
+ item->store_packed(value, example);
+ return item;
+}
+
+
bool Item_cache_real::cache_value()
{
if (!example)
@@ -9122,27 +9266,26 @@ int Item_cache_str::save_in_field(Field *field, bool no_conversions)
}
-bool Item_cache_row::allocate(uint num)
+bool Item_cache_row::allocate(THD *thd, uint num)
{
item_count= num;
- THD *thd= current_thd;
return (!(values=
(Item_cache **) thd->calloc(sizeof(Item_cache *)*item_count)));
}
-bool Item_cache_row::setup(Item * item)
+bool Item_cache_row::setup(THD *thd, Item *item)
{
example= item;
- if (!values && allocate(item->cols()))
+ if (!values && allocate(thd, item->cols()))
return 1;
for (uint i= 0; i < item_count; i++)
{
Item *el= item->element_index(i);
Item_cache *tmp;
- if (!(tmp= values[i]= Item_cache::get_cache(el)))
+ if (!(tmp= values[i]= Item_cache::get_cache(thd, el)))
return 1;
- tmp->setup(el);
+ tmp->setup(thd, el);
}
return 0;
}
@@ -9333,7 +9476,6 @@ enum_field_types Item_type_holder::get_real_type(Item *item)
return MYSQL_TYPE_NEWDECIMAL;
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0);
return MYSQL_TYPE_VAR_STRING;
}
@@ -9377,6 +9519,11 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
item_decimals= 0;
decimals= MY_MAX(decimals, item_decimals);
}
+
+ if (fld_type == FIELD_TYPE_GEOMETRY)
+ geometry_type=
+ Field_geom::geometry_type_merge(geometry_type, item->get_geometry_type());
+
if (Field::result_merge_type(fld_type) == DECIMAL_RESULT)
{
decimals= MY_MIN(MY_MAX(decimals, item->decimals), DECIMAL_MAX_SCALE);
@@ -9740,7 +9887,15 @@ const char *dbug_print_item(Item *item)
str.length(0);
if (!item)
return "(Item*)NULL";
- item->print(&str ,QT_ORDINARY);
+
+ THD *thd= current_thd;
+ ulonglong save_option_bits= thd->variables.option_bits;
+ thd->variables.option_bits &= ~OPTION_QUOTE_SHOW_CREATE;
+
+ item->print(&str ,QT_EXPLAIN);
+
+ thd->variables.option_bits= save_option_bits;
+
if (str.c_ptr() == buf)
return buf;
else
diff --git a/sql/item.h b/sql/item.h
index 24ca1ebf30c..f727c33326b 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -74,6 +74,10 @@ char_to_byte_length_safe(uint32 char_length_arg, uint32 mbmaxlen_arg)
}
+/* Bits for the split_sum_func() function */
+#define SPLIT_SUM_SKIP_REGISTERED 1 /* Skip registered funcs */
+#define SPLIT_SUM_SELECT 2 /* SELECT item; Split all parts */
+
/*
"Declared Type Collation"
A combination of collation and its derivation.
@@ -123,6 +127,13 @@ public:
derivation= derivation_arg;
set_repertoire_from_charset(collation_arg);
}
+ DTCollation(CHARSET_INFO *collation_arg,
+ Derivation derivation_arg,
+ uint repertoire_arg)
+ :collation(collation_arg),
+ derivation(derivation_arg),
+ repertoire(repertoire_arg)
+ { }
void set(const DTCollation &dt)
{
collation= dt.collation;
@@ -156,7 +167,7 @@ public:
}
void set(Derivation derivation_arg)
{ derivation= derivation_arg; }
- bool aggregate(DTCollation &dt, uint flags= 0);
+ bool aggregate(const DTCollation &dt, uint flags= 0);
bool set(DTCollation &dt1, DTCollation &dt2, uint flags= 0)
{ set(dt1); return aggregate(dt2, flags); }
const char *derivation_name() const
@@ -517,7 +528,7 @@ typedef bool (Item::*Item_processor) (uchar *arg);
*/
typedef bool (Item::*Item_analyzer) (uchar **argp);
-typedef Item* (Item::*Item_transformer) (uchar *arg);
+typedef Item* (Item::*Item_transformer) (THD *thd, uchar *arg);
typedef void (*Cond_traverser) (const Item *item, void *arg);
struct st_cond_statistic;
@@ -591,7 +602,7 @@ public:
};
-class Item: public Type_std_attributes
+class Item: public Value_source, public Type_std_attributes
{
Item(const Item &); /* Prevent use of these */
void operator=(Item &);
@@ -606,9 +617,9 @@ class Item: public Type_std_attributes
*/
uint join_tab_idx;
+ static void *operator new(size_t size);
+
public:
- static void *operator new(size_t size) throw ()
- { return sql_alloc(size); }
static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
{ return alloc_root(mem_root, size); }
static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); }
@@ -666,7 +677,7 @@ public:
calls.
*/
uint name_length; /* Length of name */
- int8 marker;
+ int marker;
bool maybe_null; /* If item may be null */
bool in_rollup; /* If used in GROUP BY list
of a query with ROLLUP */
@@ -682,9 +693,8 @@ public:
bool with_subselect; /* If this item is a subselect or some
of its arguments is or contains a
subselect */
- Item_result cmp_context; /* Comparison context */
// alloc & destruct is done as start of select using sql_alloc
- Item();
+ Item(THD *thd);
/*
Constructor used by Item_field, Item_ref & aggregate (sum) functions.
Used for duplicating lists in processing queries with temporary
@@ -1052,7 +1062,7 @@ public:
*/
virtual bool basic_const_item() const { return 0; }
/* cloning of constant items (0 if it is not const) */
- virtual Item *clone_item() { return 0; }
+ virtual Item *clone_item(THD *thd) { return 0; }
virtual cond_result eq_cmp_result() const { return COND_OK; }
inline uint float_length(uint decimals_par) const
{ return decimals != NOT_FIXED_DEC ? (DBL_DIG+2+decimals_par) : DBL_DIG+8;}
@@ -1169,15 +1179,90 @@ public:
return false;
}
virtual void split_sum_func(THD *thd, Item **ref_pointer_array,
- List<Item> &fields) {}
+ List<Item> &fields, uint flags) {}
/* Called for items that really have to be split */
void split_sum_func2(THD *thd, Item **ref_pointer_array, List<Item> &fields,
- Item **ref, bool skip_registered);
+ Item **ref, uint flags);
virtual bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
bool get_time(MYSQL_TIME *ltime)
{ return get_date(ltime, TIME_TIME_ONLY | TIME_INVALID_DATES); }
// Get date with automatic TIME->DATETIME conversion
bool get_date_with_conversion(MYSQL_TIME *ltime, ulonglong fuzzydate);
+ /*
+ Get time with automatic DATE/DATETIME to TIME conversion.
+
+ Performce a reserve operation to get_date_with_conversion().
+ Suppose:
+ - we have a set of items (typically with the native MYSQL_TYPE_TIME type)
+ whose item->get_date() return TIME1 value, and
+ - item->get_date_with_conversion() for the same Items return DATETIME1,
+ after applying time-to-datetime conversion to TIME1.
+
+ then all items (typically of the native MYSQL_TYPE_{DATE|DATETIME} types)
+ whose get_date() return DATETIME1 must also return TIME1 from
+ get_time_with_conversion()
+
+ @param thd - the thread, its variables.old_mode is checked
+ to decide if use simple YYYYMMDD truncation (old mode),
+ or perform full DATETIME-to-TIME conversion with
+ CURRENT_DATE subtraction.
+ @param[out] ltime - store the result here
+ @param fuzzydate - flags to be used for the get_date() call.
+ Normally, should include TIME_TIME_ONLY, to let
+ the called low-level routines, e.g. str_to_date(),
+ know that we prefer TIME rather that DATE/DATETIME
+ and do less conversion outside of the low-level
+ routines.
+
+ @returns true - on error, e.g. get_date() returned NULL value,
+ or get_date() returned DATETIME/DATE with non-zero
+ YYYYMMDD part.
+ @returns false - on success
+ */
+ bool get_time_with_conversion(THD *thd, MYSQL_TIME *ltime,
+ ulonglong fuzzydate);
+ // Get a DATE or DATETIME value in numeric packed format for comparison
+ virtual longlong val_datetime_packed()
+ {
+ MYSQL_TIME ltime;
+ uint fuzzydate= TIME_FUZZY_DATES | TIME_INVALID_DATES;
+ return get_date_with_conversion(&ltime, fuzzydate) ? 0 : pack_time(&ltime);
+ }
+ // Get a TIME value in numeric packed format for comparison
+ virtual longlong val_time_packed()
+ {
+ MYSQL_TIME ltime;
+ uint fuzzydate= TIME_FUZZY_DATES | TIME_INVALID_DATES | TIME_TIME_ONLY;
+ return get_date(&ltime, fuzzydate) ? 0 : pack_time(&ltime);
+ }
+ // Get a temporal value in packed DATE/DATETIME or TIME format
+ longlong val_temporal_packed(enum_field_types f_type)
+ {
+ return f_type == MYSQL_TYPE_TIME ? val_time_packed() :
+ val_datetime_packed();
+ }
+ enum_field_types field_type_for_temporal_comparison(const Item *other) const
+ {
+ if (cmp_type() == TIME_RESULT)
+ {
+ if (other->cmp_type() == TIME_RESULT)
+ return Field::field_type_merge(field_type(), other->field_type());
+ else
+ return field_type();
+ }
+ else
+ {
+ if (other->cmp_type() == TIME_RESULT)
+ return other->field_type();
+ DBUG_ASSERT(0); // Two non-temporal data types, we should not get to here
+ return MYSQL_TYPE_DATETIME;
+ }
+ }
+ // Get a temporal value to compare to another Item
+ longlong val_temporal_packed(const Item *other)
+ {
+ return val_temporal_packed(field_type_for_temporal_comparison(other));
+ }
bool get_seconds(ulonglong *sec, ulong *sec_part);
virtual bool get_date_result(MYSQL_TIME *ltime, ulonglong fuzzydate)
{ return get_date(ltime,fuzzydate); }
@@ -1225,7 +1310,6 @@ public:
virtual Item *get_tmp_table_item(THD *thd) { return copy_or_same(thd); }
static CHARSET_INFO *default_charset();
- virtual CHARSET_INFO *compare_collation() const { return NULL; }
/*
For backward compatibility, to make numeric
@@ -1247,7 +1331,7 @@ public:
return (this->*processor)(arg);
}
- virtual Item* transform(Item_transformer transformer, uchar *arg);
+ virtual Item* transform(THD *thd, Item_transformer transformer, uchar *arg);
/*
This function performs a generic "compilation" of the Item tree.
@@ -1265,11 +1349,11 @@ public:
i.e. analysis is performed top-down while transformation is done
bottom-up.
*/
- virtual Item* compile(Item_analyzer analyzer, uchar **arg_p,
+ virtual Item* compile(THD *thd, Item_analyzer analyzer, uchar **arg_p,
Item_transformer transformer, uchar *arg_t)
{
if ((this->*analyzer) (arg_p))
- return ((this->*transformer) (arg_t));
+ return ((this->*transformer) (thd, arg_t));
return 0;
}
@@ -1339,7 +1423,7 @@ public:
virtual bool register_field_in_bitmap(uchar *arg) { return 0; }
bool cache_const_expr_analyzer(uchar **arg);
- Item* cache_const_expr_transformer(uchar *arg);
+ Item* cache_const_expr_transformer(THD *thd, uchar *arg);
/*
Check if a partition function is allowed
@@ -1408,22 +1492,15 @@ public:
return FALSE;
}
- /*
- The enumeration Subst_constraint is currently used only in implementations
- of the virtual function subst_argument_checker.
- */
- enum Subst_constraint
- {
- NO_SUBST= 0, /* No substitution for a field is allowed */
- ANY_SUBST, /* Any substitution for a field is allowed */
- IDENTITY_SUBST /* Substitution for a field is allowed if any two
- different values of the field type are not equal */
+ virtual Item* propagate_equal_fields(THD*, const Context &, COND_EQUAL *)
+ {
+ return this;
};
- virtual bool subst_argument_checker(uchar **arg)
- {
- return (*arg != NULL);
- }
+ Item* propagate_equal_fields_and_change_item_tree(THD *thd,
+ const Context &ctx,
+ COND_EQUAL *cond,
+ Item **place);
/*
@brief
@@ -1443,10 +1520,9 @@ public:
return trace_unsupported_by_check_vcol_func_processor(full_name());
}
- virtual Item *equal_fields_propagator(uchar * arg) { return this; }
virtual bool set_no_const_sub(uchar *arg) { return FALSE; }
/* arg points to REPLACE_EQUAL_FIELD_ARG object */
- virtual Item *replace_equal_field(uchar * arg) { return this; }
+ virtual Item *replace_equal_field(THD *thd, uchar *arg) { return this; }
/*
Check if an expression value has allowed arguments, like DATE/DATETIME
for date functions. Also used by partitioning code to reject
@@ -1516,10 +1592,12 @@ public:
virtual Item_field *field_for_view_update() { return 0; }
virtual Item *neg_transformer(THD *thd) { return NULL; }
- virtual Item *update_value_transformer(uchar *select_arg) { return this; }
- virtual Item *expr_cache_insert_transformer(uchar *thd_arg) { return this; }
+ virtual Item *update_value_transformer(THD *thd, uchar *select_arg)
+ { return this; }
+ virtual Item *expr_cache_insert_transformer(THD *thd, uchar *unused)
+ { return this; }
virtual bool expr_cache_is_needed(THD *) { return FALSE; }
- virtual Item *safe_charset_converter(CHARSET_INFO *tocs);
+ virtual Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs);
bool needs_charset_converter(uint32 length, CHARSET_INFO *tocs)
{
/*
@@ -1558,10 +1636,10 @@ public:
// Pass 1 as length to force conversion if tocs->mbminlen>1.
return needs_charset_converter(1, tocs);
}
- Item *const_charset_converter(CHARSET_INFO *tocs, bool lossless,
+ Item *const_charset_converter(THD *thd, CHARSET_INFO *tocs, bool lossless,
const char *func_name);
- Item *const_charset_converter(CHARSET_INFO *tocs, bool lossless)
- { return const_charset_converter(tocs, lossless, NULL); }
+ Item *const_charset_converter(THD *thd, CHARSET_INFO *tocs, bool lossless)
+ { return const_charset_converter(thd, tocs, lossless, NULL); }
void delete_self()
{
cleanup();
@@ -1581,18 +1659,6 @@ public:
return 0;
}
/**
- Check whether this and the given item has compatible comparison context.
- Used by the equality propagation. See Item_field::equal_fields_propagator.
-
- @return
- TRUE if the context is the same
- FALSE otherwise.
- */
- inline bool has_compatible_context(Item *item) const
- {
- return cmp_context == IMPOSSIBLE_RESULT || item->cmp_context == cmp_context;
- }
- /**
Test whether an expression is expensive to compute. Used during
optimization to avoid computing expensive expressions during this
phase. Also used to force temp tables when sorting on expensive
@@ -1754,9 +1820,9 @@ protected:
{
my_string_metadata_get(this, str->charset(), str->ptr(), str->length());
}
- Metadata(const String *str, uint repertoire)
+ Metadata(const String *str, uint repertoire_arg)
{
- MY_STRING_METADATA::repertoire= repertoire;
+ MY_STRING_METADATA::repertoire= repertoire_arg;
MY_STRING_METADATA::char_length= str->numchars();
}
uint repertoire() const { return MY_STRING_METADATA::repertoire; }
@@ -1779,7 +1845,7 @@ protected:
{
fix_charset_and_length_from_str_value(dv, Metadata(&str_value));
}
- Item_basic_value(): Item() {}
+ Item_basic_value(THD *thd): Item(thd) {}
/*
In the xxx_eq() methods below we need to cast off "const" to
call val_xxx(). This is OK for Item_basic_constant and Item_param.
@@ -1816,7 +1882,7 @@ class Item_basic_constant :public Item_basic_value
{
table_map used_table_map;
public:
- Item_basic_constant(): Item_basic_value(), used_table_map(0) {};
+ Item_basic_constant(THD *thd): Item_basic_value(thd), used_table_map(0) {};
void set_used_tables(table_map map) { used_table_map= map; }
table_map used_tables() const { return used_table_map; }
/* to prevent drop fixed flag (no need parent cleanup call) */
@@ -1862,7 +1928,7 @@ public:
#endif
public:
- Item_sp_variable(char *sp_var_name_str, uint sp_var_name_length);
+ Item_sp_variable(THD *thd, char *sp_var_name_str, uint sp_var_name_length);
public:
bool fix_fields(THD *thd, Item **);
@@ -1928,7 +1994,7 @@ class Item_splocal :public Item_sp_variable,
Item_result m_result_type;
enum_field_types m_field_type;
public:
- Item_splocal(const LEX_STRING &sp_var_name, uint sp_var_idx,
+ Item_splocal(THD *thd, const LEX_STRING &sp_var_name, uint sp_var_idx,
enum_field_types sp_var_type,
uint pos_in_q= 0, uint len_in_q= 0);
@@ -1994,7 +2060,7 @@ inline Item_result Item_splocal::result_type() const
class Item_case_expr :public Item_sp_variable
{
public:
- Item_case_expr(uint case_expr_id);
+ Item_case_expr(THD *thd, uint case_expr_id);
public:
Item *this_item();
@@ -2051,7 +2117,7 @@ class Item_name_const : public Item
Item *name_item;
bool valid_args;
public:
- Item_name_const(Item *name_arg, Item *val);
+ Item_name_const(THD *thd, Item *name_arg, Item *val);
bool fix_fields(THD *, Item **);
@@ -2133,9 +2199,9 @@ agg_item_charsets_for_string_result_with_comparison(DTCollation &c,
class Item_num: public Item_basic_constant
{
public:
- Item_num() { collation.set_numeric(); } /* Remove gcc warning */
- virtual Item_num *neg()= 0;
- Item *safe_charset_converter(CHARSET_INFO *tocs);
+ Item_num(THD *thd): Item_basic_constant(thd) { collation.set_numeric(); }
+ virtual Item_num *neg(THD *thd)= 0;
+ Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs);
bool check_partition_func_processor(uchar *int_arg) { return FALSE;}
bool check_vcol_func_processor(uchar *arg) { return FALSE;}
};
@@ -2149,7 +2215,7 @@ class Item_result_field :public Item /* Item with result field */
{
public:
Field *result_field; /* Save result here */
- Item_result_field() :result_field(0) {}
+ Item_result_field(THD *thd): Item(thd), result_field(0) {}
// Constructor used for Item_sum/Item_cond_and/or (see Item comment)
Item_result_field(THD *thd, Item_result_field *item):
Item(thd, item), result_field(item->result_field)
@@ -2214,11 +2280,11 @@ public:
this variable.
*/
bool can_be_depended;
- Item_ident(Name_resolution_context *context_arg,
+ Item_ident(THD *thd, Name_resolution_context *context_arg,
const char *db_name_arg, const char *table_name_arg,
const char *field_name_arg);
Item_ident(THD *thd, Item_ident *item);
- Item_ident(TABLE_LIST *view_arg, const char *field_name_arg);
+ Item_ident(THD *thd, TABLE_LIST *view_arg, const char *field_name_arg);
const char *full_name() const;
void cleanup();
st_select_lex *get_depended_from() const;
@@ -2244,9 +2310,9 @@ public:
const char *db_name;
const char *table_name;
- Item_ident_for_show(Field *par_field, const char *db_arg,
- const char *table_name_arg)
- :field(par_field), db_name(db_arg), table_name(table_name_arg)
+ Item_ident_for_show(THD *thd, Field *par_field, const char *db_arg,
+ const char *table_name_arg):
+ Item(thd), field(par_field), db_name(db_arg), table_name(table_name_arg)
{}
enum Type type() const { return FIELD_ITEM; }
@@ -2275,7 +2341,7 @@ public:
uint have_privileges;
/* field need any privileges (for VIEW creation) */
bool any_privileges;
- Item_field(Name_resolution_context *context_arg,
+ Item_field(THD *thd, Name_resolution_context *context_arg,
const char *db_arg,const char *table_name_arg,
const char *field_name_arg);
/*
@@ -2293,7 +2359,7 @@ public:
db_name, table_name and column_name are unknown. It's necessary to call
reset_field() before fix_fields() for all fields created this way.
*/
- Item_field(Field *field);
+ Item_field(THD *thd, Field *field);
enum Type type() const { return FIELD_ITEM; }
bool eq(const Item *item, bool binary_cmp) const;
double val_real();
@@ -2381,7 +2447,7 @@ public:
cond_equal_ref);
}
bool is_result_field() { return false; }
- void set_result_field(Field *field) {}
+ void set_result_field(Field *field_arg) {}
void save_in_result_field(bool no_conversions) { }
Item *get_tmp_table_item(THD *thd);
bool collect_item_field_processor(uchar * arg);
@@ -2398,14 +2464,13 @@ public:
Item_equal *get_item_equal() { return item_equal; }
void set_item_equal(Item_equal *item_eq) { item_equal= item_eq; }
Item_equal *find_item_equal(COND_EQUAL *cond_equal);
- bool subst_argument_checker(uchar **arg);
- Item *equal_fields_propagator(uchar *arg);
+ Item* propagate_equal_fields(THD *, const Context &, COND_EQUAL *);
bool set_no_const_sub(uchar *arg);
- Item *replace_equal_field(uchar *arg);
+ Item *replace_equal_field(THD *thd, uchar *arg);
inline uint32 max_disp_length() { return field->max_display_length(); }
Item_field *field_for_view_update() { return this; }
int fix_outer_field(THD *thd, Field **field, Item **reference);
- virtual Item *update_value_transformer(uchar *select_arg);
+ virtual Item *update_value_transformer(THD *thd, uchar *select_arg);
virtual void print(String *str, enum_query_type query_type);
bool is_outer_field() const
{
@@ -2427,7 +2492,8 @@ public:
class Item_null :public Item_basic_constant
{
public:
- Item_null(char *name_par=0, CHARSET_INFO *cs= &my_charset_bin)
+ Item_null(THD *thd, char *name_par=0, CHARSET_INFO *cs= &my_charset_bin):
+ Item_basic_constant(thd)
{
maybe_null= null_value= TRUE;
max_length= 0;
@@ -2447,7 +2513,7 @@ public:
enum Item_result result_type () const { return STRING_RESULT; }
enum_field_types field_type() const { return MYSQL_TYPE_NULL; }
bool basic_const_item() const { return 1; }
- Item *clone_item() { return new Item_null(name); }
+ Item *clone_item(THD *thd);
bool is_null() { return 1; }
virtual inline void print(String *str, enum_query_type query_type)
@@ -2455,7 +2521,7 @@ public:
str->append(STRING_WITH_LEN("NULL"));
}
- Item *safe_charset_converter(CHARSET_INFO *tocs);
+ Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs);
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_vcol_func_processor(uchar *arg) { return FALSE;}
};
@@ -2464,7 +2530,7 @@ class Item_null_result :public Item_null
{
public:
Field *result_field;
- Item_null_result() : Item_null(), result_field(0) {}
+ Item_null_result(THD *thd): Item_null(thd), result_field(0) {}
bool is_result_field() { return result_field != 0; }
void save_in_result_field(bool no_conversions)
{
@@ -2542,7 +2608,7 @@ public:
*/
enum enum_field_types param_type;
- Item_param(uint pos_in_query_arg);
+ Item_param(THD *thd, uint pos_in_query_arg);
enum Item_result result_type () const { return item_result_type; }
enum Type type() const { return item_type; }
@@ -2598,8 +2664,8 @@ public:
constant, assert otherwise. This method is called only if
basic_const_item returned TRUE.
*/
- Item *safe_charset_converter(CHARSET_INFO *tocs);
- Item *clone_item();
+ Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs);
+ Item *clone_item(THD *thd);
/*
Implement by-value equality evaluation if parameter value
is set and is a basic constant (integer, real or string).
@@ -2634,18 +2700,19 @@ class Item_int :public Item_num
{
public:
longlong value;
- Item_int(int32 i,uint length= MY_INT32_NUM_DECIMAL_DIGITS)
- :value((longlong) i)
+ Item_int(THD *thd, int32 i,uint length= MY_INT32_NUM_DECIMAL_DIGITS):
+ Item_num(thd), value((longlong) i)
{ max_length=length; fixed= 1; }
- Item_int(longlong i,uint length= MY_INT64_NUM_DECIMAL_DIGITS)
- :value(i)
+ Item_int(THD *thd, longlong i,uint length= MY_INT64_NUM_DECIMAL_DIGITS):
+ Item_num(thd), value(i)
{ max_length=length; fixed= 1; }
- Item_int(ulonglong i, uint length= MY_INT64_NUM_DECIMAL_DIGITS)
- :value((longlong)i)
+ Item_int(THD *thd, ulonglong i, uint length= MY_INT64_NUM_DECIMAL_DIGITS):
+ Item_num(thd), value((longlong)i)
{ max_length=length; fixed= 1; unsigned_flag= 1; }
- Item_int(const char *str_arg,longlong i,uint length) :value(i)
+ Item_int(THD *thd, const char *str_arg,longlong i,uint length):
+ Item_num(thd), value(i)
{ max_length=length; name=(char*) str_arg; fixed= 1; }
- Item_int(const char *str_arg, uint length=64);
+ Item_int(THD *thd, const char *str_arg, uint length=64);
enum Type type() const { return INT_ITEM; }
enum Item_result result_type () const { return INT_RESULT; }
enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; }
@@ -2655,9 +2722,9 @@ public:
String *val_str(String*);
int save_in_field(Field *field, bool no_conversions);
bool basic_const_item() const { return 1; }
- Item *clone_item() { return new Item_int(name,value,max_length); }
+ Item *clone_item(THD *thd);
virtual void print(String *str, enum_query_type query_type);
- Item_num *neg() { value= -value; return this; }
+ Item_num *neg(THD *thd) { value= -value; return this; }
uint decimal_precision() const
{ return (uint) (max_length - MY_TEST(value < 0)); }
bool eq(const Item *item, bool binary_cmp) const
@@ -2670,15 +2737,15 @@ public:
class Item_uint :public Item_int
{
public:
- Item_uint(const char *str_arg, uint length);
- Item_uint(ulonglong i) :Item_int(i, 10) {}
- Item_uint(const char *str_arg, longlong i, uint length);
+ Item_uint(THD *thd, const char *str_arg, uint length);
+ Item_uint(THD *thd, ulonglong i): Item_int(thd, i, 10) {}
+ Item_uint(THD *thd, const char *str_arg, longlong i, uint length);
double val_real()
{ DBUG_ASSERT(fixed == 1); return ulonglong2double((ulonglong)value); }
String *val_str(String*);
- Item *clone_item() { return new Item_uint(name, value, max_length); }
+ Item *clone_item(THD *thd);
virtual void print(String *str, enum_query_type query_type);
- Item_num *neg ();
+ Item_num *neg(THD *thd);
uint decimal_precision() const { return max_length; }
};
@@ -2688,7 +2755,7 @@ class Item_datetime :public Item_int
protected:
MYSQL_TIME ltime;
public:
- Item_datetime() :Item_int(0) { unsigned_flag=0; }
+ Item_datetime(THD *thd): Item_int(thd, 0) { unsigned_flag=0; }
int save_in_field(Field *field, bool no_conversions);
longlong val_int();
double val_real() { return (double)val_int(); }
@@ -2702,13 +2769,14 @@ class Item_decimal :public Item_num
protected:
my_decimal decimal_value;
public:
- Item_decimal(const char *str_arg, uint length, CHARSET_INFO *charset);
- Item_decimal(const char *str, const my_decimal *val_arg,
+ Item_decimal(THD *thd, const char *str_arg, uint length,
+ CHARSET_INFO *charset);
+ Item_decimal(THD *thd, const char *str, const my_decimal *val_arg,
uint decimal_par, uint length);
- Item_decimal(my_decimal *value_par);
- Item_decimal(longlong val, bool unsig);
- Item_decimal(double val, int precision, int scale);
- Item_decimal(const uchar *bin, int precision, int scale);
+ Item_decimal(THD *thd, my_decimal *value_par);
+ Item_decimal(THD *thd, longlong val, bool unsig);
+ Item_decimal(THD *thd, double val, int precision, int scale);
+ Item_decimal(THD *thd, const uchar *bin, int precision, int scale);
enum Type type() const { return DECIMAL_ITEM; }
enum Item_result result_type () const { return DECIMAL_RESULT; }
@@ -2719,12 +2787,9 @@ public:
my_decimal *val_decimal(my_decimal *val) { return &decimal_value; }
int save_in_field(Field *field, bool no_conversions);
bool basic_const_item() const { return 1; }
- Item *clone_item()
- {
- return new Item_decimal(name, &decimal_value, decimals, max_length);
- }
+ Item *clone_item(THD *thd);
virtual void print(String *str, enum_query_type query_type);
- Item_num *neg()
+ Item_num *neg(THD *thd)
{
my_decimal_neg(&decimal_value);
unsigned_flag= !decimal_value.sign();
@@ -2743,16 +2808,17 @@ class Item_float :public Item_num
char *presentation;
public:
double value;
- Item_float(const char *str_arg, uint length);
- Item_float(const char *str,double val_arg,uint decimal_par,uint length)
- :value(val_arg)
+ Item_float(THD *thd, const char *str_arg, uint length);
+ Item_float(THD *thd, const char *str, double val_arg, uint decimal_par,
+ uint length): Item_num(thd), value(val_arg)
{
presentation= name=(char*) str;
decimals=(uint8) decimal_par;
max_length=length;
fixed= 1;
}
- Item_float(double value_par, uint decimal_par) :presentation(0), value(value_par)
+ Item_float(THD *thd, double value_par, uint decimal_par):
+ Item_num(thd), presentation(0), value(value_par)
{
decimals= (uint8) decimal_par;
fixed= 1;
@@ -2777,9 +2843,8 @@ public:
String *val_str(String*);
my_decimal *val_decimal(my_decimal *);
bool basic_const_item() const { return 1; }
- Item *clone_item()
- { return new Item_float(name, value, decimals, max_length); }
- Item_num *neg() { value= -value; return this; }
+ Item *clone_item(THD *thd);
+ Item_num *neg(THD *thd) { value= -value; return this; }
virtual void print(String *str, enum_query_type query_type);
bool eq(const Item *item, bool binary_cmp) const
{ return real_eq(value, item); }
@@ -2790,9 +2855,9 @@ class Item_static_float_func :public Item_float
{
const char *func_name;
public:
- Item_static_float_func(const char *str, double val_arg, uint decimal_par,
- uint length)
- :Item_float(NullS, val_arg, decimal_par, length), func_name(str)
+ Item_static_float_func(THD *thd, const char *str, double val_arg,
+ uint decimal_par, uint length):
+ Item_float(thd, NullS, val_arg, decimal_par, length), func_name(str)
{}
virtual inline void print(String *str, enum_query_type query_type)
@@ -2800,9 +2865,9 @@ public:
str->append(func_name);
}
- Item *safe_charset_converter(CHARSET_INFO *tocs)
+ Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
{
- return const_charset_converter(tocs, true, func_name);
+ return const_charset_converter(thd, tocs, true, func_name);
}
};
@@ -2823,7 +2888,8 @@ protected:
}
protected:
/* Just create an item and do not fill string representation */
- Item_string(CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE)
+ Item_string(THD *thd, CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE):
+ Item_basic_constant(thd)
{
collation.set(cs, dv);
max_length= 0;
@@ -2832,7 +2898,8 @@ protected:
fixed= 1;
}
public:
- Item_string(CHARSET_INFO *csi, const char *str_arg, uint length_arg)
+ Item_string(THD *thd, CHARSET_INFO *csi, const char *str_arg, uint length_arg):
+ Item_basic_constant(thd)
{
collation.set(csi, DERIVATION_COERCIBLE);
set_name(NULL, 0, system_charset_info);
@@ -2842,20 +2909,21 @@ public:
max_length= str_value.numchars() * csi->mbmaxlen;
}
// Constructors with the item name set from its value
- Item_string(const char *str, uint length, CHARSET_INFO *cs,
- Derivation dv, uint repertoire)
+ Item_string(THD *thd, const char *str, uint length, CHARSET_INFO *cs,
+ Derivation dv, uint repertoire): Item_basic_constant(thd)
{
str_value.set_or_copy_aligned(str, length, cs);
fix_and_set_name_from_value(dv, Metadata(&str_value, repertoire));
}
- Item_string(const char *str, uint length,
- CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE)
+ Item_string(THD *thd, const char *str, uint length,
+ CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE):
+ Item_basic_constant(thd)
{
str_value.set_or_copy_aligned(str, length, cs);
fix_and_set_name_from_value(dv, Metadata(&str_value));
}
- Item_string(const String *str, CHARSET_INFO *tocs, uint *conv_errors,
- Derivation dv, uint repertoire)
+ Item_string(THD *thd, const String *str, CHARSET_INFO *tocs, uint *conv_errors,
+ Derivation dv, uint repertoire): Item_basic_constant(thd)
{
if (str_value.copy(str, tocs, conv_errors))
str_value.set("", 0, tocs); // EOM ?
@@ -2863,15 +2931,17 @@ public:
fix_and_set_name_from_value(dv, Metadata(&str_value, repertoire));
}
// Constructors with an externally provided item name
- Item_string(const char *name_par, const char *str, uint length,
- CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE)
+ Item_string(THD *thd, const char *name_par, const char *str, uint length,
+ CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE):
+ Item_basic_constant(thd)
{
str_value.set_or_copy_aligned(str, length, cs);
fix_from_value(dv, Metadata(&str_value));
set_name(name_par, 0, system_charset_info);
}
- Item_string(const char *name_par, const char *str, uint length,
- CHARSET_INFO *cs, Derivation dv, uint repertoire)
+ Item_string(THD *thd, const char *name_par, const char *str, uint length,
+ CHARSET_INFO *cs, Derivation dv, uint repertoire):
+ Item_basic_constant(thd)
{
str_value.set_or_copy_aligned(str, length, cs);
fix_from_value(dv, Metadata(&str_value, repertoire));
@@ -2898,14 +2968,10 @@ public:
{
return str_eq(&str_value, item, binary_cmp);
}
- Item *clone_item()
- {
- return new Item_string(name, str_value.ptr(),
- str_value.length(), collation.collation);
- }
- Item *safe_charset_converter(CHARSET_INFO *tocs)
+ Item *clone_item(THD *thd);
+ Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
{
- return const_charset_converter(tocs, true);
+ return const_charset_converter(thd, tocs, true);
}
inline void append(char *str, uint length)
{
@@ -2978,12 +3044,13 @@ public:
class Item_string_with_introducer :public Item_string
{
public:
- Item_string_with_introducer(const char *str, uint length, CHARSET_INFO *cs)
- :Item_string(str, length, cs)
+ Item_string_with_introducer(THD *thd, const char *str, uint length,
+ CHARSET_INFO *cs):
+ Item_string(thd, str, length, cs)
{ }
- Item_string_with_introducer(const char *name,
- const char *str, uint length, CHARSET_INFO *tocs)
- :Item_string(name, str, length, tocs)
+ Item_string_with_introducer(THD *thd, const char *name_arg,
+ const char *str, uint length, CHARSET_INFO *tocs):
+ Item_string(thd, name_arg, str, length, tocs)
{ }
virtual bool is_cs_specified() const
{
@@ -2995,11 +3062,11 @@ public:
class Item_string_sys :public Item_string
{
public:
- Item_string_sys(const char *str, uint length)
- :Item_string(str, length, system_charset_info)
+ Item_string_sys(THD *thd, const char *str, uint length):
+ Item_string(thd, str, length, system_charset_info)
{ }
- Item_string_sys(const char *str)
- :Item_string(str, strlen(str), system_charset_info)
+ Item_string_sys(THD *thd, const char *str):
+ Item_string(thd, str, strlen(str), system_charset_info)
{ }
};
@@ -3007,43 +3074,36 @@ public:
class Item_string_ascii :public Item_string
{
public:
- Item_string_ascii(const char *str, uint length)
- :Item_string(str, length, &my_charset_latin1,
- DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII)
+ Item_string_ascii(THD *thd, const char *str, uint length):
+ Item_string(thd, str, length, &my_charset_latin1,
+ DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII)
{ }
- Item_string_ascii(const char *str)
- :Item_string(str, strlen(str), &my_charset_latin1,
- DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII)
+ Item_string_ascii(THD *thd, const char *str):
+ Item_string(thd, str, strlen(str), &my_charset_latin1,
+ DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII)
{ }
};
-longlong
-longlong_from_string_with_check(CHARSET_INFO *cs, const char *cptr,
- const char *end);
-double
-double_from_string_with_check(CHARSET_INFO *cs, const char *cptr,
- const char *end);
-
class Item_static_string_func :public Item_string
{
const char *func_name;
public:
- Item_static_string_func(const char *name_par, const char *str, uint length,
- CHARSET_INFO *cs,
- Derivation dv= DERIVATION_COERCIBLE)
- :Item_string(NullS, str, length, cs, dv), func_name(name_par)
+ Item_static_string_func(THD *thd, const char *name_par, const char *str,
+ uint length, CHARSET_INFO *cs,
+ Derivation dv= DERIVATION_COERCIBLE):
+ Item_string(thd, NullS, str, length, cs, dv), func_name(name_par)
{}
- Item_static_string_func(const char *name_par,
+ Item_static_string_func(THD *thd, const char *name_par,
const String *str,
CHARSET_INFO *tocs, uint *conv_errors,
- Derivation dv, uint repertoire)
- :Item_string(str, tocs, conv_errors, dv, repertoire),
- func_name(name_par)
+ Derivation dv, uint repertoire):
+ Item_string(thd, str, tocs, conv_errors, dv, repertoire),
+ func_name(name_par)
{}
- Item *safe_charset_converter(CHARSET_INFO *tocs)
+ Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
{
- return const_charset_converter(tocs, true, func_name);
+ return const_charset_converter(thd, tocs, true, func_name);
}
virtual inline void print(String *str, enum_query_type query_type)
@@ -3063,9 +3123,9 @@ public:
class Item_partition_func_safe_string: public Item_string
{
public:
- Item_partition_func_safe_string(const char *name_arg, uint length,
+ Item_partition_func_safe_string(THD *thd, const char *name_arg, uint length,
CHARSET_INFO *cs= NULL):
- Item_string(name_arg, length, cs)
+ Item_string(thd, name_arg, length, cs)
{}
bool check_vcol_func_processor(uchar *arg)
{
@@ -3078,10 +3138,10 @@ class Item_return_date_time :public Item_partition_func_safe_string
{
enum_field_types date_time_field_type;
public:
- Item_return_date_time(const char *name_arg, uint length_arg,
- enum_field_types field_type_arg)
- :Item_partition_func_safe_string(name_arg, length_arg, &my_charset_bin),
- date_time_field_type(field_type_arg)
+ Item_return_date_time(THD *thd, const char *name_arg, uint length_arg,
+ enum_field_types field_type_arg):
+ Item_partition_func_safe_string(thd, name_arg, length_arg, &my_charset_bin),
+ date_time_field_type(field_type_arg)
{ decimals= 0; }
enum_field_types field_type() const { return date_time_field_type; }
};
@@ -3090,8 +3150,8 @@ public:
class Item_blob :public Item_partition_func_safe_string
{
public:
- Item_blob(const char *name_arg, uint length) :
- Item_partition_func_safe_string(name_arg, length, &my_charset_bin)
+ Item_blob(THD *thd, const char *name_arg, uint length):
+ Item_partition_func_safe_string(thd, name_arg, length, &my_charset_bin)
{ max_length= length; }
enum Type type() const { return TYPE_HOLDER; }
enum_field_types field_type() const { return MYSQL_TYPE_BLOB; }
@@ -3107,8 +3167,10 @@ public:
class Item_empty_string :public Item_partition_func_safe_string
{
public:
- Item_empty_string(const char *header,uint length, CHARSET_INFO *cs= NULL) :
- Item_partition_func_safe_string("",0, cs ? cs : &my_charset_utf8_general_ci)
+ Item_empty_string(THD *thd, const char *header,uint length,
+ CHARSET_INFO *cs= NULL):
+ Item_partition_func_safe_string(thd, "", 0,
+ cs ? cs : &my_charset_utf8_general_ci)
{ name=(char*) header; max_length= length * collation.collation->mbmaxlen; }
void make_field(Send_field *field);
};
@@ -3118,9 +3180,9 @@ class Item_return_int :public Item_int
{
enum_field_types int_field_type;
public:
- Item_return_int(const char *name_arg, uint length,
- enum_field_types field_type_arg, longlong value_arg= 0)
- :Item_int(name_arg, value_arg, length), int_field_type(field_type_arg)
+ Item_return_int(THD *thd, const char *name_arg, uint length,
+ enum_field_types field_type_arg, longlong value_arg= 0):
+ Item_int(thd, name_arg, value_arg, length), int_field_type(field_type_arg)
{
unsigned_flag=1;
}
@@ -3134,22 +3196,23 @@ public:
class Item_hex_constant: public Item_basic_constant
{
private:
- void hex_string_init(const char *str, uint str_length);
+ void hex_string_init(THD *thd, const char *str, uint str_length);
public:
- Item_hex_constant()
+ Item_hex_constant(THD *thd): Item_basic_constant(thd)
{
- hex_string_init("", 0);
+ hex_string_init(thd, "", 0);
}
- Item_hex_constant(const char *str, uint str_length)
+ Item_hex_constant(THD *thd, const char *str, uint str_length):
+ Item_basic_constant(thd)
{
- hex_string_init(str, str_length);
+ hex_string_init(thd, str, str_length);
}
enum Type type() const { return VARBIN_ITEM; }
enum Item_result result_type () const { return STRING_RESULT; }
enum_field_types field_type() const { return MYSQL_TYPE_VARCHAR; }
- virtual Item *safe_charset_converter(CHARSET_INFO *tocs)
+ virtual Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
{
- return const_charset_converter(tocs, true);
+ return const_charset_converter(thd, tocs, true);
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_vcol_func_processor(uchar *arg) { return FALSE;}
@@ -3172,9 +3235,9 @@ public:
class Item_hex_hybrid: public Item_hex_constant
{
public:
- Item_hex_hybrid(): Item_hex_constant() {}
- Item_hex_hybrid(const char *str, uint str_length):
- Item_hex_constant(str, str_length) {}
+ Item_hex_hybrid(THD *thd): Item_hex_constant(thd) {}
+ Item_hex_hybrid(THD *thd, const char *str, uint str_length):
+ Item_hex_constant(thd, str, str_length) {}
double val_real()
{
DBUG_ASSERT(fixed == 1);
@@ -3207,9 +3270,9 @@ public:
class Item_hex_string: public Item_hex_constant
{
public:
- Item_hex_string(): Item_hex_constant() {}
- Item_hex_string(const char *str, uint str_length):
- Item_hex_constant(str, str_length) {}
+ Item_hex_string(THD *thd): Item_hex_constant(thd) {}
+ Item_hex_string(THD *thd, const char *str, uint str_length):
+ Item_hex_constant(thd, str, str_length) {}
longlong val_int()
{
DBUG_ASSERT(fixed == 1);
@@ -3244,7 +3307,7 @@ public:
class Item_bin_string: public Item_hex_hybrid
{
public:
- Item_bin_string(const char *str,uint str_length);
+ Item_bin_string(THD *thd, const char *str,uint str_length);
};
@@ -3257,13 +3320,14 @@ public:
Constructor for Item_date_literal.
@param ltime DATE value.
*/
- Item_temporal_literal(MYSQL_TIME *ltime) :Item_basic_constant()
+ Item_temporal_literal(THD *thd, MYSQL_TIME *ltime): Item_basic_constant(thd)
{
collation.set(&my_charset_numeric, DERIVATION_NUMERIC, MY_REPERTOIRE_ASCII);
decimals= 0;
cached_time= *ltime;
}
- Item_temporal_literal(MYSQL_TIME *ltime, uint dec_arg) :Item_basic_constant()
+ Item_temporal_literal(THD *thd, MYSQL_TIME *ltime, uint dec_arg):
+ Item_basic_constant(thd)
{
collation.set(&my_charset_numeric, DERIVATION_NUMERIC, MY_REPERTOIRE_ASCII);
decimals= dec_arg;
@@ -3303,8 +3367,8 @@ public:
class Item_date_literal: public Item_temporal_literal
{
public:
- Item_date_literal(MYSQL_TIME *ltime)
- :Item_temporal_literal(ltime)
+ Item_date_literal(THD *thd, MYSQL_TIME *ltime)
+ :Item_temporal_literal(thd, ltime)
{
max_length= MAX_DATE_WIDTH;
fixed= 1;
@@ -3319,6 +3383,7 @@ public:
}
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
void print(String *str, enum_query_type query_type);
+ Item *clone_item(THD *thd);
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
};
@@ -3329,14 +3394,15 @@ public:
class Item_time_literal: public Item_temporal_literal
{
public:
- Item_time_literal(MYSQL_TIME *ltime, uint dec_arg)
- :Item_temporal_literal(ltime, dec_arg)
+ Item_time_literal(THD *thd, MYSQL_TIME *ltime, uint dec_arg):
+ Item_temporal_literal(thd, ltime, dec_arg)
{
max_length= MIN_TIME_WIDTH + (decimals ? decimals + 1 : 0);
fixed= 1;
}
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
void print(String *str, enum_query_type query_type);
+ Item *clone_item(THD *thd);
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
};
@@ -3347,8 +3413,8 @@ public:
class Item_datetime_literal: public Item_temporal_literal
{
public:
- Item_datetime_literal(MYSQL_TIME *ltime, uint dec_arg)
- :Item_temporal_literal(ltime, dec_arg)
+ Item_datetime_literal(THD *thd, MYSQL_TIME *ltime, uint dec_arg):
+ Item_temporal_literal(thd, ltime, dec_arg)
{
max_length= MAX_DATETIME_WIDTH + (decimals ? decimals + 1 : 0);
fixed= 1;
@@ -3357,10 +3423,67 @@ public:
}
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
void print(String *str, enum_query_type query_type);
+ Item *clone_item(THD *thd);
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
};
+/**
+ An error-safe counterpart for Item_date_literal
+*/
+class Item_date_literal_for_invalid_dates: public Item_date_literal
+{
+ /**
+ During equal field propagation we can replace non-temporal constants
+ found in equalities to their native temporal equivalents:
+ WHERE date_column='2001-01-01' ... ->
+ WHERE date_column=DATE'2001-01-01' ...
+
+ This is done to make the eqial field propagation code handle mixtures of
+ different temporal types in the same expressions easier (MDEV-8706), e.g.
+ WHERE LENGTH(date_column)=10 AND date_column=TIME'00:00:00'
+
+ Item_date_literal_for_invalid_dates::get_date()
+ (unlike the regular Item_date_literal::get_date())
+ does not check the result for NO_ZERO_IN_DATE and NO_ZER_DATE,
+ always returns success (false), and does not produce error/warning messages.
+
+ We need these _for_invalid_dates classes to be able to rewrite:
+ SELECT * FROM t1 WHERE date_column='0000-00-00' ...
+ to:
+ SELECT * FROM t1 WHERE date_column=DATE'0000-00-00' ...
+
+ to avoid returning NULL value instead of '0000-00-00' even
+ in sql_mode=TRADITIONAL.
+ */
+public:
+ Item_date_literal_for_invalid_dates(THD *thd, MYSQL_TIME *ltime)
+ :Item_date_literal(thd, ltime) { }
+ bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
+ {
+ *ltime= cached_time;
+ return (null_value= false);
+ }
+};
+
+
+/**
+ An error-safe counterpart for Item_datetime_literal
+ (see Item_date_literal_for_invalid_dates for comments)
+*/
+class Item_datetime_literal_for_invalid_dates: public Item_datetime_literal
+{
+public:
+ Item_datetime_literal_for_invalid_dates(THD *thd,
+ MYSQL_TIME *ltime, uint dec_arg)
+ :Item_datetime_literal(thd, ltime, dec_arg) { }
+ bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
+ {
+ *ltime= cached_time;
+ return (null_value= false);
+ }
+};
+
/**
Array of items, e.g. function or aggerate function arguments.
@@ -3369,7 +3492,7 @@ class Item_args
{
protected:
Item **args, *tmp_arg[2];
- void set_arguments(List<Item> &list);
+ void set_arguments(THD *thd, List<Item> &list);
bool walk_args(Item_processor processor, bool walk_subquery, uchar *arg)
{
for (uint i= 0; i < arg_count; i++)
@@ -3379,7 +3502,8 @@ protected:
}
return false;
}
- bool transform_args(Item_transformer transformer, uchar *arg);
+ bool transform_args(THD *thd, Item_transformer transformer, uchar *arg);
+ void propagate_equal_fields(THD *, const Item::Context &, COND_EQUAL *);
public:
uint arg_count;
Item_args(void)
@@ -3422,9 +3546,9 @@ public:
args[0]= a; args[1]= b; args[2]= c; args[3]= d; args[4]= e;
}
}
- Item_args(List<Item> &list)
+ Item_args(THD *thd, List<Item> &list)
{
- set_arguments(list);
+ set_arguments(thd, list);
}
Item_args(THD *thd, const Item_args *other);
inline Item **arguments() const { return args; }
@@ -3506,17 +3630,20 @@ public:
class Item_func_or_sum: public Item_result_field, public Item_args
{
public:
- Item_func_or_sum() :Item_args() {}
- Item_func_or_sum(Item *a) :Item_args(a) { }
- Item_func_or_sum(Item *a, Item *b) :Item_args(a, b) { }
- Item_func_or_sum(Item *a, Item *b, Item *c) :Item_args(a, b, c) { }
- Item_func_or_sum(Item *a, Item *b, Item *c, Item *d)
- :Item_args(a, b, c, d) { }
- Item_func_or_sum(Item *a, Item *b, Item *c, Item *d, Item *e)
- :Item_args(a, b, c, d, e) { }
- Item_func_or_sum(THD *thd, Item_func_or_sum *item)
- :Item_result_field(thd, item), Item_args(thd, item) { }
- Item_func_or_sum(List<Item> &list) :Item_args(list) { }
+ Item_func_or_sum(THD *thd): Item_result_field(thd), Item_args() {}
+ Item_func_or_sum(THD *thd, Item *a): Item_result_field(thd), Item_args(a) { }
+ Item_func_or_sum(THD *thd, Item *a, Item *b):
+ Item_result_field(thd), Item_args(a, b) { }
+ Item_func_or_sum(THD *thd, Item *a, Item *b, Item *c):
+ Item_result_field(thd), Item_args(a, b, c) { }
+ Item_func_or_sum(THD *thd, Item *a, Item *b, Item *c, Item *d):
+ Item_result_field(thd), Item_args(a, b, c, d) { }
+ Item_func_or_sum(THD *thd, Item *a, Item *b, Item *c, Item *d, Item *e):
+ Item_result_field(thd), Item_args(a, b, c, d, e) { }
+ Item_func_or_sum(THD *thd, Item_func_or_sum *item):
+ Item_result_field(thd, item), Item_args(thd, item) { }
+ Item_func_or_sum(THD *thd, List<Item> &list):
+ Item_result_field(thd), Item_args(thd, list) { }
bool walk(Item_processor processor, bool walk_subquery, uchar *arg)
{
if (walk_args(processor, walk_subquery, arg))
@@ -3548,15 +3675,16 @@ class Item_ref :public Item_ident
{
protected:
void set_properties();
+ bool set_properties_only; // the item doesn't need full fix_fields
public:
enum Ref_Type { REF, DIRECT_REF, VIEW_REF, OUTER_REF, AGGREGATE_REF };
Item **ref;
bool reference_trough_name;
- Item_ref(Name_resolution_context *context_arg,
+ Item_ref(THD *thd, Name_resolution_context *context_arg,
const char *db_arg, const char *table_name_arg,
- const char *field_name_arg)
- :Item_ident(context_arg, db_arg, table_name_arg, field_name_arg),
- ref(0), reference_trough_name(1) {}
+ const char *field_name_arg):
+ Item_ident(thd, context_arg, db_arg, table_name_arg, field_name_arg),
+ set_properties_only(0), ref(0), reference_trough_name(1) {}
/*
This constructor is used in two scenarios:
A) *item = NULL
@@ -3571,15 +3699,15 @@ public:
TODO we probably fix a superset of problems like in BUG#6658. Check this
with Bar, and if we have a more broader set of problems like this.
*/
- Item_ref(Name_resolution_context *context_arg, Item **item,
+ Item_ref(THD *thd, Name_resolution_context *context_arg, Item **item,
const char *table_name_arg, const char *field_name_arg,
bool alias_name_used_arg= FALSE);
- Item_ref(TABLE_LIST *view_arg, Item **item,
+ Item_ref(THD *thd, TABLE_LIST *view_arg, Item **item,
const char *field_name_arg, bool alias_name_used_arg= FALSE);
/* Constructor need to process subselect with temporary tables (see Item) */
Item_ref(THD *thd, Item_ref *item)
- :Item_ident(thd, item), ref(item->ref) {}
+ :Item_ident(thd, item), set_properties_only(0), ref(item->ref) {}
enum Type type() const { return REF_ITEM; }
enum Type real_type() const { return ref ? (*ref)->type() :
REF_ITEM; }
@@ -3659,8 +3787,8 @@ public:
else
return FALSE;
}
- Item* transform(Item_transformer, uchar *arg);
- Item* compile(Item_analyzer analyzer, uchar **arg_p,
+ Item* transform(THD *thd, Item_transformer, uchar *arg);
+ Item* compile(THD *thd, Item_analyzer analyzer, uchar **arg_p,
Item_transformer transformer, uchar *arg_t);
bool enumerate_field_refs_processor(uchar *arg)
{ return (*ref)->enumerate_field_refs_processor(arg); }
@@ -3734,20 +3862,20 @@ public:
class Item_direct_ref :public Item_ref
{
public:
- Item_direct_ref(Name_resolution_context *context_arg, Item **item,
+ Item_direct_ref(THD *thd, Name_resolution_context *context_arg, Item **item,
const char *table_name_arg,
const char *field_name_arg,
- bool alias_name_used_arg= FALSE)
- :Item_ref(context_arg, item, table_name_arg,
- field_name_arg, alias_name_used_arg)
+ bool alias_name_used_arg= FALSE):
+ Item_ref(thd, context_arg, item, table_name_arg,
+ field_name_arg, alias_name_used_arg)
{}
/* Constructor need to process subselect with temporary tables (see Item) */
Item_direct_ref(THD *thd, Item_direct_ref *item) : Item_ref(thd, item) {}
- Item_direct_ref(TABLE_LIST *view_arg, Item **item,
+ Item_direct_ref(THD *thd, TABLE_LIST *view_arg, Item **item,
const char *field_name_arg,
- bool alias_name_used_arg= FALSE)
- :Item_ref(view_arg, item, field_name_arg,
- alias_name_used_arg)
+ bool alias_name_used_arg= FALSE):
+ Item_ref(thd, view_arg, item, field_name_arg,
+ alias_name_used_arg)
{}
bool fix_fields(THD *thd, Item **it)
@@ -3778,9 +3906,9 @@ class Item_direct_ref_to_ident :public Item_direct_ref
{
Item_ident *ident;
public:
- Item_direct_ref_to_ident(Item_ident *item)
- :Item_direct_ref(item->context, (Item**)&item, item->table_name, item->field_name,
- FALSE)
+ Item_direct_ref_to_ident(THD *thd, Item_ident *item):
+ Item_direct_ref(thd, item->context, (Item**)&item, item->table_name,
+ item->field_name, FALSE)
{
ident= item;
ref= (Item**)&ident;
@@ -3804,6 +3932,7 @@ public:
class Item_cache;
class Expression_cache;
+class Expression_cache_tracker;
/**
The objects of this class can store its values in an expression cache.
@@ -3831,13 +3960,14 @@ private:
void init_on_demand();
public:
- Item_cache_wrapper(Item *item_arg);
+ Item_cache_wrapper(THD *thd, Item *item_arg);
~Item_cache_wrapper();
enum Type type() const { return EXPR_CACHE_ITEM; }
enum Type real_type() const { return orig_item->type(); }
bool set_cache(THD *thd);
+ Expression_cache_tracker* init_tracker(MEM_ROOT *mem_root);
bool fix_fields(THD *thd, Item **it);
void cleanup();
@@ -3958,11 +4088,12 @@ class Item_direct_view_ref :public Item_direct_ref
}
public:
- Item_direct_view_ref(Name_resolution_context *context_arg, Item **item,
+ Item_direct_view_ref(THD *thd, Name_resolution_context *context_arg,
+ Item **item,
const char *table_name_arg,
const char *field_name_arg,
- TABLE_LIST *view_arg)
- :Item_direct_ref(context_arg, item, table_name_arg, field_name_arg),
+ TABLE_LIST *view_arg):
+ Item_direct_ref(thd, context_arg, item, table_name_arg, field_name_arg),
item_equal(0), view(view_arg),
null_ref_table(NULL)
{
@@ -3982,9 +4113,8 @@ public:
Item_equal *get_item_equal() { return item_equal; }
void set_item_equal(Item_equal *item_eq) { item_equal= item_eq; }
Item_equal *find_item_equal(COND_EQUAL *cond_equal);
- bool subst_argument_checker(uchar **arg);
- Item *equal_fields_propagator(uchar *arg);
- Item *replace_equal_field(uchar *arg);
+ Item* propagate_equal_fields(THD *, const Context &, COND_EQUAL *);
+ Item *replace_equal_field(THD *thd, uchar *arg);
table_map used_tables() const;
void update_used_tables();
table_map not_null_tables() const;
@@ -4108,10 +4238,10 @@ public:
*/
bool found_in_select_list;
bool found_in_group_by;
- Item_outer_ref(Name_resolution_context *context_arg,
- Item_field *outer_field_arg)
- :Item_direct_ref(context_arg, 0, outer_field_arg->table_name,
- outer_field_arg->field_name),
+ Item_outer_ref(THD *thd, Name_resolution_context *context_arg,
+ Item_field *outer_field_arg):
+ Item_direct_ref(thd, context_arg, 0, outer_field_arg->table_name,
+ outer_field_arg->field_name),
outer_ref(outer_field_arg), in_sum_func(0),
found_in_select_list(0), found_in_group_by(0)
{
@@ -4119,11 +4249,11 @@ public:
set_properties();
fixed= 0; /* reset flag set in set_properties() */
}
- Item_outer_ref(Name_resolution_context *context_arg, Item **item,
+ Item_outer_ref(THD *thd, Name_resolution_context *context_arg, Item **item,
const char *table_name_arg, const char *field_name_arg,
- bool alias_name_used_arg)
- :Item_direct_ref(context_arg, item, table_name_arg, field_name_arg,
- alias_name_used_arg),
+ bool alias_name_used_arg):
+ Item_direct_ref(thd, context_arg, item, table_name_arg, field_name_arg,
+ alias_name_used_arg),
outer_ref(0), in_sum_func(0), found_in_select_list(1), found_in_group_by(0)
{}
void save_in_result_field(bool no_conversions)
@@ -4159,11 +4289,11 @@ class Item_ref_null_helper: public Item_ref
protected:
Item_in_subselect* owner;
public:
- Item_ref_null_helper(Name_resolution_context *context_arg,
+ Item_ref_null_helper(THD *thd, Name_resolution_context *context_arg,
Item_in_subselect* master, Item **item,
- const char *table_name_arg, const char *field_name_arg)
- :Item_ref(context_arg, item, table_name_arg, field_name_arg),
- owner(master) {}
+ const char *table_name_arg, const char *field_name_arg):
+ Item_ref(thd, context_arg, item, table_name_arg, field_name_arg),
+ owner(master) {}
void save_val(Field *to);
double val_real();
longlong val_int();
@@ -4188,8 +4318,8 @@ class Item_int_with_ref :public Item_int
{
Item *ref;
public:
- Item_int_with_ref(longlong i, Item *ref_arg, bool unsigned_arg) :
- Item_int(i), ref(ref_arg)
+ Item_int_with_ref(THD *thd, longlong i, Item *ref_arg, bool unsigned_arg):
+ Item_int(thd, i), ref(ref_arg)
{
unsigned_flag= unsigned_arg;
}
@@ -4197,7 +4327,7 @@ public:
{
return ref->save_in_field(field, no_conversions);
}
- Item *clone_item();
+ Item *clone_item(THD *thd);
virtual Item *real_item() { return ref; }
};
@@ -4261,7 +4391,7 @@ protected:
stores metadata information about the original class as well as a
pointer to it.
*/
- Item_copy(Item *i)
+ Item_copy(THD *thd, Item *i): Item(thd)
{
item= i;
null_value=maybe_null=item->maybe_null;
@@ -4279,7 +4409,7 @@ public:
@param item the original item.
*/
- static Item_copy *create (Item *item);
+ static Item_copy *create(THD *thd, Item *item);
/**
Update the cache with the value of the original item
@@ -4325,7 +4455,7 @@ public:
class Item_copy_string : public Item_copy
{
public:
- Item_copy_string (Item *item) : Item_copy(item) {}
+ Item_copy_string(THD *thd, Item *item_arg): Item_copy(thd, item_arg) {}
String *val_str(String*);
my_decimal *val_decimal(my_decimal *);
@@ -4341,7 +4471,7 @@ class Item_copy_int : public Item_copy
protected:
longlong cached_value;
public:
- Item_copy_int (Item *i) : Item_copy(i) {}
+ Item_copy_int(THD *thd, Item *i): Item_copy(thd, i) {}
int save_in_field(Field *field, bool no_conversions);
virtual String *val_str(String*);
@@ -4361,7 +4491,7 @@ public:
class Item_copy_uint : public Item_copy_int
{
public:
- Item_copy_uint (Item *item) : Item_copy_int(item)
+ Item_copy_uint(THD *thd, Item *item_arg): Item_copy_int(thd, item_arg)
{
unsigned_flag= 1;
}
@@ -4379,7 +4509,7 @@ class Item_copy_float : public Item_copy
protected:
double cached_value;
public:
- Item_copy_float (Item *i) : Item_copy(i) {}
+ Item_copy_float(THD *thd, Item *i): Item_copy(thd, i) {}
int save_in_field(Field *field, bool no_conversions);
String *val_str(String*);
@@ -4405,7 +4535,7 @@ class Item_copy_decimal : public Item_copy
protected:
my_decimal cached_value;
public:
- Item_copy_decimal (Item *i) : Item_copy(i) {}
+ Item_copy_decimal(THD *thd, Item *i): Item_copy(thd, i) {}
int save_in_field(Field *field, bool no_conversions);
String *val_str(String*);
@@ -4510,12 +4640,12 @@ class Item_default_value : public Item_field
{
public:
Item *arg;
- Item_default_value(Name_resolution_context *context_arg)
- :Item_field(context_arg, (const char *)NULL, (const char *)NULL,
+ Item_default_value(THD *thd, Name_resolution_context *context_arg)
+ :Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL,
(const char *)NULL),
arg(NULL) {}
- Item_default_value(Name_resolution_context *context_arg, Item *a)
- :Item_field(context_arg, (const char *)NULL, (const char *)NULL,
+ Item_default_value(THD *thd, Name_resolution_context *context_arg, Item *a)
+ :Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL,
(const char *)NULL),
arg(a) {}
enum Type type() const { return DEFAULT_VALUE_ITEM; }
@@ -4531,7 +4661,7 @@ public:
(this->*processor)(args);
}
- Item *transform(Item_transformer transformer, uchar *args);
+ Item *transform(THD *thd, Item_transformer transformer, uchar *args);
};
/*
@@ -4548,8 +4678,8 @@ class Item_insert_value : public Item_field
{
public:
Item *arg;
- Item_insert_value(Name_resolution_context *context_arg, Item *a)
- :Item_field(context_arg, (const char *)NULL, (const char *)NULL,
+ Item_insert_value(THD *thd, Name_resolution_context *context_arg, Item *a)
+ :Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL,
(const char *)NULL),
arg(a) {}
bool eq(const Item *item, bool binary_cmp) const;
@@ -4572,7 +4702,7 @@ public:
(this->*processor)(args);
}
bool check_partition_func_processor(uchar *int_arg) {return TRUE;}
- bool check_vcol_func_processor(uchar *arg)
+ bool check_vcol_func_processor(uchar *arg_arg)
{
return trace_unsupported_by_check_vcol_func_processor("values");
}
@@ -4606,11 +4736,11 @@ public:
/* Pointer to Table_trigger_list object for table of this trigger */
Table_triggers_list *triggers;
- Item_trigger_field(Name_resolution_context *context_arg,
+ Item_trigger_field(THD *thd, Name_resolution_context *context_arg,
row_version_type row_ver_arg,
const char *field_name_arg,
ulong priv, const bool ro)
- :Item_field(context_arg,
+ :Item_field(thd, context_arg,
(const char *)NULL, (const char *)NULL, field_name_arg),
row_version(row_ver_arg), field_idx((uint)-1), original_privilege(priv),
want_privilege(priv), table_grants(NULL), read_only (ro)
@@ -4679,7 +4809,6 @@ class Item_cache: public Item_basic_constant
{
protected:
Item *example;
- table_map used_table_map;
/**
Field that this object will get value from. This is used by
index-based subquery engines to detect and remove the equality injected
@@ -4696,8 +4825,9 @@ protected:
*/
bool value_cached;
public:
- Item_cache():
- example(0), used_table_map(0), cached_field(0),
+ Item_cache(THD *thd):
+ Item_basic_constant(thd),
+ example(0), cached_field(0),
cached_field_type(MYSQL_TYPE_STRING),
value_cached(0)
{
@@ -4705,8 +4835,9 @@ public:
maybe_null= 1;
null_value= 1;
}
- Item_cache(enum_field_types field_type_arg):
- example(0), used_table_map(0), cached_field(0),
+ Item_cache(THD *thd, enum_field_types field_type_arg):
+ Item_basic_constant(thd),
+ example(0), cached_field(0),
cached_field_type(field_type_arg),
value_cached(0)
{
@@ -4715,10 +4846,8 @@ public:
null_value= 1;
}
- void set_used_tables(table_map map) { used_table_map= map; }
-
- virtual bool allocate(uint i) { return 0; }
- virtual bool setup(Item *item)
+ virtual bool allocate(THD *thd, uint i) { return 0; }
+ virtual bool setup(THD *thd, Item *item)
{
example= item;
Type_std_attributes::set(item);
@@ -4728,9 +4857,8 @@ public:
};
enum Type type() const { return CACHE_ITEM; }
enum_field_types field_type() const { return cached_field_type; }
- static Item_cache* get_cache(const Item *item);
- static Item_cache* get_cache(const Item* item, const Item_result type);
- table_map used_tables() const { return used_table_map; }
+ static Item_cache* get_cache(THD *thd, const Item *item);
+ static Item_cache* get_cache(THD *thd, const Item* item, const Item_result type);
virtual void keep_array() {}
virtual void print(String *str, enum_query_type query_type);
bool eq_def(Field *field)
@@ -4781,6 +4909,7 @@ public:
return TRUE;
return (this->*processor)(arg);
}
+ virtual Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs);
};
@@ -4789,10 +4918,10 @@ class Item_cache_int: public Item_cache
protected:
longlong value;
public:
- Item_cache_int(): Item_cache(MYSQL_TYPE_LONGLONG),
+ Item_cache_int(THD *thd): Item_cache(thd, MYSQL_TYPE_LONGLONG),
value(0) {}
- Item_cache_int(enum_field_types field_type_arg):
- Item_cache(field_type_arg), value(0) {}
+ Item_cache_int(THD *thd, enum_field_types field_type_arg):
+ Item_cache(thd, field_type_arg), value(0) {}
double val_real();
longlong val_int();
@@ -4807,11 +4936,12 @@ public:
class Item_cache_temporal: public Item_cache_int
{
public:
- Item_cache_temporal(enum_field_types field_type_arg);
+ Item_cache_temporal(THD *thd, enum_field_types field_type_arg);
String* val_str(String *str);
my_decimal *val_decimal(my_decimal *);
longlong val_int();
- longlong val_temporal_packed();
+ longlong val_datetime_packed();
+ longlong val_time_packed();
double val_real();
bool cache_value();
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
@@ -4823,12 +4953,7 @@ public:
is a constant and need not be optimized further.
Important when storing packed datetime values.
*/
- Item *clone_item()
- {
- Item_cache_temporal *item= new Item_cache_temporal(cached_field_type);
- item->store_packed(value, example);
- return item;
- }
+ Item *clone_item(THD *thd);
};
@@ -4836,7 +4961,7 @@ class Item_cache_real: public Item_cache
{
double value;
public:
- Item_cache_real(): Item_cache(MYSQL_TYPE_DOUBLE),
+ Item_cache_real(THD *thd): Item_cache(thd, MYSQL_TYPE_DOUBLE),
value(0) {}
double val_real();
@@ -4853,7 +4978,7 @@ class Item_cache_decimal: public Item_cache
protected:
my_decimal decimal_value;
public:
- Item_cache_decimal(): Item_cache(MYSQL_TYPE_NEWDECIMAL) {}
+ Item_cache_decimal(THD *thd): Item_cache(thd, MYSQL_TYPE_NEWDECIMAL) {}
double val_real();
longlong val_int();
@@ -4871,8 +4996,8 @@ class Item_cache_str: public Item_cache
bool is_varbinary;
public:
- Item_cache_str(const Item *item) :
- Item_cache(item->field_type()), value(0),
+ Item_cache_str(THD *thd, const Item *item):
+ Item_cache(thd, item->field_type()), value(0),
is_varbinary(item->type() == FIELD_ITEM &&
cached_field_type == MYSQL_TYPE_VARCHAR &&
!((const Item_field *) item)->field->has_charset())
@@ -4895,20 +5020,20 @@ class Item_cache_row: public Item_cache
uint item_count;
bool save_array;
public:
- Item_cache_row()
- :Item_cache(), values(0), item_count(2),
+ Item_cache_row(THD *thd):
+ Item_cache(thd), values(0), item_count(2),
save_array(0) {}
/*
'allocate' used only in row transformer, to preallocate space for row
cache.
*/
- bool allocate(uint num);
+ bool allocate(THD *thd, uint num);
/*
'setup' is needed only by row => it not called by simple row subselect
(only by IN subselect (in subselect optimizer))
*/
- bool setup(Item *item);
+ bool setup(THD *thd, Item *item);
void store(Item *item);
void illegal_method_call(const char *);
void make_field(Send_field *)
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index a1926756f13..a5369f42a62 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -165,7 +165,7 @@ static int agg_cmp_type(Item_result *type, Item **items, uint nitems)
type[0]= items[0]->cmp_type();
for (i= 1 ; i < nitems ; i++)
{
- type[0]= item_cmp_type(type[0], items[i]->cmp_type());
+ type[0]= item_cmp_type(type[0], items[i]);
/*
When aggregating types of two row expressions we have to check
that they have the same cardinality and that each component
@@ -231,26 +231,25 @@ static uint collect_cmp_types(Item **items, uint nitems, bool skip_nulls= FALSE)
{
uint i;
uint found_types;
- Item_result left_result= items[0]->cmp_type();
+ Item_result left_cmp_type= items[0]->cmp_type();
DBUG_ASSERT(nitems > 1);
found_types= 0;
for (i= 1; i < nitems ; i++)
{
if (skip_nulls && items[i]->type() == Item::NULL_ITEM)
continue; // Skip NULL constant items
- if ((left_result == ROW_RESULT ||
+ if ((left_cmp_type == ROW_RESULT ||
items[i]->cmp_type() == ROW_RESULT) &&
cmp_row_type(items[0], items[i]))
return 0;
- found_types|= 1U << (uint)item_cmp_type(left_result,
- items[i]->cmp_type());
+ found_types|= 1U << (uint) item_cmp_type(left_cmp_type, items[i]);
}
/*
Even if all right-hand items are NULLs and we are skipping them all, we need
at least one type bit in the found_type bitmask.
*/
if (skip_nulls && !found_types)
- found_types= 1U << (uint)left_result;
+ found_types= 1U << (uint) left_cmp_type;
return found_types;
}
@@ -442,7 +441,7 @@ static bool convert_const_to_int(THD *thd, Item_field *field_item,
if (0 == field_cmp)
{
- Item *tmp= new Item_int_with_ref(field->val_int(), *item,
+ Item *tmp= new (thd->mem_root) Item_int_with_ref(thd, field->val_int(), *item,
MY_TEST(field->flags & UNSIGNED_FLAG));
if (tmp)
thd->change_item_tree(item, tmp);
@@ -474,7 +473,7 @@ static bool convert_const_to_int(THD *thd, Item_field *field_item,
*/
void Item_func::convert_const_compared_to_int_field(THD *thd)
{
- DBUG_ASSERT(arg_count == 2);
+ DBUG_ASSERT(arg_count >= 2); // Item_func_nullif has arg_count == 3
if (!thd->lex->is_ps_or_view_context_analysis())
{
int field;
@@ -483,9 +482,8 @@ void Item_func::convert_const_compared_to_int_field(THD *thd)
{
Item_field *field_item= (Item_field*) (args[field]->real_item());
if ((field_item->field_type() == MYSQL_TYPE_LONGLONG ||
- field_item->field_type() == MYSQL_TYPE_YEAR) &&
- convert_const_to_int(thd, field_item, &args[!field]))
- args[0]->cmp_context= args[1]->cmp_context= INT_RESULT;
+ field_item->field_type() == MYSQL_TYPE_YEAR))
+ convert_const_to_int(thd, field_item, &args[!field]);
}
}
}
@@ -493,21 +491,18 @@ void Item_func::convert_const_compared_to_int_field(THD *thd)
bool Item_func::setup_args_and_comparator(THD *thd, Arg_comparator *cmp)
{
- DBUG_ASSERT(arg_count == 2);
+ DBUG_ASSERT(arg_count >= 2); // Item_func_nullif has arg_count == 3
if (args[0]->cmp_type() == STRING_RESULT &&
args[1]->cmp_type() == STRING_RESULT &&
agg_arg_charsets_for_comparison(cmp->cmp_collation, args, 2))
return true;
- args[0]->cmp_context= args[1]->cmp_context=
- item_cmp_type(args[0]->result_type(), args[1]->result_type());
-
// Convert constants when compared to int/year field
DBUG_ASSERT(functype() != LIKE_FUNC);
convert_const_compared_to_int_field(thd);
- return cmp->set_cmp_func(this, tmp_arg, tmp_arg + 1, true);
+ return cmp->set_cmp_func(this, &args[0], &args[1], true);
}
@@ -553,8 +548,8 @@ int Arg_comparator::set_compare_func(Item_func_or_sum *item, Item_result type)
my_error(ER_OPERAND_COLUMNS, MYF(0), (*a)->element_index(i)->cols());
return 1;
}
- if (comparators[i].set_cmp_func(owner, (*a)->addr(i), (*b)->addr(i),
- set_null))
+ if (comparators[i].set_cmp_func(owner, (*a)->addr(i),
+ (*b)->addr(i), set_null))
return 1;
}
break;
@@ -617,9 +612,6 @@ int Arg_comparator::set_compare_func(Item_func_or_sum *item, Item_result type)
}
break;
}
- case IMPOSSIBLE_RESULT:
- DBUG_ASSERT(0);
- break;
}
return 0;
}
@@ -728,16 +720,16 @@ bool Arg_comparator::agg_arg_charsets_for_comparison()
*/
int Arg_comparator::set_cmp_func(Item_func_or_sum *owner_arg,
- Item **a1, Item **a2,
- Item_result type)
+ Item **a1, Item **a2)
{
thd= current_thd;
owner= owner_arg;
set_null= set_null && owner_arg;
a= a1;
b= a2;
+ m_compare_type= item_cmp_type(*a1, *a2);
- if (type == STRING_RESULT &&
+ if (m_compare_type == STRING_RESULT &&
(*a)->result_type() == STRING_RESULT &&
(*b)->result_type() == STRING_RESULT)
{
@@ -748,14 +740,35 @@ int Arg_comparator::set_cmp_func(Item_func_or_sum *owner_arg,
if (agg_arg_charsets_for_comparison())
return 1;
}
- if (type == INT_RESULT &&
+
+ if (m_compare_type == TIME_RESULT)
+ {
+ enum_field_types f_type= a[0]->field_type_for_temporal_comparison(b[0]);
+ if (f_type == MYSQL_TYPE_TIME)
+ {
+ func= is_owner_equal_func() ? &Arg_comparator::compare_e_time :
+ &Arg_comparator::compare_time;
+ }
+ else
+ {
+ func= is_owner_equal_func() ? &Arg_comparator::compare_e_datetime :
+ &Arg_comparator::compare_datetime;
+ }
+ return 0;
+ }
+
+ if (m_compare_type == INT_RESULT &&
(*a)->field_type() == MYSQL_TYPE_YEAR &&
(*b)->field_type() == MYSQL_TYPE_YEAR)
- type= TIME_RESULT;
+ {
+ m_compare_type= TIME_RESULT;
+ func= is_owner_equal_func() ? &Arg_comparator::compare_e_datetime :
+ &Arg_comparator::compare_datetime;
+ }
- a= cache_converted_constant(thd, a, &a_cache, type);
- b= cache_converted_constant(thd, b, &b_cache, type);
- return set_compare_func(owner_arg, type);
+ a= cache_converted_constant(thd, a, &a_cache, m_compare_type);
+ b= cache_converted_constant(thd, b, &b_cache, m_compare_type);
+ return set_compare_func(owner_arg, m_compare_type);
}
@@ -789,8 +802,8 @@ Item** Arg_comparator::cache_converted_constant(THD *thd_arg, Item **value,
(*value)->const_item() && type != (*value)->result_type() &&
type != TIME_RESULT)
{
- Item_cache *cache= Item_cache::get_cache(*value, type);
- cache->setup(*value);
+ Item_cache *cache= Item_cache::get_cache(thd_arg, *value, type);
+ cache->setup(thd_arg, *value);
*cache_item= cache;
return cache_item;
}
@@ -798,18 +811,6 @@ Item** Arg_comparator::cache_converted_constant(THD *thd_arg, Item **value,
}
-void Arg_comparator::set_datetime_cmp_func(Item_func_or_sum *owner_arg,
- Item **a1, Item **b1)
-{
- thd= current_thd;
- owner= owner_arg;
- a= a1;
- b= b1;
- a_cache= 0;
- b_cache= 0;
- func= comparator_matrix[TIME_RESULT][is_owner_equal_func()];
-}
-
/**
Retrieves correct DATETIME value from given item.
@@ -843,34 +844,11 @@ void Arg_comparator::set_datetime_cmp_func(Item_func_or_sum *owner_arg,
longlong
get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
- Item *warn_item, bool *is_null)
+ enum_field_types f_type, bool *is_null)
{
longlong UNINIT_VAR(value);
Item *item= **item_arg;
- enum_field_types f_type= item->cmp_type() == TIME_RESULT ?
- item->field_type() : warn_item->field_type();
-
- if (item->result_type() == INT_RESULT &&
- item->cmp_type() == TIME_RESULT &&
- item->type() == Item::CACHE_ITEM)
- {
- /* it's our Item_cache_temporal, as created below */
- DBUG_ASSERT(is_temporal_type(((Item_cache *) item)->field_type()));
- value= ((Item_cache_temporal*) item)->val_temporal_packed();
- }
- else
- {
- MYSQL_TIME ltime;
- uint fuzzydate= TIME_FUZZY_DATES | TIME_INVALID_DATES;
- if ((item->field_type() == MYSQL_TYPE_TIME &&
- is_temporal_type_with_date(warn_item->field_type())) ?
- item->get_date_with_conversion(&ltime, fuzzydate) :
- item->get_date(&ltime, fuzzydate |
- (f_type == MYSQL_TYPE_TIME ? TIME_TIME_ONLY : 0)))
- value= 0; /* invalid date */
- else
- value= pack_time(&ltime);
- }
+ value= item->val_temporal_packed(f_type);
if ((*is_null= item->null_value))
return ~(ulonglong) 0;
if (cache_arg && item->const_item() &&
@@ -878,7 +856,7 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
{
Query_arena backup;
Query_arena *save_arena= thd->switch_to_arena_for_cached_items(&backup);
- Item_cache_temporal *cache= new Item_cache_temporal(f_type);
+ Item_cache_temporal *cache= new (thd->mem_root) Item_cache_temporal(thd, f_type);
if (save_arena)
thd->set_query_arena(save_arena);
@@ -907,7 +885,7 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
1 a > b
*/
-int Arg_comparator::compare_datetime()
+int Arg_comparator::compare_temporal(enum_field_types type)
{
bool a_is_null, b_is_null;
longlong a_value, b_value;
@@ -916,12 +894,12 @@ int Arg_comparator::compare_datetime()
owner->null_value= 1;
/* Get DATE/DATETIME/TIME value of the 'a' item. */
- a_value= get_datetime_value(thd, &a, &a_cache, *b, &a_is_null);
+ a_value= get_datetime_value(thd, &a, &a_cache, type, &a_is_null);
if (a_is_null)
return -1;
/* Get DATE/DATETIME/TIME value of the 'b' item. */
- b_value= get_datetime_value(thd, &b, &b_cache, *a, &b_is_null);
+ b_value= get_datetime_value(thd, &b, &b_cache, type, &b_is_null);
if (b_is_null)
return -1;
@@ -933,16 +911,16 @@ int Arg_comparator::compare_datetime()
return a_value < b_value ? -1 : a_value > b_value ? 1 : 0;
}
-int Arg_comparator::compare_e_datetime()
+int Arg_comparator::compare_e_temporal(enum_field_types type)
{
bool a_is_null, b_is_null;
longlong a_value, b_value;
/* Get DATE/DATETIME/TIME value of the 'a' item. */
- a_value= get_datetime_value(thd, &a, &a_cache, *b, &a_is_null);
+ a_value= get_datetime_value(thd, &a, &a_cache, type, &a_is_null);
/* Get DATE/DATETIME/TIME value of the 'b' item. */
- b_value= get_datetime_value(thd, &b, &b_cache, *a, &b_is_null);
+ b_value= get_datetime_value(thd, &b, &b_cache, type, &b_is_null);
return a_is_null || b_is_null ? a_is_null == b_is_null
: a_value == b_value;
}
@@ -1411,11 +1389,11 @@ bool Item_in_optimizer::fix_left(THD *thd)
{
DBUG_ENTER("Item_in_optimizer::fix_left");
if ((!args[0]->fixed && args[0]->fix_fields(thd, args)) ||
- (!cache && !(cache= Item_cache::get_cache(args[0]))))
+ (!cache && !(cache= Item_cache::get_cache(thd, args[0]))))
DBUG_RETURN(1);
DBUG_PRINT("info", ("actual fix fields"));
- cache->setup(args[0]);
+ cache->setup(thd, args[0]);
if (cache->cols() == 1)
{
DBUG_ASSERT(args[0]->type() != ROW_ITEM);
@@ -1542,9 +1520,8 @@ bool Item_in_optimizer::invisible_mode()
this item - otherwise
*/
-Item *Item_in_optimizer::expr_cache_insert_transformer(uchar *thd_arg)
+Item *Item_in_optimizer::expr_cache_insert_transformer(THD *thd, uchar *unused)
{
- THD *thd= (THD*) thd_arg;
DBUG_ENTER("Item_in_optimizer::expr_cache_insert_transformer");
if (invisible_mode())
@@ -1802,16 +1779,16 @@ bool Item_in_optimizer::is_null()
@retval NULL if an error occurred
*/
-Item *Item_in_optimizer::transform(Item_transformer transformer,
+Item *Item_in_optimizer::transform(THD *thd, Item_transformer transformer,
uchar *argument)
{
Item *new_item;
- DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
+ DBUG_ASSERT(!thd->stmt_arena->is_stmt_prepare());
DBUG_ASSERT(arg_count == 2);
/* Transform the left IN operand. */
- new_item= (*args)->transform(transformer, argument);
+ new_item= (*args)->transform(thd, transformer, argument);
if (!new_item)
return 0;
/*
@@ -1821,16 +1798,16 @@ Item *Item_in_optimizer::transform(Item_transformer transformer,
change records at each execution.
*/
if ((*args) != new_item)
- current_thd->change_item_tree(args, new_item);
+ thd->change_item_tree(args, new_item);
if (invisible_mode())
{
/* MAX/MIN transformed => pass through */
- new_item= args[1]->transform(transformer, argument);
+ new_item= args[1]->transform(thd, transformer, argument);
if (!new_item)
return 0;
if (args[1] != new_item)
- current_thd->change_item_tree(args + 1, new_item);
+ thd->change_item_tree(args + 1, new_item);
}
else
{
@@ -1850,9 +1827,9 @@ Item *Item_in_optimizer::transform(Item_transformer transformer,
Item_subselect::ANY_SUBS));
Item_in_subselect *in_arg= (Item_in_subselect*)args[1];
- current_thd->change_item_tree(&in_arg->left_expr, args[0]);
+ thd->change_item_tree(&in_arg->left_expr, args[0]);
}
- return (this->*transformer)(argument);
+ return (this->*transformer)(thd, argument);
}
@@ -2151,17 +2128,6 @@ longlong Item_func_interval::val_int()
1 got error
*/
-bool Item_func_between::fix_fields(THD *thd, Item **ref)
-{
- if (Item_func_opt_neg::fix_fields(thd, ref))
- return 1;
-
- thd->lex->current_select->between_count++;
-
-
- return 0;
-}
-
bool Item_func_between::eval_not_null_tables(uchar *opt_arg)
{
@@ -2209,9 +2175,10 @@ void Item_func_between::fix_length_and_dec()
*/
if (!args[0] || !args[1] || !args[2])
return;
- if ( agg_cmp_type(&cmp_type, args, 3))
+ if (agg_cmp_type(&m_compare_type, args, 3))
return;
- if (cmp_type == STRING_RESULT &&
+
+ if (m_compare_type == STRING_RESULT &&
agg_arg_charsets_for_comparison(cmp_collation, args, 3))
return;
@@ -2223,7 +2190,7 @@ void Item_func_between::fix_length_and_dec()
For this to work, we need to know what date/time type we compare
strings as.
*/
- if (cmp_type == TIME_RESULT)
+ if (m_compare_type == TIME_RESULT)
compare_as_dates= find_date_time_item(args, 3, 0);
/* See the comment about the similar block in Item_bool_func2 */
@@ -2237,7 +2204,7 @@ void Item_func_between::fix_length_and_dec()
const bool cvt_arg1= convert_const_to_int(thd, field_item, &args[1]);
const bool cvt_arg2= convert_const_to_int(thd, field_item, &args[2]);
if (cvt_arg1 && cvt_arg2)
- cmp_type=INT_RESULT; // Works for all types.
+ m_compare_type= INT_RESULT; // Works for all types.
}
}
}
@@ -2247,7 +2214,7 @@ longlong Item_func_between::val_int()
{
DBUG_ASSERT(fixed == 1);
- switch (cmp_type) {
+ switch (m_compare_type) {
case TIME_RESULT:
{
THD *thd= current_thd;
@@ -2256,8 +2223,8 @@ longlong Item_func_between::val_int()
bool value_is_null, a_is_null, b_is_null;
ptr= &args[0];
- value= get_datetime_value(thd, &ptr, &cache, compare_as_dates,
- &value_is_null);
+ enum_field_types f_type= field_type_for_temporal_comparison(compare_as_dates);
+ value= get_datetime_value(thd, &ptr, &cache, f_type, &value_is_null);
if (ptr != &args[0])
thd->change_item_tree(&args[0], *ptr);
@@ -2265,12 +2232,12 @@ longlong Item_func_between::val_int()
return 0;
ptr= &args[1];
- a= get_datetime_value(thd, &ptr, &cache, compare_as_dates, &a_is_null);
+ a= get_datetime_value(thd, &ptr, &cache, f_type, &a_is_null);
if (ptr != &args[1])
thd->change_item_tree(&args[1], *ptr);
ptr= &args[2];
- b= get_datetime_value(thd, &ptr, &cache, compare_as_dates, &b_is_null);
+ b= get_datetime_value(thd, &ptr, &cache, f_type, &b_is_null);
if (ptr != &args[2])
thd->change_item_tree(&args[2], *ptr);
@@ -2373,7 +2340,6 @@ longlong Item_func_between::val_int()
break;
}
case ROW_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0);
null_value= 1;
return 0;
@@ -2432,7 +2398,6 @@ Item_func_case_abbreviation2::fix_length_and_dec2(Item **args)
break;
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0);
}
fix_char_length(char_length);
@@ -2683,20 +2648,84 @@ bool Item_func_if::date_op(MYSQL_TIME *ltime, uint fuzzydate)
void
Item_func_nullif::fix_length_and_dec()
{
- if (!m_args0_copy) // Only false if EOM
+ if (!args[2]) // Only false if EOM
return;
- cached_result_type= m_args0_copy->result_type();
- cached_field_type= m_args0_copy->field_type();
- collation.set(m_args0_copy->collation);
- decimals= m_args0_copy->decimals;
- unsigned_flag= m_args0_copy->unsigned_flag;
- fix_char_length(m_args0_copy->max_char_length());
+ cached_result_type= args[2]->result_type();
+ cached_field_type= args[2]->field_type();
+ collation.set(args[2]->collation);
+ decimals= args[2]->decimals;
+ unsigned_flag= args[2]->unsigned_flag;
+ fix_char_length(args[2]->max_char_length());
maybe_null=1;
setup_args_and_comparator(current_thd, &cmp);
}
+void Item_func_nullif::print(String *str, enum_query_type query_type)
+{
+ /*
+ NULLIF(a,b) is implemented according to the SQL standard as a short for
+ CASE WHEN a=b THEN NULL ELSE a END
+
+ The constructor of Item_func_nullif sets args[0] and args[2] to the
+ same item "a", and sets args[1] to "b".
+
+ If "this" is a part of a WHERE or ON condition, then:
+ - the left "a" is a subject to equal field propagation with ANY_SUBST.
+ - the right "a" is a subject to equal field propagation with IDENTITY_SUBST.
+ Therefore, after equal field propagation args[0] and args[2] can point
+ to different items.
+ */
+ if (!(query_type & QT_ITEM_FUNC_NULLIF_TO_CASE) || args[0] == args[2])
+ {
+ /*
+ If no QT_ITEM_FUNC_NULLIF_TO_CASE is requested,
+ that means we want the original NULLIF() representation,
+ e.g. when we are in:
+ SHOW CREATE {VIEW|FUNCTION|PROCEDURE}
+
+ The original representation is possible only if
+ args[0] and args[2] still point to the same Item.
+
+ The caller must pass call print() with QT_ITEM_FUNC_NULLIF_TO_CASE
+ if an expression has undergone some optimization
+ (e.g. equal field propagation done in optimize_cond()) already and
+ NULLIF() potentially has two different representations of "a":
+ - one "a" for comparison
+ - another "a" for the returned value!
+
+ Note, the EXPLAIN EXTENDED and EXPLAIN FORMAT=JSON routines
+ do pass QT_ITEM_FUNC_NULLIF_TO_CASE to print().
+ */
+ DBUG_ASSERT(args[0] == args[2]);
+ str->append(func_name());
+ str->append('(');
+ args[2]->print(str, query_type);
+ str->append(',');
+ args[1]->print(str, query_type);
+ str->append(')');
+ }
+ else
+ {
+ /*
+ args[0] and args[2] are different items.
+ This is possible after WHERE optimization (equal fields propagation etc),
+ e.g. in EXPLAIN EXTENDED or EXPLAIN FORMAT=JSON.
+ As it's not possible to print as a function with 2 arguments any more,
+ do it in the CASE style.
+ */
+ str->append(STRING_WITH_LEN("(case when "));
+ args[0]->print(str, query_type);
+ str->append(STRING_WITH_LEN(" = "));
+ args[1]->print(str, query_type);
+ str->append(STRING_WITH_LEN(" then NULL else "));
+ args[2]->print(str, query_type);
+ str->append(STRING_WITH_LEN(" end)"));
+ }
+}
+
+
/**
@note
Note that we have to evaluate the first argument twice as the compare
@@ -2717,8 +2746,8 @@ Item_func_nullif::real_op()
null_value=1;
return 0.0;
}
- value= m_args0_copy->val_real();
- null_value=m_args0_copy->null_value;
+ value= args[2]->val_real();
+ null_value= args[2]->null_value;
return value;
}
@@ -2732,8 +2761,8 @@ Item_func_nullif::int_op()
null_value=1;
return 0;
}
- value=m_args0_copy->val_int();
- null_value=m_args0_copy->null_value;
+ value= args[2]->val_int();
+ null_value= args[2]->null_value;
return value;
}
@@ -2747,8 +2776,8 @@ Item_func_nullif::str_op(String *str)
null_value=1;
return 0;
}
- res=m_args0_copy->val_str(str);
- null_value=m_args0_copy->null_value;
+ res= args[2]->val_str(str);
+ null_value= args[2]->null_value;
return res;
}
@@ -2763,8 +2792,8 @@ Item_func_nullif::decimal_op(my_decimal * decimal_value)
null_value=1;
return 0;
}
- res= m_args0_copy->val_decimal(decimal_value);
- null_value= m_args0_copy->null_value;
+ res= args[2]->val_decimal(decimal_value);
+ null_value= args[2]->null_value;
return res;
}
@@ -2775,17 +2804,37 @@ Item_func_nullif::date_op(MYSQL_TIME *ltime, uint fuzzydate)
DBUG_ASSERT(fixed == 1);
if (!cmp.compare())
return (null_value= true);
- return (null_value= m_args0_copy->get_date(ltime, fuzzydate));
+ return (null_value= args[2]->get_date(ltime, fuzzydate));
}
bool
Item_func_nullif::is_null()
{
- return (null_value= (!cmp.compare() ? 1 : m_args0_copy->null_value));
+ return (null_value= (!cmp.compare() ? 1 : args[2]->null_value));
}
+Item_func_case::Item_func_case(THD *thd, List<Item> &list,
+ Item *first_expr_arg, Item *else_expr_arg):
+ Item_func_hybrid_field_type(thd), first_expr_num(-1), else_expr_num(-1),
+ left_cmp_type(INT_RESULT), case_item(0), m_found_types(0)
+{
+ ncases= list.elements;
+ if (first_expr_arg)
+ {
+ first_expr_num= list.elements;
+ list.push_back(first_expr_arg, thd->mem_root);
+ }
+ if (else_expr_arg)
+ {
+ else_expr_num= list.elements;
+ list.push_back(else_expr_arg, thd->mem_root);
+ }
+ set_arguments(thd, list);
+ bzero(&cmp_items, sizeof(cmp_items));
+}
+
/**
Find and return matching items for CASE or ELSE item if all compares
are failed or NULL if ELSE item isn't defined.
@@ -2828,7 +2877,7 @@ Item *Item_func_case::find_item(String *str)
{
if (args[i]->real_item()->type() == NULL_ITEM)
continue;
- cmp_type= item_cmp_type(left_result_type, args[i]->cmp_type());
+ cmp_type= item_cmp_type(left_cmp_type, args[i]);
DBUG_ASSERT(cmp_type != ROW_RESULT);
DBUG_ASSERT(cmp_items[(uint)cmp_type]);
if (!(value_added_map & (1U << (uint)cmp_type)))
@@ -2941,6 +2990,10 @@ bool Item_func_case::fix_fields(THD *thd, Item **ref)
Item_func_case::val_int() -> Item_func_case::find_item()
*/
uchar buff[MAX_FIELD_WIDTH*2+sizeof(String)*2+sizeof(String*)*2+sizeof(double)*2+sizeof(longlong)*2];
+
+ if (!(arg_buffer= (Item**) thd->alloc(sizeof(Item*)*(ncases+1))))
+ return TRUE;
+
bool res= Item_func::fix_fields(thd, ref);
/*
Call check_stack_overrun after fix_fields to be sure that stack variable
@@ -2994,14 +3047,11 @@ static void change_item_tree_if_needed(THD *thd,
void Item_func_case::fix_length_and_dec()
{
- Item **agg;
+ Item **agg= arg_buffer;
uint nagg;
- uint found_types= 0;
THD *thd= current_thd;
- if (!(agg= (Item**) sql_alloc(sizeof(Item*)*(ncases+1))))
- return;
-
+ m_found_types= 0;
if (else_expr_num == -1 || args[else_expr_num]->maybe_null)
maybe_null= 1;
@@ -3044,8 +3094,9 @@ void Item_func_case::fix_length_and_dec()
if (else_expr_num != -1)
agg_num_lengths(args[else_expr_num]);
max_length= my_decimal_precision_to_length_no_truncation(max_length +
- decimals, decimals,
- unsigned_flag);
+ decimals,
+ decimals,
+ unsigned_flag);
}
/*
@@ -3056,7 +3107,7 @@ void Item_func_case::fix_length_and_dec()
{
uint i;
agg[0]= args[first_expr_num];
- left_result_type= agg[0]->cmp_type();
+ left_cmp_type= agg[0]->cmp_type();
/*
As the first expression and WHEN expressions
@@ -3067,14 +3118,14 @@ void Item_func_case::fix_length_and_dec()
for (nagg= 0; nagg < ncases/2 ; nagg++)
agg[nagg+1]= args[nagg*2];
nagg++;
- if (!(found_types= collect_cmp_types(agg, nagg)))
+ if (!(m_found_types= collect_cmp_types(agg, nagg)))
return;
Item *date_arg= 0;
- if (found_types & (1U << TIME_RESULT))
+ if (m_found_types & (1U << TIME_RESULT))
date_arg= find_date_time_item(args, arg_count, 0);
- if (found_types & (1U << STRING_RESULT))
+ if (m_found_types & (1U << STRING_RESULT))
{
/*
If we'll do string comparison, we also need to aggregate
@@ -3115,7 +3166,7 @@ void Item_func_case::fix_length_and_dec()
for (i= 0; i <= (uint)TIME_RESULT; i++)
{
- if (found_types & (1U << i) && !cmp_items[i])
+ if (m_found_types & (1U << i) && !cmp_items[i])
{
DBUG_ASSERT((Item_result)i != ROW_RESULT);
@@ -3125,16 +3176,90 @@ void Item_func_case::fix_length_and_dec()
return;
}
}
+ }
+}
+
+
+Item* Item_func_case::propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond)
+{
+ if (first_expr_num == -1)
+ {
+ // None of the arguments are in a comparison context
+ Item_args::propagate_equal_fields(thd, Context_identity(), cond);
+ return this;
+ }
+
+ for (uint i= 0; i < arg_count; i++)
+ {
/*
- Set cmp_context of all WHEN arguments. This prevents
- Item_field::equal_fields_propagator() from transforming a
- zerofill argument into a string constant. Such a change would
- require rebuilding cmp_items.
+ Even "i" values cover items that are in a comparison context:
+ CASE x0 WHEN x1 .. WHEN x2 .. WHEN x3 ..
+ Odd "i" values cover items that are not in comparison:
+ CASE ... THEN y1 ... THEN y2 ... THEN y3 ... ELSE y4 END
*/
- for (i= 0; i < ncases; i+= 2)
- args[i]->cmp_context= item_cmp_type(left_result_type,
- args[i]->result_type());
+ Item *new_item= 0;
+ if ((int) i == first_expr_num) // Then CASE (the switch) argument
+ {
+ /*
+ Cannot replace the CASE (the switch) argument if
+ there are multiple comparison types were found, or found a single
+ comparison type that is not equal to args[0]->cmp_type().
+
+ - Example: multiple comparison types, can't propagate:
+ WHERE CASE str_column
+ WHEN 'string' THEN TRUE
+ WHEN 1 THEN TRUE
+ ELSE FALSE END;
+
+ - Example: a single incompatible comparison type, can't propagate:
+ WHERE CASE str_column
+ WHEN DATE'2001-01-01' THEN TRUE
+ ELSE FALSE END;
+
+ - Example: a single incompatible comparison type, can't propagate:
+ WHERE CASE str_column
+ WHEN 1 THEN TRUE
+ ELSE FALSE END;
+
+ - Example: a single compatible comparison type, ok to propagate:
+ WHERE CASE str_column
+ WHEN 'str1' THEN TRUE
+ WHEN 'str2' THEN TRUE
+ ELSE FALSE END;
+ */
+ if (m_found_types == (1UL << left_cmp_type))
+ new_item= args[i]->propagate_equal_fields(thd,
+ Context(
+ ANY_SUBST,
+ left_cmp_type,
+ cmp_collation.collation),
+ cond);
+ }
+ else if ((i % 2) == 0) // WHEN arguments
+ {
+ /*
+ These arguments are in comparison.
+ Allow invariants of the same value during propagation.
+ Note, as we pass ANY_SUBST, none of the WHEN arguments will be
+ replaced to zero-filled constants (only IDENTITY_SUBST allows this).
+ Such a change for WHEN arguments would require rebuilding cmp_items.
+ */
+ Item_result tmp_cmp_type= item_cmp_type(args[first_expr_num], args[i]);
+ new_item= args[i]->propagate_equal_fields(thd,
+ Context(
+ ANY_SUBST,
+ tmp_cmp_type,
+ cmp_collation.collation),
+ cond);
+ }
+ else // THEN and ELSE arguments (they are not in comparison)
+ {
+ new_item= args[i]->propagate_equal_fields(thd, Context_identity(), cond);
+ }
+ if (new_item && new_item != args[i])
+ thd->change_item_tree(&args[i], new_item);
}
+ return this;
}
@@ -3294,7 +3419,6 @@ void Item_func_coalesce::fix_length_and_dec()
break;
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0);
}
}
@@ -3487,9 +3611,15 @@ uchar *in_string::get_value(Item *item)
return (uchar*) item->val_str(&tmp);
}
-in_row::in_row(uint elements, Item * item)
+Item *in_string::create_item(THD *thd)
{
- base= (char*) new cmp_item_row[count= elements];
+ return new (thd->mem_root) Item_string_for_in_vector(thd, collation);
+}
+
+
+in_row::in_row(THD *thd, uint elements, Item * item)
+{
+ base= (char*) new (thd->mem_root) cmp_item_row[count= elements];
size= sizeof(cmp_item_row);
compare= (qsort2_cmp) cmp_row;
/*
@@ -3518,7 +3648,7 @@ void in_row::set(uint pos, Item *item)
{
DBUG_ENTER("in_row::set");
DBUG_PRINT("enter", ("pos: %u item: 0x%lx", pos, (ulong) item));
- ((cmp_item_row*) base)[pos].store_value_by_template(&tmp, item);
+ ((cmp_item_row*) base)[pos].store_value_by_template(current_thd, &tmp, item);
DBUG_VOID_RETURN;
}
@@ -3543,13 +3673,21 @@ uchar *in_longlong::get_value(Item *item)
return (uchar*) &tmp;
}
+Item *in_longlong::create_item(THD *thd)
+{
+ /*
+ We're created a signed INT, this may not be correct in
+ general case (see BUG#19342).
+ */
+ return new (thd->mem_root) Item_int(thd, (longlong)0);
+}
+
+
void in_datetime::set(uint pos,Item *item)
{
- Item **tmp_item= &item;
- bool is_null;
struct packed_longlong *buff= &((packed_longlong*) base)[pos];
- buff->val= get_datetime_value(thd, &tmp_item, 0, warn_item, &is_null);
+ buff->val= item->val_temporal_packed(warn_item);
buff->unsigned_flag= 1L;
}
@@ -3557,13 +3695,21 @@ uchar *in_datetime::get_value(Item *item)
{
bool is_null;
Item **tmp_item= lval_cache ? &lval_cache : &item;
- tmp.val= get_datetime_value(thd, &tmp_item, &lval_cache, warn_item, &is_null);
+ enum_field_types f_type=
+ tmp_item[0]->field_type_for_temporal_comparison(warn_item);
+ tmp.val= get_datetime_value(thd, &tmp_item, &lval_cache, f_type, &is_null);
if (item->null_value)
return 0;
tmp.unsigned_flag= 1L;
return (uchar*) &tmp;
}
+Item *in_datetime::create_item(THD *thd)
+{
+ return new (thd->mem_root) Item_datetime(thd);
+}
+
+
in_double::in_double(uint elements)
:in_vector(elements,sizeof(double),(qsort2_cmp) cmp_double, 0)
{}
@@ -3581,6 +3727,11 @@ uchar *in_double::get_value(Item *item)
return (uchar*) &tmp;
}
+Item *in_double::create_item(THD *thd)
+{
+ return new (thd->mem_root) Item_float(thd, 0.0, 0);
+}
+
in_decimal::in_decimal(uint elements)
:in_vector(elements, sizeof(my_decimal),(qsort2_cmp) cmp_decimal, 0)
@@ -3608,6 +3759,11 @@ uchar *in_decimal::get_value(Item *item)
return (uchar *)result;
}
+Item *in_decimal::create_item(THD *thd)
+{
+ return new (thd->mem_root) Item_decimal(thd, 0, FALSE);
+}
+
cmp_item* cmp_item::get_comparator(Item_result type, Item *warn_item,
CHARSET_INFO *cs)
@@ -3626,9 +3782,6 @@ cmp_item* cmp_item::get_comparator(Item_result type, Item *warn_item,
case TIME_RESULT:
DBUG_ASSERT(warn_item);
return new cmp_item_datetime(warn_item);
- case IMPOSSIBLE_RESULT:
- DBUG_ASSERT(0);
- break;
}
return 0; // to satisfy compiler :)
}
@@ -3705,7 +3858,7 @@ void cmp_item_row::store_value(Item *item)
}
-void cmp_item_row::store_value_by_template(cmp_item *t, Item *item)
+void cmp_item_row::store_value_by_template(THD *thd, cmp_item *t, Item *item)
{
cmp_item_row *tmpl= (cmp_item_row*) t;
if (tmpl->n != item->cols())
@@ -3714,7 +3867,7 @@ void cmp_item_row::store_value_by_template(cmp_item *t, Item *item)
return;
}
n= tmpl->n;
- if ((comparators= (cmp_item **) sql_alloc(sizeof(cmp_item *)*n)))
+ if ((comparators= (cmp_item **) thd->alloc(sizeof(cmp_item *)*n)))
{
item->bring_value();
item->null_value= 0;
@@ -3722,7 +3875,7 @@ void cmp_item_row::store_value_by_template(cmp_item *t, Item *item)
{
if (!(comparators[i]= tmpl->comparators[i]->make_same()))
break; // new failed
- comparators[i]->store_value_by_template(tmpl->comparators[i],
+ comparators[i]->store_value_by_template(thd, tmpl->comparators[i],
item->element_index(i));
item->null_value|= item->element_index(i)->null_value;
}
@@ -3801,16 +3954,15 @@ void cmp_item_datetime::store_value(Item *item)
{
bool is_null;
Item **tmp_item= lval_cache ? &lval_cache : &item;
- value= get_datetime_value(thd, &tmp_item, &lval_cache, warn_item, &is_null);
+ enum_field_types f_type=
+ tmp_item[0]->field_type_for_temporal_comparison(warn_item);
+ value= get_datetime_value(thd, &tmp_item, &lval_cache, f_type, &is_null);
}
int cmp_item_datetime::cmp(Item *arg)
{
- bool is_null;
- Item **tmp_item= &arg;
- return value !=
- get_datetime_value(thd, &tmp_item, 0, warn_item, &is_null);
+ return value != arg->val_temporal_packed(warn_item);
}
@@ -3827,6 +3979,13 @@ cmp_item *cmp_item_datetime::make_same()
}
+bool Item_func_in::count_sargable_conds(uchar *arg)
+{
+ ((SELECT_LEX*) arg)->cond_count++;
+ return 0;
+}
+
+
bool Item_func_in::nulls_in_row()
{
Item **arg,**arg_end;
@@ -3923,8 +4082,8 @@ void Item_func_in::fix_length_and_dec()
Item *date_arg= 0;
uint found_types= 0;
uint type_cnt= 0, i;
- Item_result cmp_type= STRING_RESULT;
- left_result_type= args[0]->cmp_type();
+ m_compare_type= STRING_RESULT;
+ left_cmp_type= args[0]->cmp_type();
if (!(found_types= collect_cmp_types(args, arg_count, true)))
return;
@@ -3941,30 +4100,30 @@ void Item_func_in::fix_length_and_dec()
if (found_types & (1U << i))
{
(type_cnt)++;
- cmp_type= (Item_result) i;
+ m_compare_type= (Item_result) i;
}
}
if (type_cnt == 1)
{
- if (cmp_type == STRING_RESULT &&
+ if (m_compare_type == STRING_RESULT &&
agg_arg_charsets_for_comparison(cmp_collation, args, arg_count))
return;
arg_types_compatible= TRUE;
- if (cmp_type == ROW_RESULT)
+ if (m_compare_type == ROW_RESULT)
{
uint cols= args[0]->cols();
cmp_item_row *cmp= 0;
if (const_itm && !nulls_in_row())
{
- array= new in_row(arg_count-1, 0);
+ array= new (thd->mem_root) in_row(thd, arg_count-1, 0);
cmp= &((in_row*)array)->tmp;
}
else
{
- if (!(cmp= new cmp_item_row))
+ if (!(cmp= new (thd->mem_root) cmp_item_row))
return;
cmp_items[ROW_RESULT]= cmp;
}
@@ -3981,7 +4140,7 @@ void Item_func_in::fix_length_and_dec()
cmp= ((in_row*)array)->tmp.comparators + col;
else
cmp= ((cmp_item_row*)cmp_items[ROW_RESULT])->comparators + col;
- *cmp= new cmp_item_datetime(date_arg);
+ *cmp= new (thd->mem_root) cmp_item_datetime(date_arg);
}
}
}
@@ -4002,7 +4161,7 @@ void Item_func_in::fix_length_and_dec()
See the comment about the similar block in Item_bool_func2
*/
if (args[0]->real_item()->type() == FIELD_ITEM &&
- !thd->lex->is_view_context_analysis() && cmp_type != INT_RESULT)
+ !thd->lex->is_view_context_analysis() && m_compare_type != INT_RESULT)
{
Item_field *field_item= (Item_field*) (args[0]->real_item());
if (field_item->field_type() == MYSQL_TYPE_LONGLONG ||
@@ -4015,19 +4174,19 @@ void Item_func_in::fix_length_and_dec()
all_converted= FALSE;
}
if (all_converted)
- cmp_type= INT_RESULT;
+ m_compare_type= INT_RESULT;
}
}
- switch (cmp_type) {
+ switch (m_compare_type) {
case STRING_RESULT:
- array=new in_string(arg_count-1,(qsort2_cmp) srtcmp_in,
- cmp_collation.collation);
+ array=new (thd->mem_root) in_string(arg_count-1,(qsort2_cmp) srtcmp_in,
+ cmp_collation.collation);
break;
case INT_RESULT:
- array= new in_longlong(arg_count-1);
+ array= new (thd->mem_root) in_longlong(arg_count-1);
break;
case REAL_RESULT:
- array= new in_double(arg_count-1);
+ array= new (thd->mem_root) in_double(arg_count-1);
break;
case ROW_RESULT:
/*
@@ -4038,14 +4197,11 @@ void Item_func_in::fix_length_and_dec()
((in_row*)array)->tmp.store_value(args[0]);
break;
case DECIMAL_RESULT:
- array= new in_decimal(arg_count - 1);
+ array= new (thd->mem_root) in_decimal(arg_count - 1);
break;
case TIME_RESULT:
date_arg= find_date_time_item(args, arg_count, 0);
- array= new in_datetime(date_arg, arg_count - 1);
- break;
- case IMPOSSIBLE_RESULT:
- DBUG_ASSERT(0);
+ array= new (thd->mem_root) in_datetime(date_arg, arg_count - 1);
break;
}
if (array && !(thd->is_fatal_error)) // If not EOM
@@ -4081,16 +4237,6 @@ void Item_func_in::fix_length_and_dec()
}
}
}
- /*
- Set cmp_context of all arguments. This prevents
- Item_field::equal_fields_propagator() from transforming a zerofill integer
- argument into a string constant. Such a change would require rebuilding
- cmp_itmes.
- */
- for (arg= args + 1, arg_end= args + arg_count; arg != arg_end ; arg++)
- {
- arg[0]->cmp_context= item_cmp_type(left_result_type, arg[0]->result_type());
- }
max_length= 1;
}
@@ -4155,7 +4301,7 @@ longlong Item_func_in::val_int()
have_null= TRUE;
continue;
}
- Item_result cmp_type= item_cmp_type(left_result_type, args[i]->cmp_type());
+ Item_result cmp_type= item_cmp_type(left_cmp_type, args[i]);
in_item= cmp_items[(uint)cmp_type];
DBUG_ASSERT(in_item);
if (!(value_added_map & (1U << (uint)cmp_type)))
@@ -4225,11 +4371,28 @@ Item_cond::Item_cond(THD *thd, Item_cond *item)
}
+Item_cond::Item_cond(THD *thd, Item *i1, Item *i2):
+ Item_bool_func(thd), abort_on_null(0)
+{
+ list.push_back(i1, thd->mem_root);
+ list.push_back(i2, thd->mem_root);
+}
+
+
+Item *Item_cond_and::copy_andor_structure(THD *thd)
+{
+ Item_cond_and *item;
+ if ((item= new (thd->mem_root) Item_cond_and(thd, this)))
+ item->copy_andor_arguments(thd, this);
+ return item;
+}
+
+
void Item_cond::copy_andor_arguments(THD *thd, Item_cond *item)
{
List_iterator_fast<Item> li(item->list);
while (Item *it= li++)
- list.push_back(it->copy_andor_structure(thd));
+ list.push_back(it->copy_andor_structure(thd), thd->mem_root);
}
@@ -4289,7 +4452,7 @@ Item_cond::fix_fields(THD *thd, Item **ref)
Query_arena backup, *arena;
Item *new_item;
arena= thd->activate_stmt_arena_if_needed(&backup);
- if ((new_item= new Item_func_ne(item, new Item_int(0, 1))))
+ if ((new_item= new (thd->mem_root) Item_func_ne(thd, item, new (thd->mem_root) Item_int(thd, 0, 1))))
li.replace(item= new_item);
if (arena)
thd->restore_active_arena(arena, &backup);
@@ -4337,7 +4500,6 @@ Item_cond::fix_fields(THD *thd, Item **ref)
if (item->maybe_null)
maybe_null=1;
}
- thd->lex->current_select->cond_count+= list.elements;
fix_length_and_dec();
fixed= 1;
return FALSE;
@@ -4455,15 +4617,15 @@ bool Item_cond_and::walk_top_and(Item_processor processor, uchar *arg)
Item returned as the result of transformation of the root node
*/
-Item *Item_cond::transform(Item_transformer transformer, uchar *arg)
+Item *Item_cond::transform(THD *thd, Item_transformer transformer, uchar *arg)
{
- DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
+ DBUG_ASSERT(!thd->stmt_arena->is_stmt_prepare());
List_iterator<Item> li(list);
Item *item;
while ((item= li++))
{
- Item *new_item= item->transform(transformer, arg);
+ Item *new_item= item->transform(thd, transformer, arg);
if (!new_item)
return 0;
@@ -4474,9 +4636,9 @@ Item *Item_cond::transform(Item_transformer transformer, uchar *arg)
change records at each execution.
*/
if (new_item != item)
- current_thd->change_item_tree(li.ref(), new_item);
+ thd->change_item_tree(li.ref(), new_item);
}
- return Item_func::transform(transformer, arg);
+ return Item_func::transform(thd, transformer, arg);
}
@@ -4504,7 +4666,7 @@ Item *Item_cond::transform(Item_transformer transformer, uchar *arg)
Item returned as the result of transformation of the root node
*/
-Item *Item_cond::compile(Item_analyzer analyzer, uchar **arg_p,
+Item *Item_cond::compile(THD *thd, Item_analyzer analyzer, uchar **arg_p,
Item_transformer transformer, uchar *arg_t)
{
if (!(this->*analyzer)(arg_p))
@@ -4519,11 +4681,34 @@ Item *Item_cond::compile(Item_analyzer analyzer, uchar **arg_p,
to analyze any argument of the condition formula.
*/
uchar *arg_v= *arg_p;
- Item *new_item= item->compile(analyzer, &arg_v, transformer, arg_t);
+ Item *new_item= item->compile(thd, analyzer, &arg_v, transformer, arg_t);
+ if (new_item && new_item != item)
+ thd->change_item_tree(li.ref(), new_item);
+ }
+ return Item_func::transform(thd, transformer, arg_t);
+}
+
+
+Item *Item_cond::propagate_equal_fields(THD *thd,
+ const Context &ctx,
+ COND_EQUAL *cond)
+{
+ DBUG_ASSERT(!thd->stmt_arena->is_stmt_prepare());
+ DBUG_ASSERT(arg_count == 0);
+ List_iterator<Item> li(list);
+ Item *item;
+ while ((item= li++))
+ {
+ /*
+ The exact value of the second parameter to propagate_equal_fields()
+ is not important at this point. Item_func derivants will create and
+ pass their own context to the arguments.
+ */
+ Item *new_item= item->propagate_equal_fields(thd, Context_boolean(), cond);
if (new_item && new_item != item)
- current_thd->change_item_tree(li.ref(), new_item);
+ thd->change_item_tree(li.ref(), new_item);
}
- return Item_func::transform(transformer, arg_t);
+ return this;
}
void Item_cond::traverse_cond(Cond_traverser traverser,
@@ -4568,12 +4753,13 @@ void Item_cond::traverse_cond(Cond_traverser traverser,
*/
void Item_cond::split_sum_func(THD *thd, Item **ref_pointer_array,
- List<Item> &fields)
+ List<Item> &fields, uint flags)
{
List_iterator<Item> li(list);
Item *item;
while ((item= li++))
- item->split_sum_func2(thd, ref_pointer_array, fields, li.ref(), TRUE);
+ item->split_sum_func2(thd, ref_pointer_array, fields, li.ref(),
+ flags | SPLIT_SUM_SKIP_REGISTERED);
}
@@ -4611,7 +4797,7 @@ void Item_cond::neg_arguments(THD *thd)
Item *new_item= item->neg_transformer(thd);
if (!new_item)
{
- if (!(new_item= new Item_func_not(item)))
+ if (!(new_item= new (thd->mem_root) Item_func_not(thd, item)))
return; // Fatal OEM error
}
(void) li.replace(new_item);
@@ -4629,7 +4815,6 @@ void Item_cond_and::mark_as_condition_AND_part(TABLE_LIST *embedding)
}
}
-
/**
Evaluation of AND(expr, expr, expr ...).
@@ -4687,6 +4872,15 @@ longlong Item_cond_or::val_int()
return 0;
}
+Item *Item_cond_or::copy_andor_structure(THD *thd)
+{
+ Item_cond_or *item;
+ if ((item= new (thd->mem_root) Item_cond_or(thd, this)))
+ item->copy_andor_arguments(thd, this);
+ return item;
+}
+
+
/**
Create an AND expression from two expressions.
@@ -4707,21 +4901,21 @@ longlong Item_cond_or::val_int()
Item
*/
-Item *and_expressions(Item *a, Item *b, Item **org_item)
+Item *and_expressions(THD *thd, Item *a, Item *b, Item **org_item)
{
if (!a)
return (*org_item= (Item*) b);
if (a == *org_item)
{
Item_cond *res;
- if ((res= new Item_cond_and(a, (Item*) b)))
+ if ((res= new (thd->mem_root) Item_cond_and(thd, a, (Item*) b)))
{
res->used_tables_cache= a->used_tables() | b->used_tables();
res->not_null_tables_cache= a->not_null_tables() | b->not_null_tables();
}
return res;
}
- if (((Item_cond_and*) a)->add((Item*) b))
+ if (((Item_cond_and*) a)->add((Item*) b, thd->mem_root))
return 0;
((Item_cond_and*) a)->used_tables_cache|= b->used_tables();
((Item_cond_and*) a)->not_null_tables_cache|= b->not_null_tables();
@@ -4729,6 +4923,13 @@ Item *and_expressions(Item *a, Item *b, Item **org_item)
}
+bool Item_func_null_predicate::count_sargable_conds(uchar *arg)
+{
+ ((SELECT_LEX*) arg)->cond_count++;
+ return 0;
+}
+
+
longlong Item_func_isnull::val_int()
{
DBUG_ASSERT(fixed == 1);
@@ -4781,6 +4982,13 @@ void Item_func_isnotnull::print(String *str, enum_query_type query_type)
}
+bool Item_bool_func2::count_sargable_conds(uchar *arg)
+{
+ ((SELECT_LEX*) arg)->cond_count++;
+ return 0;
+}
+
+
longlong Item_func_like::val_int()
{
DBUG_ASSERT(fixed == 1);
@@ -4810,22 +5018,21 @@ longlong Item_func_like::val_int()
We can optimize a where if first character isn't a wildcard
*/
-Item_func::optimize_type Item_func_like::select_optimize() const
+bool Item_func_like::with_sargable_pattern() const
{
if (!args[1]->const_item() || args[1]->is_expensive())
- return OPTIMIZE_NONE;
+ return false;
String* res2= args[1]->val_str((String *) &cmp_value2);
if (!res2)
- return OPTIMIZE_NONE;
+ return false;
if (!res2->length()) // Can optimize empty wildcard: column LIKE ''
- return OPTIMIZE_OP;
+ return true;
DBUG_ASSERT(res2->ptr());
char first= res2->ptr()[0];
- return (first == wild_many || first == wild_one) ?
- OPTIMIZE_NONE : OPTIMIZE_OP;
+ return first != wild_many && first != wild_one;
}
@@ -4955,16 +5162,18 @@ bool Item_func_like::find_selective_predicates_list_processor(uchar *arg)
(find_selective_predicates_list_processor_data *) arg;
if (use_sampling && used_tables() == data->table->map)
{
- COND_STATISTIC *stat= (COND_STATISTIC *)sql_alloc(sizeof(COND_STATISTIC));
- if (!stat)
+ THD *thd= data->table->in_use;
+ COND_STATISTIC *stat;
+ Item *arg0;
+ if (!(stat= (COND_STATISTIC *) thd->alloc(sizeof(COND_STATISTIC))))
return TRUE;
stat->cond= this;
- Item *arg0= args[0]->real_item();
+ arg0= args[0]->real_item();
if (args[1]->const_item() && arg0->type() == FIELD_ITEM)
stat->field_arg= ((Item_field *)arg0)->field;
else
stat->field_arg= NULL;
- data->list.push_back(stat);
+ data->list.push_back(stat, thd->mem_root);
}
return FALSE;
}
@@ -5051,10 +5260,67 @@ bool Regexp_processor_pcre::compile(Item *item, bool send_error)
}
+/**
+ Send a warning explaining an error code returned by pcre_exec().
+*/
+void Regexp_processor_pcre::pcre_exec_warn(int rc) const
+{
+ char buf[64];
+ const char *errmsg= NULL;
+ THD *thd= current_thd;
+
+ /*
+ Make a descriptive message only for those pcre_exec() error codes
+ that can actually happen in MariaDB.
+ */
+ switch (rc)
+ {
+ case PCRE_ERROR_NOMEMORY:
+ errmsg= "pcre_exec: Out of memory";
+ break;
+ case PCRE_ERROR_BADUTF8:
+ errmsg= "pcre_exec: Invalid utf8 byte sequence in the subject string";
+ break;
+ case PCRE_ERROR_RECURSELOOP:
+ errmsg= "pcre_exec: Recursion loop detected";
+ break;
+ default:
+ /*
+ As other error codes should normally not happen,
+ we just report the error code without textual description
+ of the code.
+ */
+ my_snprintf(buf, sizeof(buf), "pcre_exec: Internal error (%d)", rc);
+ errmsg= buf;
+ }
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_REGEXP_ERROR, ER_THD(thd, ER_REGEXP_ERROR), errmsg);
+}
+
+
+/**
+ Call pcre_exec() and send a warning if pcre_exec() returned with an error.
+*/
+int Regexp_processor_pcre::pcre_exec_with_warn(const pcre *code,
+ const pcre_extra *extra,
+ const char *subject,
+ int length, int startoffset,
+ int options, int *ovector,
+ int ovecsize)
+{
+ int rc= pcre_exec(code, extra, subject, length,
+ startoffset, options, ovector, ovecsize);
+ DBUG_EXECUTE_IF("pcre_exec_error_123", rc= -123;);
+ if (rc < PCRE_ERROR_NOMATCH)
+ pcre_exec_warn(rc);
+ return rc;
+}
+
+
bool Regexp_processor_pcre::exec(const char *str, int length, int offset)
{
- m_pcre_exec_rc= pcre_exec(m_pcre, NULL, str, length,
- offset, 0, m_SubStrVec, m_subpatterns_needed * 3);
+ m_pcre_exec_rc= pcre_exec_with_warn(m_pcre, NULL, str, length, offset, 0,
+ m_SubStrVec, m_subpatterns_needed * 3);
return false;
}
@@ -5064,8 +5330,10 @@ bool Regexp_processor_pcre::exec(String *str, int offset,
{
if (!(str= convert_if_needed(str, &subject_converter)))
return true;
- m_pcre_exec_rc= pcre_exec(m_pcre, NULL, str->c_ptr_safe(), str->length(),
- offset, 0, m_SubStrVec, m_subpatterns_needed * 3);
+ m_pcre_exec_rc= pcre_exec_with_warn(m_pcre, NULL,
+ str->c_ptr_safe(), str->length(),
+ offset, 0,
+ m_SubStrVec, m_subpatterns_needed * 3);
if (m_pcre_exec_rc > 0)
{
uint i;
@@ -5460,7 +5728,7 @@ bool Item_func_not::fix_fields(THD *thd, Item **ref)
Item *new_item;
bool rc= TRUE;
arena= thd->activate_stmt_arena_if_needed(&backup);
- if ((new_item= new Item_func_eq(args[0], new Item_int(0, 1))))
+ if ((new_item= new (thd->mem_root) Item_func_eq(thd, args[0], new (thd->mem_root) Item_int(thd, 0, 1))))
{
new_item->name= name;
rc= (*ref= new_item)->fix_fields(thd, ref);
@@ -5475,7 +5743,7 @@ bool Item_func_not::fix_fields(THD *thd, Item **ref)
Item *Item_bool_rowready_func2::neg_transformer(THD *thd)
{
- Item *item= negated_item();
+ Item *item= negated_item(thd);
return item;
}
@@ -5494,14 +5762,14 @@ Item *Item_func_xor::neg_transformer(THD *thd)
Item_func_xor *new_item;
if ((neg_operand= args[0]->neg_transformer(thd)))
// args[0] has neg_tranformer
- new_item= new(thd->mem_root) Item_func_xor(neg_operand, args[1]);
+ new_item= new(thd->mem_root) Item_func_xor(thd, neg_operand, args[1]);
else if ((neg_operand= args[1]->neg_transformer(thd)))
// args[1] has neg_tranformer
- new_item= new(thd->mem_root) Item_func_xor(args[0], neg_operand);
+ new_item= new(thd->mem_root) Item_func_xor(thd, args[0], neg_operand);
else
{
- neg_operand= new(thd->mem_root) Item_func_not(args[0]);
- new_item= new(thd->mem_root) Item_func_xor(neg_operand, args[1]);
+ neg_operand= new(thd->mem_root) Item_func_not(thd, args[0]);
+ new_item= new(thd->mem_root) Item_func_xor(thd, neg_operand, args[1]);
}
return new_item;
}
@@ -5512,7 +5780,7 @@ Item *Item_func_xor::neg_transformer(THD *thd)
*/
Item *Item_func_isnull::neg_transformer(THD *thd)
{
- Item *item= new Item_func_isnotnull(args[0]);
+ Item *item= new (thd->mem_root) Item_func_isnotnull(thd, args[0]);
return item;
}
@@ -5522,7 +5790,7 @@ Item *Item_func_isnull::neg_transformer(THD *thd)
*/
Item *Item_func_isnotnull::neg_transformer(THD *thd)
{
- Item *item= new Item_func_isnull(args[0]);
+ Item *item= new (thd->mem_root) Item_func_isnull(thd, args[0]);
return item;
}
@@ -5531,7 +5799,7 @@ Item *Item_cond_and::neg_transformer(THD *thd) /* NOT(a AND b AND ...) -> */
/* NOT a OR NOT b OR ... */
{
neg_arguments(thd);
- Item *item= new Item_cond_or(list);
+ Item *item= new (thd->mem_root) Item_cond_or(thd, list);
return item;
}
@@ -5540,7 +5808,7 @@ Item *Item_cond_or::neg_transformer(THD *thd) /* NOT(a OR b OR ...) -> */
/* NOT a AND NOT b AND ... */
{
neg_arguments(thd);
- Item *item= new Item_cond_and(list);
+ Item *item= new (thd->mem_root) Item_cond_and(thd, list);
return item;
}
@@ -5548,7 +5816,7 @@ Item *Item_cond_or::neg_transformer(THD *thd) /* NOT(a OR b OR ...) -> */
Item *Item_func_nop_all::neg_transformer(THD *thd)
{
/* "NOT (e $cmp$ ANY (SELECT ...)) -> e $rev_cmp$" ALL (SELECT ...) */
- Item_func_not_all *new_item= new Item_func_not_all(args[0]);
+ Item_func_not_all *new_item= new (thd->mem_root) Item_func_not_all(thd, args[0]);
Item_allany_subselect *allany= (Item_allany_subselect*)args[0];
allany->create_comp_func(FALSE);
allany->all= !allany->all;
@@ -5559,7 +5827,7 @@ Item *Item_func_nop_all::neg_transformer(THD *thd)
Item *Item_func_not_all::neg_transformer(THD *thd)
{
/* "NOT (e $cmp$ ALL (SELECT ...)) -> e $rev_cmp$" ANY (SELECT ...) */
- Item_func_nop_all *new_item= new Item_func_nop_all(args[0]);
+ Item_func_nop_all *new_item= new (thd->mem_root) Item_func_nop_all(thd, args[0]);
Item_allany_subselect *allany= (Item_allany_subselect*)args[0];
allany->all= !allany->all;
allany->create_comp_func(TRUE);
@@ -5567,45 +5835,45 @@ Item *Item_func_not_all::neg_transformer(THD *thd)
return new_item;
}
-Item *Item_func_eq::negated_item() /* a = b -> a != b */
+Item *Item_func_eq::negated_item(THD *thd) /* a = b -> a != b */
{
- return new Item_func_ne(args[0], args[1]);
+ return new (thd->mem_root) Item_func_ne(thd, args[0], args[1]);
}
-Item *Item_func_ne::negated_item() /* a != b -> a = b */
+Item *Item_func_ne::negated_item(THD *thd) /* a != b -> a = b */
{
- return new Item_func_eq(args[0], args[1]);
+ return new (thd->mem_root) Item_func_eq(thd, args[0], args[1]);
}
-Item *Item_func_lt::negated_item() /* a < b -> a >= b */
+Item *Item_func_lt::negated_item(THD *thd) /* a < b -> a >= b */
{
- return new Item_func_ge(args[0], args[1]);
+ return new (thd->mem_root) Item_func_ge(thd, args[0], args[1]);
}
-Item *Item_func_ge::negated_item() /* a >= b -> a < b */
+Item *Item_func_ge::negated_item(THD *thd) /* a >= b -> a < b */
{
- return new Item_func_lt(args[0], args[1]);
+ return new (thd->mem_root) Item_func_lt(thd, args[0], args[1]);
}
-Item *Item_func_gt::negated_item() /* a > b -> a <= b */
+Item *Item_func_gt::negated_item(THD *thd) /* a > b -> a <= b */
{
- return new Item_func_le(args[0], args[1]);
+ return new (thd->mem_root) Item_func_le(thd, args[0], args[1]);
}
-Item *Item_func_le::negated_item() /* a <= b -> a > b */
+Item *Item_func_le::negated_item(THD *thd) /* a <= b -> a > b */
{
- return new Item_func_gt(args[0], args[1]);
+ return new (thd->mem_root) Item_func_gt(thd, args[0], args[1]);
}
/**
just fake method, should never be called.
*/
-Item *Item_bool_rowready_func2::negated_item()
+Item *Item_bool_rowready_func2::negated_item(THD *thd)
{
DBUG_ASSERT(0);
return 0;
@@ -5628,17 +5896,17 @@ Item *Item_bool_rowready_func2::negated_item()
of the type Item_field or Item_direct_view_ref(Item_field).
*/
-Item_equal::Item_equal(Item *f1, Item *f2, bool with_const_item)
- : Item_bool_func(), eval_item(0), cond_false(0), cond_true(0),
- context_field(NULL), link_equal_fields(FALSE)
+Item_equal::Item_equal(THD *thd, Item *f1, Item *f2, bool with_const_item):
+ Item_bool_func(thd), eval_item(0), cond_false(0), cond_true(0),
+ context_field(NULL), link_equal_fields(FALSE),
+ m_compare_type(item_cmp_type(f1, f2)),
+ m_compare_collation(f2->collation.collation)
{
const_item_cache= 0;
with_const= with_const_item;
- equal_items.push_back(f1);
- equal_items.push_back(f2);
- compare_as_dates= with_const_item && f2->cmp_type() == TIME_RESULT;
+ equal_items.push_back(f1, thd->mem_root);
+ equal_items.push_back(f2, thd->mem_root);
upper_levels= NULL;
- sargable= TRUE;
}
@@ -5654,22 +5922,22 @@ Item_equal::Item_equal(Item *f1, Item *f2, bool with_const_item)
outer join).
*/
-Item_equal::Item_equal(Item_equal *item_equal)
- : Item_bool_func(), eval_item(0), cond_false(0), cond_true(0),
- context_field(NULL), link_equal_fields(FALSE)
+Item_equal::Item_equal(THD *thd, Item_equal *item_equal):
+ Item_bool_func(thd), eval_item(0), cond_false(0), cond_true(0),
+ context_field(NULL), link_equal_fields(FALSE),
+ m_compare_type(item_equal->m_compare_type),
+ m_compare_collation(item_equal->m_compare_collation)
{
const_item_cache= 0;
List_iterator_fast<Item> li(item_equal->equal_items);
Item *item;
while ((item= li++))
{
- equal_items.push_back(item);
+ equal_items.push_back(item, thd->mem_root);
}
with_const= item_equal->with_const;
- compare_as_dates= item_equal->compare_as_dates;
cond_false= item_equal->cond_false;
upper_levels= item_equal->upper_levels;
- sargable= TRUE;
}
@@ -5687,41 +5955,87 @@ Item_equal::Item_equal(Item_equal *item_equal)
the list. Otherwise the value of c is compared with the value of the
constant item from equal_items. If they are not equal cond_false is set
to TRUE. This serves as an indicator that this Item_equal is always FALSE.
- The optional parameter f is used to adjust the flag compare_as_dates.
*/
-void Item_equal::add_const(THD *thd, Item *c, Item *f)
+void Item_equal::add_const(THD *thd, Item *c)
{
if (cond_false)
return;
if (!with_const)
{
with_const= TRUE;
- if (f)
- compare_as_dates= f->cmp_type() == TIME_RESULT;
- equal_items.push_front(c);
+ equal_items.push_front(c, thd->mem_root);
return;
}
Item *const_item= get_const();
- if (compare_as_dates)
- {
- cmp.set_datetime_cmp_func(this, &c, &const_item);
- cond_false= cmp.compare();
- }
- else
- {
- Item_func_eq *func= new (thd->mem_root) Item_func_eq(c, const_item);
- if (func->set_cmp_func())
+ switch (Item_equal::compare_type()) {
+ case TIME_RESULT:
+ {
+ enum_field_types f_type= context_field->field_type();
+ longlong value0= c->val_temporal_packed(f_type);
+ longlong value1= const_item->val_temporal_packed(f_type);
+ cond_false= c->null_value || const_item->null_value || value0 != value1;
+ break;
+ }
+ case STRING_RESULT:
{
+ String *str1, *str2;
/*
- Setting a comparison function fails when trying to compare
- incompatible charsets. Charset compatibility is checked earlier,
- except for constant subqueries where we may do it here.
+ Suppose we have an expression (with a string type field) like this:
+ WHERE field=const1 AND field=const2 ...
+
+ For all pairs field=constXXX we know that:
+
+ - Item_func_eq::fix_length_and_dec() performed collation and character
+ set aggregation and added character set converters when needed.
+ Note, the case like:
+ WHERE field=const1 COLLATE latin1_bin AND field=const2
+ is not handled here, because the field would be replaced to
+ Item_func_set_collation, which cannot get into Item_equal.
+ So all constXXX that are handled by Item_equal
+ already have compatible character sets with "field".
+
+ - Also, Field_str::test_if_equality_guarantees_uniqueness() guarantees
+ that the comparison collation of all equalities handled by Item_equal
+ match the the collation of the field.
+
+ Therefore, at Item_equal::add_const() time all constants constXXX
+ should be directly comparable to each other without an additional
+ character set conversion.
+ It's safe to do val_str() for "const_item" and "c" and compare
+ them according to the collation of the *field*.
+
+ So in a script like this:
+ CREATE TABLE t1 (a VARCHAR(10) COLLATE xxx);
+ INSERT INTO t1 VALUES ('a'),('A');
+ SELECT * FROM t1 WHERE a='a' AND a='A';
+ Item_equal::add_const() effectively rewrites the condition to:
+ SELECT * FROM t1 WHERE a='a' AND 'a' COLLATE xxx='A';
+ and then to:
+ SELECT * FROM t1 WHERE a='a'; // if the two constants were equal
+ // e.g. in case of latin1_swedish_ci
+ or to:
+ SELECT * FROM t1 WHERE FALSE; // if the two constants were not equal
+ // e.g. in case of latin1_bin
+
+ Note, both "const_item" and "c" can return NULL, e.g.:
+ SELECT * FROM t1 WHERE a=NULL AND a='const';
+ SELECT * FROM t1 WHERE a='const' AND a=NULL;
+ SELECT * FROM t1 WHERE a='const' AND a=(SELECT MAX(a) FROM t2)
*/
- return;
+ cond_false= !(str1= const_item->val_str(&cmp_value1)) ||
+ !(str2= c->val_str(&cmp_value2)) ||
+ !str1->eq(str2, compare_collation());
+ break;
+ }
+ default:
+ {
+ Item_func_eq *func= new (thd->mem_root) Item_func_eq(thd, c, const_item);
+ if (func->set_cmp_func())
+ return;
+ func->quick_fix_field();
+ cond_false= !func->val_int();
}
- func->quick_fix_field();
- cond_false= !func->val_int();
}
if (with_const && equal_items.elements == 1)
cond_true= TRUE;
@@ -5854,7 +6168,7 @@ bool Item_equal::merge_with_check(THD *thd, Item_equal *item, bool save_merged)
while ((item= fi++))
{
if (!contains(fi.get_curr_field()))
- add(item);
+ add(item, thd->mem_root);
}
}
}
@@ -5904,7 +6218,7 @@ void Item_equal::merge_into_list(THD *thd, List<Item_equal> *list,
}
}
if (!only_intersected && !merge_into)
- list->push_back(this);
+ list->push_back(this, thd->mem_root);
}
@@ -6150,15 +6464,15 @@ bool Item_equal::walk(Item_processor processor, bool walk_subquery, uchar *arg)
}
-Item *Item_equal::transform(Item_transformer transformer, uchar *arg)
+Item *Item_equal::transform(THD *thd, Item_transformer transformer, uchar *arg)
{
- DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
+ DBUG_ASSERT(!thd->stmt_arena->is_stmt_prepare());
Item *item;
Item_equal_fields_iterator it(*this);
while ((item= it++))
{
- Item *new_item= item->transform(transformer, arg);
+ Item *new_item= item->transform(thd, transformer, arg);
if (!new_item)
return 0;
@@ -6169,9 +6483,9 @@ Item *Item_equal::transform(Item_transformer transformer, uchar *arg)
change records at each execution.
*/
if (new_item != item)
- current_thd->change_item_tree((Item **) it.ref(), new_item);
+ thd->change_item_tree((Item **) it.ref(), new_item);
}
- return Item_func::transform(transformer, arg);
+ return Item_func::transform(thd, transformer, arg);
}
@@ -6198,14 +6512,6 @@ void Item_equal::print(String *str, enum_query_type query_type)
}
-CHARSET_INFO *Item_equal::compare_collation() const
-{
- Item_equal_fields_iterator it(*((Item_equal*) this));
- Item *item= it++;
- return item->collation.collation;
-}
-
-
/*
@brief Get the first equal field of multiple equality.
@param[in] field the field to get equal field to
@@ -6411,3 +6717,75 @@ null:
null_value= TRUE;
return 0;
}
+
+
+Item_bool_rowready_func2 *Eq_creator::create(THD *thd, Item *a, Item *b) const
+{
+ return new(thd->mem_root) Item_func_eq(thd, a, b);
+}
+
+
+Item_bool_rowready_func2* Eq_creator::create_swap(THD *thd, Item *a, Item *b) const
+{
+ return new(thd->mem_root) Item_func_eq(thd, b, a);
+}
+
+
+Item_bool_rowready_func2* Ne_creator::create(THD *thd, Item *a, Item *b) const
+{
+ return new(thd->mem_root) Item_func_ne(thd, a, b);
+}
+
+
+Item_bool_rowready_func2* Ne_creator::create_swap(THD *thd, Item *a, Item *b) const
+{
+ return new(thd->mem_root) Item_func_ne(thd, b, a);
+}
+
+
+Item_bool_rowready_func2* Gt_creator::create(THD *thd, Item *a, Item *b) const
+{
+ return new(thd->mem_root) Item_func_gt(thd, a, b);
+}
+
+
+Item_bool_rowready_func2* Gt_creator::create_swap(THD *thd, Item *a, Item *b) const
+{
+ return new(thd->mem_root) Item_func_lt(thd, b, a);
+}
+
+
+Item_bool_rowready_func2* Lt_creator::create(THD *thd, Item *a, Item *b) const
+{
+ return new(thd->mem_root) Item_func_lt(thd, a, b);
+}
+
+
+Item_bool_rowready_func2* Lt_creator::create_swap(THD *thd, Item *a, Item *b) const
+{
+ return new(thd->mem_root) Item_func_gt(thd, b, a);
+}
+
+
+Item_bool_rowready_func2* Ge_creator::create(THD *thd, Item *a, Item *b) const
+{
+ return new(thd->mem_root) Item_func_ge(thd, a, b);
+}
+
+
+Item_bool_rowready_func2* Ge_creator::create_swap(THD *thd, Item *a, Item *b) const
+{
+ return new(thd->mem_root) Item_func_le(thd, b, a);
+}
+
+
+Item_bool_rowready_func2* Le_creator::create(THD *thd, Item *a, Item *b) const
+{
+ return new(thd->mem_root) Item_func_le(thd, a, b);
+}
+
+
+Item_bool_rowready_func2* Le_creator::create_swap(THD *thd, Item *a, Item *b) const
+{
+ return new(thd->mem_root) Item_func_ge(thd, b, a);
+}
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index f2d0032600b..727a7267c57 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -29,6 +29,14 @@
#include "pcre.h" /* pcre header file */
extern Item_result item_cmp_type(Item_result a,Item_result b);
+inline Item_result item_cmp_type(const Item *a, const Item *b)
+{
+ return item_cmp_type(a->cmp_type(), b->cmp_type());
+}
+inline Item_result item_cmp_type(Item_result a, const Item *b)
+{
+ return item_cmp_type(a, b->cmp_type());
+}
class Item_bool_func2;
class Arg_comparator;
@@ -39,6 +47,7 @@ typedef int (*Item_field_cmpfunc)(Item *f1, Item *f2, void *arg);
class Arg_comparator: public Sql_alloc
{
Item **a, **b;
+ Item_result m_compare_type;
arg_cmp_func func;
Item_func_or_sum *owner;
bool set_null; // TRUE <=> set owner->null_value
@@ -49,35 +58,30 @@ class Arg_comparator: public Sql_alloc
Item *a_cache, *b_cache; // Cached values of a and b items
// when one of arguments is NULL.
int set_compare_func(Item_func_or_sum *owner, Item_result type);
- inline int set_compare_func(Item_func_or_sum *owner_arg)
- {
- return set_compare_func(owner_arg, item_cmp_type((*a)->result_type(),
- (*b)->result_type()));
- }
+ int set_cmp_func(Item_func_or_sum *owner_arg, Item **a1, Item **a2);
bool agg_arg_charsets_for_comparison();
+ int compare_temporal(enum_field_types type);
+ int compare_e_temporal(enum_field_types type);
+
public:
DTCollation cmp_collation;
/* Allow owner function to use string buffers. */
String value1, value2;
- Arg_comparator(): set_null(TRUE), comparators(0), thd(0),
+ Arg_comparator(): m_compare_type(STRING_RESULT),
+ set_null(TRUE), comparators(0), thd(0),
a_cache(0), b_cache(0) {};
- Arg_comparator(Item **a1, Item **a2): a(a1), b(a2), set_null(TRUE),
+ Arg_comparator(Item **a1, Item **a2): a(a1), b(a2),
+ m_compare_type(STRING_RESULT), set_null(TRUE),
comparators(0), thd(0), a_cache(0), b_cache(0) {};
-private:
- int set_cmp_func(Item_func_or_sum *owner_arg,
- Item **a1, Item **a2,
- Item_result type);
public:
inline int set_cmp_func(Item_func_or_sum *owner_arg,
Item **a1, Item **a2, bool set_null_arg)
{
set_null= set_null_arg;
- return set_cmp_func(owner_arg, a1, a2,
- item_cmp_type((*a1)->cmp_type(),
- (*a2)->cmp_type()));
+ return set_cmp_func(owner_arg, a1, a2);
}
inline int compare() { return (this->*func)(); }
@@ -99,19 +103,21 @@ public:
int compare_e_row(); // compare args[0] & args[1]
int compare_real_fixed();
int compare_e_real_fixed();
- int compare_datetime(); // compare args[0] & args[1] as DATETIMEs
- int compare_e_datetime();
+ int compare_datetime() { return compare_temporal(MYSQL_TYPE_DATETIME); }
+ int compare_e_datetime() { return compare_e_temporal(MYSQL_TYPE_DATETIME); }
+ int compare_time() { return compare_temporal(MYSQL_TYPE_TIME); }
+ int compare_e_time() { return compare_e_temporal(MYSQL_TYPE_TIME); }
Item** cache_converted_constant(THD *thd, Item **value, Item **cache,
Item_result type);
- void set_datetime_cmp_func(Item_func_or_sum *owner_arg,
- Item **a1, Item **b1);
static arg_cmp_func comparator_matrix [6][2];
inline bool is_owner_equal_func()
{
return (owner->type() == Item::FUNC_ITEM &&
((Item_func*)owner)->functype() == Item_func::EQUAL_FUNC);
}
+ Item_result compare_type() const { return m_compare_type; }
+ Arg_comparator *subcomparators() const { return comparators; }
void cleanup()
{
delete [] comparators;
@@ -120,27 +126,51 @@ public:
friend class Item_func;
};
+
+class SEL_ARG;
+struct KEY_PART;
+
class Item_bool_func :public Item_int_func
{
protected:
- void add_key_fields_optimize_op(JOIN *join, KEY_FIELD **key_fields,
- uint *and_level, table_map usable_tables,
- SARGABLE_PARAM **sargables, bool equal_func);
-public:
- Item_bool_func() :Item_int_func() {}
- Item_bool_func(Item *a) :Item_int_func(a) {}
- Item_bool_func(Item *a,Item *b) :Item_int_func(a,b) {}
- Item_bool_func(Item *a, Item *b, Item *c) :Item_int_func(a, b, c) {}
- Item_bool_func(List<Item> &list) :Item_int_func(list) { }
+ /*
+ Build a SEL_TREE for a simple predicate
+ @param param PARAM from SQL_SELECT::test_quick_select
+ @param field field in the predicate
+ @param value constant in the predicate
+ @param cmp_type compare type for the field
+ @return Pointer to the tree built tree
+ */
+ virtual SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param,
+ Field *field, Item *value,
+ Item_result cmp_type)
+ {
+ DBUG_ENTER("Item_bool_func2::get_func_mm_tree");
+ DBUG_ASSERT(0);
+ DBUG_RETURN(0);
+ }
+ SEL_TREE *get_full_func_mm_tree(RANGE_OPT_PARAM *param,
+ Item_field *field_item, Item *value);
+ SEL_TREE *get_mm_parts(RANGE_OPT_PARAM *param, Field *field,
+ Item_func::Functype type,
+ Item *value, Item_result cmp_type);
+ SEL_TREE *get_ne_mm_tree(RANGE_OPT_PARAM *param,
+ Field *field, Item *lt_value, Item *gt_value,
+ Item_result cmp_type);
+ virtual SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, Field *field,
+ KEY_PART *key_part,
+ Item_func::Functype type, Item *value);
+public:
+ Item_bool_func(THD *thd): Item_int_func(thd) {}
+ Item_bool_func(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_bool_func(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
+ Item_bool_func(THD *thd, Item *a, Item *b, Item *c): Item_int_func(thd, a, b, c) {}
+ Item_bool_func(THD *thd, List<Item> &list): Item_int_func(thd, list) { }
Item_bool_func(THD *thd, Item_bool_func *item) :Item_int_func(thd, item) {}
bool is_bool_type() { return true; }
+ virtual CHARSET_INFO *compare_collation() const { return NULL; }
void fix_length_and_dec() { decimals=0; max_length=1; }
uint decimal_precision() const { return 1; }
- virtual bool can_optimize_group_min_max(Item_field *min_max_arg_item,
- const Item *const_item) const
- {
- return false;
- }
};
@@ -158,8 +188,8 @@ public:
virtual void print(String *str, enum_query_type query_type);
protected:
- Item_func_truth(Item *a, bool a_value, bool a_affirmative)
- : Item_bool_func(a), value(a_value), affirmative(a_affirmative)
+ Item_func_truth(THD *thd, Item *a, bool a_value, bool a_affirmative):
+ Item_bool_func(thd, a), value(a_value), affirmative(a_affirmative)
{}
~Item_func_truth()
@@ -184,7 +214,7 @@ private:
class Item_func_istrue : public Item_func_truth
{
public:
- Item_func_istrue(Item *a) : Item_func_truth(a, true, true) {}
+ Item_func_istrue(THD *thd, Item *a): Item_func_truth(thd, a, true, true) {}
~Item_func_istrue() {}
virtual const char* func_name() const { return "istrue"; }
};
@@ -197,7 +227,8 @@ public:
class Item_func_isnottrue : public Item_func_truth
{
public:
- Item_func_isnottrue(Item *a) : Item_func_truth(a, true, false) {}
+ Item_func_isnottrue(THD *thd, Item *a):
+ Item_func_truth(thd, a, true, false) {}
~Item_func_isnottrue() {}
virtual const char* func_name() const { return "isnottrue"; }
};
@@ -210,7 +241,7 @@ public:
class Item_func_isfalse : public Item_func_truth
{
public:
- Item_func_isfalse(Item *a) : Item_func_truth(a, false, true) {}
+ Item_func_isfalse(THD *thd, Item *a): Item_func_truth(thd, a, false, true) {}
~Item_func_isfalse() {}
virtual const char* func_name() const { return "isfalse"; }
};
@@ -223,7 +254,8 @@ public:
class Item_func_isnotfalse : public Item_func_truth
{
public:
- Item_func_isnotfalse(Item *a) : Item_func_truth(a, false, false) {}
+ Item_func_isnotfalse(THD *thd, Item *a):
+ Item_func_truth(thd, a, false, false) {}
~Item_func_isnotfalse() {}
virtual const char* func_name() const { return "isnotfalse"; }
};
@@ -262,8 +294,8 @@ protected:
*/
int result_for_null_param;
public:
- Item_in_optimizer(Item *a, Item *b):
- Item_bool_func(a, b), cache(0), expr_cache(0),
+ Item_in_optimizer(THD *thd, Item *a, Item *b):
+ Item_bool_func(thd, a, b), cache(0), expr_cache(0),
save_cache(0), result_for_null_param(UNKNOWN)
{ with_subselect= true; }
bool fix_fields(THD *, Item **);
@@ -275,8 +307,8 @@ public:
const char *func_name() const { return "<in_optimizer>"; }
Item_cache **get_cache() { return &cache; }
void keep_top_level_cache();
- Item *transform(Item_transformer transformer, uchar *arg);
- virtual Item *expr_cache_insert_transformer(uchar *thd_arg);
+ Item *transform(THD *thd, Item_transformer transformer, uchar *arg);
+ virtual Item *expr_cache_insert_transformer(THD *thd, uchar *unused);
bool is_expensive_processor(uchar *arg);
bool is_expensive();
void set_join_tab_idx(uint join_tab_idx_arg)
@@ -289,24 +321,56 @@ public:
void reset_cache() { cache= NULL; }
};
+
+/*
+ Functions and operators with two arguments that can use range optimizer.
+*/
class Item_bool_func2 :public Item_bool_func
{ /* Bool with 2 string args */
-public:
- Item_bool_func2(Item *a,Item *b)
- :Item_bool_func(a,b) { sargable= TRUE; }
- optimize_type select_optimize() const { return OPTIMIZE_OP; }
- virtual enum Functype rev_functype() const { return UNKNOWN_FUNC; }
bool have_rev_func() const { return rev_functype() != UNKNOWN_FUNC; }
-
- virtual inline void print(String *str, enum_query_type query_type)
- {
- Item_func::print_op(str, query_type);
+protected:
+ void add_key_fields_optimize_op(JOIN *join, KEY_FIELD **key_fields,
+ uint *and_level, table_map usable_tables,
+ SARGABLE_PARAM **sargables, bool equal_func);
+ SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param,
+ Field *field, Item *value, Item_result cmp_type)
+ {
+ DBUG_ENTER("Item_bool_func2::get_func_mm_tree");
+ /*
+ Here the function for the following predicates are processed:
+ <, <=, =, <=>, >=, >, LIKE, spatial relations
+ If the predicate is of the form (value op field) it is handled
+ as the equivalent predicate (field rev_op value), e.g.
+ 2 <= a is handled as a >= 2.
+ */
+ Item_func::Functype func_type=
+ (value != arguments()[0]) ? functype() : rev_functype();
+ DBUG_RETURN(get_mm_parts(param, field, func_type, value, cmp_type));
}
+public:
+ Item_bool_func2(THD *thd, Item *a, Item *b):
+ Item_bool_func(thd, a, b) { }
+ virtual enum Functype rev_functype() const { return UNKNOWN_FUNC; }
bool is_null() { return MY_TEST(args[0]->is_null() || args[1]->is_null()); }
+ SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr);
COND *remove_eq_conds(THD *thd, Item::cond_result *cond_value,
bool top_level);
-
+ bool count_sargable_conds(uchar *arg);
+ /*
+ Specifies which result type the function uses to compare its arguments.
+ This method is used in equal field propagation.
+ */
+ virtual Item_result compare_type() const
+ {
+ /*
+ Have STRING_RESULT by default, which means the function compares
+ val_str() results of the arguments. This is suitable for Item_func_like
+ and for Item_func_spatial_rel.
+ Note, Item_bool_rowready_func2 overrides this default behaviour.
+ */
+ return STRING_RESULT;
+ }
};
class Item_bool_rowready_func2 :public Item_bool_func2
@@ -314,16 +378,25 @@ class Item_bool_rowready_func2 :public Item_bool_func2
protected:
Arg_comparator cmp;
public:
- Item_bool_rowready_func2(Item *a, Item *b)
- :Item_bool_func2(a, b), cmp(tmp_arg, tmp_arg+1)
+ Item_bool_rowready_func2(THD *thd, Item *a, Item *b):
+ Item_bool_func2(thd, a, b), cmp(tmp_arg, tmp_arg + 1)
{
allowed_arg_cols= 0; // Fetch this value from first argument
}
- Item *neg_transformer(THD *thd);
- virtual Item *negated_item();
- bool subst_argument_checker(uchar **arg)
+ void print(String *str, enum_query_type query_type)
{
- return (*arg != NULL);
+ Item_func::print_op(str, query_type);
+ }
+ Item *neg_transformer(THD *thd);
+ virtual Item *negated_item(THD *thd);
+ Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond)
+ {
+ Item_args::propagate_equal_fields(thd,
+ Context(ANY_SUBST,
+ cmp.compare_type(),
+ compare_collation()),
+ cond);
+ return this;
}
void fix_length_and_dec();
int set_cmp_func()
@@ -332,18 +405,13 @@ public:
}
CHARSET_INFO *compare_collation() const
{ return cmp.cmp_collation.collation; }
+ Item_result compare_type() const { return cmp.compare_type(); }
Arg_comparator *get_comparator() { return &cmp; }
void cleanup()
{
Item_bool_func2::cleanup();
cmp.cleanup();
}
- bool can_optimize_group_min_max(Item_field *min_max_arg_item,
- const Item *const_item) const
- {
- return min_max_arg_item->field->can_optimize_group_min_max(this,
- const_item);
- }
void add_key_fields(JOIN *join, KEY_FIELD **key_fields,
uint *and_level, table_map usable_tables,
SARGABLE_PARAM **sargables)
@@ -354,21 +422,24 @@ public:
};
/**
- XOR inherits from Item_bool_func2 because it is not optimized yet.
+ XOR inherits from Item_bool_func because it is not optimized yet.
Later, when XOR is optimized, it needs to inherit from
Item_cond instead. See WL#5800.
*/
-class Item_func_xor :public Item_bool_func2
+class Item_func_xor :public Item_bool_func
{
public:
- Item_func_xor(Item *i1, Item *i2) :Item_bool_func2(i1, i2) {}
+ Item_func_xor(THD *thd, Item *i1, Item *i2): Item_bool_func(thd, i1, i2) {}
enum Functype functype() const { return XOR_FUNC; }
const char *func_name() const { return "xor"; }
+ void print(String *str, enum_query_type query_type)
+ { Item_func::print_op(str, query_type); }
longlong val_int();
Item *neg_transformer(THD *thd);
- bool subst_argument_checker(uchar **arg)
+ Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond)
{
- return (*arg != NULL);
+ Item_args::propagate_equal_fields(thd, Context_boolean(), cond);
+ return this;
}
};
@@ -376,7 +447,8 @@ class Item_func_not :public Item_bool_func
{
bool abort_on_null;
public:
- Item_func_not(Item *a) :Item_bool_func(a), abort_on_null(FALSE) {}
+ Item_func_not(THD *thd, Item *a):
+ Item_bool_func(thd, a), abort_on_null(FALSE) {}
virtual void top_level_item() { abort_on_null= 1; }
bool is_top_level_item() { return abort_on_null; }
longlong val_int();
@@ -422,7 +494,8 @@ class Item_func_trig_cond: public Item_bool_func
{
bool *trig_var;
public:
- Item_func_trig_cond(Item *a, bool *f) : Item_bool_func(a) { trig_var= f; }
+ Item_func_trig_cond(THD *thd, Item *a, bool *f): Item_bool_func(thd, a)
+ { trig_var= f; }
longlong val_int() { return *trig_var ? args[0]->val_int() : 1; }
enum Functype functype() const { return TRIG_COND_FUNC; };
const char *func_name() const { return "trigcond"; };
@@ -442,9 +515,8 @@ class Item_func_not_all :public Item_func_not
public:
bool show;
- Item_func_not_all(Item *a)
- :Item_func_not(a), test_sum_item(0), test_sub_item(0),
- show(0)
+ Item_func_not_all(THD *thd, Item *a):
+ Item_func_not(thd, a), test_sum_item(0), test_sub_item(0), show(0)
{}
table_map not_null_tables() const { return 0; }
longlong val_int();
@@ -464,7 +536,7 @@ class Item_func_nop_all :public Item_func_not_all
{
public:
- Item_func_nop_all(Item *a) :Item_func_not_all(a) {}
+ Item_func_nop_all(THD *thd, Item *a): Item_func_not_all(thd, a) {}
longlong val_int();
const char *func_name() const { return "<nop>"; }
Item *neg_transformer(THD *thd);
@@ -475,8 +547,8 @@ class Item_func_eq :public Item_bool_rowready_func2
{
bool abort_on_null;
public:
- Item_func_eq(Item *a,Item *b) :
- Item_bool_rowready_func2(a,b),
+ Item_func_eq(THD *thd, Item *a, Item *b):
+ Item_bool_rowready_func2(thd, a, b),
abort_on_null(false), in_equality_no(UINT_MAX)
{}
longlong val_int();
@@ -485,7 +557,7 @@ public:
cond_result eq_cmp_result() const { return COND_TRUE; }
const char *func_name() const { return "="; }
void top_level_item() { abort_on_null= true; }
- Item *negated_item();
+ Item *negated_item(THD *thd);
COND *build_equal_items(THD *thd, COND_EQUAL *inherited,
bool link_item_fields,
COND_EQUAL **cond_equal_ref);
@@ -512,7 +584,8 @@ public:
class Item_func_equal :public Item_bool_rowready_func2
{
public:
- Item_func_equal(Item *a,Item *b) :Item_bool_rowready_func2(a,b) {};
+ Item_func_equal(THD *thd, Item *a, Item *b):
+ Item_bool_rowready_func2(thd, a, b) {}
longlong val_int();
void fix_length_and_dec();
table_map not_null_tables() const { return 0; }
@@ -534,65 +607,77 @@ public:
class Item_func_ge :public Item_bool_rowready_func2
{
public:
- Item_func_ge(Item *a,Item *b) :Item_bool_rowready_func2(a,b) {};
+ Item_func_ge(THD *thd, Item *a, Item *b):
+ Item_bool_rowready_func2(thd, a, b) {};
longlong val_int();
enum Functype functype() const { return GE_FUNC; }
enum Functype rev_functype() const { return LE_FUNC; }
cond_result eq_cmp_result() const { return COND_TRUE; }
const char *func_name() const { return ">="; }
- Item *negated_item();
+ Item *negated_item(THD *thd);
};
class Item_func_gt :public Item_bool_rowready_func2
{
public:
- Item_func_gt(Item *a,Item *b) :Item_bool_rowready_func2(a,b) {};
+ Item_func_gt(THD *thd, Item *a, Item *b):
+ Item_bool_rowready_func2(thd, a, b) {};
longlong val_int();
enum Functype functype() const { return GT_FUNC; }
enum Functype rev_functype() const { return LT_FUNC; }
cond_result eq_cmp_result() const { return COND_FALSE; }
const char *func_name() const { return ">"; }
- Item *negated_item();
+ Item *negated_item(THD *thd);
};
class Item_func_le :public Item_bool_rowready_func2
{
public:
- Item_func_le(Item *a,Item *b) :Item_bool_rowready_func2(a,b) {};
+ Item_func_le(THD *thd, Item *a, Item *b):
+ Item_bool_rowready_func2(thd, a, b) {};
longlong val_int();
enum Functype functype() const { return LE_FUNC; }
enum Functype rev_functype() const { return GE_FUNC; }
cond_result eq_cmp_result() const { return COND_TRUE; }
const char *func_name() const { return "<="; }
- Item *negated_item();
+ Item *negated_item(THD *thd);
};
class Item_func_lt :public Item_bool_rowready_func2
{
public:
- Item_func_lt(Item *a,Item *b) :Item_bool_rowready_func2(a,b) {}
+ Item_func_lt(THD *thd, Item *a, Item *b):
+ Item_bool_rowready_func2(thd, a, b) {}
longlong val_int();
enum Functype functype() const { return LT_FUNC; }
enum Functype rev_functype() const { return GT_FUNC; }
cond_result eq_cmp_result() const { return COND_FALSE; }
const char *func_name() const { return "<"; }
- Item *negated_item();
+ Item *negated_item(THD *thd);
};
class Item_func_ne :public Item_bool_rowready_func2
{
+protected:
+ SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param,
+ Field *field, Item *value, Item_result cmp_type)
+ {
+ DBUG_ENTER("Item_func_ne::get_func_mm_tree");
+ DBUG_RETURN(get_ne_mm_tree(param, field, value, value, cmp_type));
+ }
public:
- Item_func_ne(Item *a,Item *b) :Item_bool_rowready_func2(a,b) {}
+ Item_func_ne(THD *thd, Item *a, Item *b):
+ Item_bool_rowready_func2(thd, a, b) {}
longlong val_int();
enum Functype functype() const { return NE_FUNC; }
+ enum Functype rev_functype() const { return NE_FUNC; }
cond_result eq_cmp_result() const { return COND_FALSE; }
- optimize_type select_optimize() const { return OPTIMIZE_KEY; }
const char *func_name() const { return "<>"; }
- Item *negated_item();
+ Item *negated_item(THD *thd);
void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level,
table_map usable_tables, SARGABLE_PARAM **sargables);
};
@@ -609,14 +694,25 @@ public:
class Item_func_opt_neg :public Item_bool_func
{
+protected:
+ /*
+ The result type that will be used for comparison.
+ cmp_type() of all arguments are collected to here.
+ */
+ Item_result m_compare_type;
+ /*
+ The collation that will be used for comparison in case
+ when m_compare_type is STRING_RESULT.
+ */
+ DTCollation cmp_collation;
public:
bool negated; /* <=> the item represents NOT <func> */
bool pred_level; /* <=> [NOT] <func> is used on a predicate level */
public:
- Item_func_opt_neg(Item *a, Item *b, Item *c)
- :Item_bool_func(a, b, c), negated(0), pred_level(0) {}
- Item_func_opt_neg(List<Item> &list)
- :Item_bool_func(list), negated(0), pred_level(0) {}
+ Item_func_opt_neg(THD *thd, Item *a, Item *b, Item *c):
+ Item_bool_func(thd, a, b, c), negated(0), pred_level(0) {}
+ Item_func_opt_neg(THD *thd, List<Item> &list):
+ Item_bool_func(thd, list), negated(0), pred_level(0) {}
public:
inline void negate() { negated= !negated; }
inline void top_level_item() { pred_level= 1; }
@@ -626,28 +722,27 @@ public:
return this;
}
bool eq(const Item *item, bool binary_cmp) const;
- bool subst_argument_checker(uchar **arg) { return TRUE; }
+ CHARSET_INFO *compare_collation() const { return cmp_collation.collation; }
+ Item* propagate_equal_fields(THD *, const Context &, COND_EQUAL *) = 0;
};
class Item_func_between :public Item_func_opt_neg
{
- DTCollation cmp_collation;
+protected:
+ SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param,
+ Field *field, Item *value, Item_result cmp_type);
public:
- Item_result cmp_type;
String value0,value1,value2;
/* TRUE <=> arguments will be compared as dates. */
Item *compare_as_dates;
- Item_func_between(Item *a, Item *b, Item *c)
- :Item_func_opt_neg(a, b, c), compare_as_dates(FALSE) { sargable= TRUE; }
+ Item_func_between(THD *thd, Item *a, Item *b, Item *c):
+ Item_func_opt_neg(thd, a, b, c), compare_as_dates(FALSE) { }
longlong val_int();
- optimize_type select_optimize() const { return OPTIMIZE_KEY; }
enum Functype functype() const { return BETWEEN; }
const char *func_name() const { return "between"; }
- bool fix_fields(THD *, Item **);
void fix_length_and_dec();
virtual void print(String *str, enum_query_type query_type);
- CHARSET_INFO *compare_collation() const { return cmp_collation.collation; }
bool eval_not_null_tables(uchar *opt_arg);
void fix_after_pullout(st_select_lex *new_parent, Item **ref);
bool count_sargable_conds(uchar *arg);
@@ -655,6 +750,15 @@ public:
uint *and_level, table_map usable_tables,
SARGABLE_PARAM **sargables);
SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr);
+ Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond)
+ {
+ Item_args::propagate_equal_fields(thd,
+ Context(ANY_SUBST,
+ m_compare_type,
+ compare_collation()),
+ cond);
+ return this;
+ }
};
@@ -663,7 +767,8 @@ class Item_func_strcmp :public Item_int_func
String value1, value2;
DTCollation cmp_collation;
public:
- Item_func_strcmp(Item *a,Item *b) :Item_int_func(a,b) {}
+ Item_func_strcmp(THD *thd, Item *a, Item *b):
+ Item_int_func(thd, a, b) {}
longlong val_int();
uint decimal_precision() const { return 1; }
const char *func_name() const { return "strcmp"; }
@@ -688,8 +793,8 @@ class Item_func_interval :public Item_int_func
bool use_decimal_comparison;
interval_range *intervals;
public:
- Item_func_interval(Item_row *a)
- :Item_int_func(a),row(a),intervals(0)
+ Item_func_interval(THD *thd, Item_row *a):
+ Item_int_func(thd, a), row(a), intervals(0)
{
allowed_arg_cols= 0; // Fetch this value from first argument
}
@@ -708,8 +813,10 @@ public:
class Item_func_coalesce :public Item_func_hybrid_field_type
{
public:
- Item_func_coalesce(Item *a, Item *b) :Item_func_hybrid_field_type(a, b) {}
- Item_func_coalesce(List<Item> &list) :Item_func_hybrid_field_type(list) {}
+ Item_func_coalesce(THD *thd, Item *a, Item *b):
+ Item_func_hybrid_field_type(thd, a, b) {}
+ Item_func_coalesce(THD *thd, List<Item> &list):
+ Item_func_hybrid_field_type(thd, list) {}
double real_op();
longlong int_op();
String *str_op(String *);
@@ -729,10 +836,10 @@ public:
class Item_func_case_abbreviation2 :public Item_func_hybrid_field_type
{
public:
- Item_func_case_abbreviation2(Item *a, Item *b)
- :Item_func_hybrid_field_type(a, b) { }
- Item_func_case_abbreviation2(Item *a, Item *b, Item *c)
- :Item_func_hybrid_field_type(a, b, c) { }
+ Item_func_case_abbreviation2(THD *thd, Item *a, Item *b):
+ Item_func_hybrid_field_type(thd, a, b) { }
+ Item_func_case_abbreviation2(THD *thd, Item *a, Item *b, Item *c):
+ Item_func_hybrid_field_type(thd, a, b, c) { }
void fix_length_and_dec2(Item **args);
uint decimal_precision2(Item **args) const;
};
@@ -741,7 +848,8 @@ public:
class Item_func_ifnull :public Item_func_case_abbreviation2
{
public:
- Item_func_ifnull(Item *a, Item *b) :Item_func_case_abbreviation2(a,b) {}
+ Item_func_ifnull(THD *thd, Item *a, Item *b):
+ Item_func_case_abbreviation2(thd, a, b) {}
double real_op();
longlong int_op();
String *str_op(String *str);
@@ -765,8 +873,8 @@ public:
class Item_func_if :public Item_func_case_abbreviation2
{
public:
- Item_func_if(Item *a,Item *b,Item *c)
- :Item_func_case_abbreviation2(a, b, c)
+ Item_func_if(THD *thd, Item *a, Item *b, Item *c):
+ Item_func_case_abbreviation2(thd, a, b, c)
{}
bool date_op(MYSQL_TIME *ltime, uint fuzzydate);
longlong int_op();
@@ -791,18 +899,26 @@ class Item_func_nullif :public Item_func_hybrid_field_type
{
Arg_comparator cmp;
/*
- Remember the first argument in case it will be substituted by either of:
- - convert_const_compared_to_int_field()
+ NULLIF(a,b) is a short for:
+ CASE WHEN a=b THEN NULL ELSE a END
+
+ The left "a" is for comparison purposes.
+ The right "a" is for return value purposes.
+ These are two different "a" and they can be replaced to different items.
+
+ The left "a" is in a comparison and can be replaced by:
+ - Item_func::convert_const_compared_to_int_field()
- agg_item_set_converter() in set_cmp_func()
- - cache_converted_constant() in set_cmp_func()
- The original item will be stored in m_arg0_copy, to return result.
- The substituted item will be stored in args[0], for comparison purposes.
+ - Arg_comparator::cache_converted_constant() in set_cmp_func()
+
+ Both "a"s are subject to equal fields propagation and can be replaced by:
+ - Item_field::propagate_equal_fields(ANY_SUBST) for the left "a"
+ - Item_field::propagate_equal_fields(IDENTITY_SUBST) for the right "a"
*/
- Item *m_args0_copy;
public:
- Item_func_nullif(Item *a,Item *b)
- :Item_func_hybrid_field_type(a, b),
- m_args0_copy(a)
+ // Put "a" to args[0] for comparison and to args[2] for the returned value.
+ Item_func_nullif(THD *thd, Item *a, Item *b):
+ Item_func_hybrid_field_type(thd, a, b, a)
{}
bool date_op(MYSQL_TIME *ltime, uint fuzzydate);
double real_op();
@@ -810,16 +926,23 @@ public:
String *str_op(String *str);
my_decimal *decimal_op(my_decimal *);
void fix_length_and_dec();
- uint decimal_precision() const { return m_args0_copy->decimal_precision(); }
+ uint decimal_precision() const { return args[2]->decimal_precision(); }
const char *func_name() const { return "nullif"; }
-
- virtual inline void print(String *str, enum_query_type query_type)
- {
- Item_func::print(str, query_type);
- }
-
+ void print(String *str, enum_query_type query_type);
table_map not_null_tables() const { return 0; }
bool is_null();
+ Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond)
+ {
+ Context cmpctx(ANY_SUBST, cmp.compare_type(), cmp.cmp_collation.collation);
+ args[0]->propagate_equal_fields_and_change_item_tree(thd, cmpctx,
+ cond, &args[0]);
+ args[1]->propagate_equal_fields_and_change_item_tree(thd, cmpctx,
+ cond, &args[1]);
+ args[2]->propagate_equal_fields_and_change_item_tree(thd,
+ Context_identity(),
+ cond, &args[2]);
+ return this;
+ }
};
@@ -860,7 +983,7 @@ public:
vector in form of Item_xxx constants without creating Item_xxx object
for every array element you get (i.e. this implements "FlyWeight" pattern)
*/
- virtual Item* create_item() { return NULL; }
+ virtual Item* create_item(THD *thd) { return NULL; }
/*
Store the value at position #pos into provided item object
@@ -887,8 +1010,8 @@ class in_string :public in_vector
class Item_string_for_in_vector: public Item_string
{
public:
- Item_string_for_in_vector(CHARSET_INFO *cs):
- Item_string(cs)
+ Item_string_for_in_vector(THD *thd, CHARSET_INFO *cs):
+ Item_string(thd, cs)
{ }
void set_value(const String *str)
{
@@ -901,10 +1024,7 @@ public:
~in_string();
void set(uint pos,Item *item);
uchar *get_value(Item *item);
- Item* create_item()
- {
- return new Item_string_for_in_vector(collation);
- }
+ Item* create_item(THD *thd);
void value_to_item(uint pos, Item *item)
{
String *str=((String*) base)+pos;
@@ -931,15 +1051,7 @@ public:
in_longlong(uint elements);
void set(uint pos,Item *item);
uchar *get_value(Item *item);
-
- Item* create_item()
- {
- /*
- We're created a signed INT, this may not be correct in
- general case (see BUG#19342).
- */
- return new Item_int((longlong)0);
- }
+ Item* create_item(THD *thd);
void value_to_item(uint pos, Item *item)
{
((Item_int*) item)->value= ((packed_longlong*) base)[pos].val;
@@ -972,10 +1084,7 @@ public:
lval_cache(0) {};
void set(uint pos,Item *item);
uchar *get_value(Item *item);
- Item* create_item()
- {
- return new Item_datetime();
- }
+ Item *create_item(THD *thd);
void value_to_item(uint pos, Item *item)
{
packed_longlong *val= reinterpret_cast<packed_longlong*>(base)+pos;
@@ -993,10 +1102,7 @@ public:
in_double(uint elements);
void set(uint pos,Item *item);
uchar *get_value(Item *item);
- Item *create_item()
- {
- return new Item_float(0.0, 0);
- }
+ Item *create_item(THD *thd);
void value_to_item(uint pos, Item *item)
{
((Item_float*)item)->value= ((double*) base)[pos];
@@ -1012,10 +1118,7 @@ public:
in_decimal(uint elements);
void set(uint pos, Item *item);
uchar *get_value(Item *item);
- Item *create_item()
- {
- return new Item_decimal(0, FALSE);
- }
+ Item *create_item(THD *thd);
void value_to_item(uint pos, Item *item)
{
my_decimal *dec= ((my_decimal *)base) + pos;
@@ -1044,7 +1147,7 @@ public:
static cmp_item* get_comparator(Item_result type, Item * warn_item,
CHARSET_INFO *cs);
virtual cmp_item *make_same()= 0;
- virtual void store_value_by_template(cmp_item *tmpl, Item *item)
+ virtual void store_value_by_template(THD *thd, cmp_item *tmpl, Item *item)
{
store_value(item);
}
@@ -1232,32 +1335,18 @@ public:
class Item_func_case :public Item_func_hybrid_field_type
{
int first_expr_num, else_expr_num;
- enum Item_result left_result_type;
+ enum Item_result left_cmp_type;
String tmp_value;
uint ncases;
Item_result cmp_type;
DTCollation cmp_collation;
cmp_item *cmp_items[6]; /* For all result types */
cmp_item *case_item;
+ Item **arg_buffer;
+ uint m_found_types;
public:
- Item_func_case(List<Item> &list, Item *first_expr_arg, Item *else_expr_arg)
- :Item_func_hybrid_field_type(), first_expr_num(-1), else_expr_num(-1),
- left_result_type(INT_RESULT), case_item(0)
- {
- ncases= list.elements;
- if (first_expr_arg)
- {
- first_expr_num= list.elements;
- list.push_back(first_expr_arg);
- }
- if (else_expr_arg)
- {
- else_expr_num= list.elements;
- list.push_back(else_expr_arg);
- }
- set_arguments(list);
- bzero(&cmp_items, sizeof(cmp_items));
- }
+ Item_func_case(THD *thd, List<Item> &list, Item *first_expr_arg,
+ Item *else_expr_arg);
double real_op();
longlong int_op();
String *str_op(String *);
@@ -1274,6 +1363,7 @@ public:
void cleanup();
void agg_str_lengths(Item *arg);
void agg_num_lengths(Item *arg);
+ Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond);
};
/*
@@ -1292,6 +1382,9 @@ public:
*/
class Item_func_in :public Item_func_opt_neg
{
+protected:
+ SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param,
+ Field *field, Item *value, Item_result cmp_type);
public:
/*
an array of values when the right hand arguments of IN
@@ -1304,17 +1397,15 @@ public:
and can be used safely as comparisons for key conditions
*/
bool arg_types_compatible;
- Item_result left_result_type;
+ Item_result left_cmp_type;
cmp_item *cmp_items[6]; /* One cmp_item for each result type */
- DTCollation cmp_collation;
- Item_func_in(List<Item> &list)
- :Item_func_opt_neg(list), array(0), have_null(0),
- arg_types_compatible(FALSE)
+ Item_func_in(THD *thd, List<Item> &list):
+ Item_func_opt_neg(thd, list), array(0), have_null(0),
+ arg_types_compatible(FALSE)
{
bzero(&cmp_items, sizeof(cmp_items));
allowed_arg_cols= 0; // Fetch this value from first argument
- sargable= TRUE;
}
longlong val_int();
bool fix_fields(THD *, Item **);
@@ -1333,18 +1424,33 @@ public:
}
DBUG_VOID_RETURN;
}
- optimize_type select_optimize() const
- { return OPTIMIZE_KEY; }
void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level,
table_map usable_tables, SARGABLE_PARAM **sargables);
SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr);
+ Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond)
+ {
+ /*
+ Note, we pass ANY_SUBST, this makes sure that non of the args
+ will be replaced to a zero-filled Item_string.
+ Such a change would require rebuilding of cmp_items.
+ */
+ Context cmpctx(ANY_SUBST, m_compare_type,
+ Item_func_in::compare_collation());
+ for (uint i= 0; i < arg_count; i++)
+ {
+ if (arg_types_compatible || i > 0)
+ args[i]->propagate_equal_fields_and_change_item_tree(thd, cmpctx,
+ cond, &args[i]);
+ }
+ return this;
+ }
virtual void print(String *str, enum_query_type query_type);
enum Functype functype() const { return IN_FUNC; }
const char *func_name() const { return " IN "; }
bool nulls_in_row();
- CHARSET_INFO *compare_collation() const { return cmp_collation.collation; }
bool eval_not_null_tables(uchar *opt_arg);
void fix_after_pullout(st_select_lex *new_parent, Item **ref);
+ bool count_sargable_conds(uchar *arg);
};
class cmp_item_row :public cmp_item
@@ -1359,7 +1465,7 @@ public:
int cmp(Item *arg);
int compare(cmp_item *arg);
cmp_item *make_same();
- void store_value_by_template(cmp_item *tmpl, Item *);
+ void store_value_by_template(THD *thd, cmp_item *tmpl, Item *);
friend void Item_func_in::fix_length_and_dec();
};
@@ -1368,7 +1474,7 @@ class in_row :public in_vector
{
cmp_item_row tmp;
public:
- in_row(uint elements, Item *);
+ in_row(THD *thd, uint elements, Item *);
~in_row();
void set(uint pos,Item *item);
uchar *get_value(Item *item);
@@ -1379,21 +1485,32 @@ public:
/* Functions used by where clause */
class Item_func_null_predicate :public Item_bool_func
{
+protected:
+ SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param,
+ Field *field, Item *value, Item_result cmp_type)
+ {
+ DBUG_ENTER("Item_func_null_predicate::get_func_mm_tree");
+ DBUG_RETURN(get_mm_parts(param, field, functype(), value, cmp_type));
+ }
+ SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, Field *field,
+ KEY_PART *key_part,
+ Item_func::Functype type, Item *value);
public:
- Item_func_null_predicate(Item *a) :Item_bool_func(a) { sargable= true; }
- optimize_type select_optimize() const { return OPTIMIZE_NULL; }
+ Item_func_null_predicate(THD *thd, Item *a): Item_bool_func(thd, a) { }
void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level,
table_map usable_tables, SARGABLE_PARAM **sargables);
+ SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr);
CHARSET_INFO *compare_collation() const
{ return args[0]->collation.collation; }
void fix_length_and_dec() { decimals=0; max_length=1; maybe_null=0; }
+ bool count_sargable_conds(uchar *arg);
};
class Item_func_isnull :public Item_func_null_predicate
{
public:
- Item_func_isnull(Item *a) :Item_func_null_predicate(a) {}
+ Item_func_isnull(THD *thd, Item *a): Item_func_null_predicate(thd, a) {}
longlong val_int();
enum Functype functype() const { return ISNULL_FUNC; }
void fix_length_and_dec()
@@ -1435,8 +1552,8 @@ class Item_is_not_null_test :public Item_func_isnull
{
Item_in_subselect* owner;
public:
- Item_is_not_null_test(Item_in_subselect* ow, Item *a)
- :Item_func_isnull(a), owner(ow)
+ Item_is_not_null_test(THD *thd, Item_in_subselect* ow, Item *a):
+ Item_func_isnull(thd, a), owner(ow)
{}
enum Functype functype() const { return ISNOTNULLTEST_FUNC; }
longlong val_int();
@@ -1455,7 +1572,8 @@ class Item_func_isnotnull :public Item_func_null_predicate
{
bool abort_on_null;
public:
- Item_func_isnotnull(Item *a) :Item_func_null_predicate(a), abort_on_null(0)
+ Item_func_isnotnull(THD *thd, Item *a):
+ Item_func_null_predicate(thd, a), abort_on_null(0)
{ }
longlong val_int();
enum Functype functype() const { return ISNOTNULL_FUNC; }
@@ -1492,16 +1610,24 @@ class Item_func_like :public Item_bool_func2
DTCollation cmp_collation;
String cmp_value1, cmp_value2;
+ bool with_sargable_pattern() const;
+protected:
+ SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, Field *field,
+ KEY_PART *key_part,
+ Item_func::Functype type, Item *value);
public:
int escape;
- Item_func_like(Item *a,Item *b, Item *escape_arg, bool escape_used)
- :Item_bool_func2(a,b), canDoTurboBM(FALSE), pattern(0), pattern_len(0),
- bmGs(0), bmBc(0), escape_item(escape_arg),
- escape_used_in_parsing(escape_used), use_sampling(0) {}
+ Item_func_like(THD *thd, Item *a, Item *b, Item *escape_arg, bool escape_used):
+ Item_bool_func2(thd, a, b), canDoTurboBM(FALSE), pattern(0), pattern_len(0),
+ bmGs(0), bmBc(0), escape_item(escape_arg),
+ escape_used_in_parsing(escape_used), use_sampling(0) {}
longlong val_int();
enum Functype functype() const { return LIKE_FUNC; }
- optimize_type select_optimize() const;
+ void print(String *str, enum_query_type query_type)
+ {
+ Item_func::print_op(str, query_type);
+ }
CHARSET_INFO *compare_collation() const
{ return cmp_collation.collation; }
cond_result eq_cmp_result() const
@@ -1541,12 +1667,50 @@ public:
}
void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level,
table_map usable_tables, SARGABLE_PARAM **sargables);
+ SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr)
+ {
+ return with_sargable_pattern() ?
+ Item_bool_func2::get_mm_tree(param, cond_ptr) :
+ Item_func::get_mm_tree(param, cond_ptr);
+ }
+ Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond)
+ {
+ /*
+ LIKE differs from the regular comparison operator ('=') in the following:
+ - LIKE never ignores trailing spaces (even for PAD SPACE collations)
+ Propagation of equal fields with a PAD SPACE collation into LIKE
+ is not safe.
+ Example:
+ WHERE a='a ' AND a LIKE 'a' - returns true for 'a'
+ cannot be rewritten to:
+ WHERE a='a ' AND 'a ' LIKE 'a' - returns false for 'a'
+ Note, binary collations in MySQL/MariaDB, e.g. latin1_bin,
+ still have the PAD SPACE attribute and ignore trailing spaces!
+ - LIKE does not take into account contractions, expansions,
+ and ignorable characters.
+ Propagation of equal fields with contractions/expansions/ignorables
+ is also not safe.
+
+ It's safe to propagate my_charset_bin (BINARY/VARBINARY/BLOB) values,
+ because they do not ignore trailing spaces and have one-to-one mapping
+ between a string and its weights.
+ The below condition should be true only for my_charset_bin
+ (as of version 10.1.7).
+ */
+ uint flags= Item_func_like::compare_collation()->state;
+ if ((flags & MY_CS_NOPAD) && !(flags & MY_CS_NON1TO1))
+ Item_args::propagate_equal_fields(thd,
+ Context(ANY_SUBST,
+ STRING_RESULT,
+ compare_collation()),
+ cond);
+ return this;
+ }
const char *func_name() const { return "like"; }
bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec()
{
max_length= 1;
- args[0]->cmp_context= args[1]->cmp_context= STRING_RESULT;
agg_arg_charsets_for_comparison(cmp_collation, args, 2);
}
void cleanup();
@@ -1567,6 +1731,10 @@ class Regexp_processor_pcre
int m_pcre_exec_rc;
int m_SubStrVec[30];
uint m_subpatterns_needed;
+ void pcre_exec_warn(int rc) const;
+ int pcre_exec_with_warn(const pcre *code, const pcre_extra *extra,
+ const char *subject, int length, int startoffset,
+ int options, int *ovector, int ovecsize);
public:
String *convert_if_needed(String *src, String *converter);
String subject_converter;
@@ -1580,7 +1748,7 @@ public:
m_subpatterns_needed(0)
{}
int default_regex_flags();
- void init(CHARSET_INFO *data_charset, int extra_flags, uint nsubpatterns)
+ void init(CHARSET_INFO *data_charset, int extra_flags, uint nsubpatterns_arg)
{
m_library_flags= default_regex_flags() | extra_flags |
(data_charset != &my_charset_bin ?
@@ -1594,7 +1762,7 @@ public:
m_conversion_is_needed= (data_charset != &my_charset_bin) &&
!my_charset_same(data_charset, m_library_charset);
- m_subpatterns_needed= nsubpatterns;
+ m_subpatterns_needed= nsubpatterns_arg;
}
void fix_owner(Item_func *owner, Item *subject_arg, Item *pattern_arg);
bool compile(String *pattern, bool send_error);
@@ -1641,7 +1809,7 @@ class Item_func_regex :public Item_bool_func
Regexp_processor_pcre re;
DTCollation cmp_collation;
public:
- Item_func_regex(Item *a,Item *b) :Item_bool_func(a,b)
+ Item_func_regex(THD *thd, Item *a, Item *b): Item_bool_func(thd, a, b)
{}
void cleanup()
{
@@ -1668,7 +1836,7 @@ class Item_func_regexp_instr :public Item_int_func
Regexp_processor_pcre re;
DTCollation cmp_collation;
public:
- Item_func_regexp_instr(Item *a, Item *b) :Item_int_func(a, b)
+ Item_func_regexp_instr(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b)
{}
void cleanup()
{
@@ -1694,26 +1862,21 @@ protected:
public:
/* Item_cond() is only used to create top level items */
- Item_cond(): Item_bool_func(), abort_on_null(1)
+ Item_cond(THD *thd): Item_bool_func(thd), abort_on_null(1)
{ const_item_cache=0; }
- Item_cond(Item *i1,Item *i2)
- :Item_bool_func(), abort_on_null(0)
- {
- list.push_back(i1);
- list.push_back(i2);
- }
+ Item_cond(THD *thd, Item *i1, Item *i2);
Item_cond(THD *thd, Item_cond *item);
- Item_cond(List<Item> &nlist)
- :Item_bool_func(), list(nlist), abort_on_null(0) {}
- bool add(Item *item)
+ Item_cond(THD *thd, List<Item> &nlist):
+ Item_bool_func(thd), list(nlist), abort_on_null(0) {}
+ bool add(Item *item, MEM_ROOT *root)
{
DBUG_ASSERT(item);
- return list.push_back(item);
+ return list.push_back(item, root);
}
- bool add_at_head(Item *item)
+ bool add_at_head(Item *item, MEM_ROOT *root)
{
DBUG_ASSERT(item);
- return list.push_front(item);
+ return list.push_front(item, root);
}
void add_at_head(List<Item> *nlist)
{
@@ -1746,19 +1909,20 @@ public:
SARGABLE_PARAM **sargables);
SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr);
virtual void print(String *str, enum_query_type query_type);
- void split_sum_func(THD *thd, Item **ref_pointer_array, List<Item> &fields);
+ void split_sum_func(THD *thd, Item **ref_pointer_array, List<Item> &fields,
+ uint flags);
friend int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
COND **conds);
void top_level_item() { abort_on_null=1; }
bool top_level() { return abort_on_null; }
void copy_andor_arguments(THD *thd, Item_cond *item);
bool walk(Item_processor processor, bool walk_subquery, uchar *arg);
- Item *transform(Item_transformer transformer, uchar *arg);
+ Item *transform(THD *thd, Item_transformer transformer, uchar *arg);
void traverse_cond(Cond_traverser, void *arg, traverse_order order);
void neg_arguments(THD *thd);
enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; }
- bool subst_argument_checker(uchar **arg) { return TRUE; }
- Item *compile(Item_analyzer analyzer, uchar **arg_p,
+ Item* propagate_equal_fields(THD *, const Context &, COND_EQUAL *);
+ Item *compile(THD *thd, Item_analyzer analyzer, uchar **arg_p,
Item_transformer transformer, uchar *arg_t);
bool eval_not_null_tables(uchar *opt_arg);
};
@@ -1880,18 +2044,6 @@ class Item_equal: public Item_bool_func
the equal_items should be ignored.
*/
bool cond_true;
- /*
- compare_as_dates=TRUE <-> constants equal to fields from equal_items
- must be compared as datetimes and not as strings.
- compare_as_dates can be TRUE only if with_const=TRUE
- */
- bool compare_as_dates;
- /*
- The comparator used to compare constants equal to fields from equal_items
- as datetimes. The comparator is used only if compare_as_dates=TRUE
- */
- Arg_comparator cmp;
-
/*
For Item_equal objects inside an OR clause: one of the fields that were
used in the original equality.
@@ -1900,21 +2052,20 @@ class Item_equal: public Item_bool_func
bool link_equal_fields;
+ Item_result m_compare_type;
+ CHARSET_INFO *m_compare_collation;
+ String cmp_value1, cmp_value2;
public:
COND_EQUAL *upper_levels; /* multiple equalities of upper and levels */
- inline Item_equal()
- : Item_bool_func(), with_const(FALSE), eval_item(0), cond_false(0),
- context_field(NULL)
- { const_item_cache=0; sargable= TRUE; }
- Item_equal(Item *f1, Item *f2, bool with_const_item);
- Item_equal(Item_equal *item_equal);
+ Item_equal(THD *thd, Item *f1, Item *f2, bool with_const_item);
+ Item_equal(THD *thd, Item_equal *item_equal);
/* Currently the const item is always the first in the list of equal items */
inline Item* get_const() { return with_const ? equal_items.head() : NULL; }
- void add_const(THD *thd, Item *c, Item *f = NULL);
+ void add_const(THD *thd, Item *c);
/** Add a non-constant item to the multiple equality */
- void add(Item *f) { equal_items.push_back(f); }
+ void add(Item *f, MEM_ROOT *root) { equal_items.push_back(f, root); }
bool contains(Field *field);
Item* get_first(struct st_join_table *context, Item *field);
/** Get number of field items / references to field items in this object */
@@ -1927,7 +2078,6 @@ public:
enum Functype functype() const { return MULT_EQUAL_FUNC; }
longlong val_int();
const char *func_name() const { return "multiple equal"; }
- optimize_type select_optimize() const { return OPTIMIZE_EQUAL; }
void sort(Item_field_cmpfunc compare, void *arg);
void fix_length_and_dec();
bool fix_fields(THD *thd, Item **ref);
@@ -1940,9 +2090,10 @@ public:
SARGABLE_PARAM **sargables);
SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr);
bool walk(Item_processor processor, bool walk_subquery, uchar *arg);
- Item *transform(Item_transformer transformer, uchar *arg);
+ Item *transform(THD *thd, Item_transformer transformer, uchar *arg);
virtual void print(String *str, enum_query_type query_type);
- CHARSET_INFO *compare_collation() const;
+ Item_result compare_type() const { return m_compare_type; }
+ CHARSET_INFO *compare_collation() const { return m_compare_collation; }
void set_context_field(Item_field *ctx_field) { context_field= ctx_field; }
void set_link_equal_fields(bool flag) { link_equal_fields= flag; }
@@ -1950,8 +2101,9 @@ public:
bool count_sargable_conds(uchar *arg);
friend class Item_equal_iterator<List_iterator_fast,Item>;
friend class Item_equal_iterator<List_iterator,Item>;
- friend Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
- Item_equal *item_equal);
+ friend Item *eliminate_item_equal(THD *thd, COND *cond,
+ COND_EQUAL *upper_levels,
+ Item_equal *item_equal);
friend bool setup_sj_materialization_part1(struct st_join_table *tab);
friend bool setup_sj_materialization_part2(struct st_join_table *tab);
};
@@ -2070,22 +2222,16 @@ public:
COND_EQUAL m_cond_equal; /* contains list of Item_equal objects for
the current and level and reference
to multiple equalities of upper and levels */
- Item_cond_and() :Item_cond() {}
- Item_cond_and(Item *i1,Item *i2) :Item_cond(i1,i2) {}
- Item_cond_and(THD *thd, Item_cond_and *item) :Item_cond(thd, item) {}
- Item_cond_and(List<Item> &list_arg): Item_cond(list_arg) {}
+ Item_cond_and(THD *thd): Item_cond(thd) {}
+ Item_cond_and(THD *thd, Item *i1,Item *i2): Item_cond(thd, i1, i2) {}
+ Item_cond_and(THD *thd, Item_cond_and *item): Item_cond(thd, item) {}
+ Item_cond_and(THD *thd, List<Item> &list_arg): Item_cond(thd, list_arg) {}
enum Functype functype() const { return COND_AND_FUNC; }
longlong val_int();
const char *func_name() const { return "and"; }
table_map not_null_tables() const
{ return abort_on_null ? not_null_tables_cache: and_tables_cache; }
- Item* copy_andor_structure(THD *thd)
- {
- Item_cond_and *item;
- if ((item= new Item_cond_and(thd, this)))
- item->copy_andor_arguments(thd, this);
- return item;
- }
+ Item *copy_andor_structure(THD *thd);
Item *neg_transformer(THD *thd);
void mark_as_condition_AND_part(TABLE_LIST *embedding);
virtual uint exists2in_reserved_items() { return list.elements; };
@@ -2110,28 +2256,22 @@ inline bool is_cond_and(Item *item)
class Item_cond_or :public Item_cond
{
public:
- Item_cond_or() :Item_cond() {}
- Item_cond_or(Item *i1,Item *i2) :Item_cond(i1,i2) {}
- Item_cond_or(THD *thd, Item_cond_or *item) :Item_cond(thd, item) {}
- Item_cond_or(List<Item> &list_arg): Item_cond(list_arg) {}
+ Item_cond_or(THD *thd): Item_cond(thd) {}
+ Item_cond_or(THD *thd, Item *i1,Item *i2): Item_cond(thd, i1, i2) {}
+ Item_cond_or(THD *thd, Item_cond_or *item): Item_cond(thd, item) {}
+ Item_cond_or(THD *thd, List<Item> &list_arg): Item_cond(thd, list_arg) {}
enum Functype functype() const { return COND_OR_FUNC; }
longlong val_int();
const char *func_name() const { return "or"; }
table_map not_null_tables() const { return and_tables_cache; }
- Item* copy_andor_structure(THD *thd)
- {
- Item_cond_or *item;
- if ((item= new Item_cond_or(thd, this)))
- item->copy_andor_arguments(thd, this);
- return item;
- }
+ Item *copy_andor_structure(THD *thd);
Item *neg_transformer(THD *thd);
};
class Item_func_dyncol_check :public Item_bool_func
{
public:
- Item_func_dyncol_check(Item *str) :Item_bool_func(str) {}
+ Item_func_dyncol_check(THD *thd, Item *str): Item_bool_func(thd, str) {}
longlong val_int();
const char *func_name() const { return "column_check"; }
};
@@ -2139,7 +2279,8 @@ public:
class Item_func_dyncol_exists :public Item_bool_func
{
public:
- Item_func_dyncol_exists(Item *str, Item *num) :Item_bool_func(str, num) {}
+ Item_func_dyncol_exists(THD *thd, Item *str, Item *num):
+ Item_bool_func(thd, str, num) {}
longlong val_int();
const char *func_name() const { return "column_exists"; }
};
@@ -2153,20 +2294,10 @@ inline bool is_cond_or(Item *item)
return (cond_item->functype() == Item_func::COND_OR_FUNC);
}
-/* Some useful inline functions */
-
-inline Item *and_conds(Item *a, Item *b)
-{
- if (!b) return a;
- if (!a) return b;
- return new Item_cond_and(a, b);
-}
-
-
Item *and_expressions(Item *a, Item *b, Item **org_item);
longlong get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
- Item *warn_item, bool *is_null);
+ enum_field_types f_type, bool *is_null);
bool get_mysql_time_from_str(THD *thd, String *str, timestamp_type warn_type,
@@ -2181,12 +2312,12 @@ public:
/**
Create operation with given arguments.
*/
- virtual Item_bool_rowready_func2* create(MEM_ROOT *, Item *a, Item *b)
+ virtual Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b)
const = 0;
/**
Create operation with given arguments in swap order.
*/
- virtual Item_bool_rowready_func2* create_swap(MEM_ROOT *, Item *a, Item *b)
+ virtual Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b)
const = 0;
virtual const char* symbol(bool invert) const = 0;
virtual bool eqne_op() const = 0;
@@ -2198,14 +2329,8 @@ class Eq_creator :public Comp_creator
public:
Eq_creator() {} /* Remove gcc warning */
virtual ~Eq_creator() {} /* Remove gcc warning */
- Item_bool_rowready_func2* create(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_eq(a, b);
- }
- Item_bool_rowready_func2* create_swap(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_eq(b, a);
- }
+ Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const;
+ Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const;
const char* symbol(bool invert) const { return invert? "<>" : "="; }
bool eqne_op() const { return 1; }
bool l_op() const { return 0; }
@@ -2216,14 +2341,8 @@ class Ne_creator :public Comp_creator
public:
Ne_creator() {} /* Remove gcc warning */
virtual ~Ne_creator() {} /* Remove gcc warning */
- Item_bool_rowready_func2* create(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_ne(a, b);
- }
- Item_bool_rowready_func2* create_swap(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_ne(b, a);
- }
+ Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const;
+ Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const;
const char* symbol(bool invert) const { return invert? "=" : "<>"; }
bool eqne_op() const { return 1; }
bool l_op() const { return 0; }
@@ -2234,14 +2353,8 @@ class Gt_creator :public Comp_creator
public:
Gt_creator() {} /* Remove gcc warning */
virtual ~Gt_creator() {} /* Remove gcc warning */
- Item_bool_rowready_func2* create(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_gt(a, b);
- }
- Item_bool_rowready_func2* create_swap(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_lt(b, a);
- }
+ Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const;
+ Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const;
const char* symbol(bool invert) const { return invert? "<=" : ">"; }
bool eqne_op() const { return 0; }
bool l_op() const { return 0; }
@@ -2252,14 +2365,8 @@ class Lt_creator :public Comp_creator
public:
Lt_creator() {} /* Remove gcc warning */
virtual ~Lt_creator() {} /* Remove gcc warning */
- Item_bool_rowready_func2* create(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_lt(a, b);
- }
- Item_bool_rowready_func2* create_swap(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_gt(b, a);
- }
+ Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const;
+ Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const;
const char* symbol(bool invert) const { return invert? ">=" : "<"; }
bool eqne_op() const { return 0; }
bool l_op() const { return 1; }
@@ -2270,14 +2377,8 @@ class Ge_creator :public Comp_creator
public:
Ge_creator() {} /* Remove gcc warning */
virtual ~Ge_creator() {} /* Remove gcc warning */
- Item_bool_rowready_func2* create(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_ge(a, b);
- }
- Item_bool_rowready_func2* create_swap(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_le(b, a);
- }
+ Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const;
+ Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const;
const char* symbol(bool invert) const { return invert? "<" : ">="; }
bool eqne_op() const { return 0; }
bool l_op() const { return 0; }
@@ -2288,14 +2389,8 @@ class Le_creator :public Comp_creator
public:
Le_creator() {} /* Remove gcc warning */
virtual ~Le_creator() {} /* Remove gcc warning */
- Item_bool_rowready_func2* create(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_le(a, b);
- }
- Item_bool_rowready_func2* create_swap(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_ge(b, a);
- }
+ Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const;
+ Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const;
const char* symbol(bool invert) const { return invert? ">" : "<="; }
bool eqne_op() const { return 0; }
bool l_op() const { return 1; }
diff --git a/sql/item_create.cc b/sql/item_create.cc
index a55c9ef3de4..82f6bbd3173 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -2970,16 +2970,16 @@ Create_udf_func::create(THD *thd, udf_func *udf, List<Item> *item_list)
if (udf->type == UDFTYPE_FUNCTION)
{
if (arg_count)
- func= new (thd->mem_root) Item_func_udf_str(udf, *item_list);
+ func= new (thd->mem_root) Item_func_udf_str(thd, udf, *item_list);
else
- func= new (thd->mem_root) Item_func_udf_str(udf);
+ func= new (thd->mem_root) Item_func_udf_str(thd, udf);
}
else
{
if (arg_count)
- func= new (thd->mem_root) Item_sum_udf_str(udf, *item_list);
+ func= new (thd->mem_root) Item_sum_udf_str(thd, udf, *item_list);
else
- func= new (thd->mem_root) Item_sum_udf_str(udf);
+ func= new (thd->mem_root) Item_sum_udf_str(thd, udf);
}
break;
}
@@ -2988,16 +2988,16 @@ Create_udf_func::create(THD *thd, udf_func *udf, List<Item> *item_list)
if (udf->type == UDFTYPE_FUNCTION)
{
if (arg_count)
- func= new (thd->mem_root) Item_func_udf_float(udf, *item_list);
+ func= new (thd->mem_root) Item_func_udf_float(thd, udf, *item_list);
else
- func= new (thd->mem_root) Item_func_udf_float(udf);
+ func= new (thd->mem_root) Item_func_udf_float(thd, udf);
}
else
{
if (arg_count)
- func= new (thd->mem_root) Item_sum_udf_float(udf, *item_list);
+ func= new (thd->mem_root) Item_sum_udf_float(thd, udf, *item_list);
else
- func= new (thd->mem_root) Item_sum_udf_float(udf);
+ func= new (thd->mem_root) Item_sum_udf_float(thd, udf);
}
break;
}
@@ -3006,16 +3006,16 @@ Create_udf_func::create(THD *thd, udf_func *udf, List<Item> *item_list)
if (udf->type == UDFTYPE_FUNCTION)
{
if (arg_count)
- func= new (thd->mem_root) Item_func_udf_int(udf, *item_list);
+ func= new (thd->mem_root) Item_func_udf_int(thd, udf, *item_list);
else
- func= new (thd->mem_root) Item_func_udf_int(udf);
+ func= new (thd->mem_root) Item_func_udf_int(thd, udf);
}
else
{
if (arg_count)
- func= new (thd->mem_root) Item_sum_udf_int(udf, *item_list);
+ func= new (thd->mem_root) Item_sum_udf_int(thd, udf, *item_list);
else
- func= new (thd->mem_root) Item_sum_udf_int(udf);
+ func= new (thd->mem_root) Item_sum_udf_int(thd, udf);
}
break;
}
@@ -3024,16 +3024,16 @@ Create_udf_func::create(THD *thd, udf_func *udf, List<Item> *item_list)
if (udf->type == UDFTYPE_FUNCTION)
{
if (arg_count)
- func= new (thd->mem_root) Item_func_udf_decimal(udf, *item_list);
+ func= new (thd->mem_root) Item_func_udf_decimal(thd, udf, *item_list);
else
- func= new (thd->mem_root) Item_func_udf_decimal(udf);
+ func= new (thd->mem_root) Item_func_udf_decimal(thd, udf);
}
else
{
if (arg_count)
- func= new (thd->mem_root) Item_sum_udf_decimal(udf, *item_list);
+ func= new (thd->mem_root) Item_sum_udf_decimal(thd, udf, *item_list);
else
- func= new (thd->mem_root) Item_sum_udf_decimal(udf);
+ func= new (thd->mem_root) Item_sum_udf_decimal(thd, udf);
}
break;
}
@@ -3082,10 +3082,10 @@ Create_sp_func::create_with_db(THD *thd, LEX_STRING db, LEX_STRING name,
sp_add_used_routine(lex, thd, qname, TYPE_ENUM_FUNCTION);
if (arg_count > 0)
- func= new (thd->mem_root) Item_func_sp(lex->current_context(), qname,
+ func= new (thd->mem_root) Item_func_sp(thd, lex->current_context(), qname,
*item_list);
else
- func= new (thd->mem_root) Item_func_sp(lex->current_context(), qname);
+ func= new (thd->mem_root) Item_func_sp(thd, lex->current_context(), qname);
lex->safe_to_cache_query= 0;
return func;
@@ -3212,7 +3212,7 @@ Create_func_abs Create_func_abs::s_singleton;
Item*
Create_func_abs::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_abs(arg1);
+ return new (thd->mem_root) Item_func_abs(thd, arg1);
}
@@ -3221,7 +3221,7 @@ Create_func_acos Create_func_acos::s_singleton;
Item*
Create_func_acos::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_acos(arg1);
+ return new (thd->mem_root) Item_func_acos(thd, arg1);
}
@@ -3230,7 +3230,7 @@ Create_func_addtime Create_func_addtime::s_singleton;
Item*
Create_func_addtime::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_add_time(arg1, arg2, 0, 0);
+ return new (thd->mem_root) Item_func_add_time(thd, arg1, arg2, 0, 0);
}
@@ -3239,7 +3239,7 @@ Create_func_aes_encrypt Create_func_aes_encrypt::s_singleton;
Item*
Create_func_aes_encrypt::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_aes_encrypt(arg1, arg2);
+ return new (thd->mem_root) Item_func_aes_encrypt(thd, arg1, arg2);
}
@@ -3248,7 +3248,7 @@ Create_func_aes_decrypt Create_func_aes_decrypt::s_singleton;
Item*
Create_func_aes_decrypt::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_aes_decrypt(arg1, arg2);
+ return new (thd->mem_root) Item_func_aes_decrypt(thd, arg1, arg2);
}
@@ -3258,7 +3258,7 @@ Create_func_area Create_func_area::s_singleton;
Item*
Create_func_area::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_area(arg1);
+ return new (thd->mem_root) Item_func_area(thd, arg1);
}
#endif
@@ -3269,7 +3269,7 @@ Create_func_as_wkb Create_func_as_wkb::s_singleton;
Item*
Create_func_as_wkb::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_as_wkb(arg1);
+ return new (thd->mem_root) Item_func_as_wkb(thd, arg1);
}
#endif
@@ -3280,7 +3280,7 @@ Create_func_as_wkt Create_func_as_wkt::s_singleton;
Item*
Create_func_as_wkt::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_as_wkt(arg1);
+ return new (thd->mem_root) Item_func_as_wkt(thd, arg1);
}
#endif
@@ -3290,7 +3290,7 @@ Create_func_asin Create_func_asin::s_singleton;
Item*
Create_func_asin::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_asin(arg1);
+ return new (thd->mem_root) Item_func_asin(thd, arg1);
}
@@ -3310,14 +3310,14 @@ Create_func_atan::create_native(THD *thd, LEX_STRING name,
case 1:
{
Item *param_1= item_list->pop();
- func= new (thd->mem_root) Item_func_atan(param_1);
+ func= new (thd->mem_root) Item_func_atan(thd, param_1);
break;
}
case 2:
{
Item *param_1= item_list->pop();
Item *param_2= item_list->pop();
- func= new (thd->mem_root) Item_func_atan(param_1, param_2);
+ func= new (thd->mem_root) Item_func_atan(thd, param_1, param_2);
break;
}
default:
@@ -3337,7 +3337,7 @@ Item*
Create_func_benchmark::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
- return new (thd->mem_root) Item_func_benchmark(arg1, arg2);
+ return new (thd->mem_root) Item_func_benchmark(thd, arg1, arg2);
}
@@ -3346,9 +3346,9 @@ Create_func_bin Create_func_bin::s_singleton;
Item*
Create_func_bin::create_1_arg(THD *thd, Item *arg1)
{
- Item *i10= new (thd->mem_root) Item_int((int32) 10,2);
- Item *i2= new (thd->mem_root) Item_int((int32) 2,1);
- return new (thd->mem_root) Item_func_conv(arg1, i10, i2);
+ Item *i10= new (thd->mem_root) Item_int(thd, (int32) 10,2);
+ Item *i2= new (thd->mem_root) Item_int(thd, (int32) 2,1);
+ return new (thd->mem_root) Item_func_conv(thd, arg1, i10, i2);
}
@@ -3365,7 +3365,7 @@ Create_func_binlog_gtid_pos::create_2_arg(THD *thd, Item *arg1, Item *arg2)
return NULL;
}
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
- return new (thd->mem_root) Item_func_binlog_gtid_pos(arg1, arg2);
+ return new (thd->mem_root) Item_func_binlog_gtid_pos(thd, arg1, arg2);
}
@@ -3374,7 +3374,7 @@ Create_func_bit_count Create_func_bit_count::s_singleton;
Item*
Create_func_bit_count::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_bit_count(arg1);
+ return new (thd->mem_root) Item_func_bit_count(thd, arg1);
}
@@ -3383,7 +3383,7 @@ Create_func_bit_length Create_func_bit_length::s_singleton;
Item*
Create_func_bit_length::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_bit_length(arg1);
+ return new (thd->mem_root) Item_func_bit_length(thd, arg1);
}
@@ -3392,7 +3392,7 @@ Create_func_ceiling Create_func_ceiling::s_singleton;
Item*
Create_func_ceiling::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_ceiling(arg1);
+ return new (thd->mem_root) Item_func_ceiling(thd, arg1);
}
@@ -3402,7 +3402,7 @@ Create_func_centroid Create_func_centroid::s_singleton;
Item*
Create_func_centroid::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_centroid(arg1);
+ return new (thd->mem_root) Item_func_centroid(thd, arg1);
}
@@ -3411,7 +3411,7 @@ Create_func_convexhull Create_func_convexhull::s_singleton;
Item*
Create_func_convexhull::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_convexhull(arg1);
+ return new (thd->mem_root) Item_func_convexhull(thd, arg1);
}
@@ -3420,7 +3420,7 @@ Create_func_pointonsurface Create_func_pointonsurface::s_singleton;
Item*
Create_func_pointonsurface::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_pointonsurface(arg1);
+ return new (thd->mem_root) Item_func_pointonsurface(thd, arg1);
}
#endif /*HAVE_SPATIAL*/
@@ -3430,7 +3430,7 @@ Create_func_char_length Create_func_char_length::s_singleton;
Item*
Create_func_char_length::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_char_length(arg1);
+ return new (thd->mem_root) Item_func_char_length(thd, arg1);
}
@@ -3439,7 +3439,7 @@ Create_func_coercibility Create_func_coercibility::s_singleton;
Item*
Create_func_coercibility::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_coercibility(arg1);
+ return new (thd->mem_root) Item_func_coercibility(thd, arg1);
}
@@ -3448,7 +3448,7 @@ Create_func_dyncol_check Create_func_dyncol_check::s_singleton;
Item*
Create_func_dyncol_check::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_dyncol_check(arg1);
+ return new (thd->mem_root) Item_func_dyncol_check(thd, arg1);
}
Create_func_dyncol_exists Create_func_dyncol_exists::s_singleton;
@@ -3456,7 +3456,7 @@ Create_func_dyncol_exists Create_func_dyncol_exists::s_singleton;
Item*
Create_func_dyncol_exists::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_dyncol_exists(arg1, arg2);
+ return new (thd->mem_root) Item_func_dyncol_exists(thd, arg1, arg2);
}
Create_func_dyncol_list Create_func_dyncol_list::s_singleton;
@@ -3464,7 +3464,7 @@ Create_func_dyncol_list Create_func_dyncol_list::s_singleton;
Item*
Create_func_dyncol_list::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_dyncol_list(arg1);
+ return new (thd->mem_root) Item_func_dyncol_list(thd, arg1);
}
Create_func_dyncol_json Create_func_dyncol_json::s_singleton;
@@ -3472,7 +3472,7 @@ Create_func_dyncol_json Create_func_dyncol_json::s_singleton;
Item*
Create_func_dyncol_json::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_dyncol_json(arg1);
+ return new (thd->mem_root) Item_func_dyncol_json(thd, arg1);
}
Create_func_concat Create_func_concat::s_singleton;
@@ -3492,7 +3492,7 @@ Create_func_concat::create_native(THD *thd, LEX_STRING name,
return NULL;
}
- return new (thd->mem_root) Item_func_concat(*item_list);
+ return new (thd->mem_root) Item_func_concat(thd, *item_list);
}
Create_func_decode_histogram Create_func_decode_histogram::s_singleton;
@@ -3500,7 +3500,7 @@ Create_func_decode_histogram Create_func_decode_histogram::s_singleton;
Item *
Create_func_decode_histogram::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_decode_histogram(arg1, arg2);
+ return new (thd->mem_root) Item_func_decode_histogram(thd, arg1, arg2);
}
Create_func_concat_ws Create_func_concat_ws::s_singleton;
@@ -3521,7 +3521,7 @@ Create_func_concat_ws::create_native(THD *thd, LEX_STRING name,
return NULL;
}
- return new (thd->mem_root) Item_func_concat_ws(*item_list);
+ return new (thd->mem_root) Item_func_concat_ws(thd, *item_list);
}
@@ -3530,7 +3530,7 @@ Create_func_compress Create_func_compress::s_singleton;
Item*
Create_func_compress::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_compress(arg1);
+ return new (thd->mem_root) Item_func_compress(thd, arg1);
}
@@ -3540,7 +3540,7 @@ Item*
Create_func_connection_id::create_builder(THD *thd)
{
thd->lex->safe_to_cache_query= 0;
- return new (thd->mem_root) Item_func_connection_id();
+ return new (thd->mem_root) Item_func_connection_id(thd);
}
@@ -3550,7 +3550,7 @@ Create_func_mbr_contains Create_func_mbr_contains::s_singleton;
Item*
Create_func_mbr_contains::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_spatial_mbr_rel(arg1, arg2,
+ return new (thd->mem_root) Item_func_spatial_mbr_rel(thd, arg1, arg2,
Item_func::SP_CONTAINS_FUNC);
}
@@ -3560,7 +3560,7 @@ Create_func_contains Create_func_contains::s_singleton;
Item*
Create_func_contains::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_spatial_precise_rel(arg1, arg2,
+ return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2,
Item_func::SP_CONTAINS_FUNC);
}
#endif
@@ -3571,7 +3571,7 @@ Create_func_conv Create_func_conv::s_singleton;
Item*
Create_func_conv::create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3)
{
- return new (thd->mem_root) Item_func_conv(arg1, arg2, arg3);
+ return new (thd->mem_root) Item_func_conv(thd, arg1, arg2, arg3);
}
@@ -3580,7 +3580,7 @@ Create_func_convert_tz Create_func_convert_tz::s_singleton;
Item*
Create_func_convert_tz::create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3)
{
- return new (thd->mem_root) Item_func_convert_tz(arg1, arg2, arg3);
+ return new (thd->mem_root) Item_func_convert_tz(thd, arg1, arg2, arg3);
}
@@ -3589,7 +3589,7 @@ Create_func_cos Create_func_cos::s_singleton;
Item*
Create_func_cos::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_cos(arg1);
+ return new (thd->mem_root) Item_func_cos(thd, arg1);
}
@@ -3598,7 +3598,7 @@ Create_func_cot Create_func_cot::s_singleton;
Item*
Create_func_cot::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_cot(arg1);
+ return new (thd->mem_root) Item_func_cot(thd, arg1);
}
@@ -3607,7 +3607,7 @@ Create_func_crc32 Create_func_crc32::s_singleton;
Item*
Create_func_crc32::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_crc32(arg1);
+ return new (thd->mem_root) Item_func_crc32(thd, arg1);
}
@@ -3617,7 +3617,7 @@ Create_func_crosses Create_func_crosses::s_singleton;
Item*
Create_func_crosses::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_spatial_precise_rel(arg1, arg2,
+ return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2,
Item_func::SP_CROSSES_FUNC);
}
#endif
@@ -3628,7 +3628,7 @@ Create_func_date_format Create_func_date_format::s_singleton;
Item*
Create_func_date_format::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_date_format(arg1, arg2, 0);
+ return new (thd->mem_root) Item_func_date_format(thd, arg1, arg2, 0);
}
@@ -3637,10 +3637,10 @@ Create_func_datediff Create_func_datediff::s_singleton;
Item*
Create_func_datediff::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- Item *i1= new (thd->mem_root) Item_func_to_days(arg1);
- Item *i2= new (thd->mem_root) Item_func_to_days(arg2);
+ Item *i1= new (thd->mem_root) Item_func_to_days(thd, arg1);
+ Item *i2= new (thd->mem_root) Item_func_to_days(thd, arg2);
- return new (thd->mem_root) Item_func_minus(i1, i2);
+ return new (thd->mem_root) Item_func_minus(thd, i1, i2);
}
@@ -3649,7 +3649,7 @@ Create_func_dayname Create_func_dayname::s_singleton;
Item*
Create_func_dayname::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_dayname(arg1);
+ return new (thd->mem_root) Item_func_dayname(thd, arg1);
}
@@ -3658,7 +3658,7 @@ Create_func_dayofmonth Create_func_dayofmonth::s_singleton;
Item*
Create_func_dayofmonth::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_dayofmonth(arg1);
+ return new (thd->mem_root) Item_func_dayofmonth(thd, arg1);
}
@@ -3667,7 +3667,7 @@ Create_func_dayofweek Create_func_dayofweek::s_singleton;
Item*
Create_func_dayofweek::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_weekday(arg1, 1);
+ return new (thd->mem_root) Item_func_weekday(thd, arg1, 1);
}
@@ -3676,7 +3676,7 @@ Create_func_dayofyear Create_func_dayofyear::s_singleton;
Item*
Create_func_dayofyear::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_dayofyear(arg1);
+ return new (thd->mem_root) Item_func_dayofyear(thd, arg1);
}
@@ -3685,7 +3685,7 @@ Create_func_decode Create_func_decode::s_singleton;
Item*
Create_func_decode::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_decode(arg1, arg2);
+ return new (thd->mem_root) Item_func_decode(thd, arg1, arg2);
}
@@ -3694,7 +3694,7 @@ Create_func_degrees Create_func_degrees::s_singleton;
Item*
Create_func_degrees::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_units((char*) "degrees", arg1,
+ return new (thd->mem_root) Item_func_units(thd, (char*) "degrees", arg1,
180/M_PI, 0.0);
}
@@ -3715,14 +3715,14 @@ Create_func_des_decrypt::create_native(THD *thd, LEX_STRING name,
case 1:
{
Item *param_1= item_list->pop();
- func= new (thd->mem_root) Item_func_des_decrypt(param_1);
+ func= new (thd->mem_root) Item_func_des_decrypt(thd, param_1);
break;
}
case 2:
{
Item *param_1= item_list->pop();
Item *param_2= item_list->pop();
- func= new (thd->mem_root) Item_func_des_decrypt(param_1, param_2);
+ func= new (thd->mem_root) Item_func_des_decrypt(thd, param_1, param_2);
break;
}
default:
@@ -3752,14 +3752,14 @@ Create_func_des_encrypt::create_native(THD *thd, LEX_STRING name,
case 1:
{
Item *param_1= item_list->pop();
- func= new (thd->mem_root) Item_func_des_encrypt(param_1);
+ func= new (thd->mem_root) Item_func_des_encrypt(thd, param_1);
break;
}
case 2:
{
Item *param_1= item_list->pop();
Item *param_2= item_list->pop();
- func= new (thd->mem_root) Item_func_des_encrypt(param_1, param_2);
+ func= new (thd->mem_root) Item_func_des_encrypt(thd, param_1, param_2);
break;
}
default:
@@ -3779,7 +3779,7 @@ Create_func_dimension Create_func_dimension::s_singleton;
Item*
Create_func_dimension::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_dimension(arg1);
+ return new (thd->mem_root) Item_func_dimension(thd, arg1);
}
#endif
@@ -3790,7 +3790,7 @@ Create_func_mbr_disjoint Create_func_mbr_disjoint::s_singleton;
Item*
Create_func_mbr_disjoint::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_spatial_mbr_rel(arg1, arg2,
+ return new (thd->mem_root) Item_func_spatial_mbr_rel(thd, arg1, arg2,
Item_func::SP_DISJOINT_FUNC);
}
@@ -3800,7 +3800,7 @@ Create_func_disjoint Create_func_disjoint::s_singleton;
Item*
Create_func_disjoint::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_spatial_precise_rel(arg1, arg2,
+ return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2,
Item_func::SP_DISJOINT_FUNC);
}
@@ -3810,7 +3810,7 @@ Create_func_distance Create_func_distance::s_singleton;
Item*
Create_func_distance::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_distance(arg1, arg2);
+ return new (thd->mem_root) Item_func_distance(thd, arg1, arg2);
}
#endif
@@ -3832,7 +3832,7 @@ Create_func_elt::create_native(THD *thd, LEX_STRING name,
return NULL;
}
- return new (thd->mem_root) Item_func_elt(*item_list);
+ return new (thd->mem_root) Item_func_elt(thd, *item_list);
}
@@ -3841,7 +3841,7 @@ Create_func_encode Create_func_encode::s_singleton;
Item*
Create_func_encode::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_encode(arg1, arg2);
+ return new (thd->mem_root) Item_func_encode(thd, arg1, arg2);
}
@@ -3861,7 +3861,7 @@ Create_func_encrypt::create_native(THD *thd, LEX_STRING name,
case 1:
{
Item *param_1= item_list->pop();
- func= new (thd->mem_root) Item_func_encrypt(param_1);
+ func= new (thd->mem_root) Item_func_encrypt(thd, param_1);
thd->lex->uncacheable(UNCACHEABLE_RAND);
break;
}
@@ -3869,7 +3869,7 @@ Create_func_encrypt::create_native(THD *thd, LEX_STRING name,
{
Item *param_1= item_list->pop();
Item *param_2= item_list->pop();
- func= new (thd->mem_root) Item_func_encrypt(param_1, param_2);
+ func= new (thd->mem_root) Item_func_encrypt(thd, param_1, param_2);
break;
}
default:
@@ -3889,7 +3889,7 @@ Create_func_endpoint Create_func_endpoint::s_singleton;
Item*
Create_func_endpoint::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_spatial_decomp(arg1,
+ return new (thd->mem_root) Item_func_spatial_decomp(thd, arg1,
Item_func::SP_ENDPOINT);
}
#endif
@@ -3901,7 +3901,7 @@ Create_func_envelope Create_func_envelope::s_singleton;
Item*
Create_func_envelope::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_envelope(arg1);
+ return new (thd->mem_root) Item_func_envelope(thd, arg1);
}
@@ -3910,7 +3910,7 @@ Create_func_boundary Create_func_boundary::s_singleton;
Item*
Create_func_boundary::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_boundary(arg1);
+ return new (thd->mem_root) Item_func_boundary(thd, arg1);
}
#endif
@@ -3921,7 +3921,7 @@ Create_func_mbr_equals Create_func_mbr_equals::s_singleton;
Item*
Create_func_mbr_equals::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_spatial_mbr_rel(arg1, arg2,
+ return new (thd->mem_root) Item_func_spatial_mbr_rel(thd, arg1, arg2,
Item_func::SP_EQUALS_FUNC);
}
@@ -3931,7 +3931,7 @@ Create_func_equals Create_func_equals::s_singleton;
Item*
Create_func_equals::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_spatial_precise_rel(arg1, arg2,
+ return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2,
Item_func::SP_EQUALS_FUNC);
}
#endif
@@ -3942,7 +3942,7 @@ Create_func_exp Create_func_exp::s_singleton;
Item*
Create_func_exp::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_exp(arg1);
+ return new (thd->mem_root) Item_func_exp(thd, arg1);
}
@@ -3964,7 +3964,7 @@ Create_func_export_set::create_native(THD *thd, LEX_STRING name,
Item *param_1= item_list->pop();
Item *param_2= item_list->pop();
Item *param_3= item_list->pop();
- func= new (thd->mem_root) Item_func_export_set(param_1, param_2, param_3);
+ func= new (thd->mem_root) Item_func_export_set(thd, param_1, param_2, param_3);
break;
}
case 4:
@@ -3973,7 +3973,7 @@ Create_func_export_set::create_native(THD *thd, LEX_STRING name,
Item *param_2= item_list->pop();
Item *param_3= item_list->pop();
Item *param_4= item_list->pop();
- func= new (thd->mem_root) Item_func_export_set(param_1, param_2, param_3,
+ func= new (thd->mem_root) Item_func_export_set(thd, param_1, param_2, param_3,
param_4);
break;
}
@@ -3984,7 +3984,7 @@ Create_func_export_set::create_native(THD *thd, LEX_STRING name,
Item *param_3= item_list->pop();
Item *param_4= item_list->pop();
Item *param_5= item_list->pop();
- func= new (thd->mem_root) Item_func_export_set(param_1, param_2, param_3,
+ func= new (thd->mem_root) Item_func_export_set(thd, param_1, param_2, param_3,
param_4, param_5);
break;
}
@@ -4005,7 +4005,7 @@ Create_func_exteriorring Create_func_exteriorring::s_singleton;
Item*
Create_func_exteriorring::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_spatial_decomp(arg1,
+ return new (thd->mem_root) Item_func_spatial_decomp(thd, arg1,
Item_func::SP_EXTERIORRING);
}
#endif
@@ -4028,7 +4028,7 @@ Create_func_field::create_native(THD *thd, LEX_STRING name,
return NULL;
}
- return new (thd->mem_root) Item_func_field(*item_list);
+ return new (thd->mem_root) Item_func_field(thd, *item_list);
}
@@ -4037,7 +4037,7 @@ Create_func_find_in_set Create_func_find_in_set::s_singleton;
Item*
Create_func_find_in_set::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_find_in_set(arg1, arg2);
+ return new (thd->mem_root) Item_func_find_in_set(thd, arg1, arg2);
}
@@ -4046,7 +4046,7 @@ Create_func_floor Create_func_floor::s_singleton;
Item*
Create_func_floor::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_floor(arg1);
+ return new (thd->mem_root) Item_func_floor(thd, arg1);
}
@@ -4064,7 +4064,7 @@ Create_func_format::create_native(THD *thd, LEX_STRING name,
{
Item *param_1= item_list->pop();
Item *param_2= item_list->pop();
- func= new (thd->mem_root) Item_func_format(param_1, param_2);
+ func= new (thd->mem_root) Item_func_format(thd, param_1, param_2);
break;
}
case 3:
@@ -4072,7 +4072,7 @@ Create_func_format::create_native(THD *thd, LEX_STRING name,
Item *param_1= item_list->pop();
Item *param_2= item_list->pop();
Item *param_3= item_list->pop();
- func= new (thd->mem_root) Item_func_format(param_1, param_2, param_3);
+ func= new (thd->mem_root) Item_func_format(thd, param_1, param_2, param_3);
break;
}
default:
@@ -4090,7 +4090,7 @@ Create_func_from_base64 Create_func_from_base64::s_singleton;
Item *
Create_func_from_base64::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_from_base64(arg1);
+ return new (thd->mem_root) Item_func_from_base64(thd, arg1);
}
@@ -4102,7 +4102,7 @@ Create_func_found_rows::create_builder(THD *thd)
DBUG_ENTER("Create_func_found_rows::create");
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
thd->lex->safe_to_cache_query= 0;
- DBUG_RETURN(new (thd->mem_root) Item_func_found_rows());
+ DBUG_RETURN(new (thd->mem_root) Item_func_found_rows(thd));
}
@@ -4111,7 +4111,7 @@ Create_func_from_days Create_func_from_days::s_singleton;
Item*
Create_func_from_days::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_from_days(arg1);
+ return new (thd->mem_root) Item_func_from_days(thd, arg1);
}
@@ -4131,15 +4131,15 @@ Create_func_from_unixtime::create_native(THD *thd, LEX_STRING name,
case 1:
{
Item *param_1= item_list->pop();
- func= new (thd->mem_root) Item_func_from_unixtime(param_1);
+ func= new (thd->mem_root) Item_func_from_unixtime(thd, param_1);
break;
}
case 2:
{
Item *param_1= item_list->pop();
Item *param_2= item_list->pop();
- Item *ut= new (thd->mem_root) Item_func_from_unixtime(param_1);
- func= new (thd->mem_root) Item_func_date_format(ut, param_2, 0);
+ Item *ut= new (thd->mem_root) Item_func_from_unixtime(thd, param_1);
+ func= new (thd->mem_root) Item_func_date_format(thd, ut, param_2, 0);
break;
}
default:
@@ -4170,7 +4170,7 @@ Create_func_geometry_from_text::create_native(THD *thd, LEX_STRING name,
case 1:
{
Item *param_1= item_list->pop();
- func= new (thd->mem_root) Item_func_geometry_from_text(param_1);
+ func= new (thd->mem_root) Item_func_geometry_from_text(thd, param_1);
thd->lex->uncacheable(UNCACHEABLE_RAND);
break;
}
@@ -4178,7 +4178,7 @@ Create_func_geometry_from_text::create_native(THD *thd, LEX_STRING name,
{
Item *param_1= item_list->pop();
Item *param_2= item_list->pop();
- func= new (thd->mem_root) Item_func_geometry_from_text(param_1, param_2);
+ func= new (thd->mem_root) Item_func_geometry_from_text(thd, param_1, param_2);
break;
}
default:
@@ -4210,7 +4210,7 @@ Create_func_geometry_from_wkb::create_native(THD *thd, LEX_STRING name,
case 1:
{
Item *param_1= item_list->pop();
- func= new (thd->mem_root) Item_func_geometry_from_wkb(param_1);
+ func= new (thd->mem_root) Item_func_geometry_from_wkb(thd, param_1);
thd->lex->uncacheable(UNCACHEABLE_RAND);
break;
}
@@ -4218,7 +4218,7 @@ Create_func_geometry_from_wkb::create_native(THD *thd, LEX_STRING name,
{
Item *param_1= item_list->pop();
Item *param_2= item_list->pop();
- func= new (thd->mem_root) Item_func_geometry_from_wkb(param_1, param_2);
+ func= new (thd->mem_root) Item_func_geometry_from_wkb(thd, param_1, param_2);
break;
}
default:
@@ -4239,7 +4239,7 @@ Create_func_geometry_type Create_func_geometry_type::s_singleton;
Item*
Create_func_geometry_type::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_geometry_type(arg1);
+ return new (thd->mem_root) Item_func_geometry_type(thd, arg1);
}
#endif
@@ -4250,7 +4250,7 @@ Create_func_geometryn Create_func_geometryn::s_singleton;
Item*
Create_func_geometryn::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_spatial_decomp_n(arg1, arg2,
+ return new (thd->mem_root) Item_func_spatial_decomp_n(thd, arg1, arg2,
Item_func::SP_GEOMETRYN);
}
#endif
@@ -4263,7 +4263,7 @@ Create_func_get_lock::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
- return new (thd->mem_root) Item_func_get_lock(arg1, arg2);
+ return new (thd->mem_root) Item_func_get_lock(thd, arg1, arg2);
}
@@ -4273,7 +4273,7 @@ Create_func_gis_debug Create_func_gis_debug::s_singleton;
Item*
Create_func_gis_debug::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_gis_debug(arg1);
+ return new (thd->mem_root) Item_func_gis_debug(thd, arg1);
}
#endif
@@ -4284,7 +4284,7 @@ Create_func_glength Create_func_glength::s_singleton;
Item*
Create_func_glength::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_glength(arg1);
+ return new (thd->mem_root) Item_func_glength(thd, arg1);
}
#endif
@@ -4306,7 +4306,7 @@ Create_func_greatest::create_native(THD *thd, LEX_STRING name,
return NULL;
}
- return new (thd->mem_root) Item_func_max(*item_list);
+ return new (thd->mem_root) Item_func_max(thd, *item_list);
}
@@ -4315,7 +4315,7 @@ Create_func_hex Create_func_hex::s_singleton;
Item*
Create_func_hex::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_hex(arg1);
+ return new (thd->mem_root) Item_func_hex(thd, arg1);
}
@@ -4324,7 +4324,7 @@ Create_func_ifnull Create_func_ifnull::s_singleton;
Item*
Create_func_ifnull::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_ifnull(arg1, arg2);
+ return new (thd->mem_root) Item_func_ifnull(thd, arg1, arg2);
}
@@ -4333,7 +4333,7 @@ Create_func_inet_ntoa Create_func_inet_ntoa::s_singleton;
Item*
Create_func_inet_ntoa::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_inet_ntoa(arg1);
+ return new (thd->mem_root) Item_func_inet_ntoa(thd, arg1);
}
@@ -4342,7 +4342,7 @@ Create_func_inet6_aton Create_func_inet6_aton::s_singleton;
Item*
Create_func_inet6_aton::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_inet6_aton(arg1);
+ return new (thd->mem_root) Item_func_inet6_aton(thd, arg1);
}
@@ -4351,7 +4351,7 @@ Create_func_inet6_ntoa Create_func_inet6_ntoa::s_singleton;
Item*
Create_func_inet6_ntoa::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_inet6_ntoa(arg1);
+ return new (thd->mem_root) Item_func_inet6_ntoa(thd, arg1);
}
@@ -4360,7 +4360,7 @@ Create_func_inet_aton Create_func_inet_aton::s_singleton;
Item*
Create_func_inet_aton::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_inet_aton(arg1);
+ return new (thd->mem_root) Item_func_inet_aton(thd, arg1);
}
@@ -4369,7 +4369,7 @@ Create_func_is_ipv4 Create_func_is_ipv4::s_singleton;
Item*
Create_func_is_ipv4::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_is_ipv4(arg1);
+ return new (thd->mem_root) Item_func_is_ipv4(thd, arg1);
}
@@ -4378,7 +4378,7 @@ Create_func_is_ipv6 Create_func_is_ipv6::s_singleton;
Item*
Create_func_is_ipv6::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_is_ipv6(arg1);
+ return new (thd->mem_root) Item_func_is_ipv6(thd, arg1);
}
@@ -4387,7 +4387,7 @@ Create_func_is_ipv4_compat Create_func_is_ipv4_compat::s_singleton;
Item*
Create_func_is_ipv4_compat::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_is_ipv4_compat(arg1);
+ return new (thd->mem_root) Item_func_is_ipv4_compat(thd, arg1);
}
@@ -4396,7 +4396,7 @@ Create_func_is_ipv4_mapped Create_func_is_ipv4_mapped::s_singleton;
Item*
Create_func_is_ipv4_mapped::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_is_ipv4_mapped(arg1);
+ return new (thd->mem_root) Item_func_is_ipv4_mapped(thd, arg1);
}
@@ -4405,7 +4405,7 @@ Create_func_instr Create_func_instr::s_singleton;
Item*
Create_func_instr::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_locate(arg1, arg2);
+ return new (thd->mem_root) Item_func_locate(thd, arg1, arg2);
}
@@ -4415,7 +4415,7 @@ Create_func_interiorringn Create_func_interiorringn::s_singleton;
Item*
Create_func_interiorringn::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_spatial_decomp_n(arg1, arg2,
+ return new (thd->mem_root) Item_func_spatial_decomp_n(thd, arg1, arg2,
Item_func::SP_INTERIORRINGN);
}
#endif
@@ -4427,7 +4427,7 @@ Create_func_relate Create_func_relate::s_singleton;
Item*
Create_func_relate::create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *matrix)
{
- return new (thd->mem_root) Item_func_spatial_precise_rel(arg1, arg2, matrix);
+ return new (thd->mem_root) Item_func_spatial_relate(thd, arg1, arg2, matrix);
}
@@ -4436,7 +4436,7 @@ Create_func_mbr_intersects Create_func_mbr_intersects::s_singleton;
Item*
Create_func_mbr_intersects::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_spatial_mbr_rel(arg1, arg2,
+ return new (thd->mem_root) Item_func_spatial_mbr_rel(thd, arg1, arg2,
Item_func::SP_INTERSECTS_FUNC);
}
@@ -4446,7 +4446,7 @@ Create_func_intersects Create_func_intersects::s_singleton;
Item*
Create_func_intersects::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_spatial_precise_rel(arg1, arg2,
+ return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2,
Item_func::SP_INTERSECTS_FUNC);
}
@@ -4456,7 +4456,7 @@ Create_func_intersection Create_func_intersection::s_singleton;
Item*
Create_func_intersection::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_spatial_operation(arg1, arg2,
+ return new (thd->mem_root) Item_func_spatial_operation(thd, arg1, arg2,
Gcalc_function::op_intersection);
}
@@ -4466,7 +4466,7 @@ Create_func_difference Create_func_difference::s_singleton;
Item*
Create_func_difference::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_spatial_operation(arg1, arg2,
+ return new (thd->mem_root) Item_func_spatial_operation(thd, arg1, arg2,
Gcalc_function::op_difference);
}
@@ -4476,7 +4476,7 @@ Create_func_union Create_func_union::s_singleton;
Item*
Create_func_union::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_spatial_operation(arg1, arg2,
+ return new (thd->mem_root) Item_func_spatial_operation(thd, arg1, arg2,
Gcalc_function::op_union);
}
@@ -4486,7 +4486,7 @@ Create_func_symdifference Create_func_symdifference::s_singleton;
Item*
Create_func_symdifference::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_spatial_operation(arg1, arg2,
+ return new (thd->mem_root) Item_func_spatial_operation(thd, arg1, arg2,
Gcalc_function::op_symdifference);
}
@@ -4496,7 +4496,7 @@ Create_func_buffer Create_func_buffer::s_singleton;
Item*
Create_func_buffer::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_buffer(arg1, arg2);
+ return new (thd->mem_root) Item_func_buffer(thd, arg1, arg2);
}
#endif /*HAVE_SPATAI*/
@@ -4508,7 +4508,7 @@ Create_func_is_free_lock::create_1_arg(THD *thd, Item *arg1)
{
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
- return new (thd->mem_root) Item_func_is_free_lock(arg1);
+ return new (thd->mem_root) Item_func_is_free_lock(thd, arg1);
}
@@ -4519,7 +4519,7 @@ Create_func_is_used_lock::create_1_arg(THD *thd, Item *arg1)
{
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
- return new (thd->mem_root) Item_func_is_used_lock(arg1);
+ return new (thd->mem_root) Item_func_is_used_lock(thd, arg1);
}
@@ -4529,7 +4529,7 @@ Create_func_isclosed Create_func_isclosed::s_singleton;
Item*
Create_func_isclosed::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_isclosed(arg1);
+ return new (thd->mem_root) Item_func_isclosed(thd, arg1);
}
@@ -4538,7 +4538,7 @@ Create_func_isring Create_func_isring::s_singleton;
Item*
Create_func_isring::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_isring(arg1);
+ return new (thd->mem_root) Item_func_isring(thd, arg1);
}
@@ -4547,7 +4547,7 @@ Create_func_isempty Create_func_isempty::s_singleton;
Item*
Create_func_isempty::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_isempty(arg1);
+ return new (thd->mem_root) Item_func_isempty(thd, arg1);
}
#endif /*HAVE_SPATIAL*/
@@ -4557,7 +4557,7 @@ Create_func_isnull Create_func_isnull::s_singleton;
Item*
Create_func_isnull::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_isnull(arg1);
+ return new (thd->mem_root) Item_func_isnull(thd, arg1);
}
@@ -4567,7 +4567,7 @@ Create_func_issimple Create_func_issimple::s_singleton;
Item*
Create_func_issimple::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_issimple(arg1);
+ return new (thd->mem_root) Item_func_issimple(thd, arg1);
}
#endif
@@ -4577,7 +4577,7 @@ Create_func_last_day Create_func_last_day::s_singleton;
Item*
Create_func_last_day::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_last_day(arg1);
+ return new (thd->mem_root) Item_func_last_day(thd, arg1);
}
@@ -4596,14 +4596,14 @@ Create_func_last_insert_id::create_native(THD *thd, LEX_STRING name,
switch (arg_count) {
case 0:
{
- func= new (thd->mem_root) Item_func_last_insert_id();
+ func= new (thd->mem_root) Item_func_last_insert_id(thd);
thd->lex->safe_to_cache_query= 0;
break;
}
case 1:
{
Item *param_1= item_list->pop();
- func= new (thd->mem_root) Item_func_last_insert_id(param_1);
+ func= new (thd->mem_root) Item_func_last_insert_id(thd, param_1);
thd->lex->safe_to_cache_query= 0;
break;
}
@@ -4623,7 +4623,7 @@ Create_func_lcase Create_func_lcase::s_singleton;
Item*
Create_func_lcase::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_lcase(arg1);
+ return new (thd->mem_root) Item_func_lcase(thd, arg1);
}
@@ -4644,7 +4644,7 @@ Create_func_least::create_native(THD *thd, LEX_STRING name,
return NULL;
}
- return new (thd->mem_root) Item_func_min(*item_list);
+ return new (thd->mem_root) Item_func_min(thd, *item_list);
}
@@ -4653,7 +4653,7 @@ Create_func_length Create_func_length::s_singleton;
Item*
Create_func_length::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_length(arg1);
+ return new (thd->mem_root) Item_func_length(thd, arg1);
}
@@ -4663,7 +4663,7 @@ Create_func_like_range_min Create_func_like_range_min::s_singleton;
Item*
Create_func_like_range_min::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_like_range_min(arg1, arg2);
+ return new (thd->mem_root) Item_func_like_range_min(thd, arg1, arg2);
}
@@ -4672,7 +4672,7 @@ Create_func_like_range_max Create_func_like_range_max::s_singleton;
Item*
Create_func_like_range_max::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_like_range_max(arg1, arg2);
+ return new (thd->mem_root) Item_func_like_range_max(thd, arg1, arg2);
}
#endif
@@ -4682,7 +4682,7 @@ Create_func_ln Create_func_ln::s_singleton;
Item*
Create_func_ln::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_ln(arg1);
+ return new (thd->mem_root) Item_func_ln(thd, arg1);
}
@@ -4694,7 +4694,7 @@ Create_func_load_file::create_1_arg(THD *thd, Item *arg1)
DBUG_ENTER("Create_func_load_file::create");
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
- DBUG_RETURN(new (thd->mem_root) Item_load_file(arg1));
+ DBUG_RETURN(new (thd->mem_root) Item_load_file(thd, arg1));
}
@@ -4716,7 +4716,7 @@ Create_func_locate::create_native(THD *thd, LEX_STRING name,
Item *param_1= item_list->pop();
Item *param_2= item_list->pop();
/* Yes, parameters in that order : 2, 1 */
- func= new (thd->mem_root) Item_func_locate(param_2, param_1);
+ func= new (thd->mem_root) Item_func_locate(thd, param_2, param_1);
break;
}
case 3:
@@ -4725,7 +4725,7 @@ Create_func_locate::create_native(THD *thd, LEX_STRING name,
Item *param_2= item_list->pop();
Item *param_3= item_list->pop();
/* Yes, parameters in that order : 2, 1, 3 */
- func= new (thd->mem_root) Item_func_locate(param_2, param_1, param_3);
+ func= new (thd->mem_root) Item_func_locate(thd, param_2, param_1, param_3);
break;
}
default:
@@ -4755,14 +4755,14 @@ Create_func_log::create_native(THD *thd, LEX_STRING name,
case 1:
{
Item *param_1= item_list->pop();
- func= new (thd->mem_root) Item_func_log(param_1);
+ func= new (thd->mem_root) Item_func_log(thd, param_1);
break;
}
case 2:
{
Item *param_1= item_list->pop();
Item *param_2= item_list->pop();
- func= new (thd->mem_root) Item_func_log(param_1, param_2);
+ func= new (thd->mem_root) Item_func_log(thd, param_1, param_2);
break;
}
default:
@@ -4781,7 +4781,7 @@ Create_func_log10 Create_func_log10::s_singleton;
Item*
Create_func_log10::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_log10(arg1);
+ return new (thd->mem_root) Item_func_log10(thd, arg1);
}
@@ -4790,7 +4790,7 @@ Create_func_log2 Create_func_log2::s_singleton;
Item*
Create_func_log2::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_log2(arg1);
+ return new (thd->mem_root) Item_func_log2(thd, arg1);
}
@@ -4799,7 +4799,7 @@ Create_func_lpad Create_func_lpad::s_singleton;
Item*
Create_func_lpad::create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3)
{
- return new (thd->mem_root) Item_func_lpad(arg1, arg2, arg3);
+ return new (thd->mem_root) Item_func_lpad(thd, arg1, arg2, arg3);
}
@@ -4808,7 +4808,7 @@ Create_func_ltrim Create_func_ltrim::s_singleton;
Item*
Create_func_ltrim::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_ltrim(arg1);
+ return new (thd->mem_root) Item_func_ltrim(thd, arg1);
}
@@ -4817,7 +4817,7 @@ Create_func_makedate Create_func_makedate::s_singleton;
Item*
Create_func_makedate::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_makedate(arg1, arg2);
+ return new (thd->mem_root) Item_func_makedate(thd, arg1, arg2);
}
@@ -4826,7 +4826,7 @@ Create_func_maketime Create_func_maketime::s_singleton;
Item*
Create_func_maketime::create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3)
{
- return new (thd->mem_root) Item_func_maketime(arg1, arg2, arg3);
+ return new (thd->mem_root) Item_func_maketime(thd, arg1, arg2, arg3);
}
@@ -4847,7 +4847,7 @@ Create_func_make_set::create_native(THD *thd, LEX_STRING name,
return NULL;
}
- return new (thd->mem_root) Item_func_make_set(*item_list);
+ return new (thd->mem_root) Item_func_make_set(thd, *item_list);
}
@@ -4879,20 +4879,20 @@ Create_func_master_pos_wait::create_native(THD *thd, LEX_STRING name,
switch (arg_count) {
case 2:
{
- func= new (thd->mem_root) Item_master_pos_wait(param_1, param_2);
+ func= new (thd->mem_root) Item_master_pos_wait(thd, param_1, param_2);
break;
}
case 3:
{
Item *param_3= item_list->pop();
- func= new (thd->mem_root) Item_master_pos_wait(param_1, param_2, param_3);
+ func= new (thd->mem_root) Item_master_pos_wait(thd, param_1, param_2, param_3);
break;
}
case 4:
{
Item *param_3= item_list->pop();
Item *param_4= item_list->pop();
- func= new (thd->mem_root) Item_master_pos_wait(param_1, param_2, param_3,
+ func= new (thd->mem_root) Item_master_pos_wait(thd, param_1, param_2, param_3,
param_4);
break;
}
@@ -4928,13 +4928,13 @@ Create_func_master_gtid_wait::create_native(THD *thd, LEX_STRING name,
switch (arg_count) {
case 1:
{
- func= new (thd->mem_root) Item_master_gtid_wait(param_1);
+ func= new (thd->mem_root) Item_master_gtid_wait(thd, param_1);
break;
}
case 2:
{
Item *param_2= item_list->pop();
- func= new (thd->mem_root) Item_master_gtid_wait(param_1, param_2);
+ func= new (thd->mem_root) Item_master_gtid_wait(thd, param_1, param_2);
break;
}
}
@@ -4948,7 +4948,7 @@ Create_func_md5 Create_func_md5::s_singleton;
Item*
Create_func_md5::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_md5(arg1);
+ return new (thd->mem_root) Item_func_md5(thd, arg1);
}
@@ -4957,7 +4957,7 @@ Create_func_monthname Create_func_monthname::s_singleton;
Item*
Create_func_monthname::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_monthname(arg1);
+ return new (thd->mem_root) Item_func_monthname(thd, arg1);
}
@@ -4966,7 +4966,7 @@ Create_func_name_const Create_func_name_const::s_singleton;
Item*
Create_func_name_const::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_name_const(arg1, arg2);
+ return new (thd->mem_root) Item_name_const(thd, arg1, arg2);
}
@@ -4975,7 +4975,7 @@ Create_func_nullif Create_func_nullif::s_singleton;
Item*
Create_func_nullif::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_nullif(arg1, arg2);
+ return new (thd->mem_root) Item_func_nullif(thd, arg1, arg2);
}
@@ -4985,7 +4985,7 @@ Create_func_numgeometries Create_func_numgeometries::s_singleton;
Item*
Create_func_numgeometries::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_numgeometries(arg1);
+ return new (thd->mem_root) Item_func_numgeometries(thd, arg1);
}
#endif
@@ -4996,7 +4996,7 @@ Create_func_numinteriorring Create_func_numinteriorring::s_singleton;
Item*
Create_func_numinteriorring::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_numinteriorring(arg1);
+ return new (thd->mem_root) Item_func_numinteriorring(thd, arg1);
}
#endif
@@ -5007,7 +5007,7 @@ Create_func_numpoints Create_func_numpoints::s_singleton;
Item*
Create_func_numpoints::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_numpoints(arg1);
+ return new (thd->mem_root) Item_func_numpoints(thd, arg1);
}
#endif
@@ -5017,9 +5017,9 @@ Create_func_oct Create_func_oct::s_singleton;
Item*
Create_func_oct::create_1_arg(THD *thd, Item *arg1)
{
- Item *i10= new (thd->mem_root) Item_int((int32) 10,2);
- Item *i8= new (thd->mem_root) Item_int((int32) 8,1);
- return new (thd->mem_root) Item_func_conv(arg1, i10, i8);
+ Item *i10= new (thd->mem_root) Item_int(thd, (int32) 10,2);
+ Item *i8= new (thd->mem_root) Item_int(thd, (int32) 8,1);
+ return new (thd->mem_root) Item_func_conv(thd, arg1, i10, i8);
}
@@ -5028,7 +5028,7 @@ Create_func_ord Create_func_ord::s_singleton;
Item*
Create_func_ord::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_ord(arg1);
+ return new (thd->mem_root) Item_func_ord(thd, arg1);
}
@@ -5038,7 +5038,7 @@ Create_func_mbr_overlaps Create_func_mbr_overlaps::s_singleton;
Item*
Create_func_mbr_overlaps::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_spatial_mbr_rel(arg1, arg2,
+ return new (thd->mem_root) Item_func_spatial_mbr_rel(thd, arg1, arg2,
Item_func::SP_OVERLAPS_FUNC);
}
@@ -5048,7 +5048,7 @@ Create_func_overlaps Create_func_overlaps::s_singleton;
Item*
Create_func_overlaps::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_spatial_precise_rel(arg1, arg2,
+ return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2,
Item_func::SP_OVERLAPS_FUNC);
}
#endif
@@ -5059,7 +5059,7 @@ Create_func_period_add Create_func_period_add::s_singleton;
Item*
Create_func_period_add::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_period_add(arg1, arg2);
+ return new (thd->mem_root) Item_func_period_add(thd, arg1, arg2);
}
@@ -5068,7 +5068,7 @@ Create_func_period_diff Create_func_period_diff::s_singleton;
Item*
Create_func_period_diff::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_period_diff(arg1, arg2);
+ return new (thd->mem_root) Item_func_period_diff(thd, arg1, arg2);
}
@@ -5077,7 +5077,7 @@ Create_func_pi Create_func_pi::s_singleton;
Item*
Create_func_pi::create_builder(THD *thd)
{
- return new (thd->mem_root) Item_static_float_func("pi()", M_PI, 6, 8);
+ return new (thd->mem_root) Item_static_float_func(thd, "pi()", M_PI, 6, 8);
}
@@ -5087,7 +5087,7 @@ Create_func_pointn Create_func_pointn::s_singleton;
Item*
Create_func_pointn::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_spatial_decomp_n(arg1, arg2,
+ return new (thd->mem_root) Item_func_spatial_decomp_n(thd, arg1, arg2,
Item_func::SP_POINTN);
}
#endif
@@ -5098,7 +5098,7 @@ Create_func_pow Create_func_pow::s_singleton;
Item*
Create_func_pow::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_pow(arg1, arg2);
+ return new (thd->mem_root) Item_func_pow(thd, arg1, arg2);
}
@@ -5107,7 +5107,7 @@ Create_func_quote Create_func_quote::s_singleton;
Item*
Create_func_quote::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_quote(arg1);
+ return new (thd->mem_root) Item_func_quote(thd, arg1);
}
@@ -5116,7 +5116,7 @@ Create_func_regexp_instr Create_func_regexp_instr::s_singleton;
Item*
Create_func_regexp_instr::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_regexp_instr(arg1, arg2);
+ return new (thd->mem_root) Item_func_regexp_instr(thd, arg1, arg2);
}
@@ -5125,7 +5125,7 @@ Create_func_regexp_replace Create_func_regexp_replace::s_singleton;
Item*
Create_func_regexp_replace::create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3)
{
- return new (thd->mem_root) Item_func_regexp_replace(arg1, arg2, arg3);
+ return new (thd->mem_root) Item_func_regexp_replace(thd, arg1, arg2, arg3);
}
@@ -5134,7 +5134,7 @@ Create_func_regexp_substr Create_func_regexp_substr::s_singleton;
Item*
Create_func_regexp_substr::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_regexp_substr(arg1, arg2);
+ return new (thd->mem_root) Item_func_regexp_substr(thd, arg1, arg2);
}
@@ -5143,7 +5143,7 @@ Create_func_radians Create_func_radians::s_singleton;
Item*
Create_func_radians::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_units((char*) "radians", arg1,
+ return new (thd->mem_root) Item_func_units(thd, (char*) "radians", arg1,
M_PI/180, 0.0);
}
@@ -5176,14 +5176,14 @@ Create_func_rand::create_native(THD *thd, LEX_STRING name,
switch (arg_count) {
case 0:
{
- func= new (thd->mem_root) Item_func_rand();
+ func= new (thd->mem_root) Item_func_rand(thd);
thd->lex->uncacheable(UNCACHEABLE_RAND);
break;
}
case 1:
{
Item *param_1= item_list->pop();
- func= new (thd->mem_root) Item_func_rand(param_1);
+ func= new (thd->mem_root) Item_func_rand(thd, param_1);
thd->lex->uncacheable(UNCACHEABLE_RAND);
break;
}
@@ -5205,7 +5205,7 @@ Create_func_release_lock::create_1_arg(THD *thd, Item *arg1)
{
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
- return new (thd->mem_root) Item_func_release_lock(arg1);
+ return new (thd->mem_root) Item_func_release_lock(thd, arg1);
}
@@ -5214,7 +5214,7 @@ Create_func_reverse Create_func_reverse::s_singleton;
Item*
Create_func_reverse::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_reverse(arg1);
+ return new (thd->mem_root) Item_func_reverse(thd, arg1);
}
@@ -5234,15 +5234,15 @@ Create_func_round::create_native(THD *thd, LEX_STRING name,
case 1:
{
Item *param_1= item_list->pop();
- Item *i0 = new (thd->mem_root) Item_int((char*)"0", 0, 1);
- func= new (thd->mem_root) Item_func_round(param_1, i0, 0);
+ Item *i0= new (thd->mem_root) Item_int(thd, (char*)"0", 0, 1);
+ func= new (thd->mem_root) Item_func_round(thd, param_1, i0, 0);
break;
}
case 2:
{
Item *param_1= item_list->pop();
Item *param_2= item_list->pop();
- func= new (thd->mem_root) Item_func_round(param_1, param_2, 0);
+ func= new (thd->mem_root) Item_func_round(thd, param_1, param_2, 0);
break;
}
default:
@@ -5261,7 +5261,7 @@ Create_func_rpad Create_func_rpad::s_singleton;
Item*
Create_func_rpad::create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3)
{
- return new (thd->mem_root) Item_func_rpad(arg1, arg2, arg3);
+ return new (thd->mem_root) Item_func_rpad(thd, arg1, arg2, arg3);
}
@@ -5270,7 +5270,7 @@ Create_func_rtrim Create_func_rtrim::s_singleton;
Item*
Create_func_rtrim::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_rtrim(arg1);
+ return new (thd->mem_root) Item_func_rtrim(thd, arg1);
}
@@ -5279,7 +5279,7 @@ Create_func_sec_to_time Create_func_sec_to_time::s_singleton;
Item*
Create_func_sec_to_time::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_sec_to_time(arg1);
+ return new (thd->mem_root) Item_func_sec_to_time(thd, arg1);
}
@@ -5288,7 +5288,7 @@ Create_func_sha Create_func_sha::s_singleton;
Item*
Create_func_sha::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_sha(arg1);
+ return new (thd->mem_root) Item_func_sha(thd, arg1);
}
@@ -5297,7 +5297,7 @@ Create_func_sha2 Create_func_sha2::s_singleton;
Item*
Create_func_sha2::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_sha2(arg1, arg2);
+ return new (thd->mem_root) Item_func_sha2(thd, arg1, arg2);
}
@@ -5306,7 +5306,7 @@ Create_func_sign Create_func_sign::s_singleton;
Item*
Create_func_sign::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_sign(arg1);
+ return new (thd->mem_root) Item_func_sign(thd, arg1);
}
@@ -5315,7 +5315,7 @@ Create_func_sin Create_func_sin::s_singleton;
Item*
Create_func_sin::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_sin(arg1);
+ return new (thd->mem_root) Item_func_sin(thd, arg1);
}
@@ -5326,7 +5326,7 @@ Create_func_sleep::create_1_arg(THD *thd, Item *arg1)
{
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
- return new (thd->mem_root) Item_func_sleep(arg1);
+ return new (thd->mem_root) Item_func_sleep(thd, arg1);
}
@@ -5335,7 +5335,7 @@ Create_func_soundex Create_func_soundex::s_singleton;
Item*
Create_func_soundex::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_soundex(arg1);
+ return new (thd->mem_root) Item_func_soundex(thd, arg1);
}
@@ -5344,7 +5344,7 @@ Create_func_space Create_func_space::s_singleton;
Item*
Create_func_space::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_space(arg1);
+ return new (thd->mem_root) Item_func_space(thd, arg1);
}
@@ -5353,7 +5353,7 @@ Create_func_sqrt Create_func_sqrt::s_singleton;
Item*
Create_func_sqrt::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_sqrt(arg1);
+ return new (thd->mem_root) Item_func_sqrt(thd, arg1);
}
@@ -5363,7 +5363,7 @@ Create_func_srid Create_func_srid::s_singleton;
Item*
Create_func_srid::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_srid(arg1);
+ return new (thd->mem_root) Item_func_srid(thd, arg1);
}
#endif
@@ -5374,7 +5374,7 @@ Create_func_startpoint Create_func_startpoint::s_singleton;
Item*
Create_func_startpoint::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_spatial_decomp(arg1,
+ return new (thd->mem_root) Item_func_spatial_decomp(thd, arg1,
Item_func::SP_STARTPOINT);
}
#endif
@@ -5385,7 +5385,7 @@ Create_func_str_to_date Create_func_str_to_date::s_singleton;
Item*
Create_func_str_to_date::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_str_to_date(arg1, arg2);
+ return new (thd->mem_root) Item_func_str_to_date(thd, arg1, arg2);
}
@@ -5394,7 +5394,7 @@ Create_func_strcmp Create_func_strcmp::s_singleton;
Item*
Create_func_strcmp::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_strcmp(arg1, arg2);
+ return new (thd->mem_root) Item_func_strcmp(thd, arg1, arg2);
}
@@ -5403,7 +5403,7 @@ Create_func_substr_index Create_func_substr_index::s_singleton;
Item*
Create_func_substr_index::create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3)
{
- return new (thd->mem_root) Item_func_substr_index(arg1, arg2, arg3);
+ return new (thd->mem_root) Item_func_substr_index(thd, arg1, arg2, arg3);
}
@@ -5412,7 +5412,7 @@ Create_func_subtime Create_func_subtime::s_singleton;
Item*
Create_func_subtime::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_add_time(arg1, arg2, 0, 1);
+ return new (thd->mem_root) Item_func_add_time(thd, arg1, arg2, 0, 1);
}
@@ -5421,7 +5421,7 @@ Create_func_tan Create_func_tan::s_singleton;
Item*
Create_func_tan::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_tan(arg1);
+ return new (thd->mem_root) Item_func_tan(thd, arg1);
}
@@ -5430,7 +5430,7 @@ Create_func_time_format Create_func_time_format::s_singleton;
Item*
Create_func_time_format::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_date_format(arg1, arg2, 1);
+ return new (thd->mem_root) Item_func_date_format(thd, arg1, arg2, 1);
}
@@ -5439,7 +5439,7 @@ Create_func_time_to_sec Create_func_time_to_sec::s_singleton;
Item*
Create_func_time_to_sec::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_time_to_sec(arg1);
+ return new (thd->mem_root) Item_func_time_to_sec(thd, arg1);
}
@@ -5448,7 +5448,7 @@ Create_func_timediff Create_func_timediff::s_singleton;
Item*
Create_func_timediff::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_timediff(arg1, arg2);
+ return new (thd->mem_root) Item_func_timediff(thd, arg1, arg2);
}
@@ -5457,7 +5457,7 @@ Create_func_to_base64 Create_func_to_base64::s_singleton;
Item*
Create_func_to_base64::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_to_base64(arg1);
+ return new (thd->mem_root) Item_func_to_base64(thd, arg1);
}
@@ -5466,7 +5466,7 @@ Create_func_to_days Create_func_to_days::s_singleton;
Item*
Create_func_to_days::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_to_days(arg1);
+ return new (thd->mem_root) Item_func_to_days(thd, arg1);
}
@@ -5475,7 +5475,7 @@ Create_func_to_seconds Create_func_to_seconds::s_singleton;
Item*
Create_func_to_seconds::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_to_seconds(arg1);
+ return new (thd->mem_root) Item_func_to_seconds(thd, arg1);
}
@@ -5485,7 +5485,7 @@ Create_func_touches Create_func_touches::s_singleton;
Item*
Create_func_touches::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_spatial_precise_rel(arg1, arg2,
+ return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2,
Item_func::SP_TOUCHES_FUNC);
}
#endif
@@ -5496,7 +5496,7 @@ Create_func_ucase Create_func_ucase::s_singleton;
Item*
Create_func_ucase::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_ucase(arg1);
+ return new (thd->mem_root) Item_func_ucase(thd, arg1);
}
@@ -5505,7 +5505,7 @@ Create_func_uncompress Create_func_uncompress::s_singleton;
Item*
Create_func_uncompress::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_uncompress(arg1);
+ return new (thd->mem_root) Item_func_uncompress(thd, arg1);
}
@@ -5514,7 +5514,7 @@ Create_func_uncompressed_length Create_func_uncompressed_length::s_singleton;
Item*
Create_func_uncompressed_length::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_uncompressed_length(arg1);
+ return new (thd->mem_root) Item_func_uncompressed_length(thd, arg1);
}
@@ -5523,7 +5523,7 @@ Create_func_unhex Create_func_unhex::s_singleton;
Item*
Create_func_unhex::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_unhex(arg1);
+ return new (thd->mem_root) Item_func_unhex(thd, arg1);
}
@@ -5542,14 +5542,14 @@ Create_func_unix_timestamp::create_native(THD *thd, LEX_STRING name,
switch (arg_count) {
case 0:
{
- func= new (thd->mem_root) Item_func_unix_timestamp();
+ func= new (thd->mem_root) Item_func_unix_timestamp(thd);
thd->lex->safe_to_cache_query= 0;
break;
}
case 1:
{
Item *param_1= item_list->pop();
- func= new (thd->mem_root) Item_func_unix_timestamp(param_1);
+ func= new (thd->mem_root) Item_func_unix_timestamp(thd, param_1);
break;
}
default:
@@ -5571,7 +5571,7 @@ Create_func_uuid::create_builder(THD *thd)
DBUG_ENTER("Create_func_uuid::create");
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
thd->lex->safe_to_cache_query= 0;
- DBUG_RETURN(new (thd->mem_root) Item_func_uuid());
+ DBUG_RETURN(new (thd->mem_root) Item_func_uuid(thd));
}
@@ -5583,7 +5583,7 @@ Create_func_uuid_short::create_builder(THD *thd)
DBUG_ENTER("Create_func_uuid_short::create");
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
thd->lex->safe_to_cache_query= 0;
- DBUG_RETURN(new (thd->mem_root) Item_func_uuid_short());
+ DBUG_RETURN(new (thd->mem_root) Item_func_uuid_short(thd));
}
@@ -5593,7 +5593,7 @@ Item*
Create_func_version::create_builder(THD *thd)
{
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
- return new (thd->mem_root) Item_static_string_func("version()",
+ return new (thd->mem_root) Item_static_string_func(thd, "version()",
server_version,
(uint) strlen(server_version),
system_charset_info,
@@ -5606,7 +5606,7 @@ Create_func_weekday Create_func_weekday::s_singleton;
Item*
Create_func_weekday::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_weekday(arg1, 0);
+ return new (thd->mem_root) Item_func_weekday(thd, arg1, 0);
}
@@ -5615,8 +5615,8 @@ Create_func_weekofyear Create_func_weekofyear::s_singleton;
Item*
Create_func_weekofyear::create_1_arg(THD *thd, Item *arg1)
{
- Item *i1= new (thd->mem_root) Item_int((char*) "0", 3, 1);
- return new (thd->mem_root) Item_func_week(arg1, i1);
+ Item *i1= new (thd->mem_root) Item_int(thd, (char*) "0", 3, 1);
+ return new (thd->mem_root) Item_func_week(thd, arg1, i1);
}
@@ -5626,7 +5626,7 @@ Create_func_mbr_within Create_func_mbr_within::s_singleton;
Item*
Create_func_mbr_within::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_spatial_mbr_rel(arg1, arg2,
+ return new (thd->mem_root) Item_func_spatial_mbr_rel(thd, arg1, arg2,
Item_func::SP_WITHIN_FUNC);
}
@@ -5636,7 +5636,7 @@ Create_func_within Create_func_within::s_singleton;
Item*
Create_func_within::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_spatial_precise_rel(arg1, arg2,
+ return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2,
Item_func::SP_WITHIN_FUNC);
}
#endif
@@ -5648,7 +5648,7 @@ Create_func_x Create_func_x::s_singleton;
Item*
Create_func_x::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_x(arg1);
+ return new (thd->mem_root) Item_func_x(thd, arg1);
}
#endif
@@ -5658,7 +5658,7 @@ Create_func_xml_extractvalue Create_func_xml_extractvalue::s_singleton;
Item*
Create_func_xml_extractvalue::create_2_arg(THD *thd, Item *arg1, Item *arg2)
{
- return new (thd->mem_root) Item_func_xml_extractvalue(arg1, arg2);
+ return new (thd->mem_root) Item_func_xml_extractvalue(thd, arg1, arg2);
}
@@ -5667,7 +5667,7 @@ Create_func_xml_update Create_func_xml_update::s_singleton;
Item*
Create_func_xml_update::create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3)
{
- return new (thd->mem_root) Item_func_xml_update(arg1, arg2, arg3);
+ return new (thd->mem_root) Item_func_xml_update(thd, arg1, arg2, arg3);
}
@@ -5677,7 +5677,7 @@ Create_func_y Create_func_y::s_singleton;
Item*
Create_func_y::create_1_arg(THD *thd, Item *arg1)
{
- return new (thd->mem_root) Item_func_y(arg1);
+ return new (thd->mem_root) Item_func_y(thd, arg1);
}
#endif
@@ -5698,15 +5698,15 @@ Create_func_year_week::create_native(THD *thd, LEX_STRING name,
case 1:
{
Item *param_1= item_list->pop();
- Item *i0= new (thd->mem_root) Item_int((char*) "0", 0, 1);
- func= new (thd->mem_root) Item_func_yearweek(param_1, i0);
+ Item *i0= new (thd->mem_root) Item_int(thd, (char*) "0", 0, 1);
+ func= new (thd->mem_root) Item_func_yearweek(thd, param_1, i0);
break;
}
case 2:
{
Item *param_1= item_list->pop();
Item *param_2= item_list->pop();
- func= new (thd->mem_root) Item_func_yearweek(param_1, param_2);
+ func= new (thd->mem_root) Item_func_yearweek(thd, param_1, param_2);
break;
}
default:
@@ -6165,16 +6165,16 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
switch (cast_type) {
case ITEM_CAST_BINARY:
- res= new (thd->mem_root) Item_func_binary(a);
+ res= new (thd->mem_root) Item_func_binary(thd, a);
break;
case ITEM_CAST_SIGNED_INT:
- res= new (thd->mem_root) Item_func_signed(a);
+ res= new (thd->mem_root) Item_func_signed(thd, a);
break;
case ITEM_CAST_UNSIGNED_INT:
- res= new (thd->mem_root) Item_func_unsigned(a);
+ res= new (thd->mem_root) Item_func_unsigned(thd, a);
break;
case ITEM_CAST_DATE:
- res= new (thd->mem_root) Item_date_typecast(a);
+ res= new (thd->mem_root) Item_date_typecast(thd, a);
break;
case ITEM_CAST_TIME:
if (decimals > MAX_DATETIME_PRECISION)
@@ -6183,7 +6183,7 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
MAX_DATETIME_PRECISION);
return 0;
}
- res= new (thd->mem_root) Item_time_typecast(a, (uint) decimals);
+ res= new (thd->mem_root) Item_time_typecast(thd, a, (uint) decimals);
break;
case ITEM_CAST_DATETIME:
if (decimals > MAX_DATETIME_PRECISION)
@@ -6192,7 +6192,7 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
MAX_DATETIME_PRECISION);
return 0;
}
- res= new (thd->mem_root) Item_datetime_typecast(a, (uint) decimals);
+ res= new (thd->mem_root) Item_datetime_typecast(thd, a, (uint) decimals);
break;
case ITEM_CAST_DECIMAL:
{
@@ -6202,7 +6202,7 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
DECIMAL_MAX_PRECISION, DECIMAL_MAX_SCALE,
a))
return NULL;
- res= new (thd->mem_root) Item_decimal_typecast(a, len, dec);
+ res= new (thd->mem_root) Item_decimal_typecast(thd, a, len, dec);
break;
}
case ITEM_CAST_DOUBLE:
@@ -6219,7 +6219,7 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
DECIMAL_MAX_PRECISION, NOT_FIXED_DEC-1,
a))
return NULL;
- res= new (thd->mem_root) Item_double_typecast(a, (uint) length,
+ res= new (thd->mem_root) Item_double_typecast(thd, a, (uint) length,
(uint) decimals);
break;
}
@@ -6239,7 +6239,7 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
}
len= (int) length;
}
- res= new (thd->mem_root) Item_char_typecast(a, len, real_cs);
+ res= new (thd->mem_root) Item_char_typecast(thd, a, len, real_cs);
break;
}
default:
@@ -6287,20 +6287,20 @@ Item *create_temporal_literal(THD *thd,
case MYSQL_TYPE_NEWDATE:
if (!str_to_datetime(cs, str, length, &ltime, flags, &status) &&
ltime.time_type == MYSQL_TIMESTAMP_DATE && !status.warnings)
- item= new (thd->mem_root) Item_date_literal(&ltime);
+ item= new (thd->mem_root) Item_date_literal(thd, &ltime);
break;
case MYSQL_TYPE_DATETIME:
if (!str_to_datetime(cs, str, length, &ltime, flags, &status) &&
ltime.time_type == MYSQL_TIMESTAMP_DATETIME &&
!have_important_literal_warnings(&status))
- item= new (thd->mem_root) Item_datetime_literal(&ltime,
+ item= new (thd->mem_root) Item_datetime_literal(thd, &ltime,
status.precision);
break;
case MYSQL_TYPE_TIME:
if (!str_to_time(cs, str, length, &ltime, 0, &status) &&
ltime.time_type == MYSQL_TIMESTAMP_TIME &&
!have_important_literal_warnings(&status))
- item= new (thd->mem_root) Item_time_literal(&ltime,
+ item= new (thd->mem_root) Item_time_literal(thd, &ltime,
status.precision);
break;
default:
@@ -6312,7 +6312,7 @@ Item *create_temporal_literal(THD *thd,
if (status.warnings) // e.g. a note on nanosecond truncation
{
ErrConvString err(str, length, cs);
- make_truncated_value_warning(current_thd,
+ make_truncated_value_warning(thd,
Sql_condition::time_warn_level(status.warnings),
&err, ltime.time_type, 0);
}
@@ -6349,8 +6349,8 @@ static List<Item> *create_func_dyncol_prepare(THD *thd,
for (uint i= 0; (def= li++) ;)
{
dfs[0][i++]= *def;
- args->push_back(def->key);
- args->push_back(def->value);
+ args->push_back(def->key, thd->mem_root);
+ args->push_back(def->value, thd->mem_root);
}
return args;
}
@@ -6362,7 +6362,7 @@ Item *create_func_dyncol_create(THD *thd, List<DYNCALL_CREATE_DEF> &list)
if (!(args= create_func_dyncol_prepare(thd, &dfs, list)))
return NULL;
- return new (thd->mem_root) Item_func_dyncol_create(*args, dfs);
+ return new (thd->mem_root) Item_func_dyncol_create(thd, *args, dfs);
}
Item *create_func_dyncol_add(THD *thd, Item *str,
@@ -6374,9 +6374,9 @@ Item *create_func_dyncol_add(THD *thd, Item *str,
if (!(args= create_func_dyncol_prepare(thd, &dfs, list)))
return NULL;
- args->push_back(str);
+ args->push_back(str, thd->mem_root);
- return new (thd->mem_root) Item_func_dyncol_add(*args, dfs);
+ return new (thd->mem_root) Item_func_dyncol_add(thd, *args, dfs);
}
@@ -6397,15 +6397,15 @@ Item *create_func_dyncol_delete(THD *thd, Item *str, List<Item> &nums)
for (uint i= 0; (key= it++); i++)
{
dfs[i].key= key;
- dfs[i].value= new Item_null();
+ dfs[i].value= new (thd->mem_root) Item_null(thd);
dfs[i].type= DYN_COL_INT;
- args->push_back(dfs[i].key);
- args->push_back(dfs[i].value);
+ args->push_back(dfs[i].key, thd->mem_root);
+ args->push_back(dfs[i].value, thd->mem_root);
}
- args->push_back(str);
+ args->push_back(str, thd->mem_root);
- return new (thd->mem_root) Item_func_dyncol_add(*args, dfs);
+ return new (thd->mem_root) Item_func_dyncol_add(thd, *args, dfs);
}
@@ -6416,7 +6416,7 @@ Item *create_func_dyncol_get(THD *thd, Item *str, Item *num,
{
Item *res;
- if (!(res= new (thd->mem_root) Item_dyncol_get(str, num)))
+ if (!(res= new (thd->mem_root) Item_dyncol_get(thd, str, num)))
return res; // Return NULL
return create_func_cast(thd, res, cast_type, c_len, c_dec, cs);
}
diff --git a/sql/item_func.cc b/sql/item_func.cc
index dfb44702cf6..f224a68ecbe 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -89,14 +89,14 @@ static inline bool test_if_sum_overflows_ull(ulonglong arg1, ulonglong arg2)
}
-void Item_args::set_arguments(List<Item> &list)
+void Item_args::set_arguments(THD *thd, List<Item> &list)
{
arg_count= list.elements;
if (arg_count <= 2)
{
args= tmp_arg;
}
- else if (!(args= (Item**) sql_alloc(sizeof(Item*) * arg_count)))
+ else if (!(args= (Item**) thd->alloc(sizeof(Item*) * arg_count)))
{
arg_count= 0;
return;
@@ -319,11 +319,11 @@ void Item_func::traverse_cond(Cond_traverser traverser,
}
-bool Item_args::transform_args(Item_transformer transformer, uchar *arg)
+bool Item_args::transform_args(THD *thd, Item_transformer transformer, uchar *arg)
{
for (uint i= 0; i < arg_count; i++)
{
- Item *new_item= args[i]->transform(transformer, arg);
+ Item *new_item= args[i]->transform(thd, transformer, arg);
if (!new_item)
return true;
/*
@@ -333,7 +333,7 @@ bool Item_args::transform_args(Item_transformer transformer, uchar *arg)
change records at each execution.
*/
if (args[i] != new_item)
- current_thd->change_item_tree(&args[i], new_item);
+ thd->change_item_tree(&args[i], new_item);
}
return false;
}
@@ -356,12 +356,12 @@ bool Item_args::transform_args(Item_transformer transformer, uchar *arg)
Item returned as the result of transformation of the root node
*/
-Item *Item_func::transform(Item_transformer transformer, uchar *argument)
+Item *Item_func::transform(THD *thd, Item_transformer transformer, uchar *argument)
{
- DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
- if (transform_args(transformer, argument))
+ DBUG_ASSERT(!thd->stmt_arena->is_stmt_prepare());
+ if (transform_args(thd, transformer, argument))
return 0;
- return (this->*transformer)(argument);
+ return (this->*transformer)(thd, argument);
}
@@ -391,7 +391,7 @@ Item *Item_func::transform(Item_transformer transformer, uchar *argument)
Item returned as the result of transformation of the root node
*/
-Item *Item_func::compile(Item_analyzer analyzer, uchar **arg_p,
+Item *Item_func::compile(THD *thd, Item_analyzer analyzer, uchar **arg_p,
Item_transformer transformer, uchar *arg_t)
{
if (!(this->*analyzer)(arg_p))
@@ -406,24 +406,38 @@ Item *Item_func::compile(Item_analyzer analyzer, uchar **arg_p,
to analyze any argument of the condition formula.
*/
uchar *arg_v= *arg_p;
- Item *new_item= (*arg)->compile(analyzer, &arg_v, transformer, arg_t);
+ Item *new_item= (*arg)->compile(thd, analyzer, &arg_v, transformer,
+ arg_t);
if (new_item && *arg != new_item)
- current_thd->change_item_tree(arg, new_item);
+ thd->change_item_tree(arg, new_item);
}
}
- return (this->*transformer)(arg_t);
+ return (this->*transformer)(thd, arg_t);
+}
+
+
+void Item_args::propagate_equal_fields(THD *thd,
+ const Item::Context &ctx,
+ COND_EQUAL *cond)
+{
+ uint i;
+ for (i= 0; i < arg_count; i++)
+ args[i]->propagate_equal_fields_and_change_item_tree(thd, ctx, cond,
+ &args[i]);
}
+
/**
See comments in Item_cond::split_sum_func()
*/
void Item_func::split_sum_func(THD *thd, Item **ref_pointer_array,
- List<Item> &fields)
+ List<Item> &fields, uint flags)
{
Item **arg, **arg_end;
for (arg= args, arg_end= args+arg_count; arg != arg_end ; arg++)
- (*arg)->split_sum_func2(thd, ref_pointer_array, fields, arg, TRUE);
+ (*arg)->split_sum_func2(thd, ref_pointer_array, fields, arg,
+ flags | SPLIT_SUM_SKIP_REGISTERED);
}
@@ -479,7 +493,11 @@ bool Item_func::eq(const Item *item, bool binary_cmp) const
/* Assume we don't have rtti */
if (this == item)
return 1;
- if (item->type() != FUNC_ITEM)
+ /*
+ Ensure that we are comparing two functions and that the function
+ is deterministic.
+ */
+ if (item->type() != FUNC_ITEM || (used_tables() & RAND_TABLE_BIT))
return 0;
Item_func *item_func=(Item_func*) item;
Item_func::Functype func_type;
@@ -500,27 +518,30 @@ bool Item_func::eq(const Item *item, bool binary_cmp) const
Field *Item_func::tmp_table_field(TABLE *table)
{
Field *field= NULL;
+ MEM_ROOT *mem_root= table->in_use->mem_root;
switch (result_type()) {
case INT_RESULT:
if (max_char_length() > MY_INT32_NUM_DECIMAL_DIGITS)
- field= new Field_longlong(max_char_length(), maybe_null, name,
- unsigned_flag);
+ field= new (mem_root)
+ Field_longlong(max_char_length(), maybe_null, name,
+ unsigned_flag);
else
- field= new Field_long(max_char_length(), maybe_null, name,
- unsigned_flag);
+ field= new (mem_root)
+ Field_long(max_char_length(), maybe_null, name,
+ unsigned_flag);
break;
case REAL_RESULT:
- field= new Field_double(max_char_length(), maybe_null, name, decimals);
+ field= new (mem_root)
+ Field_double(max_char_length(), maybe_null, name, decimals);
break;
case STRING_RESULT:
return make_string_field(table);
case DECIMAL_RESULT:
- field= Field_new_decimal::create_from_item(this);
+ field= Field_new_decimal::create_from_item(mem_root, this);
break;
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
// This case should never be chosen
DBUG_ASSERT(0);
field= 0;
@@ -692,12 +713,12 @@ void Item_func::count_real_length()
@retval False on success, true on error.
*/
-bool Item_func::count_string_result_length(enum_field_types field_type,
+bool Item_func::count_string_result_length(enum_field_types field_type_arg,
Item **items, uint nitems)
{
if (agg_arg_charsets(collation, items, nitems, MY_COLL_ALLOW_CONV, 1))
return true;
- if (is_temporal_type(field_type))
+ if (is_temporal_type(field_type_arg))
count_datetime_length(items, nitems);
else
{
@@ -713,7 +734,7 @@ void Item_func::signal_divide_by_null()
THD *thd= current_thd;
if (thd->variables.sql_mode & MODE_ERROR_FOR_DIVISION_BY_ZERO)
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_DIVISION_BY_ZERO,
- ER(ER_DIVISION_BY_ZERO));
+ ER_THD(thd, ER_DIVISION_BY_ZERO));
null_value= 1;
}
@@ -721,7 +742,7 @@ void Item_func::signal_divide_by_null()
Item *Item_func::get_tmp_table_item(THD *thd)
{
if (!with_sum_func && !const_item())
- return new Item_field(result_field);
+ return new (thd->mem_root) Item_field(thd, result_field);
return copy_or_same(thd);
}
@@ -732,16 +753,6 @@ double Item_int_func::val_real()
return unsigned_flag ? (double) ((ulonglong) val_int()) : (double) val_int();
}
-bool Item_int_func::count_sargable_conds(uchar *arg)
-{
- if (sargable)
- {
- SELECT_LEX *sel= (SELECT_LEX *) arg;
- sel->cond_count++;
- }
- return 0;
-}
-
String *Item_int_func::val_str(String *str)
{
@@ -844,7 +855,6 @@ void Item_func_num1::fix_length_and_dec()
max_length= args[0]->max_length;
break;
case ROW_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0);
}
DBUG_PRINT("info", ("Type: %s",
@@ -905,7 +915,6 @@ String *Item_func_hybrid_result_type::val_str(String *str)
return str_op(&str_value);
case TIME_RESULT:
case ROW_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0);
}
return str;
@@ -954,7 +963,6 @@ double Item_func_hybrid_result_type::val_real()
}
case TIME_RESULT:
case ROW_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0);
}
return 0.0;
@@ -1003,7 +1011,6 @@ longlong Item_func_hybrid_result_type::val_int()
}
case TIME_RESULT:
case ROW_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0);
}
return 0;
@@ -1055,7 +1062,6 @@ my_decimal *Item_func_hybrid_result_type::val_decimal(my_decimal *decimal_value)
}
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0);
}
return val;
@@ -1109,7 +1115,6 @@ bool Item_func_hybrid_result_type::get_date(MYSQL_TIME *ltime,
}
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0);
}
@@ -1132,11 +1137,8 @@ void Item_func_signed::print(String *str, enum_query_type query_type)
longlong Item_func_signed::val_int_from_str(int *error)
{
- char buff[MAX_FIELD_WIDTH], *end, *start;
- uint32 length;
+ char buff[MAX_FIELD_WIDTH];
String tmp(buff,sizeof(buff), &my_charset_bin), *res;
- longlong value;
- CHARSET_INFO *cs;
/*
For a string result, we must first get the string and then convert it
@@ -1150,21 +1152,10 @@ longlong Item_func_signed::val_int_from_str(int *error)
return 0;
}
null_value= 0;
- start= (char *)res->ptr();
- length= res->length();
- cs= res->charset();
-
- end= start + length;
- value= cs->cset->strtoll10(cs, start, &end, error);
- if (*error > 0 || end != start+ length)
- {
- ErrConvString err(res);
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE,
- ER(ER_TRUNCATED_WRONG_VALUE), "INTEGER",
- err.ptr());
- }
- return value;
+ Converter_strtoll10_with_warn cnv(NULL, Warn_filter_all(),
+ res->charset(), res->ptr(), res->length());
+ *error= cnv.error();
+ return cnv.result();
}
@@ -1320,9 +1311,10 @@ my_decimal *Item_decimal_typecast::val_decimal(my_decimal *dec)
return dec;
err:
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ THD *thd= current_thd;
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_DATA_OUT_OF_RANGE,
- ER(ER_WARN_DATA_OUT_OF_RANGE),
+ ER_THD(thd, ER_WARN_DATA_OUT_OF_RANGE),
name, 1L);
return dec;
}
@@ -1361,10 +1353,11 @@ double Item_double_typecast::val_real()
if ((error= truncate_double(&tmp, max_length, decimals, 0, DBL_MAX)))
{
- push_warning_printf(current_thd,
+ THD *thd= current_thd;
+ push_warning_printf(thd,
Sql_condition::WARN_LEVEL_WARN,
ER_WARN_DATA_OUT_OF_RANGE,
- ER(ER_WARN_DATA_OUT_OF_RANGE),
+ ER_THD(thd, ER_WARN_DATA_OUT_OF_RANGE),
name, 1);
if (error < 0)
{
@@ -1858,7 +1851,6 @@ void Item_func_div::fix_length_and_dec()
case STRING_RESULT:
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0);
}
maybe_null= 1; // devision by zero
@@ -2434,7 +2426,6 @@ void Item_func_int_val::fix_length_and_dec()
}
break;
case ROW_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0);
}
DBUG_PRINT("info", ("Type: %s",
@@ -2616,7 +2607,6 @@ void Item_func_round::fix_length_and_dec()
}
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0); /* This result type isn't handled */
}
}
@@ -2920,9 +2910,7 @@ bool Item_func_min_max::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
for (uint i=0; i < arg_count ; i++)
{
- Item **arg= args + i;
- bool is_null;
- longlong res= get_datetime_value(thd, &arg, 0, compare_as_dates, &is_null);
+ longlong res= args[i]->val_temporal_packed(compare_as_dates);
/* Check if we need to stop (because of error or KILL) and stop the loop */
if (thd->is_error() || args[i]->null_value)
@@ -2997,7 +2985,6 @@ String *Item_func_min_max::val_str(String *str)
}
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0); // This case should never be chosen
return 0;
}
@@ -3486,7 +3473,7 @@ udf_handler::fix_fields(THD *thd, Item_func_or_sum *func,
if ((f_args.arg_count=arg_count))
{
if (!(f_args.arg_type= (Item_result*)
- sql_alloc(f_args.arg_count*sizeof(Item_result))))
+ thd->alloc(f_args.arg_count*sizeof(Item_result))))
{
free_udf(u_d);
@@ -3528,13 +3515,14 @@ udf_handler::fix_fields(THD *thd, Item_func_or_sum *func,
}
//TODO: why all following memory is not allocated with 1 call of sql_alloc?
if (!(buffers=new String[arg_count]) ||
- !(f_args.args= (char**) sql_alloc(arg_count * sizeof(char *))) ||
- !(f_args.lengths= (ulong*) sql_alloc(arg_count * sizeof(long))) ||
- !(f_args.maybe_null= (char*) sql_alloc(arg_count * sizeof(char))) ||
- !(num_buffer= (char*) sql_alloc(arg_count *
+ !(f_args.args= (char**) thd->alloc(arg_count * sizeof(char *))) ||
+ !(f_args.lengths= (ulong*) thd->alloc(arg_count * sizeof(long))) ||
+ !(f_args.maybe_null= (char*) thd->alloc(arg_count * sizeof(char))) ||
+ !(num_buffer= (char*) thd->alloc(arg_count *
ALIGN_SIZE(sizeof(double)))) ||
- !(f_args.attributes= (char**) sql_alloc(arg_count * sizeof(char *))) ||
- !(f_args.attribute_lengths= (ulong*) sql_alloc(arg_count *
+ !(f_args.attributes= (char**) thd->alloc(arg_count *
+ sizeof(char *))) ||
+ !(f_args.attribute_lengths= (ulong*) thd->alloc(arg_count *
sizeof(long))))
{
free_udf(u_d);
@@ -3594,7 +3582,6 @@ udf_handler::fix_fields(THD *thd, Item_func_or_sum *func,
break;
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0); // This case should never be chosen
break;
}
@@ -3623,7 +3610,7 @@ udf_handler::fix_fields(THD *thd, Item_func_or_sum *func,
if (error)
{
my_error(ER_CANT_INITIALIZE_UDF, MYF(0),
- u_d->name.str, ER(ER_UNKNOWN_ERROR));
+ u_d->name.str, ER_THD(thd, ER_UNKNOWN_ERROR));
DBUG_RETURN(TRUE);
}
DBUG_RETURN(FALSE);
@@ -3673,7 +3660,6 @@ bool udf_handler::get_arguments()
break;
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0); // This case should never be chosen
break;
}
@@ -4260,6 +4246,21 @@ longlong Item_func_get_lock::val_int()
DBUG_RETURN(1);
}
+ if (args[1]->null_value ||
+ (!args[1]->unsigned_flag && ((longlong) timeout < 0)))
+ {
+ char buf[22];
+ if (args[1]->null_value)
+ strmov(buf, "NULL");
+ else
+ llstr(((longlong) timeout), buf);
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WRONG_VALUE_FOR_TYPE, ER(ER_WRONG_VALUE_FOR_TYPE),
+ "timeout", buf, "get_lock");
+ null_value= 1;
+ DBUG_RETURN(0);
+ }
+
if (!ull_name_ok(res))
DBUG_RETURN(0);
DBUG_PRINT("enter", ("lock: %.*s", res->length(), res->ptr()));
@@ -4455,7 +4456,7 @@ longlong Item_func_benchmark::val_int()
char buff[MAX_FIELD_WIDTH];
String tmp(buff,sizeof(buff), &my_charset_bin);
my_decimal tmp_decimal;
- THD *thd=current_thd;
+ THD *thd= current_thd;
ulonglong loop_count;
loop_count= (ulonglong) args[0]->val_int();
@@ -4467,8 +4468,9 @@ longlong Item_func_benchmark::val_int()
{
char buff[22];
llstr(((longlong) loop_count), buff);
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_WRONG_VALUE_FOR_TYPE, ER(ER_WRONG_VALUE_FOR_TYPE),
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WRONG_VALUE_FOR_TYPE,
+ ER_THD(thd, ER_WRONG_VALUE_FOR_TYPE),
"count", buff, "benchmark");
}
@@ -4494,7 +4496,6 @@ longlong Item_func_benchmark::val_int()
break;
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0); // This case should never be chosen
return 0;
}
@@ -4933,7 +4934,6 @@ double user_var_entry::val_real(bool *null_value)
return my_atof(value); // This is null terminated
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0); // Impossible
break;
}
@@ -4966,7 +4966,6 @@ longlong user_var_entry::val_int(bool *null_value) const
}
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0); // Impossible
break;
}
@@ -5001,7 +5000,6 @@ String *user_var_entry::val_str(bool *null_value, String *str,
break;
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0); // Impossible
break;
}
@@ -5030,7 +5028,6 @@ my_decimal *user_var_entry::val_decimal(bool *null_value, my_decimal *val)
break;
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0); // Impossible
break;
}
@@ -5089,7 +5086,6 @@ Item_func_set_user_var::check(bool use_result_field)
}
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0); // This case should never be chosen
break;
}
@@ -5124,7 +5120,6 @@ void Item_func_set_user_var::save_item_result(Item *item)
break;
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0); // This case should never be chosen
break;
}
@@ -5192,7 +5187,6 @@ Item_func_set_user_var::update()
}
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0); // This case should never be chosen
break;
}
@@ -5533,8 +5527,11 @@ get_var_with_binlog(THD *thd, enum_sql_command sql_command,
LEX *sav_lex= thd->lex, lex_tmp;
thd->lex= &lex_tmp;
lex_start(thd);
- tmp_var_list.push_back(new set_var_user(new Item_func_set_user_var(name,
- new Item_null())));
+ tmp_var_list.push_back(new (thd->mem_root)
+ set_var_user(new (thd->mem_root)
+ Item_func_set_user_var(thd, name,
+ new (thd->mem_root) Item_null(thd))),
+ thd->mem_root);
/* Create the variable */
if (sql_set_variables(thd, &tmp_var_list, false))
{
@@ -5645,7 +5642,6 @@ void Item_func_get_user_var::fix_length_and_dec()
break;
case ROW_RESULT: // Keep compiler happy
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0); // This case should never be chosen
break;
}
@@ -5698,7 +5694,7 @@ bool Item_func_get_user_var::eq(const Item *item, bool binary_cmp) const
bool Item_func_get_user_var::set_value(THD *thd,
sp_rcontext * /*ctx*/, Item **it)
{
- Item_func_set_user_var *suv= new Item_func_set_user_var(get_name(), *it);
+ Item_func_set_user_var *suv= new (thd->mem_root) Item_func_set_user_var(thd, get_name(), *it);
/*
Item_func_set_user_var is not fixed after construction, call
fix_fields().
@@ -5779,11 +5775,11 @@ void Item_user_var_as_out_param::print_for_load(THD *thd, String *str)
Item_func_get_system_var::
-Item_func_get_system_var(sys_var *var_arg, enum_var_type var_type_arg,
+Item_func_get_system_var(THD *thd, sys_var *var_arg, enum_var_type var_type_arg,
LEX_STRING *component_arg, const char *name_arg,
- size_t name_len_arg)
- :var(var_arg), var_type(var_type_arg), orig_var_type(var_type_arg),
- component(*component_arg), cache_present(0)
+ size_t name_len_arg):
+ Item_func(thd), var(var_arg), var_type(var_type_arg),
+ orig_var_type(var_type_arg), component(*component_arg), cache_present(0)
{
/* set_name() will allocate the name */
set_name(name_arg, (uint) name_len_arg, system_charset_info);
@@ -6095,7 +6091,7 @@ void Item_func_get_system_var::cleanup()
}
-void Item_func_match::init_search(bool no_order)
+void Item_func_match::init_search(THD *thd, bool no_order)
{
DBUG_ENTER("Item_func_match::init_search");
@@ -6113,10 +6109,12 @@ void Item_func_match::init_search(bool no_order)
if (key == NO_SUCH_KEY)
{
List<Item> fields;
- fields.push_back(new Item_string(" ", 1, cmp_collation.collation));
+ fields.push_back(new (thd->mem_root)
+ Item_string(thd, " ", 1, cmp_collation.collation),
+ thd->mem_root);
for (uint i= 1; i < arg_count; i++)
fields.push_back(args[i]);
- concat_ws= new Item_func_concat_ws(fields);
+ concat_ws= new (thd->mem_root) Item_func_concat_ws(thd, fields);
/*
Above function used only to get value and do not need fix_fields for it:
Item_string - basic constant
@@ -6129,7 +6127,7 @@ void Item_func_match::init_search(bool no_order)
if (master)
{
join_key= master->join_key= join_key | master->join_key;
- master->init_search(no_order);
+ master->init_search(thd, no_order);
ft_handler= master->ft_handler;
join_key= master->join_key;
DBUG_VOID_RETURN;
@@ -6464,7 +6462,7 @@ Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name,
set_if_smaller(component_name->length, MAX_SYS_VAR_LENGTH);
- return new Item_func_get_system_var(var, var_type, component_name,
+ return new (thd->mem_root) Item_func_get_system_var(thd, var, var_type, component_name,
NULL, 0);
}
@@ -6480,23 +6478,25 @@ longlong Item_func_row_count::val_int()
-Item_func_sp::Item_func_sp(Name_resolution_context *context_arg, sp_name *name)
- :Item_func(), context(context_arg), m_name(name), m_sp(NULL), sp_result_field(NULL)
+Item_func_sp::Item_func_sp(THD *thd, Name_resolution_context *context_arg,
+ sp_name *name):
+ Item_func(thd), context(context_arg), m_name(name), m_sp(NULL), sp_result_field(NULL)
{
maybe_null= 1;
- m_name->init_qname(current_thd);
- dummy_table= (TABLE*) sql_calloc(sizeof(TABLE)+ sizeof(TABLE_SHARE));
+ m_name->init_qname(thd);
+ dummy_table= (TABLE*) thd->calloc(sizeof(TABLE)+ sizeof(TABLE_SHARE));
dummy_table->s= (TABLE_SHARE*) (dummy_table+1);
}
-Item_func_sp::Item_func_sp(Name_resolution_context *context_arg,
- sp_name *name, List<Item> &list)
- :Item_func(list), context(context_arg), m_name(name), m_sp(NULL),sp_result_field(NULL)
+Item_func_sp::Item_func_sp(THD *thd, Name_resolution_context *context_arg,
+ sp_name *name_arg, List<Item> &list):
+ Item_func(thd, list), context(context_arg), m_name(name_arg), m_sp(NULL),
+ sp_result_field(NULL)
{
maybe_null= 1;
- m_name->init_qname(current_thd);
- dummy_table= (TABLE*) sql_calloc(sizeof(TABLE)+ sizeof(TABLE_SHARE));
+ m_name->init_qname(thd);
+ dummy_table= (TABLE*) thd->calloc(sizeof(TABLE)+ sizeof(TABLE_SHARE));
dummy_table->s= (TABLE_SHARE*) (dummy_table+1);
}
@@ -6608,7 +6608,7 @@ Item_func_sp::init_result_field(THD *thd)
if (sp_result_field->pack_length() > sizeof(result_buf))
{
void *tmp;
- if (!(tmp= sql_alloc(sp_result_field->pack_length())))
+ if (!(tmp= thd->alloc(sp_result_field->pack_length())))
DBUG_RETURN(TRUE);
sp_result_field->move_field((uchar*) tmp);
}
diff --git a/sql/item_func.h b/sql/item_func.h
index cb8975a202a..f8fd26d129c 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -60,54 +60,50 @@ public:
SUSERVAR_FUNC, GUSERVAR_FUNC, COLLATE_FUNC,
EXTRACT_FUNC, CHAR_TYPECAST_FUNC, FUNC_SP, UDF_FUNC,
NEG_FUNC, GSYSVAR_FUNC, DYNCOL_FUNC };
- enum optimize_type { OPTIMIZE_NONE,OPTIMIZE_KEY,OPTIMIZE_OP, OPTIMIZE_NULL,
- OPTIMIZE_EQUAL };
enum Type type() const { return FUNC_ITEM; }
virtual enum Functype functype() const { return UNKNOWN_FUNC; }
- Item_func(void):
- Item_func_or_sum(), allowed_arg_cols(1)
+ Item_func(THD *thd): Item_func_or_sum(thd), allowed_arg_cols(1)
{
with_sum_func= 0;
with_field= 0;
}
- Item_func(Item *a):
- Item_func_or_sum(a), allowed_arg_cols(1)
+ Item_func(THD *thd, Item *a): Item_func_or_sum(thd, a), allowed_arg_cols(1)
{
with_sum_func= a->with_sum_func;
with_field= a->with_field;
}
- Item_func(Item *a,Item *b):
- Item_func_or_sum(a, b), allowed_arg_cols(1)
+ Item_func(THD *thd, Item *a, Item *b):
+ Item_func_or_sum(thd, a, b), allowed_arg_cols(1)
{
with_sum_func= a->with_sum_func || b->with_sum_func;
with_field= a->with_field || b->with_field;
}
- Item_func(Item *a,Item *b,Item *c):
- Item_func_or_sum(a, b, c), allowed_arg_cols(1)
+ Item_func(THD *thd, Item *a, Item *b, Item *c):
+ Item_func_or_sum(thd, a, b, c), allowed_arg_cols(1)
{
with_sum_func= a->with_sum_func || b->with_sum_func || c->with_sum_func;
with_field= a->with_field || b->with_field || c->with_field;
}
- Item_func(Item *a,Item *b,Item *c,Item *d):
- Item_func_or_sum(a, b, c, d), allowed_arg_cols(1)
+ Item_func(THD *thd, Item *a, Item *b, Item *c, Item *d):
+ Item_func_or_sum(thd, a, b, c, d), allowed_arg_cols(1)
{
with_sum_func= a->with_sum_func || b->with_sum_func ||
c->with_sum_func || d->with_sum_func;
with_field= a->with_field || b->with_field ||
c->with_field || d->with_field;
}
- Item_func(Item *a,Item *b,Item *c,Item *d,Item* e):
- Item_func_or_sum(a, b, c, d, e), allowed_arg_cols(1)
+ Item_func(THD *thd, Item *a, Item *b, Item *c, Item *d, Item* e):
+ Item_func_or_sum(thd, a, b, c, d, e), allowed_arg_cols(1)
{
with_sum_func= a->with_sum_func || b->with_sum_func ||
c->with_sum_func || d->with_sum_func || e->with_sum_func;
with_field= a->with_field || b->with_field ||
c->with_field || d->with_field || e->with_field;
}
- Item_func(List<Item> &list)
- :Item_func_or_sum(list), allowed_arg_cols(1)
+ Item_func(THD *thd, List<Item> &list):
+ Item_func_or_sum(thd, list), allowed_arg_cols(1)
{
- set_arguments(list);
+ set_arguments(thd, list);
}
// Constructor used for Item_cond_and/or (see Item comment)
Item_func(THD *thd, Item_func *item)
@@ -136,18 +132,17 @@ public:
COND_EQUAL **cond_equal_ref);
SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr);
bool eq(const Item *item, bool binary_cmp) const;
- virtual optimize_type select_optimize() const { return OPTIMIZE_NONE; }
- virtual bool have_rev_func() const { return 0; }
virtual Item *key_item() const { return args[0]; }
virtual bool const_item() const { return const_item_cache; }
- void set_arguments(List<Item> &list)
+ void set_arguments(THD *thd, List<Item> &list)
{
allowed_arg_cols= 1;
- Item_args::set_arguments(list);
+ Item_args::set_arguments(thd, list);
sync_with_sum_func_and_with_field(list);
list.empty(); // Fields are used
}
- void split_sum_func(THD *thd, Item **ref_pointer_array, List<Item> &fields);
+ void split_sum_func(THD *thd, Item **ref_pointer_array, List<Item> &fields,
+ uint flags);
virtual void print(String *str, enum_query_type query_type);
void print_op(String *str, enum_query_type query_type);
void print_args(String *str, uint from, enum_query_type query_type);
@@ -236,8 +231,8 @@ public:
items, nitems,
item_sep);
}
- Item *transform(Item_transformer transformer, uchar *arg);
- Item* compile(Item_analyzer analyzer, uchar **arg_p,
+ Item *transform(THD *thd, Item_transformer transformer, uchar *arg);
+ Item* compile(THD *thd, Item_analyzer analyzer, uchar **arg_p,
Item_transformer transformer, uchar *arg_t);
void traverse_cond(Cond_traverser traverser,
void * arg, traverse_order order);
@@ -346,19 +341,15 @@ public:
return FALSE;
}
- /*
- By default only substitution for a field whose two different values
- are never equal is allowed in the arguments of a function.
- This is overruled for the direct arguments of comparison functions.
- */
- bool subst_argument_checker(uchar **arg)
- {
- if (*arg)
- {
- *arg= (uchar *) Item::IDENTITY_SUBST;
- return TRUE;
- }
- return FALSE;
+ Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond)
+ {
+ /*
+ By default only substitution for a field whose two different values
+ are never equal is allowed in the arguments of a function.
+ This is overruled for the direct arguments of comparison functions.
+ */
+ Item_args::propagate_equal_fields(thd, Context_identity(), cond);
+ return this;
}
/*
@@ -409,10 +400,13 @@ public:
class Item_real_func :public Item_func
{
public:
- Item_real_func() :Item_func() { collation.set_numeric(); }
- Item_real_func(Item *a) :Item_func(a) { collation.set_numeric(); }
- Item_real_func(Item *a,Item *b) :Item_func(a,b) { collation.set_numeric(); }
- Item_real_func(List<Item> &list) :Item_func(list) { collation.set_numeric(); }
+ Item_real_func(THD *thd): Item_func(thd) { collation.set_numeric(); }
+ Item_real_func(THD *thd, Item *a): Item_func(thd, a)
+ { collation.set_numeric(); }
+ Item_real_func(THD *thd, Item *a, Item *b): Item_func(thd, a, b)
+ { collation.set_numeric(); }
+ Item_real_func(THD *thd, List<Item> &list): Item_func(thd, list)
+ { collation.set_numeric(); }
String *val_str(String*str);
my_decimal *val_decimal(my_decimal *decimal_value);
longlong val_int()
@@ -429,18 +423,20 @@ protected:
Item_result cached_result_type;
public:
- Item_func_hybrid_result_type() :Item_func(), cached_result_type(REAL_RESULT)
+ Item_func_hybrid_result_type(THD *thd):
+ Item_func(thd), cached_result_type(REAL_RESULT)
{ collation.set_numeric(); }
- Item_func_hybrid_result_type(Item *a) :Item_func(a), cached_result_type(REAL_RESULT)
+ Item_func_hybrid_result_type(THD *thd, Item *a):
+ Item_func(thd, a), cached_result_type(REAL_RESULT)
{ collation.set_numeric(); }
- Item_func_hybrid_result_type(Item *a,Item *b)
- :Item_func(a,b), cached_result_type(REAL_RESULT)
+ Item_func_hybrid_result_type(THD *thd, Item *a, Item *b):
+ Item_func(thd, a, b), cached_result_type(REAL_RESULT)
{ collation.set_numeric(); }
- Item_func_hybrid_result_type(Item *a,Item *b,Item *c)
- :Item_func(a,b,c), cached_result_type(REAL_RESULT)
+ Item_func_hybrid_result_type(THD *thd, Item *a, Item *b, Item *c):
+ Item_func(thd, a, b, c), cached_result_type(REAL_RESULT)
{ collation.set_numeric(); }
- Item_func_hybrid_result_type(List<Item> &list)
- :Item_func(list), cached_result_type(REAL_RESULT)
+ Item_func_hybrid_result_type(THD *thd, List<Item> &list):
+ Item_func(thd, list), cached_result_type(REAL_RESULT)
{ collation.set_numeric(); }
enum Item_result result_type () const { return cached_result_type; }
@@ -503,18 +499,19 @@ class Item_func_hybrid_field_type :public Item_func_hybrid_result_type
protected:
enum_field_types cached_field_type;
public:
- Item_func_hybrid_field_type()
- :Item_func_hybrid_result_type(), cached_field_type(MYSQL_TYPE_DOUBLE)
+ Item_func_hybrid_field_type(THD *thd):
+ Item_func_hybrid_result_type(thd), cached_field_type(MYSQL_TYPE_DOUBLE)
{}
- Item_func_hybrid_field_type(Item *a, Item *b)
- :Item_func_hybrid_result_type(a, b), cached_field_type(MYSQL_TYPE_DOUBLE)
+ Item_func_hybrid_field_type(THD *thd, Item *a, Item *b):
+ Item_func_hybrid_result_type(thd, a, b),
+ cached_field_type(MYSQL_TYPE_DOUBLE)
{}
- Item_func_hybrid_field_type(Item *a, Item *b, Item *c)
- :Item_func_hybrid_result_type(a, b, c),
+ Item_func_hybrid_field_type(THD *thd, Item *a, Item *b, Item *c):
+ Item_func_hybrid_result_type(thd, a, b, c),
cached_field_type(MYSQL_TYPE_DOUBLE)
{}
- Item_func_hybrid_field_type(List<Item> &list)
- :Item_func_hybrid_result_type(list),
+ Item_func_hybrid_field_type(THD *thd, List<Item> &list):
+ Item_func_hybrid_result_type(thd, list),
cached_field_type(MYSQL_TYPE_DOUBLE)
{}
enum_field_types field_type() const { return cached_field_type; }
@@ -534,18 +531,18 @@ protected:
}
public:
- Item_func_numhybrid() :Item_func_hybrid_result_type()
+ Item_func_numhybrid(THD *thd): Item_func_hybrid_result_type(thd)
{ }
- Item_func_numhybrid(Item *a) :Item_func_hybrid_result_type(a)
+ Item_func_numhybrid(THD *thd, Item *a): Item_func_hybrid_result_type(thd, a)
{ }
- Item_func_numhybrid(Item *a,Item *b)
- :Item_func_hybrid_result_type(a,b)
+ Item_func_numhybrid(THD *thd, Item *a, Item *b):
+ Item_func_hybrid_result_type(thd, a, b)
{ }
- Item_func_numhybrid(Item *a,Item *b,Item *c)
- :Item_func_hybrid_result_type(a,b,c)
+ Item_func_numhybrid(THD *thd, Item *a, Item *b, Item *c):
+ Item_func_hybrid_result_type(thd, a, b, c)
{ }
- Item_func_numhybrid(List<Item> &list)
- :Item_func_hybrid_result_type(list)
+ Item_func_numhybrid(THD *thd, List<Item> &list):
+ Item_func_hybrid_result_type(thd, list)
{ }
String *str_op(String *str) { DBUG_ASSERT(0); return 0; }
bool date_op(MYSQL_TIME *ltime, uint fuzzydate) { DBUG_ASSERT(0); return true; }
@@ -556,8 +553,8 @@ public:
class Item_func_num1: public Item_func_numhybrid
{
public:
- Item_func_num1(Item *a) :Item_func_numhybrid(a) {}
- Item_func_num1(Item *a, Item *b) :Item_func_numhybrid(a, b) {}
+ Item_func_num1(THD *thd, Item *a): Item_func_numhybrid(thd, a) {}
+ Item_func_num1(THD *thd, Item *a, Item *b): Item_func_numhybrid(thd, a, b) {}
void fix_length_and_dec();
};
@@ -566,7 +563,7 @@ public:
class Item_num_op :public Item_func_numhybrid
{
public:
- Item_num_op(Item *a,Item *b) :Item_func_numhybrid(a, b) {}
+ Item_num_op(THD *thd, Item *a, Item *b): Item_func_numhybrid(thd, a, b) {}
virtual void result_precision()= 0;
virtual inline void print(String *str, enum_query_type query_type)
@@ -580,28 +577,26 @@ class Item_num_op :public Item_func_numhybrid
class Item_int_func :public Item_func
{
-protected:
- bool sargable;
-public:
- Item_int_func() :Item_func()
- { collation.set_numeric(); fix_char_length(21); sargable= false; }
- Item_int_func(Item *a) :Item_func(a)
- { collation.set_numeric(); fix_char_length(21); sargable= false; }
- Item_int_func(Item *a,Item *b) :Item_func(a,b)
- { collation.set_numeric(); fix_char_length(21); sargable= false; }
- Item_int_func(Item *a,Item *b,Item *c) :Item_func(a,b,c)
- { collation.set_numeric(); fix_char_length(21); sargable= false; }
- Item_int_func(Item *a,Item *b,Item *c, Item *d) :Item_func(a,b,c,d)
- { collation.set_numeric(); fix_char_length(21); sargable= false; }
- Item_int_func(List<Item> &list) :Item_func(list)
- { collation.set_numeric(); fix_char_length(21); sargable= false; }
+public:
+ Item_int_func(THD *thd): Item_func(thd)
+ { collation.set_numeric(); fix_char_length(21); }
+ Item_int_func(THD *thd, Item *a): Item_func(thd, a)
+ { collation.set_numeric(); fix_char_length(21); }
+ Item_int_func(THD *thd, Item *a, Item *b): Item_func(thd, a, b)
+ { collation.set_numeric(); fix_char_length(21); }
+ Item_int_func(THD *thd, Item *a, Item *b, Item *c): Item_func(thd, a, b, c)
+ { collation.set_numeric(); fix_char_length(21); }
+ Item_int_func(THD *thd, Item *a, Item *b, Item *c, Item *d):
+ Item_func(thd, a, b, c, d)
+ { collation.set_numeric(); fix_char_length(21); }
+ Item_int_func(THD *thd, List<Item> &list): Item_func(thd, list)
+ { collation.set_numeric(); fix_char_length(21); }
Item_int_func(THD *thd, Item_int_func *item) :Item_func(thd, item)
- { collation.set_numeric(); sargable= false; }
+ { collation.set_numeric(); }
double val_real();
String *val_str(String*str);
enum Item_result result_type () const { return INT_RESULT; }
void fix_length_and_dec() {}
- bool count_sargable_conds(uchar *arg);
};
@@ -610,7 +605,7 @@ class Item_func_connection_id :public Item_int_func
longlong value;
public:
- Item_func_connection_id() {}
+ Item_func_connection_id(THD *thd): Item_int_func(thd) {}
const char *func_name() const { return "connection_id"; }
void fix_length_and_dec();
bool fix_fields(THD *thd, Item **ref);
@@ -622,7 +617,7 @@ public:
class Item_func_signed :public Item_int_func
{
public:
- Item_func_signed(Item *a) :Item_int_func(a)
+ Item_func_signed(THD *thd, Item *a): Item_int_func(thd, a)
{
unsigned_flag= 0;
}
@@ -642,7 +637,7 @@ public:
class Item_func_unsigned :public Item_func_signed
{
public:
- Item_func_unsigned(Item *a) :Item_func_signed(a)
+ Item_func_unsigned(THD *thd, Item *a): Item_func_signed(thd, a)
{
unsigned_flag= 1;
}
@@ -656,7 +651,7 @@ class Item_decimal_typecast :public Item_func
{
my_decimal decimal_value;
public:
- Item_decimal_typecast(Item *a, int len, int dec) :Item_func(a)
+ Item_decimal_typecast(THD *thd, Item *a, int len, int dec): Item_func(thd, a)
{
decimals= (uint8) dec;
collation.set_numeric();
@@ -678,7 +673,8 @@ public:
class Item_double_typecast :public Item_real_func
{
public:
- Item_double_typecast(Item *a, int len, int dec) :Item_real_func(a)
+ Item_double_typecast(THD *thd, Item *a, int len, int dec):
+ Item_real_func(thd, a)
{
decimals= (uint8) dec;
max_length= (uint32) len;
@@ -695,7 +691,7 @@ public:
class Item_func_additive_op :public Item_num_op
{
public:
- Item_func_additive_op(Item *a,Item *b) :Item_num_op(a,b) {}
+ Item_func_additive_op(THD *thd, Item *a, Item *b): Item_num_op(thd, a, b) {}
void result_precision();
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_vcol_func_processor(uchar *int_arg) { return FALSE;}
@@ -705,7 +701,8 @@ public:
class Item_func_plus :public Item_func_additive_op
{
public:
- Item_func_plus(Item *a,Item *b) :Item_func_additive_op(a,b) {}
+ Item_func_plus(THD *thd, Item *a, Item *b):
+ Item_func_additive_op(thd, a, b) {}
const char *func_name() const { return "+"; }
longlong int_op();
double real_op();
@@ -715,7 +712,8 @@ public:
class Item_func_minus :public Item_func_additive_op
{
public:
- Item_func_minus(Item *a,Item *b) :Item_func_additive_op(a,b) {}
+ Item_func_minus(THD *thd, Item *a, Item *b):
+ Item_func_additive_op(thd, a, b) {}
const char *func_name() const { return "-"; }
longlong int_op();
double real_op();
@@ -727,7 +725,8 @@ public:
class Item_func_mul :public Item_num_op
{
public:
- Item_func_mul(Item *a,Item *b) :Item_num_op(a,b) {}
+ Item_func_mul(THD *thd, Item *a, Item *b):
+ Item_num_op(thd, a, b) {}
const char *func_name() const { return "*"; }
longlong int_op();
double real_op();
@@ -742,7 +741,7 @@ class Item_func_div :public Item_num_op
{
public:
uint prec_increment;
- Item_func_div(Item *a,Item *b) :Item_num_op(a,b) {}
+ Item_func_div(THD *thd, Item *a, Item *b): Item_num_op(thd, a, b) {}
longlong int_op() { DBUG_ASSERT(0); return 0; }
double real_op();
my_decimal *decimal_op(my_decimal *);
@@ -755,7 +754,7 @@ public:
class Item_func_int_div :public Item_int_func
{
public:
- Item_func_int_div(Item *a,Item *b) :Item_int_func(a,b)
+ Item_func_int_div(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b)
{}
longlong val_int();
const char *func_name() const { return "DIV"; }
@@ -774,7 +773,7 @@ public:
class Item_func_mod :public Item_num_op
{
public:
- Item_func_mod(Item *a,Item *b) :Item_num_op(a,b) {}
+ Item_func_mod(THD *thd, Item *a, Item *b): Item_num_op(thd, a, b) {}
longlong int_op();
double real_op();
my_decimal *decimal_op(my_decimal *);
@@ -789,7 +788,7 @@ public:
class Item_func_neg :public Item_func_num1
{
public:
- Item_func_neg(Item *a) :Item_func_num1(a) {}
+ Item_func_neg(THD *thd, Item *a): Item_func_num1(thd, a) {}
double real_op();
longlong int_op();
my_decimal *decimal_op(my_decimal *);
@@ -805,7 +804,7 @@ public:
class Item_func_abs :public Item_func_num1
{
public:
- Item_func_abs(Item *a) :Item_func_num1(a) {}
+ Item_func_abs(THD *thd, Item *a): Item_func_num1(thd, a) {}
double real_op();
longlong int_op();
my_decimal *decimal_op(my_decimal *);
@@ -820,8 +819,8 @@ public:
class Item_dec_func :public Item_real_func
{
public:
- Item_dec_func(Item *a) :Item_real_func(a) {}
- Item_dec_func(Item *a,Item *b) :Item_real_func(a,b) {}
+ Item_dec_func(THD *thd, Item *a): Item_real_func(thd, a) {}
+ Item_dec_func(THD *thd, Item *a, Item *b): Item_real_func(thd, a, b) {}
void fix_length_and_dec()
{
decimals=NOT_FIXED_DEC; max_length=float_length(decimals);
@@ -832,7 +831,7 @@ class Item_dec_func :public Item_real_func
class Item_func_exp :public Item_dec_func
{
public:
- Item_func_exp(Item *a) :Item_dec_func(a) {}
+ Item_func_exp(THD *thd, Item *a): Item_dec_func(thd, a) {}
double val_real();
const char *func_name() const { return "exp"; }
};
@@ -841,7 +840,7 @@ public:
class Item_func_ln :public Item_dec_func
{
public:
- Item_func_ln(Item *a) :Item_dec_func(a) {}
+ Item_func_ln(THD *thd, Item *a): Item_dec_func(thd, a) {}
double val_real();
const char *func_name() const { return "ln"; }
};
@@ -850,8 +849,8 @@ public:
class Item_func_log :public Item_dec_func
{
public:
- Item_func_log(Item *a) :Item_dec_func(a) {}
- Item_func_log(Item *a,Item *b) :Item_dec_func(a,b) {}
+ Item_func_log(THD *thd, Item *a): Item_dec_func(thd, a) {}
+ Item_func_log(THD *thd, Item *a, Item *b): Item_dec_func(thd, a, b) {}
double val_real();
const char *func_name() const { return "log"; }
};
@@ -860,7 +859,7 @@ public:
class Item_func_log2 :public Item_dec_func
{
public:
- Item_func_log2(Item *a) :Item_dec_func(a) {}
+ Item_func_log2(THD *thd, Item *a): Item_dec_func(thd, a) {}
double val_real();
const char *func_name() const { return "log2"; }
};
@@ -869,7 +868,7 @@ public:
class Item_func_log10 :public Item_dec_func
{
public:
- Item_func_log10(Item *a) :Item_dec_func(a) {}
+ Item_func_log10(THD *thd, Item *a): Item_dec_func(thd, a) {}
double val_real();
const char *func_name() const { return "log10"; }
};
@@ -878,7 +877,7 @@ public:
class Item_func_sqrt :public Item_dec_func
{
public:
- Item_func_sqrt(Item *a) :Item_dec_func(a) {}
+ Item_func_sqrt(THD *thd, Item *a): Item_dec_func(thd, a) {}
double val_real();
const char *func_name() const { return "sqrt"; }
};
@@ -887,7 +886,7 @@ public:
class Item_func_pow :public Item_dec_func
{
public:
- Item_func_pow(Item *a,Item *b) :Item_dec_func(a,b) {}
+ Item_func_pow(THD *thd, Item *a, Item *b): Item_dec_func(thd, a, b) {}
double val_real();
const char *func_name() const { return "pow"; }
};
@@ -896,7 +895,7 @@ public:
class Item_func_acos :public Item_dec_func
{
public:
- Item_func_acos(Item *a) :Item_dec_func(a) {}
+ Item_func_acos(THD *thd, Item *a): Item_dec_func(thd, a) {}
double val_real();
const char *func_name() const { return "acos"; }
};
@@ -904,7 +903,7 @@ public:
class Item_func_asin :public Item_dec_func
{
public:
- Item_func_asin(Item *a) :Item_dec_func(a) {}
+ Item_func_asin(THD *thd, Item *a): Item_dec_func(thd, a) {}
double val_real();
const char *func_name() const { return "asin"; }
};
@@ -912,8 +911,8 @@ public:
class Item_func_atan :public Item_dec_func
{
public:
- Item_func_atan(Item *a) :Item_dec_func(a) {}
- Item_func_atan(Item *a,Item *b) :Item_dec_func(a,b) {}
+ Item_func_atan(THD *thd, Item *a): Item_dec_func(thd, a) {}
+ Item_func_atan(THD *thd, Item *a, Item *b): Item_dec_func(thd, a, b) {}
double val_real();
const char *func_name() const { return "atan"; }
};
@@ -921,7 +920,7 @@ public:
class Item_func_cos :public Item_dec_func
{
public:
- Item_func_cos(Item *a) :Item_dec_func(a) {}
+ Item_func_cos(THD *thd, Item *a): Item_dec_func(thd, a) {}
double val_real();
const char *func_name() const { return "cos"; }
};
@@ -929,7 +928,7 @@ public:
class Item_func_sin :public Item_dec_func
{
public:
- Item_func_sin(Item *a) :Item_dec_func(a) {}
+ Item_func_sin(THD *thd, Item *a): Item_dec_func(thd, a) {}
double val_real();
const char *func_name() const { return "sin"; }
};
@@ -937,7 +936,7 @@ public:
class Item_func_tan :public Item_dec_func
{
public:
- Item_func_tan(Item *a) :Item_dec_func(a) {}
+ Item_func_tan(THD *thd, Item *a): Item_dec_func(thd, a) {}
double val_real();
const char *func_name() const { return "tan"; }
};
@@ -945,7 +944,7 @@ public:
class Item_func_cot :public Item_dec_func
{
public:
- Item_func_cot(Item *a) :Item_dec_func(a) {}
+ Item_func_cot(THD *thd, Item *a): Item_dec_func(thd, a) {}
double val_real();
const char *func_name() const { return "cot"; }
};
@@ -953,7 +952,7 @@ public:
class Item_func_integer :public Item_int_func
{
public:
- inline Item_func_integer(Item *a) :Item_int_func(a) {}
+ inline Item_func_integer(THD *thd, Item *a): Item_int_func(thd, a) {}
void fix_length_and_dec();
};
@@ -961,7 +960,7 @@ public:
class Item_func_int_val :public Item_func_num1
{
public:
- Item_func_int_val(Item *a) :Item_func_num1(a) {}
+ Item_func_int_val(THD *thd, Item *a): Item_func_num1(thd, a) {}
void fix_length_and_dec();
};
@@ -969,7 +968,7 @@ public:
class Item_func_ceiling :public Item_func_int_val
{
public:
- Item_func_ceiling(Item *a) :Item_func_int_val(a) {}
+ Item_func_ceiling(THD *thd, Item *a): Item_func_int_val(thd, a) {}
const char *func_name() const { return "ceiling"; }
longlong int_op();
double real_op();
@@ -982,7 +981,7 @@ public:
class Item_func_floor :public Item_func_int_val
{
public:
- Item_func_floor(Item *a) :Item_func_int_val(a) {}
+ Item_func_floor(THD *thd, Item *a): Item_func_int_val(thd, a) {}
const char *func_name() const { return "floor"; }
longlong int_op();
double real_op();
@@ -997,8 +996,8 @@ class Item_func_round :public Item_func_num1
{
bool truncate;
public:
- Item_func_round(Item *a, Item *b, bool trunc_arg)
- :Item_func_num1(a,b), truncate(trunc_arg) {}
+ Item_func_round(THD *thd, Item *a, Item *b, bool trunc_arg)
+ :Item_func_num1(thd, a, b), truncate(trunc_arg) {}
const char *func_name() const { return truncate ? "truncate" : "round"; }
double real_op();
longlong int_op();
@@ -1012,8 +1011,9 @@ class Item_func_rand :public Item_real_func
struct my_rnd_struct *rand;
bool first_eval; // TRUE if val_real() is called 1st time
public:
- Item_func_rand(Item *a) :Item_real_func(a), rand(0), first_eval(TRUE) {}
- Item_func_rand() :Item_real_func() {}
+ Item_func_rand(THD *thd, Item *a):
+ Item_real_func(thd, a), rand(0), first_eval(TRUE) {}
+ Item_func_rand(THD *thd): Item_real_func(thd) {}
double val_real();
const char *func_name() const { return "rand"; }
bool const_item() const { return 0; }
@@ -1032,7 +1032,7 @@ private:
class Item_func_sign :public Item_int_func
{
public:
- Item_func_sign(Item *a) :Item_int_func(a) {}
+ Item_func_sign(THD *thd, Item *a): Item_int_func(thd, a) {}
const char *func_name() const { return "sign"; }
longlong val_int();
};
@@ -1043,8 +1043,9 @@ class Item_func_units :public Item_real_func
char *name;
double mul,add;
public:
- Item_func_units(char *name_arg,Item *a,double mul_arg,double add_arg)
- :Item_real_func(a),name(name_arg),mul(mul_arg),add(add_arg) {}
+ Item_func_units(THD *thd, char *name_arg, Item *a, double mul_arg,
+ double add_arg):
+ Item_real_func(thd, a), name(name_arg), mul(mul_arg), add(add_arg) {}
double val_real();
const char *func_name() const { return name; }
void fix_length_and_dec()
@@ -1063,8 +1064,9 @@ class Item_func_min_max :public Item_func
protected:
enum_field_types cached_field_type;
public:
- Item_func_min_max(List<Item> &list,int cmp_sign_arg) :Item_func(list),
- cmp_type(INT_RESULT), cmp_sign(cmp_sign_arg), compare_as_dates(0) {}
+ Item_func_min_max(THD *thd, List<Item> &list, int cmp_sign_arg):
+ Item_func(thd, list), cmp_type(INT_RESULT), cmp_sign(cmp_sign_arg),
+ compare_as_dates(0) {}
double val_real();
longlong val_int();
String *val_str(String *);
@@ -1078,14 +1080,14 @@ public:
class Item_func_min :public Item_func_min_max
{
public:
- Item_func_min(List<Item> &list) :Item_func_min_max(list,1) {}
+ Item_func_min(THD *thd, List<Item> &list): Item_func_min_max(thd, list, 1) {}
const char *func_name() const { return "least"; }
};
class Item_func_max :public Item_func_min_max
{
public:
- Item_func_max(List<Item> &list) :Item_func_min_max(list,-1) {}
+ Item_func_max(THD *thd, List<Item> &list): Item_func_min_max(thd, list, -1) {}
const char *func_name() const { return "greatest"; }
};
@@ -1098,7 +1100,7 @@ public:
class Item_func_rollup_const :public Item_func
{
public:
- Item_func_rollup_const(Item *a) :Item_func(a)
+ Item_func_rollup_const(THD *thd, Item *a): Item_func(thd, a)
{
name= a->name;
name_length= a->name_length;
@@ -1125,7 +1127,7 @@ class Item_func_length :public Item_int_func
{
String value;
public:
- Item_func_length(Item *a) :Item_int_func(a) {}
+ Item_func_length(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "length"; }
void fix_length_and_dec() { max_length=10; }
@@ -1134,7 +1136,7 @@ public:
class Item_func_bit_length :public Item_func_length
{
public:
- Item_func_bit_length(Item *a) :Item_func_length(a) {}
+ Item_func_bit_length(THD *thd, Item *a): Item_func_length(thd, a) {}
longlong val_int()
{ DBUG_ASSERT(fixed == 1); return Item_func_length::val_int()*8; }
const char *func_name() const { return "bit_length"; }
@@ -1144,7 +1146,7 @@ class Item_func_char_length :public Item_int_func
{
String value;
public:
- Item_func_char_length(Item *a) :Item_int_func(a) {}
+ Item_func_char_length(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "char_length"; }
void fix_length_and_dec() { max_length=10; }
@@ -1153,11 +1155,14 @@ public:
class Item_func_coercibility :public Item_int_func
{
public:
- Item_func_coercibility(Item *a) :Item_int_func(a) {}
+ Item_func_coercibility(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "coercibility"; }
void fix_length_and_dec() { max_length=10; maybe_null= 0; }
table_map not_null_tables() const { return 0; }
+ Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond)
+ { return this; }
+ bool const_item() const { return true; }
};
class Item_func_locate :public Item_int_func
@@ -1165,8 +1170,8 @@ class Item_func_locate :public Item_int_func
String value1,value2;
DTCollation cmp_collation;
public:
- Item_func_locate(Item *a,Item *b) :Item_int_func(a,b) {}
- Item_func_locate(Item *a,Item *b,Item *c) :Item_int_func(a,b,c) {}
+ Item_func_locate(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
+ Item_func_locate(THD *thd, Item *a, Item *b, Item *c): Item_int_func(thd, a, b, c) {}
const char *func_name() const { return "locate"; }
longlong val_int();
void fix_length_and_dec();
@@ -1180,7 +1185,7 @@ class Item_func_field :public Item_int_func
Item_result cmp_type;
DTCollation cmp_collation;
public:
- Item_func_field(List<Item> &list) :Item_int_func(list) {}
+ Item_func_field(THD *thd, List<Item> &list): Item_int_func(thd, list) {}
longlong val_int();
const char *func_name() const { return "field"; }
void fix_length_and_dec();
@@ -1191,7 +1196,7 @@ class Item_func_ascii :public Item_int_func
{
String value;
public:
- Item_func_ascii(Item *a) :Item_int_func(a) {}
+ Item_func_ascii(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "ascii"; }
void fix_length_and_dec() { max_length=3; }
@@ -1201,7 +1206,7 @@ class Item_func_ord :public Item_int_func
{
String value;
public:
- Item_func_ord(Item *a) :Item_int_func(a) {}
+ Item_func_ord(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "ord"; }
};
@@ -1213,7 +1218,8 @@ class Item_func_find_in_set :public Item_int_func
ulonglong enum_bit;
DTCollation cmp_collation;
public:
- Item_func_find_in_set(Item *a,Item *b) :Item_int_func(a,b),enum_value(0) {}
+ Item_func_find_in_set(THD *thd, Item *a, Item *b):
+ Item_int_func(thd, a, b), enum_value(0) {}
longlong val_int();
const char *func_name() const { return "find_in_set"; }
void fix_length_and_dec();
@@ -1224,8 +1230,8 @@ public:
class Item_func_bit: public Item_int_func
{
public:
- Item_func_bit(Item *a, Item *b) :Item_int_func(a, b) {}
- Item_func_bit(Item *a) :Item_int_func(a) {}
+ Item_func_bit(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
+ Item_func_bit(THD *thd, Item *a): Item_int_func(thd, a) {}
void fix_length_and_dec() { unsigned_flag= 1; }
virtual inline void print(String *str, enum_query_type query_type)
@@ -1237,7 +1243,7 @@ public:
class Item_func_bit_or :public Item_func_bit
{
public:
- Item_func_bit_or(Item *a, Item *b) :Item_func_bit(a, b) {}
+ Item_func_bit_or(THD *thd, Item *a, Item *b): Item_func_bit(thd, a, b) {}
longlong val_int();
const char *func_name() const { return "|"; }
};
@@ -1245,7 +1251,7 @@ public:
class Item_func_bit_and :public Item_func_bit
{
public:
- Item_func_bit_and(Item *a, Item *b) :Item_func_bit(a, b) {}
+ Item_func_bit_and(THD *thd, Item *a, Item *b): Item_func_bit(thd, a, b) {}
longlong val_int();
const char *func_name() const { return "&"; }
};
@@ -1253,7 +1259,7 @@ public:
class Item_func_bit_count :public Item_int_func
{
public:
- Item_func_bit_count(Item *a) :Item_int_func(a) {}
+ Item_func_bit_count(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "bit_count"; }
void fix_length_and_dec() { max_length=2; }
@@ -1262,7 +1268,7 @@ public:
class Item_func_shift_left :public Item_func_bit
{
public:
- Item_func_shift_left(Item *a, Item *b) :Item_func_bit(a, b) {}
+ Item_func_shift_left(THD *thd, Item *a, Item *b): Item_func_bit(thd, a, b) {}
longlong val_int();
const char *func_name() const { return "<<"; }
};
@@ -1270,7 +1276,7 @@ public:
class Item_func_shift_right :public Item_func_bit
{
public:
- Item_func_shift_right(Item *a, Item *b) :Item_func_bit(a, b) {}
+ Item_func_shift_right(THD *thd, Item *a, Item *b): Item_func_bit(thd, a, b) {}
longlong val_int();
const char *func_name() const { return ">>"; }
};
@@ -1278,7 +1284,7 @@ public:
class Item_func_bit_neg :public Item_func_bit
{
public:
- Item_func_bit_neg(Item *a) :Item_func_bit(a) {}
+ Item_func_bit_neg(THD *thd, Item *a): Item_func_bit(thd, a) {}
longlong val_int();
const char *func_name() const { return "~"; }
@@ -1292,8 +1298,8 @@ public:
class Item_func_last_insert_id :public Item_int_func
{
public:
- Item_func_last_insert_id() :Item_int_func() {}
- Item_func_last_insert_id(Item *a) :Item_int_func(a) {}
+ Item_func_last_insert_id(THD *thd): Item_int_func(thd) {}
+ Item_func_last_insert_id(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "last_insert_id"; }
void fix_length_and_dec()
@@ -1314,8 +1320,8 @@ public:
class Item_func_benchmark :public Item_int_func
{
public:
- Item_func_benchmark(Item *count_expr, Item *expr)
- :Item_int_func(count_expr, expr)
+ Item_func_benchmark(THD *thd, Item *count_expr, Item *expr):
+ Item_int_func(thd, count_expr, expr)
{}
longlong val_int();
const char *func_name() const { return "benchmark"; }
@@ -1334,7 +1340,7 @@ void item_func_sleep_free(void);
class Item_func_sleep :public Item_int_func
{
public:
- Item_func_sleep(Item *a) :Item_int_func(a) {}
+ Item_func_sleep(THD *thd, Item *a): Item_int_func(thd, a) {}
bool const_item() const { return 0; }
const char *func_name() const { return "sleep"; }
table_map used_tables() const
@@ -1360,10 +1366,10 @@ protected:
bool is_expensive_processor(uchar *arg) { return TRUE; }
public:
- Item_udf_func(udf_func *udf_arg)
- :Item_func(), udf(udf_arg) {}
- Item_udf_func(udf_func *udf_arg, List<Item> &list)
- :Item_func(list), udf(udf_arg) {}
+ Item_udf_func(THD *thd, udf_func *udf_arg):
+ Item_func(thd), udf(udf_arg) {}
+ Item_udf_func(THD *thd, udf_func *udf_arg, List<Item> &list):
+ Item_func(thd, list), udf(udf_arg) {}
const char *func_name() const { return udf.name(); }
enum Functype functype() const { return UDF_FUNC; }
bool fix_fields(THD *thd, Item **ref)
@@ -1436,11 +1442,11 @@ public:
class Item_func_udf_float :public Item_udf_func
{
public:
- Item_func_udf_float(udf_func *udf_arg)
- :Item_udf_func(udf_arg) {}
- Item_func_udf_float(udf_func *udf_arg,
- List<Item> &list)
- :Item_udf_func(udf_arg, list) {}
+ Item_func_udf_float(THD *thd, udf_func *udf_arg):
+ Item_udf_func(thd, udf_arg) {}
+ Item_func_udf_float(THD *thd, udf_func *udf_arg,
+ List<Item> &list):
+ Item_udf_func(thd, udf_arg, list) {}
longlong val_int()
{
DBUG_ASSERT(fixed == 1);
@@ -1463,11 +1469,11 @@ class Item_func_udf_float :public Item_udf_func
class Item_func_udf_int :public Item_udf_func
{
public:
- Item_func_udf_int(udf_func *udf_arg)
- :Item_udf_func(udf_arg) {}
- Item_func_udf_int(udf_func *udf_arg,
- List<Item> &list)
- :Item_udf_func(udf_arg, list) {}
+ Item_func_udf_int(THD *thd, udf_func *udf_arg):
+ Item_udf_func(thd, udf_arg) {}
+ Item_func_udf_int(THD *thd, udf_func *udf_arg,
+ List<Item> &list):
+ Item_udf_func(thd, udf_arg, list) {}
longlong val_int();
double val_real() { return (double) Item_func_udf_int::val_int(); }
String *val_str(String *str);
@@ -1479,10 +1485,10 @@ public:
class Item_func_udf_decimal :public Item_udf_func
{
public:
- Item_func_udf_decimal(udf_func *udf_arg)
- :Item_udf_func(udf_arg) {}
- Item_func_udf_decimal(udf_func *udf_arg, List<Item> &list)
- :Item_udf_func(udf_arg, list) {}
+ Item_func_udf_decimal(THD *thd, udf_func *udf_arg):
+ Item_udf_func(thd, udf_arg) {}
+ Item_func_udf_decimal(THD *thd, udf_func *udf_arg, List<Item> &list):
+ Item_udf_func(thd, udf_arg, list) {}
longlong val_int();
double val_real();
my_decimal *val_decimal(my_decimal *);
@@ -1495,10 +1501,10 @@ public:
class Item_func_udf_str :public Item_udf_func
{
public:
- Item_func_udf_str(udf_func *udf_arg)
- :Item_udf_func(udf_arg) {}
- Item_func_udf_str(udf_func *udf_arg, List<Item> &list)
- :Item_udf_func(udf_arg, list) {}
+ Item_func_udf_str(THD *thd, udf_func *udf_arg):
+ Item_udf_func(thd, udf_arg) {}
+ Item_func_udf_str(THD *thd, udf_func *udf_arg, List<Item> &list):
+ Item_udf_func(thd, udf_arg, list) {}
String *val_str(String *);
double val_real()
{
@@ -1533,10 +1539,10 @@ public:
class Item_func_udf_float :public Item_real_func
{
public:
- Item_func_udf_float(udf_func *udf_arg)
- :Item_real_func() {}
- Item_func_udf_float(udf_func *udf_arg, List<Item> &list)
- :Item_real_func(list) {}
+ Item_func_udf_float(THD *thd, udf_func *udf_arg):
+ Item_real_func(thd) {}
+ Item_func_udf_float(THD *thd, udf_func *udf_arg, List<Item> &list):
+ Item_real_func(thd, list) {}
double val_real() { DBUG_ASSERT(fixed == 1); return 0.0; }
};
@@ -1544,10 +1550,10 @@ class Item_func_udf_float :public Item_real_func
class Item_func_udf_int :public Item_int_func
{
public:
- Item_func_udf_int(udf_func *udf_arg)
- :Item_int_func() {}
- Item_func_udf_int(udf_func *udf_arg, List<Item> &list)
- :Item_int_func(list) {}
+ Item_func_udf_int(THD *thd, udf_func *udf_arg):
+ Item_int_func(thd) {}
+ Item_func_udf_int(THD *thd, udf_func *udf_arg, List<Item> &list):
+ Item_int_func(thd, list) {}
longlong val_int() { DBUG_ASSERT(fixed == 1); return 0; }
};
@@ -1555,10 +1561,10 @@ public:
class Item_func_udf_decimal :public Item_int_func
{
public:
- Item_func_udf_decimal(udf_func *udf_arg)
- :Item_int_func() {}
- Item_func_udf_decimal(udf_func *udf_arg, List<Item> &list)
- :Item_int_func(list) {}
+ Item_func_udf_decimal(THD *thd, udf_func *udf_arg):
+ Item_int_func(thd) {}
+ Item_func_udf_decimal(THD *thd, udf_func *udf_arg, List<Item> &list):
+ Item_int_func(thd, list) {}
my_decimal *val_decimal(my_decimal *) { DBUG_ASSERT(fixed == 1); return 0; }
};
@@ -1566,10 +1572,10 @@ public:
class Item_func_udf_str :public Item_func
{
public:
- Item_func_udf_str(udf_func *udf_arg)
- :Item_func() {}
- Item_func_udf_str(udf_func *udf_arg, List<Item> &list)
- :Item_func(list) {}
+ Item_func_udf_str(THD *thd, udf_func *udf_arg):
+ Item_func(thd) {}
+ Item_func_udf_str(THD *thd, udf_func *udf_arg, List<Item> &list):
+ Item_func(thd, list) {}
String *val_str(String *)
{ DBUG_ASSERT(fixed == 1); null_value=1; return 0; }
double val_real() { DBUG_ASSERT(fixed == 1); null_value= 1; return 0.0; }
@@ -1587,7 +1593,7 @@ class Item_func_get_lock :public Item_int_func
{
String value;
public:
- Item_func_get_lock(Item *a,Item *b) :Item_int_func(a,b) {}
+ Item_func_get_lock(THD *thd, Item *a, Item *b) :Item_int_func(thd, a, b) {}
longlong val_int();
const char *func_name() const { return "get_lock"; }
void fix_length_and_dec() { max_length=1; maybe_null=1;}
@@ -1607,7 +1613,7 @@ class Item_func_release_lock :public Item_int_func
{
String value;
public:
- Item_func_release_lock(Item *a) :Item_int_func(a) {}
+ Item_func_release_lock(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "release_lock"; }
void fix_length_and_dec() { max_length= 1; maybe_null= 1;}
@@ -1629,9 +1635,11 @@ class Item_master_pos_wait :public Item_int_func
{
String value;
public:
- Item_master_pos_wait(Item *a,Item *b) :Item_int_func(a,b) {}
- Item_master_pos_wait(Item *a,Item *b,Item *c) :Item_int_func(a,b,c) {}
- Item_master_pos_wait(Item *a,Item *b, Item *c, Item *d) :Item_int_func(a,b,c,d) {}
+ Item_master_pos_wait(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
+ Item_master_pos_wait(THD *thd, Item *a, Item *b, Item *c):
+ Item_int_func(thd, a, b, c) {}
+ Item_master_pos_wait(THD *thd, Item *a, Item *b, Item *c, Item *d):
+ Item_int_func(thd, a, b, c, d) {}
longlong val_int();
const char *func_name() const { return "master_pos_wait"; }
void fix_length_and_dec() { max_length=21; maybe_null=1;}
@@ -1646,8 +1654,8 @@ class Item_master_gtid_wait :public Item_int_func
{
String value;
public:
- Item_master_gtid_wait(Item *a) :Item_int_func(a) {}
- Item_master_gtid_wait(Item *a,Item *b) :Item_int_func(a,b) {}
+ Item_master_gtid_wait(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_master_gtid_wait(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
longlong val_int();
const char *func_name() const { return "master_gtid_wait"; }
void fix_length_and_dec() { max_length=10+1+10+1+20+1; maybe_null=0;}
@@ -1691,9 +1699,9 @@ class Item_func_set_user_var :public Item_func
public:
LEX_STRING name; // keep it public
- Item_func_set_user_var(LEX_STRING a,Item *b)
- :Item_func(b), cached_result_type(INT_RESULT),
- entry(NULL), entry_thread_id(0), name(a)
+ Item_func_set_user_var(THD *thd, LEX_STRING a, Item *b):
+ Item_func(thd, b), cached_result_type(INT_RESULT),
+ entry(NULL), entry_thread_id(0), name(a)
{}
Item_func_set_user_var(THD *thd, Item_func_set_user_var *item)
:Item_func(thd, item), cached_result_type(item->cached_result_type),
@@ -1758,8 +1766,8 @@ class Item_func_get_user_var :public Item_func,
public:
LEX_STRING name; // keep it public
- Item_func_get_user_var(LEX_STRING a):
- Item_func(), m_cached_result_type(STRING_RESULT), name(a) {}
+ Item_func_get_user_var(THD *thd, LEX_STRING a):
+ Item_func(thd), m_cached_result_type(STRING_RESULT), name(a) {}
enum Functype functype() const { return GUSERVAR_FUNC; }
LEX_STRING get_name() { return name; }
double val_real();
@@ -1804,7 +1812,7 @@ class Item_user_var_as_out_param :public Item
LEX_STRING name;
user_var_entry *entry;
public:
- Item_user_var_as_out_param(LEX_STRING a) : name(a)
+ Item_user_var_as_out_param(THD *thd, LEX_STRING a): Item(thd), name(a)
{ set_name(a.str, 0, system_charset_info); }
/* We should return something different from FIELD_ITEM here */
enum Type type() const { return STRING_ITEM;}
@@ -1839,7 +1847,8 @@ class Item_func_get_system_var :public Item_func
uchar cache_present;
public:
- Item_func_get_system_var(sys_var *var_arg, enum_var_type var_type_arg,
+ Item_func_get_system_var(THD *thd, sys_var *var_arg,
+ enum_var_type var_type_arg,
LEX_STRING *component_arg, const char *name_arg,
size_t name_len_arg);
enum Functype functype() const { return GSYSVAR_FUNC; }
@@ -1888,8 +1897,9 @@ public:
String value; // value of concat_ws
String search_value; // key_item()'s value converted to cmp_collation
- Item_func_match(List<Item> &a, uint b): Item_real_func(a), key(0), flags(b),
- join_key(0), ft_handler(0), table(0), master(0), concat_ws(0) { }
+ Item_func_match(THD *thd, List<Item> &a, uint b):
+ Item_real_func(thd, a), key(0), flags(b), join_key(0), ft_handler(0),
+ table(0), master(0), concat_ws(0) { }
void cleanup()
{
DBUG_ENTER("Item_func_match::cleanup");
@@ -1913,7 +1923,7 @@ public:
virtual void print(String *str, enum_query_type query_type);
bool fix_index();
- void init_search(bool no_order);
+ void init_search(THD *thd, bool no_order);
bool check_vcol_func_processor(uchar *int_arg)
{
/* TODO: consider adding in support for the MATCH-based virtual columns */
@@ -1960,7 +1970,7 @@ private:
class Item_func_bit_xor : public Item_func_bit
{
public:
- Item_func_bit_xor(Item *a, Item *b) :Item_func_bit(a, b) {}
+ Item_func_bit_xor(THD *thd, Item *a, Item *b): Item_func_bit(thd, a, b) {}
longlong val_int();
const char *func_name() const { return "^"; }
};
@@ -1969,7 +1979,7 @@ class Item_func_is_free_lock :public Item_int_func
{
String value;
public:
- Item_func_is_free_lock(Item *a) :Item_int_func(a) {}
+ Item_func_is_free_lock(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "is_free_lock"; }
void fix_length_and_dec() { decimals=0; max_length=1; maybe_null=1;}
@@ -1983,7 +1993,7 @@ class Item_func_is_used_lock :public Item_int_func
{
String value;
public:
- Item_func_is_used_lock(Item *a) :Item_int_func(a) {}
+ Item_func_is_used_lock(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "is_used_lock"; }
void fix_length_and_dec() { decimals=0; max_length=10; maybe_null=1;}
@@ -2006,7 +2016,7 @@ enum Cast_target
class Item_func_row_count :public Item_int_func
{
public:
- Item_func_row_count() :Item_int_func() {}
+ Item_func_row_count(THD *thd): Item_int_func(thd) {}
longlong val_int();
const char *func_name() const { return "row_count"; }
void fix_length_and_dec() { decimals= 0; maybe_null=0; }
@@ -2051,9 +2061,9 @@ protected:
public:
- Item_func_sp(Name_resolution_context *context_arg, sp_name *name);
+ Item_func_sp(THD *thd, Name_resolution_context *context_arg, sp_name *name);
- Item_func_sp(Name_resolution_context *context_arg,
+ Item_func_sp(THD *thd, Name_resolution_context *context_arg,
sp_name *name, List<Item> &list);
virtual ~Item_func_sp()
@@ -2147,7 +2157,7 @@ public:
class Item_func_found_rows :public Item_int_func
{
public:
- Item_func_found_rows() :Item_int_func() {}
+ Item_func_found_rows(THD *thd): Item_int_func(thd) {}
longlong val_int();
const char *func_name() const { return "found_rows"; }
void fix_length_and_dec() { decimals= 0; maybe_null=0; }
@@ -2163,7 +2173,7 @@ void uuid_short_init();
class Item_func_uuid_short :public Item_int_func
{
public:
- Item_func_uuid_short() :Item_int_func() {}
+ Item_func_uuid_short(THD *thd): Item_int_func(thd) {}
const char *func_name() const { return "uuid_short"; }
longlong val_int();
void fix_length_and_dec()
@@ -2180,7 +2190,7 @@ class Item_func_last_value :public Item_func
protected:
Item *last_value;
public:
- Item_func_last_value(List<Item> &list) :Item_func(list) {}
+ Item_func_last_value(THD *thd, List<Item> &list): Item_func(thd, list) {}
double val_real();
longlong val_int();
String *val_str(String *);
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index fc7367dcd67..07059fed4be 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -38,6 +38,7 @@
#include "set_var.h"
#ifdef HAVE_SPATIAL
#include <m_ctype.h>
+#include "opt_range.h"
Field *Item_geometry_func::tmp_table_field(TABLE *t_arg)
@@ -908,10 +909,11 @@ String *Item_func_spatial_collection::val_str(String *str)
}
if (str->length() > current_thd->variables.max_allowed_packet)
{
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ THD *thd= current_thd;
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
- ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
- func_name(), current_thd->variables.max_allowed_packet);
+ ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED),
+ func_name(), thd->variables.max_allowed_packet);
goto err;
}
@@ -928,6 +930,78 @@ err:
Functions for spatial relations
*/
+static SEL_ARG sel_arg_impossible(SEL_ARG::IMPOSSIBLE);
+
+SEL_ARG *
+Item_func_spatial_rel::get_mm_leaf(RANGE_OPT_PARAM *param,
+ Field *field, KEY_PART *key_part,
+ Item_func::Functype type, Item *value)
+{
+ DBUG_ENTER("Item_func_spatial_rel::get_mm_leaf");
+ if (key_part->image_type != Field::itMBR)
+ DBUG_RETURN(0);
+ if (value->cmp_type() != STRING_RESULT)
+ DBUG_RETURN(&sel_arg_impossible);
+
+ if (param->using_real_indexes &&
+ !field->optimize_range(param->real_keynr[key_part->key],
+ key_part->part))
+ DBUG_RETURN(0);
+
+ if (value->save_in_field_no_warnings(field, 1))
+ DBUG_RETURN(&sel_arg_impossible); // Bad GEOMETRY value
+
+ DBUG_ASSERT(!field->real_maybe_null()); // SPATIAL keys do not support NULL
+
+ uchar *str= (uchar*) alloc_root(param->mem_root, key_part->store_length + 1);
+ if (!str)
+ DBUG_RETURN(0); // out of memory
+ field->get_key_image(str, key_part->length, key_part->image_type);
+ SEL_ARG *tree;
+ if (!(tree= new (param->mem_root) SEL_ARG(field, str, str)))
+ DBUG_RETURN(0); // out of memory
+
+ switch (type) {
+ case SP_EQUALS_FUNC:
+ tree->min_flag= GEOM_FLAG | HA_READ_MBR_EQUAL;// NEAR_MIN;//512;
+ tree->max_flag= NO_MAX_RANGE;
+ break;
+ case SP_DISJOINT_FUNC:
+ tree->min_flag= GEOM_FLAG | HA_READ_MBR_DISJOINT;// NEAR_MIN;//512;
+ tree->max_flag= NO_MAX_RANGE;
+ break;
+ case SP_INTERSECTS_FUNC:
+ tree->min_flag= GEOM_FLAG | HA_READ_MBR_INTERSECT;// NEAR_MIN;//512;
+ tree->max_flag= NO_MAX_RANGE;
+ break;
+ case SP_TOUCHES_FUNC:
+ tree->min_flag= GEOM_FLAG | HA_READ_MBR_INTERSECT;// NEAR_MIN;//512;
+ tree->max_flag= NO_MAX_RANGE;
+ break;
+ case SP_CROSSES_FUNC:
+ tree->min_flag= GEOM_FLAG | HA_READ_MBR_INTERSECT;// NEAR_MIN;//512;
+ tree->max_flag= NO_MAX_RANGE;
+ break;
+ case SP_WITHIN_FUNC:
+ tree->min_flag= GEOM_FLAG | HA_READ_MBR_WITHIN;// NEAR_MIN;//512;
+ tree->max_flag= NO_MAX_RANGE;
+ break;
+ case SP_CONTAINS_FUNC:
+ tree->min_flag= GEOM_FLAG | HA_READ_MBR_CONTAIN;// NEAR_MIN;//512;
+ tree->max_flag= NO_MAX_RANGE;
+ break;
+ case SP_OVERLAPS_FUNC:
+ tree->min_flag= GEOM_FLAG | HA_READ_MBR_INTERSECT;// NEAR_MIN;//512;
+ tree->max_flag= NO_MAX_RANGE;
+ break;
+ default:
+ DBUG_ASSERT(0);
+ break;
+ }
+ DBUG_RETURN(tree);
+}
+
+
const char *Item_func_spatial_mbr_rel::func_name() const
{
switch (spatial_rel) {
@@ -1018,8 +1092,6 @@ const char *Item_func_spatial_precise_rel::func_name() const
return "st_crosses";
case SP_OVERLAPS_FUNC:
return "st_overlaps";
- case SP_RELATE_FUNC:
- return "st_relate";
default:
DBUG_ASSERT(0); // Should never happened
return "sp_unknown";
@@ -1080,7 +1152,7 @@ static int setup_relate_func(Geometry *g1, Geometry *g2,
const char *mask)
{
int do_store_shapes=1;
- uint shape_a, shape_b;
+ uint UNINIT_VAR(shape_a), UNINIT_VAR(shape_b);
uint n_operands= 0;
int last_shape_pos;
@@ -1104,8 +1176,10 @@ static int setup_relate_func(Geometry *g1, Geometry *g2,
cur_op|= Gcalc_function::v_find_t;
break;
case 'F':
- cur_op|= (Gcalc_function::op_not | Gcalc_function::v_find_t);
+ cur_op|= (Gcalc_function::op_not | Gcalc_function::v_find_f);
break;
+ default:
+ return 1;
};
++n_operands;
if (func->reserve_op_buffer(3))
@@ -1140,94 +1214,139 @@ static int setup_relate_func(Geometry *g1, Geometry *g2,
#define GIS_ZERO 0.00000000001
+class Geometry_ptr_with_buffer_and_mbr
+{
+public:
+ Geometry *geom;
+ Geometry_buffer buffer;
+ MBR mbr;
+ bool construct(Item *item, String *tmp_value)
+ {
+ const char *c_end;
+ String *res= item->val_str(tmp_value);
+ return
+ item->null_value ||
+ !(geom= Geometry::construct(&buffer, res->ptr(), res->length())) ||
+ geom->get_mbr(&mbr, &c_end) || !mbr.valid();
+ }
+ int store_shapes(Gcalc_shape_transporter *trn) const
+ { return geom->store_shapes(trn); }
+};
+
+
+longlong Item_func_spatial_relate::val_int()
+{
+ DBUG_ENTER("Item_func_spatial_relate::val_int");
+ DBUG_ASSERT(fixed == 1);
+ Geometry_ptr_with_buffer_and_mbr g1, g2;
+ int result= 0;
+
+ if ((null_value= (g1.construct(args[0], &tmp_value1) ||
+ g2.construct(args[1], &tmp_value2) ||
+ func.reserve_op_buffer(1))))
+ DBUG_RETURN(0);
+
+ MBR umbr(g1.mbr, g2.mbr);
+ collector.set_extent(umbr.xmin, umbr.xmax, umbr.ymin, umbr.ymax);
+ g1.mbr.buffer(1e-5);
+ Gcalc_operation_transporter trn(&func, &collector);
+
+ String *matrix= args[2]->val_str(&tmp_matrix);
+ if ((null_value= args[2]->null_value || matrix->length() != 9 ||
+ setup_relate_func(g1.geom, g2.geom,
+ &trn, &func, matrix->ptr())))
+ goto exit;
+
+ collector.prepare_operation();
+ scan_it.init(&collector);
+ scan_it.killed= (int *) &(current_thd->killed);
+ if (!func.alloc_states())
+ result= func.check_function(scan_it);
+
+exit:
+ collector.reset();
+ func.reset();
+ scan_it.reset();
+ DBUG_RETURN(result);
+}
+
+
longlong Item_func_spatial_precise_rel::val_int()
{
DBUG_ENTER("Item_func_spatial_precise_rel::val_int");
DBUG_ASSERT(fixed == 1);
- String *res1;
- String *res2;
- String *res3;
- Geometry_buffer buffer1, buffer2;
- Geometry *g1, *g2;
+ Geometry_ptr_with_buffer_and_mbr g1, g2;
int result= 0;
- int mask= 0;
uint shape_a, shape_b;
- MBR umbr, mbr1, mbr2;
- const char *c_end;
- res1= args[0]->val_str(&tmp_value1);
- res2= args[1]->val_str(&tmp_value2);
- Gcalc_operation_transporter trn(&func, &collector);
-
- if (func.reserve_op_buffer(1))
+ if ((null_value= (g1.construct(args[0], &tmp_value1) ||
+ g2.construct(args[1], &tmp_value2) ||
+ func.reserve_op_buffer(1))))
DBUG_RETURN(0);
- if ((null_value=
- (args[0]->null_value || args[1]->null_value ||
- !(g1= Geometry::construct(&buffer1, res1->ptr(), res1->length())) ||
- !(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())) ||
- g1->get_mbr(&mbr1, &c_end) || !mbr1.valid() ||
- g2->get_mbr(&mbr2, &c_end) || !mbr2.valid())))
- goto exit;
+ Gcalc_operation_transporter trn(&func, &collector);
- umbr= mbr1;
- umbr.add_mbr(&mbr2);
+ MBR umbr(g1.mbr, g2.mbr);
collector.set_extent(umbr.xmin, umbr.xmax, umbr.ymin, umbr.ymax);
- mbr1.buffer(1e-5);
+ g1.mbr.buffer(1e-5);
switch (spatial_rel) {
case SP_CONTAINS_FUNC:
- if (!mbr1.contains(&mbr2))
+ if (!g1.mbr.contains(&g2.mbr))
goto exit;
- mask= 1;
- func.add_operation(Gcalc_function::op_difference, 2);
+ func.add_operation(Gcalc_function::v_find_f |
+ Gcalc_function::op_not |
+ Gcalc_function::op_difference, 2);
/* Mind the g2 goes first. */
- null_value= g2->store_shapes(&trn) || g1->store_shapes(&trn);
+ null_value= g2.store_shapes(&trn) || g1.store_shapes(&trn);
break;
case SP_WITHIN_FUNC:
- mbr2.buffer(2e-5);
- if (!mbr1.within(&mbr2))
+ g2.mbr.buffer(2e-5);
+ if (!g1.mbr.within(&g2.mbr))
goto exit;
- mask= 1;
- func.add_operation(Gcalc_function::op_difference, 2);
- null_value= g1->store_shapes(&trn) || g2->store_shapes(&trn);
+ func.add_operation(Gcalc_function::v_find_f |
+ Gcalc_function::op_not |
+ Gcalc_function::op_difference, 2);
+ null_value= g1.store_shapes(&trn) || g2.store_shapes(&trn);
break;
case SP_EQUALS_FUNC:
- if (!mbr1.contains(&mbr2))
+ if (!g1.mbr.contains(&g2.mbr))
goto exit;
- mask= 1;
- func.add_operation(Gcalc_function::op_symdifference, 2);
- null_value= g1->store_shapes(&trn) || g2->store_shapes(&trn);
+ func.add_operation(Gcalc_function::v_find_f |
+ Gcalc_function::op_not |
+ Gcalc_function::op_symdifference, 2);
+ null_value= g1.store_shapes(&trn) || g2.store_shapes(&trn);
break;
case SP_DISJOINT_FUNC:
- mask= 1;
- func.add_operation(Gcalc_function::op_intersection, 2);
- null_value= g1->store_shapes(&trn) || g2->store_shapes(&trn);
+ func.add_operation(Gcalc_function::v_find_f |
+ Gcalc_function::op_not |
+ Gcalc_function::op_intersection, 2);
+ null_value= g1.store_shapes(&trn) || g2.store_shapes(&trn);
break;
case SP_INTERSECTS_FUNC:
- if (!mbr1.intersects(&mbr2))
+ if (!g1.mbr.intersects(&g2.mbr))
goto exit;
- func.add_operation(Gcalc_function::op_intersection, 2);
- null_value= g1->store_shapes(&trn) || g2->store_shapes(&trn);
+ func.add_operation(Gcalc_function::v_find_t |
+ Gcalc_function::op_intersection, 2);
+ null_value= g1.store_shapes(&trn) || g2.store_shapes(&trn);
break;
case SP_OVERLAPS_FUNC:
case SP_CROSSES_FUNC:
func.add_operation(Gcalc_function::op_intersection, 2);
- if (func.reserve_op_buffer(1))
+ if (func.reserve_op_buffer(3))
break;
func.add_operation(Gcalc_function::v_find_t |
Gcalc_function::op_intersection, 2);
shape_a= func.get_next_expression_pos();
- if ((null_value= g1->store_shapes(&trn)))
+ if ((null_value= g1.store_shapes(&trn)))
break;
shape_b= func.get_next_expression_pos();
- if ((null_value= g2->store_shapes(&trn)))
+ if ((null_value= g2.store_shapes(&trn)))
break;
if (func.reserve_op_buffer(7))
break;
- func.add_operation(Gcalc_function::v_find_t |
- Gcalc_function::op_intersection, 2);
+ func.add_operation(Gcalc_function::op_intersection, 2);
func.add_operation(Gcalc_function::v_find_t |
Gcalc_function::op_difference, 2);
func.repeat_expression(shape_a);
@@ -1238,7 +1357,7 @@ longlong Item_func_spatial_precise_rel::val_int()
func.repeat_expression(shape_a);
break;
case SP_TOUCHES_FUNC:
- if (func.reserve_op_buffer(2))
+ if (func.reserve_op_buffer(5))
break;
func.add_operation(Gcalc_function::op_intersection, 2);
func.add_operation(Gcalc_function::v_find_f |
@@ -1246,26 +1365,17 @@ longlong Item_func_spatial_precise_rel::val_int()
Gcalc_function::op_intersection, 2);
func.add_operation(Gcalc_function::op_internals, 1);
shape_a= func.get_next_expression_pos();
- if ((null_value= g1->store_shapes(&trn)))
+ if ((null_value= g1.store_shapes(&trn)))
break;
func.add_operation(Gcalc_function::op_internals, 1);
shape_b= func.get_next_expression_pos();
- if ((null_value= g2->store_shapes(&trn)))
+ if ((null_value= g2.store_shapes(&trn)))
break;
func.add_operation(Gcalc_function::v_find_t |
Gcalc_function::op_intersection, 2);
- func.add_operation(Gcalc_function::op_border, 1);
func.repeat_expression(shape_a);
- func.add_operation(Gcalc_function::op_border, 1);
func.repeat_expression(shape_b);
break;
- case SP_RELATE_FUNC:
- res3= args[2]->val_str(&tmp_matrix);
- if ((null_value= args[2]->null_value))
- break;
- null_value= (res3->length() != 9) ||
- setup_relate_func(g1, g2, &trn, &func, res3->ptr());
- break;
default:
DBUG_ASSERT(FALSE);
break;
@@ -1281,7 +1391,7 @@ longlong Item_func_spatial_precise_rel::val_int()
if (func.alloc_states())
goto exit;
- result= func.check_function(scan_it) ^ mask;
+ result= func.check_function(scan_it);
exit:
collector.reset();
@@ -1300,34 +1410,25 @@ String *Item_func_spatial_operation::val_str(String *str_value)
{
DBUG_ENTER("Item_func_spatial_operation::val_str");
DBUG_ASSERT(fixed == 1);
- String *res1= args[0]->val_str(&tmp_value1);
- String *res2= args[1]->val_str(&tmp_value2);
- Geometry_buffer buffer1, buffer2;
- Geometry *g1, *g2;
+ Geometry_ptr_with_buffer_and_mbr g1, g2;
uint32 srid= 0;
Gcalc_operation_transporter trn(&func, &collector);
- MBR mbr1, mbr2;
- const char *c_end;
if (func.reserve_op_buffer(1))
DBUG_RETURN(0);
func.add_operation(spatial_op, 2);
- if ((null_value=
- (args[0]->null_value || args[1]->null_value ||
- !(g1= Geometry::construct(&buffer1, res1->ptr(), res1->length())) ||
- !(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())) ||
- g1->get_mbr(&mbr1, &c_end) || !mbr1.valid() ||
- g2->get_mbr(&mbr2, &c_end) || !mbr2.valid())))
+ if ((null_value= (g1.construct(args[0], &tmp_value1) ||
+ g2.construct(args[1], &tmp_value2))))
{
str_value= 0;
goto exit;
}
- mbr1.add_mbr(&mbr2);
- collector.set_extent(mbr1.xmin, mbr1.xmax, mbr1.ymin, mbr1.ymax);
+ g1.mbr.add_mbr(&g2.mbr);
+ collector.set_extent(g1.mbr.xmin, g1.mbr.xmax, g1.mbr.ymin, g1.mbr.ymax);
- if ((null_value= g1->store_shapes(&trn) || g2->store_shapes(&trn)))
+ if ((null_value= g1.store_shapes(&trn) || g2.store_shapes(&trn)))
{
str_value= 0;
goto exit;
@@ -1350,7 +1451,7 @@ String *Item_func_spatial_operation::val_str(String *str_value)
str_value->length(0);
str_value->q_append(srid);
- if (!Geometry::create_from_opresult(&buffer1, str_value, res_receiver))
+ if (!Geometry::create_from_opresult(&g1.buffer, str_value, res_receiver))
goto exit;
exit:
@@ -1857,10 +1958,14 @@ longlong Item_func_issimple::val_int()
DBUG_ENTER("Item_func_issimple::val_int");
DBUG_ASSERT(fixed == 1);
- if ((null_value= (args[0]->null_value ||
- !(g= Geometry::construct(&buffer, swkb->ptr(), swkb->length())) ||
- g->get_mbr(&mbr, &c_end))))
- DBUG_RETURN(0);
+ null_value= 0;
+ if ((args[0]->null_value ||
+ !(g= Geometry::construct(&buffer, swkb->ptr(), swkb->length())) ||
+ g->get_mbr(&mbr, &c_end)))
+ {
+ /* We got NULL as an argument. Have to return -1 */
+ DBUG_RETURN(-1);
+ }
collector.set_extent(mbr.xmin, mbr.xmax, mbr.ymin, mbr.ymax);
@@ -1921,11 +2026,15 @@ longlong Item_func_isclosed::val_int()
Geometry *geom;
int isclosed= 0; // In case of error
- null_value= (!swkb ||
- args[0]->null_value ||
- !(geom=
- Geometry::construct(&buffer, swkb->ptr(), swkb->length())) ||
- geom->is_closed(&isclosed));
+ null_value= 0;
+ if (!swkb ||
+ args[0]->null_value ||
+ !(geom= Geometry::construct(&buffer, swkb->ptr(), swkb->length())) ||
+ geom->is_closed(&isclosed))
+ {
+ /* IsClosed(NULL) should return -1 */
+ return -1;
+ }
return (longlong) isclosed;
}
@@ -1941,11 +2050,15 @@ longlong Item_func_isring::val_int()
Geometry *geom;
int isclosed= 0; // In case of error
- null_value= (!swkb ||
- args[0]->null_value ||
- !(geom=
- Geometry::construct(&buffer, swkb->ptr(), swkb->length())) ||
- geom->is_closed(&isclosed));
+ null_value= 0;
+ if (!swkb ||
+ args[0]->null_value ||
+ !(geom= Geometry::construct(&buffer, swkb->ptr(), swkb->length())) ||
+ geom->is_closed(&isclosed))
+ {
+ /* IsRing(NULL) should return -1 */
+ return -1;
+ }
if (!isclosed)
return 0;
@@ -2281,12 +2394,11 @@ String *Item_func_pointonsurface::val_str(String *str)
Geometry *g;
MBR mbr;
const char *c_end;
- double px, py, x0, y0;
+ double UNINIT_VAR(px), UNINIT_VAR(py), x0, y0;
String *result= 0;
const Gcalc_scan_iterator::point *pprev= NULL;
uint32 srid;
-
null_value= 1;
if ((args[0]->null_value ||
!(g= Geometry::construct(&buffer, res->ptr(), res->length())) ||
diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h
index 17556c9dec9..d814019bd74 100644
--- a/sql/item_geofunc.h
+++ b/sql/item_geofunc.h
@@ -32,11 +32,12 @@
class Item_geometry_func: public Item_str_func
{
public:
- Item_geometry_func() :Item_str_func() {}
- Item_geometry_func(Item *a) :Item_str_func(a) {}
- Item_geometry_func(Item *a,Item *b) :Item_str_func(a,b) {}
- Item_geometry_func(Item *a,Item *b,Item *c) :Item_str_func(a,b,c) {}
- Item_geometry_func(List<Item> &list) :Item_str_func(list) {}
+ Item_geometry_func(THD *thd): Item_str_func(thd) {}
+ Item_geometry_func(THD *thd, Item *a): Item_str_func(thd, a) {}
+ Item_geometry_func(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
+ Item_geometry_func(THD *thd, Item *a, Item *b, Item *c):
+ Item_str_func(thd, a, b, c) {}
+ Item_geometry_func(THD *thd, List<Item> &list): Item_str_func(thd, list) {}
void fix_length_and_dec();
enum_field_types field_type() const { return MYSQL_TYPE_GEOMETRY; }
Field *tmp_table_field(TABLE *t_arg);
@@ -46,8 +47,9 @@ public:
class Item_func_geometry_from_text: public Item_geometry_func
{
public:
- Item_func_geometry_from_text(Item *a) :Item_geometry_func(a) {}
- Item_func_geometry_from_text(Item *a, Item *srid) :Item_geometry_func(a, srid) {}
+ Item_func_geometry_from_text(THD *thd, Item *a): Item_geometry_func(thd, a) {}
+ Item_func_geometry_from_text(THD *thd, Item *a, Item *srid):
+ Item_geometry_func(thd, a, srid) {}
const char *func_name() const { return "st_geometryfromtext"; }
String *val_str(String *);
};
@@ -55,8 +57,9 @@ public:
class Item_func_geometry_from_wkb: public Item_geometry_func
{
public:
- Item_func_geometry_from_wkb(Item *a): Item_geometry_func(a) {}
- Item_func_geometry_from_wkb(Item *a, Item *srid): Item_geometry_func(a, srid) {}
+ Item_func_geometry_from_wkb(THD *thd, Item *a): Item_geometry_func(thd, a) {}
+ Item_func_geometry_from_wkb(THD *thd, Item *a, Item *srid):
+ Item_geometry_func(thd, a, srid) {}
const char *func_name() const { return "st_geometryfromwkb"; }
String *val_str(String *);
};
@@ -64,7 +67,7 @@ public:
class Item_func_as_wkt: public Item_str_ascii_func
{
public:
- Item_func_as_wkt(Item *a): Item_str_ascii_func(a) {}
+ Item_func_as_wkt(THD *thd, Item *a): Item_str_ascii_func(thd, a) {}
const char *func_name() const { return "st_astext"; }
String *val_str_ascii(String *);
void fix_length_and_dec();
@@ -73,7 +76,7 @@ public:
class Item_func_as_wkb: public Item_geometry_func
{
public:
- Item_func_as_wkb(Item *a): Item_geometry_func(a) {}
+ Item_func_as_wkb(THD *thd, Item *a): Item_geometry_func(thd, a) {}
const char *func_name() const { return "st_aswkb"; }
String *val_str(String *);
enum_field_types field_type() const { return MYSQL_TYPE_BLOB; }
@@ -82,7 +85,7 @@ public:
class Item_func_geometry_type: public Item_str_ascii_func
{
public:
- Item_func_geometry_type(Item *a): Item_str_ascii_func(a) {}
+ Item_func_geometry_type(THD *thd, Item *a): Item_str_ascii_func(thd, a) {}
String *val_str_ascii(String *);
const char *func_name() const { return "st_geometrytype"; }
void fix_length_and_dec()
@@ -118,7 +121,7 @@ class Item_func_convexhull: public Item_geometry_func
ch_node *new_ch_node() { return (ch_node *) res_heap.new_item(); }
int add_node_to_line(ch_node **p_cur, int dir, const Gcalc_heap::Info *pi);
public:
- Item_func_convexhull(Item *a): Item_geometry_func(a),
+ Item_func_convexhull(THD *thd, Item *a): Item_geometry_func(thd, a),
res_heap(8192, sizeof(ch_node))
{}
const char *func_name() const { return "st_convexhull"; }
@@ -129,7 +132,7 @@ public:
class Item_func_centroid: public Item_geometry_func
{
public:
- Item_func_centroid(Item *a): Item_geometry_func(a) {}
+ Item_func_centroid(THD *thd, Item *a): Item_geometry_func(thd, a) {}
const char *func_name() const { return "st_centroid"; }
String *val_str(String *);
Field::geometry_type get_geometry_type() const;
@@ -138,7 +141,7 @@ public:
class Item_func_envelope: public Item_geometry_func
{
public:
- Item_func_envelope(Item *a): Item_geometry_func(a) {}
+ Item_func_envelope(THD *thd, Item *a): Item_geometry_func(thd, a) {}
const char *func_name() const { return "st_envelope"; }
String *val_str(String *);
Field::geometry_type get_geometry_type() const;
@@ -170,7 +173,7 @@ class Item_func_boundary: public Item_geometry_func
};
Gcalc_result_receiver res_receiver;
public:
- Item_func_boundary(Item *a): Item_geometry_func(a) {}
+ Item_func_boundary(THD *thd, Item *a): Item_geometry_func(thd, a) {}
const char *func_name() const { return "st_boundary"; }
String *val_str(String *);
};
@@ -179,8 +182,9 @@ public:
class Item_func_point: public Item_geometry_func
{
public:
- Item_func_point(Item *a, Item *b): Item_geometry_func(a, b) {}
- Item_func_point(Item *a, Item *b, Item *srid): Item_geometry_func(a, b, srid) {}
+ Item_func_point(THD *thd, Item *a, Item *b): Item_geometry_func(thd, a, b) {}
+ Item_func_point(THD *thd, Item *a, Item *b, Item *srid):
+ Item_geometry_func(thd, a, b, srid) {}
const char *func_name() const { return "point"; }
String *val_str(String *);
Field::geometry_type get_geometry_type() const;
@@ -190,8 +194,8 @@ class Item_func_spatial_decomp: public Item_geometry_func
{
enum Functype decomp_func;
public:
- Item_func_spatial_decomp(Item *a, Item_func::Functype ft) :
- Item_geometry_func(a) { decomp_func = ft; }
+ Item_func_spatial_decomp(THD *thd, Item *a, Item_func::Functype ft):
+ Item_geometry_func(thd, a) { decomp_func = ft; }
const char *func_name() const
{
switch (decomp_func)
@@ -214,8 +218,8 @@ class Item_func_spatial_decomp_n: public Item_geometry_func
{
enum Functype decomp_func_n;
public:
- Item_func_spatial_decomp_n(Item *a, Item *b, Item_func::Functype ft):
- Item_geometry_func(a, b) { decomp_func_n = ft; }
+ Item_func_spatial_decomp_n(THD *thd, Item *a, Item *b, Item_func::Functype ft):
+ Item_geometry_func(thd, a, b) { decomp_func_n = ft; }
const char *func_name() const
{
switch (decomp_func_n)
@@ -240,9 +244,9 @@ class Item_func_spatial_collection: public Item_geometry_func
enum Geometry::wkbType coll_type;
enum Geometry::wkbType item_type;
public:
- Item_func_spatial_collection(
+ Item_func_spatial_collection(THD *thd,
List<Item> &list, enum Geometry::wkbType ct, enum Geometry::wkbType it):
- Item_geometry_func(list)
+ Item_geometry_func(thd, list)
{
coll_type=ct;
item_type=it;
@@ -272,22 +276,23 @@ public:
Spatial relations
*/
-class Item_func_spatial_rel: public Item_bool_func
+class Item_func_spatial_rel: public Item_bool_func2
{
protected:
enum Functype spatial_rel;
String tmp_value1, tmp_value2;
+ SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, Field *field,
+ KEY_PART *key_part,
+ Item_func::Functype type, Item *value);
public:
- Item_func_spatial_rel(Item *a, Item *b, enum Functype sp_rel)
- :Item_bool_func(a, b), spatial_rel(sp_rel)
- { }
- Item_func_spatial_rel(Item *a, Item *b, Item *c, enum Functype sp_rel)
- :Item_bool_func(a, b, c), spatial_rel(sp_rel)
- { }
+ Item_func_spatial_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel):
+ Item_bool_func2(thd, a, b), spatial_rel(sp_rel)
+ {
+ maybe_null= true;
+ }
enum Functype functype() const { return spatial_rel; }
enum Functype rev_functype() const { return spatial_rel; }
bool is_null() { (void) val_int(); return null_value; }
- optimize_type select_optimize() const { return OPTIMIZE_OP; }
void add_key_fields(JOIN *join, KEY_FIELD **key_fields,
uint *and_level, table_map usable_tables,
SARGABLE_PARAM **sargables)
@@ -301,8 +306,8 @@ public:
class Item_func_spatial_mbr_rel: public Item_func_spatial_rel
{
public:
- Item_func_spatial_mbr_rel(Item *a, Item *b, enum Functype sp_rel)
- :Item_func_spatial_rel(a, b, sp_rel)
+ Item_func_spatial_mbr_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel):
+ Item_func_spatial_rel(thd, a, b, sp_rel)
{ }
longlong val_int();
const char *func_name() const;
@@ -314,19 +319,30 @@ class Item_func_spatial_precise_rel: public Item_func_spatial_rel
Gcalc_heap collector;
Gcalc_scan_iterator scan_it;
Gcalc_function func;
- String tmp_matrix;
public:
- Item_func_spatial_precise_rel(Item *a, Item *b, enum Functype sp_rel)
- :Item_func_spatial_rel(a, b, sp_rel), collector()
- { }
- Item_func_spatial_precise_rel(Item *a, Item *b, Item *matrix)
- :Item_func_spatial_rel(a, b, matrix, SP_RELATE_FUNC)
+ Item_func_spatial_precise_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel):
+ Item_func_spatial_rel(thd, a, b, sp_rel), collector()
{ }
longlong val_int();
const char *func_name() const;
};
+class Item_func_spatial_relate: public Item_bool_func
+{
+ Gcalc_heap collector;
+ Gcalc_scan_iterator scan_it;
+ Gcalc_function func;
+ String tmp_value1, tmp_value2, tmp_matrix;
+public:
+ Item_func_spatial_relate(THD *thd, Item *a, Item *b, Item *matrix):
+ Item_bool_func(thd, a, b, matrix)
+ { }
+ longlong val_int();
+ const char *func_name() const { return "st_relate"; }
+};
+
+
/*
Spatial operations
*/
@@ -342,8 +358,9 @@ public:
Gcalc_operation_reducer operation;
String tmp_value1,tmp_value2;
public:
- Item_func_spatial_operation(Item *a,Item *b, Gcalc_function::op_type sp_op) :
- Item_geometry_func(a, b), spatial_op(sp_op)
+ Item_func_spatial_operation(THD *thd, Item *a,Item *b,
+ Gcalc_function::op_type sp_op):
+ Item_geometry_func(thd, a, b), spatial_op(sp_op)
{}
virtual ~Item_func_spatial_operation();
String *val_str(String *);
@@ -399,8 +416,8 @@ protected:
String tmp_value;
public:
- Item_func_buffer(Item *obj, Item *distance):
- Item_geometry_func(obj, distance) {}
+ Item_func_buffer(THD *thd, Item *obj, Item *distance):
+ Item_geometry_func(thd, obj, distance) {}
const char *func_name() const { return "st_buffer"; }
String *val_str(String *);
};
@@ -409,38 +426,40 @@ public:
class Item_func_isempty: public Item_bool_func
{
public:
- Item_func_isempty(Item *a): Item_bool_func(a) {}
+ Item_func_isempty(THD *thd, Item *a): Item_bool_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "st_isempty"; }
void fix_length_and_dec() { maybe_null= 1; }
};
-class Item_func_issimple: public Item_bool_func
+class Item_func_issimple: public Item_int_func
{
Gcalc_heap collector;
Gcalc_function func;
Gcalc_scan_iterator scan_it;
String tmp;
public:
- Item_func_issimple(Item *a): Item_bool_func(a) {}
+ Item_func_issimple(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "st_issimple"; }
- void fix_length_and_dec() { maybe_null= 1; }
+ void fix_length_and_dec() { decimals=0; max_length=2; }
+ uint decimal_precision() const { return 1; }
};
-class Item_func_isclosed: public Item_bool_func
+class Item_func_isclosed: public Item_int_func
{
public:
- Item_func_isclosed(Item *a): Item_bool_func(a) {}
+ Item_func_isclosed(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "st_isclosed"; }
- void fix_length_and_dec() { maybe_null= 1; }
+ void fix_length_and_dec() { decimals=0; max_length=2; }
+ uint decimal_precision() const { return 1; }
};
class Item_func_isring: public Item_func_issimple
{
public:
- Item_func_isring(Item *a): Item_func_issimple(a) {}
+ Item_func_isring(THD *thd, Item *a): Item_func_issimple(thd, a) {}
longlong val_int();
const char *func_name() const { return "st_isring"; }
};
@@ -449,7 +468,7 @@ class Item_func_dimension: public Item_int_func
{
String value;
public:
- Item_func_dimension(Item *a): Item_int_func(a) {}
+ Item_func_dimension(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "st_dimension"; }
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
@@ -459,7 +478,7 @@ class Item_func_x: public Item_real_func
{
String value;
public:
- Item_func_x(Item *a): Item_real_func(a) {}
+ Item_func_x(THD *thd, Item *a): Item_real_func(thd, a) {}
double val_real();
const char *func_name() const { return "st_x"; }
void fix_length_and_dec()
@@ -474,7 +493,7 @@ class Item_func_y: public Item_real_func
{
String value;
public:
- Item_func_y(Item *a): Item_real_func(a) {}
+ Item_func_y(THD *thd, Item *a): Item_real_func(thd, a) {}
double val_real();
const char *func_name() const { return "st_y"; }
void fix_length_and_dec()
@@ -489,7 +508,7 @@ class Item_func_numgeometries: public Item_int_func
{
String value;
public:
- Item_func_numgeometries(Item *a): Item_int_func(a) {}
+ Item_func_numgeometries(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "st_numgeometries"; }
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
@@ -500,7 +519,7 @@ class Item_func_numinteriorring: public Item_int_func
{
String value;
public:
- Item_func_numinteriorring(Item *a): Item_int_func(a) {}
+ Item_func_numinteriorring(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "st_numinteriorrings"; }
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
@@ -511,7 +530,7 @@ class Item_func_numpoints: public Item_int_func
{
String value;
public:
- Item_func_numpoints(Item *a): Item_int_func(a) {}
+ Item_func_numpoints(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "st_numpoints"; }
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
@@ -522,7 +541,7 @@ class Item_func_area: public Item_real_func
{
String value;
public:
- Item_func_area(Item *a): Item_real_func(a) {}
+ Item_func_area(THD *thd, Item *a): Item_real_func(thd, a) {}
double val_real();
const char *func_name() const { return "st_area"; }
void fix_length_and_dec()
@@ -537,7 +556,7 @@ class Item_func_glength: public Item_real_func
{
String value;
public:
- Item_func_glength(Item *a): Item_real_func(a) {}
+ Item_func_glength(THD *thd, Item *a): Item_real_func(thd, a) {}
double val_real();
const char *func_name() const { return "st_length"; }
void fix_length_and_dec()
@@ -552,7 +571,7 @@ class Item_func_srid: public Item_int_func
{
String value;
public:
- Item_func_srid(Item *a): Item_int_func(a) {}
+ Item_func_srid(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "srid"; }
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
@@ -567,7 +586,7 @@ class Item_func_distance: public Item_real_func
Gcalc_function func;
Gcalc_scan_iterator scan_it;
public:
- Item_func_distance(Item *a, Item *b): Item_real_func(a, b) {}
+ Item_func_distance(THD *thd, Item *a, Item *b): Item_real_func(thd, a, b) {}
double val_real();
const char *func_name() const { return "st_distance"; }
};
@@ -580,7 +599,7 @@ class Item_func_pointonsurface: public Item_geometry_func
Gcalc_function func;
Gcalc_scan_iterator scan_it;
public:
- Item_func_pointonsurface(Item *a): Item_geometry_func(a) {}
+ Item_func_pointonsurface(THD *thd, Item *a): Item_geometry_func(thd, a) {}
const char *func_name() const { return "st_pointonsurface"; }
String *val_str(String *);
Field::geometry_type get_geometry_type() const;
@@ -591,7 +610,8 @@ public:
class Item_func_gis_debug: public Item_int_func
{
public:
- Item_func_gis_debug(Item *a) :Item_int_func(a) { null_value= false; }
+ Item_func_gis_debug(THD *thd, Item *a): Item_int_func(thd, a)
+ { null_value= false; }
const char *func_name() const { return "st_gis_debug"; }
longlong val_int();
};
diff --git a/sql/item_inetfunc.h b/sql/item_inetfunc.h
index 3a85d367ff1..82a4405df1e 100644
--- a/sql/item_inetfunc.h
+++ b/sql/item_inetfunc.h
@@ -27,7 +27,7 @@
class Item_func_inet_aton : public Item_int_func
{
public:
- Item_func_inet_aton(Item *a) :Item_int_func(a) {}
+ Item_func_inet_aton(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "inet_aton"; }
void fix_length_and_dec()
@@ -47,8 +47,7 @@ public:
class Item_func_inet_ntoa : public Item_str_func
{
public:
- Item_func_inet_ntoa(Item *a)
- : Item_str_func(a)
+ Item_func_inet_ntoa(THD *thd, Item *a): Item_str_func(thd, a)
{ }
String* val_str(String* str);
const char *func_name() const { return "inet_ntoa"; }
@@ -69,8 +68,8 @@ public:
class Item_func_inet_bool_base : public Item_bool_func
{
public:
- inline Item_func_inet_bool_base(Item *ip_addr)
- : Item_bool_func(ip_addr)
+ inline Item_func_inet_bool_base(THD *thd, Item *ip_addr):
+ Item_bool_func(thd, ip_addr)
{
null_value= false;
}
@@ -91,8 +90,8 @@ protected:
class Item_func_inet_str_base : public Item_str_ascii_func
{
public:
- inline Item_func_inet_str_base(Item *arg)
- : Item_str_ascii_func(arg)
+ inline Item_func_inet_str_base(THD *thd, Item *arg):
+ Item_str_ascii_func(thd, arg)
{ }
public:
@@ -110,8 +109,8 @@ protected:
class Item_func_inet6_aton : public Item_func_inet_str_base
{
public:
- inline Item_func_inet6_aton(Item *ip_addr)
- : Item_func_inet_str_base(ip_addr)
+ inline Item_func_inet6_aton(THD *thd, Item *ip_addr):
+ Item_func_inet_str_base(thd, ip_addr)
{ }
public:
@@ -137,8 +136,8 @@ protected:
class Item_func_inet6_ntoa : public Item_func_inet_str_base
{
public:
- inline Item_func_inet6_ntoa(Item *ip_addr)
- : Item_func_inet_str_base(ip_addr)
+ inline Item_func_inet6_ntoa(THD *thd, Item *ip_addr):
+ Item_func_inet_str_base(thd, ip_addr)
{ }
public:
@@ -169,8 +168,8 @@ protected:
class Item_func_is_ipv4 : public Item_func_inet_bool_base
{
public:
- inline Item_func_is_ipv4(Item *ip_addr)
- : Item_func_inet_bool_base(ip_addr)
+ inline Item_func_is_ipv4(THD *thd, Item *ip_addr):
+ Item_func_inet_bool_base(thd, ip_addr)
{ }
public:
@@ -189,8 +188,8 @@ protected:
class Item_func_is_ipv6 : public Item_func_inet_bool_base
{
public:
- inline Item_func_is_ipv6(Item *ip_addr)
- : Item_func_inet_bool_base(ip_addr)
+ inline Item_func_is_ipv6(THD *thd, Item *ip_addr):
+ Item_func_inet_bool_base(thd, ip_addr)
{ }
public:
@@ -209,8 +208,8 @@ protected:
class Item_func_is_ipv4_compat : public Item_func_inet_bool_base
{
public:
- inline Item_func_is_ipv4_compat(Item *ip_addr)
- : Item_func_inet_bool_base(ip_addr)
+ inline Item_func_is_ipv4_compat(THD *thd, Item *ip_addr):
+ Item_func_inet_bool_base(thd, ip_addr)
{ }
public:
@@ -229,8 +228,8 @@ protected:
class Item_func_is_ipv4_mapped : public Item_func_inet_bool_base
{
public:
- inline Item_func_is_ipv4_mapped(Item *ip_addr)
- : Item_func_inet_bool_base(ip_addr)
+ inline Item_func_is_ipv4_mapped(THD *thd, Item *ip_addr):
+ Item_func_inet_bool_base(thd, ip_addr)
{ }
public:
diff --git a/sql/item_row.cc b/sql/item_row.cc
index dea26ebc6ae..b1575b81087 100644
--- a/sql/item_row.cc
+++ b/sql/item_row.cc
@@ -101,11 +101,12 @@ void Item_row::cleanup()
void Item_row::split_sum_func(THD *thd, Item **ref_pointer_array,
- List<Item> &fields)
+ List<Item> &fields, uint flags)
{
Item **arg, **arg_end;
for (arg= args, arg_end= args + arg_count; arg != arg_end ; arg++)
- (*arg)->split_sum_func2(thd, ref_pointer_array, fields, arg, TRUE);
+ (*arg)->split_sum_func2(thd, ref_pointer_array, fields, arg,
+ flags | SPLIT_SUM_SKIP_REGISTERED);
}
@@ -145,13 +146,13 @@ void Item_row::print(String *str, enum_query_type query_type)
}
-Item *Item_row::transform(Item_transformer transformer, uchar *arg)
+Item *Item_row::transform(THD *thd, Item_transformer transformer, uchar *arg)
{
- DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
+ DBUG_ASSERT(!thd->stmt_arena->is_stmt_prepare());
- if (transform_args(transformer, arg))
+ if (transform_args(thd, transformer, arg))
return 0;
- return (this->*transformer)(arg);
+ return (this->*transformer)(thd, arg);
}
void Item_row::bring_value()
diff --git a/sql/item_row.h b/sql/item_row.h
index 1bec6212715..cf55eddc19c 100644
--- a/sql/item_row.h
+++ b/sql/item_row.h
@@ -35,10 +35,11 @@ class Item_row: public Item,
table_map not_null_tables_cache;
bool with_null;
public:
- Item_row(List<Item> &list)
- :Item_args(list), not_null_tables_cache(0), with_null(0)
+ Item_row(THD *thd, List<Item> &list):
+ Item(thd), Item_args(thd, list), not_null_tables_cache(0), with_null(0)
{ }
- Item_row(Item_row *item):
+ Item_row(THD *thd, Item_row *item):
+ Item(thd),
Item_args(item),
Used_tables_and_const_cache(item),
not_null_tables_cache(0),
@@ -75,7 +76,8 @@ public:
bool fix_fields(THD *thd, Item **ref);
void fix_after_pullout(st_select_lex *new_parent, Item **ref);
void cleanup();
- void split_sum_func(THD *thd, Item **ref_pointer_array, List<Item> &fields);
+ void split_sum_func(THD *thd, Item **ref_pointer_array, List<Item> &fields,
+ uint flags);
table_map used_tables() const { return used_tables_cache; };
bool const_item() const { return const_item_cache; };
enum Item_result result_type() const { return ROW_RESULT; }
@@ -94,7 +96,7 @@ public:
return true;
return (this->*processor)(arg);
}
- Item *transform(Item_transformer transformer, uchar *arg);
+ Item *transform(THD *thd, Item_transformer transformer, uchar *arg);
bool eval_not_null_tables(uchar *opt_arg);
uint cols() { return arg_count; }
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 4bf8dd5ae1b..ef2e96e8234 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -284,10 +284,14 @@ String *Item_func_sha2::val_str_ascii(String *str)
#endif
default:
if (!args[1]->const_item())
- push_warning_printf(current_thd,
+ {
+ THD *thd= current_thd;
+ push_warning_printf(thd,
Sql_condition::WARN_LEVEL_WARN,
ER_WRONG_PARAMETERS_TO_NATIVE_FCT,
- ER(ER_WRONG_PARAMETERS_TO_NATIVE_FCT), "sha2");
+ ER_THD(thd, ER_WRONG_PARAMETERS_TO_NATIVE_FCT),
+ "sha2");
+ }
null_value= TRUE;
return NULL;
}
@@ -308,11 +312,12 @@ String *Item_func_sha2::val_str_ascii(String *str)
return str;
#else
- push_warning_printf(current_thd,
- Sql_condition::WARN_LEVEL_WARN,
- ER_FEATURE_DISABLED,
- ER(ER_FEATURE_DISABLED),
- "sha2", "--with-ssl");
+ THD *thd= current_thd;
+ push_warning_printf(thd,
+ Sql_condition::WARN_LEVEL_WARN,
+ ER_FEATURE_DISABLED,
+ ER_THD(thd, ER_FEATURE_DISABLED),
+ "sha2", "--with-ssl");
null_value= TRUE;
return (String *) NULL;
#endif /* defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) */
@@ -346,21 +351,24 @@ void Item_func_sha2::fix_length_and_dec()
break;
#endif
default:
- push_warning_printf(current_thd,
- Sql_condition::WARN_LEVEL_WARN,
- ER_WRONG_PARAMETERS_TO_NATIVE_FCT,
- ER(ER_WRONG_PARAMETERS_TO_NATIVE_FCT), "sha2");
+ THD *thd= current_thd;
+ push_warning_printf(thd,
+ Sql_condition::WARN_LEVEL_WARN,
+ ER_WRONG_PARAMETERS_TO_NATIVE_FCT,
+ ER_THD(thd, ER_WRONG_PARAMETERS_TO_NATIVE_FCT),
+ "sha2");
}
CHARSET_INFO *cs= get_checksum_charset(args[0]->collation.collation->csname);
args[0]->collation.set(cs, DERIVATION_COERCIBLE);
#else
- push_warning_printf(current_thd,
- Sql_condition::WARN_LEVEL_WARN,
- ER_FEATURE_DISABLED,
- ER(ER_FEATURE_DISABLED),
- "sha2", "--with-ssl");
+ THD *thd= current_thd;
+ push_warning_printf(thd,
+ Sql_condition::WARN_LEVEL_WARN,
+ ER_FEATURE_DISABLED,
+ ER_THD(thd, ER_FEATURE_DISABLED),
+ "sha2", "--with-ssl");
#endif /* defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) */
}
@@ -394,16 +402,16 @@ String *Item_aes_crypt::val_str(String *str)
if (sptr && user_key) // we need both arguments to be not NULL
{
null_value=0;
- aes_length=my_aes_get_size(sptr->length()); // Calculate result length
+ aes_length=my_aes_get_size(MY_AES_ECB, sptr->length());
if (!str_value.alloc(aes_length)) // Ensure that memory is free
{
uchar rkey[AES_KEY_LENGTH / 8];
create_key(user_key, rkey);
- if (!crypt((uchar*)sptr->ptr(), sptr->length(),
+ if (!my_aes_crypt(MY_AES_ECB, what, (uchar*)sptr->ptr(), sptr->length(),
(uchar*)str_value.ptr(), &aes_length,
- rkey, AES_KEY_LENGTH / 8, 0, 0, 0))
+ rkey, AES_KEY_LENGTH / 8, 0, 0))
{
str_value.length((uint) aes_length);
return &str_value;
@@ -416,16 +424,16 @@ String *Item_aes_crypt::val_str(String *str)
void Item_func_aes_encrypt::fix_length_and_dec()
{
- max_length=my_aes_get_size(args[0]->max_length);
- crypt= my_aes_encrypt_ecb;
+ max_length=my_aes_get_size(MY_AES_ECB, args[0]->max_length);
+ what= ENCRYPTION_FLAG_ENCRYPT;
}
void Item_func_aes_decrypt::fix_length_and_dec()
{
- max_length=args[0]->max_length;
- maybe_null= 1;
- crypt= my_aes_decrypt_ecb;
+ max_length=args[0]->max_length;
+ maybe_null= 1;
+ what= ENCRYPTION_FLAG_DECRYPT;
}
@@ -462,10 +470,12 @@ String *Item_func_to_base64::val_str_ascii(String *str)
null_value= 1; // NULL input, too long input, or OOM.
if (too_long)
{
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ THD *thd= current_thd;
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
- ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name(),
- current_thd->variables.max_allowed_packet);
+ ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED),
+ func_name(),
+ thd->variables.max_allowed_packet);
}
return 0;
}
@@ -505,10 +515,12 @@ String *Item_func_from_base64::val_str(String *str)
((uint) (length= base64_needed_decoded_length((int) res->length())) >
current_thd->variables.max_allowed_packet))
{
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ THD *thd= current_thd;
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
- ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name(),
- current_thd->variables.max_allowed_packet);
+ ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED),
+ func_name(),
+ thd->variables.max_allowed_packet);
goto err;
}
@@ -519,8 +531,9 @@ String *Item_func_from_base64::val_str(String *str)
(char *) tmp_value.ptr(), &end_ptr, 0)) < 0 ||
end_ptr < res->ptr() + res->length())
{
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_BAD_BASE64_DATA, ER(ER_BAD_BASE64_DATA),
+ THD *thd= current_thd;
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_BAD_BASE64_DATA, ER_THD(thd, ER_BAD_BASE64_DATA),
end_ptr - res->ptr());
goto err;
}
@@ -650,10 +663,12 @@ String *Item_func_concat::val_str(String *str)
if (res->length()+res2->length() >
current_thd->variables.max_allowed_packet)
{
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ THD *thd= current_thd;
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
- ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name(),
- current_thd->variables.max_allowed_packet);
+ ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED),
+ func_name(),
+ thd->variables.max_allowed_packet);
goto null;
}
if (!is_const && res->alloced_length() >= res->length()+res2->length())
@@ -856,12 +871,14 @@ String *Item_func_des_encrypt::val_str(String *str)
return &tmp_value;
error:
- push_warning_printf(current_thd,Sql_condition::WARN_LEVEL_WARN,
- code, ER(code),
- "des_encrypt");
+ THD *thd= current_thd;
+ push_warning_printf(thd,Sql_condition::WARN_LEVEL_WARN,
+ code, ER_THD(thd, code),
+ "des_encrypt");
#else
- push_warning_printf(current_thd,Sql_condition::WARN_LEVEL_WARN,
- ER_FEATURE_DISABLED, ER(ER_FEATURE_DISABLED),
+ THD *thd= current_thd;
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_FEATURE_DISABLED, ER_THD(thd, ER_FEATURE_DISABLED),
"des_encrypt", "--with-ssl");
#endif /* defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) */
null_value=1;
@@ -934,14 +951,20 @@ String *Item_func_des_decrypt::val_str(String *str)
return &tmp_value;
error:
- push_warning_printf(current_thd,Sql_condition::WARN_LEVEL_WARN,
- code, ER(code),
- "des_decrypt");
+ {
+ THD *thd= current_thd;
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ code, ER_THD(thd, code),
+ "des_decrypt");
+ }
wrong_key:
#else
- push_warning_printf(current_thd,Sql_condition::WARN_LEVEL_WARN,
- ER_FEATURE_DISABLED, ER(ER_FEATURE_DISABLED),
- "des_decrypt", "--with-ssl");
+ {
+ THD *thd= current_thd;
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_FEATURE_DISABLED, ER_THD(thd, ER_FEATURE_DISABLED),
+ "des_decrypt", "--with-ssl");
+ }
#endif /* defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) */
null_value=1;
return 0;
@@ -961,6 +984,7 @@ String *Item_func_concat_ws::val_str(String *str)
*sep_str, *res, *res2,*use_as_buff;
uint i;
bool is_const= 0;
+ THD *thd= 0;
null_value=0;
if (!(sep_str= args[0]->val_str(&tmp_sep_str)))
@@ -987,13 +1011,16 @@ String *Item_func_concat_ws::val_str(String *str)
if (!(res2= args[i]->val_str(use_as_buff)))
continue; // Skip NULL
+ if (!thd)
+ thd= current_thd;
if (res->length() + sep_str->length() + res2->length() >
- current_thd->variables.max_allowed_packet)
+ thd->variables.max_allowed_packet)
{
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
- ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name(),
- current_thd->variables.max_allowed_packet);
+ ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED),
+ func_name(),
+ thd->variables.max_allowed_packet);
goto null;
}
if (!is_const && res->alloced_length() >=
@@ -1193,6 +1220,7 @@ String *Item_func_replace::val_str(String *str)
register uint32 l;
bool binary_cmp;
#endif
+ THD *thd= 0;
null_value=0;
res=args[0]->val_str(str);
@@ -1240,49 +1268,56 @@ redo:
end= strend ? strend - from_length + 1 : NULL;
while (ptr < end)
{
- if (*ptr == *search)
+ if (*ptr == *search)
+ {
+ register char *i,*j;
+ i=(char*) ptr+1; j=(char*) search+1;
+ while (j != search_end)
+ if (*i++ != *j++) goto skip;
+ offset= (int) (ptr-res->ptr());
+
+ if (!thd)
+ thd= current_thd;
+
+ if (res->length()-from_length + to_length >
+ thd->variables.max_allowed_packet)
{
- register char *i,*j;
- i=(char*) ptr+1; j=(char*) search+1;
- while (j != search_end)
- if (*i++ != *j++) goto skip;
- offset= (int) (ptr-res->ptr());
- if (res->length()-from_length + to_length >
- current_thd->variables.max_allowed_packet)
- {
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_WARN_ALLOWED_PACKET_OVERFLOWED,
- ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
- func_name(),
- current_thd->variables.max_allowed_packet);
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WARN_ALLOWED_PACKET_OVERFLOWED,
+ ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED),
+ func_name(),
+ thd->variables.max_allowed_packet);
- goto null;
- }
- if (!alloced)
- {
- alloced=1;
- res=copy_if_not_alloced(str,res,res->length()+to_length);
- }
- res->replace((uint) offset,from_length,*res3);
- offset+=(int) to_length;
- goto redo;
+ goto null;
}
-skip:
- if ((l=my_ismbchar(res->charset(), ptr,strend))) ptr+=l;
- else ++ptr;
+ if (!alloced)
+ {
+ alloced=1;
+ res=copy_if_not_alloced(str,res,res->length()+to_length);
+ }
+ res->replace((uint) offset,from_length,*res3);
+ offset+=(int) to_length;
+ goto redo;
+ }
+ skip:
+ if ((l=my_ismbchar(res->charset(), ptr,strend))) ptr+=l;
+ else ++ptr;
}
}
else
#endif /* USE_MB */
+ {
+ thd= current_thd;
do
{
if (res->length()-from_length + to_length >
- current_thd->variables.max_allowed_packet)
+ thd->variables.max_allowed_packet)
{
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
- ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name(),
- current_thd->variables.max_allowed_packet);
+ ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED),
+ func_name(),
+ thd->variables.max_allowed_packet);
goto null;
}
if (!alloced)
@@ -1294,6 +1329,7 @@ skip:
offset+=(int) to_length;
}
while ((offset=res->strstr(*res2,(uint) offset)) >= 0);
+ }
return res;
null:
@@ -1547,14 +1583,17 @@ String *Item_func_insert::val_str(String *str)
if (length > res->length() - start)
length= res->length() - start;
- if ((ulonglong) (res->length() - length + res2->length()) >
- (ulonglong) current_thd->variables.max_allowed_packet)
{
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_WARN_ALLOWED_PACKET_OVERFLOWED,
- ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
- func_name(), current_thd->variables.max_allowed_packet);
- goto null;
+ THD *thd= current_thd;
+ if ((ulonglong) (res->length() - length + res2->length()) >
+ (ulonglong) thd->variables.max_allowed_packet)
+ {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WARN_ALLOWED_PACKET_OVERFLOWED,
+ ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED),
+ func_name(), thd->variables.max_allowed_packet);
+ goto null;
+ }
}
res=copy_if_not_alloced(str,res,res->length());
res->replace((uint32) start,(uint32) length,*res2);
@@ -2575,9 +2614,10 @@ MY_LOCALE *Item_func_format::get_locale(Item *item)
if (!locale_name ||
!(lc= my_locale_by_name(locale_name->c_ptr_safe())))
{
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ THD *thd= current_thd;
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_UNKNOWN_LOCALE,
- ER(ER_UNKNOWN_LOCALE),
+ ER_THD(thd, ER_UNKNOWN_LOCALE),
locale_name ? locale_name->c_ptr_safe() : "NULL");
lc= &my_locale_en_US;
}
@@ -2962,14 +3002,18 @@ String *Item_func_repeat::val_str(String *str)
if (count == 1) // To avoid reallocs
return res;
length=res->length();
+
// Safe length check
- if (length > current_thd->variables.max_allowed_packet / (uint) count)
{
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_WARN_ALLOWED_PACKET_OVERFLOWED,
- ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
- func_name(), current_thd->variables.max_allowed_packet);
- goto err;
+ THD *thd= current_thd;
+ if (length > thd->variables.max_allowed_packet / (uint) count)
+ {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WARN_ALLOWED_PACKET_OVERFLOWED,
+ ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED),
+ func_name(), thd->variables.max_allowed_packet);
+ goto err;
+ }
}
tot_length= length*(uint) count;
if (!(res= alloc_buffer(res,str,&tmp_value,tot_length)))
@@ -3035,16 +3079,18 @@ String *Item_func_space::val_str(String *str)
// Safe length check
tot_length= (uint) count * cs->mbminlen;
- if (tot_length > current_thd->variables.max_allowed_packet)
{
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_WARN_ALLOWED_PACKET_OVERFLOWED,
- ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
- func_name(),
- current_thd->variables.max_allowed_packet);
- goto err;
- }
-
+ THD *thd= current_thd;
+ if (tot_length > thd->variables.max_allowed_packet)
+ {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WARN_ALLOWED_PACKET_OVERFLOWED,
+ ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED),
+ func_name(),
+ thd->variables.max_allowed_packet);
+ goto err;
+ }
+ }
if (str->alloc(tot_length))
goto err;
str->length(tot_length);
@@ -3165,13 +3211,16 @@ String *Item_func_rpad::val_str(String *str)
pad_char_length= rpad->numchars();
byte_count= count * collation.collation->mbmaxlen;
- if ((ulonglong) byte_count > current_thd->variables.max_allowed_packet)
{
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_WARN_ALLOWED_PACKET_OVERFLOWED,
- ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
- func_name(), current_thd->variables.max_allowed_packet);
- goto err;
+ THD *thd= current_thd;
+ if ((ulonglong) byte_count > thd->variables.max_allowed_packet)
+ {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WARN_ALLOWED_PACKET_OVERFLOWED,
+ ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED),
+ func_name(), thd->variables.max_allowed_packet);
+ goto err;
+ }
}
if (args[2]->null_value || !pad_char_length)
goto err;
@@ -3273,13 +3322,16 @@ String *Item_func_lpad::val_str(String *str)
pad_char_length= pad->numchars();
byte_count= count * collation.collation->mbmaxlen;
- if ((ulonglong) byte_count > current_thd->variables.max_allowed_packet)
{
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_WARN_ALLOWED_PACKET_OVERFLOWED,
- ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
- func_name(), current_thd->variables.max_allowed_packet);
- goto err;
+ THD *thd= current_thd;
+ if ((ulonglong) byte_count > thd->variables.max_allowed_packet)
+ {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WARN_ALLOWED_PACKET_OVERFLOWED,
+ ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED),
+ func_name(), thd->variables.max_allowed_packet);
+ goto err;
+ }
}
if (args[2]->null_value || !pad_char_length ||
@@ -3550,15 +3602,18 @@ String *Item_func_weight_string::val_str(String *str)
tmp_length= cs->coll->strnxfrmlen(cs, char_length * cs->mbmaxlen);
}
- if(tmp_length > current_thd->variables.max_allowed_packet)
{
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_WARN_ALLOWED_PACKET_OVERFLOWED,
- ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name(),
- current_thd->variables.max_allowed_packet);
- goto nl;
+ THD *thd= current_thd;
+ if (tmp_length > current_thd->variables.max_allowed_packet)
+ {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WARN_ALLOWED_PACKET_OVERFLOWED,
+ ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED),
+ func_name(),
+ thd->variables.max_allowed_packet);
+ goto nl;
+ }
}
-
if (tmp_value.alloc(tmp_length))
goto nl;
@@ -3744,13 +3799,17 @@ String *Item_load_file::val_str(String *str)
/* my_error(ER_TEXTFILE_NOT_READABLE, MYF(0), file_name->c_ptr()); */
goto err;
}
- if (stat_info.st_size > (long) current_thd->variables.max_allowed_packet)
+
{
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_WARN_ALLOWED_PACKET_OVERFLOWED,
- ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
- func_name(), current_thd->variables.max_allowed_packet);
- goto err;
+ THD *thd= current_thd;
+ if (stat_info.st_size > (long) thd->variables.max_allowed_packet)
+ {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WARN_ALLOWED_PACKET_OVERFLOWED,
+ ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED),
+ func_name(), thd->variables.max_allowed_packet);
+ goto err;
+ }
}
if (tmp_value.alloc((size_t)stat_info.st_size))
goto err;
@@ -3829,7 +3888,8 @@ String* Item_func_export_set::val_str(String* str)
}
null_value= false;
- const ulong max_allowed_packet= current_thd->variables.max_allowed_packet;
+ THD *thd= current_thd;
+ const ulong max_allowed_packet= thd->variables.max_allowed_packet;
const uint num_separators= num_set_values > 0 ? num_set_values - 1 : 0;
const ulonglong max_total_length=
num_set_values * MY_MAX(yes->length(), no->length()) +
@@ -3837,9 +3897,9 @@ String* Item_func_export_set::val_str(String* str)
if (unlikely(max_total_length > max_allowed_packet))
{
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
- ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
+ ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED),
func_name(), max_allowed_packet);
null_value= true;
return NULL;
@@ -4043,9 +4103,10 @@ longlong Item_func_uncompressed_length::val_int()
*/
if (res->length() <= 4)
{
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ THD *thd= current_thd;
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_ZLIB_Z_DATA_ERROR,
- ER(ER_ZLIB_Z_DATA_ERROR));
+ ER_THD(thd, ER_ZLIB_Z_DATA_ERROR));
null_value= 1;
return 0;
}
@@ -4119,8 +4180,10 @@ String *Item_func_compress::val_str(String *str)
if ((err= my_compress_buffer(body, &new_size, (const uchar *)res->ptr(),
res->length())) != Z_OK)
{
+ THD *thd= current_thd;
code= err==Z_MEM_ERROR ? ER_ZLIB_Z_MEM_ERROR : ER_ZLIB_Z_BUF_ERROR;
- push_warning(current_thd,Sql_condition::WARN_LEVEL_WARN,code,ER(code));
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, code,
+ ER_THD(thd, code));
null_value= 1;
return 0;
}
@@ -4158,9 +4221,10 @@ String *Item_func_uncompress::val_str(String *str)
/* If length is less than 4 bytes, data is corrupt */
if (res->length() <= 4)
{
- push_warning_printf(current_thd,Sql_condition::WARN_LEVEL_WARN,
+ THD *thd= current_thd;
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_ZLIB_Z_DATA_ERROR,
- ER(ER_ZLIB_Z_DATA_ERROR));
+ ER_THD(thd, ER_ZLIB_Z_DATA_ERROR));
goto err;
}
@@ -4168,10 +4232,11 @@ String *Item_func_uncompress::val_str(String *str)
new_size= uint4korr(res->ptr()) & 0x3FFFFFFF;
if (new_size > current_thd->variables.max_allowed_packet)
{
- push_warning_printf(current_thd,Sql_condition::WARN_LEVEL_WARN,
+ THD *thd= current_thd;
+ push_warning_printf(thd,Sql_condition::WARN_LEVEL_WARN,
ER_TOO_BIG_FOR_UNCOMPRESS,
- ER(ER_TOO_BIG_FOR_UNCOMPRESS),
- static_cast<int>(current_thd->variables.
+ ER_THD(thd, ER_TOO_BIG_FOR_UNCOMPRESS),
+ static_cast<int>(thd->variables.
max_allowed_packet));
goto err;
}
@@ -4187,7 +4252,10 @@ String *Item_func_uncompress::val_str(String *str)
code= ((err == Z_BUF_ERROR) ? ER_ZLIB_Z_BUF_ERROR :
((err == Z_MEM_ERROR) ? ER_ZLIB_Z_MEM_ERROR : ER_ZLIB_Z_DATA_ERROR));
- push_warning(current_thd,Sql_condition::WARN_LEVEL_WARN,code,ER(code));
+ {
+ THD *thd= current_thd;
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, code, ER_THD(thd, code));
+ }
err:
null_value= 1;
@@ -4211,9 +4279,9 @@ String *Item_func_uuid::val_str(String *str)
}
-Item_func_dyncol_create::Item_func_dyncol_create(List<Item> &args,
- DYNCALL_CREATE_DEF *dfs)
- : Item_str_func(args), defs(dfs), vals(0), keys_num(NULL), keys_str(NULL),
+Item_func_dyncol_create::Item_func_dyncol_create(THD *thd, List<Item> &args,
+ DYNCALL_CREATE_DEF *dfs):
+ Item_str_func(thd, args), defs(dfs), vals(0), keys_num(NULL), keys_str(NULL),
names(FALSE), force_names(FALSE)
{
DBUG_ASSERT((args.elements & 0x1) == 0); // even number of arguments
@@ -4515,8 +4583,7 @@ String *Item_func_dyncol_create::val_str(String *str)
char *ptr;
size_t length, alloc_length;
dynstr_reassociate(&col, &ptr, &length, &alloc_length);
- str_value.reassociate(ptr, (uint32) length, (uint32) alloc_length,
- &my_charset_bin);
+ str_value.reset(ptr, length, alloc_length, &my_charset_bin);
res= &str_value;
null_value= FALSE;
}
@@ -4608,8 +4675,7 @@ String *Item_func_dyncol_json::val_str(String *str)
char *ptr;
size_t length, alloc_length;
dynstr_reassociate(&json, &ptr, &length, &alloc_length);
- str->reassociate(ptr, (uint32) length, (uint32) alloc_length,
- &my_charset_utf8_general_ci);
+ str->reset(ptr, length, alloc_length, &my_charset_utf8_general_ci);
null_value= FALSE;
}
return str;
@@ -4657,8 +4723,7 @@ String *Item_func_dyncol_add::val_str(String *str)
char *ptr;
size_t length, alloc_length;
dynstr_reassociate(&col, &ptr, &length, &alloc_length);
- str->reassociate(ptr, (uint32) length, (uint32) alloc_length,
- &my_charset_bin);
+ str->reset(ptr, length, alloc_length, &my_charset_bin);
null_value= FALSE;
}
@@ -4877,11 +4942,12 @@ longlong Item_dyncol_get::val_int()
num= double_to_longlong(val.x.double_value, unsigned_flag, &error);
if (error)
{
+ THD *thd= current_thd;
char buff[30];
sprintf(buff, "%lg", val.x.double_value);
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_DATA_OVERFLOW,
- ER(ER_DATA_OVERFLOW),
+ ER_THD(thd, ER_DATA_OVERFLOW),
buff,
unsigned_flag ? "UNSIGNED INT" : "INT");
}
@@ -4896,12 +4962,13 @@ longlong Item_dyncol_get::val_int()
num= my_strtoll10(val.x.string.value.str, &end, &error);
if (end != org_end || error > 0)
{
+ THD *thd= current_thd;
char buff[80];
strmake(buff, val.x.string.value.str, MY_MIN(sizeof(buff)-1,
val.x.string.value.length));
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_BAD_DATA,
- ER(ER_BAD_DATA),
+ ER_THD(thd, ER_BAD_DATA),
buff,
unsigned_flag ? "UNSIGNED INT" : "INT");
}
@@ -4960,12 +5027,13 @@ double Item_dyncol_get::val_real()
if (end != (char*) val.x.string.value.str + val.x.string.value.length ||
error)
{
+ THD *thd= current_thd;
char buff[80];
strmake(buff, val.x.string.value.str, MY_MIN(sizeof(buff)-1,
val.x.string.value.length));
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_BAD_DATA,
- ER(ER_BAD_DATA),
+ ER_THD(thd, ER_BAD_DATA),
buff, "DOUBLE");
}
return res;
@@ -5013,17 +5081,20 @@ my_decimal *Item_dyncol_get::val_decimal(my_decimal *decimal_value)
break;
case DYN_COL_STRING:
{
+ const char *end;
int rc;
rc= str2my_decimal(0, val.x.string.value.str, val.x.string.value.length,
- val.x.string.charset, decimal_value);
+ val.x.string.charset, decimal_value, &end);
char buff[80];
strmake(buff, val.x.string.value.str, MY_MIN(sizeof(buff)-1,
val.x.string.value.length));
- if (rc != E_DEC_OK)
+ if (rc != E_DEC_OK ||
+ end != val.x.string.value.str + val.x.string.value.length)
{
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ THD *thd= current_thd;
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_BAD_DATA,
- ER(ER_BAD_DATA),
+ ER_THD(thd, ER_BAD_DATA),
buff, "DECIMAL");
}
break;
@@ -5106,6 +5177,16 @@ null:
void Item_dyncol_get::print(String *str, enum_query_type query_type)
{
+ /*
+ Parent cast doesn't exist yet, only print dynamic column name. This happens
+ when called from create_func_cast() / wrong_precision_error().
+ */
+ if (!str->length())
+ {
+ args[1]->print(str, query_type);
+ return;
+ }
+
/* see create_func_dyncol_get */
DBUG_ASSERT(str->length() >= 5);
DBUG_ASSERT(strncmp(str->ptr() + str->length() - 5, "cast(", 5) == 0);
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index ca1f3966da2..d1abbe198b1 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -49,13 +49,18 @@ protected:
return &str_value;
}
public:
- Item_str_func() :Item_func() { decimals=NOT_FIXED_DEC; }
- Item_str_func(Item *a) :Item_func(a) {decimals=NOT_FIXED_DEC; }
- Item_str_func(Item *a,Item *b) :Item_func(a,b) { decimals=NOT_FIXED_DEC; }
- Item_str_func(Item *a,Item *b,Item *c) :Item_func(a,b,c) { decimals=NOT_FIXED_DEC; }
- Item_str_func(Item *a,Item *b,Item *c,Item *d) :Item_func(a,b,c,d) {decimals=NOT_FIXED_DEC; }
- Item_str_func(Item *a,Item *b,Item *c,Item *d, Item* e) :Item_func(a,b,c,d,e) {decimals=NOT_FIXED_DEC; }
- Item_str_func(List<Item> &list) :Item_func(list) {decimals=NOT_FIXED_DEC; }
+ Item_str_func(THD *thd): Item_func(thd) { decimals=NOT_FIXED_DEC; }
+ Item_str_func(THD *thd, Item *a): Item_func(thd, a) {decimals=NOT_FIXED_DEC; }
+ Item_str_func(THD *thd, Item *a, Item *b):
+ Item_func(thd, a, b) { decimals=NOT_FIXED_DEC; }
+ Item_str_func(THD *thd, Item *a, Item *b, Item *c):
+ Item_func(thd, a, b, c) { decimals=NOT_FIXED_DEC; }
+ Item_str_func(THD *thd, Item *a, Item *b, Item *c, Item *d):
+ Item_func(thd, a, b, c, d) { decimals=NOT_FIXED_DEC; }
+ Item_str_func(THD *thd, Item *a, Item *b, Item *c, Item *d, Item* e):
+ Item_func(thd, a, b, c, d, e) { decimals=NOT_FIXED_DEC; }
+ Item_str_func(THD *thd, List<Item> &list):
+ Item_func(thd, list) { decimals=NOT_FIXED_DEC; }
longlong val_int();
double val_real();
my_decimal *val_decimal(my_decimal *);
@@ -73,10 +78,11 @@ class Item_str_ascii_func :public Item_str_func
{
String ascii_buf;
public:
- Item_str_ascii_func() :Item_str_func() {}
- Item_str_ascii_func(Item *a) :Item_str_func(a) {}
- Item_str_ascii_func(Item *a,Item *b) :Item_str_func(a,b) {}
- Item_str_ascii_func(Item *a,Item *b,Item *c) :Item_str_func(a,b,c) {}
+ Item_str_ascii_func(THD *thd): Item_str_func(thd) {}
+ Item_str_ascii_func(THD *thd, Item *a): Item_str_func(thd, a) {}
+ Item_str_ascii_func(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
+ Item_str_ascii_func(THD *thd, Item *a, Item *b, Item *c):
+ Item_str_func(thd, a, b, c) {}
String *val_str(String *str)
{
return val_str_from_val_str_ascii(str, &ascii_buf);
@@ -89,7 +95,7 @@ class Item_func_md5 :public Item_str_ascii_func
{
String tmp_value;
public:
- Item_func_md5(Item *a) :Item_str_ascii_func(a) {}
+ Item_func_md5(THD *thd, Item *a): Item_str_ascii_func(thd, a) {}
String *val_str_ascii(String *);
void fix_length_and_dec();
const char *func_name() const { return "md5"; }
@@ -99,7 +105,7 @@ public:
class Item_func_sha :public Item_str_ascii_func
{
public:
- Item_func_sha(Item *a) :Item_str_ascii_func(a) {}
+ Item_func_sha(THD *thd, Item *a): Item_str_ascii_func(thd, a) {}
String *val_str_ascii(String *);
void fix_length_and_dec();
const char *func_name() const { return "sha"; }
@@ -108,7 +114,7 @@ public:
class Item_func_sha2 :public Item_str_ascii_func
{
public:
- Item_func_sha2(Item *a, Item *b) :Item_str_ascii_func(a, b) {}
+ Item_func_sha2(THD *thd, Item *a, Item *b): Item_str_ascii_func(thd, a, b) {}
String *val_str_ascii(String *);
void fix_length_and_dec();
const char *func_name() const { return "sha2"; }
@@ -118,7 +124,7 @@ class Item_func_to_base64 :public Item_str_ascii_func
{
String tmp_value;
public:
- Item_func_to_base64(Item *a) :Item_str_ascii_func(a) {}
+ Item_func_to_base64(THD *thd, Item *a): Item_str_ascii_func(thd, a) {}
String *val_str_ascii(String *);
void fix_length_and_dec();
const char *func_name() const { return "to_base64"; }
@@ -128,7 +134,7 @@ class Item_func_from_base64 :public Item_str_func
{
String tmp_value;
public:
- Item_func_from_base64(Item *a) :Item_str_func(a) {}
+ Item_func_from_base64(THD *thd, Item *a): Item_str_func(thd, a) {}
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "from_base64"; }
@@ -142,19 +148,17 @@ class Item_aes_crypt :public Item_str_func
void create_key(String *user_key, uchar* key);
protected:
- int (*crypt)(const uchar* src, uint slen, uchar* dst, uint* dlen,
- const uchar* key, uint klen, const uchar* iv, uint ivlen,
- int no_padding);
-
+ int what;
public:
- Item_aes_crypt(Item *a, Item *b) :Item_str_func(a,b) {}
+ Item_aes_crypt(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
String *val_str(String *);
};
class Item_func_aes_encrypt :public Item_aes_crypt
{
public:
- Item_func_aes_encrypt(Item *a, Item *b) :Item_aes_crypt(a,b) {}
+ Item_func_aes_encrypt(THD *thd, Item *a, Item *b):
+ Item_aes_crypt(thd, a, b) {}
void fix_length_and_dec();
const char *func_name() const { return "aes_encrypt"; }
};
@@ -162,7 +166,8 @@ public:
class Item_func_aes_decrypt :public Item_aes_crypt
{
public:
- Item_func_aes_decrypt(Item *a, Item *b) :Item_aes_crypt(a,b) {}
+ Item_func_aes_decrypt(THD *thd, Item *a, Item *b):
+ Item_aes_crypt(thd, a, b) {}
void fix_length_and_dec();
const char *func_name() const { return "aes_decrypt"; }
};
@@ -172,8 +177,8 @@ class Item_func_concat :public Item_str_func
{
String tmp_value;
public:
- Item_func_concat(List<Item> &list) :Item_str_func(list) {}
- Item_func_concat(Item *a,Item *b) :Item_str_func(a,b) {}
+ Item_func_concat(THD *thd, List<Item> &list): Item_str_func(thd, list) {}
+ Item_func_concat(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "concat"; }
@@ -183,8 +188,8 @@ class Item_func_decode_histogram :public Item_str_func
{
String tmp_value;
public:
- Item_func_decode_histogram(Item *a, Item *b)
- :Item_str_func(a, b) {}
+ Item_func_decode_histogram(THD *thd, Item *a, Item *b):
+ Item_str_func(thd, a, b) {}
String *val_str(String *);
void fix_length_and_dec()
{
@@ -199,7 +204,7 @@ class Item_func_concat_ws :public Item_str_func
{
String tmp_value;
public:
- Item_func_concat_ws(List<Item> &list) :Item_str_func(list) {}
+ Item_func_concat_ws(THD *thd, List<Item> &list): Item_str_func(thd, list) {}
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "concat_ws"; }
@@ -210,7 +215,7 @@ class Item_func_reverse :public Item_str_func
{
String tmp_value;
public:
- Item_func_reverse(Item *a) :Item_str_func(a) {}
+ Item_func_reverse(THD *thd, Item *a): Item_str_func(thd, a) {}
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "reverse"; }
@@ -221,8 +226,8 @@ class Item_func_replace :public Item_str_func
{
String tmp_value,tmp_value2;
public:
- Item_func_replace(Item *org,Item *find,Item *replace)
- :Item_str_func(org,find,replace) {}
+ Item_func_replace(THD *thd, Item *org, Item *find, Item *replace):
+ Item_str_func(thd, org, find, replace) {}
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "replace"; }
@@ -236,8 +241,8 @@ class Item_func_regexp_replace :public Item_str_func
const LEX_CSTRING *source,
const LEX_CSTRING *replace);
public:
- Item_func_regexp_replace(Item *a, Item *b, Item *c)
- :Item_str_func(a, b, c)
+ Item_func_regexp_replace(THD *thd, Item *a, Item *b, Item *c):
+ Item_str_func(thd, a, b, c)
{}
void cleanup()
{
@@ -256,8 +261,8 @@ class Item_func_regexp_substr :public Item_str_func
{
Regexp_processor_pcre re;
public:
- Item_func_regexp_substr(Item *a, Item *b)
- :Item_str_func(a, b)
+ Item_func_regexp_substr(THD *thd, Item *a, Item *b):
+ Item_str_func(thd, a, b)
{}
void cleanup()
{
@@ -276,8 +281,9 @@ class Item_func_insert :public Item_str_func
{
String tmp_value;
public:
- Item_func_insert(Item *org,Item *start,Item *length,Item *new_str)
- :Item_str_func(org,start,length,new_str) {}
+ Item_func_insert(THD *thd, Item *org, Item *start, Item *length,
+ Item *new_str):
+ Item_str_func(thd, org, start, length, new_str) {}
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "insert"; }
@@ -291,7 +297,7 @@ protected:
my_charset_conv_case converter;
String tmp_value;
public:
- Item_str_conv(Item *item) :Item_str_func(item) {}
+ Item_str_conv(THD *thd, Item *item): Item_str_func(thd, item) {}
String *val_str(String *);
};
@@ -299,7 +305,7 @@ public:
class Item_func_lcase :public Item_str_conv
{
public:
- Item_func_lcase(Item *item) :Item_str_conv(item) {}
+ Item_func_lcase(THD *thd, Item *item): Item_str_conv(thd, item) {}
const char *func_name() const { return "lcase"; }
void fix_length_and_dec();
};
@@ -307,7 +313,7 @@ public:
class Item_func_ucase :public Item_str_conv
{
public:
- Item_func_ucase(Item *item) :Item_str_conv(item) {}
+ Item_func_ucase(THD *thd, Item *item): Item_str_conv(thd, item) {}
const char *func_name() const { return "ucase"; }
void fix_length_and_dec();
};
@@ -317,7 +323,7 @@ class Item_func_left :public Item_str_func
{
String tmp_value;
public:
- Item_func_left(Item *a,Item *b) :Item_str_func(a,b) {}
+ Item_func_left(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "left"; }
@@ -328,7 +334,7 @@ class Item_func_right :public Item_str_func
{
String tmp_value;
public:
- Item_func_right(Item *a,Item *b) :Item_str_func(a,b) {}
+ Item_func_right(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "right"; }
@@ -339,8 +345,8 @@ class Item_func_substr :public Item_str_func
{
String tmp_value;
public:
- Item_func_substr(Item *a,Item *b) :Item_str_func(a,b) {}
- Item_func_substr(Item *a,Item *b,Item *c) :Item_str_func(a,b,c) {}
+ Item_func_substr(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
+ Item_func_substr(THD *thd, Item *a, Item *b, Item *c): Item_str_func(thd, a, b, c) {}
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "substr"; }
@@ -351,7 +357,8 @@ class Item_func_substr_index :public Item_str_func
{
String tmp_value;
public:
- Item_func_substr_index(Item *a,Item *b,Item *c) :Item_str_func(a,b,c) {}
+ Item_func_substr_index(THD *thd, Item *a,Item *b,Item *c):
+ Item_str_func(thd, a, b, c) {}
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "substring_index"; }
@@ -379,8 +386,8 @@ protected:
return trimmed_value(res, 0, res->length());
}
public:
- Item_func_trim(Item *a,Item *b) :Item_str_func(a,b) {}
- Item_func_trim(Item *a) :Item_str_func(a) {}
+ Item_func_trim(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
+ Item_func_trim(THD *thd, Item *a): Item_str_func(thd, a) {}
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "trim"; }
@@ -392,8 +399,8 @@ public:
class Item_func_ltrim :public Item_func_trim
{
public:
- Item_func_ltrim(Item *a,Item *b) :Item_func_trim(a,b) {}
- Item_func_ltrim(Item *a) :Item_func_trim(a) {}
+ Item_func_ltrim(THD *thd, Item *a, Item *b): Item_func_trim(thd, a, b) {}
+ Item_func_ltrim(THD *thd, Item *a): Item_func_trim(thd, a) {}
String *val_str(String *);
const char *func_name() const { return "ltrim"; }
const char *mode_name() const { return "leading"; }
@@ -403,8 +410,8 @@ public:
class Item_func_rtrim :public Item_func_trim
{
public:
- Item_func_rtrim(Item *a,Item *b) :Item_func_trim(a,b) {}
- Item_func_rtrim(Item *a) :Item_func_trim(a) {}
+ Item_func_rtrim(THD *thd, Item *a, Item *b): Item_func_trim(thd, a, b) {}
+ Item_func_rtrim(THD *thd, Item *a): Item_func_trim(thd, a) {}
String *val_str(String *);
const char *func_name() const { return "rtrim"; }
const char *mode_name() const { return "trailing"; }
@@ -428,9 +435,10 @@ private:
enum PW_Alg alg;
bool deflt;
public:
- Item_func_password(Item *a) :Item_str_ascii_func(a), alg(NEW), deflt(1) {}
- Item_func_password(Item *a, PW_Alg al) :Item_str_ascii_func(a),
- alg(al), deflt(0) {}
+ Item_func_password(THD *thd, Item *a):
+ Item_str_ascii_func(thd, a), alg(NEW), deflt(1) {}
+ Item_func_password(THD *thd, Item *a, PW_Alg al):
+ Item_str_ascii_func(thd, a), alg(al), deflt(0) {}
String *val_str_ascii(String *str);
bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec()
@@ -452,8 +460,8 @@ class Item_func_des_encrypt :public Item_str_func
{
String tmp_value,tmp_arg;
public:
- Item_func_des_encrypt(Item *a) :Item_str_func(a) {}
- Item_func_des_encrypt(Item *a, Item *b): Item_str_func(a,b) {}
+ Item_func_des_encrypt(THD *thd, Item *a): Item_str_func(thd, a) {}
+ Item_func_des_encrypt(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
String *val_str(String *);
void fix_length_and_dec()
{
@@ -468,8 +476,8 @@ class Item_func_des_decrypt :public Item_str_func
{
String tmp_value;
public:
- Item_func_des_decrypt(Item *a) :Item_str_func(a) {}
- Item_func_des_decrypt(Item *a, Item *b): Item_str_func(a,b) {}
+ Item_func_des_decrypt(THD *thd, Item *a): Item_str_func(thd, a) {}
+ Item_func_des_decrypt(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
String *val_str(String *);
void fix_length_and_dec()
{
@@ -492,11 +500,11 @@ class Item_func_encrypt :public Item_str_func
collation.set(&my_charset_bin);
}
public:
- Item_func_encrypt(Item *a) :Item_str_func(a)
+ Item_func_encrypt(THD *thd, Item *a): Item_str_func(thd, a)
{
constructor_helper();
}
- Item_func_encrypt(Item *a, Item *b): Item_str_func(a,b)
+ Item_func_encrypt(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b)
{
constructor_helper();
}
@@ -520,8 +528,8 @@ private:
protected:
SQL_CRYPT sql_crypt;
public:
- Item_func_encode(Item *a, Item *seed):
- Item_str_func(a, seed) {}
+ Item_func_encode(THD *thd, Item *a, Item *seed_arg):
+ Item_str_func(thd, a, seed_arg) {}
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "encode"; }
@@ -536,7 +544,7 @@ private:
class Item_func_decode :public Item_func_encode
{
public:
- Item_func_decode(Item *a, Item *seed): Item_func_encode(a, seed) {}
+ Item_func_decode(THD *thd, Item *a, Item *seed_arg): Item_func_encode(thd, a, seed_arg) {}
const char *func_name() const { return "decode"; }
protected:
void crypto_transform(String *);
@@ -546,11 +554,11 @@ protected:
class Item_func_sysconst :public Item_str_func
{
public:
- Item_func_sysconst()
+ Item_func_sysconst(THD *thd): Item_str_func(thd)
{ collation.set(system_charset_info,DERIVATION_SYSCONST); }
- Item *safe_charset_converter(CHARSET_INFO *tocs)
+ Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
{
- return const_charset_converter(tocs, true, fully_qualified_func_name());
+ return const_charset_converter(thd, tocs, true, fully_qualified_func_name());
}
/*
Used to create correct Item name in new converted item in
@@ -569,7 +577,7 @@ public:
class Item_func_database :public Item_func_sysconst
{
public:
- Item_func_database() :Item_func_sysconst() {}
+ Item_func_database(THD *thd): Item_func_sysconst(thd) {}
String *val_str(String *);
void fix_length_and_dec()
{
@@ -587,7 +595,7 @@ protected:
bool init (const char *user, const char *host);
public:
- Item_func_user()
+ Item_func_user(THD *thd): Item_func_sysconst(thd)
{
str_value.set("", 0, system_charset_info);
}
@@ -616,8 +624,8 @@ class Item_func_current_user :public Item_func_user
Name_resolution_context *context;
public:
- Item_func_current_user(Name_resolution_context *context_arg)
- : context(context_arg) {}
+ Item_func_current_user(THD *thd, Name_resolution_context *context_arg):
+ Item_func_user(thd), context(context_arg) {}
bool fix_fields(THD *thd, Item **ref);
const char *func_name() const { return "current_user"; }
const char *fully_qualified_func_name() const { return "current_user()"; }
@@ -629,8 +637,8 @@ class Item_func_current_role :public Item_func_sysconst
Name_resolution_context *context;
public:
- Item_func_current_role(Name_resolution_context *context_arg)
- : context(context_arg) {}
+ Item_func_current_role(THD *thd, Name_resolution_context *context_arg):
+ Item_func_sysconst(thd), context(context_arg) {}
bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec()
{ max_length= username_char_length * SYSTEM_CHARSET_MBMAXLEN; }
@@ -650,7 +658,7 @@ class Item_func_soundex :public Item_str_func
{
String tmp_value;
public:
- Item_func_soundex(Item *a) :Item_str_func(a) {}
+ Item_func_soundex(THD *thd, Item *a): Item_str_func(thd, a) {}
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "soundex"; }
@@ -660,7 +668,7 @@ public:
class Item_func_elt :public Item_str_func
{
public:
- Item_func_elt(List<Item> &list) :Item_str_func(list) {}
+ Item_func_elt(THD *thd, List<Item> &list): Item_str_func(thd, list) {}
double val_real();
longlong val_int();
String *val_str(String *str);
@@ -674,7 +682,7 @@ class Item_func_make_set :public Item_str_func
String tmp_str;
public:
- Item_func_make_set(List<Item> &list) :Item_str_func(list) {}
+ Item_func_make_set(THD *thd, List<Item> &list): Item_str_func(thd, list) {}
String *val_str(String *str);
void fix_length_and_dec();
const char *func_name() const { return "make_set"; }
@@ -686,10 +694,11 @@ class Item_func_format :public Item_str_ascii_func
String tmp_str;
MY_LOCALE *locale;
public:
- Item_func_format(Item *org, Item *dec): Item_str_ascii_func(org, dec) {}
- Item_func_format(Item *org, Item *dec, Item *lang):
- Item_str_ascii_func(org, dec, lang) {}
-
+ Item_func_format(THD *thd, Item *org, Item *dec):
+ Item_str_ascii_func(thd, org, dec) {}
+ Item_func_format(THD *thd, Item *org, Item *dec, Item *lang):
+ Item_str_ascii_func(thd, org, dec, lang) {}
+
MY_LOCALE *get_locale(Item *item);
String *val_str_ascii(String *);
void fix_length_and_dec();
@@ -701,10 +710,11 @@ public:
class Item_func_char :public Item_str_func
{
public:
- Item_func_char(List<Item> &list) :Item_str_func(list)
+ Item_func_char(THD *thd, List<Item> &list): Item_str_func(thd, list)
{ collation.set(&my_charset_bin); }
- Item_func_char(List<Item> &list, CHARSET_INFO *cs) :Item_str_func(list)
- { collation.set(cs); }
+ Item_func_char(THD *thd, List<Item> &list, CHARSET_INFO *cs):
+ Item_str_func(thd, list)
+ { collation.set(cs); }
String *val_str(String *);
void fix_length_and_dec()
{
@@ -718,7 +728,8 @@ class Item_func_repeat :public Item_str_func
{
String tmp_value;
public:
- Item_func_repeat(Item *arg1,Item *arg2) :Item_str_func(arg1,arg2) {}
+ Item_func_repeat(THD *thd, Item *arg1, Item *arg2):
+ Item_str_func(thd, arg1, arg2) {}
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "repeat"; }
@@ -728,7 +739,7 @@ public:
class Item_func_space :public Item_str_func
{
public:
- Item_func_space(Item *arg1):Item_str_func(arg1) {}
+ Item_func_space(THD *thd, Item *arg1): Item_str_func(thd, arg1) {}
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "space"; }
@@ -739,7 +750,8 @@ class Item_func_binlog_gtid_pos :public Item_str_func
{
String tmp_value;
public:
- Item_func_binlog_gtid_pos(Item *arg1,Item *arg2) :Item_str_func(arg1,arg2) {}
+ Item_func_binlog_gtid_pos(THD *thd, Item *arg1, Item *arg2):
+ Item_str_func(thd, arg1, arg2) {}
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "binlog_gtid_pos"; }
@@ -750,8 +762,8 @@ class Item_func_rpad :public Item_str_func
{
String tmp_value, rpad_str;
public:
- Item_func_rpad(Item *arg1,Item *arg2,Item *arg3)
- :Item_str_func(arg1,arg2,arg3) {}
+ Item_func_rpad(THD *thd, Item *arg1, Item *arg2, Item *arg3):
+ Item_str_func(thd, arg1, arg2, arg3) {}
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "rpad"; }
@@ -762,8 +774,8 @@ class Item_func_lpad :public Item_str_func
{
String tmp_value, lpad_str;
public:
- Item_func_lpad(Item *arg1,Item *arg2,Item *arg3)
- :Item_str_func(arg1,arg2,arg3) {}
+ Item_func_lpad(THD *thd, Item *arg1, Item *arg2, Item *arg3):
+ Item_str_func(thd, arg1, arg2, arg3) {}
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "lpad"; }
@@ -773,7 +785,8 @@ public:
class Item_func_conv :public Item_str_func
{
public:
- Item_func_conv(Item *a,Item *b,Item *c) :Item_str_func(a,b,c) {}
+ Item_func_conv(THD *thd, Item *a, Item *b, Item *c):
+ Item_str_func(thd, a, b, c) {}
const char *func_name() const { return "conv"; }
String *val_str(String *);
void fix_length_and_dec()
@@ -789,7 +802,8 @@ class Item_func_hex :public Item_str_ascii_func
{
String tmp_value;
public:
- Item_func_hex(Item *a) :Item_str_ascii_func(a) {}
+ Item_func_hex(THD *thd, Item *a):
+ Item_str_ascii_func(thd, a) {}
const char *func_name() const { return "hex"; }
String *val_str_ascii(String *);
void fix_length_and_dec()
@@ -804,10 +818,10 @@ class Item_func_unhex :public Item_str_func
{
String tmp_value;
public:
- Item_func_unhex(Item *a) :Item_str_func(a)
- {
+ Item_func_unhex(THD *thd, Item *a): Item_str_func(thd, a)
+ {
/* there can be bad hex strings */
- maybe_null= 1;
+ maybe_null= 1;
}
const char *func_name() const { return "unhex"; }
String *val_str(String *);
@@ -828,8 +842,8 @@ protected:
String max_str;
const bool is_min;
public:
- Item_func_like_range(Item *a, Item *b, bool is_min_arg)
- :Item_str_func(a, b), is_min(is_min_arg)
+ Item_func_like_range(THD *thd, Item *a, Item *b, bool is_min_arg):
+ Item_str_func(thd, a, b), is_min(is_min_arg)
{ maybe_null= 1; }
String *val_str(String *);
void fix_length_and_dec()
@@ -844,8 +858,8 @@ public:
class Item_func_like_range_min :public Item_func_like_range
{
public:
- Item_func_like_range_min(Item *a, Item *b)
- :Item_func_like_range(a, b, true) { }
+ Item_func_like_range_min(THD *thd, Item *a, Item *b):
+ Item_func_like_range(thd, a, b, true) { }
const char *func_name() const { return "like_range_min"; }
};
@@ -853,8 +867,8 @@ public:
class Item_func_like_range_max :public Item_func_like_range
{
public:
- Item_func_like_range_max(Item *a, Item *b)
- :Item_func_like_range(a, b, false) { }
+ Item_func_like_range_max(THD *thd, Item *a, Item *b):
+ Item_func_like_range(thd, a, b, false) { }
const char *func_name() const { return "like_range_max"; }
};
#endif
@@ -863,7 +877,7 @@ public:
class Item_func_binary :public Item_str_func
{
public:
- Item_func_binary(Item *a) :Item_str_func(a) {}
+ Item_func_binary(THD *thd, Item *a): Item_str_func(thd, a) {}
String *val_str(String *a)
{
DBUG_ASSERT(fixed == 1);
@@ -887,7 +901,7 @@ class Item_load_file :public Item_str_func
{
String tmp_value;
public:
- Item_load_file(Item *a) :Item_str_func(a) {}
+ Item_load_file(THD *thd, Item *a): Item_str_func(thd, a) {}
String *val_str(String *);
const char *func_name() const { return "load_file"; }
void fix_length_and_dec()
@@ -906,9 +920,12 @@ public:
class Item_func_export_set: public Item_str_func
{
public:
- Item_func_export_set(Item *a,Item *b,Item* c) :Item_str_func(a,b,c) {}
- Item_func_export_set(Item *a,Item *b,Item* c,Item* d) :Item_str_func(a,b,c,d) {}
- Item_func_export_set(Item *a,Item *b,Item* c,Item* d,Item* e) :Item_str_func(a,b,c,d,e) {}
+ Item_func_export_set(THD *thd, Item *a, Item *b, Item* c):
+ Item_str_func(thd, a, b, c) {}
+ Item_func_export_set(THD *thd, Item *a, Item *b, Item* c, Item* d):
+ Item_str_func(thd, a, b, c, d) {}
+ Item_func_export_set(THD *thd, Item *a, Item *b, Item* c, Item* d, Item* e):
+ Item_str_func(thd, a, b, c, d, e) {}
String *val_str(String *str);
void fix_length_and_dec();
const char *func_name() const { return "export_set"; }
@@ -919,7 +936,7 @@ class Item_func_quote :public Item_str_func
{
String tmp_value;
public:
- Item_func_quote(Item *a) :Item_str_func(a) {}
+ Item_func_quote(THD *thd, Item *a): Item_str_func(thd, a) {}
const char *func_name() const { return "quote"; }
String *val_str(String *);
void fix_length_and_dec()
@@ -938,10 +955,11 @@ class Item_func_conv_charset :public Item_str_func
public:
bool safe;
CHARSET_INFO *conv_charset; // keep it public
- Item_func_conv_charset(Item *a, CHARSET_INFO *cs) :Item_str_func(a)
+ Item_func_conv_charset(THD *thd, Item *a, CHARSET_INFO *cs):
+ Item_str_func(thd, a)
{ conv_charset= cs; use_cached_value= 0; safe= 0; }
- Item_func_conv_charset(Item *a, CHARSET_INFO *cs, bool cache_if_const)
- :Item_str_func(a)
+ Item_func_conv_charset(THD *thd, Item *a, CHARSET_INFO *cs, bool cache_if_const):
+ Item_str_func(thd, a)
{
conv_charset= cs;
if (cache_if_const && args[0]->const_item() && !args[0]->is_expensive())
@@ -1013,7 +1031,8 @@ public:
class Item_func_set_collation :public Item_str_func
{
public:
- Item_func_set_collation(Item *a, Item *b) :Item_str_func(a,b) {};
+ Item_func_set_collation(THD *thd, Item *a, Item *b):
+ Item_str_func(thd, a, b) {}
String *val_str(String *);
void fix_length_and_dec();
bool eq(const Item *item, bool binary_cmp) const;
@@ -1027,12 +1046,11 @@ public:
}
};
-class Item_func_charset :public Item_str_func
+
+class Item_func_expr_str_metadata :public Item_str_func
{
public:
- Item_func_charset(Item *a) :Item_str_func(a) {}
- String *val_str(String *);
- const char *func_name() const { return "charset"; }
+ Item_func_expr_str_metadata(THD *thd, Item *a): Item_str_func(thd, a) { }
void fix_length_and_dec()
{
collation.set(system_charset_info);
@@ -1040,23 +1058,32 @@ public:
maybe_null= 0;
};
table_map not_null_tables() const { return 0; }
+ Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond)
+ { return this; }
+ bool const_item() const { return true; }
};
-class Item_func_collation :public Item_str_func
+
+class Item_func_charset :public Item_func_expr_str_metadata
{
public:
- Item_func_collation(Item *a) :Item_str_func(a) {}
+ Item_func_charset(THD *thd, Item *a)
+ :Item_func_expr_str_metadata(thd, a) { }
+ String *val_str(String *);
+ const char *func_name() const { return "charset"; }
+};
+
+
+class Item_func_collation :public Item_func_expr_str_metadata
+{
+public:
+ Item_func_collation(THD *thd, Item *a)
+ :Item_func_expr_str_metadata(thd, a) {}
String *val_str(String *);
const char *func_name() const { return "collation"; }
- void fix_length_and_dec()
- {
- collation.set(system_charset_info);
- max_length= 64 * collation.collation->mbmaxlen; // should be enough
- maybe_null= 0;
- };
- table_map not_null_tables() const { return 0; }
};
+
class Item_func_weight_string :public Item_str_func
{
String tmp_value;
@@ -1064,9 +1091,9 @@ class Item_func_weight_string :public Item_str_func
uint nweights;
uint result_length;
public:
- Item_func_weight_string(Item *a, uint result_length_arg,
- uint nweights_arg, uint flags_arg)
- :Item_str_func(a)
+ Item_func_weight_string(THD *thd, Item *a, uint result_length_arg,
+ uint nweights_arg, uint flags_arg):
+ Item_str_func(thd, a)
{
nweights= nweights_arg;
flags= flags_arg;
@@ -1084,13 +1111,16 @@ public:
this->nweights == that->nweights &&
this->result_length == that->result_length;
}
+ Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond)
+ { return this; }
};
class Item_func_crc32 :public Item_int_func
{
String value;
public:
- Item_func_crc32(Item *a) :Item_int_func(a) { unsigned_flag= 1; }
+ Item_func_crc32(THD *thd, Item *a): Item_int_func(thd, a)
+ { unsigned_flag= 1; }
const char *func_name() const { return "crc32"; }
void fix_length_and_dec() { max_length=10; }
longlong val_int();
@@ -1100,7 +1130,7 @@ class Item_func_uncompressed_length : public Item_int_func
{
String value;
public:
- Item_func_uncompressed_length(Item *a):Item_int_func(a){}
+ Item_func_uncompressed_length(THD *thd, Item *a): Item_int_func(thd, a) {}
const char *func_name() const{return "uncompressed_length";}
void fix_length_and_dec() { max_length=10; maybe_null= true; }
longlong val_int();
@@ -1116,7 +1146,7 @@ class Item_func_compress: public Item_str_func
{
String buffer;
public:
- Item_func_compress(Item *a):Item_str_func(a){}
+ Item_func_compress(THD *thd, Item *a): Item_str_func(thd, a) {}
void fix_length_and_dec(){max_length= (args[0]->max_length*120)/100+12;}
const char *func_name() const{return "compress";}
String *val_str(String *) ZLIB_DEPENDED_FUNCTION
@@ -1126,7 +1156,7 @@ class Item_func_uncompress: public Item_str_func
{
String buffer;
public:
- Item_func_uncompress(Item *a): Item_str_func(a){}
+ Item_func_uncompress(THD *thd, Item *a): Item_str_func(thd, a) {}
void fix_length_and_dec(){ maybe_null= 1; max_length= MAX_BLOB_WIDTH; }
const char *func_name() const{return "uncompress";}
String *val_str(String *) ZLIB_DEPENDED_FUNCTION
@@ -1136,7 +1166,7 @@ public:
class Item_func_uuid: public Item_str_func
{
public:
- Item_func_uuid(): Item_str_func() {}
+ Item_func_uuid(THD *thd): Item_str_func(thd) {}
void fix_length_and_dec()
{
collation.set(system_charset_info,
@@ -1163,7 +1193,7 @@ protected:
bool prepare_arguments(bool force_names);
void print_arguments(String *str, enum_query_type query_type);
public:
- Item_func_dyncol_create(List<Item> &args, DYNCALL_CREATE_DEF *dfs);
+ Item_func_dyncol_create(THD *thd, List<Item> &args, DYNCALL_CREATE_DEF *dfs);
bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec();
const char *func_name() const{ return "column_create"; }
@@ -1176,8 +1206,8 @@ public:
class Item_func_dyncol_add: public Item_func_dyncol_create
{
public:
- Item_func_dyncol_add(List<Item> &args, DYNCALL_CREATE_DEF *dfs)
- :Item_func_dyncol_create(args, dfs)
+ Item_func_dyncol_add(THD *thd, List<Item> &args_arg, DYNCALL_CREATE_DEF *dfs):
+ Item_func_dyncol_create(thd, args_arg, dfs)
{}
const char *func_name() const{ return "column_add"; }
String *val_str(String *);
@@ -1187,7 +1217,7 @@ public:
class Item_func_dyncol_json: public Item_str_func
{
public:
- Item_func_dyncol_json(Item *str) :Item_str_func(str) {}
+ Item_func_dyncol_json(THD *thd, Item *str): Item_str_func(thd, str) {}
const char *func_name() const{ return "column_json"; }
String *val_str(String *);
void fix_length_and_dec()
@@ -1206,8 +1236,7 @@ public:
class Item_dyncol_get: public Item_str_func
{
public:
- Item_dyncol_get(Item *str, Item *num)
- :Item_str_func(str, num)
+ Item_dyncol_get(THD *thd, Item *str, Item *num): Item_str_func(thd, str, num)
{}
void fix_length_and_dec()
{ maybe_null= 1;; max_length= MAX_BLOB_WIDTH; }
@@ -1228,7 +1257,7 @@ public:
class Item_func_dyncol_list: public Item_str_func
{
public:
- Item_func_dyncol_list(Item *str) :Item_str_func(str) {};
+ Item_func_dyncol_list(THD *thd, Item *str): Item_str_func(thd, str) {};
void fix_length_and_dec() { maybe_null= 1; max_length= MAX_BLOB_WIDTH; };
const char *func_name() const{ return "column_list"; }
String *val_str(String *);
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index fa398dc6e21..227d84dd213 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -48,9 +48,9 @@ const char *exists_outer_expr_name= "<exists outer expr>";
int check_and_do_in_subquery_rewrites(JOIN *join);
-Item_subselect::Item_subselect():
- Item_result_field(), Used_tables_and_const_cache(),
- value_assigned(0), own_engine(0), thd(0), old_engine(0),
+Item_subselect::Item_subselect(THD *thd_arg):
+ Item_result_field(thd_arg), Used_tables_and_const_cache(),
+ value_assigned(0), own_engine(0), thd(0), old_engine(0),
have_to_be_excluded(0),
inside_first_fix_fields(0), done_first_fix_fields(FALSE),
expr_cache(0), forced_const(FALSE), substitution(0), engine(0), eliminated(FALSE),
@@ -478,6 +478,7 @@ void Item_subselect::recalc_used_tables(st_select_lex *new_parent,
{
List_iterator_fast<Ref_to_outside> it(upper_refs);
Ref_to_outside *upper;
+ DBUG_ENTER("recalc_used_tables");
used_tables_cache= 0;
while ((upper= it++))
@@ -537,6 +538,8 @@ void Item_subselect::recalc_used_tables(st_select_lex *new_parent,
he has done const table detection, and that will be our chance to update
const_tables_cache.
*/
+ DBUG_PRINT("exit", ("used_tables_cache: %llx", used_tables_cache));
+ DBUG_VOID_RETURN;
}
@@ -875,7 +878,7 @@ bool Item_subselect::const_item() const
Item *Item_subselect::get_tmp_table_item(THD *thd_arg)
{
if (!with_sum_func && !const_item())
- return new Item_field(result_field);
+ return new (thd->mem_root) Item_field(thd_arg, result_field);
return copy_or_same(thd_arg);
}
@@ -896,7 +899,7 @@ void Item_subselect::update_used_tables()
void Item_subselect::print(String *str, enum_query_type query_type)
{
- if (query_type == QT_EXPLAIN)
+ if (query_type & QT_ITEM_SUBSELECT_ID_ONLY)
{
str->append("(subquery#");
if (unit && unit->first_select())
@@ -922,12 +925,11 @@ void Item_subselect::print(String *str, enum_query_type query_type)
}
-Item_singlerow_subselect::Item_singlerow_subselect(THD *thd_arg, st_select_lex *select_lex)
- :Item_subselect(), value(0)
+Item_singlerow_subselect::Item_singlerow_subselect(THD *thd, st_select_lex *select_lex):
+ Item_subselect(thd), value(0)
{
DBUG_ENTER("Item_singlerow_subselect::Item_singlerow_subselect");
- init(select_lex, new (thd_arg->mem_root) select_singlerow_subselect(thd_arg,
- this));
+ init(select_lex, new (thd->mem_root) select_singlerow_subselect(thd, this));
maybe_null= 1;
max_columns= UINT_MAX;
DBUG_VOID_RETURN;
@@ -953,16 +955,16 @@ Item_singlerow_subselect::invalidate_and_restore_select_lex()
DBUG_RETURN(result);
}
-Item_maxmin_subselect::Item_maxmin_subselect(THD *thd_param,
+Item_maxmin_subselect::Item_maxmin_subselect(THD *thd,
Item_subselect *parent,
st_select_lex *select_lex,
- bool max_arg)
- :Item_singlerow_subselect(), was_values(TRUE)
+ bool max_arg):
+ Item_singlerow_subselect(thd), was_values(TRUE)
{
DBUG_ENTER("Item_maxmin_subselect::Item_maxmin_subselect");
max= max_arg;
init(select_lex,
- new (thd_param->mem_root) select_max_min_finder_subselect(thd_param,
+ new (thd->mem_root) select_max_min_finder_subselect(thd,
this, max_arg, parent->substype() == Item_subselect::ALL_SUBS));
max_columns= 1;
maybe_null= 1;
@@ -975,12 +977,6 @@ Item_maxmin_subselect::Item_maxmin_subselect(THD *thd_param,
used_tables_cache= parent->get_used_tables_cache();
const_item_cache= parent->const_item();
- /*
- this subquery always creates during preparation, so we can assign
- thd here
- */
- thd= thd_param;
-
DBUG_VOID_RETURN;
}
@@ -1020,7 +1016,7 @@ void Item_maxmin_subselect::no_rows_in_result()
*/
if (parsing_place != SELECT_LIST || const_item())
return;
- value= Item_cache::get_cache(new Item_null());
+ value= Item_cache::get_cache(thd, new (thd->mem_root) Item_null(thd));
null_value= 0;
was_values= 0;
make_const();
@@ -1038,7 +1034,7 @@ void Item_singlerow_subselect::no_rows_in_result()
*/
if (parsing_place != SELECT_LIST || const_item())
return;
- value= Item_cache::get_cache(new Item_null());
+ value= Item_cache::get_cache(thd, new (thd->mem_root) Item_null(thd));
reset();
make_const();
}
@@ -1105,7 +1101,8 @@ Item_singlerow_subselect::select_transformer(JOIN *join)
if (thd->lex->describe)
{
char warn_buff[MYSQL_ERRMSG_SIZE];
- sprintf(warn_buff, ER(ER_SELECT_REDUCED), select_lex->select_number);
+ sprintf(warn_buff, ER_THD(thd, ER_SELECT_REDUCED),
+ select_lex->select_number);
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_SELECT_REDUCED, warn_buff);
}
@@ -1191,17 +1188,22 @@ void Item_singlerow_subselect::fix_length_and_dec()
this item - otherwise
*/
-Item* Item_singlerow_subselect::expr_cache_insert_transformer(uchar *thd_arg)
+Item* Item_singlerow_subselect::expr_cache_insert_transformer(THD *tmp_thd,
+ uchar *unused)
{
- THD *thd= (THD*) thd_arg;
DBUG_ENTER("Item_singlerow_subselect::expr_cache_insert_transformer");
+ DBUG_ASSERT(thd == tmp_thd);
+
if (expr_cache)
DBUG_RETURN(expr_cache);
- if (expr_cache_is_needed(thd) &&
- (expr_cache= set_expr_cache(thd)))
+ if (expr_cache_is_needed(tmp_thd) &&
+ (expr_cache= set_expr_cache(tmp_thd)))
+ {
+ init_expr_cache_tracker(tmp_thd);
DBUG_RETURN(expr_cache);
+ }
DBUG_RETURN(this);
}
@@ -1345,13 +1347,13 @@ bool Item_singlerow_subselect::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
}
-Item_exists_subselect::Item_exists_subselect(THD *thd_arg,
+Item_exists_subselect::Item_exists_subselect(THD *thd,
st_select_lex *select_lex):
- Item_subselect(), upper_not(NULL), abort_on_null(0),
+ Item_subselect(thd), upper_not(NULL), abort_on_null(0),
emb_on_expr_nest(NULL), optimizer(0), exists_transformed(0)
{
DBUG_ENTER("Item_exists_subselect::Item_exists_subselect");
- init(select_lex, new (thd_arg->mem_root) select_exists_subselect(thd_arg, this));
+ init(select_lex, new (thd->mem_root) select_exists_subselect(thd, this));
max_columns= UINT_MAX;
null_value= FALSE; //can't be NULL
maybe_null= 0; //can't be NULL
@@ -1382,9 +1384,9 @@ bool Item_in_subselect::test_limit(st_select_lex_unit *unit_arg)
return(0);
}
-Item_in_subselect::Item_in_subselect(THD *thd_arg, Item * left_exp,
+Item_in_subselect::Item_in_subselect(THD *thd, Item * left_exp,
st_select_lex *select_lex):
- Item_exists_subselect(), left_expr_cache(0), first_execution(TRUE),
+ Item_exists_subselect(thd), left_expr_cache(0), first_execution(TRUE),
in_strategy(SUBS_NOT_TRANSFORMED),
pushed_cond_guards(NULL), is_jtbm_merged(FALSE), is_jtbm_const_tab(FALSE),
is_flattenable_semijoin(FALSE), is_registered_semijoin(FALSE),
@@ -1394,8 +1396,7 @@ Item_in_subselect::Item_in_subselect(THD *thd_arg, Item * left_exp,
DBUG_PRINT("info", ("in_strategy: %u", (uint)in_strategy));
left_expr= left_exp;
func= &eq_creator;
- init(select_lex, new (thd_arg->mem_root) select_exists_subselect(thd_arg,
- this));
+ init(select_lex, new (thd->mem_root) select_exists_subselect(thd, this));
max_columns= UINT_MAX;
maybe_null= 1;
reset();
@@ -1409,17 +1410,16 @@ int Item_in_subselect::get_identifier()
return engine->get_identifier();
}
-Item_allany_subselect::Item_allany_subselect(THD *thd_arg, Item * left_exp,
+Item_allany_subselect::Item_allany_subselect(THD *thd, Item * left_exp,
chooser_compare_func_creator fc,
st_select_lex *select_lex,
- bool all_arg)
- :Item_in_subselect(), func_creator(fc), all(all_arg)
+ bool all_arg):
+ Item_in_subselect(thd), func_creator(fc), all(all_arg)
{
DBUG_ENTER("Item_allany_subselect::Item_allany_subselect");
left_expr= left_exp;
func= func_creator(all_arg);
- init(select_lex, new (thd_arg->mem_root) select_exists_subselect(thd_arg,
- this));
+ init(select_lex, new (thd->mem_root) select_exists_subselect(thd, this));
max_columns= 1;
abort_on_null= 0;
reset();
@@ -1451,7 +1451,7 @@ void Item_exists_subselect::fix_length_and_dec()
an IN always requires LIMIT 1)
*/
thd->change_item_tree(&unit->global_parameters()->select_limit,
- new Item_int((int32) 1));
+ new (thd->mem_root) Item_int(thd, (int32) 1));
DBUG_PRINT("info", ("Set limit to 1"));
DBUG_VOID_RETURN;
}
@@ -1487,17 +1487,21 @@ void Item_in_subselect::fix_length_and_dec()
this item - otherwise
*/
-Item* Item_exists_subselect::expr_cache_insert_transformer(uchar *thd_arg)
+Item* Item_exists_subselect::expr_cache_insert_transformer(THD *tmp_thd,
+ uchar *unused)
{
- THD *thd= (THD*) thd_arg;
DBUG_ENTER("Item_exists_subselect::expr_cache_insert_transformer");
+ DBUG_ASSERT(thd == tmp_thd);
if (expr_cache)
DBUG_RETURN(expr_cache);
- if (substype() == EXISTS_SUBS && expr_cache_is_needed(thd) &&
- (expr_cache= set_expr_cache(thd)))
+ if (substype() == EXISTS_SUBS && expr_cache_is_needed(tmp_thd) &&
+ (expr_cache= set_expr_cache(tmp_thd)))
+ {
+ init_expr_cache_tracker(tmp_thd);
DBUG_RETURN(expr_cache);
+ }
DBUG_RETURN(this);
}
@@ -1779,12 +1783,13 @@ Item_in_subselect::single_value_transformer(JOIN *join)
of the statement. Thus one of 'substitution' arguments
can be broken in case of PS.
*/
- substitution= func->create(thd->mem_root, left_expr, where_item);
+ substitution= func->create(thd, left_expr, where_item);
have_to_be_excluded= 1;
if (thd->lex->describe)
{
char warn_buff[MYSQL_ERRMSG_SIZE];
- sprintf(warn_buff, ER(ER_SELECT_REDUCED), select_lex->select_number);
+ sprintf(warn_buff, ER_THD(thd, ER_SELECT_REDUCED),
+ select_lex->select_number);
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_SELECT_REDUCED, warn_buff);
}
@@ -1817,7 +1822,7 @@ Item_in_subselect::single_value_transformer(JOIN *join)
As far as Item_in_optimizer does not substitute itself on fix_fields
we can use same item for all selects.
*/
- expr= new Item_direct_ref(&select_lex->context,
+ expr= new (thd->mem_root) Item_direct_ref(thd, &select_lex->context,
(Item**)optimizer->get_cache(),
(char *)"<no matter>",
(char *)in_left_expr_name);
@@ -1855,7 +1860,6 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join)
if (!test_strategy(SUBS_MAXMIN_INJECTED | SUBS_MAXMIN_ENGINE))
DBUG_RETURN(false);
Item **place= optimizer->arguments() + 1;
- THD *thd= join->thd;
SELECT_LEX *select_lex= join->select_lex;
Item *subs;
@@ -1886,7 +1890,7 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join)
(ALL && (> || =>)) || (ANY && (< || =<))
for ALL condition is inverted
*/
- item= new Item_sum_max(*select_lex->ref_pointer_array);
+ item= new (thd->mem_root) Item_sum_max(thd, *select_lex->ref_pointer_array);
}
else
{
@@ -1894,7 +1898,7 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join)
(ALL && (< || =<)) || (ANY && (> || =>))
for ALL condition is inverted
*/
- item= new Item_sum_min(*select_lex->ref_pointer_array);
+ item= new (thd->mem_root) Item_sum_min(thd, *select_lex->ref_pointer_array);
}
if (upper_item)
upper_item->set_sum_test(item);
@@ -1935,7 +1939,7 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join)
else
{
Item_maxmin_subselect *item;
- subs= item= new Item_maxmin_subselect(thd, this, select_lex, func->l_op());
+ subs= item= new (thd->mem_root) Item_maxmin_subselect(thd, this, select_lex, func->l_op());
if (upper_item)
upper_item->set_sub_test(item);
/*
@@ -1948,7 +1952,7 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join)
The swap is needed for expressions of type 'f1 < ALL ( SELECT ....)'
where we want to evaluate the sub query even if f1 would be null.
*/
- subs= func->create_swap(thd->mem_root, *(optimizer->get_cache()), subs);
+ subs= func->create_swap(thd, *(optimizer->get_cache()), subs);
thd->change_item_tree(place, subs);
if (subs->fix_fields(thd, &subs))
DBUG_RETURN(true);
@@ -2021,7 +2025,7 @@ bool Item_allany_subselect::is_maxmin_applicable(JOIN *join)
*/
bool
-Item_in_subselect::create_single_in_to_exists_cond(JOIN * join,
+Item_in_subselect::create_single_in_to_exists_cond(JOIN *join,
Item **where_item,
Item **having_item)
{
@@ -2031,7 +2035,6 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN * join,
during JOIN::optimize: this->tmp_having= this->having; this->having= 0;
*/
Item* join_having= join->having ? join->having : join->tmp_having;
-
DBUG_ENTER("Item_in_subselect::create_single_in_to_exists_cond");
*where_item= NULL;
@@ -2040,8 +2043,9 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN * join,
if (join_having || select_lex->with_sum_func ||
select_lex->group_list.elements)
{
- Item *item= func->create(thd->mem_root, expr,
+ Item *item= func->create(thd, expr,
new (thd->mem_root) Item_ref_null_helper(
+ thd,
&select_lex->context,
this,
select_lex->
@@ -2054,7 +2058,7 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN * join,
We can encounter "NULL IN (SELECT ...)". Wrap the added condition
within a trig_cond.
*/
- item= new Item_func_trig_cond(item, get_cond_guard(0));
+ item= new (thd->mem_root) Item_func_trig_cond(thd, item, get_cond_guard(0));
}
if (!join_having)
@@ -2072,13 +2076,13 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN * join,
Item *having= item;
Item *orig_item= item;
- item= func->create(thd->mem_root, expr, item);
+ item= func->create(thd, expr, item);
if (!abort_on_null && orig_item->maybe_null)
{
- having= new (thd->mem_root) Item_is_not_null_test(this, having);
+ having= new (thd->mem_root) Item_is_not_null_test(thd, this, having);
if (left_expr->maybe_null)
{
- if (!(having= new (thd->mem_root) Item_func_trig_cond(having,
+ if (!(having= new (thd->mem_root) Item_func_trig_cond(thd, having,
get_cond_guard(0))))
DBUG_RETURN(true);
}
@@ -2087,8 +2091,8 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN * join,
DBUG_RETURN(true);
*having_item= having;
- item= new (thd->mem_root) Item_cond_or(item,
- new (thd->mem_root) Item_func_isnull(orig_item));
+ item= new (thd->mem_root) Item_cond_or(thd, item,
+ new (thd->mem_root) Item_func_isnull(thd, orig_item));
}
/*
If we may encounter NULL IN (SELECT ...) and care whether subquery
@@ -2096,7 +2100,7 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN * join,
*/
if (!abort_on_null && left_expr->maybe_null)
{
- if (!(item= new (thd->mem_root) Item_func_trig_cond(item,
+ if (!(item= new (thd->mem_root) Item_func_trig_cond(thd, item,
get_cond_guard(0))))
DBUG_RETURN(true);
}
@@ -2116,8 +2120,8 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN * join,
if (select_lex->master_unit()->is_union())
{
Item *new_having=
- func->create(thd->mem_root, expr,
- new (thd->mem_root) Item_ref_null_helper(
+ func->create(thd, expr,
+ new (thd->mem_root) Item_ref_null_helper(thd,
&select_lex->context,
this,
select_lex->ref_pointer_array,
@@ -2125,7 +2129,7 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN * join,
(char *)"<result>"));
if (!abort_on_null && left_expr->maybe_null)
{
- if (!(new_having= new (thd->mem_root) Item_func_trig_cond(new_having,
+ if (!(new_having= new (thd->mem_root) Item_func_trig_cond(thd, new_having,
get_cond_guard(0))))
DBUG_RETURN(true);
}
@@ -2298,48 +2302,56 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
check_cols(left_expr->element_index(i)->cols()))
DBUG_RETURN(true);
Item *item_eq=
- new Item_func_eq(new
- Item_direct_ref(&select_lex->context,
- (*optimizer->get_cache())->
- addr(i),
- (char *)"<no matter>",
- (char *)in_left_expr_name),
- new
- Item_ref(&select_lex->context,
- select_lex->ref_pointer_array + i,
+ new (thd->mem_root)
+ Item_func_eq(thd, new (thd->mem_root)
+ Item_direct_ref(thd, &select_lex->context,
+ (*optimizer->get_cache())->
+ addr(i),
+ (char *)"<no matter>",
+ (char *)in_left_expr_name),
+ new (thd->mem_root)
+ Item_ref(thd, &select_lex->context,
+ select_lex->ref_pointer_array + i,
+ (char *)"<no matter>",
+ (char *)"<list ref>"));
+ Item *item_isnull=
+ new (thd->mem_root)
+ Item_func_isnull(thd,
+ new (thd->mem_root)
+ Item_ref(thd, &select_lex->context,
+ select_lex->ref_pointer_array+i,
(char *)"<no matter>",
(char *)"<list ref>"));
- Item *item_isnull=
- new Item_func_isnull(new
- Item_ref(&select_lex->context,
- select_lex->ref_pointer_array+i,
- (char *)"<no matter>",
- (char *)"<list ref>"));
- Item *col_item= new Item_cond_or(item_eq, item_isnull);
+ Item *col_item= new (thd->mem_root)
+ Item_cond_or(thd, item_eq, item_isnull);
if (!abort_on_null && left_expr->element_index(i)->maybe_null)
{
- if (!(col_item= new Item_func_trig_cond(col_item, get_cond_guard(i))))
+ if (!(col_item= new (thd->mem_root)
+ Item_func_trig_cond(thd, col_item, get_cond_guard(i))))
DBUG_RETURN(true);
}
- *having_item= and_items(*having_item, col_item);
+ *having_item= and_items(thd, *having_item, col_item);
Item *item_nnull_test=
- new Item_is_not_null_test(this,
- new Item_ref(&select_lex->context,
- select_lex->
- ref_pointer_array + i,
- (char *)"<no matter>",
- (char *)"<list ref>"));
+ new (thd->mem_root)
+ Item_is_not_null_test(thd, this,
+ new (thd->mem_root)
+ Item_ref(thd, &select_lex->context,
+ select_lex->
+ ref_pointer_array + i,
+ (char *)"<no matter>",
+ (char *)"<list ref>"));
if (!abort_on_null && left_expr->element_index(i)->maybe_null)
{
if (!(item_nnull_test=
- new Item_func_trig_cond(item_nnull_test, get_cond_guard(i))))
+ new (thd->mem_root)
+ Item_func_trig_cond(thd, item_nnull_test, get_cond_guard(i))))
DBUG_RETURN(true);
}
- item_having_part2= and_items(item_having_part2, item_nnull_test);
+ item_having_part2= and_items(thd, item_having_part2, item_nnull_test);
item_having_part2->top_level_item();
}
- *having_item= and_items(*having_item, item_having_part2);
+ *having_item= and_items(thd, *having_item, item_having_part2);
}
else
{
@@ -2354,54 +2366,59 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
if (select_lex->ref_pointer_array[i]->
check_cols(left_expr->element_index(i)->cols()))
DBUG_RETURN(true);
- item=
- new Item_func_eq(new
- Item_direct_ref(&select_lex->context,
- (*optimizer->get_cache())->
- addr(i),
- (char *)"<no matter>",
- (char *)in_left_expr_name),
- new
- Item_direct_ref(&select_lex->context,
- select_lex->
- ref_pointer_array+i,
- (char *)"<no matter>",
- (char *)"<list ref>"));
+ item= new (thd->mem_root)
+ Item_func_eq(thd,
+ new (thd->mem_root)
+ Item_direct_ref(thd, &select_lex->context,
+ (*optimizer->get_cache())->
+ addr(i),
+ (char *)"<no matter>",
+ (char *)in_left_expr_name),
+ new (thd->mem_root)
+ Item_direct_ref(thd, &select_lex->context,
+ select_lex->
+ ref_pointer_array+i,
+ (char *)"<no matter>",
+ (char *)"<list ref>"));
if (!abort_on_null && select_lex->ref_pointer_array[i]->maybe_null)
{
Item *having_col_item=
- new Item_is_not_null_test(this,
- new
- Item_ref(&select_lex->context,
- select_lex->ref_pointer_array + i,
- (char *)"<no matter>",
- (char *)"<list ref>"));
+ new (thd->mem_root)
+ Item_is_not_null_test(thd, this,
+ new (thd->mem_root)
+ Item_ref(thd, &select_lex->context,
+ select_lex->ref_pointer_array + i,
+ (char *)"<no matter>",
+ (char *)"<list ref>"));
- item_isnull= new
- Item_func_isnull(new
- Item_direct_ref(&select_lex->context,
+ item_isnull= new (thd->mem_root)
+ Item_func_isnull(thd,
+ new (thd->mem_root)
+ Item_direct_ref(thd, &select_lex->context,
select_lex->
ref_pointer_array+i,
(char *)"<no matter>",
(char *)"<list ref>"));
- item= new Item_cond_or(item, item_isnull);
+ item= new (thd->mem_root) Item_cond_or(thd, item, item_isnull);
if (left_expr->element_index(i)->maybe_null)
{
- if (!(item= new Item_func_trig_cond(item, get_cond_guard(i))))
+ if (!(item= new (thd->mem_root)
+ Item_func_trig_cond(thd, item, get_cond_guard(i))))
DBUG_RETURN(true);
- if (!(having_col_item=
- new Item_func_trig_cond(having_col_item, get_cond_guard(i))))
+ if (!(having_col_item= new (thd->mem_root)
+ Item_func_trig_cond(thd, having_col_item, get_cond_guard(i))))
DBUG_RETURN(true);
}
- *having_item= and_items(*having_item, having_col_item);
+ *having_item= and_items(thd, *having_item, having_col_item);
}
if (!abort_on_null && left_expr->element_index(i)->maybe_null)
{
- if (!(item= new Item_func_trig_cond(item, get_cond_guard(i))))
+ if (!(item= new (thd->mem_root)
+ Item_func_trig_cond(thd, item, get_cond_guard(i))))
DBUG_RETURN(true);
}
- *where_item= and_items(*where_item, item);
+ *where_item= and_items(thd, *where_item, item);
}
}
@@ -2531,7 +2548,7 @@ bool Item_in_subselect::inject_in_to_exists_cond(JOIN *join_arg)
and_args->disjoin((List<Item> *) &join_arg->cond_equal->current_level);
}
- where_item= and_items(join_arg->conds, where_item);
+ where_item= and_items(thd, join_arg->conds, where_item);
if (!where_item->fixed && where_item->fix_fields(thd, 0))
DBUG_RETURN(true);
// TIMOUR TODO: call optimize_cond() for the new where clause
@@ -2548,7 +2565,7 @@ bool Item_in_subselect::inject_in_to_exists_cond(JOIN *join_arg)
Item_equal *elem;
while ((elem= li++))
{
- and_args->push_back(elem);
+ and_args->push_back(elem, thd->mem_root);
}
}
}
@@ -2556,7 +2573,7 @@ bool Item_in_subselect::inject_in_to_exists_cond(JOIN *join_arg)
if (having_item)
{
Item* join_having= join_arg->having ? join_arg->having:join_arg->tmp_having;
- having_item= and_items(join_having, having_item);
+ having_item= and_items(thd, join_having, having_item);
if (fix_having(having_item, select_lex))
DBUG_RETURN(true);
// TIMOUR TODO: call optimize_cond() for the new having clause
@@ -2565,7 +2582,8 @@ bool Item_in_subselect::inject_in_to_exists_cond(JOIN *join_arg)
join_arg->having= select_lex->having;
}
join_arg->thd->change_item_tree(&unit->global_parameters()->select_limit,
- new Item_int((int32) 1));
+ new (thd->mem_root)
+ Item_int(thd, (int32) 1));
unit->select_limit_cnt= 1;
DBUG_RETURN(false);
@@ -2592,7 +2610,7 @@ bool Item_exists_subselect::select_prepare_to_be_in()
Query_arena *arena, backup;
bool result;
arena= thd->activate_stmt_arena_if_needed(&backup);
- result= (!(optimizer= new Item_in_optimizer(new Item_int(1), this)));
+ result= (!(optimizer= new (thd->mem_root) Item_in_optimizer(thd, new (thd->mem_root) Item_int(thd, 1), this)));
if (arena)
thd->restore_active_arena(arena, &backup);
if (result)
@@ -2805,20 +2823,24 @@ bool Item_exists_subselect::exists2in_processor(uchar *opt_arg)
it.replace(local_field);
else
{
- first_select->item_list.push_back(local_field);
+ first_select->item_list.push_back(local_field, thd->mem_root);
first_select->join->all_fields.elements++;
}
first_select->ref_pointer_array[i]= (Item *)local_field;
/* remove the parts from condition */
if (!upper_not || !local_field->maybe_null)
- *eq_ref= new Item_int(1);
+ *eq_ref= new (thd->mem_root) Item_int(thd, 1);
else
{
- *eq_ref= new Item_func_isnotnull(
- new Item_field(thd,
- ((Item_field*)(local_field->real_item()))->context,
- ((Item_field*)(local_field->real_item()))->field));
+ *eq_ref= new (thd->mem_root)
+ Item_func_isnotnull(thd,
+ new (thd->mem_root)
+ Item_field(thd,
+ ((Item_field*)(local_field->
+ real_item()))->context,
+ ((Item_field*)(local_field->
+ real_item()))->field));
if((*eq_ref)->fix_fields(thd, (Item **)eq_ref))
{
res= TRUE;
@@ -2827,7 +2849,7 @@ bool Item_exists_subselect::exists2in_processor(uchar *opt_arg)
}
outer_exp->fix_after_pullout(unit->outer_select(), &outer_exp);
outer_exp->update_used_tables();
- outer.push_back(outer_exp);
+ outer.push_back(outer_exp, thd->mem_root);
}
}
@@ -2838,7 +2860,7 @@ bool Item_exists_subselect::exists2in_processor(uchar *opt_arg)
left_exp= outer_exp;
else
{
- if (!(left_exp= new Item_row(outer)))
+ if (!(left_exp= new (thd->mem_root) Item_row(thd, outer)))
{
res= TRUE;
goto out;
@@ -2850,7 +2872,7 @@ bool Item_exists_subselect::exists2in_processor(uchar *opt_arg)
first_select->select_limit= NULL;
if (!(in_subs= new (thd->mem_root) Item_in_subselect(thd, left_exp,
- first_select)))
+ first_select)))
{
res= TRUE;
goto out;
@@ -2880,10 +2902,11 @@ bool Item_exists_subselect::exists2in_processor(uchar *opt_arg)
As far as Item_ref_in_optimizer do not substitute itself on fix_fields
we can use same item for all selects.
*/
- in_subs->expr= new Item_direct_ref(&first_select->context,
- (Item**)optimizer->get_cache(),
- (char *)"<no matter>",
- (char *)in_left_expr_name);
+ in_subs->expr= new (thd->mem_root)
+ Item_direct_ref(thd, &first_select->context,
+ (Item**)optimizer->get_cache(),
+ (char *)"<no matter>",
+ (char *)in_left_expr_name);
if (in_subs->fix_fields(thd, optimizer->arguments() + 1))
{
res= TRUE;
@@ -2945,14 +2968,17 @@ bool Item_exists_subselect::exists2in_processor(uchar *opt_arg)
if (eqs.elements() == 1)
{
exp= (optimizer->arguments()[0]->maybe_null ?
- (Item*)
- new Item_cond_and(
- new Item_func_isnotnull(
- new Item_direct_ref(&unit->outer_select()->context,
- optimizer->arguments(),
- (char *)"<no matter>",
- (char *)exists_outer_expr_name)),
- optimizer) :
+ (Item*) new (thd->mem_root)
+ Item_cond_and(thd,
+ new (thd->mem_root)
+ Item_func_isnotnull(thd,
+ new (thd->mem_root)
+ Item_direct_ref(thd,
+ &unit->outer_select()->context,
+ optimizer->arguments(),
+ (char *)"<no matter>",
+ (char *)exists_outer_expr_name)),
+ optimizer) :
(Item *)optimizer);
}
else
@@ -2968,18 +2994,21 @@ bool Item_exists_subselect::exists2in_processor(uchar *opt_arg)
if (optimizer->arguments()[0]->maybe_null)
{
and_list->
- push_front(
- new Item_func_isnotnull(
- new Item_direct_ref(&unit->outer_select()->context,
- optimizer->arguments()[0]->addr(i),
- (char *)"<no matter>",
- (char *)exists_outer_expr_name)));
+ push_front(new (thd->mem_root)
+ Item_func_isnotnull(thd,
+ new (thd->mem_root)
+ Item_direct_ref(thd,
+ &unit->outer_select()->context,
+ optimizer->arguments()[0]->addr(i),
+ (char *)"<no matter>",
+ (char *)exists_outer_expr_name)),
+ thd->mem_root);
}
}
if (and_list->elements > 0)
{
- and_list->push_front(optimizer);
- exp= new Item_cond_and(*and_list);
+ and_list->push_front(optimizer, thd->mem_root);
+ exp= new (thd->mem_root) Item_cond_and(thd, *and_list);
}
else
exp= optimizer;
@@ -3054,7 +3083,7 @@ Item_in_subselect::select_in_like_transformer(JOIN *join)
arena= thd->activate_stmt_arena_if_needed(&backup);
if (!optimizer)
{
- result= (!(optimizer= new Item_in_optimizer(left_expr, this)));
+ result= (!(optimizer= new (thd->mem_root) Item_in_optimizer(thd, left_expr, this)));
if (result)
goto out;
}
@@ -3116,12 +3145,12 @@ void Item_in_subselect::print(String *str, enum_query_type query_type)
Item_subselect::print(str, query_type);
}
-bool Item_exists_subselect::fix_fields(THD *thd_arg, Item **ref)
+bool Item_exists_subselect::fix_fields(THD *thd, Item **ref)
{
DBUG_ENTER("Item_exists_subselect::fix_fields");
if (exists_transformed)
- DBUG_RETURN( !( (*ref)= new Item_int(1)));
- DBUG_RETURN(Item_subselect::fix_fields(thd_arg, ref));
+ DBUG_RETURN( !( (*ref)= new (thd->mem_root) Item_int(thd, 1)));
+ DBUG_RETURN(Item_subselect::fix_fields(thd, ref));
}
@@ -3132,7 +3161,7 @@ bool Item_in_subselect::fix_fields(THD *thd_arg, Item **ref)
DBUG_ENTER("Item_in_subselect::fix_fields");
if (test_strategy(SUBS_SEMI_JOIN))
- DBUG_RETURN( !( (*ref)= new Item_int(1)) );
+ DBUG_RETURN( !( (*ref)= new (thd->mem_root) Item_int(thd, 1)) );
/*
Check if the outer and inner IN operands match in those cases when we
@@ -3283,7 +3312,8 @@ bool Item_in_subselect::init_left_expr_cache()
Cached_item *cur_item_cache= new_Cached_item(thd,
left_expr->element_index(i),
FALSE);
- if (!cur_item_cache || left_expr_cache->push_front(cur_item_cache))
+ if (!cur_item_cache || left_expr_cache->push_front(cur_item_cache,
+ thd->mem_root))
return TRUE;
}
return FALSE;
@@ -3563,9 +3593,9 @@ void subselect_engine::set_row(List<Item> &item_list, Item_cache **row)
item->decimals= sel_item->decimals;
item->unsigned_flag= sel_item->unsigned_flag;
maybe_null= sel_item->maybe_null;
- if (!(row[i]= Item_cache::get_cache(sel_item, sel_item->cmp_type())))
+ if (!(row[i]= Item_cache::get_cache(thd, sel_item, sel_item->cmp_type())))
return;
- row[i]->setup(sel_item);
+ row[i]->setup(thd, sel_item);
//psergey-backport-timours: row[i]->store(sel_item);
}
if (item_list.elements > 1)
@@ -4581,7 +4611,7 @@ subselect_hash_sj_engine::get_strategy_using_data()
void
subselect_hash_sj_engine::choose_partial_match_strategy(
bool has_non_null_key, bool has_covering_null_row,
- MY_BITMAP *partial_match_key_parts)
+ MY_BITMAP *partial_match_key_parts_arg)
{
ulonglong pm_buff_size;
@@ -4632,7 +4662,7 @@ subselect_hash_sj_engine::choose_partial_match_strategy(
{
pm_buff_size= rowid_merge_buff_size(has_non_null_key,
has_covering_null_row,
- partial_match_key_parts);
+ partial_match_key_parts_arg);
if (pm_buff_size > thd->variables.rowid_merge_buff_size)
strategy= PARTIAL_MATCH_SCAN;
}
@@ -4886,7 +4916,7 @@ bool subselect_hash_sj_engine::make_semi_join_conds()
DBUG_ENTER("subselect_hash_sj_engine::make_semi_join_conds");
DBUG_ASSERT(semi_join_conds == NULL);
- if (!(semi_join_conds= new Item_cond_and))
+ if (!(semi_join_conds= new (thd->mem_root) Item_cond_and(thd)))
DBUG_RETURN(TRUE);
if (!(tmp_table_ref= (TABLE_LIST*) thd->alloc(sizeof(TABLE_LIST))))
@@ -4906,14 +4936,17 @@ bool subselect_hash_sj_engine::make_semi_join_conds()
for (uint i= 0; i < item_in->left_expr->cols(); i++)
{
- Item_func_eq *eq_cond; /* New equi-join condition for the current column. */
+ /* New equi-join condition for the current column. */
+ Item_func_eq *eq_cond;
/* Item for the corresponding field from the materialized temp table. */
Item_field *right_col_item;
- if (!(right_col_item= new Item_field(thd, context, tmp_table->field[i])) ||
- !(eq_cond= new Item_func_eq(item_in->left_expr->element_index(i),
- right_col_item)) ||
- (((Item_cond_and*)semi_join_conds)->add(eq_cond)))
+ if (!(right_col_item= new (thd->mem_root)
+ Item_field(thd, context, tmp_table->field[i])) ||
+ !(eq_cond= new (thd->mem_root)
+ Item_func_eq(thd, item_in->left_expr->element_index(i),
+ right_col_item)) ||
+ (((Item_cond_and*)semi_join_conds)->add(eq_cond, thd->mem_root)))
{
delete semi_join_conds;
semi_join_conds= NULL;
@@ -5518,9 +5551,9 @@ bool Ordered_key::init(MY_BITMAP *columns_to_index)
{
if (!bitmap_is_set(columns_to_index, i))
continue;
- cur_tmp_field= new Item_field(tbl->field[i]);
+ cur_tmp_field= new (thd->mem_root) Item_field(thd, tbl->field[i]);
/* Create the predicate (tmp_column[i] < outer_ref[i]). */
- fn_less_than= new Item_func_lt(cur_tmp_field,
+ fn_less_than= new (thd->mem_root) Item_func_lt(thd, cur_tmp_field,
search_key->element_index(i));
fn_less_than->fix_fields(thd, (Item**) &fn_less_than);
key_columns[cur_key_col]= cur_tmp_field;
@@ -5552,9 +5585,9 @@ bool Ordered_key::init(int col_idx)
key_columns= (Item_field**) thd->alloc(sizeof(Item_field*));
compare_pred= (Item_func_lt**) thd->alloc(sizeof(Item_func_lt*));
- key_columns[0]= new Item_field(tbl->field[col_idx]);
+ key_columns[0]= new (thd->mem_root) Item_field(thd, tbl->field[col_idx]);
/* Create the predicate (tmp_column[i] < outer_ref[i]). */
- compare_pred[0]= new Item_func_lt(key_columns[0],
+ compare_pred[0]= new (thd->mem_root) Item_func_lt(thd, key_columns[0],
search_key->element_index(col_idx));
compare_pred[0]->fix_fields(thd, (Item**)&compare_pred[0]);
@@ -6556,3 +6589,23 @@ void subselect_table_scan_engine::cleanup()
{
}
+
+/*
+ Create an execution tracker for the expression cache we're using for this
+ subselect; add the tracker to the query plan.
+*/
+
+void Item_subselect::init_expr_cache_tracker(THD *thd)
+{
+ if(!expr_cache)
+ return;
+
+ Explain_query *qw= thd->lex->explain;
+ DBUG_ASSERT(qw);
+ Explain_node *node= qw->get_node(unit->first_select()->select_number);
+ if (!node)
+ return;
+ DBUG_ASSERT(expr_cache->type() == Item::EXPR_CACHE_ITEM);
+ node->cache_tracker= ((Item_cache_wrapper *)expr_cache)->init_tracker(qw->mem_root);
+}
+
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 6628a1bf86b..27d06d715b5 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -128,7 +128,7 @@ public:
enum subs_type {UNKNOWN_SUBS, SINGLEROW_SUBS,
EXISTS_SUBS, IN_SUBS, ALL_SUBS, ANY_SUBS};
- Item_subselect();
+ Item_subselect(THD *thd);
virtual subs_type substype() { return UNKNOWN_SUBS; }
bool is_in_predicate()
@@ -244,7 +244,10 @@ public:
bool limit_index_condition_pushdown_processor(uchar *opt_arg)
{
return TRUE;
- }
+ }
+
+ void init_expr_cache_tracker(THD *thd);
+
friend class select_result_interceptor;
friend class Item_in_optimizer;
@@ -266,7 +269,7 @@ protected:
Item_cache *value, **row;
public:
Item_singlerow_subselect(THD *thd_arg, st_select_lex *select_lex);
- Item_singlerow_subselect() :Item_subselect(), value(0), row (0)
+ Item_singlerow_subselect(THD *thd_arg): Item_subselect(thd_arg), value(0), row (0)
{}
void cleanup();
@@ -308,7 +311,7 @@ public:
*/
st_select_lex* invalidate_and_restore_select_lex();
- Item* expr_cache_insert_transformer(uchar *thd_arg);
+ Item* expr_cache_insert_transformer(THD *thd, uchar *unused);
friend class select_singlerow_subselect;
};
@@ -361,8 +364,8 @@ public:
bool exists_transformed;
Item_exists_subselect(THD *thd_arg, st_select_lex *select_lex);
- Item_exists_subselect()
- :Item_subselect(), upper_not(NULL),abort_on_null(0),
+ Item_exists_subselect(THD *thd_arg):
+ Item_subselect(thd_arg), upper_not(NULL), abort_on_null(0),
emb_on_expr_nest(NULL), optimizer(0), exists_transformed(0)
{}
@@ -388,7 +391,7 @@ public:
inline bool is_top_level_item() { return abort_on_null; }
bool exists2in_processor(uchar *opt_arg);
- Item* expr_cache_insert_transformer(uchar *thd_arg);
+ Item* expr_cache_insert_transformer(THD *thd, uchar *unused);
void mark_as_condition_AND_part(TABLE_LIST *embedding)
{
@@ -567,8 +570,8 @@ public:
Item_func_not_all *upper_item; // point on NOT/NOP before ALL/SOME subquery
Item_in_subselect(THD *thd_arg, Item * left_expr, st_select_lex *select_lex);
- Item_in_subselect()
- :Item_exists_subselect(), left_expr_cache(0), first_execution(TRUE),
+ Item_in_subselect(THD *thd_arg):
+ Item_exists_subselect(thd_arg), left_expr_cache(0), first_execution(TRUE),
in_strategy(SUBS_NOT_TRANSFORMED),
pushed_cond_guards(NULL), func(NULL), is_jtbm_merged(FALSE),
is_jtbm_const_tab(FALSE), upper_item(0) {}
@@ -1036,9 +1039,9 @@ public:
Name_resolution_context *semi_join_conds_context;
- subselect_hash_sj_engine(THD *thd, Item_subselect *in_predicate,
+ subselect_hash_sj_engine(THD *thd_arg, Item_subselect *in_predicate,
subselect_single_select_engine *old_engine)
- : subselect_engine(thd, in_predicate, NULL),
+ : subselect_engine(thd_arg, in_predicate, NULL),
tmp_table(NULL), is_materialized(FALSE), materialize_engine(old_engine),
materialize_join(NULL), semi_join_conds(NULL), lookup_engine(NULL),
count_partial_match_columns(0), count_null_only_columns(0),
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index bac5c599561..79471bb6d50 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2008, 2014, SkySQL Ab.
+/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2008, 2015, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -76,7 +76,7 @@ bool Item_sum::init_sum_func_check(THD *thd)
}
if (!(thd->lex->allow_sum_func & curr_sel->name_visibility_map))
{
- my_message(ER_INVALID_GROUP_FUNC_USE, ER(ER_INVALID_GROUP_FUNC_USE),
+ my_message(ER_INVALID_GROUP_FUNC_USE, ER_THD(thd, ER_INVALID_GROUP_FUNC_USE),
MYF(0));
return TRUE;
}
@@ -200,7 +200,8 @@ bool Item_sum::check_sum_func(THD *thd, Item **ref)
invalid= aggr_level <= max_sum_func_level;
if (invalid)
{
- my_message(ER_INVALID_GROUP_FUNC_USE, ER(ER_INVALID_GROUP_FUNC_USE),
+ my_message(ER_INVALID_GROUP_FUNC_USE,
+ ER_THD(thd, ER_INVALID_GROUP_FUNC_USE),
MYF(0));
return TRUE;
}
@@ -271,7 +272,7 @@ bool Item_sum::check_sum_func(THD *thd, Item **ref)
Let upper function decide whether this field is a non
aggregated one.
*/
- in_sum_func->outer_fields.push_back(field);
+ in_sum_func->outer_fields.push_back(field, thd->mem_root);
}
else
sel->set_non_agg_field_used(true);
@@ -281,7 +282,7 @@ bool Item_sum::check_sum_func(THD *thd, Item **ref)
!sel->group_list.elements)
{
my_message(ER_MIX_OF_GROUP_FUNC_AND_FIELDS,
- ER(ER_MIX_OF_GROUP_FUNC_AND_FIELDS), MYF(0));
+ ER_THD(thd, ER_MIX_OF_GROUP_FUNC_AND_FIELDS), MYF(0));
return TRUE;
}
}
@@ -400,10 +401,10 @@ bool Item_sum::collect_outer_ref_processor(uchar *param)
}
-Item_sum::Item_sum(List<Item> &list) :Item_func_or_sum(list),
+Item_sum::Item_sum(THD *thd, List<Item> &list): Item_func_or_sum(thd, list),
forced_const(FALSE)
{
- if (!(orig_args= (Item **) sql_alloc(sizeof(Item *) * arg_count)))
+ if (!(orig_args= (Item **) thd->alloc(sizeof(Item *) * arg_count)))
{
args= NULL;
}
@@ -489,7 +490,7 @@ Item *Item_sum::get_tmp_table_item(THD *thd)
if (arg->type() == Item::FIELD_ITEM)
((Item_field*) arg)->field= result_field_tmp++;
else
- sum_item->args[i]= new Item_field(result_field_tmp++);
+ sum_item->args[i]= new (thd->mem_root) Item_field(thd, result_field_tmp++);
}
}
}
@@ -501,27 +502,30 @@ Field *Item_sum::create_tmp_field(bool group, TABLE *table,
uint convert_blob_length)
{
Field *UNINIT_VAR(field);
+ MEM_ROOT *mem_root= table->in_use->mem_root;
+
switch (result_type()) {
case REAL_RESULT:
- field= new Field_double(max_length, maybe_null, name, decimals, TRUE);
+ field= new (mem_root)
+ Field_double(max_length, maybe_null, name, decimals, TRUE);
break;
case INT_RESULT:
- field= new Field_longlong(max_length, maybe_null, name, unsigned_flag);
+ field= new (mem_root)
+ Field_longlong(max_length, maybe_null, name, unsigned_flag);
break;
case STRING_RESULT:
if (max_length/collation.collation->mbmaxlen <= 255 ||
convert_blob_length > Field_varstring::MAX_SIZE ||
!convert_blob_length)
return make_string_field(table);
- field= new Field_varstring(convert_blob_length, maybe_null,
- name, table->s, collation.collation);
+ field= new (mem_root) Field_varstring(convert_blob_length, maybe_null,
+ name, table->s, collation.collation);
break;
case DECIMAL_RESULT:
- field= Field_new_decimal::create_from_item(this);
+ field= Field_new_decimal::create_from_item(mem_root, this);
break;
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
// This case should never be choosen
DBUG_ASSERT(0);
return 0;
@@ -609,6 +613,10 @@ void Item_sum::cleanup()
forced_const= FALSE;
}
+Item *Item_sum::result_item(THD *thd, Field *field)
+{
+ return new (thd->mem_root) Item_field(thd, field);
+}
/**
Compare keys consisting of single field that cannot be compared as binary.
@@ -772,7 +780,7 @@ bool Aggregator_distinct::setup(THD *thd)
for (uint i=0; i < item_sum->get_arg_count() ; i++)
{
Item *item=item_sum->get_arg(i);
- if (list.push_back(item))
+ if (list.push_back(item, thd->mem_root))
return TRUE; // End of memory
if (item->const_item() && item->is_null())
always_null= true;
@@ -893,7 +901,7 @@ bool Aggregator_distinct::setup(THD *thd)
PS/SP. Hence all further allocations are performed in the runtime
mem_root.
*/
- if (field_list.push_back(&field_def))
+ if (field_list.push_back(&field_def, thd->mem_root))
DBUG_RETURN(TRUE);
item_sum->null_value= item_sum->maybe_null= 1;
@@ -1193,10 +1201,9 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref)
break;
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0);
};
- setup_hybrid(args[0], NULL);
+ setup_hybrid(thd, args[0], NULL);
/* MIN/MAX can return NULL for empty set indepedent of the used column */
maybe_null= 1;
unsigned_flag=item->unsigned_flag;
@@ -1235,18 +1242,18 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref)
and Item_sum_min::add() to use different values!
*/
-void Item_sum_hybrid::setup_hybrid(Item *item, Item *value_arg)
+void Item_sum_hybrid::setup_hybrid(THD *thd, Item *item, Item *value_arg)
{
- if (!(value= Item_cache::get_cache(item, item->cmp_type())))
+ if (!(value= Item_cache::get_cache(thd, item, item->cmp_type())))
return;
- value->setup(item);
+ value->setup(thd, item);
value->store(value_arg);
/* Don't cache value, as it will change */
if (!item->const_item())
value->set_used_tables(RAND_TABLE_BIT);
- if (!(arg_cache= Item_cache::get_cache(item, item->cmp_type())))
+ if (!(arg_cache= Item_cache::get_cache(thd, item, item->cmp_type())))
return;
- arg_cache->setup(item);
+ arg_cache->setup(thd, item);
/* Don't cache value, as it will change */
if (!item->const_item())
arg_cache->set_used_tables(RAND_TABLE_BIT);
@@ -1261,33 +1268,37 @@ Field *Item_sum_hybrid::create_tmp_field(bool group, TABLE *table,
uint convert_blob_length)
{
Field *field;
+ MEM_ROOT *mem_root;
+
if (args[0]->type() == Item::FIELD_ITEM)
{
field= ((Item_field*) args[0])->field;
- if ((field= create_tmp_field_from_field(current_thd, field, name, table,
+ if ((field= create_tmp_field_from_field(table->in_use, field, name, table,
NULL, convert_blob_length)))
field->flags&= ~NOT_NULL_FLAG;
return field;
}
+
/*
DATE/TIME fields have STRING_RESULT result types.
In order to preserve field type, it's needed to handle DATE/TIME
fields creations separately.
*/
+ mem_root= table->in_use->mem_root;
switch (args[0]->field_type()) {
case MYSQL_TYPE_DATE:
- field= new Field_newdate(0, maybe_null ? (uchar*)"" : 0, 0, Field::NONE,
- name);
+ field= new (mem_root)
+ Field_newdate(0, maybe_null ? (uchar*)"" : 0, 0, Field::NONE, name);
break;
case MYSQL_TYPE_TIME:
- field= new_Field_time(0, maybe_null ? (uchar*)"" : 0, 0, Field::NONE,
- name, decimals);
+ field= new_Field_time(mem_root, 0, maybe_null ? (uchar*)"" : 0, 0,
+ Field::NONE, name, decimals);
break;
case MYSQL_TYPE_TIMESTAMP:
case MYSQL_TYPE_DATETIME:
- field= new_Field_datetime(0, maybe_null ? (uchar*)"" : 0, 0, Field::NONE,
- name, decimals);
+ field= new_Field_datetime(mem_root, 0, maybe_null ? (uchar*)"" : 0, 0,
+ Field::NONE, name, decimals);
break;
default:
return Item_sum::create_tmp_field(group, table, convert_blob_length);
@@ -1367,7 +1378,6 @@ void Item_sum_sum::fix_length_and_dec()
break;
}
case ROW_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0);
}
DBUG_PRINT("info", ("Type: %s (%d, %d)",
@@ -1652,6 +1662,8 @@ Field *Item_sum_avg::create_tmp_field(bool group, TABLE *table,
uint convert_blob_len)
{
Field *field;
+ MEM_ROOT *mem_root= table->in_use->mem_root;
+
if (group)
{
/*
@@ -1659,14 +1671,16 @@ Field *Item_sum_avg::create_tmp_field(bool group, TABLE *table,
The easiest way is to do this is to store both value in a string
and unpack on access.
*/
- field= new Field_string(((hybrid_type == DECIMAL_RESULT) ?
- dec_bin_size : sizeof(double)) + sizeof(longlong),
- 0, name, &my_charset_bin);
+ field= new (mem_root)
+ Field_string(((hybrid_type == DECIMAL_RESULT) ?
+ dec_bin_size : sizeof(double)) + sizeof(longlong),
+ 0, name, &my_charset_bin);
}
else if (hybrid_type == DECIMAL_RESULT)
- field= Field_new_decimal::create_from_item(this);
+ field= Field_new_decimal::create_from_item(mem_root, this);
else
- field= new Field_double(max_length, maybe_null, name, decimals, TRUE);
+ field= new (mem_root) Field_double(max_length, maybe_null, name, decimals,
+ TRUE);
if (field)
field->init(table);
return field;
@@ -1758,6 +1772,12 @@ Item *Item_sum_std::copy_or_same(THD* thd)
}
+Item *Item_sum_std::result_item(THD *thd, Field *field)
+{
+ return new (thd->mem_root) Item_std_field(thd, this);
+}
+
+
/*
Variance
*/
@@ -1848,7 +1868,6 @@ void Item_sum_variance::fix_length_and_dec()
}
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0);
}
DBUG_PRINT("info", ("Type: REAL_RESULT (%d, %d)", max_length, (int)decimals));
@@ -1988,6 +2007,11 @@ void Item_sum_variance::update_field()
}
+Item *Item_sum_variance::result_item(THD *thd, Field *field)
+{
+ return new (thd->mem_root) Item_variance_field(thd, this);
+}
+
/* min & max */
void Item_sum_hybrid::clear()
@@ -2087,7 +2111,7 @@ void Item_sum_hybrid::restore_to_before_no_rows_in_result()
Item *Item_sum_min::copy_or_same(THD* thd)
{
Item_sum_min *item= new (thd->mem_root) Item_sum_min(thd, this);
- item->setup_hybrid(args[0], value);
+ item->setup_hybrid(thd, args[0], value);
return item;
}
@@ -2110,7 +2134,7 @@ bool Item_sum_min::add()
Item *Item_sum_max::copy_or_same(THD* thd)
{
Item_sum_max *item= new (thd->mem_root) Item_sum_max(thd, this);
- item->setup_hybrid(args[0], value);
+ item->setup_hybrid(thd, args[0], value);
return item;
}
@@ -2286,7 +2310,6 @@ void Item_sum_hybrid::reset_field()
}
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0);
}
}
@@ -2476,6 +2499,12 @@ void Item_sum_avg::update_field()
}
+Item *Item_sum_avg::result_item(THD *thd, Field *field)
+{
+ return new (thd->mem_root) Item_avg_field(thd, hybrid_type, this);
+}
+
+
void Item_sum_hybrid::update_field()
{
switch (hybrid_type) {
@@ -2590,7 +2619,9 @@ Item_sum_hybrid::min_max_update_decimal_field()
}
-Item_avg_field::Item_avg_field(Item_result res_type, Item_sum_avg *item)
+Item_avg_field::Item_avg_field(THD *thd, Item_result res_type,
+ Item_sum_avg *item):
+ Item_result_field(thd)
{
name=item->name;
decimals=item->decimals;
@@ -2663,8 +2694,8 @@ String *Item_avg_field::val_str(String *str)
}
-Item_std_field::Item_std_field(Item_sum_std *item)
- : Item_variance_field(item)
+Item_std_field::Item_std_field(THD *thd, Item_sum_std *item):
+ Item_variance_field(thd, item)
{
}
@@ -2702,7 +2733,8 @@ my_decimal *Item_std_field::val_decimal(my_decimal *dec_buf)
}
-Item_variance_field::Item_variance_field(Item_sum_variance *item)
+Item_variance_field::Item_variance_field(THD *thd, Item_sum_variance *item):
+ Item_result_field(thd)
{
name=item->name;
decimals=item->decimals;
@@ -3112,6 +3144,7 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)),
CHARSET_INFO *cs= item->collation.collation;
const char *ptr= result->ptr();
uint add_length;
+ THD *thd= current_thd;
/*
It's ok to use item->result.length() as the fourth argument
as this is never used to limit the length of the data.
@@ -3124,8 +3157,9 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)),
&well_formed_error);
result->length(old_length + add_length);
item->warning_for_row= TRUE;
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_CUT_VALUE_GROUP_CONCAT, ER(ER_CUT_VALUE_GROUP_CONCAT),
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_CUT_VALUE_GROUP_CONCAT,
+ ER_THD(thd, ER_CUT_VALUE_GROUP_CONCAT),
item->row_count);
return 1;
@@ -3144,11 +3178,11 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)),
*/
Item_func_group_concat::
-Item_func_group_concat(Name_resolution_context *context_arg,
+Item_func_group_concat(THD *thd, Name_resolution_context *context_arg,
bool distinct_arg, List<Item> *select_list,
const SQL_I_List<ORDER> &order_list,
String *separator_arg)
- :tmp_table_param(0), separator(separator_arg), tree(0),
+ :Item_sum(thd), tmp_table_param(0), separator(separator_arg), tree(0),
unique_filter(NULL), table(0),
order(0), context(context_arg),
arg_count_order(order_list.elements),
@@ -3170,8 +3204,8 @@ Item_func_group_concat(Name_resolution_context *context_arg,
(for possible order items in temporary tables)
order - arg_count_order
*/
- if (!(args= (Item**) sql_alloc(sizeof(Item*) * arg_count * 2 +
- sizeof(ORDER*)*arg_count_order)))
+ if (!(args= (Item**) thd->alloc(sizeof(Item*) * arg_count * 2 +
+ sizeof(ORDER*)*arg_count_order)))
return;
order= (ORDER**)(args + arg_count);
@@ -3280,12 +3314,24 @@ void Item_func_group_concat::cleanup()
}
DBUG_ASSERT(tree == 0);
}
-
+ /*
+ As the ORDER structures pointed to by the elements of the
+ 'order' array may be modified in find_order_in_list() called
+ from Item_func_group_concat::setup() to point to runtime
+ created objects, we need to reset them back to the original
+ arguments of the function.
+ */
+ ORDER **order_ptr= order;
+ for (uint i= 0; i < arg_count_order; i++)
+ {
+ (*order_ptr)->item= &args[arg_count_field + i];
+ order_ptr++;
+ }
DBUG_VOID_RETURN;
}
-Field *Item_func_group_concat::make_string_field(TABLE *table)
+Field *Item_func_group_concat::make_string_field(TABLE *table_arg)
{
Field *field;
DBUG_ASSERT(collation.collation);
@@ -3294,10 +3340,11 @@ Field *Item_func_group_concat::make_string_field(TABLE *table)
maybe_null, name, collation.collation, TRUE);
else
field= new Field_varstring(max_length,
- maybe_null, name, table->s, collation.collation);
+ maybe_null, name, table_arg->s,
+ collation.collation);
if (field)
- field->init(table);
+ field->init(table_arg);
return field;
}
@@ -3465,7 +3512,7 @@ bool Item_func_group_concat::setup(THD *thd)
for (uint i= 0; i < arg_count_field; i++)
{
Item *item= args[i];
- if (list.push_back(item))
+ if (list.push_back(item, thd->mem_root))
DBUG_RETURN(TRUE);
if (item->const_item())
{
@@ -3484,9 +3531,17 @@ bool Item_func_group_concat::setup(THD *thd)
"all_fields". The resulting field list is used as input to create
tmp table columns.
*/
- if (arg_count_order &&
- setup_order(thd, args, context->table_list, list, all_fields, *order))
- DBUG_RETURN(TRUE);
+ if (arg_count_order)
+ {
+ uint n_elems= arg_count_order + all_fields.elements;
+ ref_pointer_array= static_cast<Item**>(thd->alloc(sizeof(Item*) * n_elems));
+ if (!ref_pointer_array)
+ DBUG_RETURN(TRUE);
+ memcpy(ref_pointer_array, args, arg_count * sizeof(Item*));
+ if (setup_order(thd, ref_pointer_array, context->table_list, list,
+ all_fields, *order))
+ DBUG_RETURN(TRUE);
+ }
count_field_types(select_lex, tmp_table_param, all_fields, 0);
tmp_table_param->force_copy_fields= force_copy_fields;
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 056c62355fb..01a580d03cb 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -381,24 +381,24 @@ protected:
public:
void mark_as_sum_func();
- Item_sum() :Item_func_or_sum(), quick_group(1), forced_const(FALSE)
+ Item_sum(THD *thd): Item_func_or_sum(thd), quick_group(1), forced_const(FALSE)
{
mark_as_sum_func();
init_aggregator();
}
- Item_sum(Item *a) :Item_func_or_sum(a), quick_group(1),
+ Item_sum(THD *thd, Item *a): Item_func_or_sum(thd, a), quick_group(1),
orig_args(tmp_orig_args), forced_const(FALSE)
{
mark_as_sum_func();
init_aggregator();
}
- Item_sum(Item *a, Item *b) :Item_func_or_sum(a, b), quick_group(1),
- orig_args(tmp_orig_args), forced_const(FALSE)
+ Item_sum(THD *thd, Item *a, Item *b): Item_func_or_sum(thd, a, b),
+ quick_group(1), orig_args(tmp_orig_args), forced_const(FALSE)
{
mark_as_sum_func();
init_aggregator();
}
- Item_sum(List<Item> &list);
+ Item_sum(THD *thd, List<Item> &list);
//Copy constructor, need to perform subselects with temporary tables
Item_sum(THD *thd, Item_sum *item);
enum Type type() const { return SUM_FUNC_ITEM; }
@@ -431,8 +431,8 @@ public:
virtual void update_field()=0;
virtual bool keep_field_type(void) const { return 0; }
virtual void fix_length_and_dec() { maybe_null=1; null_value=1; }
- virtual Item *result_item(Field *field)
- { return new Item_field(field); }
+ virtual Item *result_item(THD *thd, Field *field);
+
/*
Return bitmap of tables that are needed to evaluate the item.
@@ -694,14 +694,15 @@ protected:
*/
bool is_evaluated;
public:
- Item_sum_num() :Item_sum(),is_evaluated(FALSE) {}
- Item_sum_num(Item *item_par)
- :Item_sum(item_par), is_evaluated(FALSE) {}
- Item_sum_num(Item *a, Item* b) :Item_sum(a,b),is_evaluated(FALSE) {}
- Item_sum_num(List<Item> &list)
- :Item_sum(list), is_evaluated(FALSE) {}
- Item_sum_num(THD *thd, Item_sum_num *item)
- :Item_sum(thd, item),is_evaluated(item->is_evaluated) {}
+ Item_sum_num(THD *thd): Item_sum(thd), is_evaluated(FALSE) {}
+ Item_sum_num(THD *thd, Item *item_par):
+ Item_sum(thd, item_par), is_evaluated(FALSE) {}
+ Item_sum_num(THD *thd, Item *a, Item* b):
+ Item_sum(thd, a, b), is_evaluated(FALSE) {}
+ Item_sum_num(THD *thd, List<Item> &list):
+ Item_sum(thd, list), is_evaluated(FALSE) {}
+ Item_sum_num(THD *thd, Item_sum_num *item):
+ Item_sum(thd, item),is_evaluated(item->is_evaluated) {}
bool fix_fields(THD *, Item **);
longlong val_int()
{
@@ -717,8 +718,8 @@ public:
class Item_sum_int :public Item_sum_num
{
public:
- Item_sum_int(Item *item_par) :Item_sum_num(item_par) {}
- Item_sum_int(List<Item> &list) :Item_sum_num(list) {}
+ Item_sum_int(THD *thd, Item *item_par): Item_sum_num(thd, item_par) {}
+ Item_sum_int(THD *thd, List<Item> &list): Item_sum_num(thd, list) {}
Item_sum_int(THD *thd, Item_sum_int *item) :Item_sum_num(thd, item) {}
double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
String *val_str(String*str);
@@ -739,7 +740,8 @@ protected:
void fix_length_and_dec();
public:
- Item_sum_sum(Item *item_par, bool distinct) :Item_sum_num(item_par)
+ Item_sum_sum(THD *thd, Item *item_par, bool distinct):
+ Item_sum_num(thd, item_par)
{
set_distinct(distinct);
}
@@ -777,8 +779,8 @@ class Item_sum_count :public Item_sum_int
void cleanup();
public:
- Item_sum_count(Item *item_par)
- :Item_sum_int(item_par),count(0)
+ Item_sum_count(THD *thd, Item *item_par):
+ Item_sum_int(thd, item_par), count(0)
{}
/**
@@ -789,13 +791,13 @@ class Item_sum_count :public Item_sum_int
This constructor is called by the parser only for COUNT (DISTINCT).
*/
- Item_sum_count(List<Item> &list)
- :Item_sum_int(list),count(0)
+ Item_sum_count(THD *thd, List<Item> &list):
+ Item_sum_int(thd, list), count(0)
{
set_distinct(TRUE);
}
- Item_sum_count(THD *thd, Item_sum_count *item)
- :Item_sum_int(thd, item), count(item->count)
+ Item_sum_count(THD *thd, Item_sum_count *item):
+ Item_sum_int(thd, item), count(item->count)
{}
enum Sumfunctype sum_func () const
{
@@ -829,7 +831,7 @@ public:
Item_result hybrid_type;
uint f_precision, f_scale, dec_bin_size;
uint prec_increment;
- Item_avg_field(Item_result res_type, Item_sum_avg *item);
+ Item_avg_field(THD *thd, Item_result res_type, Item_sum_avg *item);
enum Type type() const { return FIELD_AVG_ITEM; }
double val_real();
longlong val_int();
@@ -856,8 +858,8 @@ public:
uint prec_increment;
uint f_precision, f_scale, dec_bin_size;
- Item_sum_avg(Item *item_par, bool distinct)
- :Item_sum_sum(item_par, distinct), count(0)
+ Item_sum_avg(THD *thd, Item *item_par, bool distinct):
+ Item_sum_sum(thd, item_par, distinct), count(0)
{}
Item_sum_avg(THD *thd, Item_sum_avg *item)
:Item_sum_sum(thd, item), count(item->count),
@@ -877,8 +879,7 @@ public:
String *val_str(String *str);
void reset_field();
void update_field();
- Item *result_item(Field *field)
- { return new Item_avg_field(hybrid_type, this); }
+ Item *result_item(THD *thd, Field *field);
void no_rows_in_result() {}
const char *func_name() const
{
@@ -905,7 +906,7 @@ public:
uint dec_bin_size0, dec_bin_size1;
uint sample;
uint prec_increment;
- Item_variance_field(Item_sum_variance *item);
+ Item_variance_field(THD *thd, Item_sum_variance *item);
enum Type type() const {return FIELD_VARIANCE_ITEM; }
double val_real();
longlong val_int()
@@ -963,8 +964,9 @@ public:
uint sample;
uint prec_increment;
- Item_sum_variance(Item *item_par, uint sample_arg) :Item_sum_num(item_par),
- hybrid_type(REAL_RESULT), count(0), sample(sample_arg)
+ Item_sum_variance(THD *thd, Item *item_par, uint sample_arg):
+ Item_sum_num(thd, item_par), hybrid_type(REAL_RESULT), count(0),
+ sample(sample_arg)
{}
Item_sum_variance(THD *thd, Item_sum_variance *item);
enum Sumfunctype sum_func () const { return VARIANCE_FUNC; }
@@ -974,8 +976,7 @@ public:
my_decimal *val_decimal(my_decimal *);
void reset_field();
void update_field();
- Item *result_item(Field *field)
- { return new Item_variance_field(this); }
+ Item *result_item(THD *thd, Field *field);
void no_rows_in_result() {}
const char *func_name() const
{ return sample ? "var_samp(" : "variance("; }
@@ -994,7 +995,7 @@ class Item_sum_std;
class Item_std_field :public Item_variance_field
{
public:
- Item_std_field(Item_sum_std *item);
+ Item_std_field(THD *thd, Item_sum_std *item);
enum Type type() const { return FIELD_STD_ITEM; }
double val_real();
my_decimal *val_decimal(my_decimal *);
@@ -1009,15 +1010,14 @@ public:
class Item_sum_std :public Item_sum_variance
{
public:
- Item_sum_std(Item *item_par, uint sample_arg)
- :Item_sum_variance(item_par, sample_arg) {}
+ Item_sum_std(THD *thd, Item *item_par, uint sample_arg):
+ Item_sum_variance(thd, item_par, sample_arg) {}
Item_sum_std(THD *thd, Item_sum_std *item)
:Item_sum_variance(thd, item)
{}
enum Sumfunctype sum_func () const { return STD_FUNC; }
double val_real();
- Item *result_item(Field *field)
- { return new Item_std_field(this); }
+ Item *result_item(THD *thd, Field *field);
const char *func_name() const { return "std("; }
Item *copy_or_same(THD* thd);
enum Item_result result_type () const { return REAL_RESULT; }
@@ -1039,8 +1039,8 @@ protected:
bool was_null_value;
public:
- Item_sum_hybrid(Item *item_par,int sign)
- :Item_sum(item_par), value(0), arg_cache(0), cmp(0),
+ Item_sum_hybrid(THD *thd, Item *item_par,int sign):
+ Item_sum(thd, item_par), value(0), arg_cache(0), cmp(0),
hybrid_type(INT_RESULT), hybrid_field_type(MYSQL_TYPE_LONGLONG),
cmp_sign(sign), was_values(TRUE)
{ collation.set(&my_charset_bin); }
@@ -1050,7 +1050,7 @@ protected:
cmp_sign(item->cmp_sign), was_values(item->was_values)
{ }
bool fix_fields(THD *, Item **);
- void setup_hybrid(Item *item, Item *value_arg);
+ void setup_hybrid(THD *thd, Item *item, Item *value_arg);
void clear();
double val_real();
longlong val_int();
@@ -1077,7 +1077,7 @@ protected:
class Item_sum_min :public Item_sum_hybrid
{
public:
- Item_sum_min(Item *item_par) :Item_sum_hybrid(item_par,1) {}
+ Item_sum_min(THD *thd, Item *item_par): Item_sum_hybrid(thd, item_par, 1) {}
Item_sum_min(THD *thd, Item_sum_min *item) :Item_sum_hybrid(thd, item) {}
enum Sumfunctype sum_func () const {return MIN_FUNC;}
@@ -1090,7 +1090,7 @@ public:
class Item_sum_max :public Item_sum_hybrid
{
public:
- Item_sum_max(Item *item_par) :Item_sum_hybrid(item_par,-1) {}
+ Item_sum_max(THD *thd, Item *item_par): Item_sum_hybrid(thd, item_par, -1) {}
Item_sum_max(THD *thd, Item_sum_max *item) :Item_sum_hybrid(thd, item) {}
enum Sumfunctype sum_func () const {return MAX_FUNC;}
@@ -1106,8 +1106,8 @@ protected:
ulonglong reset_bits,bits;
public:
- Item_sum_bit(Item *item_par,ulonglong reset_arg)
- :Item_sum_int(item_par),reset_bits(reset_arg),bits(reset_arg) {}
+ Item_sum_bit(THD *thd, Item *item_par, ulonglong reset_arg):
+ Item_sum_int(thd, item_par), reset_bits(reset_arg), bits(reset_arg) {}
Item_sum_bit(THD *thd, Item_sum_bit *item):
Item_sum_int(thd, item), reset_bits(item->reset_bits), bits(item->bits) {}
enum Sumfunctype sum_func () const {return SUM_BIT_FUNC;}
@@ -1128,7 +1128,7 @@ public:
class Item_sum_or :public Item_sum_bit
{
public:
- Item_sum_or(Item *item_par) :Item_sum_bit(item_par, 0) {}
+ Item_sum_or(THD *thd, Item *item_par): Item_sum_bit(thd, item_par, 0) {}
Item_sum_or(THD *thd, Item_sum_or *item) :Item_sum_bit(thd, item) {}
bool add();
const char *func_name() const { return "bit_or("; }
@@ -1139,7 +1139,8 @@ public:
class Item_sum_and :public Item_sum_bit
{
public:
- Item_sum_and(Item *item_par) :Item_sum_bit(item_par, ULONGLONG_MAX) {}
+ Item_sum_and(THD *thd, Item *item_par):
+ Item_sum_bit(thd, item_par, ULONGLONG_MAX) {}
Item_sum_and(THD *thd, Item_sum_and *item) :Item_sum_bit(thd, item) {}
bool add();
const char *func_name() const { return "bit_and("; }
@@ -1149,7 +1150,7 @@ class Item_sum_and :public Item_sum_bit
class Item_sum_xor :public Item_sum_bit
{
public:
- Item_sum_xor(Item *item_par) :Item_sum_bit(item_par, 0) {}
+ Item_sum_xor(THD *thd, Item *item_par): Item_sum_bit(thd, item_par, 0) {}
Item_sum_xor(THD *thd, Item_sum_xor *item) :Item_sum_bit(thd, item) {}
bool add();
const char *func_name() const { return "bit_xor("; }
@@ -1169,11 +1170,11 @@ protected:
udf_handler udf;
public:
- Item_udf_sum(udf_func *udf_arg)
- :Item_sum(), udf(udf_arg)
+ Item_udf_sum(THD *thd, udf_func *udf_arg):
+ Item_sum(thd), udf(udf_arg)
{ quick_group=0; }
- Item_udf_sum(udf_func *udf_arg, List<Item> &list)
- :Item_sum(list), udf(udf_arg)
+ Item_udf_sum(THD *thd, udf_func *udf_arg, List<Item> &list):
+ Item_sum(thd, list), udf(udf_arg)
{ quick_group=0;}
Item_udf_sum(THD *thd, Item_udf_sum *item)
:Item_sum(thd, item), udf(item->udf)
@@ -1208,10 +1209,10 @@ public:
class Item_sum_udf_float :public Item_udf_sum
{
public:
- Item_sum_udf_float(udf_func *udf_arg)
- :Item_udf_sum(udf_arg) {}
- Item_sum_udf_float(udf_func *udf_arg, List<Item> &list)
- :Item_udf_sum(udf_arg, list) {}
+ Item_sum_udf_float(THD *thd, udf_func *udf_arg):
+ Item_udf_sum(thd, udf_arg) {}
+ Item_sum_udf_float(THD *thd, udf_func *udf_arg, List<Item> &list):
+ Item_udf_sum(thd, udf_arg, list) {}
Item_sum_udf_float(THD *thd, Item_sum_udf_float *item)
:Item_udf_sum(thd, item) {}
longlong val_int()
@@ -1230,10 +1231,10 @@ class Item_sum_udf_float :public Item_udf_sum
class Item_sum_udf_int :public Item_udf_sum
{
public:
- Item_sum_udf_int(udf_func *udf_arg)
- :Item_udf_sum(udf_arg) {}
- Item_sum_udf_int(udf_func *udf_arg, List<Item> &list)
- :Item_udf_sum(udf_arg, list) {}
+ Item_sum_udf_int(THD *thd, udf_func *udf_arg):
+ Item_udf_sum(thd, udf_arg) {}
+ Item_sum_udf_int(THD *thd, udf_func *udf_arg, List<Item> &list):
+ Item_udf_sum(thd, udf_arg, list) {}
Item_sum_udf_int(THD *thd, Item_sum_udf_int *item)
:Item_udf_sum(thd, item) {}
longlong val_int();
@@ -1250,10 +1251,10 @@ public:
class Item_sum_udf_str :public Item_udf_sum
{
public:
- Item_sum_udf_str(udf_func *udf_arg)
- :Item_udf_sum(udf_arg) {}
- Item_sum_udf_str(udf_func *udf_arg, List<Item> &list)
- :Item_udf_sum(udf_arg,list) {}
+ Item_sum_udf_str(THD *thd, udf_func *udf_arg):
+ Item_udf_sum(thd, udf_arg) {}
+ Item_sum_udf_str(THD *thd, udf_func *udf_arg, List<Item> &list):
+ Item_udf_sum(thd, udf_arg, list) {}
Item_sum_udf_str(THD *thd, Item_sum_udf_str *item)
:Item_udf_sum(thd, item) {}
String *val_str(String *);
@@ -1289,10 +1290,10 @@ public:
class Item_sum_udf_decimal :public Item_udf_sum
{
public:
- Item_sum_udf_decimal(udf_func *udf_arg)
- :Item_udf_sum(udf_arg) {}
- Item_sum_udf_decimal(udf_func *udf_arg, List<Item> &list)
- :Item_udf_sum(udf_arg, list) {}
+ Item_sum_udf_decimal(THD *thd, udf_func *udf_arg):
+ Item_udf_sum(thd, udf_arg) {}
+ Item_sum_udf_decimal(THD *thd, udf_func *udf_arg, List<Item> &list):
+ Item_udf_sum(thd, udf_arg, list) {}
Item_sum_udf_decimal(THD *thd, Item_sum_udf_decimal *item)
:Item_udf_sum(thd, item) {}
String *val_str(String *);
@@ -1309,9 +1310,10 @@ public:
class Item_sum_udf_float :public Item_sum_num
{
public:
- Item_sum_udf_float(udf_func *udf_arg)
- :Item_sum_num() {}
- Item_sum_udf_float(udf_func *udf_arg, List<Item> &list) :Item_sum_num() {}
+ Item_sum_udf_float(THD *thd, udf_func *udf_arg):
+ Item_sum_num(thd) {}
+ Item_sum_udf_float(THD *thd, udf_func *udf_arg, List<Item> &list):
+ Item_sum_num(thd) {}
Item_sum_udf_float(THD *thd, Item_sum_udf_float *item)
:Item_sum_num(thd, item) {}
enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
@@ -1325,9 +1327,10 @@ class Item_sum_udf_float :public Item_sum_num
class Item_sum_udf_int :public Item_sum_num
{
public:
- Item_sum_udf_int(udf_func *udf_arg)
- :Item_sum_num() {}
- Item_sum_udf_int(udf_func *udf_arg, List<Item> &list) :Item_sum_num() {}
+ Item_sum_udf_int(THD *thd, udf_func *udf_arg):
+ Item_sum_num(thd) {}
+ Item_sum_udf_int(THD *thd, udf_func *udf_arg, List<Item> &list):
+ Item_sum_num(thd) {}
Item_sum_udf_int(THD *thd, Item_sum_udf_int *item)
:Item_sum_num(thd, item) {}
enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
@@ -1342,10 +1345,10 @@ public:
class Item_sum_udf_decimal :public Item_sum_num
{
public:
- Item_sum_udf_decimal(udf_func *udf_arg)
- :Item_sum_num() {}
- Item_sum_udf_decimal(udf_func *udf_arg, List<Item> &list)
- :Item_sum_num() {}
+ Item_sum_udf_decimal(THD *thd, udf_func *udf_arg):
+ Item_sum_num(thd) {}
+ Item_sum_udf_decimal(THD *thd, udf_func *udf_arg, List<Item> &list):
+ Item_sum_num(thd) {}
Item_sum_udf_decimal(THD *thd, Item_sum_udf_float *item)
:Item_sum_num(thd, item) {}
enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
@@ -1360,10 +1363,10 @@ class Item_sum_udf_decimal :public Item_sum_num
class Item_sum_udf_str :public Item_sum_num
{
public:
- Item_sum_udf_str(udf_func *udf_arg)
- :Item_sum_num() {}
- Item_sum_udf_str(udf_func *udf_arg, List<Item> &list)
- :Item_sum_num() {}
+ Item_sum_udf_str(THD *thd, udf_func *udf_arg):
+ Item_sum_num(thd) {}
+ Item_sum_udf_str(THD *thd, udf_func *udf_arg, List<Item> &list):
+ Item_sum_num(thd) {}
Item_sum_udf_str(THD *thd, Item_sum_udf_str *item)
:Item_sum_num(thd, item) {}
String *val_str(String *)
@@ -1397,6 +1400,7 @@ class Item_func_group_concat : public Item_sum
String *separator;
TREE tree_base;
TREE *tree;
+ Item **ref_pointer_array;
/**
If DISTINCT is used with this GROUP_CONCAT, this member is used to filter
@@ -1434,7 +1438,7 @@ class Item_func_group_concat : public Item_sum
void* item_arg);
public:
- Item_func_group_concat(Name_resolution_context *context_arg,
+ Item_func_group_concat(THD *thd, Name_resolution_context *context_arg,
bool is_distinct, List<Item> *is_select,
const SQL_I_List<ORDER> &is_order, String *is_separator);
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index d82e4aabb35..2faf7a7d347 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -426,7 +426,8 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
{
if (!my_isspace(&my_charset_latin1,*val))
{
- make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ make_truncated_value_warning(current_thd,
+ Sql_condition::WARN_LEVEL_WARN,
val_begin, length,
cached_timestamp_type, NullS);
break;
@@ -437,10 +438,12 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
err:
{
+ THD *thd= current_thd;
char buff[128];
strmake(buff, val_begin, MY_MIN(length, sizeof(buff)-1));
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_WRONG_VALUE_FOR_TYPE, ER(ER_WRONG_VALUE_FOR_TYPE),
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WRONG_VALUE_FOR_TYPE,
+ ER_THD(thd, ER_WRONG_VALUE_FOR_TYPE),
date_time_type, buff, "str_to_date");
}
DBUG_RETURN(1);
@@ -1299,10 +1302,11 @@ bool get_interval_value(Item *args,interval_type int_type, INTERVAL *interval)
interval->neg= my_decimal2seconds(val, &second, &second_part);
if (second == LONGLONG_MAX)
{
+ THD *thd= current_thd;
ErrConvDecimal err(val);
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE,
- ER(ER_TRUNCATED_WRONG_VALUE), "DECIMAL",
+ ER_THD(thd, ER_TRUNCATED_WRONG_VALUE), "DECIMAL",
err.ptr());
return true;
}
@@ -2361,14 +2365,15 @@ void Item_char_typecast::check_truncation_with_warn(String *src, uint dstlen)
{
if (dstlen < src->length())
{
+ THD *thd= current_thd;
char char_type[40];
+ ErrConvString err(src);
my_snprintf(char_type, sizeof(char_type), "%s(%lu)",
cast_cs == &my_charset_bin ? "BINARY" : "CHAR",
(ulong) cast_length);
- ErrConvString err(src);
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE,
- ER(ER_TRUNCATED_WRONG_VALUE), char_type,
+ ER_THD(thd, ER_TRUNCATED_WRONG_VALUE), char_type,
err.ptr());
}
}
@@ -2404,13 +2409,15 @@ uint Item_char_typecast::adjusted_length_with_warn(uint length)
{
if (length <= current_thd->variables.max_allowed_packet)
return length;
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+
+ THD *thd= current_thd;
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
- ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
+ ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED),
cast_cs == &my_charset_bin ?
"cast_as_binary" : func_name(),
- current_thd->variables.max_allowed_packet);
- return current_thd->variables.max_allowed_packet;
+ thd->variables.max_allowed_packet);
+ return thd->variables.max_allowed_packet;
}
@@ -2749,8 +2756,6 @@ void Item_func_add_time::print(String *str, enum_query_type query_type)
bool Item_func_timediff::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
{
DBUG_ASSERT(fixed == 1);
- longlong seconds;
- long microseconds;
int l_sign= 1;
MYSQL_TIME l_time1,l_time2,l_time3;
ErrConvTime str(&l_time3);
@@ -2767,31 +2772,7 @@ bool Item_func_timediff::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
if (l_time1.neg != l_time2.neg)
l_sign= -l_sign;
- bzero((char *)&l_time3, sizeof(l_time3));
-
- l_time3.neg= calc_time_diff(&l_time1, &l_time2, l_sign,
- &seconds, &microseconds);
-
- /*
- For MYSQL_TIMESTAMP_TIME only:
- If first argument was negative and diff between arguments
- is non-zero we need to swap sign to get proper result.
- */
- if (l_time1.neg && (seconds || microseconds))
- l_time3.neg= 1-l_time3.neg; // Swap sign of result
-
- /*
- seconds is longlong, when casted to long it may become a small number
- even if the original seconds value was too large and invalid.
- as a workaround we limit seconds by a large invalid long number
- ("invalid" means > TIME_MAX_SECOND)
- */
- set_if_smaller(seconds, INT_MAX32);
-
- calc_time_from_sec(&l_time3, (long) seconds, microseconds);
-
- if ((fuzzy_date & TIME_NO_ZERO_DATE) && (seconds == 0) &&
- (microseconds == 0))
+ if (calc_time_diff(&l_time1, &l_time2, l_sign, &l_time3, fuzzy_date))
return (null_value= 1);
*ltime= l_time3;
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index e7a37ed7bb1..edc77038f89 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -46,7 +46,7 @@ bool get_interval_value(Item *args,interval_type int_type, INTERVAL *interval);
class Item_func_period_add :public Item_int_func
{
public:
- Item_func_period_add(Item *a,Item *b) :Item_int_func(a,b) {}
+ Item_func_period_add(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
longlong val_int();
const char *func_name() const { return "period_add"; }
void fix_length_and_dec()
@@ -59,7 +59,7 @@ public:
class Item_func_period_diff :public Item_int_func
{
public:
- Item_func_period_diff(Item *a,Item *b) :Item_int_func(a,b) {}
+ Item_func_period_diff(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
longlong val_int();
const char *func_name() const { return "period_diff"; }
void fix_length_and_dec()
@@ -73,7 +73,7 @@ public:
class Item_func_to_days :public Item_int_func
{
public:
- Item_func_to_days(Item *a) :Item_int_func(a) {}
+ Item_func_to_days(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "to_days"; }
void fix_length_and_dec()
@@ -96,7 +96,7 @@ public:
class Item_func_to_seconds :public Item_int_func
{
public:
- Item_func_to_seconds(Item *a) :Item_int_func(a) {}
+ Item_func_to_seconds(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "to_seconds"; }
void fix_length_and_dec()
@@ -129,7 +129,7 @@ public:
class Item_func_dayofmonth :public Item_int_func
{
public:
- Item_func_dayofmonth(Item *a) :Item_int_func(a) {}
+ Item_func_dayofmonth(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "dayofmonth"; }
void fix_length_and_dec()
@@ -150,7 +150,8 @@ public:
class Item_func_month :public Item_func
{
public:
- Item_func_month(Item *a) :Item_func(a) { collation.set_numeric(); }
+ Item_func_month(THD *thd, Item *a): Item_func(thd, a)
+ { collation.set_numeric(); }
longlong val_int();
double val_real()
{ DBUG_ASSERT(fixed == 1); return (double) Item_func_month::val_int(); }
@@ -183,7 +184,7 @@ class Item_func_monthname :public Item_str_func
{
MY_LOCALE *locale;
public:
- Item_func_monthname(Item *a) :Item_str_func(a) {}
+ Item_func_monthname(THD *thd, Item *a): Item_str_func(thd, a) {}
const char *func_name() const { return "monthname"; }
String *val_str(String *str);
void fix_length_and_dec();
@@ -199,7 +200,7 @@ public:
class Item_func_dayofyear :public Item_int_func
{
public:
- Item_func_dayofyear(Item *a) :Item_int_func(a) {}
+ Item_func_dayofyear(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "dayofyear"; }
void fix_length_and_dec()
@@ -220,7 +221,7 @@ public:
class Item_func_hour :public Item_int_func
{
public:
- Item_func_hour(Item *a) :Item_int_func(a) {}
+ Item_func_hour(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "hour"; }
void fix_length_and_dec()
@@ -241,7 +242,7 @@ public:
class Item_func_minute :public Item_int_func
{
public:
- Item_func_minute(Item *a) :Item_int_func(a) {}
+ Item_func_minute(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "minute"; }
void fix_length_and_dec()
@@ -262,7 +263,7 @@ public:
class Item_func_quarter :public Item_int_func
{
public:
- Item_func_quarter(Item *a) :Item_int_func(a) {}
+ Item_func_quarter(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "quarter"; }
void fix_length_and_dec()
@@ -283,7 +284,7 @@ public:
class Item_func_second :public Item_int_func
{
public:
- Item_func_second(Item *a) :Item_int_func(a) {}
+ Item_func_second(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "second"; }
void fix_length_and_dec()
@@ -304,7 +305,7 @@ public:
class Item_func_week :public Item_int_func
{
public:
- Item_func_week(Item *a,Item *b) :Item_int_func(a,b) {}
+ Item_func_week(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
longlong val_int();
const char *func_name() const { return "week"; }
void fix_length_and_dec()
@@ -318,7 +319,7 @@ public:
class Item_func_yearweek :public Item_int_func
{
public:
- Item_func_yearweek(Item *a,Item *b) :Item_int_func(a,b) {}
+ Item_func_yearweek(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
longlong val_int();
const char *func_name() const { return "yearweek"; }
void fix_length_and_dec()
@@ -339,7 +340,7 @@ public:
class Item_func_year :public Item_int_func
{
public:
- Item_func_year(Item *a) :Item_int_func(a) {}
+ Item_func_year(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "year"; }
enum_monotonicity_info get_monotonicity_info() const;
@@ -363,8 +364,8 @@ class Item_func_weekday :public Item_func
{
bool odbc_type;
public:
- Item_func_weekday(Item *a,bool type_arg)
- :Item_func(a), odbc_type(type_arg) { collation.set_numeric(); }
+ Item_func_weekday(THD *thd, Item *a, bool type_arg):
+ Item_func(thd, a), odbc_type(type_arg) { collation.set_numeric(); }
longlong val_int();
double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
String *val_str(String *str)
@@ -396,7 +397,7 @@ class Item_func_dayname :public Item_func_weekday
{
MY_LOCALE *locale;
public:
- Item_func_dayname(Item *a) :Item_func_weekday(a,0) {}
+ Item_func_dayname(THD *thd, Item *a): Item_func_weekday(thd, a, 0) {}
const char *func_name() const { return "dayname"; }
String *val_str(String *str);
enum Item_result result_type () const { return STRING_RESULT; }
@@ -411,8 +412,8 @@ class Item_func_seconds_hybrid: public Item_func_numhybrid
protected:
virtual enum_field_types arg0_expected_type() const = 0;
public:
- Item_func_seconds_hybrid() :Item_func_numhybrid() {}
- Item_func_seconds_hybrid(Item *a) :Item_func_numhybrid(a) {}
+ Item_func_seconds_hybrid(THD *thd): Item_func_numhybrid(thd) {}
+ Item_func_seconds_hybrid(THD *thd, Item *a): Item_func_numhybrid(thd, a) {}
void fix_length_and_dec()
{
if (arg_count)
@@ -434,8 +435,9 @@ class Item_func_unix_timestamp :public Item_func_seconds_hybrid
protected:
enum_field_types arg0_expected_type() const { return MYSQL_TYPE_DATETIME; }
public:
- Item_func_unix_timestamp() :Item_func_seconds_hybrid() {}
- Item_func_unix_timestamp(Item *a) :Item_func_seconds_hybrid(a) {}
+ Item_func_unix_timestamp(THD *thd): Item_func_seconds_hybrid(thd) {}
+ Item_func_unix_timestamp(THD *thd, Item *a):
+ Item_func_seconds_hybrid(thd, a) {}
const char *func_name() const { return "unix_timestamp"; }
enum_monotonicity_info get_monotonicity_info() const;
longlong val_int_endpoint(bool left_endp, bool *incl_endp);
@@ -467,7 +469,8 @@ class Item_func_time_to_sec :public Item_func_seconds_hybrid
protected:
enum_field_types arg0_expected_type() const { return MYSQL_TYPE_TIME; }
public:
- Item_func_time_to_sec(Item *item) :Item_func_seconds_hybrid(item) {}
+ Item_func_time_to_sec(THD *thd, Item *item):
+ Item_func_seconds_hybrid(thd, item) {}
const char *func_name() const { return "time_to_sec"; }
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_vcol_func_processor(uchar *int_arg) { return FALSE;}
@@ -484,10 +487,10 @@ class Item_temporal_func: public Item_func
{
ulonglong sql_mode;
public:
- Item_temporal_func() :Item_func() {}
- Item_temporal_func(Item *a) :Item_func(a) {}
- Item_temporal_func(Item *a, Item *b) :Item_func(a,b) {}
- Item_temporal_func(Item *a, Item *b, Item *c) :Item_func(a,b,c) {}
+ Item_temporal_func(THD *thd): Item_func(thd) {}
+ Item_temporal_func(THD *thd, Item *a): Item_func(thd, a) {}
+ Item_temporal_func(THD *thd, Item *a, Item *b): Item_func(thd, a, b) {}
+ Item_temporal_func(THD *thd, Item *a, Item *b, Item *c): Item_func(thd, a, b, c) {}
enum Item_result result_type () const { return STRING_RESULT; }
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
Item_result cmp_type() const { return TIME_RESULT; }
@@ -515,8 +518,8 @@ protected:
enum_field_types cached_field_type; // TIME, DATE, DATETIME or STRING
String ascii_buf; // Conversion buffer
public:
- Item_temporal_hybrid_func(Item *a,Item *b)
- :Item_temporal_func(a,b) {}
+ Item_temporal_hybrid_func(THD *thd, Item *a, Item *b):
+ Item_temporal_func(thd, a, b) {}
enum_field_types field_type() const { return cached_field_type; }
Item_result cmp_type() const
{
@@ -557,8 +560,8 @@ public:
class Item_datefunc :public Item_temporal_func
{
public:
- Item_datefunc() :Item_temporal_func() { }
- Item_datefunc(Item *a) :Item_temporal_func(a) { }
+ Item_datefunc(THD *thd): Item_temporal_func(thd) { }
+ Item_datefunc(THD *thd, Item *a): Item_temporal_func(thd, a) { }
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
};
@@ -566,10 +569,11 @@ public:
class Item_timefunc :public Item_temporal_func
{
public:
- Item_timefunc() :Item_temporal_func() {}
- Item_timefunc(Item *a) :Item_temporal_func(a) {}
- Item_timefunc(Item *a,Item *b) :Item_temporal_func(a,b) {}
- Item_timefunc(Item *a, Item *b, Item *c) :Item_temporal_func(a, b ,c) {}
+ Item_timefunc(THD *thd): Item_temporal_func(thd) {}
+ Item_timefunc(THD *thd, Item *a): Item_temporal_func(thd, a) {}
+ Item_timefunc(THD *thd, Item *a, Item *b): Item_temporal_func(thd, a, b) {}
+ Item_timefunc(THD *thd, Item *a, Item *b, Item *c):
+ Item_temporal_func(thd, a, b ,c) {}
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
};
@@ -580,7 +584,7 @@ class Item_func_curtime :public Item_timefunc
{
MYSQL_TIME ltime;
public:
- Item_func_curtime(uint dec) :Item_timefunc() { decimals= dec; }
+ Item_func_curtime(THD *thd, uint dec): Item_timefunc(thd) { decimals= dec; }
bool fix_fields(THD *, Item **);
void fix_length_and_dec()
{
@@ -605,7 +609,7 @@ public:
class Item_func_curtime_local :public Item_func_curtime
{
public:
- Item_func_curtime_local(uint dec) :Item_func_curtime(dec) {}
+ Item_func_curtime_local(THD *thd, uint dec): Item_func_curtime(thd, dec) {}
const char *func_name() const { return "curtime"; }
virtual void store_now_in_TIME(MYSQL_TIME *now_time);
};
@@ -614,7 +618,7 @@ public:
class Item_func_curtime_utc :public Item_func_curtime
{
public:
- Item_func_curtime_utc(uint dec) :Item_func_curtime(dec) {}
+ Item_func_curtime_utc(THD *thd, uint dec): Item_func_curtime(thd, dec) {}
const char *func_name() const { return "utc_time"; }
virtual void store_now_in_TIME(MYSQL_TIME *now_time);
};
@@ -626,7 +630,7 @@ class Item_func_curdate :public Item_datefunc
{
MYSQL_TIME ltime;
public:
- Item_func_curdate() :Item_datefunc() {}
+ Item_func_curdate(THD *thd): Item_datefunc(thd) {}
void fix_length_and_dec();
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
virtual void store_now_in_TIME(MYSQL_TIME *now_time)=0;
@@ -640,7 +644,7 @@ public:
class Item_func_curdate_local :public Item_func_curdate
{
public:
- Item_func_curdate_local() :Item_func_curdate() {}
+ Item_func_curdate_local(THD *thd): Item_func_curdate(thd) {}
const char *func_name() const { return "curdate"; }
void store_now_in_TIME(MYSQL_TIME *now_time);
};
@@ -649,7 +653,7 @@ public:
class Item_func_curdate_utc :public Item_func_curdate
{
public:
- Item_func_curdate_utc() :Item_func_curdate() {}
+ Item_func_curdate_utc(THD *thd): Item_func_curdate(thd) {}
const char *func_name() const { return "utc_date"; }
void store_now_in_TIME(MYSQL_TIME *now_time);
};
@@ -662,7 +666,7 @@ class Item_func_now :public Item_temporal_func
{
MYSQL_TIME ltime;
public:
- Item_func_now(uint dec) :Item_temporal_func() { decimals= dec; }
+ Item_func_now(THD *thd, uint dec): Item_temporal_func(thd) { decimals= dec; }
bool fix_fields(THD *, Item **);
void fix_length_and_dec()
{
@@ -682,7 +686,7 @@ public:
class Item_func_now_local :public Item_func_now
{
public:
- Item_func_now_local(uint dec) :Item_func_now(dec) {}
+ Item_func_now_local(THD *thd, uint dec): Item_func_now(thd, dec) {}
const char *func_name() const { return "now"; }
virtual void store_now_in_TIME(MYSQL_TIME *now_time);
virtual enum Functype functype() const { return NOW_FUNC; }
@@ -692,7 +696,7 @@ public:
class Item_func_now_utc :public Item_func_now
{
public:
- Item_func_now_utc(uint dec) :Item_func_now(dec) {}
+ Item_func_now_utc(THD *thd, uint dec): Item_func_now(thd, dec) {}
const char *func_name() const { return "utc_timestamp"; }
virtual void store_now_in_TIME(MYSQL_TIME *now_time);
};
@@ -705,7 +709,7 @@ public:
class Item_func_sysdate_local :public Item_func_now
{
public:
- Item_func_sysdate_local(uint dec) :Item_func_now(dec) {}
+ Item_func_sysdate_local(THD *thd, uint dec): Item_func_now(thd, dec) {}
bool const_item() const { return 0; }
const char *func_name() const { return "sysdate"; }
void store_now_in_TIME(MYSQL_TIME *now_time);
@@ -722,7 +726,7 @@ public:
class Item_func_from_days :public Item_datefunc
{
public:
- Item_func_from_days(Item *a) :Item_datefunc(a) {}
+ Item_func_from_days(THD *thd, Item *a): Item_datefunc(thd, a) {}
const char *func_name() const { return "from_days"; }
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
@@ -741,8 +745,8 @@ class Item_func_date_format :public Item_str_func
const bool is_time_format;
String value;
public:
- Item_func_date_format(Item *a,Item *b,bool is_time_format_arg)
- :Item_str_func(a,b),is_time_format(is_time_format_arg) {}
+ Item_func_date_format(THD *thd, Item *a, Item *b, bool is_time_format_arg):
+ Item_str_func(thd, a, b), is_time_format(is_time_format_arg) {}
String *val_str(String *str);
const char *func_name() const
{ return is_time_format ? "time_format" : "date_format"; }
@@ -756,7 +760,7 @@ class Item_func_from_unixtime :public Item_temporal_func
{
Time_zone *tz;
public:
- Item_func_from_unixtime(Item *a) :Item_temporal_func(a) {}
+ Item_func_from_unixtime(THD *thd, Item *a): Item_temporal_func(thd, a) {}
const char *func_name() const { return "from_unixtime"; }
void fix_length_and_dec();
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
@@ -788,8 +792,8 @@ class Item_func_convert_tz :public Item_temporal_func
bool from_tz_cached, to_tz_cached;
Time_zone *from_tz, *to_tz;
public:
- Item_func_convert_tz(Item *a, Item *b, Item *c):
- Item_temporal_func(a, b, c), from_tz_cached(0), to_tz_cached(0) {}
+ Item_func_convert_tz(THD *thd, Item *a, Item *b, Item *c):
+ Item_temporal_func(thd, a, b, c), from_tz_cached(0), to_tz_cached(0) {}
const char *func_name() const { return "convert_tz"; }
void fix_length_and_dec();
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
@@ -800,7 +804,7 @@ class Item_func_convert_tz :public Item_temporal_func
class Item_func_sec_to_time :public Item_timefunc
{
public:
- Item_func_sec_to_time(Item *item) :Item_timefunc(item) {}
+ Item_func_sec_to_time(THD *thd, Item *item): Item_timefunc(thd, item) {}
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
void fix_length_and_dec()
{
@@ -816,8 +820,10 @@ class Item_date_add_interval :public Item_temporal_hybrid_func
public:
const interval_type int_type; // keep it public
const bool date_sub_interval; // keep it public
- Item_date_add_interval(Item *a,Item *b,interval_type type_arg,bool neg_arg)
- :Item_temporal_hybrid_func(a,b),int_type(type_arg), date_sub_interval(neg_arg) {}
+ Item_date_add_interval(THD *thd, Item *a, Item *b, interval_type type_arg,
+ bool neg_arg):
+ Item_temporal_hybrid_func(thd, a, b),int_type(type_arg),
+ date_sub_interval(neg_arg) {}
const char *func_name() const { return "date_add_interval"; }
void fix_length_and_dec();
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
@@ -831,8 +837,8 @@ class Item_extract :public Item_int_func
bool date_value;
public:
const interval_type int_type; // keep it public
- Item_extract(interval_type type_arg, Item *a)
- :Item_int_func(a), int_type(type_arg) {}
+ Item_extract(THD *thd, interval_type type_arg, Item *a):
+ Item_int_func(thd, a), int_type(type_arg) {}
longlong val_int();
enum Functype functype() const { return EXTRACT_FUNC; }
const char *func_name() const { return "extract"; }
@@ -892,8 +898,8 @@ class Item_char_typecast :public Item_str_func
uint adjusted_length_with_warn(uint length);
void check_truncation_with_warn(String *src, uint dstlen);
public:
- Item_char_typecast(Item *a, uint length_arg, CHARSET_INFO *cs_arg)
- :Item_str_func(a), cast_length(length_arg), cast_cs(cs_arg) {}
+ Item_char_typecast(THD *thd, Item *a, uint length_arg, CHARSET_INFO *cs_arg):
+ Item_str_func(thd, a), cast_length(length_arg), cast_cs(cs_arg) {}
enum Functype functype() const { return CHAR_TYPECAST_FUNC; }
bool eq(const Item *item, bool binary_cmp) const;
const char *func_name() const { return "cast_as_char"; }
@@ -906,7 +912,7 @@ public:
class Item_temporal_typecast: public Item_temporal_func
{
public:
- Item_temporal_typecast(Item *a) :Item_temporal_func(a) {}
+ Item_temporal_typecast(THD *thd, Item *a): Item_temporal_func(thd, a) {}
virtual const char *cast_type() const = 0;
void print(String *str, enum_query_type query_type);
void fix_length_and_dec()
@@ -920,7 +926,7 @@ public:
class Item_date_typecast :public Item_temporal_typecast
{
public:
- Item_date_typecast(Item *a) :Item_temporal_typecast(a) {}
+ Item_date_typecast(THD *thd, Item *a): Item_temporal_typecast(thd, a) {}
const char *func_name() const { return "cast_as_date"; }
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date);
const char *cast_type() const { return "date"; }
@@ -931,8 +937,8 @@ public:
class Item_time_typecast :public Item_temporal_typecast
{
public:
- Item_time_typecast(Item *a, uint dec_arg)
- :Item_temporal_typecast(a) { decimals= dec_arg; }
+ Item_time_typecast(THD *thd, Item *a, uint dec_arg):
+ Item_temporal_typecast(thd, a) { decimals= dec_arg; }
const char *func_name() const { return "cast_as_time"; }
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date);
const char *cast_type() const { return "time"; }
@@ -943,8 +949,8 @@ public:
class Item_datetime_typecast :public Item_temporal_typecast
{
public:
- Item_datetime_typecast(Item *a, uint dec_arg)
- :Item_temporal_typecast(a) { decimals= dec_arg; }
+ Item_datetime_typecast(THD *thd, Item *a, uint dec_arg):
+ Item_temporal_typecast(thd, a) { decimals= dec_arg; }
const char *func_name() const { return "cast_as_datetime"; }
const char *cast_type() const { return "datetime"; }
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
@@ -955,7 +961,8 @@ public:
class Item_func_makedate :public Item_temporal_func
{
public:
- Item_func_makedate(Item *a,Item *b) :Item_temporal_func(a,b) {}
+ Item_func_makedate(THD *thd, Item *a, Item *b):
+ Item_temporal_func(thd, a, b) {}
const char *func_name() const { return "makedate"; }
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date);
@@ -968,8 +975,9 @@ class Item_func_add_time :public Item_temporal_hybrid_func
int sign;
public:
- Item_func_add_time(Item *a, Item *b, bool type_arg, bool neg_arg)
- :Item_temporal_hybrid_func(a, b), is_date(type_arg) { sign= neg_arg ? -1 : 1; }
+ Item_func_add_time(THD *thd, Item *a, Item *b, bool type_arg, bool neg_arg):
+ Item_temporal_hybrid_func(thd, a, b), is_date(type_arg)
+ { sign= neg_arg ? -1 : 1; }
void fix_length_and_dec();
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date);
void print(String *str, enum_query_type query_type);
@@ -979,8 +987,7 @@ public:
class Item_func_timediff :public Item_timefunc
{
public:
- Item_func_timediff(Item *a, Item *b)
- :Item_timefunc(a, b) {}
+ Item_func_timediff(THD *thd, Item *a, Item *b): Item_timefunc(thd, a, b) {}
const char *func_name() const { return "timediff"; }
void fix_length_and_dec()
{
@@ -994,8 +1001,8 @@ public:
class Item_func_maketime :public Item_timefunc
{
public:
- Item_func_maketime(Item *a, Item *b, Item *c)
- :Item_timefunc(a, b, c)
+ Item_func_maketime(THD *thd, Item *a, Item *b, Item *c):
+ Item_timefunc(thd, a, b, c)
{}
void fix_length_and_dec()
{
@@ -1010,7 +1017,7 @@ public:
class Item_func_microsecond :public Item_int_func
{
public:
- Item_func_microsecond(Item *a) :Item_int_func(a) {}
+ Item_func_microsecond(THD *thd, Item *a): Item_int_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "microsecond"; }
void fix_length_and_dec()
@@ -1031,8 +1038,8 @@ class Item_func_timestamp_diff :public Item_int_func
{
const interval_type int_type;
public:
- Item_func_timestamp_diff(Item *a,Item *b,interval_type type_arg)
- :Item_int_func(a,b), int_type(type_arg) {}
+ Item_func_timestamp_diff(THD *thd, Item *a, Item *b, interval_type type_arg):
+ Item_int_func(thd, a, b), int_type(type_arg) {}
const char *func_name() const { return "timestampdiff"; }
longlong val_int();
void fix_length_and_dec()
@@ -1053,8 +1060,8 @@ class Item_func_get_format :public Item_str_ascii_func
{
public:
const timestamp_type type; // keep it public
- Item_func_get_format(timestamp_type type_arg, Item *a)
- :Item_str_ascii_func(a), type(type_arg)
+ Item_func_get_format(THD *thd, timestamp_type type_arg, Item *a):
+ Item_str_ascii_func(thd, a), type(type_arg)
{}
String *val_str_ascii(String *str);
const char *func_name() const { return "get_format"; }
@@ -1076,8 +1083,8 @@ class Item_func_str_to_date :public Item_temporal_hybrid_func
String format_converter;
CHARSET_INFO *internal_charset;
public:
- Item_func_str_to_date(Item *a, Item *b)
- :Item_temporal_hybrid_func(a, b), const_item(false),
+ Item_func_str_to_date(THD *thd, Item *a, Item *b):
+ Item_temporal_hybrid_func(thd, a, b), const_item(false),
internal_charset(NULL)
{}
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date);
@@ -1089,7 +1096,7 @@ public:
class Item_func_last_day :public Item_datefunc
{
public:
- Item_func_last_day(Item *a) :Item_datefunc(a) {}
+ Item_func_last_day(THD *thd, Item *a): Item_datefunc(thd, a) {}
const char *func_name() const { return "last_day"; }
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
};
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc
index 24441cd80e8..c1140946e87 100644
--- a/sql/item_xmlfunc.cc
+++ b/sql/item_xmlfunc.cc
@@ -99,6 +99,7 @@ typedef struct my_xpath_function_names_st
/* XPath query parser */
typedef struct my_xpath_st
{
+ THD *thd;
int debug;
MY_XPATH_LEX query; /* Whole query */
MY_XPATH_LEX lasttok; /* last scanned token */
@@ -166,13 +167,14 @@ protected:
public:
String *pxml;
String context_cache;
- Item_nodeset_func(String *pxml_arg) :Item_str_func(), pxml(pxml_arg) {}
- Item_nodeset_func(Item *a, String *pxml_arg)
- :Item_str_func(a), pxml(pxml_arg) {}
- Item_nodeset_func(Item *a, Item *b, String *pxml_arg)
- :Item_str_func(a, b), pxml(pxml_arg) {}
- Item_nodeset_func(Item *a, Item *b, Item *c, String *pxml_arg)
- :Item_str_func(a,b,c), pxml(pxml_arg) {}
+ Item_nodeset_func(THD *thd, String *pxml_arg):
+ Item_str_func(thd), pxml(pxml_arg) {}
+ Item_nodeset_func(THD *thd, Item *a, String *pxml_arg):
+ Item_str_func(thd, a), pxml(pxml_arg) {}
+ Item_nodeset_func(THD *thd, Item *a, Item *b, String *pxml_arg):
+ Item_str_func(thd, a, b), pxml(pxml_arg) {}
+ Item_nodeset_func(THD *thd, Item *a, Item *b, Item *c, String *pxml_arg):
+ Item_str_func(thd, a, b, c), pxml(pxml_arg) {}
void prepare_nodes()
{
nodebeg= (MY_XML_NODE*) pxml->ptr();
@@ -244,7 +246,8 @@ public:
class Item_nodeset_func_rootelement :public Item_nodeset_func
{
public:
- Item_nodeset_func_rootelement(String *pxml): Item_nodeset_func(pxml) {}
+ Item_nodeset_func_rootelement(THD *thd, String *pxml):
+ Item_nodeset_func(thd, pxml) {}
const char *func_name() const { return "xpath_rootelement"; }
String *val_nodeset(String *nodeset);
};
@@ -254,8 +257,8 @@ public:
class Item_nodeset_func_union :public Item_nodeset_func
{
public:
- Item_nodeset_func_union(Item *a, Item *b, String *pxml)
- :Item_nodeset_func(a, b, pxml) {}
+ Item_nodeset_func_union(THD *thd, Item *a, Item *b, String *pxml):
+ Item_nodeset_func(thd, a, b, pxml) {}
const char *func_name() const { return "xpath_union"; }
String *val_nodeset(String *nodeset);
};
@@ -267,9 +270,9 @@ class Item_nodeset_func_axisbyname :public Item_nodeset_func
const char *node_name;
uint node_namelen;
public:
- Item_nodeset_func_axisbyname(Item *a, const char *n_arg, uint l_arg,
- String *pxml):
- Item_nodeset_func(a, pxml), node_name(n_arg), node_namelen(l_arg) { }
+ Item_nodeset_func_axisbyname(THD *thd, Item *a, const char *n_arg, uint l_arg,
+ String *pxml):
+ Item_nodeset_func(thd, a, pxml), node_name(n_arg), node_namelen(l_arg) { }
const char *func_name() const { return "xpath_axisbyname"; }
bool validname(MY_XML_NODE *n)
{
@@ -285,9 +288,9 @@ public:
class Item_nodeset_func_selfbyname: public Item_nodeset_func_axisbyname
{
public:
- Item_nodeset_func_selfbyname(Item *a, const char *n_arg, uint l_arg,
- String *pxml):
- Item_nodeset_func_axisbyname(a, n_arg, l_arg, pxml) {}
+ Item_nodeset_func_selfbyname(THD *thd, Item *a, const char *n_arg, uint l_arg,
+ String *pxml):
+ Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml) {}
const char *func_name() const { return "xpath_selfbyname"; }
String *val_nodeset(String *nodeset);
};
@@ -297,9 +300,9 @@ public:
class Item_nodeset_func_childbyname: public Item_nodeset_func_axisbyname
{
public:
- Item_nodeset_func_childbyname(Item *a, const char *n_arg, uint l_arg,
+ Item_nodeset_func_childbyname(THD *thd, Item *a, const char *n_arg, uint l_arg,
String *pxml):
- Item_nodeset_func_axisbyname(a, n_arg, l_arg, pxml) {}
+ Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml) {}
const char *func_name() const { return "xpath_childbyname"; }
String *val_nodeset(String *nodeset);
};
@@ -310,9 +313,9 @@ class Item_nodeset_func_descendantbyname: public Item_nodeset_func_axisbyname
{
bool need_self;
public:
- Item_nodeset_func_descendantbyname(Item *a, const char *n_arg, uint l_arg,
- String *pxml, bool need_self_arg):
- Item_nodeset_func_axisbyname(a, n_arg, l_arg, pxml),
+ Item_nodeset_func_descendantbyname(THD *thd, Item *a, const char *n_arg, uint l_arg,
+ String *pxml, bool need_self_arg):
+ Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml),
need_self(need_self_arg) {}
const char *func_name() const { return "xpath_descendantbyname"; }
String *val_nodeset(String *nodeset);
@@ -324,9 +327,9 @@ class Item_nodeset_func_ancestorbyname: public Item_nodeset_func_axisbyname
{
bool need_self;
public:
- Item_nodeset_func_ancestorbyname(Item *a, const char *n_arg, uint l_arg,
- String *pxml, bool need_self_arg):
- Item_nodeset_func_axisbyname(a, n_arg, l_arg, pxml),
+ Item_nodeset_func_ancestorbyname(THD *thd, Item *a, const char *n_arg, uint l_arg,
+ String *pxml, bool need_self_arg):
+ Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml),
need_self(need_self_arg) {}
const char *func_name() const { return "xpath_ancestorbyname"; }
String *val_nodeset(String *nodeset);
@@ -337,9 +340,9 @@ public:
class Item_nodeset_func_parentbyname: public Item_nodeset_func_axisbyname
{
public:
- Item_nodeset_func_parentbyname(Item *a, const char *n_arg, uint l_arg,
- String *pxml):
- Item_nodeset_func_axisbyname(a, n_arg, l_arg, pxml) {}
+ Item_nodeset_func_parentbyname(THD *thd, Item *a, const char *n_arg, uint l_arg,
+ String *pxml):
+ Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml) {}
const char *func_name() const { return "xpath_parentbyname"; }
String *val_nodeset(String *nodeset);
};
@@ -349,9 +352,9 @@ public:
class Item_nodeset_func_attributebyname: public Item_nodeset_func_axisbyname
{
public:
- Item_nodeset_func_attributebyname(Item *a, const char *n_arg, uint l_arg,
- String *pxml):
- Item_nodeset_func_axisbyname(a, n_arg, l_arg, pxml) {}
+ Item_nodeset_func_attributebyname(THD *thd, Item *a, const char *n_arg,
+ uint l_arg, String *pxml):
+ Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml) {}
const char *func_name() const { return "xpath_attributebyname"; }
String *val_nodeset(String *nodeset);
};
@@ -365,8 +368,8 @@ public:
class Item_nodeset_func_predicate :public Item_nodeset_func
{
public:
- Item_nodeset_func_predicate(Item *a, Item *b, String *pxml):
- Item_nodeset_func(a, b, pxml) {}
+ Item_nodeset_func_predicate(THD *thd, Item *a, Item *b, String *pxml):
+ Item_nodeset_func(thd, a, b, pxml) {}
const char *func_name() const { return "xpath_predicate"; }
String *val_nodeset(String *nodeset);
};
@@ -376,8 +379,8 @@ public:
class Item_nodeset_func_elementbyindex :public Item_nodeset_func
{
public:
- Item_nodeset_func_elementbyindex(Item *a, Item *b, String *pxml):
- Item_nodeset_func(a, b, pxml) { }
+ Item_nodeset_func_elementbyindex(THD *thd, Item *a, Item *b, String *pxml):
+ Item_nodeset_func(thd, a, b, pxml) { }
const char *func_name() const { return "xpath_elementbyindex"; }
String *val_nodeset(String *nodeset);
};
@@ -390,7 +393,7 @@ public:
class Item_bool :public Item_int
{
public:
- Item_bool(int32 i): Item_int(i) {}
+ Item_bool(THD *thd, int32 i): Item_int(thd, i) {}
const char *func_name() const { return "xpath_bool"; }
bool is_bool_type() { return true; }
};
@@ -407,8 +410,8 @@ class Item_xpath_cast_bool :public Item_bool_func
String *pxml;
String tmp_value;
public:
- Item_xpath_cast_bool(Item *a, String *pxml_arg)
- :Item_bool_func(a), pxml(pxml_arg) {}
+ Item_xpath_cast_bool(THD *thd, Item *a, String *pxml_arg):
+ Item_bool_func(thd, a), pxml(pxml_arg) {}
const char *func_name() const { return "xpath_cast_bool"; }
longlong val_int()
{
@@ -428,7 +431,7 @@ public:
class Item_xpath_cast_number :public Item_real_func
{
public:
- Item_xpath_cast_number(Item *a): Item_real_func(a) {}
+ Item_xpath_cast_number(THD *thd, Item *a): Item_real_func(thd, a) {}
const char *func_name() const { return "xpath_cast_number"; }
virtual double val_real() { return args[0]->val_real(); }
};
@@ -441,8 +444,8 @@ class Item_nodeset_context_cache :public Item_nodeset_func
{
public:
String *string_cache;
- Item_nodeset_context_cache(String *str_arg, String *pxml):
- Item_nodeset_func(pxml), string_cache(str_arg) { }
+ Item_nodeset_context_cache(THD *thd, String *str_arg, String *pxml):
+ Item_nodeset_func(thd, pxml), string_cache(str_arg) { }
String *val_nodeset(String *res)
{ return string_cache; }
void fix_length_and_dec() { max_length= MAX_BLOB_WIDTH; }
@@ -454,8 +457,8 @@ class Item_func_xpath_position :public Item_int_func
String *pxml;
String tmp_value;
public:
- Item_func_xpath_position(Item *a, String *p)
- :Item_int_func(a), pxml(p) {}
+ Item_func_xpath_position(THD *thd, Item *a, String *p):
+ Item_int_func(thd, a), pxml(p) {}
const char *func_name() const { return "xpath_position"; }
void fix_length_and_dec() { max_length=10; }
longlong val_int()
@@ -473,8 +476,8 @@ class Item_func_xpath_count :public Item_int_func
String *pxml;
String tmp_value;
public:
- Item_func_xpath_count(Item *a, String *p)
- :Item_int_func(a), pxml(p) {}
+ Item_func_xpath_count(THD *thd, Item *a, String *p):
+ Item_int_func(thd, a), pxml(p) {}
const char *func_name() const { return "xpath_count"; }
void fix_length_and_dec() { max_length=10; }
longlong val_int()
@@ -494,8 +497,8 @@ class Item_func_xpath_sum :public Item_real_func
String *pxml;
String tmp_value;
public:
- Item_func_xpath_sum(Item *a, String *p)
- :Item_real_func(a), pxml(p) {}
+ Item_func_xpath_sum(THD *thd, Item *a, String *p):
+ Item_real_func(thd, a), pxml(p) {}
const char *func_name() const { return "xpath_sum"; }
double val_real()
@@ -538,8 +541,9 @@ public:
class Item_string_xml_non_const: public Item_string
{
public:
- Item_string_xml_non_const(const char *str, uint length, CHARSET_INFO *cs)
- :Item_string(str, length, cs)
+ Item_string_xml_non_const(THD *thd, const char *str, uint length,
+ CHARSET_INFO *cs):
+ Item_string(thd, str, length, cs)
{ }
bool const_item() const { return false ; }
bool basic_const_item() const { return false; }
@@ -547,7 +551,7 @@ public:
{
str_value.set(str, length, cs);
}
- Item *safe_charset_converter(CHARSET_INFO *tocs)
+ Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
{
/*
Item_string::safe_charset_converter() does not accept non-constants.
@@ -563,8 +567,9 @@ class Item_nodeset_to_const_comparator :public Item_bool_func
String *pxml;
String tmp_nodeset;
public:
- Item_nodeset_to_const_comparator(Item *nodeset, Item *cmpfunc, String *p)
- :Item_bool_func(nodeset,cmpfunc), pxml(p) {}
+ Item_nodeset_to_const_comparator(THD *thd, Item *nodeset, Item *cmpfunc,
+ String *p):
+ Item_bool_func(thd, nodeset, cmpfunc), pxml(p) {}
enum Type type() const { return XPATH_NODESET_CMP; };
const char *func_name() const { return "xpath_nodeset_to_const_comparator"; }
bool check_vcol_func_processor(uchar *int_arg)
@@ -835,7 +840,8 @@ String *Item_nodeset_func_elementbyindex::val_nodeset(String *nodeset)
static Item* nodeset2bool(MY_XPATH *xpath, Item *item)
{
if (item->type() == Item::XPATH_NODESET)
- return new Item_xpath_cast_bool(item, xpath->pxml);
+ return new (xpath->thd->mem_root)
+ Item_xpath_cast_bool(xpath->thd, item, xpath->pxml);
return item;
}
@@ -905,16 +911,17 @@ static Item* nodeset2bool(MY_XPATH *xpath, Item *item)
RETURN
The newly created item.
*/
-static Item *eq_func(int oper, Item *a, Item *b)
+static Item *eq_func(THD *thd, int oper, Item *a, Item *b)
{
+ MEM_ROOT *mem_root= thd->mem_root;
switch (oper)
{
- case '=': return new Item_func_eq(a, b);
- case '!': return new Item_func_ne(a, b);
- case MY_XPATH_LEX_GE: return new Item_func_ge(a, b);
- case MY_XPATH_LEX_LE: return new Item_func_le(a, b);
- case MY_XPATH_LEX_GREATER: return new Item_func_gt(a, b);
- case MY_XPATH_LEX_LESS: return new Item_func_lt(a, b);
+ case '=': return new (mem_root) Item_func_eq(thd, a, b);
+ case '!': return new (mem_root) Item_func_ne(thd, a, b);
+ case MY_XPATH_LEX_GE: return new (mem_root) Item_func_ge(thd, a, b);
+ case MY_XPATH_LEX_LE: return new (mem_root) Item_func_le(thd, a, b);
+ case MY_XPATH_LEX_GREATER: return new (mem_root) Item_func_gt(thd, a, b);
+ case MY_XPATH_LEX_LESS: return new (mem_root) Item_func_lt(thd, a, b);
}
return 0;
}
@@ -932,16 +939,17 @@ static Item *eq_func(int oper, Item *a, Item *b)
RETURN
The newly created item.
*/
-static Item *eq_func_reverse(int oper, Item *a, Item *b)
+static Item *eq_func_reverse(THD *thd, int oper, Item *a, Item *b)
{
+ MEM_ROOT *mem_root= thd->mem_root;
switch (oper)
{
- case '=': return new Item_func_eq(a, b);
- case '!': return new Item_func_ne(a, b);
- case MY_XPATH_LEX_GE: return new Item_func_le(a, b);
- case MY_XPATH_LEX_LE: return new Item_func_ge(a, b);
- case MY_XPATH_LEX_GREATER: return new Item_func_lt(a, b);
- case MY_XPATH_LEX_LESS: return new Item_func_gt(a, b);
+ case '=': return new (mem_root) Item_func_eq(thd, a, b);
+ case '!': return new (mem_root) Item_func_ne(thd, a, b);
+ case MY_XPATH_LEX_GE: return new (mem_root) Item_func_le(thd, a, b);
+ case MY_XPATH_LEX_LE: return new (mem_root) Item_func_ge(thd, a, b);
+ case MY_XPATH_LEX_GREATER: return new (mem_root) Item_func_lt(thd, a, b);
+ case MY_XPATH_LEX_LESS: return new (mem_root) Item_func_gt(thd, a, b);
}
return 0;
}
@@ -964,7 +972,7 @@ static Item *create_comparator(MY_XPATH *xpath,
if (a->type() != Item::XPATH_NODESET &&
b->type() != Item::XPATH_NODESET)
{
- return eq_func(oper, a, b); // two scalar arguments
+ return eq_func(xpath->thd, oper, a, b); // two scalar arguments
}
else if (a->type() == Item::XPATH_NODESET &&
b->type() == Item::XPATH_NODESET)
@@ -987,22 +995,25 @@ static Item *create_comparator(MY_XPATH *xpath,
in a loop through all of the nodes in the node set.
*/
- Item_string *fake= new Item_string_xml_non_const("", 0, xpath->cs);
+ THD *thd= xpath->thd;
+ Item_string *fake= (new (thd->mem_root)
+ Item_string_xml_non_const(thd, "", 0, xpath->cs));
Item_nodeset_func *nodeset;
Item *scalar, *comp;
if (a->type() == Item::XPATH_NODESET)
{
nodeset= (Item_nodeset_func*) a;
scalar= b;
- comp= eq_func(oper, (Item*)fake, scalar);
+ comp= eq_func(thd, oper, (Item*)fake, scalar);
}
else
{
nodeset= (Item_nodeset_func*) b;
scalar= a;
- comp= eq_func_reverse(oper, fake, scalar);
+ comp= eq_func_reverse(thd, oper, fake, scalar);
}
- return new Item_nodeset_to_const_comparator(nodeset, comp, xpath->pxml);
+ return (new (thd->mem_root)
+ Item_nodeset_to_const_comparator(thd, nodeset, comp, xpath->pxml));
}
}
@@ -1019,6 +1030,9 @@ static Item *create_comparator(MY_XPATH *xpath,
static Item* nametestfunc(MY_XPATH *xpath,
int type, Item *arg, const char *beg, uint len)
{
+ THD *thd= xpath->thd;
+ MEM_ROOT *mem_root= thd->mem_root;
+
DBUG_ASSERT(arg != 0);
DBUG_ASSERT(arg->type() == Item::XPATH_NODESET);
DBUG_ASSERT(beg != 0);
@@ -1028,28 +1042,36 @@ static Item* nametestfunc(MY_XPATH *xpath,
switch (type)
{
case MY_XPATH_AXIS_ANCESTOR:
- res= new Item_nodeset_func_ancestorbyname(arg, beg, len, xpath->pxml, 0);
+ res= new (mem_root) Item_nodeset_func_ancestorbyname(thd, arg, beg, len,
+ xpath->pxml, 0);
break;
case MY_XPATH_AXIS_ANCESTOR_OR_SELF:
- res= new Item_nodeset_func_ancestorbyname(arg, beg, len, xpath->pxml, 1);
+ res= new (mem_root) Item_nodeset_func_ancestorbyname(thd, arg, beg, len,
+ xpath->pxml, 1);
break;
case MY_XPATH_AXIS_PARENT:
- res= new Item_nodeset_func_parentbyname(arg, beg, len, xpath->pxml);
+ res= new (mem_root) Item_nodeset_func_parentbyname(thd, arg, beg, len,
+ xpath->pxml);
break;
case MY_XPATH_AXIS_DESCENDANT:
- res= new Item_nodeset_func_descendantbyname(arg, beg, len, xpath->pxml, 0);
+ res= new (mem_root) Item_nodeset_func_descendantbyname(thd, arg, beg, len,
+ xpath->pxml, 0);
break;
case MY_XPATH_AXIS_DESCENDANT_OR_SELF:
- res= new Item_nodeset_func_descendantbyname(arg, beg, len, xpath->pxml, 1);
+ res= new (mem_root) Item_nodeset_func_descendantbyname(thd, arg, beg, len,
+ xpath->pxml, 1);
break;
case MY_XPATH_AXIS_ATTRIBUTE:
- res= new Item_nodeset_func_attributebyname(arg, beg, len, xpath->pxml);
+ res= new (mem_root) Item_nodeset_func_attributebyname(thd, arg, beg, len,
+ xpath->pxml);
break;
case MY_XPATH_AXIS_SELF:
- res= new Item_nodeset_func_selfbyname(arg, beg, len, xpath->pxml);
+ res= new (mem_root) Item_nodeset_func_selfbyname(thd, arg, beg, len,
+ xpath->pxml);
break;
default:
- res= new Item_nodeset_func_childbyname(arg, beg, len, xpath->pxml);
+ res= new (mem_root) Item_nodeset_func_childbyname(thd, arg, beg, len,
+ xpath->pxml);
}
return res;
}
@@ -1157,101 +1179,117 @@ my_xpath_keyword(MY_XPATH *x,
*/
static Item *create_func_true(MY_XPATH *xpath, Item **args, uint nargs)
-{
- return new Item_bool(1);
+{
+ return new (xpath->thd->mem_root) Item_bool(xpath->thd, 1);
}
static Item *create_func_false(MY_XPATH *xpath, Item **args, uint nargs)
-{
- return new Item_bool(0);
+{
+ return new (xpath->thd->mem_root) Item_bool(xpath->thd, 0);
}
static Item *create_func_not(MY_XPATH *xpath, Item **args, uint nargs)
-{
- return new Item_func_not(nodeset2bool(xpath, args[0]));
+{
+ return new (xpath->thd->mem_root)
+ Item_func_not(xpath->thd, nodeset2bool(xpath, args[0]));
}
static Item *create_func_ceiling(MY_XPATH *xpath, Item **args, uint nargs)
{
- return new Item_func_ceiling(args[0]);
+ return new (xpath->thd->mem_root) Item_func_ceiling(xpath->thd, args[0]);
}
static Item *create_func_floor(MY_XPATH *xpath, Item **args, uint nargs)
{
- return new Item_func_floor(args[0]);
+ return new (xpath->thd->mem_root) Item_func_floor(xpath->thd, args[0]);
}
static Item *create_func_bool(MY_XPATH *xpath, Item **args, uint nargs)
{
- return new Item_xpath_cast_bool(args[0], xpath->pxml);
+ return new (xpath->thd->mem_root)
+ Item_xpath_cast_bool(xpath->thd, args[0], xpath->pxml);
}
static Item *create_func_number(MY_XPATH *xpath, Item **args, uint nargs)
{
- return new Item_xpath_cast_number(args[0]);
+ return new (xpath->thd->mem_root)
+ Item_xpath_cast_number(xpath->thd, args[0]);
}
-static Item *create_func_string_length(MY_XPATH *xpath, Item **args, uint nargs)
+static Item *create_func_string_length(MY_XPATH *xpath, Item **args,
+ uint nargs)
{
Item *arg= nargs ? args[0] : xpath->context;
- return arg ? new Item_func_char_length(arg) : 0;
+ return arg ? new (xpath->thd->mem_root)
+ Item_func_char_length(xpath->thd, arg) : 0;
}
static Item *create_func_round(MY_XPATH *xpath, Item **args, uint nargs)
{
- return new Item_func_round(args[0], new Item_int((char*)"0",0,1),0);
+ return new (xpath->thd->mem_root)
+ Item_func_round(xpath->thd, args[0],
+ new (xpath->thd->mem_root)
+ Item_int(xpath->thd, (char *) "0", 0, 1), 0);
}
static Item *create_func_last(MY_XPATH *xpath, Item **args, uint nargs)
{
- return xpath->context ?
- new Item_func_xpath_count(xpath->context, xpath->pxml) : NULL;
+ return (xpath->context ?
+ new (xpath->thd->mem_root)
+ Item_func_xpath_count(xpath->thd, xpath->context, xpath->pxml) :
+ NULL);
}
static Item *create_func_position(MY_XPATH *xpath, Item **args, uint nargs)
{
- return xpath->context ?
- new Item_func_xpath_position(xpath->context, xpath->pxml) : NULL;
+ return (xpath->context ?
+ new (xpath->thd->mem_root)
+ Item_func_xpath_position(xpath->thd, xpath->context, xpath->pxml) :
+ NULL);
}
static Item *create_func_contains(MY_XPATH *xpath, Item **args, uint nargs)
{
- return new Item_xpath_cast_bool(new Item_func_locate(args[0], args[1]),
- xpath->pxml);
+ return (new (xpath->thd->mem_root)
+ Item_xpath_cast_bool(xpath->thd,
+ new (xpath->thd->mem_root)
+ Item_func_locate(xpath->thd, args[0], args[1]),
+ xpath->pxml));
}
static Item *create_func_concat(MY_XPATH *xpath, Item **args, uint nargs)
-{
- return new Item_func_concat(args[0], args[1]);
+{
+ return new (xpath->thd->mem_root)
+ Item_func_concat(xpath->thd, args[0], args[1]);
}
static Item *create_func_substr(MY_XPATH *xpath, Item **args, uint nargs)
{
+ THD *thd= xpath->thd;
if (nargs == 2)
- return new Item_func_substr(args[0], args[1]);
- else
- return new Item_func_substr(args[0], args[1], args[2]);
+ return new (thd->mem_root) Item_func_substr(thd, args[0], args[1]);
+ return new (thd->mem_root) Item_func_substr(thd, args[0], args[1], args[2]);
}
static Item *create_func_count(MY_XPATH *xpath, Item **args, uint nargs)
-{
+{
if (args[0]->type() != Item::XPATH_NODESET)
return 0;
- return new Item_func_xpath_count(args[0], xpath->pxml);
+ return new (xpath->thd->mem_root) Item_func_xpath_count(xpath->thd, args[0], xpath->pxml);
}
@@ -1259,7 +1297,8 @@ static Item *create_func_sum(MY_XPATH *xpath, Item **args, uint nargs)
{
if (args[0]->type() != Item::XPATH_NODESET)
return 0;
- return new Item_func_xpath_sum(args[0], xpath->pxml);
+ return new (xpath->thd->mem_root)
+ Item_func_xpath_sum(xpath->thd, args[0], xpath->pxml);
}
@@ -1632,9 +1671,11 @@ static int my_xpath_parse_AbsoluteLocationPath(MY_XPATH *xpath)
if (my_xpath_parse_term(xpath, MY_XPATH_LEX_SLASH))
{
- xpath->context= new Item_nodeset_func_descendantbyname(xpath->context,
- "*", 1,
- xpath->pxml, 1);
+ xpath->context= new (xpath->thd->mem_root)
+ Item_nodeset_func_descendantbyname(xpath->thd,
+ xpath->context,
+ "*", 1,
+ xpath->pxml, 1);
return my_xpath_parse_RelativeLocationPath(xpath);
}
@@ -1673,9 +1714,11 @@ static int my_xpath_parse_RelativeLocationPath(MY_XPATH *xpath)
while (my_xpath_parse_term(xpath, MY_XPATH_LEX_SLASH))
{
if (my_xpath_parse_term(xpath, MY_XPATH_LEX_SLASH))
- xpath->context= new Item_nodeset_func_descendantbyname(xpath->context,
- "*", 1,
- xpath->pxml, 1);
+ xpath->context= new (xpath->thd->mem_root)
+ Item_nodeset_func_descendantbyname(xpath->thd,
+ xpath->context,
+ "*", 1,
+ xpath->pxml, 1);
if (!my_xpath_parse_Step(xpath))
{
xpath->error= 1;
@@ -1713,7 +1756,8 @@ my_xpath_parse_AxisSpecifier_NodeTest_opt_Predicate_list(MY_XPATH *xpath)
Item *prev_context= xpath->context;
String *context_cache;
context_cache= &((Item_nodeset_func*)xpath->context)->context_cache;
- xpath->context= new Item_nodeset_context_cache(context_cache, xpath->pxml);
+ xpath->context= new (xpath->thd->mem_root)
+ Item_nodeset_context_cache(xpath->thd, context_cache, xpath->pxml);
xpath->context_cache= context_cache;
if(!my_xpath_parse_PredicateExpr(xpath))
@@ -1732,15 +1776,18 @@ my_xpath_parse_AxisSpecifier_NodeTest_opt_Predicate_list(MY_XPATH *xpath)
if (xpath->item->is_bool_type())
{
- xpath->context= new Item_nodeset_func_predicate(prev_context,
- xpath->item,
- xpath->pxml);
+ xpath->context= new (xpath->thd->mem_root)
+ Item_nodeset_func_predicate(xpath->thd, prev_context,
+ xpath->item,
+ xpath->pxml);
}
else
{
- xpath->context= new Item_nodeset_func_elementbyindex(prev_context,
- xpath->item,
- xpath->pxml);
+ xpath->context= new (xpath->thd->mem_root)
+ Item_nodeset_func_elementbyindex(xpath->thd,
+ prev_context,
+ xpath->item,
+ xpath->pxml);
}
}
return 1;
@@ -1748,7 +1795,7 @@ my_xpath_parse_AxisSpecifier_NodeTest_opt_Predicate_list(MY_XPATH *xpath)
static int my_xpath_parse_Step(MY_XPATH *xpath)
-{
+{
return
my_xpath_parse_AxisSpecifier_NodeTest_opt_Predicate_list(xpath) ||
my_xpath_parse_AbbreviatedStep(xpath);
@@ -1862,8 +1909,10 @@ static int my_xpath_parse_AbbreviatedStep(MY_XPATH *xpath)
if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_DOT))
return 0;
if (my_xpath_parse_term(xpath, MY_XPATH_LEX_DOT))
- xpath->context= new Item_nodeset_func_parentbyname(xpath->context, "*", 1,
- xpath->pxml);
+ xpath->context= new (xpath->thd->mem_root)
+ Item_nodeset_func_parentbyname(xpath->thd,
+ xpath->context, "*",
+ 1, xpath->pxml);
return 1;
}
@@ -1892,9 +1941,10 @@ static int my_xpath_parse_PrimaryExpr_literal(MY_XPATH *xpath)
{
if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_STRING))
return 0;
- xpath->item= new Item_string(xpath->prevtok.beg + 1,
- xpath->prevtok.end - xpath->prevtok.beg - 2,
- xpath->cs);
+ xpath->item= new (xpath->thd->mem_root)
+ Item_string(xpath->thd, xpath->prevtok.beg + 1,
+ xpath->prevtok.end - xpath->prevtok.beg - 2,
+ xpath->cs);
return 1;
}
static int my_xpath_parse_PrimaryExpr(MY_XPATH *xpath)
@@ -1987,7 +2037,9 @@ static int my_xpath_parse_UnionExpr(MY_XPATH *xpath)
xpath->error= 1;
return 0;
}
- xpath->item= new Item_nodeset_func_union(prev, xpath->item, xpath->pxml);
+ xpath->item= new (xpath->thd->mem_root)
+ Item_nodeset_func_union(xpath->thd, prev, xpath->item,
+ xpath->pxml);
}
return 1;
}
@@ -2033,8 +2085,11 @@ my_xpath_parse_FilterExpr_opt_slashes_RelativeLocationPath(MY_XPATH *xpath)
/* treat double slash (//) as /descendant-or-self::node()/ */
if (my_xpath_parse_term(xpath, MY_XPATH_LEX_SLASH))
- xpath->context= new Item_nodeset_func_descendantbyname(xpath->context,
- "*", 1, xpath->pxml, 1);
+ xpath->context= new (xpath->thd->mem_root)
+ Item_nodeset_func_descendantbyname(xpath->thd,
+ xpath->context,
+ "*", 1,
+ xpath->pxml, 1);
rc= my_xpath_parse_RelativeLocationPath(xpath);
/* push back the context and restore the item */
@@ -2096,8 +2151,9 @@ static int my_xpath_parse_OrExpr(MY_XPATH *xpath)
xpath->error= 1;
return 0;
}
- xpath->item= new Item_cond_or(nodeset2bool(xpath, prev),
- nodeset2bool(xpath, xpath->item));
+ xpath->item= new (xpath->thd->mem_root)
+ Item_cond_or(xpath->thd, nodeset2bool(xpath, prev),
+ nodeset2bool(xpath, xpath->item));
}
return 1;
}
@@ -2128,8 +2184,9 @@ static int my_xpath_parse_AndExpr(MY_XPATH *xpath)
return 0;
}
- xpath->item= new Item_cond_and(nodeset2bool(xpath,prev),
- nodeset2bool(xpath,xpath->item));
+ xpath->item= new (xpath->thd->mem_root)
+ Item_cond_and(xpath->thd, nodeset2bool(xpath, prev),
+ nodeset2bool(xpath, xpath->item));
}
return 1;
}
@@ -2291,6 +2348,8 @@ static int my_xpath_parse_AdditiveExpr(MY_XPATH *xpath)
{
int oper= xpath->prevtok.term;
Item *prev= xpath->item;
+ THD *thd= xpath->thd;
+
if (!my_xpath_parse_MultiplicativeExpr(xpath))
{
xpath->error= 1;
@@ -2298,9 +2357,11 @@ static int my_xpath_parse_AdditiveExpr(MY_XPATH *xpath)
}
if (oper == MY_XPATH_LEX_PLUS)
- xpath->item= new Item_func_plus(prev, xpath->item);
+ xpath->item= new (thd->mem_root)
+ Item_func_plus(thd, prev, xpath->item);
else
- xpath->item= new Item_func_minus(prev, xpath->item);
+ xpath->item= new (thd->mem_root)
+ Item_func_minus(thd, prev, xpath->item);
};
return 1;
}
@@ -2335,6 +2396,7 @@ static int my_xpath_parse_MultiplicativeExpr(MY_XPATH *xpath)
if (!my_xpath_parse_UnaryExpr(xpath))
return 0;
+ THD *thd= xpath->thd;
while (my_xpath_parse_MultiplicativeOperator(xpath))
{
int oper= xpath->prevtok.term;
@@ -2347,13 +2409,13 @@ static int my_xpath_parse_MultiplicativeExpr(MY_XPATH *xpath)
switch (oper)
{
case MY_XPATH_LEX_ASTERISK:
- xpath->item= new Item_func_mul(prev, xpath->item);
+ xpath->item= new (thd->mem_root) Item_func_mul(thd, prev, xpath->item);
break;
case MY_XPATH_LEX_DIV:
- xpath->item= new Item_func_int_div(prev, xpath->item);
+ xpath->item= new (thd->mem_root) Item_func_int_div(thd, prev, xpath->item);
break;
case MY_XPATH_LEX_MOD:
- xpath->item= new Item_func_mod(prev, xpath->item);
+ xpath->item= new (thd->mem_root) Item_func_mod(thd, prev, xpath->item);
break;
}
}
@@ -2378,7 +2440,8 @@ static int my_xpath_parse_UnaryExpr(MY_XPATH *xpath)
return my_xpath_parse_UnionExpr(xpath);
if (!my_xpath_parse_UnaryExpr(xpath))
return 0;
- xpath->item= new Item_func_neg(xpath->item);
+ xpath->item= new (xpath->thd->mem_root)
+ Item_func_neg(xpath->thd, xpath->item);
return 1;
}
@@ -2410,18 +2473,21 @@ static int my_xpath_parse_UnaryExpr(MY_XPATH *xpath)
static int my_xpath_parse_Number(MY_XPATH *xpath)
{
const char *beg;
+ THD *thd;
if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_DIGITS))
return 0;
beg= xpath->prevtok.beg;
+ thd= xpath->thd;
if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_DOT))
{
- xpath->item= new Item_int(xpath->prevtok.beg,
+ xpath->item= new (thd->mem_root) Item_int(thd, xpath->prevtok.beg,
xpath->prevtok.end - xpath->prevtok.beg);
return 1;
}
my_xpath_parse_term(xpath, MY_XPATH_LEX_DIGITS);
- xpath->item= new Item_float(beg, xpath->prevtok.end - beg);
+ xpath->item= new (thd->mem_root) Item_float(thd, beg,
+ xpath->prevtok.end - beg);
return 1;
}
@@ -2514,6 +2580,7 @@ my_xpath_parse_VariableReference(MY_XPATH *xpath)
LEX_STRING name;
int user_var;
const char *dollar_pos;
+ THD *thd= xpath->thd;
if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_DOLLAR) ||
(!(dollar_pos= xpath->prevtok.beg)) ||
(!((user_var= my_xpath_parse_term(xpath, MY_XPATH_LEX_AT) &&
@@ -2525,17 +2592,19 @@ my_xpath_parse_VariableReference(MY_XPATH *xpath)
name.str= (char*) xpath->prevtok.beg;
if (user_var)
- xpath->item= new Item_func_get_user_var(name);
+ xpath->item= new (thd->mem_root) Item_func_get_user_var(thd, name);
else
{
sp_variable *spv;
sp_pcontext *spc;
LEX *lex;
- if ((lex= current_thd->lex) &&
+ if ((lex= thd->lex) &&
(spc= lex->spcont) &&
(spv= spc->find_variable(name, false)))
{
- Item_splocal *splocal= new Item_splocal(name, spv->offset, spv->type, 0);
+ Item_splocal *splocal= new (thd->mem_root)
+ Item_splocal(thd, name, spv->offset,
+ spv->type, 0);
#ifndef DBUG_OFF
if (splocal)
splocal->m_sp= lex->sphead;
@@ -2614,11 +2683,12 @@ my_xpath_parse(MY_XPATH *xpath, const char *str, const char *strend)
my_xpath_lex_init(&xpath->prevtok, str, strend);
my_xpath_lex_scan(xpath, &xpath->lasttok, str, strend);
- xpath->rootelement= new Item_nodeset_func_rootelement(xpath->pxml);
+ xpath->rootelement= new (xpath->thd->mem_root)
+ Item_nodeset_func_rootelement(xpath->thd,
+ xpath->pxml);
- return
- my_xpath_parse_Expr(xpath) &&
- my_xpath_parse_term(xpath, MY_XPATH_LEX_EOF);
+ return (my_xpath_parse_Expr(xpath) &&
+ my_xpath_parse_term(xpath, MY_XPATH_LEX_EOF));
}
@@ -2662,6 +2732,7 @@ bool Item_xml_str_func::fix_fields(THD *thd, Item **ref)
if (!(xp= args[1]->val_str(&tmp)))
return false; // Will return NULL
my_xpath_init(&xpath);
+ xpath.thd= thd;
xpath.cs= collation.collation;
xpath.debug= 0;
xpath.pxml= xml.parsed();
@@ -2854,14 +2925,15 @@ bool Item_xml_str_func::XML::parse()
/* Execute XML parser */
if ((rc= my_xml_parse(&p, m_raw_ptr->ptr(), m_raw_ptr->length())) != MY_XML_OK)
{
+ THD *thd= current_thd;
char buf[128];
my_snprintf(buf, sizeof(buf)-1, "parse error at line %d pos %lu: %s",
my_xml_error_lineno(&p) + 1,
(ulong) my_xml_error_pos(&p) + 1,
my_xml_error_string(&p));
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WRONG_VALUE,
- ER(ER_WRONG_VALUE), "XML", buf);
+ ER_THD(thd, ER_WRONG_VALUE), "XML", buf);
m_raw_ptr= (String *) 0;
}
my_xml_parser_free(&p);
diff --git a/sql/item_xmlfunc.h b/sql/item_xmlfunc.h
index 637f505e12e..3758025fc90 100644
--- a/sql/item_xmlfunc.h
+++ b/sql/item_xmlfunc.h
@@ -69,20 +69,19 @@ protected:
};
Item *nodeset_func;
XML xml;
- bool get_xml(XML *xml, bool cache= false)
+ bool get_xml(XML *xml_arg, bool cache= false)
{
- if (!cache && xml->cached())
- return xml->raw() == 0;
- return xml->parse(args[0], cache);
+ if (!cache && xml_arg->cached())
+ return xml_arg->raw() == 0;
+ return xml_arg->parse(args[0], cache);
}
public:
- Item_xml_str_func(Item *a, Item *b):
- Item_str_func(a,b)
+ Item_xml_str_func(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b)
{
maybe_null= TRUE;
}
- Item_xml_str_func(Item *a, Item *b, Item *c):
- Item_str_func(a,b,c)
+ Item_xml_str_func(THD *thd, Item *a, Item *b, Item *c):
+ Item_str_func(thd, a, b, c)
{
maybe_null= TRUE;
}
@@ -102,7 +101,8 @@ public:
class Item_func_xml_extractvalue: public Item_xml_str_func
{
public:
- Item_func_xml_extractvalue(Item *a,Item *b) :Item_xml_str_func(a,b) {}
+ Item_func_xml_extractvalue(THD *thd, Item *a, Item *b):
+ Item_xml_str_func(thd, a, b) {}
const char *func_name() const { return "extractvalue"; }
String *val_str(String *);
};
@@ -115,7 +115,8 @@ class Item_func_xml_update: public Item_xml_str_func
const MY_XML_NODE *cut,
const String *replace);
public:
- Item_func_xml_update(Item *a,Item *b,Item *c) :Item_xml_str_func(a,b,c) {}
+ Item_func_xml_update(THD *thd, Item *a, Item *b, Item *c):
+ Item_xml_str_func(thd, a, b, c) {}
const char *func_name() const { return "updatexml"; }
String *val_str(String *);
};
diff --git a/sql/lock.cc b/sql/lock.cc
index a2f7df04de5..946a089fadc 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -826,7 +826,7 @@ bool lock_schema_name(THD *thd, const char *db)
if (thd->locked_tables_mode)
{
my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
- ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
+ ER_THD(thd, ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
return TRUE;
}
@@ -882,7 +882,7 @@ bool lock_object_name(THD *thd, MDL_key::enum_mdl_namespace mdl_type,
if (thd->locked_tables_mode)
{
my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
- ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
+ ER_THD(thd, ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
return TRUE;
}
diff --git a/sql/log.cc b/sql/log.cc
index 593d9ba04ea..8302dec986f 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -67,6 +67,9 @@
handlerton *binlog_hton;
LOGGER logger;
+const char *log_bin_index= 0;
+const char *log_bin_basename= 0;
+
MYSQL_BIN_LOG mysql_bin_log(&sync_binlog_period);
static bool test_if_number(const char *str,
@@ -263,9 +266,9 @@ public:
return m_pending;
}
- void set_pending(Rows_log_event *const pending)
+ void set_pending(Rows_log_event *const pending_arg)
{
- m_pending= pending;
+ m_pending= pending_arg;
}
void set_incident(void)
@@ -296,11 +299,12 @@ public:
incident= FALSE;
before_stmt_pos= MY_OFF_T_UNDEF;
/*
- The truncate function calls reinit_io_cache that calls my_b_flush_io_cache
- which may increase disk_writes. This breaks the disk_writes use by the
- binary log which aims to compute the ratio between in-memory cache usage
- and disk cache usage. To avoid this undesirable behavior, we reset the
- variable after truncating the cache.
+ The truncate function calls reinit_io_cache that calls
+ my_b_flush_io_cache which may increase disk_writes. This breaks
+ the disk_writes use by the binary log which aims to compute the
+ ratio between in-memory cache usage and disk cache usage. To
+ avoid this undesirable behavior, we reset the variable after
+ truncating the cache.
*/
cache_log.disk_writes= 0;
DBUG_ASSERT(empty());
@@ -633,7 +637,7 @@ void Log_to_csv_event_handler::cleanup()
bool Log_to_csv_event_handler::
log_general(THD *thd, my_hrtime_t event_time, const char *user_host,
- uint user_host_len, int thread_id,
+ uint user_host_len, int thread_id_arg,
const char *command_type, uint command_type_len,
const char *sql_text, uint sql_text_len,
CHARSET_INFO *client_cs)
@@ -714,7 +718,7 @@ bool Log_to_csv_event_handler::
/* do a write */
if (table->field[1]->store(user_host, user_host_len, client_cs) ||
- table->field[2]->store((longlong) thread_id, TRUE) ||
+ table->field[2]->store((longlong) thread_id_arg, TRUE) ||
table->field[3]->store((longlong) global_system_variables.server_id,
TRUE) ||
table->field[4]->store(command_type, command_type_len, client_cs))
@@ -1043,7 +1047,7 @@ bool Log_to_file_event_handler::
bool Log_to_file_event_handler::
log_general(THD *thd, my_hrtime_t event_time, const char *user_host,
- uint user_host_len, int thread_id,
+ uint user_host_len, int thread_id_arg,
const char *command_type, uint command_type_len,
const char *sql_text, uint sql_text_len,
CHARSET_INFO *client_cs)
@@ -1052,7 +1056,7 @@ bool Log_to_file_event_handler::
thd->push_internal_handler(&error_handler);
bool retval= mysql_log.write(hrtime_to_time(event_time), user_host,
user_host_len,
- thread_id, command_type, command_type_len,
+ thread_id_arg, command_type, command_type_len,
sql_text, sql_text_len);
thd->pop_internal_handler();
return retval;
@@ -1656,15 +1660,36 @@ int binlog_init(void *p)
return 0;
}
+#ifdef WITH_WSREP
+#include "wsrep_binlog.h"
+#endif /* WITH_WSREP */
static int binlog_close_connection(handlerton *hton, THD *thd)
{
+ DBUG_ENTER("binlog_close_connection");
binlog_cache_mngr *const cache_mngr=
(binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
+#ifdef WITH_WSREP
+ if (cache_mngr && !cache_mngr->trx_cache.empty()) {
+ IO_CACHE* cache= get_trans_log(thd);
+ uchar *buf;
+ size_t len=0;
+ wsrep_write_cache_buf(cache, &buf, &len);
+ WSREP_WARN("binlog trx cache not empty (%lu bytes) @ connection close %lu",
+ len, thd->thread_id);
+ if (len > 0) wsrep_dump_rbr_buf(thd, buf, len);
+
+ cache = cache_mngr->get_binlog_cache_log(false);
+ wsrep_write_cache_buf(cache, &buf, &len);
+ WSREP_WARN("binlog stmt cache not empty (%lu bytes) @ connection close %lu",
+ len, thd->thread_id);
+ if (len > 0) wsrep_dump_rbr_buf(thd, buf, len);
+ }
+#endif /* WITH_WSREP */
DBUG_ASSERT(cache_mngr->trx_cache.empty() && cache_mngr->stmt_cache.empty());
thd_set_ha_data(thd, binlog_hton, NULL);
cache_mngr->~binlog_cache_mngr();
my_free(cache_mngr);
- return 0;
+ DBUG_RETURN(0);
}
/*
@@ -2122,11 +2147,11 @@ void MYSQL_BIN_LOG::set_write_error(THD *thd, bool is_transactional)
{
if (is_transactional)
{
- my_message(ER_TRANS_CACHE_FULL, ER(ER_TRANS_CACHE_FULL), MYF(MY_WME));
+ my_message(ER_TRANS_CACHE_FULL, ER_THD(thd, ER_TRANS_CACHE_FULL), MYF(MY_WME));
}
else
{
- my_message(ER_STMT_CACHE_FULL, ER(ER_STMT_CACHE_FULL), MYF(MY_WME));
+ my_message(ER_STMT_CACHE_FULL, ER_THD(thd, ER_STMT_CACHE_FULL), MYF(MY_WME));
}
}
else
@@ -2383,13 +2408,13 @@ static void setup_windows_event_source()
nonzero if not possible to get unique filename.
*/
-static int find_uniq_filename(char *name)
+static int find_uniq_filename(char *name, ulong next_log_number)
{
uint i;
char buff[FN_REFLEN], ext_buf[FN_REFLEN];
struct st_my_dir *dir_info;
reg1 struct fileinfo *file_info;
- ulong max_found= 0, next= 0, number= 0;
+ ulong max_found, next, number;
size_t buf_length, length;
char *start, *end;
int error= 0;
@@ -2409,6 +2434,7 @@ static int find_uniq_filename(char *name)
DBUG_RETURN(1);
}
file_info= dir_info->dir_entry;
+ max_found= next_log_number ? next_log_number-1 : 0;
for (i= dir_info->number_of_files ; i-- ; file_info++)
{
if (strncmp(file_info->name, start, length) == 0 &&
@@ -2420,7 +2446,7 @@ static int find_uniq_filename(char *name)
my_dirend(dir_info);
/* check if reached the maximum possible extension number */
- if (max_found == MAX_LOG_UNIQUE_FN_EXT)
+ if (max_found >= MAX_LOG_UNIQUE_FN_EXT)
{
sql_print_error("Log filename extension number exhausted: %06lu. \
Please fix this by archiving old logs and \
@@ -2481,14 +2507,18 @@ void MYSQL_LOG::init(enum_log_type log_type_arg,
bool MYSQL_LOG::init_and_set_log_file_name(const char *log_name,
const char *new_name,
+ ulong next_log_number,
enum_log_type log_type_arg,
enum cache_type io_cache_type_arg)
{
init(log_type_arg, io_cache_type_arg);
- if (new_name && !strmov(log_file_name, new_name))
- return TRUE;
- else if (!new_name && generate_new_name(log_file_name, log_name))
+ if (new_name)
+ {
+ strmov(log_file_name, new_name);
+ }
+ else if (!new_name && generate_new_name(log_file_name, log_name,
+ next_log_number))
return TRUE;
return FALSE;
@@ -2521,7 +2551,8 @@ bool MYSQL_LOG::open(
PSI_file_key log_file_key,
#endif
const char *log_name, enum_log_type log_type_arg,
- const char *new_name, enum cache_type io_cache_type_arg)
+ const char *new_name, ulong next_log_number,
+ enum cache_type io_cache_type_arg)
{
char buff[FN_REFLEN];
MY_STAT f_stat;
@@ -2540,7 +2571,13 @@ bool MYSQL_LOG::open(
goto err;
}
- if (init_and_set_log_file_name(name, new_name,
+ /*
+ log_type is LOG_UNKNOWN if we should not generate a new name
+ This is only used when called from MYSQL_BINARY_LOG::open, which
+ has already updated log_file_name.
+ */
+ if (log_type_arg != LOG_UNKNOWN &&
+ init_and_set_log_file_name(name, new_name, next_log_number,
log_type_arg, io_cache_type_arg))
goto err;
@@ -2695,7 +2732,8 @@ void MYSQL_LOG::cleanup()
}
-int MYSQL_LOG::generate_new_name(char *new_name, const char *log_name)
+int MYSQL_LOG::generate_new_name(char *new_name, const char *log_name,
+ ulong next_log_number)
{
fn_format(new_name, log_name, mysql_data_home, "", 4);
if (log_type == LOG_BIN)
@@ -2703,10 +2741,12 @@ int MYSQL_LOG::generate_new_name(char *new_name, const char *log_name)
if (!fn_ext(log_name)[0])
{
if (DBUG_EVALUATE_IF("binlog_inject_new_name_error", TRUE, FALSE) ||
- find_uniq_filename(new_name))
+ find_uniq_filename(new_name, next_log_number))
{
- if (current_thd)
- my_printf_error(ER_NO_UNIQUE_LOGFILE, ER(ER_NO_UNIQUE_LOGFILE),
+ THD *thd= current_thd;
+ if (thd)
+ my_printf_error(ER_NO_UNIQUE_LOGFILE,
+ ER_THD(thd, ER_NO_UNIQUE_LOGFILE),
MYF(ME_FATALERROR), log_name);
sql_print_error(ER_DEFAULT(ER_NO_UNIQUE_LOGFILE), log_name);
return 1;
@@ -2754,7 +2794,7 @@ void MYSQL_QUERY_LOG::reopen_file()
#ifdef HAVE_PSI_INTERFACE
m_log_file_key,
#endif
- save_name, log_type, 0, io_cache_type);
+ save_name, log_type, 0, 0, io_cache_type);
my_free(save_name);
mysql_mutex_unlock(&LOCK_log);
@@ -2789,7 +2829,7 @@ void MYSQL_QUERY_LOG::reopen_file()
*/
bool MYSQL_QUERY_LOG::write(time_t event_time, const char *user_host,
- uint user_host_len, int thread_id,
+ uint user_host_len, int thread_id_arg,
const char *command_type, uint command_type_len,
const char *sql_text, uint sql_text_len)
{
@@ -2828,7 +2868,7 @@ bool MYSQL_QUERY_LOG::write(time_t event_time, const char *user_host,
goto err;
/* command_type, thread_id */
- length= my_snprintf(buff, 32, "%5ld ", (long) thread_id);
+ length= my_snprintf(buff, 32, "%5ld ", (long) thread_id_arg);
if (my_b_write(&log_file, (uchar*) buff, length))
goto err;
@@ -3048,7 +3088,7 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time,
if (! write_error)
{
write_error= 1;
- sql_print_error(ER(ER_ERROR_ON_WRITE), name, error);
+ sql_print_error(ER_THD(thd, ER_ERROR_ON_WRITE), name, error);
}
}
}
@@ -3063,8 +3103,8 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time,
first change fn_format() to cut the file name if it's too long.
*/
const char *MYSQL_LOG::generate_name(const char *log_name,
- const char *suffix,
- bool strip_ext, char *buff)
+ const char *suffix,
+ bool strip_ext, char *buff)
{
if (!log_name || !log_name[0])
{
@@ -3288,6 +3328,7 @@ bool MYSQL_BIN_LOG::open_index_file(const char *index_file_name_arg,
bool MYSQL_BIN_LOG::open(const char *log_name,
enum_log_type log_type_arg,
const char *new_name,
+ ulong next_log_number,
enum cache_type io_cache_type_arg,
ulong max_size_arg,
bool null_created_arg,
@@ -3295,7 +3336,6 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
{
File file= -1;
xid_count_per_binlog *new_xid_list_entry= NULL, *b;
-
DBUG_ENTER("MYSQL_BIN_LOG::open");
DBUG_PRINT("enter",("log_type: %d",(int) log_type_arg));
@@ -3313,8 +3353,9 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
DBUG_RETURN(1);
}
- if (init_and_set_log_file_name(log_name, new_name, log_type_arg,
- io_cache_type_arg))
+ /* We need to calculate new log file name for purge to delete old */
+ if (init_and_set_log_file_name(log_name, new_name, next_log_number,
+ log_type_arg, io_cache_type_arg))
{
sql_print_error("MSYQL_BIN_LOG::open failed to generate new file name.");
DBUG_RETURN(1);
@@ -3327,13 +3368,15 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
DBUG_EVALUATE_IF("fault_injection_registering_index", 1, 0))
{
/**
- TODO: although this was introduced to appease valgrind
- when injecting emulated faults using fault_injection_registering_index
- it may be good to consider what actually happens when
- open_purge_index_file succeeds but register or sync fails.
-
- Perhaps we might need the code below in MYSQL_LOG_BIN::cleanup
- for "real life" purposes as well?
+ TODO:
+ Although this was introduced to appease valgrind when
+ injecting emulated faults using
+ fault_injection_registering_index it may be good to consider
+ what actually happens when open_purge_index_file succeeds but
+ register or sync fails.
+
+ Perhaps we might need the code below in MYSQL_LOG_BIN::cleanup
+ for "real life" purposes as well?
*/
DBUG_EXECUTE_IF("fault_injection_registering_index", {
if (my_b_inited(&purge_index_file))
@@ -3356,7 +3399,9 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
#ifdef HAVE_PSI_INTERFACE
m_key_file_log,
#endif
- log_name, log_type_arg, new_name, io_cache_type_arg))
+ log_name,
+ LOG_UNKNOWN, /* Don't generate new name */
+ 0, 0, io_cache_type_arg))
{
#ifdef HAVE_REPLICATION
close_purge_index_file();
@@ -3400,25 +3445,52 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
*/
if (io_cache_type == WRITE_CACHE)
s.flags |= LOG_EVENT_BINLOG_IN_USE_F;
- s.checksum_alg= is_relay_log ?
- /* relay-log */
- /* inherit master's A descriptor if one has been received */
- (relay_log_checksum_alg=
- (relay_log_checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF) ?
- relay_log_checksum_alg :
- /* otherwise use slave's local preference of RL events verification */
- (opt_slave_sql_verify_checksum == 0) ?
- (uint8) BINLOG_CHECKSUM_ALG_OFF : (uint8) binlog_checksum_options):
- /* binlog */
- (uint8) binlog_checksum_options;
+
+ if (is_relay_log)
+ {
+ if (relay_log_checksum_alg == BINLOG_CHECKSUM_ALG_UNDEF)
+ relay_log_checksum_alg=
+ opt_slave_sql_verify_checksum ? (enum_binlog_checksum_alg) binlog_checksum_options
+ : BINLOG_CHECKSUM_ALG_OFF;
+ s.checksum_alg= relay_log_checksum_alg;
+ }
+ else
+ s.checksum_alg= (enum_binlog_checksum_alg)binlog_checksum_options;
+
+ crypto.scheme = 0;
DBUG_ASSERT(s.checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF);
if (!s.is_valid())
goto err;
s.dont_set_created= null_created_arg;
- if (s.write(&log_file))
+ if (write_event(&s))
goto err;
bytes_written+= s.data_written;
+ if (encrypt_binlog)
+ {
+ uint key_version= encryption_key_get_latest_version(ENCRYPTION_KEY_SYSTEM_DATA);
+ if (key_version == ENCRYPTION_KEY_VERSION_INVALID)
+ {
+ sql_print_error("Failed to enable encryption of binary logs");
+ goto err;
+ }
+
+ if (key_version != ENCRYPTION_KEY_NOT_ENCRYPTED)
+ {
+ if (my_random_bytes(crypto.nonce, sizeof(crypto.nonce)))
+ goto err;
+
+ Start_encryption_log_event sele(1, key_version, crypto.nonce);
+ sele.checksum_alg= s.checksum_alg;
+ if (write_event(&sele))
+ goto err;
+
+ // Start_encryption_log_event is written, enable the encryption
+ if (crypto.init(sele.crypto_scheme, key_version))
+ goto err;
+ }
+ }
+
if (!is_relay_log)
{
char buf[FN_REFLEN];
@@ -3458,7 +3530,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
*/
Gtid_list_log_event gl_ev(&rpl_global_gtid_binlog_state, 0);
- if (gl_ev.write(&log_file))
+ if (write_event(&gl_ev))
goto err;
/* Output a binlog checkpoint event at the start of the binlog file. */
@@ -3509,7 +3581,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
flush_io_cache(&log_file);
mysql_file_sync(log_file.file, MYF(MY_WME));
DBUG_SUICIDE(););
- if (ev.write(&log_file))
+ if (write_event(&ev))
goto err;
bytes_written+= ev.data_written;
}
@@ -3541,7 +3613,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
/* Don't set log_pos in event header */
description_event_for_queue->set_artificial_event();
- if (description_event_for_queue->write(&log_file))
+ if (write_event(description_event_for_queue))
goto err;
bytes_written+= description_event_for_queue->data_written;
}
@@ -3798,7 +3870,10 @@ int MYSQL_BIN_LOG::find_log_pos(LOG_INFO *linfo, const char *log_name,
error= !index_file.error ? LOG_INFO_EOF : LOG_INFO_IO;
break;
}
-
+ if (fname[length-1] != '\n')
+ continue; // Not a log entry
+ fname[length-1]= 0; // Remove end \n
+
// extend relative paths and match against full path
if (normalize_binlog_name(full_fname, fname, is_relay_log))
{
@@ -3809,11 +3884,10 @@ int MYSQL_BIN_LOG::find_log_pos(LOG_INFO *linfo, const char *log_name,
// if the log entry matches, null string matching anything
if (!log_name ||
- (log_name_len == fname_len-1 && full_fname[log_name_len] == '\n' &&
+ (log_name_len == fname_len &&
!memcmp(full_fname, full_log_name, log_name_len)))
{
DBUG_PRINT("info", ("Found log file entry"));
- full_fname[fname_len-1]= 0; // remove last \n
linfo->index_file_start_offset= offset;
linfo->index_file_offset = my_b_tell(&index_file);
break;
@@ -3898,8 +3972,10 @@ err:
The new index file will only contain this file.
- @param thd Thread
- @param create_new_log 1 if we should start writing to a new log file
+ @param thd Thread id. This can be zero in case of resetting
+ relay logs
+ @param create_new_log 1 if we should start writing to a new log file
+ @param next_log_number min number of next log file to use, if possible.
@note
If not called from slave thread, write start event to new log
@@ -3910,8 +3986,9 @@ err:
1 error
*/
-bool MYSQL_BIN_LOG::reset_logs(THD* thd, bool create_new_log,
- rpl_gtid *init_state, uint32 init_state_len)
+bool MYSQL_BIN_LOG::reset_logs(THD *thd, bool create_new_log,
+ rpl_gtid *init_state, uint32 init_state_len,
+ ulong next_log_number)
{
LOG_INFO linfo;
bool error=0;
@@ -3944,7 +4021,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd, bool create_new_log,
mysql_mutex_unlock(&LOCK_xid_list);
}
- DEBUG_SYNC(thd, "reset_logs_after_set_reset_master_pending");
+ DEBUG_SYNC_C_IF_THD(thd, "reset_logs_after_set_reset_master_pending");
/*
We need to get both locks to be sure that no one is trying to
write to the index log file.
@@ -4027,7 +4104,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd, bool create_new_log,
{
uint errcode= purge_log_get_error_code(err);
sql_print_error("Failed to locate old binlog or relay log files");
- my_message(errcode, ER(errcode), MYF(0));
+ my_message(errcode, ER_THD_OR_DEFAULT(thd, errcode), MYF(0));
error= 1;
goto err;
}
@@ -4038,9 +4115,12 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd, bool create_new_log,
{
if (my_errno == ENOENT)
{
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_LOG_PURGE_NO_FILE, ER(ER_LOG_PURGE_NO_FILE),
- linfo.log_file_name);
+ if (thd)
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_LOG_PURGE_NO_FILE,
+ ER_THD(thd, ER_LOG_PURGE_NO_FILE),
+ linfo.log_file_name);
+
sql_print_information("Failed to delete file '%s'",
linfo.log_file_name);
my_errno= 0;
@@ -4048,13 +4128,14 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd, bool create_new_log,
}
else
{
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_BINLOG_PURGE_FATAL_ERR,
- "a problem with deleting %s; "
- "consider examining correspondence "
- "of your binlog index file "
- "to the actual binlog files",
- linfo.log_file_name);
+ if (thd)
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_BINLOG_PURGE_FATAL_ERR,
+ "a problem with deleting %s; "
+ "consider examining correspondence "
+ "of your binlog index file "
+ "to the actual binlog files",
+ linfo.log_file_name);
error= 1;
goto err;
}
@@ -4077,9 +4158,11 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd, bool create_new_log,
{
if (my_errno == ENOENT)
{
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_LOG_PURGE_NO_FILE, ER(ER_LOG_PURGE_NO_FILE),
- index_file_name);
+ if (thd)
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_LOG_PURGE_NO_FILE,
+ ER_THD(thd, ER_LOG_PURGE_NO_FILE),
+ index_file_name);
sql_print_information("Failed to delete file '%s'",
index_file_name);
my_errno= 0;
@@ -4087,19 +4170,21 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd, bool create_new_log,
}
else
{
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_BINLOG_PURGE_FATAL_ERR,
- "a problem with deleting %s; "
- "consider examining correspondence "
- "of your binlog index file "
- "to the actual binlog files",
- index_file_name);
+ if (thd)
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_BINLOG_PURGE_FATAL_ERR,
+ "a problem with deleting %s; "
+ "consider examining correspondence "
+ "of your binlog index file "
+ "to the actual binlog files",
+ index_file_name);
error= 1;
goto err;
}
}
if (create_new_log && !open_index_file(index_file_name, 0, FALSE))
- if ((error= open(save_name, log_type, 0, io_cache_type, max_size, 0, FALSE)))
+ if ((error= open(save_name, log_type, 0, next_log_number,
+ io_cache_type, max_size, 0, FALSE)))
goto err;
my_free((void *) save_name);
@@ -4182,6 +4267,7 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included)
int error;
char *to_purge_if_included= NULL;
inuse_relaylog *ir;
+ ulonglong log_space_reclaimed= 0;
DBUG_ENTER("purge_first_log");
DBUG_ASSERT(is_open());
@@ -4221,12 +4307,9 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included)
if((error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0)) ||
(error=find_next_log(&rli->linfo, 0)))
{
- char buff[22];
- sql_print_error("next log error: %d offset: %s log: %s included: %d",
- error,
- llstr(rli->linfo.index_file_offset,buff),
- rli->event_relay_log_name,
- included);
+ sql_print_error("next log error: %d offset: %llu log: %s included: %d",
+ error, rli->linfo.index_file_offset,
+ rli->event_relay_log_name, included);
goto err;
}
@@ -4253,17 +4336,13 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included)
DBUG_EXECUTE_IF("crash_before_purge_logs", DBUG_SUICIDE(););
- mysql_mutex_lock(&rli->log_space_lock);
rli->relay_log.purge_logs(to_purge_if_included, included,
- 0, 0, &rli->log_space_total);
- mysql_mutex_unlock(&rli->log_space_lock);
+ 0, 0, &log_space_reclaimed);
- /*
- Ok to broadcast after the critical region as there is no risk of
- the mutex being destroyed by this thread later - this helps save
- context switches
- */
+ mysql_mutex_lock(&rli->log_space_lock);
+ rli->log_space_total-= log_space_reclaimed;
mysql_cond_broadcast(&rli->log_space_cond);
+ mysql_mutex_unlock(&rli->log_space_lock);
/*
* Need to update the log pos because purge logs has been called
@@ -4271,12 +4350,9 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included)
*/
if((error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0)))
{
- char buff[22];
- sql_print_error("next log error: %d offset: %s log: %s included: %d",
- error,
- llstr(rli->linfo.index_file_offset,buff),
- rli->group_relay_log_name,
- included);
+ sql_print_error("next log error: %d offset: %llu log: %s included: %d",
+ error, rli->linfo.index_file_offset,
+ rli->group_relay_log_name, included);
goto err;
}
@@ -4312,8 +4388,8 @@ int MYSQL_BIN_LOG::update_log_index(LOG_INFO* log_info, bool need_update_threads
@param need_mutex
@param need_update_threads If we want to update the log coordinates of
all threads. False for relay logs, true otherwise.
- @param freed_log_space If not null, decrement this variable of
- the amount of log space freed
+ @param reclaimeed_log_space If not null, increment this variable to
+ the amount of log space freed
@note
If any of the logs before the deleted one is in use,
@@ -4329,10 +4405,10 @@ int MYSQL_BIN_LOG::update_log_index(LOG_INFO* log_info, bool need_update_threads
*/
int MYSQL_BIN_LOG::purge_logs(const char *to_log,
- bool included,
- bool need_mutex,
- bool need_update_threads,
- ulonglong *decrease_log_space)
+ bool included,
+ bool need_mutex,
+ bool need_update_threads,
+ ulonglong *reclaimed_space)
{
int error= 0;
bool exit_loop= 0;
@@ -4396,7 +4472,7 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log,
err:
/* Read each entry from purge_index_file and delete the file. */
if (is_inited_purge_index_file() &&
- (error= purge_index_entry(thd, decrease_log_space, FALSE)))
+ (error= purge_index_entry(thd, reclaimed_space, FALSE)))
sql_print_error("MSYQL_BIN_LOG::purge_logs failed to process registered files"
" that would be purged.");
close_purge_index_file();
@@ -4501,7 +4577,7 @@ int MYSQL_BIN_LOG::register_create_index_entry(const char *entry)
DBUG_RETURN(register_purge_index_entry(entry));
}
-int MYSQL_BIN_LOG::purge_index_entry(THD *thd, ulonglong *decrease_log_space,
+int MYSQL_BIN_LOG::purge_index_entry(THD *thd, ulonglong *reclaimed_space,
bool need_mutex)
{
DBUG_ENTER("MYSQL_BIN_LOG:purge_index_entry");
@@ -4552,7 +4628,7 @@ int MYSQL_BIN_LOG::purge_index_entry(THD *thd, ulonglong *decrease_log_space,
if (thd)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_LOG_PURGE_NO_FILE, ER(ER_LOG_PURGE_NO_FILE),
+ ER_LOG_PURGE_NO_FILE, ER_THD(thd, ER_LOG_PURGE_NO_FILE),
log_info.log_file_name);
}
sql_print_information("Failed to execute mysql_file_stat on file '%s'",
@@ -4614,8 +4690,8 @@ int MYSQL_BIN_LOG::purge_index_entry(THD *thd, ulonglong *decrease_log_space,
DBUG_PRINT("info",("purging %s",log_info.log_file_name));
if (!my_delete(log_info.log_file_name, MYF(0)))
{
- if (decrease_log_space)
- *decrease_log_space-= s.st_size;
+ if (reclaimed_space)
+ *reclaimed_space+= s.st_size;
}
else
{
@@ -4624,7 +4700,7 @@ int MYSQL_BIN_LOG::purge_index_entry(THD *thd, ulonglong *decrease_log_space,
if (thd)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_LOG_PURGE_NO_FILE, ER(ER_LOG_PURGE_NO_FILE),
+ ER_LOG_PURGE_NO_FILE, ER_THD(thd, ER_LOG_PURGE_NO_FILE),
log_info.log_file_name);
}
sql_print_information("Failed to delete file '%s'",
@@ -4696,7 +4772,6 @@ int MYSQL_BIN_LOG::purge_logs_before_date(time_t purge_time)
LOG_INFO log_info;
MY_STAT stat_area;
THD *thd= current_thd;
-
DBUG_ENTER("purge_logs_before_date");
mysql_mutex_lock(&LOCK_index);
@@ -4762,24 +4837,24 @@ err:
bool
-MYSQL_BIN_LOG::can_purge_log(const char *log_file_name)
+MYSQL_BIN_LOG::can_purge_log(const char *log_file_name_arg)
{
xid_count_per_binlog *b;
- if (is_active(log_file_name))
+ if (is_active(log_file_name_arg))
return false;
mysql_mutex_lock(&LOCK_xid_list);
{
I_List_iterator<xid_count_per_binlog> it(binlog_xid_count_list);
while ((b= it++) &&
- 0 != strncmp(log_file_name+dirname_length(log_file_name),
+ 0 != strncmp(log_file_name_arg+dirname_length(log_file_name_arg),
b->binlog_name, b->binlog_name_len))
;
}
mysql_mutex_unlock(&LOCK_xid_list);
if (b)
return false;
- return !log_in_use(log_file_name);
+ return !log_in_use(log_file_name_arg);
}
#endif /* HAVE_REPLICATION */
@@ -4898,8 +4973,8 @@ int MYSQL_BIN_LOG::new_file_impl(bool need_lock)
uint close_flag;
bool delay_close= false;
File UNINIT_VAR(old_file);
-
DBUG_ENTER("MYSQL_BIN_LOG::new_file_impl");
+
if (!is_open())
{
DBUG_PRINT("info",("log is closed"));
@@ -4921,7 +4996,7 @@ int MYSQL_BIN_LOG::new_file_impl(bool need_lock)
We have to do this here and not in open as we want to store the
new file name in the current binary log file.
*/
- if ((error= generate_new_name(new_name, name)))
+ if ((error= generate_new_name(new_name, name, 0)))
goto end;
new_name_ptr=new_name;
@@ -4942,11 +5017,13 @@ int MYSQL_BIN_LOG::new_file_impl(bool need_lock)
r.checksum_alg= relay_log_checksum_alg;
DBUG_ASSERT(!is_relay_log || relay_log_checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF);
if(DBUG_EVALUATE_IF("fault_injection_new_file_rotate_event", (error=close_on_error=TRUE), FALSE) ||
- (error= r.write(&log_file)))
+ (error= write_event(&r)))
{
DBUG_EXECUTE_IF("fault_injection_new_file_rotate_event", errno=2;);
close_on_error= TRUE;
- my_printf_error(ER_ERROR_ON_WRITE, ER(ER_CANT_OPEN_FILE), MYF(ME_FATALERROR), name, errno);
+ my_printf_error(ER_ERROR_ON_WRITE,
+ ER_THD_OR_DEFAULT(current_thd, ER_CANT_OPEN_FILE),
+ MYF(ME_FATALERROR), name, errno);
goto end;
}
bytes_written += r.data_written;
@@ -4981,14 +5058,15 @@ int MYSQL_BIN_LOG::new_file_impl(bool need_lock)
binlog_checksum_options= checksum_alg_reset;
}
/*
- Note that at this point, log_state != LOG_CLOSED (important for is_open()).
+ Note that at this point, log_state != LOG_CLOSED
+ (important for is_open()).
*/
/*
new_file() is only used for rotation (in FLUSH LOGS or because size >
max_binlog_size or max_relay_log_size).
- If this is a binary log, the Format_description_log_event at the beginning of
- the new file should have created=0 (to distinguish with the
+ If this is a binary log, the Format_description_log_event at the
+ beginning of the new file should have created=0 (to distinguish with the
Format_description_log_event written at server startup, which should
trigger temp tables deletion on slaves.
*/
@@ -5000,14 +5078,15 @@ int MYSQL_BIN_LOG::new_file_impl(bool need_lock)
{
/* reopen the binary log file. */
file_to_open= new_name_ptr;
- error= open(old_name, log_type, new_name_ptr, io_cache_type,
+ error= open(old_name, log_type, new_name_ptr, 0, io_cache_type,
max_size, 1, FALSE);
}
/* handle reopening errors */
if (error)
{
- my_printf_error(ER_CANT_OPEN_FILE, ER(ER_CANT_OPEN_FILE),
+ my_printf_error(ER_CANT_OPEN_FILE,
+ ER_THD_OR_DEFAULT(current_thd, ER_CANT_OPEN_FILE),
MYF(ME_FATALERROR), file_to_open, error);
close_on_error= TRUE;
}
@@ -5052,9 +5131,16 @@ end:
DBUG_RETURN(error);
}
+bool MYSQL_BIN_LOG::write_event(Log_event *ev, IO_CACHE *file)
+{
+ Log_event_writer writer(file, &crypto);
+ if (crypto.scheme && file == &log_file)
+ writer.ctx= alloca(crypto.ctx_size);
-bool
-MYSQL_BIN_LOG::append(Log_event *ev)
+ return writer.write(ev);
+}
+
+bool MYSQL_BIN_LOG::append(Log_event *ev)
{
bool res;
mysql_mutex_lock(&LOCK_log);
@@ -5071,11 +5157,8 @@ bool MYSQL_BIN_LOG::append_no_lock(Log_event* ev)
mysql_mutex_assert_owner(&LOCK_log);
DBUG_ASSERT(log_file.type == SEQ_READ_APPEND);
- /*
- Log_event::write() is smart enough to use my_b_write() or
- my_b_append() depending on the kind of cache we have.
- */
- if (ev->write(&log_file))
+
+ if (write_event(ev))
{
error=1;
goto err;
@@ -5091,32 +5174,62 @@ err:
DBUG_RETURN(error);
}
-
-bool MYSQL_BIN_LOG::appendv(const char* buf, uint len,...)
+bool MYSQL_BIN_LOG::write_event_buffer(uchar* buf, uint len)
{
- bool error= 0;
- DBUG_ENTER("MYSQL_BIN_LOG::appendv");
- va_list(args);
- va_start(args,len);
+ bool error= 1;
+ uchar *ebuf= 0;
+ DBUG_ENTER("MYSQL_BIN_LOG::write_event_buffer");
DBUG_ASSERT(log_file.type == SEQ_READ_APPEND);
mysql_mutex_assert_owner(&LOCK_log);
- do
+
+ if (crypto.scheme != 0)
{
- if (my_b_append(&log_file,(uchar*) buf,len))
- {
- error= 1;
+ DBUG_ASSERT(crypto.scheme == 1);
+
+ uint elen;
+ uchar iv[BINLOG_IV_LENGTH];
+
+ ebuf= (uchar*)my_safe_alloca(len);
+ if (!ebuf)
goto err;
- }
- bytes_written += len;
- } while ((buf=va_arg(args,const char*)) && (len=va_arg(args,uint)));
+
+ crypto.set_iv(iv, my_b_append_tell(&log_file));
+
+ /*
+ we want to encrypt everything, excluding the event length:
+ massage the data before the encryption
+ */
+ memcpy(buf + EVENT_LEN_OFFSET, buf, 4);
+
+ if (encryption_crypt(buf + 4, len - 4,
+ ebuf + 4, &elen,
+ crypto.key, crypto.key_length, iv, sizeof(iv),
+ ENCRYPTION_FLAG_ENCRYPT | ENCRYPTION_FLAG_NOPAD,
+ ENCRYPTION_KEY_SYSTEM_DATA, crypto.key_version))
+ goto err;
+
+ DBUG_ASSERT(elen == len - 4);
+
+ /* massage the data after the encryption */
+ memcpy(ebuf, ebuf + EVENT_LEN_OFFSET, 4);
+ int4store(ebuf + EVENT_LEN_OFFSET, len);
+
+ buf= ebuf;
+ }
+ if (my_b_append(&log_file, buf, len))
+ goto err;
+ bytes_written+= len;
+
+ error= 0;
DBUG_PRINT("info",("max_size: %lu",max_size));
if (flush_and_sync(0))
goto err;
if (my_b_append_tell(&log_file) > max_size)
error= new_file_without_locking();
err:
+ my_safe_afree(ebuf, len);
if (!error)
signal_update();
DBUG_RETURN(error);
@@ -5463,15 +5576,16 @@ int THD::binlog_write_table_map(TABLE *table, bool is_transactional,
IO_CACHE *file=
cache_mngr->get_binlog_cache_log(use_trans_cache(this, is_transactional));
+ Log_event_writer writer(file);
if (with_annotate && *with_annotate)
{
Annotate_rows_log_event anno(table->in_use, is_transactional, false);
/* Annotate event should be written not more than once */
*with_annotate= 0;
- if ((error= anno.write(file)))
+ if ((error= writer.write(&anno)))
DBUG_RETURN(error);
}
- if ((error= the_event.write(file)))
+ if ((error= writer.write(&the_event)))
DBUG_RETURN(error);
binlog_table_maps++;
@@ -5598,14 +5712,14 @@ MYSQL_BIN_LOG::flush_and_set_pending_rows_event(THD *thd,
if (Rows_log_event* pending= cache_data->pending())
{
- IO_CACHE *file= &cache_data->cache_log;
+ Log_event_writer writer(&cache_data->cache_log);
/*
Write pending event to the cache.
*/
DBUG_EXECUTE_IF("simulate_disk_full_at_flush_pending",
{DBUG_SET("+d,simulate_file_write_error");});
- if (pending->write(file))
+ if (writer.write(pending))
{
set_write_error(thd, is_transactional);
if (check_write_error(thd) && cache_data &&
@@ -5635,7 +5749,7 @@ MYSQL_BIN_LOG::write_gtid_event(THD *thd, bool standalone,
{
rpl_gtid gtid;
uint32 domain_id;
- uint32 server_id;
+ uint32 local_server_id;
uint64 seq_no;
int err;
DBUG_ENTER("write_gtid_event");
@@ -5651,7 +5765,7 @@ MYSQL_BIN_LOG::write_gtid_event(THD *thd, bool standalone,
#ifdef WITH_WSREP
}
#endif /* WITH_WSREP */
- server_id= thd->variables.server_id;
+ local_server_id= thd->variables.server_id;
seq_no= thd->variables.gtid_seq_no;
if (thd->variables.option_bits & OPTION_GTID_BEGIN)
@@ -5671,7 +5785,7 @@ MYSQL_BIN_LOG::write_gtid_event(THD *thd, bool standalone,
{
/* Use the specified sequence number. */
gtid.domain_id= domain_id;
- gtid.server_id= server_id;
+ gtid.server_id= local_server_id;
gtid.seq_no= seq_no;
err= rpl_global_gtid_binlog_state.update(&gtid, opt_gtid_strict_mode);
if (err && thd->get_stmt_da()->sql_errno()==ER_GTID_STRICT_OUT_OF_ORDER)
@@ -5681,7 +5795,7 @@ MYSQL_BIN_LOG::write_gtid_event(THD *thd, bool standalone,
{
/* Allocate the next sequence number for the GTID. */
err= rpl_global_gtid_binlog_state.update_with_next_gtid(domain_id,
- server_id, &gtid);
+ local_server_id, &gtid);
seq_no= gtid.seq_no;
}
if (err)
@@ -5693,7 +5807,8 @@ MYSQL_BIN_LOG::write_gtid_event(THD *thd, bool standalone,
commit_id);
/* Write the event to the binary log. */
- if (gtid_event.write(&mysql_bin_log.log_file))
+ DBUG_ASSERT(this == &mysql_bin_log);
+ if (write_event(&gtid_event))
DBUG_RETURN(true);
status_var_add(thd->status_var.binlog_bytes_written, gtid_event.data_written);
@@ -5709,7 +5824,7 @@ MYSQL_BIN_LOG::write_state_to_file()
char buf[FN_REFLEN];
int err;
bool opened= false;
- bool inited= false;
+ bool log_inited= false;
fn_format(buf, opt_bin_logname, mysql_data_home, ".state",
MY_UNPACK_FILENAME);
@@ -5724,10 +5839,10 @@ MYSQL_BIN_LOG::write_state_to_file()
if ((err= init_io_cache(&cache, file_no, IO_SIZE, WRITE_CACHE, 0, 0,
MYF(MY_WME|MY_WAIT_IF_FULL))))
goto err;
- inited= true;
+ log_inited= true;
if ((err= rpl_global_gtid_binlog_state.write_to_iocache(&cache)))
goto err;
- inited= false;
+ log_inited= false;
if ((err= end_io_cache(&cache)))
goto err;
if ((err= mysql_file_sync(file_no, MYF(MY_WME|MY_SYNC_FILESIZE))))
@@ -5736,7 +5851,7 @@ MYSQL_BIN_LOG::write_state_to_file()
err:
sql_print_error("Error writing binlog state to file '%s'.\n", buf);
- if (inited)
+ if (log_inited)
end_io_cache(&cache);
end:
if (opened)
@@ -5762,7 +5877,7 @@ MYSQL_BIN_LOG::read_state_from_file()
char buf[FN_REFLEN];
int err;
bool opened= false;
- bool inited= false;
+ bool log_inited= false;
fn_format(buf, opt_bin_logname, mysql_data_home, ".state",
MY_UNPACK_FILENAME);
@@ -5789,7 +5904,7 @@ MYSQL_BIN_LOG::read_state_from_file()
if ((err= init_io_cache(&cache, file_no, IO_SIZE, READ_CACHE, 0, 0,
MYF(MY_WME|MY_WAIT_IF_FULL))))
goto err;
- inited= true;
+ log_inited= true;
if ((err= rpl_global_gtid_binlog_state.read_from_iocache(&cache)))
goto err;
goto end;
@@ -5797,7 +5912,7 @@ MYSQL_BIN_LOG::read_state_from_file()
err:
sql_print_error("Error reading binlog GTID state from file '%s'.\n", buf);
end:
- if (inited)
+ if (log_inited)
end_io_cache(&cache);
if (opened)
mysql_file_close(file_no, MYF(0));
@@ -5835,11 +5950,11 @@ MYSQL_BIN_LOG::is_empty_state()
bool
-MYSQL_BIN_LOG::find_in_binlog_state(uint32 domain_id, uint32 server_id,
+MYSQL_BIN_LOG::find_in_binlog_state(uint32 domain_id, uint32 server_id_arg,
rpl_gtid *out_gtid)
{
rpl_gtid *gtid;
- if ((gtid= rpl_global_gtid_binlog_state.find(domain_id, server_id)))
+ if ((gtid= rpl_global_gtid_binlog_state.find(domain_id, server_id_arg)))
*out_gtid= *gtid;
return gtid != NULL;
}
@@ -5869,11 +5984,13 @@ MYSQL_BIN_LOG::bump_seq_no_counter_if_needed(uint32 domain_id, uint64 seq_no)
bool
-MYSQL_BIN_LOG::check_strict_gtid_sequence(uint32 domain_id, uint32 server_id,
+MYSQL_BIN_LOG::check_strict_gtid_sequence(uint32 domain_id,
+ uint32 server_id_arg,
uint64 seq_no)
{
return rpl_global_gtid_binlog_state.check_strict_sequence(domain_id,
- server_id, seq_no);
+ server_id_arg,
+ seq_no);
}
@@ -5894,6 +6011,16 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
ulong UNINIT_VAR(prev_binlog_id);
DBUG_ENTER("MYSQL_BIN_LOG::write(Log_event *)");
+ /*
+ When binary logging is not enabled (--log-bin=0), wsrep-patch partially
+ enables it without opening the binlog file (MYSQL_BIN_LOG::open().
+ So, avoid writing to binlog file.
+ */
+ if (direct &&
+ (wsrep_emulate_bin_log ||
+ (WSREP(thd) && !(thd->variables.option_bits & OPTION_BIN_LOG))))
+ DBUG_RETURN(0);
+
if (thd->variables.option_bits & OPTION_GTID_BEGIN)
{
DBUG_PRINT("info", ("OPTION_GTID_BEGIN was set"));
@@ -5940,7 +6067,17 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
binlog_[wild_]{do|ignore}_table?" (WL#1049)"
*/
const char *local_db= event_info->get_db();
- if ((!(thd->variables.option_bits & OPTION_BIN_LOG)) ||
+
+ bool option_bin_log_flag= (thd->variables.option_bits & OPTION_BIN_LOG);
+
+ /*
+ Log all updates to binlog cache so that they can get replicated to other
+ nodes. A check has been added to stop them from getting logged into
+ binary log files.
+ */
+ if (WSREP(thd)) option_bin_log_flag= true;
+
+ if ((!(option_bin_log_flag)) ||
(thd->lex->sql_command != SQLCOM_ROLLBACK_TO_SAVEPOINT &&
thd->lex->sql_command != SQLCOM_SAVEPOINT &&
!binlog_filter->db_ok(local_db)))
@@ -5962,11 +6099,12 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
prev_binlog_id= current_binlog_id;
DBUG_EXECUTE_IF("binlog_force_commit_id",
{
- const LEX_STRING name= { C_STRING_WITH_LEN("commit_id") };
+ const LEX_STRING commit_name= { C_STRING_WITH_LEN("commit_id") };
bool null_value;
user_var_entry *entry=
(user_var_entry*) my_hash_search(&thd->user_vars,
- (uchar*) name.str, name.length);
+ (uchar*) commit_name.str,
+ commit_name.length);
commit_id= entry->val_int(&null_value);
});
if (write_gtid_event(thd, true, using_trans, commit_id))
@@ -6004,7 +6142,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
Annotate_rows_log_event anno(thd, using_trans, direct);
/* Annotate event should be written not more than once */
*with_annotate= 0;
- if (anno.write(file))
+ if (write_event(&anno, file))
goto err;
}
@@ -6018,7 +6156,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
Intvar_log_event e(thd,(uchar) LAST_INSERT_ID_EVENT,
thd->first_successful_insert_id_in_prev_stmt_for_binlog,
using_trans, direct);
- if (e.write(file))
+ if (write_event(&e, file))
goto err;
}
if (thd->auto_inc_intervals_in_cur_stmt_for_binlog.nb_elements() > 0)
@@ -6029,14 +6167,14 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
Intvar_log_event e(thd, (uchar) INSERT_ID_EVENT,
thd->auto_inc_intervals_in_cur_stmt_for_binlog.
minimum(), using_trans, direct);
- if (e.write(file))
+ if (write_event(&e, file))
goto err;
}
if (thd->rand_used)
{
Rand_log_event e(thd,thd->rand_saved_seed1,thd->rand_saved_seed2,
using_trans, direct);
- if (e.write(file))
+ if (write_event(&e, file))
goto err;
}
if (thd->user_var_events.elements)
@@ -6060,7 +6198,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
flags,
using_trans,
direct);
- if (e.write(file))
+ if (write_event(&e, file))
goto err;
}
}
@@ -6070,7 +6208,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
/*
Write the event.
*/
- if (event_info->write(file) ||
+ if (write_event(event_info, file) ||
DBUG_EVALUATE_IF("injecting_fault_writing", 1, 0))
goto err;
@@ -6449,33 +6587,35 @@ uint MYSQL_BIN_LOG::next_file_id()
return res;
}
+class CacheWriter: public Log_event_writer
+{
+public:
+ ulong remains;
-/**
- Calculate checksum of possibly a part of an event containing at least
- the whole common header.
-
- @param buf the pointer to trans cache's buffer
- @param off the offset of the beginning of the event in the buffer
- @param event_len no-checksum length of the event
- @param length the current size of the buffer
-
- @param crc [in-out] the checksum
+ CacheWriter(THD *thd_arg, IO_CACHE *file_arg, bool do_checksum,
+ Binlog_crypt_data *cr)
+ : Log_event_writer(file_arg, cr), remains(0), thd(thd_arg), first(true)
+ { checksum_len= do_checksum ? BINLOG_CHECKSUM_LEN : 0; }
- Event size in incremented by @c BINLOG_CHECKSUM_LEN.
+ ~CacheWriter()
+ { status_var_add(thd->status_var.binlog_bytes_written, bytes_written); }
- @return 0 or number of unprocessed yet bytes of the event excluding
- the checksum part.
-*/
- static ulong fix_log_event_crc(uchar *buf, uint off, uint event_len,
- uint length, ha_checksum *crc)
-{
- ulong ret;
- uchar *event_begin= buf + off;
+ int write(uchar* pos, size_t len)
+ {
+ if (first)
+ write_header(pos, len);
+ else
+ write_data(pos, len);
- ret= length >= off + event_len ? 0 : off + event_len - length;
- *crc= my_checksum(*crc, event_begin, event_len - ret);
- return ret;
-}
+ remains -= len;
+ if ((first= !remains))
+ write_footer();
+ return 0;
+ }
+private:
+ THD *thd;
+ bool first;
+};
/*
Write the contents of a cache to the binary log.
@@ -6496,20 +6636,22 @@ uint MYSQL_BIN_LOG::next_file_id()
int MYSQL_BIN_LOG::write_cache(THD *thd, IO_CACHE *cache)
{
+ DBUG_ENTER("MYSQL_BIN_LOG::write_cache");
+
mysql_mutex_assert_owner(&LOCK_log);
if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0))
- return ER_ERROR_ON_WRITE;
+ DBUG_RETURN(ER_ERROR_ON_WRITE);
uint length= my_b_bytes_in_cache(cache), group, carry, hdr_offs;
- ulong remains= 0; // part of unprocessed yet netto length of the event
long val;
ulong end_log_pos_inc= 0; // each event processed adds BINLOG_CHECKSUM_LEN 2 t
uchar header[LOG_EVENT_HEADER_LEN];
- ha_checksum crc= 0, crc_0= 0; // assignments to keep compiler happy
- my_bool do_checksum= (binlog_checksum_options != BINLOG_CHECKSUM_ALG_OFF);
- uchar buf[BINLOG_CHECKSUM_LEN];
+ CacheWriter writer(thd, &log_file, binlog_checksum_options, &crypto);
+
+ if (crypto.scheme)
+ writer.ctx= alloca(crypto.ctx_size);
// while there is just one alg the following must hold:
- DBUG_ASSERT(!do_checksum ||
+ DBUG_ASSERT(binlog_checksum_options == BINLOG_CHECKSUM_ALG_OFF ||
binlog_checksum_options == BINLOG_CHECKSUM_ALG_CRC32);
/*
@@ -6528,8 +6670,6 @@ int MYSQL_BIN_LOG::write_cache(THD *thd, IO_CACHE *cache)
group= (uint)my_b_tell(&log_file);
hdr_offs= carry= 0;
- if (do_checksum)
- crc= crc_0= my_checksum(0L, NULL, 0);
do
{
@@ -6540,53 +6680,40 @@ int MYSQL_BIN_LOG::write_cache(THD *thd, IO_CACHE *cache)
if (unlikely(carry > 0))
{
DBUG_ASSERT(carry < LOG_EVENT_HEADER_LEN);
+ uint tail= LOG_EVENT_HEADER_LEN - carry;
/* assemble both halves */
- memcpy(&header[carry], (char *)cache->read_pos,
- LOG_EVENT_HEADER_LEN - carry);
+ memcpy(&header[carry], (char *)cache->read_pos, tail);
+
+ ulong len= uint4korr(header + EVENT_LEN_OFFSET);
+ writer.remains= len;
/* fix end_log_pos */
- val= uint4korr(&header[LOG_POS_OFFSET]) + group +
- (end_log_pos_inc+= (do_checksum ? BINLOG_CHECKSUM_LEN : 0));
- int4store(&header[LOG_POS_OFFSET], val);
+ end_log_pos_inc += writer.checksum_len;
+ val= uint4korr(header + LOG_POS_OFFSET) + group + end_log_pos_inc;
+ int4store(header + LOG_POS_OFFSET, val);
- if (do_checksum)
- {
- ulong len= uint4korr(&header[EVENT_LEN_OFFSET]);
- /* fix len */
- int4store(&header[EVENT_LEN_OFFSET], len + BINLOG_CHECKSUM_LEN);
- }
+ /* fix len */
+ len+= writer.checksum_len;
+ int4store(header + EVENT_LEN_OFFSET, len);
- /* write the first half of the split header */
- if (my_b_write(&log_file, header, carry))
- return ER_ERROR_ON_WRITE;
- status_var_add(thd->status_var.binlog_bytes_written, carry);
+ if (writer.write(header, LOG_EVENT_HEADER_LEN))
+ DBUG_RETURN(ER_ERROR_ON_WRITE);
- /*
- copy fixed second half of header to cache so the correct
- version will be written later.
- */
- memcpy((char *)cache->read_pos, &header[carry],
- LOG_EVENT_HEADER_LEN - carry);
+ cache->read_pos+= tail;
+ length-= tail;
+ carry= 0;
/* next event header at ... */
- hdr_offs= uint4korr(&header[EVENT_LEN_OFFSET]) - carry -
- (do_checksum ? BINLOG_CHECKSUM_LEN : 0);
-
- if (do_checksum)
- {
- DBUG_ASSERT(crc == crc_0 && remains == 0);
- crc= my_checksum(crc, header, carry);
- remains= uint4korr(header + EVENT_LEN_OFFSET) - carry -
- BINLOG_CHECKSUM_LEN;
- }
- carry= 0;
+ hdr_offs= len - LOG_EVENT_HEADER_LEN - writer.checksum_len;
}
/* if there is anything to write, process it. */
if (likely(length > 0))
{
+ DBUG_EXECUTE_IF("fail_binlog_write_1",
+ errno= 28; DBUG_RETURN(ER_ERROR_ON_WRITE););
/*
process all event-headers in this (partial) cache.
if next header is beyond current read-buffer,
@@ -6594,52 +6721,28 @@ int MYSQL_BIN_LOG::write_cache(THD *thd, IO_CACHE *cache)
very next iteration, just "eventually").
*/
- /* crc-calc the whole buffer */
- if (do_checksum && hdr_offs >= length)
+ if (hdr_offs >= length)
{
-
- DBUG_ASSERT(remains != 0 && crc != crc_0);
-
- crc= my_checksum(crc, cache->read_pos, length);
- remains -= length;
- if (my_b_write(&log_file, cache->read_pos, length))
- return ER_ERROR_ON_WRITE;
- if (remains == 0)
- {
- int4store(buf, crc);
- if (my_b_write(&log_file, buf, BINLOG_CHECKSUM_LEN))
- return ER_ERROR_ON_WRITE;
- crc= crc_0;
- }
+ if (writer.write(cache->read_pos, length))
+ DBUG_RETURN(ER_ERROR_ON_WRITE);
}
while (hdr_offs < length)
{
/*
- partial header only? save what we can get, process once
- we get the rest.
+ finish off with remains of the last event that crawls
+ from previous into the current buffer
*/
-
- if (do_checksum)
+ if (writer.remains != 0)
{
- if (remains != 0)
- {
- /*
- finish off with remains of the last event that crawls
- from previous into the current buffer
- */
- DBUG_ASSERT(crc != crc_0);
- crc= my_checksum(crc, cache->read_pos, hdr_offs);
- int4store(buf, crc);
- remains -= hdr_offs;
- DBUG_ASSERT(remains == 0);
- if (my_b_write(&log_file, cache->read_pos, hdr_offs) ||
- my_b_write(&log_file, buf, BINLOG_CHECKSUM_LEN))
- return ER_ERROR_ON_WRITE;
- crc= crc_0;
- }
+ if (writer.write(cache->read_pos, hdr_offs))
+ DBUG_RETURN(ER_ERROR_ON_WRITE);
}
+ /*
+ partial header only? save what we can get, process once
+ we get the rest.
+ */
if (hdr_offs + LOG_EVENT_HEADER_LEN > length)
{
carry= length - hdr_offs;
@@ -6650,37 +6753,25 @@ int MYSQL_BIN_LOG::write_cache(THD *thd, IO_CACHE *cache)
{
/* we've got a full event-header, and it came in one piece */
uchar *ev= (uchar *)cache->read_pos + hdr_offs;
- uint event_len= uint4korr(ev + EVENT_LEN_OFFSET); // netto len
+ uint ev_len= uint4korr(ev + EVENT_LEN_OFFSET); // netto len
uchar *log_pos= ev + LOG_POS_OFFSET;
+ end_log_pos_inc += writer.checksum_len;
/* fix end_log_pos */
- val= uint4korr(log_pos) + group +
- (end_log_pos_inc += (do_checksum ? BINLOG_CHECKSUM_LEN : 0));
+ val= uint4korr(log_pos) + group + end_log_pos_inc;
int4store(log_pos, val);
- /* fix CRC */
- if (do_checksum)
- {
- /* fix length */
- int4store(ev + EVENT_LEN_OFFSET, event_len + BINLOG_CHECKSUM_LEN);
- remains= fix_log_event_crc(cache->read_pos, hdr_offs, event_len,
- length, &crc);
- if (my_b_write(&log_file, ev,
- remains == 0 ? event_len : length - hdr_offs))
- return ER_ERROR_ON_WRITE;
- if (remains == 0)
- {
- int4store(buf, crc);
- if (my_b_write(&log_file, buf, BINLOG_CHECKSUM_LEN))
- return ER_ERROR_ON_WRITE;
- crc= crc_0; // crc is complete
- }
- }
+ /* fix length */
+ int4store(ev + EVENT_LEN_OFFSET, ev_len + writer.checksum_len);
+
+ writer.remains= ev_len;
+ if (writer.write(ev, std::min<uint>(ev_len, length - hdr_offs)))
+ DBUG_RETURN(ER_ERROR_ON_WRITE);
/* next event header at ... */
- hdr_offs += event_len; // incr by the netto len
+ hdr_offs += ev_len; // incr by the netto len
- DBUG_ASSERT(!do_checksum || remains == 0 || hdr_offs >= length);
+ DBUG_ASSERT(!writer.checksum_len || writer.remains == 0 || hdr_offs >= length);
}
}
@@ -6694,22 +6785,12 @@ int MYSQL_BIN_LOG::write_cache(THD *thd, IO_CACHE *cache)
*/
hdr_offs -= length;
}
-
- /* Write data to the binary log file */
- DBUG_EXECUTE_IF("fail_binlog_write_1",
- errno= 28; return ER_ERROR_ON_WRITE;);
- if (!do_checksum)
- if (my_b_write(&log_file, cache->read_pos, length))
- return ER_ERROR_ON_WRITE;
- status_var_add(thd->status_var.binlog_bytes_written, length);
-
} while ((length= my_b_fill(cache)));
DBUG_ASSERT(carry == 0);
- DBUG_ASSERT(!do_checksum || remains == 0);
- DBUG_ASSERT(!do_checksum || crc == crc_0);
+ DBUG_ASSERT(!writer.checksum_len || writer.remains == 0);
- return 0; // All OK
+ DBUG_RETURN(0); // All OK
}
/*
@@ -6752,7 +6833,7 @@ bool MYSQL_BIN_LOG::write_incident_already_locked(THD *thd)
if (likely(is_open()))
{
- error= ev.write(&log_file);
+ error= write_event(&ev);
status_var_add(thd->status_var.binlog_bytes_written, ev.data_written);
}
@@ -6805,17 +6886,16 @@ bool MYSQL_BIN_LOG::write_incident(THD *thd)
}
void
-MYSQL_BIN_LOG::write_binlog_checkpoint_event_already_locked(const char *name,
- uint len)
+MYSQL_BIN_LOG::write_binlog_checkpoint_event_already_locked(const char *name_arg, uint len)
{
my_off_t offset;
- Binlog_checkpoint_log_event ev(name, len);
+ Binlog_checkpoint_log_event ev(name_arg, len);
/*
Note that we must sync the binlog checkpoint to disk.
Otherwise a subsequent log purge could delete binlogs that XA recovery
thinks are needed (even though they are not really).
*/
- if (!ev.write(&log_file) && !flush_and_sync(0))
+ if (!write_event(&ev) && !flush_and_sync(0))
{
signal_update();
}
@@ -6881,7 +6961,12 @@ MYSQL_BIN_LOG::write_transaction_to_binlog(THD *thd,
Ha_trx_info *ha_info;
DBUG_ENTER("MYSQL_BIN_LOG::write_transaction_to_binlog");
- if (wsrep_emulate_bin_log)
+ /*
+ Control should not be allowed beyond this point in wsrep_emulate_bin_log
+ mode. Also, do not write the cached updates to binlog if binary logging is
+ disabled (log-bin/sql_log_bin).
+ */
+ if (wsrep_emulate_bin_log || !(thd->variables.option_bits & OPTION_BIN_LOG))
DBUG_RETURN(0);
entry.thd= thd;
@@ -7041,7 +7126,8 @@ MYSQL_BIN_LOG::queue_for_group_commit(group_commit_entry *orig_entry)
wfc->wakeup_error= orig_entry->thd->killed_errno();
if (!wfc->wakeup_error)
wfc->wakeup_error= ER_QUERY_INTERRUPTED;
- my_message(wfc->wakeup_error, ER(wfc->wakeup_error), MYF(0));
+ my_message(wfc->wakeup_error,
+ ER_THD(orig_entry->thd, wfc->wakeup_error), MYF(0));
DBUG_RETURN(-1);
}
}
@@ -7408,11 +7494,12 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader)
commit_id= (last_in_queue == leader ? 0 : (uint64)leader->thd->query_id);
DBUG_EXECUTE_IF("binlog_force_commit_id",
{
- const LEX_STRING name= { C_STRING_WITH_LEN("commit_id") };
+ const LEX_STRING commit_name= { C_STRING_WITH_LEN("commit_id") };
bool null_value;
user_var_entry *entry=
(user_var_entry*) my_hash_search(&leader->thd->user_vars,
- (uchar*) name.str, name.length);
+ (uchar*) commit_name.str,
+ commit_name.length);
commit_id= entry->val_int(&null_value);
});
/*
@@ -7716,7 +7803,7 @@ MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry *entry,
DBUG_RETURN(ER_ERROR_ON_WRITE);
});
- if (entry->end_event->write(&log_file))
+ if (write_event(entry->end_event))
{
entry->error_cache= NULL;
DBUG_RETURN(ER_ERROR_ON_WRITE);
@@ -7726,7 +7813,7 @@ MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry *entry,
if (entry->incident_event)
{
- if (entry->incident_event->write(&log_file))
+ if (write_event(entry->incident_event))
{
entry->error_cache= NULL;
DBUG_RETURN(ER_ERROR_ON_WRITE);
@@ -7846,14 +7933,13 @@ void
MYSQL_BIN_LOG::binlog_trigger_immediate_group_commit()
{
group_commit_entry *head;
- mysql_mutex_lock(&LOCK_prepare_ordered);
+ mysql_mutex_assert_owner(&LOCK_prepare_ordered);
head= group_commit_queue;
if (head)
{
head->thd->has_waiter= true;
mysql_cond_signal(&COND_prepare_ordered);
}
- mysql_mutex_unlock(&LOCK_prepare_ordered);
}
@@ -7872,9 +7958,11 @@ binlog_report_wait_for(THD *thd1, THD *thd2)
{
if (opt_binlog_commit_wait_count == 0)
return;
+ mysql_mutex_lock(&LOCK_prepare_ordered);
thd2->has_waiter= true;
if (thd2->waiting_on_group_commit)
mysql_bin_log.binlog_trigger_immediate_group_commit();
+ mysql_mutex_unlock(&LOCK_prepare_ordered);
}
@@ -7980,11 +8068,11 @@ void MYSQL_BIN_LOG::close(uint exiting)
{
Stop_log_event s;
// the checksumming rule for relay-log case is similar to Rotate
- s.checksum_alg= is_relay_log ?
- (uint8) relay_log_checksum_alg : (uint8) binlog_checksum_options;
+ s.checksum_alg= is_relay_log ? relay_log_checksum_alg
+ : (enum_binlog_checksum_alg)binlog_checksum_options;
DBUG_ASSERT(!is_relay_log ||
relay_log_checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF);
- s.write(&log_file);
+ write_event(&s);
bytes_written+= s.data_written;
signal_update();
@@ -8042,7 +8130,8 @@ void MYSQL_BIN_LOG::close(uint exiting)
if (mysql_file_close(index_file.file, MYF(0)) < 0 && ! write_error)
{
write_error= 1;
- sql_print_error(ER(ER_ERROR_ON_WRITE), index_file_name, errno);
+ sql_print_error(ER_THD_OR_DEFAULT(current_thd, ER_ERROR_ON_WRITE),
+ index_file_name, errno);
}
}
log_state= (exiting & LOG_CLOSE_TO_BE_OPENED) ? LOG_TO_BE_OPENED : LOG_CLOSED;
@@ -8269,7 +8358,8 @@ static void print_buffer_to_file(enum loglevel level, const char *buffer,
Add tag for slaves so that the user can see from which connection
the error originates.
*/
- tag_length= my_snprintf(tag, sizeof(tag), ER(ER_MASTER_LOG_PREFIX),
+ tag_length= my_snprintf(tag, sizeof(tag),
+ ER_THD(thd, ER_MASTER_LOG_PREFIX),
(int) thd->connection_name.length,
thd->connection_name.str);
}
@@ -9144,7 +9234,7 @@ int TC_LOG_BINLOG::open(const char *opt_name)
if (using_heuristic_recover())
{
/* generate a new binlog to mask a corrupted one */
- open(opt_name, LOG_BIN, 0, WRITE_CACHE, max_binlog_size, 0, TRUE);
+ open(opt_name, LOG_BIN, 0, 0, WRITE_CACHE, max_binlog_size, 0, TRUE);
cleanup();
return 1;
}
@@ -9462,7 +9552,7 @@ binlog_background_thread(void *arg __attribute__((unused)))
while (queue)
{
THD_STAGE_INFO(thd, stage_binlog_processing_checkpoint_notify);
- DEBUG_SYNC(current_thd, "binlog_background_thread_before_mark_xid_done");
+ DEBUG_SYNC(thd, "binlog_background_thread_before_mark_xid_done");
/* Grab next pointer first, as mark_xid_done() may free the element. */
next= queue->next_in_queue;
mysql_bin_log.mark_xid_done(queue->binlog_id, true);
@@ -9643,6 +9733,13 @@ int TC_LOG_BINLOG::recover(LOG_INFO *linfo, const char *last_log_name,
break;
#endif
+ case START_ENCRYPTION_EVENT:
+ {
+ if (fdle->start_decryption((Start_encryption_log_event*) ev))
+ goto err2;
+ }
+ break;
+
default:
/* Nothing. */
break;
@@ -9719,6 +9816,7 @@ int TC_LOG_BINLOG::recover(LOG_INFO *linfo, const char *last_log_name,
sql_print_error("Error reading binlog files during recovery. Aborting.");
goto err2;
}
+ fdle->reset_crypto();
}
if (do_xa)
@@ -9917,7 +10015,7 @@ binlog_checksum_update(MYSQL_THD thd, struct st_mysql_sys_var *var,
{
prev_binlog_id= mysql_bin_log.current_binlog_id;
if (binlog_checksum_options != value)
- mysql_bin_log.checksum_alg_reset= (uint8) value;
+ mysql_bin_log.checksum_alg_reset= (enum_binlog_checksum_alg)value;
if (mysql_bin_log.rotate(true, &check_purge))
check_purge= false;
}
@@ -10082,7 +10180,14 @@ void thd_binlog_trx_reset(THD * thd)
binlog_cache_mngr *const cache_mngr=
(binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
if (cache_mngr)
+ {
cache_mngr->reset(false, true);
+ if (!cache_mngr->stmt_cache.empty())
+ {
+ WSREP_DEBUG("pending events in stmt cache, sql: %s", thd->query());
+ cache_mngr->stmt_cache.reset();
+ }
+ }
}
thd->clear_binlog_table_maps();
}
diff --git a/sql/log.h b/sql/log.h
index a48b09cb9fc..9bf80d6e603 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -17,10 +17,10 @@
#ifndef LOG_H
#define LOG_H
-#include "unireg.h" // REQUIRED: for other includes
#include "handler.h" /* my_xid */
#include "wsrep.h"
#include "wsrep_mysqld.h"
+#include "rpl_constants.h"
class Relay_log_info;
@@ -313,19 +313,22 @@ public:
#endif
const char *log_name,
enum_log_type log_type,
- const char *new_name,
+ const char *new_name, ulong next_file_number,
enum cache_type io_cache_type_arg);
bool init_and_set_log_file_name(const char *log_name,
const char *new_name,
+ ulong next_log_number,
enum_log_type log_type_arg,
enum cache_type io_cache_type_arg);
void init(enum_log_type log_type_arg,
enum cache_type io_cache_type_arg);
void close(uint exiting);
inline bool is_open() { return log_state != LOG_CLOSED; }
- const char *generate_name(const char *log_name, const char *suffix,
+ const char *generate_name(const char *log_name,
+ const char *suffix,
bool strip_ext, char *buff);
- int generate_new_name(char *new_name, const char *log_name);
+ int generate_new_name(char *new_name, const char *log_name,
+ ulong next_log_number);
protected:
/* LOCK_log is inited by init_pthread_objects() */
mysql_mutex_t LOCK_log;
@@ -366,7 +369,7 @@ public:
key_file_slow_log,
#endif
generate_name(log_name, "-slow.log", 0, buf),
- LOG_NORMAL, 0, WRITE_CACHE);
+ LOG_NORMAL, 0, 0, WRITE_CACHE);
}
bool open_query_log(const char *log_name)
{
@@ -376,7 +379,7 @@ public:
key_file_query_log,
#endif
generate_name(log_name, ".log", 0, buf),
- LOG_NORMAL, 0, WRITE_CACHE);
+ LOG_NORMAL, 0, 0, WRITE_CACHE);
}
private:
@@ -524,6 +527,9 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
ulonglong group_commit_trigger_count, group_commit_trigger_timeout;
ulonglong group_commit_trigger_lock_wait;
+ /* binlog encryption data */
+ struct Binlog_crypt_data crypto;
+
/* pointer to the sync period variable, for binlog this will be
sync_binlog_period, for relay log this will be
sync_relay_log_period
@@ -588,7 +594,7 @@ public:
/* This is relay log */
bool is_relay_log;
ulong signal_cnt; // update of the counter is checked by heartbeat
- uint8 checksum_alg_reset; // to contain a new value when binlog is rotated
+ enum enum_binlog_checksum_alg checksum_alg_reset; // to contain a new value when binlog is rotated
/*
Holds the last seen in Relay-Log FD's checksum alg value.
The initial value comes from the slave's local FD that heads
@@ -622,7 +628,7 @@ public:
(A) - checksum algorithm descriptor value
FD.(A) - the value of (A) in FD
*/
- uint8 relay_log_checksum_alg;
+ enum enum_binlog_checksum_alg relay_log_checksum_alg;
/*
These describe the log's format. This is used only for relay logs.
_for_exec is used by the SQL thread, _for_queue by the I/O thread. It's
@@ -707,6 +713,7 @@ public:
bool open(const char *log_name,
enum_log_type log_type,
const char *new_name,
+ ulong next_log_number,
enum cache_type io_cache_type_arg,
ulong max_size,
bool null_created,
@@ -733,11 +740,10 @@ public:
void stop_union_events(THD *thd);
bool is_query_in_union(THD *thd, query_id_t query_id_param);
- /*
- v stands for vector
- invoked as appendv(buf1,len1,buf2,len2,...,bufn,lenn,0)
- */
- bool appendv(const char* buf,uint len,...);
+ bool write_event(Log_event *ev, IO_CACHE *file);
+ bool write_event(Log_event *ev) { return write_event(ev, &log_file); }
+
+ bool write_event_buffer(uchar* buf,uint len);
bool append(Log_event* ev);
bool append_no_lock(Log_event* ev);
@@ -780,7 +786,8 @@ public:
int purge_index_entry(THD *thd, ulonglong *decrease_log_space,
bool need_mutex);
bool reset_logs(THD* thd, bool create_new_log,
- rpl_gtid *init_state, uint32 init_state_len);
+ rpl_gtid *init_state, uint32 init_state_len,
+ ulong next_log_number);
void close(uint exiting);
void clear_inuse_flag_when_closing(File file);
@@ -1058,8 +1065,7 @@ int vprint_msg_to_log(enum loglevel level, const char *format, va_list args);
void sql_print_error(const char *format, ...);
void sql_print_warning(const char *format, ...);
void sql_print_information(const char *format, ...);
-typedef void (*sql_print_message_func)(const char *format, ...)
- ATTRIBUTE_FORMAT_FPTR(printf, 1, 2);
+typedef void (*sql_print_message_func)(const char *format, ...);
extern sql_print_message_func sql_print_message_handlers[];
int error_log_print(enum loglevel level, const char *format,
@@ -1087,6 +1093,8 @@ void binlog_reset_cache(THD *thd);
extern MYSQL_PLUGIN_IMPORT MYSQL_BIN_LOG mysql_bin_log;
extern LOGGER logger;
+extern const char *log_bin_index;
+extern const char *log_bin_basename;
/**
Turns a relative log binary log path into a full path, based on the
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 95438b69348..2bc9b6559e0 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -49,6 +49,7 @@
#include <base64.h>
#include <my_bitmap.h>
#include "rpl_utility.h"
+#include "rpl_constants.h"
#include "sql_digest.h"
#define my_b_write_string(A, B) my_b_write((A), (uchar*)(B), (uint) (sizeof(B) - 1))
@@ -518,6 +519,28 @@ pretty_print_str(String *packet, const char *str, int len)
}
#endif /* !MYSQL_CLIENT */
+#ifndef DBUG_OFF
+#define DBUG_DUMP_EVENT_BUF(B,L) \
+ do { \
+ const uchar *_buf=(uchar*)(B); \
+ size_t _len=(L); \
+ if (_len >= LOG_EVENT_MINIMAL_HEADER_LEN) \
+ { \
+ DBUG_PRINT("data", ("header: timestamp:%u type:%u server_id:%u len:%u log_pos:%u flags:%u", \
+ uint4korr(_buf), _buf[EVENT_TYPE_OFFSET], \
+ uint4korr(_buf+SERVER_ID_OFFSET), \
+ uint4korr(_buf+EVENT_LEN_OFFSET), \
+ uint4korr(_buf+LOG_POS_OFFSET), \
+ uint4korr(_buf+FLAGS_OFFSET))); \
+ DBUG_DUMP("data", _buf+LOG_EVENT_MINIMAL_HEADER_LEN, \
+ _len-LOG_EVENT_MINIMAL_HEADER_LEN); \
+ } \
+ else \
+ DBUG_DUMP("data", _buf, _len); \
+ } while(0)
+#else
+#define DBUG_DUMP_EVENT_BUF(B,L) do { } while(0)
+#endif
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
@@ -645,19 +668,6 @@ static void cleanup_load_tmpdir(LEX_STRING *connection_name)
/*
- write_str()
-*/
-
-static bool write_str(IO_CACHE *file, const char *str, uint length)
-{
- uchar tmp[1];
- tmp[0]= (uchar) length;
- return (my_b_safe_write(file, tmp, sizeof(tmp)) ||
- my_b_safe_write(file, (uchar*) str, length));
-}
-
-
-/*
read_str()
*/
@@ -806,6 +816,7 @@ const char* Log_event::get_type_str(Log_event_type type)
case BINLOG_CHECKPOINT_EVENT: return "Binlog_checkpoint";
case GTID_EVENT: return "Gtid";
case GTID_LIST_EVENT: return "Gtid_list";
+ case START_ENCRYPTION_EVENT: return "Start_encryption";
default: return "Unknown"; /* impossible */
}
}
@@ -822,8 +833,7 @@ const char* Log_event::get_type_str()
#ifndef MYSQL_CLIENT
Log_event::Log_event(THD* thd_arg, uint16 flags_arg, bool using_trans)
- :log_pos(0), temp_buf(0), exec_time(0),
- crc(0), thd(thd_arg),
+ :log_pos(0), temp_buf(0), exec_time(0), thd(thd_arg),
checksum_alg(BINLOG_CHECKSUM_ALG_UNDEF)
{
server_id= thd->variables.server_id;
@@ -847,8 +857,7 @@ Log_event::Log_event(THD* thd_arg, uint16 flags_arg, bool using_trans)
*/
Log_event::Log_event()
- :temp_buf(0), exec_time(0), flags(0),
- cache_type(Log_event::EVENT_INVALID_CACHE), crc(0),
+ :temp_buf(0), exec_time(0), flags(0), cache_type(EVENT_INVALID_CACHE),
thd(0), checksum_alg(BINLOG_CHECKSUM_ALG_UNDEF)
{
server_id= global_system_variables.server_id;
@@ -870,7 +879,7 @@ Log_event::Log_event()
Log_event::Log_event(const char* buf,
const Format_description_log_event* description_event)
:temp_buf(0), exec_time(0), cache_type(Log_event::EVENT_INVALID_CACHE),
- crc(0), checksum_alg(BINLOG_CHECKSUM_ALG_UNDEF)
+ checksum_alg(BINLOG_CHECKSUM_ALG_UNDEF)
{
#ifndef MYSQL_CLIENT
thd = 0;
@@ -1034,18 +1043,31 @@ int Log_event::net_send(THD *thd, Protocol *protocol, const char* log_name,
EVENTS.
*/
-void Log_event::init_show_field_list(List<Item>* field_list)
-{
- field_list->push_back(new Item_empty_string("Log_name", 20));
- field_list->push_back(new Item_return_int("Pos", MY_INT32_NUM_DECIMAL_DIGITS,
- MYSQL_TYPE_LONGLONG));
- field_list->push_back(new Item_empty_string("Event_type", 20));
- field_list->push_back(new Item_return_int("Server_id", 10,
- MYSQL_TYPE_LONG));
- field_list->push_back(new Item_return_int("End_log_pos",
- MY_INT32_NUM_DECIMAL_DIGITS,
- MYSQL_TYPE_LONGLONG));
- field_list->push_back(new Item_empty_string("Info", 20));
+void Log_event::init_show_field_list(THD *thd, List<Item>* field_list)
+{
+ MEM_ROOT *mem_root= thd->mem_root;
+ field_list->push_back(new (mem_root)
+ Item_empty_string(thd, "Log_name", 20),
+ mem_root);
+ field_list->push_back(new (mem_root)
+ Item_return_int(thd, "Pos",
+ MY_INT32_NUM_DECIMAL_DIGITS,
+ MYSQL_TYPE_LONGLONG),
+ mem_root);
+ field_list->push_back(new (mem_root)
+ Item_empty_string(thd, "Event_type", 20),
+ mem_root);
+ field_list->push_back(new (mem_root)
+ Item_return_int(thd, "Server_id", 10,
+ MYSQL_TYPE_LONG),
+ mem_root);
+ field_list->push_back(new (mem_root)
+ Item_return_int(thd, "End_log_pos",
+ MY_INT32_NUM_DECIMAL_DIGITS,
+ MYSQL_TYPE_LONGLONG),
+ mem_root);
+ field_list->push_back(new (mem_root) Item_empty_string(thd, "Info", 20),
+ mem_root);
}
/**
@@ -1076,12 +1098,14 @@ my_bool Log_event::need_checksum()
and Stop event)
provides their checksum alg preference through Log_event::checksum_alg.
*/
- ret= ((checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF) ?
- (checksum_alg != BINLOG_CHECKSUM_ALG_OFF) :
- ((binlog_checksum_options != BINLOG_CHECKSUM_ALG_OFF) &&
- (cache_type == Log_event::EVENT_NO_CACHE)) ?
- MY_TEST(binlog_checksum_options) : FALSE);
-
+ if (checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF)
+ ret= checksum_alg != BINLOG_CHECKSUM_ALG_OFF;
+ else
+ {
+ ret= binlog_checksum_options && cache_type == Log_event::EVENT_NO_CACHE;
+ checksum_alg= ret ? (enum_binlog_checksum_alg)binlog_checksum_options
+ : BINLOG_CHECKSUM_ALG_OFF;
+ }
/*
FD calls the methods before data_written has been calculated.
The following invariant claims if the current is not the first
@@ -1092,10 +1116,6 @@ my_bool Log_event::need_checksum()
DBUG_ASSERT(get_type_code() != FORMAT_DESCRIPTION_EVENT || ret ||
data_written == 0);
- if (checksum_alg == BINLOG_CHECKSUM_ALG_UNDEF)
- checksum_alg= ret ? // calculated value stored
- (uint8) binlog_checksum_options : (uint8) BINLOG_CHECKSUM_ALG_OFF;
-
DBUG_ASSERT(!ret ||
((checksum_alg == binlog_checksum_options ||
/*
@@ -1110,8 +1130,9 @@ my_bool Log_event::need_checksum()
the local RL's Rotate and the master's Rotate
which IO thread instantiates via queue_binlog_ver_3_event.
*/
- get_type_code() == ROTATE_EVENT
- || /* FD is always checksummed */
+ get_type_code() == ROTATE_EVENT ||
+ get_type_code() == START_ENCRYPTION_EVENT ||
+ /* FD is always checksummed */
get_type_code() == FORMAT_DESCRIPTION_EVENT) &&
checksum_alg != BINLOG_CHECKSUM_ALG_OFF));
@@ -1125,51 +1146,145 @@ my_bool Log_event::need_checksum()
DBUG_RETURN(ret);
}
-bool Log_event::wrapper_my_b_safe_write(IO_CACHE* file, const uchar* buf, ulong size)
+int Log_event_writer::write_internal(const uchar *pos, size_t len)
+{
+ if (my_b_safe_write(file, pos, len))
+ return 1;
+ bytes_written+= len;
+ return 0;
+}
+
+/*
+ as soon as encryption produces the first output block, write event_len
+ where it should be in a valid event header
+*/
+int Log_event_writer::maybe_write_event_len(uchar *pos, size_t len)
+{
+ if (len && event_len)
+ {
+ DBUG_ASSERT(len >= EVENT_LEN_OFFSET);
+ if (write_internal(pos + EVENT_LEN_OFFSET - 4, 4))
+ return 1;
+ int4store(pos + EVENT_LEN_OFFSET - 4, event_len);
+ event_len= 0;
+ }
+ return 0;
+}
+
+int Log_event_writer::encrypt_and_write(const uchar *pos, size_t len)
{
- if (need_checksum() && size != 0)
- crc= my_checksum(crc, buf, size);
+ uchar *dst= 0;
+ size_t dstsize= 0;
+
+ if (ctx)
+ {
+ dstsize= encryption_encrypted_length(len, ENCRYPTION_KEY_SYSTEM_DATA,
+ crypto->key_version);
+ if (!(dst= (uchar*)my_safe_alloca(dstsize)))
+ return 1;
- return my_b_safe_write(file, buf, size);
+ uint dstlen;
+ if (encryption_ctx_update(ctx, pos, len, dst, &dstlen))
+ goto err;
+ if (maybe_write_event_len(dst, dstlen))
+ return 1;
+ pos= dst;
+ len= dstlen;
+ }
+ if (write_internal(pos, len))
+ goto err;
+
+ my_safe_afree(dst, dstsize);
+ return 0;
+err:
+ my_safe_afree(dst, dstsize);
+ return 1;
}
-bool Log_event::write_footer(IO_CACHE* file)
+int Log_event_writer::write_header(uchar *pos, size_t len)
{
+ DBUG_ENTER("Log_event_writer::write_header");
/*
- footer contains the checksum-algorithm descriptor
- followed by the checksum value
+ recording checksum of FD event computed with dropped
+ possibly active LOG_EVENT_BINLOG_IN_USE_F flag.
+ Similar step at verication: the active flag is dropped before
+ checksum computing.
*/
- if (need_checksum())
+ if (checksum_len)
{
- uchar buf[BINLOG_CHECKSUM_LEN];
- int4store(buf, crc);
- return (my_b_safe_write(file, (uchar*) buf, sizeof(buf)));
+ uchar save=pos[FLAGS_OFFSET];
+ pos[FLAGS_OFFSET]&= ~LOG_EVENT_BINLOG_IN_USE_F;
+ crc= my_checksum(0, pos, len);
+ pos[FLAGS_OFFSET]= save;
}
- return 0;
+
+ if (ctx)
+ {
+ uchar iv[BINLOG_IV_LENGTH];
+ crypto->set_iv(iv, my_b_safe_tell(file));
+ if (encryption_ctx_init(ctx, crypto->key, crypto->key_length,
+ iv, sizeof(iv), ENCRYPTION_FLAG_ENCRYPT | ENCRYPTION_FLAG_NOPAD,
+ ENCRYPTION_KEY_SYSTEM_DATA, crypto->key_version))
+ DBUG_RETURN(1);
+
+ DBUG_ASSERT(len >= LOG_EVENT_HEADER_LEN);
+ event_len= uint4korr(pos + EVENT_LEN_OFFSET);
+ DBUG_ASSERT(event_len >= len);
+ memcpy(pos + EVENT_LEN_OFFSET, pos, 4);
+ pos+= 4;
+ len-= 4;
+ }
+ DBUG_RETURN(encrypt_and_write(pos, len));
+}
+
+int Log_event_writer::write_data(const uchar *pos, size_t len)
+{
+ DBUG_ENTER("Log_event_writer::write_data");
+ if (checksum_len)
+ crc= my_checksum(crc, pos, len);
+
+ DBUG_RETURN(encrypt_and_write(pos, len));
+}
+
+int Log_event_writer::write_footer()
+{
+ DBUG_ENTER("Log_event_writer::write_footer");
+ if (checksum_len)
+ {
+ uchar checksum_buf[BINLOG_CHECKSUM_LEN];
+ int4store(checksum_buf, crc);
+ if (encrypt_and_write(checksum_buf, BINLOG_CHECKSUM_LEN))
+ DBUG_RETURN(ER_ERROR_ON_WRITE);
+ }
+ if (ctx)
+ {
+ uint dstlen;
+ uchar dst[MY_AES_BLOCK_SIZE*2];
+ if (encryption_ctx_finish(ctx, dst, &dstlen))
+ DBUG_RETURN(1);
+ if (maybe_write_event_len(dst, dstlen) || write_internal(dst, dstlen))
+ DBUG_RETURN(ER_ERROR_ON_WRITE);
+ }
+ DBUG_RETURN(0);
}
/*
- Log_event::write()
+ Log_event::write_header()
*/
-bool Log_event::write_header(IO_CACHE* file, ulong event_data_length)
+bool Log_event::write_header(ulong event_data_length)
{
uchar header[LOG_EVENT_HEADER_LEN];
ulong now;
- bool ret;
DBUG_ENTER("Log_event::write_header");
DBUG_PRINT("enter", ("filepos: %lld length: %lu type: %d",
- (longlong) my_b_tell(file), event_data_length,
+ (longlong) writer->pos(), event_data_length,
(int) get_type_code()));
- /* Store number of bytes that will be written by this event */
- data_written= event_data_length + sizeof(header);
+ writer->checksum_len= need_checksum() ? BINLOG_CHECKSUM_LEN : 0;
- if (need_checksum())
- {
- crc= my_checksum(0L, NULL, 0);
- data_written += BINLOG_CHECKSUM_LEN;
- }
+ /* Store number of bytes that will be written by this event */
+ data_written= event_data_length + sizeof(header) + writer->checksum_len;
/*
log_pos != 0 if this is relay-log event. In this case we should not
@@ -1187,32 +1302,11 @@ bool Log_event::write_header(IO_CACHE* file, ulong event_data_length)
else if (!log_pos)
{
/*
- Calculate position of end of event
-
- Note that with a SEQ_READ_APPEND cache, my_b_tell() does not
- work well. So this will give slightly wrong positions for the
- Format_desc/Rotate/Stop events which the slave writes to its
- relay log. For example, the initial Format_desc will have
- end_log_pos=91 instead of 95. Because after writing the first 4
- bytes of the relay log, my_b_tell() still reports 0. Because
- my_b_append() does not update the counter which my_b_tell()
- later uses (one should probably use my_b_append_tell() to work
- around this). To get right positions even when writing to the
- relay log, we use the (new) my_b_safe_tell().
-
- Note that this raises a question on the correctness of all these
- DBUG_ASSERT(my_b_tell()=rli->event_relay_log_pos).
-
- If in a transaction, the log_pos which we calculate below is not
- very good (because then my_b_safe_tell() returns start position
- of the BEGIN, so it's like the statement was at the BEGIN's
- place), but it's not a very serious problem (as the slave, when
- it is in a transaction, does not take those end_log_pos into
- account (as it calls inc_event_relay_log_pos()). To be fixed
- later, so that it looks less strange. But not bug.
+ Calculate the position of where the next event will start
+ (end of this event, that is).
*/
- log_pos= my_b_safe_tell(file)+data_written;
+ log_pos= writer->pos() + data_written;
}
now= get_time(); // Query start time
@@ -1229,61 +1323,33 @@ bool Log_event::write_header(IO_CACHE* file, ulong event_data_length)
int4store(header+ SERVER_ID_OFFSET, server_id);
int4store(header+ EVENT_LEN_OFFSET, data_written);
int4store(header+ LOG_POS_OFFSET, log_pos);
- /*
- recording checksum of FD event computed with dropped
- possibly active LOG_EVENT_BINLOG_IN_USE_F flag.
- Similar step at verication: the active flag is dropped before
- checksum computing.
- */
- if (header[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT ||
- !need_checksum() || !(flags & LOG_EVENT_BINLOG_IN_USE_F))
- {
- int2store(header+ FLAGS_OFFSET, flags);
- ret= wrapper_my_b_safe_write(file, header, sizeof(header)) != 0;
- }
- else
- {
- ret= (wrapper_my_b_safe_write(file, header, FLAGS_OFFSET) != 0);
- if (!ret)
- {
- flags &= ~LOG_EVENT_BINLOG_IN_USE_F;
- int2store(header + FLAGS_OFFSET, flags);
- crc= my_checksum(crc, header + FLAGS_OFFSET, sizeof(flags));
- flags |= LOG_EVENT_BINLOG_IN_USE_F;
- int2store(header + FLAGS_OFFSET, flags);
- ret= (my_b_safe_write(file, header + FLAGS_OFFSET, sizeof(flags)) != 0);
- }
- if (!ret)
- ret= (wrapper_my_b_safe_write(file, header + FLAGS_OFFSET + sizeof(flags),
- sizeof(header)
- - (FLAGS_OFFSET + sizeof(flags))) != 0);
- }
- DBUG_RETURN( ret);
+ int2store(header + FLAGS_OFFSET, flags);
+
+ bool ret= writer->write_header(header, sizeof(header));
+ DBUG_RETURN(ret);
}
+#endif /* !MYSQL_CLIENT */
/**
- This needn't be format-tolerant, because we only read
- LOG_EVENT_MINIMAL_HEADER_LEN (we just want to read the event's length).
+ This needn't be format-tolerant, because we only parse the first
+ LOG_EVENT_MINIMAL_HEADER_LEN bytes (just need the event's length).
*/
int Log_event::read_log_event(IO_CACHE* file, String* packet,
- mysql_mutex_t* log_lock,
- uint8 checksum_alg_arg,
- const char *log_file_name_arg,
- bool* is_binlog_active)
+ const Format_description_log_event *fdle,
+ enum enum_binlog_checksum_alg checksum_alg_arg)
{
ulong data_len;
- int result=0;
char buf[LOG_EVENT_MINIMAL_HEADER_LEN];
uchar ev_offset= packet->length();
- DBUG_ENTER("Log_event::read_log_event");
-
- if (log_lock)
- mysql_mutex_lock(log_lock);
-
- if (log_file_name_arg)
- *is_binlog_active= mysql_bin_log.is_active(log_file_name_arg);
+#ifndef max_allowed_packet
+ THD *thd=current_thd;
+ ulong max_allowed_packet= thd ? thd->slave_thread ? slave_max_allowed_packet
+ : thd->variables.max_allowed_packet
+ : ~(uint)0;
+#endif
+ DBUG_ENTER("Log_event::read_log_event(IO_CACHE*,String*...)");
if (my_b_read(file, (uchar*) buf, sizeof(buf)))
{
@@ -1293,185 +1359,157 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet,
update to the log.
*/
DBUG_PRINT("error",("file->error: %d", file->error));
- if (!file->error)
- result= LOG_READ_EOF;
- else
- result= (file->error > 0 ? LOG_READ_TRUNC : LOG_READ_IO);
- goto end;
+ DBUG_RETURN(file->error == 0 ? LOG_READ_EOF :
+ file->error > 0 ? LOG_READ_TRUNC : LOG_READ_IO);
}
data_len= uint4korr(buf + EVENT_LEN_OFFSET);
- if (data_len < LOG_EVENT_MINIMAL_HEADER_LEN ||
- data_len > max(current_thd->variables.max_allowed_packet,
- opt_binlog_rows_event_max_size + MAX_LOG_EVENT_HEADER))
- {
- DBUG_PRINT("error",("data_len: %lu", data_len));
- result= ((data_len < LOG_EVENT_MINIMAL_HEADER_LEN) ? LOG_READ_BOGUS :
- LOG_READ_TOO_LARGE);
- goto end;
- }
/* Append the log event header to packet */
if (packet->append(buf, sizeof(buf)))
- {
- /* Failed to allocate packet */
- result= LOG_READ_MEM;
- goto end;
- }
- data_len-= LOG_EVENT_MINIMAL_HEADER_LEN;
- if (data_len)
+ DBUG_RETURN(LOG_READ_MEM);
+
+ if (data_len < LOG_EVENT_MINIMAL_HEADER_LEN)
+ DBUG_RETURN(LOG_READ_BOGUS);
+
+ if (data_len > max(max_allowed_packet,
+ opt_binlog_rows_event_max_size + MAX_LOG_EVENT_HEADER))
+ DBUG_RETURN(LOG_READ_TOO_LARGE);
+
+ if (likely(data_len > LOG_EVENT_MINIMAL_HEADER_LEN))
{
/* Append rest of event, read directly from file into packet */
- if (packet->append(file, data_len))
+ if (packet->append(file, data_len - LOG_EVENT_MINIMAL_HEADER_LEN))
{
/*
Fatal error occured when appending rest of the event
to packet, possible failures:
1. EOF occured when reading from file, it's really an error
- as data_len is >=0 there's supposed to be more bytes available.
+ as there's supposed to be more bytes available.
file->error will have been set to number of bytes left to read
2. Read was interrupted, file->error would normally be set to -1
3. Failed to allocate memory for packet, my_errno
- will be ENOMEM(file->error shuold be 0, but since the
+ will be ENOMEM(file->error should be 0, but since the
memory allocation occurs before the call to read it might
be uninitialized)
*/
- result= (my_errno == ENOMEM ? LOG_READ_MEM :
- (file->error >= 0 ? LOG_READ_TRUNC: LOG_READ_IO));
- /* Implicit goto end; */
- }
- else
- {
- /* Corrupt the event for Dump thread*/
- DBUG_EXECUTE_IF("corrupt_read_log_event2",
- uchar *debug_event_buf_c = (uchar*) packet->ptr() + ev_offset;
- if (debug_event_buf_c[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT)
- {
- int debug_cor_pos = rand() % (data_len + sizeof(buf) - BINLOG_CHECKSUM_LEN);
- debug_event_buf_c[debug_cor_pos] =~ debug_event_buf_c[debug_cor_pos];
- DBUG_PRINT("info", ("Corrupt the event at Log_event::read_log_event: byte on position %d", debug_cor_pos));
- DBUG_SET("-d,corrupt_read_log_event2");
- }
- );
- /*
- CRC verification of the Dump thread
- */
- if (opt_master_verify_checksum &&
- event_checksum_test((uchar*) packet->ptr() + ev_offset,
- data_len + sizeof(buf),
- checksum_alg_arg))
- {
- result= LOG_READ_CHECKSUM_FAILURE;
- goto end;
- }
+ DBUG_RETURN(my_errno == ENOMEM ? LOG_READ_MEM :
+ (file->error >= 0 ? LOG_READ_TRUNC: LOG_READ_IO));
}
}
-end:
- if (log_lock)
- mysql_mutex_unlock(log_lock);
- DBUG_RETURN(result);
-}
-#endif /* !MYSQL_CLIENT */
+ if (fdle->crypto_data.scheme)
+ {
+ uchar iv[BINLOG_IV_LENGTH];
+ fdle->crypto_data.set_iv(iv, my_b_tell(file) - data_len);
-#ifndef MYSQL_CLIENT
-#define UNLOCK_MUTEX if (log_lock) mysql_mutex_unlock(log_lock);
-#define LOCK_MUTEX if (log_lock) mysql_mutex_lock(log_lock);
-#else
-#define UNLOCK_MUTEX
-#define LOCK_MUTEX
-#endif
+ char *newpkt= (char*)my_malloc(data_len + ev_offset + 1, MYF(MY_WME));
+ if (!newpkt)
+ DBUG_RETURN(LOG_READ_MEM);
+ memcpy(newpkt, packet->ptr(), ev_offset);
+
+ uint dstlen;
+ uchar *src= (uchar*)packet->ptr() + ev_offset;
+ uchar *dst= (uchar*)newpkt + ev_offset;
+ memcpy(src + EVENT_LEN_OFFSET, src, 4);
+ if (encryption_crypt(src + 4, data_len - 4, dst + 4, &dstlen,
+ fdle->crypto_data.key, fdle->crypto_data.key_length, iv,
+ sizeof(iv), ENCRYPTION_FLAG_DECRYPT | ENCRYPTION_FLAG_NOPAD,
+ ENCRYPTION_KEY_SYSTEM_DATA, fdle->crypto_data.key_version))
+ {
+ my_free(newpkt);
+ DBUG_RETURN(LOG_READ_DECRYPT);
+ }
+ DBUG_ASSERT(dstlen == data_len - 4);
+ memcpy(dst, dst + EVENT_LEN_OFFSET, 4);
+ int4store(dst + EVENT_LEN_OFFSET, data_len);
+ packet->reset(newpkt, data_len + ev_offset, data_len + ev_offset + 1,
+ &my_charset_bin);
+ }
-#ifndef MYSQL_CLIENT
-/**
- @note
- Allocates memory; The caller is responsible for clean-up.
-*/
-Log_event* Log_event::read_log_event(IO_CACHE* file,
- mysql_mutex_t* log_lock,
- const Format_description_log_event
- *description_event,
- my_bool crc_check)
-#else
-Log_event* Log_event::read_log_event(IO_CACHE* file,
- const Format_description_log_event
- *description_event,
- my_bool crc_check)
-#endif
-{
- DBUG_ENTER("Log_event::read_log_event");
- DBUG_ASSERT(description_event != 0);
- char head[LOG_EVENT_MINIMAL_HEADER_LEN];
/*
- First we only want to read at most LOG_EVENT_MINIMAL_HEADER_LEN, just to
- check the event for sanity and to know its length; no need to really parse
- it. We say "at most" because this could be a 3.23 master, which has header
- of 13 bytes, whereas LOG_EVENT_MINIMAL_HEADER_LEN is 19 bytes (it's
- "minimal" over the set {MySQL >=4.0}).
+ CRC verification of the Dump thread
*/
- uint header_size= MY_MIN(description_event->common_header_len,
- LOG_EVENT_MINIMAL_HEADER_LEN);
-
- LOCK_MUTEX;
- DBUG_PRINT("info", ("my_b_tell: %lu", (ulong) my_b_tell(file)));
- if (my_b_read(file, (uchar *) head, header_size))
+ if (data_len > LOG_EVENT_MINIMAL_HEADER_LEN)
{
- DBUG_PRINT("info", ("Log_event::read_log_event(IO_CACHE*,Format_desc*) \
-failed my_b_read"));
- UNLOCK_MUTEX;
- /*
- No error here; it could be that we are at the file's end. However
- if the next my_b_read() fails (below), it will be an error as we
- were able to read the first bytes.
- */
- DBUG_RETURN(0);
+ /* Corrupt the event for Dump thread*/
+ DBUG_EXECUTE_IF("corrupt_read_log_event2",
+ uchar *debug_event_buf_c = (uchar*) packet->ptr() + ev_offset;
+ if (debug_event_buf_c[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT)
+ {
+ int debug_cor_pos = rand() % (data_len - BINLOG_CHECKSUM_LEN);
+ debug_event_buf_c[debug_cor_pos] =~ debug_event_buf_c[debug_cor_pos];
+ DBUG_PRINT("info", ("Corrupt the event at Log_event::read_log_event: byte on position %d", debug_cor_pos));
+ DBUG_SET("-d,corrupt_read_log_event2");
+ }
+ );
+ if (event_checksum_test((uchar*) packet->ptr() + ev_offset,
+ data_len, checksum_alg_arg))
+ DBUG_RETURN(LOG_READ_CHECKSUM_FAILURE);
}
- ulong data_len = uint4korr(head + EVENT_LEN_OFFSET);
- char *buf= 0;
+ DBUG_RETURN(0);
+}
+
+Log_event* Log_event::read_log_event(IO_CACHE* file, mysql_mutex_t* log_lock,
+ const Format_description_log_event *fdle,
+ my_bool crc_check)
+{
+ DBUG_ENTER("Log_event::read_log_event(IO_CACHE*,Format_description_log_event*...)");
+ DBUG_ASSERT(fdle != 0);
+ String event;
const char *error= 0;
- Log_event *res= 0;
-#ifndef max_allowed_packet
- THD *thd=current_thd;
- uint max_allowed_packet= thd ? slave_max_allowed_packet:~(uint)0;
-#endif
+ Log_event *res= 0;
- if (data_len > max<ulong>(max_allowed_packet,
- opt_binlog_rows_event_max_size + MAX_LOG_EVENT_HEADER))
- {
- error = "Event too big";
- goto err;
- }
+ if (log_lock)
+ mysql_mutex_lock(log_lock);
- if (data_len < header_size)
+ switch (read_log_event(file, &event, fdle, BINLOG_CHECKSUM_ALG_OFF))
{
- error = "Event too small";
- goto err;
+ case 0:
+ break;
+ case LOG_READ_EOF: // no error here; we are at the file's end
+ goto err;
+ case LOG_READ_BOGUS:
+ error= "Event invalid";
+ goto err;
+ case LOG_READ_IO:
+ error= "read error";
+ goto err;
+ case LOG_READ_MEM:
+ error= "Out of memory";
+ goto err;
+ case LOG_READ_TRUNC:
+ error= "Event truncated";
+ goto err;
+ case LOG_READ_TOO_LARGE:
+ error= "Event too big";
+ goto err;
+ case LOG_READ_DECRYPT:
+ error= "Event decryption failure";
+ goto err;
+ case LOG_READ_CHECKSUM_FAILURE:
+ default:
+ DBUG_ASSERT(0);
+ error= "internal error";
+ goto err;
}
- // some events use the extra byte to null-terminate strings
- if (!(buf = (char*) my_malloc(data_len+1, MYF(MY_WME))))
- {
- error = "Out of memory";
- goto err;
- }
- buf[data_len] = 0;
- memcpy(buf, head, header_size);
- if (my_b_read(file, (uchar*) buf + header_size, data_len - header_size))
- {
- error = "read error";
- goto err;
- }
- if ((res= read_log_event(buf, data_len, &error, description_event, crc_check)))
- res->register_temp_buf(buf, TRUE);
+ if ((res= read_log_event(event.ptr(), event.length(),
+ &error, fdle, crc_check)))
+ res->register_temp_buf(event.release(), true);
err:
- UNLOCK_MUTEX;
- if (!res)
+ if (log_lock)
+ mysql_mutex_unlock(log_lock);
+ if (error)
{
- DBUG_ASSERT(error != 0);
- sql_print_error("Error in Log_event::read_log_event(): "
- "'%s', data_len: %lu, event_type: %d",
- error,data_len,(uchar)(head[EVENT_TYPE_OFFSET]));
- my_free(buf);
+ DBUG_ASSERT(!res);
+ if (event.length() >= OLD_HEADER_LEN)
+ sql_print_error("Error in Log_event::read_log_event(): '%s',"
+ " data_len: %lu, event_type: %d", error,
+ uint4korr(&event[EVENT_LEN_OFFSET]),
+ (uchar)event[EVENT_TYPE_OFFSET]);
+ else
+ sql_print_error("Error in Log_event::read_log_event(): '%s'", error);
/*
The SQL slave thread will check if file->error<0 to know
if there was an I/O error. Even if there is no "low-level" I/O errors
@@ -1487,26 +1525,25 @@ err:
/**
- Binlog format tolerance is in (buf, event_len, description_event)
+ Binlog format tolerance is in (buf, event_len, fdle)
constructors.
*/
Log_event* Log_event::read_log_event(const char* buf, uint event_len,
const char **error,
- const Format_description_log_event *description_event,
+ const Format_description_log_event *fdle,
my_bool crc_check)
{
Log_event* ev;
- uint8 alg;
+ enum enum_binlog_checksum_alg alg;
DBUG_ENTER("Log_event::read_log_event(char*,...)");
- DBUG_ASSERT(description_event != 0);
- DBUG_PRINT("info", ("binlog_version: %d", description_event->binlog_version));
- DBUG_DUMP("data", (unsigned char*) buf, event_len);
+ DBUG_ASSERT(fdle != 0);
+ DBUG_PRINT("info", ("binlog_version: %d", fdle->binlog_version));
+ DBUG_DUMP_EVENT_BUF(buf, event_len);
/* Check the integrity */
if (event_len < EVENT_LEN_OFFSET ||
- (uchar)buf[EVENT_TYPE_OFFSET] >= ENUM_END_EVENT ||
- (uint) event_len != uint4korr(buf+EVENT_LEN_OFFSET))
+ (uchar)buf[EVENT_TYPE_OFFSET] >= ENUM_END_EVENT)
{
*error="Sanity check failed"; // Needed to free buffer
DBUG_RETURN(NULL); // general sanity check - will fail on a partial read
@@ -1515,16 +1552,16 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len,
uint event_type= (uchar)buf[EVENT_TYPE_OFFSET];
// all following START events in the current file are without checksum
if (event_type == START_EVENT_V3)
- (const_cast< Format_description_log_event *>(description_event))->checksum_alg= BINLOG_CHECKSUM_ALG_OFF;
+ (const_cast< Format_description_log_event *>(fdle))->checksum_alg= BINLOG_CHECKSUM_ALG_OFF;
/*
CRC verification by SQL and Show-Binlog-Events master side.
- The caller has to provide @description_event->checksum_alg to
+ The caller has to provide @fdle->checksum_alg to
be the last seen FD's (A) descriptor.
If event is FD the descriptor is in it.
Notice, FD of the binlog can be only in one instance and therefore
Show-Binlog-Events executing master side thread needs just to know
the only FD's (A) value - whereas RL can contain more.
- In the RL case, the alg is kept in FD_e (@description_event) which is reset
+ In the RL case, the alg is kept in FD_e (@fdle) which is reset
to the newer read-out event after its execution with possibly new alg descriptor.
Therefore in a typical sequence of RL:
{FD_s^0, FD_m, E_m^1} E_m^1
@@ -1536,7 +1573,7 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len,
Notice, a pre-checksum FD version forces alg := BINLOG_CHECKSUM_ALG_UNDEF.
*/
alg= (event_type != FORMAT_DESCRIPTION_EVENT) ?
- description_event->checksum_alg : get_checksum_alg(buf, event_len);
+ fdle->checksum_alg : get_checksum_alg(buf, event_len);
// Emulate the corruption during reading an event
DBUG_EXECUTE_IF("corrupt_read_log_event_char",
if (event_type != FORMAT_DESCRIPTION_EVENT)
@@ -1555,29 +1592,29 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len,
*error= "Event crc check failed! Most likely there is event corruption.";
if (force_opt)
{
- ev= new Unknown_log_event(buf, description_event);
+ ev= new Unknown_log_event(buf, fdle);
DBUG_RETURN(ev);
}
else
DBUG_RETURN(NULL);
#else
*error= ER(ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE);
- sql_print_error("%s", ER(ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE));
+ sql_print_error("%s", *error);
DBUG_RETURN(NULL);
#endif
}
- if (event_type > description_event->number_of_event_types &&
+ if (event_type > fdle->number_of_event_types &&
event_type != FORMAT_DESCRIPTION_EVENT)
{
/*
- It is unsafe to use the description_event if its post_header_len
+ It is unsafe to use the fdle if its post_header_len
array does not include the event type.
*/
DBUG_PRINT("error", ("event type %d found, but the current "
"Format_description_log_event supports only %d event "
"types", event_type,
- description_event->number_of_event_types));
+ fdle->number_of_event_types));
ev= NULL;
}
else
@@ -1592,9 +1629,9 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len,
array, which was set up when the Format_description_log_event
was read.
*/
- if (description_event->event_type_permutation)
+ if (fdle->event_type_permutation)
{
- int new_event_type= description_event->event_type_permutation[event_type];
+ int new_event_type= fdle->event_type_permutation[event_type];
DBUG_PRINT("info", ("converting event type %d to %d (%s)",
event_type, new_event_type,
get_type_str((Log_event_type)new_event_type)));
@@ -1605,104 +1642,102 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len,
(event_type == FORMAT_DESCRIPTION_EVENT ||
alg != BINLOG_CHECKSUM_ALG_OFF))
event_len= event_len - BINLOG_CHECKSUM_LEN;
-
+
switch(event_type) {
case QUERY_EVENT:
- ev = new Query_log_event(buf, event_len, description_event, QUERY_EVENT);
+ ev = new Query_log_event(buf, event_len, fdle, QUERY_EVENT);
break;
case LOAD_EVENT:
- ev = new Load_log_event(buf, event_len, description_event);
+ ev = new Load_log_event(buf, event_len, fdle);
break;
case NEW_LOAD_EVENT:
- ev = new Load_log_event(buf, event_len, description_event);
+ ev = new Load_log_event(buf, event_len, fdle);
break;
case ROTATE_EVENT:
- ev = new Rotate_log_event(buf, event_len, description_event);
+ ev = new Rotate_log_event(buf, event_len, fdle);
break;
case BINLOG_CHECKPOINT_EVENT:
- ev = new Binlog_checkpoint_log_event(buf, event_len, description_event);
+ ev = new Binlog_checkpoint_log_event(buf, event_len, fdle);
break;
case GTID_EVENT:
- ev = new Gtid_log_event(buf, event_len, description_event);
+ ev = new Gtid_log_event(buf, event_len, fdle);
break;
case GTID_LIST_EVENT:
- ev = new Gtid_list_log_event(buf, event_len, description_event);
- break;
-#ifdef HAVE_REPLICATION
- case SLAVE_EVENT: /* can never happen (unused event) */
- ev = new Slave_log_event(buf, event_len, description_event);
+ ev = new Gtid_list_log_event(buf, event_len, fdle);
break;
-#endif /* HAVE_REPLICATION */
case CREATE_FILE_EVENT:
- ev = new Create_file_log_event(buf, event_len, description_event);
+ ev = new Create_file_log_event(buf, event_len, fdle);
break;
case APPEND_BLOCK_EVENT:
- ev = new Append_block_log_event(buf, event_len, description_event);
+ ev = new Append_block_log_event(buf, event_len, fdle);
break;
case DELETE_FILE_EVENT:
- ev = new Delete_file_log_event(buf, event_len, description_event);
+ ev = new Delete_file_log_event(buf, event_len, fdle);
break;
case EXEC_LOAD_EVENT:
- ev = new Execute_load_log_event(buf, event_len, description_event);
+ ev = new Execute_load_log_event(buf, event_len, fdle);
break;
case START_EVENT_V3: /* this is sent only by MySQL <=4.x */
- ev = new Start_log_event_v3(buf, event_len, description_event);
+ ev = new Start_log_event_v3(buf, event_len, fdle);
break;
case STOP_EVENT:
- ev = new Stop_log_event(buf, description_event);
+ ev = new Stop_log_event(buf, fdle);
break;
case INTVAR_EVENT:
- ev = new Intvar_log_event(buf, description_event);
+ ev = new Intvar_log_event(buf, fdle);
break;
case XID_EVENT:
- ev = new Xid_log_event(buf, description_event);
+ ev = new Xid_log_event(buf, fdle);
break;
case RAND_EVENT:
- ev = new Rand_log_event(buf, description_event);
+ ev = new Rand_log_event(buf, fdle);
break;
case USER_VAR_EVENT:
- ev = new User_var_log_event(buf, event_len, description_event);
+ ev = new User_var_log_event(buf, event_len, fdle);
break;
case FORMAT_DESCRIPTION_EVENT:
- ev = new Format_description_log_event(buf, event_len, description_event);
+ ev = new Format_description_log_event(buf, event_len, fdle);
break;
#if defined(HAVE_REPLICATION)
case PRE_GA_WRITE_ROWS_EVENT:
- ev = new Write_rows_log_event_old(buf, event_len, description_event);
+ ev = new Write_rows_log_event_old(buf, event_len, fdle);
break;
case PRE_GA_UPDATE_ROWS_EVENT:
- ev = new Update_rows_log_event_old(buf, event_len, description_event);
+ ev = new Update_rows_log_event_old(buf, event_len, fdle);
break;
case PRE_GA_DELETE_ROWS_EVENT:
- ev = new Delete_rows_log_event_old(buf, event_len, description_event);
+ ev = new Delete_rows_log_event_old(buf, event_len, fdle);
break;
case WRITE_ROWS_EVENT_V1:
case WRITE_ROWS_EVENT:
- ev = new Write_rows_log_event(buf, event_len, description_event);
+ ev = new Write_rows_log_event(buf, event_len, fdle);
break;
case UPDATE_ROWS_EVENT_V1:
case UPDATE_ROWS_EVENT:
- ev = new Update_rows_log_event(buf, event_len, description_event);
+ ev = new Update_rows_log_event(buf, event_len, fdle);
break;
case DELETE_ROWS_EVENT_V1:
case DELETE_ROWS_EVENT:
- ev = new Delete_rows_log_event(buf, event_len, description_event);
+ ev = new Delete_rows_log_event(buf, event_len, fdle);
break;
case TABLE_MAP_EVENT:
- ev = new Table_map_log_event(buf, event_len, description_event);
+ ev = new Table_map_log_event(buf, event_len, fdle);
break;
#endif
case BEGIN_LOAD_QUERY_EVENT:
- ev = new Begin_load_query_log_event(buf, event_len, description_event);
+ ev = new Begin_load_query_log_event(buf, event_len, fdle);
break;
case EXECUTE_LOAD_QUERY_EVENT:
- ev= new Execute_load_query_log_event(buf, event_len, description_event);
+ ev= new Execute_load_query_log_event(buf, event_len, fdle);
break;
case INCIDENT_EVENT:
- ev = new Incident_log_event(buf, event_len, description_event);
+ ev = new Incident_log_event(buf, event_len, fdle);
break;
case ANNOTATE_ROWS_EVENT:
- ev = new Annotate_rows_log_event(buf, event_len, description_event);
+ ev = new Annotate_rows_log_event(buf, event_len, fdle);
+ break;
+ case START_ENCRYPTION_EVENT:
+ ev = new Start_encryption_log_event(buf, event_len, fdle);
break;
default:
DBUG_PRINT("error",("Unknown event code: %d",
@@ -1715,14 +1750,16 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len,
if (ev)
{
ev->checksum_alg= alg;
+#ifdef MYSQL_CLIENT
if (ev->checksum_alg != BINLOG_CHECKSUM_ALG_OFF &&
ev->checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF)
ev->crc= uint4korr(buf + (event_len));
+#endif
}
- DBUG_PRINT("read_event", ("%s(type_code: %d; event_len: %d)",
+ DBUG_PRINT("read_event", ("%s(type_code: %u; event_len: %u)",
ev ? ev->get_type_str() : "<unknown>",
- buf[EVENT_TYPE_OFFSET],
+ (uchar)buf[EVENT_TYPE_OFFSET],
event_len));
/*
is_valid() are small event-specific sanity tests which are
@@ -1746,7 +1783,7 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len,
*error= "Found invalid event in binary log";
DBUG_RETURN(0);
}
- ev= new Unknown_log_event(buf, description_event);
+ ev= new Unknown_log_event(buf, fdle);
#else
*error= "Found invalid event in binary log";
DBUG_RETURN(0);
@@ -2399,6 +2436,12 @@ log_event_print_value(IO_CACHE *file, const uchar *ptr,
my_snprintf(typestr, typestr_length, "STRING(%d)", length);
return my_b_write_quoted_with_length(file, ptr, length);
+ case MYSQL_TYPE_DECIMAL:
+ my_b_printf(file,
+ "!! Old DECIMAL (mysql-4.1 or earlier). "
+ "Not enough metadata to display the value. ");
+ break;
+
default:
{
char tmp[5];
@@ -2769,7 +2812,7 @@ void Query_log_event::pack_info(THD *thd, Protocol *protocol)
/**
Utility function for the next method (Query_log_event::write()) .
*/
-static void write_str_with_code_and_len(uchar **dst, const char *src,
+static void store_str_with_code_and_len(uchar **dst, const char *src,
uint len, uint code)
{
/*
@@ -2794,7 +2837,7 @@ static void write_str_with_code_and_len(uchar **dst, const char *src,
will print!
*/
-bool Query_log_event::write(IO_CACHE* file)
+bool Query_log_event::write()
{
uchar buf[QUERY_HEADER_LEN + MAX_SIZE_LOG_EVENT_STATUS];
uchar *start, *start_of_status;
@@ -2865,7 +2908,7 @@ bool Query_log_event::write(IO_CACHE* file)
}
if (catalog_len) // i.e. this var is inited (false for 4.0 events)
{
- write_str_with_code_and_len(&start,
+ store_str_with_code_and_len(&start,
catalog, catalog_len, Q_CATALOG_NZ_CODE);
/*
In 5.0.x where x<4 masters we used to store the end zero here. This was
@@ -2903,7 +2946,7 @@ bool Query_log_event::write(IO_CACHE* file)
{
/* In the TZ sys table, column Name is of length 64 so this should be ok */
DBUG_ASSERT(time_zone_len <= MAX_TIME_ZONE_NAME_LENGTH);
- write_str_with_code_and_len(&start,
+ store_str_with_code_and_len(&start,
time_zone_str, time_zone_len, Q_TIME_ZONE_CODE);
}
if (lc_time_names_number)
@@ -3023,14 +3066,13 @@ bool Query_log_event::write(IO_CACHE* file)
*/
event_length= (uint) (start-buf) + get_post_header_size_for_derived() + db_len + 1 + q_len;
- return (write_header(file, event_length) ||
- wrapper_my_b_safe_write(file, (uchar*) buf, QUERY_HEADER_LEN) ||
- write_post_header_for_derived(file) ||
- wrapper_my_b_safe_write(file, (uchar*) start_of_status,
- (uint) (start-start_of_status)) ||
- wrapper_my_b_safe_write(file, (db) ? (uchar*) db : (uchar*)"", db_len + 1) ||
- wrapper_my_b_safe_write(file, (uchar*) query, q_len) ||
- write_footer(file)) ? 1 : 0;
+ return write_header(event_length) ||
+ write_data(buf, QUERY_HEADER_LEN) ||
+ write_post_header_for_derived() ||
+ write_data(start_of_status, (uint) (start-start_of_status)) ||
+ write_data(safe_str(db), db_len + 1) ||
+ write_data(query, q_len) ||
+ write_footer();
}
/**
@@ -3053,6 +3095,7 @@ Query_log_event::Query_log_event()
query_arg - array of char representing the query
query_length - size of the `query_arg' array
using_trans - there is a modified transactional table
+ direct - Don't cache statement
suppress_use - suppress the generation of 'USE' statements
errcode - the error code of the query
@@ -3180,10 +3223,17 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
break;
case SQLCOM_CREATE_TABLE:
+ /*
+ If we are using CREATE ... SELECT or if we are a slave
+ executing BEGIN...COMMIT (generated by CREATE...SELECT) we
+ have to use the transactional cache to ensure we don't
+ calculate any checksum for the CREATE part.
+ */
trx_cache= (lex->select_lex.item_list.elements &&
- thd->is_current_stmt_binlog_format_row());
+ thd->is_current_stmt_binlog_format_row()) ||
+ (thd->variables.option_bits & OPTION_GTID_BEGIN);
use_cache= (lex->tmp_table() &&
- thd->in_multi_stmt_transaction_mode()) || trx_cache;
+ thd->in_multi_stmt_transaction_mode()) || trx_cache;
break;
case SQLCOM_SET_OPTION:
if (lex->autocommit)
@@ -3214,8 +3264,8 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
else
cache_type= Log_event::EVENT_STMT_CACHE;
DBUG_ASSERT(cache_type != Log_event::EVENT_INVALID_CACHE);
- DBUG_PRINT("info",("Query_log_event has flags2: %lu sql_mode: %llu",
- (ulong) flags2, sql_mode));
+ DBUG_PRINT("info",("Query_log_event has flags2: %lu sql_mode: %llu cache_tye: %d",
+ (ulong) flags2, sql_mode, cache_type));
}
#endif /* MYSQL_CLIENT */
@@ -3425,14 +3475,10 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
break;
case Q_SQL_MODE_CODE:
{
-#ifndef DBUG_OFF
- char buff[22];
-#endif
CHECK_SPACE(pos, end, 8);
sql_mode_inited= 1;
sql_mode= (ulong) uint8korr(pos); // QQ: Fix when sql_mode is ulonglong
- DBUG_PRINT("info",("In Query_log_event, read sql_mode: %s",
- llstr(sql_mode, buff)));
+ DBUG_PRINT("info",("In Query_log_event, read sql_mode: %llu", sql_mode));
pos+= 8;
break;
}
@@ -3635,7 +3681,7 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
*/
int
Query_log_event::dummy_event(String *packet, ulong ev_offset,
- uint8 checksum_alg)
+ enum enum_binlog_checksum_alg checksum_alg)
{
uchar *p= (uchar *)packet->ptr() + ev_offset;
size_t data_len= packet->length() - ev_offset;
@@ -3715,7 +3761,7 @@ Query_log_event::dummy_event(String *packet, ulong ev_offset,
if (checksum_alg == BINLOG_CHECKSUM_ALG_CRC32)
{
- ha_checksum crc= my_checksum(0L, p, data_len);
+ ha_checksum crc= my_checksum(0, p, data_len);
int4store(p + data_len, crc);
}
return 0;
@@ -3727,7 +3773,7 @@ Query_log_event::dummy_event(String *packet, ulong ev_offset,
*/
int
Query_log_event::begin_event(String *packet, ulong ev_offset,
- uint8 checksum_alg)
+ enum enum_binlog_checksum_alg checksum_alg)
{
uchar *p= (uchar *)packet->ptr() + ev_offset;
uchar *q= p + LOG_EVENT_HEADER_LEN;
@@ -3780,7 +3826,7 @@ Query_log_event::begin_event(String *packet, ulong ev_offset,
if (checksum_alg == BINLOG_CHECKSUM_ALG_CRC32)
{
- ha_checksum crc= my_checksum(0L, p, data_len);
+ ha_checksum crc= my_checksum(0, p, data_len);
int4store(p + data_len, crc);
}
return 0;
@@ -4228,7 +4274,6 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
"mysql", rpl_gtid_slave_state_table_name.str,
errcode,
thd->get_stmt_da()->message());
- trans_rollback(thd);
sub_id= 0;
thd->is_slave_error= 1;
goto end;
@@ -4349,15 +4394,15 @@ compare_errors:
!ignored_error_code(expected_error))
{
rli->report(ERROR_LEVEL, 0, rgi->gtid_info(),
- "Query caused different errors on master and slave. "
- "Error on master: message (format)='%s' error code=%d ; "
- "Error on slave: actual message='%s', error code=%d. "
- "Default database: '%s'. Query: '%s'",
- ER_SAFE(expected_error),
- expected_error,
- actual_error ? thd->get_stmt_da()->message() : "no error",
- actual_error,
- print_slave_db_safe(db), query_arg);
+ "Query caused different errors on master and slave. "
+ "Error on master: message (format)='%s' error code=%d ; "
+ "Error on slave: actual message='%s', error code=%d. "
+ "Default database: '%s'. Query: '%s'",
+ ER_SAFE_THD(thd, expected_error),
+ expected_error,
+ actual_error ? thd->get_stmt_da()->message() : "no error",
+ actual_error,
+ print_slave_db_safe(db), query_arg);
thd->is_slave_error= 1;
}
/*
@@ -4464,12 +4509,6 @@ end:
DBUG_RETURN(thd->is_slave_error);
}
-int Query_log_event::do_update_pos(rpl_group_info *rgi)
-{
- return Log_event::do_update_pos(rgi);
-}
-
-
Log_event::enum_skip_reason
Query_log_event::do_shall_skip(rpl_group_info *rgi)
{
@@ -4523,7 +4562,8 @@ Query_log_event::do_shall_skip(rpl_group_info *rgi)
bool
Query_log_event::peek_is_commit_rollback(const char *event_start,
- size_t event_len, uint8 checksum_alg)
+ size_t event_len,
+ enum enum_binlog_checksum_alg checksum_alg)
{
if (checksum_alg == BINLOG_CHECKSUM_ALG_CRC32)
{
@@ -4657,7 +4697,7 @@ Start_log_event_v3::Start_log_event_v3(const char* buf, uint event_len,
*/
#ifndef MYSQL_CLIENT
-bool Start_log_event_v3::write(IO_CACHE* file)
+bool Start_log_event_v3::write()
{
char buff[START_V3_HEADER_LEN];
int2store(buff + ST_BINLOG_VER_OFFSET,binlog_version);
@@ -4665,9 +4705,9 @@ bool Start_log_event_v3::write(IO_CACHE* file)
if (!dont_set_created)
created= get_time(); // this sets when and when_sec_part as a side effect
int4store(buff + ST_CREATED_OFFSET,created);
- return (write_header(file, sizeof(buff)) ||
- wrapper_my_b_safe_write(file, (uchar*) buff, sizeof(buff)) ||
- write_footer(file));
+ return write_header(sizeof(buff)) ||
+ write_data(buff, sizeof(buff)) ||
+ write_footer();
}
#endif
@@ -4864,6 +4904,7 @@ Format_description_log_event(uint8 binlog_ver, const char* server_ver)
BINLOG_CHECKPOINT_HEADER_LEN;
post_header_len[GTID_EVENT-1]= GTID_HEADER_LEN;
post_header_len[GTID_LIST_EVENT-1]= GTID_LIST_HEADER_LEN;
+ post_header_len[START_ENCRYPTION_EVENT-1]= START_ENCRYPTION_HEADER_LEN;
// Sanity-check that all post header lengths are initialized.
int i;
@@ -4917,7 +4958,8 @@ Format_description_log_event(uint8 binlog_ver, const char* server_ver)
break;
}
calc_server_version_split();
- checksum_alg= (uint8) BINLOG_CHECKSUM_ALG_UNDEF;
+ checksum_alg= BINLOG_CHECKSUM_ALG_UNDEF;
+ reset_crypto();
}
@@ -4969,18 +5011,19 @@ Format_description_log_event(const char* buf,
{
/* the last bytes are the checksum alg desc and value (or value's room) */
number_of_event_types -= BINLOG_CHECKSUM_ALG_DESC_LEN;
- checksum_alg= post_header_len[number_of_event_types];
+ checksum_alg= (enum_binlog_checksum_alg)post_header_len[number_of_event_types];
}
else
{
- checksum_alg= (uint8) BINLOG_CHECKSUM_ALG_UNDEF;
+ checksum_alg= BINLOG_CHECKSUM_ALG_UNDEF;
}
+ reset_crypto();
DBUG_VOID_RETURN;
}
#ifndef MYSQL_CLIENT
-bool Format_description_log_event::write(IO_CACHE* file)
+bool Format_description_log_event::write()
{
bool ret;
bool no_checksum;
@@ -5005,12 +5048,12 @@ bool Format_description_log_event::write(IO_CACHE* file)
slave does it via marking the event according to
FD_queue checksum_alg value.
*/
- compile_time_assert(sizeof(BINLOG_CHECKSUM_ALG_DESC_LEN == 1));
+ compile_time_assert(BINLOG_CHECKSUM_ALG_DESC_LEN == 1);
#ifndef DBUG_OFF
data_written= 0; // to prepare for need_checksum assert
#endif
- uchar checksum_byte= need_checksum() ?
- checksum_alg : (uint8) BINLOG_CHECKSUM_ALG_OFF;
+ uint8 checksum_byte= (uint8)
+ (need_checksum() ? checksum_alg : BINLOG_CHECKSUM_ALG_OFF);
/*
FD of checksum-aware server is always checksum-equipped, (V) is in,
regardless of @@global.binlog_checksum policy.
@@ -5028,12 +5071,11 @@ bool Format_description_log_event::write(IO_CACHE* file)
{
checksum_alg= BINLOG_CHECKSUM_ALG_CRC32; // Forcing (V) room to fill anyway
}
- ret= (write_header(file, rec_size) ||
- wrapper_my_b_safe_write(file, buff, sizeof(buff)) ||
- wrapper_my_b_safe_write(file, (uchar*)post_header_len,
- number_of_event_types) ||
- wrapper_my_b_safe_write(file, &checksum_byte, sizeof(checksum_byte)) ||
- write_footer(file));
+ ret= write_header(rec_size) ||
+ write_data(buff, sizeof(buff)) ||
+ write_data(post_header_len, number_of_event_types) ||
+ write_data(&checksum_byte, sizeof(checksum_byte)) ||
+ write_footer();
if (no_checksum)
checksum_alg= BINLOG_CHECKSUM_ALG_OFF;
return ret;
@@ -5044,7 +5086,7 @@ bool Format_description_log_event::write(IO_CACHE* file)
int Format_description_log_event::do_apply_event(rpl_group_info *rgi)
{
int ret= 0;
- Relay_log_info const *rli= rgi->rli;
+ Relay_log_info *rli= rgi->rli;
DBUG_ENTER("Format_description_log_event::do_apply_event");
/*
@@ -5091,8 +5133,9 @@ int Format_description_log_event::do_apply_event(rpl_group_info *rgi)
if (!ret)
{
/* Save the information describing this binlog */
+ copy_crypto_data(rli->relay_log.description_event_for_exec);
delete rli->relay_log.description_event_for_exec;
- const_cast<Relay_log_info *>(rli)->relay_log.description_event_for_exec= this;
+ rli->relay_log.description_event_for_exec= this;
}
DBUG_RETURN(ret);
@@ -5132,6 +5175,17 @@ Format_description_log_event::do_shall_skip(rpl_group_info *rgi)
#endif
+bool Format_description_log_event::start_decryption(Start_encryption_log_event* sele)
+{
+ DBUG_ASSERT(crypto_data.scheme == 0);
+
+ if (!sele->is_valid())
+ return 1;
+
+ memcpy(crypto_data.nonce, sele->nonce, BINLOG_NONCE_LENGTH);
+ return crypto_data.init(sele->crypto_scheme, sele->key_version);
+}
+
static inline void
do_server_version_split(char* version,
Format_description_log_event::master_version_split *split_versions)
@@ -5215,9 +5269,9 @@ Format_description_log_event::is_version_before_checksum(const master_version_sp
checksum-unaware (effectively no checksum) and the actuall
[1-254] range alg descriptor.
*/
-uint8 get_checksum_alg(const char* buf, ulong len)
+enum enum_binlog_checksum_alg get_checksum_alg(const char* buf, ulong len)
{
- uint8 ret;
+ enum enum_binlog_checksum_alg ret;
char version[ST_SERVER_VER_LEN];
Format_description_log_event::master_version_split version_split;
@@ -5230,16 +5284,68 @@ uint8 get_checksum_alg(const char* buf, ulong len)
version[ST_SERVER_VER_LEN - 1]= 0;
do_server_version_split(version, &version_split);
- ret= Format_description_log_event::is_version_before_checksum(&version_split) ?
- (uint8) BINLOG_CHECKSUM_ALG_UNDEF :
- * (uint8*) (buf + len - BINLOG_CHECKSUM_LEN - BINLOG_CHECKSUM_ALG_DESC_LEN);
+ ret= Format_description_log_event::is_version_before_checksum(&version_split)
+ ? BINLOG_CHECKSUM_ALG_UNDEF
+ : (enum_binlog_checksum_alg)buf[len - BINLOG_CHECKSUM_LEN - BINLOG_CHECKSUM_ALG_DESC_LEN];
DBUG_ASSERT(ret == BINLOG_CHECKSUM_ALG_OFF ||
ret == BINLOG_CHECKSUM_ALG_UNDEF ||
ret == BINLOG_CHECKSUM_ALG_CRC32);
DBUG_RETURN(ret);
}
-
+Start_encryption_log_event::Start_encryption_log_event(
+ const char* buf, uint event_len,
+ const Format_description_log_event* description_event)
+ :Log_event(buf, description_event)
+{
+ if ((int)event_len ==
+ LOG_EVENT_MINIMAL_HEADER_LEN + Start_encryption_log_event::get_data_size())
+ {
+ buf += LOG_EVENT_MINIMAL_HEADER_LEN;
+ crypto_scheme = *(uchar*)buf;
+ key_version = uint4korr(buf + BINLOG_CRYPTO_SCHEME_LENGTH);
+ memcpy(nonce,
+ buf + BINLOG_CRYPTO_SCHEME_LENGTH + BINLOG_KEY_VERSION_LENGTH,
+ BINLOG_NONCE_LENGTH);
+ }
+ else
+ crypto_scheme= ~0; // invalid
+}
+
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
+int Start_encryption_log_event::do_apply_event(rpl_group_info* rgi)
+{
+ return rgi->rli->relay_log.description_event_for_exec->start_decryption(this);
+}
+
+int Start_encryption_log_event::do_update_pos(rpl_group_info *rgi)
+{
+ /*
+ master never sends Start_encryption_log_event, any SELE that a slave
+ might see was created locally in MYSQL_BIN_LOG::open() on the slave
+ */
+ rgi->inc_event_relay_log_pos();
+ return 0;
+}
+
+#endif
+
+#ifndef MYSQL_SERVER
+void Start_encryption_log_event::print(FILE* file,
+ PRINT_EVENT_INFO* print_event_info)
+{
+ Write_on_release_cache cache(&print_event_info->head_cache, file);
+ StringBuffer<1024> buf;
+ buf.append(STRING_WITH_LEN("# Encryption scheme: "));
+ buf.append_ulonglong(crypto_scheme);
+ buf.append(STRING_WITH_LEN(", key_version: "));
+ buf.append_ulonglong(key_version);
+ buf.append(STRING_WITH_LEN(", nonce: "));
+ buf.append_hex(nonce, BINLOG_NONCE_LENGTH);
+ buf.append(STRING_WITH_LEN("\n# The rest of the binlog is encrypted!\n"));
+ my_b_write(&cache, (uchar*)buf.ptr(), buf.length());
+}
+#endif
/**************************************************************************
Load_log_event methods
General note about Load_log_event: the binlogging of LOAD DATA INFILE is
@@ -5379,7 +5485,7 @@ void Load_log_event::pack_info(THD *thd, Protocol *protocol)
Load_log_event::write_data_header()
*/
-bool Load_log_event::write_data_header(IO_CACHE* file)
+bool Load_log_event::write_data_header()
{
char buf[LOAD_HEADER_LEN];
int4store(buf + L_THREAD_ID_OFFSET, slave_proxy_id);
@@ -5388,7 +5494,7 @@ bool Load_log_event::write_data_header(IO_CACHE* file)
buf[L_TBL_LEN_OFFSET] = (char)table_name_len;
buf[L_DB_LEN_OFFSET] = (char)db_len;
int4store(buf + L_NUM_FIELDS_OFFSET, num_fields);
- return my_b_safe_write(file, (uchar*)buf, LOAD_HEADER_LEN) != 0;
+ return write_data(buf, LOAD_HEADER_LEN) != 0;
}
@@ -5396,19 +5502,19 @@ bool Load_log_event::write_data_header(IO_CACHE* file)
Load_log_event::write_data_body()
*/
-bool Load_log_event::write_data_body(IO_CACHE* file)
+bool Load_log_event::write_data_body()
{
- if (sql_ex.write_data(file))
+ if (sql_ex.write_data(writer))
return 1;
if (num_fields && fields && field_lens)
{
- if (my_b_safe_write(file, (uchar*)field_lens, num_fields) ||
- my_b_safe_write(file, (uchar*)fields, field_block_len))
+ if (write_data(field_lens, num_fields) ||
+ write_data(fields, field_block_len))
return 1;
}
- return (my_b_safe_write(file, (uchar*)table_name, table_name_len + 1) ||
- my_b_safe_write(file, (uchar*)db, db_len + 1) ||
- my_b_safe_write(file, (uchar*)fname, fname_len));
+ return (write_data(table_name, table_name_len + 1) ||
+ write_data(db, db_len + 1) ||
+ write_data(fname, fname_len));
}
@@ -5719,8 +5825,10 @@ void Load_log_event::set_fields(const char* affected_db,
const char* field = fields;
for (i= 0; i < num_fields; i++)
{
- field_list.push_back(new Item_field(context,
- affected_db, table_name, field));
+ field_list.push_back(new (thd->mem_root)
+ Item_field(thd, context, affected_db, table_name,
+ field),
+ thd->mem_root);
field+= field_lens[i] + 1;
}
}
@@ -5828,7 +5936,6 @@ int Load_log_event::do_apply_event(NET* net, rpl_group_info *rgi,
}
else
{
- char llbuff[22];
enum enum_duplicates handle_dup;
bool ignore= 0;
char query_buffer[1024];
@@ -5929,10 +6036,9 @@ int Load_log_event::do_apply_event(NET* net, rpl_group_info *rgi,
{
/* log_pos is the position of the LOAD event in the master log */
sql_print_warning("Slave: load data infile on table '%s' at "
- "log position %s in log '%s' produced %ld "
+ "log position %llu in log '%s' produced %ld "
"warning(s). Default database: '%s'",
- (char*) table_name,
- llstr(log_pos,llbuff), RPL_LOG_NAME,
+ (char*) table_name, log_pos, RPL_LOG_NAME,
(ulong) thd->cuted_fields,
print_slave_db_safe(thd->db));
}
@@ -6000,7 +6106,7 @@ error:
else
{
sql_errno=ER_UNKNOWN_ERROR;
- err=ER(sql_errno);
+ err= ER_THD(thd, sql_errno);
}
rli->report(ERROR_LEVEL, sql_errno, rgi->gtid_info(), "\
Error '%s' running LOAD DATA INFILE on table '%s'. Default database: '%s'",
@@ -6020,7 +6126,7 @@ Error '%s' running LOAD DATA INFILE on table '%s'. Default database: '%s'",
print_slave_db_safe(remember_db));
rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, rgi->gtid_info(),
- ER(ER_SLAVE_FATAL_ERROR), buf);
+ ER_THD(thd, ER_SLAVE_FATAL_ERROR), buf);
DBUG_RETURN(1);
}
@@ -6040,12 +6146,11 @@ Error '%s' running LOAD DATA INFILE on table '%s'. Default database: '%s'",
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
void Rotate_log_event::pack_info(THD *thd, Protocol *protocol)
{
- char buf1[256], buf[22];
- String tmp(buf1, sizeof(buf1), log_cs);
+ StringBuffer<256> tmp(log_cs);
tmp.length(0);
tmp.append(new_log_ident, ident_len);
tmp.append(STRING_WITH_LEN(";pos="));
- tmp.append(llstr(pos,buf));
+ tmp.append_ulonglong(pos);
protocol->store(tmp.ptr(), tmp.length(), &my_charset_bin);
}
#endif
@@ -6087,12 +6192,9 @@ Rotate_log_event::Rotate_log_event(const char* new_log_ident_arg,
pos(pos_arg),ident_len(ident_len_arg ? ident_len_arg :
(uint) strlen(new_log_ident_arg)), flags(flags_arg)
{
-#ifndef DBUG_OFF
- char buff[22];
DBUG_ENTER("Rotate_log_event::Rotate_log_event(...,flags)");
- DBUG_PRINT("enter",("new_log_ident: %s pos: %s flags: %lu", new_log_ident_arg,
- llstr(pos_arg, buff), (ulong) flags));
-#endif
+ DBUG_PRINT("enter",("new_log_ident: %s pos: %llu flags: %lu", new_log_ident_arg,
+ pos_arg, (ulong) flags));
cache_type= EVENT_NO_CACHE;
if (flags & DUP_NAME)
new_log_ident= my_strndup(new_log_ident_arg, ident_len, MYF(MY_WME));
@@ -6129,15 +6231,14 @@ Rotate_log_event::Rotate_log_event(const char* buf, uint event_len,
*/
#ifndef MYSQL_CLIENT
-bool Rotate_log_event::write(IO_CACHE* file)
+bool Rotate_log_event::write()
{
char buf[ROTATE_HEADER_LEN];
int8store(buf + R_POS_OFFSET, pos);
- return (write_header(file, ROTATE_HEADER_LEN + ident_len) ||
- wrapper_my_b_safe_write(file, (uchar*) buf, ROTATE_HEADER_LEN) ||
- wrapper_my_b_safe_write(file, (uchar*) new_log_ident,
- (uint) ident_len) ||
- write_footer(file));
+ return (write_header(ROTATE_HEADER_LEN + ident_len) ||
+ write_data(buf, ROTATE_HEADER_LEN) ||
+ write_data(new_log_ident, (uint) ident_len) ||
+ write_footer());
}
#endif
@@ -6161,14 +6262,11 @@ int Rotate_log_event::do_update_pos(rpl_group_info *rgi)
{
Relay_log_info *rli= rgi->rli;
DBUG_ENTER("Rotate_log_event::do_update_pos");
-#ifndef DBUG_OFF
- char buf[32];
-#endif
DBUG_PRINT("info", ("server_id=%lu; ::server_id=%lu",
(ulong) this->server_id, (ulong) global_system_variables.server_id));
DBUG_PRINT("info", ("new_log_ident: %s", this->new_log_ident));
- DBUG_PRINT("info", ("pos: %s", llstr(this->pos, buf)));
+ DBUG_PRINT("info", ("pos: %llu", this->pos));
/*
If we are in a transaction or in a group: the only normal case is
@@ -6330,15 +6428,14 @@ Binlog_checkpoint_log_event::Binlog_checkpoint_log_event(
#ifndef MYSQL_CLIENT
-bool Binlog_checkpoint_log_event::write(IO_CACHE *file)
+bool Binlog_checkpoint_log_event::write()
{
uchar buf[BINLOG_CHECKPOINT_HEADER_LEN];
int4store(buf, binlog_file_len);
- return write_header(file, BINLOG_CHECKPOINT_HEADER_LEN + binlog_file_len) ||
- wrapper_my_b_safe_write(file, buf, BINLOG_CHECKPOINT_HEADER_LEN) ||
- wrapper_my_b_safe_write(file, (const uchar *)binlog_file_name,
- binlog_file_len) ||
- write_footer(file);
+ return write_header(BINLOG_CHECKPOINT_HEADER_LEN + binlog_file_len) ||
+ write_data(buf, BINLOG_CHECKPOINT_HEADER_LEN) ||
+ write_data(binlog_file_name, binlog_file_len) ||
+ write_footer();
}
#endif /* MYSQL_CLIENT */
@@ -6409,7 +6506,7 @@ Gtid_log_event::Gtid_log_event(THD *thd_arg, uint64 seq_no_arg,
*/
bool
Gtid_log_event::peek(const char *event_start, size_t event_len,
- uint8 checksum_alg,
+ enum enum_binlog_checksum_alg checksum_alg,
uint32 *domain_id, uint32 *server_id, uint64 *seq_no,
uchar *flags2, const Format_description_log_event *fdev)
{
@@ -6440,7 +6537,7 @@ Gtid_log_event::peek(const char *event_start, size_t event_len,
bool
-Gtid_log_event::write(IO_CACHE *file)
+Gtid_log_event::write()
{
uchar buf[GTID_HEADER_LEN+2];
size_t write_len;
@@ -6458,9 +6555,9 @@ Gtid_log_event::write(IO_CACHE *file)
bzero(buf+13, GTID_HEADER_LEN-13);
write_len= GTID_HEADER_LEN;
}
- return write_header(file, write_len) ||
- wrapper_my_b_safe_write(file, buf, write_len) ||
- write_footer(file);
+ return write_header(write_len) ||
+ write_data(buf, write_len) ||
+ write_footer();
}
@@ -6475,7 +6572,8 @@ Gtid_log_event::write(IO_CACHE *file)
*/
int
Gtid_log_event::make_compatible_event(String *packet, bool *need_dummy_event,
- ulong ev_offset, uint8 checksum_alg)
+ ulong ev_offset,
+ enum enum_binlog_checksum_alg checksum_alg)
{
uchar flags2;
if (packet->length() - ev_offset < LOG_EVENT_HEADER_LEN + GTID_HEADER_LEN)
@@ -6817,7 +6915,7 @@ Gtid_list_log_event::to_packet(String *packet)
bool
-Gtid_list_log_event::write(IO_CACHE *file)
+Gtid_list_log_event::write()
{
char buf[128];
String packet(buf, sizeof(buf), system_charset_info);
@@ -6825,10 +6923,9 @@ Gtid_list_log_event::write(IO_CACHE *file)
packet.length(0);
if (to_packet(&packet))
return true;
- return
- write_header(file, get_data_size()) ||
- wrapper_my_b_safe_write(file, (uchar *)packet.ptr(), packet.length()) ||
- write_footer(file);
+ return write_header(get_data_size()) ||
+ write_data(packet.ptr(), packet.length()) ||
+ write_footer();
}
@@ -6930,7 +7027,7 @@ Gtid_list_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info)
*/
bool
Gtid_list_log_event::peek(const char *event_start, uint32 event_len,
- uint8 checksum_alg,
+ enum enum_binlog_checksum_alg checksum_alg,
rpl_gtid **out_gtid_list, uint32 *out_list_len,
const Format_description_log_event *fdev)
{
@@ -7033,14 +7130,14 @@ const char* Intvar_log_event::get_var_type_name()
*/
#ifndef MYSQL_CLIENT
-bool Intvar_log_event::write(IO_CACHE* file)
+bool Intvar_log_event::write()
{
uchar buf[9];
buf[I_TYPE_OFFSET]= (uchar) type;
int8store(buf + I_VAL_OFFSET, val);
- return (write_header(file, sizeof(buf)) ||
- wrapper_my_b_safe_write(file, buf, sizeof(buf)) ||
- write_footer(file));
+ return write_header(sizeof(buf)) ||
+ write_data(buf, sizeof(buf)) ||
+ write_footer();
}
#endif
@@ -7163,14 +7260,14 @@ Rand_log_event::Rand_log_event(const char* buf,
#ifndef MYSQL_CLIENT
-bool Rand_log_event::write(IO_CACHE* file)
+bool Rand_log_event::write()
{
uchar buf[16];
int8store(buf + RAND_SEED1_OFFSET, seed1);
int8store(buf + RAND_SEED2_OFFSET, seed2);
- return (write_header(file, sizeof(buf)) ||
- wrapper_my_b_safe_write(file, buf, sizeof(buf)) ||
- write_footer(file));
+ return write_header(sizeof(buf)) ||
+ write_data(buf, sizeof(buf)) ||
+ write_footer();
}
#endif
@@ -7289,12 +7386,12 @@ Xid_log_event(const char* buf,
#ifndef MYSQL_CLIENT
-bool Xid_log_event::write(IO_CACHE* file)
+bool Xid_log_event::write()
{
DBUG_EXECUTE_IF("do_not_write_xid", return 0;);
- return (write_header(file, sizeof(xid)) ||
- wrapper_my_b_safe_write(file, (uchar*) &xid, sizeof(xid)) ||
- write_footer(file));
+ return write_header(sizeof(xid)) ||
+ write_data((uchar*)&xid, sizeof(xid)) ||
+ write_footer();
}
#endif
@@ -7359,7 +7456,6 @@ int Xid_log_event::do_apply_event(rpl_group_info *rgi)
"%s.%s: %d: %s",
"mysql", rpl_gtid_slave_state_table_name.str, ec,
thd->get_stmt_da()->message());
- trans_rollback(thd);
thd->is_slave_error= 1;
return err;
}
@@ -7641,7 +7737,7 @@ err:
#ifndef MYSQL_CLIENT
-bool User_var_log_event::write(IO_CACHE* file)
+bool User_var_log_event::write()
{
char buf[UV_NAME_LEN_SIZE];
char buf1[UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE +
@@ -7696,13 +7792,13 @@ bool User_var_log_event::write(IO_CACHE* file)
/* Length of the whole event */
event_length= sizeof(buf)+ name_len + buf1_length + val_len + unsigned_len;
- return (write_header(file, event_length) ||
- wrapper_my_b_safe_write(file, (uchar*) buf, sizeof(buf)) ||
- wrapper_my_b_safe_write(file, (uchar*) name, name_len) ||
- wrapper_my_b_safe_write(file, (uchar*) buf1, buf1_length) ||
- wrapper_my_b_safe_write(file, pos, val_len) ||
- wrapper_my_b_safe_write(file, &flags, unsigned_len) ||
- write_footer(file));
+ return write_header(event_length) ||
+ write_data(buf, sizeof(buf)) ||
+ write_data(name, name_len) ||
+ write_data(buf1, buf1_length) ||
+ write_data(pos, val_len) ||
+ write_data(&flags, unsigned_len) ||
+ write_footer();
}
#endif
@@ -7849,33 +7945,33 @@ int User_var_log_event::do_apply_event(rpl_group_info *rgi)
if (is_null)
{
- it= new Item_null();
+ it= new (thd->mem_root) Item_null(thd);
}
else
{
switch (type) {
case REAL_RESULT:
float8get(real_val, val);
- it= new Item_float(real_val, 0);
+ it= new (thd->mem_root) Item_float(thd, real_val, 0);
val= (char*) &real_val; // Pointer to value in native format
val_len= 8;
break;
case INT_RESULT:
int_val= (longlong) uint8korr(val);
- it= new Item_int(int_val);
+ it= new (thd->mem_root) Item_int(thd, int_val);
val= (char*) &int_val; // Pointer to value in native format
val_len= 8;
break;
case DECIMAL_RESULT:
{
- Item_decimal *dec= new Item_decimal((uchar*) val+2, val[0], val[1]);
+ Item_decimal *dec= new (thd->mem_root) Item_decimal(thd, (uchar*) val+2, val[0], val[1]);
it= dec;
val= (char *)dec->val_decimal(NULL);
val_len= sizeof(my_decimal);
break;
}
case STRING_RESULT:
- it= new Item_string(val, val_len, charset);
+ it= new (thd->mem_root) Item_string(thd, val, val_len, charset);
break;
case ROW_RESULT:
default:
@@ -7884,7 +7980,7 @@ int User_var_log_event::do_apply_event(rpl_group_info *rgi)
}
}
- Item_func_set_user_var *e= new Item_func_set_user_var(user_var_name, it);
+ Item_func_set_user_var *e= new (thd->mem_root) Item_func_set_user_var(thd, user_var_name, it);
/*
Item_func_set_user_var can't substitute something else on its place =>
0 can be passed as last argument (reference on item)
@@ -7932,11 +8028,6 @@ User_var_log_event::do_shall_skip(rpl_group_info *rgi)
}
#endif /* !MYSQL_CLIENT */
-
-/**************************************************************************
- Slave_log_event methods
-**************************************************************************/
-
#ifdef HAVE_REPLICATION
#ifdef MYSQL_CLIENT
void Unknown_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info)
@@ -7950,152 +8041,6 @@ void Unknown_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info
}
#endif
-#ifndef MYSQL_CLIENT
-void Slave_log_event::pack_info(THD *thd, Protocol *protocol)
-{
- char buf[256+HOSTNAME_LENGTH], *pos;
- pos= strmov(buf, "host=");
- pos= strnmov(pos, master_host, HOSTNAME_LENGTH);
- pos= strmov(pos, ",port=");
- pos= int10_to_str((long) master_port, pos, 10);
- pos= strmov(pos, ",log=");
- pos= strmov(pos, master_log);
- pos= strmov(pos, ",pos=");
- pos= longlong10_to_str(master_pos, pos, 10);
- protocol->store(buf, pos-buf, &my_charset_bin);
-}
-#endif /* !MYSQL_CLIENT */
-
-
-#ifndef MYSQL_CLIENT
-/**
- @todo
- re-write this better without holding both locks at the same time
-*/
-Slave_log_event::Slave_log_event(THD* thd_arg,
- Relay_log_info* rli)
- :Log_event(thd_arg, 0, 0) , mem_pool(0), master_host(0)
-{
- DBUG_ENTER("Slave_log_event");
- if (!rli->inited) // QQ When can this happen ?
- DBUG_VOID_RETURN;
-
- Master_info* mi = rli->mi;
- // TODO: re-write this better without holding both locks at the same time
- mysql_mutex_lock(&mi->data_lock);
- mysql_mutex_lock(&rli->data_lock);
- master_host_len = strlen(mi->host);
- master_log_len = strlen(rli->group_master_log_name);
- // on OOM, just do not initialize the structure and print the error
- if ((mem_pool = (char*)my_malloc(get_data_size() + 1,
- MYF(MY_WME))))
- {
- master_host = mem_pool + SL_MASTER_HOST_OFFSET ;
- memcpy(master_host, mi->host, master_host_len + 1);
- master_log = master_host + master_host_len + 1;
- memcpy(master_log, rli->group_master_log_name, master_log_len + 1);
- master_port = mi->port;
- master_pos = rli->group_master_log_pos;
- DBUG_PRINT("info", ("master_log: %s pos: %lu", master_log,
- (ulong) master_pos));
- }
- else
- sql_print_error("Out of memory while recording slave event");
- mysql_mutex_unlock(&rli->data_lock);
- mysql_mutex_unlock(&mi->data_lock);
- DBUG_VOID_RETURN;
-}
-#endif /* !MYSQL_CLIENT */
-
-
-Slave_log_event::~Slave_log_event()
-{
- my_free(mem_pool);
-}
-
-
-#ifdef MYSQL_CLIENT
-void Slave_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
-{
- Write_on_release_cache cache(&print_event_info->head_cache, file);
-
- char llbuff[22];
- if (print_event_info->short_form)
- return;
- print_header(&cache, print_event_info, FALSE);
- my_b_printf(&cache, "\n\
-Slave: master_host: '%s' master_port: %d master_log: '%s' master_pos: %s\n",
- master_host, master_port, master_log, llstr(master_pos, llbuff));
-}
-#endif /* MYSQL_CLIENT */
-
-
-int Slave_log_event::get_data_size()
-{
- return master_host_len + master_log_len + 1 + SL_MASTER_HOST_OFFSET;
-}
-
-
-#ifndef MYSQL_CLIENT
-bool Slave_log_event::write(IO_CACHE* file)
-{
- ulong event_length= get_data_size();
- int8store(mem_pool + SL_MASTER_POS_OFFSET, master_pos);
- int2store(mem_pool + SL_MASTER_PORT_OFFSET, master_port);
- // log and host are already there
-
- return (write_header(file, event_length) ||
- my_b_safe_write(file, (uchar*) mem_pool, event_length));
-}
-#endif
-
-
-void Slave_log_event::init_from_mem_pool(int data_size)
-{
- master_pos = uint8korr(mem_pool + SL_MASTER_POS_OFFSET);
- master_port = uint2korr(mem_pool + SL_MASTER_PORT_OFFSET);
- master_host = mem_pool + SL_MASTER_HOST_OFFSET;
- master_host_len = (uint) strlen(master_host);
- // safety
- master_log = master_host + master_host_len + 1;
- if (master_log > mem_pool + data_size)
- {
- master_host = 0;
- return;
- }
- master_log_len = (uint) strlen(master_log);
-}
-
-
-/** This code is not used, so has not been updated to be format-tolerant. */
-/* We are using description_event so that slave does not crash on Log_event
- constructor */
-Slave_log_event::Slave_log_event(const char* buf,
- uint event_len,
- const Format_description_log_event* description_event)
- :Log_event(buf,description_event),mem_pool(0),master_host(0)
-{
- if (event_len < LOG_EVENT_HEADER_LEN)
- return;
- event_len -= LOG_EVENT_HEADER_LEN;
- if (!(mem_pool = (char*) my_malloc(event_len + 1, MYF(MY_WME))))
- return;
- memcpy(mem_pool, buf + LOG_EVENT_HEADER_LEN, event_len);
- mem_pool[event_len] = 0;
- init_from_mem_pool(event_len);
-}
-
-
-#ifndef MYSQL_CLIENT
-int Slave_log_event::do_apply_event(rpl_group_info *rgi)
-{
- if (mysql_bin_log.is_open())
- return mysql_bin_log.write(this);
- return 0;
-}
-#endif /* !MYSQL_CLIENT */
-
-
/**************************************************************************
Stop_log_event methods
**************************************************************************/
@@ -8191,13 +8136,13 @@ Create_file_log_event(THD* thd_arg, sql_exchange* ex,
Create_file_log_event::write_data_body()
*/
-bool Create_file_log_event::write_data_body(IO_CACHE* file)
+bool Create_file_log_event::write_data_body()
{
bool res;
- if ((res= Load_log_event::write_data_body(file)) || fake_base)
+ if ((res= Load_log_event::write_data_body()) || fake_base)
return res;
- return (my_b_safe_write(file, (uchar*) "", 1) ||
- my_b_safe_write(file, (uchar*) block, block_len));
+ return write_data("", 1) ||
+ write_data(block, block_len);
}
@@ -8205,14 +8150,14 @@ bool Create_file_log_event::write_data_body(IO_CACHE* file)
Create_file_log_event::write_data_header()
*/
-bool Create_file_log_event::write_data_header(IO_CACHE* file)
+bool Create_file_log_event::write_data_header()
{
bool res;
uchar buf[CREATE_FILE_HEADER_LEN];
- if ((res= Load_log_event::write_data_header(file)) || fake_base)
+ if ((res= Load_log_event::write_data_header()) || fake_base)
return res;
int4store(buf + CF_FILE_ID_OFFSET, file_id);
- return my_b_safe_write(file, buf, CREATE_FILE_HEADER_LEN) != 0;
+ return write_data(buf, CREATE_FILE_HEADER_LEN) != 0;
}
@@ -8220,11 +8165,11 @@ bool Create_file_log_event::write_data_header(IO_CACHE* file)
Create_file_log_event::write_base()
*/
-bool Create_file_log_event::write_base(IO_CACHE* file)
+bool Create_file_log_event::write_base()
{
bool res;
fake_base= 1; // pretend we are Load event
- res= write(file);
+ res= write();
fake_base= 0;
return res;
}
@@ -8371,6 +8316,7 @@ int Create_file_log_event::do_apply_event(rpl_group_info *rgi)
char *ext;
int fd = -1;
IO_CACHE file;
+ Log_event_writer lew(&file);
int error = 1;
Relay_log_info const *rli= rgi->rli;
@@ -8396,7 +8342,8 @@ int Create_file_log_event::do_apply_event(rpl_group_info *rgi)
// a trick to avoid allocating another buffer
fname= fname_buf;
fname_len= (uint) (strmov(ext, ".data") - fname);
- if (write_base(&file))
+ writer= &lew;
+ if (write_base())
{
strmov(ext, ".info"); // to have it right in the error message
rli->report(ERROR_LEVEL, my_errno, rgi->gtid_info(),
@@ -8487,14 +8434,14 @@ Append_block_log_event::Append_block_log_event(const char* buf, uint len,
*/
#ifndef MYSQL_CLIENT
-bool Append_block_log_event::write(IO_CACHE* file)
+bool Append_block_log_event::write()
{
uchar buf[APPEND_BLOCK_HEADER_LEN];
int4store(buf + AB_FILE_ID_OFFSET, file_id);
- return (write_header(file, APPEND_BLOCK_HEADER_LEN + block_len) ||
- wrapper_my_b_safe_write(file, buf, APPEND_BLOCK_HEADER_LEN) ||
- wrapper_my_b_safe_write(file, (uchar*) block, block_len) ||
- write_footer(file));
+ return write_header(APPEND_BLOCK_HEADER_LEN + block_len) ||
+ write_data(buf, APPEND_BLOCK_HEADER_LEN) ||
+ write_data(block, block_len) ||
+ write_footer();
}
#endif
@@ -8647,13 +8594,13 @@ Delete_file_log_event::Delete_file_log_event(const char* buf, uint len,
*/
#ifndef MYSQL_CLIENT
-bool Delete_file_log_event::write(IO_CACHE* file)
+bool Delete_file_log_event::write()
{
uchar buf[DELETE_FILE_HEADER_LEN];
int4store(buf + DF_FILE_ID_OFFSET, file_id);
- return (write_header(file, sizeof(buf)) ||
- wrapper_my_b_safe_write(file, buf, sizeof(buf)) ||
- write_footer(file));
+ return write_header(sizeof(buf)) ||
+ write_data(buf, sizeof(buf)) ||
+ write_footer();
}
#endif
@@ -8747,13 +8694,13 @@ Execute_load_log_event::Execute_load_log_event(const char* buf, uint len,
*/
#ifndef MYSQL_CLIENT
-bool Execute_load_log_event::write(IO_CACHE* file)
+bool Execute_load_log_event::write()
{
uchar buf[EXEC_LOAD_HEADER_LEN];
int4store(buf + EL_FILE_ID_OFFSET, file_id);
- return (write_header(file, sizeof(buf)) ||
- wrapper_my_b_safe_write(file, buf, sizeof(buf)) ||
- write_footer(file));
+ return write_header(sizeof(buf)) ||
+ write_data(buf, sizeof(buf)) ||
+ write_footer();
}
#endif
@@ -8982,14 +8929,14 @@ ulong Execute_load_query_log_event::get_post_header_size_for_derived()
#ifndef MYSQL_CLIENT
bool
-Execute_load_query_log_event::write_post_header_for_derived(IO_CACHE* file)
+Execute_load_query_log_event::write_post_header_for_derived()
{
uchar buf[EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN];
int4store(buf, file_id);
int4store(buf + 4, fn_pos_start);
int4store(buf + 4 + 4, fn_pos_end);
*(buf + 4 + 4 + 4)= (uchar) dup_handling;
- return wrapper_my_b_safe_write(file, buf, EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN);
+ return write_data(buf, EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN);
}
#endif
@@ -9084,7 +9031,7 @@ Execute_load_query_log_event::do_apply_event(rpl_group_info *rgi)
if (buf == NULL)
{
rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, rgi->gtid_info(),
- ER(ER_SLAVE_FATAL_ERROR), "Not enough memory");
+ ER_THD(rgi->thd, ER_SLAVE_FATAL_ERROR), "Not enough memory");
return 1;
}
@@ -9133,40 +9080,6 @@ Execute_load_query_log_event::do_apply_event(rpl_group_info *rgi)
**************************************************************************/
/*
- sql_ex_info::write_data()
-*/
-
-bool sql_ex_info::write_data(IO_CACHE* file)
-{
- if (new_format())
- {
- return (write_str(file, field_term, (uint) field_term_len) ||
- write_str(file, enclosed, (uint) enclosed_len) ||
- write_str(file, line_term, (uint) line_term_len) ||
- write_str(file, line_start, (uint) line_start_len) ||
- write_str(file, escaped, (uint) escaped_len) ||
- my_b_safe_write(file,(uchar*) &opt_flags,1));
- }
- else
- {
- /**
- @todo This is sensitive to field padding. We should write a
- char[7], not an old_sql_ex. /sven
- */
- old_sql_ex old_ex;
- old_ex.field_term= *field_term;
- old_ex.enclosed= *enclosed;
- old_ex.line_term= *line_term;
- old_ex.line_start= *line_start;
- old_ex.escaped= *escaped;
- old_ex.opt_flags= opt_flags;
- old_ex.empty_flags=empty_flags;
- return my_b_safe_write(file, (uchar*) &old_ex, sizeof(old_ex)) != 0;
- }
-}
-
-
-/*
sql_ex_info::init()
*/
@@ -9216,12 +9129,54 @@ const char *sql_ex_info::init(const char *buf, const char *buf_end,
return buf;
}
+#ifndef MYSQL_CLIENT
+/*
+ write_str()
+*/
+
+static bool write_str(Log_event_writer *writer, const char *str, uint length)
+{
+ uchar tmp[1];
+ tmp[0]= (uchar) length;
+ return (writer->write_data(tmp, sizeof(tmp)) ||
+ writer->write_data((uchar*) str, length));
+}
+
+/*
+ sql_ex_info::write_data()
+*/
+
+bool sql_ex_info::write_data(Log_event_writer *writer)
+{
+ if (new_format())
+ {
+ return write_str(writer, field_term, field_term_len) ||
+ write_str(writer, enclosed, enclosed_len) ||
+ write_str(writer, line_term, line_term_len) ||
+ write_str(writer, line_start, line_start_len) ||
+ write_str(writer, escaped, escaped_len) ||
+ writer->write_data((uchar*) &opt_flags, 1);
+ }
+ else
+ {
+ uchar old_ex[7];
+ old_ex[0]= *field_term;
+ old_ex[1]= *enclosed;
+ old_ex[2]= *line_term;
+ old_ex[3]= *line_start;
+ old_ex[4]= *escaped;
+ old_ex[5]= opt_flags;
+ old_ex[6]= empty_flags;
+ return writer->write_data(old_ex, sizeof(old_ex));
+ }
+}
+
+
/**************************************************************************
Rows_log_event member functions
**************************************************************************/
-#ifndef MYSQL_CLIENT
Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
MY_BITMAP const *cols, bool is_transactional,
Log_event_type event_type)
@@ -9493,6 +9448,18 @@ int Rows_log_event::do_add_row_data(uchar *row_data, size_t length)
DBUG_ENTER("Rows_log_event::do_add_row_data");
DBUG_PRINT("enter", ("row_data: 0x%lx length: %lu", (ulong) row_data,
(ulong) length));
+
+ /*
+ If length is zero, there is nothing to write, so we just
+ return. Note that this is not an optimization, since calling
+ realloc() with size 0 means free().
+ */
+ if (length == 0)
+ {
+ m_row_count++;
+ DBUG_RETURN(0);
+ }
+
/*
Don't print debug messages when running valgrind since they can
trigger false warnings.
@@ -9849,12 +9816,19 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
longer if slave has extra columns.
*/
- DBUG_PRINT_BITSET("debug", "Setting table's write_set from: %s", &m_cols);
+ DBUG_PRINT_BITSET("debug", "Setting table's read_set from: %s", &m_cols);
bitmap_set_all(table->read_set);
+ if (get_general_type_code() == DELETE_ROWS_EVENT ||
+ get_general_type_code() == UPDATE_ROWS_EVENT)
+ bitmap_intersect(table->read_set,&m_cols);
+
bitmap_set_all(table->write_set);
- if (!get_flags(COMPLETE_ROWS_F))
- bitmap_intersect(table->write_set,&m_cols);
+
+ /* WRITE ROWS EVENTS store the bitmap in m_cols instead of m_cols_ai */
+ MY_BITMAP *after_image= ((get_general_type_code() == UPDATE_ROWS_EVENT) ?
+ &m_cols_ai : &m_cols);
+ bitmap_intersect(table->write_set, after_image);
this->slave_exec_mode= slave_exec_mode_options; // fix the mode
@@ -9882,7 +9856,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
rgi->set_row_stmt_start_timestamp();
THD_STAGE_INFO(thd, stage_executing);
- while (error == 0 && m_curr_row < m_rows_end)
+ do
{
/* in_use can have been set to NULL in close_tables_for_reopen */
THD* old_thd= table->in_use;
@@ -9930,18 +9904,14 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
if (!m_curr_row_end && !error)
error= unpack_current_row(rgi);
-
- // at this moment m_curr_row_end should be set
- DBUG_ASSERT(error || m_curr_row_end != NULL);
- DBUG_ASSERT(error || m_curr_row < m_curr_row_end);
- DBUG_ASSERT(error || m_curr_row_end <= m_rows_end);
-
+
m_curr_row= m_curr_row_end;
if (error == 0 && !transactional_table)
thd->transaction.all.modified_non_trans_table=
thd->transaction.stmt.modified_non_trans_table= TRUE;
} // row processing loop
+ while (error == 0 && (m_curr_row != m_rows_end));
/*
Restore the sql_mode after the rows event is processed.
@@ -10155,7 +10125,7 @@ Rows_log_event::do_update_pos(rpl_group_info *rgi)
#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
#ifndef MYSQL_CLIENT
-bool Rows_log_event::write_data_header(IO_CACHE *file)
+bool Rows_log_event::write_data_header()
{
uchar buf[ROWS_HEADER_LEN_V2]; // No need to init the buffer
DBUG_ASSERT(m_table_id != ~0UL);
@@ -10163,14 +10133,14 @@ bool Rows_log_event::write_data_header(IO_CACHE *file)
{
int4store(buf + 0, m_table_id);
int2store(buf + 4, m_flags);
- return (wrapper_my_b_safe_write(file, buf, 6));
+ return (write_data(buf, 6));
});
int6store(buf + RW_MAPID_OFFSET, (ulonglong)m_table_id);
int2store(buf + RW_FLAGS_OFFSET, m_flags);
- return (wrapper_my_b_safe_write(file, buf, ROWS_HEADER_LEN));
+ return write_data(buf, ROWS_HEADER_LEN);
}
-bool Rows_log_event::write_data_body(IO_CACHE*file)
+bool Rows_log_event::write_data_body()
{
/*
Note that this should be the number of *bits*, not the number of
@@ -10183,11 +10153,10 @@ bool Rows_log_event::write_data_body(IO_CACHE*file)
DBUG_ASSERT(static_cast<size_t>(sbuf_end - sbuf) <= sizeof(sbuf));
DBUG_DUMP("m_width", sbuf, (size_t) (sbuf_end - sbuf));
- res= res || wrapper_my_b_safe_write(file, sbuf, (size_t) (sbuf_end - sbuf));
+ res= res || write_data(sbuf, (size_t) (sbuf_end - sbuf));
DBUG_DUMP("m_cols", (uchar*) m_cols.bitmap, no_bytes_in_map(&m_cols));
- res= res || wrapper_my_b_safe_write(file, (uchar*) m_cols.bitmap,
- no_bytes_in_map(&m_cols));
+ res= res || write_data((uchar*)m_cols.bitmap, no_bytes_in_map(&m_cols));
/*
TODO[refactor write]: Remove the "down cast" here (and elsewhere).
*/
@@ -10195,11 +10164,11 @@ bool Rows_log_event::write_data_body(IO_CACHE*file)
{
DBUG_DUMP("m_cols_ai", (uchar*) m_cols_ai.bitmap,
no_bytes_in_map(&m_cols_ai));
- res= res || wrapper_my_b_safe_write(file, (uchar*) m_cols_ai.bitmap,
- no_bytes_in_map(&m_cols_ai));
+ res= res || write_data((uchar*)m_cols_ai.bitmap,
+ no_bytes_in_map(&m_cols_ai));
}
DBUG_DUMP("rows", m_rows_buf, data_size);
- res= res || wrapper_my_b_safe_write(file, m_rows_buf, (size_t) data_size);
+ res= res || write_data(m_rows_buf, (size_t) data_size);
return res;
@@ -10297,16 +10266,16 @@ bool Annotate_rows_log_event::is_valid() const
}
#ifndef MYSQL_CLIENT
-bool Annotate_rows_log_event::write_data_header(IO_CACHE *file)
+bool Annotate_rows_log_event::write_data_header()
{
return 0;
}
#endif
#ifndef MYSQL_CLIENT
-bool Annotate_rows_log_event::write_data_body(IO_CACHE *file)
+bool Annotate_rows_log_event::write_data_body()
{
- return wrapper_my_b_safe_write(file, (uchar*) m_query_txt, m_query_len);
+ return write_data(m_query_txt, m_query_len);
}
#endif
@@ -10980,13 +10949,14 @@ int Table_map_log_event::do_apply_event(rpl_group_info *rgi)
if (thd->slave_thread)
rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, rgi->gtid_info(),
- ER(ER_SLAVE_FATAL_ERROR), buf);
+ ER_THD(thd, ER_SLAVE_FATAL_ERROR), buf);
else
/*
For the cases in which a 'BINLOG' statement is set to
execute in a user session
*/
- my_printf_error(ER_SLAVE_FATAL_ERROR, ER(ER_SLAVE_FATAL_ERROR),
+ my_printf_error(ER_SLAVE_FATAL_ERROR,
+ ER_THD(thd, ER_SLAVE_FATAL_ERROR),
MYF(0), buf);
}
@@ -11015,7 +10985,7 @@ int Table_map_log_event::do_update_pos(rpl_group_info *rgi)
#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
#ifndef MYSQL_CLIENT
-bool Table_map_log_event::write_data_header(IO_CACHE *file)
+bool Table_map_log_event::write_data_header()
{
DBUG_ASSERT(m_table_id != ~0UL);
uchar buf[TABLE_MAP_HEADER_LEN];
@@ -11023,14 +10993,14 @@ bool Table_map_log_event::write_data_header(IO_CACHE *file)
{
int4store(buf + 0, m_table_id);
int2store(buf + 4, m_flags);
- return (wrapper_my_b_safe_write(file, buf, 6));
+ return (write_data(buf, 6));
});
int6store(buf + TM_MAPID_OFFSET, (ulonglong)m_table_id);
int2store(buf + TM_FLAGS_OFFSET, m_flags);
- return (wrapper_my_b_safe_write(file, buf, TABLE_MAP_HEADER_LEN));
+ return write_data(buf, TABLE_MAP_HEADER_LEN);
}
-bool Table_map_log_event::write_data_body(IO_CACHE *file)
+bool Table_map_log_event::write_data_body()
{
DBUG_ASSERT(m_dbnam != NULL);
DBUG_ASSERT(m_tblnam != NULL);
@@ -11051,15 +11021,15 @@ bool Table_map_log_event::write_data_body(IO_CACHE *file)
uchar mbuf[MAX_INT_WIDTH];
uchar *const mbuf_end= net_store_length(mbuf, m_field_metadata_size);
- return (wrapper_my_b_safe_write(file, dbuf, sizeof(dbuf)) ||
- wrapper_my_b_safe_write(file, (const uchar*)m_dbnam, m_dblen+1) ||
- wrapper_my_b_safe_write(file, tbuf, sizeof(tbuf)) ||
- wrapper_my_b_safe_write(file, (const uchar*)m_tblnam, m_tbllen+1) ||
- wrapper_my_b_safe_write(file, cbuf, (size_t) (cbuf_end - cbuf)) ||
- wrapper_my_b_safe_write(file, m_coltype, m_colcnt) ||
- wrapper_my_b_safe_write(file, mbuf, (size_t) (mbuf_end - mbuf)) ||
- wrapper_my_b_safe_write(file, m_field_metadata, m_field_metadata_size),
- wrapper_my_b_safe_write(file, m_null_bits, (m_colcnt + 7) / 8));
+ return write_data(dbuf, sizeof(dbuf)) ||
+ write_data(m_dbnam, m_dblen+1) ||
+ write_data(tbuf, sizeof(tbuf)) ||
+ write_data(m_tblnam, m_tbllen+1) ||
+ write_data(cbuf, (size_t) (cbuf_end - cbuf)) ||
+ write_data(m_coltype, m_colcnt) ||
+ write_data(mbuf, (size_t) (mbuf_end - mbuf)) ||
+ write_data(m_field_metadata, m_field_metadata_size),
+ write_data(m_null_bits, (m_colcnt + 7) / 8);
}
#endif
@@ -11111,9 +11081,9 @@ void Table_map_log_event::print(FILE *, PRINT_EVENT_INFO *print_event_info)
#if !defined(MYSQL_CLIENT)
Write_rows_log_event::Write_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
ulong tid_arg,
- MY_BITMAP const *cols,
bool is_transactional)
- : Rows_log_event(thd_arg, tbl_arg, tid_arg, cols, is_transactional, WRITE_ROWS_EVENT_V1)
+ : Rows_log_event(thd_arg, tbl_arg, tid_arg, tbl_arg->write_set,
+ is_transactional, WRITE_ROWS_EVENT_V1)
{
}
#endif
@@ -11370,7 +11340,16 @@ Rows_log_event::write_row(rpl_group_info *rgi,
the size of the first row and use that value to initialize
storage engine for bulk insertion.
*/
- ulong estimated_rows= (m_rows_end - m_curr_row) / (m_curr_row_end - m_curr_row);
+ /* this is the first row to be inserted, we estimate the rows with
+ the size of the first row and use that value to initialize
+ storage engine for bulk insertion */
+ DBUG_ASSERT(!(m_curr_row > m_curr_row_end));
+ ulong estimated_rows= 0;
+ if (m_curr_row < m_curr_row_end)
+ estimated_rows= (m_rows_end - m_curr_row) / (m_curr_row_end - m_curr_row);
+ else if (m_curr_row == m_curr_row_end)
+ estimated_rows= 1;
+
table->file->ha_start_bulk_insert(estimated_rows);
}
@@ -11381,11 +11360,9 @@ Rows_log_event::write_row(rpl_group_info *rgi,
if (is_auto_inc_in_extra_columns())
m_table->next_number_field->set_null();
-#ifndef DBUG_OFF
DBUG_DUMP("record[0]", table->record[0], table->s->reclength);
DBUG_PRINT_BITSET("debug", "write_set = %s", table->write_set);
DBUG_PRINT_BITSET("debug", "read_set = %s", table->read_set);
-#endif
if (invoke_triggers &&
process_triggers(TRG_EVENT_INSERT, TRG_ACTION_BEFORE, TRUE))
@@ -11494,11 +11471,9 @@ Rows_log_event::write_row(rpl_group_info *rgi,
error= unpack_current_row(rgi);
}
-#ifndef DBUG_OFF
DBUG_PRINT("debug",("preparing for update: before and after image"));
DBUG_DUMP("record[1] (before)", table->record[1], table->s->reclength);
DBUG_DUMP("record[0] (after)", table->record[0], table->s->reclength);
-#endif
/*
REPLACE is defined as either INSERT or DELETE + INSERT. If
@@ -11858,10 +11833,8 @@ int Rows_log_event::find_row(rpl_group_info *rgi)
prepare_record(table, m_width, FALSE);
error= unpack_current_row(rgi);
-#ifndef DBUG_OFF
DBUG_PRINT("info",("looking for the following record"));
DBUG_DUMP("record[0]", table->record[0], table->s->reclength);
-#endif
if ((table->file->ha_table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_POSITION) &&
table->s->primary_key < MAX_KEY)
@@ -12125,9 +12098,9 @@ end:
#ifndef MYSQL_CLIENT
Delete_rows_log_event::Delete_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
- ulong tid, MY_BITMAP const *cols,
- bool is_transactional)
- : Rows_log_event(thd_arg, tbl_arg, tid, cols, is_transactional, DELETE_ROWS_EVENT_V1)
+ ulong tid, bool is_transactional)
+ : Rows_log_event(thd_arg, tbl_arg, tid, tbl_arg->read_set, is_transactional,
+ DELETE_ROWS_EVENT_V1)
{
}
#endif /* #if !defined(MYSQL_CLIENT) */
@@ -12255,21 +12228,11 @@ uint8 Delete_rows_log_event::get_trg_event_map()
#if !defined(MYSQL_CLIENT)
Update_rows_log_event::Update_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
ulong tid,
- MY_BITMAP const *cols_bi,
- MY_BITMAP const *cols_ai,
- bool is_transactional)
-: Rows_log_event(thd_arg, tbl_arg, tid, cols_bi, is_transactional, UPDATE_ROWS_EVENT_V1)
-{
- init(cols_ai);
-}
-
-Update_rows_log_event::Update_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
- ulong tid,
- MY_BITMAP const *cols,
bool is_transactional)
-: Rows_log_event(thd_arg, tbl_arg, tid, cols, is_transactional, UPDATE_ROWS_EVENT_V1)
+: Rows_log_event(thd_arg, tbl_arg, tid, tbl_arg->read_set, is_transactional,
+ UPDATE_ROWS_EVENT_V1)
{
- init(cols);
+ init(tbl_arg->write_set);
}
void Update_rows_log_event::init(MY_BITMAP const *cols)
@@ -12371,7 +12334,7 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi)
able to skip to the next pair of updates
*/
m_curr_row= m_curr_row_end;
- unpack_current_row(rgi);
+ unpack_current_row(rgi, &m_cols_ai);
thd_proc_info(thd, tmp);
return error;
}
@@ -12400,7 +12363,7 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi)
/* this also updates m_curr_row_end */
thd_proc_info(thd, message);
- if ((error= unpack_current_row(rgi)))
+ if ((error= unpack_current_row(rgi, &m_cols_ai)))
goto err;
/*
@@ -12433,9 +12396,15 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi)
goto err;
}
+ // Temporary fix to find out why it fails [/Matz]
+ memcpy(m_table->read_set->bitmap, m_cols.bitmap, (m_table->read_set->n_bits + 7) / 8);
+ memcpy(m_table->write_set->bitmap, m_cols_ai.bitmap, (m_table->write_set->n_bits + 7) / 8);
+
+ m_table->mark_columns_per_binlog_row_image();
error= m_table->file->ha_update_row(m_table->record[1], m_table->record[0]);
if (error == HA_ERR_RECORD_IS_THE_SAME)
error= 0;
+ m_table->default_column_bitmaps();
if (invoke_triggers && !error &&
process_triggers(TRG_EVENT_UPDATE, TRG_ACTION_AFTER, TRUE))
@@ -12495,7 +12464,12 @@ Incident_log_event::Incident_log_event(const char *buf, uint event_len,
char const *const str_end= buf + event_len;
uint8 len= 0; // Assignment to keep compiler happy
const char *str= NULL; // Assignment to keep compiler happy
- read_str(&ptr, str_end, &str, &len);
+ if (read_str(&ptr, str_end, &str, &len))
+ {
+ /* Mark this event invalid */
+ m_incident= INCIDENT_NONE;
+ DBUG_VOID_RETURN;
+ }
if (!(m_message.str= (char*) my_malloc(len+1, MYF(MY_WME))))
{
/* Mark this event invalid */
@@ -12546,7 +12520,6 @@ void Incident_log_event::pack_info(THD *thd, Protocol *protocol)
#if WITH_WSREP && !defined(MYSQL_CLIENT)
-Format_description_log_event *wsrep_format_desc; // TODO: free them at the end
/*
read the first event from (*buf). The size of the (*buf) is (*buf_len).
At the end (*buf) is shitfed to point to the following event or NULL and
@@ -12616,42 +12589,34 @@ Incident_log_event::do_apply_event(rpl_group_info *rgi)
}
rli->report(ERROR_LEVEL, ER_SLAVE_INCIDENT, NULL,
- ER(ER_SLAVE_INCIDENT),
+ ER_THD(rgi->thd, ER_SLAVE_INCIDENT),
description(),
m_message.length > 0 ? m_message.str : "<none>");
DBUG_RETURN(1);
}
#endif
+#ifdef MYSQL_SERVER
bool
-Incident_log_event::write_data_header(IO_CACHE *file)
+Incident_log_event::write_data_header()
{
DBUG_ENTER("Incident_log_event::write_data_header");
DBUG_PRINT("enter", ("m_incident: %d", m_incident));
uchar buf[sizeof(int16)];
int2store(buf, (int16) m_incident);
-#ifndef MYSQL_CLIENT
- DBUG_RETURN(wrapper_my_b_safe_write(file, buf, sizeof(buf)));
-#else
- DBUG_RETURN(my_b_safe_write(file, buf, sizeof(buf)));
-#endif
+ DBUG_RETURN(write_data(buf, sizeof(buf)));
}
bool
-Incident_log_event::write_data_body(IO_CACHE *file)
+Incident_log_event::write_data_body()
{
uchar tmp[1];
DBUG_ENTER("Incident_log_event::write_data_body");
tmp[0]= (uchar) m_message.length;
- crc= my_checksum(crc, (uchar*) tmp, 1);
- if (m_message.length > 0)
- {
- crc= my_checksum(crc, (uchar*) m_message.str, m_message.length);
- // todo: report a bug on write_str accepts uint but treats it as uchar
- }
- DBUG_RETURN(write_str(file, m_message.str, (uint) m_message.length));
+ DBUG_RETURN(write_data(tmp, sizeof(tmp)) ||
+ write_data(m_message.str, m_message.length));
}
-
+#endif
#ifdef MYSQL_CLIENT
/**
diff --git a/sql/log_event.h b/sql/log_event.h
index b57ef35aad2..f96075db77d 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -81,6 +81,7 @@ class String;
#define LOG_READ_TRUNC -6
#define LOG_READ_TOO_LARGE -7
#define LOG_READ_CHECKSUM_FAILURE -8
+#define LOG_READ_DECRYPT -9
#define LOG_EVENT_OFFSET 4
@@ -145,64 +146,10 @@ class String;
#define LINE_START_EMPTY 0x8
#define ESCAPED_EMPTY 0x10
-/*****************************************************************************
-
- old_sql_ex struct
-
- ****************************************************************************/
-struct old_sql_ex
-{
- char field_term;
- char enclosed;
- char line_term;
- char line_start;
- char escaped;
- char opt_flags;
- char empty_flags;
-};
-
#define NUM_LOAD_DELIM_STRS 5
/*****************************************************************************
- sql_ex_info struct
-
- ****************************************************************************/
-struct sql_ex_info
-{
- sql_ex_info() {} /* Remove gcc warning */
- const char* field_term;
- const char* enclosed;
- const char* line_term;
- const char* line_start;
- const char* escaped;
- int cached_new_format;
- uint8 field_term_len,enclosed_len,line_term_len,line_start_len, escaped_len;
- char opt_flags;
- char empty_flags;
-
- // store in new format even if old is possible
- void force_new_format() { cached_new_format = 1;}
- int data_size()
- {
- return (new_format() ?
- field_term_len + enclosed_len + line_term_len +
- line_start_len + escaped_len + 6 : 7);
- }
- bool write_data(IO_CACHE* file);
- const char* init(const char* buf, const char* buf_end, bool use_new_format);
- bool new_format()
- {
- return ((cached_new_format != -1) ? cached_new_format :
- (cached_new_format=(field_term_len > 1 ||
- enclosed_len > 1 ||
- line_term_len > 1 || line_start_len > 1 ||
- escaped_len > 1)));
- }
-};
-
-/*****************************************************************************
-
MySQL Binary Log
This log consists of events. Each event has a fixed-length header,
@@ -265,6 +212,7 @@ struct sql_ex_info
#define BINLOG_CHECKPOINT_HEADER_LEN 4
#define GTID_HEADER_LEN 19
#define GTID_LIST_HEADER_LEN 4
+#define START_ENCRYPTION_HEADER_LEN 0
/*
Max number of possible extra bytes in a replication event compared to a
@@ -566,15 +514,6 @@ struct sql_ex_info
#endif
#undef EXPECTED_OPTIONS /* You shouldn't use this one */
-enum enum_binlog_checksum_alg {
- BINLOG_CHECKSUM_ALG_OFF= 0, // Events are without checksum though its generator
- // is checksum-capable New Master (NM).
- BINLOG_CHECKSUM_ALG_CRC32= 1, // CRC32 of zlib algorithm.
- BINLOG_CHECKSUM_ALG_ENUM_END, // the cut line: valid alg range is [1, 0x7f].
- BINLOG_CHECKSUM_ALG_UNDEF= 255 // special value to tag undetermined yet checksum
- // or events from checksum-unaware servers
-};
-
#define CHECKSUM_CRC32_SIGNATURE_LEN 4
/**
defined statically while there is just one alg implemented
@@ -729,6 +668,8 @@ enum Log_event_type
*/
GTID_LIST_EVENT= 163,
+ START_ENCRYPTION_EVENT= 164,
+
/* Add new MariaDB events here - right above this comment! */
ENUM_END_EVENT /* end marker */
@@ -852,6 +793,45 @@ typedef struct st_print_event_info
#endif
/**
+ This class encapsulates writing of Log_event objects to IO_CACHE.
+ Automatically calculates the checksum and encrypts the data, if necessary.
+*/
+class Log_event_writer
+{
+public:
+ ulonglong bytes_written;
+ void *ctx; ///< Encryption context or 0 if no encryption is needed
+ uint checksum_len;
+ int write(Log_event *ev);
+ int write_header(uchar *pos, size_t len);
+ int write_data(const uchar *pos, size_t len);
+ int write_footer();
+ my_off_t pos() { return my_b_safe_tell(file); }
+
+Log_event_writer(IO_CACHE *file_arg, Binlog_crypt_data *cr= 0)
+ : bytes_written(0), ctx(0),
+ file(file_arg), crypto(cr) { }
+
+private:
+ IO_CACHE *file;
+ /**
+ Placeholder for event checksum while writing to binlog.
+ */
+ ha_checksum crc;
+ /**
+ Encryption data (key, nonce). Only used if ctx != 0.
+ */
+ Binlog_crypt_data *crypto;
+ /**
+ Event length to be written into the next encrypted block
+ */
+ uint event_len;
+ int write_internal(const uchar *pos, size_t len);
+ int encrypt_and_write(const uchar *pos, size_t len);
+ int maybe_write_event_len(uchar *pos, size_t len);
+};
+
+/**
the struct aggregates two paramenters that identify an event
uniquely in scope of communication of a particular master and slave couple.
I.e there can not be 2 events from the same staying connected master which
@@ -1117,16 +1097,47 @@ public:
*/
ulong slave_exec_mode;
- /**
- Placeholder for event checksum while writing to binlog.
- */
- ha_checksum crc;
+ Log_event_writer *writer;
#ifdef MYSQL_SERVER
THD* thd;
Log_event();
Log_event(THD* thd_arg, uint16 flags_arg, bool is_transactional);
+
+ /*
+ init_show_field_list() prepares the column names and types for the
+ output of SHOW BINLOG EVENTS; it is used only by SHOW BINLOG
+ EVENTS.
+ */
+ static void init_show_field_list(THD *thd, List<Item>* field_list);
+#ifdef HAVE_REPLICATION
+ int net_send(THD *thd, Protocol *protocol, const char* log_name,
+ my_off_t pos);
+
+ /*
+ pack_info() is used by SHOW BINLOG EVENTS; as print() it prepares and sends
+ a string to display to the user, so it resembles print().
+ */
+
+ virtual void pack_info(THD *thd, Protocol *protocol);
+
+#endif /* HAVE_REPLICATION */
+ virtual const char* get_db()
+ {
+ return thd ? thd->db : 0;
+ }
+#else
+ Log_event() : temp_buf(0), flags(0) {}
+ ha_checksum crc;
+ /* print*() functions are used by mysqlbinlog */
+ virtual void print(FILE* file, PRINT_EVENT_INFO* print_event_info) = 0;
+ void print_timestamp(IO_CACHE* file, time_t *ts = 0);
+ void print_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info,
+ bool is_more);
+ void print_base64(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info,
+ bool is_more);
+#endif
/*
read_log_event() functions read an event from a binlog or relay
log; used by SHOW BINLOG EVENTS, the binlog_dump thread on the
@@ -1155,9 +1166,9 @@ public:
@param[in] file log file to be read
@param[out] packet packet to hold the event
- @param[in] lock the lock to be used upon read
- @param[in] log_file_name_arg the log's file name
- @param[out] is_binlog_active is the current log still active
+ @param[in] checksum_alg_arg verify the event checksum using this
+ algorithm (or don't if it's
+ use BINLOG_CHECKSUM_ALG_OFF)
@retval 0 success
@retval LOG_READ_EOF end of file, nothing was read
@@ -1168,46 +1179,8 @@ public:
@retval LOG_READ_TOO_LARGE event too large
*/
static int read_log_event(IO_CACHE* file, String* packet,
- mysql_mutex_t* log_lock,
- uint8 checksum_alg_arg,
- const char *log_file_name_arg = NULL,
- bool* is_binlog_active = NULL);
- /*
- init_show_field_list() prepares the column names and types for the
- output of SHOW BINLOG EVENTS; it is used only by SHOW BINLOG
- EVENTS.
- */
- static void init_show_field_list(List<Item>* field_list);
-#ifdef HAVE_REPLICATION
- int net_send(THD *thd, Protocol *protocol, const char* log_name,
- my_off_t pos);
-
- /*
- pack_info() is used by SHOW BINLOG EVENTS; as print() it prepares and sends
- a string to display to the user, so it resembles print().
- */
-
- virtual void pack_info(THD *thd, Protocol *protocol);
-
-#endif /* HAVE_REPLICATION */
- virtual const char* get_db()
- {
- return thd ? thd->db : 0;
- }
-#else
- Log_event() : temp_buf(0), flags(0) {}
- /* avoid having to link mysqlbinlog against libpthread */
- static Log_event* read_log_event(IO_CACHE* file,
- const Format_description_log_event
- *description_event, my_bool crc_check);
- /* print*() functions are used by mysqlbinlog */
- virtual void print(FILE* file, PRINT_EVENT_INFO* print_event_info) = 0;
- void print_timestamp(IO_CACHE* file, time_t *ts = 0);
- void print_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info,
- bool is_more);
- void print_base64(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info,
- bool is_more);
-#endif
+ const Format_description_log_event *fdle,
+ enum enum_binlog_checksum_alg checksum_alg_arg);
/*
The value is set by caller of FD constructor and
Log_event::write_header() for the rest.
@@ -1216,7 +1189,7 @@ public:
On the slave side the value is assigned from post_header_len[last]
of the last seen FD event.
*/
- uint8 checksum_alg;
+ enum enum_binlog_checksum_alg checksum_alg;
static void *operator new(size_t size)
{
@@ -1231,24 +1204,29 @@ public:
/* Placement version of the above operators */
static void *operator new(size_t, void* ptr) { return ptr; }
static void operator delete(void*, void*) { }
- bool wrapper_my_b_safe_write(IO_CACHE* file, const uchar* buf, ulong data_length);
#ifdef MYSQL_SERVER
- bool write_header(IO_CACHE* file, ulong data_length);
- bool write_footer(IO_CACHE* file);
+ bool write_header(ulong data_length);
+ bool write_data(const uchar *buf, ulong data_length)
+ { return writer->write_data(buf, data_length); }
+ bool write_data(const char *buf, ulong data_length)
+ { return write_data((uchar*)buf, data_length); }
+ bool write_footer()
+ { return writer->write_footer(); }
+
my_bool need_checksum();
- virtual bool write(IO_CACHE* file)
+ virtual bool write()
{
- return(write_header(file, get_data_size()) ||
- write_data_header(file) ||
- write_data_body(file) ||
- write_footer(file));
+ return write_header(get_data_size()) || write_data_header() ||
+ write_data_body() || write_footer();
}
- virtual bool write_data_header(IO_CACHE* file)
+ virtual bool write_data_header()
{ return 0; }
- virtual bool write_data_body(IO_CACHE* file __attribute__((unused)))
+ virtual bool write_data_body()
{ return 0; }
+
+ /* Return start of query time or current time */
inline my_time_t get_time()
{
THD *tmp_thd;
@@ -1327,10 +1305,7 @@ public:
*/
const char* get_type_str();
- /* Return start of query time or current time */
-
#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
-public:
/**
Apply the event to the database.
@@ -1422,6 +1397,7 @@ public:
case HEARTBEAT_LOG_EVENT:
case BINLOG_CHECKPOINT_EVENT:
case GTID_LIST_EVENT:
+ case START_ENCRYPTION_EVENT:
return false;
default:
@@ -2001,11 +1977,11 @@ public:
my_free(data_buf);
}
Log_event_type get_type_code() { return QUERY_EVENT; }
- static int dummy_event(String *packet, ulong ev_offset, uint8 checksum_alg);
- static int begin_event(String *packet, ulong ev_offset, uint8 checksum_alg);
+ static int dummy_event(String *packet, ulong ev_offset, enum enum_binlog_checksum_alg checksum_alg);
+ static int begin_event(String *packet, ulong ev_offset, enum enum_binlog_checksum_alg checksum_alg);
#ifdef MYSQL_SERVER
- bool write(IO_CACHE* file);
- virtual bool write_post_header_for_derived(IO_CACHE* file) { return FALSE; }
+ bool write();
+ virtual bool write_post_header_for_derived() { return FALSE; }
#endif
bool is_valid() const { return query != 0; }
@@ -2020,13 +1996,12 @@ public: /* !!! Public in this patch to allow old usage */
#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi);
virtual int do_apply_event(rpl_group_info *rgi);
- virtual int do_update_pos(rpl_group_info *rgi);
int do_apply_event(rpl_group_info *rgi,
const char *query_arg,
uint32 q_len_arg);
static bool peek_is_commit_rollback(const char *event_start,
- size_t event_len, uint8 checksum_alg);
+ size_t event_len, enum enum_binlog_checksum_alg checksum_alg);
#endif /* HAVE_REPLICATION */
/*
If true, the event always be applied by slave SQL thread or be printed by
@@ -2056,96 +2031,42 @@ public: /* !!! Public in this patch to allow old usage */
};
-#ifdef HAVE_REPLICATION
-
-/**
- @class Slave_log_event
-
- Note that this class is currently not used at all; no code writes a
- @c Slave_log_event (though some code in @c repl_failsafe.cc reads @c
- Slave_log_event). So it's not a problem if this code is not
- maintained.
-
- @section Slave_log_event_binary_format Binary Format
-
- This event type has no Post-Header. The Body has the following
- four components.
-
- <table>
- <caption>Body for Slave_log_event</caption>
-
- <tr>
- <th>Name</th>
- <th>Format</th>
- <th>Description</th>
- </tr>
-
- <tr>
- <td>master_pos</td>
- <td>8 byte integer</td>
- <td>???TODO
- </td>
- </tr>
-
- <tr>
- <td>master_port</td>
- <td>2 byte integer</td>
- <td>???TODO</td>
- </tr>
-
- <tr>
- <td>master_host</td>
- <td>null-terminated string</td>
- <td>???TODO</td>
- </tr>
-
- <tr>
- <td>master_log</td>
- <td>null-terminated string</td>
- <td>???TODO</td>
- </tr>
- </table>
-*/
-class Slave_log_event: public Log_event
+/*****************************************************************************
+ sql_ex_info struct
+ ****************************************************************************/
+struct sql_ex_info
{
-protected:
- char* mem_pool;
- void init_from_mem_pool(int data_size);
-public:
- my_off_t master_pos;
- char* master_host;
- char* master_log;
- int master_host_len;
- int master_log_len;
- uint16 master_port;
-
-#ifdef MYSQL_SERVER
- Slave_log_event(THD* thd_arg, Relay_log_info* rli);
- void pack_info(THD *thd, Protocol* protocol);
-#else
- void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
-#endif
-
- Slave_log_event(const char* buf,
- uint event_len,
- const Format_description_log_event *description_event);
- ~Slave_log_event();
- int get_data_size();
- bool is_valid() const { return master_host != 0; }
- Log_event_type get_type_code() { return SLAVE_EVENT; }
-#ifdef MYSQL_SERVER
- bool write(IO_CACHE* file);
-#endif
+ sql_ex_info() {} /* Remove gcc warning */
+ const char* field_term;
+ const char* enclosed;
+ const char* line_term;
+ const char* line_start;
+ const char* escaped;
+ int cached_new_format;
+ uint8 field_term_len,enclosed_len,line_term_len,line_start_len, escaped_len;
+ char opt_flags;
+ char empty_flags;
-private:
-#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
- virtual int do_apply_event(rpl_group_info *rgi);
-#endif
+ // store in new format even if old is possible
+ void force_new_format() { cached_new_format = 1;}
+ int data_size()
+ {
+ return (new_format() ?
+ field_term_len + enclosed_len + line_term_len +
+ line_start_len + escaped_len + 6 : 7);
+ }
+ bool write_data(Log_event_writer *writer);
+ const char* init(const char* buf, const char* buf_end, bool use_new_format);
+ bool new_format()
+ {
+ return ((cached_new_format != -1) ? cached_new_format :
+ (cached_new_format=(field_term_len > 1 ||
+ enclosed_len > 1 ||
+ line_term_len > 1 || line_start_len > 1 ||
+ escaped_len > 1)));
+ }
};
-#endif /* HAVE_REPLICATION */
-
-
/**
@class Load_log_event
@@ -2439,8 +2360,8 @@ public:
return sql_ex.new_format() ? NEW_LOAD_EVENT: LOAD_EVENT;
}
#ifdef MYSQL_SERVER
- bool write_data_header(IO_CACHE* file);
- bool write_data_body(IO_CACHE* file);
+ bool write_data_header();
+ bool write_data_body();
#endif
bool is_valid() const { return table_name != 0; }
int get_data_size()
@@ -2528,7 +2449,7 @@ public:
my_off_t get_header_len(my_off_t l __attribute__((unused)))
{ return LOG_EVENT_MINIMAL_HEADER_LEN; }
#ifdef MYSQL_SERVER
- bool write(IO_CACHE* file);
+ bool write();
#endif
bool is_valid() const { return server_version[0] != 0; }
int get_data_size()
@@ -2553,6 +2474,73 @@ protected:
#endif
};
+/**
+ @class Start_encryption_log_event
+
+ Start_encryption_log_event marks the beginning of encrypted data (all events
+ after this event are encrypted).
+
+ It contains the cryptographic scheme used for the encryption as well as any
+ data required to decrypt (except the actual key).
+
+ For binlog cryptoscheme 1: key version, and nonce for iv generation.
+*/
+class Start_encryption_log_event : public Log_event
+{
+public:
+#ifdef MYSQL_SERVER
+ Start_encryption_log_event(uint crypto_scheme_arg, uint key_version_arg,
+ const uchar* nonce_arg)
+ : crypto_scheme(crypto_scheme_arg), key_version(key_version_arg)
+ {
+ cache_type = EVENT_NO_CACHE;
+ DBUG_ASSERT(crypto_scheme == 1);
+ memcpy(nonce, nonce_arg, BINLOG_NONCE_LENGTH);
+ }
+
+ bool write_data_body()
+ {
+ uchar scheme_buf= crypto_scheme;
+ uchar key_version_buf[BINLOG_KEY_VERSION_LENGTH];
+ int4store(key_version_buf, key_version);
+ return write_data(&scheme_buf, sizeof(scheme_buf)) ||
+ write_data(key_version_buf, sizeof(key_version_buf)) ||
+ write_data(nonce, BINLOG_NONCE_LENGTH);
+ }
+#else
+ void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
+#endif
+
+ Start_encryption_log_event(
+ const char* buf, uint event_len,
+ const Format_description_log_event* description_event);
+
+ bool is_valid() const { return crypto_scheme == 1; }
+
+ Log_event_type get_type_code() { return START_ENCRYPTION_EVENT; }
+
+ int get_data_size()
+ {
+ return BINLOG_CRYPTO_SCHEME_LENGTH + BINLOG_KEY_VERSION_LENGTH +
+ BINLOG_NONCE_LENGTH;
+ }
+
+ uint crypto_scheme;
+ uint key_version;
+ uchar nonce[BINLOG_NONCE_LENGTH];
+
+protected:
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
+ virtual int do_apply_event(rpl_group_info* rgi);
+ virtual int do_update_pos(rpl_group_info *rgi);
+ virtual enum_skip_reason do_shall_skip(rpl_group_info* rgi)
+ {
+ return Log_event::EVENT_SKIP_NOT;
+ }
+#endif
+
+};
+
/**
@class Format_description_log_event
@@ -2598,7 +2586,7 @@ public:
}
Log_event_type get_type_code() { return FORMAT_DESCRIPTION_EVENT;}
#ifdef MYSQL_SERVER
- bool write(IO_CACHE* file);
+ bool write();
#endif
bool header_is_valid() const
{
@@ -2630,6 +2618,17 @@ public:
return FORMAT_DESCRIPTION_HEADER_LEN;
}
+ Binlog_crypt_data crypto_data;
+ bool start_decryption(Start_encryption_log_event* sele);
+ void copy_crypto_data(const Format_description_log_event* o)
+ {
+ crypto_data= o->crypto_data;
+ }
+ void reset_crypto()
+ {
+ crypto_data.scheme= 0;
+ }
+
void calc_server_version_split();
static bool is_version_before_checksum(const master_version_split *version_split);
protected:
@@ -2707,7 +2706,7 @@ Intvar_log_event(THD* thd_arg,uchar type_arg, ulonglong val_arg,
const char* get_var_type_name();
int get_data_size() { return 9; /* sizeof(type) + sizeof(val) */;}
#ifdef MYSQL_SERVER
- bool write(IO_CACHE* file);
+ bool write();
#endif
bool is_valid() const { return 1; }
bool is_part_of_group() { return 1; }
@@ -2787,7 +2786,7 @@ class Rand_log_event: public Log_event
Log_event_type get_type_code() { return RAND_EVENT;}
int get_data_size() { return 16; /* sizeof(ulonglong) * 2*/ }
#ifdef MYSQL_SERVER
- bool write(IO_CACHE* file);
+ bool write();
#endif
bool is_valid() const { return 1; }
bool is_part_of_group() { return 1; }
@@ -2837,7 +2836,7 @@ class Xid_log_event: public Log_event
Log_event_type get_type_code() { return XID_EVENT;}
int get_data_size() { return sizeof(xid); }
#ifdef MYSQL_SERVER
- bool write(IO_CACHE* file);
+ bool write();
#endif
bool is_valid() const { return 1; }
@@ -2898,7 +2897,7 @@ public:
~User_var_log_event() {}
Log_event_type get_type_code() { return USER_VAR_EVENT;}
#ifdef MYSQL_SERVER
- bool write(IO_CACHE* file);
+ bool write();
/*
Getter and setter for deferred User-event.
Returns true if the event is not applied directly
@@ -3050,7 +3049,7 @@ public:
int get_data_size() { return ident_len + ROTATE_HEADER_LEN;}
bool is_valid() const { return new_log_ident != 0; }
#ifdef MYSQL_SERVER
- bool write(IO_CACHE* file);
+ bool write();
#endif
private:
@@ -3083,7 +3082,7 @@ public:
int get_data_size() { return binlog_file_len + BINLOG_CHECKPOINT_HEADER_LEN;}
bool is_valid() const { return binlog_file_name != 0; }
#ifdef MYSQL_SERVER
- bool write(IO_CACHE* file);
+ bool write();
enum_skip_reason do_shall_skip(rpl_group_info *rgi);
#endif
};
@@ -3211,11 +3210,11 @@ public:
}
bool is_valid() const { return seq_no != 0; }
#ifdef MYSQL_SERVER
- bool write(IO_CACHE *file);
+ bool write();
static int make_compatible_event(String *packet, bool *need_dummy_event,
- ulong ev_offset, uint8 checksum_alg);
+ ulong ev_offset, enum enum_binlog_checksum_alg checksum_alg);
static bool peek(const char *event_start, size_t event_len,
- uint8 checksum_alg,
+ enum enum_binlog_checksum_alg checksum_alg,
uint32 *domain_id, uint32 *server_id, uint64 *seq_no,
uchar *flags2, const Format_description_log_event *fdev);
#endif
@@ -3326,12 +3325,12 @@ public:
bool is_valid() const { return list != NULL; }
#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
bool to_packet(String *packet);
- bool write(IO_CACHE *file);
+ bool write();
virtual int do_apply_event(rpl_group_info *rgi);
enum_skip_reason do_shall_skip(rpl_group_info *rgi);
#endif
static bool peek(const char *event_start, uint32 event_len,
- uint8 checksum_alg,
+ enum enum_binlog_checksum_alg checksum_alg,
rpl_gtid **out_gtid_list, uint32 *out_list_len,
const Format_description_log_event *fdev);
};
@@ -3397,13 +3396,13 @@ public:
}
bool is_valid() const { return inited_from_old || block != 0; }
#ifdef MYSQL_SERVER
- bool write_data_header(IO_CACHE* file);
- bool write_data_body(IO_CACHE* file);
+ bool write_data_header();
+ bool write_data_body();
/*
Cut out Create_file extentions and
write it as Load event - used on the slave
*/
- bool write_base(IO_CACHE* file);
+ bool write_base();
#endif
private:
@@ -3457,7 +3456,7 @@ public:
int get_data_size() { return block_len + APPEND_BLOCK_HEADER_LEN ;}
bool is_valid() const { return block != 0; }
#ifdef MYSQL_SERVER
- bool write(IO_CACHE* file);
+ bool write();
const char* get_db() { return db; }
#endif
@@ -3498,7 +3497,7 @@ public:
int get_data_size() { return DELETE_FILE_HEADER_LEN ;}
bool is_valid() const { return file_id != 0; }
#ifdef MYSQL_SERVER
- bool write(IO_CACHE* file);
+ bool write();
const char* get_db() { return db; }
#endif
@@ -3538,7 +3537,7 @@ public:
int get_data_size() { return EXEC_LOAD_HEADER_LEN ;}
bool is_valid() const { return file_id != 0; }
#ifdef MYSQL_SERVER
- bool write(IO_CACHE* file);
+ bool write();
const char* get_db() { return db; }
#endif
@@ -3638,7 +3637,7 @@ public:
ulong get_post_header_size_for_derived();
#ifdef MYSQL_SERVER
- bool write_post_header_for_derived(IO_CACHE* file);
+ bool write_post_header_for_derived();
#endif
private:
@@ -3702,8 +3701,8 @@ public:
virtual bool is_part_of_group() { return 1; }
#ifndef MYSQL_CLIENT
- virtual bool write_data_header(IO_CACHE*);
- virtual bool write_data_body(IO_CACHE*);
+ virtual bool write_data_header();
+ virtual bool write_data_body();
#endif
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
@@ -4118,8 +4117,8 @@ public:
virtual int get_data_size() { return (uint) m_data_size; }
#ifdef MYSQL_SERVER
virtual int save_field_metadata();
- virtual bool write_data_header(IO_CACHE *file);
- virtual bool write_data_body(IO_CACHE *file);
+ virtual bool write_data_header();
+ virtual bool write_data_body();
virtual const char *get_db() { return m_dbnam; }
#endif
@@ -4264,12 +4263,61 @@ public:
virtual int get_data_size();
MY_BITMAP const *get_cols() const { return &m_cols; }
+ MY_BITMAP const *get_cols_ai() const { return &m_cols_ai; }
size_t get_width() const { return m_width; }
ulong get_table_id() const { return m_table_id; }
+#if defined(MYSQL_SERVER)
+ /*
+ This member function compares the table's read/write_set
+ with this event's m_cols and m_cols_ai. Comparison takes
+ into account what type of rows event is this: Delete, Write or
+ Update, therefore it uses the correct m_cols[_ai] according
+ to the event type code.
+
+ Note that this member function should only be called for the
+ following events:
+ - Delete_rows_log_event
+ - Write_rows_log_event
+ - Update_rows_log_event
+
+ @param[IN] table The table to compare this events bitmaps
+ against.
+
+ @return TRUE if sets match, FALSE otherwise. (following
+ bitmap_cmp return logic).
+
+ */
+ virtual bool read_write_bitmaps_cmp(TABLE *table)
+ {
+ bool res= FALSE;
+
+ switch (get_general_type_code())
+ {
+ case DELETE_ROWS_EVENT:
+ res= bitmap_cmp(get_cols(), table->read_set);
+ break;
+ case UPDATE_ROWS_EVENT:
+ res= (bitmap_cmp(get_cols(), table->read_set) &&
+ bitmap_cmp(get_cols_ai(), table->write_set));
+ break;
+ case WRITE_ROWS_EVENT:
+ res= bitmap_cmp(get_cols(), table->write_set);
+ break;
+ default:
+ /*
+ We should just compare bitmaps for Delete, Write
+ or Update rows events.
+ */
+ DBUG_ASSERT(0);
+ }
+ return res;
+ }
+#endif
+
#ifdef MYSQL_SERVER
- virtual bool write_data_header(IO_CACHE *file);
- virtual bool write_data_body(IO_CACHE *file);
+ virtual bool write_data_header();
+ virtual bool write_data_body();
virtual const char *get_db() { return m_table->s->db.str; }
#endif
/*
@@ -4360,12 +4408,23 @@ protected:
int find_row(rpl_group_info *);
int write_row(rpl_group_info *, const bool);
+ // Unpack the current row into m_table->record[0], but with
+ // a different columns bitmap.
+ int unpack_current_row(rpl_group_info *rgi, MY_BITMAP const *cols)
+ {
+ DBUG_ASSERT(m_table);
+
+ ASSERT_OR_RETURN_ERROR(m_curr_row <= m_rows_end, HA_ERR_CORRUPT_EVENT);
+ return ::unpack_row(rgi, m_table, m_width, m_curr_row, cols,
+ &m_curr_row_end, &m_master_reclength, m_rows_end);
+ }
+
// Unpack the current row into m_table->record[0]
int unpack_current_row(rpl_group_info *rgi)
{
DBUG_ASSERT(m_table);
- ASSERT_OR_RETURN_ERROR(m_curr_row < m_rows_end, HA_ERR_CORRUPT_EVENT);
+ ASSERT_OR_RETURN_ERROR(m_curr_row <= m_rows_end, HA_ERR_CORRUPT_EVENT);
return ::unpack_row(rgi, m_table, m_width, m_curr_row, &m_cols,
&m_curr_row_end, &m_master_reclength, m_rows_end);
}
@@ -4469,8 +4528,8 @@ public:
};
#if defined(MYSQL_SERVER)
- Write_rows_log_event(THD*, TABLE*, ulong table_id,
- MY_BITMAP const *cols, bool is_transactional);
+ Write_rows_log_event(THD*, TABLE*, ulong table_id,
+ bool is_transactional);
#endif
#ifdef HAVE_REPLICATION
Write_rows_log_event(const char *buf, uint event_len,
@@ -4479,14 +4538,11 @@ public:
#if defined(MYSQL_SERVER)
static bool binlog_row_logging_function(THD *thd, TABLE *table,
bool is_transactional,
- MY_BITMAP *cols,
- uint fields,
const uchar *before_record
__attribute__((unused)),
const uchar *after_record)
{
- return thd->binlog_write_row(table, is_transactional,
- cols, fields, after_record);
+ return thd->binlog_write_row(table, is_transactional, after_record);
}
#endif
@@ -4532,12 +4588,6 @@ public:
#ifdef MYSQL_SERVER
Update_rows_log_event(THD*, TABLE*, ulong table_id,
- MY_BITMAP const *cols_bi,
- MY_BITMAP const *cols_ai,
- bool is_transactional);
-
- Update_rows_log_event(THD*, TABLE*, ulong table_id,
- MY_BITMAP const *cols,
bool is_transactional);
void init(MY_BITMAP const *cols);
@@ -4553,13 +4603,11 @@ public:
#ifdef MYSQL_SERVER
static bool binlog_row_logging_function(THD *thd, TABLE *table,
bool is_transactional,
- MY_BITMAP *cols,
- uint fields,
const uchar *before_record,
const uchar *after_record)
{
return thd->binlog_update_row(table, is_transactional,
- cols, fields, before_record, after_record);
+ before_record, after_record);
}
#endif
@@ -4616,8 +4664,7 @@ public:
};
#ifdef MYSQL_SERVER
- Delete_rows_log_event(THD*, TABLE*, ulong,
- MY_BITMAP const *cols, bool is_transactional);
+ Delete_rows_log_event(THD*, TABLE*, ulong, bool is_transactional);
#endif
#ifdef HAVE_REPLICATION
Delete_rows_log_event(const char *buf, uint event_len,
@@ -4626,14 +4673,12 @@ public:
#ifdef MYSQL_SERVER
static bool binlog_row_logging_function(THD *thd, TABLE *table,
bool is_transactional,
- MY_BITMAP *cols,
- uint fields,
const uchar *before_record,
const uchar *after_record
__attribute__((unused)))
{
return thd->binlog_delete_row(table, is_transactional,
- cols, fields, before_record);
+ before_record);
}
#endif
@@ -4734,6 +4779,9 @@ public:
#ifdef MYSQL_SERVER
void pack_info(THD *thd, Protocol*);
+
+ virtual bool write_data_header();
+ virtual bool write_data_body();
#endif
Incident_log_event(const char *buf, uint event_len,
@@ -4749,9 +4797,6 @@ public:
virtual int do_apply_event(rpl_group_info *rgi);
#endif
- virtual bool write_data_header(IO_CACHE *file);
- virtual bool write_data_body(IO_CACHE *file);
-
virtual Log_event_type get_type_code() { return INCIDENT_EVENT; }
virtual bool is_valid() const
@@ -4812,6 +4857,14 @@ private:
uint ident_len;
};
+inline int Log_event_writer::write(Log_event *ev)
+{
+ ev->writer= this;
+ int res= ev->write();
+ IF_DBUG(ev->writer= 0,); // writer must be set before every Log_event::write
+ return res;
+}
+
/**
The function is called by slave applier in case there are
active table filtering rules to force gathering events associated
@@ -4825,8 +4878,8 @@ bool rpl_get_position_info(const char **log_file_name, ulonglong *log_pos,
const char **group_relay_log_name,
ulonglong *relay_log_pos);
-bool event_checksum_test(uchar *buf, ulong event_len, uint8 alg);
-uint8 get_checksum_alg(const char* buf, ulong len);
+bool event_checksum_test(uchar *buf, ulong event_len, enum_binlog_checksum_alg alg);
+enum enum_binlog_checksum_alg get_checksum_alg(const char* buf, ulong len);
extern TYPELIB binlog_checksum_typelib;
/**
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc
index 4779e90d815..ce1bf614bc9 100644
--- a/sql/log_event_old.cc
+++ b/sql/log_event_old.cc
@@ -1753,7 +1753,7 @@ Old_rows_log_event::do_update_pos(rpl_group_info *rgi)
#ifndef MYSQL_CLIENT
-bool Old_rows_log_event::write_data_header(IO_CACHE *file)
+bool Old_rows_log_event::write_data_header()
{
uchar buf[ROWS_HEADER_LEN]; // No need to init the buffer
@@ -1765,15 +1765,15 @@ bool Old_rows_log_event::write_data_header(IO_CACHE *file)
{
int4store(buf + 0, m_table_id);
int2store(buf + 4, m_flags);
- return (my_b_safe_write(file, buf, 6));
+ return write_data(buf, 6);
});
int6store(buf + RW_MAPID_OFFSET, (ulonglong)m_table_id);
int2store(buf + RW_FLAGS_OFFSET, m_flags);
- return (my_b_safe_write(file, buf, ROWS_HEADER_LEN));
+ return write_data(buf, ROWS_HEADER_LEN);
}
-bool Old_rows_log_event::write_data_body(IO_CACHE*file)
+bool Old_rows_log_event::write_data_body()
{
/*
Note that this should be the number of *bits*, not the number of
@@ -1790,13 +1790,12 @@ bool Old_rows_log_event::write_data_body(IO_CACHE*file)
DBUG_ASSERT(static_cast<size_t>(sbuf_end - sbuf) <= sizeof(sbuf));
DBUG_DUMP("m_width", sbuf, (size_t) (sbuf_end - sbuf));
- res= res || my_b_safe_write(file, sbuf, (size_t) (sbuf_end - sbuf));
+ res= res || write_data(sbuf, (size_t) (sbuf_end - sbuf));
DBUG_DUMP("m_cols", (uchar*) m_cols.bitmap, no_bytes_in_map(&m_cols));
- res= res || my_b_safe_write(file, (uchar*) m_cols.bitmap,
- no_bytes_in_map(&m_cols));
+ res= res || write_data((uchar*)m_cols.bitmap, no_bytes_in_map(&m_cols));
DBUG_DUMP("rows", m_rows_buf, data_size);
- res= res || my_b_safe_write(file, m_rows_buf, (size_t) data_size);
+ res= res || write_data(m_rows_buf, (size_t) data_size);
return res;
diff --git a/sql/log_event_old.h b/sql/log_event_old.h
index 7408e121f96..edc74ca1a6f 100644
--- a/sql/log_event_old.h
+++ b/sql/log_event_old.h
@@ -134,8 +134,8 @@ public:
ulong get_table_id() const { return m_table_id; }
#ifndef MYSQL_CLIENT
- virtual bool write_data_header(IO_CACHE *file);
- virtual bool write_data_body(IO_CACHE *file);
+ virtual bool write_data_header();
+ virtual bool write_data_body();
virtual const char *get_db() { return m_table->s->db.str; }
#endif
/*
@@ -369,14 +369,11 @@ public:
#if !defined(MYSQL_CLIENT)
static bool binlog_row_logging_function(THD *thd, TABLE *table,
bool is_transactional,
- MY_BITMAP *cols,
- uint fields,
const uchar *before_record
__attribute__((unused)),
const uchar *after_record)
{
- return thd->binlog_write_row(table, is_transactional,
- cols, fields, after_record);
+ return thd->binlog_write_row(table, is_transactional, after_record);
}
#endif
@@ -452,7 +449,7 @@ public:
const uchar *after_record)
{
return thd->binlog_update_row(table, is_transactional,
- cols, fields, before_record, after_record);
+ before_record, after_record);
}
#endif
@@ -526,8 +523,7 @@ public:
const uchar *after_record
__attribute__((unused)))
{
- return thd->binlog_delete_row(table, is_transactional,
- cols, fields, before_record);
+ return thd->binlog_delete_row(table, is_transactional, before_record);
}
#endif
diff --git a/sql/mdl.cc b/sql/mdl.cc
index 55e39d0ee0a..ec380aa7432 100644
--- a/sql/mdl.cc
+++ b/sql/mdl.cc
@@ -336,6 +336,7 @@ public:
virtual bool needs_notification(const MDL_ticket *ticket) const = 0;
virtual bool conflicting_locks(const MDL_ticket *ticket) const = 0;
virtual bitmap_t hog_lock_types_bitmap() const = 0;
+ virtual ~MDL_lock_strategy() {}
};
@@ -1062,6 +1063,13 @@ MDL_wait::timed_wait(MDL_context_owner *owner, struct timespec *abs_timeout,
while (!m_wait_status && !owner->is_killed() &&
wait_result != ETIMEDOUT && wait_result != ETIME)
{
+#ifdef WITH_WSREP
+ if (wsrep_thd_is_BF(owner->get_thd(), true))
+ {
+ wait_result= mysql_cond_wait(&m_COND_wait_status, &m_LOCK_wait_status);
+ }
+ else
+#endif
wait_result= mysql_cond_timedwait(&m_COND_wait_status, &m_LOCK_wait_status,
abs_timeout);
}
@@ -1147,12 +1155,15 @@ void MDL_lock::Ticket_list::add_ticket(MDL_ticket *ticket)
WSREP_DEBUG("MDL add_ticket inserted before: %lu %s",
thd_get_thread_id(waiting->get_ctx()->get_thd()),
wsrep_thd_query(waiting->get_ctx()->get_thd()));
+ /* Insert the ticket before the first non-BF waiting thd. */
m_list.insert_after(prev, ticket);
added= true;
}
prev= waiting;
}
- if (!added) m_list.push_back(ticket);
+
+ /* Otherwise, insert the ticket at the back of the waiting list. */
+ if (!added) m_list.push_back(ticket);
while ((granted= itg++))
{
@@ -1972,14 +1983,10 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout)
{
MDL_lock *lock;
MDL_ticket *ticket;
- struct timespec abs_timeout;
MDL_wait::enum_wait_status wait_status;
DBUG_ENTER("MDL_context::acquire_lock");
DBUG_PRINT("enter", ("lock_type: %d", mdl_request->type));
- /* Do some work outside the critical section. */
- set_timespec(abs_timeout, lock_wait_timeout);
-
if (try_acquire_lock_impl(mdl_request, &ticket))
DBUG_RETURN(TRUE);
@@ -2028,7 +2035,8 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout)
find_deadlock();
- struct timespec abs_shortwait;
+ struct timespec abs_timeout, abs_shortwait;
+ set_timespec(abs_timeout, lock_wait_timeout);
set_timespec(abs_shortwait, 1);
wait_status= MDL_wait::EMPTY;
diff --git a/sql/mdl.h b/sql/mdl.h
index f7a5d160e53..a80de5a4e71 100644
--- a/sql/mdl.h
+++ b/sql/mdl.h
@@ -334,24 +334,25 @@ public:
@param name Name of of the object
@param key Where to store the the MDL key.
*/
- void mdl_key_init(enum_mdl_namespace mdl_namespace,
- const char *db, const char *name)
+ void mdl_key_init(enum_mdl_namespace mdl_namespace_arg,
+ const char *db, const char *name_arg)
{
- m_ptr[0]= (char) mdl_namespace;
+ m_ptr[0]= (char) mdl_namespace_arg;
/*
It is responsibility of caller to ensure that db and object names
are not longer than NAME_LEN. Still we play safe and try to avoid
buffer overruns.
*/
DBUG_ASSERT(strlen(db) <= NAME_LEN);
- DBUG_ASSERT(strlen(name) <= NAME_LEN);
+ DBUG_ASSERT(strlen(name_arg) <= NAME_LEN);
m_db_name_length= static_cast<uint16>(strmake(m_ptr + 1, db, NAME_LEN) -
m_ptr - 1);
- m_length= static_cast<uint16>(strmake(m_ptr + m_db_name_length + 2, name,
+ m_length= static_cast<uint16>(strmake(m_ptr + m_db_name_length + 2,
+ name_arg,
NAME_LEN) - m_ptr + 1);
m_hash_value= my_hash_sort(&my_charset_bin, (uchar*) m_ptr + 1,
m_length - 1);
- DBUG_ASSERT(mdl_namespace == USER_LOCK || ok_for_lower_case_names(db));
+ DBUG_ASSERT(mdl_namespace_arg == USER_LOCK || ok_for_lower_case_names(db));
}
void mdl_key_init(const MDL_key *rhs)
{
diff --git a/sql/message.rc b/sql/message.rc
index 116522b7d48..0885a897e6f 100644
--- a/sql/message.rc
+++ b/sql/message.rc
@@ -1,2 +1,2 @@
-LANGUAGE 0x9,0x1
-1 11 MSG00001.bin
+LANGUAGE 0x9,0x1
+1 11 MSG00001.bin
diff --git a/sql/mf_iocache_encr.cc b/sql/mf_iocache_encr.cc
index d215636d62a..ae314d826a0 100644
--- a/sql/mf_iocache_encr.cc
+++ b/sql/mf_iocache_encr.cc
@@ -95,9 +95,10 @@ static int my_b_encr_read(IO_CACHE *info, uchar *Buffer, size_t Count)
elength= wlength - (ebuffer - wbuffer);
set_iv(iv, pos_in_file, crypt_data->inbuf_counter);
- if (encryption_decrypt(ebuffer, elength, info->buffer, &length,
- crypt_data->key, sizeof(crypt_data->key),
- iv, sizeof(iv), 0, keyid, keyver))
+ if (encryption_crypt(ebuffer, elength, info->buffer, &length,
+ crypt_data->key, sizeof(crypt_data->key),
+ iv, sizeof(iv), ENCRYPTION_FLAG_DECRYPT,
+ keyid, keyver))
{
my_errno= 1;
DBUG_RETURN(info->error= -1);
@@ -175,9 +176,10 @@ static int my_b_encr_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
crypt_data->inbuf_counter= crypt_data->counter;
set_iv(iv, info->pos_in_file, crypt_data->inbuf_counter);
- if (encryption_encrypt(Buffer, length, ebuffer, &elength,
- crypt_data->key, sizeof(crypt_data->key),
- iv, sizeof(iv), 0, keyid, keyver))
+ if (encryption_crypt(Buffer, length, ebuffer, &elength,
+ crypt_data->key, sizeof(crypt_data->key),
+ iv, sizeof(iv), ENCRYPTION_FLAG_ENCRYPT,
+ keyid, keyver))
{
my_errno= 1;
DBUG_RETURN(info->error= -1);
@@ -191,7 +193,7 @@ static int my_b_encr_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
buffer_length bytes should *always* produce block_length bytes
*/
DBUG_ASSERT(crypt_data->block_length == 0 || crypt_data->block_length == wlength);
- DBUG_ASSERT(elength <= my_aes_get_size(length));
+ DBUG_ASSERT(elength <= encryption_encrypted_length(length, keyid, keyver));
crypt_data->block_length= wlength;
}
else
@@ -228,7 +230,7 @@ static int my_b_encr_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
Note that encrypt_tmp_files variable is read-only.
*/
-void init_io_cache_encryption()
+int init_io_cache_encryption()
{
if (encrypt_tmp_files)
{
@@ -239,20 +241,23 @@ void init_io_cache_encryption()
keyid= ENCRYPTION_KEY_SYSTEM_DATA;
keyver= encryption_key_get_latest_version(keyid);
}
- }
- else
- keyver= ENCRYPTION_KEY_VERSION_INVALID;
+ if (keyver == ENCRYPTION_KEY_VERSION_INVALID)
+ {
+ sql_print_error("Failed to enable encryption of temporary files");
+ return 1;
+ }
- if (keyver != ENCRYPTION_KEY_VERSION_INVALID)
- {
- sql_print_information("Using encryption key id %d for temporary files", keyid);
- _my_b_encr_read= my_b_encr_read;
- _my_b_encr_write= my_b_encr_write;
- }
- else
- {
- _my_b_encr_read= 0;
- _my_b_encr_write= 0;
+ if (keyver != ENCRYPTION_KEY_NOT_ENCRYPTED)
+ {
+ sql_print_information("Using encryption key id %d for temporary files", keyid);
+ _my_b_encr_read= my_b_encr_read;
+ _my_b_encr_write= my_b_encr_write;
+ return 0;
+ }
}
+
+ _my_b_encr_read= 0;
+ _my_b_encr_write= 0;
+ return 0;
}
diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc
index 61f344d8689..6e8428f1aad 100644
--- a/sql/multi_range_read.cc
+++ b/sql/multi_range_read.cc
@@ -62,7 +62,7 @@ handler::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
range_seq_t seq_it;
ha_rows rows, total_rows= 0;
uint n_ranges=0;
- THD *thd= current_thd;
+ THD *thd= table->in_use;
/* Default MRR implementation doesn't need buffer */
*bufsz= 0;
@@ -814,7 +814,7 @@ int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs,
void *seq_init_param, uint n_ranges, uint mode,
HANDLER_BUFFER *buf)
{
- THD *thd= current_thd;
+ THD *thd= h_arg->get_table()->in_use;
int res;
Key_parameters keypar;
uint UNINIT_VAR(key_buff_elem_size); /* set/used when do_sort_keys==TRUE */
@@ -1573,7 +1573,7 @@ bool DsMrr_impl::choose_mrr_impl(uint keyno, ha_rows rows, uint *flags,
{
Cost_estimate dsmrr_cost;
bool res;
- THD *thd= current_thd;
+ THD *thd= primary_file->get_table()->in_use;
TABLE_SHARE *share= primary_file->get_table_share();
bool doing_cpk_scan= check_cpk_scan(thd, share, keyno, *flags);
diff --git a/sql/my_apc.cc b/sql/my_apc.cc
index 17660688be0..91f5cd3f39c 100644
--- a/sql/my_apc.cc
+++ b/sql/my_apc.cc
@@ -41,45 +41,6 @@ void Apc_target::init(mysql_mutex_t *target_mutex)
}
-/*
- Destroy the target. The target must be disabled when this call is made.
-*/
-void Apc_target::destroy()
-{
- DBUG_ASSERT(!enabled);
-}
-
-
-/*
- Enter ther state where the target is available for serving APC requests
-*/
-void Apc_target::enable()
-{
- /* Ok to do without getting/releasing the mutex: */
- enabled++;
-}
-
-
-/*
- Make the target unavailable for serving APC requests.
-
- @note
- This call will serve all requests that were already enqueued
-*/
-
-void Apc_target::disable()
-{
- bool process= FALSE;
- DBUG_ASSERT(enabled);
- mysql_mutex_lock(LOCK_thd_data_ptr);
- if (!(--enabled))
- process= TRUE;
- mysql_mutex_unlock(LOCK_thd_data_ptr);
- if (process)
- process_apc_requests();
-}
-
-
/* [internal] Put request qe into the request list */
void Apc_target::enqueue_request(Call_request *qe)
diff --git a/sql/my_apc.h b/sql/my_apc.h
index dfeef5eb8ac..20b1ee4c4ec 100644
--- a/sql/my_apc.h
+++ b/sql/my_apc.h
@@ -50,10 +50,29 @@ public:
~Apc_target() { DBUG_ASSERT(!enabled && !apc_calls);}
void init(mysql_mutex_t *target_mutex);
- void destroy();
- void enable();
- void disable();
-
+
+ /* Destroy the target. The target must be disabled when this call is made. */
+ void destroy() { DBUG_ASSERT(!enabled); }
+
+ /* Enter ther state where the target is available for serving APC requests */
+ void enable() { enabled++; }
+
+ /*
+ Make the target unavailable for serving APC requests.
+
+ @note
+ This call will serve all requests that were already enqueued
+ */
+ void disable()
+ {
+ DBUG_ASSERT(enabled);
+ mysql_mutex_lock(LOCK_thd_data_ptr);
+ bool process= !--enabled && have_apc_requests();
+ mysql_mutex_unlock(LOCK_thd_data_ptr);
+ if (unlikely(process))
+ process_apc_requests();
+ }
+
void process_apc_requests();
/*
A lightweight function, intended to be used in frequent checks like this:
diff --git a/sql/my_decimal.cc b/sql/my_decimal.cc
index d4f1ae19bc6..37d4dd25473 100644
--- a/sql/my_decimal.cc
+++ b/sql/my_decimal.cc
@@ -41,26 +41,29 @@
int decimal_operation_results(int result, const char *value, const char *type)
{
+ /* Avoid calling current_thd on default path */
+ if (likely(result == E_DEC_OK))
+ return(result);
+
+ THD *thd= current_thd;
switch (result) {
- case E_DEC_OK:
- break;
case E_DEC_TRUNCATED:
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_DATA_TRUNCATED, ER(ER_DATA_TRUNCATED),
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_DATA_TRUNCATED, ER_THD(thd, ER_DATA_TRUNCATED),
value, type);
break;
case E_DEC_OVERFLOW:
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_DATA_OVERFLOW, ER(ER_DATA_OVERFLOW),
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_DATA_OVERFLOW, ER_THD(thd, ER_DATA_OVERFLOW),
value, type);
break;
case E_DEC_DIV_ZERO:
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_DIVISION_BY_ZERO, ER(ER_DIVISION_BY_ZERO));
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_DIVISION_BY_ZERO, ER_THD(thd, ER_DIVISION_BY_ZERO));
break;
case E_DEC_BAD_NUM:
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_BAD_DATA, ER(ER_BAD_DATA),
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_BAD_DATA, ER_THD(thd, ER_BAD_DATA),
value, type);
break;
case E_DEC_OOM:
@@ -236,33 +239,24 @@ int my_decimal2binary(uint mask, const my_decimal *d, uchar *bin, int prec,
*/
int str2my_decimal(uint mask, const char *from, uint length,
- CHARSET_INFO *charset, my_decimal *decimal_value)
+ CHARSET_INFO *charset, my_decimal *decimal_value,
+ const char **end_ptr)
{
- char *end, *from_end;
int err;
- char buff[STRING_BUFFER_USUAL_SIZE];
- String tmp(buff, sizeof(buff), &my_charset_bin);
if (charset->mbminlen > 1)
{
+ StringBuffer<STRING_BUFFER_USUAL_SIZE> tmp;
uint dummy_errors;
tmp.copy(from, length, charset, &my_charset_latin1, &dummy_errors);
- from= tmp.ptr();
- length= tmp.length();
- charset= &my_charset_bin;
+ char *end= (char*) tmp.end();
+ err= string2decimal(tmp.ptr(), (decimal_t*) decimal_value, &end);
+ *end_ptr= from + charset->mbminlen * (size_t) (end - tmp.ptr());
}
- from_end= end= (char*) from+length;
- err= string2decimal((char *)from, (decimal_t*) decimal_value, &end);
- if (end != from_end && !err)
+ else
{
- /* Give warning if there is something other than end space */
- for ( ; end < from_end; end++)
- {
- if (!my_isspace(&my_charset_latin1, *end))
- {
- err= E_DEC_TRUNCATED;
- break;
- }
- }
+ char *end= (char*) from + length;
+ err= string2decimal(from, (decimal_t*) decimal_value, &end);
+ *end_ptr= end;
}
check_result_and_overflow(mask, err, decimal_value);
return err;
diff --git a/sql/my_decimal.h b/sql/my_decimal.h
index a2cce862f1a..78c71d54b6d 100644
--- a/sql/my_decimal.h
+++ b/sql/my_decimal.h
@@ -366,13 +366,23 @@ int str2my_decimal(uint mask, const char *str, my_decimal *d, char **end)
int str2my_decimal(uint mask, const char *from, uint length,
- CHARSET_INFO *charset, my_decimal *decimal_value);
+ CHARSET_INFO *charset, my_decimal *decimal_value,
+ const char **end);
+
+inline int str2my_decimal(uint mask, const char *from, uint length,
+ CHARSET_INFO *charset, my_decimal *decimal_value)
+{
+ const char *end;
+ return str2my_decimal(mask, from, length, charset, decimal_value, &end);
+}
#if defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY)
inline
int string2my_decimal(uint mask, const String *str, my_decimal *d)
{
- return str2my_decimal(mask, str->ptr(), str->length(), str->charset(), d);
+ const char *end;
+ return str2my_decimal(mask, str->ptr(), str->length(), str->charset(),
+ d, &end);
}
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 2bde88189fb..8e11b4b6caf 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -278,6 +278,8 @@ extern "C" sig_handler handle_fatal_signal(int sig);
#define ENABLE_TEMP_POOL 0
#endif
+int init_io_cache_encryption();
+
/* Constants */
#include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE
@@ -487,7 +489,7 @@ ulong delay_key_write_options;
uint protocol_version;
uint lower_case_table_names;
ulong tc_heuristic_recover= 0;
-int32 thread_count;
+int32 thread_count, service_thread_count;
int32 thread_running;
int32 slave_open_temp_tables;
ulong thread_created;
@@ -629,6 +631,7 @@ char server_version[SERVER_VERSION_LENGTH];
char *mysqld_unix_port, *opt_mysql_tmpdir;
ulong thread_handling;
+my_bool encrypt_binlog;
my_bool encrypt_tmp_disk_tables, encrypt_tmp_files;
/** name of reference on left expression in rewritten IN subquery */
@@ -1753,7 +1756,7 @@ static void close_connections(void)
/* All threads has now been aborted */
DBUG_PRINT("quit",("Waiting for threads to die (count=%u)",thread_count));
mysql_mutex_lock(&LOCK_thread_count);
- while (thread_count)
+ while (thread_count || service_thread_count)
{
mysql_cond_wait(&COND_thread_count, &LOCK_thread_count);
DBUG_PRINT("quit",("One thread died (count=%u)",thread_count));
@@ -1902,7 +1905,10 @@ static void __cdecl kill_server(int sig_ptr)
#endif
/* Stop wsrep threads in case they are running. */
- wsrep_stop_replication(NULL);
+ if (wsrep_running_threads > 0)
+ {
+ wsrep_stop_replication(NULL);
+ }
close_connections();
@@ -2105,6 +2111,7 @@ void clean_up(bool print_message)
xid_cache_free();
tdc_deinit();
mdl_destroy();
+ dflt_key_cache= 0;
key_caches.delete_elements((void (*)(const char*, uchar*)) free_key_cache);
wt_end();
multi_keycache_free();
@@ -2147,6 +2154,7 @@ void clean_up(bool print_message)
sql_print_information(ER_DEFAULT(ER_SHUTDOWN_COMPLETE),my_progname);
cleanup_errmsgs();
MYSQL_CALLBACK(thread_scheduler, end, ());
+ thread_scheduler= 0;
mysql_library_end();
finish_client_errs();
(void) my_error_unregister(ER_ERROR_FIRST, ER_ERROR_LAST); // finish server errs
@@ -2162,6 +2170,12 @@ void clean_up(bool print_message)
mysql_cond_broadcast(&COND_thread_count);
mysql_mutex_unlock(&LOCK_thread_count);
+ my_free(const_cast<char*>(log_bin_basename));
+ my_free(const_cast<char*>(log_bin_index));
+#ifndef EMBEDDED_LIBRARY
+ my_free(const_cast<char*>(relay_log_basename));
+ my_free(const_cast<char*>(relay_log_index));
+#endif
free_list(opt_plugin_load_list_ptr);
if (THR_THD)
@@ -2287,7 +2301,7 @@ static void set_ports()
if ((env = getenv("MYSQL_TCP_PORT")))
{
mysqld_port= (uint) atoi(env);
- mark_sys_var_value_origin(&mysqld_port, sys_var::ENV);
+ set_sys_var_value_origin(&mysqld_port, sys_var::ENV);
}
}
if (!mysqld_unix_port)
@@ -2300,7 +2314,7 @@ static void set_ports()
if ((env = getenv("MYSQL_UNIX_PORT")))
{
mysqld_unix_port= env;
- mark_sys_var_value_origin(&mysqld_unix_port, sys_var::ENV);
+ set_sys_var_value_origin(&mysqld_unix_port, sys_var::ENV);
}
}
}
@@ -2504,10 +2518,11 @@ static MYSQL_SOCKET activate_tcp_port(uint port)
if (mysql_socket_getfd(ip_sock) == INVALID_SOCKET)
{
- sql_print_error("Failed to create a socket for %s '%s': errno: %d.",
- (a->ai_family == AF_INET) ? "IPv4" : "IPv6",
- (const char *) ip_addr,
- (int) socket_errno);
+ sql_print_message_func func= real_bind_addr_str ? sql_print_error
+ : sql_print_warning;
+ func("Failed to create a socket for %s '%s': errno: %d.",
+ (a->ai_family == AF_INET) ? "IPv4" : "IPv6",
+ (const char *) ip_addr, (int) socket_errno);
}
else
{
@@ -2828,8 +2843,26 @@ void delete_running_thd(THD *thd)
delete thd;
dec_thread_running();
thread_safe_decrement32(&thread_count);
- if (!thread_count)
+ signal_thd_deleted();
+}
+
+/*
+ Send a signal to unblock close_conneciton() if there is no more
+ threads running with a THD attached
+
+ It's safe to check for thread_count and service_thread_count outside
+ of a mutex as we are only interested to see if they where decremented
+ to 0 by a previous unlink_thd() call.
+
+ We should only signal COND_thread_count if both variables are 0,
+ false positives are ok.
+*/
+
+void signal_thd_deleted()
+{
+ if (!thread_count && ! service_thread_count)
{
+ /* Signal close_connections() that all THD's are freed */
mysql_mutex_lock(&LOCK_thread_count);
mysql_cond_broadcast(&COND_thread_count);
mysql_mutex_unlock(&LOCK_thread_count);
@@ -2983,22 +3016,10 @@ bool one_thread_per_connection_end(THD *thd, bool put_in_cache)
unlink_thd(thd);
- if (put_in_cache && cache_thread() && !wsrep_applier)
+ if (!wsrep_applier && put_in_cache && cache_thread())
DBUG_RETURN(0); // Thread is reused
- /*
- It's safe to check for thread_count outside of the mutex
- as we are only interested to see if it was counted to 0 by the
- above unlink_thd() call. We should only signal COND_thread_count if
- thread_count is likely to be 0. (false positives are ok)
- */
- if (!thread_count)
- {
- mysql_mutex_lock(&LOCK_thread_count);
- DBUG_PRINT("signal", ("Broadcasting COND_thread_count"));
- mysql_cond_broadcast(&COND_thread_count);
- mysql_mutex_unlock(&LOCK_thread_count);
- }
+ signal_thd_deleted();
DBUG_LEAVE; // Must match DBUG_ENTER()
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
ERR_remove_state(0);
@@ -3750,6 +3771,7 @@ SHOW_VAR com_status_vars[]= {
{"create_role", STMT_STATUS(SQLCOM_CREATE_ROLE)},
{"create_server", STMT_STATUS(SQLCOM_CREATE_SERVER)},
{"create_table", STMT_STATUS(SQLCOM_CREATE_TABLE)},
+ {"create_temporary_table", COM_STATUS(com_create_tmp_table)},
{"create_trigger", STMT_STATUS(SQLCOM_CREATE_TRIGGER)},
{"create_udf", STMT_STATUS(SQLCOM_CREATE_FUNCTION)},
{"create_user", STMT_STATUS(SQLCOM_CREATE_USER)},
@@ -3766,6 +3788,7 @@ SHOW_VAR com_status_vars[]= {
{"drop_role", STMT_STATUS(SQLCOM_DROP_ROLE)},
{"drop_server", STMT_STATUS(SQLCOM_DROP_SERVER)},
{"drop_table", STMT_STATUS(SQLCOM_DROP_TABLE)},
+ {"drop_temporary_table", COM_STATUS(com_drop_tmp_table)},
{"drop_trigger", STMT_STATUS(SQLCOM_DROP_TRIGGER)},
{"drop_user", STMT_STATUS(SQLCOM_DROP_USER)},
{"drop_view", STMT_STATUS(SQLCOM_DROP_VIEW)},
@@ -3913,7 +3936,7 @@ void init_sql_statement_info()
while (var->name != NULL)
{
ptr= (size_t)(var->value);
- if ((first_com <= ptr) && (ptr <= last_com))
+ if ((first_com <= ptr) && (ptr < last_com))
{
com_index= ((int)(ptr - first_com))/record_size;
DBUG_ASSERT(com_index < (uint) SQLCOM_END);
@@ -3999,6 +4022,42 @@ static void my_malloc_size_cb_func(long long size, my_bool is_thread_specific)
}
}
+/**
+ Create a replication file name or base for file names.
+
+ @param[in] opt Value of option, or NULL
+ @param[in] def Default value if option value is not set.
+ @param[in] ext Extension to use for the path
+
+ @returns Pointer to string containing the full file path, or NULL if
+ it was not possible to create the path.
+ */
+static inline const char *
+rpl_make_log_name(const char *opt,
+ const char *def,
+ const char *ext)
+{
+ DBUG_ENTER("rpl_make_log_name");
+ DBUG_PRINT("enter", ("opt: %s, def: %s, ext: %s", opt, def, ext));
+ char buff[FN_REFLEN];
+ const char *base= opt ? opt : def;
+ unsigned int options=
+ MY_REPLACE_EXT | MY_UNPACK_FILENAME | MY_SAFE_PATH;
+
+ /* mysql_real_data_home_ptr may be null if no value of datadir has been
+ specified through command-line or througha cnf file. If that is the
+ case we make mysql_real_data_home_ptr point to mysql_real_data_home
+ which, in that case holds the default path for data-dir.
+ */
+ if(mysql_real_data_home_ptr == NULL)
+ mysql_real_data_home_ptr= mysql_real_data_home;
+
+ if (fn_format(buff, base, mysql_real_data_home_ptr, ext, options))
+ DBUG_RETURN(my_strdup(buff, MYF(MY_WME)));
+ else
+ DBUG_RETURN(NULL);
+}
+
static int init_common_variables()
{
umask(((~my_umask) & 0666));
@@ -4130,7 +4189,7 @@ static int init_common_variables()
strmake(pidfile_name, opt_log_basename, sizeof(pidfile_name)-5);
strmov(fn_ext(pidfile_name),".pid"); // Add proper extension
SYSVAR_AUTOSIZE(pidfile_name_ptr, pidfile_name);
- mark_sys_var_value_origin(&opt_tc_log_size, sys_var::AUTO);
+ set_sys_var_value_origin(&opt_tc_log_size, sys_var::AUTO);
/*
The default-storage-engine entry in my_long_options should have a
@@ -4165,25 +4224,27 @@ static int init_common_variables()
We have few debug-only commands in com_status_vars, only visible in debug
builds. for simplicity we enable the assert only in debug builds
- There are 8 Com_ variables which don't have corresponding SQLCOM_ values:
+ There are 10 Com_ variables which don't have corresponding SQLCOM_ values:
(TODO strictly speaking they shouldn't be here, should not have Com_ prefix
that is. Perhaps Stmt_ ? Comstmt_ ? Prepstmt_ ?)
- Com_admin_commands => com_other
- Com_stmt_close => com_stmt_close
- Com_stmt_execute => com_stmt_execute
- Com_stmt_fetch => com_stmt_fetch
- Com_stmt_prepare => com_stmt_prepare
- Com_stmt_reprepare => com_stmt_reprepare
- Com_stmt_reset => com_stmt_reset
- Com_stmt_send_long_data => com_stmt_send_long_data
+ Com_admin_commands => com_other
+ Com_create_temporary_table => com_create_tmp_table
+ Com_drop_temporary_table => com_drop_tmp_table
+ Com_stmt_close => com_stmt_close
+ Com_stmt_execute => com_stmt_execute
+ Com_stmt_fetch => com_stmt_fetch
+ Com_stmt_prepare => com_stmt_prepare
+ Com_stmt_reprepare => com_stmt_reprepare
+ Com_stmt_reset => com_stmt_reset
+ Com_stmt_send_long_data => com_stmt_send_long_data
With this correction the number of Com_ variables (number of elements in
the array, excluding the last element - terminator) must match the number
of SQLCOM_ constants.
*/
compile_time_assert(sizeof(com_status_vars)/sizeof(com_status_vars[0]) - 1 ==
- SQLCOM_END + 8);
+ SQLCOM_END + 10);
#endif
if (get_options(&remaining_argc, &remaining_argv))
@@ -4269,6 +4330,27 @@ static int init_common_variables()
}
#endif /* HAVE_SOLARIS_LARGE_PAGES */
+
+ /* Fix host_cache_size. */
+ if (IS_SYSVAR_AUTOSIZE(&host_cache_size))
+ {
+ if (max_connections <= 628 - 128)
+ SYSVAR_AUTOSIZE(host_cache_size, 128 + max_connections);
+ else if (max_connections <= ((ulong)(2000 - 628)) * 20 + 500)
+ SYSVAR_AUTOSIZE(host_cache_size, 628 + ((max_connections - 500) / 20));
+ else
+ SYSVAR_AUTOSIZE(host_cache_size, 2000);
+ }
+
+ /* Fix back_log (back_log == 0 added for MySQL compatibility) */
+ if (back_log == 0 || IS_SYSVAR_AUTOSIZE(&back_log))
+ {
+ if ((900 - 50) * 5 >= max_connections)
+ SYSVAR_AUTOSIZE(back_log, (50 + max_connections / 5));
+ else
+ SYSVAR_AUTOSIZE(back_log, 900);
+ }
+
/* connections and databases needs lots of files */
{
uint files, wanted_files, max_open_files;
@@ -4329,9 +4411,11 @@ static int init_common_variables()
sql_print_error("Unknown locale: '%s'", lc_messages);
return 1;
}
- global_system_variables.lc_messages= my_default_lc_messages;
+
if (init_errmessage()) /* Read error messages from file */
return 1;
+ global_system_variables.lc_messages= my_default_lc_messages;
+ global_system_variables.errmsgs= my_default_lc_messages->errmsgs->errmsgs;
init_client_errs();
mysql_library_init(unused,unused,unused); /* for replication */
lex_init();
@@ -4812,9 +4896,16 @@ static int init_server_components()
unireg_abort(1);
query_cache_set_min_res_unit(query_cache_min_res_unit);
+ query_cache_result_size_limit(query_cache_limit);
+ /* if we set size of QC non zero in config then probably we want it ON */
+ if (query_cache_size != 0 &&
+ global_system_variables.query_cache_type == 0 &&
+ !IS_SYSVAR_AUTOSIZE(&query_cache_size))
+ {
+ global_system_variables.query_cache_type= 1;
+ }
query_cache_init();
query_cache_resize(query_cache_size);
- query_cache_result_size_limit(query_cache_limit);
my_rnd_init(&sql_rand,(ulong) server_start_time,(ulong) server_start_time/2);
setup_fpu();
init_thr_lock();
@@ -4942,8 +5033,6 @@ static int init_server_components()
}
#endif
- DBUG_ASSERT(!opt_bin_log || opt_bin_logname);
-
if (opt_bin_log)
{
/* Reports an error and aborts, if the --log-bin's path
@@ -5035,6 +5124,11 @@ static int init_server_components()
{
set_ports(); // this is also called in network_init() later but we need
// to know mysqld_port now - lp:1071882
+ /*
+ Plugin initialization (plugin_init()) hasn't happened yet, set
+ maria_hton to 0.
+ */
+ maria_hton= 0;
wsrep_init_startup(true);
}
}
@@ -5049,6 +5143,45 @@ static int init_server_components()
}
}
+ if (opt_bin_log)
+ {
+ log_bin_basename=
+ rpl_make_log_name(opt_bin_logname, pidfile_name,
+ opt_bin_logname ? "" : "-bin");
+ log_bin_index=
+ rpl_make_log_name(opt_binlog_index_name, log_bin_basename, ".index");
+ if (log_bin_basename == NULL || log_bin_index == NULL)
+ {
+ sql_print_error("Unable to create replication path names:"
+ " out of memory or path names too long"
+ " (path name exceeds " STRINGIFY_ARG(FN_REFLEN)
+ " or file name exceeds " STRINGIFY_ARG(FN_LEN) ").");
+ unireg_abort(1);
+ }
+ }
+
+#ifndef EMBEDDED_LIBRARY
+ DBUG_PRINT("debug",
+ ("opt_bin_logname: %s, opt_relay_logname: %s, pidfile_name: %s",
+ opt_bin_logname, opt_relay_logname, pidfile_name));
+ if (opt_relay_logname)
+ {
+ relay_log_basename=
+ rpl_make_log_name(opt_relay_logname, pidfile_name,
+ opt_relay_logname ? "" : "-relay-bin");
+ relay_log_index=
+ rpl_make_log_name(opt_relaylog_index_name, relay_log_basename, ".index");
+ if (relay_log_basename == NULL || relay_log_index == NULL)
+ {
+ sql_print_error("Unable to create replication path names:"
+ " out of memory or path names too long"
+ " (path name exceeds " STRINGIFY_ARG(FN_REFLEN)
+ " or file name exceeds " STRINGIFY_ARG(FN_LEN) ").");
+ unireg_abort(1);
+ }
+ }
+#endif /* !EMBEDDED_LIBRARY */
+
/* call ha_init_key_cache() on all key caches to init them */
process_key_caches(&ha_init_key_cache, 0);
@@ -5100,6 +5233,9 @@ static int init_server_components()
}
}
+ if (init_io_cache_encryption())
+ unireg_abort(1);
+
if (opt_abort)
unireg_abort(0);
@@ -5157,6 +5293,9 @@ static int init_server_components()
if (default_tmp_storage_engine && !*default_tmp_storage_engine)
default_tmp_storage_engine= NULL;
+ if (enforced_storage_engine && !*enforced_storage_engine)
+ enforced_storage_engine= NULL;
+
if (init_default_storage_engine(default_tmp_storage_engine, tmp_table_plugin))
unireg_abort(1);
@@ -5198,10 +5337,11 @@ static int init_server_components()
* but to be able to have mysql_mutex_assert_owner() in code,
* we do it anyway */
mysql_mutex_lock(mysql_bin_log.get_log_lock());
- if (mysql_bin_log.open(opt_bin_logname, LOG_BIN, 0,
- WRITE_CACHE, max_binlog_size, 0, TRUE))
- unireg_abort(1);
+ int r= mysql_bin_log.open(opt_bin_logname, LOG_BIN, 0, 0,
+ WRITE_CACHE, max_binlog_size, 0, TRUE);
mysql_mutex_unlock(mysql_bin_log.get_log_lock());
+ if (r)
+ unireg_abort(1);
}
#ifdef HAVE_REPLICATION
@@ -5349,41 +5489,6 @@ void decrement_handler_count()
#ifndef EMBEDDED_LIBRARY
-LEX_STRING sql_statement_names[(uint) SQLCOM_END + 1];
-
-static void init_sql_statement_names()
-{
- size_t first_com= offsetof(STATUS_VAR, com_stat[0]);
- size_t last_com= offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_END]);
- int record_size= offsetof(STATUS_VAR, com_stat[1])
- - offsetof(STATUS_VAR, com_stat[0]);
- size_t ptr;
- uint i;
- uint com_index;
-
- for (i= 0; i < ((uint) SQLCOM_END + 1); i++)
- sql_statement_names[i]= empty_lex_str;
-
- SHOW_VAR *var= &com_status_vars[0];
- while (var->name != NULL)
- {
- ptr= (size_t)(var->value);
- if ((first_com <= ptr) && (ptr <= last_com))
- {
- com_index= ((int)(ptr - first_com))/record_size;
- DBUG_ASSERT(com_index < (uint) SQLCOM_END);
- sql_statement_names[com_index].str= const_cast<char *>(var->name);
- sql_statement_names[com_index].length= strlen(var->name);
- }
- var++;
- }
-
- DBUG_ASSERT(strcmp(sql_statement_names[(uint) SQLCOM_SELECT].str, "select") == 0);
- DBUG_ASSERT(strcmp(sql_statement_names[(uint) SQLCOM_SIGNAL].str, "signal") == 0);
-
- sql_statement_names[(uint) SQLCOM_END].str= const_cast<char*>("error");
-}
-
#ifndef DBUG_OFF
/*
Debugging helper function to keep the locale database
@@ -5462,7 +5567,6 @@ int mysqld_main(int argc, char **argv)
/* Must be initialized early for comparison of options name */
system_charset_info= &my_charset_utf8_general_ci;
- init_sql_statement_names();
sys_var_init();
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
@@ -5485,6 +5589,12 @@ int mysqld_main(int argc, char **argv)
int ho_error __attribute__((unused))= handle_early_options();
+ /* fix tdc_size */
+ if (IS_SYSVAR_AUTOSIZE(&tdc_size))
+ {
+ SYSVAR_AUTOSIZE(tdc_size, MY_MIN(400 + tdc_size / 2, 2000));
+ }
+
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
if (ho_error == 0)
{
@@ -5495,8 +5605,6 @@ int mysqld_main(int argc, char **argv)
pfs_param.m_hints.m_table_open_cache= tc_size;
pfs_param.m_hints.m_max_connections= max_connections;
pfs_param.m_hints.m_open_files_limit= open_files_limit;
- /* the performance schema digest size is the same as the SQL layer */
- pfs_param.m_max_digest_length= max_digest_length;
PSI_hook= initialize_performance_schema(&pfs_param);
if (PSI_hook == NULL)
{
@@ -5672,6 +5780,7 @@ int mysqld_main(int argc, char **argv)
}
#endif
+#ifdef WITH_WSREP
// Recover and exit.
if (wsrep_recovery)
{
@@ -5682,6 +5791,7 @@ int mysqld_main(int argc, char **argv)
sql_print_information("WSREP: disabled, skipping position recovery");
unireg_abort(0);
}
+#endif
/*
init signals & alarm
@@ -5756,12 +5866,8 @@ int mysqld_main(int argc, char **argv)
wsrep_create_appliers(wsrep_slave_threads - 1);
}
}
- else
- {
- wsrep_init_startup (false);
- }
- if (opt_bootstrap)
+ if (opt_bootstrap)
{
select_thread_in_use= 0; // Allow 'kill' to work
bootstrap(mysql_stdin);
@@ -5805,7 +5911,14 @@ int mysqld_main(int argc, char **argv)
(char*) "" : mysqld_unix_port),
mysqld_port,
MYSQL_COMPILATION_COMMENT);
- fclose(stdin);
+
+ // try to keep fd=0 busy
+ if (!freopen(IF_WIN("NUL","/dev/null"), "r", stdin))
+ {
+ // fall back on failure
+ fclose(stdin);
+ }
+
#if defined(_WIN32) && !defined(EMBEDDED_LIBRARY)
Service.SetRunning();
#endif
@@ -5816,6 +5929,8 @@ int mysqld_main(int argc, char **argv)
mysql_cond_signal(&COND_server_started);
mysql_mutex_unlock(&LOCK_server_started);
+ MYSQL_SET_STAGE(0 ,__FILE__, __LINE__);
+
#if defined(_WIN32) || defined(HAVE_SMEM)
handle_connections_methods();
#else
@@ -6100,7 +6215,7 @@ static void bootstrap(MYSQL_FILE *file)
thd->variables.wsrep_on= 0;
#endif
thd->bootstrap=1;
- my_net_init(&thd->net,(st_vio*) 0, MYF(0));
+ my_net_init(&thd->net,(st_vio*) 0, (void*) 0, MYF(0));
thd->max_client_packet_length= thd->net.max_packet;
thd->security_ctx->master_access= ~(ulong)0;
thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
@@ -6569,7 +6684,7 @@ void handle_connections_sockets()
mysql_socket_vio_new(new_sock,
is_unix_sock ? VIO_TYPE_SOCKET : VIO_TYPE_TCPIP,
is_unix_sock ? VIO_LOCALHOST: 0)) ||
- my_net_init(&thd->net, vio_tmp, MYF(MY_THREAD_SPECIFIC)))
+ my_net_init(&thd->net, vio_tmp, thd, MYF(MY_THREAD_SPECIFIC)))
{
/*
Only delete the temporary vio if we didn't already attach it to the
@@ -6694,7 +6809,7 @@ pthread_handler_t handle_connections_namedpipes(void *arg)
}
set_current_thd(thd);
if (!(thd->net.vio= vio_new_win32pipe(hConnectedPipe)) ||
- my_net_init(&thd->net, thd->net.vio, MYF(MY_THREAD_SPECIFIC)))
+ my_net_init(&thd->net, thd->net.vio, thd, MYF(MY_THREAD_SPECIFIC)))
{
close_connection(thd, ER_OUT_OF_RESOURCES);
delete thd;
@@ -6891,7 +7006,7 @@ pthread_handler_t handle_connections_shared_memory(void *arg)
event_server_wrote,
event_server_read,
event_conn_closed)) ||
- my_net_init(&thd->net, thd->net.vio, MYF(MY_THREAD_SPECIFIC)))
+ my_net_init(&thd->net, thd->net.vio, thd, MYF(MY_THREAD_SPECIFIC)))
{
close_connection(thd, ER_OUT_OF_RESOURCES);
errmsg= 0;
@@ -7233,6 +7348,11 @@ struct my_option my_long_options[]=
"File that holds the names for last binary log files.",
&opt_binlog_index_name, &opt_binlog_index_name, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"relay-log-index", 0,
+ "The location and name to use for the file that keeps a list of the last "
+ "relay logs",
+ &opt_relaylog_index_name, &opt_relaylog_index_name, 0, GET_STR,
+ REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"log-isam", OPT_ISAM_LOG, "Log all MyISAM changes to file.",
&myisam_log_filename, &myisam_log_filename, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
@@ -7459,12 +7579,10 @@ struct my_option my_long_options[]=
#endif
/* The following options exist in 5.6 but not in 10.0 */
- MYSQL_TO_BE_IMPLEMENTED_OPTION("default-tmp-storage-engine"),
MYSQL_COMPATIBILITY_OPTION("log-raw"),
MYSQL_COMPATIBILITY_OPTION("log-bin-use-v1-row-events"),
MYSQL_TO_BE_IMPLEMENTED_OPTION("default-authentication-plugin"),
MYSQL_COMPATIBILITY_OPTION("binlog-max-flush-queue-time"),
- MYSQL_TO_BE_IMPLEMENTED_OPTION("binlog-row-image"),
MYSQL_TO_BE_IMPLEMENTED_OPTION("explicit-defaults-for-timestamp"),
MYSQL_COMPATIBILITY_OPTION("master-info-repository"),
MYSQL_COMPATIBILITY_OPTION("relay-log-info-repository"),
@@ -8519,7 +8637,8 @@ static int mysql_init_variables(void)
cleanup_done= 0;
server_id_supplied= 0;
test_flags= select_errors= dropping_tables= ha_open_options=0;
- thread_count= thread_running= kill_cached_threads= wake_thread=0;
+ thread_count= thread_running= kill_cached_threads= wake_thread= 0;
+ service_thread_count= 0;
slave_open_temp_tables= 0;
cached_thread_count= 0;
opt_endinfo= using_udf_functions= 0;
@@ -8585,6 +8704,8 @@ static int mysql_init_variables(void)
report_user= report_password = report_host= 0; /* TO BE DELETED */
opt_relay_logname= opt_relaylog_index_name= 0;
slave_retried_transactions= 0;
+ log_bin_basename= NULL;
+ log_bin_index= NULL;
/* Variables in libraries */
charsets_dir= 0;
@@ -8688,7 +8809,7 @@ static int mysql_init_variables(void)
if (!(tmpenv = getenv("MY_BASEDIR_VERSION")))
tmpenv = DEFAULT_MYSQL_HOME;
strmake_buf(mysql_home, tmpenv);
- mark_sys_var_value_origin(&mysql_home_ptr, sys_var::ENV);
+ set_sys_var_value_origin(&mysql_home_ptr, sys_var::ENV);
#endif
if (wsrep_init_vars())
@@ -8703,6 +8824,11 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument)
if (opt->app_type)
{
sys_var *var= (sys_var*) opt->app_type;
+ if (argument == autoset_my_option)
+ {
+ var->value_origin= sys_var::AUTO;
+ return 0;
+ }
var->value_origin= sys_var::CONFIG;
}
@@ -8807,26 +8933,32 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument)
if (log_error_file_ptr != disabled_my_option)
SYSVAR_AUTOSIZE(log_error_file_ptr, opt_log_basename);
+ /* General log file */
make_default_log_name(&opt_logname, ".log", false);
+ /* Slow query log file */
make_default_log_name(&opt_slow_logname, "-slow.log", false);
+ /* Binary log file */
make_default_log_name(&opt_bin_logname, "-bin", true);
+ /* Binary log index file */
make_default_log_name(&opt_binlog_index_name, "-bin.index", true);
- mark_sys_var_value_origin(&opt_logname, sys_var::AUTO);
- mark_sys_var_value_origin(&opt_slow_logname, sys_var::AUTO);
+ set_sys_var_value_origin(&opt_logname, sys_var::AUTO);
+ set_sys_var_value_origin(&opt_slow_logname, sys_var::AUTO);
if (!opt_logname || !opt_slow_logname || !opt_bin_logname ||
!opt_binlog_index_name)
return 1;
#ifdef HAVE_REPLICATION
+ /* Relay log file */
make_default_log_name(&opt_relay_logname, "-relay-bin", true);
+ /* Relay log index file */
make_default_log_name(&opt_relaylog_index_name, "-relay-bin.index", true);
- mark_sys_var_value_origin(&opt_relay_logname, sys_var::AUTO);
- mark_sys_var_value_origin(&opt_relaylog_index_name, sys_var::AUTO);
+ set_sys_var_value_origin(&opt_relay_logname, sys_var::AUTO);
if (!opt_relay_logname || !opt_relaylog_index_name)
return 1;
#endif
SYSVAR_AUTOSIZE(pidfile_name_ptr, pidfile_name);
+ /* PID file */
strmake(pidfile_name, argument, sizeof(pidfile_name)-5);
strmov(fn_ext(pidfile_name),".pid");
@@ -9016,6 +9148,7 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument)
max_long_data_size_used= true;
break;
case OPT_PFS_INSTRUMENT:
+ {
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
#ifndef EMBEDDED_LIBRARY
/* Parse instrument name and value from argument string */
@@ -9085,6 +9218,7 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument)
#endif
break;
}
+ }
return 0;
}
diff --git a/sql/mysqld.h b/sql/mysqld.h
index ebf55d8fd8a..bf1af3afb94 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -81,6 +81,7 @@ void close_connection(THD *thd, uint sql_errno= 0);
void handle_connection_in_main_thread(THD *thd);
void create_thread_to_handle_connection(THD *thd);
void delete_running_thd(THD *thd);
+void signal_thd_deleted();
void unlink_thd(THD *thd);
bool one_thread_per_connection_end(THD *thd, bool put_in_cache);
void flush_thread_cache();
@@ -254,6 +255,7 @@ extern ulong connection_errors_internal;
extern ulong connection_errors_max_connection;
extern ulong connection_errors_peer_addr;
extern ulong log_warnings;
+extern my_bool encrypt_binlog;
extern my_bool encrypt_tmp_disk_tables, encrypt_tmp_files;
extern ulong encryption_algorithm;
extern const char *encryption_algorithm_names[];
@@ -566,7 +568,7 @@ extern mysql_cond_t COND_thread_count;
extern mysql_cond_t COND_manager;
extern mysql_cond_t COND_slave_init;
extern int32 thread_running;
-extern int32 thread_count;
+extern int32 thread_count, service_thread_count;
extern char *opt_ssl_ca, *opt_ssl_capath, *opt_ssl_cert, *opt_ssl_cipher,
*opt_ssl_key, *opt_ssl_crl, *opt_ssl_crlpath;
@@ -645,12 +647,37 @@ enum enum_query_type
QT_WITHOUT_INTRODUCERS= (1 << 1),
/// view internal representation (like QT_ORDINARY except ORDER BY clause)
QT_VIEW_INTERNAL= (1 << 2),
+ /// If identifiers should not include database names for the current database
+ QT_ITEM_IDENT_SKIP_CURRENT_DATABASE= (1 << 3),
+ /// If Item_cache_wrapper should not print <expr_cache>
+ QT_ITEM_CACHE_WRAPPER_SKIP_DETAILS= (1 << 4),
+ /// If Item_subselect should print as just "(subquery#1)"
+ /// rather than display the subquery body
+ QT_ITEM_SUBSELECT_ID_ONLY= (1 << 5),
+ /// If NULLIF(a,b) should print itself as
+ /// CASE WHEN a_for_comparison=b THEN NULL ELSE a_for_return_value END
+ /// when "a" was replaced to two different items
+ /// (e.g. by equal fields propagation in optimize_cond()).
+ /// The default behaviour is to print as NULLIF(a_for_return, b)
+ /// which should be Ok for SHOW CREATE {VIEW|PROCEDURE|FUNCTION}
+ /// as they are not affected by WHERE optimization.
+ QT_ITEM_FUNC_NULLIF_TO_CASE= (1 <<6),
+
/// This value means focus on readability, not on ability to parse back, etc.
- QT_EXPLAIN= (1 << 4)
+ QT_EXPLAIN= QT_TO_SYSTEM_CHARSET |
+ QT_ITEM_FUNC_NULLIF_TO_CASE |
+ QT_ITEM_IDENT_SKIP_CURRENT_DATABASE |
+ QT_ITEM_CACHE_WRAPPER_SKIP_DETAILS |
+ QT_ITEM_SUBSELECT_ID_ONLY,
+
+ /// This is used for EXPLAIN EXTENDED extra warnings
+ /// Be more detailed than QT_EXPLAIN.
+ /// Perhaps we should eventually include QT_ITEM_IDENT_SKIP_CURRENT_DATABASE
+ /// here, as it would give better readable results
+ QT_EXPLAIN_EXTENDED= QT_TO_SYSTEM_CHARSET | QT_ITEM_FUNC_NULLIF_TO_CASE
};
-
/* query_id */
typedef int64 query_id_t;
extern query_id_t global_query_id;
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index 0ce0fa93f99..b6da7933bb1 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -103,7 +103,7 @@ extern uint test_flags;
extern ulong bytes_sent, bytes_received, net_big_packet_count;
#ifdef HAVE_QUERY_CACHE
#define USE_QUERY_CACHE
-extern void query_cache_insert(const char *packet, ulong length,
+extern void query_cache_insert(void *thd, const char *packet, ulong length,
unsigned pkt_nr);
#endif // HAVE_QUERY_CACHE
#define update_statistics(A) A
@@ -123,7 +123,7 @@ static my_bool net_write_buff(NET *, const uchar *, ulong);
/** Init with packet info. */
-my_bool my_net_init(NET *net, Vio* vio, uint my_flags)
+my_bool my_net_init(NET *net, Vio *vio, void *thd, uint my_flags)
{
DBUG_ENTER("my_net_init");
DBUG_PRINT("enter", ("my_flags: %u", my_flags));
@@ -142,10 +142,11 @@ my_bool my_net_init(NET *net, Vio* vio, uint my_flags)
net->where_b = net->remain_in_buf=0;
net->net_skip_rest_factor= 0;
net->last_errno=0;
- net->unused= 0;
net->thread_specific_malloc= MY_TEST(my_flags & MY_THREAD_SPECIFIC);
+ net->thd= 0;
#ifdef MYSQL_SERVER
net->extension= NULL;
+ net->thd= thd;
#endif
if (vio)
@@ -602,7 +603,7 @@ net_real_write(NET *net,const uchar *packet, size_t len)
DBUG_ENTER("net_real_write");
#if defined(MYSQL_SERVER) && defined(USE_QUERY_CACHE)
- query_cache_insert((char*) packet, len, net->pkt_nr);
+ query_cache_insert(net->thd, (char*) packet, len, net->pkt_nr);
#endif
if (net->error == 2)
@@ -705,7 +706,7 @@ net_real_write(NET *net,const uchar *packet, size_t len)
break;
}
pos+=length;
- update_statistics(thd_increment_bytes_sent(length));
+ update_statistics(thd_increment_bytes_sent(net->thd, length));
}
#ifndef __WIN__
end:
@@ -778,7 +779,7 @@ static my_bool my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed,
DBUG_PRINT("enter",("bytes_to_skip: %u", (uint) remain));
/* The following is good for debugging */
- update_statistics(thd_increment_net_big_packet_count(1));
+ update_statistics(thd_increment_net_big_packet_count(net->thd, 1));
if (!thr_alarm_in_use(alarmed))
{
@@ -794,7 +795,7 @@ static my_bool my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed,
size_t length= MY_MIN(remain, net->max_packet);
if (net_safe_read(net, net->buff, length, alarmed))
DBUG_RETURN(1);
- update_statistics(thd_increment_bytes_received(length));
+ update_statistics(thd_increment_bytes_received(net->thd, length));
remain -= (uint32) length;
limit-= length;
if (limit < 0)
@@ -935,7 +936,7 @@ my_real_read(NET *net, size_t *complen,
}
remain -= (uint32) length;
pos+= length;
- update_statistics(thd_increment_bytes_received(length));
+ update_statistics(thd_increment_bytes_received(net->thd, length));
}
if (i == 0)
{ /* First parts is packet length */
diff --git a/sql/opt_index_cond_pushdown.cc b/sql/opt_index_cond_pushdown.cc
index be33e46bf94..a6707d458df 100644
--- a/sql/opt_index_cond_pushdown.cc
+++ b/sql/opt_index_cond_pushdown.cc
@@ -181,8 +181,8 @@ bool uses_index_fields_only(Item *item, TABLE *tbl, uint keyno,
Index condition, or NULL if no condition could be inferred.
*/
-Item *make_cond_for_index(Item *cond, TABLE *table, uint keyno,
- bool other_tbls_ok)
+static Item *make_cond_for_index(THD *thd, Item *cond, TABLE *table, uint keyno,
+ bool other_tbls_ok)
{
if (!cond)
return NULL;
@@ -192,17 +192,17 @@ Item *make_cond_for_index(Item *cond, TABLE *table, uint keyno,
if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC)
{
table_map used_tables= 0;
- Item_cond_and *new_cond=new Item_cond_and;
+ Item_cond_and *new_cond= new (thd->mem_root) Item_cond_and(thd);
if (!new_cond)
return (COND*) 0;
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
Item *item;
while ((item=li++))
{
- Item *fix= make_cond_for_index(item, table, keyno, other_tbls_ok);
+ Item *fix= make_cond_for_index(thd, item, table, keyno, other_tbls_ok);
if (fix)
{
- new_cond->argument_list()->push_back(fix);
+ new_cond->argument_list()->push_back(fix, thd->mem_root);
used_tables|= fix->used_tables();
}
if (MY_TEST(item->marker == ICP_COND_USES_INDEX_ONLY))
@@ -227,17 +227,17 @@ Item *make_cond_for_index(Item *cond, TABLE *table, uint keyno,
}
else /* It's OR */
{
- Item_cond_or *new_cond=new Item_cond_or;
+ Item_cond_or *new_cond= new (thd->mem_root) Item_cond_or(thd);
if (!new_cond)
return (COND*) 0;
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
Item *item;
while ((item=li++))
{
- Item *fix= make_cond_for_index(item, table, keyno, other_tbls_ok);
+ Item *fix= make_cond_for_index(thd, item, table, keyno, other_tbls_ok);
if (!fix)
return (COND*) 0;
- new_cond->argument_list()->push_back(fix);
+ new_cond->argument_list()->push_back(fix, thd->mem_root);
if (MY_TEST(item->marker == ICP_COND_USES_INDEX_ONLY))
{
n_marked++;
@@ -260,8 +260,8 @@ Item *make_cond_for_index(Item *cond, TABLE *table, uint keyno,
}
-Item *make_cond_remainder(Item *cond, TABLE *table, uint keyno,
- bool other_tbls_ok, bool exclude_index)
+static Item *make_cond_remainder(THD *thd, Item *cond, TABLE *table, uint keyno,
+ bool other_tbls_ok, bool exclude_index)
{
if (cond->type() == Item::COND_ITEM)
{
@@ -269,18 +269,18 @@ Item *make_cond_remainder(Item *cond, TABLE *table, uint keyno,
if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC)
{
/* Create new top level AND item */
- Item_cond_and *new_cond=new Item_cond_and;
+ Item_cond_and *new_cond= new (thd->mem_root) Item_cond_and(thd);
if (!new_cond)
return (COND*) 0;
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
Item *item;
while ((item=li++))
{
- Item *fix= make_cond_remainder(item, table, keyno,
+ Item *fix= make_cond_remainder(thd, item, table, keyno,
other_tbls_ok, exclude_index);
if (fix)
{
- new_cond->argument_list()->push_back(fix);
+ new_cond->argument_list()->push_back(fix, thd->mem_root);
tbl_map |= fix->used_tables();
}
}
@@ -297,18 +297,18 @@ Item *make_cond_remainder(Item *cond, TABLE *table, uint keyno,
}
else /* It's OR */
{
- Item_cond_or *new_cond=new Item_cond_or;
+ Item_cond_or *new_cond= new (thd->mem_root) Item_cond_or(thd);
if (!new_cond)
return (COND*) 0;
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
Item *item;
while ((item=li++))
{
- Item *fix= make_cond_remainder(item, table, keyno,
+ Item *fix= make_cond_remainder(thd, item, table, keyno,
other_tbls_ok, FALSE);
if (!fix)
return (COND*) 0;
- new_cond->argument_list()->push_back(fix);
+ new_cond->argument_list()->push_back(fix, thd->mem_root);
tbl_map |= fix->used_tables();
}
new_cond->quick_fix_field();
@@ -366,8 +366,8 @@ void push_index_cond(JOIN_TAB *tab, uint keyno)
DBUG_EXECUTE("where",
print_where(tab->select_cond, "full cond", QT_ORDINARY););
- idx_cond= make_cond_for_index(tab->select_cond, tab->table, keyno,
- tab->icp_other_tables_ok);
+ idx_cond= make_cond_for_index(tab->join->thd, tab->select_cond, tab->table,
+ keyno, tab->icp_other_tables_ok);
DBUG_EXECUTE("where",
print_where(idx_cond, "idx cond", QT_ORDINARY););
@@ -406,7 +406,8 @@ void push_index_cond(JOIN_TAB *tab, uint keyno)
tab->ref.disable_cache= TRUE;
Item *row_cond= tab->idx_cond_fact_out ?
- make_cond_remainder(tab->select_cond, tab->table, keyno,
+ make_cond_remainder(tab->join->thd, tab->select_cond,
+ tab->table, keyno,
tab->icp_other_tables_ok, TRUE) :
tab->pre_idx_push_select_cond;
@@ -419,7 +420,8 @@ void push_index_cond(JOIN_TAB *tab, uint keyno)
tab->select_cond= row_cond;
else
{
- COND *new_cond= new Item_cond_and(row_cond, idx_remainder_cond);
+ COND *new_cond= new (tab->join->thd->mem_root)
+ Item_cond_and(tab->join->thd, row_cond, idx_remainder_cond);
tab->select_cond= new_cond;
tab->select_cond->quick_fix_field();
((Item_cond_and*)tab->select_cond)->used_tables_cache=
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 190cd450240..e17d19ff9f8 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -132,8 +132,6 @@
*/
#define double2rows(x) ((ha_rows)(x))
-static int sel_cmp(Field *f,uchar *a,uchar *b,uint8 a_flag,uint8 b_flag);
-
/*
this should be long enough so that any memcmp with a string that
starts from '\0' won't cross is_null_string boundaries, even
@@ -141,543 +139,6 @@ static int sel_cmp(Field *f,uchar *a,uchar *b,uint8 a_flag,uint8 b_flag);
*/
static uchar is_null_string[20]= {1,0};
-class RANGE_OPT_PARAM;
-/*
- A construction block of the SEL_ARG-graph.
-
- The following description only covers graphs of SEL_ARG objects with
- sel_arg->type==KEY_RANGE:
-
- One SEL_ARG object represents an "elementary interval" in form
-
- min_value <=? table.keypartX <=? max_value
-
- The interval is a non-empty interval of any kind: with[out] minimum/maximum
- bound, [half]open/closed, single-point interval, etc.
-
- 1. SEL_ARG GRAPH STRUCTURE
-
- SEL_ARG objects are linked together in a graph. The meaning of the graph
- is better demostrated by an example:
-
- tree->keys[i]
- |
- | $ $
- | part=1 $ part=2 $ part=3
- | $ $
- | +-------+ $ +-------+ $ +--------+
- | | kp1<1 |--$-->| kp2=5 |--$-->| kp3=10 |
- | +-------+ $ +-------+ $ +--------+
- | | $ $ |
- | | $ $ +--------+
- | | $ $ | kp3=12 |
- | | $ $ +--------+
- | +-------+ $ $
- \->| kp1=2 |--$--------------$-+
- +-------+ $ $ | +--------+
- | $ $ ==>| kp3=11 |
- +-------+ $ $ | +--------+
- | kp1=3 |--$--------------$-+ |
- +-------+ $ $ +--------+
- | $ $ | kp3=14 |
- ... $ $ +--------+
-
- The entire graph is partitioned into "interval lists".
-
- An interval list is a sequence of ordered disjoint intervals over the same
- key part. SEL_ARG are linked via "next" and "prev" pointers. Additionally,
- all intervals in the list form an RB-tree, linked via left/right/parent
- pointers. The RB-tree root SEL_ARG object will be further called "root of the
- interval list".
-
- In the example pic, there are 4 interval lists:
- "kp<1 OR kp1=2 OR kp1=3", "kp2=5", "kp3=10 OR kp3=12", "kp3=11 OR kp3=13".
- The vertical lines represent SEL_ARG::next/prev pointers.
-
- In an interval list, each member X may have SEL_ARG::next_key_part pointer
- pointing to the root of another interval list Y. The pointed interval list
- must cover a key part with greater number (i.e. Y->part > X->part).
-
- In the example pic, the next_key_part pointers are represented by
- horisontal lines.
-
- 2. SEL_ARG GRAPH SEMANTICS
-
- It represents a condition in a special form (we don't have a name for it ATM)
- The SEL_ARG::next/prev is "OR", and next_key_part is "AND".
-
- For example, the picture represents the condition in form:
- (kp1 < 1 AND kp2=5 AND (kp3=10 OR kp3=12)) OR
- (kp1=2 AND (kp3=11 OR kp3=14)) OR
- (kp1=3 AND (kp3=11 OR kp3=14))
-
-
- 3. SEL_ARG GRAPH USE
-
- Use get_mm_tree() to construct SEL_ARG graph from WHERE condition.
- Then walk the SEL_ARG graph and get a list of dijsoint ordered key
- intervals (i.e. intervals in form
-
- (constA1, .., const1_K) < (keypart1,.., keypartK) < (constB1, .., constB_K)
-
- Those intervals can be used to access the index. The uses are in:
- - check_quick_select() - Walk the SEL_ARG graph and find an estimate of
- how many table records are contained within all
- intervals.
- - get_quick_select() - Walk the SEL_ARG, materialize the key intervals,
- and create QUICK_RANGE_SELECT object that will
- read records within these intervals.
-
- 4. SPACE COMPLEXITY NOTES
-
- SEL_ARG graph is a representation of an ordered disjoint sequence of
- intervals over the ordered set of index tuple values.
-
- For multi-part keys, one can construct a WHERE expression such that its
- list of intervals will be of combinatorial size. Here is an example:
-
- (keypart1 IN (1,2, ..., n1)) AND
- (keypart2 IN (1,2, ..., n2)) AND
- (keypart3 IN (1,2, ..., n3))
-
- For this WHERE clause the list of intervals will have n1*n2*n3 intervals
- of form
-
- (keypart1, keypart2, keypart3) = (k1, k2, k3), where 1 <= k{i} <= n{i}
-
- SEL_ARG graph structure aims to reduce the amount of required space by
- "sharing" the elementary intervals when possible (the pic at the
- beginning of this comment has examples of such sharing). The sharing may
- prevent combinatorial blowup:
-
- There are WHERE clauses that have combinatorial-size interval lists but
- will be represented by a compact SEL_ARG graph.
- Example:
- (keypartN IN (1,2, ..., n1)) AND
- ...
- (keypart2 IN (1,2, ..., n2)) AND
- (keypart1 IN (1,2, ..., n3))
-
- but not in all cases:
-
- - There are WHERE clauses that do have a compact SEL_ARG-graph
- representation but get_mm_tree() and its callees will construct a
- graph of combinatorial size.
- Example:
- (keypart1 IN (1,2, ..., n1)) AND
- (keypart2 IN (1,2, ..., n2)) AND
- ...
- (keypartN IN (1,2, ..., n3))
-
- - There are WHERE clauses for which the minimal possible SEL_ARG graph
- representation will have combinatorial size.
- Example:
- By induction: Let's take any interval on some keypart in the middle:
-
- kp15=c0
-
- Then let's AND it with this interval 'structure' from preceding and
- following keyparts:
-
- (kp14=c1 AND kp16=c3) OR keypart14=c2) (*)
-
- We will obtain this SEL_ARG graph:
-
- kp14 $ kp15 $ kp16
- $ $
- +---------+ $ +---------+ $ +---------+
- | kp14=c1 |--$-->| kp15=c0 |--$-->| kp16=c3 |
- +---------+ $ +---------+ $ +---------+
- | $ $
- +---------+ $ +---------+ $
- | kp14=c2 |--$-->| kp15=c0 | $
- +---------+ $ +---------+ $
- $ $
-
- Note that we had to duplicate "kp15=c0" and there was no way to avoid
- that.
- The induction step: AND the obtained expression with another "wrapping"
- expression like (*).
- When the process ends because of the limit on max. number of keyparts
- we'll have:
-
- WHERE clause length is O(3*#max_keyparts)
- SEL_ARG graph size is O(2^(#max_keyparts/2))
-
- (it is also possible to construct a case where instead of 2 in 2^n we
- have a bigger constant, e.g. 4, and get a graph with 4^(31/2)= 2^31
- nodes)
-
- We avoid consuming too much memory by setting a limit on the number of
- SEL_ARG object we can construct during one range analysis invocation.
-*/
-
-class SEL_ARG :public Sql_alloc
-{
-public:
- uint8 min_flag,max_flag,maybe_flag;
- uint8 part; // Which key part
- uint8 maybe_null;
- /*
- The ordinal number the least significant component encountered in
- the ranges of the SEL_ARG tree (the first component has number 1)
- */
- uint16 max_part_no;
- /*
- Number of children of this element in the RB-tree, plus 1 for this
- element itself.
- */
- uint16 elements;
- /*
- Valid only for elements which are RB-tree roots: Number of times this
- RB-tree is referred to (it is referred by SEL_ARG::next_key_part or by
- SEL_TREE::keys[i] or by a temporary SEL_ARG* variable)
- */
- ulong use_count;
-
- Field *field;
- uchar *min_value,*max_value; // Pointer to range
-
- /*
- eq_tree() requires that left == right == 0 if the type is MAYBE_KEY.
- */
- SEL_ARG *left,*right; /* R-B tree children */
- SEL_ARG *next,*prev; /* Links for bi-directional interval list */
- SEL_ARG *parent; /* R-B tree parent */
- SEL_ARG *next_key_part;
- enum leaf_color { BLACK,RED } color;
- enum Type { IMPOSSIBLE, MAYBE, MAYBE_KEY, KEY_RANGE } type;
-
- enum { MAX_SEL_ARGS = 16000 };
-
- SEL_ARG() {}
- SEL_ARG(SEL_ARG &);
- SEL_ARG(Field *,const uchar *, const uchar *);
- SEL_ARG(Field *field, uint8 part, uchar *min_value, uchar *max_value,
- uint8 min_flag, uint8 max_flag, uint8 maybe_flag);
- SEL_ARG(enum Type type_arg)
- :min_flag(0), max_part_no(0) /* first key part means 1. 0 mean 'no parts'*/,
- elements(1),use_count(1),left(0),right(0),
- next_key_part(0), color(BLACK), type(type_arg)
- {}
- /**
- returns true if a range predicate is equal. Use all_same()
- to check for equality of all the predicates on this keypart.
- */
- inline bool is_same(const SEL_ARG *arg) const
- {
- if (type != arg->type || part != arg->part)
- return false;
- if (type != KEY_RANGE)
- return true;
- return cmp_min_to_min(arg) == 0 && cmp_max_to_max(arg) == 0;
- }
- /**
- returns true if all the predicates in the keypart tree are equal
- */
- bool all_same(const SEL_ARG *arg) const
- {
- if (type != arg->type || part != arg->part)
- return false;
- if (type != KEY_RANGE)
- return true;
- if (arg == this)
- return true;
- const SEL_ARG *cmp_arg= arg->first();
- const SEL_ARG *cur_arg= first();
- for (; cur_arg && cmp_arg && cur_arg->is_same(cmp_arg);
- cur_arg= cur_arg->next, cmp_arg= cmp_arg->next) ;
- if (cur_arg || cmp_arg)
- return false;
- return true;
- }
- inline void merge_flags(SEL_ARG *arg) { maybe_flag|=arg->maybe_flag; }
- inline void maybe_smaller() { maybe_flag=1; }
- /* Return true iff it's a single-point null interval */
- inline bool is_null_interval() { return maybe_null && max_value[0] == 1; }
- inline int cmp_min_to_min(const SEL_ARG* arg) const
- {
- return sel_cmp(field,min_value, arg->min_value, min_flag, arg->min_flag);
- }
- inline int cmp_min_to_max(const SEL_ARG* arg) const
- {
- return sel_cmp(field,min_value, arg->max_value, min_flag, arg->max_flag);
- }
- inline int cmp_max_to_max(const SEL_ARG* arg) const
- {
- return sel_cmp(field,max_value, arg->max_value, max_flag, arg->max_flag);
- }
- inline int cmp_max_to_min(const SEL_ARG* arg) const
- {
- return sel_cmp(field,max_value, arg->min_value, max_flag, arg->min_flag);
- }
- SEL_ARG *clone_and(THD *thd, SEL_ARG* arg)
- { // Get overlapping range
- uchar *new_min,*new_max;
- uint8 flag_min,flag_max;
- if (cmp_min_to_min(arg) >= 0)
- {
- new_min=min_value; flag_min=min_flag;
- }
- else
- {
- new_min=arg->min_value; flag_min=arg->min_flag; /* purecov: deadcode */
- }
- if (cmp_max_to_max(arg) <= 0)
- {
- new_max=max_value; flag_max=max_flag;
- }
- else
- {
- new_max=arg->max_value; flag_max=arg->max_flag;
- }
- return new (thd->mem_root) SEL_ARG(field, part, new_min, new_max, flag_min,
- flag_max,
- MY_TEST(maybe_flag && arg->maybe_flag));
- }
- SEL_ARG *clone_first(SEL_ARG *arg)
- { // min <= X < arg->min
- return new SEL_ARG(field,part, min_value, arg->min_value,
- min_flag, arg->min_flag & NEAR_MIN ? 0 : NEAR_MAX,
- maybe_flag | arg->maybe_flag);
- }
- SEL_ARG *clone_last(SEL_ARG *arg)
- { // min <= X <= key_max
- return new SEL_ARG(field, part, min_value, arg->max_value,
- min_flag, arg->max_flag, maybe_flag | arg->maybe_flag);
- }
- SEL_ARG *clone(RANGE_OPT_PARAM *param, SEL_ARG *new_parent, SEL_ARG **next);
-
- bool copy_min(SEL_ARG* arg)
- { // Get overlapping range
- if (cmp_min_to_min(arg) > 0)
- {
- min_value=arg->min_value; min_flag=arg->min_flag;
- if ((max_flag & (NO_MAX_RANGE | NO_MIN_RANGE)) ==
- (NO_MAX_RANGE | NO_MIN_RANGE))
- return 1; // Full range
- }
- maybe_flag|=arg->maybe_flag;
- return 0;
- }
- bool copy_max(SEL_ARG* arg)
- { // Get overlapping range
- if (cmp_max_to_max(arg) <= 0)
- {
- max_value=arg->max_value; max_flag=arg->max_flag;
- if ((max_flag & (NO_MAX_RANGE | NO_MIN_RANGE)) ==
- (NO_MAX_RANGE | NO_MIN_RANGE))
- return 1; // Full range
- }
- maybe_flag|=arg->maybe_flag;
- return 0;
- }
-
- void copy_min_to_min(SEL_ARG *arg)
- {
- min_value=arg->min_value; min_flag=arg->min_flag;
- }
- void copy_min_to_max(SEL_ARG *arg)
- {
- max_value=arg->min_value;
- max_flag=arg->min_flag & NEAR_MIN ? 0 : NEAR_MAX;
- }
- void copy_max_to_min(SEL_ARG *arg)
- {
- min_value=arg->max_value;
- min_flag=arg->max_flag & NEAR_MAX ? 0 : NEAR_MIN;
- }
- /* returns a number of keypart values (0 or 1) appended to the key buffer */
- int store_min(uint length, uchar **min_key,uint min_key_flag)
- {
- /* "(kp1 > c1) AND (kp2 OP c2) AND ..." -> (kp1 > c1) */
- if ((min_flag & GEOM_FLAG) ||
- (!(min_flag & NO_MIN_RANGE) &&
- !(min_key_flag & (NO_MIN_RANGE | NEAR_MIN))))
- {
- if (maybe_null && *min_value)
- {
- **min_key=1;
- bzero(*min_key+1,length-1);
- }
- else
- memcpy(*min_key,min_value,length);
- (*min_key)+= length;
- return 1;
- }
- return 0;
- }
- /* returns a number of keypart values (0 or 1) appended to the key buffer */
- int store_max(uint length, uchar **max_key, uint max_key_flag)
- {
- if (!(max_flag & NO_MAX_RANGE) &&
- !(max_key_flag & (NO_MAX_RANGE | NEAR_MAX)))
- {
- if (maybe_null && *max_value)
- {
- **max_key=1;
- bzero(*max_key+1,length-1);
- }
- else
- memcpy(*max_key,max_value,length);
- (*max_key)+= length;
- return 1;
- }
- return 0;
- }
-
- /*
- Returns a number of keypart values appended to the key buffer
- for min key and max key. This function is used by both Range
- Analysis and Partition pruning. For partition pruning we have
- to ensure that we don't store also subpartition fields. Thus
- we have to stop at the last partition part and not step into
- the subpartition fields. For Range Analysis we set last_part
- to MAX_KEY which we should never reach.
- */
- int store_min_key(KEY_PART *key,
- uchar **range_key,
- uint *range_key_flag,
- uint last_part)
- {
- SEL_ARG *key_tree= first();
- uint res= key_tree->store_min(key[key_tree->part].store_length,
- range_key, *range_key_flag);
- *range_key_flag|= key_tree->min_flag;
- if (key_tree->next_key_part &&
- key_tree->next_key_part->type == SEL_ARG::KEY_RANGE &&
- key_tree->part != last_part &&
- key_tree->next_key_part->part == key_tree->part+1 &&
- !(*range_key_flag & (NO_MIN_RANGE | NEAR_MIN)))
- res+= key_tree->next_key_part->store_min_key(key,
- range_key,
- range_key_flag,
- last_part);
- return res;
- }
-
- /* returns a number of keypart values appended to the key buffer */
- int store_max_key(KEY_PART *key,
- uchar **range_key,
- uint *range_key_flag,
- uint last_part)
- {
- SEL_ARG *key_tree= last();
- uint res=key_tree->store_max(key[key_tree->part].store_length,
- range_key, *range_key_flag);
- (*range_key_flag)|= key_tree->max_flag;
- if (key_tree->next_key_part &&
- key_tree->next_key_part->type == SEL_ARG::KEY_RANGE &&
- key_tree->part != last_part &&
- key_tree->next_key_part->part == key_tree->part+1 &&
- !(*range_key_flag & (NO_MAX_RANGE | NEAR_MAX)))
- res+= key_tree->next_key_part->store_max_key(key,
- range_key,
- range_key_flag,
- last_part);
- return res;
- }
-
- SEL_ARG *insert(SEL_ARG *key);
- SEL_ARG *tree_delete(SEL_ARG *key);
- SEL_ARG *find_range(SEL_ARG *key);
- SEL_ARG *rb_insert(SEL_ARG *leaf);
- friend SEL_ARG *rb_delete_fixup(SEL_ARG *root,SEL_ARG *key, SEL_ARG *par);
-#ifdef EXTRA_DEBUG
- friend int test_rb_tree(SEL_ARG *element,SEL_ARG *parent);
- void test_use_count(SEL_ARG *root);
-#endif
- SEL_ARG *first();
- const SEL_ARG *first() const;
- SEL_ARG *last();
- void make_root();
- inline bool simple_key()
- {
- return !next_key_part && elements == 1;
- }
- void increment_use_count(long count)
- {
- if (next_key_part)
- {
- next_key_part->use_count+=count;
- count*= (next_key_part->use_count-count);
- for (SEL_ARG *pos=next_key_part->first(); pos ; pos=pos->next)
- if (pos->next_key_part)
- pos->increment_use_count(count);
- }
- }
- void incr_refs()
- {
- increment_use_count(1);
- use_count++;
- }
- void incr_refs_all()
- {
- for (SEL_ARG *pos=first(); pos ; pos=pos->next)
- {
- pos->increment_use_count(1);
- }
- use_count++;
- }
- void free_tree()
- {
- for (SEL_ARG *pos=first(); pos ; pos=pos->next)
- if (pos->next_key_part)
- {
- pos->next_key_part->use_count--;
- pos->next_key_part->free_tree();
- }
- }
-
- inline SEL_ARG **parent_ptr()
- {
- return parent->left == this ? &parent->left : &parent->right;
- }
-
-
- /*
- Check if this SEL_ARG object represents a single-point interval
-
- SYNOPSIS
- is_singlepoint()
-
- DESCRIPTION
- Check if this SEL_ARG object (not tree) represents a single-point
- interval, i.e. if it represents a "keypart = const" or
- "keypart IS NULL".
-
- RETURN
- TRUE This SEL_ARG object represents a singlepoint interval
- FALSE Otherwise
- */
-
- bool is_singlepoint()
- {
- /*
- Check for NEAR_MIN ("strictly less") and NO_MIN_RANGE (-inf < field)
- flags, and the same for right edge.
- */
- if (min_flag || max_flag)
- return FALSE;
- uchar *min_val= min_value;
- uchar *max_val= max_value;
-
- if (maybe_null)
- {
- /* First byte is a NULL value indicator */
- if (*min_val != *max_val)
- return FALSE;
-
- if (*min_val)
- return TRUE; /* This "x IS NULL" */
- min_val++;
- max_val++;
- }
- return !field->key_cmp(min_val, max_val);
- }
- SEL_ARG *clone_tree(RANGE_OPT_PARAM *param);
-};
-
/**
Helper function to compare two SEL_ARG's.
*/
@@ -832,74 +293,6 @@ public:
bool without_imerges() { return merges.is_empty(); }
};
-class RANGE_OPT_PARAM
-{
-public:
- THD *thd; /* Current thread handle */
- TABLE *table; /* Table being analyzed */
- COND *cond; /* Used inside get_mm_tree(). */
- table_map prev_tables;
- table_map read_tables;
- table_map current_table; /* Bit of the table being analyzed */
-
- /* Array of parts of all keys for which range analysis is performed */
- KEY_PART *key_parts;
- KEY_PART *key_parts_end;
- MEM_ROOT *mem_root; /* Memory that will be freed when range analysis completes */
- MEM_ROOT *old_root; /* Memory that will last until the query end */
- /*
- Number of indexes used in range analysis (In SEL_TREE::keys only first
- #keys elements are not empty)
- */
- uint keys;
-
- /*
- If true, the index descriptions describe real indexes (and it is ok to
- call field->optimize_range(real_keynr[...], ...).
- Otherwise index description describes fake indexes.
- */
- bool using_real_indexes;
-
- /*
- Aggressively remove "scans" that do not have conditions on first
- keyparts. Such scans are usable when doing partition pruning but not
- regular range optimization.
- */
- bool remove_jump_scans;
-
- /*
- TRUE <=> Range analyzer should remove parts of condition that are found
- to be always FALSE.
- */
- bool remove_false_where_parts;
-
- /*
- used_key_no -> table_key_no translation table. Only makes sense if
- using_real_indexes==TRUE
- */
- uint real_keynr[MAX_KEY];
-
- /*
- Used to store 'current key tuples', in both range analysis and
- partitioning (list) analysis
- */
- uchar min_key[MAX_KEY_LENGTH+MAX_FIELD_WIDTH],
- max_key[MAX_KEY_LENGTH+MAX_FIELD_WIDTH];
-
- /* Number of SEL_ARG objects allocated by SEL_ARG::clone_tree operations */
- uint alloced_sel_args;
-
- bool force_default_mrr;
- KEY_PART *key[MAX_KEY]; /* First key parts of keys used in the query */
-
- bool statement_should_be_aborted() const
- {
- return
- thd->is_fatal_error ||
- thd->is_error() ||
- alloced_sel_args > SEL_ARG::MAX_SEL_ARGS;
- }
-};
class PARAM : public RANGE_OPT_PARAM
{
@@ -946,13 +339,6 @@ class TABLE_READ_PLAN;
struct st_index_scan_info;
struct st_ror_scan_info;
-static SEL_TREE * get_mm_parts(RANGE_OPT_PARAM *param,COND *cond_func,Field *field,
- Item_func::Functype type,Item *value,
- Item_result cmp_type);
-static SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param,COND *cond_func,Field *field,
- KEY_PART *key_part,
- Item_func::Functype type,Item *value);
-
static bool is_key_scan_ror(PARAM *param, uint keynr, uint8 nparts);
static ha_rows check_quick_select(PARAM *param, uint idx, bool index_only,
SEL_ARG *tree, bool update_tbl_stats,
@@ -1406,6 +792,8 @@ SEL_TREE::SEL_TREE(SEL_TREE *arg, bool without_merges,
{
keys_map= arg->keys_map;
type= arg->type;
+ MEM_ROOT *mem_root;
+
for (uint idx= 0; idx < param->keys; idx++)
{
if ((keys[idx]= arg->keys[idx]))
@@ -1415,16 +803,17 @@ SEL_TREE::SEL_TREE(SEL_TREE *arg, bool without_merges,
if (without_merges)
return;
+ mem_root= current_thd->mem_root;
List_iterator<SEL_IMERGE> it(arg->merges);
for (SEL_IMERGE *el= it++; el; el= it++)
{
- SEL_IMERGE *merge= new SEL_IMERGE(el, 0, param);
+ SEL_IMERGE *merge= new (mem_root) SEL_IMERGE(el, 0, param);
if (!merge || merge->trees == merge->trees_next)
{
merges.empty();
return;
}
- merges.push_back (merge);
+ merges.push_back(merge, mem_root);
}
}
@@ -1551,11 +940,12 @@ int imerge_list_or_list(RANGE_OPT_PARAM *param,
uint rc;
bool is_last_check_pass= FALSE;
-
SEL_IMERGE *imerge= im1->head();
uint elems= imerge->trees_next-imerge->trees;
+ MEM_ROOT *mem_root= current_thd->mem_root;
+
im1->empty();
- im1->push_back(imerge);
+ im1->push_back(imerge, mem_root);
rc= imerge->or_sel_imerge_with_checks(param, elems, im2->head(),
TRUE, &is_last_check_pass);
@@ -1571,14 +961,14 @@ int imerge_list_or_list(RANGE_OPT_PARAM *param,
if (!is_last_check_pass)
{
- SEL_IMERGE* new_imerge= new SEL_IMERGE(imerge, elems, param);
+ SEL_IMERGE* new_imerge= new (mem_root) SEL_IMERGE(imerge, elems, param);
if (new_imerge)
{
is_last_check_pass= TRUE;
rc= new_imerge->or_sel_imerge_with_checks(param, elems, im2->head(),
FALSE, &is_last_check_pass);
if (!rc)
- im1->push_back(new_imerge);
+ im1->push_back(new_imerge, mem_root);
}
}
return rc;
@@ -1638,17 +1028,17 @@ int imerge_list_or_tree(RANGE_OPT_PARAM *param,
List<SEL_IMERGE> *merges,
SEL_TREE *tree)
{
-
SEL_IMERGE *imerge;
List<SEL_IMERGE> additional_merges;
List_iterator<SEL_IMERGE> it(*merges);
+ MEM_ROOT *mem_root= current_thd->mem_root;
while ((imerge= it++))
{
bool is_last_check_pass;
int rc= 0;
int rc1= 0;
- SEL_TREE *or_tree= new SEL_TREE (tree, FALSE, param);
+ SEL_TREE *or_tree= new (mem_root) SEL_TREE (tree, FALSE, param);
if (or_tree)
{
uint elems= imerge->trees_next-imerge->trees;
@@ -1656,13 +1046,14 @@ int imerge_list_or_tree(RANGE_OPT_PARAM *param,
TRUE, &is_last_check_pass);
if (!is_last_check_pass)
{
- SEL_IMERGE *new_imerge= new SEL_IMERGE(imerge, elems, param);
+ SEL_IMERGE *new_imerge= new (mem_root) SEL_IMERGE(imerge, elems,
+ param);
if (new_imerge)
{
rc1= new_imerge->or_sel_tree_with_checks(param, elems, or_tree,
FALSE, &is_last_check_pass);
if (!rc1)
- additional_merges.push_back(new_imerge);
+ additional_merges.push_back(new_imerge, mem_root);
}
}
}
@@ -1724,11 +1115,12 @@ int imerge_list_and_tree(RANGE_OPT_PARAM *param,
SEL_IMERGE *new_imerge= NULL;
List<SEL_IMERGE> new_merges;
List_iterator<SEL_IMERGE> it(*merges);
+ MEM_ROOT *mem_root= current_thd->mem_root;
while ((imerge= it++))
{
if (!new_imerge)
- new_imerge= new SEL_IMERGE();
+ new_imerge= new (mem_root) SEL_IMERGE();
if (imerge->have_common_keys(param, tree) &&
new_imerge && !imerge->and_sel_tree(param, tree, new_imerge))
{
@@ -1739,7 +1131,7 @@ int imerge_list_and_tree(RANGE_OPT_PARAM *param,
if (replace)
it.replace(new_imerge);
else
- new_merges.push_back(new_imerge);
+ new_merges.push_back(new_imerge, mem_root);
new_imerge= NULL;
}
}
@@ -1985,7 +1377,7 @@ QUICK_INDEX_SORT_SELECT::push_quick_back(QUICK_RANGE_SELECT *quick_sel_range)
pk_quick_select= quick_sel_range;
DBUG_RETURN(0);
}
- DBUG_RETURN(quick_selects.push_back(quick_sel_range));
+ DBUG_RETURN(quick_selects.push_back(quick_sel_range, thd->mem_root));
}
QUICK_INDEX_SORT_SELECT::~QUICK_INDEX_SORT_SELECT()
@@ -2066,7 +1458,8 @@ int QUICK_ROR_INTERSECT_SELECT::init()
1 error
*/
-int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc)
+int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler,
+ MEM_ROOT *local_alloc)
{
handler *save_file= file, *org_file;
my_bool org_key_read;
@@ -2094,7 +1487,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc
DBUG_RETURN(0);
}
- if (!(file= head->file->clone(head->s->normalized_path.str, alloc)))
+ if (!(file= head->file->clone(head->s->normalized_path.str, local_alloc)))
{
/*
Manually set the error flag. Note: there seems to be quite a few
@@ -2182,7 +1575,7 @@ failure:
other error code
*/
int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler,
- MEM_ROOT *alloc)
+ MEM_ROOT *local_alloc)
{
List_iterator_fast<QUICK_SELECT_WITH_RECORD> quick_it(quick_selects);
QUICK_SELECT_WITH_RECORD *cur;
@@ -2199,7 +1592,7 @@ int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler,
There is no use of this->file. Use it for the first of merged range
selects.
*/
- int error= quick->init_ror_merged_scan(TRUE, alloc);
+ int error= quick->init_ror_merged_scan(TRUE, local_alloc);
if (error)
DBUG_RETURN(error);
quick->file->extra(HA_EXTRA_KEYREAD_PRESERVE_FIELDS);
@@ -2211,7 +1604,7 @@ int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler,
const MY_BITMAP * const save_read_set= quick->head->read_set;
const MY_BITMAP * const save_write_set= quick->head->write_set;
#endif
- if (quick->init_ror_merged_scan(FALSE, alloc))
+ if (quick->init_ror_merged_scan(FALSE, local_alloc))
DBUG_RETURN(1);
quick->file->extra(HA_EXTRA_KEYREAD_PRESERVE_FIELDS);
@@ -2273,11 +1666,13 @@ int QUICK_ROR_INTERSECT_SELECT::reset()
*/
bool
-QUICK_ROR_INTERSECT_SELECT::push_quick_back(MEM_ROOT *alloc, QUICK_RANGE_SELECT *quick)
+QUICK_ROR_INTERSECT_SELECT::push_quick_back(MEM_ROOT *local_alloc,
+ QUICK_RANGE_SELECT *quick)
{
QUICK_SELECT_WITH_RECORD *qr;
if (!(qr= new QUICK_SELECT_WITH_RECORD) ||
- !(qr->key_tuple= (uchar*)alloc_root(alloc, quick->max_used_key_length)))
+ !(qr->key_tuple= (uchar*)alloc_root(local_alloc,
+ quick->max_used_key_length)))
return TRUE;
qr->quick= quick;
return quick_selects.push_back(qr);
@@ -2576,8 +1971,8 @@ SEL_ARG *SEL_ARG::last()
Returns -2 or 2 if the ranges where 'joined' like < 2 and >= 2
*/
-static int sel_cmp(Field *field, uchar *a, uchar *b, uint8 a_flag,
- uint8 b_flag)
+int SEL_ARG::sel_cmp(Field *field, uchar *a, uchar *b, uint8 a_flag,
+ uint8 b_flag)
{
int cmp;
/* First check if there was a compare to a min or max element */
@@ -3542,9 +2937,10 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond)
break;
bitmap_set_bit(&handled_columns, key_part->fieldnr-1);
}
- double selectivity_mult;
if (i)
{
+ double UNINIT_VAR(selectivity_mult);
+
/*
There is at least 1-column prefix of columns whose selectivity has
not yet been accounted for.
@@ -7541,289 +6937,239 @@ QUICK_SELECT_I *TRP_ROR_UNION::make_quick(PARAM *param,
0 on error
*/
-static SEL_TREE *get_ne_mm_tree(RANGE_OPT_PARAM *param, Item_func *cond_func,
- Field *field,
- Item *lt_value, Item *gt_value,
- Item_result cmp_type)
+SEL_TREE *Item_bool_func::get_ne_mm_tree(RANGE_OPT_PARAM *param,
+ Field *field,
+ Item *lt_value, Item *gt_value,
+ Item_result cmp_type)
{
SEL_TREE *tree;
- tree= get_mm_parts(param, cond_func, field, Item_func::LT_FUNC,
- lt_value, cmp_type);
+ tree= get_mm_parts(param, field, Item_func::LT_FUNC, lt_value, cmp_type);
if (tree)
- {
- tree= tree_or(param, tree, get_mm_parts(param, cond_func, field,
- Item_func::GT_FUNC,
+ tree= tree_or(param, tree, get_mm_parts(param, field, Item_func::GT_FUNC,
gt_value, cmp_type));
- }
return tree;
}
-
-
-/*
- Build a SEL_TREE for a simple predicate
-
- SYNOPSIS
- get_func_mm_tree()
- param PARAM from SQL_SELECT::test_quick_select
- cond_func item for the predicate
- field field in the predicate
- value constant in the predicate
- cmp_type compare type for the field
- inv TRUE <> NOT cond_func is considered
- (makes sense only when cond_func is BETWEEN or IN)
- RETURN
- Pointer to the tree built tree
-*/
-static SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, Item_func *cond_func,
- Field *field, Item *value,
- Item_result cmp_type, bool inv)
+SEL_TREE *Item_func_between::get_func_mm_tree(RANGE_OPT_PARAM *param,
+ Field *field, Item *value,
+ Item_result cmp_type)
{
- SEL_TREE *tree= 0;
- DBUG_ENTER("get_func_mm_tree");
-
- switch (cond_func->functype()) {
-
- case Item_func::NE_FUNC:
- tree= get_ne_mm_tree(param, cond_func, field, value, value, cmp_type);
- break;
-
- case Item_func::BETWEEN:
+ SEL_TREE *tree;
+ DBUG_ENTER("Item_func_between::get_func_mm_tree");
+ if (!value)
{
- if (!value)
+ if (negated)
{
- if (inv)
- {
- tree= get_ne_mm_tree(param, cond_func, field, cond_func->arguments()[1],
- cond_func->arguments()[2], cmp_type);
- }
- else
+ tree= get_ne_mm_tree(param, field, args[1], args[2], cmp_type);
+ }
+ else
+ {
+ tree= get_mm_parts(param, field, Item_func::GE_FUNC, args[1], cmp_type);
+ if (tree)
{
- tree= get_mm_parts(param, cond_func, field, Item_func::GE_FUNC,
- cond_func->arguments()[1],cmp_type);
- if (tree)
- {
- tree= tree_and(param, tree, get_mm_parts(param, cond_func, field,
- Item_func::LE_FUNC,
- cond_func->arguments()[2],
- cmp_type));
- }
+ tree= tree_and(param, tree, get_mm_parts(param, field,
+ Item_func::LE_FUNC,
+ args[2], cmp_type));
}
}
- else
- tree= get_mm_parts(param, cond_func, field,
- (inv ?
- (value == (Item*)1 ? Item_func::GT_FUNC :
- Item_func::LT_FUNC):
- (value == (Item*)1 ? Item_func::LE_FUNC :
- Item_func::GE_FUNC)),
- cond_func->arguments()[0], cmp_type);
- break;
}
- case Item_func::IN_FUNC:
+ else
{
- Item_func_in *func=(Item_func_in*) cond_func;
+ tree= get_mm_parts(param, field,
+ (negated ?
+ (value == (Item*)1 ? Item_func::GT_FUNC :
+ Item_func::LT_FUNC):
+ (value == (Item*)1 ? Item_func::LE_FUNC :
+ Item_func::GE_FUNC)),
+ args[0], cmp_type);
+ }
+ DBUG_RETURN(tree);
+}
- /*
- Array for IN() is constructed when all values have the same result
- type. Tree won't be built for values with different result types,
- so we check it here to avoid unnecessary work.
- */
- if (!func->arg_types_compatible)
- break;
- if (inv)
+SEL_TREE *Item_func_in::get_func_mm_tree(RANGE_OPT_PARAM *param,
+ Field *field, Item *value,
+ Item_result cmp_type)
+{
+ SEL_TREE *tree= 0;
+ DBUG_ENTER("Iten_func_in::get_func_mm_tree");
+ /*
+ Array for IN() is constructed when all values have the same result
+ type. Tree won't be built for values with different result types,
+ so we check it here to avoid unnecessary work.
+ */
+ if (!arg_types_compatible)
+ DBUG_RETURN(0);
+
+ if (negated)
+ {
+ if (array && array->result_type() != ROW_RESULT)
{
- if (func->array && func->array->result_type() != ROW_RESULT)
- {
- /*
- We get here for conditions in form "t.key NOT IN (c1, c2, ...)",
- where c{i} are constants. Our goal is to produce a SEL_TREE that
- represents intervals:
-
- ($MIN<t.key<c1) OR (c1<t.key<c2) OR (c2<t.key<c3) OR ... (*)
-
- where $MIN is either "-inf" or NULL.
-
- The most straightforward way to produce it is to convert NOT IN
- into "(t.key != c1) AND (t.key != c2) AND ... " and let the range
- analyzer to build SEL_TREE from that. The problem is that the
- range analyzer will use O(N^2) memory (which is probably a bug),
- and people do use big NOT IN lists (e.g. see BUG#15872, BUG#21282),
- will run out of memory.
-
- Another problem with big lists like (*) is that a big list is
- unlikely to produce a good "range" access, while considering that
- range access will require expensive CPU calculations (and for
- MyISAM even index accesses). In short, big NOT IN lists are rarely
- worth analyzing.
-
- Considering the above, we'll handle NOT IN as follows:
- * if the number of entries in the NOT IN list is less than
- NOT_IN_IGNORE_THRESHOLD, construct the SEL_TREE (*) manually.
- * Otherwise, don't produce a SEL_TREE.
- */
+ /*
+ We get here for conditions in form "t.key NOT IN (c1, c2, ...)",
+ where c{i} are constants. Our goal is to produce a SEL_TREE that
+ represents intervals:
+
+ ($MIN<t.key<c1) OR (c1<t.key<c2) OR (c2<t.key<c3) OR ... (*)
+
+ where $MIN is either "-inf" or NULL.
+
+ The most straightforward way to produce it is to convert NOT IN
+ into "(t.key != c1) AND (t.key != c2) AND ... " and let the range
+ analyzer to build SEL_TREE from that. The problem is that the
+ range analyzer will use O(N^2) memory (which is probably a bug),
+ and people do use big NOT IN lists (e.g. see BUG#15872, BUG#21282),
+ will run out of memory.
+
+ Another problem with big lists like (*) is that a big list is
+ unlikely to produce a good "range" access, while considering that
+ range access will require expensive CPU calculations (and for
+ MyISAM even index accesses). In short, big NOT IN lists are rarely
+ worth analyzing.
+
+ Considering the above, we'll handle NOT IN as follows:
+ * if the number of entries in the NOT IN list is less than
+ NOT_IN_IGNORE_THRESHOLD, construct the SEL_TREE (*) manually.
+ * Otherwise, don't produce a SEL_TREE.
+ */
#define NOT_IN_IGNORE_THRESHOLD 1000
- MEM_ROOT *tmp_root= param->mem_root;
- param->thd->mem_root= param->old_root;
- /*
- Create one Item_type constant object. We'll need it as
- get_mm_parts only accepts constant values wrapped in Item_Type
- objects.
- We create the Item on param->mem_root which points to
- per-statement mem_root (while thd->mem_root is currently pointing
- to mem_root local to range optimizer).
- */
- Item *value_item= func->array->create_item();
- param->thd->mem_root= tmp_root;
+ MEM_ROOT *tmp_root= param->mem_root;
+ param->thd->mem_root= param->old_root;
+ /*
+ Create one Item_type constant object. We'll need it as
+ get_mm_parts only accepts constant values wrapped in Item_Type
+ objects.
+ We create the Item on param->mem_root which points to
+ per-statement mem_root (while thd->mem_root is currently pointing
+ to mem_root local to range optimizer).
+ */
+ Item *value_item= array->create_item(param->thd);
+ param->thd->mem_root= tmp_root;
+
+ if (array->count > NOT_IN_IGNORE_THRESHOLD || !value_item)
+ DBUG_RETURN(0);
- if (func->array->count > NOT_IN_IGNORE_THRESHOLD || !value_item)
+ /* Get a SEL_TREE for "(-inf|NULL) < X < c_0" interval. */
+ uint i=0;
+ do
+ {
+ array->value_to_item(i, value_item);
+ tree= get_mm_parts(param, field, Item_func::LT_FUNC,
+ value_item, cmp_type);
+ if (!tree)
break;
+ i++;
+ } while (i < array->count && tree->type == SEL_TREE::IMPOSSIBLE);
- /* Get a SEL_TREE for "(-inf|NULL) < X < c_0" interval. */
- uint i=0;
- do
+ if (!tree || tree->type == SEL_TREE::IMPOSSIBLE)
+ {
+ /* We get here in cases like "t.unsigned NOT IN (-1,-2,-3) */
+ DBUG_RETURN(NULL);
+ }
+ SEL_TREE *tree2;
+ for (; i < array->count; i++)
+ {
+ if (array->compare_elems(i, i-1))
{
- func->array->value_to_item(i, value_item);
- tree= get_mm_parts(param, cond_func, field, Item_func::LT_FUNC,
- value_item, cmp_type);
- if (!tree)
+ /* Get a SEL_TREE for "-inf < X < c_i" interval */
+ array->value_to_item(i, value_item);
+ tree2= get_mm_parts(param, field, Item_func::LT_FUNC,
+ value_item, cmp_type);
+ if (!tree2)
+ {
+ tree= NULL;
break;
- i++;
- } while (i < func->array->count && tree->type == SEL_TREE::IMPOSSIBLE);
+ }
- if (!tree || tree->type == SEL_TREE::IMPOSSIBLE)
- {
- /* We get here in cases like "t.unsigned NOT IN (-1,-2,-3) */
- tree= NULL;
- break;
- }
- SEL_TREE *tree2;
- for (; i < func->array->count; i++)
- {
- if (func->array->compare_elems(i, i-1))
+ /* Change all intervals to be "c_{i-1} < X < c_i" */
+ for (uint idx= 0; idx < param->keys; idx++)
{
- /* Get a SEL_TREE for "-inf < X < c_i" interval */
- func->array->value_to_item(i, value_item);
- tree2= get_mm_parts(param, cond_func, field, Item_func::LT_FUNC,
- value_item, cmp_type);
- if (!tree2)
+ SEL_ARG *new_interval, *last_val;
+ if (((new_interval= tree2->keys[idx])) &&
+ (tree->keys[idx]) &&
+ ((last_val= tree->keys[idx]->last())))
{
- tree= NULL;
- break;
- }
-
- /* Change all intervals to be "c_{i-1} < X < c_i" */
- for (uint idx= 0; idx < param->keys; idx++)
- {
- SEL_ARG *new_interval, *last_val;
- if (((new_interval= tree2->keys[idx])) &&
- (tree->keys[idx]) &&
- ((last_val= tree->keys[idx]->last())))
+ new_interval->min_value= last_val->max_value;
+ new_interval->min_flag= NEAR_MIN;
+
+ /*
+ If the interval is over a partial keypart, the
+ interval must be "c_{i-1} <= X < c_i" instead of
+ "c_{i-1} < X < c_i". Reason:
+
+ Consider a table with a column "my_col VARCHAR(3)",
+ and an index with definition
+ "INDEX my_idx my_col(1)". If the table contains rows
+ with my_col values "f" and "foo", the index will not
+ distinguish the two rows.
+
+ Note that tree_or() below will effectively merge
+ this range with the range created for c_{i-1} and
+ we'll eventually end up with only one range:
+ "NULL < X".
+
+ Partitioning indexes are never partial.
+ */
+ if (param->using_real_indexes)
{
- new_interval->min_value= last_val->max_value;
- new_interval->min_flag= NEAR_MIN;
-
- /*
- If the interval is over a partial keypart, the
- interval must be "c_{i-1} <= X < c_i" instead of
- "c_{i-1} < X < c_i". Reason:
-
- Consider a table with a column "my_col VARCHAR(3)",
- and an index with definition
- "INDEX my_idx my_col(1)". If the table contains rows
- with my_col values "f" and "foo", the index will not
- distinguish the two rows.
-
- Note that tree_or() below will effectively merge
- this range with the range created for c_{i-1} and
- we'll eventually end up with only one range:
- "NULL < X".
-
- Partitioning indexes are never partial.
- */
- if (param->using_real_indexes)
- {
- const KEY key=
- param->table->key_info[param->real_keynr[idx]];
- const KEY_PART_INFO *kpi= key.key_part + new_interval->part;
-
- if (kpi->key_part_flag & HA_PART_KEY_SEG)
- new_interval->min_flag= 0;
- }
+ const KEY key=
+ param->table->key_info[param->real_keynr[idx]];
+ const KEY_PART_INFO *kpi= key.key_part + new_interval->part;
+
+ if (kpi->key_part_flag & HA_PART_KEY_SEG)
+ new_interval->min_flag= 0;
}
}
- /*
- The following doesn't try to allocate memory so no need to
- check for NULL.
- */
- tree= tree_or(param, tree, tree2);
}
- }
-
- if (tree && tree->type != SEL_TREE::IMPOSSIBLE)
- {
/*
- Get the SEL_TREE for the last "c_last < X < +inf" interval
- (value_item cotains c_last already)
+ The following doesn't try to allocate memory so no need to
+ check for NULL.
*/
- tree2= get_mm_parts(param, cond_func, field, Item_func::GT_FUNC,
- value_item, cmp_type);
tree= tree_or(param, tree, tree2);
}
}
- else
+
+ if (tree && tree->type != SEL_TREE::IMPOSSIBLE)
{
- tree= get_ne_mm_tree(param, cond_func, field,
- func->arguments()[1], func->arguments()[1],
- cmp_type);
- if (tree)
- {
- Item **arg, **end;
- for (arg= func->arguments()+2, end= arg+func->argument_count()-2;
- arg < end ; arg++)
- {
- tree= tree_and(param, tree, get_ne_mm_tree(param, cond_func, field,
- *arg, *arg, cmp_type));
- }
- }
+ /*
+ Get the SEL_TREE for the last "c_last < X < +inf" interval
+ (value_item cotains c_last already)
+ */
+ tree2= get_mm_parts(param, field, Item_func::GT_FUNC,
+ value_item, cmp_type);
+ tree= tree_or(param, tree, tree2);
}
}
else
- {
- tree= get_mm_parts(param, cond_func, field, Item_func::EQ_FUNC,
- func->arguments()[1], cmp_type);
+ {
+ tree= get_ne_mm_tree(param, field, args[1], args[1], cmp_type);
if (tree)
{
Item **arg, **end;
- for (arg= func->arguments()+2, end= arg+func->argument_count()-2;
- arg < end ; arg++)
+ for (arg= args + 2, end= arg + arg_count - 2; arg < end ; arg++)
{
- tree= tree_or(param, tree, get_mm_parts(param, cond_func, field,
- Item_func::EQ_FUNC,
- *arg, cmp_type));
+ tree= tree_and(param, tree, get_ne_mm_tree(param, field,
+ *arg, *arg, cmp_type));
}
}
}
- break;
}
- default:
+ else
{
- /*
- Here the function for the following predicates are processed:
- <, <=, =, >=, >, LIKE, IS NULL, IS NOT NULL.
- If the predicate is of the form (value op field) it is handled
- as the equivalent predicate (field rev_op value), e.g.
- 2 <= a is handled as a >= 2.
- */
- Item_func::Functype func_type=
- (value != cond_func->arguments()[0]) ? cond_func->functype() :
- ((Item_bool_func2*) cond_func)->rev_functype();
- tree= get_mm_parts(param, cond_func, field, func_type, value, cmp_type);
- }
+ tree= get_mm_parts(param, field, Item_func::EQ_FUNC, args[1], cmp_type);
+ if (tree)
+ {
+ Item **arg, **end;
+ for (arg= args + 2, end= arg + arg_count - 2;
+ arg < end ; arg++)
+ {
+ tree= tree_or(param, tree, get_mm_parts(param, field,
+ Item_func::EQ_FUNC,
+ *arg, cmp_type));
+ }
+ }
}
-
DBUG_RETURN(tree);
}
@@ -7834,7 +7180,6 @@ static SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, Item_func *cond_func,
SYNOPSIS
get_full_func_mm_tree()
param PARAM from SQL_SELECT::test_quick_select
- cond_func item for the predicate
field_item field in the predicate
value constant in the predicate (or a field already read from
a table in the case of dynamic range access)
@@ -7899,18 +7244,16 @@ static SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, Item_func *cond_func,
Pointer to the tree representing the built conjunction of SEL_TREEs
*/
-static SEL_TREE *get_full_func_mm_tree(RANGE_OPT_PARAM *param,
- Item_func *cond_func,
- Item_field *field_item, Item *value,
- bool inv)
+SEL_TREE *Item_bool_func::get_full_func_mm_tree(RANGE_OPT_PARAM *param,
+ Item_field *field_item,
+ Item *value)
{
+ DBUG_ENTER("Item_bool_func::get_full_func_mm_tree");
SEL_TREE *tree= 0;
SEL_TREE *ftree= 0;
table_map ref_tables= 0;
table_map param_comp= ~(param->prev_tables | param->read_tables |
param->current_table);
- DBUG_ENTER("get_full_func_mm_tree");
-
#ifdef HAVE_SPATIAL
if (field_item->field->type() == MYSQL_TYPE_GEOMETRY)
{
@@ -7919,16 +7262,16 @@ static SEL_TREE *get_full_func_mm_tree(RANGE_OPT_PARAM *param,
}
#endif /*HAVE_SPATIAL*/
- for (uint i= 0; i < cond_func->arg_count; i++)
+ for (uint i= 0; i < arg_count; i++)
{
- Item *arg= cond_func->arguments()[i]->real_item();
+ Item *arg= arguments()[i]->real_item();
if (arg != field_item)
ref_tables|= arg->used_tables();
}
Field *field= field_item->field;
Item_result cmp_type= field->cmp_type();
if (!((ref_tables | field->table->map) & param_comp))
- ftree= get_func_mm_tree(param, cond_func, field, value, cmp_type, inv);
+ ftree= get_func_mm_tree(param, field, value, cmp_type);
Item_equal *item_equal= field_item->item_equal;
if (item_equal)
{
@@ -7940,7 +7283,7 @@ static SEL_TREE *get_full_func_mm_tree(RANGE_OPT_PARAM *param,
continue;
if (!((ref_tables | f->table->map) & param_comp))
{
- tree= get_func_mm_tree(param, cond_func, f, value, cmp_type, inv);
+ tree= get_func_mm_tree(param, f, value, cmp_type);
ftree= !ftree ? tree : tree_and(param, ftree, tree);
}
}
@@ -7948,6 +7291,7 @@ static SEL_TREE *get_full_func_mm_tree(RANGE_OPT_PARAM *param,
DBUG_RETURN(ftree);
}
+
/*
make a select tree of all keys in condition
@@ -8106,15 +7450,13 @@ Item_func_between::get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr)
if (const_item())
DBUG_RETURN(get_mm_tree_for_const(param, this));
- param->cond= this;
-
SEL_TREE *tree= 0;
SEL_TREE *ftree= 0;
if (arguments()[0]->real_item()->type() == Item::FIELD_ITEM)
{
Item_field *field_item= (Item_field*) (arguments()[0]->real_item());
- ftree= get_full_func_mm_tree(param, this, field_item, NULL, negated);
+ ftree= get_full_func_mm_tree(param, field_item, NULL);
}
/*
@@ -8126,8 +7468,8 @@ Item_func_between::get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr)
if (arguments()[i]->real_item()->type() == Item::FIELD_ITEM)
{
Item_field *field_item= (Item_field*) (arguments()[i]->real_item());
- SEL_TREE *tmp= get_full_func_mm_tree(param, this, field_item,
- (Item*)(intptr) i, negated);
+ SEL_TREE *tmp= get_full_func_mm_tree(param, field_item,
+ (Item*)(intptr) i);
if (negated)
{
tree= !tree ? tmp : tree_or(param, tree, tmp);
@@ -8155,12 +7497,10 @@ SEL_TREE *Item_func_in::get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr)
if (const_item())
DBUG_RETURN(get_mm_tree_for_const(param, this));
- param->cond= this;
-
if (key_item()->real_item()->type() != Item::FIELD_ITEM)
DBUG_RETURN(0);
Item_field *field= (Item_field*) (key_item()->real_item());
- SEL_TREE *tree= get_full_func_mm_tree(param, this, field, NULL, negated);
+ SEL_TREE *tree= get_full_func_mm_tree(param, field, NULL);
DBUG_RETURN(tree);
}
@@ -8171,8 +7511,6 @@ SEL_TREE *Item_equal::get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr)
if (const_item())
DBUG_RETURN(get_mm_tree_for_const(param, this));
- param->cond= this;
-
SEL_TREE *tree= 0;
SEL_TREE *ftree= 0;
@@ -8187,11 +7525,10 @@ SEL_TREE *Item_equal::get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr)
while (it++)
{
Field *field= it.get_curr_field();
- Item_result cmp_type= field->cmp_type();
if (!((ref_tables | field->table->map) & param_comp))
{
- tree= get_mm_parts(param, this, field, Item_func::EQ_FUNC,
- value, cmp_type);
+ tree= get_mm_parts(param, field, Item_func::EQ_FUNC,
+ value, field->cmp_type());
ftree= !ftree ? tree : tree_and(param, ftree, tree);
}
}
@@ -8203,23 +7540,42 @@ SEL_TREE *Item_equal::get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr)
SEL_TREE *Item_func::get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr)
{
DBUG_ENTER("Item_func::get_mm_tree");
+ DBUG_RETURN(const_item() ? get_mm_tree_for_const(param, this) : NULL);
+}
+
+
+SEL_TREE *Item_func_null_predicate::get_mm_tree(RANGE_OPT_PARAM *param,
+ Item **cond_ptr)
+{
+ DBUG_ENTER("Item_func_null_predicate::get_mm_tree");
if (const_item())
DBUG_RETURN(get_mm_tree_for_const(param, this));
+ if (args[0]->real_item()->type() == Item::FIELD_ITEM)
+ {
+ Item_field *field_item= (Item_field*) args[0]->real_item();
+ if (!field_item->const_item())
+ DBUG_RETURN(get_full_func_mm_tree(param, field_item, NULL));
+ }
+ DBUG_RETURN(NULL);
+}
- if (select_optimize() == Item_func::OPTIMIZE_NONE)
- DBUG_RETURN(0);
- param->cond= this;
+SEL_TREE *Item_bool_func2::get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr)
+{
+ DBUG_ENTER("Item_bool_func2::get_mm_tree");
+ if (const_item())
+ DBUG_RETURN(get_mm_tree_for_const(param, this));
SEL_TREE *ftree= 0;
+ DBUG_ASSERT(arg_count == 2);
if (arguments()[0]->real_item()->type() == Item::FIELD_ITEM)
{
Item_field *field_item= (Item_field*) (arguments()[0]->real_item());
- Item *value= arg_count > 1 ? arguments()[1] : NULL;
+ Item *value= arguments()[1];
if (value && value->is_expensive())
DBUG_RETURN(0);
if (!arguments()[0]->real_item()->const_item())
- ftree= get_full_func_mm_tree(param, this, field_item, value, false);
+ ftree= get_full_func_mm_tree(param, field_item, value);
}
/*
Even if get_full_func_mm_tree() was executed above and did not
@@ -8245,17 +7601,17 @@ SEL_TREE *Item_func::get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr)
if (value && value->is_expensive())
DBUG_RETURN(0);
if (!arguments()[1]->real_item()->const_item())
- ftree= get_full_func_mm_tree(param, this, field_item, value, false);
+ ftree= get_full_func_mm_tree(param, field_item, value);
}
DBUG_RETURN(ftree);
}
-static SEL_TREE *
-get_mm_parts(RANGE_OPT_PARAM *param, COND *cond_func, Field *field,
- Item_func::Functype type,
- Item *value, Item_result cmp_type)
+SEL_TREE *
+Item_bool_func::get_mm_parts(RANGE_OPT_PARAM *param, Field *field,
+ Item_func::Functype type,
+ Item *value, Item_result cmp_type)
{
DBUG_ENTER("get_mm_parts");
if (field->table != param->table)
@@ -8276,8 +7632,19 @@ get_mm_parts(RANGE_OPT_PARAM *param, COND *cond_func, Field *field,
DBUG_RETURN(0); // OOM
if (!value || !(value->used_tables() & ~param->read_tables))
{
- sel_arg=get_mm_leaf(param,cond_func,
- key_part->field,key_part,type,value);
+ /*
+ We need to restore the runtime mem_root of the thread in this
+ function because it evaluates the value of its argument, while
+ the argument can be any, e.g. a subselect. The subselect
+ items, in turn, assume that all the memory allocated during
+ the evaluation has the same life span as the item itself.
+ TODO: opt_range.cc should not reset thd->mem_root at all.
+ */
+ MEM_ROOT *tmp_root= param->mem_root;
+ param->thd->mem_root= param->old_root;
+ sel_arg= get_mm_leaf(param, key_part->field, key_part, type, value);
+ param->thd->mem_root= tmp_root;
+
if (!sel_arg)
continue;
if (sel_arg->type == SEL_ARG::IMPOSSIBLE)
@@ -8305,53 +7672,147 @@ get_mm_parts(RANGE_OPT_PARAM *param, COND *cond_func, Field *field,
}
-static SEL_ARG *
-get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
- KEY_PART *key_part, Item_func::Functype type,Item *value)
+SEL_ARG *
+Item_func_null_predicate::get_mm_leaf(RANGE_OPT_PARAM *param,
+ Field *field, KEY_PART *key_part,
+ Item_func::Functype type,
+ Item *value)
{
- uint maybe_null=(uint) field->real_maybe_null();
- bool optimize_range;
- SEL_ARG *tree= 0;
MEM_ROOT *alloc= param->mem_root;
- uchar *str;
- int err;
- DBUG_ENTER("get_mm_leaf");
+ DBUG_ENTER("Item_func_null_predicate::get_mm_leaf");
+ DBUG_ASSERT(!value);
+ /*
+ No check for field->table->maybe_null. It's perfecly fine to use range
+ access for cases like
+
+ SELECT * FROM t1 LEFT JOIN t2 ON t2.key IS [NOT] NULL
+
+ ON expression is evaluated before considering NULL-complemented rows, so
+ IS [NOT] NULL has regular semantics.
+ */
+ if (!field->real_maybe_null())
+ DBUG_RETURN(type == ISNULL_FUNC ? &null_element : NULL);
+ SEL_ARG *tree;
+ if (!(tree= new (alloc) SEL_ARG(field, is_null_string, is_null_string)))
+ DBUG_RETURN(0);
+ if (type == Item_func::ISNOTNULL_FUNC)
+ {
+ tree->min_flag=NEAR_MIN; /* IS NOT NULL -> X > NULL */
+ tree->max_flag=NO_MAX_RANGE;
+ }
+ DBUG_RETURN(tree);
+}
+
+
+SEL_ARG *
+Item_func_like::get_mm_leaf(RANGE_OPT_PARAM *param,
+ Field *field, KEY_PART *key_part,
+ Item_func::Functype type, Item *value)
+{
+ DBUG_ENTER("Item_func_like::get_mm_leaf");
+ DBUG_ASSERT(value);
+
+ if (key_part->image_type != Field::itRAW)
+ DBUG_RETURN(0);
+
+ if (param->using_real_indexes &&
+ !field->optimize_range(param->real_keynr[key_part->key],
+ key_part->part))
+ DBUG_RETURN(0);
+
+ if (field->result_type() == STRING_RESULT &&
+ field->charset() != compare_collation())
+ DBUG_RETURN(0);
+
+ StringBuffer<MAX_FIELD_WIDTH> tmp(value->collation.collation);
+ String *res;
+
+ if (!(res= value->val_str(&tmp)))
+ DBUG_RETURN(&null_element);
+
+ if (field->cmp_type() != STRING_RESULT)
+ DBUG_RETURN(0);
/*
- We need to restore the runtime mem_root of the thread in this
- function because it evaluates the value of its argument, while
- the argument can be any, e.g. a subselect. The subselect
- items, in turn, assume that all the memory allocated during
- the evaluation has the same life span as the item itself.
- TODO: opt_range.cc should not reset thd->mem_root at all.
+ TODO:
+ Check if this was a function. This should have be optimized away
+ in the sql_select.cc
*/
- param->thd->mem_root= param->old_root;
- if (!value) // IS NULL or IS NOT NULL
+ if (res != &tmp)
{
- /*
- No check for field->table->maybe_null. It's perfecly fine to use range
- access for cases like
+ tmp.copy(*res); // Get own copy
+ res= &tmp;
+ }
- SELECT * FROM t1 LEFT JOIN t2 ON t2.key IS [NOT] NULL
+ uint maybe_null= (uint) field->real_maybe_null();
+ uint field_length= field->pack_length() + maybe_null;
+ size_t offset= maybe_null;
+ size_t length= key_part->store_length;
- ON expression is evaluated before considering NULL-complemented rows, so
- IS [NOT] NULL has regular semantics.
- */
- if (!maybe_null) // Not null field
- {
- if (type == Item_func::ISNULL_FUNC)
- tree= &null_element;
- goto end;
- }
- if (!(tree= new (alloc) SEL_ARG(field,is_null_string,is_null_string)))
- goto end; // out of memory
- if (type == Item_func::ISNOTNULL_FUNC)
+ if (length != key_part->length + maybe_null)
+ {
+ /* key packed with length prefix */
+ offset+= HA_KEY_BLOB_LENGTH;
+ field_length= length - HA_KEY_BLOB_LENGTH;
+ }
+ else
+ {
+ if (unlikely(length < field_length))
{
- tree->min_flag=NEAR_MIN; /* IS NOT NULL -> X > NULL */
- tree->max_flag=NO_MAX_RANGE;
+ /*
+ This can only happen in a table created with UNIREG where one key
+ overlaps many fields
+ */
+ length= field_length;
}
- goto end;
+ else
+ field_length= length;
}
+ length+= offset;
+ uchar *min_str,*max_str;
+ if (!(min_str= (uchar*) alloc_root(param->mem_root, length*2)))
+ DBUG_RETURN(0);
+ max_str= min_str + length;
+ if (maybe_null)
+ max_str[0]= min_str[0]=0;
+
+ size_t min_length, max_length;
+ field_length-= maybe_null;
+ if (my_like_range(field->charset(),
+ res->ptr(), res->length(),
+ escape, wild_one, wild_many,
+ field_length,
+ (char*) min_str + offset,
+ (char*) max_str + offset,
+ &min_length, &max_length))
+ DBUG_RETURN(0); // Can't optimize with LIKE
+
+ if (offset != maybe_null) // BLOB or VARCHAR
+ {
+ int2store(min_str + maybe_null, min_length);
+ int2store(max_str + maybe_null, max_length);
+ }
+ SEL_ARG *tree= new (param->mem_root) SEL_ARG(field, min_str, max_str);
+ DBUG_RETURN(tree);
+}
+
+
+SEL_ARG *
+Item_bool_func::get_mm_leaf(RANGE_OPT_PARAM *param,
+ Field *field, KEY_PART *key_part,
+ Item_func::Functype type, Item *value)
+{
+ uint maybe_null=(uint) field->real_maybe_null();
+ SEL_ARG *tree= 0;
+ MEM_ROOT *alloc= param->mem_root;
+ uchar *str;
+ int err;
+ DBUG_ENTER("Item_bool_func::get_mm_leaf");
+
+ DBUG_ASSERT(value); // IS NULL and IS NOT NULL are handled separately
+
+ if (key_part->image_type != Field::itRAW)
+ DBUG_RETURN(0); // e.g. SPATIAL index
/*
1. Usually we can't use an index if the column collation
@@ -8368,125 +7829,18 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
if (field->result_type() == STRING_RESULT &&
field->match_collation_to_optimize_range() &&
value->result_type() == STRING_RESULT &&
- key_part->image_type == Field::itRAW &&
- field->charset() != conf_func->compare_collation() &&
- !(conf_func->compare_collation()->state & MY_CS_BINSORT &&
- (type == Item_func::EQUAL_FUNC || type == Item_func::EQ_FUNC)))
+ field->charset() != compare_collation() &&
+ !((type == EQUAL_FUNC || type == EQ_FUNC) &&
+ compare_collation()->state & MY_CS_BINSORT))
goto end;
if (value->cmp_type() == TIME_RESULT && field->cmp_type() != TIME_RESULT)
goto end;
- if (key_part->image_type == Field::itMBR)
- {
- // @todo: use is_spatial_operator() instead?
- switch (type) {
- case Item_func::SP_EQUALS_FUNC:
- case Item_func::SP_DISJOINT_FUNC:
- case Item_func::SP_INTERSECTS_FUNC:
- case Item_func::SP_TOUCHES_FUNC:
- case Item_func::SP_CROSSES_FUNC:
- case Item_func::SP_WITHIN_FUNC:
- case Item_func::SP_CONTAINS_FUNC:
- case Item_func::SP_OVERLAPS_FUNC:
- break;
- default:
- /*
- We cannot involve spatial indexes for queries that
- don't use MBREQUALS(), MBRDISJOINT(), etc. functions.
- */
- goto end;
- }
- }
-
- if (param->using_real_indexes)
- optimize_range= field->optimize_range(param->real_keynr[key_part->key],
- key_part->part);
- else
- optimize_range= TRUE;
-
- if (type == Item_func::LIKE_FUNC)
- {
- bool like_error;
- char buff1[MAX_FIELD_WIDTH];
- uchar *min_str,*max_str;
- String tmp(buff1,sizeof(buff1),value->collation.collation),*res;
- size_t length, offset, min_length, max_length;
- uint field_length= field->pack_length()+maybe_null;
-
- if (!optimize_range)
- goto end;
- if (!(res= value->val_str(&tmp)))
- {
- tree= &null_element;
- goto end;
- }
-
- /*
- TODO:
- Check if this was a function. This should have be optimized away
- in the sql_select.cc
- */
- if (res != &tmp)
- {
- tmp.copy(*res); // Get own copy
- res= &tmp;
- }
- if (field->cmp_type() != STRING_RESULT)
- goto end; // Can only optimize strings
-
- offset=maybe_null;
- length=key_part->store_length;
-
- if (length != key_part->length + maybe_null)
- {
- /* key packed with length prefix */
- offset+= HA_KEY_BLOB_LENGTH;
- field_length= length - HA_KEY_BLOB_LENGTH;
- }
- else
- {
- if (unlikely(length < field_length))
- {
- /*
- This can only happen in a table created with UNIREG where one key
- overlaps many fields
- */
- length= field_length;
- }
- else
- field_length= length;
- }
- length+=offset;
- if (!(min_str= (uchar*) alloc_root(alloc, length*2)))
- goto end;
-
- max_str=min_str+length;
- if (maybe_null)
- max_str[0]= min_str[0]=0;
-
- field_length-= maybe_null;
- like_error= my_like_range(field->charset(),
- res->ptr(), res->length(),
- ((Item_func_like*)(param->cond))->escape,
- wild_one, wild_many,
- field_length,
- (char*) min_str+offset, (char*) max_str+offset,
- &min_length, &max_length);
- if (like_error) // Can't optimize with LIKE
- goto end;
-
- if (offset != maybe_null) // BLOB or VARCHAR
- {
- int2store(min_str+maybe_null,min_length);
- int2store(max_str+maybe_null,max_length);
- }
- tree= new (alloc) SEL_ARG(field, min_str, max_str);
- goto end;
- }
-
- if (!optimize_range &&
- type != Item_func::EQ_FUNC &&
- type != Item_func::EQUAL_FUNC)
+ if (param->using_real_indexes &&
+ !field->optimize_range(param->real_keynr[key_part->key],
+ key_part->part) &&
+ type != EQ_FUNC &&
+ type != EQUAL_FUNC)
goto end; // Can't optimize this
/*
@@ -8498,7 +7852,7 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
err= value->save_in_field_no_warnings(field, 1);
if (err == 2 && field->cmp_type() == STRING_RESULT)
{
- if (type == Item_func::EQ_FUNC)
+ if (type == EQ_FUNC || type == EQUAL_FUNC)
{
tree= new (alloc) SEL_ARG(field, 0, 0);
tree->type= SEL_ARG::IMPOSSIBLE;
@@ -8511,7 +7865,7 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
{
if (field->cmp_type() != value->result_type())
{
- if ((type == Item_func::EQ_FUNC || type == Item_func::EQUAL_FUNC) &&
+ if ((type == EQ_FUNC || type == EQUAL_FUNC) &&
value->result_type() == item_cmp_type(field->result_type(),
value->result_type()))
{
@@ -8527,8 +7881,8 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
*/
tree= 0;
if (err == 3 && field->type() == FIELD_TYPE_DATE &&
- (type == Item_func::GT_FUNC || type == Item_func::GE_FUNC ||
- type == Item_func::LT_FUNC || type == Item_func::LE_FUNC) )
+ (type == GT_FUNC || type == GE_FUNC ||
+ type == LT_FUNC || type == LE_FUNC) )
{
/*
We were saving DATETIME into a DATE column, the conversion went ok
@@ -8561,14 +7915,14 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
*/
else if (err == 1 && field->result_type() == INT_RESULT)
{
- if (type == Item_func::LT_FUNC && (value->val_int() > 0))
- type = Item_func::LE_FUNC;
- else if (type == Item_func::GT_FUNC &&
+ if (type == LT_FUNC && (value->val_int() > 0))
+ type= LE_FUNC;
+ else if (type == GT_FUNC &&
(field->type() != FIELD_TYPE_BIT) &&
!((Field_num*)field)->unsigned_flag &&
!((Item_int*)value)->unsigned_flag &&
(value->val_int() < 0))
- type = Item_func::GE_FUNC;
+ type= GE_FUNC;
}
}
else if (err < 0)
@@ -8582,7 +7936,7 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
Any sargable predicate except "<=>" involving NULL as a constant is always
FALSE
*/
- if (type != Item_func::EQUAL_FUNC && field->is_real_null())
+ if (type != EQUAL_FUNC && field->is_real_null())
{
tree= &null_element;
goto end;
@@ -8618,12 +7972,12 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
longlong item_val= value->val_int();
if (item_val < 0)
{
- if (type == Item_func::LT_FUNC || type == Item_func::LE_FUNC)
+ if (type == LT_FUNC || type == LE_FUNC)
{
tree->type= SEL_ARG::IMPOSSIBLE;
goto end;
}
- if (type == Item_func::GT_FUNC || type == Item_func::GE_FUNC)
+ if (type == GT_FUNC || type == GE_FUNC)
{
tree= 0;
goto end;
@@ -8632,11 +7986,11 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
}
switch (type) {
- case Item_func::LT_FUNC:
+ case LT_FUNC:
if (stored_field_cmp_to_item(param->thd, field, value) == 0)
tree->max_flag=NEAR_MAX;
/* fall through */
- case Item_func::LE_FUNC:
+ case LE_FUNC:
if (!maybe_null)
tree->min_flag=NO_MIN_RANGE; /* From start */
else
@@ -8645,61 +7999,29 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
tree->min_flag=NEAR_MIN;
}
break;
- case Item_func::GT_FUNC:
+ case GT_FUNC:
/* Don't use open ranges for partial key_segments */
if ((!(key_part->flag & HA_PART_KEY_SEG)) &&
(stored_field_cmp_to_item(param->thd, field, value) <= 0))
tree->min_flag=NEAR_MIN;
tree->max_flag= NO_MAX_RANGE;
break;
- case Item_func::GE_FUNC:
+ case GE_FUNC:
/* Don't use open ranges for partial key_segments */
if ((!(key_part->flag & HA_PART_KEY_SEG)) &&
(stored_field_cmp_to_item(param->thd, field, value) < 0))
tree->min_flag= NEAR_MIN;
tree->max_flag=NO_MAX_RANGE;
break;
- case Item_func::SP_EQUALS_FUNC:
- tree->min_flag=GEOM_FLAG | HA_READ_MBR_EQUAL;// NEAR_MIN;//512;
- tree->max_flag=NO_MAX_RANGE;
- break;
- case Item_func::SP_DISJOINT_FUNC:
- tree->min_flag=GEOM_FLAG | HA_READ_MBR_DISJOINT;// NEAR_MIN;//512;
- tree->max_flag=NO_MAX_RANGE;
- break;
- case Item_func::SP_INTERSECTS_FUNC:
- tree->min_flag=GEOM_FLAG | HA_READ_MBR_INTERSECT;// NEAR_MIN;//512;
- tree->max_flag=NO_MAX_RANGE;
- break;
- case Item_func::SP_TOUCHES_FUNC:
- tree->min_flag=GEOM_FLAG | HA_READ_MBR_INTERSECT;// NEAR_MIN;//512;
- tree->max_flag=NO_MAX_RANGE;
- break;
-
- case Item_func::SP_CROSSES_FUNC:
- tree->min_flag=GEOM_FLAG | HA_READ_MBR_INTERSECT;// NEAR_MIN;//512;
- tree->max_flag=NO_MAX_RANGE;
- break;
- case Item_func::SP_WITHIN_FUNC:
- tree->min_flag=GEOM_FLAG | HA_READ_MBR_WITHIN;// NEAR_MIN;//512;
- tree->max_flag=NO_MAX_RANGE;
- break;
-
- case Item_func::SP_CONTAINS_FUNC:
- tree->min_flag=GEOM_FLAG | HA_READ_MBR_CONTAIN;// NEAR_MIN;//512;
- tree->max_flag=NO_MAX_RANGE;
+ case EQ_FUNC:
+ case EQUAL_FUNC:
break;
- case Item_func::SP_OVERLAPS_FUNC:
- tree->min_flag=GEOM_FLAG | HA_READ_MBR_INTERSECT;// NEAR_MIN;//512;
- tree->max_flag=NO_MAX_RANGE;
- break;
-
default:
+ DBUG_ASSERT(0);
break;
}
end:
- param->thd->mem_root= alloc;
DBUG_RETURN(tree);
}
@@ -11647,7 +10969,7 @@ int QUICK_ROR_INTERSECT_SELECT::get_next()
if ((error= quick->get_next()))
{
/* On certain errors like deadlock, trx might be rolled back.*/
- if (!current_thd->transaction_rollback_request)
+ if (!thd->transaction_rollback_request)
quick_with_last_rowid->file->unlock_row();
DBUG_RETURN(error);
}
@@ -11675,7 +10997,7 @@ int QUICK_ROR_INTERSECT_SELECT::get_next()
if ((error= quick->get_next()))
{
/* On certain errors like deadlock, trx might be rolled back.*/
- if (!current_thd->transaction_rollback_request)
+ if (!thd->transaction_rollback_request)
quick_with_last_rowid->file->unlock_row();
DBUG_RETURN(error);
}
@@ -12308,28 +11630,30 @@ void QUICK_SELECT_I::add_key_name(String *str, bool *first)
}
-Explain_quick_select* QUICK_RANGE_SELECT::get_explain(MEM_ROOT *alloc)
+Explain_quick_select* QUICK_RANGE_SELECT::get_explain(MEM_ROOT *local_alloc)
{
Explain_quick_select *res;
- if ((res= new (alloc) Explain_quick_select(QS_TYPE_RANGE)))
- res->range.set(alloc, &head->key_info[index], max_used_key_length);
+ if ((res= new (local_alloc) Explain_quick_select(QS_TYPE_RANGE)))
+ res->range.set(local_alloc, &head->key_info[index], max_used_key_length);
return res;
}
-Explain_quick_select* QUICK_GROUP_MIN_MAX_SELECT::get_explain(MEM_ROOT *alloc)
+Explain_quick_select*
+QUICK_GROUP_MIN_MAX_SELECT::get_explain(MEM_ROOT *local_alloc)
{
Explain_quick_select *res;
- if ((res= new (alloc) Explain_quick_select(QS_TYPE_GROUP_MIN_MAX)))
- res->range.set(alloc, &head->key_info[index], max_used_key_length);
+ if ((res= new (local_alloc) Explain_quick_select(QS_TYPE_GROUP_MIN_MAX)))
+ res->range.set(local_alloc, &head->key_info[index], max_used_key_length);
return res;
}
-Explain_quick_select* QUICK_INDEX_SORT_SELECT::get_explain(MEM_ROOT *alloc)
+Explain_quick_select*
+QUICK_INDEX_SORT_SELECT::get_explain(MEM_ROOT *local_alloc)
{
Explain_quick_select *res;
- if (!(res= new (alloc) Explain_quick_select(get_type())))
+ if (!(res= new (local_alloc) Explain_quick_select(get_type())))
return NULL;
QUICK_RANGE_SELECT *quick;
@@ -12337,7 +11661,7 @@ Explain_quick_select* QUICK_INDEX_SORT_SELECT::get_explain(MEM_ROOT *alloc)
List_iterator_fast<QUICK_RANGE_SELECT> it(quick_selects);
while ((quick= it++))
{
- if ((child_explain= quick->get_explain(alloc)))
+ if ((child_explain= quick->get_explain(local_alloc)))
res->children.push_back(child_explain);
else
return NULL;
@@ -12345,7 +11669,7 @@ Explain_quick_select* QUICK_INDEX_SORT_SELECT::get_explain(MEM_ROOT *alloc)
if (pk_quick_select)
{
- if ((child_explain= pk_quick_select->get_explain(alloc)))
+ if ((child_explain= pk_quick_select->get_explain(local_alloc)))
res->children.push_back(child_explain);
else
return NULL;
@@ -12359,17 +11683,18 @@ Explain_quick_select* QUICK_INDEX_SORT_SELECT::get_explain(MEM_ROOT *alloc)
first
*/
-Explain_quick_select* QUICK_INDEX_INTERSECT_SELECT::get_explain(MEM_ROOT *alloc)
+Explain_quick_select*
+QUICK_INDEX_INTERSECT_SELECT::get_explain(MEM_ROOT *local_alloc)
{
Explain_quick_select *res;
Explain_quick_select *child_explain;
- if (!(res= new (alloc) Explain_quick_select(get_type())))
+ if (!(res= new (local_alloc) Explain_quick_select(get_type())))
return NULL;
if (pk_quick_select)
{
- if ((child_explain= pk_quick_select->get_explain(alloc)))
+ if ((child_explain= pk_quick_select->get_explain(local_alloc)))
res->children.push_back(child_explain);
else
return NULL;
@@ -12379,7 +11704,7 @@ Explain_quick_select* QUICK_INDEX_INTERSECT_SELECT::get_explain(MEM_ROOT *alloc)
List_iterator_fast<QUICK_RANGE_SELECT> it(quick_selects);
while ((quick= it++))
{
- if ((child_explain= quick->get_explain(alloc)))
+ if ((child_explain= quick->get_explain(local_alloc)))
res->children.push_back(child_explain);
else
return NULL;
@@ -12388,19 +11713,20 @@ Explain_quick_select* QUICK_INDEX_INTERSECT_SELECT::get_explain(MEM_ROOT *alloc)
}
-Explain_quick_select* QUICK_ROR_INTERSECT_SELECT::get_explain(MEM_ROOT *alloc)
+Explain_quick_select*
+QUICK_ROR_INTERSECT_SELECT::get_explain(MEM_ROOT *local_alloc)
{
Explain_quick_select *res;
Explain_quick_select *child_explain;
- if (!(res= new (alloc) Explain_quick_select(get_type())))
+ if (!(res= new (local_alloc) Explain_quick_select(get_type())))
return NULL;
QUICK_SELECT_WITH_RECORD *qr;
List_iterator_fast<QUICK_SELECT_WITH_RECORD> it(quick_selects);
while ((qr= it++))
{
- if ((child_explain= qr->quick->get_explain(alloc)))
+ if ((child_explain= qr->quick->get_explain(local_alloc)))
res->children.push_back(child_explain);
else
return NULL;
@@ -12408,7 +11734,7 @@ Explain_quick_select* QUICK_ROR_INTERSECT_SELECT::get_explain(MEM_ROOT *alloc)
if (cpk_quick)
{
- if ((child_explain= cpk_quick->get_explain(alloc)))
+ if ((child_explain= cpk_quick->get_explain(local_alloc)))
res->children.push_back(child_explain);
else
return NULL;
@@ -12417,19 +11743,20 @@ Explain_quick_select* QUICK_ROR_INTERSECT_SELECT::get_explain(MEM_ROOT *alloc)
}
-Explain_quick_select* QUICK_ROR_UNION_SELECT::get_explain(MEM_ROOT *alloc)
+Explain_quick_select*
+QUICK_ROR_UNION_SELECT::get_explain(MEM_ROOT *local_alloc)
{
Explain_quick_select *res;
Explain_quick_select *child_explain;
- if (!(res= new (alloc) Explain_quick_select(get_type())))
+ if (!(res= new (local_alloc) Explain_quick_select(get_type())))
return NULL;
QUICK_SELECT_I *quick;
List_iterator_fast<QUICK_SELECT_I> it(quick_selects);
while ((quick= it++))
{
- if ((child_explain= quick->get_explain(alloc)))
+ if ((child_explain= quick->get_explain(local_alloc)))
res->children.push_back(child_explain);
else
return NULL;
@@ -12789,6 +12116,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time)
uint key_infix_len= 0; /* Length of key_infix. */
TRP_GROUP_MIN_MAX *read_plan= NULL; /* The eventually constructed TRP. */
uint key_part_nr;
+ uint elements_in_group;
ORDER *tmp_group;
Item *item;
Item_field *item_field;
@@ -12870,10 +12198,12 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time)
}
/* Check (GA4) - that there are no expressions among the group attributes. */
+ elements_in_group= 0;
for (tmp_group= join->group_list; tmp_group; tmp_group= tmp_group->next)
{
if ((*tmp_group->item)->real_item()->type() != Item::FIELD_ITEM)
DBUG_RETURN(NULL);
+ elements_in_group++;
}
/*
@@ -12922,8 +12252,16 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time)
there are cases Loose Scan over a multi-part index is useful).
*/
if (!table->covering_keys.is_set(cur_index))
- goto next_index;
-
+ continue;
+
+ /*
+ This function is called on the precondition that the index is covering.
+ Therefore if the GROUP BY list contains more elements than the index,
+ these are duplicates. The GROUP BY list cannot be a prefix of the index.
+ */
+ if (elements_in_group > table->actual_n_key_parts(cur_index_info))
+ continue;
+
/*
Unless extended keys can be used for cur_index:
If the current storage manager is such that it appends the primary key to
@@ -12984,13 +12322,6 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time)
else
goto next_index;
}
- /*
- This function is called on the precondition that the index is covering.
- Therefore if the GROUP BY list contains more elements than the index,
- these are duplicates. The GROUP BY list cannot be a prefix of the index.
- */
- if (cur_part == end_part && tmp_group)
- goto next_index;
}
/*
Check (GA2) if this is a DISTINCT query.
@@ -13000,8 +12331,8 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time)
Later group_fields_array of ORDER objects is used to convert the query
to a GROUP query.
*/
- if ((!join->group_list && join->select_distinct) ||
- is_agg_distinct)
+ if ((!join->group && join->select_distinct) ||
+ is_agg_distinct)
{
if (!is_agg_distinct)
{
@@ -13455,13 +12786,22 @@ check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item,
if (!simple_pred(pred, args, &inv))
DBUG_RETURN(FALSE);
- if (args[0] && args[1] && !args[2]) // this is a binary function
+ if (args[0] && args[1]) // this is a binary function or BETWEEN
{
DBUG_ASSERT(pred->is_bool_type());
Item_bool_func *bool_func= (Item_bool_func*) pred;
- if (!bool_func->can_optimize_group_min_max(min_max_arg_item,
- args[1]))
- DBUG_RETURN(FALSE);
+ Field *field= min_max_arg_item->field;
+ if (!args[2]) // this is a binary function
+ {
+ if (!field->can_optimize_group_min_max(bool_func, args[1]))
+ DBUG_RETURN(FALSE);
+ }
+ else // this is BETWEEN
+ {
+ if (!field->can_optimize_group_min_max(bool_func, args[1]) ||
+ !field->can_optimize_group_min_max(bool_func, args[2]))
+ DBUG_RETURN(FALSE);
+ }
}
}
else
diff --git a/sql/opt_range.h b/sql/opt_range.h
index e81a536c2b6..d47fe765184 100644
--- a/sql/opt_range.h
+++ b/sql/opt_range.h
@@ -38,7 +38,7 @@
class JOIN;
class Item_sum;
-typedef struct st_key_part {
+struct KEY_PART {
uint16 key,part;
/* See KEY_PART_INFO for meaning of the next two: */
uint16 store_length, length;
@@ -50,7 +50,617 @@ typedef struct st_key_part {
uint8 flag;
Field *field;
Field::imagetype image_type;
-} KEY_PART;
+};
+
+
+class RANGE_OPT_PARAM;
+/*
+ A construction block of the SEL_ARG-graph.
+
+ The following description only covers graphs of SEL_ARG objects with
+ sel_arg->type==KEY_RANGE:
+
+ One SEL_ARG object represents an "elementary interval" in form
+
+ min_value <=? table.keypartX <=? max_value
+
+ The interval is a non-empty interval of any kind: with[out] minimum/maximum
+ bound, [half]open/closed, single-point interval, etc.
+
+ 1. SEL_ARG GRAPH STRUCTURE
+
+ SEL_ARG objects are linked together in a graph. The meaning of the graph
+ is better demostrated by an example:
+
+ tree->keys[i]
+ |
+ | $ $
+ | part=1 $ part=2 $ part=3
+ | $ $
+ | +-------+ $ +-------+ $ +--------+
+ | | kp1<1 |--$-->| kp2=5 |--$-->| kp3=10 |
+ | +-------+ $ +-------+ $ +--------+
+ | | $ $ |
+ | | $ $ +--------+
+ | | $ $ | kp3=12 |
+ | | $ $ +--------+
+ | +-------+ $ $
+ \->| kp1=2 |--$--------------$-+
+ +-------+ $ $ | +--------+
+ | $ $ ==>| kp3=11 |
+ +-------+ $ $ | +--------+
+ | kp1=3 |--$--------------$-+ |
+ +-------+ $ $ +--------+
+ | $ $ | kp3=14 |
+ ... $ $ +--------+
+
+ The entire graph is partitioned into "interval lists".
+
+ An interval list is a sequence of ordered disjoint intervals over the same
+ key part. SEL_ARG are linked via "next" and "prev" pointers. Additionally,
+ all intervals in the list form an RB-tree, linked via left/right/parent
+ pointers. The RB-tree root SEL_ARG object will be further called "root of the
+ interval list".
+
+ In the example pic, there are 4 interval lists:
+ "kp<1 OR kp1=2 OR kp1=3", "kp2=5", "kp3=10 OR kp3=12", "kp3=11 OR kp3=13".
+ The vertical lines represent SEL_ARG::next/prev pointers.
+
+ In an interval list, each member X may have SEL_ARG::next_key_part pointer
+ pointing to the root of another interval list Y. The pointed interval list
+ must cover a key part with greater number (i.e. Y->part > X->part).
+
+ In the example pic, the next_key_part pointers are represented by
+ horisontal lines.
+
+ 2. SEL_ARG GRAPH SEMANTICS
+
+ It represents a condition in a special form (we don't have a name for it ATM)
+ The SEL_ARG::next/prev is "OR", and next_key_part is "AND".
+
+ For example, the picture represents the condition in form:
+ (kp1 < 1 AND kp2=5 AND (kp3=10 OR kp3=12)) OR
+ (kp1=2 AND (kp3=11 OR kp3=14)) OR
+ (kp1=3 AND (kp3=11 OR kp3=14))
+
+
+ 3. SEL_ARG GRAPH USE
+
+ Use get_mm_tree() to construct SEL_ARG graph from WHERE condition.
+ Then walk the SEL_ARG graph and get a list of dijsoint ordered key
+ intervals (i.e. intervals in form
+
+ (constA1, .., const1_K) < (keypart1,.., keypartK) < (constB1, .., constB_K)
+
+ Those intervals can be used to access the index. The uses are in:
+ - check_quick_select() - Walk the SEL_ARG graph and find an estimate of
+ how many table records are contained within all
+ intervals.
+ - get_quick_select() - Walk the SEL_ARG, materialize the key intervals,
+ and create QUICK_RANGE_SELECT object that will
+ read records within these intervals.
+
+ 4. SPACE COMPLEXITY NOTES
+
+ SEL_ARG graph is a representation of an ordered disjoint sequence of
+ intervals over the ordered set of index tuple values.
+
+ For multi-part keys, one can construct a WHERE expression such that its
+ list of intervals will be of combinatorial size. Here is an example:
+
+ (keypart1 IN (1,2, ..., n1)) AND
+ (keypart2 IN (1,2, ..., n2)) AND
+ (keypart3 IN (1,2, ..., n3))
+
+ For this WHERE clause the list of intervals will have n1*n2*n3 intervals
+ of form
+
+ (keypart1, keypart2, keypart3) = (k1, k2, k3), where 1 <= k{i} <= n{i}
+
+ SEL_ARG graph structure aims to reduce the amount of required space by
+ "sharing" the elementary intervals when possible (the pic at the
+ beginning of this comment has examples of such sharing). The sharing may
+ prevent combinatorial blowup:
+
+ There are WHERE clauses that have combinatorial-size interval lists but
+ will be represented by a compact SEL_ARG graph.
+ Example:
+ (keypartN IN (1,2, ..., n1)) AND
+ ...
+ (keypart2 IN (1,2, ..., n2)) AND
+ (keypart1 IN (1,2, ..., n3))
+
+ but not in all cases:
+
+ - There are WHERE clauses that do have a compact SEL_ARG-graph
+ representation but get_mm_tree() and its callees will construct a
+ graph of combinatorial size.
+ Example:
+ (keypart1 IN (1,2, ..., n1)) AND
+ (keypart2 IN (1,2, ..., n2)) AND
+ ...
+ (keypartN IN (1,2, ..., n3))
+
+ - There are WHERE clauses for which the minimal possible SEL_ARG graph
+ representation will have combinatorial size.
+ Example:
+ By induction: Let's take any interval on some keypart in the middle:
+
+ kp15=c0
+
+ Then let's AND it with this interval 'structure' from preceding and
+ following keyparts:
+
+ (kp14=c1 AND kp16=c3) OR keypart14=c2) (*)
+
+ We will obtain this SEL_ARG graph:
+
+ kp14 $ kp15 $ kp16
+ $ $
+ +---------+ $ +---------+ $ +---------+
+ | kp14=c1 |--$-->| kp15=c0 |--$-->| kp16=c3 |
+ +---------+ $ +---------+ $ +---------+
+ | $ $
+ +---------+ $ +---------+ $
+ | kp14=c2 |--$-->| kp15=c0 | $
+ +---------+ $ +---------+ $
+ $ $
+
+ Note that we had to duplicate "kp15=c0" and there was no way to avoid
+ that.
+ The induction step: AND the obtained expression with another "wrapping"
+ expression like (*).
+ When the process ends because of the limit on max. number of keyparts
+ we'll have:
+
+ WHERE clause length is O(3*#max_keyparts)
+ SEL_ARG graph size is O(2^(#max_keyparts/2))
+
+ (it is also possible to construct a case where instead of 2 in 2^n we
+ have a bigger constant, e.g. 4, and get a graph with 4^(31/2)= 2^31
+ nodes)
+
+ We avoid consuming too much memory by setting a limit on the number of
+ SEL_ARG object we can construct during one range analysis invocation.
+*/
+
+class SEL_ARG :public Sql_alloc
+{
+ static int sel_cmp(Field *field, uchar *a, uchar *b, uint8 a_flag,
+ uint8 b_flag);
+public:
+ uint8 min_flag,max_flag,maybe_flag;
+ uint8 part; // Which key part
+ uint8 maybe_null;
+ /*
+ The ordinal number the least significant component encountered in
+ the ranges of the SEL_ARG tree (the first component has number 1)
+ */
+ uint16 max_part_no;
+ /*
+ Number of children of this element in the RB-tree, plus 1 for this
+ element itself.
+ */
+ uint16 elements;
+ /*
+ Valid only for elements which are RB-tree roots: Number of times this
+ RB-tree is referred to (it is referred by SEL_ARG::next_key_part or by
+ SEL_TREE::keys[i] or by a temporary SEL_ARG* variable)
+ */
+ ulong use_count;
+
+ Field *field;
+ uchar *min_value,*max_value; // Pointer to range
+
+ /*
+ eq_tree() requires that left == right == 0 if the type is MAYBE_KEY.
+ */
+ SEL_ARG *left,*right; /* R-B tree children */
+ SEL_ARG *next,*prev; /* Links for bi-directional interval list */
+ SEL_ARG *parent; /* R-B tree parent */
+ SEL_ARG *next_key_part;
+ enum leaf_color { BLACK,RED } color;
+ enum Type { IMPOSSIBLE, MAYBE, MAYBE_KEY, KEY_RANGE } type;
+
+ enum { MAX_SEL_ARGS = 16000 };
+
+ SEL_ARG() {}
+ SEL_ARG(SEL_ARG &);
+ SEL_ARG(Field *,const uchar *, const uchar *);
+ SEL_ARG(Field *field, uint8 part, uchar *min_value, uchar *max_value,
+ uint8 min_flag, uint8 max_flag, uint8 maybe_flag);
+ SEL_ARG(enum Type type_arg)
+ :min_flag(0), max_part_no(0) /* first key part means 1. 0 mean 'no parts'*/,
+ elements(1),use_count(1),left(0),right(0),
+ next_key_part(0), color(BLACK), type(type_arg)
+ {}
+ /**
+ returns true if a range predicate is equal. Use all_same()
+ to check for equality of all the predicates on this keypart.
+ */
+ inline bool is_same(const SEL_ARG *arg) const
+ {
+ if (type != arg->type || part != arg->part)
+ return false;
+ if (type != KEY_RANGE)
+ return true;
+ return cmp_min_to_min(arg) == 0 && cmp_max_to_max(arg) == 0;
+ }
+ /**
+ returns true if all the predicates in the keypart tree are equal
+ */
+ bool all_same(const SEL_ARG *arg) const
+ {
+ if (type != arg->type || part != arg->part)
+ return false;
+ if (type != KEY_RANGE)
+ return true;
+ if (arg == this)
+ return true;
+ const SEL_ARG *cmp_arg= arg->first();
+ const SEL_ARG *cur_arg= first();
+ for (; cur_arg && cmp_arg && cur_arg->is_same(cmp_arg);
+ cur_arg= cur_arg->next, cmp_arg= cmp_arg->next) ;
+ if (cur_arg || cmp_arg)
+ return false;
+ return true;
+ }
+ inline void merge_flags(SEL_ARG *arg) { maybe_flag|=arg->maybe_flag; }
+ inline void maybe_smaller() { maybe_flag=1; }
+ /* Return true iff it's a single-point null interval */
+ inline bool is_null_interval() { return maybe_null && max_value[0] == 1; }
+ inline int cmp_min_to_min(const SEL_ARG* arg) const
+ {
+ return sel_cmp(field,min_value, arg->min_value, min_flag, arg->min_flag);
+ }
+ inline int cmp_min_to_max(const SEL_ARG* arg) const
+ {
+ return sel_cmp(field,min_value, arg->max_value, min_flag, arg->max_flag);
+ }
+ inline int cmp_max_to_max(const SEL_ARG* arg) const
+ {
+ return sel_cmp(field,max_value, arg->max_value, max_flag, arg->max_flag);
+ }
+ inline int cmp_max_to_min(const SEL_ARG* arg) const
+ {
+ return sel_cmp(field,max_value, arg->min_value, max_flag, arg->min_flag);
+ }
+ SEL_ARG *clone_and(THD *thd, SEL_ARG* arg)
+ { // Get overlapping range
+ uchar *new_min,*new_max;
+ uint8 flag_min,flag_max;
+ if (cmp_min_to_min(arg) >= 0)
+ {
+ new_min=min_value; flag_min=min_flag;
+ }
+ else
+ {
+ new_min=arg->min_value; flag_min=arg->min_flag; /* purecov: deadcode */
+ }
+ if (cmp_max_to_max(arg) <= 0)
+ {
+ new_max=max_value; flag_max=max_flag;
+ }
+ else
+ {
+ new_max=arg->max_value; flag_max=arg->max_flag;
+ }
+ return new (thd->mem_root) SEL_ARG(field, part, new_min, new_max, flag_min,
+ flag_max,
+ MY_TEST(maybe_flag && arg->maybe_flag));
+ }
+ SEL_ARG *clone_first(SEL_ARG *arg)
+ { // min <= X < arg->min
+ return new SEL_ARG(field,part, min_value, arg->min_value,
+ min_flag, arg->min_flag & NEAR_MIN ? 0 : NEAR_MAX,
+ maybe_flag | arg->maybe_flag);
+ }
+ SEL_ARG *clone_last(SEL_ARG *arg)
+ { // min <= X <= key_max
+ return new SEL_ARG(field, part, min_value, arg->max_value,
+ min_flag, arg->max_flag, maybe_flag | arg->maybe_flag);
+ }
+ SEL_ARG *clone(RANGE_OPT_PARAM *param, SEL_ARG *new_parent, SEL_ARG **next);
+
+ bool copy_min(SEL_ARG* arg)
+ { // Get overlapping range
+ if (cmp_min_to_min(arg) > 0)
+ {
+ min_value=arg->min_value; min_flag=arg->min_flag;
+ if ((max_flag & (NO_MAX_RANGE | NO_MIN_RANGE)) ==
+ (NO_MAX_RANGE | NO_MIN_RANGE))
+ return 1; // Full range
+ }
+ maybe_flag|=arg->maybe_flag;
+ return 0;
+ }
+ bool copy_max(SEL_ARG* arg)
+ { // Get overlapping range
+ if (cmp_max_to_max(arg) <= 0)
+ {
+ max_value=arg->max_value; max_flag=arg->max_flag;
+ if ((max_flag & (NO_MAX_RANGE | NO_MIN_RANGE)) ==
+ (NO_MAX_RANGE | NO_MIN_RANGE))
+ return 1; // Full range
+ }
+ maybe_flag|=arg->maybe_flag;
+ return 0;
+ }
+
+ void copy_min_to_min(SEL_ARG *arg)
+ {
+ min_value=arg->min_value; min_flag=arg->min_flag;
+ }
+ void copy_min_to_max(SEL_ARG *arg)
+ {
+ max_value=arg->min_value;
+ max_flag=arg->min_flag & NEAR_MIN ? 0 : NEAR_MAX;
+ }
+ void copy_max_to_min(SEL_ARG *arg)
+ {
+ min_value=arg->max_value;
+ min_flag=arg->max_flag & NEAR_MAX ? 0 : NEAR_MIN;
+ }
+ /* returns a number of keypart values (0 or 1) appended to the key buffer */
+ int store_min(uint length, uchar **min_key,uint min_key_flag)
+ {
+ /* "(kp1 > c1) AND (kp2 OP c2) AND ..." -> (kp1 > c1) */
+ if ((min_flag & GEOM_FLAG) ||
+ (!(min_flag & NO_MIN_RANGE) &&
+ !(min_key_flag & (NO_MIN_RANGE | NEAR_MIN))))
+ {
+ if (maybe_null && *min_value)
+ {
+ **min_key=1;
+ bzero(*min_key+1,length-1);
+ }
+ else
+ memcpy(*min_key,min_value,length);
+ (*min_key)+= length;
+ return 1;
+ }
+ return 0;
+ }
+ /* returns a number of keypart values (0 or 1) appended to the key buffer */
+ int store_max(uint length, uchar **max_key, uint max_key_flag)
+ {
+ if (!(max_flag & NO_MAX_RANGE) &&
+ !(max_key_flag & (NO_MAX_RANGE | NEAR_MAX)))
+ {
+ if (maybe_null && *max_value)
+ {
+ **max_key=1;
+ bzero(*max_key+1,length-1);
+ }
+ else
+ memcpy(*max_key,max_value,length);
+ (*max_key)+= length;
+ return 1;
+ }
+ return 0;
+ }
+
+ /*
+ Returns a number of keypart values appended to the key buffer
+ for min key and max key. This function is used by both Range
+ Analysis and Partition pruning. For partition pruning we have
+ to ensure that we don't store also subpartition fields. Thus
+ we have to stop at the last partition part and not step into
+ the subpartition fields. For Range Analysis we set last_part
+ to MAX_KEY which we should never reach.
+ */
+ int store_min_key(KEY_PART *key,
+ uchar **range_key,
+ uint *range_key_flag,
+ uint last_part)
+ {
+ SEL_ARG *key_tree= first();
+ uint res= key_tree->store_min(key[key_tree->part].store_length,
+ range_key, *range_key_flag);
+ *range_key_flag|= key_tree->min_flag;
+ if (key_tree->next_key_part &&
+ key_tree->next_key_part->type == SEL_ARG::KEY_RANGE &&
+ key_tree->part != last_part &&
+ key_tree->next_key_part->part == key_tree->part+1 &&
+ !(*range_key_flag & (NO_MIN_RANGE | NEAR_MIN)))
+ res+= key_tree->next_key_part->store_min_key(key,
+ range_key,
+ range_key_flag,
+ last_part);
+ return res;
+ }
+
+ /* returns a number of keypart values appended to the key buffer */
+ int store_max_key(KEY_PART *key,
+ uchar **range_key,
+ uint *range_key_flag,
+ uint last_part)
+ {
+ SEL_ARG *key_tree= last();
+ uint res=key_tree->store_max(key[key_tree->part].store_length,
+ range_key, *range_key_flag);
+ (*range_key_flag)|= key_tree->max_flag;
+ if (key_tree->next_key_part &&
+ key_tree->next_key_part->type == SEL_ARG::KEY_RANGE &&
+ key_tree->part != last_part &&
+ key_tree->next_key_part->part == key_tree->part+1 &&
+ !(*range_key_flag & (NO_MAX_RANGE | NEAR_MAX)))
+ res+= key_tree->next_key_part->store_max_key(key,
+ range_key,
+ range_key_flag,
+ last_part);
+ return res;
+ }
+
+ SEL_ARG *insert(SEL_ARG *key);
+ SEL_ARG *tree_delete(SEL_ARG *key);
+ SEL_ARG *find_range(SEL_ARG *key);
+ SEL_ARG *rb_insert(SEL_ARG *leaf);
+ friend SEL_ARG *rb_delete_fixup(SEL_ARG *root,SEL_ARG *key, SEL_ARG *par);
+#ifdef EXTRA_DEBUG
+ friend int test_rb_tree(SEL_ARG *element,SEL_ARG *parent);
+ void test_use_count(SEL_ARG *root);
+#endif
+ SEL_ARG *first();
+ const SEL_ARG *first() const;
+ SEL_ARG *last();
+ void make_root();
+ inline bool simple_key()
+ {
+ return !next_key_part && elements == 1;
+ }
+ void increment_use_count(long count)
+ {
+ if (next_key_part)
+ {
+ next_key_part->use_count+=count;
+ count*= (next_key_part->use_count-count);
+ for (SEL_ARG *pos=next_key_part->first(); pos ; pos=pos->next)
+ if (pos->next_key_part)
+ pos->increment_use_count(count);
+ }
+ }
+ void incr_refs()
+ {
+ increment_use_count(1);
+ use_count++;
+ }
+ void incr_refs_all()
+ {
+ for (SEL_ARG *pos=first(); pos ; pos=pos->next)
+ {
+ pos->increment_use_count(1);
+ }
+ use_count++;
+ }
+ void free_tree()
+ {
+ for (SEL_ARG *pos=first(); pos ; pos=pos->next)
+ if (pos->next_key_part)
+ {
+ pos->next_key_part->use_count--;
+ pos->next_key_part->free_tree();
+ }
+ }
+
+ inline SEL_ARG **parent_ptr()
+ {
+ return parent->left == this ? &parent->left : &parent->right;
+ }
+
+
+ /*
+ Check if this SEL_ARG object represents a single-point interval
+
+ SYNOPSIS
+ is_singlepoint()
+
+ DESCRIPTION
+ Check if this SEL_ARG object (not tree) represents a single-point
+ interval, i.e. if it represents a "keypart = const" or
+ "keypart IS NULL".
+
+ RETURN
+ TRUE This SEL_ARG object represents a singlepoint interval
+ FALSE Otherwise
+ */
+
+ bool is_singlepoint()
+ {
+ /*
+ Check for NEAR_MIN ("strictly less") and NO_MIN_RANGE (-inf < field)
+ flags, and the same for right edge.
+ */
+ if (min_flag || max_flag)
+ return FALSE;
+ uchar *min_val= min_value;
+ uchar *max_val= max_value;
+
+ if (maybe_null)
+ {
+ /* First byte is a NULL value indicator */
+ if (*min_val != *max_val)
+ return FALSE;
+
+ if (*min_val)
+ return TRUE; /* This "x IS NULL" */
+ min_val++;
+ max_val++;
+ }
+ return !field->key_cmp(min_val, max_val);
+ }
+ SEL_ARG *clone_tree(RANGE_OPT_PARAM *param);
+};
+
+
+class RANGE_OPT_PARAM
+{
+public:
+ THD *thd; /* Current thread handle */
+ TABLE *table; /* Table being analyzed */
+ table_map prev_tables;
+ table_map read_tables;
+ table_map current_table; /* Bit of the table being analyzed */
+
+ /* Array of parts of all keys for which range analysis is performed */
+ KEY_PART *key_parts;
+ KEY_PART *key_parts_end;
+ MEM_ROOT *mem_root; /* Memory that will be freed when range analysis completes */
+ MEM_ROOT *old_root; /* Memory that will last until the query end */
+ /*
+ Number of indexes used in range analysis (In SEL_TREE::keys only first
+ #keys elements are not empty)
+ */
+ uint keys;
+
+ /*
+ If true, the index descriptions describe real indexes (and it is ok to
+ call field->optimize_range(real_keynr[...], ...).
+ Otherwise index description describes fake indexes.
+ */
+ bool using_real_indexes;
+
+ /*
+ Aggressively remove "scans" that do not have conditions on first
+ keyparts. Such scans are usable when doing partition pruning but not
+ regular range optimization.
+ */
+ bool remove_jump_scans;
+
+ /*
+ TRUE <=> Range analyzer should remove parts of condition that are found
+ to be always FALSE.
+ */
+ bool remove_false_where_parts;
+
+ /*
+ used_key_no -> table_key_no translation table. Only makes sense if
+ using_real_indexes==TRUE
+ */
+ uint real_keynr[MAX_KEY];
+
+ /*
+ Used to store 'current key tuples', in both range analysis and
+ partitioning (list) analysis
+ */
+ uchar min_key[MAX_KEY_LENGTH+MAX_FIELD_WIDTH],
+ max_key[MAX_KEY_LENGTH+MAX_FIELD_WIDTH];
+
+ /* Number of SEL_ARG objects allocated by SEL_ARG::clone_tree operations */
+ uint alloced_sel_args;
+
+ bool force_default_mrr;
+ KEY_PART *key[MAX_KEY]; /* First key parts of keys used in the query */
+
+ bool statement_should_be_aborted() const
+ {
+ return
+ thd->is_fatal_error ||
+ thd->is_error() ||
+ alloced_sel_args > SEL_ARG::MAX_SEL_ARGS;
+ }
+};
+
class Explain_quick_select;
/*
@@ -401,7 +1011,6 @@ public:
struct st_qsel_param;
class PARAM;
-class SEL_ARG;
/*
@@ -665,8 +1274,8 @@ protected:
int read_keys_and_merge();
public:
- QUICK_INDEX_MERGE_SELECT(THD *thd, TABLE *table)
- :QUICK_INDEX_SORT_SELECT(thd, table) {}
+ QUICK_INDEX_MERGE_SELECT(THD *thd_arg, TABLE *table)
+ :QUICK_INDEX_SORT_SELECT(thd_arg, table) {}
int get_next();
int get_type() { return QS_TYPE_INDEX_MERGE; }
@@ -679,8 +1288,8 @@ protected:
int read_keys_and_merge();
public:
- QUICK_INDEX_INTERSECT_SELECT(THD *thd, TABLE *table)
- :QUICK_INDEX_SORT_SELECT(thd, table) {}
+ QUICK_INDEX_INTERSECT_SELECT(THD *thd_arg, TABLE *table)
+ :QUICK_INDEX_SORT_SELECT(thd_arg, table) {}
key_map filtered_scans;
int get_next();
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index c0d0fa3c7f3..9c6784437a7 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -461,7 +461,7 @@ void best_access_path(JOIN *join, JOIN_TAB *s,
static Item *create_subq_in_equalities(THD *thd, SJ_MATERIALIZATION_INFO *sjm,
Item_in_subselect *subq_pred);
-static void remove_sj_conds(Item **tree);
+static void remove_sj_conds(THD *thd, Item **tree);
static bool is_cond_sj_in_equality(Item *item);
static bool sj_table_is_included(JOIN *join, JOIN_TAB *join_tab);
static Item *remove_additional_cond(Item* conds);
@@ -691,7 +691,8 @@ int check_and_do_in_subquery_rewrites(JOIN *join)
{
Query_arena *arena, backup;
arena= thd->activate_stmt_arena_if_needed(&backup);
- select_lex->outer_select()->sj_subselects.push_back(in_subs);
+ select_lex->outer_select()->sj_subselects.push_back(in_subs,
+ thd->mem_root);
if (arena)
thd->restore_active_arena(arena, &backup);
in_subs->is_registered_semijoin= TRUE;
@@ -728,7 +729,8 @@ int check_and_do_in_subquery_rewrites(JOIN *join)
{
Query_arena *arena, backup;
arena= thd->activate_stmt_arena_if_needed(&backup);
- select_lex->outer_select()->sj_subselects.push_back(in_subs);
+ select_lex->outer_select()->sj_subselects.push_back(in_subs,
+ thd->mem_root);
if (arena)
thd->restore_active_arena(arena, &backup);
in_subs->is_registered_semijoin= TRUE;
@@ -1135,7 +1137,8 @@ bool convert_join_subqueries_to_semijoins(JOIN *join)
Item **tree= (in_subq->emb_on_expr_nest == NO_JOIN_NEST)?
&join->conds : &(in_subq->emb_on_expr_nest->on_expr);
Item *replace_me= in_subq->original_item();
- if (replace_where_subcondition(join, tree, replace_me, new Item_int(1),
+ if (replace_where_subcondition(join, tree, replace_me,
+ new (thd->mem_root) Item_int(thd, 1),
FALSE))
goto restore_arena_and_fail;
}
@@ -1424,7 +1427,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
A3: changes in the TABLE_LIST::outer_join will make everything work
automatically.
*/
- if (!(wrap_nest= alloc_join_nest(parent_join->thd)))
+ if (!(wrap_nest= alloc_join_nest(thd)))
{
DBUG_RETURN(TRUE);
}
@@ -1433,7 +1436,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
wrap_nest->alias= (char*) "(sj-wrap)";
wrap_nest->nested_join->join_list.empty();
- wrap_nest->nested_join->join_list.push_back(outer_tbl);
+ wrap_nest->nested_join->join_list.push_back(outer_tbl, thd->mem_root);
outer_tbl->embedding= wrap_nest;
outer_tbl->join_list= &wrap_nest->nested_join->join_list;
@@ -1469,7 +1472,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
TABLE_LIST *sj_nest;
NESTED_JOIN *nested_join;
- if (!(sj_nest= alloc_join_nest(parent_join->thd)))
+ if (!(sj_nest= alloc_join_nest(thd)))
{
DBUG_RETURN(TRUE);
}
@@ -1483,7 +1486,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
subq_pred->left_expr->used_tables();
/* Nests do not participate in those 'chains', so: */
/* sj_nest->next_leaf= sj_nest->next_local= sj_nest->next_global == NULL*/
- emb_join_list->push_back(sj_nest);
+ emb_join_list->push_back(sj_nest, thd->mem_root);
/*
nested_join->used_tables and nested_join->not_null_tables are
@@ -1502,7 +1505,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
{
tl->embedding= sj_nest;
tl->join_list= &nested_join->join_list;
- nested_join->join_list.push_back(tl);
+ nested_join->join_list.push_back(tl, thd->mem_root);
}
/*
@@ -1592,23 +1595,27 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
if (subq_pred->left_expr->cols() == 1)
{
- nested_join->sj_outer_expr_list.push_back(subq_pred->left_expr);
+ nested_join->sj_outer_expr_list.push_back(subq_pred->left_expr,
+ thd->mem_root);
Item_func_eq *item_eq=
- new Item_func_eq(subq_pred->left_expr, subq_lex->ref_pointer_array[0]);
+ new (thd->mem_root) Item_func_eq(thd, subq_pred->left_expr,
+ subq_lex->ref_pointer_array[0]);
item_eq->in_equality_no= 0;
- sj_nest->sj_on_expr= and_items(sj_nest->sj_on_expr, item_eq);
+ sj_nest->sj_on_expr= and_items(thd, sj_nest->sj_on_expr, item_eq);
}
else
{
for (uint i= 0; i < subq_pred->left_expr->cols(); i++)
{
nested_join->sj_outer_expr_list.push_back(subq_pred->left_expr->
- element_index(i));
+ element_index(i),
+ thd->mem_root);
Item_func_eq *item_eq=
- new Item_func_eq(subq_pred->left_expr->element_index(i),
- subq_lex->ref_pointer_array[i]);
+ new (thd->mem_root)
+ Item_func_eq(thd, subq_pred->left_expr->element_index(i),
+ subq_lex->ref_pointer_array[i]);
item_eq->in_equality_no= i;
- sj_nest->sj_on_expr= and_items(sj_nest->sj_on_expr, item_eq);
+ sj_nest->sj_on_expr= and_items(thd, sj_nest->sj_on_expr, item_eq);
}
}
/*
@@ -1621,7 +1628,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
we have in here).
*/
if (!sj_nest->sj_on_expr->fixed &&
- sj_nest->sj_on_expr->fix_fields(parent_join->thd, &sj_nest->sj_on_expr))
+ sj_nest->sj_on_expr->fix_fields(thd, &sj_nest->sj_on_expr))
{
DBUG_RETURN(TRUE);
}
@@ -1643,11 +1650,11 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
/* Inject sj_on_expr into the parent's WHERE or ON */
if (emb_tbl_nest)
{
- emb_tbl_nest->on_expr= and_items(emb_tbl_nest->on_expr,
+ emb_tbl_nest->on_expr= and_items(thd, emb_tbl_nest->on_expr,
sj_nest->sj_on_expr);
emb_tbl_nest->on_expr->top_level_item();
if (!emb_tbl_nest->on_expr->fixed &&
- emb_tbl_nest->on_expr->fix_fields(parent_join->thd,
+ emb_tbl_nest->on_expr->fix_fields(thd,
&emb_tbl_nest->on_expr))
{
DBUG_RETURN(TRUE);
@@ -1656,7 +1663,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
else
{
/* Inject into the WHERE */
- parent_join->conds= and_items(parent_join->conds, sj_nest->sj_on_expr);
+ parent_join->conds= and_items(thd, parent_join->conds, sj_nest->sj_on_expr);
parent_join->conds->top_level_item();
/*
fix_fields must update the properties (e.g. st_select_lex::cond_count of
@@ -1665,7 +1672,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
save_lex= thd->lex->current_select;
thd->lex->current_select=parent_join->select_lex;
if (!parent_join->conds->fixed &&
- parent_join->conds->fix_fields(parent_join->thd,
+ parent_join->conds->fix_fields(thd,
&parent_join->conds))
{
DBUG_RETURN(1);
@@ -1679,7 +1686,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
Item_func_match *ifm;
List_iterator_fast<Item_func_match> li(*(subq_lex->ftfunc_list));
while ((ifm= li++))
- parent_lex->ftfunc_list->push_front(ifm);
+ parent_lex->ftfunc_list->push_front(ifm, thd->mem_root);
}
parent_lex->have_merged_subqueries= TRUE;
@@ -1721,16 +1728,16 @@ static bool convert_subq_to_jtbm(JOIN *parent_join,
List<TABLE_LIST> *emb_join_list= &parent_lex->top_join_list;
TABLE_LIST *emb_tbl_nest= NULL; // will change when we learn to handle outer joins
TABLE_LIST *tl;
- DBUG_ENTER("convert_subq_to_jtbm");
bool optimization_delayed= TRUE;
- subq_pred->set_strategy(SUBS_MATERIALIZATION);
+ TABLE_LIST *jtbm;
+ char *tbl_alias;
+ DBUG_ENTER("convert_subq_to_jtbm");
+ subq_pred->set_strategy(SUBS_MATERIALIZATION);
subq_pred->is_jtbm_merged= TRUE;
*remove_item= TRUE;
- TABLE_LIST *jtbm;
- char *tbl_alias;
if (!(tbl_alias= (char*)parent_join->thd->calloc(SUBQERY_TEMPTABLE_NAME_MAX_LEN)) ||
!(jtbm= alloc_join_nest(parent_join->thd))) //todo: this is not a join nest!
{
@@ -1744,13 +1751,13 @@ static bool convert_subq_to_jtbm(JOIN *parent_join,
/* Nests do not participate in those 'chains', so: */
/* jtbm->next_leaf= jtbm->next_local= jtbm->next_global == NULL*/
- emb_join_list->push_back(jtbm);
+ emb_join_list->push_back(jtbm, parent_join->thd->mem_root);
/*
Inject the jtbm table into TABLE_LIST::next_leaf list, so that
make_join_statistics() and co. can find it.
*/
- parent_lex->leaf_tables.push_back(jtbm);
+ parent_lex->leaf_tables.push_back(jtbm, parent_join->thd->mem_root);
if (subq_pred->unit->first_select()->options & OPTION_SCHEMA_TABLE)
parent_lex->options |= OPTION_SCHEMA_TABLE;
@@ -2071,7 +2078,7 @@ int pull_out_semijoin_tables(JOIN *join)
*/
child_li.remove();
sj_nest->nested_join->used_tables &= ~tbl->table->map;
- upper_join_list->push_back(tbl);
+ upper_join_list->push_back(tbl, join->thd->mem_root);
tbl->join_list= upper_join_list;
tbl->embedding= sj_nest->embedding;
}
@@ -3510,16 +3517,19 @@ void fix_semijoin_strategies_for_picked_join_order(JOIN *join)
bool setup_sj_materialization_part1(JOIN_TAB *sjm_tab)
{
- DBUG_ENTER("setup_sj_materialization");
JOIN_TAB *tab= sjm_tab->bush_children->start;
TABLE_LIST *emb_sj_nest= tab->table->pos_in_table_list->embedding;
+ SJ_MATERIALIZATION_INFO *sjm;
+ THD *thd;
+
+ DBUG_ENTER("setup_sj_materialization");
/* Walk out of outer join nests until we reach the semi-join nest we're in */
while (!emb_sj_nest->sj_mat_info)
emb_sj_nest= emb_sj_nest->embedding;
- SJ_MATERIALIZATION_INFO *sjm= emb_sj_nest->sj_mat_info;
- THD *thd= tab->join->thd;
+ sjm= emb_sj_nest->sj_mat_info;
+ thd= tab->join->thd;
/* First the calls come to the materialization function */
//List<Item> &item_list= emb_sj_nest->sj_subq_pred->unit->first_select()->item_list;
@@ -3535,8 +3545,8 @@ bool setup_sj_materialization_part1(JOIN_TAB *sjm_tab)
Item **p_end= p_item + subq_select->item_list.elements;
//while((right_expr= it++))
for(;p_item != p_end; p_item++)
- sjm->sjm_table_cols.push_back(*p_item);
-
+ sjm->sjm_table_cols.push_back(*p_item, thd->mem_root);
+
sjm->sjm_table_param.field_count= subq_select->item_list.elements;
sjm->sjm_table_param.force_not_null_cols= TRUE;
@@ -3552,8 +3562,8 @@ bool setup_sj_materialization_part1(JOIN_TAB *sjm_tab)
sjm->table->file->extra(HA_EXTRA_WRITE_CACHE);
sjm->table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
- tab->join->sj_tmp_tables.push_back(sjm->table);
- tab->join->sjm_info_list.push_back(sjm);
+ tab->join->sj_tmp_tables.push_back(sjm->table, thd->mem_root);
+ tab->join->sjm_info_list.push_back(sjm, thd->mem_root);
sjm->materialized= FALSE;
sjm_tab->table= sjm->table;
@@ -3650,9 +3660,9 @@ bool setup_sj_materialization_part2(JOIN_TAB *sjm_tab)
*/
for (i= 0; i < sjm->tables; i++)
{
- remove_sj_conds(&tab[i].select_cond);
+ remove_sj_conds(thd, &tab[i].select_cond);
if (tab[i].select)
- remove_sj_conds(&tab[i].select->cond);
+ remove_sj_conds(thd, &tab[i].select->cond);
}
if (!(sjm->in_equality= create_subq_in_equalities(thd, sjm,
emb_sj_nest->sj_subq_pred)))
@@ -3795,8 +3805,8 @@ static Item *create_subq_in_equalities(THD *thd, SJ_MATERIALIZATION_INFO *sjm,
Item *res= NULL;
if (subq_pred->left_expr->cols() == 1)
{
- if (!(res= new Item_func_eq(subq_pred->left_expr,
- new Item_field(sjm->table->field[0]))))
+ if (!(res= new (thd->mem_root) Item_func_eq(thd, subq_pred->left_expr,
+ new (thd->mem_root) Item_field(thd, sjm->table->field[0]))))
return NULL; /* purecov: inspected */
}
else
@@ -3804,9 +3814,9 @@ static Item *create_subq_in_equalities(THD *thd, SJ_MATERIALIZATION_INFO *sjm,
Item *conj;
for (uint i= 0; i < subq_pred->left_expr->cols(); i++)
{
- if (!(conj= new Item_func_eq(subq_pred->left_expr->element_index(i),
- new Item_field(sjm->table->field[i]))) ||
- !(res= and_items(res, conj)))
+ if (!(conj= new (thd->mem_root) Item_func_eq(thd, subq_pred->left_expr->element_index(i),
+ new (thd->mem_root) Item_field(thd, sjm->table->field[i]))) ||
+ !(res= and_items(thd, res, conj)))
return NULL; /* purecov: inspected */
}
}
@@ -3818,7 +3828,7 @@ static Item *create_subq_in_equalities(THD *thd, SJ_MATERIALIZATION_INFO *sjm,
-static void remove_sj_conds(Item **tree)
+static void remove_sj_conds(THD *thd, Item **tree)
{
if (*tree)
{
@@ -3834,7 +3844,7 @@ static void remove_sj_conds(Item **tree)
while ((item= li++))
{
if (is_cond_sj_in_equality(item))
- li.replace(new Item_int(1));
+ li.replace(new (thd->mem_root) Item_int(thd, 1));
}
}
}
@@ -4336,7 +4346,7 @@ int init_dups_weedout(JOIN *join, uint first_table, int first_fanout_table, uint
sjtbl->null_bytes= (jt_null_bits + 7)/8;
if (sjtbl->create_sj_weedout_tmp_table(thd))
DBUG_RETURN(TRUE);
- join->sj_tmp_tables.push_back(sjtbl->tmp_table);
+ join->sj_tmp_tables.push_back(sjtbl->tmp_table, thd->mem_root);
}
else
{
@@ -4361,6 +4371,74 @@ int init_dups_weedout(JOIN *join, uint first_table, int first_fanout_table, uint
/*
+ @brief
+ Set up semi-join Loose Scan strategy for execution
+
+ @detail
+ Other strategies are done in setup_semijoin_dups_elimination(),
+ however, we need to set up Loose Scan earlier, before make_join_select is
+ called. This is to prevent make_join_select() from switching full index
+ scans into quick selects (which will break Loose Scan access).
+
+ @return
+ 0 OK
+ 1 Error
+*/
+
+int setup_semijoin_loosescan(JOIN *join)
+{
+ uint i;
+ DBUG_ENTER("setup_semijoin_loosescan");
+
+ POSITION *pos= join->best_positions + join->const_tables;
+ for (i= join->const_tables ; i < join->top_join_tab_count; )
+ {
+ JOIN_TAB *tab=join->join_tab + i;
+ switch (pos->sj_strategy) {
+ case SJ_OPT_MATERIALIZE:
+ case SJ_OPT_MATERIALIZE_SCAN:
+ i+= 1; /* join tabs are embedded in the nest */
+ pos += pos->n_sj_tables;
+ break;
+ case SJ_OPT_LOOSE_SCAN:
+ {
+ /* We jump from the last table to the first one */
+ tab->loosescan_match_tab= tab + pos->n_sj_tables - 1;
+
+ /* LooseScan requires records to be produced in order */
+ if (tab->select && tab->select->quick)
+ tab->select->quick->need_sorted_output();
+
+ for (uint j= i; j < i + pos->n_sj_tables; j++)
+ join->join_tab[j].inside_loosescan_range= TRUE;
+
+ /* Calculate key length */
+ uint keylen= 0;
+ uint keyno= pos->loosescan_picker.loosescan_key;
+ for (uint kp=0; kp < pos->loosescan_picker.loosescan_parts; kp++)
+ keylen += tab->table->key_info[keyno].key_part[kp].store_length;
+
+ tab->loosescan_key= keyno;
+ tab->loosescan_key_len= keylen;
+ if (pos->n_sj_tables > 1)
+ tab[pos->n_sj_tables - 1].do_firstmatch= tab;
+ i+= pos->n_sj_tables;
+ pos+= pos->n_sj_tables;
+ break;
+ }
+ default:
+ {
+ i++;
+ pos++;
+ break;
+ }
+ }
+ }
+ DBUG_RETURN(FALSE);
+}
+
+
+/*
Setup the strategies to eliminate semi-join duplicates.
SYNOPSIS
@@ -4468,8 +4546,6 @@ int setup_semijoin_dups_elimination(JOIN *join, ulonglong options,
for (i= join->const_tables ; i < join->top_join_tab_count; )
{
JOIN_TAB *tab=join->join_tab + i;
- //POSITION *pos= join->best_positions + i;
- uint keylen, keyno;
switch (pos->sj_strategy) {
case SJ_OPT_MATERIALIZE:
case SJ_OPT_MATERIALIZE_SCAN:
@@ -4479,26 +4555,7 @@ int setup_semijoin_dups_elimination(JOIN *join, ulonglong options,
break;
case SJ_OPT_LOOSE_SCAN:
{
- /* We jump from the last table to the first one */
- tab->loosescan_match_tab= tab + pos->n_sj_tables - 1;
-
- /* LooseScan requires records to be produced in order */
- if (tab->select && tab->select->quick)
- tab->select->quick->need_sorted_output();
-
- for (uint j= i; j < i + pos->n_sj_tables; j++)
- join->join_tab[j].inside_loosescan_range= TRUE;
-
- /* Calculate key length */
- keylen= 0;
- keyno= pos->loosescan_picker.loosescan_key;
- for (uint kp=0; kp < pos->loosescan_picker.loosescan_parts; kp++)
- keylen += tab->table->key_info[keyno].key_part[kp].store_length;
-
- tab->loosescan_key= keyno;
- tab->loosescan_key_len= keylen;
- if (pos->n_sj_tables > 1)
- tab[pos->n_sj_tables - 1].do_firstmatch= tab;
+ /* Setup already handled by setup_semijoin_loosescan */
i+= pos->n_sj_tables;
pos+= pos->n_sj_tables;
break;
@@ -5100,13 +5157,14 @@ TABLE *create_dummy_tmp_table(THD *thd)
sjm_table_param.init();
sjm_table_param.field_count= 1;
List<Item> sjm_table_cols;
- Item *column_item= new Item_int(1);
- sjm_table_cols.push_back(column_item);
+ Item *column_item= new (thd->mem_root) Item_int(thd, 1);
+ sjm_table_cols.push_back(column_item, thd->mem_root);
if (!(table= create_tmp_table(thd, &sjm_table_param,
sjm_table_cols, (ORDER*) 0,
TRUE /* distinct */,
1, /*save_sum_fields*/
- thd->variables.option_bits | TMP_TABLE_ALL_COLUMNS,
+ thd->variables.option_bits |
+ TMP_TABLE_ALL_COLUMNS,
HA_POS_ERROR /*rows_limit */,
(char*)"dummy", TRUE /* Do not open */)))
{
@@ -5143,16 +5201,16 @@ int select_value_catcher::setup(List<Item> *items)
assigned= FALSE;
n_elements= items->elements;
- if (!(row= (Item_cache**) sql_alloc(sizeof(Item_cache*)*n_elements)))
+ if (!(row= (Item_cache**) thd->alloc(sizeof(Item_cache*) * n_elements)))
return TRUE;
Item *sel_item;
List_iterator<Item> li(*items);
for (uint i= 0; (sel_item= li++); i++)
{
- if (!(row[i]= Item_cache::get_cache(sel_item)))
+ if (!(row[i]= Item_cache::get_cache(thd, sel_item)))
return TRUE;
- row[i]->setup(sel_item);
+ row[i]->setup(thd, sel_item);
}
return FALSE;
}
@@ -5192,6 +5250,7 @@ bool setup_jtbm_semi_joins(JOIN *join, List<TABLE_LIST> *join_list,
TABLE_LIST *table;
NESTED_JOIN *nested_join;
List_iterator<TABLE_LIST> li(*join_list);
+ THD *thd= join->thd;
DBUG_ENTER("setup_jtbm_semi_joins");
while ((table= li++))
@@ -5240,7 +5299,7 @@ bool setup_jtbm_semi_joins(JOIN *join, List<TABLE_LIST> *join_list,
(subselect_single_select_engine*)subq_pred->engine;
select_value_catcher *new_sink;
if (!(new_sink=
- new (join->thd->mem_root) select_value_catcher(join->thd, subq_pred)))
+ new (thd->mem_root) select_value_catcher(thd, subq_pred)))
DBUG_RETURN(TRUE);
if (new_sink->setup(&engine->select_lex->join->fields_list) ||
engine->select_lex->join->change_result(new_sink, NULL) ||
@@ -5260,13 +5319,14 @@ bool setup_jtbm_semi_joins(JOIN *join, List<TABLE_LIST> *join_list,
Item *eq_cond;
for (uint i= 0; i < subq_pred->left_expr->cols(); i++)
{
- eq_cond= new Item_func_eq(subq_pred->left_expr->element_index(i),
- new_sink->row[i]);
+ eq_cond= new (thd->mem_root)
+ Item_func_eq(thd, subq_pred->left_expr->element_index(i),
+ new_sink->row[i]);
if (!eq_cond)
DBUG_RETURN(1);
- if (!((*join_where)= and_items(*join_where, eq_cond)) ||
- (*join_where)->fix_fields(join->thd, join_where))
+ if (!((*join_where)= and_items(thd, *join_where, eq_cond)) ||
+ (*join_where)->fix_fields(thd, join_where))
DBUG_RETURN(1);
}
}
@@ -5278,7 +5338,7 @@ bool setup_jtbm_semi_joins(JOIN *join, List<TABLE_LIST> *join_list,
/* Set up a dummy TABLE*, optimizer code needs JOIN_TABs to have TABLE */
TABLE *dummy_table;
- if (!(dummy_table= create_dummy_tmp_table(join->thd)))
+ if (!(dummy_table= create_dummy_tmp_table(thd)))
DBUG_RETURN(1);
table->table= dummy_table;
table->table->pos_in_table_list= table;
@@ -5304,9 +5364,9 @@ bool setup_jtbm_semi_joins(JOIN *join, List<TABLE_LIST> *join_list,
Item *sj_conds= hash_sj_engine->semi_join_conds;
- (*join_where)= and_items(*join_where, sj_conds);
+ (*join_where)= and_items(thd, *join_where, sj_conds);
if (!(*join_where)->fixed)
- (*join_where)->fix_fields(join->thd, join_where);
+ (*join_where)->fix_fields(thd, join_where);
}
table->table->maybe_null= MY_TEST(join->mixed_implicit_grouping);
}
@@ -5494,7 +5554,7 @@ bool JOIN::choose_subquery_plan(table_map join_tables)
unmodified, and with injected IN->EXISTS predicates.
*/
inner_read_time_1= inner_join->best_read;
- inner_record_count_1= inner_join->record_count;
+ inner_record_count_1= inner_join->join_record_count;
if (in_to_exists_where && const_tables != table_count)
{
diff --git a/sql/opt_subselect.h b/sql/opt_subselect.h
index 3da94d05521..8daa973f825 100644
--- a/sql/opt_subselect.h
+++ b/sql/opt_subselect.h
@@ -95,12 +95,13 @@ public:
bound_sj_equalities(0),
quick_uses_applicable_index(FALSE)
{
- UNINIT_VAR(quick_max_loose_keypart); /* Protected by quick_uses_applicable_index */
+ /* Protected by quick_uses_applicable_index */
+ LINT_INIT(quick_max_loose_keypart);
/* The following are protected by best_loose_scan_cost!= DBL_MAX */
- UNINIT_VAR(best_loose_scan_key);
- UNINIT_VAR(best_loose_scan_records);
- UNINIT_VAR(best_max_loose_keypart);
- UNINIT_VAR(best_loose_scan_start_key);
+ LINT_INIT(best_loose_scan_key);
+ LINT_INIT(best_loose_scan_records);
+ LINT_INIT(best_max_loose_keypart);
+ LINT_INIT(best_loose_scan_start_key);
}
void init(JOIN *join, JOIN_TAB *s, table_map remaining_tables)
@@ -122,7 +123,7 @@ public:
s->emb_sj_nest->sj_in_exprs < 64 &&
((remaining_tables & s->emb_sj_nest->sj_inner_tables) == // (2)
s->emb_sj_nest->sj_inner_tables) && // (2)
- join->cur_sj_inner_tables == 0 && // (3)
+ join->cur_sj_inner_tables == 0 && // (3)
!(remaining_tables &
s->emb_sj_nest->nested_join->sj_corr_tables) && // (4)
remaining_tables & s->emb_sj_nest->nested_join->sj_depends_on &&// (5)
@@ -194,8 +195,6 @@ public:
PREV_BITS(key_part_map, max_loose_keypart+1) && // (3)
!key_uses_partial_cols(s->table->s, key))
{
- /* Ok, can use the strategy */
- part1_conds_met= TRUE;
if (s->quick && s->quick->index == key &&
s->quick->get_type() == QUICK_SELECT_I::QS_TYPE_RANGE)
{
@@ -204,6 +203,12 @@ public:
}
DBUG_PRINT("info", ("Can use LooseScan scan"));
+ if (found_part & 1)
+ {
+ /* Can use LooseScan on ref access if the first key part is bound */
+ part1_conds_met= TRUE;
+ }
+
/*
Check if this is a special case where there are no usable bound
IN-equalities, i.e. we have
@@ -211,11 +216,13 @@ public:
outer_expr IN (SELECT innertbl.key FROM ...)
and outer_expr cannot be evaluated yet, so it's actually full
- index scan and not a ref access
+ index scan and not a ref access.
+ We can do full index scan if it uses index-only.
*/
if (!(found_part & 1 ) && /* no usable ref access for 1st key part */
s->table->covering_keys.is_set(key))
{
+ part1_conds_met= TRUE;
DBUG_PRINT("info", ("Can use full index scan for LooseScan"));
/* Calculate the cost of complete loose index scan. */
@@ -383,6 +390,7 @@ public:
bool create_sj_weedout_tmp_table(THD *thd);
};
+int setup_semijoin_loosescan(JOIN *join);
int setup_semijoin_dups_elimination(JOIN *join, ulonglong options,
uint no_jbuf_after);
void destroy_sj_tmp_tables(JOIN *join);
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index fc3ce09dd8e..7a6685914a9 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -578,7 +578,7 @@ bool simple_pred(Item_func *func_item, Item **args, bool *inv_order)
if (!item->const_item())
return 0;
args[i]= item;
- if (check_item1_shorter_item2(args[0], args[1]))
+ if (check_item1_shorter_item2(args[0], args[i]))
return 0;
}
}
diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc
index f6e3b619f51..912ef4a7df7 100644
--- a/sql/opt_table_elimination.cc
+++ b/sql/opt_table_elimination.cc
@@ -529,12 +529,13 @@ bool check_func_dependency(JOIN *join,
TABLE_LIST *oj_tbl,
Item* cond);
static
-void build_eq_mods_for_cond(Dep_analysis_context *dac,
+void build_eq_mods_for_cond(THD *thd, Dep_analysis_context *dac,
Dep_module_expr **eq_mod, uint *and_level,
Item *cond);
static
void check_equality(Dep_analysis_context *dac, Dep_module_expr **eq_mod,
- uint and_level, Item_func *cond, Item *left, Item *right);
+ uint and_level, Item_bool_func *cond,
+ Item *left, Item *right);
static
Dep_module_expr *merge_eq_mods(Dep_module_expr *start,
Dep_module_expr *new_fields,
@@ -846,7 +847,7 @@ bool check_func_dependency(JOIN *join,
Dep_value_field objects for the used fields.
*/
uint and_level=0;
- build_eq_mods_for_cond(&dac, &last_eq_mod, &and_level, cond);
+ build_eq_mods_for_cond(join->thd, &dac, &last_eq_mod, &and_level, cond);
if (!(dac.n_equality_mods= last_eq_mod - dac.equality_mods))
return FALSE; /* No useful conditions */
@@ -1017,6 +1018,7 @@ public:
bool Dep_analysis_context::setup_equality_modules_deps(List<Dep_module>
*bound_modules)
{
+ THD *thd= current_thd;
DBUG_ENTER("setup_equality_modules_deps");
/*
@@ -1041,7 +1043,7 @@ bool Dep_analysis_context::setup_equality_modules_deps(List<Dep_module>
}
void *buf;
- if (!(buf= current_thd->alloc(bitmap_buffer_size(offset))) ||
+ if (!(buf= thd->alloc(bitmap_buffer_size(offset))) ||
my_bitmap_init(&expr_deps, (my_bitmap_map*)buf, offset, FALSE))
{
DBUG_RETURN(TRUE); /* purecov: inspected */
@@ -1083,7 +1085,7 @@ bool Dep_analysis_context::setup_equality_modules_deps(List<Dep_module>
}
if (!eq_mod->unbound_args)
- bound_modules->push_back(eq_mod);
+ bound_modules->push_back(eq_mod, thd->mem_root);
}
DBUG_RETURN(FALSE);
@@ -1149,7 +1151,7 @@ int compare_field_values(Dep_value_field *a, Dep_value_field *b, void *unused)
*/
static
-void build_eq_mods_for_cond(Dep_analysis_context *ctx,
+void build_eq_mods_for_cond(THD *thd, Dep_analysis_context *ctx,
Dep_module_expr **eq_mod,
uint *and_level, Item *cond)
{
@@ -1163,7 +1165,7 @@ void build_eq_mods_for_cond(Dep_analysis_context *ctx,
{
Item *item;
while ((item=li++))
- build_eq_mods_for_cond(ctx, eq_mod, and_level, item);
+ build_eq_mods_for_cond(thd, ctx, eq_mod, and_level, item);
for (Dep_module_expr *mod_exp= ctx->equality_mods + orig_offset;
mod_exp != *eq_mod ; mod_exp++)
@@ -1175,12 +1177,12 @@ void build_eq_mods_for_cond(Dep_analysis_context *ctx,
{
Item *item;
(*and_level)++;
- build_eq_mods_for_cond(ctx, eq_mod, and_level, li++);
+ build_eq_mods_for_cond(thd, ctx, eq_mod, and_level, li++);
while ((item=li++))
{
Dep_module_expr *start_key_fields= *eq_mod;
(*and_level)++;
- build_eq_mods_for_cond(ctx, eq_mod, and_level, item);
+ build_eq_mods_for_cond(thd, ctx, eq_mod, and_level, item);
*eq_mod= merge_eq_mods(ctx->equality_mods + orig_offset,
start_key_fields, *eq_mod,
++(*and_level));
@@ -1199,27 +1201,30 @@ void build_eq_mods_for_cond(Dep_analysis_context *ctx,
case Item_func::BETWEEN:
{
Item *fld;
- if (!((Item_func_between*)cond)->negated &&
+ Item_func_between *func= (Item_func_between *) cond_func;
+ if (!func->negated &&
(fld= args[0]->real_item())->type() == Item::FIELD_ITEM &&
args[1]->eq(args[2], ((Item_field*)fld)->field->binary()))
{
- check_equality(ctx, eq_mod, *and_level, cond_func, args[0], args[1]);
- check_equality(ctx, eq_mod, *and_level, cond_func, args[1], args[0]);
+ check_equality(ctx, eq_mod, *and_level, func, args[0], args[1]);
+ check_equality(ctx, eq_mod, *and_level, func, args[1], args[0]);
}
break;
}
case Item_func::EQ_FUNC:
case Item_func::EQUAL_FUNC:
{
- check_equality(ctx, eq_mod, *and_level, cond_func, args[0], args[1]);
- check_equality(ctx, eq_mod, *and_level, cond_func, args[1], args[0]);
+ Item_bool_rowready_func2 *func= (Item_bool_rowready_func2*) cond_func;
+ check_equality(ctx, eq_mod, *and_level, func, args[0], args[1]);
+ check_equality(ctx, eq_mod, *and_level, func, args[1], args[0]);
break;
}
case Item_func::ISNULL_FUNC:
{
- Item *tmp=new Item_null;
+ Item *tmp=new (thd->mem_root) Item_null(thd);
if (tmp)
- check_equality(ctx, eq_mod, *and_level, cond_func, args[0], tmp);
+ check_equality(ctx, eq_mod, *and_level,
+ (Item_func_isnull*) cond_func, args[0], tmp);
break;
}
case Item_func::MULT_EQUAL_FUNC:
@@ -1251,7 +1256,7 @@ void build_eq_mods_for_cond(Dep_analysis_context *ctx,
{
Dep_value_field *field_val;
if ((field_val= ctx->get_field_value(equal_field)))
- fvl->push_back(field_val);
+ fvl->push_back(field_val, thd->mem_root);
}
else
{
@@ -1479,7 +1484,8 @@ Dep_module_expr *merge_eq_mods(Dep_module_expr *start,
static
void check_equality(Dep_analysis_context *ctx, Dep_module_expr **eq_mod,
- uint and_level, Item_func *cond, Item *left, Item *right)
+ uint and_level, Item_bool_func *cond,
+ Item *left, Item *right)
{
if ((left->used_tables() & ctx->usable_tables) &&
!(right->used_tables() & RAND_TABLE_BIT) &&
diff --git a/sql/parse_file.cc b/sql/parse_file.cc
index 14c32eb09c6..f3dab4f7b2f 100644
--- a/sql/parse_file.cc
+++ b/sql/parse_file.cc
@@ -59,27 +59,27 @@ write_escaped_string(IO_CACHE *file, LEX_STRING *val_s)
*/
switch(*ptr) {
case '\\': // escape character
- if (my_b_append(file, (const uchar *)STRING_WITH_LEN("\\\\")))
+ if (my_b_write(file, (const uchar *)STRING_WITH_LEN("\\\\")))
return TRUE;
break;
case '\n': // parameter value delimiter
- if (my_b_append(file, (const uchar *)STRING_WITH_LEN("\\n")))
+ if (my_b_write(file, (const uchar *)STRING_WITH_LEN("\\n")))
return TRUE;
break;
case '\0': // problem for some string processing utilities
- if (my_b_append(file, (const uchar *)STRING_WITH_LEN("\\0")))
+ if (my_b_write(file, (const uchar *)STRING_WITH_LEN("\\0")))
return TRUE;
break;
case 26: // problem for windows utilities (Ctrl-Z)
- if (my_b_append(file, (const uchar *)STRING_WITH_LEN("\\z")))
+ if (my_b_write(file, (const uchar *)STRING_WITH_LEN("\\z")))
return TRUE;
break;
case '\'': // list of string delimiter
- if (my_b_append(file, (const uchar *)STRING_WITH_LEN("\\\'")))
+ if (my_b_write(file, (const uchar *)STRING_WITH_LEN("\\\'")))
return TRUE;
break;
default:
- if (my_b_append(file, (const uchar *)ptr, 1))
+ if (my_b_write(file, (const uchar *)ptr, 1))
return TRUE;
}
}
@@ -147,7 +147,7 @@ write_parameter(IO_CACHE *file, uchar* base, File_option *parameter)
case FILE_OPTIONS_STRING:
{
LEX_STRING *val_s= (LEX_STRING *)(base + parameter->offset);
- if (my_b_append(file, (const uchar *)val_s->str, val_s->length))
+ if (my_b_write(file, (const uchar *)val_s->str, val_s->length))
DBUG_RETURN(TRUE);
break;
}
@@ -166,7 +166,7 @@ write_parameter(IO_CACHE *file, uchar* base, File_option *parameter)
val= view_algo_to_frm(val);
num.set(val, &my_charset_bin);
- if (my_b_append(file, (const uchar *)num.ptr(), num.length()))
+ if (my_b_write(file, (const uchar *)num.ptr(), num.length()))
DBUG_RETURN(TRUE);
break;
}
@@ -179,7 +179,7 @@ write_parameter(IO_CACHE *file, uchar* base, File_option *parameter)
get_date(val_s->str, GETDATE_DATE_TIME|GETDATE_GMT|GETDATE_FIXEDLENGTH,
tm);
val_s->length= PARSE_FILE_TIMESTAMPLENGTH;
- if (my_b_append(file, (const uchar *)val_s->str,
+ if (my_b_write(file, (const uchar *)val_s->str,
PARSE_FILE_TIMESTAMPLENGTH))
DBUG_RETURN(TRUE);
break;
@@ -193,10 +193,10 @@ write_parameter(IO_CACHE *file, uchar* base, File_option *parameter)
while ((str= it++))
{
// We need ' ' after string to detect list continuation
- if ((!first && my_b_append(file, (const uchar *)STRING_WITH_LEN(" "))) ||
- my_b_append(file, (const uchar *)STRING_WITH_LEN("\'")) ||
+ if ((!first && my_b_write(file, (const uchar *)STRING_WITH_LEN(" "))) ||
+ my_b_write(file, (const uchar *)STRING_WITH_LEN("\'")) ||
write_escaped_string(file, str) ||
- my_b_append(file, (const uchar *)STRING_WITH_LEN("\'")))
+ my_b_write(file, (const uchar *)STRING_WITH_LEN("\'")))
{
DBUG_RETURN(TRUE);
}
@@ -214,8 +214,8 @@ write_parameter(IO_CACHE *file, uchar* base, File_option *parameter)
{
num.set(*val, &my_charset_bin);
// We need ' ' after string to detect list continuation
- if ((!first && my_b_append(file, (const uchar *)STRING_WITH_LEN(" "))) ||
- my_b_append(file, (const uchar *)num.ptr(), num.length()))
+ if ((!first && my_b_write(file, (const uchar *)STRING_WITH_LEN(" "))) ||
+ my_b_write(file, (const uchar *)num.ptr(), num.length()))
{
DBUG_RETURN(TRUE);
}
@@ -287,23 +287,23 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
DBUG_RETURN(TRUE);
}
- if (init_io_cache(&file, handler, 0, SEQ_READ_APPEND, 0L, 0, MYF(MY_WME)))
+ if (init_io_cache(&file, handler, 0, WRITE_CACHE, 0L, 0, MYF(MY_WME)))
goto err_w_file;
// write header (file signature)
- if (my_b_append(&file, (const uchar *)STRING_WITH_LEN("TYPE=")) ||
- my_b_append(&file, (const uchar *)type->str, type->length) ||
- my_b_append(&file, (const uchar *)STRING_WITH_LEN("\n")))
+ if (my_b_write(&file, (const uchar *)STRING_WITH_LEN("TYPE=")) ||
+ my_b_write(&file, (const uchar *)type->str, type->length) ||
+ my_b_write(&file, (const uchar *)STRING_WITH_LEN("\n")))
goto err_w_cache;
// write parameters to temporary file
for (param= parameters; param->name.str; param++)
{
- if (my_b_append(&file, (const uchar *)param->name.str,
+ if (my_b_write(&file, (const uchar *)param->name.str,
param->name.length) ||
- my_b_append(&file, (const uchar *)STRING_WITH_LEN("=")) ||
+ my_b_write(&file, (const uchar *)STRING_WITH_LEN("=")) ||
write_parameter(&file, base, param) ||
- my_b_append(&file, (const uchar *)STRING_WITH_LEN("\n")))
+ my_b_write(&file, (const uchar *)STRING_WITH_LEN("\n")))
goto err_w_cache;
}
@@ -667,7 +667,8 @@ parse_quoted_escaped_string(const char *ptr, const char *end,
@param[in] mem_root MEM_ROOT for parameters allocation
*/
-bool get_file_options_ulllist(const char *&ptr, const char *end, const char *line,
+bool get_file_options_ulllist(const char *&ptr, const char *end,
+ const char *line,
uchar* base, File_option *parameter,
MEM_ROOT *mem_root)
{
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 0d26563d45e..f16ed0e879e 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -34,14 +34,16 @@
#include "ha_partition.h"
-partition_info *partition_info::get_clone()
+partition_info *partition_info::get_clone(THD *thd)
{
+ MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("partition_info::get_clone");
+
if (!this)
DBUG_RETURN(NULL);
List_iterator<partition_element> part_it(partitions);
partition_element *part;
- partition_info *clone= new partition_info();
+ partition_info *clone= new (mem_root) partition_info();
if (!clone)
{
mem_alloc_error(sizeof(partition_info));
@@ -57,7 +59,7 @@ partition_info *partition_info::get_clone()
{
List_iterator<partition_element> subpart_it(part->subpartitions);
partition_element *subpart;
- partition_element *part_clone= new partition_element();
+ partition_element *part_clone= new (mem_root) partition_element();
if (!part_clone)
{
mem_alloc_error(sizeof(partition_element));
@@ -74,9 +76,9 @@ partition_info *partition_info::get_clone()
DBUG_RETURN(NULL);
}
memcpy(subpart_clone, subpart, sizeof(partition_element));
- part_clone->subpartitions.push_back(subpart_clone);
+ part_clone->subpartitions.push_back(subpart_clone, mem_root);
}
- clone->partitions.push_back(part_clone);
+ clone->partitions.push_back(part_clone, mem_root);
}
DBUG_RETURN(clone);
}
@@ -1220,8 +1222,8 @@ bool partition_info::check_range_constants(THD *thd)
part_column_list_val *UNINIT_VAR(current_largest_col_val);
uint num_column_values= part_field_list.elements;
uint size_entries= sizeof(part_column_list_val) * num_column_values;
- range_col_array= (part_column_list_val*)sql_calloc(num_parts *
- size_entries);
+ range_col_array= (part_column_list_val*) thd->calloc(num_parts *
+ size_entries);
if (unlikely(range_col_array == NULL))
{
mem_alloc_error(num_parts * size_entries);
@@ -1258,7 +1260,7 @@ bool partition_info::check_range_constants(THD *thd)
longlong part_range_value;
bool signed_flag= !part_expr->unsigned_flag;
- range_int_array= (longlong*)sql_alloc(num_parts * sizeof(longlong));
+ range_int_array= (longlong*) thd->alloc(num_parts * sizeof(longlong));
if (unlikely(range_int_array == NULL))
{
mem_alloc_error(num_parts * sizeof(longlong));
@@ -1472,7 +1474,7 @@ bool partition_info::check_list_constants(THD *thd)
size_entries= column_list ?
(num_column_values * sizeof(part_column_list_val)) :
sizeof(LIST_PART_ENTRY);
- ptr= sql_calloc((num_list_values+1) * size_entries);
+ ptr= thd->calloc((num_list_values+1) * size_entries);
if (unlikely(ptr == NULL))
{
mem_alloc_error(num_list_values * size_entries);
@@ -1572,11 +1574,13 @@ static void warn_if_dir_in_part_elem(THD *thd, partition_element *part_elem)
{
if (part_elem->data_file_name)
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
+ WARN_OPTION_IGNORED,
+ ER_THD(thd, WARN_OPTION_IGNORED),
"DATA DIRECTORY");
if (part_elem->index_file_name)
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
+ WARN_OPTION_IGNORED,
+ ER_THD(thd, WARN_OPTION_IGNORED),
"INDEX DIRECTORY");
part_elem->data_file_name= part_elem->index_file_name= NULL;
}
@@ -1849,16 +1853,17 @@ void partition_info::print_no_partition_found(TABLE *table_arg, myf errflag)
char buf[100];
char *buf_ptr= (char*)&buf;
TABLE_LIST table_list;
+ THD *thd= current_thd;
bzero(&table_list, sizeof(table_list));
table_list.db= table_arg->s->db.str;
table_list.table_name= table_arg->s->table_name.str;
- if (check_single_table_access(current_thd,
+ if (check_single_table_access(thd,
SELECT_ACL, &table_list, TRUE))
{
my_message(ER_NO_PARTITION_FOR_GIVEN_VALUE,
- ER(ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT), errflag);
+ ER_THD(thd, ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT), errflag);
}
else
{
@@ -1967,7 +1972,7 @@ bool partition_info::check_partition_field_length()
the binary collation.
*/
-bool partition_info::set_up_charset_field_preps()
+bool partition_info::set_up_charset_field_preps(THD *thd)
{
Field *field, **ptr;
uchar **char_ptrs;
@@ -1993,14 +1998,14 @@ bool partition_info::set_up_charset_field_preps()
}
}
size= tot_part_fields * sizeof(char*);
- if (!(char_ptrs= (uchar**)sql_calloc(size)))
+ if (!(char_ptrs= (uchar**)thd->calloc(size)))
goto error;
part_field_buffers= char_ptrs;
- if (!(char_ptrs= (uchar**)sql_calloc(size)))
+ if (!(char_ptrs= (uchar**)thd->calloc(size)))
goto error;
restore_part_field_ptrs= char_ptrs;
size= (tot_part_fields + 1) * sizeof(Field*);
- if (!(char_ptrs= (uchar**)sql_alloc(size)))
+ if (!(char_ptrs= (uchar**)thd->alloc(size)))
goto error;
part_charset_field_array= (Field**)char_ptrs;
ptr= part_field_array;
@@ -2011,7 +2016,7 @@ bool partition_info::set_up_charset_field_preps()
{
uchar *field_buf;
size= field->pack_length();
- if (!(field_buf= (uchar*) sql_calloc(size)))
+ if (!(field_buf= (uchar*) thd->calloc(size)))
goto error;
part_charset_field_array[i]= field;
part_field_buffers[i++]= field_buf;
@@ -2033,14 +2038,14 @@ bool partition_info::set_up_charset_field_preps()
}
}
size= tot_subpart_fields * sizeof(char*);
- if (!(char_ptrs= (uchar**) sql_calloc(size)))
+ if (!(char_ptrs= (uchar**) thd->calloc(size)))
goto error;
subpart_field_buffers= char_ptrs;
- if (!(char_ptrs= (uchar**) sql_calloc(size)))
+ if (!(char_ptrs= (uchar**) thd->calloc(size)))
goto error;
restore_subpart_field_ptrs= char_ptrs;
size= (tot_subpart_fields + 1) * sizeof(Field*);
- if (!(char_ptrs= (uchar**) sql_alloc(size)))
+ if (!(char_ptrs= (uchar**) thd->alloc(size)))
goto error;
subpart_charset_field_array= (Field**)char_ptrs;
ptr= subpart_field_array;
@@ -2052,7 +2057,7 @@ bool partition_info::set_up_charset_field_preps()
if (!field_is_partition_charset(field))
continue;
size= field->pack_length();
- if (!(field_buf= (uchar*) sql_calloc(size)))
+ if (!(field_buf= (uchar*) thd->calloc(size)))
goto error;
subpart_charset_field_array[i]= field;
subpart_field_buffers[i++]= field_buf;
@@ -2233,12 +2238,12 @@ bool partition_info::is_full_part_expr_in_fields(List<Item> &fields)
FALSE Success
*/
-int partition_info::add_max_value()
+int partition_info::add_max_value(THD *thd)
{
DBUG_ENTER("partition_info::add_max_value");
part_column_list_val *col_val;
- if (!(col_val= add_column_value()))
+ if (!(col_val= add_column_value(thd)))
{
DBUG_RETURN(TRUE);
}
@@ -2258,7 +2263,7 @@ int partition_info::add_max_value()
0 Memory allocation failure
*/
-part_column_list_val *partition_info::add_column_value()
+part_column_list_val *partition_info::add_column_value(THD *thd)
{
uint max_val= num_columns ? num_columns : MAX_REF_PARTS;
DBUG_ENTER("add_column_value");
@@ -2280,9 +2285,9 @@ part_column_list_val *partition_info::add_column_value()
into the structure used for 1 column. After this we call
ourselves recursively which should always succeed.
*/
- if (!reorganize_into_single_field_col_val())
+ if (!reorganize_into_single_field_col_val(thd))
{
- DBUG_RETURN(add_column_value());
+ DBUG_RETURN(add_column_value(thd));
}
DBUG_RETURN(NULL);
}
@@ -2363,7 +2368,7 @@ bool partition_info::add_column_list_value(THD *thd, Item *item)
if (part_type == LIST_PARTITION &&
num_columns == 1U)
{
- if (init_column_part())
+ if (init_column_part(thd))
{
DBUG_RETURN(TRUE);
}
@@ -2392,7 +2397,7 @@ bool partition_info::add_column_list_value(THD *thd, Item *item)
}
thd->where= save_where;
- if (!(col_val= add_column_value()))
+ if (!(col_val= add_column_value(thd)))
{
DBUG_RETURN(TRUE);
}
@@ -2413,7 +2418,7 @@ bool partition_info::add_column_list_value(THD *thd, Item *item)
TRUE Failure
FALSE Success
*/
-bool partition_info::init_column_part()
+bool partition_info::init_column_part(THD *thd)
{
partition_element *p_elem= curr_part_elem;
part_column_list_val *col_val_array;
@@ -2422,8 +2427,8 @@ bool partition_info::init_column_part()
DBUG_ENTER("partition_info::init_column_part");
if (!(list_val=
- (part_elem_value*)sql_calloc(sizeof(part_elem_value))) ||
- p_elem->list_val_list.push_back(list_val))
+ (part_elem_value*) thd->calloc(sizeof(part_elem_value))) ||
+ p_elem->list_val_list.push_back(list_val, thd->mem_root))
{
mem_alloc_error(sizeof(part_elem_value));
DBUG_RETURN(TRUE);
@@ -2433,8 +2438,8 @@ bool partition_info::init_column_part()
else
loc_num_columns= MAX_REF_PARTS;
if (!(col_val_array=
- (part_column_list_val*)sql_calloc(loc_num_columns *
- sizeof(part_column_list_val))))
+ (part_column_list_val*) thd->calloc(loc_num_columns *
+ sizeof(part_column_list_val))))
{
mem_alloc_error(loc_num_columns * sizeof(part_elem_value));
DBUG_RETURN(TRUE);
@@ -2467,7 +2472,8 @@ bool partition_info::init_column_part()
TRUE Failure
FALSE Success
*/
-int partition_info::reorganize_into_single_field_col_val()
+
+int partition_info::reorganize_into_single_field_col_val(THD *thd)
{
part_column_list_val *col_val, *new_col_val;
part_elem_value *val= curr_list_val;
@@ -2483,11 +2489,11 @@ int partition_info::reorganize_into_single_field_col_val()
{
col_val= &val->col_val_array[i];
DBUG_ASSERT(part_type == LIST_PARTITION);
- if (init_column_part())
+ if (init_column_part(thd))
{
DBUG_RETURN(TRUE);
}
- if (!(new_col_val= add_column_value()))
+ if (!(new_col_val= add_column_value(thd)))
{
DBUG_RETURN(TRUE);
}
@@ -2680,14 +2686,13 @@ bool partition_info::fix_column_value_functions(THD *thd,
}
thd->got_warning= save_got_warning;
thd->variables.sql_mode= save_sql_mode;
- if (!(val_ptr= (uchar*) sql_calloc(len)))
+ if (!(val_ptr= (uchar*) thd->memdup(field->ptr, len)))
{
mem_alloc_error(len);
result= TRUE;
goto end;
}
col_val->column_value= val_ptr;
- memcpy(val_ptr, field->ptr, len);
}
}
col_val->fixed= 2;
@@ -3100,7 +3105,7 @@ void partition_info::print_debug(const char *str, uint *value)
remove code parts using ifdef, but the code parts cannot be called
so we simply need to add empty functions to make the linker happy.
*/
-part_column_list_val *partition_info::add_column_value()
+part_column_list_val *partition_info::add_column_value(THD *thd)
{
return NULL;
}
@@ -3115,12 +3120,12 @@ bool partition_info::set_part_expr(char *start_token, Item *item_ptr,
return FALSE;
}
-int partition_info::reorganize_into_single_field_col_val()
+int partition_info::reorganize_into_single_field_col_val(THD *thd)
{
return 0;
}
-bool partition_info::init_column_part()
+bool partition_info::init_column_part(THD *thd)
{
return FALSE;
}
@@ -3129,7 +3134,7 @@ bool partition_info::add_column_list_value(THD *thd, Item *item)
{
return FALSE;
}
-int partition_info::add_max_value()
+int partition_info::add_max_value(THD *thd)
{
return 0;
}
diff --git a/sql/partition_info.h b/sql/partition_info.h
index 8ad7b1fd1fd..df7010b2ab3 100644
--- a/sql/partition_info.h
+++ b/sql/partition_info.h
@@ -292,7 +292,7 @@ public:
}
~partition_info() {}
- partition_info *get_clone();
+ partition_info *get_clone(THD *thd);
bool set_named_partition_bitmap(const char *part_name, uint length);
bool set_partition_bitmaps(TABLE_LIST *table_list);
/* Answers the question if subpartitioning is used for a certain table */
@@ -328,16 +328,16 @@ public:
part_elem_value *val,
uint part_id);
bool fix_parser_data(THD *thd);
- int add_max_value();
+ int add_max_value(THD *thd);
void init_col_val(part_column_list_val *col_val, Item *item);
- int reorganize_into_single_field_col_val();
- part_column_list_val *add_column_value();
+ int reorganize_into_single_field_col_val(THD *thd);
+ part_column_list_val *add_column_value(THD *thd);
bool set_part_expr(char *start_token, Item *item_ptr,
char *end_token, bool is_subpart);
static int compare_column_values(const void *a, const void *b);
- bool set_up_charset_field_preps();
+ bool set_up_charset_field_preps(THD *thd);
bool check_partition_field_length();
- bool init_column_part();
+ bool init_column_part(THD *thd);
bool add_column_list_value(THD *thd, Item *item);
void set_show_version_string(String *packet);
partition_element *get_part_elem(const char *partition_name,
diff --git a/sql/procedure.h b/sql/procedure.h
index 6870b97de57..a46e8cfc137 100644
--- a/sql/procedure.h
+++ b/sql/procedure.h
@@ -38,7 +38,7 @@
class Item_proc :public Item
{
public:
- Item_proc(const char *name_par): Item()
+ Item_proc(THD *thd, const char *name_par): Item(thd)
{
this->name=(char*) name_par;
}
@@ -63,7 +63,8 @@ class Item_proc_real :public Item_proc
{
double value;
public:
- Item_proc_real(const char *name_par,uint dec) : Item_proc(name_par)
+ Item_proc_real(THD *thd, const char *name_par, uint dec):
+ Item_proc(thd, name_par)
{
decimals=dec; max_length=float_length(dec);
}
@@ -92,7 +93,7 @@ class Item_proc_int :public Item_proc
{
longlong value;
public:
- Item_proc_int(const char *name_par) :Item_proc(name_par)
+ Item_proc_int(THD *thd, const char *name_par): Item_proc(thd, name_par)
{ max_length=11; }
enum Item_result result_type () const { return INT_RESULT; }
enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; }
@@ -111,8 +112,8 @@ public:
class Item_proc_string :public Item_proc
{
public:
- Item_proc_string(const char *name_par,uint length) :Item_proc(name_par)
- { this->max_length=length; }
+ Item_proc_string(THD *thd, const char *name_par, uint length):
+ Item_proc(thd, name_par) { this->max_length=length; }
enum Item_result result_type () const { return STRING_RESULT; }
enum_field_types field_type() const { return MYSQL_TYPE_VARCHAR; }
void set(double nr) { str_value.set_real(nr, 2, default_charset()); }
@@ -156,7 +157,7 @@ public:
virtual void add(void)=0;
virtual void end_group(void)=0;
virtual int send_row(List<Item> &fields)=0;
- virtual bool change_columns(List<Item> &fields)=0;
+ virtual bool change_columns(THD *thd, List<Item> &fields)= 0;
virtual void update_refs(void) {}
virtual int end_of_records() { return 0; }
};
diff --git a/sql/protocol.cc b/sql/protocol.cc
index 5970568b66c..249dd73e2df 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -868,7 +868,7 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
DBUG_RETURN(prepare_for_send(list->elements));
err:
- my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES),
+ my_message(ER_OUT_OF_RESOURCES, ER_THD(thd, ER_OUT_OF_RESOURCES),
MYF(0)); /* purecov: inspected */
DBUG_RETURN(1); /* purecov: inspected */
}
@@ -1248,7 +1248,7 @@ bool Protocol_text::send_out_parameters(List<Item_param> *sp_params)
continue; // It's an IN-parameter.
Item_func_set_user_var *suv=
- new Item_func_set_user_var(*user_var_name, item_param);
+ new (thd->mem_root) Item_func_set_user_var(thd, *user_var_name, item_param);
/*
Item_func_set_user_var is not fixed after construction, call
fix_fields().
@@ -1520,7 +1520,7 @@ bool Protocol_binary::send_out_parameters(List<Item_param> *sp_params)
if (!item_param->get_out_param_info())
continue; // It's an IN-parameter.
- if (out_param_lst.push_back(item_param))
+ if (out_param_lst.push_back(item_param, thd->mem_root))
return TRUE;
}
}
diff --git a/sql/protocol.h b/sql/protocol.h
index 048db940804..329bb0f9c46 100644
--- a/sql/protocol.h
+++ b/sql/protocol.h
@@ -139,6 +139,10 @@ public:
virtual enum enum_protocol_type type()= 0;
void end_statement();
+
+ friend int send_answer_1(Protocol *protocol, String *s1, String *s2,
+ String *s3);
+ friend int send_header_2(Protocol *protocol, bool for_category);
};
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index 3c99becf304..4cf7df5227f 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -230,19 +230,29 @@ bool show_slave_hosts(THD* thd)
{
List<Item> field_list;
Protocol *protocol= thd->protocol;
+ MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("show_slave_hosts");
- field_list.push_back(new Item_return_int("Server_id", 10,
- MYSQL_TYPE_LONG));
- field_list.push_back(new Item_empty_string("Host", 20));
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Server_id", 10,
+ MYSQL_TYPE_LONG),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Host", 20),
+ thd->mem_root);
if (opt_show_slave_auth_info)
{
- field_list.push_back(new Item_empty_string("User",20));
- field_list.push_back(new Item_empty_string("Password",20));
+ field_list.push_back(new (mem_root) Item_empty_string(thd, "User", 20),
+ thd->mem_root);
+ field_list.push_back(new (mem_root) Item_empty_string(thd, "Password", 20),
+ thd->mem_root);
}
- field_list.push_back(new Item_return_int("Port", 7, MYSQL_TYPE_LONG));
- field_list.push_back(new Item_return_int("Master_id", 10,
- MYSQL_TYPE_LONG));
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Port", 7, MYSQL_TYPE_LONG),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Master_id", 10, MYSQL_TYPE_LONG),
+ thd->mem_root);
if (protocol->send_result_set_metadata(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
diff --git a/sql/rpl_constants.h b/sql/rpl_constants.h
index cc6fb8145ad..0a7fde439dd 100644
--- a/sql/rpl_constants.h
+++ b/sql/rpl_constants.h
@@ -17,6 +17,9 @@
#ifndef RPL_CONSTANTS_H
#define RPL_CONSTANTS_H
+#include <my_sys.h>
+#include <my_crypt.h>
+
/**
Enumeration of the incidents that can occur for the server.
*/
@@ -69,4 +72,41 @@ enum ExtraRowInfoFormat {
#define EXTRA_ROW_INFO_HDR_BYTES 2
#define EXTRA_ROW_INFO_MAX_PAYLOAD (255 - EXTRA_ROW_INFO_HDR_BYTES)
+enum enum_binlog_checksum_alg {
+ BINLOG_CHECKSUM_ALG_OFF= 0, // Events are without checksum though its generator
+ // is checksum-capable New Master (NM).
+ BINLOG_CHECKSUM_ALG_CRC32= 1, // CRC32 of zlib algorithm.
+ BINLOG_CHECKSUM_ALG_ENUM_END, // the cut line: valid alg range is [1, 0x7f].
+ BINLOG_CHECKSUM_ALG_UNDEF= 255 // special value to tag undetermined yet checksum
+ // or events from checksum-unaware servers
+};
+
+#define BINLOG_CRYPTO_SCHEME_LENGTH 1
+#define BINLOG_KEY_VERSION_LENGTH 4
+#define BINLOG_IV_LENGTH MY_AES_BLOCK_SIZE
+#define BINLOG_IV_OFFS_LENGTH 4
+#define BINLOG_NONCE_LENGTH (BINLOG_IV_LENGTH - BINLOG_IV_OFFS_LENGTH)
+
+struct Binlog_crypt_data {
+ uint scheme;
+ uint key_version, key_length, ctx_size;
+ uchar key[MY_AES_MAX_KEY_LENGTH];
+ uchar nonce[BINLOG_NONCE_LENGTH];
+
+ int init(uint sch, uint kv)
+ {
+ scheme= sch;
+ ctx_size= encryption_ctx_size(ENCRYPTION_KEY_SYSTEM_DATA, kv);
+ key_version= kv;
+ key_length= sizeof(key);
+ return encryption_key_get(ENCRYPTION_KEY_SYSTEM_DATA, kv, key, &key_length);
+ }
+
+ void set_iv(uchar* iv, uint32 offs) const
+ {
+ memcpy(iv, nonce, BINLOG_NONCE_LENGTH);
+ int4store(iv + BINLOG_NONCE_LENGTH, offs);
+ }
+};
+
#endif /* RPL_CONSTANTS_H */
diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc
index 30f73b673f9..857dbfcca56 100644
--- a/sql/rpl_gtid.cc
+++ b/sql/rpl_gtid.cc
@@ -117,7 +117,7 @@ int
rpl_slave_state::check_duplicate_gtid(rpl_gtid *gtid, rpl_group_info *rgi)
{
uint32 domain_id= gtid->domain_id;
- uint32 seq_no= gtid->seq_no;
+ uint64 seq_no= gtid->seq_no;
rpl_slave_state::element *elem;
int res;
bool did_enter_cond= false;
diff --git a/sql/rpl_handler.cc b/sql/rpl_handler.cc
index 3962600f600..733af6c61c8 100644
--- a/sql/rpl_handler.cc
+++ b/sql/rpl_handler.cc
@@ -39,8 +39,6 @@ typedef struct Trans_binlog_info {
char log_file[FN_REFLEN];
} Trans_binlog_info;
-static pthread_key(Trans_binlog_info*, RPL_TRANS_BINLOG_INFO);
-
int get_user_var_int(const char *name,
long long int *value, int *null_value)
{
@@ -144,13 +142,6 @@ int delegates_init()
}
#endif
- if (pthread_key_create(&RPL_TRANS_BINLOG_INFO, NULL))
- {
- sql_print_error("Error while creating pthread specific data key for replication. "
- "Please report a bug.");
- return 1;
- }
-
return 0;
}
@@ -196,27 +187,27 @@ void delegates_destroy()
int Trans_delegate::after_commit(THD *thd, bool all)
{
Trans_param param;
+ Trans_binlog_info *log_info;
bool is_real_trans= (all || thd->transaction.all.ha_list == 0);
+ int ret= 0;
param.flags = is_real_trans ? TRANS_IS_REAL_TRANS : 0;
- Trans_binlog_info *log_info=
- my_pthread_getspecific_ptr(Trans_binlog_info*, RPL_TRANS_BINLOG_INFO);
+ log_info= thd->semisync_info;
- param.log_file= log_info ? log_info->log_file : 0;
+ param.log_file= log_info && log_info->log_file[0] ? log_info->log_file : 0;
param.log_pos= log_info ? log_info->log_pos : 0;
- int ret= 0;
FOREACH_OBSERVER(ret, after_commit, false, (&param));
/*
This is the end of a real transaction or autocommit statement, we
- can free the memory allocated for binlog file and position.
+ can mark the memory unused.
*/
if (is_real_trans && log_info)
{
- my_pthread_setspecific_ptr(RPL_TRANS_BINLOG_INFO, NULL);
- my_free(log_info);
+ log_info->log_file[0]= 0;
+ log_info->log_pos= 0;
}
return ret;
}
@@ -224,27 +215,27 @@ int Trans_delegate::after_commit(THD *thd, bool all)
int Trans_delegate::after_rollback(THD *thd, bool all)
{
Trans_param param;
+ Trans_binlog_info *log_info;
bool is_real_trans= (all || thd->transaction.all.ha_list == 0);
+ int ret= 0;
param.flags = is_real_trans ? TRANS_IS_REAL_TRANS : 0;
- Trans_binlog_info *log_info=
- my_pthread_getspecific_ptr(Trans_binlog_info*, RPL_TRANS_BINLOG_INFO);
-
- param.log_file= log_info ? log_info->log_file : 0;
+ log_info= thd->semisync_info;
+
+ param.log_file= log_info && log_info->log_file[0] ? log_info->log_file : 0;
param.log_pos= log_info ? log_info->log_pos : 0;
- int ret= 0;
FOREACH_OBSERVER(ret, after_rollback, false, (&param));
/*
This is the end of a real transaction or autocommit statement, we
- can free the memory allocated for binlog file and position.
+ can mark the memory unused.
*/
if (is_real_trans && log_info)
{
- my_pthread_setspecific_ptr(RPL_TRANS_BINLOG_INFO, NULL);
- my_free(log_info);
+ log_info->log_file[0]= 0;
+ log_info->log_pos= 0;
}
return ret;
}
@@ -257,7 +248,10 @@ int Binlog_storage_delegate::after_flush(THD *thd,
bool last_in_group)
{
Binlog_storage_param param;
+ Trans_binlog_info *log_info;
uint32 flags=0;
+ int ret= 0;
+
if (synced)
flags |= BINLOG_STORAGE_IS_SYNCED;
if (first_in_group)
@@ -265,21 +259,17 @@ int Binlog_storage_delegate::after_flush(THD *thd,
if (last_in_group)
flags|= BINLOG_GROUP_COMMIT_TRAILER;
- Trans_binlog_info *log_info=
- my_pthread_getspecific_ptr(Trans_binlog_info*, RPL_TRANS_BINLOG_INFO);
-
- if (!log_info)
+ if (!(log_info= thd->semisync_info))
{
if(!(log_info=
- (Trans_binlog_info *)my_malloc(sizeof(Trans_binlog_info), MYF(0))))
+ (Trans_binlog_info*) my_malloc(sizeof(Trans_binlog_info), MYF(0))))
return 1;
- my_pthread_setspecific_ptr(RPL_TRANS_BINLOG_INFO, log_info);
+ thd->semisync_info= log_info;
}
-
+
strcpy(log_info->log_file, log_file+dirname_length(log_file));
log_info->log_pos = log_pos;
- int ret= 0;
FOREACH_OBSERVER(ret, after_flush, false,
(&param, log_info->log_file, log_info->log_pos, flags));
return ret;
diff --git a/sql/rpl_injector.cc b/sql/rpl_injector.cc
index 19b193729fd..caa84d867ad 100644
--- a/sql/rpl_injector.cc
+++ b/sql/rpl_injector.cc
@@ -118,62 +118,6 @@ int injector::transaction::use_table(server_id_type sid, table tbl)
}
-int injector::transaction::write_row (server_id_type sid, table tbl,
- MY_BITMAP const* cols, size_t colcnt,
- record_type record)
-{
- DBUG_ENTER("injector::transaction::write_row(...)");
-
- int error= check_state(ROW_STATE);
- if (error)
- DBUG_RETURN(error);
-
- server_id_type save_id= m_thd->variables.server_id;
- m_thd->set_server_id(sid);
- error= m_thd->binlog_write_row(tbl.get_table(), tbl.is_transactional(),
- cols, colcnt, record);
- m_thd->set_server_id(save_id);
- DBUG_RETURN(error);
-}
-
-
-int injector::transaction::delete_row(server_id_type sid, table tbl,
- MY_BITMAP const* cols, size_t colcnt,
- record_type record)
-{
- DBUG_ENTER("injector::transaction::delete_row(...)");
-
- int error= check_state(ROW_STATE);
- if (error)
- DBUG_RETURN(error);
-
- server_id_type save_id= m_thd->variables.server_id;
- m_thd->set_server_id(sid);
- error= m_thd->binlog_delete_row(tbl.get_table(), tbl.is_transactional(),
- cols, colcnt, record);
- m_thd->set_server_id(save_id);
- DBUG_RETURN(error);
-}
-
-
-int injector::transaction::update_row(server_id_type sid, table tbl,
- MY_BITMAP const* cols, size_t colcnt,
- record_type before, record_type after)
-{
- DBUG_ENTER("injector::transaction::update_row(...)");
-
- int error= check_state(ROW_STATE);
- if (error)
- DBUG_RETURN(error);
-
- server_id_type save_id= m_thd->variables.server_id;
- m_thd->set_server_id(sid);
- error= m_thd->binlog_update_row(tbl.get_table(), tbl.is_transactional(),
- cols, colcnt, before, after);
- m_thd->set_server_id(save_id);
- DBUG_RETURN(error);
-}
-
injector::transaction::binlog_pos injector::transaction::start_pos() const
{
diff --git a/sql/rpl_injector.h b/sql/rpl_injector.h
index 98788955e24..41e1fcf460c 100644
--- a/sql/rpl_injector.h
+++ b/sql/rpl_injector.h
@@ -117,8 +117,8 @@ public:
class table
{
public:
- table(TABLE *table, bool is_transactional)
- : m_table(table), m_is_transactional(is_transactional)
+ table(TABLE *table, bool is_transactional_arg)
+ : m_table(table), m_is_transactional(is_transactional_arg)
{
}
@@ -181,27 +181,6 @@ public:
int use_table(server_id_type sid, table tbl);
/*
- Add a 'write row' entry to the transaction.
- */
- int write_row (server_id_type sid, table tbl,
- MY_BITMAP const *cols, size_t colcnt,
- record_type record);
-
- /*
- Add a 'delete row' entry to the transaction.
- */
- int delete_row(server_id_type sid, table tbl,
- MY_BITMAP const *cols, size_t colcnt,
- record_type record);
-
- /*
- Add an 'update row' entry to the transaction.
- */
- int update_row(server_id_type sid, table tbl,
- MY_BITMAP const *cols, size_t colcnt,
- record_type before, record_type after);
-
- /*
Commit a transaction.
This member function will clean up after a sequence of *_row calls by,
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc
index d2b792a259d..02104af8cd3 100644
--- a/sql/rpl_mi.cc
+++ b/sql/rpl_mi.cc
@@ -1086,14 +1086,15 @@ bool Master_info_index::init_all_master_info()
{
/* Master_info is not in HASH; Add it */
if (master_info_index->add_master_info(mi, FALSE))
- return 1;
+ DBUG_RETURN(1);
succ_num++;
unlock_slave_threads(mi);
}
else
{
/* Master_info already in HASH */
- sql_print_error(ER(ER_CONNECTION_ALREADY_EXISTS),
+ sql_print_error(ER_THD_OR_DEFAULT(current_thd,
+ ER_CONNECTION_ALREADY_EXISTS),
(int) connection_name.length, connection_name.str);
unlock_slave_threads(mi);
delete mi;
@@ -1110,7 +1111,8 @@ bool Master_info_index::init_all_master_info()
Sql_condition::WARN_LEVEL_NOTE))
{
/* Master_info was already registered */
- sql_print_error(ER(ER_CONNECTION_ALREADY_EXISTS),
+ sql_print_error(ER_THD_OR_DEFAULT(current_thd,
+ ER_CONNECTION_ALREADY_EXISTS),
(int) connection_name.length, connection_name.str);
unlock_slave_threads(mi);
delete mi;
@@ -1119,18 +1121,19 @@ bool Master_info_index::init_all_master_info()
/* Master_info was not registered; add it */
if (master_info_index->add_master_info(mi, FALSE))
- return 1;
+ DBUG_RETURN(1);
succ_num++;
unlock_slave_threads(mi);
if (!opt_skip_slave_start)
{
- if (start_slave_threads(1 /* need mutex */,
- 0 /* no wait for start*/,
- mi,
- buf_master_info_file,
- buf_relay_log_info_file,
- SLAVE_IO | SLAVE_SQL))
+ if (start_slave_threads(current_thd,
+ 1 /* need mutex */,
+ 0 /* no wait for start*/,
+ mi,
+ buf_master_info_file,
+ buf_relay_log_info_file,
+ SLAVE_IO | SLAVE_SQL))
{
sql_print_error("Failed to create slave threads for connection '%.*s'",
(int) connection_name.length,
@@ -1216,7 +1219,7 @@ Master_info_index::get_master_info(const LEX_STRING *connection_name,
mysql_mutex_assert_owner(&LOCK_active_mi);
if (!this) // master_info_index is set to NULL on server shutdown
- return NULL;
+ DBUG_RETURN(NULL);
/* Make name lower case for comparison */
res= strmake(buff, connection_name->str, connection_name->length);
@@ -1371,7 +1374,7 @@ bool Master_info_index::give_error_if_slave_running()
DBUG_ENTER("give_error_if_slave_running");
mysql_mutex_assert_owner(&LOCK_active_mi);
if (!this) // master_info_index is set to NULL on server shutdown
- return TRUE;
+ DBUG_RETURN(TRUE);
for (uint i= 0; i< master_info_hash.records; ++i)
{
@@ -1402,7 +1405,7 @@ bool Master_info_index::any_slave_sql_running()
{
DBUG_ENTER("any_slave_sql_running");
if (!this) // master_info_index is set to NULL on server shutdown
- return TRUE;
+ DBUG_RETURN(TRUE);
for (uint i= 0; i< master_info_hash.records; ++i)
{
@@ -1453,9 +1456,9 @@ bool Master_info_index::start_all_slaves(THD *thd)
if (error < 0) // fatal error
break;
}
- else
+ else if (thd)
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_SLAVE_STARTED, ER(ER_SLAVE_STARTED),
+ ER_SLAVE_STARTED, ER_THD(thd, ER_SLAVE_STARTED),
(int) mi->connection_name.length,
mi->connection_name.str);
}
@@ -1469,6 +1472,8 @@ bool Master_info_index::start_all_slaves(THD *thd)
Start all slaves that was not running.
+ @param thread id from user
+
@return
TRUE Error
FALSE Everything ok.
@@ -1479,6 +1484,7 @@ bool Master_info_index::stop_all_slaves(THD *thd)
bool result= FALSE;
DBUG_ENTER("warn_if_slave_running");
mysql_mutex_assert_owner(&LOCK_active_mi);
+ DBUG_ASSERT(thd);
for (uint i= 0; i< master_info_hash.records; ++i)
{
@@ -1500,7 +1506,7 @@ bool Master_info_index::stop_all_slaves(THD *thd)
}
else
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_SLAVE_STOPPED, ER(ER_SLAVE_STOPPED),
+ ER_SLAVE_STOPPED, ER_THD(thd, ER_SLAVE_STOPPED),
(int) mi->connection_name.length,
mi->connection_name.str);
}
diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h
index 7ba64a9dc92..69d602c1dcb 100644
--- a/sql/rpl_mi.h
+++ b/sql/rpl_mi.h
@@ -218,7 +218,7 @@ class Master_info : public Slave_reporting_capability
Initialized to novalue, then set to the queried from master
@@global.binlog_checksum and deactivated once FD has been received.
*/
- uint8 checksum_alg_before_fd;
+ enum enum_binlog_checksum_alg checksum_alg_before_fd;
uint connect_retry;
#ifndef DBUG_OFF
int events_till_disconnect;
diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc
index 29a87cc627b..d5020dd4cba 100644
--- a/sql/rpl_parallel.cc
+++ b/sql/rpl_parallel.cc
@@ -94,7 +94,6 @@ handle_queued_pos_update(THD *thd, rpl_parallel_thread::queued_event *qev)
if (cmp < 0)
{
strcpy(rli->group_master_log_name, qev->future_event_master_log_name);
- rli->notify_group_master_log_name_update();
rli->group_master_log_pos= qev->future_event_master_log_pos;
}
else if (cmp == 0
@@ -225,6 +224,11 @@ static void
signal_error_to_sql_driver_thread(THD *thd, rpl_group_info *rgi, int err)
{
rgi->worker_error= err;
+ /*
+ In case we get an error during commit, inform following transactions that
+ we aborted our commit.
+ */
+ rgi->unmark_start_commit();
rgi->cleanup_context(thd, true);
rgi->rli->abort_slave= true;
rgi->rli->stop_for_until= false;
@@ -319,13 +323,26 @@ convert_kill_to_deadlock_error(rpl_group_info *rgi)
}
-static bool
+/*
+ Check if an event marks the end of an event group. Returns non-zero if so,
+ zero otherwise.
+
+ In addition, returns 1 if the group is committing, 2 if it is rolling back.
+*/
+static int
is_group_ending(Log_event *ev, Log_event_type event_type)
{
- return event_type == XID_EVENT ||
- (event_type == QUERY_EVENT &&
- (((Query_log_event *)ev)->is_commit() ||
- ((Query_log_event *)ev)->is_rollback()));
+ if (event_type == XID_EVENT)
+ return 1;
+ if (event_type == QUERY_EVENT)
+ {
+ Query_log_event *qev = (Query_log_event *)ev;
+ if (qev->is_commit())
+ return 1;
+ if (qev->is_rollback())
+ return 2;
+ }
+ return 0;
}
@@ -377,6 +394,7 @@ do_retry:
transaction we deadlocked with will not signal that it started to commit
until after the unmark.
*/
+ DBUG_EXECUTE_IF("inject_mdev8302", { my_sleep(20000);});
rgi->unmark_start_commit();
DEBUG_SYNC(thd, "rpl_parallel_retry_after_unmark");
@@ -551,16 +569,26 @@ do_retry:
err= 1;
goto check_retry;
}
+ description_event->reset_crypto();
/* Loop to try again on the new log file. */
}
event_type= ev->get_type_code();
if (event_type == FORMAT_DESCRIPTION_EVENT)
{
+ Format_description_log_event *newde= (Format_description_log_event*)ev;
+ newde->copy_crypto_data(description_event);
delete description_event;
- description_event= (Format_description_log_event *)ev;
+ description_event= newde;
+ continue;
+ }
+ else if (event_type == START_ENCRYPTION_EVENT)
+ {
+ description_event->start_decryption((Start_encryption_log_event*)ev);
+ delete ev;
continue;
- } else if (!Log_event::is_group_event(event_type))
+ }
+ else if (!Log_event::is_group_event(event_type))
{
delete ev;
continue;
@@ -578,7 +606,7 @@ do_retry:
err= 1;
goto err;
}
- if (is_group_ending(ev, event_type))
+ if (is_group_ending(ev, event_type) == 1)
rgi->mark_start_commit();
err= rpt_handle_event(qev, rpt);
@@ -724,7 +752,8 @@ handle_rpl_parallel_thread(void *arg)
Log_event_type event_type;
rpl_group_info *rgi= qev->rgi;
rpl_parallel_entry *entry= rgi->parallel_entry;
- bool end_of_group, group_ending;
+ bool end_of_group;
+ int group_ending;
next_qev= qev->next;
if (qev->typ == rpl_parallel_thread::queued_event::QUEUED_POS_UPDATE)
@@ -912,11 +941,37 @@ handle_rpl_parallel_thread(void *arg)
group_rgi= rgi;
group_ending= is_group_ending(qev->ev, event_type);
- if (group_ending && likely(!rgi->worker_error))
+ /*
+ We do not unmark_start_commit() here in case of an explicit ROLLBACK
+ statement. Such events should be very rare, there is no real reason
+ to try to group commit them - on the contrary, it seems best to avoid
+ running them in parallel with following group commits, as with
+ ROLLBACK events we are already deep in dangerous corner cases with
+ mix of transactional and non-transactional tables or the like. And
+ avoiding the mark_start_commit() here allows us to keep an assertion
+ in ha_rollback_trans() that we do not rollback after doing
+ mark_start_commit().
+ */
+ if (group_ending == 1 && likely(!rgi->worker_error))
{
- DEBUG_SYNC(thd, "rpl_parallel_before_mark_start_commit");
- rgi->mark_start_commit();
- DEBUG_SYNC(thd, "rpl_parallel_after_mark_start_commit");
+ /*
+ Do an extra check for (deadlock) kill here. This helps prevent a
+ lingering deadlock kill that occured during normal DML processing to
+ propagate past the mark_start_commit(). If we detect a deadlock only
+ after mark_start_commit(), we have to unmark, which has at least a
+ theoretical possibility of leaving a window where it looks like all
+ transactions in a GCO have started committing, while in fact one
+ will need to rollback and retry. This is not supposed to be possible
+ (since there is a deadlock, at least one transaction should be
+ blocked from reaching commit), but this seems a fragile ensurance,
+ and there were historically a number of subtle bugs in this area.
+ */
+ if (!thd->killed)
+ {
+ DEBUG_SYNC(thd, "rpl_parallel_before_mark_start_commit");
+ rgi->mark_start_commit();
+ DEBUG_SYNC(thd, "rpl_parallel_after_mark_start_commit");
+ }
}
/*
@@ -941,7 +996,17 @@ handle_rpl_parallel_thread(void *arg)
});
if (!err)
#endif
- err= rpt_handle_event(qev, rpt);
+ {
+ if (thd->check_killed())
+ {
+ thd->clear_error();
+ thd->get_stmt_da()->reset_diagnostics_area();
+ thd->send_kill_message();
+ err= 1;
+ }
+ else
+ err= rpt_handle_event(qev, rpt);
+ }
delete_or_keep_event_post_apply(rgi, event_type, qev->ev);
DBUG_EXECUTE_IF("rpl_parallel_simulate_temp_err_gtid_0_x_100",
err= dbug_simulate_tmp_error(rgi, thd););
@@ -2044,6 +2109,7 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev,
{
memcpy(rli->future_event_master_log_name,
rev->new_log_ident, rev->ident_len+1);
+ rli->notify_group_master_log_name_update();
}
}
diff --git a/sql/rpl_record.cc b/sql/rpl_record.cc
index 8c694602c74..ee222f02f07 100644
--- a/sql/rpl_record.cc
+++ b/sql/rpl_record.cc
@@ -209,6 +209,16 @@ unpack_row(rpl_group_info *rgi,
Field **field_ptr;
Field **const end_ptr= begin_ptr + colcnt;
+ if (bitmap_is_clear_all(cols))
+ {
+ /**
+ There was no data sent from the master, so there is
+ nothing to unpack.
+ */
+ *current_row_end= pack_ptr;
+ *master_reclength= 0;
+ DBUG_RETURN(error);
+ }
DBUG_ASSERT(null_ptr < row_data + master_null_byte_count);
// Mask to mask out the correct bit among the null bits
@@ -290,9 +300,12 @@ unpack_row(rpl_group_info *rgi,
}
else
{
+ THD *thd= f->table->in_use;
+
f->set_default();
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_BAD_NULL_ERROR, ER(ER_BAD_NULL_ERROR),
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_BAD_NULL_ERROR,
+ ER_THD(thd, ER_BAD_NULL_ERROR),
f->field_name);
}
}
@@ -465,11 +478,12 @@ int prepare_record(TABLE *const table, const uint skip, const bool check)
if ((f->flags & NO_DEFAULT_VALUE_FLAG) &&
(f->real_type() != MYSQL_TYPE_ENUM))
{
+ THD *thd= f->table->in_use;
f->set_default();
- push_warning_printf(current_thd,
+ push_warning_printf(thd,
Sql_condition::WARN_LEVEL_WARN,
ER_NO_DEFAULT_FOR_FIELD,
- ER(ER_NO_DEFAULT_FOR_FIELD),
+ ER_THD(thd, ER_NO_DEFAULT_FOR_FIELD),
f->field_name);
}
}
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index a9d149f5876..7453f57e64c 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -228,7 +228,7 @@ a file name for --relay-log-index option", opt_relaylog_index_name);
but a destructor will take care of that
*/
if (rli->relay_log.open_index_file(buf_relaylog_index_name, ln, TRUE) ||
- rli->relay_log.open(ln, LOG_BIN, 0, SEQ_READ_APPEND,
+ rli->relay_log.open(ln, LOG_BIN, 0, 0, SEQ_READ_APPEND,
mi->rli.max_relay_log_size, 1, TRUE))
{
mysql_mutex_unlock(&rli->data_lock);
@@ -395,24 +395,16 @@ Failed to open the existing relay log info file '%s' (errno %d)",
0 /* no data lock*/,
&msg, 0))
{
- char llbuf[22];
- sql_print_error("Failed to open the relay log '%s' (relay_log_pos %s)",
- rli->group_relay_log_name,
- llstr(rli->group_relay_log_pos, llbuf));
+ sql_print_error("Failed to open the relay log '%s' (relay_log_pos %llu)",
+ rli->group_relay_log_name, rli->group_relay_log_pos);
goto err;
}
}
-#ifndef DBUG_OFF
- {
- char llbuf1[22], llbuf2[22];
- DBUG_PRINT("info", ("my_b_tell(rli->cur_log)=%s rli->event_relay_log_pos=%s",
- llstr(my_b_tell(rli->cur_log),llbuf1),
- llstr(rli->event_relay_log_pos,llbuf2)));
- DBUG_ASSERT(rli->event_relay_log_pos >= BIN_LOG_HEADER_SIZE);
- DBUG_ASSERT(my_b_tell(rli->cur_log) == rli->event_relay_log_pos);
- }
-#endif
+ DBUG_PRINT("info", ("my_b_tell(rli->cur_log)=%llu rli->event_relay_log_pos=%llu",
+ my_b_tell(rli->cur_log), rli->event_relay_log_pos));
+ DBUG_ASSERT(rli->event_relay_log_pos >= BIN_LOG_HEADER_SIZE);
+ DBUG_ASSERT(my_b_tell(rli->cur_log) == rli->event_relay_log_pos);
/*
Now change the cache from READ to WRITE - must do this
@@ -457,10 +449,7 @@ static inline int add_relay_log(Relay_log_info* rli,LOG_INFO* linfo)
DBUG_RETURN(1);
}
rli->log_space_total += s.st_size;
-#ifndef DBUG_OFF
- char buf[22];
- DBUG_PRINT("info",("log_space_total: %s", llstr(rli->log_space_total,buf)));
-#endif
+ DBUG_PRINT("info",("log_space_total: %llu", rli->log_space_total));
DBUG_RETURN(0);
}
@@ -558,9 +547,12 @@ read_relay_log_description_event(IO_CACHE *cur_log, ulonglong start_pos,
typ= ev->get_type_code();
if (typ == FORMAT_DESCRIPTION_EVENT)
{
+ Format_description_log_event *old= fdev;
DBUG_PRINT("info",("found Format_description_log_event"));
- delete fdev;
fdev= (Format_description_log_event*) ev;
+ fdev->copy_crypto_data(old);
+ delete old;
+
/*
As ev was returned by read_log_event, it has passed is_valid(), so
my_malloc() in ctor worked, no need to check again.
@@ -582,6 +574,17 @@ read_relay_log_description_event(IO_CACHE *cur_log, ulonglong start_pos,
or Format_desc.
*/
}
+ else if (typ == START_ENCRYPTION_EVENT)
+ {
+ if (fdev->start_decryption((Start_encryption_log_event*) ev))
+ {
+ *errmsg= "Unable to set up decryption of binlog.";
+ delete ev;
+ delete fdev;
+ return NULL;
+ }
+ delete ev;
+ }
else
{
DBUG_PRINT("info",("found event of another type=%d", typ));
@@ -725,14 +728,8 @@ int init_relay_log_pos(Relay_log_info* rli,const char* log,
rli->relay_log.description_event_for_exec= fdev;
}
my_b_seek(rli->cur_log,(off_t)pos);
-#ifndef DBUG_OFF
- {
- char llbuf1[22], llbuf2[22];
- DBUG_PRINT("info", ("my_b_tell(rli->cur_log)=%s rli->event_relay_log_pos=%s",
- llstr(my_b_tell(rli->cur_log),llbuf1),
- llstr(rli->event_relay_log_pos,llbuf2)));
- }
-#endif
+ DBUG_PRINT("info", ("my_b_tell(rli->cur_log)=%llu rli->event_relay_log_pos=%llu",
+ my_b_tell(rli->cur_log), rli->event_relay_log_pos));
}
@@ -996,7 +993,6 @@ void Relay_log_info::inc_group_relay_log_pos(ulonglong log_pos,
if (cmp < 0)
{
strcpy(group_master_log_name, rgi->future_event_master_log_name);
- notify_group_master_log_name_update();
group_master_log_pos= log_pos;
}
else if (group_master_log_pos < log_pos)
@@ -1009,7 +1005,7 @@ void Relay_log_info::inc_group_relay_log_pos(ulonglong log_pos,
group_relay_log_pos= event_relay_log_pos;
strmake_buf(group_relay_log_name, event_relay_log_name);
notify_group_relay_log_name_update();
- if (log_pos) // 3.23 binlogs don't have log_posx
+ if (log_pos) // not 3.23 binlogs (no log_pos there) and not Stop_log_event
group_master_log_pos= log_pos;
}
@@ -1076,6 +1072,9 @@ void Relay_log_info::close_temporary_tables()
/*
purge_relay_logs()
+ @param rli Relay log information
+ @param thd thread id. May be zero during startup
+
NOTES
Assumes to have a run lock on rli and that no slave thread are running.
*/
@@ -1131,7 +1130,7 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset,
rli->cur_log_fd= -1;
}
- if (rli->relay_log.reset_logs(thd, !just_reset, NULL, 0))
+ if (rli->relay_log.reset_logs(thd, !just_reset, NULL, 0, 0))
{
*errmsg = "Failed during log reset";
error=1;
@@ -1162,10 +1161,7 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset,
}
err:
-#ifndef DBUG_OFF
- char buf[22];
-#endif
- DBUG_PRINT("info",("log_space_total: %s",llstr(rli->log_space_total,buf)));
+ DBUG_PRINT("info",("log_space_total: %llu",rli->log_space_total));
mysql_mutex_unlock(&rli->data_lock);
DBUG_RETURN(error);
}
@@ -1204,46 +1200,35 @@ err:
false - condition not met
*/
-bool Relay_log_info::is_until_satisfied(THD *thd, Log_event *ev)
+bool Relay_log_info::is_until_satisfied(my_off_t master_beg_pos)
{
const char *log_name;
ulonglong log_pos;
DBUG_ENTER("Relay_log_info::is_until_satisfied");
- DBUG_ASSERT(until_condition == UNTIL_MASTER_POS ||
- until_condition == UNTIL_RELAY_POS);
-
if (until_condition == UNTIL_MASTER_POS)
{
- if (ev && ev->server_id == (uint32) global_system_variables.server_id &&
- !replicate_same_server_id)
- DBUG_RETURN(FALSE);
- log_name= group_master_log_name;
- log_pos= ((!ev)? group_master_log_pos :
- (get_flag(IN_TRANSACTION) || !ev->log_pos) ?
- group_master_log_pos : ev->log_pos - ev->data_written);
+ log_name= (mi->using_parallel() ?
+ future_event_master_log_name : group_master_log_name);
+ log_pos= master_beg_pos;
}
else
- { /* until_condition == UNTIL_RELAY_POS */
+ {
+ DBUG_ASSERT(until_condition == UNTIL_RELAY_POS);
log_name= group_relay_log_name;
log_pos= group_relay_log_pos;
}
-#ifndef DBUG_OFF
- {
- char buf[32];
- DBUG_PRINT("info", ("group_master_log_name='%s', group_master_log_pos=%s",
- group_master_log_name, llstr(group_master_log_pos, buf)));
- DBUG_PRINT("info", ("group_relay_log_name='%s', group_relay_log_pos=%s",
- group_relay_log_name, llstr(group_relay_log_pos, buf)));
- DBUG_PRINT("info", ("(%s) log_name='%s', log_pos=%s",
- until_condition == UNTIL_MASTER_POS ? "master" : "relay",
- log_name, llstr(log_pos, buf)));
- DBUG_PRINT("info", ("(%s) until_log_name='%s', until_log_pos=%s",
- until_condition == UNTIL_MASTER_POS ? "master" : "relay",
- until_log_name, llstr(until_log_pos, buf)));
- }
-#endif
+ DBUG_PRINT("info", ("group_master_log_name='%s', group_master_log_pos=%llu",
+ group_master_log_name, group_master_log_pos));
+ DBUG_PRINT("info", ("group_relay_log_name='%s', group_relay_log_pos=%llu",
+ group_relay_log_name, group_relay_log_pos));
+ DBUG_PRINT("info", ("(%s) log_name='%s', log_pos=%llu",
+ until_condition == UNTIL_MASTER_POS ? "master" : "relay",
+ log_name, log_pos));
+ DBUG_PRINT("info", ("(%s) until_log_name='%s', until_log_pos=%llu",
+ until_condition == UNTIL_MASTER_POS ? "master" : "relay",
+ until_log_name, until_log_pos));
if (until_log_names_cmp_result == UNTIL_LOG_NAMES_CMP_UNKNOWN)
{
@@ -1768,6 +1753,13 @@ void rpl_group_info::cleanup_context(THD *thd, bool error)
rli->clear_flag(Relay_log_info::IN_STMT);
rli->clear_flag(Relay_log_info::IN_TRANSACTION);
}
+
+ /*
+ Ensure we always release the domain for others to process, when using
+ --gtid-ignore-duplicates.
+ */
+ if (gtid_ignore_duplicate_state != GTID_DUPLICATE_NULL)
+ rpl_global_gtid_slave_state.release_domain_owner(this);
}
/*
@@ -1777,13 +1769,6 @@ void rpl_group_info::cleanup_context(THD *thd, bool error)
thd->variables.option_bits&= ~OPTION_RELAXED_UNIQUE_CHECKS;
/*
- Ensure we always release the domain for others to process, when using
- --gtid-ignore-duplicates.
- */
- if (gtid_ignore_duplicate_state != GTID_DUPLICATE_NULL)
- rpl_global_gtid_slave_state.release_domain_owner(this);
-
- /*
Reset state related to long_find_row notes in the error log:
- timestamp
- flag that decides whether the slave prints or not
@@ -1791,6 +1776,11 @@ void rpl_group_info::cleanup_context(THD *thd, bool error)
reset_row_stmt_start_timestamp();
unset_long_find_row_note_printed();
+ DBUG_EXECUTE_IF("inject_sleep_gtid_100_x_x", {
+ if (current_gtid.domain_id == 100)
+ my_sleep(50000);
+ };);
+
DBUG_VOID_RETURN;
}
diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h
index 2b45ed9aead..377db469276 100644
--- a/sql/rpl_rli.h
+++ b/sql/rpl_rli.h
@@ -394,7 +394,7 @@ public:
void close_temporary_tables();
/* Check if UNTIL condition is satisfied. See slave.cc for more. */
- bool is_until_satisfied(THD *thd, Log_event *ev);
+ bool is_until_satisfied(my_off_t);
inline ulonglong until_pos()
{
DBUG_ASSERT(until_condition == UNTIL_MASTER_POS ||
diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc
index 9067f1e4253..d1dd0298a1f 100644
--- a/sql/rpl_utility.cc
+++ b/sql/rpl_utility.cc
@@ -452,7 +452,7 @@ void show_sql_type(enum_field_types type, uint16 metadata, String *str, CHARSET_
CHARSET_INFO *cs= str->charset();
uint32 length=
cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
- "decimal(%d,?)", metadata);
+ "decimal(%d,?)/*old*/", metadata);
str->length(length);
}
break;
@@ -879,16 +879,19 @@ table_def::compatible_with(THD *thd, rpl_group_info *rgi,
col, field->field_name));
DBUG_ASSERT(col < size() && col < table->s->fields);
DBUG_ASSERT(table->s->db.str && table->s->table_name.str);
+ DBUG_ASSERT(table->in_use);
const char *db_name= table->s->db.str;
const char *tbl_name= table->s->table_name.str;
char source_buf[MAX_FIELD_WIDTH];
char target_buf[MAX_FIELD_WIDTH];
String source_type(source_buf, sizeof(source_buf), &my_charset_latin1);
String target_type(target_buf, sizeof(target_buf), &my_charset_latin1);
+ THD *thd= table->in_use;
+
show_sql_type(type(col), field_metadata(col), &source_type, field->charset());
field->sql_type(target_type);
rli->report(ERROR_LEVEL, ER_SLAVE_CONVERSION_FAILED, rgi->gtid_info(),
- ER(ER_SLAVE_CONVERSION_FAILED),
+ ER_THD(thd, ER_SLAVE_CONVERSION_FAILED),
col, db_name, tbl_name,
source_type.c_ptr_safe(), target_type.c_ptr_safe());
return false;
@@ -947,7 +950,8 @@ TABLE *table_def::create_conversion_table(THD *thd, rpl_group_info *rgi,
{
Create_field *field_def=
(Create_field*) alloc_root(thd->mem_root, sizeof(Create_field));
- if (field_list.push_back(field_def))
+ bool unsigned_flag= 0;
+ if (field_list.push_back(field_def, thd->mem_root))
DBUG_RETURN(NULL);
uint decimals= 0;
@@ -956,8 +960,7 @@ TABLE *table_def::create_conversion_table(THD *thd, rpl_group_info *rgi,
uint32 max_length=
max_display_length_for_field(type(col), field_metadata(col));
- switch(type(col))
- {
+ switch(type(col)) {
int precision;
case MYSQL_TYPE_ENUM:
case MYSQL_TYPE_SET:
@@ -996,6 +999,18 @@ TABLE *table_def::create_conversion_table(THD *thd, rpl_group_info *rgi,
pack_length= field_metadata(col) & 0x00ff;
break;
+ case MYSQL_TYPE_TINY:
+ case MYSQL_TYPE_SHORT:
+ case MYSQL_TYPE_INT24:
+ case MYSQL_TYPE_LONG:
+ case MYSQL_TYPE_LONGLONG:
+ /*
+ As we don't know if the integer was signed or not on the master,
+ assume we have same sign on master and slave. This is true when not
+ using conversions so it should be true also when using conversions.
+ */
+ unsigned_flag= ((Field_num*) target_table->field[col])->unsigned_flag;
+ break;
default:
break;
}
@@ -1003,12 +1018,13 @@ TABLE *table_def::create_conversion_table(THD *thd, rpl_group_info *rgi,
DBUG_PRINT("debug", ("sql_type: %d, target_field: '%s', max_length: %d, decimals: %d,"
" maybe_null: %d, unsigned_flag: %d, pack_length: %u",
binlog_type(col), target_table->field[col]->field_name,
- max_length, decimals, TRUE, FALSE, pack_length));
+ max_length, decimals, TRUE, unsigned_flag,
+ pack_length));
field_def->init_for_tmp_table(type(col),
max_length,
decimals,
TRUE, // maybe_null
- FALSE, // unsigned_flag
+ unsigned_flag,
pack_length);
field_def->charset= target_table->field[col]->charset();
field_def->interval= interval;
@@ -1018,10 +1034,12 @@ TABLE *table_def::create_conversion_table(THD *thd, rpl_group_info *rgi,
err:
if (conv_table == NULL)
+ {
rli->report(ERROR_LEVEL, ER_SLAVE_CANT_CREATE_CONVERSION, rgi->gtid_info(),
- ER(ER_SLAVE_CANT_CREATE_CONVERSION),
+ ER_THD(thd, ER_SLAVE_CANT_CREATE_CONVERSION),
target_table->s->db.str,
target_table->s->table_name.str);
+ }
DBUG_RETURN(conv_table);
}
#endif /* MYSQL_CLIENT */
@@ -1140,7 +1158,7 @@ table_def::~table_def()
@return TRUE if test fails
FALSE as success
*/
-bool event_checksum_test(uchar *event_buf, ulong event_len, uint8 alg)
+bool event_checksum_test(uchar *event_buf, ulong event_len, enum enum_binlog_checksum_alg alg)
{
bool res= FALSE;
uint16 flags= 0; // to store in FD's buffer flags orig value
@@ -1174,19 +1192,17 @@ bool event_checksum_test(uchar *event_buf, ulong event_len, uint8 alg)
compile_time_assert(BINLOG_CHECKSUM_ALG_ENUM_END <= 0x80);
}
incoming= uint4korr(event_buf + event_len - BINLOG_CHECKSUM_LEN);
- computed= my_checksum(0L, NULL, 0);
- /* checksum the event content but the checksum part itself */
- computed= my_checksum(computed, (const uchar*) event_buf,
- event_len - BINLOG_CHECKSUM_LEN);
+ /* checksum the event content without the checksum part itself */
+ computed= my_checksum(0, event_buf, event_len - BINLOG_CHECKSUM_LEN);
if (flags != 0)
{
/* restoring the orig value of flags of FD */
DBUG_ASSERT(event_buf[EVENT_TYPE_OFFSET] == FORMAT_DESCRIPTION_EVENT);
event_buf[FLAGS_OFFSET]= (uchar) flags;
}
- res= !(computed == incoming);
+ res= DBUG_EVALUATE_IF("simulate_checksum_test_failure", TRUE, computed != incoming);
}
- return DBUG_EVALUATE_IF("simulate_checksum_test_failure", TRUE, res);
+ return res;
}
#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
@@ -1252,4 +1268,3 @@ void Deferred_log_events::rewind()
}
#endif
-
diff --git a/sql/set_var.cc b/sql/set_var.cc
index c65ca3d59b7..18f6cbc41fd 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -172,6 +172,7 @@ sys_var::sys_var(sys_var_chain *chain, const char *name_arg,
option.value= (uchar **)global_var_ptr();
option.def_value= def_val;
option.app_type= this;
+ option.var_type= flags & AUTO_SET ? GET_AUTO : 0;
if (chain->last)
chain->last->next= this;
@@ -402,7 +403,7 @@ void sys_var::do_deprecated_warning(THD *thd)
: ER_WARN_DEPRECATED_SYNTAX;
if (thd)
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_WARN_DEPRECATED_SYNTAX, ER(errmsg),
+ ER_WARN_DEPRECATED_SYNTAX, ER_THD(thd, errmsg),
buf1, deprecation_substitute);
else
sql_print_warning(ER_DEFAULT(errmsg), buf1, deprecation_substitute);
@@ -440,7 +441,7 @@ bool throw_bounds_warning(THD *thd, const char *name,
}
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE,
- ER(ER_TRUNCATED_WRONG_VALUE), name, buf);
+ ER_THD(thd, ER_TRUNCATED_WRONG_VALUE), name, buf);
}
return false;
}
@@ -460,7 +461,7 @@ bool throw_bounds_warning(THD *thd, const char *name, bool fixed, double v)
}
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE,
- ER(ER_TRUNCATED_WRONG_VALUE), name, buf);
+ ER_THD(thd, ER_TRUNCATED_WRONG_VALUE), name, buf);
}
return false;
}
@@ -788,12 +789,33 @@ int set_var::light_check(THD *thd)
Consider set_var::check() method if there is a need to return
an error due to logics.
*/
+
int set_var::update(THD *thd)
{
return value ? var->update(thd, this) : var->set_default(thd, this);
}
+set_var::set_var(THD *thd, enum_var_type type_arg, sys_var *var_arg,
+ const LEX_STRING *base_name_arg, Item *value_arg)
+ :var(var_arg), type(type_arg), base(*base_name_arg)
+{
+ /*
+ If the set value is a field, change it to a string to allow things like
+ SET table_type=MYISAM;
+ */
+ if (value_arg && value_arg->type() == Item::FIELD_ITEM)
+ {
+ Item_field *item= (Item_field*) value_arg;
+ // names are utf8
+ if (!(value= new (thd->mem_root) Item_string_sys(thd, item->field_name)))
+ value=value_arg; /* Give error message later */
+ }
+ else
+ value=value_arg;
+}
+
+
/*****************************************************************************
Functions to handle SET @user_variable=const_expr
*****************************************************************************/
@@ -836,7 +858,8 @@ int set_var_user::update(THD *thd)
if (user_var_item->update())
{
/* Give an error if it's not given already */
- my_message(ER_SET_CONSTANTS_ONLY, ER(ER_SET_CONSTANTS_ONLY), MYF(0));
+ my_message(ER_SET_CONSTANTS_ONLY, ER_THD(thd, ER_SET_CONSTANTS_ONLY),
+ MYF(0));
return -1;
}
return 0;
@@ -981,7 +1004,7 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond)
DBUG_ASSERT(tables->table->in_use == thd);
- cond= make_cond_for_info_schema(cond, tables);
+ cond= make_cond_for_info_schema(thd, cond, tables);
thd->count_cuted_fields= CHECK_FIELD_WARN;
mysql_rwlock_rdlock(&LOCK_system_variables_hash);
@@ -1064,7 +1087,8 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond)
{ STRING_WITH_LEN("DOUBLE") }, // GET_DOUBLE 14
{ STRING_WITH_LEN("FLAGSET") }, // GET_FLAGSET 15
};
- const LEX_CSTRING *type= types + (var->option.var_type & GET_TYPE_MASK);
+ const ulong vartype= (var->option.var_type & GET_TYPE_MASK);
+ const LEX_CSTRING *type= types + vartype;
fields[6]->store(type->str, type->length, scs);
// VARIABLE_COMMENT
@@ -1075,7 +1099,7 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond)
// NUMERIC_MAX_VALUE
// NUMERIC_BLOCK_SIZE
bool is_unsigned= true;
- switch (var->option.var_type)
+ switch (vartype)
{
case GET_INT:
case GET_LONG:
@@ -1157,7 +1181,7 @@ end:
and update it directly.
*/
-void mark_sys_var_value_origin(void *ptr, enum sys_var::where here)
+void set_sys_var_value_origin(void *ptr, enum sys_var::where here)
{
bool found __attribute__((unused))= false;
DBUG_ASSERT(!mysqld_server_started); // only to be used during startup
@@ -1176,3 +1200,20 @@ void mark_sys_var_value_origin(void *ptr, enum sys_var::where here)
DBUG_ASSERT(found); // variable must have been found
}
+enum sys_var::where get_sys_var_value_origin(void *ptr)
+{
+ DBUG_ASSERT(!mysqld_server_started); // only to be used during startup
+
+ for (uint i= 0; i < system_variable_hash.records; i++)
+ {
+ sys_var *var= (sys_var*) my_hash_element(&system_variable_hash, i);
+ if (var->option.value == ptr)
+ {
+ return var->value_origin; //first match
+ }
+ }
+
+ DBUG_ASSERT(0); // variable must have been found
+ return sys_var::CONFIG;
+}
+
diff --git a/sql/set_var.h b/sql/set_var.h
index 0215a452c07..b8192e67ca9 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -55,14 +55,14 @@ int mysql_del_sys_var_chain(sys_var *chain);
optionally it can be assigned to, optionally it can have a command-line
counterpart with the same name.
*/
-class sys_var
+class sys_var: protected Value_source // for double_from_string_with_check
{
public:
sys_var *next;
LEX_CSTRING name;
enum flag_enum { GLOBAL, SESSION, ONLY_SESSION, SCOPE_MASK=1023,
READONLY=1024, ALLOCATED=2048, PARSE_EARLY=4096,
- NO_SET_STATEMENT=8192};
+ NO_SET_STATEMENT=8192, AUTO_SET=16384};
enum { NO_GETOPT=-1, GETOPT_ONLY_HELP=-2 };
enum where { CONFIG, AUTO, SQL, COMPILE_TIME, ENV };
@@ -285,23 +285,8 @@ public:
} save_result;
LEX_STRING base; /**< for structured variables, like keycache_name.variable_name */
- set_var(enum_var_type type_arg, sys_var *var_arg,
- const LEX_STRING *base_name_arg, Item *value_arg)
- :var(var_arg), type(type_arg), base(*base_name_arg)
- {
- /*
- If the set value is a field, change it to a string to allow things like
- SET table_type=MYISAM;
- */
- if (value_arg && value_arg->type() == Item::FIELD_ITEM)
- {
- Item_field *item= (Item_field*) value_arg;
- if (!(value=new Item_string_sys(item->field_name))) // names are utf8
- value=value_arg; /* Give error message later */
- }
- else
- value=value_arg;
- }
+ set_var(THD *thd, enum_var_type type_arg, sys_var *var_arg,
+ const LEX_STRING *base_name_arg, Item *value_arg);
virtual bool is_system() { return 1; }
int check(THD *thd);
int update(THD *thd);
@@ -404,10 +389,17 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list, bool free);
#define SYSVAR_AUTOSIZE(VAR,VAL) \
do { \
VAR= (VAL); \
- mark_sys_var_value_origin(&VAR, sys_var::AUTO); \
+ set_sys_var_value_origin(&VAR, sys_var::AUTO); \
} while(0)
-void mark_sys_var_value_origin(void *ptr, enum sys_var::where here);
+void set_sys_var_value_origin(void *ptr, enum sys_var::where here);
+
+enum sys_var::where get_sys_var_value_origin(void *ptr);
+inline bool IS_SYSVAR_AUTOSIZE(void *ptr)
+{
+ enum sys_var::where res= get_sys_var_value_origin(ptr);
+ return (res == sys_var::AUTO || res == sys_var::COMPILE_TIME);
+}
bool fix_delay_key_write(sys_var *self, THD *thd, enum_var_type type);
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 084674065e4..59908dc51c0 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -7109,6 +7109,9 @@ ER_SLAVE_SKIP_NOT_IN_GTID
eng "When using GTID, @@sql_slave_skip_counter can not be used. Instead, setting @@gtid_slave_pos explicitly can be used to skip to after a given GTID position."
ER_TABLE_DEFINITION_TOO_BIG
eng "The definition for table %`s is too big"
+ER_PLUGIN_INSTALLED
+ eng "Plugin '%-.192s' already installed"
+ rus "Плагин '%-.192s' уже уÑтановлен"
ER_STATEMENT_TIMEOUT 70100
eng "Query execution was interrupted (max_statement_time exceeded)"
ER_SUBQUERIES_NOT_SUPPORTED 42000
@@ -7127,3 +7130,9 @@ ER_ROLE_DROP_EXISTS
eng "Can't drop role '%-.64s'; it doesn't exist"
ER_CANNOT_CONVERT_CHARACTER
eng "Cannot convert '%s' character 0x%-.64s to '%s'"
+ER_INVALID_DEFAULT_VALUE_FOR_FIELD 22007
+ eng "Incorrect default value '%-.128s' for column '%.192s'"
+ER_KILL_QUERY_DENIED_ERROR
+ eng "You are not owner of query %lu"
+ ger "Sie sind nicht Eigentümer von Abfrage %lu"
+ rus "Ð’Ñ‹ не ÑвлÑетеÑÑŒ владельцем запроÑа %lu"
diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc
index 61e2830e82e..4490aae6b62 100644
--- a/sql/signal_handler.cc
+++ b/sql/signal_handler.cc
@@ -110,8 +110,9 @@ extern "C" sig_handler handle_fatal_signal(int sig)
set_server_version();
my_safe_printf_stderr("Server version: %s\n", server_version);
- my_safe_printf_stderr("key_buffer_size=%lu\n",
- (ulong) dflt_key_cache->key_cache_mem_size);
+ if (dflt_key_cache)
+ my_safe_printf_stderr("key_buffer_size=%lu\n",
+ (ulong) dflt_key_cache->key_cache_mem_size);
my_safe_printf_stderr("read_buffer_size=%ld\n",
(long) global_system_variables.read_buff_size);
@@ -119,24 +120,30 @@ extern "C" sig_handler handle_fatal_signal(int sig)
my_safe_printf_stderr("max_used_connections=%lu\n",
(ulong) max_used_connections);
- my_safe_printf_stderr("max_threads=%u\n",
- (uint) thread_scheduler->max_threads +
- (uint) extra_max_connections);
+ if (thread_scheduler)
+ my_safe_printf_stderr("max_threads=%u\n",
+ (uint) thread_scheduler->max_threads +
+ (uint) extra_max_connections);
my_safe_printf_stderr("thread_count=%u\n", (uint) thread_count);
- my_safe_printf_stderr("It is possible that mysqld could use up to \n"
- "key_buffer_size + "
- "(read_buffer_size + sort_buffer_size)*max_threads = "
- "%lu K bytes of memory\n",
- (ulong)(dflt_key_cache->key_cache_mem_size +
- (global_system_variables.read_buff_size +
- global_system_variables.sortbuff_size) *
- (thread_scheduler->max_threads + extra_max_connections) +
- (max_connections + extra_max_connections)* sizeof(THD)) / 1024);
-
- my_safe_printf_stderr("%s",
- "Hope that's ok; if not, decrease some variables in the equation.\n\n");
+ if (dflt_key_cache && thread_scheduler)
+ {
+ my_safe_printf_stderr("It is possible that mysqld could use up to \n"
+ "key_buffer_size + "
+ "(read_buffer_size + sort_buffer_size)*max_threads = "
+ "%lu K bytes of memory\n",
+ (ulong)
+ (dflt_key_cache->key_cache_mem_size +
+ (global_system_variables.read_buff_size +
+ global_system_variables.sortbuff_size) *
+ (thread_scheduler->max_threads + extra_max_connections) +
+ (max_connections + extra_max_connections) *
+ sizeof(THD)) / 1024);
+ my_safe_printf_stderr("%s",
+ "Hope that's ok; if not, decrease some variables in "
+ "the equation.\n\n");
+ }
#ifdef HAVE_STACKTRACE
thd= current_thd;
diff --git a/sql/slave.cc b/sql/slave.cc
index e228033f15a..6e5bfedf89b 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -77,6 +77,10 @@ Master_info *active_mi= 0;
Master_info_index *master_info_index;
my_bool replicate_same_server_id;
ulonglong relay_log_space_limit = 0;
+
+const char *relay_log_index= 0;
+const char *relay_log_basename= 0;
+
LEX_STRING default_master_connection_name= { (char*) "", 0 };
/*
@@ -117,7 +121,7 @@ static const char *reconnect_messages[SLAVE_RECON_ACT_MAX][SLAVE_RECON_MSG_MAX]=
registration on master",
"Reconnecting after a failed registration on master",
"failed registering on master, reconnecting to try again, \
-log '%s' at position %s%s",
+log '%s' at position %llu%s",
"COM_REGISTER_SLAVE",
"Slave I/O thread killed during or after reconnect"
},
@@ -125,7 +129,7 @@ log '%s' at position %s%s",
"Waiting to reconnect after a failed binlog dump request",
"Slave I/O thread killed while retrying master dump",
"Reconnecting after a failed binlog dump request",
- "failed dump request, reconnecting to try again, log '%s' at position %s%s",
+ "failed dump request, reconnecting to try again, log '%s' at position %llu%s",
"COM_BINLOG_DUMP",
"Slave I/O thread killed during or after reconnect"
},
@@ -134,7 +138,7 @@ log '%s' at position %s%s",
"Slave I/O thread killed while waiting to reconnect after a failed read",
"Reconnecting after a failed master event read",
"Slave I/O thread: Failed reading log event, reconnecting to retry, \
-log '%s' at position %s%s",
+log '%s' at position %llu%s",
"",
"Slave I/O thread killed during or after a reconnect done to recover from \
failed read"
@@ -295,6 +299,7 @@ handle_slave_init(void *arg __attribute__((unused)))
thd->thread_id= thread_id++;
mysql_mutex_unlock(&LOCK_thread_count);
thd->system_thread = SYSTEM_THREAD_SLAVE_INIT;
+ thread_safe_increment32(&service_thread_count);
thd->store_globals();
thd->security_ctx->skip_grants();
thd->set_command(COM_DAEMON);
@@ -310,6 +315,8 @@ handle_slave_init(void *arg __attribute__((unused)))
mysql_mutex_lock(&LOCK_thread_count);
delete thd;
mysql_mutex_unlock(&LOCK_thread_count);
+ thread_safe_decrement32(&service_thread_count);
+ signal_thd_deleted();
my_thread_end();
mysql_mutex_lock(&LOCK_slave_init);
@@ -426,7 +433,8 @@ int init_slave()
if (active_mi->host[0] && !opt_skip_slave_start)
{
- if (start_slave_threads(1 /* need mutex */,
+ if (start_slave_threads(0, /* No active thd */
+ 1 /* need mutex */,
0 /* no wait for start*/,
active_mi,
master_info_file,
@@ -644,11 +652,10 @@ int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock)
DBUG_RETURN(ER_ERROR_DURING_FLUSH_LOGS);
mysql_mutex_unlock(log_lock);
-
- if (opt_slave_parallel_threads > 0 &&
- !master_info_index->any_slave_sql_running())
- rpl_parallel_inactivate_pool(&global_rpl_thread_pool);
}
+ if (opt_slave_parallel_threads > 0 &&
+ !master_info_index->any_slave_sql_running())
+ rpl_parallel_inactivate_pool(&global_rpl_thread_pool);
if (thread_mask & (SLAVE_IO|SLAVE_FORCE_ALL))
{
DBUG_PRINT("info",("Terminating IO thread"));
@@ -884,7 +891,8 @@ int start_slave_thread(
started the threads that were not previously running
*/
-int start_slave_threads(bool need_slave_mutex, bool wait_for_start,
+int start_slave_threads(THD *thd,
+ bool need_slave_mutex, bool wait_for_start,
Master_info* mi, const char* master_info_fname,
const char* slave_info_fname, int thread_mask)
{
@@ -930,7 +938,7 @@ int start_slave_threads(bool need_slave_mutex, bool wait_for_start,
mi->rli.group_master_log_pos);
strmake(mi->master_log_name, mi->rli.group_master_log_name,
sizeof(mi->master_log_name)-1);
- purge_relay_logs(&mi->rli, NULL, 0, &errmsg);
+ purge_relay_logs(&mi->rli, thd, 0, &errmsg);
mi->rli.group_master_log_pos= mi->master_log_pos;
strmake(mi->rli.group_master_log_name, mi->master_log_name,
sizeof(mi->rli.group_master_log_name)-1);
@@ -1108,14 +1116,14 @@ static bool sql_slave_killed(rpl_group_info *rgi)
else
{
rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, rgi->gtid_info(),
- ER(ER_SLAVE_FATAL_ERROR), msg_stopped);
+ ER_THD(thd, ER_SLAVE_FATAL_ERROR), msg_stopped);
}
}
else
{
ret= TRUE;
rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, rgi->gtid_info(),
- ER(ER_SLAVE_FATAL_ERROR),
+ ER_THD(thd, ER_SLAVE_FATAL_ERROR),
msg_stopped);
}
}
@@ -1401,7 +1409,7 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi)
"Master reported unrecognized MySQL version: %s",
mysql->server_version);
err_code= ER_SLAVE_FATAL_ERROR;
- sprintf(err_buff, ER(err_code), err_buff2);
+ sprintf(err_buff, ER_DEFAULT(err_code), err_buff2);
}
else
{
@@ -1417,7 +1425,7 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi)
"Master reported unrecognized MySQL version: %s",
mysql->server_version);
err_code= ER_SLAVE_FATAL_ERROR;
- sprintf(err_buff, ER(err_code), err_buff2);
+ sprintf(err_buff, ER_DEFAULT(err_code), err_buff2);
break;
case 3:
mi->rli.relay_log.description_event_for_queue= new
@@ -1457,7 +1465,7 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi)
{
errmsg= "default Format_description_log_event";
err_code= ER_SLAVE_CREATE_EVENT_FAILURE;
- sprintf(err_buff, ER(err_code), errmsg);
+ sprintf(err_buff, ER_DEFAULT(err_code), errmsg);
goto err;
}
@@ -1587,7 +1595,7 @@ MySQL server ids; these ids must be different for replication to work (or \
the --replicate-same-server-id option must be used on slave but this does \
not always make sense; please check the manual before using it).";
err_code= ER_SLAVE_FATAL_ERROR;
- sprintf(err_buff, ER(err_code), errmsg);
+ sprintf(err_buff, ER_DEFAULT(err_code), errmsg);
goto err;
}
}
@@ -1623,7 +1631,7 @@ maybe it is a *VERY OLD MASTER*.");
{
errmsg= "Slave configured with server id filtering could not detect the master server id.";
err_code= ER_SLAVE_FATAL_ERROR;
- sprintf(err_buff, ER(err_code), errmsg);
+ sprintf(err_buff, ER_DEFAULT(err_code), errmsg);
goto err;
}
@@ -1662,7 +1670,7 @@ maybe it is a *VERY OLD MASTER*.");
different values for the COLLATION_SERVER global variable. The values must \
be equal for the Statement-format replication to work";
err_code= ER_SLAVE_FATAL_ERROR;
- sprintf(err_buff, ER(err_code), errmsg);
+ sprintf(err_buff, ER_DEFAULT(err_code), errmsg);
goto err;
}
}
@@ -1725,7 +1733,7 @@ inconsistency if replicated data deals with collation.");
different values for the TIME_ZONE global variable. The values must \
be equal for the Statement-format replication to work";
err_code= ER_SLAVE_FATAL_ERROR;
- sprintf(err_buff, ER(err_code), errmsg);
+ sprintf(err_buff, ER_DEFAULT(err_code), errmsg);
goto err;
}
}
@@ -1764,14 +1772,13 @@ when it try to get the value of TIME_ZONE global variable from master.";
if (mi->heartbeat_period != 0.0)
{
- char llbuf[22];
- const char query_format[]= "SET @master_heartbeat_period= %s";
- char query[sizeof(query_format) - 2 + sizeof(llbuf)];
+ const char query_format[]= "SET @master_heartbeat_period= %llu";
+ char query[sizeof(query_format) + 32];
/*
the period is an ulonglong of nano-secs.
*/
- llstr((ulonglong) (mi->heartbeat_period*1000000000UL), llbuf);
- sprintf(query, query_format, llbuf);
+ my_snprintf(query, sizeof(query), query_format,
+ (ulonglong) (mi->heartbeat_period*1000000000UL));
DBUG_EXECUTE_IF("simulate_slave_heartbeat_network_error",
{ static ulong dbug_count= 0;
@@ -1873,8 +1880,8 @@ when it try to get the value of TIME_ZONE global variable from master.";
(master_row= mysql_fetch_row(master_res)) &&
(master_row[0] != NULL))
{
- mi->checksum_alg_before_fd= (uint8)
- find_type(master_row[0], &binlog_checksum_typelib, 1) - 1;
+ mi->checksum_alg_before_fd= (enum_binlog_checksum_alg)
+ (find_type(master_row[0], &binlog_checksum_typelib, 1) - 1);
// valid outcome is either of
DBUG_ASSERT(mi->checksum_alg_before_fd == BINLOG_CHECKSUM_ALG_OFF ||
mi->checksum_alg_before_fd == BINLOG_CHECKSUM_ALG_CRC32);
@@ -2290,13 +2297,10 @@ static bool wait_for_relay_log_space(Relay_log_info* rli)
{
#ifndef DBUG_OFF
{
- char llbuf1[22], llbuf2[22];
- DBUG_PRINT("info", ("log_space_limit=%s "
- "log_space_total=%s "
+ DBUG_PRINT("info", ("log_space_limit=%llu log_space_total=%llu "
"ignore_log_space_limit=%d "
"sql_force_rotate_relay=%d",
- llstr(rli->log_space_limit,llbuf1),
- llstr(rli->log_space_total,llbuf2),
+ rli->log_space_limit, rli->log_space_total,
(int) rli->ignore_log_space_limit,
(int) rli->sql_force_rotate_relay));
}
@@ -2347,7 +2351,7 @@ static void write_ignored_events_info_to_relay_log(THD *thd, Master_info *mi)
rli->ign_master_log_name_end[0]= 0;
if (unlikely(!(bool)rev))
mi->report(ERROR_LEVEL, ER_SLAVE_CREATE_EVENT_FAILURE, NULL,
- ER(ER_SLAVE_CREATE_EVENT_FAILURE),
+ ER_THD(thd, ER_SLAVE_CREATE_EVENT_FAILURE),
"Rotate_event (out of memory?),"
" SHOW SLAVE STATUS may be inaccurate");
}
@@ -2358,7 +2362,7 @@ static void write_ignored_events_info_to_relay_log(THD *thd, Master_info *mi)
rli->ign_gtids.reset();
if (unlikely(!(bool)glev))
mi->report(ERROR_LEVEL, ER_SLAVE_CREATE_EVENT_FAILURE, NULL,
- ER(ER_SLAVE_CREATE_EVENT_FAILURE),
+ ER_THD(thd, ER_SLAVE_CREATE_EVENT_FAILURE),
"Gtid_list_event (out of memory?),"
" gtid_slave_pos may be inaccurate");
}
@@ -2371,7 +2375,7 @@ static void write_ignored_events_info_to_relay_log(THD *thd, Master_info *mi)
rev->server_id= 0; // don't be ignored by slave SQL thread
if (unlikely(rli->relay_log.append(rev)))
mi->report(ERROR_LEVEL, ER_SLAVE_RELAY_LOG_WRITE_FAILURE, NULL,
- ER(ER_SLAVE_RELAY_LOG_WRITE_FAILURE),
+ ER_THD(thd, ER_SLAVE_RELAY_LOG_WRITE_FAILURE),
"failed to write a Rotate event"
" to the relay log, SHOW SLAVE STATUS may be"
" inaccurate");
@@ -2384,7 +2388,7 @@ static void write_ignored_events_info_to_relay_log(THD *thd, Master_info *mi)
glev->set_artificial_event(); // Don't mess up Exec_Master_Log_Pos
if (unlikely(rli->relay_log.append(glev)))
mi->report(ERROR_LEVEL, ER_SLAVE_RELAY_LOG_WRITE_FAILURE, NULL,
- ER(ER_SLAVE_RELAY_LOG_WRITE_FAILURE),
+ ER_THD(thd, ER_SLAVE_RELAY_LOG_WRITE_FAILURE),
"failed to write a Gtid_list event to the relay log, "
"gtid_slave_pos may be inaccurate");
delete glev;
@@ -2510,107 +2514,212 @@ static bool send_show_master_info_header(THD *thd, bool full,
List<Item> field_list;
Protocol *protocol= thd->protocol;
Master_info *mi;
+ MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("show_master_info_header");
if (full)
{
- field_list.push_back(new Item_empty_string("Connection_name",
- MAX_CONNECTION_NAME));
- field_list.push_back(new Item_empty_string("Slave_SQL_State",
- 30));
- }
-
- field_list.push_back(new Item_empty_string("Slave_IO_State",
- 30));
- field_list.push_back(new Item_empty_string("Master_Host",
- sizeof(mi->host)));
- field_list.push_back(new Item_empty_string("Master_User",
- sizeof(mi->user)));
- field_list.push_back(new Item_return_int("Master_Port", 7,
- MYSQL_TYPE_LONG));
- field_list.push_back(new Item_return_int("Connect_Retry", 10,
- MYSQL_TYPE_LONG));
- field_list.push_back(new Item_empty_string("Master_Log_File",
- FN_REFLEN));
- field_list.push_back(new Item_return_int("Read_Master_Log_Pos", 10,
- MYSQL_TYPE_LONGLONG));
- field_list.push_back(new Item_empty_string("Relay_Log_File",
- FN_REFLEN));
- field_list.push_back(new Item_return_int("Relay_Log_Pos", 10,
- MYSQL_TYPE_LONGLONG));
- field_list.push_back(new Item_empty_string("Relay_Master_Log_File",
- FN_REFLEN));
- field_list.push_back(new Item_empty_string("Slave_IO_Running", 3));
- field_list.push_back(new Item_empty_string("Slave_SQL_Running", 3));
- field_list.push_back(new Item_empty_string("Replicate_Do_DB", 20));
- field_list.push_back(new Item_empty_string("Replicate_Ignore_DB", 20));
- field_list.push_back(new Item_empty_string("Replicate_Do_Table", 20));
- field_list.push_back(new Item_empty_string("Replicate_Ignore_Table", 23));
- field_list.push_back(new Item_empty_string("Replicate_Wild_Do_Table", 24));
- field_list.push_back(new Item_empty_string("Replicate_Wild_Ignore_Table",
- 28));
- field_list.push_back(new Item_return_int("Last_Errno", 4, MYSQL_TYPE_LONG));
- field_list.push_back(new Item_empty_string("Last_Error", 20));
- field_list.push_back(new Item_return_int("Skip_Counter", 10,
- MYSQL_TYPE_LONG));
- field_list.push_back(new Item_return_int("Exec_Master_Log_Pos", 10,
- MYSQL_TYPE_LONGLONG));
- field_list.push_back(new Item_return_int("Relay_Log_Space", 10,
- MYSQL_TYPE_LONGLONG));
- field_list.push_back(new Item_empty_string("Until_Condition", 6));
- field_list.push_back(new Item_empty_string("Until_Log_File", FN_REFLEN));
- field_list.push_back(new Item_return_int("Until_Log_Pos", 10,
- MYSQL_TYPE_LONGLONG));
- field_list.push_back(new Item_empty_string("Master_SSL_Allowed", 7));
- field_list.push_back(new Item_empty_string("Master_SSL_CA_File",
- sizeof(mi->ssl_ca)));
- field_list.push_back(new Item_empty_string("Master_SSL_CA_Path",
- sizeof(mi->ssl_capath)));
- field_list.push_back(new Item_empty_string("Master_SSL_Cert",
- sizeof(mi->ssl_cert)));
- field_list.push_back(new Item_empty_string("Master_SSL_Cipher",
- sizeof(mi->ssl_cipher)));
- field_list.push_back(new Item_empty_string("Master_SSL_Key",
- sizeof(mi->ssl_key)));
- field_list.push_back(new Item_return_int("Seconds_Behind_Master", 10,
- MYSQL_TYPE_LONGLONG));
- field_list.push_back(new Item_empty_string("Master_SSL_Verify_Server_Cert",
- 3));
- field_list.push_back(new Item_return_int("Last_IO_Errno", 4, MYSQL_TYPE_LONG));
- field_list.push_back(new Item_empty_string("Last_IO_Error", 20));
- field_list.push_back(new Item_return_int("Last_SQL_Errno", 4, MYSQL_TYPE_LONG));
- field_list.push_back(new Item_empty_string("Last_SQL_Error", 20));
- field_list.push_back(new Item_empty_string("Replicate_Ignore_Server_Ids",
- FN_REFLEN));
- field_list.push_back(new Item_return_int("Master_Server_Id", sizeof(ulong),
- MYSQL_TYPE_LONG));
- field_list.push_back(new Item_empty_string("Master_SSL_Crl",
- sizeof(mi->ssl_crl)));
- field_list.push_back(new Item_empty_string("Master_SSL_Crlpath",
- sizeof(mi->ssl_crlpath)));
- field_list.push_back(new Item_empty_string("Using_Gtid",
- sizeof("Current_Pos")-1));
- field_list.push_back(new Item_empty_string("Gtid_IO_Pos", 30));
- field_list.push_back(new Item_empty_string("Replicate_Do_Domain_Ids",
- FN_REFLEN));
- field_list.push_back(new Item_empty_string("Replicate_Ignore_Domain_Ids",
- FN_REFLEN));
- field_list.push_back(new Item_empty_string("Parallel_Mode",
- sizeof("conservative")-1));
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Connection_name",
+ MAX_CONNECTION_NAME),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Slave_SQL_State", 30),
+ thd->mem_root);
+ }
+
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Slave_IO_State", 30),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Master_Host", sizeof(mi->host)),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Master_User", sizeof(mi->user)),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Master_Port", 7, MYSQL_TYPE_LONG),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Connect_Retry", 10,
+ MYSQL_TYPE_LONG),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Master_Log_File", FN_REFLEN),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Read_Master_Log_Pos", 10,
+ MYSQL_TYPE_LONGLONG),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Relay_Log_File", FN_REFLEN),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Relay_Log_Pos", 10,
+ MYSQL_TYPE_LONGLONG),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Relay_Master_Log_File",
+ FN_REFLEN),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Slave_IO_Running", 3),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Slave_SQL_Running", 3),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Replicate_Do_DB", 20),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Replicate_Ignore_DB", 20),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Replicate_Do_Table", 20),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Replicate_Ignore_Table", 23),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Replicate_Wild_Do_Table", 24),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Replicate_Wild_Ignore_Table",
+ 28),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Last_Errno", 4, MYSQL_TYPE_LONG),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Last_Error", 20),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Skip_Counter", 10,
+ MYSQL_TYPE_LONG),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Exec_Master_Log_Pos", 10,
+ MYSQL_TYPE_LONGLONG),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Relay_Log_Space", 10,
+ MYSQL_TYPE_LONGLONG),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Until_Condition", 6),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Until_Log_File", FN_REFLEN),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Until_Log_Pos", 10,
+ MYSQL_TYPE_LONGLONG),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Master_SSL_Allowed", 7),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Master_SSL_CA_File",
+ sizeof(mi->ssl_ca)),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Master_SSL_CA_Path",
+ sizeof(mi->ssl_capath)),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Master_SSL_Cert",
+ sizeof(mi->ssl_cert)),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Master_SSL_Cipher",
+ sizeof(mi->ssl_cipher)),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Master_SSL_Key",
+ sizeof(mi->ssl_key)),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Seconds_Behind_Master", 10,
+ MYSQL_TYPE_LONGLONG),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Master_SSL_Verify_Server_Cert",
+ 3),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Last_IO_Errno", 4,
+ MYSQL_TYPE_LONG),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Last_IO_Error", 20),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Last_SQL_Errno", 4,
+ MYSQL_TYPE_LONG),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Last_SQL_Error", 20),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Replicate_Ignore_Server_Ids",
+ FN_REFLEN),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Master_Server_Id", sizeof(ulong),
+ MYSQL_TYPE_LONG),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Master_SSL_Crl",
+ sizeof(mi->ssl_crl)),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Master_SSL_Crlpath",
+ sizeof(mi->ssl_crlpath)),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Using_Gtid",
+ sizeof("Current_Pos")-1),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Gtid_IO_Pos", 30),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Replicate_Do_Domain_Ids",
+ FN_REFLEN),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Replicate_Ignore_Domain_Ids",
+ FN_REFLEN),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Parallel_Mode",
+ sizeof("conservative")-1),
+ thd->mem_root);
if (full)
{
- field_list.push_back(new Item_return_int("Retried_transactions",
- 10, MYSQL_TYPE_LONG));
- field_list.push_back(new Item_return_int("Max_relay_log_size",
- 10, MYSQL_TYPE_LONGLONG));
- field_list.push_back(new Item_return_int("Executed_log_entries",
- 10, MYSQL_TYPE_LONG));
- field_list.push_back(new Item_return_int("Slave_received_heartbeats",
- 10, MYSQL_TYPE_LONG));
- field_list.push_back(new Item_float("Slave_heartbeat_period",
- 0.0, 3, 10));
- field_list.push_back(new Item_empty_string("Gtid_Slave_Pos",
- gtid_pos_length));
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Retried_transactions", 10,
+ MYSQL_TYPE_LONG),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Max_relay_log_size", 10,
+ MYSQL_TYPE_LONGLONG),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Executed_log_entries", 10,
+ MYSQL_TYPE_LONG),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Slave_received_heartbeats", 10,
+ MYSQL_TYPE_LONG),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_float(thd, "Slave_heartbeat_period", 0.0, 3, 10),
+ thd->mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Gtid_Slave_Pos",
+ gtid_pos_length),
+ thd->mem_root);
}
if (protocol->send_result_set_metadata(&field_list,
@@ -2631,8 +2740,7 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
String *packet= &thd->packet;
Protocol *protocol= thd->protocol;
Rpl_filter *rpl_filter= mi->rpl_filter;
- char buf[256];
- String tmp(buf, sizeof(buf), &my_charset_bin);
+ StringBuffer<256> tmp;
protocol->prepare_for_resend();
@@ -2788,8 +2896,6 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
protocol->store(mi->using_gtid_astext(mi->using_gtid), &my_charset_bin);
// Gtid_IO_Pos
{
- char buff[30];
- String tmp(buff, sizeof(buff), system_charset_info);
mi->gtid_current_pos.to_string(&tmp);
protocol->store(tmp.ptr(), tmp.length(), &my_charset_bin);
}
@@ -2950,17 +3056,20 @@ static int init_slave_thread(THD* thd, Master_info *mi,
simulate_error|= (1 << SLAVE_THD_IO););
DBUG_EXECUTE_IF("simulate_sql_slave_error_on_init",
simulate_error|= (1 << SLAVE_THD_SQL););
+
+ thd->system_thread = (thd_type == SLAVE_THD_SQL) ?
+ SYSTEM_THREAD_SLAVE_SQL : SYSTEM_THREAD_SLAVE_IO;
+ thread_safe_increment32(&service_thread_count);
+
/* We must call store_globals() before doing my_net_init() */
if (init_thr_lock() || thd->store_globals() ||
- my_net_init(&thd->net, 0, MYF(MY_THREAD_SPECIFIC)) ||
+ my_net_init(&thd->net, 0, thd, MYF(MY_THREAD_SPECIFIC)) ||
IF_DBUG(simulate_error & (1<< thd_type), 0))
{
thd->cleanup();
DBUG_RETURN(-1);
}
- thd->system_thread = (thd_type == SLAVE_THD_SQL) ?
- SYSTEM_THREAD_SLAVE_SQL : SYSTEM_THREAD_SLAVE_IO;
thd->security_ctx->skip_grants();
thd->slave_thread= 1;
thd->connection_name= mi->connection_name;
@@ -3295,15 +3404,10 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd,
if (!rli->is_fake)
#endif
{
-#ifndef DBUG_OFF
- char buf[22];
-#endif
DBUG_PRINT("info", ("update_pos error = %d", error));
- DBUG_PRINT("info", ("group %s %s",
- llstr(rli->group_relay_log_pos, buf),
+ DBUG_PRINT("info", ("group %llu %s", rli->group_relay_log_pos,
rli->group_relay_log_name));
- DBUG_PRINT("info", ("event %s %s",
- llstr(rli->event_relay_log_pos, buf),
+ DBUG_PRINT("info", ("event %llu %s", rli->event_relay_log_pos,
rli->event_relay_log_name));
}
/*
@@ -3315,14 +3419,12 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd,
*/
if (error)
{
- char buf[22];
rli->report(ERROR_LEVEL, ER_UNKNOWN_ERROR, rgi->gtid_info(),
"It was not possible to update the positions"
" of the relay log information: the slave may"
" be in an inconsistent state."
- " Stopped in %s position %s",
- rli->group_relay_log_name,
- llstr(rli->group_relay_log_pos, buf));
+ " Stopped in %s position %llu",
+ rli->group_relay_log_name, rli->group_relay_log_pos);
DBUG_RETURN(2);
}
}
@@ -3489,11 +3591,14 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
*/
if ((rli->until_condition == Relay_log_info::UNTIL_MASTER_POS ||
rli->until_condition == Relay_log_info::UNTIL_RELAY_POS) &&
- rli->is_until_satisfied(thd, ev))
+ (ev->server_id != global_system_variables.server_id ||
+ rli->replicate_same_server_id) &&
+ rli->is_until_satisfied((rli->get_flag(Relay_log_info::IN_TRANSACTION) || !ev->log_pos)
+ ? rli->group_master_log_pos
+ : ev->log_pos - ev->data_written))
{
- char buf[22];
sql_print_information("Slave SQL thread stopped because it reached its"
- " UNTIL position %s", llstr(rli->until_pos(), buf));
+ " UNTIL position %llu", rli->until_pos());
/*
Setting abort_slave flag because we do not want additional
message about error in query execution to be printed.
@@ -3669,7 +3774,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
}
mysql_mutex_unlock(&rli->data_lock);
rli->report(ERROR_LEVEL, ER_SLAVE_RELAY_LOG_READ_FAILURE, NULL,
- ER(ER_SLAVE_RELAY_LOG_READ_FAILURE), "\
+ ER_THD(thd, ER_SLAVE_RELAY_LOG_READ_FAILURE), "\
Could not parse relay log event entry. The possible reasons are: the master's \
binary log is corrupted (you can check this by running 'mysqlbinlog' on the \
binary log), the slave's relay log is corrupted (you can check this by running \
@@ -3740,8 +3845,8 @@ static int try_to_reconnect(THD *thd, MYSQL *mysql, Master_info *mi,
thd->proc_info = messages[SLAVE_RECON_MSG_AFTER];
if (!suppress_warnings)
{
- char buf[256], llbuff[22];
- String tmp;
+ char buf[256];
+ StringBuffer<100> tmp;
if (mi->using_gtid != Master_info::USE_GTID_NO)
{
tmp.append(STRING_WITH_LEN("; GTID position '"));
@@ -3755,7 +3860,7 @@ static int try_to_reconnect(THD *thd, MYSQL *mysql, Master_info *mi,
}
}
my_snprintf(buf, sizeof(buf), messages[SLAVE_RECON_MSG_FAILED],
- IO_RPL_LOG_NAME, llstr(mi->master_log_pos, llbuff),
+ IO_RPL_LOG_NAME, mi->master_log_pos,
tmp.c_ptr_safe());
/*
Raise a warining during registering on master/requesting dump.
@@ -3764,7 +3869,7 @@ static int try_to_reconnect(THD *thd, MYSQL *mysql, Master_info *mi,
if (messages[SLAVE_RECON_MSG_COMMAND][0])
{
mi->report(WARNING_LEVEL, ER_SLAVE_MASTER_COM_FAILURE, NULL,
- ER(ER_SLAVE_MASTER_COM_FAILURE),
+ ER_THD(thd, ER_SLAVE_MASTER_COM_FAILURE),
messages[SLAVE_RECON_MSG_COMMAND], buf);
}
else
@@ -3796,13 +3901,11 @@ pthread_handler_t handle_slave_io(void *arg)
MYSQL *mysql;
Master_info *mi = (Master_info*)arg;
Relay_log_info *rli= &mi->rli;
- char llbuff[22];
uint retry_count;
bool suppress_warnings;
int ret;
rpl_io_thread_info io_info;
#ifndef DBUG_OFF
- uint retry_count_reg= 0, retry_count_dump= 0, retry_count_event= 0;
mi->dbug_do_disconnect= false;
#endif
// needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff
@@ -3844,9 +3947,8 @@ pthread_handler_t handle_slave_io(void *arg)
mysql_mutex_unlock(&mi->run_lock);
mysql_cond_broadcast(&mi->start_cond);
- DBUG_PRINT("master_info",("log_file_name: '%s' position: %s",
- mi->master_log_name,
- llstr(mi->master_log_pos,llbuff)));
+ DBUG_PRINT("master_info",("log_file_name: '%s' position: %llu",
+ mi->master_log_name, mi->master_log_pos));
/* This must be called before run any binlog_relay_io hooks */
my_pthread_setspecific_ptr(RPL_MASTER_INFO, mi);
@@ -3871,14 +3973,15 @@ pthread_handler_t handle_slave_io(void *arg)
if (RUN_HOOK(binlog_relay_io, thread_start, (thd, mi)))
{
mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, NULL,
- ER(ER_SLAVE_FATAL_ERROR), "Failed to run 'thread_start' hook");
+ ER_THD(thd, ER_SLAVE_FATAL_ERROR),
+ "Failed to run 'thread_start' hook");
goto err;
}
if (!(mi->mysql = mysql = mysql_init(NULL)))
{
mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, NULL,
- ER(ER_SLAVE_FATAL_ERROR), "error in mysql_init()");
+ ER_THD(thd, ER_SLAVE_FATAL_ERROR), "error in mysql_init()");
goto err;
}
@@ -3888,13 +3991,12 @@ pthread_handler_t handle_slave_io(void *arg)
{
if (mi->using_gtid == Master_info::USE_GTID_NO)
sql_print_information("Slave I/O thread: connected to master '%s@%s:%d',"
- "replication started in log '%s' at position %s",
+ "replication started in log '%s' at position %llu",
mi->user, mi->host, mi->port,
- IO_RPL_LOG_NAME,
- llstr(mi->master_log_pos,llbuff));
+ IO_RPL_LOG_NAME, mi->master_log_pos);
else
{
- String tmp;
+ StringBuffer<100> tmp;
mi->gtid_current_pos.to_string(&tmp);
sql_print_information("Slave I/O thread: connected to master '%s@%s:%d',"
"replication starts at GTID position '%s'",
@@ -3951,7 +4053,7 @@ connected:
if (ret == 2)
{
- if (check_io_slave_killed(mi, "Slave I/O thread killed"
+ if (check_io_slave_killed(mi, "Slave I/O thread killed "
"while calling get_master_version_and_clock(...)"))
goto err;
suppress_warnings= FALSE;
@@ -3985,16 +4087,6 @@ connected:
goto err;
goto connected;
}
- DBUG_EXECUTE_IF("FORCE_SLAVE_TO_RECONNECT_REG",
- if (!retry_count_reg)
- {
- retry_count_reg++;
- sql_print_information("Forcing to reconnect slave I/O thread");
- if (try_to_reconnect(thd, mysql, mi, &retry_count, suppress_warnings,
- reconnect_messages[SLAVE_RECON_ACT_REG]))
- goto err;
- goto connected;
- });
}
DBUG_PRINT("info",("Starting reading binary log from master"));
@@ -4011,16 +4103,7 @@ requesting master dump") ||
goto err;
goto connected;
}
- DBUG_EXECUTE_IF("FORCE_SLAVE_TO_RECONNECT_DUMP",
- if (!retry_count_dump)
- {
- retry_count_dump++;
- sql_print_information("Forcing to reconnect slave I/O thread");
- if (try_to_reconnect(thd, mysql, mi, &retry_count, suppress_warnings,
- reconnect_messages[SLAVE_RECON_ACT_DUMP]))
- goto err;
- goto connected;
- });
+
const char *event_buf;
DBUG_ASSERT(mi->last_error().number == 0);
@@ -4038,16 +4121,6 @@ requesting master dump") ||
if (check_io_slave_killed(mi, "Slave I/O thread killed while \
reading event"))
goto err;
- DBUG_EXECUTE_IF("FORCE_SLAVE_TO_RECONNECT_EVENT",
- if (!retry_count_event)
- {
- retry_count_event++;
- sql_print_information("Forcing to reconnect slave I/O thread");
- if (try_to_reconnect(thd, mysql, mi, &retry_count, suppress_warnings,
- reconnect_messages[SLAVE_RECON_ACT_EVENT]))
- goto err;
- goto connected;
- });
if (event_len == packet_error)
{
@@ -4064,14 +4137,14 @@ slave_max_allowed_packet",
goto err;
case ER_MASTER_FATAL_ERROR_READING_BINLOG:
mi->report(ERROR_LEVEL, ER_MASTER_FATAL_ERROR_READING_BINLOG, NULL,
- ER(ER_MASTER_FATAL_ERROR_READING_BINLOG),
+ ER_THD(thd, ER_MASTER_FATAL_ERROR_READING_BINLOG),
mysql_error_number, mysql_error(mysql));
goto err;
case ER_OUT_OF_RESOURCES:
sql_print_error("\
Stopping slave I/O thread due to out-of-memory error from master");
mi->report(ERROR_LEVEL, ER_OUT_OF_RESOURCES, NULL,
- "%s", ER(ER_OUT_OF_RESOURCES));
+ "%s", ER_THD(thd, ER_OUT_OF_RESOURCES));
goto err;
}
if (try_to_reconnect(thd, mysql, mi, &retry_count, suppress_warnings,
@@ -4088,7 +4161,7 @@ Stopping slave I/O thread due to out-of-memory error from master");
event_len, &event_buf, &event_len)))
{
mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, NULL,
- ER(ER_SLAVE_FATAL_ERROR),
+ ER_THD(thd, ER_SLAVE_FATAL_ERROR),
"Failed to run 'after_read_event' hook");
goto err;
}
@@ -4099,7 +4172,7 @@ Stopping slave I/O thread due to out-of-memory error from master");
if (queue_event(mi, event_buf, event_len))
{
mi->report(ERROR_LEVEL, ER_SLAVE_RELAY_LOG_WRITE_FAILURE, NULL,
- ER(ER_SLAVE_RELAY_LOG_WRITE_FAILURE),
+ ER_THD(thd, ER_SLAVE_RELAY_LOG_WRITE_FAILURE),
"could not queue event from master");
goto err;
}
@@ -4108,7 +4181,7 @@ Stopping slave I/O thread due to out-of-memory error from master");
(thd, mi, event_buf, event_len, synced)))
{
mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, NULL,
- ER(ER_SLAVE_FATAL_ERROR),
+ ER_THD(thd, ER_SLAVE_FATAL_ERROR),
"Failed to run 'after_queue_event' hook");
goto err;
}
@@ -4134,11 +4207,9 @@ Stopping slave I/O thread due to out-of-memory error from master");
*/
#ifndef DBUG_OFF
{
- char llbuf1[22], llbuf2[22];
- DBUG_PRINT("info", ("log_space_limit=%s log_space_total=%s \
-ignore_log_space_limit=%d",
- llstr(rli->log_space_limit,llbuf1),
- llstr(rli->log_space_total,llbuf2),
+ DBUG_PRINT("info", ("log_space_limit=%llu log_space_total=%llu "
+ "ignore_log_space_limit=%d",
+ rli->log_space_limit, rli->log_space_total,
(int) rli->ignore_log_space_limit));
}
#endif
@@ -4160,15 +4231,14 @@ err:
// print the current replication position
if (mi->using_gtid == Master_info::USE_GTID_NO)
sql_print_information("Slave I/O thread exiting, read up to log '%s', "
- "position %s",
- IO_RPL_LOG_NAME, llstr(mi->master_log_pos,llbuff));
+ "position %llu", IO_RPL_LOG_NAME, mi->master_log_pos);
else
{
- String tmp;
+ StringBuffer<100> tmp;
mi->gtid_current_pos.to_string(&tmp);
sql_print_information("Slave I/O thread exiting, read up to log '%s', "
- "position %s; GTID position %s",
- IO_RPL_LOG_NAME, llstr(mi->master_log_pos,llbuff),
+ "position %llu; GTID position %s",
+ IO_RPL_LOG_NAME, mi->master_log_pos,
tmp.c_ptr_safe());
}
RUN_HOOK(binlog_relay_io, thread_stop, (thd, mi));
@@ -4203,11 +4273,14 @@ err_during_init:
mi->rli.relay_log.description_event_for_queue= 0;
// TODO: make rpl_status part of Master_info
change_rpl_status(RPL_ACTIVE_SLAVE,RPL_IDLE_SLAVE);
+
mysql_mutex_lock(&LOCK_thread_count);
thd->unlink();
mysql_mutex_unlock(&LOCK_thread_count);
- THD_CHECK_SENTRY(thd);
delete thd;
+ thread_safe_decrement32(&service_thread_count);
+ signal_thd_deleted();
+
mi->abort_slave= 0;
mi->slave_running= MYSQL_SLAVE_NOT_RUN;
mi->io_thd= 0;
@@ -4305,7 +4378,6 @@ slave_output_error_info(rpl_group_info *rgi, THD *thd)
*/
Relay_log_info *rli= rgi->rli;
uint32 const last_errno= rli->last_error().number;
- char llbuff[22];
if (thd->is_error())
{
@@ -4353,7 +4425,7 @@ slave_output_error_info(rpl_group_info *rgi, THD *thd)
}
if (udf_error)
{
- String tmp;
+ StringBuffer<100> tmp;
if (rli->mi->using_gtid != Master_info::USE_GTID_NO)
{
tmp.append(STRING_WITH_LEN("; GTID position '"));
@@ -4363,22 +4435,22 @@ slave_output_error_info(rpl_group_info *rgi, THD *thd)
sql_print_error("Error loading user-defined library, slave SQL "
"thread aborted. Install the missing library, and restart the "
"slave SQL thread with \"SLAVE START\". We stopped at log '%s' "
- "position %s%s", RPL_LOG_NAME, llstr(rli->group_master_log_pos,
- llbuff), tmp.c_ptr_safe());
+ "position %llu%s", RPL_LOG_NAME, rli->group_master_log_pos,
+ tmp.c_ptr_safe());
}
else
{
- String tmp;
+ StringBuffer<100> tmp;
if (rli->mi->using_gtid != Master_info::USE_GTID_NO)
{
tmp.append(STRING_WITH_LEN("; GTID position '"));
rpl_append_gtid_state(&tmp, false);
tmp.append(STRING_WITH_LEN("'"));
}
- sql_print_error("\
-Error running query, slave SQL thread aborted. Fix the problem, and restart \
-the slave SQL thread with \"SLAVE START\". We stopped at log \
-'%s' position %s%s", RPL_LOG_NAME, llstr(rli->group_master_log_pos, llbuff),
+ sql_print_error("Error running query, slave SQL thread aborted. "
+ "Fix the problem, and restart the slave SQL thread "
+ "with \"SLAVE START\". We stopped at log '%s' position "
+ "%llu%s", RPL_LOG_NAME, rli->group_master_log_pos,
tmp.c_ptr_safe());
}
}
@@ -4395,7 +4467,6 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
pthread_handler_t handle_slave_sql(void *arg)
{
THD *thd; /* needs to be first for thread_stack */
- char llbuff[22],llbuff1[22];
char saved_log_name[FN_REFLEN];
char saved_master_log_name[FN_REFLEN];
my_off_t UNINIT_VAR(saved_log_pos);
@@ -4500,9 +4571,7 @@ pthread_handler_t handle_slave_sql(void *arg)
rli->parallel.reset();
//tell the I/O thread to take relay_log_space_limit into account from now on
- mysql_mutex_lock(&rli->log_space_lock);
rli->ignore_log_space_limit= 0;
- mysql_mutex_unlock(&rli->log_space_lock);
serial_rgi->gtid_sub_id= 0;
serial_rgi->gtid_pending= false;
@@ -4534,10 +4603,9 @@ pthread_handler_t handle_slave_sql(void *arg)
THD_CHECK_SENTRY(thd);
#ifndef DBUG_OFF
{
- char llbuf1[22], llbuf2[22];
- DBUG_PRINT("info", ("my_b_tell(rli->cur_log)=%s rli->event_relay_log_pos=%s",
- llstr(my_b_tell(rli->cur_log),llbuf1),
- llstr(rli->event_relay_log_pos,llbuf2)));
+ DBUG_PRINT("info", ("my_b_tell(rli->cur_log)=%llu "
+ "rli->event_relay_log_pos=%llu",
+ my_b_tell(rli->cur_log), rli->event_relay_log_pos));
DBUG_ASSERT(rli->event_relay_log_pos >= BIN_LOG_HEADER_SIZE);
/*
Wonder if this is correct. I (Guilhem) wonder if my_b_tell() returns the
@@ -4563,12 +4631,12 @@ pthread_handler_t handle_slave_sql(void *arg)
if (WSREP_ON)
wsrep_ready_wait();
#endif
- DBUG_PRINT("master_info",("log_file_name: %s position: %s",
+ DBUG_PRINT("master_info",("log_file_name: %s position: %llu",
rli->group_master_log_name,
- llstr(rli->group_master_log_pos,llbuff)));
+ rli->group_master_log_pos));
if (global_system_variables.log_warnings)
{
- String tmp;
+ StringBuffer<100> tmp;
if (mi->using_gtid != Master_info::USE_GTID_NO)
{
tmp.append(STRING_WITH_LEN("; GTID position '"));
@@ -4576,10 +4644,11 @@ pthread_handler_t handle_slave_sql(void *arg)
mi->using_gtid==Master_info::USE_GTID_CURRENT_POS);
tmp.append(STRING_WITH_LEN("'"));
}
- sql_print_information("Slave SQL thread initialized, starting replication in \
-log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME,
- llstr(rli->group_master_log_pos,llbuff),rli->group_relay_log_name,
- llstr(rli->group_relay_log_pos,llbuff1), tmp.c_ptr_safe());
+ sql_print_information("Slave SQL thread initialized, starting replication "
+ "in log '%s' at position %llu, relay log '%s' "
+ "position: %llu%s", RPL_LOG_NAME,
+ rli->group_master_log_pos, rli->group_relay_log_name,
+ rli->group_relay_log_pos, tmp.c_ptr_safe());
}
if (check_temp_dir(rli->slave_patternload_file))
@@ -4639,11 +4708,10 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME,
}
if ((rli->until_condition == Relay_log_info::UNTIL_MASTER_POS ||
rli->until_condition == Relay_log_info::UNTIL_RELAY_POS) &&
- rli->is_until_satisfied(thd, NULL))
+ rli->is_until_satisfied(rli->group_master_log_pos))
{
- char buf[22];
sql_print_information("Slave SQL thread stopped because it reached its"
- " UNTIL position %s", llstr(rli->until_pos(), buf));
+ " UNTIL position %llu", rli->until_pos());
mysql_mutex_unlock(&rli->data_lock);
goto err;
}
@@ -4658,7 +4726,7 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME,
if (saved_skip && rli->slave_skip_counter == 0)
{
- String tmp;
+ StringBuffer<100> tmp;
if (mi->using_gtid != Master_info::USE_GTID_NO)
{
tmp.append(STRING_WITH_LEN(", GTID '"));
@@ -4702,7 +4770,7 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME,
/* Thread stopped. Print the current replication position to the log */
{
- String tmp;
+ StringBuffer<100> tmp;
if (mi->using_gtid != Master_info::USE_GTID_NO)
{
tmp.append(STRING_WITH_LEN("; GTID position '"));
@@ -4710,10 +4778,8 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME,
tmp.append(STRING_WITH_LEN("'"));
}
sql_print_information("Slave SQL thread exiting, replication stopped in "
- "log '%s' at position %s%s",
- RPL_LOG_NAME,
- llstr(rli->group_master_log_pos,llbuff),
- tmp.c_ptr_safe());
+ "log '%s' at position %llu%s", RPL_LOG_NAME,
+ rli->group_master_log_pos, tmp.c_ptr_safe());
}
err:
@@ -4815,10 +4881,8 @@ err_during_init:
THD_CHECK_SENTRY(thd);
rli->sql_driver_thd= 0;
mysql_mutex_lock(&LOCK_thread_count);
- THD_CHECK_SENTRY(thd);
thd->rgi_fake= thd->rgi_slave= NULL;
delete serial_rgi;
- delete thd;
mysql_mutex_unlock(&LOCK_thread_count);
#ifdef WITH_WSREP
/* if slave stopped due to node going non primary, we set global flag to
@@ -4850,6 +4914,23 @@ err_during_init:
DBUG_EXECUTE_IF("simulate_slave_delay_at_terminate_bug38694", sleep(5););
mysql_mutex_unlock(&rli->run_lock); // tell the world we are done
+ /*
+ Deactivate the parallel replication thread pool, if there are now no more
+ SQL threads running. Do this here, when we have released all locks, but
+ while our THD (and current_thd) is still valid.
+ */
+ mysql_mutex_lock(&LOCK_active_mi);
+ if (opt_slave_parallel_threads > 0 &&
+ !master_info_index->any_slave_sql_running())
+ rpl_parallel_inactivate_pool(&global_rpl_thread_pool);
+ mysql_mutex_unlock(&LOCK_active_mi);
+
+ mysql_mutex_lock(&LOCK_thread_count);
+ delete thd;
+ mysql_mutex_unlock(&LOCK_thread_count);
+ thread_safe_decrement32(&service_thread_count);
+ signal_thd_deleted();
+
DBUG_LEAVE; // Must match DBUG_ENTER()
my_thread_end();
#ifdef HAVE_OPENSSL
@@ -4926,7 +5007,7 @@ static int process_io_create_file(Master_info* mi, Create_file_log_event* cev)
if (unlikely(mi->rli.relay_log.append(&xev)))
{
mi->report(ERROR_LEVEL, ER_SLAVE_RELAY_LOG_WRITE_FAILURE, NULL,
- ER(ER_SLAVE_RELAY_LOG_WRITE_FAILURE),
+ ER_THD(thd, ER_SLAVE_RELAY_LOG_WRITE_FAILURE),
"error writing Exec_load event to relay log");
goto err;
}
@@ -4940,7 +5021,7 @@ static int process_io_create_file(Master_info* mi, Create_file_log_event* cev)
if (unlikely(mi->rli.relay_log.append(cev)))
{
mi->report(ERROR_LEVEL, ER_SLAVE_RELAY_LOG_WRITE_FAILURE, NULL,
- ER(ER_SLAVE_RELAY_LOG_WRITE_FAILURE),
+ ER_THD(thd, ER_SLAVE_RELAY_LOG_WRITE_FAILURE),
"error writing Create_file event to relay log");
goto err;
}
@@ -4955,7 +5036,7 @@ static int process_io_create_file(Master_info* mi, Create_file_log_event* cev)
if (unlikely(mi->rli.relay_log.append(&aev)))
{
mi->report(ERROR_LEVEL, ER_SLAVE_RELAY_LOG_WRITE_FAILURE, NULL,
- ER(ER_SLAVE_RELAY_LOG_WRITE_FAILURE),
+ ER_THD(thd, ER_SLAVE_RELAY_LOG_WRITE_FAILURE),
"error writing Append_block event to relay log");
goto err;
}
@@ -5259,7 +5340,7 @@ static int queue_old_event(Master_info *mi, const char *buf,
static int queue_event(Master_info* mi,const char* buf, ulong event_len)
{
int error= 0;
- String error_msg;
+ StringBuffer<1024> error_msg;
ulonglong inc_pos;
ulonglong event_pos;
Relay_log_info *rli= &mi->rli;
@@ -5276,9 +5357,9 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
Show-up of FD:s affects checksum_alg at once because
that changes FD_queue.
*/
- uint8 checksum_alg= mi->checksum_alg_before_fd != BINLOG_CHECKSUM_ALG_UNDEF ?
- mi->checksum_alg_before_fd :
- mi->rli.relay_log.relay_log_checksum_alg;
+ enum enum_binlog_checksum_alg checksum_alg=
+ mi->checksum_alg_before_fd != BINLOG_CHECKSUM_ALG_UNDEF ?
+ mi->checksum_alg_before_fd : mi->rli.relay_log.relay_log_checksum_alg;
char *save_buf= NULL; // needed for checksumming the fake Rotate event
char rot_buf[LOG_EVENT_HEADER_LEN + ROTATE_HEADER_LEN + FN_REFLEN];
@@ -5420,7 +5501,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
mi->master_log_name, rev.new_log_ident);
mysql_mutex_lock(log_lock);
- if (likely(!fdle.write(rli->relay_log.get_log_file()) &&
+ if (likely(!rli->relay_log.write_event(&fdle) &&
!rli->relay_log.flush_and_sync(NULL)))
{
rli->relay_log.harvest_bytes_written(&rli->log_space_total);
@@ -5460,7 +5541,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
if (uint4korr(&buf[0]) == 0 && checksum_alg == BINLOG_CHECKSUM_ALG_OFF &&
mi->rli.relay_log.relay_log_checksum_alg != BINLOG_CHECKSUM_ALG_OFF)
{
- ha_checksum rot_crc= my_checksum(0L, NULL, 0);
+ ha_checksum rot_crc= 0;
event_len += BINLOG_CHECKSUM_LEN;
memcpy(rot_buf, buf, event_len - BINLOG_CHECKSUM_LEN);
int4store(&rot_buf[EVENT_LEN_OFFSET],
@@ -5526,6 +5607,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
error= ER_SLAVE_RELAY_LOG_WRITE_FAILURE;
goto err;
}
+ tmp->copy_crypto_data(mi->rli.relay_log.description_event_for_queue);
delete mi->rli.relay_log.description_event_for_queue;
mi->rli.relay_log.description_event_for_queue= tmp;
if (tmp->checksum_alg == BINLOG_CHECKSUM_ALG_UNDEF)
@@ -5567,7 +5649,6 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
/*
HB (heartbeat) cannot come before RL (Relay)
*/
- char llbuf[22];
Heartbeat_log_event hb(buf,
mi->rli.relay_log.relay_log_checksum_alg
!= BINLOG_CHECKSUM_ALG_OFF ?
@@ -5580,8 +5661,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
error_msg.append(STRING_WITH_LEN("the event's data: log_file_name "));
error_msg.append(hb.get_log_ident(), (uint) strlen(hb.get_log_ident()));
error_msg.append(STRING_WITH_LEN(" log_pos "));
- llstr(hb.log_pos, llbuf);
- error_msg.append(llbuf, strlen(llbuf));
+ error_msg.append_ulonglong(hb.log_pos);
goto err;
}
mi->received_heartbeats++;
@@ -5609,8 +5689,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
error_msg.append(STRING_WITH_LEN("the event's data: log_file_name "));
error_msg.append(hb.get_log_ident(), (uint) strlen(hb.get_log_ident()));
error_msg.append(STRING_WITH_LEN(" log_pos "));
- llstr(hb.log_pos, llbuf);
- error_msg.append(llbuf, strlen(llbuf));
+ error_msg.append_ulonglong(hb.log_pos);
goto err;
}
goto skip_relay_logging;
@@ -5950,7 +6029,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
}
else
{
- if (likely(!(rli->relay_log.appendv(buf,event_len,0))))
+ if (likely(!rli->relay_log.write_event_buffer((uchar*)buf, event_len)))
{
mi->master_log_pos+= inc_pos;
DBUG_PRINT("info", ("master_log_pos: %lu", (ulong) mi->master_log_pos));
@@ -6000,7 +6079,7 @@ err:
handle_slave_io() prints it on return.
*/
if (error && error != ER_SLAVE_RELAY_LOG_WRITE_FAILURE)
- mi->report(ERROR_LEVEL, error, NULL, ER(error),
+ mi->report(ERROR_LEVEL, error, NULL, ER_DEFAULT(error),
error_msg.ptr());
DBUG_RETURN(error);
@@ -6099,7 +6178,6 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi,
int slave_was_killed;
int last_errno= -2; // impossible error
ulong err_count=0;
- char llbuff[22];
my_bool my_true= 1;
DBUG_ENTER("connect_to_master");
set_slave_max_allowed_packet(thd, mysql);
@@ -6161,7 +6239,7 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi,
if (mi->user == NULL || mi->user[0] == 0)
{
mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, NULL,
- ER(ER_SLAVE_FATAL_ERROR),
+ ER_THD(thd, ER_SLAVE_FATAL_ERROR),
"Invalid (empty) username when attempting to "
"connect to the master server. Connection attempt "
"terminated.");
@@ -6207,11 +6285,10 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi,
if (reconnect)
{
if (!suppress_warnings && global_system_variables.log_warnings)
- sql_print_information("Slave: connected to master '%s@%s:%d',\
-replication resumed in log '%s' at position %s", mi->user,
- mi->host, mi->port,
- IO_RPL_LOG_NAME,
- llstr(mi->master_log_pos,llbuff));
+ sql_print_information("Slave: connected to master '%s@%s:%d',"
+ "replication resumed in log '%s' at "
+ "position %llu", mi->user, mi->host, mi->port,
+ IO_RPL_LOG_NAME, mi->master_log_pos);
}
else
{
@@ -6494,10 +6571,8 @@ static Log_event* next_event(rpl_group_info *rgi, ulonglong *event_size)
#ifndef DBUG_OFF
{
/* This is an assertion which sometimes fails, let's try to track it */
- char llbuf1[22], llbuf2[22];
- DBUG_PRINT("info", ("my_b_tell(cur_log)=%s rli->event_relay_log_pos=%s",
- llstr(my_b_tell(cur_log),llbuf1),
- llstr(rli->event_relay_log_pos,llbuf2)));
+ DBUG_PRINT("info", ("my_b_tell(cur_log)=%llu rli->event_relay_log_pos=%llu",
+ my_b_tell(cur_log), rli->event_relay_log_pos));
DBUG_ASSERT(my_b_tell(cur_log) >= BIN_LOG_HEADER_SIZE);
DBUG_ASSERT(rli->mi->using_parallel() ||
my_b_tell(cur_log) == rli->event_relay_log_pos);
@@ -6685,14 +6760,8 @@ static Log_event* next_event(rpl_group_info *rgi, ulonglong *event_size)
rli->ignore_log_space_limit= true;
}
- /*
- If the I/O thread is blocked, unblock it. Ok to broadcast
- after unlock, because the mutex is only destroyed in
- ~Relay_log_info(), i.e. when rli is destroyed, and rli will
- not be destroyed before we exit the present function.
- */
- mysql_mutex_unlock(&rli->log_space_lock);
mysql_cond_broadcast(&rli->log_space_cond);
+ mysql_mutex_unlock(&rli->log_space_lock);
// Note that wait_for_update_relay_log unlocks lock_log !
rli->relay_log.wait_for_update_relay_log(rli->sql_driver_thd);
// re-acquire data lock since we released it earlier
@@ -6710,6 +6779,7 @@ static Log_event* next_event(rpl_group_info *rgi, ulonglong *event_size)
mysql_file_close(rli->cur_log_fd, MYF(MY_WME));
rli->cur_log_fd = -1;
rli->last_inuse_relaylog->completed= true;
+ rli->relay_log.description_event_for_exec->reset_crypto();
if (relay_log_purge)
{
diff --git a/sql/slave.h b/sql/slave.h
index fc48476a6d8..a519229fac1 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -131,6 +131,8 @@ extern char *opt_slave_skip_errors;
extern my_bool opt_replicate_annotate_row_events;
extern ulonglong relay_log_space_limit;
extern ulonglong slave_skipped_errors;
+extern const char *relay_log_index;
+extern const char *relay_log_basename;
/*
3 possible values for Master_info::slave_running and
@@ -174,7 +176,8 @@ bool flush_relay_log_info(Relay_log_info* rli);
int register_slave_on_master(MYSQL* mysql);
int terminate_slave_threads(Master_info* mi, int thread_mask,
bool skip_lock = 0);
-int start_slave_threads(bool need_slave_mutex, bool wait_for_start,
+int start_slave_threads(THD *thd,
+ bool need_slave_mutex, bool wait_for_start,
Master_info* mi, const char* master_info_fname,
const char* slave_info_fname, int thread_mask);
/*
diff --git a/sql/sp.cc b/sql/sp.cc
index 9fd17b0582d..6ec59143720 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -317,7 +317,7 @@ Stored_routine_creation_ctx::load_from_db(THD *thd,
push_warning_printf(thd,
Sql_condition::WARN_LEVEL_WARN,
ER_SR_INVALID_CREATION_CTX,
- ER(ER_SR_INVALID_CREATION_CTX),
+ ER_THD(thd, ER_SR_INVALID_CREATION_CTX),
(const char *) db_name,
(const char *) sr_name);
}
@@ -1063,10 +1063,11 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp)
else if (lex->create_info.if_not_exists())
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_SP_ALREADY_EXISTS, ER(ER_SP_ALREADY_EXISTS),
- type == TYPE_ENUM_FUNCTION ?
- "FUNCTION" : "PROCEDURE",
- lex->spname->m_name.str);
+ ER_SP_ALREADY_EXISTS,
+ ER_THD(thd, ER_SP_ALREADY_EXISTS),
+ type == TYPE_ENUM_FUNCTION ?
+ "FUNCTION" : "PROCEDURE",
+ lex->spname->m_name.str);
ret= SP_OK;
@@ -1193,7 +1194,7 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp)
access == SP_MODIFIES_SQL_DATA)
{
my_message(ER_BINLOG_UNSAFE_ROUTINE,
- ER(ER_BINLOG_UNSAFE_ROUTINE), MYF(0));
+ ER_THD(thd, ER_BINLOG_UNSAFE_ROUTINE), MYF(0));
ret= SP_INTERNAL_ERROR;
goto done;
}
@@ -1201,7 +1202,7 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp)
if (!(thd->security_ctx->master_access & SUPER_ACL))
{
my_message(ER_BINLOG_CREATE_ROUTINE_NEED_SUPER,
- ER(ER_BINLOG_CREATE_ROUTINE_NEED_SUPER), MYF(0));
+ ER_THD(thd, ER_BINLOG_CREATE_ROUTINE_NEED_SUPER), MYF(0));
ret= SP_INTERNAL_ERROR;
goto done;
}
@@ -1401,7 +1402,7 @@ sp_update_routine(THD *thd, stored_procedure_type type, sp_name *name,
if (!is_deterministic)
{
my_message(ER_BINLOG_UNSAFE_ROUTINE,
- ER(ER_BINLOG_UNSAFE_ROUTINE), MYF(0));
+ ER_THD(thd, ER_BINLOG_UNSAFE_ROUTINE), MYF(0));
ret= SP_INTERNAL_ERROR;
goto err;
}
@@ -1796,7 +1797,8 @@ sp_find_routine(THD *thd, stored_procedure_type type, sp_name *name,
@param thd Thread handler
@param routines List of needles in the hay stack
- @param any Any of the needles are good enough
+ @param is_proc Indicates whether routines in the list are procedures
+ or functions.
@return
@retval FALSE Found.
@@ -1804,7 +1806,7 @@ sp_find_routine(THD *thd, stored_procedure_type type, sp_name *name,
*/
bool
-sp_exist_routines(THD *thd, TABLE_LIST *routines, bool any)
+sp_exist_routines(THD *thd, TABLE_LIST *routines, bool is_proc)
{
TABLE_LIST *routine;
bool sp_object_found;
@@ -1820,17 +1822,14 @@ sp_exist_routines(THD *thd, TABLE_LIST *routines, bool any)
lex_name.str= thd->strmake(routine->table_name, lex_name.length);
name= new sp_name(lex_db, lex_name, true);
name->init_qname(thd);
- sp_object_found= sp_find_routine(thd, TYPE_ENUM_PROCEDURE, name,
- &thd->sp_proc_cache, FALSE) != NULL ||
- sp_find_routine(thd, TYPE_ENUM_FUNCTION, name,
- &thd->sp_func_cache, FALSE) != NULL;
+ sp_object_found= is_proc ? sp_find_routine(thd, TYPE_ENUM_PROCEDURE,
+ name, &thd->sp_proc_cache,
+ FALSE) != NULL :
+ sp_find_routine(thd, TYPE_ENUM_FUNCTION,
+ name, &thd->sp_func_cache,
+ FALSE) != NULL;
thd->get_stmt_da()->clear_warning_info(thd->query_id);
- if (sp_object_found)
- {
- if (any)
- break;
- }
- else if (!any)
+ if (! sp_object_found)
{
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION or PROCEDURE",
routine->table_name);
diff --git a/sql/sp.h b/sql/sp.h
index eb3291fb1a9..4bfb0577fcc 100644
--- a/sql/sp.h
+++ b/sql/sp.h
@@ -121,7 +121,7 @@ sp_cache_routine(THD *thd, stored_procedure_type type, sp_name *name,
bool lookup_only, sp_head **sp);
bool
-sp_exist_routines(THD *thd, TABLE_LIST *procs, bool any);
+sp_exist_routines(THD *thd, TABLE_LIST *procs, bool is_proc);
bool
sp_show_create_routine(THD *thd, stored_procedure_type type, sp_name *name);
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index b637b04059c..a11796391d7 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -540,7 +540,7 @@ check_routine_name(LEX_STRING *ident)
my_error(ER_SP_WRONG_NAME, MYF(0), ident->str);
return TRUE;
}
- if (check_string_char_length(ident, "", NAME_CHAR_LEN,
+ if (check_string_char_length(ident, 0, NAME_CHAR_LEN,
system_charset_info, 1))
{
my_error(ER_TOO_LONG_IDENT, MYF(0), ident->str);
@@ -872,6 +872,7 @@ sp_head::create_result_field(uint field_max_length, const char *field_name,
field_max_length : m_return_field_def.length;
field= ::make_field(table->s, /* TABLE_SHARE ptr */
+ table->in_use->mem_root,
(uchar*) 0, /* field ptr */
field_length, /* field [max] length */
(uchar*) "", /* null ptr */
@@ -1129,7 +1130,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
const uint status_backup_mask= SERVER_STATUS_CURSOR_EXISTS |
SERVER_STATUS_LAST_ROW_SENT;
Reprepare_observer *save_reprepare_observer= thd->m_reprepare_observer;
- Object_creation_ctx *saved_creation_ctx;
+ Object_creation_ctx *UNINIT_VAR(saved_creation_ctx);
Diagnostics_area *da= thd->get_stmt_da();
Warning_info sp_wi(da->warning_info_id(), false, true);
@@ -2019,7 +2020,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
if (spvar->mode == sp_variable::MODE_OUT)
{
- Item_null *null_item= new Item_null();
+ Item_null *null_item= new (thd->mem_root) Item_null(thd);
Item *tmp_item= null_item;
if (!null_item ||
@@ -2559,6 +2560,7 @@ sp_head::show_create_routine(THD *thd, int type)
LEX_STRING sql_mode;
bool full_access;
+ MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("sp_head::show_create_routine");
DBUG_PRINT("info", ("routine %s", m_name.str));
@@ -2573,8 +2575,12 @@ sp_head::show_create_routine(THD *thd, int type)
/* Send header. */
- fields.push_back(new Item_empty_string(col1_caption, NAME_CHAR_LEN));
- fields.push_back(new Item_empty_string("sql_mode", sql_mode.length));
+ fields.push_back(new (mem_root)
+ Item_empty_string(thd, col1_caption, NAME_CHAR_LEN),
+ thd->mem_root);
+ fields.push_back(new (mem_root)
+ Item_empty_string(thd, "sql_mode", sql_mode.length),
+ thd->mem_root);
{
/*
@@ -2583,22 +2589,28 @@ sp_head::show_create_routine(THD *thd, int type)
*/
Item_empty_string *stmt_fld=
- new Item_empty_string(col3_caption,
+ new (mem_root) Item_empty_string(thd, col3_caption,
MY_MAX(m_defstr.length, 1024));
stmt_fld->maybe_null= TRUE;
- fields.push_back(stmt_fld);
+ fields.push_back(stmt_fld, thd->mem_root);
}
- fields.push_back(new Item_empty_string("character_set_client",
- MY_CS_NAME_SIZE));
+ fields.push_back(new (mem_root)
+ Item_empty_string(thd, "character_set_client",
+ MY_CS_NAME_SIZE),
+ thd->mem_root);
- fields.push_back(new Item_empty_string("collation_connection",
- MY_CS_NAME_SIZE));
+ fields.push_back(new (mem_root)
+ Item_empty_string(thd, "collation_connection",
+ MY_CS_NAME_SIZE),
+ thd->mem_root);
- fields.push_back(new Item_empty_string("Database Collation",
- MY_CS_NAME_SIZE));
+ fields.push_back(new (mem_root)
+ Item_empty_string(thd, "Database Collation",
+ MY_CS_NAME_SIZE),
+ thd->mem_root);
if (protocol->send_result_set_metadata(&fields,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
@@ -2781,10 +2793,13 @@ sp_head::show_routine_code(THD *thd)
if (check_show_routine_access(thd, this, &full_access) || !full_access)
DBUG_RETURN(1);
- field_list.push_back(new Item_uint("Pos", 9));
+ field_list.push_back(new (thd->mem_root) Item_uint(thd, "Pos", 9),
+ thd->mem_root);
// 1024 is for not to confuse old clients
- field_list.push_back(new Item_empty_string("Instruction",
- MY_MAX(buffer.length(), 1024)));
+ field_list.push_back(new (thd->mem_root)
+ Item_empty_string(thd, "Instruction",
+ MY_MAX(buffer.length(), 1024)),
+ thd->mem_root);
if (protocol->send_result_set_metadata(&field_list, Protocol::SEND_NUM_ROWS |
Protocol::SEND_EOF))
DBUG_RETURN(1);
@@ -3851,7 +3866,7 @@ sp_instr_error::execute(THD *thd, uint *nextp)
{
DBUG_ENTER("sp_instr_error::execute");
- my_message(m_errcode, ER(m_errcode), MYF(0));
+ my_message(m_errcode, ER_THD(thd, m_errcode), MYF(0));
*nextp= m_ip+1;
DBUG_RETURN(-1);
}
@@ -3893,7 +3908,7 @@ sp_instr_set_case_expr::exec_core(THD *thd, uint *nextp)
initialized. Set to NULL so we can continue.
*/
- Item *null_item= new Item_null();
+ Item *null_item= new (thd->mem_root) Item_null(thd);
if (!null_item ||
thd->spcont->set_case_expr(thd, m_case_expr_id, &null_item))
diff --git a/sql/sp_pcontext.cc b/sql/sp_pcontext.cc
index 6afca24231b..faf5a2de891 100644
--- a/sql/sp_pcontext.cc
+++ b/sql/sp_pcontext.cc
@@ -205,7 +205,7 @@ sp_label *sp_pcontext::push_label(THD *thd, LEX_STRING name, uint ip)
if (!label)
return NULL;
- m_labels.push_front(label);
+ m_labels.push_front(label, thd->mem_root);
return label;
}
diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc
index 08aedc3b780..b38f4a3ddad 100644
--- a/sql/sp_rcontext.cc
+++ b/sql/sp_rcontext.cc
@@ -137,7 +137,7 @@ bool sp_rcontext::init_var_items(THD *thd)
for (uint idx = 0; idx < num_vars; ++idx)
{
- if (!(m_var_items[idx]= new Item_field(m_var_table->field[idx])))
+ if (!(m_var_items[idx]= new (thd->mem_root) Item_field(thd, m_var_table->field[idx])))
return true;
}
@@ -387,7 +387,7 @@ Item_cache *sp_rcontext::create_case_expr_holder(THD *thd,
thd->set_n_backup_active_arena(thd->spcont->callers_arena, &current_arena);
- holder= Item_cache::get_cache(item);
+ holder= Item_cache::get_cache(thd, item);
thd->restore_active_arena(thd->spcont->callers_arena, &current_arena);
@@ -451,7 +451,8 @@ int sp_cursor::open(THD *thd)
{
if (server_side_cursor)
{
- my_message(ER_SP_CURSOR_ALREADY_OPEN, ER(ER_SP_CURSOR_ALREADY_OPEN),
+ my_message(ER_SP_CURSOR_ALREADY_OPEN,
+ ER_THD(thd, ER_SP_CURSOR_ALREADY_OPEN),
MYF(0));
return -1;
}
@@ -465,7 +466,8 @@ int sp_cursor::close(THD *thd)
{
if (! server_side_cursor)
{
- my_message(ER_SP_CURSOR_NOT_OPEN, ER(ER_SP_CURSOR_NOT_OPEN), MYF(0));
+ my_message(ER_SP_CURSOR_NOT_OPEN, ER_THD(thd, ER_SP_CURSOR_NOT_OPEN),
+ MYF(0));
return -1;
}
destroy();
@@ -484,20 +486,21 @@ int sp_cursor::fetch(THD *thd, List<sp_variable> *vars)
{
if (! server_side_cursor)
{
- my_message(ER_SP_CURSOR_NOT_OPEN, ER(ER_SP_CURSOR_NOT_OPEN), MYF(0));
+ my_message(ER_SP_CURSOR_NOT_OPEN, ER_THD(thd, ER_SP_CURSOR_NOT_OPEN),
+ MYF(0));
return -1;
}
if (vars->elements != result.get_field_count())
{
my_message(ER_SP_WRONG_NO_OF_FETCH_ARGS,
- ER(ER_SP_WRONG_NO_OF_FETCH_ARGS), MYF(0));
+ ER_THD(thd, ER_SP_WRONG_NO_OF_FETCH_ARGS), MYF(0));
return -1;
}
DBUG_EXECUTE_IF("bug23032_emit_warning",
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
ER_UNKNOWN_ERROR,
- ER(ER_UNKNOWN_ERROR)););
+ ER_THD(thd, ER_UNKNOWN_ERROR)););
result.set_spvar_list(vars);
@@ -511,7 +514,7 @@ int sp_cursor::fetch(THD *thd, List<sp_variable> *vars)
*/
if (! server_side_cursor->is_open())
{
- my_message(ER_SP_FETCH_NO_DATA, ER(ER_SP_FETCH_NO_DATA), MYF(0));
+ my_message(ER_SP_FETCH_NO_DATA, ER_THD(thd, ER_SP_FETCH_NO_DATA), MYF(0));
return -1;
}
diff --git a/sql/spatial.h b/sql/spatial.h
index b850d405228..6f50acac984 100644
--- a/sql/spatial.h
+++ b/sql/spatial.h
@@ -71,7 +71,11 @@ struct MBR
MBR(const st_point_2d &min, const st_point_2d &max)
:xmin(min.x), ymin(min.y), xmax(max.x), ymax(max.y)
{}
-
+
+ MBR(const MBR &mbr1, const MBR &mbr2)
+ :xmin(mbr1.xmin), ymin(mbr1.ymin), xmax(mbr1.xmax), ymax(mbr1.ymax)
+ { add_mbr(&mbr2); }
+
inline void add_xy(double x, double y)
{
/* Not using "else" for proper one point MBR calculation */
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 1e94e75cf75..061a227004f 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1219,7 +1219,7 @@ static bool acl_load(THD *thd, TABLE_LIST *tables)
char *end = strnmov(tmp_name, host.db, sizeof(tmp_name));
if (end >= tmp_name + sizeof(tmp_name))
{
- sql_print_warning(ER(ER_WRONG_DB_NAME), host.db);
+ sql_print_warning(ER_THD(thd, ER_WRONG_DB_NAME), host.db);
continue;
}
my_casedn_str(files_charset_info, host.db);
@@ -1556,7 +1556,7 @@ static bool acl_load(THD *thd, TABLE_LIST *tables)
char *end = strnmov(tmp_name, db.db, sizeof(tmp_name));
if (end >= tmp_name + sizeof(tmp_name))
{
- sql_print_warning(ER(ER_WRONG_DB_NAME), db.db);
+ sql_print_warning(ER_THD(thd, ER_WRONG_DB_NAME), db.db);
continue;
}
my_casedn_str(files_charset_info, db.db);
@@ -2695,7 +2695,8 @@ static int check_alter_user(THD *thd, const char *host, const char *user)
if (IF_WSREP((!WSREP(thd) || !thd->wsrep_applier), 1) &&
!thd->slave_thread && !thd->security_ctx->priv_user[0])
{
- my_message(ER_PASSWORD_ANONYMOUS_USER, ER(ER_PASSWORD_ANONYMOUS_USER),
+ my_message(ER_PASSWORD_ANONYMOUS_USER,
+ ER_THD(thd, ER_PASSWORD_ANONYMOUS_USER),
MYF(0));
goto end;
}
@@ -2801,7 +2802,8 @@ bool change_password(THD *thd, LEX_USER *user)
if (!(acl_user= find_user_exact(user->host.str, user->user.str)))
{
mysql_mutex_unlock(&acl_cache->lock);
- my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH), MYF(0));
+ my_message(ER_PASSWORD_NO_MATCH,
+ ER_THD(thd, ER_PASSWORD_NO_MATCH), MYF(0));
goto end;
}
@@ -2816,7 +2818,8 @@ bool change_password(THD *thd, LEX_USER *user)
}
else
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_SET_PASSWORD_AUTH_PLUGIN, ER(ER_SET_PASSWORD_AUTH_PLUGIN));
+ ER_SET_PASSWORD_AUTH_PLUGIN,
+ ER_THD(thd, ER_SET_PASSWORD_AUTH_PLUGIN));
if (update_user_table(thd, tables[USER_TABLE].table,
safe_str(acl_user->host.hostname),
@@ -2925,7 +2928,8 @@ int acl_set_default_role(THD *thd, const char *host, const char *user,
if (!(acl_user= find_user_exact(host, user)))
{
mysql_mutex_unlock(&acl_cache->lock);
- my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH), MYF(0));
+ my_message(ER_PASSWORD_NO_MATCH, ER_THD(thd, ER_PASSWORD_NO_MATCH),
+ MYF(0));
goto end;
}
@@ -2961,7 +2965,8 @@ int acl_set_default_role(THD *thd, const char *host, const char *user,
HA_READ_KEY_EXACT))
{
mysql_mutex_unlock(&acl_cache->lock);
- my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH), MYF(0));
+ my_message(ER_PASSWORD_NO_MATCH, ER_THD(thd, ER_PASSWORD_NO_MATCH),
+ MYF(0));
goto end;
}
store_record(table, record[1]);
@@ -3291,7 +3296,7 @@ static bool update_user_table(THD *thd, TABLE *table,
(uchar *) user_key, HA_WHOLE_KEY,
HA_READ_KEY_EXACT))
{
- my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH),
+ my_message(ER_PASSWORD_NO_MATCH, ER_THD(thd, ER_PASSWORD_NO_MATCH),
MYF(0)); /* purecov: deadcode */
DBUG_RETURN(1); /* purecov: deadcode */
}
@@ -3652,7 +3657,8 @@ static int replace_db_table(TABLE *table, const char *db,
/* The user could be a role, check if the user is registered as a role */
if (!combo.host.length && !find_acl_role(combo.user.str))
{
- my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH), MYF(0));
+ my_message(ER_PASSWORD_NO_MATCH, ER_THD(table->in_use,
+ ER_PASSWORD_NO_MATCH), MYF(0));
DBUG_RETURN(-1);
}
}
@@ -3919,7 +3925,8 @@ replace_proxies_priv_table(THD *thd, TABLE *table, const LEX_USER *user,
/* Check if there is such a user in user table in memory? */
if (!find_user_wild(user->host.str,user->user.str))
{
- my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH), MYF(0));
+ my_message(ER_PASSWORD_NO_MATCH,
+ ER_THD(thd, ER_PASSWORD_NO_MATCH), MYF(0));
DBUG_RETURN(-1);
}
@@ -4584,7 +4591,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
{
if (!combo.host.length && !find_acl_role(combo.user.str))
{
- my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH),
+ my_message(ER_PASSWORD_NO_MATCH, ER_THD(thd, ER_PASSWORD_NO_MATCH),
MYF(0)); /* purecov: deadcode */
DBUG_RETURN(-1); /* purecov: deadcode */
}
@@ -5744,7 +5751,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
if (rights & ~TABLE_ACLS)
{
- my_message(ER_ILLEGAL_GRANT_FOR_TABLE, ER(ER_ILLEGAL_GRANT_FOR_TABLE),
+ my_message(ER_ILLEGAL_GRANT_FOR_TABLE,
+ ER_THD(thd, ER_ILLEGAL_GRANT_FOR_TABLE),
MYF(0));
DBUG_RETURN(TRUE);
}
@@ -5989,7 +5997,8 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
if (rights & ~PROC_ACLS)
{
- my_message(ER_ILLEGAL_GRANT_FOR_TABLE, ER(ER_ILLEGAL_GRANT_FOR_TABLE),
+ my_message(ER_ILLEGAL_GRANT_FOR_TABLE,
+ ER_THD(thd, ER_ILLEGAL_GRANT_FOR_TABLE),
MYF(0));
DBUG_RETURN(TRUE);
}
@@ -7160,7 +7169,7 @@ bool check_column_grant_in_table_ref(THD *thd, TABLE_LIST * table_ref,
return FALSE;
}
table_ref->belong_to_view->allowed_show= FALSE;
- my_message(ER_VIEW_NO_EXPLAIN, ER(ER_VIEW_NO_EXPLAIN), MYF(0));
+ my_message(ER_VIEW_NO_EXPLAIN, ER_THD(thd, ER_VIEW_NO_EXPLAIN), MYF(0));
return TRUE;
}
}
@@ -7779,7 +7788,7 @@ bool mysql_show_grants(THD *thd, LEX_USER *lex_user)
}
DBUG_ASSERT(rolename || username);
- Item_string *field=new Item_string_ascii("", 0);
+ Item_string *field=new (thd->mem_root) Item_string_ascii(thd, "", 0);
List<Item> field_list;
field->name=buff;
field->max_length=1024;
@@ -7787,9 +7796,10 @@ bool mysql_show_grants(THD *thd, LEX_USER *lex_user)
strxmov(buff,"Grants for ",rolename, NullS);
else
strxmov(buff,"Grants for ",username,"@",hostname, NullS);
- field_list.push_back(field);
+ field_list.push_back(field, thd->mem_root);
if (protocol->send_result_set_metadata(&field_list,
- Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
+ Protocol::SEND_NUM_ROWS |
+ Protocol::SEND_EOF))
{
mysql_mutex_unlock(&acl_cache->lock);
mysql_rwlock_unlock(&LOCK_grant);
@@ -8565,7 +8575,7 @@ static int handle_roles_mappings_table(TABLE *table, bool drop,
int error;
int result= 0;
- THD *thd= current_thd;
+ THD *thd= table->in_use;
const char *host, *user, *role;
Field *host_field= table->field[0];
Field *user_field= table->field[1];
@@ -8658,7 +8668,7 @@ static int handle_roles_mappings_table(TABLE *table, bool drop,
< 0 Error.
*/
-static int handle_grant_table(TABLE_LIST *tables,
+static int handle_grant_table(THD *thd, TABLE_LIST *tables,
enum enum_acl_tables table_no, bool drop,
LEX_USER *user_from, LEX_USER *user_to)
{
@@ -8675,7 +8685,6 @@ static int handle_grant_table(TABLE_LIST *tables,
uchar user_key[MAX_KEY_LENGTH];
uint key_prefix_length;
DBUG_ENTER("handle_grant_table");
- THD *thd= current_thd;
if (table_no == ROLES_MAPPING_TABLE)
{
@@ -9179,7 +9188,7 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
< 0 Error.
*/
-static int handle_grant_data(TABLE_LIST *tables, bool drop,
+static int handle_grant_data(THD *thd, TABLE_LIST *tables, bool drop,
LEX_USER *user_from, LEX_USER *user_to)
{
int result= 0;
@@ -9202,7 +9211,8 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
}
/* Handle db table. */
- if ((found= handle_grant_table(tables, DB_TABLE, drop, user_from, user_to)) < 0)
+ if ((found= handle_grant_table(thd, tables, DB_TABLE, drop, user_from,
+ user_to)) < 0)
{
/* Handle of table failed, don't touch the in-memory array. */
result= -1;
@@ -9222,7 +9232,8 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
}
/* Handle stored routines table. */
- if ((found= handle_grant_table(tables, PROCS_PRIV_TABLE, drop, user_from, user_to)) < 0)
+ if ((found= handle_grant_table(thd, tables, PROCS_PRIV_TABLE, drop,
+ user_from, user_to)) < 0)
{
/* Handle of table failed, don't touch in-memory array. */
result= -1;
@@ -9250,7 +9261,8 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
}
/* Handle tables table. */
- if ((found= handle_grant_table(tables, TABLES_PRIV_TABLE, drop, user_from, user_to)) < 0)
+ if ((found= handle_grant_table(thd, tables, TABLES_PRIV_TABLE, drop,
+ user_from, user_to)) < 0)
{
/* Handle of table failed, don't touch columns and in-memory array. */
result= -1;
@@ -9266,7 +9278,8 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
}
/* Handle columns table. */
- if ((found= handle_grant_table(tables, COLUMNS_PRIV_TABLE, drop, user_from, user_to)) < 0)
+ if ((found= handle_grant_table(thd, tables, COLUMNS_PRIV_TABLE, drop,
+ user_from, user_to)) < 0)
{
/* Handle of table failed, don't touch the in-memory array. */
result= -1;
@@ -9285,7 +9298,8 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
/* Handle proxies_priv table. */
if (tables[PROXIES_PRIV_TABLE].table)
{
- if ((found= handle_grant_table(tables, PROXIES_PRIV_TABLE, drop, user_from, user_to)) < 0)
+ if ((found= handle_grant_table(thd, tables, PROXIES_PRIV_TABLE, drop,
+ user_from, user_to)) < 0)
{
/* Handle of table failed, don't touch the in-memory array. */
result= -1;
@@ -9304,7 +9318,8 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
/* Handle roles_mapping table. */
if (tables[ROLES_MAPPING_TABLE].table)
{
- if ((found= handle_grant_table(tables, ROLES_MAPPING_TABLE, drop, user_from, user_to)) < 0)
+ if ((found= handle_grant_table(thd, tables, ROLES_MAPPING_TABLE, drop,
+ user_from, user_to)) < 0)
{
/* Handle of table failed, don't touch the in-memory array. */
result= -1;
@@ -9321,7 +9336,8 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
}
/* Handle user table. */
- if ((found= handle_grant_table(tables, USER_TABLE, drop, user_from, user_to)) < 0)
+ if ((found= handle_grant_table(thd, tables, USER_TABLE, drop, user_from,
+ user_to)) < 0)
{
/* Handle of table failed, don't touch the in-memory array. */
result= -1;
@@ -9415,12 +9431,12 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list, bool handle_as_role)
Search all in-memory structures and grant tables
for a mention of the new user/role name.
*/
- if (handle_grant_data(tables, 0, user_name, NULL))
+ if (handle_grant_data(thd, tables, 0, user_name, NULL))
{
if (thd->lex->create_info.or_replace())
{
// Drop the existing user
- if (handle_grant_data(tables, 1, user_name, NULL) <= 0)
+ if (handle_grant_data(thd, tables, 1, user_name, NULL) <= 0)
{
// DROP failed
append_user(thd, &wrong_users, user_name);
@@ -9434,11 +9450,13 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list, bool handle_as_role)
binlog= true;
if (handle_as_role)
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_ROLE_CREATE_EXISTS, ER(ER_ROLE_CREATE_EXISTS),
+ ER_ROLE_CREATE_EXISTS,
+ ER_THD(thd, ER_ROLE_CREATE_EXISTS),
user_name->user.str);
else
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_USER_CREATE_EXISTS, ER(ER_USER_CREATE_EXISTS),
+ ER_USER_CREATE_EXISTS,
+ ER_THD(thd, ER_USER_CREATE_EXISTS),
user_name->user.str, user_name->host.str);
continue;
}
@@ -9561,7 +9579,7 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list, bool handle_as_role)
continue;
}
- if ((rc= handle_grant_data(tables, 1, user_name, NULL)) > 0)
+ if ((rc= handle_grant_data(thd, tables, 1, user_name, NULL)) > 0)
{
// The user or role was successfully deleted
binlog= true;
@@ -9573,11 +9591,13 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list, bool handle_as_role)
// "DROP USER IF EXISTS user1" for a non-existing user or role
if (handle_as_role)
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_ROLE_DROP_EXISTS, ER(ER_ROLE_DROP_EXISTS),
+ ER_ROLE_DROP_EXISTS,
+ ER_THD(thd, ER_ROLE_DROP_EXISTS),
user_name->user.str);
else
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_USER_DROP_EXISTS, ER(ER_USER_DROP_EXISTS),
+ ER_USER_DROP_EXISTS,
+ ER_THD(thd, ER_USER_DROP_EXISTS),
user_name->user.str, user_name->host.str);
binlog= true;
continue;
@@ -9672,8 +9692,8 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list)
Search all in-memory structures and grant tables
for a mention of the new user name.
*/
- if (handle_grant_data(tables, 0, user_to, NULL) ||
- handle_grant_data(tables, 0, user_from, user_to) <= 0)
+ if (handle_grant_data(thd, tables, 0, user_to, NULL) ||
+ handle_grant_data(thd, tables, 0, user_from, user_to) <= 0)
{
/* NOTE TODO renaming roles is not yet implemented */
append_user(thd, &wrong_users, user_from);
@@ -9928,8 +9948,8 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
mysql_mutex_unlock(&acl_cache->lock);
if (result)
- my_message(ER_REVOKE_GRANTS, ER(ER_REVOKE_GRANTS), MYF(0));
-
+ my_message(ER_REVOKE_GRANTS, ER_THD(thd, ER_REVOKE_GRANTS), MYF(0));
+
result= result |
write_bin_log(thd, FALSE, thd->query(), thd->query_length());
@@ -10145,7 +10165,7 @@ bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name,
combo->auth= au->auth_string;
}
- if (user_list.push_back(combo))
+ if (user_list.push_back(combo, thd->mem_root))
DBUG_RETURN(TRUE);
thd->lex->ssl_type= SSL_TYPE_NOT_SPECIFIED;
@@ -10383,11 +10403,14 @@ static int show_column_grants(THD *thd, SHOW_VAR *var, char *buff,
var->type= SHOW_ULONG;
var->value= buff;
*(ulong *)buff= 0;
- mysql_rwlock_rdlock(&LOCK_grant);
- mysql_mutex_lock(&acl_cache->lock);
- my_hash_iterate(&column_priv_hash, count_column_grants, buff);
- mysql_mutex_unlock(&acl_cache->lock);
- mysql_rwlock_unlock(&LOCK_grant);
+ if (initialized)
+ {
+ mysql_rwlock_rdlock(&LOCK_grant);
+ mysql_mutex_lock(&acl_cache->lock);
+ my_hash_iterate(&column_priv_hash, count_column_grants, buff);
+ mysql_mutex_unlock(&acl_cache->lock);
+ mysql_rwlock_unlock(&LOCK_grant);
+ }
return 0;
}
@@ -11159,12 +11182,12 @@ static void login_failed_error(THD *thd)
my_error(access_denied_error_code(thd->password), MYF(0),
thd->main_security_ctx.user,
thd->main_security_ctx.host_or_ip,
- thd->password ? ER(ER_YES) : ER(ER_NO));
+ thd->password ? ER_THD(thd, ER_YES) : ER_THD(thd, ER_NO));
general_log_print(thd, COM_CONNECT,
- ER(access_denied_error_code(thd->password)),
+ ER_THD(thd, access_denied_error_code(thd->password)),
thd->main_security_ctx.user,
thd->main_security_ctx.host_or_ip,
- thd->password ? ER(ER_YES) : ER(ER_NO));
+ thd->password ? ER_THD(thd, ER_YES) : ER_THD(thd, ER_NO));
status_var_increment(thd->status_var.access_denied_errors);
/*
Log access denied messages to the error log when log-warnings = 2
@@ -11173,10 +11196,10 @@ static void login_failed_error(THD *thd)
*/
if (global_system_variables.log_warnings > 1)
{
- sql_print_warning(ER(access_denied_error_code(thd->password)),
+ sql_print_warning(ER_THD(thd, access_denied_error_code(thd->password)),
thd->main_security_ctx.user,
thd->main_security_ctx.host_or_ip,
- thd->password ? ER(ER_YES) : ER(ER_NO));
+ thd->password ? ER_THD(thd, ER_YES) : ER_THD(thd, ER_NO));
}
}
@@ -11317,14 +11340,16 @@ static bool secure_auth(THD *thd)
my_error(ER_SERVER_IS_IN_SECURE_AUTH_MODE, MYF(0),
thd->security_ctx->user,
thd->security_ctx->host_or_ip);
- general_log_print(thd, COM_CONNECT, ER(ER_SERVER_IS_IN_SECURE_AUTH_MODE),
+ general_log_print(thd, COM_CONNECT,
+ ER_THD(thd, ER_SERVER_IS_IN_SECURE_AUTH_MODE),
thd->security_ctx->user,
thd->security_ctx->host_or_ip);
}
else
{
my_error(ER_NOT_SUPPORTED_AUTH_MODE, MYF(0));
- general_log_print(thd, COM_CONNECT, ER(ER_NOT_SUPPORTED_AUTH_MODE));
+ general_log_print(thd, COM_CONNECT,
+ ER_THD(thd, ER_NOT_SUPPORTED_AUTH_MODE));
}
return 1;
}
@@ -11396,7 +11421,8 @@ static bool send_plugin_request_packet(MPVIO_EXT *mpvio,
if (switch_from_short_to_long_scramble)
{
my_error(ER_NOT_SUPPORTED_AUTH_MODE, MYF(0));
- general_log_print(mpvio->thd, COM_CONNECT, ER(ER_NOT_SUPPORTED_AUTH_MODE));
+ general_log_print(mpvio->thd, COM_CONNECT,
+ ER_THD(mpvio->thd, ER_NOT_SUPPORTED_AUTH_MODE));
DBUG_RETURN (1);
}
@@ -11473,7 +11499,8 @@ static bool find_mpvio_user(MPVIO_EXT *mpvio)
DBUG_ASSERT(my_strcasecmp(system_charset_info, mpvio->acl_user->plugin.str,
old_password_plugin_name.str));
my_error(ER_NOT_SUPPORTED_AUTH_MODE, MYF(0));
- general_log_print(mpvio->thd, COM_CONNECT, ER(ER_NOT_SUPPORTED_AUTH_MODE));
+ general_log_print(mpvio->thd, COM_CONNECT,
+ ER_THD(mpvio->thd, ER_NOT_SUPPORTED_AUTH_MODE));
DBUG_RETURN (1);
}
@@ -11547,7 +11574,8 @@ static bool parse_com_change_user_packet(MPVIO_EXT *mpvio, uint packet_length)
if (passwd >= end)
{
- my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
+ my_message(ER_UNKNOWN_COM_ERROR, ER_THD(thd, ER_UNKNOWN_COM_ERROR),
+ MYF(0));
DBUG_RETURN (1);
}
@@ -11571,7 +11599,8 @@ static bool parse_com_change_user_packet(MPVIO_EXT *mpvio, uint packet_length)
*/
if (db >= end)
{
- my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
+ my_message(ER_UNKNOWN_COM_ERROR, ER_THD(thd, ER_UNKNOWN_COM_ERROR),
+ MYF(0));
DBUG_RETURN (1);
}
@@ -11629,7 +11658,8 @@ static bool parse_com_change_user_packet(MPVIO_EXT *mpvio, uint packet_length)
{
if (next_field >= end)
{
- my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
+ my_message(ER_UNKNOWN_COM_ERROR, ER_THD(thd, ER_UNKNOWN_COM_ERROR),
+ MYF(0));
DBUG_RETURN(1);
}
client_plugin= fix_plugin_ptr(next_field);
@@ -11653,11 +11683,12 @@ static bool parse_com_change_user_packet(MPVIO_EXT *mpvio, uint packet_length)
}
}
- if ((mpvio->thd->client_capabilities & CLIENT_CONNECT_ATTRS) &&
+ if ((thd->client_capabilities & CLIENT_CONNECT_ATTRS) &&
read_client_connect_attrs(&next_field, end,
- mpvio->thd->charset()))
+ thd->charset()))
{
- my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
+ my_message(ER_UNKNOWN_COM_ERROR, ER_THD(thd, ER_UNKNOWN_COM_ERROR),
+ MYF(0));
DBUG_RETURN(packet_error);
}
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index 5b64a792016..0787aa9e92f 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -326,14 +326,20 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
DBUG_ENTER("mysql_admin_table");
DBUG_PRINT("enter", ("extra_open_options: %u", extra_open_options));
- field_list.push_back(item = new Item_empty_string("Table", NAME_CHAR_LEN*2));
+ field_list.push_back(item= new (thd->mem_root)
+ Item_empty_string(thd, "Table",
+ NAME_CHAR_LEN * 2), thd->mem_root);
item->maybe_null = 1;
- field_list.push_back(item = new Item_empty_string("Op", 10));
+ field_list.push_back(item= new (thd->mem_root)
+ Item_empty_string(thd, "Op", 10), thd->mem_root);
item->maybe_null = 1;
- field_list.push_back(item = new Item_empty_string("Msg_type", 10));
+ field_list.push_back(item= new (thd->mem_root)
+ Item_empty_string(thd, "Msg_type", 10), thd->mem_root);
item->maybe_null = 1;
- field_list.push_back(item = new Item_empty_string("Msg_text",
- SQL_ADMIN_MSG_TEXT_SIZE));
+ field_list.push_back(item= new (thd->mem_root)
+ Item_empty_string(thd, "Msg_text",
+ SQL_ADMIN_MSG_TEXT_SIZE),
+ thd->mem_root);
item->maybe_null = 1;
if (protocol->send_result_set_metadata(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
@@ -496,7 +502,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
protocol->store(operator_name, system_charset_info);
protocol->store(STRING_WITH_LEN("error"), system_charset_info);
length= my_snprintf(buff, sizeof(buff),
- ER(ER_DROP_PARTITION_NON_EXISTENT),
+ ER_THD(thd, ER_DROP_PARTITION_NON_EXISTENT),
table_name);
protocol->store(buff, length, system_charset_info);
if(protocol->write())
@@ -545,12 +551,13 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
DBUG_PRINT("admin", ("open table failed"));
if (thd->get_stmt_da()->is_warning_info_empty())
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_CHECK_NO_SUCH_TABLE, ER(ER_CHECK_NO_SUCH_TABLE));
+ ER_CHECK_NO_SUCH_TABLE,
+ ER_THD(thd, ER_CHECK_NO_SUCH_TABLE));
/* if it was a view will check md5 sum */
if (table->view &&
view_check(thd, table, check_opt) == HA_ADMIN_WRONG_CHECKSUM)
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_VIEW_CHECKSUM, ER(ER_VIEW_CHECKSUM));
+ ER_VIEW_CHECKSUM, ER_THD(thd, ER_VIEW_CHECKSUM));
if (thd->get_stmt_da()->is_error() &&
table_not_corrupt_error(thd->get_stmt_da()->sql_errno()))
result_code= HA_ADMIN_FAILED;
@@ -584,7 +591,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
protocol->store(table_name, system_charset_info);
protocol->store(operator_name, system_charset_info);
protocol->store(STRING_WITH_LEN("error"), system_charset_info);
- length= my_snprintf(buff, sizeof(buff), ER(ER_OPEN_AS_READONLY),
+ length= my_snprintf(buff, sizeof(buff), ER_THD(thd, ER_OPEN_AS_READONLY),
table_name);
protocol->store(buff, length, system_charset_info);
trans_commit_stmt(thd);
@@ -813,7 +820,8 @@ send_result_message:
{
char buf[MYSQL_ERRMSG_SIZE];
size_t length=my_snprintf(buf, sizeof(buf),
- ER(ER_CHECK_NOT_IMPLEMENTED), operator_name);
+ ER_THD(thd, ER_CHECK_NOT_IMPLEMENTED),
+ operator_name);
protocol->store(STRING_WITH_LEN("note"), system_charset_info);
protocol->store(buf, length, system_charset_info);
}
@@ -823,7 +831,8 @@ send_result_message:
{
char buf[MYSQL_ERRMSG_SIZE];
size_t length= my_snprintf(buf, sizeof(buf),
- ER(ER_BAD_TABLE_ERROR), table_name);
+ ER_THD(thd, ER_BAD_TABLE_ERROR),
+ table_name);
protocol->store(STRING_WITH_LEN("note"), system_charset_info);
protocol->store(buf, length, system_charset_info);
}
@@ -968,7 +977,8 @@ send_result_message:
case HA_ADMIN_WRONG_CHECKSUM:
{
protocol->store(STRING_WITH_LEN("note"), system_charset_info);
- protocol->store(ER(ER_VIEW_CHECKSUM), strlen(ER(ER_VIEW_CHECKSUM)),
+ protocol->store(ER_THD(thd, ER_VIEW_CHECKSUM),
+ strlen(ER_THD(thd, ER_VIEW_CHECKSUM)),
system_charset_info);
break;
}
@@ -983,10 +993,12 @@ send_result_message:
protocol->store(STRING_WITH_LEN("error"), system_charset_info);
if (what_to_upgrade)
- length= my_snprintf(buf, sizeof(buf), ER(ER_TABLE_NEEDS_UPGRADE),
+ length= my_snprintf(buf, sizeof(buf),
+ ER_THD(thd, ER_TABLE_NEEDS_UPGRADE),
what_to_upgrade, table->table_name);
else
- length= my_snprintf(buf, sizeof(buf), ER(ER_TABLE_NEEDS_REBUILD),
+ length= my_snprintf(buf, sizeof(buf),
+ ER_THD(thd, ER_TABLE_NEEDS_REBUILD),
table->table_name);
protocol->store(buf, length, system_charset_info);
fatal_error=1;
diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc
index e413361191d..bff45e089a4 100644
--- a/sql/sql_alter.cc
+++ b/sql/sql_alter.cc
@@ -294,11 +294,11 @@ bool Sql_cmd_alter_table::execute(THD *thd)
/* Don't yet allow changing of symlinks with ALTER TABLE */
if (create_info.data_file_name)
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
+ WARN_OPTION_IGNORED, ER_THD(thd, WARN_OPTION_IGNORED),
"DATA DIRECTORY");
if (create_info.index_file_name)
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
+ WARN_OPTION_IGNORED, ER_THD(thd, WARN_OPTION_IGNORED),
"INDEX DIRECTORY");
create_info.data_file_name= create_info.index_file_name= NULL;
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc
index 32b447797cf..1f801a33dcd 100644
--- a/sql/sql_analyse.cc
+++ b/sql/sql_analyse.cc
@@ -1166,27 +1166,29 @@ int collect_ulonglong(ulonglong *element,
} // collect_ulonglong
-bool analyse::change_columns(List<Item> &field_list)
+bool analyse::change_columns(THD *thd, List<Item> &field_list)
{
+ MEM_ROOT *mem_root= thd->mem_root;
field_list.empty();
- func_items[0] = new Item_proc_string("Field_name", 255);
- func_items[1] = new Item_proc_string("Min_value", 255);
+ func_items[0]= new (mem_root) Item_proc_string(thd, "Field_name", 255);
+ func_items[1]= new (mem_root) Item_proc_string(thd, "Min_value", 255);
func_items[1]->maybe_null = 1;
- func_items[2] = new Item_proc_string("Max_value", 255);
+ func_items[2]= new (mem_root) Item_proc_string(thd, "Max_value", 255);
func_items[2]->maybe_null = 1;
- func_items[3] = new Item_proc_int("Min_length");
- func_items[4] = new Item_proc_int("Max_length");
- func_items[5] = new Item_proc_int("Empties_or_zeros");
- func_items[6] = new Item_proc_int("Nulls");
- func_items[7] = new Item_proc_string("Avg_value_or_avg_length", 255);
- func_items[8] = new Item_proc_string("Std", 255);
+ func_items[3]= new (mem_root) Item_proc_int(thd, "Min_length");
+ func_items[4]= new (mem_root) Item_proc_int(thd, "Max_length");
+ func_items[5]= new (mem_root) Item_proc_int(thd, "Empties_or_zeros");
+ func_items[6]= new (mem_root) Item_proc_int(thd, "Nulls");
+ func_items[7]= new (mem_root) Item_proc_string(thd, "Avg_value_or_avg_length", 255);
+ func_items[8]= new (mem_root) Item_proc_string(thd, "Std", 255);
func_items[8]->maybe_null = 1;
- func_items[9] = new Item_proc_string("Optimal_fieldtype",
- MY_MAX(64, output_str_length));
+ func_items[9]= new (mem_root) Item_proc_string(thd, "Optimal_fieldtype",
+ MY_MAX(64,
+ output_str_length));
for (uint i = 0; i < array_elements(func_items); i++)
- field_list.push_back(func_items[i]);
+ field_list.push_back(func_items[i], thd->mem_root);
result_fields = field_list;
return 0;
} // analyse::change_columns
diff --git a/sql/sql_analyse.h b/sql/sql_analyse.h
index 3d3662c3f4f..820877f2a69 100644
--- a/sql/sql_analyse.h
+++ b/sql/sql_analyse.h
@@ -356,7 +356,7 @@ public:
}
}
virtual void add() {}
- virtual bool change_columns(List<Item> &fields);
+ virtual bool change_columns(THD *thd, List<Item> &fields);
virtual int send_row(List<Item> &field_list);
virtual void end_group(void) {}
virtual int end_of_records(void);
diff --git a/sql/sql_analyze_stmt.cc b/sql/sql_analyze_stmt.cc
index 4874c33a544..5e6774bd539 100644
--- a/sql/sql_analyze_stmt.cc
+++ b/sql/sql_analyze_stmt.cc
@@ -23,32 +23,41 @@
#include "sql_select.h"
#include "my_json_writer.h"
-void Filesort_tracker::print_json(Json_writer *writer)
+void Filesort_tracker::print_json_members(Json_writer *writer)
{
const char *varied_str= "(varied across executions)";
- writer->add_member("r_loops").add_ll(r_loops);
+ writer->add_member("r_loops").add_ll(get_r_loops());
+ if (get_r_loops() && time_tracker.timed)
+ {
+ writer->add_member("r_total_time_ms").
+ add_double(time_tracker.get_time_ms());
+ }
if (r_limit != HA_POS_ERROR)
{
writer->add_member("r_limit");
if (r_limit == 0)
writer->add_str(varied_str);
else
- writer->add_ll(rint(r_limit/r_loops));
+ writer->add_ll(rint(r_limit/get_r_loops()));
}
writer->add_member("r_used_priority_queue");
- if (r_used_pq == r_loops)
+ if (r_used_pq == get_r_loops())
writer->add_bool(true);
else if (r_used_pq == 0)
writer->add_bool(false);
else
writer->add_str(varied_str);
- writer->add_member("r_output_rows").add_ll(rint(r_output_rows / r_loops));
+ writer->add_member("r_output_rows").add_ll(rint(r_output_rows /
+ get_r_loops()));
if (sort_passes)
- writer->add_member("r_sort_passes").add_ll(rint(sort_passes / r_loops));
+ {
+ writer->add_member("r_sort_passes").add_ll(rint(sort_passes /
+ get_r_loops()));
+ }
if (sort_buffer_size != 0)
{
@@ -60,3 +69,75 @@ void Filesort_tracker::print_json(Json_writer *writer)
}
}
+
+/*
+ Report that we are doing a filesort.
+ @return
+ Tracker object to be used with filesort
+*/
+
+Filesort_tracker *Sort_and_group_tracker::report_sorting(THD *thd)
+{
+ DBUG_ASSERT(cur_action < MAX_QEP_ACTIONS);
+
+ if (total_actions)
+ {
+ /* This is not the first execution. Check */
+ if (qep_actions[cur_action] != EXPL_ACTION_FILESORT)
+ {
+ varied_executions= true;
+ cur_action++;
+ if (!dummy_fsort_tracker)
+ dummy_fsort_tracker= new (thd->mem_root) Filesort_tracker(is_analyze);
+ return dummy_fsort_tracker;
+ }
+ return qep_actions_data[cur_action++].filesort_tracker;
+ }
+
+ Filesort_tracker *fs_tracker= new(thd->mem_root)Filesort_tracker(is_analyze);
+ qep_actions_data[cur_action].filesort_tracker= fs_tracker;
+ qep_actions[cur_action++]= EXPL_ACTION_FILESORT;
+
+ return fs_tracker;
+}
+
+
+void Sort_and_group_tracker::report_tmp_table(TABLE *tbl)
+{
+ DBUG_ASSERT(cur_action < MAX_QEP_ACTIONS);
+ if (total_actions)
+ {
+ /* This is not the first execution. Check if the steps match. */
+ // todo: should also check that tmp.table kinds are the same.
+ if (qep_actions[cur_action] != EXPL_ACTION_TEMPTABLE)
+ varied_executions= true;
+ }
+
+ if (!varied_executions)
+ {
+ qep_actions[cur_action]= EXPL_ACTION_TEMPTABLE;
+ // qep_actions_data[cur_action]= ....
+ }
+
+ cur_action++;
+}
+
+
+void Sort_and_group_tracker::report_duplicate_removal()
+{
+ DBUG_ASSERT(cur_action < MAX_QEP_ACTIONS);
+ if (total_actions)
+ {
+ /* This is not the first execution. Check if the steps match. */
+ if (qep_actions[cur_action] != EXPL_ACTION_REMOVE_DUPS)
+ varied_executions= true;
+ }
+
+ if (!varied_executions)
+ {
+ qep_actions[cur_action]= EXPL_ACTION_REMOVE_DUPS;
+ }
+
+ cur_action++;
+}
+
diff --git a/sql/sql_analyze_stmt.h b/sql/sql_analyze_stmt.h
index abd4fc1ea4b..bf800fd1df6 100644
--- a/sql/sql_analyze_stmt.h
+++ b/sql/sql_analyze_stmt.h
@@ -63,8 +63,8 @@ public:
}
// interface for getting the time
- ulonglong get_loops() { return count; }
- double get_time_ms()
+ ulonglong get_loops() const { return count; }
+ double get_time_ms() const
{
// convert 'cycles' to milliseconds.
return 1000 * ((double)cycles) / sys_timer_info.cycles.frequency;
@@ -169,8 +169,8 @@ class Json_writer;
class Filesort_tracker : public Sql_alloc
{
public:
- Filesort_tracker() :
- r_loops(0), r_limit(0), r_used_pq(0),
+ Filesort_tracker(bool do_timing) :
+ time_tracker(do_timing), r_limit(0), r_used_pq(0),
r_examined_rows(0), r_sorted_rows(0), r_output_rows(0),
sort_passes(0),
sort_buffer_size(0)
@@ -180,10 +180,12 @@ public:
inline void report_use(ha_rows r_limit_arg)
{
- if (!r_loops++)
+ if (!time_tracker.get_loops())
r_limit= r_limit_arg;
else
r_limit= (r_limit != r_limit_arg)? 0: r_limit_arg;
+
+ ANALYZE_START_TRACKING(&time_tracker);
}
inline void incr_pq_used() { r_used_pq++; }
@@ -202,6 +204,7 @@ public:
}
inline void report_merge_passes_at_end(ulong passes)
{
+ ANALYZE_STOP_TRACKING(&time_tracker);
sort_passes += passes;
}
@@ -214,16 +217,16 @@ public:
}
/* Functions to get the statistics */
- void print_json(Json_writer *writer);
+ void print_json_members(Json_writer *writer);
- ulonglong get_r_loops() { return r_loops; }
+ ulonglong get_r_loops() const { return time_tracker.get_loops(); }
double get_avg_examined_rows()
{
- return ((double)r_examined_rows) / r_loops;
+ return ((double)r_examined_rows) / get_r_loops();
}
double get_avg_returned_rows()
{
- return ((double)r_output_rows) / r_loops;
+ return ((double)r_output_rows) / get_r_loops();
}
double get_r_filtered()
{
@@ -233,7 +236,9 @@ public:
return 1.0;
}
private:
- ulonglong r_loops; /* How many times filesort was invoked */
+ Time_and_counter_tracker time_tracker;
+
+ //ulonglong r_loops; /* How many times filesort was invoked */
/*
LIMIT is typically a constant. There is never "LIMIT 0".
HA_POS_ERROR means we never had a limit
@@ -283,6 +288,7 @@ typedef enum
typedef enum
{
+ EXPL_ACTION_EOF, /* not-an-action */
EXPL_ACTION_FILESORT,
EXPL_ACTION_TEMPTABLE,
EXPL_ACTION_REMOVE_DUPS,
@@ -333,60 +339,111 @@ class Sort_and_group_tracker : public Sql_alloc
{
enum { MAX_QEP_ACTIONS = 5 };
- /* Query actions in the order they were made */
+ /* Query actions in the order they were made. */
enum_qep_action qep_actions[MAX_QEP_ACTIONS];
- uint n_actions;
- /*
- Trackers for filesort operation. JOIN::exec() may need at most two sorting
- operations.
+ /* Number for the next action */
+ int cur_action;
+
+ /*
+ Non-zero means there was already an execution which had
+ #total_actions actions
*/
- Filesort_tracker filesort_tracker[2];
- int cur_tracker;
-
- /* Information about temporary tables */
- enum_tmp_table_use tmp_table_kind[2];
- int cur_tmp_table;
+ int total_actions;
+
+ int get_n_actions()
+ {
+ return total_actions? total_actions: cur_action;
+ }
- friend class Explain_select;
+ /*
+ TRUE<=>there were executions which took different sort/buffer/de-duplicate
+ routes. The counter values are not meaningful.
+ */
+ bool varied_executions;
+ /* Details about query actions */
+ union
+ {
+ Filesort_tracker *filesort_tracker;
+ enum_tmp_table_use tmp_table;
+ }
+ qep_actions_data[MAX_QEP_ACTIONS];
+
+ Filesort_tracker *dummy_fsort_tracker;
+ bool is_analyze;
public:
- Sort_and_group_tracker() :
- n_actions(0),
- cur_tracker(0),
- cur_tmp_table(0)
+ Sort_and_group_tracker(bool is_analyze_arg) :
+ cur_action(0), total_actions(0), varied_executions(false),
+ dummy_fsort_tracker(NULL),
+ is_analyze(is_analyze_arg)
{}
/*************** Reporting interface ***************/
/* Report that join execution is started */
void report_join_start()
{
- n_actions= 0;
- cur_tracker= 0;
- cur_tmp_table= 0;
+ if (!total_actions && cur_action != 0)
+ {
+ /* This is a second execution */
+ total_actions= cur_action;
+ }
+ cur_action= 0;
}
- /* Report that a temporary table is created. */
- void report_tmp_table(TABLE *tbl)
- {
- DBUG_ASSERT(n_actions < MAX_QEP_ACTIONS);
- qep_actions[n_actions++]= EXPL_ACTION_TEMPTABLE;
+ /*
+ Report that a temporary table is created. The next step is to write to the
+ this tmp. table
+ */
+ void report_tmp_table(TABLE *tbl);
- DBUG_ASSERT(cur_tmp_table < 2);
- cur_tmp_table++;
- }
+ /*
+ Report that we are doing a filesort.
+ @return
+ Tracker object to be used with filesort
+ */
+ Filesort_tracker *report_sorting(THD *thd);
+
+ /*
+ Report that remove_duplicates() is invoked [on a temp. table].
+ We don't collect any statistics on this operation, yet.
+ */
+ void report_duplicate_removal();
+
+ friend class Iterator;
+ /*************** Statistics retrieval interface ***************/
+ bool had_varied_executions() { return varied_executions; }
- /* Report that we are doing a filesort. */
- Filesort_tracker *report_sorting()
+ class Iterator
{
- DBUG_ASSERT(n_actions < MAX_QEP_ACTIONS);
- qep_actions[n_actions++]= EXPL_ACTION_FILESORT;
-
- DBUG_ASSERT(cur_tracker < 2);
- return &filesort_tracker[cur_tracker++];
- }
-
- /*************** Statistics retrieval interface ***************/
- //enum_tmp_table_use get_tmp_table_type() { return join_result_tmp_table; }
+ Sort_and_group_tracker *owner;
+ int idx;
+ public:
+ Iterator(Sort_and_group_tracker *owner_arg) :
+ owner(owner_arg), idx(owner_arg->get_n_actions() - 1)
+ {}
+
+ enum_qep_action get_next(Filesort_tracker **tracker/*,
+ enum_tmp_table_use *tmp_table_use*/)
+ {
+ /* Walk back through the array... */
+ if (idx < 0)
+ return EXPL_ACTION_EOF;
+ switch (owner->qep_actions[idx])
+ {
+ case EXPL_ACTION_FILESORT:
+ *tracker= owner->qep_actions_data[idx].filesort_tracker;
+ break;
+ case EXPL_ACTION_TEMPTABLE:
+ //*tmp_table_use= tmp_table_kind[tmp_table_idx++];
+ break;
+ default:
+ break;
+ }
+ return owner->qep_actions[idx--];
+ }
+
+ bool is_last_element() { return idx == -1; }
+ };
};
diff --git a/sql/sql_array.h b/sql/sql_array.h
index da95e99daa4..159951e26a6 100644
--- a/sql/sql_array.h
+++ b/sql/sql_array.h
@@ -36,16 +36,16 @@ template <typename Element_type> class Bounds_checked_array
public:
Bounds_checked_array() : m_array(NULL), m_size(0) {}
- Bounds_checked_array(Element_type *el, size_t size)
- : m_array(el), m_size(size)
+ Bounds_checked_array(Element_type *el, size_t size_arg)
+ : m_array(el), m_size(size_arg)
{}
void reset() { m_array= NULL; m_size= 0; }
- void reset(Element_type *array, size_t size)
+ void reset(Element_type *array_arg, size_t size_arg)
{
- m_array= array;
- m_size= size;
+ m_array= array_arg;
+ m_size= size_arg;
}
/**
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 96d317e2b57..9162969e2d5 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1100,7 +1100,7 @@ void close_thread_table(THD *thd, TABLE **table_ptr)
critical section.
*/
if (table->file != NULL)
- table->file->unbind_psi();
+ MYSQL_UNBIND_TABLE(table->file);
tc_release_table(table);
DBUG_VOID_RETURN;
@@ -1635,8 +1635,8 @@ use_temporary_table(THD *thd, TABLE *table, TABLE **out_table)
thread to another, we need to let the performance schema know that,
for aggregates per thread to work properly.
*/
- table->file->unbind_psi();
- table->file->rebind_psi();
+ MYSQL_UNBIND_TABLE(table->file);
+ MYSQL_REBIND_TABLE(table->file);
}
#endif
}
@@ -2530,7 +2530,7 @@ retry_share:
if (table)
{
DBUG_ASSERT(table->file != NULL);
- table->file->rebind_psi();
+ MYSQL_REBIND_TABLE(table->file);
}
else
{
@@ -3439,10 +3439,11 @@ request_backoff_action(enum_open_table_action action_arg,
* We met a broken table that needs repair, or a table that
is not present on this MySQL server and needs re-discovery.
To perform the action, we need an exclusive metadata lock on
- the table. Acquiring an X lock while holding other shared
- locks is very deadlock-prone. If this is a multi- statement
- transaction that holds metadata locks for completed
- statements, we don't do it, and report an error instead.
+ the table. Acquiring X lock while holding other shared
+ locks can easily lead to deadlocks. We rely on MDL deadlock
+ detector to discover them. If this is a multi-statement
+ transaction that holds metadata locks for completed statements,
+ we should keep these locks after discovery/repair.
The action type in this case is OT_DISCOVER or OT_REPAIR.
* Our attempt to acquire an MDL lock lead to a deadlock,
detected by the MDL deadlock detector. The current
@@ -3483,7 +3484,7 @@ request_backoff_action(enum_open_table_action action_arg,
keep tables open between statements and a livelock
is not possible.
*/
- if (action_arg != OT_REOPEN_TABLES && m_has_locks)
+ if (action_arg == OT_BACKOFF_AND_RETRY && m_has_locks)
{
my_error(ER_LOCK_DEADLOCK, MYF(0));
m_thd->mark_transaction_to_rollback(true);
@@ -3512,6 +3513,32 @@ request_backoff_action(enum_open_table_action action_arg,
/**
+ An error handler to mark transaction to rollback on DEADLOCK error
+ during DISCOVER / REPAIR.
+*/
+class MDL_deadlock_discovery_repair_handler : public Internal_error_handler
+{
+public:
+ virtual bool handle_condition(THD *thd,
+ uint sql_errno,
+ const char* sqlstate,
+ Sql_condition::enum_warning_level level,
+ const char* msg,
+ Sql_condition ** cond_hdl)
+ {
+ if (sql_errno == ER_LOCK_DEADLOCK)
+ {
+ thd->mark_transaction_to_rollback(true);
+ }
+ /*
+ We have marked this transaction to rollback. Return false to allow
+ error to be reported or handled by other handlers.
+ */
+ return false;
+ }
+};
+
+/**
Recover from failed attempt of open table by performing requested action.
@pre This function should be called only with "action" != OT_NO_ACTION
@@ -3525,6 +3552,12 @@ bool
Open_table_context::recover_from_failed_open()
{
bool result= FALSE;
+ MDL_deadlock_discovery_repair_handler handler;
+ /*
+ Install error handler to mark transaction to rollback on DEADLOCK error.
+ */
+ m_thd->push_internal_handler(&handler);
+
/* Execute the action. */
switch (m_action)
{
@@ -3561,7 +3594,12 @@ Open_table_context::recover_from_failed_open()
result= FALSE;
}
- m_thd->mdl_context.release_transactional_locks();
+ /*
+ Rollback to start of the current statement to release exclusive lock
+ on table which was discovered but preserve locks from previous statements
+ in current transaction.
+ */
+ m_thd->mdl_context.rollback_to_savepoint(start_of_statement_svp());
break;
}
case OT_REPAIR:
@@ -3575,12 +3613,18 @@ Open_table_context::recover_from_failed_open()
m_failed_table->table_name, FALSE);
result= auto_repair_table(m_thd, m_failed_table);
- m_thd->mdl_context.release_transactional_locks();
+ /*
+ Rollback to start of the current statement to release exclusive lock
+ on table which was discovered but preserve locks from previous statements
+ in current transaction.
+ */
+ m_thd->mdl_context.rollback_to_savepoint(start_of_statement_svp());
break;
}
default:
DBUG_ASSERT(0);
}
+ m_thd->pop_internal_handler();
/*
Reset the pointers to conflicting MDL request and the
TABLE_LIST element, set when we need auto-discovery or repair,
@@ -4297,7 +4341,8 @@ lock_table_names(THD *thd, const DDL_options_st &options,
if (options.if_not_exists())
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
+ ER_TABLE_EXISTS_ERROR,
+ ER_THD(thd, ER_TABLE_EXISTS_ERROR),
tables_start->table_name);
}
else
@@ -4653,8 +4698,12 @@ restart:
if (!tbl)
continue;
- if (WSREP_ON && sqlcom_can_generate_row_events(thd) &&
- wsrep_replicate_myisam && tables && tbl->file->ht == myisam_hton &&
+ if (WSREP_ON &&
+ wsrep_replicate_myisam &&
+ tables &&
+ tbl->file->ht == myisam_hton &&
+ sqlcom_can_generate_row_events(thd) &&
+ thd->get_command() != COM_STMT_PREPARE &&
tables->lock_type >= TL_WRITE_ALLOW_WRITE)
{
WSREP_TO_ISOLATION_BEGIN(NULL, NULL, tables);
@@ -6610,6 +6659,7 @@ find_field_in_tables(THD *thd, Item_ident *item,
if (item->cached_table)
{
+ DBUG_PRINT("info", ("using cached table"));
/*
This shortcut is used by prepared statements. We assume that
TABLE_LIST *first_table is not changed during query execution (which
@@ -7303,7 +7353,7 @@ mark_common_columns(THD *thd, TABLE_LIST *table_ref_1, TABLE_LIST *table_ref_2,
set_new_item_local_context(thd, item_ident_2, nj_col_2->table_ref))
goto err;
- if (!(eq_cond= new Item_func_eq(item_ident_1, item_ident_2)))
+ if (!(eq_cond= new (thd->mem_root) Item_func_eq(thd, item_ident_1, item_ident_2)))
goto err; /* Out of memory. */
if (field_1 && field_1->vcol_info)
@@ -7316,8 +7366,8 @@ mark_common_columns(THD *thd, TABLE_LIST *table_ref_1, TABLE_LIST *table_ref_2,
fix_fields() is applied to all ON conditions in setup_conds()
so we don't do it here.
*/
- add_join_on((table_ref_1->outer_join & JOIN_TYPE_RIGHT ?
- table_ref_1 : table_ref_2),
+ add_join_on(thd, (table_ref_1->outer_join & JOIN_TYPE_RIGHT ?
+ table_ref_1 : table_ref_2),
eq_cond);
nj_col_1->is_common= nj_col_2->is_common= TRUE;
@@ -7362,14 +7412,6 @@ mark_common_columns(THD *thd, TABLE_LIST *table_ref_1, TABLE_LIST *table_ref_2,
*/
result= FALSE;
- /*
- Save the lists made during natural join matching (because
- the matching done only once but we need the list in case
- of prepared statements).
- */
- table_ref_1->persistent_used_items= table_ref_1->used_items;
- table_ref_2->persistent_used_items= table_ref_2->used_items;
-
err:
if (arena)
thd->restore_active_arena(arena, &backup);
@@ -7441,12 +7483,12 @@ store_natural_using_join_columns(THD *thd, TABLE_LIST *natural_using_join,
nj_col_1= it_1.get_natural_column_ref();
if (nj_col_1->is_common)
{
- natural_using_join->join_columns->push_back(nj_col_1);
+ natural_using_join->join_columns->push_back(nj_col_1, thd->mem_root);
/* Reset the common columns for the next call to mark_common_columns. */
nj_col_1->is_common= FALSE;
}
else
- non_join_columns->push_back(nj_col_1);
+ non_join_columns->push_back(nj_col_1, thd->mem_root);
}
/*
@@ -7486,7 +7528,7 @@ store_natural_using_join_columns(THD *thd, TABLE_LIST *natural_using_join,
{
nj_col_2= it_2.get_natural_column_ref();
if (!nj_col_2->is_common)
- non_join_columns->push_back(nj_col_2);
+ non_join_columns->push_back(nj_col_2, thd->mem_root);
else
{
/* Reset the common columns for the next call to mark_common_columns. */
@@ -7650,7 +7692,7 @@ store_top_level_join_columns(THD *thd, TABLE_LIST *table_ref,
/* Add a TRUE condition to outer joins that have no common columns. */
if (table_ref_2->outer_join &&
!table_ref_1->on_expr && !table_ref_2->on_expr)
- table_ref_2->on_expr= new Item_int((longlong) 1,1); /* Always true. */
+ table_ref_2->on_expr= new (thd->mem_root) Item_int(thd, (longlong) 1, 1); // Always true.
/* Change this table reference to become a leaf for name resolution. */
if (left_neighbor)
@@ -7815,7 +7857,7 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
Item_int do not need fix_fields() because it is basic constant.
*/
- it.replace(new Item_int("Not_used", (longlong) 1,
+ it.replace(new (thd->mem_root) Item_int(thd, "Not_used", (longlong) 1,
MY_INT64_NUM_DECIMAL_DIGITS));
}
else if (insert_fields(thd, ((Item_field*) item)->context,
@@ -7935,7 +7977,8 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
*(ref++)= item;
if (item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM &&
sum_func_list)
- item->split_sum_func(thd, ref_pointer_array, *sum_func_list);
+ item->split_sum_func(thd, ref_pointer_array, *sum_func_list,
+ SPLIT_SUM_SELECT);
thd->lex->used_tables|= item->used_tables();
thd->lex->current_select->cur_pos_in_select_list++;
}
@@ -8042,16 +8085,17 @@ bool setup_tables(THD *thd, Name_resolution_context *context,
if (select_lex->first_cond_optimization)
{
leaves.empty();
- if (!select_lex->is_prep_leaf_list_saved)
+ if (select_lex->prep_leaf_list_state != SELECT_LEX::SAVED)
{
make_leaves_list(thd, leaves, tables, full_table_list, first_select_table);
+ select_lex->prep_leaf_list_state= SELECT_LEX::READY;
select_lex->leaf_tables_exec.empty();
}
else
{
List_iterator_fast <TABLE_LIST> ti(select_lex->leaf_tables_prep);
while ((table_list= ti++))
- leaves.push_back(table_list);
+ leaves.push_back(table_list, thd->mem_root);
}
while ((table_list= ti++))
@@ -8415,11 +8459,6 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
}
}
#endif
- /*
- field_iterator.create_item() builds used_items which we
- have to save because changes made once and they are persistent
- */
- tables->persistent_used_items= tables->used_items;
if ((field= field_iterator.field()))
{
@@ -8507,7 +8546,7 @@ void wrap_ident(THD *thd, Item **conds)
DBUG_ASSERT((*conds)->type() == Item::FIELD_ITEM || (*conds)->type() == Item::REF_ITEM);
Query_arena *arena, backup;
arena= thd->activate_stmt_arena_if_needed(&backup);
- if ((wrapper= new Item_direct_ref_to_ident((Item_ident *)(*conds))))
+ if ((wrapper= new (thd->mem_root) Item_direct_ref_to_ident(thd, (Item_ident *) (*conds))))
(*conds)= (Item*) wrapper;
if (arena)
thd->restore_active_arena(arena, &backup);
@@ -8711,7 +8750,7 @@ err_no_arena:
*/
bool
-fill_record(THD * thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
+fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
bool ignore_errors)
{
List_iterator_fast<Item> f(fields),v(values);
@@ -8765,13 +8804,13 @@ fill_record(THD * thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN,
- ER(ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN),
+ ER_THD(thd, ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN),
rfield->field_name, table->s->table_name.str);
}
if ((!rfield->vcol_info || rfield->stored_in_db) &&
(value->save_in_field(rfield, 0)) < 0 && !ignore_errors)
{
- my_message(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR), MYF(0));
+ my_message(ER_UNKNOWN_ERROR, ER_THD(thd, ER_UNKNOWN_ERROR), MYF(0));
goto err;
}
rfield->set_explicit_default(value);
@@ -8917,7 +8956,7 @@ fill_record(THD *thd, TABLE *table, Field **ptr, List<Item> &values,
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN,
- ER(ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN),
+ ER_THD(thd, ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN),
field->field_name, table->s->table_name.str);
}
@@ -9173,7 +9212,7 @@ int init_ftfuncs(THD *thd, SELECT_LEX *select_lex, bool no_order)
DBUG_PRINT("info",("Performing FULLTEXT search"));
while ((ifm=li++))
- ifm->init_search(no_order);
+ ifm->init_search(thd, no_order);
}
return 0;
}
diff --git a/sql/sql_bitmap.h b/sql/sql_bitmap.h
index 55b2d7eefd9..229c4dc8379 100644
--- a/sql/sql_bitmap.h
+++ b/sql/sql_bitmap.h
@@ -168,7 +168,7 @@ public:
class Iterator : public Table_map_iterator
{
public:
- Iterator(Bitmap<64> &bmp) : Table_map_iterator(bmp.map) {}
+ Iterator(Bitmap<64> &map2) : Table_map_iterator(map2.map) {}
};
uint bits_set()
{
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index e1efb1e85d6..03505dec0cf 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -397,9 +397,9 @@ const uchar *query_state_map;
#if defined(ENABLED_DEBUG_SYNC)
#define QC_DEBUG_SYNC(name) \
do { \
- THD *thd= current_thd; \
- if (thd) \
- DEBUG_SYNC(thd, name); \
+ THD *thd_tmp= current_thd; \
+ if (thd_tmp) \
+ DEBUG_SYNC(thd_tmp, name); \
} while (0)
#else
#define QC_DEBUG_SYNC(name)
@@ -1037,10 +1037,10 @@ uchar *query_cache_query_get_key(const uchar *record, size_t *length,
/**
libmysql convenience wrapper to insert data into query cache.
*/
-void query_cache_insert(const char *packet, ulong length,
+void query_cache_insert(void *thd_arg, const char *packet, ulong length,
unsigned pkt_nr)
{
- THD *thd= current_thd;
+ THD *thd= (THD*) thd_arg;
/*
Current_thd can be NULL when a new connection is immediately ended
@@ -1052,7 +1052,7 @@ void query_cache_insert(const char *packet, ulong length,
if (!thd)
return;
- query_cache.insert(&thd->query_cache_tls,
+ query_cache.insert(thd, &thd->query_cache_tls,
packet, length,
pkt_nr);
}
@@ -1063,7 +1063,7 @@ void query_cache_insert(const char *packet, ulong length,
*/
void
-Query_cache::insert(Query_cache_tls *query_cache_tls,
+Query_cache::insert(THD *thd, Query_cache_tls *query_cache_tls,
const char *packet, ulong length,
unsigned pkt_nr)
{
@@ -1073,15 +1073,13 @@ Query_cache::insert(Query_cache_tls *query_cache_tls,
if (is_disabled() || query_cache_tls->first_query_block == NULL)
DBUG_VOID_RETURN;
- DBUG_ASSERT(current_thd);
-
QC_DEBUG_SYNC("wait_in_query_cache_insert");
/*
Lock the cache with try_lock(). try_lock() will fail if
cache was disabled between the above test and lock.
*/
- if (try_lock(current_thd, Query_cache::WAIT))
+ if (try_lock(thd, Query_cache::WAIT))
DBUG_VOID_RETURN;
Query_cache_block *query_block = query_cache_tls->first_query_block;
@@ -1130,16 +1128,15 @@ Query_cache::insert(Query_cache_tls *query_cache_tls,
void
-Query_cache::abort(Query_cache_tls *query_cache_tls)
+Query_cache::abort(THD *thd, Query_cache_tls *query_cache_tls)
{
- THD *thd;
DBUG_ENTER("query_cache_abort");
/* See the comment on double-check locking usage above. */
if (is_disabled() || query_cache_tls->first_query_block == NULL)
DBUG_VOID_RETURN;
- if (try_lock(current_thd, Query_cache::WAIT))
+ if (try_lock(thd, Query_cache::WAIT))
DBUG_VOID_RETURN;
/*
@@ -1149,7 +1146,6 @@ Query_cache::abort(Query_cache_tls *query_cache_tls)
Query_cache_block *query_block= query_cache_tls->first_query_block;
if (query_block)
{
- thd= current_thd;
THD_STAGE_INFO(thd, stage_storing_result_in_query_cache);
DUMP(this);
BLOCK_LOCK_WR(query_block);
@@ -1181,12 +1177,12 @@ void Query_cache::end_of_result(THD *thd)
if (thd->killed)
{
- query_cache_abort(&thd->query_cache_tls);
+ query_cache_abort(thd, &thd->query_cache_tls);
DBUG_VOID_RETURN;
}
#ifdef EMBEDDED_LIBRARY
- insert(query_cache_tls, (char*)thd,
+ insert(thd, query_cache_tls, (char*)thd,
emb_count_querycache_size(thd), 0);
#endif
@@ -1299,14 +1295,6 @@ ulong Query_cache::resize(ulong query_cache_size_arg)
query_cache_size_arg));
DBUG_ASSERT(initialized);
- if (global_system_variables.query_cache_type == 0)
- {
- DBUG_ASSERT(query_cache_size_arg == 0);
- if (query_cache_size_arg != 0)
- my_error(ER_QUERY_CACHE_IS_DISABLED, MYF(0));
- DBUG_RETURN(0);
- }
-
lock_and_suspend();
/*
@@ -1344,7 +1332,7 @@ ulong Query_cache::resize(ulong query_cache_size_arg)
m_cache_status is internal query cache switch so switching it on/off
will not be reflected on global_system_variables.query_cache_type
*/
- if (new_query_cache_size)
+ if (new_query_cache_size && global_system_variables.query_cache_type != 0)
{
DBUG_EXECUTE("check_querycache",check_integrity(1););
m_cache_status= OK; // size > 0 => enable cache
@@ -3338,7 +3326,7 @@ Query_cache::register_tables_from_list(THD *thd, TABLE_LIST *tables_used,
/*
There are not callback function for for VIEWs
*/
- if (!insert_table(key_length, key, (*block_table),
+ if (!insert_table(thd, key_length, key, (*block_table),
tables_used->view_db.length, 0,
HA_CACHE_TBL_NONTRANSACT, 0, 0, TRUE))
DBUG_RETURN(0);
@@ -3357,7 +3345,7 @@ Query_cache::register_tables_from_list(THD *thd, TABLE_LIST *tables_used,
(ulong) tables_used->table->s->table_cache_key.length,
(ulong) tables_used->table->s->table_cache_key.str));
- if (!insert_table(tables_used->table->s->table_cache_key.length,
+ if (!insert_table(thd, tables_used->table->s->table_cache_key.length,
tables_used->table->s->table_cache_key.str,
(*block_table),
tables_used->db_length, 0,
@@ -3423,7 +3411,7 @@ my_bool Query_cache::register_all_tables(THD *thd,
*/
my_bool
-Query_cache::insert_table(uint key_len, const char *key,
+Query_cache::insert_table(THD *thd, uint key_len, const char *key,
Query_cache_block_table *node,
uint32 db_length, uint8 suffix_length_arg,
uint8 cache_type,
@@ -3435,8 +3423,6 @@ Query_cache::insert_table(uint key_len, const char *key,
DBUG_PRINT("qcache", ("insert table node 0x%lx, len %d",
(ulong)node, key_len));
- THD *thd= current_thd;
-
Query_cache_block *table_block=
(hash ?
(Query_cache_block *) my_hash_search(&tables, (uchar*) key, key_len) :
diff --git a/sql/sql_cache.h b/sql/sql_cache.h
index 69520d668ac..00ba9bf59d8 100644
--- a/sql/sql_cache.h
+++ b/sql/sql_cache.h
@@ -487,11 +487,11 @@ protected:
void destroy();
- void insert(Query_cache_tls *query_cache_tls,
+ void insert(THD *thd, Query_cache_tls *query_cache_tls,
const char *packet,
ulong length,
unsigned pkt_nr);
- my_bool insert_table(uint key_len, const char *key,
+ my_bool insert_table(THD *thd, uint key_len, const char *key,
Query_cache_block_table *node,
uint32 db_length, uint8 suffix_length_arg,
uint8 cache_type,
@@ -500,7 +500,7 @@ protected:
my_bool hash);
void end_of_result(THD *thd);
- void abort(Query_cache_tls *query_cache_tls);
+ void abort(THD *thd, Query_cache_tls *query_cache_tls);
/*
The following functions are only used when debugging
@@ -558,7 +558,7 @@ struct Query_cache_query_flags
#define QUERY_CACHE_FLAGS_SIZE sizeof(Query_cache_query_flags)
#define QUERY_CACHE_DB_LENGTH_SIZE 2
#include "sql_cache.h"
-#define query_cache_abort(A) query_cache.abort(A)
+#define query_cache_abort(A,B) query_cache.abort(A,B)
#define query_cache_end_of_result(A) query_cache.end_of_result(A)
#define query_cache_store_query(A, B) query_cache.store_query(A, B)
#define query_cache_destroy() query_cache.destroy()
@@ -590,7 +590,7 @@ struct Query_cache_query_flags
#define query_cache_send_result_to_client(A, B, C) 0
#define query_cache_invalidate_by_MyISAM_filename_ref NULL
-#define query_cache_abort(A) do { } while(0)
+#define query_cache_abort(A,B) do { } while(0)
#define query_cache_end_of_result(A) do { } while(0)
#define query_cache_maybe_disabled(T) 1
#define query_cache_is_cacheable_query(L) 0
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index e025041d2e2..cb1aabf79e5 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -69,6 +69,10 @@
#include "sql_connect.h"
#include "my_atomic.h"
+#ifdef HAVE_SYS_SYSCALL_H
+#include <sys/syscall.h>
+#endif
+
/*
The following is used to initialise Table_ident with a internal
table name
@@ -867,6 +871,7 @@ THD::THD(bool is_wsrep_applier)
m_statement_psi(NULL),
m_idle_psi(NULL),
thread_id(0),
+ os_thread_id(0),
global_disable_checkpoint(0),
failed_com_change_user(0),
is_fatal_error(0),
@@ -947,7 +952,7 @@ THD::THD(bool is_wsrep_applier)
// Must be reset to handle error with THD's created for init of mysqld
lex->current_select= 0;
user_time.val= start_time= start_time_sec_part= 0;
- start_utime= prior_thr_create_utime= 0L;
+ start_utime= utime_after_query= prior_thr_create_utime= 0L;
utime_after_lock= 0L;
progress.arena= 0;
progress.report_to_client= 0;
@@ -961,6 +966,7 @@ THD::THD(bool is_wsrep_applier)
file_id = 0;
query_id= 0;
query_name_consts= 0;
+ semisync_info= 0;
db_charset= global_system_variables.collation_database;
bzero(ha_data, sizeof(ha_data));
mysys_var=0;
@@ -1137,7 +1143,7 @@ Internal_error_handler *THD::pop_internal_handler()
void THD::raise_error(uint sql_errno)
{
- const char* msg= ER(sql_errno);
+ const char* msg= ER_THD(this, sql_errno);
(void) raise_condition(sql_errno,
NULL,
Sql_condition::WARN_LEVEL_ERROR,
@@ -1150,7 +1156,7 @@ void THD::raise_error_printf(uint sql_errno, ...)
char ebuff[MYSQL_ERRMSG_SIZE];
DBUG_ENTER("THD::raise_error_printf");
DBUG_PRINT("my", ("nr: %d errno: %d", sql_errno, errno));
- const char* format= ER(sql_errno);
+ const char* format= ER_THD(this, sql_errno);
va_start(args, sql_errno);
my_vsnprintf(ebuff, sizeof(ebuff), format, args);
va_end(args);
@@ -1163,7 +1169,7 @@ void THD::raise_error_printf(uint sql_errno, ...)
void THD::raise_warning(uint sql_errno)
{
- const char* msg= ER(sql_errno);
+ const char* msg= ER_THD(this, sql_errno);
(void) raise_condition(sql_errno,
NULL,
Sql_condition::WARN_LEVEL_WARN,
@@ -1176,7 +1182,7 @@ void THD::raise_warning_printf(uint sql_errno, ...)
char ebuff[MYSQL_ERRMSG_SIZE];
DBUG_ENTER("THD::raise_warning_printf");
DBUG_PRINT("enter", ("warning: %u", sql_errno));
- const char* format= ER(sql_errno);
+ const char* format= ER_THD(this, sql_errno);
va_start(args, sql_errno);
my_vsnprintf(ebuff, sizeof(ebuff), format, args);
va_end(args);
@@ -1193,7 +1199,7 @@ void THD::raise_note(uint sql_errno)
DBUG_PRINT("enter", ("code: %d", sql_errno));
if (!(variables.option_bits & OPTION_SQL_NOTES))
DBUG_VOID_RETURN;
- const char* msg= ER(sql_errno);
+ const char* msg= ER_THD(this, sql_errno);
(void) raise_condition(sql_errno,
NULL,
Sql_condition::WARN_LEVEL_NOTE,
@@ -1209,7 +1215,7 @@ void THD::raise_note_printf(uint sql_errno, ...)
DBUG_PRINT("enter",("code: %u", sql_errno));
if (!(variables.option_bits & OPTION_SQL_NOTES))
DBUG_VOID_RETURN;
- const char* format= ER(sql_errno);
+ const char* format= ER_THD(this, sql_errno);
va_start(args, sql_errno);
my_vsnprintf(ebuff, sizeof(ebuff), format, args);
va_end(args);
@@ -1243,7 +1249,7 @@ Sql_condition* THD::raise_condition(uint sql_errno,
if (sql_errno == 0)
sql_errno= ER_UNKNOWN_ERROR;
if (msg == NULL)
- msg= ER(sql_errno);
+ msg= ER_THD(this, sql_errno);
if (sqlstate == NULL)
sqlstate= mysql_errno_to_sqlstate(sql_errno);
@@ -1286,7 +1292,7 @@ Sql_condition* THD::raise_condition(uint sql_errno,
}
}
- query_cache_abort(&query_cache_tls);
+ query_cache_abort(this, &query_cache_tls);
/*
Avoid pushing a condition for fatal out of memory errors as this will
@@ -1418,6 +1424,7 @@ void THD::init(void)
bzero((char *) &org_status_var, sizeof(org_status_var));
start_bytes_received= 0;
last_commit_gtid.seq_no= 0;
+ status_in_global= 0;
#ifdef WITH_WSREP
wsrep_exec_mode= wsrep_applier ? REPL_RECV : LOCAL_STATE;
wsrep_conflict_state= NO_CONFLICT;
@@ -1427,12 +1434,10 @@ void THD::init(void)
wsrep_trx_meta.depends_on= WSREP_SEQNO_UNDEFINED;
wsrep_converted_lock_session= false;
wsrep_retry_counter= 0;
- wsrep_rli= NULL;
wsrep_rgi= NULL;
wsrep_PA_safe= true;
wsrep_consistency_check = NO_CONSISTENCY_CHECK;
wsrep_mysql_replicated = 0;
-
wsrep_TOI_pre_query = NULL;
wsrep_TOI_pre_query_len = 0;
#endif
@@ -1442,6 +1447,8 @@ void THD::init(void)
else
variables.option_bits&= ~OPTION_BIN_LOG;
+ variables.sql_log_bin_off= 0;
+
select_commands= update_commands= other_commands= 0;
/* Set to handle counting of aborted connections */
userstat_running= opt_userstat_running;
@@ -1540,6 +1547,7 @@ void THD::change_user(void)
cleanup();
reset_killed();
cleanup_done= 0;
+ status_in_global= 0;
init();
stmt_map.reset();
my_hash_init(&user_vars, system_charset_info, USER_VARS_HASH_SIZE, 0, 0,
@@ -1634,7 +1642,6 @@ THD::~THD()
mysql_mutex_lock(&LOCK_wsrep_thd);
mysql_mutex_unlock(&LOCK_wsrep_thd);
mysql_mutex_destroy(&LOCK_wsrep_thd);
- if (wsrep_rli) delete wsrep_rli;
if (wsrep_rgi) delete wsrep_rgi;
#endif
/* Close connection */
@@ -1677,6 +1684,7 @@ THD::~THD()
mysql_audit_free_thd(this);
if (rgi_slave)
rgi_slave->cleanup_after_session();
+ my_free(semisync_info);
#endif
main_lex.free_set_stmt_mem_root();
free_root(&main_mem_root, MYF(0));
@@ -1940,6 +1948,7 @@ void THD::disconnect()
/* Disconnect even if a active vio is not associated. */
if (net.vio != vio)
vio_close(net.vio);
+ net.thd= 0; // Don't collect statistics
mysql_mutex_unlock(&LOCK_thd_data);
}
@@ -2063,10 +2072,19 @@ bool THD::store_globals()
This allows us to move THD to different threads if needed.
*/
mysys_var->id= thread_id;
+#ifdef __NR_gettid
+ os_thread_id= syscall(__NR_gettid);
+#else
+ os_thread_id= 0;
+#endif
real_id= pthread_self(); // For debugging
mysys_var->stack_ends_here= thread_stack + // for consistency, see libevent_thread_proc
STACK_DIRECTION * (long)my_thread_stack_size;
- vio_set_thread_id(net.vio, real_id);
+ if (net.vio)
+ {
+ vio_set_thread_id(net.vio, real_id);
+ net.thd= this;
+ }
/*
We have to call thr_lock_info_init() again here as THD may have been
created in another thread
@@ -2091,7 +2109,7 @@ void THD::reset_globals()
/* Undocking the thread specific data. */
set_current_thd(0);
my_pthread_setspecific_ptr(THR_MALLOC, NULL);
-
+ net.thd= 0;
}
/*
@@ -2457,11 +2475,11 @@ int THD::send_explain_fields(select_result *result, uint8 explain_flags, bool is
void THD::make_explain_json_field_list(List<Item> &field_list, bool is_analyze)
{
- Item *item= new Item_empty_string((is_analyze ?
- "ANALYZE" :
- "EXPLAIN"),
- 78, system_charset_info);
- field_list.push_back(item);
+ Item *item= new (mem_root) Item_empty_string(this, (is_analyze ?
+ "ANALYZE" :
+ "EXPLAIN"),
+ 78, system_charset_info);
+ field_list.push_back(item, mem_root);
}
@@ -2478,55 +2496,79 @@ void THD::make_explain_field_list(List<Item> &field_list, uint8 explain_flags,
{
Item *item;
CHARSET_INFO *cs= system_charset_info;
- field_list.push_back(item= new Item_return_int("id",3, MYSQL_TYPE_LONGLONG));
+ field_list.push_back(item= new (mem_root)
+ Item_return_int(this, "id", 3,
+ MYSQL_TYPE_LONGLONG), mem_root);
item->maybe_null= 1;
- field_list.push_back(new Item_empty_string("select_type", 19, cs));
- field_list.push_back(item= new Item_empty_string("table", NAME_CHAR_LEN, cs));
+ field_list.push_back(new (mem_root)
+ Item_empty_string(this, "select_type", 19, cs),
+ mem_root);
+ field_list.push_back(item= new (mem_root)
+ Item_empty_string(this, "table", NAME_CHAR_LEN, cs),
+ mem_root);
item->maybe_null= 1;
if (explain_flags & DESCRIBE_PARTITIONS)
{
/* Maximum length of string that make_used_partitions_str() can produce */
- item= new Item_empty_string("partitions", MAX_PARTITIONS * (1 + FN_LEN),
- cs);
- field_list.push_back(item);
+ item= new (mem_root) Item_empty_string(this, "partitions",
+ MAX_PARTITIONS * (1 + FN_LEN), cs);
+ field_list.push_back(item, mem_root);
item->maybe_null= 1;
}
- field_list.push_back(item= new Item_empty_string("type", 10, cs));
+ field_list.push_back(item= new (mem_root)
+ Item_empty_string(this, "type", 10, cs),
+ mem_root);
item->maybe_null= 1;
- field_list.push_back(item=new Item_empty_string("possible_keys",
- NAME_CHAR_LEN*MAX_KEY, cs));
+ field_list.push_back(item= new (mem_root)
+ Item_empty_string(this, "possible_keys",
+ NAME_CHAR_LEN*MAX_KEY, cs),
+ mem_root);
item->maybe_null=1;
- field_list.push_back(item=new Item_empty_string("key", NAME_CHAR_LEN, cs));
+ field_list.push_back(item=new (mem_root)
+ Item_empty_string(this, "key", NAME_CHAR_LEN, cs),
+ mem_root);
item->maybe_null=1;
- field_list.push_back(item=new Item_empty_string("key_len",
- NAME_CHAR_LEN*MAX_KEY));
+ field_list.push_back(item=new (mem_root)
+ Item_empty_string(this, "key_len",
+ NAME_CHAR_LEN*MAX_KEY),
+ mem_root);
item->maybe_null=1;
- field_list.push_back(item=new Item_empty_string("ref",
- NAME_CHAR_LEN*MAX_REF_PARTS,
- cs));
+ field_list.push_back(item=new (mem_root)
+ Item_empty_string(this, "ref",
+ NAME_CHAR_LEN*MAX_REF_PARTS, cs),
+ mem_root);
item->maybe_null=1;
- field_list.push_back(item= new Item_return_int("rows", 10,
- MYSQL_TYPE_LONGLONG));
+ field_list.push_back(item= new (mem_root)
+ Item_return_int(this, "rows", 10, MYSQL_TYPE_LONGLONG),
+ mem_root);
if (is_analyze)
{
- field_list.push_back(item= new Item_float("r_rows", 0.1234, 10, 4));
+ field_list.push_back(item= new (mem_root)
+ Item_float(this, "r_rows", 0.1234, 10, 4),
+ mem_root);
item->maybe_null=1;
}
if (is_analyze || (explain_flags & DESCRIBE_EXTENDED))
{
- field_list.push_back(item= new Item_float("filtered", 0.1234, 2, 4));
+ field_list.push_back(item= new (mem_root)
+ Item_float(this, "filtered", 0.1234, 2, 4),
+ mem_root);
item->maybe_null=1;
}
if (is_analyze)
{
- field_list.push_back(item= new Item_float("r_filtered", 0.1234, 2, 4));
+ field_list.push_back(item= new (mem_root)
+ Item_float(this, "r_filtered", 0.1234, 2, 4),
+ mem_root);
item->maybe_null=1;
}
item->maybe_null= 1;
- field_list.push_back(new Item_empty_string("Extra", 255, cs));
+ field_list.push_back(new (mem_root)
+ Item_empty_string(this, "Extra", 255, cs),
+ mem_root);
}
@@ -2954,7 +2996,7 @@ select_export::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
*/
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED,
- ER(WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED));
+ ER_THD(thd, WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED));
}
field_term_length=exchange->field_term->length();
field_term_char= field_term_length ?
@@ -2984,7 +3026,8 @@ select_export::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
field_term_length && strchr(NUMERIC_CHARS, field_term_char)))
{
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_AMBIGUOUS_FIELD_TERM, ER(ER_AMBIGUOUS_FIELD_TERM));
+ ER_AMBIGUOUS_FIELD_TERM,
+ ER_THD(thd, ER_AMBIGUOUS_FIELD_TERM));
is_ambiguous_field_term= TRUE;
}
else
@@ -3061,7 +3104,7 @@ int select_export::send_data(List<Item> &items)
res->charset(), 6);
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
- ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
+ ER_THD(thd, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
"string", printable_buff,
item->name, static_cast<long>(row_count));
}
@@ -3071,7 +3114,8 @@ int select_export::send_data(List<Item> &items)
result is longer than UINT_MAX32 and doesn't fit into String
*/
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- WARN_DATA_TRUNCATED, ER(WARN_DATA_TRUNCATED),
+ WARN_DATA_TRUNCATED,
+ ER_THD(thd, WARN_DATA_TRUNCATED),
item->full_name(), static_cast<long>(row_count));
}
cvt_str.length(bytes);
@@ -3271,7 +3315,7 @@ int select_dump::send_data(List<Item> &items)
if (row_count++ > 1)
{
- my_message(ER_TOO_MANY_ROWS, ER(ER_TOO_MANY_ROWS), MYF(0));
+ my_message(ER_TOO_MANY_ROWS, ER_THD(thd, ER_TOO_MANY_ROWS), MYF(0));
goto err;
}
while ((item=li++))
@@ -3300,7 +3344,7 @@ int select_singlerow_subselect::send_data(List<Item> &items)
Item_singlerow_subselect *it= (Item_singlerow_subselect *)item;
if (it->assigned())
{
- my_message(ER_SUBQUERY_NO_1_ROW, ER(ER_SUBQUERY_NO_1_ROW),
+ my_message(ER_SUBQUERY_NO_1_ROW, ER_THD(thd, ER_SUBQUERY_NO_1_ROW),
MYF(current_thd->lex->ignore ? ME_JUST_WARNING : 0));
DBUG_RETURN(1);
}
@@ -3345,7 +3389,7 @@ int select_max_min_finder_subselect::send_data(List<Item> &items)
{
if (!cache)
{
- cache= Item_cache::get_cache(val_item);
+ cache= Item_cache::get_cache(thd, val_item);
switch (val_item->result_type()) {
case REAL_RESULT:
op= &select_max_min_finder_subselect::cmp_real;
@@ -3361,7 +3405,6 @@ int select_max_min_finder_subselect::send_data(List<Item> &items)
break;
case ROW_RESULT:
case TIME_RESULT:
- case IMPOSSIBLE_RESULT:
// This case should never be choosen
DBUG_ASSERT(0);
op= 0;
@@ -3473,7 +3516,7 @@ int select_dumpvar::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
if (var_list.elements != list.elements)
{
my_message(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT,
- ER(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT), MYF(0));
+ ER_THD(thd, ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT), MYF(0));
return 1;
}
return 0;
@@ -3802,7 +3845,7 @@ Statement_map::~Statement_map()
bool my_var_user::set(THD *thd, Item *item)
{
- Item_func_set_user_var *suv= new Item_func_set_user_var(name, item);
+ Item_func_set_user_var *suv= new (thd->mem_root) Item_func_set_user_var(thd, name, item);
suv->save_item_result(item);
return suv->fix_fields(thd, 0) || suv->update();
}
@@ -3827,7 +3870,7 @@ int select_dumpvar::send_data(List<Item> &items)
}
if (row_count++)
{
- my_message(ER_TOO_MANY_ROWS, ER(ER_TOO_MANY_ROWS), MYF(0));
+ my_message(ER_TOO_MANY_ROWS, ER_THD(thd, ER_TOO_MANY_ROWS), MYF(0));
DBUG_RETURN(1);
}
while ((mv= var_li++) && (item= it++))
@@ -3842,7 +3885,7 @@ bool select_dumpvar::send_eof()
{
if (! row_count)
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_SP_FETCH_NO_DATA, ER(ER_SP_FETCH_NO_DATA));
+ ER_SP_FETCH_NO_DATA, ER_THD(thd, ER_SP_FETCH_NO_DATA));
/*
Don't send EOF if we're in error condition (which implies we've already
sent or are sending an error)
@@ -3973,26 +4016,29 @@ void TMP_TABLE_PARAM::init()
}
-void thd_increment_bytes_sent(ulong length)
+void thd_increment_bytes_sent(void *thd, ulong length)
{
- THD *thd=current_thd;
+ /* thd == 0 when close_connection() calls net_send_error() */
if (likely(thd != 0))
{
- /* current_thd == 0 when close_connection() calls net_send_error() */
- thd->status_var.bytes_sent+= length;
+ ((THD*) thd)->status_var.bytes_sent+= length;
}
}
-void thd_increment_bytes_received(ulong length)
+void thd_increment_bytes_received(void *thd, ulong length)
{
- current_thd->status_var.bytes_received+= length;
+ if (unlikely(!thd)) // Called from federatedx
+ thd= current_thd;
+ ((THD*) thd)->status_var.bytes_received+= length;
}
-void thd_increment_net_big_packet_count(ulong length)
+void thd_increment_net_big_packet_count(void *thd, ulong length)
{
- current_thd->status_var.net_big_packet_count+= length;
+ if (unlikely(!thd)) // Called from federatedx
+ thd= current_thd;
+ ((THD*) thd)->status_var.net_big_packet_count+= length;
}
@@ -5742,7 +5788,8 @@ int THD::decide_logging_format(TABLE_LIST *tables)
unsafe_type++)
if (unsafe_flags & (1 << unsafe_type))
my_error((error= ER_BINLOG_UNSAFE_AND_STMT_ENGINE), MYF(0),
- ER(LEX::binlog_stmt_unsafe_errcode[unsafe_type]));
+ ER_THD(this,
+ LEX::binlog_stmt_unsafe_errcode[unsafe_type]));
}
/* log in statement format! */
}
@@ -5782,7 +5829,7 @@ int THD::decide_logging_format(TABLE_LIST *tables)
DBUG_PRINT("info", ("Scheduling warning to be issued by "
"binlog_query: '%s'",
- ER(ER_BINLOG_UNSAFE_STATEMENT)));
+ ER_THD(this, ER_BINLOG_UNSAFE_STATEMENT)));
DBUG_PRINT("info", ("binlog_unsafe_warning_flags: 0x%x",
binlog_unsafe_warning_flags));
}
@@ -5919,13 +5966,11 @@ int THD::decide_logging_format(TABLE_LIST *tables)
If error, NULL.
*/
-template <class RowsEventT> Rows_log_event*
+template <class RowsEventT> Rows_log_event*
THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id,
- MY_BITMAP const* cols,
- size_t colcnt,
size_t needed,
bool is_transactional,
- RowsEventT *hint __attribute__((unused)))
+ RowsEventT *hint __attribute__((unused)))
{
DBUG_ENTER("binlog_prepare_pending_rows_event");
/* Pre-conditions */
@@ -5961,16 +6006,15 @@ THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id,
event.
*/
if (!pending ||
- pending->server_id != serv_id ||
+ pending->server_id != serv_id ||
pending->get_table_id() != table->s->table_map_id ||
- pending->get_general_type_code() != general_type_code ||
- pending->get_data_size() + needed > opt_binlog_rows_event_max_size ||
- pending->get_width() != colcnt ||
- !bitmap_cmp(pending->get_cols(), cols))
+ pending->get_general_type_code() != general_type_code ||
+ pending->get_data_size() + needed > opt_binlog_rows_event_max_size ||
+ pending->read_write_bitmaps_cmp(table) == FALSE)
{
/* Create a new RowsEventT... */
Rows_log_event* const
- ev= new RowsEventT(this, table, table->s->table_map_id, cols,
+ ev= new RowsEventT(this, table, table->s->table_map_id,
is_transactional);
if (unlikely(!ev))
DBUG_RETURN(NULL);
@@ -6115,9 +6159,8 @@ CPP_UNNAMED_NS_START
CPP_UNNAMED_NS_END
-int THD::binlog_write_row(TABLE* table, bool is_trans,
- MY_BITMAP const* cols, size_t colcnt,
- uchar const *record)
+int THD::binlog_write_row(TABLE* table, bool is_trans,
+ uchar const *record)
{
DBUG_ASSERT(is_current_stmt_binlog_format_row() &&
@@ -6132,14 +6175,14 @@ int THD::binlog_write_row(TABLE* table, bool is_trans,
uchar *row_data= memory.slot(0);
- size_t const len= pack_row(table, cols, row_data, record);
+ size_t const len= pack_row(table, table->write_set, row_data, record);
/* Ensure that all events in a GTID group are in the same cache */
if (variables.option_bits & OPTION_GTID_BEGIN)
is_trans= 1;
Rows_log_event* const ev=
- binlog_prepare_pending_rows_event(table, variables.server_id, cols, colcnt,
+ binlog_prepare_pending_rows_event(table, variables.server_id,
len, is_trans,
static_cast<Write_rows_log_event*>(0));
@@ -6150,13 +6193,19 @@ int THD::binlog_write_row(TABLE* table, bool is_trans,
}
int THD::binlog_update_row(TABLE* table, bool is_trans,
- MY_BITMAP const* cols, size_t colcnt,
const uchar *before_record,
const uchar *after_record)
{
DBUG_ASSERT(is_current_stmt_binlog_format_row() &&
((WSREP(this) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()));
+ /**
+ Save a reference to the original read and write set bitmaps.
+ We will need this to restore the bitmaps at the end.
+ */
+ MY_BITMAP *old_read_set= table->read_set;
+ MY_BITMAP *old_write_set= table->write_set;
+
size_t const before_maxlen = max_row_length(table, before_record);
size_t const after_maxlen = max_row_length(table, after_record);
@@ -6167,9 +6216,9 @@ int THD::binlog_update_row(TABLE* table, bool is_trans,
uchar *before_row= row_data.slot(0);
uchar *after_row= row_data.slot(1);
- size_t const before_size= pack_row(table, cols, before_row,
+ size_t const before_size= pack_row(table, table->read_set, before_row,
before_record);
- size_t const after_size= pack_row(table, cols, after_row,
+ size_t const after_size= pack_row(table, table->write_set, after_row,
after_record);
/* Ensure that all events in a GTID group are in the same cache */
@@ -6188,26 +6237,44 @@ int THD::binlog_update_row(TABLE* table, bool is_trans,
#endif
Rows_log_event* const ev=
- binlog_prepare_pending_rows_event(table, variables.server_id, cols, colcnt,
- before_size + after_size, is_trans,
- static_cast<Update_rows_log_event*>(0));
+ binlog_prepare_pending_rows_event(table, variables.server_id,
+ before_size + after_size, is_trans,
+ static_cast<Update_rows_log_event*>(0));
if (unlikely(ev == 0))
return HA_ERR_OUT_OF_MEM;
- return
- ev->add_row_data(before_row, before_size) ||
- ev->add_row_data(after_row, after_size);
+ int error= ev->add_row_data(before_row, before_size) ||
+ ev->add_row_data(after_row, after_size);
+
+ /* restore read/write set for the rest of execution */
+ table->column_bitmaps_set_no_signal(old_read_set,
+ old_write_set);
+
+ return error;
+
}
int THD::binlog_delete_row(TABLE* table, bool is_trans,
- MY_BITMAP const* cols, size_t colcnt,
uchar const *record)
{
DBUG_ASSERT(is_current_stmt_binlog_format_row() &&
((WSREP(this) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()));
+ /**
+ Save a reference to the original read and write set bitmaps.
+ We will need this to restore the bitmaps at the end.
+ */
+ MY_BITMAP *old_read_set= table->read_set;
+ MY_BITMAP *old_write_set= table->write_set;
- /*
+ /**
+ This will remove spurious fields required during execution but
+ not needed for binlogging. This is done according to the:
+ binlog-row-image option.
+ */
+ binlog_prepare_row_images(table);
+
+ /*
Pack records into format for transfer. We are allocating more
memory than needed, but that doesn't matter.
*/
@@ -6217,24 +6284,96 @@ int THD::binlog_delete_row(TABLE* table, bool is_trans,
uchar *row_data= memory.slot(0);
- size_t const len= pack_row(table, cols, row_data, record);
+ DBUG_DUMP("table->read_set", (uchar*) table->read_set->bitmap, (table->s->fields + 7) / 8);
+ size_t const len= pack_row(table, table->read_set, row_data, record);
/* Ensure that all events in a GTID group are in the same cache */
if (variables.option_bits & OPTION_GTID_BEGIN)
is_trans= 1;
Rows_log_event* const ev=
- binlog_prepare_pending_rows_event(table, variables.server_id, cols, colcnt,
- len, is_trans,
- static_cast<Delete_rows_log_event*>(0));
+ binlog_prepare_pending_rows_event(table, variables.server_id,
+ len, is_trans,
+ static_cast<Delete_rows_log_event*>(0));
if (unlikely(ev == 0))
return HA_ERR_OUT_OF_MEM;
- return ev->add_row_data(row_data, len);
+
+ int error= ev->add_row_data(row_data, len);
+
+ /* restore read/write set for the rest of execution */
+ table->column_bitmaps_set_no_signal(old_read_set,
+ old_write_set);
+
+ return error;
}
+void THD::binlog_prepare_row_images(TABLE *table)
+{
+ DBUG_ENTER("THD::binlog_prepare_row_images");
+ /**
+ Remove from read_set spurious columns. The write_set has been
+ handled before in table->mark_columns_needed_for_update.
+ */
+
+ DBUG_PRINT_BITSET("debug", "table->read_set (before preparing): %s", table->read_set);
+ THD *thd= table->in_use;
+
+ /**
+ if there is a primary key in the table (ie, user declared PK or a
+ non-null unique index) and we dont want to ship the entire image,
+ and the handler involved supports this.
+ */
+ if (table->s->primary_key < MAX_KEY &&
+ (thd->variables.binlog_row_image < BINLOG_ROW_IMAGE_FULL) &&
+ !ha_check_storage_engine_flag(table->s->db_type(), HTON_NO_BINLOG_ROW_OPT))
+ {
+ /**
+ Just to be sure that tmp_set is currently not in use as
+ the read_set already.
+ */
+ DBUG_ASSERT(table->read_set != &table->tmp_set);
+
+ bitmap_clear_all(&table->tmp_set);
+
+ switch(thd->variables.binlog_row_image)
+ {
+ case BINLOG_ROW_IMAGE_MINIMAL:
+ /* MINIMAL: Mark only PK */
+ table->mark_columns_used_by_index_no_reset(table->s->primary_key,
+ &table->tmp_set);
+ break;
+ case BINLOG_ROW_IMAGE_NOBLOB:
+ /**
+ NOBLOB: Remove unnecessary BLOB fields from read_set
+ (the ones that are not part of PK).
+ */
+ bitmap_union(&table->tmp_set, table->read_set);
+ for (Field **ptr=table->field ; *ptr ; ptr++)
+ {
+ Field *field= (*ptr);
+ if ((field->type() == MYSQL_TYPE_BLOB) &&
+ !(field->flags & PRI_KEY_FLAG))
+ bitmap_clear_bit(&table->tmp_set, field->field_index);
+ }
+ break;
+ default:
+ DBUG_ASSERT(0); // impossible.
+ }
+
+ /* set the temporary read_set */
+ table->column_bitmaps_set_no_signal(&table->tmp_set,
+ table->write_set);
+ }
+
+ DBUG_PRINT_BITSET("debug", "table->read_set (after preparing): %s", table->read_set);
+ DBUG_VOID_RETURN;
+}
+
+
+
int THD::binlog_remove_pending_rows_event(bool clear_maps,
bool is_transactional)
{
@@ -6349,13 +6488,13 @@ static void reset_binlog_unsafe_suppression(ulonglong now)
/**
Auxiliary function to print warning in the error log.
*/
-static void print_unsafe_warning_to_log(int unsafe_type, char* buf,
- char* query)
+static void print_unsafe_warning_to_log(THD *thd, int unsafe_type, char* buf,
+ char* query)
{
DBUG_ENTER("print_unsafe_warning_in_log");
- sprintf(buf, ER(ER_BINLOG_UNSAFE_STATEMENT),
- ER(LEX::binlog_stmt_unsafe_errcode[unsafe_type]));
- sql_print_warning(ER(ER_MESSAGE_AND_STATEMENT), buf, query);
+ sprintf(buf, ER_THD(thd, ER_BINLOG_UNSAFE_STATEMENT),
+ ER_THD(thd, LEX::binlog_stmt_unsafe_errcode[unsafe_type]));
+ sql_print_warning(ER_THD(thd, ER_MESSAGE_AND_STATEMENT), buf, query);
DBUG_VOID_RETURN;
}
@@ -6483,11 +6622,11 @@ void THD::issue_unsafe_warnings()
{
push_warning_printf(this, Sql_condition::WARN_LEVEL_NOTE,
ER_BINLOG_UNSAFE_STATEMENT,
- ER(ER_BINLOG_UNSAFE_STATEMENT),
- ER(LEX::binlog_stmt_unsafe_errcode[unsafe_type]));
+ ER_THD(this, ER_BINLOG_UNSAFE_STATEMENT),
+ ER_THD(this, LEX::binlog_stmt_unsafe_errcode[unsafe_type]));
if (global_system_variables.log_warnings > 0 &&
!protect_against_unsafe_warning_flood(unsafe_type))
- print_unsafe_warning_to_log(unsafe_type, buf, query());
+ print_unsafe_warning_to_log(this, unsafe_type, buf, query());
}
}
DBUG_VOID_RETURN;
@@ -6617,14 +6756,6 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
The MYSQL_LOG::write() function will set the STMT_END_F flag and
flush the pending rows event if necessary.
*/
- /*
- Even though wsrep only supports ROW binary log format, a user can set
- binlog format to STATEMENT (wsrep_forced_binlog_format). In which case
- the control might reach here even when binary logging (--log-bin) is
- not enabled. This is possible because wsrep patch partially enables
- binary logging by setting wsrep_emulate_binlog.
- */
- if (mysql_bin_log.is_open())
{
Query_log_event qinfo(this, query_arg, query_len, is_trans, direct,
suppress_use, errcode);
@@ -6868,7 +6999,7 @@ wait_for_commit::wait_for_prior_commit2(THD *thd)
wakeup_error= thd->killed_errno();
if (!wakeup_error)
wakeup_error= ER_QUERY_INTERRUPTED;
- my_message(wakeup_error, ER(wakeup_error), MYF(0));
+ my_message(wakeup_error, ER_THD(thd, wakeup_error), MYF(0));
thd->EXIT_COND(&old_stage);
/*
Must do the DEBUG_SYNC() _after_ exit_cond(), as DEBUG_SYNC is not safe to
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 176d739f38f..f12281657f5 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -66,10 +66,8 @@ class Reprepare_observer;
class Relay_log_info;
struct rpl_group_info;
class Rpl_filter;
-
class Query_log_event;
class Load_log_event;
-class Slave_log_event;
class sp_rcontext;
class sp_cache;
class Lex_input_stream;
@@ -77,6 +75,7 @@ class Parser_state;
class Rows_log_event;
class Sroutine_hash_entry;
class user_var_entry;
+struct Trans_binlog_info;
class rpl_io_thread_info;
class rpl_sql_thread_info;
@@ -96,6 +95,16 @@ enum enum_mark_columns
{ MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE};
enum enum_filetype { FILETYPE_CSV, FILETYPE_XML };
+enum enum_binlog_row_image {
+ /** PKE in the before image and changed columns in the after image */
+ BINLOG_ROW_IMAGE_MINIMAL= 0,
+ /** Whenever possible, before and after image contain all columns except blobs. */
+ BINLOG_ROW_IMAGE_NOBLOB= 1,
+ /** All columns in both before and after image. */
+ BINLOG_ROW_IMAGE_FULL= 2
+};
+
+
/* Bits for different SQL modes modes (including ANSI mode) */
#define MODE_REAL_AS_FLOAT (1ULL << 0)
#define MODE_PIPES_AS_CONCAT (1ULL << 1)
@@ -487,7 +496,6 @@ enum killed_type
#include "sql_lex.h" /* Must be here */
-extern LEX_STRING sql_statement_names[(uint) SQLCOM_END + 1];
class Delayed_insert;
class select_result;
class Time_zone;
@@ -589,6 +597,7 @@ typedef struct system_variables
/* Flags for slow log filtering */
ulong log_slow_rate_limit;
ulong binlog_format; ///< binlog format for this thd (see enum_binlog_format)
+ ulong binlog_row_image;
ulong progress_report_time;
ulong completion_type;
ulong query_cache_type;
@@ -623,6 +632,11 @@ typedef struct system_variables
my_bool query_cache_strip_comments;
my_bool sql_log_slow;
my_bool sql_log_bin;
+ /*
+ A flag to help detect whether binary logging was temporarily disabled
+ (see tmp_disable_binlog(A) macro).
+ */
+ my_bool sql_log_bin_off;
my_bool binlog_annotate_row_events;
my_bool binlog_direct_non_trans_update;
@@ -645,6 +659,8 @@ typedef struct system_variables
/* Error messages */
MY_LOCALE *lc_messages;
+ const char **errmsgs; /* lc_messages->errmsg->errmsgs */
+
/* Locale Support */
MY_LOCALE *lc_time_names;
@@ -661,6 +677,7 @@ typedef struct system_variables
my_bool wsrep_dirty_reads;
uint wsrep_sync_wait;
ulong wsrep_retry_autocommit;
+ ulong wsrep_OSU_method;
double long_query_time_double, max_statement_time_double;
my_bool pseudo_slave_mode;
@@ -675,8 +692,19 @@ typedef struct system_variables
typedef struct system_status_var
{
- ulong com_other;
ulong com_stat[(uint) SQLCOM_END];
+ ulong com_create_tmp_table;
+ ulong com_drop_tmp_table;
+ ulong com_other;
+
+ ulong com_stmt_prepare;
+ ulong com_stmt_reprepare;
+ ulong com_stmt_execute;
+ ulong com_stmt_send_long_data;
+ ulong com_stmt_fetch;
+ ulong com_stmt_reset;
+ ulong com_stmt_close;
+
ulong created_tmp_disk_tables_;
ulong created_tmp_tables_;
ulong ha_commit_count;
@@ -729,14 +757,6 @@ typedef struct system_status_var
ulong filesort_rows_;
ulong filesort_scan_count_;
ulong filesort_pq_sorts_;
- /* Prepared statements and binary protocol */
- ulong com_stmt_prepare;
- ulong com_stmt_reprepare;
- ulong com_stmt_execute;
- ulong com_stmt_send_long_data;
- ulong com_stmt_fetch;
- ulong com_stmt_reset;
- ulong com_stmt_close;
/* Features used */
ulong feature_dynamic_columns; /* +1 when creating a dynamic column */
@@ -1784,7 +1804,7 @@ struct wait_for_commit
return wakeup_error;
}
}
- void wakeup_subsequent_commits(int wakeup_error)
+ void wakeup_subsequent_commits(int wakeup_error_arg)
{
/*
Do the check inline, so only the wakeup case takes the cost of a function
@@ -1799,7 +1819,7 @@ struct wait_for_commit
prevent a waiter from arriving just after releasing the lock.
*/
if (subsequent_commits_list)
- wakeup_subsequent_commits2(wakeup_error);
+ wakeup_subsequent_commits2(wakeup_error_arg);
}
void unregister_wait_for_prior_commit()
{
@@ -2022,6 +2042,9 @@ public:
*/
const char *where;
+ /* Needed by MariaDB semi sync replication */
+ Trans_binlog_info *semisync_info;
+
ulong client_capabilities; /* What the client supports */
ulong max_client_packet_length;
@@ -2090,11 +2113,11 @@ public:
/* Do not set socket timeouts for wait_timeout (used with threadpool) */
bool skip_wait_timeout;
- /* container for handler's private per-connection data */
- Ha_data ha_data[MAX_HA];
-
bool prepare_derived_at_open;
+ /* Set to 1 if status of this THD is already in global status */
+ bool status_in_global;
+
/*
To signal that the tmp table to be created is created for materialized
derived table or a view.
@@ -2103,6 +2126,9 @@ public:
bool save_prep_leaf_list;
+ /* container for handler's private per-connection data */
+ Ha_data ha_data[MAX_HA];
+
#ifndef MYSQL_CLIENT
binlog_cache_mngr * binlog_setup_trx_data();
@@ -2114,14 +2140,12 @@ public:
int binlog_write_table_map(TABLE *table, bool is_transactional,
my_bool *with_annotate= 0);
int binlog_write_row(TABLE* table, bool is_transactional,
- MY_BITMAP const* cols, size_t colcnt,
const uchar *buf);
int binlog_delete_row(TABLE* table, bool is_transactional,
- MY_BITMAP const* cols, size_t colcnt,
const uchar *buf);
int binlog_update_row(TABLE* table, bool is_transactional,
- MY_BITMAP const* cols, size_t colcnt,
const uchar *old_data, const uchar *new_data);
+ static void binlog_prepare_row_images(TABLE* table);
void set_server_id(uint32 sid) { variables.server_id = sid; }
@@ -2130,11 +2154,9 @@ public:
*/
template <class RowsEventT> Rows_log_event*
binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id,
- MY_BITMAP const* cols,
- size_t colcnt,
size_t needed,
bool is_transactional,
- RowsEventT* hint);
+ RowsEventT* hint);
Rows_log_event* binlog_get_pending_rows_event(bool is_transactional) const;
void binlog_set_pending_rows_event(Rows_log_event* ev, bool is_transactional);
inline int binlog_flush_pending_rows_event(bool stmt_end)
@@ -2608,6 +2630,7 @@ public:
ulong query_plan_fsort_passes;
pthread_t real_id; /* For debugging */
my_thread_id thread_id;
+ pid_t os_thread_id;
uint tmp_table, global_disable_checkpoint;
uint server_status,open_options;
enum enum_thread_type system_thread;
@@ -3375,7 +3398,7 @@ public:
{
int err= killed_errno();
if (err)
- my_message(err, ER(err), MYF(0));
+ my_message(err, ER_THD(this, err), MYF(0));
}
/* return TRUE if we will abort query if we make a warning now */
inline bool really_abort_on_warning()
@@ -3816,6 +3839,8 @@ public:
{
mysql_mutex_lock(&LOCK_status);
add_to_status(&global_status_var, &status_var);
+ /* Mark that this THD status has already been added in global status */
+ status_in_global= 1;
mysql_mutex_unlock(&LOCK_status);
}
@@ -4024,11 +4049,14 @@ my_eof(THD *thd)
thd->get_stmt_da()->set_eof_status(thd);
}
-#define tmp_disable_binlog(A) \
+#define tmp_disable_binlog(A) \
{ulonglong tmp_disable_binlog__save_options= (A)->variables.option_bits; \
- (A)->variables.option_bits&= ~OPTION_BIN_LOG
+ (A)->variables.option_bits&= ~OPTION_BIN_LOG; \
+ (A)->variables.sql_log_bin_off= 1;
-#define reenable_binlog(A) (A)->variables.option_bits= tmp_disable_binlog__save_options;}
+#define reenable_binlog(A) \
+ (A)->variables.option_bits= tmp_disable_binlog__save_options; \
+ (A)->variables.sql_log_bin_off= 0;}
inline sql_mode_t sql_mode_for_dates(THD *thd)
@@ -4068,6 +4096,8 @@ class JOIN;
class select_result_sink: public Sql_alloc
{
public:
+ THD *thd;
+ select_result_sink(THD *thd_arg): thd(thd_arg) {}
/*
send_data returns 0 on ok, 1 on error and -1 if data was ignored, for
example for a duplicate row entry written to a temp table.
@@ -4092,7 +4122,6 @@ public:
class select_result :public select_result_sink
{
protected:
- THD *thd;
/*
All descendant classes have their send_data() skip the first
unit->offset_limit_cnt rows sent. Select_materialize
@@ -4101,7 +4130,7 @@ protected:
SELECT_LEX_UNIT *unit;
/* Something used only by the parser: */
public:
- select_result(THD *thd_arg): thd(thd_arg) {}
+ select_result(THD *thd_arg): select_result_sink(thd_arg) {}
virtual ~select_result() {};
/**
Change wrapped select_result.
@@ -4188,9 +4217,8 @@ class select_result_explain_buffer : public select_result_sink
{
public:
select_result_explain_buffer(THD *thd_arg, TABLE *table_arg) :
- thd(thd_arg), dst_table(table_arg) {};
+ select_result_sink(thd_arg), dst_table(table_arg) {};
- THD *thd;
TABLE *dst_table; /* table to write into */
/* The following is called in the child thread: */
@@ -4207,7 +4235,7 @@ public:
class select_result_text_buffer : public select_result_sink
{
public:
- select_result_text_buffer(THD *thd_arg) : thd(thd_arg) {}
+ select_result_text_buffer(THD *thd_arg): select_result_sink(thd_arg) {}
int send_data(List<Item> &items);
bool send_result_set_metadata(List<Item> &fields, uint flag);
@@ -4215,7 +4243,6 @@ public:
private:
int append_row(List<Item> &items, bool send_names);
- THD *thd;
List<char*> rows;
int n_columns;
};
@@ -4372,6 +4399,8 @@ class select_insert :public select_result_interceptor {
virtual int send_data(List<Item> &items);
virtual void store_values(List<Item> &values);
virtual bool can_rollback_data() { return 0; }
+ bool prepare_eof();
+ bool send_ok_packet();
bool send_eof();
virtual void abort_result_set();
/* not implemented: select_insert is never re-used in prepared statements */
@@ -4615,9 +4644,10 @@ private:
public:
/* Number of rows in the union */
ha_rows send_records;
- select_union_direct(THD *thd_arg, select_result *result,
- SELECT_LEX *last_select_lex):
- select_union(thd_arg), result(result), last_select_lex(last_select_lex),
+ select_union_direct(THD *thd_arg, select_result *result_arg,
+ SELECT_LEX *last_select_lex_arg):
+ select_union(thd_arg), result(result_arg),
+ last_select_lex(last_select_lex_arg),
done_send_result_set_metadata(false), done_initialize_tables(false),
limit_found_rows(0)
{ send_records= 0; }
@@ -5294,7 +5324,7 @@ inline bool add_item_to_list(THD *thd, Item *item)
inline bool add_value_to_list(THD *thd, Item *value)
{
- return thd->lex->value_list.push_back(value);
+ return thd->lex->value_list.push_back(value, thd->mem_root);
}
inline bool add_order_to_list(THD *thd, Item *item, bool asc)
@@ -5312,6 +5342,13 @@ inline bool add_group_to_list(THD *thd, Item *item, bool asc)
return thd->lex->current_select->add_group_to_list(thd, item, asc);
}
+inline Item *and_conds(THD *thd, Item *a, Item *b)
+{
+ if (!b) return a;
+ if (!a) return b;
+ return new (thd->mem_root) Item_cond_and(thd, a, b);
+}
+
/* inline handler methods that need to know TABLE and THD structures */
inline void handler::increment_statistics(ulong SSV::*offset) const
{
diff --git a/sql/sql_cmd.h b/sql/sql_cmd.h
index dcc0b3303d8..904578134b4 100644
--- a/sql/sql_cmd.h
+++ b/sql/sql_cmd.h
@@ -96,7 +96,7 @@ enum enum_sql_command {
/*
When a command is added here, be sure it's also added in mysqld.cc
- in "struct show_var_st status_vars[]= {" ...
+ in "struct show_var_st com_status_vars[]= {" ...
*/
/* This should be the last !!! */
SQLCOM_END
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index 94dcfedcf02..f6e37f07e60 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -1080,7 +1080,7 @@ bool setup_connection_thread_globals(THD *thd)
bool login_connection(THD *thd)
{
NET *net= &thd->net;
- int error;
+ int error= 0;
DBUG_ENTER("login_connection");
DBUG_PRINT("info", ("login_connection called by thread %lu",
thd->thread_id));
@@ -1099,7 +1099,8 @@ bool login_connection(THD *thd)
my_sleep(1000); /* must wait after eof() */
#endif
statistic_increment(aborted_connects,&LOCK_status);
- DBUG_RETURN(1);
+ error=1;
+ goto exit;
}
/* Connect completed, set read/write timeouts back to default */
my_net_set_read_timeout(net, thd->variables.net_read_timeout);
@@ -1109,10 +1110,13 @@ bool login_connection(THD *thd)
if (increment_connection_count(thd, TRUE))
{
my_error(ER_OUTOFMEMORY, MYF(0), 2*sizeof(USER_STATS));
- DBUG_RETURN(1);
+ error= 1;
+ goto exit;
}
- DBUG_RETURN(0);
+exit:
+ mysql_audit_notify_connection_connect(thd);
+ DBUG_RETURN(error);
}
@@ -1162,7 +1166,7 @@ void end_connection(THD *thd)
}
if (!thd->killed && (net->error && net->vio != 0))
- thd->print_aborted_warning(1, ER(ER_UNKNOWN_ERROR));
+ thd->print_aborted_warning(1, ER_THD(thd, ER_UNKNOWN_ERROR));
}
@@ -1264,7 +1268,6 @@ bool thd_prepare_connection(THD *thd)
bool rc;
lex_start(thd);
rc= login_connection(thd);
- mysql_audit_notify_connection_connect(thd);
if (rc)
return rc;
diff --git a/sql/sql_const.h b/sql/sql_const.h
index 18a74d8579e..c8bb442376e 100644
--- a/sql/sql_const.h
+++ b/sql/sql_const.h
@@ -111,7 +111,7 @@
#define MAX_FIELDS_BEFORE_HASH 32
#define USER_VARS_HASH_SIZE 16
#define TABLE_OPEN_CACHE_MIN 400
-#define TABLE_OPEN_CACHE_DEFAULT 400
+#define TABLE_OPEN_CACHE_DEFAULT 2000
#define TABLE_DEF_CACHE_DEFAULT 400
/**
We must have room for at least 400 table definitions in the table
diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc
index 27dea480025..a8c5569ba4a 100644
--- a/sql/sql_cursor.cc
+++ b/sql/sql_cursor.cc
@@ -54,6 +54,8 @@ public:
virtual void fetch(ulong num_rows);
virtual void close();
virtual ~Materialized_cursor();
+
+ void on_table_fill_finished();
};
@@ -74,6 +76,18 @@ public:
Select_materialize(THD *thd_arg, select_result *result_arg):
select_union(thd_arg), result(result_arg), materialized_cursor(0) {}
virtual bool send_result_set_metadata(List<Item> &list, uint flags);
+ bool send_eof()
+ {
+ if (materialized_cursor)
+ materialized_cursor->on_table_fill_finished();
+ return false;
+ }
+
+ void abort_result_set()
+ {
+ if (materialized_cursor)
+ materialized_cursor->on_table_fill_finished();
+ }
};
@@ -389,6 +403,29 @@ Materialized_cursor::~Materialized_cursor()
}
+/*
+ @brief
+ Perform actions that are to be done when cursor materialization has
+ finished.
+
+ @detail
+ This function is called when "OPEN $cursor" has finished filling the
+ temporary table with rows that the cursor will return.
+
+ Temporary table has table->field->orig_table pointing at the tables
+ that are used in the cursor definition query. Pointers to these tables
+ will not be valid after the query finishes. So, we do what is done for
+ regular tables: have orig_table point at the table that the fields belong
+ to.
+*/
+
+void Materialized_cursor::on_table_fill_finished()
+{
+ uint fields= table->s->fields;
+ for (uint i= 0; i < fields; i++)
+ table->field[i]->orig_table= table->field[i]->table;
+}
+
/***************************************************************************
Select_materialize
****************************************************************************/
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 475afa882f8..2ba67cb1b00 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -430,7 +430,7 @@ bool load_db_opt(THD *thd, const char *path, Schema_specification_st *create)
get_charset_by_name(pos+1, MYF(0))))
{
sql_print_error("Error while loading database options: '%s':",path);
- sql_print_error(ER(ER_UNKNOWN_CHARACTER_SET),pos+1);
+ sql_print_error(ER_THD(thd, ER_UNKNOWN_CHARACTER_SET),pos+1);
create->default_table_charset= default_charset_info;
}
}
@@ -440,7 +440,7 @@ bool load_db_opt(THD *thd, const char *path, Schema_specification_st *create)
MYF(0))))
{
sql_print_error("Error while loading database options: '%s':",path);
- sql_print_error(ER(ER_UNKNOWN_COLLATION),pos+1);
+ sql_print_error(ER_THD(thd, ER_UNKNOWN_COLLATION),pos+1);
create->default_table_charset= default_charset_info;
}
}
@@ -624,7 +624,8 @@ mysql_create_db_internal(THD *thd, char *db,
else if (options.if_not_exists())
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_DB_CREATE_EXISTS, ER(ER_DB_CREATE_EXISTS), db);
+ ER_DB_CREATE_EXISTS, ER_THD(thd, ER_DB_CREATE_EXISTS),
+ db);
affected_rows= 0;
goto not_silent;
}
@@ -852,7 +853,8 @@ mysql_rm_db_internal(THD *thd,char *db, bool if_exists, bool silent)
else
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_DB_DROP_EXISTS, ER(ER_DB_DROP_EXISTS), db);
+ ER_DB_DROP_EXISTS, ER_THD(thd, ER_DB_DROP_EXISTS),
+ db);
error= false;
goto update_binlog;
}
@@ -1460,7 +1462,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch)
}
else
{
- my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0));
+ my_message(ER_NO_DB_ERROR, ER_THD(thd, ER_NO_DB_ERROR), MYF(0));
DBUG_RETURN(TRUE);
}
@@ -1535,7 +1537,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch)
sctx->priv_user,
sctx->priv_host,
new_db_file_name.str);
- general_log_print(thd, COM_INIT_DB, ER(ER_DBACCESS_DENIED_ERROR),
+ general_log_print(thd, COM_INIT_DB, ER_THD(thd, ER_DBACCESS_DENIED_ERROR),
sctx->priv_user, sctx->priv_host, new_db_file_name.str);
my_free(new_db_file_name.str);
DBUG_RETURN(TRUE);
@@ -1551,7 +1553,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch)
/* Throw a warning and free new_db_file_name. */
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_BAD_DB_ERROR, ER(ER_BAD_DB_ERROR),
+ ER_BAD_DB_ERROR, ER_THD(thd, ER_BAD_DB_ERROR),
new_db_file_name.str);
my_free(new_db_file_name.str);
@@ -1719,7 +1721,7 @@ bool mysql_upgrade_db(THD *thd, LEX_STRING *old_db)
table_str.length= filename_to_tablename(file->name,
tname, sizeof(tname)-1);
- table_str.str= (char*) sql_memdup(tname, table_str.length + 1);
+ table_str.str= (char*) thd->memdup(tname, table_str.length + 1);
Table_ident *old_ident= new Table_ident(thd, *old_db, table_str, 0);
Table_ident *new_ident= new Table_ident(thd, new_db, table_str, 0);
if (!old_ident || !new_ident ||
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index e3610a8f919..8995684b8f6 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -159,7 +159,7 @@ void Update_plan::save_explain_data_intern(MEM_ROOT *mem_root,
explain->where_cond= select? select->cond: NULL;
if (using_filesort)
- explain->filesort_tracker= new (mem_root) Filesort_tracker;
+ explain->filesort_tracker= new (mem_root) Filesort_tracker(is_analyze);
explain->using_io_buffer= using_io_buffer;
append_possible_keys(mem_root, explain->possible_keys, table,
@@ -312,7 +312,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
if (safe_update && const_cond)
{
my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE,
- ER(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE), MYF(0));
+ ER_THD(thd, ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE), MYF(0));
DBUG_RETURN(TRUE);
}
@@ -370,6 +370,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
goto cleanup;
}
/* Handler didn't support fast delete; Delete rows one by one */
+ query_plan.cancel_delete_all_rows();
}
if (conds)
{
@@ -436,7 +437,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
delete select;
free_underlaid_joins(thd, select_lex);
my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE,
- ER(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE), MYF(0));
+ ER_THD(thd, ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE), MYF(0));
DBUG_RETURN(TRUE);
}
}
@@ -905,7 +906,7 @@ multi_delete::multi_delete(THD *thd_arg, TABLE_LIST *dt, uint num_of_tables_arg)
num_of_tables(num_of_tables_arg), error(0),
do_delete(0), transactional_tables(0), normal_tables(0), error_handled(0)
{
- tempfiles= (Unique **) sql_calloc(sizeof(Unique *) * num_of_tables);
+ tempfiles= (Unique **) thd_arg->calloc(sizeof(Unique *) * num_of_tables);
}
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 9dfabb3d2f8..67e7b6115a3 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -446,7 +446,7 @@ bool mysql_derived_merge(THD *thd, LEX *lex, TABLE_LIST *derived)
if (derived->get_unit()->prepared)
{
Item *expr= derived->on_expr;
- expr= and_conds(expr, dt_select->join ? dt_select->join->conds : 0);
+ expr= and_conds(thd, expr, dt_select->join ? dt_select->join->conds : 0);
if (expr && (derived->prep_on_expr || expr != derived->on_expr))
{
derived->on_expr= expr;
diff --git a/sql/sql_digest.cc b/sql/sql_digest.cc
index cdbfcbb2e89..7f6f3bbfe9b 100644
--- a/sql/sql_digest.cc
+++ b/sql/sql_digest.cc
@@ -224,6 +224,7 @@ void compute_digest_text(const sql_digest_storage* digest_storage,
/* All identifiers are printed with their name. */
case IDENT:
case IDENT_QUOTED:
+ case TOK_IDENT:
{
char *id_ptr= NULL;
int id_len= 0;
@@ -259,13 +260,10 @@ void compute_digest_text(const sql_digest_storage* digest_storage,
break;
}
/* Copy the converted identifier into the digest string. */
- if (tok == IDENT_QUOTED)
- digest_output->append("`", 1);
+ digest_output->append("`", 1);
if (id_length > 0)
digest_output->append(id_string, id_length);
- if (tok == IDENT_QUOTED)
- digest_output->append("`", 1);
- digest_output->append(" ", 1);
+ digest_output->append("` ", 2);
}
break;
@@ -575,6 +573,15 @@ sql_digest_state* digest_add_token(sql_digest_state *state,
char *yytext= lex_token->lex_str.str;
size_t yylen= lex_token->lex_str.length;
+ /*
+ REDUCE:
+ TOK_IDENT := IDENT | IDENT_QUOTED
+ The parser gives IDENT or IDENT_TOKEN for the same text,
+ depending on the character set used.
+ We unify both to always print the same digest text,
+ and always have the same digest hash.
+ */
+ token= TOK_IDENT;
/* Add this token and identifier string to digest storage. */
store_token_identifier(digest_storage, token, yylen, yytext);
diff --git a/sql/sql_error.cc b/sql/sql_error.cc
index 3e18b701031..47f24ad9cb8 100644
--- a/sql/sql_error.cc
+++ b/sql/sql_error.cc
@@ -814,23 +814,30 @@ const LEX_STRING warning_level_names[]=
bool mysqld_show_warnings(THD *thd, ulong levels_to_show)
{
List<Item> field_list;
- DBUG_ENTER("mysqld_show_warnings");
-
- DBUG_ASSERT(thd->get_stmt_da()->is_warning_info_read_only());
-
- field_list.push_back(new Item_empty_string("Level", 7));
- field_list.push_back(new Item_return_int("Code",4, MYSQL_TYPE_LONG));
- field_list.push_back(new Item_empty_string("Message",MYSQL_ERRMSG_SIZE));
-
- if (thd->protocol->send_result_set_metadata(&field_list,
- Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
- DBUG_RETURN(TRUE);
-
+ MEM_ROOT *mem_root= thd->mem_root;
const Sql_condition *err;
SELECT_LEX *sel= &thd->lex->select_lex;
SELECT_LEX_UNIT *unit= &thd->lex->unit;
ulonglong idx= 0;
Protocol *protocol=thd->protocol;
+ DBUG_ENTER("mysqld_show_warnings");
+
+ DBUG_ASSERT(thd->get_stmt_da()->is_warning_info_read_only());
+
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Level", 7),
+ mem_root);
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Code", 4, MYSQL_TYPE_LONG),
+ mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Message", MYSQL_ERRMSG_SIZE),
+ mem_root);
+
+ if (protocol->send_result_set_metadata(&field_list,
+ Protocol::SEND_NUM_ROWS |
+ Protocol::SEND_EOF))
+ DBUG_RETURN(TRUE);
unit->set_limit(sel);
diff --git a/sql/sql_error.h b/sql/sql_error.h
index 7308a574e1d..111495fa566 100644
--- a/sql/sql_error.h
+++ b/sql/sql_error.h
@@ -440,7 +440,7 @@ private:
ulonglong id() const { return m_warn_id; }
/** Set id of the warning information area. */
- void id(ulonglong id) { m_warn_id= id; }
+ void id(ulonglong id_arg) { m_warn_id= id_arg; }
/** Do we have any errors and warnings that we can *show*? */
bool is_empty() const { return m_warn_list.is_empty(); }
@@ -501,8 +501,8 @@ private:
- GET DIAGNOSTICS
@param read_only the read only property to set.
*/
- void set_read_only(bool read_only)
- { m_read_only= read_only; }
+ void set_read_only(bool read_only_arg)
+ { m_read_only= read_only_arg; }
/**
Read only status.
@@ -670,7 +670,7 @@ public:
/** True if status information is sent to the client. */
bool is_sent() const { return m_is_sent; }
- void set_is_sent(bool is_sent) { m_is_sent= is_sent; }
+ void set_is_sent(bool is_sent_arg) { m_is_sent= is_sent_arg; }
void set_ok_status(ulonglong affected_rows,
ulonglong last_insert_id,
@@ -793,8 +793,8 @@ public:
bool is_warning_info_read_only() const
{ return get_warning_info()->is_read_only(); }
- void set_warning_info_read_only(bool read_only)
- { get_warning_info()->set_read_only(read_only); }
+ void set_warning_info_read_only(bool read_only_arg)
+ { get_warning_info()->set_read_only(read_only_arg); }
ulong error_count() const
{ return get_warning_info()->error_count(); }
@@ -815,13 +815,14 @@ public:
{ return get_warning_info()->push_warning(thd, sql_condition); }
Sql_condition *push_warning(THD *thd,
- uint sql_errno,
+ uint sql_errno_arg,
const char* sqlstate,
Sql_condition::enum_warning_level level,
const char* msg)
{
return get_warning_info()->push_warning(thd,
- sql_errno, sqlstate, level, msg);
+ sql_errno_arg, sqlstate, level,
+ msg);
}
void mark_sql_conditions_for_removal()
diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc
index 92f221513f2..15ee67a0318 100644
--- a/sql/sql_explain.cc
+++ b/sql/sql_explain.cc
@@ -23,6 +23,7 @@
#include "sql_select.h"
#include "my_json_writer.h"
#include "opt_range.h"
+#include "sql_expression_cache.h"
const char * STR_DELETING_ALL_ROWS= "Deleting all rows";
const char * STR_IMPOSSIBLE_WHERE= "Impossible WHERE";
@@ -203,7 +204,8 @@ int Explain_query::print_explain(select_result_sink *output,
}
-void Explain_query::print_explain_json(select_result_sink *output, bool is_analyze)
+void Explain_query::print_explain_json(select_result_sink *output,
+ bool is_analyze)
{
Json_writer writer;
writer.start_object();
@@ -226,7 +228,9 @@ void Explain_query::print_explain_json(select_result_sink *output, bool is_analy
CHARSET_INFO *cs= system_charset_info;
List<Item> item_list;
String *buf= &writer.output;
- item_list.push_back(new Item_string(buf->ptr(), buf->length(), cs));
+ item_list.push_back(new (thd->mem_root)
+ Item_string(thd, buf->ptr(), buf->length(), cs),
+ thd->mem_root);
output->send_data(item_list);
}
@@ -256,19 +260,22 @@ bool Explain_query::print_explain_str(THD *thd, String *out_str,
}
-static void push_str(List<Item> *item_list, const char *str)
+static void push_str(THD *thd, List<Item> *item_list, const char *str)
{
- item_list->push_back(new Item_string_sys(str));
+ item_list->push_back(new (thd->mem_root) Item_string_sys(thd, str),
+ thd->mem_root);
}
-static void push_string(List<Item> *item_list, String *str)
+static void push_string(THD *thd, List<Item> *item_list, String *str)
{
- item_list->push_back(new Item_string_sys(str->ptr(), str->length()));
+ item_list->push_back(new (thd->mem_root)
+ Item_string_sys(thd, str->ptr(), str->length()),
+ thd->mem_root);
}
-static void push_string_list(List<Item> *item_list, String_list &lines,
- String *buf)
+static void push_string_list(THD *thd, List<Item> *item_list,
+ String_list &lines, String *buf)
{
List_iterator_fast<char> it(lines);
char *line;
@@ -282,7 +289,7 @@ static void push_string_list(List<Item> *item_list, String_list &lines,
buf->append(line);
}
- push_string(item_list, buf);
+ push_string(thd, item_list, buf);
}
@@ -315,79 +322,89 @@ int print_explain_row(select_result_sink *result,
double r_filtered,
const char *extra)
{
- Item *item_null= new Item_null();
+ THD *thd= result->thd;
+ MEM_ROOT *mem_root= thd->mem_root;
+ Item *item_null= new (mem_root) Item_null(thd);
List<Item> item_list;
Item *item;
- item_list.push_back(new Item_int((int32) select_number));
- item_list.push_back(new Item_string_sys(select_type));
- item_list.push_back(new Item_string_sys(table_name));
+ item_list.push_back(new (mem_root) Item_int(thd, (int32) select_number),
+ mem_root);
+ item_list.push_back(new (mem_root) Item_string_sys(thd, select_type),
+ mem_root);
+ item_list.push_back(new (mem_root) Item_string_sys(thd, table_name),
+ mem_root);
if (options & DESCRIBE_PARTITIONS)
{
if (partitions)
{
- item_list.push_back(new Item_string_sys(partitions));
+ item_list.push_back(new (mem_root) Item_string_sys(thd, partitions),
+ mem_root);
}
else
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
}
const char *jtype_str= join_type_str[jtype];
- item_list.push_back(new Item_string_sys(jtype_str));
+ item_list.push_back(new (mem_root) Item_string_sys(thd, jtype_str),
+ mem_root);
/* 'possible_keys' */
if (possible_keys && !possible_keys->is_empty())
{
StringBuffer<64> possible_keys_buf;
- push_string_list(&item_list, *possible_keys, &possible_keys_buf);
+ push_string_list(thd, &item_list, *possible_keys, &possible_keys_buf);
}
else
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
/* 'index */
- item= index ? new Item_string_sys(index) : item_null;
- item_list.push_back(item);
+ item= index ? new (mem_root) Item_string_sys(thd, index) : item_null;
+ item_list.push_back(item, mem_root);
/* 'key_len */
- item= key_len ? new Item_string_sys(key_len) : item_null;
- item_list.push_back(item);
+ item= key_len ? new (mem_root) Item_string_sys(thd, key_len) : item_null;
+ item_list.push_back(item, mem_root);
/* 'ref' */
- item= ref ? new Item_string_sys(ref) : item_null;
- item_list.push_back(item);
+ item= ref ? new (mem_root) Item_string_sys(thd, ref) : item_null;
+ item_list.push_back(item, mem_root);
/* 'rows' */
if (rows)
{
- item_list.push_back(new Item_int(*rows,
- MY_INT64_NUM_DECIMAL_DIGITS));
+ item_list.push_back(new (mem_root)
+ Item_int(thd, *rows, MY_INT64_NUM_DECIMAL_DIGITS),
+ mem_root);
}
else
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
/* 'r_rows' */
if (is_analyze)
{
if (r_rows)
- item_list.push_back(new Item_float(*r_rows, 2));
+ item_list.push_back(new (mem_root) Item_float(thd, *r_rows, 2),
+ mem_root);
else
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
}
/* 'filtered' */
const double filtered=100.0;
if (options & DESCRIBE_EXTENDED || is_analyze)
- item_list.push_back(new Item_float(filtered, 2));
+ item_list.push_back(new (mem_root) Item_float(thd, filtered, 2), mem_root);
/* 'r_filtered' */
if (is_analyze)
- item_list.push_back(new Item_float(r_filtered, 2));
+ item_list.push_back(new (mem_root) Item_float(thd, r_filtered, 2),
+ mem_root);
/* 'Extra' */
if (extra)
- item_list.push_back(new Item_string_sys(extra));
+ item_list.push_back(new (mem_root) Item_string_sys(thd, extra), mem_root);
else
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
if (result->send_data(item_list))
return 1;
@@ -430,7 +447,8 @@ int Explain_union::print_explain(Explain_query *query,
uint8 explain_flags,
bool is_analyze)
{
- //CHARSET_INFO *cs= system_charset_info;
+ THD *thd= output->thd;
+ MEM_ROOT *mem_root= thd->mem_root;
char table_name_buffer[SAFE_NAME_LEN];
/* print all UNION children, in order */
@@ -445,54 +463,56 @@ int Explain_union::print_explain(Explain_query *query,
/* Print a line with "UNION RESULT" */
List<Item> item_list;
- Item *item_null= new Item_null();
+ Item *item_null= new (mem_root) Item_null(thd);
/* `id` column */
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
/* `select_type` column */
- push_str(&item_list, fake_select_type);
+ push_str(thd, &item_list, fake_select_type);
/* `table` column: something like "<union1,2>" */
uint len= make_union_table_name(table_name_buffer);
- item_list.push_back(new Item_string_sys(table_name_buffer, len));
+ item_list.push_back(new (mem_root)
+ Item_string_sys(thd, table_name_buffer, len),
+ mem_root);
/* `partitions` column */
if (explain_flags & DESCRIBE_PARTITIONS)
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
/* `type` column */
- push_str(&item_list, join_type_str[JT_ALL]);
+ push_str(thd, &item_list, join_type_str[JT_ALL]);
/* `possible_keys` column */
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
/* `key` */
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
/* `key_len` */
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
/* `ref` */
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
/* `rows` */
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
/* `r_rows` */
if (is_analyze)
{
double avg_rows= fake_select_lex_tracker.get_avg_rows();
- item_list.push_back(new Item_float(avg_rows, 2));
+ item_list.push_back(new (mem_root) Item_float(thd, avg_rows, 2), mem_root);
}
/* `filtered` */
if (explain_flags & DESCRIBE_EXTENDED || is_analyze)
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
/* `r_filtered` */
if (is_analyze)
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
/* `Extra` */
StringBuffer<256> extra_buf;
@@ -500,7 +520,10 @@ int Explain_union::print_explain(Explain_query *query,
{
extra_buf.append(STRING_WITH_LEN("Using filesort"));
}
- item_list.push_back(new Item_string_sys(extra_buf.ptr(), extra_buf.length()));
+ item_list.push_back(new (mem_root)
+ Item_string_sys(thd, extra_buf.ptr(),
+ extra_buf.length()),
+ mem_root);
//output->unit.offset_limit_cnt= 0;
if (output->send_data(item_list))
@@ -520,6 +543,8 @@ void Explain_union::print_explain_json(Explain_query *query,
Json_writer_nesting_guard guard(writer);
char table_name_buffer[SAFE_NAME_LEN];
+ bool started_object= print_explain_json_cache(writer, is_analyze);
+
writer->add_member("query_block").start_object();
writer->add_member("union_result").start_object();
// using_temporary_table
@@ -560,6 +585,9 @@ void Explain_union::print_explain_json(Explain_query *query,
writer->end_object(); // union_result
writer->end_object(); // query_block
+
+ if (started_object)
+ writer->end_object();
}
@@ -640,6 +668,35 @@ void Explain_node::print_explain_json_for_children(Explain_query *query,
}
+bool Explain_node::print_explain_json_cache(Json_writer *writer,
+ bool is_analyze)
+{
+ if (cache_tracker)
+ {
+ cache_tracker->fetch_current_stats();
+ writer->add_member("expression_cache").start_object();
+ if (cache_tracker->state != Expression_cache_tracker::OK)
+ {
+ writer->add_member("state").
+ add_str(Expression_cache_tracker::state_str[cache_tracker->state]);
+ }
+
+ if (is_analyze)
+ {
+ longlong cache_reads= cache_tracker->hit + cache_tracker->miss;
+ writer->add_member("r_loops").add_ll(cache_reads);
+ if (cache_reads != 0)
+ {
+ double hit_ratio= double(cache_tracker->hit) / cache_reads * 100.0;
+ writer->add_member("r_hit_ratio").add_double(hit_ratio);
+ }
+ }
+ return true;
+ }
+ return false;
+}
+
+
void Explain_select::replace_table(uint idx, Explain_table_access *new_tab)
{
delete join_tabs[idx];
@@ -661,38 +718,72 @@ int Explain_select::print_explain(Explain_query *query,
select_result_sink *output,
uint8 explain_flags, bool is_analyze)
{
+ THD *thd= output->thd;
+ MEM_ROOT *mem_root= thd->mem_root;
+
if (message)
{
List<Item> item_list;
- Item *item_null= new Item_null();
+ Item *item_null= new (mem_root) Item_null(thd);
- item_list.push_back(new Item_int((int32) select_id));
- item_list.push_back(new Item_string_sys(select_type));
+ item_list.push_back(new (mem_root) Item_int(thd, (int32) select_id),
+ mem_root);
+ item_list.push_back(new (mem_root) Item_string_sys(thd, select_type),
+ mem_root);
for (uint i=0 ; i < 7; i++)
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
if (explain_flags & DESCRIBE_PARTITIONS)
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
/* filtered */
if (is_analyze || explain_flags & DESCRIBE_EXTENDED)
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
if (is_analyze)
{
/* r_rows, r_filtered */
- item_list.push_back(item_null);
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
+ item_list.push_back(item_null, mem_root);
}
- item_list.push_back(new Item_string_sys(message));
+ item_list.push_back(new (mem_root) Item_string_sys(thd, message),
+ mem_root);
if (output->send_data(item_list))
return 1;
}
else
{
- bool using_tmp= using_temporary;
- bool using_fs= using_filesort;
+ bool using_tmp;
+ bool using_fs;
+
+ if (is_analyze)
+ {
+ /*
+ Get the data about "Using temporary; Using filesort" from execution
+ tracking system.
+ */
+ using_tmp= false;
+ using_fs= false;
+ Sort_and_group_tracker::Iterator iter(&ops_tracker);
+ enum_qep_action action;
+ Filesort_tracker *dummy;
+
+ while ((action= iter.get_next(&dummy)) != EXPL_ACTION_EOF)
+ {
+ if (action == EXPL_ACTION_FILESORT)
+ using_fs= true;
+ else if (action == EXPL_ACTION_TEMPTABLE)
+ using_tmp= true;
+ }
+ }
+ else
+ {
+ /* Use imprecise "estimates" we got with the query plan */
+ using_tmp= using_temporary;
+ using_fs= using_filesort;
+ }
+
for (uint i=0; i< n_join_tabs; i++)
{
join_tabs[i]->print_explain(output, explain_flags, is_analyze, select_id,
@@ -740,6 +831,8 @@ void Explain_select::print_explain_json(Explain_query *query,
Json_writer *writer, bool is_analyze)
{
Json_writer_nesting_guard guard(writer);
+
+ bool started_cache= print_explain_json_cache(writer, is_analyze);
if (message)
{
@@ -757,12 +850,13 @@ void Explain_select::print_explain_json(Explain_query *query,
{
writer->add_member("query_block").start_object();
writer->add_member("select_id").add_ll(select_id);
-
+
if (is_analyze && time_tracker.get_loops())
{
writer->add_member("r_loops").add_ll(time_tracker.get_loops());
writer->add_member("r_total_time_ms").add_double(time_tracker.get_time_ms());
}
+
if (exec_const_cond)
{
writer->add_member("const_condition");
@@ -770,47 +864,62 @@ void Explain_select::print_explain_json(Explain_query *query,
}
Filesort_tracker *first_table_sort= NULL;
+ bool first_table_sort_used= false;
int started_objects= 0;
if (is_analyze)
{
/* ANALYZE has collected this part of query plan independently */
- for (int i= ops_tracker.n_actions-1; i >= 0; i--)
+ if (ops_tracker.had_varied_executions())
+ {
+ writer->add_member("varied-sort-and-tmp").start_object();
+ started_objects++;
+ }
+ else
{
- if (ops_tracker.qep_actions[i] == EXPL_ACTION_FILESORT)
+ Sort_and_group_tracker::Iterator iter(&ops_tracker);
+ enum_qep_action action;
+ Filesort_tracker *fs_tracker;
+
+ while ((action= iter.get_next(&fs_tracker)) != EXPL_ACTION_EOF)
{
- if (i == 0)
+ if (action == EXPL_ACTION_FILESORT)
{
- /* filesort operation was the first in the pipeline */
- first_table_sort= &ops_tracker.filesort_tracker[0];
- break;
+ if (iter.is_last_element())
+ {
+ first_table_sort= fs_tracker;
+ break;
+ }
+ writer->add_member("filesort").start_object();
+ started_objects++;
+ fs_tracker->print_json_members(writer);
+ }
+ else if (action == EXPL_ACTION_TEMPTABLE)
+ {
+ writer->add_member("temporary_table").start_object();
+ started_objects++;
+ /*
+ if (tmp == EXPL_TMP_TABLE_BUFFER)
+ func= "buffer";
+ else if (tmp == EXPL_TMP_TABLE_GROUP)
+ func= "group-by";
+ else
+ func= "distinct";
+ writer->add_member("function").add_str(func);
+ */
+ }
+ else if (action == EXPL_ACTION_REMOVE_DUPS)
+ {
+ writer->add_member("duplicate_removal").start_object();
+ started_objects++;
}
- writer->add_member("filesort").start_object();
- started_objects++;
- }
- else if (ops_tracker.qep_actions[i] == EXPL_ACTION_TEMPTABLE)
- {
- writer->add_member("temporary_table").start_object();
- started_objects++;
- /*
- if (tmp == EXPL_TMP_TABLE_BUFFER)
- func= "buffer";
- else if (tmp == EXPL_TMP_TABLE_GROUP)
- func= "group-by";
else
- func= "distinct";
- writer->add_member("function").add_str(func);
- */
+ DBUG_ASSERT(0);
}
- else if (ops_tracker.qep_actions[i] == EXPL_ACTION_REMOVE_DUPS)
- {
- writer->add_member("duplicate_removal").start_object();
- started_objects++;
- }
- else
- DBUG_ASSERT(0);
}
+ if (first_table_sort)
+ first_table_sort_used= true;
}
else
{
@@ -828,13 +937,15 @@ void Explain_select::print_explain_json(Explain_query *query,
}
else
{
+ fprintf(stderr, "Weird!\n");
if (using_filesort)
- first_table_sort= &ops_tracker.filesort_tracker[0];
+ first_table_sort_used= true;
}
}
-
+
Explain_basic_join::print_explain_json_interns(query, writer, is_analyze,
- first_table_sort);
+ first_table_sort,
+ first_table_sort_used);
for (;started_objects; started_objects--)
writer->end_object();
@@ -842,6 +953,8 @@ void Explain_select::print_explain_json(Explain_query *query,
writer->end_object();
}
+ if (started_cache)
+ writer->end_object();
}
@@ -852,7 +965,7 @@ void Explain_basic_join::print_explain_json(Explain_query *query,
writer->add_member("query_block").start_object();
writer->add_member("select_id").add_ll(select_id);
- print_explain_json_interns(query, writer, is_analyze, NULL);
+ print_explain_json_interns(query, writer, is_analyze, NULL, false);
writer->end_object();
}
@@ -862,7 +975,8 @@ void Explain_basic_join::
print_explain_json_interns(Explain_query *query,
Json_writer *writer,
bool is_analyze,
- Filesort_tracker *first_table_sort)
+ Filesort_tracker *first_table_sort,
+ bool first_table_sort_used)
{
Json_writer_nesting_guard guard(writer);
for (uint i=0; i< n_join_tabs; i++)
@@ -871,7 +985,11 @@ print_explain_json_interns(Explain_query *query,
writer->add_member("duplicates_removal").start_object();
join_tabs[i]->print_explain_json(query, writer, is_analyze,
- (i==0)? first_table_sort : NULL);
+ first_table_sort,
+ first_table_sort_used);
+
+ first_table_sort= NULL;
+ first_table_sort_used= false;
if (join_tabs[i]->end_dups_weedout)
writer->end_object();
@@ -1016,58 +1134,60 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
uint select_id, const char *select_type,
bool using_temporary, bool using_filesort)
{
- //CHARSET_INFO *cs= system_charset_info;
+ THD *thd= output->thd;
+ MEM_ROOT *mem_root= thd->mem_root;
List<Item> item_list;
- Item *item_null= new Item_null();
+ Item *item_null= new (mem_root) Item_null(thd);
/* `id` column */
- item_list.push_back(new Item_int((int32) select_id));
+ item_list.push_back(new (mem_root) Item_int(thd, (int32) select_id),
+ mem_root);
/* `select_type` column */
- push_str(&item_list, select_type);
+ push_str(thd, &item_list, select_type);
/* `table` column */
- push_string(&item_list, &table_name);
+ push_string(thd, &item_list, &table_name);
/* `partitions` column */
if (explain_flags & DESCRIBE_PARTITIONS)
{
if (used_partitions_set)
{
- push_string(&item_list, &used_partitions);
+ push_string(thd, &item_list, &used_partitions);
}
else
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
}
/* `type` column */
- push_str(&item_list, join_type_str[type]);
+ push_str(thd, &item_list, join_type_str[type]);
/* `possible_keys` column */
StringBuffer<64> possible_keys_buf;
if (possible_keys.is_empty())
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
else
- push_string_list(&item_list, possible_keys, &possible_keys_buf);
+ push_string_list(thd, &item_list, possible_keys, &possible_keys_buf);
/* `key` */
StringBuffer<64> key_str;
fill_key_str(&key_str, false);
if (key_str.length() > 0)
- push_string(&item_list, &key_str);
+ push_string(thd, &item_list, &key_str);
else
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
/* `key_len` */
StringBuffer<64> key_len_str;
fill_key_len_str(&key_len_str);
if (key_len_str.length() > 0)
- push_string(&item_list, &key_len_str);
+ push_string(thd, &item_list, &key_len_str);
else
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
/* `ref` */
StringBuffer<64> ref_list_buf;
@@ -1076,34 +1196,37 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
if (type == JT_FT)
{
/* Traditionally, EXPLAIN lines with type=fulltext have ref='' */
- push_str(&item_list, "");
+ push_str(thd, &item_list, "");
}
else
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
}
else
- push_string_list(&item_list, ref_list, &ref_list_buf);
+ push_string_list(thd, &item_list, ref_list, &ref_list_buf);
/* `rows` */
if (rows_set)
{
- item_list.push_back(new Item_int((longlong) (ulonglong) rows,
- MY_INT64_NUM_DECIMAL_DIGITS));
+ item_list.push_back(new (mem_root)
+ Item_int(thd, (longlong) (ulonglong) rows,
+ MY_INT64_NUM_DECIMAL_DIGITS),
+ mem_root);
}
else
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
/* `r_rows` */
if (is_analyze)
{
if (!tracker.has_scans())
{
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
}
else
{
double avg_rows= tracker.get_avg_rows();
- item_list.push_back(new Item_float(avg_rows, 2));
+ item_list.push_back(new (mem_root) Item_float(thd, avg_rows, 2),
+ mem_root);
}
}
@@ -1112,10 +1235,11 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
{
if (filtered_set)
{
- item_list.push_back(new Item_float(filtered, 2));
+ item_list.push_back(new (mem_root) Item_float(thd, filtered, 2),
+ mem_root);
}
else
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
}
/* `r_filtered` */
@@ -1123,14 +1247,16 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
{
if (!tracker.has_scans())
{
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
}
else
{
double r_filtered= tracker.get_filtered_after_where();
if (bka_type.is_using_jbuf())
r_filtered *= jbuf_tracker.get_filtered_after_where();
- item_list.push_back(new Item_float(r_filtered*100.0, 2));
+ item_list.push_back(new (mem_root)
+ Item_float(thd, r_filtered * 100.0, 2),
+ mem_root);
}
}
@@ -1164,7 +1290,10 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
extra_buf.append(STRING_WITH_LEN("Using filesort"));
}
- item_list.push_back(new Item_string_sys(extra_buf.ptr(), extra_buf.length()));
+ item_list.push_back(new (mem_root)
+ Item_string_sys(thd, extra_buf.ptr(),
+ extra_buf.length()),
+ mem_root);
if (output->send_data(item_list))
return 1;
@@ -1314,11 +1443,12 @@ void add_json_keyset(Json_writer *writer, const char *elem_name,
void Explain_table_access::print_explain_json(Explain_query *query,
Json_writer *writer,
bool is_analyze,
- Filesort_tracker *fs_tracker)
+ Filesort_tracker *fs_tracker,
+ bool first_table_sort_used)
{
Json_writer_nesting_guard guard(writer);
- if (fs_tracker)
+ if (first_table_sort_used)
{
/* filesort was invoked on this join tab before doing the join with the rest */
writer->add_member("read_sorted_file").start_object();
@@ -1346,7 +1476,7 @@ void Explain_table_access::print_explain_json(Explain_query *query,
}
writer->add_member("filesort").start_object();
if (is_analyze)
- fs_tracker->print_json(writer);
+ fs_tracker->print_json_members(writer);
}
if (bka_type.is_using_jbuf())
@@ -1537,7 +1667,7 @@ void Explain_table_access::print_explain_json(Explain_query *query,
writer->end_object();
}
- if (fs_tracker)
+ if (first_table_sort_used)
{
writer->end_object(); // filesort
writer->end_object(); // read_sorted_file
@@ -1976,7 +2106,7 @@ void Explain_update::print_explain_json(Explain_query *query,
{
writer->add_member("filesort").start_object();
if (is_analyze)
- filesort_tracker->print_json(writer);
+ filesort_tracker->print_json_members(writer);
doing_buffering= true;
}
diff --git a/sql/sql_explain.h b/sql/sql_explain.h
index 61720ca8d76..f92a57627d5 100644
--- a/sql/sql_explain.h
+++ b/sql/sql_explain.h
@@ -84,9 +84,10 @@ class Explain_query;
class Explain_node : public Sql_alloc
{
public:
- Explain_node(MEM_ROOT *root) :
- connection_type(EXPLAIN_NODE_OTHER),
- children(root)
+ Explain_node(MEM_ROOT *root) :
+ cache_tracker(NULL),
+ connection_type(EXPLAIN_NODE_OTHER),
+ children(root)
{}
/* A type specifying what kind of node this is */
enum explain_node_type
@@ -106,10 +107,14 @@ public:
EXPLAIN_NODE_NON_MERGED_SJ /* aka JTBM semi-join */
};
-
virtual enum explain_node_type get_type()= 0;
virtual int get_select_id()= 0;
+ /**
+ expression cache statistics
+ */
+ Expression_cache_tracker* cache_tracker;
+
/*
How this node is connected to its parent.
(NOTE: EXPLAIN_NODE_NON_MERGED_SJ is set very late currently)
@@ -135,6 +140,7 @@ public:
uint8 explain_flags, bool is_analyze);
void print_explain_json_for_children(Explain_query *query,
Json_writer *writer, bool is_analyze);
+ bool print_explain_json_cache(Json_writer *writer, bool is_analyze);
virtual ~Explain_node(){}
};
@@ -171,7 +177,8 @@ public:
void print_explain_json_interns(Explain_query *query, Json_writer *writer,
bool is_analyze,
- Filesort_tracker *first_table_sort);
+ Filesort_tracker *first_table_sort,
+ bool first_table_sort_used);
/* A flat array of Explain structs for tables. */
Explain_table_access** join_tabs;
@@ -203,7 +210,8 @@ public:
Explain_basic_join(root),
message(NULL),
using_temporary(false), using_filesort(false),
- time_tracker(is_analyze)
+ time_tracker(is_analyze),
+ ops_tracker(is_analyze)
{}
/*
@@ -220,7 +228,7 @@ public:
members have no info
*/
const char *message;
-
+
/* Expensive constant condition */
Item *exec_const_cond;
@@ -704,7 +712,9 @@ public:
uint select_id, const char *select_type,
bool using_temporary, bool using_filesort);
void print_explain_json(Explain_query *query, Json_writer *writer,
- bool is_analyze, Filesort_tracker *fs_tracker);
+ bool is_analyze,
+ Filesort_tracker *fs_tracker,
+ bool first_table_sort_used);
private:
void append_tag_name(String *str, enum explain_extra_tag tag);
@@ -720,6 +730,8 @@ private:
This is similar to Explain_table_access, except that it is more restrictive.
Also, it can have UPDATE operation options, but currently there aren't any.
+
+ Explain_delete inherits from this.
*/
class Explain_update : public Explain_node
diff --git a/sql/sql_expression_cache.cc b/sql/sql_expression_cache.cc
index 824d21eea20..3ed33d97094 100644
--- a/sql/sql_expression_cache.cc
+++ b/sql/sql_expression_cache.cc
@@ -43,7 +43,7 @@ ulong subquery_cache_miss, subquery_cache_hit;
Expression_cache_tmptable::Expression_cache_tmptable(THD *thd,
List<Item> &dependants,
Item *value)
- :cache_table(NULL), table_thd(thd), items(dependants), val(value),
+ :cache_table(NULL), table_thd(thd), tracker(NULL), items(dependants), val(value),
hit(0), miss(0), inited (0)
{
DBUG_ENTER("Expression_cache_tmptable::Expression_cache_tmptable");
@@ -61,6 +61,9 @@ void Expression_cache_tmptable::disable_cache()
cache_table->file->ha_index_end();
free_tmp_table(table_thd, cache_table);
cache_table= NULL;
+ update_tracker();
+ if (tracker)
+ tracker->cache= NULL;
}
@@ -158,12 +161,14 @@ void Expression_cache_tmptable::init()
goto error;
}
- if (!(cached_result= new Item_field(cache_table->field[0])))
+ if (!(cached_result= new (table_thd->mem_root)
+ Item_field(table_thd, cache_table->field[0])))
{
DBUG_PRINT("error", ("Creating Item_field failed"));
goto error;
}
+ update_tracker();
DBUG_VOID_RETURN;
error:
@@ -180,6 +185,11 @@ Expression_cache_tmptable::~Expression_cache_tmptable()
if (cache_table)
disable_cache();
+ else
+ {
+ update_tracker();
+ tracker= NULL;
+ }
}
@@ -323,3 +333,7 @@ void Expression_cache_tmptable::print(String *str, enum_query_type query_type)
}
str->append('>');
}
+
+
+const char *Expression_cache_tracker::state_str[3]=
+{"uninitialized", "disabled", "enabled"};
diff --git a/sql/sql_expression_cache.h b/sql/sql_expression_cache.h
index 48a8e33a787..87be6ddb4f4 100644
--- a/sql/sql_expression_cache.h
+++ b/sql/sql_expression_cache.h
@@ -19,6 +19,7 @@
#include "sql_select.h"
+
/**
Interface for expression cache
@@ -62,6 +63,11 @@ public:
Initialize this cache
*/
virtual void init()= 0;
+
+ /**
+ Save this object's statistics into Expression_cache_tracker object
+ */
+ virtual void update_tracker()= 0;
};
struct st_table_ref;
@@ -69,6 +75,30 @@ struct st_join_table;
class Item_field;
+class Expression_cache_tracker :public Sql_alloc
+{
+public:
+ enum expr_cache_state {UNINITED, STOPPED, OK};
+ Expression_cache_tracker(Expression_cache *c) :
+ cache(c), hit(0), miss(0), state(UNINITED)
+ {}
+
+ Expression_cache *cache;
+ ulong hit, miss;
+ enum expr_cache_state state;
+
+ static const char* state_str[3];
+ void set(ulong h, ulong m, enum expr_cache_state s)
+ {hit= h; miss= m; state= s;}
+
+ void fetch_current_stats()
+ {
+ if (cache)
+ cache->update_tracker();
+ }
+};
+
+
/**
Implementation of expression cache over a temporary table
*/
@@ -85,6 +115,22 @@ public:
bool is_inited() { return inited; };
void init();
+ void set_tracker(Expression_cache_tracker *st)
+ {
+ tracker= st;
+ update_tracker();
+ }
+ virtual void update_tracker()
+ {
+ if (tracker)
+ {
+ tracker->set(hit, miss, (inited ? (cache_table ?
+ Expression_cache_tracker::OK :
+ Expression_cache_tracker::STOPPED) :
+ Expression_cache_tracker::UNINITED));
+ }
+ }
+
private:
void disable_cache();
@@ -94,6 +140,8 @@ private:
TABLE *cache_table;
/* Thread handle for the temporary table */
THD *table_thd;
+ /* EXPALIN/ANALYZE statistics */
+ Expression_cache_tracker *tracker;
/* TABLE_REF for index lookup */
struct st_table_ref ref;
/* Cached result */
@@ -103,7 +151,7 @@ private:
/* Value Item example */
Item *val;
/* hit/miss counters */
- uint hit, miss;
+ ulong hit, miss;
/* Set on if the object has been succesfully initialized with init() */
bool inited;
};
diff --git a/sql/sql_get_diagnostics.cc b/sql/sql_get_diagnostics.cc
index 8b0d86aa7d1..1713cb04ebc 100644
--- a/sql/sql_get_diagnostics.cc
+++ b/sql/sql_get_diagnostics.cc
@@ -174,7 +174,7 @@ Statement_information_item::get_value(THD *thd, const Diagnostics_area *da)
case NUMBER:
{
ulong count= da->cond_count();
- value= new (thd->mem_root) Item_uint(count);
+ value= new (thd->mem_root) Item_uint(thd, count);
break;
}
/*
@@ -183,7 +183,7 @@ Statement_information_item::get_value(THD *thd, const Diagnostics_area *da)
REPLACE, LOAD).
*/
case ROW_COUNT:
- value= new (thd->mem_root) Item_int(thd->get_row_count_func());
+ value= new (thd->mem_root) Item_int(thd, thd->get_row_count_func());
break;
}
@@ -270,7 +270,7 @@ Condition_information_item::make_utf8_string_item(THD *thd, const String *str)
String tmp(str->ptr(), str->length(), from_cs);
/* If necessary, convert the string (ignoring errors), then copy it over. */
uint conv_errors;
- return new Item_string(&tmp, to_cs, &conv_errors,
+ return new (thd->mem_root) Item_string(thd, &tmp, to_cs, &conv_errors,
DERIVATION_COERCIBLE, MY_REPERTOIRE_UNICODE30);
}
@@ -329,7 +329,7 @@ Condition_information_item::get_value(THD *thd, const Sql_condition *cond)
value= make_utf8_string_item(thd, &(cond->m_message_text));
break;
case MYSQL_ERRNO:
- value= new (thd->mem_root) Item_uint(cond->m_sql_errno);
+ value= new (thd->mem_root) Item_uint(thd, cond->m_sql_errno);
break;
case RETURNED_SQLSTATE:
str.set_ascii(cond->get_sqlstate(), strlen(cond->get_sqlstate()));
diff --git a/sql/sql_help.cc b/sql/sql_help.cc
index afeb9395a55..a0e836da203 100644
--- a/sql/sql_help.cc
+++ b/sql/sql_help.cc
@@ -93,7 +93,7 @@ static bool init_fields(THD *thd, TABLE_LIST *tables,
for (; count-- ; find_fields++)
{
/* We have to use 'new' here as field will be re_linked on free */
- Item_field *field= new Item_field(context,
+ Item_field *field= new (thd->mem_root) Item_field(thd, context,
"mysql", find_fields->table_name,
find_fields->field_name);
if (!(find_fields->field= find_field_in_tables(thd, field, tables, NULL,
@@ -151,10 +151,10 @@ void memorize_variant_topic(THD *thd, TABLE *topics, int count,
else
{
if (count == 1)
- names->push_back(name);
+ names->push_back(name, thd->mem_root);
String *new_name= new (thd->mem_root) String;
get_field(mem_root,find_fields[help_topic_name].field,new_name);
- names->push_back(new_name);
+ names->push_back(new_name, thd->mem_root);
}
DBUG_VOID_RETURN;
}
@@ -297,7 +297,7 @@ int get_topics_for_keyword(THD *thd, TABLE *topics, TABLE *relations,
find_type(primary_key_name, &relations->s->keynames,
FIND_TYPE_NO_PREFIX) - 1) < 0)
{
- my_message(ER_CORRUPT_HELP_DB, ER(ER_CORRUPT_HELP_DB), MYF(0));
+ my_message(ER_CORRUPT_HELP_DB, ER_THD(thd, ER_CORRUPT_HELP_DB), MYF(0));
DBUG_RETURN(-1);
}
rtopic_id= find_fields[help_relation_help_topic_id].field;
@@ -308,7 +308,7 @@ int get_topics_for_keyword(THD *thd, TABLE *topics, TABLE *relations,
{
if (topics->file->inited)
topics->file->ha_index_end();
- my_message(ER_CORRUPT_HELP_DB, ER(ER_CORRUPT_HELP_DB), MYF(0));
+ my_message(ER_CORRUPT_HELP_DB, ER_THD(thd, ER_CORRUPT_HELP_DB), MYF(0));
DBUG_RETURN(-1);
}
@@ -380,7 +380,7 @@ int search_categories(THD *thd, TABLE *categories,
get_field(thd->mem_root,pfname,lname);
if (++count == 1 && res_id)
*res_id= (int16) pcat_id->val_int();
- names->push_back(lname);
+ names->push_back(lname, thd->mem_root);
}
end_read_record(&read_record_info);
@@ -415,7 +415,7 @@ void get_all_items_for_category(THD *thd, TABLE *items, Field *pfname,
continue;
String *name= new (thd->mem_root) String();
get_field(thd->mem_root,pfname,name);
- res->push_back(name);
+ res->push_back(name, thd->mem_root);
}
end_read_record(&read_record_info);
@@ -449,11 +449,17 @@ void get_all_items_for_category(THD *thd, TABLE *items, Field *pfname,
int send_answer_1(Protocol *protocol, String *s1, String *s2, String *s3)
{
+ THD *thd= protocol->thd;
+ MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("send_answer_1");
+
List<Item> field_list;
- field_list.push_back(new Item_empty_string("name",64));
- field_list.push_back(new Item_empty_string("description",1000));
- field_list.push_back(new Item_empty_string("example",1000));
+ field_list.push_back(new (mem_root) Item_empty_string(thd, "name", 64),
+ mem_root);
+ field_list.push_back(new (mem_root) Item_empty_string(thd, "description", 1000),
+ mem_root);
+ field_list.push_back(new (mem_root) Item_empty_string(thd, "example", 1000),
+ mem_root);
if (protocol->send_result_set_metadata(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
@@ -492,13 +498,22 @@ int send_answer_1(Protocol *protocol, String *s1, String *s2, String *s3)
int send_header_2(Protocol *protocol, bool for_category)
{
+ THD *thd= protocol->thd;
+ MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("send_header_2");
List<Item> field_list;
if (for_category)
- field_list.push_back(new Item_empty_string("source_category_name",64));
- field_list.push_back(new Item_empty_string("name",64));
- field_list.push_back(new Item_empty_string("is_it_category",1));
- DBUG_RETURN(protocol->send_result_set_metadata(&field_list, Protocol::SEND_NUM_ROWS |
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "source_category_name", 64),
+ mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "name", 64),
+ mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "is_it_category", 1),
+ mem_root);
+ DBUG_RETURN(protocol->send_result_set_metadata(&field_list,
+ Protocol::SEND_NUM_ROWS |
Protocol::SEND_EOF));
}
@@ -625,10 +640,15 @@ SQL_SELECT *prepare_select_for_name(THD *thd, const char *mask, uint mlen,
TABLE_LIST *tables, TABLE *table,
Field *pfname, int *error)
{
- Item *cond= new Item_func_like(new Item_field(pfname),
- new Item_string(mask,mlen,pfname->charset()),
- new Item_string_ascii("\\"),
- FALSE);
+ MEM_ROOT *mem_root= thd->mem_root;
+ Item *cond= new (mem_root)
+ Item_func_like(thd,
+ new (mem_root)
+ Item_field(thd, pfname),
+ new (mem_root) Item_string(thd, mask, mlen,
+ pfname->charset()),
+ new (mem_root) Item_string_ascii(thd, "\\"),
+ FALSE);
if (thd->is_fatal_error)
return 0; // OOM
return prepare_simple_select(thd, cond, table, error);
@@ -763,11 +783,17 @@ bool mysqld_help(THD *thd, const char *mask)
{
Field *topic_cat_id= used_fields[help_topic_help_category_id].field;
Item *cond_topic_by_cat=
- new Item_func_equal(new Item_field(topic_cat_id),
- new Item_int((int32)category_id));
+ new (mem_root)
+ Item_func_equal(thd,
+ new (mem_root)
+ Item_field(thd, topic_cat_id),
+ new (mem_root)
+ Item_int(thd, (int32) category_id));
Item *cond_cat_by_cat=
- new Item_func_equal(new Item_field(cat_cat_id),
- new Item_int((int32)category_id));
+ new (mem_root)
+ Item_func_equal(thd,
+ new (mem_root) Item_field(thd, cat_cat_id),
+ new (mem_root) Item_int(thd, (int32) category_id));
if (!(select= prepare_simple_select(thd, cond_topic_by_cat,
tables[0].table, &error)))
goto error;
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index aaaf7b998b0..1c4452eaf97 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -872,10 +872,29 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
table->reset_default_fields();
+ if (fields.elements || !value_count)
+ {
+ /*
+ There are possibly some default values:
+ INSERT INTO t1 (fields) VALUES ...
+ INSERT INTO t1 VALUES ()
+ */
+ if (table->validate_default_values_of_unset_fields(thd))
+ {
+ error= 1;
+ goto values_loop_end;
+ }
+ }
+
while ((values= its++))
{
if (fields.elements || !value_count)
{
+ /*
+ There are possibly some default values:
+ INSERT INTO t1 (fields) VALUES ...
+ INSERT INTO t1 VALUES ()
+ */
restore_record(table,s->default_values); // Get empty record
if (fill_record_n_invoke_before_triggers(thd, table, fields, *values, 0,
TRG_EVENT_INSERT))
@@ -896,6 +915,10 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
}
else
{
+ /*
+ No field list, all fields are set explicitly:
+ INSERT INTO t1 VALUES (values)
+ */
if (thd->lex->used_tables) // Column used in values()
restore_record(table,s->default_values); // Get empty record
else
@@ -967,6 +990,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
thd->get_stmt_da()->inc_current_row_for_warning();
}
+values_loop_end:
free_underlaid_joins(thd, &thd->lex->select_lex);
joins_freed= TRUE;
@@ -1125,12 +1149,12 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
ha_rows updated=((thd->client_capabilities & CLIENT_FOUND_ROWS) ?
info.touched : info.updated);
if (ignore)
- sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
+ sprintf(buff, ER_THD(thd, ER_INSERT_INFO), (ulong) info.records,
(lock_type == TL_WRITE_DELAYED) ? (ulong) 0 :
(ulong) (info.records - info.copied),
(long) thd->get_stmt_da()->current_statement_warn_count());
else
- sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
+ sprintf(buff, ER_THD(thd, ER_INSERT_INFO), (ulong) info.records,
(ulong) (info.deleted + updated),
(long) thd->get_stmt_da()->current_statement_warn_count());
::my_ok(thd, info.copied + info.deleted + updated, id, buff);
@@ -1646,8 +1670,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
if (!key)
{
- if (!(key=(char*) my_safe_alloca(table->s->max_unique_length,
- MAX_KEY_LENGTH)))
+ if (!(key=(char*) my_safe_alloca(table->s->max_unique_length)))
{
error=ENOMEM;
goto err;
@@ -1873,7 +1896,7 @@ after_trg_n_copied_inc:
ok_or_after_trg_err:
if (key)
- my_safe_afree(key,table->s->max_unique_length,MAX_KEY_LENGTH);
+ my_safe_afree(key,table->s->max_unique_length);
if (!table->file->has_transactions())
thd->transaction.stmt.modified_non_trans_table= TRUE;
DBUG_RETURN(trg_error);
@@ -1885,7 +1908,7 @@ err:
before_trg_err:
table->file->restore_auto_increment(prev_insert_id);
if (key)
- my_safe_afree(key, table->s->max_unique_length, MAX_KEY_LENGTH);
+ my_safe_afree(key, table->s->max_unique_length);
table->column_bitmaps_set(save_read_set, save_write_set);
DBUG_RETURN(1);
}
@@ -1917,7 +1940,7 @@ int check_that_all_fields_are_given_values(THD *thd, TABLE *entry,
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_NO_DEFAULT_FOR_VIEW_FIELD,
- ER(ER_NO_DEFAULT_FOR_VIEW_FIELD),
+ ER_THD(thd, ER_NO_DEFAULT_FOR_VIEW_FIELD),
table_list->view_db.str,
table_list->view_name.str);
}
@@ -1925,7 +1948,7 @@ int check_that_all_fields_are_given_values(THD *thd, TABLE *entry,
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_NO_DEFAULT_FOR_FIELD,
- ER(ER_NO_DEFAULT_FOR_FIELD),
+ ER_THD(thd, ER_NO_DEFAULT_FOR_FIELD),
(*field)->field_name);
}
err= 1;
@@ -2362,7 +2385,8 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd)
kill_delayed_threads_for_table().
*/
if (!thd.is_error())
- my_message(ER_QUERY_INTERRUPTED, ER(ER_QUERY_INTERRUPTED), MYF(0));
+ my_message(ER_QUERY_INTERRUPTED, ER_THD(&thd, ER_QUERY_INTERRUPTED),
+ MYF(0));
else
my_message(thd.get_stmt_da()->sql_errno(),
thd.get_stmt_da()->message(), MYF(0));
@@ -2425,7 +2449,8 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd)
found_next_number_field= table->found_next_number_field;
for (org_field= table->field; *org_field; org_field++, field++)
{
- if (!(*field= (*org_field)->new_field(client_thd->mem_root, copy, 1)))
+ if (!(*field= (*org_field)->make_new_field(client_thd->mem_root, copy,
+ 1)))
goto error;
(*field)->orig_table= copy; // Remove connection
(*field)->move_field_offset(adjust_ptrs); // Point at copy->record[0]
@@ -3456,7 +3481,7 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
while ((item= li++))
{
- item->transform(&Item::update_value_transformer,
+ item->transform(thd, &Item::update_value_transformer,
(uchar*)lex->current_select);
}
}
@@ -3555,6 +3580,8 @@ int select_insert::prepare2(void)
thd->locked_tables_mode <= LTM_LOCK_TABLES &&
!thd->lex->describe)
table->file->ha_start_bulk_insert((ha_rows) 0);
+ if (table->validate_default_values_of_unset_fields(thd))
+ DBUG_RETURN(1);
DBUG_RETURN(0);
}
@@ -3663,14 +3690,14 @@ void select_insert::store_values(List<Item> &values)
TRG_EVENT_INSERT);
}
-bool select_insert::send_eof()
+bool select_insert::prepare_eof()
{
int error;
bool const trans_table= table->file->has_transactions();
- ulonglong id, row_count;
bool changed;
killed_state killed_status= thd->killed;
- DBUG_ENTER("select_insert::send_eof");
+
+ DBUG_ENTER("select_insert::prepare_eof");
DBUG_PRINT("enter", ("trans_table=%d, table_type='%s'",
trans_table, table->file->table_type()));
@@ -3721,7 +3748,7 @@ bool select_insert::send_eof()
trans_table, FALSE, FALSE, errcode))
{
table->file->ha_release_auto_increment();
- DBUG_RETURN(1);
+ DBUG_RETURN(true);
}
}
table->file->ha_release_auto_increment();
@@ -3729,31 +3756,49 @@ bool select_insert::send_eof()
if (error)
{
table->file->print_error(error,MYF(0));
- DBUG_RETURN(1);
+ DBUG_RETURN(true);
}
- if (suppress_my_ok)
- DBUG_RETURN(0);
+ DBUG_RETURN(false);
+}
+
+bool select_insert::send_ok_packet() {
+ char message[160]; /* status message */
+ ulong row_count; /* rows affected */
+ ulong id; /* last insert-id */
+
+ DBUG_ENTER("select_insert::send_ok_packet");
- char buff[160];
if (info.ignore)
- sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
- (ulong) (info.records - info.copied),
- (long) thd->get_stmt_da()->current_statement_warn_count());
+ my_snprintf(message, sizeof(message), ER(ER_INSERT_INFO),
+ (ulong) info.records, (ulong) (info.records - info.copied),
+ (long) thd->get_stmt_da()->current_statement_warn_count());
else
- sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
- (ulong) (info.deleted+info.updated),
- (long) thd->get_stmt_da()->current_statement_warn_count());
+ my_snprintf(message, sizeof(message), ER(ER_INSERT_INFO),
+ (ulong) info.records, (ulong) (info.deleted + info.updated),
+ (long) thd->get_stmt_da()->current_statement_warn_count());
+
row_count= info.copied + info.deleted +
- ((thd->client_capabilities & CLIENT_FOUND_ROWS) ?
- info.touched : info.updated);
+ ((thd->client_capabilities & CLIENT_FOUND_ROWS) ?
+ info.touched : info.updated);
+
id= (thd->first_successful_insert_id_in_cur_stmt > 0) ?
thd->first_successful_insert_id_in_cur_stmt :
(thd->arg_of_last_insert_id_function ?
thd->first_successful_insert_id_in_prev_stmt :
(info.copied ? autoinc_value_of_last_inserted_row : 0));
- ::my_ok(thd, row_count, id, buff);
- DBUG_RETURN(0);
+
+ ::my_ok(thd, row_count, id, message);
+
+ DBUG_RETURN(false);
+}
+
+bool select_insert::send_eof()
+{
+ bool res;
+ DBUG_ENTER("select_insert::send_eof");
+ res= (prepare_eof() || (!suppress_my_ok && send_ok_packet()));
+ DBUG_RETURN(res);
}
void select_insert::abort_result_set() {
@@ -3885,6 +3930,7 @@ static TABLE *create_table_from_items(THD *thd,
tmp_table.s->db_create_options=0;
tmp_table.null_row= 0;
tmp_table.maybe_null= 0;
+ tmp_table.in_use= thd;
promote_first_timestamp_column(&alter_info->create_list);
@@ -3904,13 +3950,15 @@ static TABLE *create_table_from_items(THD *thd,
(Item ***) 0, &tmp_field, &def_field, 0, 0, 0, 0,
0);
if (!field ||
- !(cr_field=new Create_field(field,(item->type() == Item::FIELD_ITEM ?
- ((Item_field *)item)->field :
- (Field*) 0))))
+ !(cr_field= (new (thd->mem_root)
+ Create_field(thd, field,
+ (item->type() == Item::FIELD_ITEM ?
+ ((Item_field *) item)->field :
+ (Field *) 0)))))
DBUG_RETURN(0);
if (item->maybe_null)
cr_field->flags &= ~NOT_NULL_FLAG;
- alter_info->create_list.push_back(cr_field);
+ alter_info->create_list.push_back(cr_field, thd->mem_root);
}
DEBUG_SYNC(thd,"create_table_select_before_create");
@@ -4228,13 +4276,13 @@ void select_create::store_values(List<Item> &values)
bool select_create::send_eof()
{
- if (select_insert::send_eof())
+ DBUG_ENTER("select_create::send_eof");
+ if (prepare_eof())
{
abort_result_set();
- return 1;
+ DBUG_RETURN(true);
}
- exit_done= 1; // Avoid double calls
/*
Do an implicit commit at end of statement for non-temporary
tables. This can fail, but we should unlock the table
@@ -4255,7 +4303,7 @@ bool select_create::send_eof()
thd->thread_id, thd->wsrep_conflict_state, thd->query());
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
abort_result_set();
- return TRUE;
+ DBUG_RETURN(true);
}
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
}
@@ -4264,9 +4312,17 @@ bool select_create::send_eof()
else if (!thd->is_current_stmt_binlog_format_row())
table->s->table_creation_was_logged= 1;
+ /*
+ exit_done must only be set after last potential call to
+ abort_result_set().
+ */
+ exit_done= 1; // Avoid double calls
+
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
+ send_ok_packet();
+
if (m_plock)
{
MYSQL_LOCK *lock= *m_plock;
@@ -4287,12 +4343,12 @@ bool select_create::send_eof()
create_info->
pos_in_locked_tables,
table, lock))
- return 0; // ok
+ DBUG_RETURN(false); // ok
/* Fail. Continue without locking the table */
}
mysql_unlock_tables(thd, lock);
}
- return 0;
+ DBUG_RETURN(false);
}
diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc
index 23357ac871d..731cc7267d5 100644
--- a/sql/sql_join_cache.cc
+++ b/sql/sql_join_cache.cc
@@ -318,7 +318,7 @@ void JOIN_CACHE::collect_info_on_key_args()
The allocated arrays are adjacent.
NOTES
- The memory is allocated in join->thd->memroot
+ The memory is allocated in join->thd->mem_root
RETURN VALUE
pointer to the first array
@@ -328,8 +328,8 @@ int JOIN_CACHE::alloc_fields()
{
uint ptr_cnt= external_key_arg_fields+blobs+1;
uint fields_size= sizeof(CACHE_FIELD)*fields;
- field_descr= (CACHE_FIELD*) sql_alloc(fields_size +
- sizeof(CACHE_FIELD*)*ptr_cnt);
+ field_descr= (CACHE_FIELD*) join->thd->alloc(fields_size +
+ sizeof(CACHE_FIELD*)*ptr_cnt);
blob_ptr= (CACHE_FIELD **) ((uchar *) field_descr + fields_size);
return (field_descr == NULL);
}
@@ -2679,7 +2679,7 @@ int JOIN_CACHE_HASHED::init(bool for_explain)
if ((rc= JOIN_CACHE::init(for_explain)) || for_explain)
DBUG_RETURN (rc);
- if (!(key_buff= (uchar*) sql_alloc(key_length)))
+ if (!(key_buff= (uchar*) join->thd->alloc(key_length)))
DBUG_RETURN(1);
/* Take into account a reference to the next record in the key chain */
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 992510a18e6..12f55acf5a0 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -540,6 +540,7 @@ void lex_start(THD *thd)
lex->in_sum_func= NULL;
lex->used_tables= 0;
+ lex->only_view= FALSE;
lex->reset_slave_info.all= false;
lex->limit_rows_examined= 0;
lex->limit_rows_examined_cnt= ULONGLONG_MAX;
@@ -1898,7 +1899,7 @@ void st_select_lex::init_query()
exclude_from_table_unique_test= no_wrap_view_item= FALSE;
nest_level= 0;
link_next= 0;
- is_prep_leaf_list_saved= FALSE;
+ prep_leaf_list_state= UNINIT;
have_merged_subqueries= FALSE;
bzero((char*) expr_cache_may_be_used, sizeof(expr_cache_may_be_used));
m_non_agg_field_used= false;
@@ -1933,7 +1934,6 @@ void st_select_lex::init_select()
with_sum_func= 0;
is_correlated= 0;
cur_pos_in_select_list= UNDEF_POS;
- non_agg_fields.empty();
cond_value= having_value= Item::COND_UNDEF;
inner_refs_list.empty();
insert_tables= 0;
@@ -1941,6 +1941,7 @@ void st_select_lex::init_select()
m_non_agg_field_used= false;
m_agg_func_used= false;
name_visibility_map= 0;
+ join= 0;
}
/*
@@ -2333,9 +2334,9 @@ bool st_select_lex::add_group_to_list(THD *thd, Item *item, bool asc)
}
-bool st_select_lex::add_ftfunc_to_list(Item_func_match *func)
+bool st_select_lex::add_ftfunc_to_list(THD *thd, Item_func_match *func)
{
- return !func || ftfunc_list->push_back(func); // end of memory?
+ return !func || ftfunc_list->push_back(func, thd->mem_root); // end of memory?
}
@@ -3458,7 +3459,7 @@ void st_select_lex::alloc_index_hints (THD *thd)
*/
bool st_select_lex::add_index_hint (THD *thd, char *str, uint length)
{
- return index_hints->push_front (new (thd->mem_root)
+ return index_hints->push_front(new (thd->mem_root)
Index_hint(current_index_hint_type,
current_index_hint_clause,
str, length), thd->mem_root);
@@ -3504,6 +3505,8 @@ bool st_select_lex::optimize_unflattened_subqueries(bool const_only)
bool empty_union_result= true;
bool is_correlated_unit= false;
+ bool first= true;
+ bool union_plan_saved= false;
/*
If the subquery is a UNION, optimize all the subqueries in the UNION. If
there is no UNION, then the loop will execute once for the subquery.
@@ -3511,6 +3514,17 @@ bool st_select_lex::optimize_unflattened_subqueries(bool const_only)
for (SELECT_LEX *sl= un->first_select(); sl; sl= sl->next_select())
{
JOIN *inner_join= sl->join;
+ if (first)
+ first= false;
+ else
+ {
+ if (!union_plan_saved)
+ {
+ union_plan_saved= true;
+ if (un->save_union_explain(un->thd->lex->explain))
+ return true; /* Failure */
+ }
+ }
if (!inner_join)
continue;
SELECT_LEX *save_select= un->thd->lex->current_select;
@@ -3786,7 +3800,7 @@ bool SELECT_LEX::merge_subquery(THD *thd, TABLE_LIST *derived,
Item_in_subselect *in_subq;
while ((in_subq= li++))
{
- sj_subselects.push_back(in_subq);
+ sj_subselects.push_back(in_subq, thd->mem_root);
if (in_subq->emb_on_expr_nest == NO_JOIN_NEST)
in_subq->emb_on_expr_nest= derived;
}
@@ -4179,12 +4193,22 @@ bool st_select_lex::save_prep_leaf_tables(THD *thd)
{
List_iterator_fast<TABLE_LIST> li(leaf_tables);
TABLE_LIST *table;
+
+ /*
+ Check that the SELECT_LEX was really prepared and so tables are setup.
+
+ It can be subquery in SET clause of UPDATE which was not prepared yet, so
+ its tables are not yet setup and ready for storing.
+ */
+ if (prep_leaf_list_state != READY)
+ return FALSE;
+
while ((table= li++))
{
if (leaf_tables_prep.push_back(table))
return TRUE;
}
- is_prep_leaf_list_saved= TRUE;
+ prep_leaf_list_state= SAVED;
for (SELECT_LEX_UNIT *u= first_inner_unit(); u; u= u->next_unit())
{
for (SELECT_LEX *sl= u->first_select(); sl; sl= sl->next_select())
@@ -4354,10 +4378,15 @@ void LEX::restore_set_statement_var()
int st_select_lex_unit::save_union_explain(Explain_query *output)
{
SELECT_LEX *first= first_select();
+
+ if (output->get_union(first->select_number))
+ return 0; /* Already added */
+
Explain_union *eu=
new (output->mem_root) Explain_union(output->mem_root,
thd->lex->analyze_stmt);
+
if (derived)
eu->connection_type= Explain_node::EXPLAIN_NODE_DERIVED;
/*
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 20b156a36b6..473fd18a2ee 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -780,7 +780,8 @@ public:
List<TABLE_LIST> leaf_tables;
List<TABLE_LIST> leaf_tables_exec;
List<TABLE_LIST> leaf_tables_prep;
- bool is_prep_leaf_list_saved;
+ enum leaf_list_state {UNINIT, READY, SAVED};
+ enum leaf_list_state prep_leaf_list_state;
uint insert_tables;
st_select_lex *merged_into; /* select which this select is merged into */
/* (not 0 only for views/derived tables) */
@@ -800,7 +801,7 @@ public:
list during split_sum_func
*/
uint select_n_having_items;
- uint cond_count; /* number of arguments of and/or/xor in where/having/on */
+ uint cond_count; /* number of sargable Items in where/having/on */
uint between_count; /* number of between predicates in where/having/on */
uint max_equal_elems; /* maximal number of elements in multiple equalities */
/*
@@ -869,8 +870,6 @@ public:
bool no_wrap_view_item;
/* exclude this select from check of unique_table() */
bool exclude_from_table_unique_test;
- /* List of fields that aren't under an aggregate function */
- List<Item_field> non_agg_fields;
/* index in the select list of the expression currently being fixed */
int cur_pos_in_select_list;
@@ -925,7 +924,7 @@ public:
bool add_item_to_list(THD *thd, Item *item);
bool add_group_to_list(THD *thd, Item *item, bool asc);
- bool add_ftfunc_to_list(Item_func_match *func);
+ bool add_ftfunc_to_list(THD *thd, Item_func_match *func);
bool add_order_to_list(THD *thd, Item *item, bool asc);
bool add_gorder_to_list(THD *thd, Item *item, bool asc);
TABLE_LIST* add_table_to_list(THD *thd, Table_ident *table,
@@ -2372,6 +2371,10 @@ public:
deleting_all_rows= true;
scanned_rows= rows_arg;
}
+ void cancel_delete_all_rows()
+ {
+ deleting_all_rows= false;
+ }
Explain_delete* save_explain_delete_data(MEM_ROOT *mem_root, THD *thd);
};
@@ -2484,6 +2487,7 @@ public:
USER_RESOURCES mqh;
LEX_RESET_SLAVE reset_slave_info;
ulonglong type;
+ ulong next_binlog_file_number;
/* The following is used by KILL */
killed_state kill_signal;
killed_type kill_type;
@@ -2863,21 +2867,21 @@ public:
return false;
}
// Add a key as a part of CREATE TABLE or ALTER TABLE
- bool add_key(Key::Keytype type, const LEX_STRING &name,
+ bool add_key(Key::Keytype key_type, const LEX_STRING &key_name,
ha_key_alg algorithm, DDL_options_st ddl)
{
if (check_add_key(ddl) ||
- !(last_key= new Key(type, name, algorithm, false, ddl)))
+ !(last_key= new Key(key_type, key_name, algorithm, false, ddl)))
return true;
alter_info.key_list.push_back(last_key);
return false;
}
// Add a key for a CREATE INDEX statement
- bool add_create_index(Key::Keytype type, const LEX_STRING &name,
+ bool add_create_index(Key::Keytype key_type, const LEX_STRING &key_name,
ha_key_alg algorithm, DDL_options_st ddl)
{
if (check_create_options(ddl) ||
- !(last_key= new Key(type, name, algorithm, false, ddl)))
+ !(last_key= new Key(key_type, key_name, algorithm, false, ddl)))
return true;
alter_info.key_list.push_back(last_key);
return false;
diff --git a/sql/sql_list.h b/sql/sql_list.h
index e8fd5c66e0b..6f01b64df70 100644
--- a/sql/sql_list.h
+++ b/sql/sql_list.h
@@ -48,8 +48,8 @@ public:
{ /* never called */ }
static void operator delete[](void *ptr, size_t size) { TRASH(ptr, size); }
#ifdef HAVE_valgrind
- bool dummy;
- inline Sql_alloc() :dummy(0) {}
+ bool dummy_for_valgrind;
+ inline Sql_alloc() :dummy_for_valgrind(0) {}
inline ~Sql_alloc() {}
#else
inline Sql_alloc() {}
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 142036b2191..2870e90ef4d 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -99,7 +99,7 @@ public:
/* load xml */
List<XML_TAG> taglist;
int read_value(int delim, String *val);
- int read_xml();
+ int read_xml(THD *thd);
int clear_level(int level);
my_off_t file_length() { return cache.end_of_file; }
@@ -200,7 +200,8 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
if (escaped->length() > 1 || enclosed->length() > 1)
{
- my_message(ER_WRONG_FIELD_TERMINATORS,ER(ER_WRONG_FIELD_TERMINATORS),
+ my_message(ER_WRONG_FIELD_TERMINATORS,
+ ER_THD(thd, ER_WRONG_FIELD_TERMINATORS),
MYF(0));
DBUG_RETURN(TRUE);
}
@@ -212,7 +213,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
{
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED,
- ER(WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED));
+ ER_THD(thd, WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED));
}
if (open_and_lock_tables(thd, table_list, TRUE, 0))
@@ -269,7 +270,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
Item *item;
if (!(item= field_iterator.create_item(thd)))
DBUG_RETURN(TRUE);
- fields_vars.push_back(item->real_item());
+ fields_vars.push_back(item->real_item(), thd->mem_root);
}
bitmap_set_all(table->write_set);
/*
@@ -298,6 +299,18 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
table->prepare_triggers_for_insert_stmt_or_event();
table->mark_columns_needed_for_insert();
+ if (table->vfield)
+ {
+ for (Field **vfield_ptr= table->vfield; *vfield_ptr; vfield_ptr++)
+ {
+ if ((*vfield_ptr)->stored_in_db)
+ {
+ thd->lex->unit.insert_table_with_stored_vcol= table;
+ break;
+ }
+ }
+ }
+
uint tot_length=0;
bool use_blobs= 0, use_vars= 0;
List_iterator_fast<Item> it(fields_vars);
@@ -323,7 +336,8 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
}
if (use_blobs && !ex->line_term->length() && !field_term->length())
{
- my_message(ER_BLOBS_AND_NO_TERMINATED,ER(ER_BLOBS_AND_NO_TERMINATED),
+ my_message(ER_BLOBS_AND_NO_TERMINATED,
+ ER_THD(thd, ER_BLOBS_AND_NO_TERMINATED),
MYF(0));
DBUG_RETURN(TRUE);
}
@@ -477,7 +491,12 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
thd->abort_on_warning= !ignore && thd->is_strict_mode();
thd_progress_init(thd, 2);
- if (ex->filetype == FILETYPE_XML) /* load xml */
+ if (table_list->table->validate_default_values_of_unset_fields(thd))
+ {
+ read_info.error= true;
+ error= 1;
+ }
+ else if (ex->filetype == FILETYPE_XML) /* load xml */
error= read_xml_field(thd, info, table_list, fields_vars,
set_fields, set_values, read_info,
*(ex->line_term), skip_lines, ignore);
@@ -567,7 +586,8 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
error= -1; // Error on read
goto err;
}
- sprintf(name, ER(ER_LOAD_INFO), (ulong) info.records, (ulong) info.deleted,
+ sprintf(name, ER_THD(thd, ER_LOAD_INFO),
+ (ulong) info.records, (ulong) info.deleted,
(ulong) (info.records - info.copied),
(long) thd->get_stmt_da()->current_statement_warn_count());
@@ -813,7 +833,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
thd->cuted_fields++; /* Not enough fields */
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_TOO_FEW_RECORDS,
- ER(ER_WARN_TOO_FEW_RECORDS),
+ ER_THD(thd, ER_WARN_TOO_FEW_RECORDS),
thd->get_stmt_da()->current_row_for_warning());
/*
Timestamp fields that are NOT NULL are autoupdated if there is no
@@ -843,7 +863,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
thd->cuted_fields++; /* To long row */
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_TOO_MANY_RECORDS,
- ER(ER_WARN_TOO_MANY_RECORDS),
+ ER_THD(thd, ER_WARN_TOO_MANY_RECORDS),
thd->get_stmt_da()->current_row_for_warning());
}
@@ -879,7 +899,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
thd->cuted_fields++; /* To long row */
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_TOO_MANY_RECORDS,
- ER(ER_WARN_TOO_MANY_RECORDS),
+ ER_THD(thd, ER_WARN_TOO_MANY_RECORDS),
thd->get_stmt_da()->current_row_for_warning());
}
thd->get_stmt_da()->inc_current_row_for_warning();
@@ -1056,7 +1076,7 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
thd->cuted_fields++;
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_TOO_FEW_RECORDS,
- ER(ER_WARN_TOO_FEW_RECORDS),
+ ER_THD(thd, ER_WARN_TOO_FEW_RECORDS),
thd->get_stmt_da()->current_row_for_warning());
}
else if (item->type() == Item::STRING_ITEM)
@@ -1102,7 +1122,8 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
{
thd->cuted_fields++; /* To long row */
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_WARN_TOO_MANY_RECORDS, ER(ER_WARN_TOO_MANY_RECORDS),
+ ER_WARN_TOO_MANY_RECORDS,
+ ER_THD(thd, ER_WARN_TOO_MANY_RECORDS),
thd->get_stmt_da()->current_row_for_warning());
if (thd->killed)
DBUG_RETURN(1);
@@ -1142,7 +1163,7 @@ read_xml_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
}
// read row tag and save values into tag list
- if (read_info.read_xml())
+ if (read_info.read_xml(thd))
break;
List_iterator_fast<XML_TAG> xmlit(read_info.taglist);
@@ -1243,7 +1264,7 @@ read_xml_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
thd->cuted_fields++;
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_TOO_FEW_RECORDS,
- ER(ER_WARN_TOO_FEW_RECORDS),
+ ER_THD(thd, ER_WARN_TOO_FEW_RECORDS),
thd->get_stmt_da()->current_row_for_warning());
}
else
@@ -1866,7 +1887,7 @@ int READ_INFO::read_value(int delim, String *val)
tags and attributes are stored in taglist
when tag set in ROWS IDENTIFIED BY is closed, we are ready and return
*/
-int READ_INFO::read_xml()
+int READ_INFO::read_xml(THD *thd)
{
DBUG_ENTER("READ_INFO::read_xml");
int chr, chr2, chr3;
@@ -1964,11 +1985,13 @@ int READ_INFO::read_xml()
goto found_eof;
/* save value to list */
- if(tag.length() > 0 && value.length() > 0)
+ if (tag.length() > 0 && value.length() > 0)
{
DBUG_PRINT("read_xml", ("lev:%i tag:%s val:%s",
level,tag.c_ptr_safe(), value.c_ptr_safe()));
- taglist.push_front( new XML_TAG(level, tag, value));
+ XML_TAG *tmp= new XML_TAG(level, tag, value);
+ if (!tmp || taglist.push_front(tmp, thd->mem_root))
+ DBUG_RETURN(1); // End of memory
}
tag.length(0);
value.length(0);
@@ -2028,13 +2051,15 @@ int READ_INFO::read_xml()
}
chr= read_value(delim, &value);
- if(attribute.length() > 0 && value.length() > 0)
+ if (attribute.length() > 0 && value.length() > 0)
{
DBUG_PRINT("read_xml", ("lev:%i att:%s val:%s\n",
level + 1,
attribute.c_ptr_safe(),
value.c_ptr_safe()));
- taglist.push_front(new XML_TAG(level + 1, attribute, value));
+ XML_TAG *tmp= new XML_TAG(level + 1, attribute, value);
+ if (!tmp || taglist.push_front(tmp, thd->mem_root))
+ DBUG_RETURN(1); // End of memory
}
attribute.length(0);
value.length(0);
diff --git a/sql/sql_locale.cc b/sql/sql_locale.cc
index d918d5c9cf4..bdda5f1b5ef 100644
--- a/sql/sql_locale.cc
+++ b/sql/sql_locale.cc
@@ -3494,7 +3494,8 @@ MY_LOCALE *my_locale_by_name(const char *name)
{
// Send a warning to the client
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_WARN_DEPRECATED_SYNTAX, ER(ER_WARN_DEPRECATED_SYNTAX),
+ ER_WARN_DEPRECATED_SYNTAX,
+ ER_THD(thd, ER_WARN_DEPRECATED_SYNTAX),
name, locale->name);
}
else
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 61c8d823acd..2141e6884f7 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -51,7 +51,7 @@
#include "sql_connect.h" // decrease_user_connections,
// check_mqh,
// reset_mqh
-#include "sql_rename.h" // mysql_rename_table
+#include "sql_rename.h" // mysql_rename_tables
#include "sql_tablespace.h" // mysql_alter_tablespace
#include "hostname.h" // hostname_cache_refresh
#include "sql_acl.h" // *_ACL, check_grant, is_acl_user,
@@ -133,7 +133,7 @@ static void sql_kill(THD *thd, longlong id, killed_state state, killed_type type
static void sql_kill_user(THD *thd, LEX_USER *user, killed_state state);
static bool lock_tables_precheck(THD *thd, TABLE_LIST *tables);
static bool execute_show_status(THD *, TABLE_LIST *);
-static bool execute_rename_table(THD *, TABLE_LIST *, TABLE_LIST *);
+static bool check_rename_table(THD *, TABLE_LIST *, TABLE_LIST *);
const char *any_db="*any*"; // Special symbol for check_access
@@ -271,9 +271,6 @@ void init_update_queries(void)
server_command_flags[COM_STATISTICS]= CF_SKIP_QUERY_ID | CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK;
server_command_flags[COM_PING]= CF_SKIP_QUERY_ID | CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK;
- server_command_flags[COM_STMT_PREPARE]= CF_SKIP_QUESTIONS;
- server_command_flags[COM_STMT_CLOSE]= CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK;
- server_command_flags[COM_STMT_RESET]= CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK;
server_command_flags[COM_QUIT]= CF_SKIP_WSREP_CHECK;
server_command_flags[COM_PROCESS_INFO]= CF_SKIP_WSREP_CHECK;
@@ -284,11 +281,16 @@ void init_update_queries(void)
server_command_flags[COM_END]= CF_SKIP_WSREP_CHECK;
/*
- COM_QUERY and COM_SET_OPTION are allowed to pass the early COM_xxx filter,
- they're checked later in mysql_execute_command().
+ COM_QUERY, COM_SET_OPTION and COM_STMT_XXX are allowed to pass the early
+ COM_xxx filter, they're checked later in mysql_execute_command().
*/
server_command_flags[COM_QUERY]= CF_SKIP_WSREP_CHECK;
server_command_flags[COM_SET_OPTION]= CF_SKIP_WSREP_CHECK;
+ server_command_flags[COM_STMT_PREPARE]= CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK;
+ server_command_flags[COM_STMT_CLOSE]= CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK;
+ server_command_flags[COM_STMT_RESET]= CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK;
+ server_command_flags[COM_STMT_EXECUTE]= CF_SKIP_WSREP_CHECK;
+ server_command_flags[COM_STMT_SEND_LONG_DATA]= CF_SKIP_WSREP_CHECK;
/* Initialize the sql command flags array. */
memset(sql_command_flags, 0, sizeof(sql_command_flags));
@@ -886,9 +888,9 @@ void cleanup_items(Item *item)
#ifndef EMBEDDED_LIBRARY
+#ifdef WITH_WSREP
static bool wsrep_node_is_ready(THD *thd)
{
-#ifdef WITH_WSREP
if (thd->variables.wsrep_on && !thd->wsrep_applier && !wsrep_ready)
{
my_message(ER_UNKNOWN_COM_ERROR,
@@ -896,9 +898,9 @@ static bool wsrep_node_is_ready(THD *thd)
MYF(0));
return false;
}
-#endif
return true;
}
+#endif
/**
Read one command from connection and execute it (query or simple command).
@@ -916,7 +918,11 @@ bool do_command(THD *thd)
{
bool return_value;
char *packet= 0;
+#ifdef WITH_WSREP
+ ulong packet_length= 0; // just to avoid (false positive) compiler warning
+#else
ulong packet_length;
+#endif /* WITH_WSREP */
NET *net= &thd->net;
enum enum_server_command command;
DBUG_ENTER("do_command");
@@ -1077,14 +1083,25 @@ bool do_command(THD *thd)
vio_description(net->vio), command,
command_name[command].str));
- /* bail out if DB snapshot has not been installed. */
+#ifdef WITH_WSREP
+ /*
+ Bail out if DB snapshot has not been installed.
+ */
if (!(server_command_flags[command] & CF_SKIP_WSREP_CHECK) &&
!wsrep_node_is_ready(thd))
{
thd->protocol->end_statement();
+
+ /* Performance Schema Interface instrumentation end. */
+ MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
+ thd->m_statement_psi= NULL;
+ thd->m_digest= NULL;
+
return_value= FALSE;
goto out;
}
+#endif
+
/* Restore read timeout value */
my_net_set_read_timeout(net, thd->variables.net_read_timeout);
@@ -1374,7 +1391,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
*/
if (thd->failed_com_change_user >= 3)
{
- my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
+ my_message(ER_UNKNOWN_COM_ERROR, ER_THD(thd,ER_UNKNOWN_COM_ERROR),
+ MYF(0));
auth_rc= 1;
}
else
@@ -1563,7 +1581,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
case COM_FIELD_LIST: // This isn't actually needed
#ifdef DONT_ALLOW_SHOW_COMMANDS
- my_message(ER_NOT_ALLOWED_COMMAND, ER(ER_NOT_ALLOWED_COMMAND),
+ my_message(ER_NOT_ALLOWED_COMMAND, ER_THD(thd, ER_NOT_ALLOWED_COMMAND),
MYF(0)); /* purecov: inspected */
break;
#else
@@ -1592,7 +1610,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
/* Check given table name length. */
if (packet_length - arg_length > NAME_LEN + 1 || arg_length > SAFE_NAME_LEN)
{
- my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
+ my_message(ER_UNKNOWN_COM_ERROR, ER_THD(thd, ER_UNKNOWN_COM_ERROR),
+ MYF(0));
break;
}
thd->convert_string(&table_name, system_charset_info,
@@ -1869,7 +1888,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
my_eof(thd);
break;
default:
- my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
+ my_message(ER_UNKNOWN_COM_ERROR, ER_THD(thd, ER_UNKNOWN_COM_ERROR),
+ MYF(0));
break;
}
break;
@@ -1888,7 +1908,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
case COM_DELAYED_INSERT:
case COM_END:
default:
- my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
+ my_message(ER_UNKNOWN_COM_ERROR, ER_THD(thd, ER_UNKNOWN_COM_ERROR),
+ MYF(0));
break;
}
@@ -1943,7 +1964,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->m_statement_psi= NULL;
thd->m_digest= NULL;
- thd->set_time();
dec_thread_running();
thd->packet.shrink(thd->variables.net_buffer_length); // Reclaim some memory
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
@@ -2056,7 +2076,7 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
case SCH_SCHEMATA:
#if defined(DONT_ALLOW_SHOW_COMMANDS)
my_message(ER_NOT_ALLOWED_COMMAND,
- ER(ER_NOT_ALLOWED_COMMAND), MYF(0)); /* purecov: inspected */
+ ER_THD(thd, ER_NOT_ALLOWED_COMMAND), MYF(0));
DBUG_RETURN(1);
#else
break;
@@ -2069,7 +2089,7 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
case SCH_EVENTS:
#ifdef DONT_ALLOW_SHOW_COMMANDS
my_message(ER_NOT_ALLOWED_COMMAND,
- ER(ER_NOT_ALLOWED_COMMAND), MYF(0)); /* purecov: inspected */
+ ER_THD(thd, ER_NOT_ALLOWED_COMMAND), MYF(0));
DBUG_RETURN(1);
#else
{
@@ -2098,7 +2118,7 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
{
#ifdef DONT_ALLOW_SHOW_COMMANDS
my_message(ER_NOT_ALLOWED_COMMAND,
- ER(ER_NOT_ALLOWED_COMMAND), MYF(0)); /* purecov: inspected */
+ ER_THD(thd, ER_NOT_ALLOWED_COMMAND), MYF(0));
DBUG_RETURN(1);
#else
DBUG_ASSERT(table_ident);
@@ -2278,7 +2298,7 @@ bool sp_process_definer(THD *thd)
push_warning_printf(thd,
Sql_condition::WARN_LEVEL_NOTE,
ER_NO_SUCH_USER,
- ER(ER_NO_SUCH_USER),
+ ER_THD(thd, ER_NO_SUCH_USER),
lex->definer->user.str,
lex->definer->host.str);
}
@@ -2550,7 +2570,8 @@ mysql_execute_command(THD *thd)
if (all_tables_not_ok(thd, all_tables))
{
/* we warn the slave SQL thread */
- my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0));
+ my_message(ER_SLAVE_IGNORED_TABLE, ER_THD(thd, ER_SLAVE_IGNORED_TABLE),
+ MYF(0));
}
for (table=all_tables; table; table=table->next_global)
@@ -2577,7 +2598,8 @@ mysql_execute_command(THD *thd)
all_tables_not_ok(thd, all_tables))
{
/* we warn the slave SQL thread */
- my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0));
+ my_message(ER_SLAVE_IGNORED_TABLE, ER_THD(thd, ER_SLAVE_IGNORED_TABLE),
+ MYF(0));
DBUG_RETURN(0);
}
/*
@@ -2628,13 +2650,13 @@ mysql_execute_command(THD *thd)
}
/*
- Bail out if DB snapshot has not been installed. We however,
- allow SET and SHOW queries.
+ Bail out if DB snapshot has not been installed. We however, allow SET,
+ SHOW and SELECT queries (only if wsrep_dirty_reads is set).
*/
- if (lex->sql_command != SQLCOM_SET_OPTION &&
+ if (lex->sql_command != SQLCOM_SET_OPTION &&
!wsrep_is_show_query(lex->sql_command) &&
- !(thd->variables.wsrep_dirty_reads &&
- lex->sql_command == SQLCOM_SELECT) &&
+ !(thd->variables.wsrep_dirty_reads &&
+ lex->sql_command == SQLCOM_SELECT) &&
!wsrep_node_is_ready(thd))
goto error;
}
@@ -2663,6 +2685,7 @@ mysql_execute_command(THD *thd)
if (lex->set_arena_for_set_stmt(&backup))
goto error;
+ MEM_ROOT *mem_root= thd->mem_root;
while ((var= it++))
{
DBUG_ASSERT(var->is_system());
@@ -2676,7 +2699,7 @@ mysql_execute_command(THD *thd)
goto error;
}
if (v->var->session_is_default(thd))
- o= new set_var(v->type, v->var, &v->base, NULL);
+ o= new set_var(thd,v->type, v->var, &v->base, NULL);
else
{
switch (v->var->option.var_type & GET_TYPE_MASK)
@@ -2688,10 +2711,10 @@ mysql_execute_command(THD *thd)
{
bool null_value;
longlong val= v->var->val_int(&null_value, thd, v->type, &v->base);
- o= new set_var(v->type, v->var, &v->base,
+ o= new set_var(thd, v->type, v->var, &v->base,
(null_value ?
- (Item *)new Item_null() :
- (Item *)new Item_int(val)));
+ (Item *) new (mem_root) Item_null(thd) :
+ (Item *) new (mem_root) Item_int(thd, val)));
}
break;
case GET_UINT:
@@ -2700,20 +2723,20 @@ mysql_execute_command(THD *thd)
{
bool null_value;
ulonglong val= v->var->val_int(&null_value, thd, v->type, &v->base);
- o= new set_var(v->type, v->var, &v->base,
+ o= new set_var(thd, v->type, v->var, &v->base,
(null_value ?
- (Item *)new Item_null() :
- (Item *)new Item_uint(val)));
+ (Item *) new (mem_root) Item_null(thd) :
+ (Item *) new (mem_root) Item_uint(thd, val)));
}
break;
case GET_DOUBLE:
{
bool null_value;
double val= v->var->val_real(&null_value, thd, v->type, &v->base);
- o= new set_var(v->type, v->var, &v->base,
+ o= new set_var(thd, v->type, v->var, &v->base,
(null_value ?
- (Item *)new Item_null() :
- (Item *)new Item_float(val, 1)));
+ (Item *) new (mem_root) Item_null(thd) :
+ (Item *) new (mem_root) Item_float(thd, val, 1)));
}
break;
default:
@@ -2732,18 +2755,19 @@ mysql_execute_command(THD *thd)
val= v->var->val_str(&tmp, thd, v->type, &v->base);
if (val)
{
- Item_string *str= new Item_string(v->var->charset(thd),
+ Item_string *str= new (mem_root) Item_string(thd, v->var->charset(thd),
val->ptr(), val->length());
- o= new set_var(v->type, v->var, &v->base, str);
+ o= new set_var(thd, v->type, v->var, &v->base, str);
}
else
- o= new set_var(v->type, v->var, &v->base, new Item_null());
+ o= new set_var(thd, v->type, v->var, &v->base,
+ new (mem_root) Item_null(thd));
}
break;
}
}
DBUG_ASSERT(o);
- lex->old_var_list.push_back(o);
+ lex->old_var_list.push_back(o, thd->mem_root);
}
lex->reset_arena_for_set_stmt(&backup);
if (lex->old_var_list.is_empty())
@@ -2881,7 +2905,7 @@ mysql_execute_command(THD *thd)
*/
if (lex->sroutines.records || lex->query_tables->next_global)
{
- my_message(ER_SET_CONSTANTS_ONLY, ER(ER_SET_CONSTANTS_ONLY),
+ my_message(ER_SET_CONSTANTS_ONLY, ER_THD(thd, ER_SET_CONSTANTS_ONLY),
MYF(0));
goto error;
}
@@ -2891,7 +2915,7 @@ mysql_execute_command(THD *thd)
(!(*it)->fixed && (*it)->fix_fields(lex->thd, it)) ||
(*it)->check_cols(1))
{
- my_message(ER_SET_CONSTANTS_ONLY, ER(ER_SET_CONSTANTS_ONLY),
+ my_message(ER_SET_CONSTANTS_ONLY, ER_THD(thd, ER_SET_CONSTANTS_ONLY),
MYF(0));
goto error;
}
@@ -2993,7 +3017,7 @@ mysql_execute_command(THD *thd)
my_error(ER_WRONG_ARGUMENTS, MYF(0), "PURGE LOGS BEFORE");
goto error;
}
- it= new Item_func_unix_timestamp(it);
+ it= new (thd->mem_root) Item_func_unix_timestamp(thd, it);
it->fix_fields(thd, &it);
res = purge_master_logs_before_date(thd, (ulong)it->val_int());
break;
@@ -3177,6 +3201,12 @@ mysql_execute_command(THD *thd)
TABLE_LIST *create_table= first_table;
TABLE_LIST *select_tables= lex->create_last_non_select_table->next_global;
+ if (lex->tmp_table())
+ {
+ status_var_decrement(thd->status_var.com_stat[SQLCOM_CREATE_TABLE]);
+ status_var_increment(thd->status_var.com_create_tmp_table);
+ }
+
/*
Code below (especially in mysql_create_table() and select_create
methods) may modify HA_CREATE_INFO structure in LEX, so we have to
@@ -3256,7 +3286,7 @@ mysql_execute_command(THD *thd)
#ifdef WITH_PARTITION_STORAGE_ENGINE
{
partition_info *part_info= thd->lex->part_info;
- if (part_info && !(part_info= thd->lex->part_info->get_clone()))
+ if (part_info && !(part_info= thd->lex->part_info->get_clone(thd)))
{
res= -1;
goto end_with_restore_list;
@@ -3375,6 +3405,7 @@ mysql_execute_command(THD *thd)
/*
select_create is currently not re-execution friendly and
needs to be created for every execution of a PS/SP.
+ Note: In wsrep-patch, CTAS is handled like a regular transaction.
*/
if ((result= new (thd->mem_root) select_create(thd, create_table,
&create_info,
@@ -3530,7 +3561,7 @@ end_with_restore_list:
thd->global_read_lock.is_acquired())
{
my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
- ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
+ ER_THD(thd, ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
goto error;
}
@@ -3559,7 +3590,7 @@ end_with_restore_list:
thd->global_read_lock.is_acquired())
{
my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
- ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
+ ER_THD(thd, ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
goto error;
}
mysql_mutex_lock(&LOCK_active_mi);
@@ -3571,15 +3602,19 @@ end_with_restore_list:
#endif /* HAVE_REPLICATION */
case SQLCOM_RENAME_TABLE:
{
+ if (check_rename_table(thd, first_table, all_tables))
+ goto error;
+
WSREP_TO_ISOLATION_BEGIN(0, 0, first_table)
- if (execute_rename_table(thd, first_table, all_tables))
+
+ if (mysql_rename_tables(thd, first_table, 0))
goto error;
break;
}
#ifndef EMBEDDED_LIBRARY
case SQLCOM_SHOW_BINLOGS:
#ifdef DONT_ALLOW_SHOW_COMMANDS
- my_message(ER_NOT_ALLOWED_COMMAND, ER(ER_NOT_ALLOWED_COMMAND),
+ my_message(ER_NOT_ALLOWED_COMMAND, ER_THD(thd, ER_NOT_ALLOWED_COMMAND),
MYF(0)); /* purecov: inspected */
goto error;
#else
@@ -3595,7 +3630,7 @@ end_with_restore_list:
{
DBUG_ASSERT(first_table == all_tables && first_table != 0);
#ifdef DONT_ALLOW_SHOW_COMMANDS
- my_message(ER_NOT_ALLOWED_COMMAND, ER(ER_NOT_ALLOWED_COMMAND),
+ my_message(ER_NOT_ALLOWED_COMMAND, ER_THD(thd, ER_NOT_ALLOWED_COMMAND),
MYF(0)); /* purecov: inspected */
goto error;
#else
@@ -4071,7 +4106,7 @@ end_with_restore_list:
/* condition will be TRUE on SP re-excuting */
if (select_lex->item_list.elements != 0)
select_lex->item_list.empty();
- if (add_item_to_list(thd, new Item_null()))
+ if (add_item_to_list(thd, new (thd->mem_root) Item_null(thd)))
goto error;
THD_STAGE_INFO(thd, stage_init);
@@ -4132,6 +4167,9 @@ end_with_restore_list:
}
else
{
+ status_var_decrement(thd->status_var.com_stat[SQLCOM_DROP_TABLE]);
+ status_var_increment(thd->status_var.com_drop_tmp_table);
+
/* So that DROP TEMPORARY TABLE gets to binlog at commit/rollback */
thd->variables.option_bits|= OPTION_KEEP_LOG;
}
@@ -4183,7 +4221,7 @@ end_with_restore_list:
break;
case SQLCOM_SHOW_ENGINE_LOGS:
#ifdef DONT_ALLOW_SHOW_COMMANDS
- my_message(ER_NOT_ALLOWED_COMMAND, ER(ER_NOT_ALLOWED_COMMAND),
+ my_message(ER_NOT_ALLOWED_COMMAND, ER_THD(thd, ER_NOT_ALLOWED_COMMAND),
MYF(0)); /* purecov: inspected */
goto error;
#else
@@ -4216,7 +4254,7 @@ end_with_restore_list:
if (!(thd->client_capabilities & CLIENT_LOCAL_FILES) ||
!opt_local_infile)
{
- my_message(ER_NOT_ALLOWED_COMMAND, ER(ER_NOT_ALLOWED_COMMAND), MYF(0));
+ my_message(ER_NOT_ALLOWED_COMMAND, ER_THD(thd, ER_NOT_ALLOWED_COMMAND), MYF(0));
goto error;
}
}
@@ -4338,7 +4376,7 @@ end_with_restore_list:
if (!rpl_filter->db_ok(lex->name.str) ||
!rpl_filter->db_ok_with_wild_table(lex->name.str))
{
- my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0));
+ my_message(ER_SLAVE_IGNORED_TABLE, ER_THD(thd, ER_SLAVE_IGNORED_TABLE), MYF(0));
break;
}
}
@@ -4373,7 +4411,7 @@ end_with_restore_list:
if (!rpl_filter->db_ok(lex->name.str) ||
!rpl_filter->db_ok_with_wild_table(lex->name.str))
{
- my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0));
+ my_message(ER_SLAVE_IGNORED_TABLE, ER_THD(thd, ER_SLAVE_IGNORED_TABLE), MYF(0));
break;
}
}
@@ -4395,7 +4433,7 @@ end_with_restore_list:
!rpl_filter->db_ok_with_wild_table(db->str))
{
res= 1;
- my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0));
+ my_message(ER_SLAVE_IGNORED_TABLE, ER_THD(thd, ER_SLAVE_IGNORED_TABLE), MYF(0));
break;
}
}
@@ -4440,7 +4478,7 @@ end_with_restore_list:
if (!rpl_filter->db_ok(db->str) ||
!rpl_filter->db_ok_with_wild_table(db->str))
{
- my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0));
+ my_message(ER_SLAVE_IGNORED_TABLE, ER_THD(thd, ER_SLAVE_IGNORED_TABLE), MYF(0));
break;
}
}
@@ -4622,7 +4660,7 @@ end_with_restore_list:
hostname_requires_resolving(user->host.str))
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_HOSTNAME_WONT_WORK,
- ER(ER_WARN_HOSTNAME_WONT_WORK));
+ ER_THD(thd, ER_WARN_HOSTNAME_WONT_WORK));
/*
GRANT/REVOKE PROXY has the target user as a first entry in the list.
@@ -4675,7 +4713,7 @@ end_with_restore_list:
{
if (lex->columns.elements || (lex->type && lex->type != TYPE_ENUM_PROXY))
{
- my_message(ER_ILLEGAL_GRANT_FOR_TABLE, ER(ER_ILLEGAL_GRANT_FOR_TABLE),
+ my_message(ER_ILLEGAL_GRANT_FOR_TABLE, ER_THD(thd, ER_ILLEGAL_GRANT_FOR_TABLE),
MYF(0));
goto error;
}
@@ -4707,6 +4745,7 @@ end_with_restore_list:
case SQLCOM_REVOKE_ROLE:
case SQLCOM_GRANT_ROLE:
{
+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
if (!(res= mysql_grant_role(thd, lex->users_list,
lex->sql_command != SQLCOM_GRANT_ROLE)))
my_ok(thd);
@@ -4739,6 +4778,21 @@ end_with_restore_list:
break;
}
+#ifdef WITH_WSREP
+ if (lex->type & (
+ REFRESH_GRANT |
+ REFRESH_HOSTS |
+ REFRESH_DES_KEY_FILE |
+#ifdef HAVE_QUERY_CACHE
+ REFRESH_QUERY_CACHE_FREE |
+#endif /* HAVE_QUERY_CACHE */
+ REFRESH_STATUS |
+ REFRESH_USER_RESOURCES))
+ {
+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
+ }
+#endif /* WITH_WSREP*/
+
/*
reload_acl_and_cache() will tell us if we are allowed to write to the
binlog or not.
@@ -4785,7 +4839,7 @@ end_with_restore_list:
Item *it= (Item *)lex->value_list.head();
if ((!it->fixed && it->fix_fields(lex->thd, &it)) || it->check_cols(1))
{
- my_message(ER_SET_CONSTANTS_ONLY, ER(ER_SET_CONSTANTS_ONLY),
+ my_message(ER_SET_CONSTANTS_ONLY, ER_THD(thd, ER_SET_CONSTANTS_ONLY),
MYF(0));
goto error;
}
@@ -5084,7 +5138,7 @@ end_with_restore_list:
if (sp_grant_privileges(thd, lex->sphead->m_db.str, name,
lex->sql_command == SQLCOM_CREATE_PROCEDURE))
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_PROC_AUTO_GRANT_FAIL, ER(ER_PROC_AUTO_GRANT_FAIL));
+ ER_PROC_AUTO_GRANT_FAIL, ER_THD(thd, ER_PROC_AUTO_GRANT_FAIL));
thd->clear_error();
}
@@ -5250,7 +5304,7 @@ create_sp_error:
if (lex->if_exists())
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST),
+ ER_SP_DOES_NOT_EXIST, ER_THD(thd, ER_SP_DOES_NOT_EXIST),
"FUNCTION (UDF)", lex->spname->m_name.str);
res= FALSE;
my_ok(thd);
@@ -5305,7 +5359,7 @@ create_sp_error:
{
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
ER_PROC_AUTO_REVOKE_FAIL,
- ER(ER_PROC_AUTO_REVOKE_FAIL));
+ ER_THD(thd, ER_PROC_AUTO_REVOKE_FAIL));
/* If this happens, an error should have been reported. */
goto error;
}
@@ -5321,7 +5375,7 @@ create_sp_error:
{
res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST),
+ ER_SP_DOES_NOT_EXIST, ER_THD(thd, ER_SP_DOES_NOT_EXIST),
SP_COM_STRING(lex), lex->spname->m_qname.str);
if (!res)
my_ok(thd);
@@ -5503,7 +5557,6 @@ create_sp_error:
}
case SQLCOM_CREATE_SERVER:
{
- LEX *lex= thd->lex;
DBUG_PRINT("info", ("case SQLCOM_CREATE_SERVER"));
if (check_global_access(thd, SUPER_ACL))
@@ -5515,7 +5568,6 @@ create_sp_error:
case SQLCOM_ALTER_SERVER:
{
int error;
- LEX *lex= thd->lex;
DBUG_PRINT("info", ("case SQLCOM_ALTER_SERVER"));
if (check_global_access(thd, SUPER_ACL))
@@ -5534,7 +5586,6 @@ create_sp_error:
case SQLCOM_DROP_SERVER:
{
int err_code;
- LEX *lex= thd->lex;
DBUG_PRINT("info", ("case SQLCOM_DROP_SERVER"));
if (check_global_access(thd, SUPER_ACL))
@@ -5713,7 +5764,8 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
SELECT_LEX *param= lex->unit.global_parameters();
if (!param->explicit_limit)
param->select_limit=
- new (thd->mem_root) Item_int((ulonglong) thd->variables.select_limit);
+ new (thd->mem_root) Item_int(thd,
+ (ulonglong) thd->variables.select_limit);
}
if (!(res= open_and_lock_tables(thd, all_tables, TRUE, 0)))
{
@@ -5760,7 +5812,7 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
The warnings system requires input in utf8, @see
mysqld_show_warnings().
*/
- lex->unit.print(&str, QT_TO_SYSTEM_CHARSET);
+ lex->unit.print(&str, QT_EXPLAIN_EXTENDED);
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_YES, str.c_ptr_safe());
}
@@ -5845,8 +5897,8 @@ static bool execute_show_status(THD *thd, TABLE_LIST *all_tables)
}
-static bool execute_rename_table(THD *thd, TABLE_LIST *first_table,
- TABLE_LIST *all_tables)
+static bool check_rename_table(THD *thd, TABLE_LIST *first_table,
+ TABLE_LIST *all_tables)
{
DBUG_ASSERT(first_table == all_tables && first_table != 0);
TABLE_LIST *table;
@@ -5876,7 +5928,7 @@ static bool execute_rename_table(THD *thd, TABLE_LIST *first_table,
return 1;
}
- return mysql_rename_tables(thd, first_table, 0);
+ return 0;
}
@@ -5948,7 +6000,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
{
DBUG_PRINT("error",("No database"));
if (!no_errors)
- my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR),
+ my_message(ER_NO_DB_ERROR, ER_THD(thd, ER_NO_DB_ERROR),
MYF(0)); /* purecov: tested */
DBUG_RETURN(TRUE); /* purecov: tested */
}
@@ -6034,8 +6086,8 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
sctx->priv_user,
sctx->priv_host,
(thd->password ?
- ER(ER_YES) :
- ER(ER_NO))); /* purecov: tested */
+ ER_THD(thd, ER_YES) :
+ ER_THD(thd, ER_NO))); /* purecov: tested */
}
DBUG_RETURN(TRUE); /* purecov: tested */
}
@@ -6678,7 +6730,7 @@ bool check_stack_overrun(THD *thd, long margin,
*/
char* ebuff= new char[MYSQL_ERRMSG_SIZE];
if (ebuff) {
- my_snprintf(ebuff, MYSQL_ERRMSG_SIZE, ER(ER_STACK_OVERRUN_NEED_MORE),
+ my_snprintf(ebuff, MYSQL_ERRMSG_SIZE, ER_THD(thd, ER_STACK_OVERRUN_NEED_MORE),
stack_used, my_thread_stack_size, margin);
my_message(ER_STACK_OVERRUN_NEED_MORE, ebuff, MYF(ME_FATALERROR));
delete [] ebuff;
@@ -6813,6 +6865,8 @@ void THD::reset_for_next_command()
thd->reset_current_stmt_binlog_format_row();
thd->binlog_unsafe_warning_flags= 0;
+ thd->save_prep_leaf_list= false;
+
DBUG_PRINT("debug",
("is_current_stmt_binlog_format_row(): %d",
thd->is_current_stmt_binlog_format_row()));
@@ -7185,7 +7239,7 @@ void mysql_parse(THD *thd, char *rawbuf, uint length,
DBUG_PRINT("info",("Command aborted. Fatal_error: %d",
thd->is_fatal_error));
- query_cache_abort(&thd->query_cache_tls);
+ query_cache_abort(thd, &thd->query_cache_tls);
}
THD_STAGE_INFO(thd, stage_freeing_items);
sp_cache_enforce_limit(thd->sp_proc_cache, stored_program_cache_size);
@@ -7346,7 +7400,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
if (table->sel)
{
my_message(ER_DERIVED_MUST_HAVE_ALIAS,
- ER(ER_DERIVED_MUST_HAVE_ALIAS), MYF(0));
+ ER_THD(thd, ER_DERIVED_MUST_HAVE_ALIAS), MYF(0));
DBUG_RETURN(0);
}
if (!(alias_str= (char*) thd->memdup(alias_str,table->table.length+1)))
@@ -7516,7 +7570,7 @@ bool st_select_lex::init_nested_join(THD *thd)
nested_join= ptr->nested_join=
((NESTED_JOIN*) ((uchar*) ptr + ALIGN_SIZE(sizeof(TABLE_LIST))));
- join_list->push_front(ptr);
+ join_list->push_front(ptr, thd->mem_root);
ptr->embedding= embedding;
ptr->join_list= join_list;
ptr->alias= (char*) "(nested_join)";
@@ -7558,7 +7612,7 @@ TABLE_LIST *st_select_lex::end_nested_join(THD *thd)
join_list->pop();
embedded->join_list= join_list;
embedded->embedding= embedding;
- join_list->push_front(embedded);
+ join_list->push_front(embedded, thd->mem_root);
ptr= embedded;
embedded->lifted= 1;
}
@@ -7622,7 +7676,7 @@ TABLE_LIST *st_select_lex::nest_last_join(THD *thd)
ptr->join_using_fields= prev_join_using;
}
}
- join_list->push_front(ptr);
+ join_list->push_front(ptr, thd->mem_root);
nested_join->used_tables= nested_join->not_null_tables= (table_map) 0;
DBUG_RETURN(ptr);
}
@@ -7689,8 +7743,8 @@ TABLE_LIST *st_select_lex::convert_right_join()
TABLE_LIST *tab1= join_list->pop();
DBUG_ENTER("convert_right_join");
- join_list->push_front(tab2);
- join_list->push_front(tab1);
+ join_list->push_front(tab2, parent_lex->thd->mem_root);
+ join_list->push_front(tab1, parent_lex->thd->mem_root);
tab1->outer_join|= JOIN_TYPE_RIGHT;
DBUG_RETURN(tab1);
@@ -7835,14 +7889,14 @@ push_new_name_resolution_context(THD *thd,
@return fixed condition
*/
-Item *normalize_cond(Item *cond)
+Item *normalize_cond(THD *thd, Item *cond)
{
if (cond)
{
Item::Type type= cond->type();
if (type == Item::FIELD_ITEM || type == Item::REF_ITEM)
{
- cond= new Item_func_ne(cond, new Item_int(0));
+ cond= new (thd->mem_root) Item_func_ne(thd, cond, new (thd->mem_root) Item_int(thd, 0));
}
}
return cond;
@@ -7863,11 +7917,11 @@ Item *normalize_cond(Item *cond)
TRUE if all is OK
*/
-void add_join_on(TABLE_LIST *b, Item *expr)
+void add_join_on(THD *thd, TABLE_LIST *b, Item *expr)
{
if (expr)
{
- expr= normalize_cond(expr);
+ expr= normalize_cond(thd, expr);
if (!b->on_expr)
b->on_expr= expr;
else
@@ -7877,7 +7931,7 @@ void add_join_on(TABLE_LIST *b, Item *expr)
right and left join. If called later, it happens if we add more
than one condition to the ON clause.
*/
- b->on_expr= new Item_cond_and(b->on_expr,expr);
+ b->on_expr= new (thd->mem_root) Item_cond_and(thd, b->on_expr,expr);
}
b->on_expr->top_level_item();
}
@@ -8006,7 +8060,8 @@ kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type typ
error=0;
}
else
- error=ER_KILL_DENIED_ERROR;
+ error= (type == KILL_TYPE_QUERY ? ER_KILL_QUERY_DENIED_ERROR :
+ ER_KILL_DENIED_ERROR);
mysql_mutex_unlock(&tmp->LOCK_thd_data);
}
DBUG_PRINT("exit", ("%d", error));
@@ -8071,9 +8126,9 @@ static uint kill_threads_for_user(THD *thd, LEX_USER *user,
mysql_mutex_unlock(&LOCK_thread_count);
if (!threads_to_kill.is_empty())
{
- List_iterator_fast<THD> it(threads_to_kill);
+ List_iterator_fast<THD> it2(threads_to_kill);
THD *next_ptr;
- THD *ptr= it++;
+ THD *ptr= it2++;
do
{
ptr->awake(kill_signal);
@@ -8085,7 +8140,7 @@ static uint kill_threads_for_user(THD *thd, LEX_USER *user,
Since the operation "it++" dereferences the "next" pointer of the
previous list node, we need to do this while holding LOCK_thd_data.
*/
- next_ptr= it++;
+ next_ptr= it2++;
mysql_mutex_unlock(&ptr->LOCK_thd_data);
(*rows)++;
} while ((ptr= next_ptr));
@@ -8246,16 +8301,17 @@ Item * all_any_subquery_creator(THD *thd, Item *left_expr,
return new (thd->mem_root) Item_in_subselect(thd, left_expr, select_lex);
if ((cmp == &comp_ne_creator) && all) // <> ALL <=> NOT IN
- return new (thd->mem_root) Item_func_not(
+ return new (thd->mem_root) Item_func_not(thd,
new (thd->mem_root) Item_in_subselect(thd, left_expr, select_lex));
Item_allany_subselect *it=
new (thd->mem_root) Item_allany_subselect(thd, left_expr, cmp, select_lex,
all);
- if (all)
- return it->upper_item= new (thd->mem_root) Item_func_not_all(it); /* ALL */
+ if (all) /* ALL */
+ return it->upper_item= new (thd->mem_root) Item_func_not_all(thd, it);
- return it->upper_item= new (thd->mem_root) Item_func_nop_all(it); /* ANY/SOME */
+ /* ANY/SOME */
+ return it->upper_item= new (thd->mem_root) Item_func_nop_all(thd, it);
}
@@ -8281,7 +8337,7 @@ bool multi_update_precheck(THD *thd, TABLE_LIST *tables)
if (select_lex->item_list.elements != lex->value_list.elements)
{
- my_message(ER_WRONG_VALUE_COUNT, ER(ER_WRONG_VALUE_COUNT), MYF(0));
+ my_message(ER_WRONG_VALUE_COUNT, ER_THD(thd, ER_WRONG_VALUE_COUNT), MYF(0));
DBUG_RETURN(TRUE);
}
/*
@@ -8290,6 +8346,8 @@ bool multi_update_precheck(THD *thd, TABLE_LIST *tables)
*/
for (table= tables; table; table= table->next_local)
{
+ if (table->is_jtbm())
+ continue;
if (table->derived)
table->grant.privilege= SELECT_ACL;
else if ((check_access(thd, UPDATE_ACL, table->db,
@@ -8392,7 +8450,7 @@ bool multi_delete_precheck(THD *thd, TABLE_LIST *tables)
if ((thd->variables.option_bits & OPTION_SAFE_UPDATES) && !select_lex->where)
{
my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE,
- ER(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE), MYF(0));
+ ER_THD(thd, ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE), MYF(0));
DBUG_RETURN(TRUE);
}
DBUG_RETURN(FALSE);
@@ -8517,7 +8575,7 @@ bool update_precheck(THD *thd, TABLE_LIST *tables)
DBUG_ENTER("update_precheck");
if (thd->lex->select_lex.item_list.elements != thd->lex->value_list.elements)
{
- my_message(ER_WRONG_VALUE_COUNT, ER(ER_WRONG_VALUE_COUNT), MYF(0));
+ my_message(ER_WRONG_VALUE_COUNT, ER_THD(thd, ER_WRONG_VALUE_COUNT), MYF(0));
DBUG_RETURN(TRUE);
}
DBUG_RETURN(check_one_table_access(thd, UPDATE_ACL, tables));
@@ -8577,7 +8635,7 @@ bool insert_precheck(THD *thd, TABLE_LIST *tables)
if (lex->update_list.elements != lex->value_list.elements)
{
- my_message(ER_WRONG_VALUE_COUNT, ER(ER_WRONG_VALUE_COUNT), MYF(0));
+ my_message(ER_WRONG_VALUE_COUNT, ER_THD(thd, ER_WRONG_VALUE_COUNT), MYF(0));
DBUG_RETURN(TRUE);
}
DBUG_RETURN(FALSE);
@@ -8783,12 +8841,12 @@ Item *negate_expression(THD *thd, Item *expr)
if it is not boolean function then we have to emulate value of
not(not(a)), it will be a != 0
*/
- return new Item_func_ne(arg, new Item_int((char*) "0", 0, 1));
+ return new (thd->mem_root) Item_func_ne(thd, arg, new (thd->mem_root) Item_int(thd, (char*) "0", 0, 1));
}
if ((negated= expr->neg_transformer(thd)) != 0)
return negated;
- return new Item_func_not(expr);
+ return new (thd->mem_root) Item_func_not(thd, expr);
}
/**
@@ -8886,7 +8944,8 @@ LEX_USER *create_definer(THD *thd, LEX_STRING *user_name, LEX_STRING *host_name)
Check that byte length of a string does not exceed some limit.
@param str string to be checked
- @param err_msg error message to be displayed if the string is too long
+ @param err_msg Number of error message to be displayed if the string
+ is too long. 0 if empty error message.
@param max_length max length
@retval
@@ -8898,13 +8957,14 @@ LEX_USER *create_definer(THD *thd, LEX_STRING *user_name, LEX_STRING *host_name)
The function is not used in existing code but can be useful later?
*/
-bool check_string_byte_length(LEX_STRING *str, const char *err_msg,
+bool check_string_byte_length(LEX_STRING *str, uint err_msg,
uint max_byte_length)
{
if (str->length <= max_byte_length)
return FALSE;
- my_error(ER_WRONG_STRING_LENGTH, MYF(0), str->str, err_msg, max_byte_length);
+ my_error(ER_WRONG_STRING_LENGTH, MYF(0), str->str,
+ err_msg ? ER(err_msg) : "", max_byte_length);
return TRUE;
}
@@ -8916,7 +8976,8 @@ bool check_string_byte_length(LEX_STRING *str, const char *err_msg,
SYNOPSIS
check_string_char_length()
str string to be checked
- err_msg error message to be displayed if the string is too long
+ err_msg Number of error message to be displayed if the string
+ is too long. 0 if empty error message.
max_char_length max length in symbols
cs string charset
@@ -8926,7 +8987,7 @@ bool check_string_byte_length(LEX_STRING *str, const char *err_msg,
*/
-bool check_string_char_length(LEX_STRING *str, const char *err_msg,
+bool check_string_char_length(LEX_STRING *str, uint err_msg,
uint max_char_length, CHARSET_INFO *cs,
bool no_error)
{
@@ -8934,13 +8995,15 @@ bool check_string_char_length(LEX_STRING *str, const char *err_msg,
uint res= cs->cset->well_formed_len(cs, str->str, str->str + str->length,
max_char_length, &well_formed_error);
- if (!well_formed_error && str->length == res)
+ if (!well_formed_error && str->length == res)
return FALSE;
if (!no_error)
{
ErrConvString err(str->str, str->length, cs);
- my_error(ER_WRONG_STRING_LENGTH, MYF(0), err.ptr(), err_msg, max_char_length);
+ my_error(ER_WRONG_STRING_LENGTH, MYF(0), err.ptr(),
+ err_msg ? ER(err_msg) : "",
+ max_char_length);
}
return TRUE;
}
@@ -9048,7 +9111,7 @@ bool check_host_name(LEX_STRING *str)
{
const char *name= str->str;
const char *end= str->str + str->length;
- if (check_string_byte_length(str, ER(ER_HOSTNAME), HOSTNAME_LENGTH))
+ if (check_string_byte_length(str, ER_HOSTNAME, HOSTNAME_LENGTH))
return TRUE;
while (name != end)
diff --git a/sql/sql_parse.h b/sql/sql_parse.h
index 76e1b7a797a..c3c47567cf5 100644
--- a/sql/sql_parse.h
+++ b/sql/sql_parse.h
@@ -70,9 +70,9 @@ LEX_USER *create_default_definer(THD *thd, bool role);
LEX_USER *create_definer(THD *thd, LEX_STRING *user_name, LEX_STRING *host_name);
LEX_USER *get_current_user(THD *thd, LEX_USER *user, bool lock=true);
bool sp_process_definer(THD *thd);
-bool check_string_byte_length(LEX_STRING *str, const char *err_msg,
+bool check_string_byte_length(LEX_STRING *str, uint err_msg,
uint max_byte_length);
-bool check_string_char_length(LEX_STRING *str, const char *err_msg,
+bool check_string_char_length(LEX_STRING *str, uint err_msg,
uint max_char_length, CHARSET_INFO *cs,
bool no_error);
CHARSET_INFO* merge_charset_and_collation(CHARSET_INFO *cs, CHARSET_INFO *cl);
@@ -108,7 +108,7 @@ bool append_file_to_dir(THD *thd, const char **filename_ptr,
void execute_init_command(THD *thd, LEX_STRING *init_command,
mysql_rwlock_t *var_lock);
bool add_to_list(THD *thd, SQL_I_List<ORDER> &list, Item *group, bool asc);
-void add_join_on(TABLE_LIST *b,Item *expr);
+void add_join_on(THD *thd, TABLE_LIST *b, Item *expr);
void add_join_natural(TABLE_LIST *a,TABLE_LIST *b,List<String> *using_fields,
SELECT_LEX *lex);
bool add_proc_to_list(THD *thd, Item *item);
@@ -118,7 +118,7 @@ bool push_new_name_resolution_context(THD *thd,
void store_position_for_column(const char *name);
void init_update_queries(void);
bool check_simple_select();
-Item *normalize_cond(Item *cond);
+Item *normalize_cond(THD *thd, Item *cond);
Item *negate_expression(THD *thd, Item *expr);
bool check_stack_overrun(THD *thd, long margin, uchar *dummy);
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 703ae52dc12..8e77d77205c 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -202,7 +202,7 @@ Item* convert_charset_partition_constant(Item *item, CHARSET_INFO *cs)
TABLE_LIST *save_list= context->table_list;
const char *save_where= thd->where;
- item= item->safe_charset_converter(cs);
+ item= item->safe_charset_converter(thd, cs);
context->table_list= NULL;
thd->where= "convert character set partition constant";
if (!item || item->fix_fields(thd, (Item**)NULL))
@@ -1030,7 +1030,7 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
else
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR,
- ER(ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR));
+ ER_THD(thd, ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR));
}
if ((!is_sub_part) && (error= check_signed_flag(part_info)))
@@ -1756,7 +1756,7 @@ bool fix_partition_func(THD *thd, TABLE *table,
goto end;
if (unlikely(set_up_partition_bitmaps(thd, part_info)))
goto end;
- if (unlikely(part_info->set_up_charset_field_preps()))
+ if (unlikely(part_info->set_up_charset_field_preps(thd)))
{
my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
goto end;
@@ -2653,8 +2653,7 @@ char *generate_partition_syntax(partition_info *part_info,
{
if (!use_sql_alloc)
my_free(buf);
- else
- buf= NULL;
+ buf= NULL;
}
else
buf[*buf_length]= 0;
@@ -4485,7 +4484,7 @@ static int fast_end_partition(THD *thd, ulonglong copied,
query_cache_invalidate3(thd, table_list, 0);
- my_snprintf(tmp_name, sizeof(tmp_name), ER(ER_INSERT_INFO),
+ my_snprintf(tmp_name, sizeof(tmp_name), ER_THD(thd, ER_INSERT_INFO),
(ulong) (copied + deleted),
(ulong) deleted,
(ulong) 0);
@@ -4724,7 +4723,7 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
thd->work_part_info= thd->lex->part_info;
if (thd->work_part_info &&
- !(thd->work_part_info= thd->lex->part_info->get_clone()))
+ !(thd->work_part_info= thd->lex->part_info->get_clone(thd)))
DBUG_RETURN(TRUE);
/* ALTER_ADMIN_PARTITION is handled in mysql_admin_table */
@@ -4804,7 +4803,7 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
Create copy of partition_info to avoid modifying original
TABLE::part_info, to keep it safe for later use.
*/
- if (!(tab_part_info= tab_part_info->get_clone()))
+ if (!(tab_part_info= tab_part_info->get_clone(thd)))
DBUG_RETURN(TRUE);
}
@@ -4855,7 +4854,7 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
we read data from old version of table using this TABLE object
while copying them to new version of table.
*/
- if (!(tab_part_info= tab_part_info->get_clone()))
+ if (!(tab_part_info= tab_part_info->get_clone(thd)))
DBUG_RETURN(TRUE);
}
DBUG_PRINT("info", ("*fast_alter_table flags: 0x%x", flags));
@@ -5152,7 +5151,7 @@ that are reorganised.
partition_element *part_elem= alt_it++;
if (*fast_alter_table)
part_elem->part_state= PART_TO_BE_ADDED;
- if (tab_part_info->partitions.push_back(part_elem))
+ if (tab_part_info->partitions.push_back(part_elem, thd->mem_root))
{
mem_alloc_error(1);
goto err;
@@ -5459,7 +5458,8 @@ the generated partition syntax in a correct manner.
else
tab_max_range= part_elem->range_value;
if (*fast_alter_table &&
- tab_part_info->temp_partitions.push_back(part_elem))
+ tab_part_info->temp_partitions.push_back(part_elem,
+ thd->mem_root))
{
mem_alloc_error(1);
goto err;
@@ -5643,7 +5643,7 @@ the generated partition syntax in a correct manner.
Create a copy of TABLE::part_info to be able to modify it freely.
*/
- if (!(tab_part_info= tab_part_info->get_clone()))
+ if (!(tab_part_info= tab_part_info->get_clone(thd)))
DBUG_RETURN(TRUE);
thd->work_part_info= tab_part_info;
if (create_info->used_fields & HA_CREATE_USED_ENGINE &&
@@ -6634,7 +6634,7 @@ void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt,
}
}
/* Ensure the share is destroyed and reopened. */
- part_info= lpt->part_info->get_clone();
+ part_info= lpt->part_info->get_clone(thd);
close_all_tables_for_name(thd, table->s, HA_EXTRA_NOT_USED, NULL);
}
else
@@ -6652,7 +6652,7 @@ err_exclusive_lock:
the table cache.
*/
mysql_lock_remove(thd, thd->lock, table);
- part_info= lpt->part_info->get_clone();
+ part_info= lpt->part_info->get_clone(thd);
close_thread_table(thd, &thd->open_tables);
lpt->table_list->table= NULL;
}
diff --git a/sql/sql_partition.h b/sql/sql_partition.h
index ff6596fffaa..b560c53562d 100644
--- a/sql/sql_partition.h
+++ b/sql/sql_partition.h
@@ -16,7 +16,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
diff --git a/sql/sql_partition_admin.cc b/sql/sql_partition_admin.cc
index 8755ec47c54..e237fb1ad00 100644
--- a/sql/sql_partition_admin.cc
+++ b/sql/sql_partition_admin.cc
@@ -531,6 +531,24 @@ bool Sql_cmd_alter_table_exchange_partition::
&alter_prelocking_strategy))
DBUG_RETURN(true);
+#ifdef WITH_WSREP
+ if (WSREP_ON)
+ {
+ /* Forward declaration */
+ TABLE *find_temporary_table(THD *thd, const TABLE_LIST *tl);
+
+ if ((!thd->is_current_stmt_binlog_format_row() ||
+ /* TODO: Do we really need to check for temp tables in this case? */
+ !find_temporary_table(thd, table_list)) &&
+ wsrep_to_isolation_begin(thd, table_list->db, table_list->table_name,
+ NULL))
+ {
+ WSREP_WARN("ALTER TABLE EXCHANGE PARTITION isolation failure");
+ DBUG_RETURN(TRUE);
+ }
+ }
+#endif /* WITH_WSREP */
+
part_table= table_list->table;
swap_table= swap_table_list->table;
@@ -767,6 +785,7 @@ bool Sql_cmd_alter_table_truncate_partition::execute(THD *thd)
#ifdef WITH_WSREP
if (WSREP_ON)
{
+ /* Forward declaration */
TABLE *find_temporary_table(THD *thd, const TABLE_LIST *tl);
if ((!thd->is_current_stmt_binlog_format_row() ||
@@ -775,7 +794,7 @@ bool Sql_cmd_alter_table_truncate_partition::execute(THD *thd)
thd, first_table->db, first_table->table_name, NULL)
)
{
- WSREP_WARN("ALTER TABLE isolation failure");
+ WSREP_WARN("ALTER TABLE TRUNCATE PARTITION isolation failure");
DBUG_RETURN(TRUE);
}
}
@@ -805,7 +824,7 @@ bool Sql_cmd_alter_table_truncate_partition::execute(THD *thd)
String(partition_name, system_charset_info);
if (!str_partition_name)
DBUG_RETURN(true);
- partition_names_list.push_back(str_partition_name);
+ partition_names_list.push_back(str_partition_name, thd->mem_root);
}
first_table->partition_names= &partition_names_list;
if (first_table->table->part_info->set_partition_bitmaps(first_table))
@@ -837,9 +856,16 @@ bool Sql_cmd_alter_table_truncate_partition::execute(THD *thd)
log. The exception is a unimplemented truncate method or failure
before any call to handler::truncate() is done.
Also, it is logged in statement format, regardless of the binlog format.
+
+ Since we've changed data within the table, we also have to invalidate
+ the query cache for it.
*/
- if (error != HA_ERR_WRONG_COMMAND && binlog_stmt)
- error|= write_bin_log(thd, !error, thd->query(), thd->query_length());
+ if (error != HA_ERR_WRONG_COMMAND)
+ {
+ query_cache_invalidate3(thd, first_table, FALSE);
+ if (binlog_stmt)
+ error|= write_bin_log(thd, !error, thd->query(), thd->query_length());
+ }
/*
A locked table ticket was upgraded to a exclusive lock. After the
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 847669d84ea..6d8268efe86 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -215,7 +215,7 @@ static struct
/* support for Services */
-#include "sql_plugin_services.h"
+#include "sql_plugin_services.ic"
/*
A mutex LOCK_plugin must be acquired before accessing the
@@ -738,7 +738,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
plugin directory are used (to make this even remotely secure).
*/
if (check_valid_path(dl->str, dl->length) ||
- check_string_char_length((LEX_STRING *) dl, "", NAME_CHAR_LEN,
+ check_string_char_length((LEX_STRING *) dl, 0, NAME_CHAR_LEN,
system_charset_info, 1) ||
plugin_dir_len + dl->length + 1 >= FN_REFLEN)
{
@@ -1077,7 +1077,7 @@ static bool plugin_add(MEM_ROOT *tmp_root,
if (name->str && plugin_find_internal(name, MYSQL_ANY_PLUGIN))
{
- report_error(report, ER_UDF_EXISTS, name->str);
+ report_error(report, ER_PLUGIN_INSTALLED, name->str);
DBUG_RETURN(TRUE);
}
/* Clear the whole struct to catch future extensions. */
@@ -1252,7 +1252,7 @@ static void plugin_del(struct st_plugin_int *plugin)
static void reap_plugins(void)
{
- uint count, idx;
+ uint count;
struct st_plugin_int *plugin, **reap, **list;
mysql_mutex_assert_owner(&LOCK_plugin);
@@ -1265,14 +1265,18 @@ static void reap_plugins(void)
reap= (struct st_plugin_int **)my_alloca(sizeof(plugin)*(count+1));
*(reap++)= NULL;
- for (idx= 0; idx < count; idx++)
+ for (uint i=0; i < MYSQL_MAX_PLUGIN_TYPE_NUM; i++)
{
- plugin= *dynamic_element(&plugin_array, idx, struct st_plugin_int **);
- if (plugin->state == PLUGIN_IS_DELETED && !plugin->ref_count)
+ HASH *hash= plugin_hash + plugin_type_initialization_order[i];
+ for (uint j= 0; j < hash->records; j++)
{
- /* change the status flag to prevent reaping by another thread */
- plugin->state= PLUGIN_IS_DYING;
- *(reap++)= plugin;
+ plugin= (struct st_plugin_int *) my_hash_element(hash, j);
+ if (plugin->state == PLUGIN_IS_DELETED && !plugin->ref_count)
+ {
+ /* change the status flag to prevent reaping by another thread */
+ plugin->state= PLUGIN_IS_DYING;
+ *(reap++)= plugin;
+ }
}
}
@@ -1573,6 +1577,9 @@ int plugin_init(int *argc, char **argv, int flags)
/*
First we register builtin plugins
*/
+ if (global_system_variables.log_warnings >= 9)
+ sql_print_information("Initializing built-in plugins");
+
for (builtins= mysql_mandatory_plugins; *builtins || mandatory; builtins++)
{
if (!*builtins)
@@ -1636,6 +1643,8 @@ int plugin_init(int *argc, char **argv, int flags)
{
I_List_iterator<i_string> iter(opt_plugin_load_list);
i_string *item;
+ if (global_system_variables.log_warnings >= 9)
+ sql_print_information("Initializing plugins specified on the command line");
while (NULL != (item= iter++))
plugin_load_list(&tmp_root, item->ptr);
@@ -1759,6 +1768,9 @@ static void plugin_load(MEM_ROOT *tmp_root)
bool result;
DBUG_ENTER("plugin_load");
+ if (global_system_variables.log_warnings >= 9)
+ sql_print_information("Initializing installed plugins");
+
new_thd->thread_stack= (char*) &tables;
new_thd->store_globals();
new_thd->db= my_strdup("mysql", MYF(0));
@@ -1807,14 +1819,13 @@ static void plugin_load(MEM_ROOT *tmp_root)
the mutex here to satisfy the assert
*/
mysql_mutex_lock(&LOCK_plugin);
- if (plugin_add(tmp_root, &name, &dl, REPORT_TO_LOG))
- sql_print_warning("Couldn't load plugin named '%s' with soname '%s'.",
- str_name.c_ptr(), str_dl.c_ptr());
+ plugin_add(tmp_root, &name, &dl, REPORT_TO_LOG);
free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE));
mysql_mutex_unlock(&LOCK_plugin);
}
if (error > 0)
- sql_print_error(ER(ER_GET_ERRNO), my_errno, table->file->table_type());
+ sql_print_error(ER_THD(new_thd, ER_GET_ERRNO), my_errno,
+ table->file->table_type());
end_read_record(&read_record_info);
table->m_needs_reopen= TRUE; // Force close to free memory
close_mysql_tables(new_thd);
@@ -2065,7 +2076,8 @@ static bool finalize_install(THD *thd, TABLE *table, const LEX_STRING *name,
{
if (global_system_variables.log_warnings)
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_CANT_INITIALIZE_UDF, ER(ER_CANT_INITIALIZE_UDF),
+ ER_CANT_INITIALIZE_UDF,
+ ER_THD(thd, ER_CANT_INITIALIZE_UDF),
name->str, "Plugin is disabled");
}
@@ -2198,7 +2210,7 @@ static bool do_uninstall(THD *thd, TABLE *table, const LEX_STRING *name)
plugin->state= PLUGIN_IS_DELETED;
if (plugin->ref_count)
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
- WARN_PLUGIN_BUSY, ER(WARN_PLUGIN_BUSY));
+ WARN_PLUGIN_BUSY, ER_THD(thd, WARN_PLUGIN_BUSY));
else
reap_needed= true;
@@ -3359,9 +3371,9 @@ bool sys_var_pluginvar::session_is_default(THD *thd)
}
case PLUGIN_VAR_DOUBLE:
return getopt_ulonglong2double(option.def_value) == *(double*)value;
- default:
- DBUG_ASSERT(0);
}
+ DBUG_ASSERT(0);
+ return 0;
}
diff --git a/sql/sql_plugin_services.h b/sql/sql_plugin_services.ic
index 4bb1861281e..0570e2fcdd9 100644
--- a/sql/sql_plugin_services.h
+++ b/sql/sql_plugin_services.ic
@@ -105,6 +105,7 @@ static struct wsrep_service_st wsrep_handler = {
get_wsrep_certify_nonPK,
get_wsrep_debug,
get_wsrep_drupal_282555_workaround,
+ get_wsrep_recovery,
get_wsrep_load_data_splitting,
get_wsrep_log_conflicts,
get_wsrep_protocol_version,
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index ea16b862b11..2b37cb172aa 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -1542,7 +1542,7 @@ static int mysql_test_select(Prepared_statement *stmt,
List<Item> fields(lex->select_lex.item_list);
/* Change columns if a procedure like analyse() */
- if (unit->last_procedure && unit->last_procedure->change_columns(fields))
+ if (unit->last_procedure && unit->last_procedure->change_columns(thd, fields))
goto error;
/*
@@ -1897,14 +1897,17 @@ static bool mysql_test_multiupdate(Prepared_statement *stmt,
static bool mysql_test_multidelete(Prepared_statement *stmt,
TABLE_LIST *tables)
{
- stmt->thd->lex->current_select= &stmt->thd->lex->select_lex;
- if (add_item_to_list(stmt->thd, new Item_null()))
+ THD *thd= stmt->thd;
+
+ thd->lex->current_select= &thd->lex->select_lex;
+ if (add_item_to_list(thd, new (thd->mem_root)
+ Item_null(thd)))
{
my_error(ER_OUTOFMEMORY, MYF(ME_FATALERROR), 0);
goto error;
}
- if (multi_delete_precheck(stmt->thd, tables) ||
+ if (multi_delete_precheck(thd, tables) ||
select_like_stmt_test_with_open(stmt, tables,
&mysql_multi_delete_prepare,
OPTION_SETUP_TABLES_DONE))
@@ -2144,7 +2147,7 @@ static bool check_prepared_statement(Prepared_statement *stmt)
case SQLCOM_CREATE_VIEW:
if (lex->create_view_mode == VIEW_ALTER)
{
- my_message(ER_UNSUPPORTED_PS, ER(ER_UNSUPPORTED_PS), MYF(0));
+ my_message(ER_UNSUPPORTED_PS, ER_THD(thd, ER_UNSUPPORTED_PS), MYF(0));
goto error;
}
res= mysql_test_create_view(stmt);
@@ -2227,7 +2230,7 @@ static bool check_prepared_statement(Prepared_statement *stmt)
if (!(sql_command_flags[sql_command] & CF_STATUS_COMMAND))
{
/* All other statements are not supported yet. */
- my_message(ER_UNSUPPORTED_PS, ER(ER_UNSUPPORTED_PS), MYF(0));
+ my_message(ER_UNSUPPORTED_PS, ER_THD(thd, ER_UNSUPPORTED_PS), MYF(0));
goto error;
}
break;
@@ -2253,7 +2256,8 @@ static bool init_param_array(Prepared_statement *stmt)
if (stmt->param_count > (uint) UINT_MAX16)
{
/* Error code to be defined in 5.0 */
- my_message(ER_PS_MANY_PARAM, ER(ER_PS_MANY_PARAM), MYF(0));
+ my_message(ER_PS_MANY_PARAM, ER_THD(stmt->thd, ER_PS_MANY_PARAM),
+ MYF(0));
return TRUE;
}
Item_param **to;
@@ -2999,7 +3003,7 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
/* Error will be sent in execute call */
stmt->state= Query_arena::STMT_ERROR;
stmt->last_errno= ER_WRONG_ARGUMENTS;
- sprintf(stmt->last_error, ER(ER_WRONG_ARGUMENTS),
+ sprintf(stmt->last_error, ER_THD(thd, ER_WRONG_ARGUMENTS),
"mysqld_stmt_send_long_data");
DBUG_VOID_RETURN;
}
@@ -3368,7 +3372,7 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
DBUG_RETURN(TRUE);
/*
- alloc_query() uses thd->memroot && thd->query, so we should call
+ alloc_query() uses thd->mem_root && thd->query, so we should call
both of backup_statement() and backup_query_arena() here.
*/
thd->set_n_backup_statement(this, &stmt_backup);
diff --git a/sql/sql_priv.h b/sql/sql_priv.h
index 7ba027d2380..4d62f72f571 100644
--- a/sql/sql_priv.h
+++ b/sql/sql_priv.h
@@ -51,9 +51,9 @@
compile_time_assert(MYSQL_VERSION_ID < VerHi * 10000 + VerLo * 100); \
if (((THD *) Thd) != NULL) \
push_warning_printf(((THD *) Thd), Sql_condition::WARN_LEVEL_WARN, \
- ER_WARN_DEPRECATED_SYNTAX, \
- ER(ER_WARN_DEPRECATED_SYNTAX), \
- (Old), (New)); \
+ ER_WARN_DEPRECATED_SYNTAX, \
+ ER_THD(((THD *) Thd), ER_WARN_DEPRECATED_SYNTAX), \
+ (Old), (New)); \
else \
sql_print_warning("The syntax '%s' is deprecated and will be removed " \
"in a future release. Please use %s instead.", \
@@ -77,11 +77,12 @@
#define WARN_DEPRECATED_NO_REPLACEMENT(Thd,Old) \
do { \
- if (((THD *) Thd) != NULL) \
- push_warning_printf(((THD *) Thd), Sql_condition::WARN_LEVEL_WARN, \
- ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT, \
- ER(ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT), \
- (Old)); \
+ THD *thd_= ((THD*) Thd); \
+ if (thd_ != NULL) \
+ push_warning_printf(thd_, Sql_condition::WARN_LEVEL_WARN, \
+ ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT, \
+ ER_THD(thd_, ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT), \
+ (Old)); \
else \
sql_print_warning("'%s' is deprecated and will be removed " \
"in a future release.", (Old)); \
diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc
index 9fa4d646fa1..bc11f5fdb21 100644
--- a/sql/sql_profile.cc
+++ b/sql/sql_profile.cc
@@ -121,7 +121,7 @@ int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table)
continue;
field_info= &schema_table->fields_info[i];
- Item_field *field= new Item_field(context,
+ Item_field *field= new (thd->mem_root) Item_field(thd, context,
NullS, NullS, field_info->field_name);
if (field)
{
@@ -386,28 +386,35 @@ void PROFILING::finish_current_query_impl()
bool PROFILING::show_profiles()
{
- DBUG_ENTER("PROFILING::show_profiles");
QUERY_PROFILE *prof;
List<Item> field_list;
-
- field_list.push_back(new Item_return_int("Query_ID", 10,
- MYSQL_TYPE_LONG));
- field_list.push_back(new Item_return_int("Duration", TIME_FLOAT_DIGITS-1,
- MYSQL_TYPE_DOUBLE));
- field_list.push_back(new Item_empty_string("Query", 40));
-
- if (thd->protocol->send_result_set_metadata(&field_list,
- Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
- DBUG_RETURN(TRUE);
-
+ MEM_ROOT *mem_root= thd->mem_root;
SELECT_LEX *sel= &thd->lex->select_lex;
SELECT_LEX_UNIT *unit= &thd->lex->unit;
ha_rows idx= 0;
Protocol *protocol= thd->protocol;
+ void *iterator;
+ DBUG_ENTER("PROFILING::show_profiles");
+
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Query_ID", 10,
+ MYSQL_TYPE_LONG),
+ mem_root);
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Duration",
+ TIME_FLOAT_DIGITS - 1,
+ MYSQL_TYPE_DOUBLE),
+ mem_root);
+ field_list.push_back(new (mem_root) Item_empty_string(thd, "Query", 40),
+ mem_root);
+
+ if (protocol->send_result_set_metadata(&field_list,
+ Protocol::SEND_NUM_ROWS |
+ Protocol::SEND_EOF))
+ DBUG_RETURN(TRUE);
unit->set_limit(sel);
- void *iterator;
for (iterator= history.new_iterator();
iterator != NULL;
iterator= history.iterator_next(iterator))
diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc
index 6fc0e0024af..e6c8e0777b8 100644
--- a/sql/sql_reload.cc
+++ b/sql/sql_reload.cc
@@ -334,7 +334,7 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
{
DBUG_ASSERT(thd);
tmp_write_to_binlog= 0;
- if (reset_master(thd, NULL, 0))
+ if (reset_master(thd, NULL, 0, thd->lex->next_binlog_file_number))
{
/* NOTE: my_error() has been already called by reset_master(). */
result= 1;
diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc
index 2c17898f07c..d9cf0344cdf 100644
--- a/sql/sql_rename.cc
+++ b/sql/sql_rename.cc
@@ -62,7 +62,7 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent)
if (thd->locked_tables_mode || thd->in_active_multi_stmt_transaction())
{
my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
- ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
+ ER_THD(thd, ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
DBUG_RETURN(1);
}
@@ -238,7 +238,6 @@ do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db, char *new_table_name,
{
int rc= 1;
handlerton *hton;
- bool new_exists, old_exists;
const char *new_alias, *old_alias;
DBUG_ENTER("do_rename");
@@ -254,17 +253,13 @@ do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db, char *new_table_name,
}
DBUG_ASSERT(new_alias);
- new_exists= ha_table_exists(thd, new_db, new_alias);
-
- if (new_exists)
+ if (ha_table_exists(thd, new_db, new_alias))
{
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), new_alias);
DBUG_RETURN(1); // This can't be skipped
}
- old_exists= ha_table_exists(thd, ren_table->db, old_alias, &hton);
-
- if (old_exists)
+ if (ha_table_exists(thd, ren_table->db, old_alias, &hton) && hton)
{
DBUG_ASSERT(!thd->locked_tables_mode);
tdc_remove_table(thd, TDC_RT_REMOVE_ALL,
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 0ea61320a5a..5cf55d89d3e 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -51,7 +51,7 @@ extern TYPELIB binlog_checksum_typelib;
static int
fake_event_header(String* packet, Log_event_type event_type, ulong extra_len,
my_bool *do_checksum, ha_checksum *crc, const char** errmsg,
- uint8 checksum_alg_arg, uint32 end_pos)
+ enum enum_binlog_checksum_alg checksum_alg_arg, uint32 end_pos)
{
char header[LOG_EVENT_HEADER_LEN];
ulong event_len;
@@ -79,8 +79,7 @@ fake_event_header(String* packet, Log_event_type event_type, ulong extra_len,
}
if (*do_checksum)
{
- *crc= my_checksum(0L, NULL, 0);
- *crc= my_checksum(*crc, (uchar*)header, sizeof(header));
+ *crc= my_checksum(0, (uchar*)header, sizeof(header));
}
return 0;
}
@@ -133,7 +132,7 @@ struct binlog_send_info {
enum_gtid_skip_type gtid_skip_group;
enum_gtid_until_state gtid_until_group;
ushort flags;
- uint8 current_checksum_alg;
+ enum enum_binlog_checksum_alg current_checksum_alg;
bool slave_gtid_strict_mode;
bool send_fake_gtid_list;
bool slave_gtid_ignore_duplicates;
@@ -209,7 +208,7 @@ static int reset_transmit_packet(struct binlog_send_info *info, ushort flags,
*/
static int fake_rotate_event(binlog_send_info *info, ulonglong position,
- const char** errmsg, uint8 checksum_alg_arg)
+ const char** errmsg, enum enum_binlog_checksum_alg checksum_alg_arg)
{
DBUG_ENTER("fake_rotate_event");
ulong ev_offset;
@@ -405,11 +404,11 @@ inline void fix_checksum(String *packet, ulong ev_offset)
{
/* recalculate the crc for this event */
uint data_len = uint4korr(packet->ptr() + ev_offset + EVENT_LEN_OFFSET);
- ha_checksum crc= my_checksum(0L, NULL, 0);
+ ha_checksum crc;
DBUG_ASSERT(data_len ==
LOG_EVENT_MINIMAL_HEADER_LEN + FORMAT_DESCRIPTION_HEADER_LEN +
BINLOG_CHECKSUM_ALG_DESC_LEN + BINLOG_CHECKSUM_LEN);
- crc= my_checksum(crc, (uchar *)packet->ptr() + ev_offset, data_len -
+ crc= my_checksum(0, (uchar *)packet->ptr() + ev_offset, data_len -
BINLOG_CHECKSUM_LEN);
int4store(packet->ptr() + ev_offset + data_len - BINLOG_CHECKSUM_LEN, crc);
}
@@ -454,9 +453,9 @@ static bool is_slave_checksum_aware(THD * thd)
@c enum enum_binlog_checksum_alg
*/
-static uint8 get_binlog_checksum_value_at_connect(THD * thd)
+static enum enum_binlog_checksum_alg get_binlog_checksum_value_at_connect(THD * thd)
{
- uint8 ret;
+ enum enum_binlog_checksum_alg ret;
DBUG_ENTER("get_binlog_checksum_value_at_connect");
user_var_entry *entry= get_binlog_checksum_uservar(thd);
@@ -471,7 +470,8 @@ static uint8 get_binlog_checksum_value_at_connect(THD * thd)
uint dummy_errors;
str.copy(entry->value, entry->length, &my_charset_bin, &my_charset_bin,
&dummy_errors);
- ret= (uint8) find_type ((char*) str.ptr(), &binlog_checksum_typelib, 1) - 1;
+ ret= (enum_binlog_checksum_alg)
+ (find_type ((char*) str.ptr(), &binlog_checksum_typelib, 1) - 1);
DBUG_ASSERT(ret <= BINLOG_CHECKSUM_ALG_CRC32); // while it's just on CRC32 alg
}
DBUG_RETURN(ret);
@@ -559,7 +559,7 @@ bool purge_error_message(THD* thd, int res)
if ((errcode= purge_log_get_error_code(res)) != 0)
{
- my_message(errcode, ER(errcode), MYF(0));
+ my_message(errcode, ER_THD(thd, errcode), MYF(0));
return TRUE;
}
my_ok(thd);
@@ -644,6 +644,9 @@ void set_read_error(binlog_send_info *info, int error)
case LOG_READ_CHECKSUM_FAILURE:
info->errmsg= "event read from binlog did not pass crc check";
break;
+ case LOG_READ_DECRYPT:
+ info->errmsg= "event decryption failure";
+ break;
default:
info->errmsg= "unknown error reading log event on the master";
break;
@@ -775,7 +778,7 @@ get_slave_until_gtid(THD *thd, String *out_str)
static int send_heartbeat_event(binlog_send_info *info,
NET* net, String* packet,
const struct event_coordinates *coord,
- uint8 checksum_alg_arg)
+ enum enum_binlog_checksum_alg checksum_alg_arg)
{
DBUG_ENTER("send_heartbeat_event");
@@ -811,8 +814,7 @@ static int send_heartbeat_event(binlog_send_info *info,
if (do_checksum)
{
char b[BINLOG_CHECKSUM_LEN];
- ha_checksum crc= my_checksum(0L, NULL, 0);
- crc= my_checksum(crc, (uchar*) header, sizeof(header));
+ ha_checksum crc= my_checksum(0, (uchar*) header, sizeof(header));
crc= my_checksum(crc, (uchar*) p, ident_len);
int4store(b, crc);
packet->append(b, sizeof(b));
@@ -919,9 +921,14 @@ get_gtid_list_event(IO_CACHE *cache, Gtid_list_log_event **out_gtid_list)
typ= ev->get_type_code();
if (typ == GTID_LIST_EVENT)
break; /* Done, found it */
+ if (typ == START_ENCRYPTION_EVENT)
+ {
+ if (fdle->start_decryption((Start_encryption_log_event*) ev))
+ errormsg= "Could not set up decryption for binlog.";
+ }
delete ev;
if (typ == ROTATE_EVENT || typ == STOP_EVENT ||
- typ == FORMAT_DESCRIPTION_EVENT)
+ typ == FORMAT_DESCRIPTION_EVENT || typ == START_ENCRYPTION_EVENT)
continue; /* Continue looking */
/* We did not find any Gtid_list_log_event, must be old binlog. */
@@ -1396,7 +1403,7 @@ gtid_state_from_pos(const char *name, uint32 offset,
bool found_gtid_list_event= false;
bool found_format_description_event= false;
bool valid_pos= false;
- uint8 current_checksum_alg= BINLOG_CHECKSUM_ALG_UNDEF;
+ enum enum_binlog_checksum_alg current_checksum_alg= BINLOG_CHECKSUM_ALG_UNDEF;
int err;
String packet;
Format_description_log_event *fdev= NULL;
@@ -1438,8 +1445,9 @@ gtid_state_from_pos(const char *name, uint32 offset,
break;
packet.length(0);
- err= Log_event::read_log_event(&cache, &packet, NULL,
- current_checksum_alg);
+ err= Log_event::read_log_event(&cache, &packet, fdev,
+ opt_master_verify_checksum ? current_checksum_alg
+ : BINLOG_CHECKSUM_ALG_OFF);
if (err)
{
errormsg= "Could not read binlog while searching for slave start "
@@ -1474,6 +1482,20 @@ gtid_state_from_pos(const char *name, uint32 offset,
delete fdev;
fdev= tmp;
}
+ else if (typ == START_ENCRYPTION_EVENT)
+ {
+ uint sele_len = packet.length();
+ if (current_checksum_alg == BINLOG_CHECKSUM_ALG_CRC32)
+ {
+ sele_len -= BINLOG_CHECKSUM_LEN;
+ }
+ Start_encryption_log_event sele(packet.ptr(), sele_len, fdev);
+ if (fdev->start_decryption(&sele))
+ {
+ errormsg= "Could not start decryption of binlog.";
+ goto end;
+ }
+ }
else if (typ != FORMAT_DESCRIPTION_EVENT && !found_format_description_event)
{
errormsg= "Did not find format description log event while searching "
@@ -1647,7 +1669,7 @@ send_event_to_slave(binlog_send_info *info, Log_event_type event_type,
String* const packet= info->packet;
size_t len= packet->length();
int mariadb_slave_capability= info->mariadb_slave_capability;
- uint8 current_checksum_alg= info->current_checksum_alg;
+ enum enum_binlog_checksum_alg current_checksum_alg= info->current_checksum_alg;
slave_connection_state *gtid_state= &info->gtid_state;
slave_connection_state *until_gtid_state= info->until_gtid_state;
@@ -2073,18 +2095,6 @@ static int init_binlog_sender(binlog_send_info *info,
info->dbug_reconnect_counter= 22;
});
- /*
- We want to corrupt the first event, in Log_event::read_log_event().
- But we do not want the corruption to happen early, eg. when client does
- BINLOG_GTID_POS(). So test case sets a DBUG trigger which causes us to
- set the real DBUG injection here.
- */
- DBUG_EXECUTE_IF("corrupt_read_log_event2_set",
- {
- DBUG_SET("-d,corrupt_read_log_event2_set");
- DBUG_SET("+d,corrupt_read_log_event2");
- });
-
if (global_system_variables.log_warnings > 1)
sql_print_information(
"Start binlog_dump to slave_server(%lu), pos(%s, %lu)",
@@ -2194,10 +2204,8 @@ static int init_binlog_sender(binlog_send_info *info,
/**
* send format descriptor event for one binlog file
*/
-static int send_format_descriptor_event(binlog_send_info *info,
- IO_CACHE *log,
- LOG_INFO *linfo,
- my_off_t start_pos)
+static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log,
+ LOG_INFO *linfo, my_off_t start_pos)
{
int error;
ulong ev_offset;
@@ -2221,144 +2229,194 @@ static int send_format_descriptor_event(binlog_send_info *info,
return 1;
}
- do
+ /* reset transmit packet for the event read from binary log file */
+ if (reset_transmit_packet(info, info->flags, &ev_offset, &info->errmsg))
+ return 1;
+
+ /*
+ Try to find a Format_description_log_event at the beginning of
+ the binlog
+ */
+ info->last_pos= my_b_tell(log);
+ error= Log_event::read_log_event(log, packet, info->fdev,
+ opt_master_verify_checksum
+ ? info->current_checksum_alg
+ : BINLOG_CHECKSUM_ALG_OFF);
+ linfo->pos= my_b_tell(log);
+
+ if (error)
{
- /* reset transmit packet for the event read from binary log file */
- if (reset_transmit_packet(info, info->flags, &ev_offset, &info->errmsg))
- break;
+ set_read_error(info, error);
+ return 1;
+ }
- /*
- Try to find a Format_description_log_event at the beginning of
- the binlog
- */
- info->last_pos= my_b_tell(log);
- error= Log_event::read_log_event(log, packet, /* LOCK_log */ NULL,
- info->current_checksum_alg);
- linfo->pos= my_b_tell(log);
+ event_type= (Log_event_type)((uchar)(*packet)[LOG_EVENT_OFFSET+ev_offset]);
- if (error)
- {
- set_read_error(info, error);
- break;
- }
+ /*
+ The packet has offsets equal to the normal offsets in a
+ binlog event + ev_offset (the first ev_offset characters are
+ the header (default \0)).
+ */
+ DBUG_PRINT("info",
+ ("Looked for a Format_description_log_event, "
+ "found event type %d", (int)event_type));
- event_type= (Log_event_type)((uchar)(*packet)[LOG_EVENT_OFFSET+ev_offset]);
+ if (event_type != FORMAT_DESCRIPTION_EVENT)
+ {
+ info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG;
+ info->errmsg= "Failed to find format descriptor event in start of binlog";
+ sql_print_warning("Failed to find format descriptor event in "
+ "start of binlog: %s",
+ info->log_file_name);
+ return 1;
+ }
- /*
- The packet has offsets equal to the normal offsets in a
- binlog event + ev_offset (the first ev_offset characters are
- the header (default \0)).
- */
- DBUG_PRINT("info",
- ("Looked for a Format_description_log_event, "
- "found event type %d", (int)event_type));
+ info->current_checksum_alg= get_checksum_alg(packet->ptr() + ev_offset,
+ packet->length() - ev_offset);
- if (event_type != FORMAT_DESCRIPTION_EVENT)
- {
- info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG;
- info->errmsg= "Failed to find format descriptor event in start of binlog";
- sql_print_warning("Failed to find format descriptor event in "
- "start of binlog: %s",
- info->log_file_name);
- break;
- }
+ DBUG_ASSERT(info->current_checksum_alg == BINLOG_CHECKSUM_ALG_OFF ||
+ info->current_checksum_alg == BINLOG_CHECKSUM_ALG_UNDEF ||
+ info->current_checksum_alg == BINLOG_CHECKSUM_ALG_CRC32);
- info->current_checksum_alg= get_checksum_alg(packet->ptr() + ev_offset,
- packet->length() - ev_offset);
+ if (!is_slave_checksum_aware(thd) &&
+ info->current_checksum_alg != BINLOG_CHECKSUM_ALG_OFF &&
+ info->current_checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF)
+ {
+ info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG;
+ info->errmsg= "Slave can not handle replication events with the "
+ "checksum that master is configured to log";
+ sql_print_warning("Master is configured to log replication events "
+ "with checksum, but will not send such events to "
+ "slaves that cannot process them");
+ return 1;
+ }
- DBUG_ASSERT(info->current_checksum_alg == BINLOG_CHECKSUM_ALG_OFF ||
- info->current_checksum_alg == BINLOG_CHECKSUM_ALG_UNDEF ||
- info->current_checksum_alg == BINLOG_CHECKSUM_ALG_CRC32);
+ uint ev_len= packet->length() - ev_offset;
+ if (info->current_checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF)
+ ev_len-= BINLOG_CHECKSUM_LEN;
- if (!is_slave_checksum_aware(thd) &&
- info->current_checksum_alg != BINLOG_CHECKSUM_ALG_OFF &&
- info->current_checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF)
- {
- info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG;
- info->errmsg= "Slave can not handle replication events with the "
- "checksum that master is configured to log";
- sql_print_warning("Master is configured to log replication events "
- "with checksum, but will not send such events to "
- "slaves that cannot process them");
- break;
- }
+ Format_description_log_event *tmp;
+ if (!(tmp= new Format_description_log_event(packet->ptr() + ev_offset,
+ ev_len, info->fdev)))
+ {
+ info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG;
+ info->errmsg= "Corrupt Format_description event found "
+ "or out-of-memory";
+ return 1;
+ }
+ delete info->fdev;
+ info->fdev= tmp;
- Format_description_log_event *tmp;
- if (!(tmp= new Format_description_log_event(packet->ptr()+ev_offset,
- packet->length()-ev_offset,
- info->fdev)))
- {
- info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG;
- info->errmsg= "Corrupt Format_description event found "
- "or out-of-memory";
- break;
- }
- delete info->fdev;
- info->fdev= tmp;
+ (*packet)[FLAGS_OFFSET+ev_offset] &= ~LOG_EVENT_BINLOG_IN_USE_F;
- (*packet)[FLAGS_OFFSET+ev_offset] &= ~LOG_EVENT_BINLOG_IN_USE_F;
+ if (info->clear_initial_log_pos)
+ {
+ info->clear_initial_log_pos= false;
+ /*
+ mark that this event with "log_pos=0", so the slave
+ should not increment master's binlog position
+ (rli->group_master_log_pos)
+ */
+ int4store((char*) packet->ptr()+LOG_POS_OFFSET+ev_offset, (ulong) 0);
- if (info->clear_initial_log_pos)
- {
- info->clear_initial_log_pos= false;
- /*
- mark that this event with "log_pos=0", so the slave
- should not increment master's binlog position
- (rli->group_master_log_pos)
- */
- int4store((char*) packet->ptr()+LOG_POS_OFFSET+ev_offset, (ulong) 0);
+ /*
+ if reconnect master sends FD event with `created' as 0
+ to avoid destroying temp tables.
+ */
+ int4store((char*) packet->ptr()+LOG_EVENT_MINIMAL_HEADER_LEN+
+ ST_CREATED_OFFSET+ev_offset, (ulong) 0);
- /*
- if reconnect master sends FD event with `created' as 0
- to avoid destroying temp tables.
- */
+ /* fix the checksum due to latest changes in header */
+ if (info->current_checksum_alg != BINLOG_CHECKSUM_ALG_OFF &&
+ info->current_checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF)
+ fix_checksum(packet, ev_offset);
+ }
+ else if (info->using_gtid_state)
+ {
+ /*
+ If this event has the field `created' set, then it will cause the
+ slave to delete all active temporary tables. This must not happen
+ if the slave received any later GTIDs in a previous connect, as
+ those GTIDs might have created new temporary tables that are still
+ needed.
+
+ So here, we check if the starting GTID position was already
+ reached before this format description event. If not, we clear the
+ `created' flag to preserve temporary tables on the slave. (If the
+ slave connects at a position past this event, it means that it
+ already received and handled it in a previous connect).
+ */
+ if (!info->gtid_state.is_pos_reached())
+ {
int4store((char*) packet->ptr()+LOG_EVENT_MINIMAL_HEADER_LEN+
ST_CREATED_OFFSET+ev_offset, (ulong) 0);
-
- /* fix the checksum due to latest changes in header */
if (info->current_checksum_alg != BINLOG_CHECKSUM_ALG_OFF &&
- info->current_checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF)
+ info->current_checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF)
fix_checksum(packet, ev_offset);
}
- else if (info->using_gtid_state)
+ }
+
+ /* send it */
+ if (my_net_write(info->net, (uchar*) packet->ptr(), packet->length()))
+ {
+ info->errmsg= "Failed on my_net_write()";
+ info->error= ER_UNKNOWN_ERROR;
+ return 1;
+ }
+
+ /*
+ Read the following Start_encryption_log_event but don't send it to slave.
+ Slave doesn't need to know whether master's binlog is encrypted,
+ and if it'll want to encrypt its logs, it should generate its own
+ random nonce, not use the one from the master.
+ */
+ packet->length(0);
+ info->last_pos= linfo->pos;
+ error= Log_event::read_log_event(log, packet, info->fdev,
+ opt_master_verify_checksum
+ ? info->current_checksum_alg
+ : BINLOG_CHECKSUM_ALG_OFF);
+ linfo->pos= my_b_tell(log);
+
+ if (error)
+ {
+ set_read_error(info, error);
+ return 1;
+ }
+
+ event_type= (Log_event_type)((uchar)(*packet)[LOG_EVENT_OFFSET]);
+ if (event_type == START_ENCRYPTION_EVENT)
+ {
+ Start_encryption_log_event *sele= (Start_encryption_log_event *)
+ Log_event::read_log_event(packet->ptr(), packet->length(), &info->errmsg,
+ info->fdev, BINLOG_CHECKSUM_ALG_OFF);
+ if (!sele)
{
- /*
- If this event has the field `created' set, then it will cause the
- slave to delete all active temporary tables. This must not happen
- if the slave received any later GTIDs in a previous connect, as
- those GTIDs might have created new temporary tables that are still
- needed.
-
- So here, we check if the starting GTID position was already
- reached before this format description event. If not, we clear the
- `created' flag to preserve temporary tables on the slave. (If the
- slave connects at a position past this event, it means that it
- already received and handled it in a previous connect).
- */
- if (!info->gtid_state.is_pos_reached())
- {
- int4store((char*) packet->ptr()+LOG_EVENT_MINIMAL_HEADER_LEN+
- ST_CREATED_OFFSET+ev_offset, (ulong) 0);
- if (info->current_checksum_alg != BINLOG_CHECKSUM_ALG_OFF &&
- info->current_checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF)
- fix_checksum(packet, ev_offset);
- }
+ info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG;
+ return 1;
}
- /* send it */
- if (my_net_write(info->net, (uchar*) packet->ptr(), packet->length()))
+ if (info->fdev->start_decryption(sele))
{
- info->errmsg= "Failed on my_net_write()";
- info->error= ER_UNKNOWN_ERROR;
- break;
+ info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG;
+ info->errmsg= "Could not decrypt binlog: encryption key error";
+ return 1;
}
+ delete sele;
+ }
+ else if (start_pos == BIN_LOG_HEADER_SIZE)
+ {
+ /*
+ not Start_encryption_log_event - seek back. But only if
+ send_one_binlog_file() isn't going to seek anyway
+ */
+ my_b_seek(log, info->last_pos);
+ linfo->pos= info->last_pos;
+ }
- /** all done */
- return 0;
-
- } while (false);
- return 1;
+ /** all done */
+ return 0;
}
static bool should_stop(binlog_send_info *info)
@@ -2545,9 +2603,7 @@ static my_off_t get_binlog_end_pos(binlog_send_info *info,
* return 0 - OK
* else NOK
*/
-static int send_events(binlog_send_info *info,
- IO_CACHE* log,
- LOG_INFO* linfo,
+static int send_events(binlog_send_info *info, IO_CACHE* log, LOG_INFO* linfo,
my_off_t end_pos)
{
int error;
@@ -2568,14 +2624,15 @@ static int send_events(binlog_send_info *info,
return 1;
info->last_pos= linfo->pos;
- error = Log_event::read_log_event(log, packet, /* LOCK_log */ NULL,
- info->current_checksum_alg,
- NULL, NULL);
+ error= Log_event::read_log_event(log, packet, info->fdev,
+ opt_master_verify_checksum ? info->current_checksum_alg
+ : BINLOG_CHECKSUM_ALG_OFF);
linfo->pos= my_b_tell(log);
if (error)
{
- goto read_err;
+ set_read_error(info, error);
+ return 1;
}
Log_event_type event_type=
@@ -2618,8 +2675,9 @@ static int send_events(binlog_send_info *info,
});
#endif
- if ((info->errmsg= send_event_to_slave(info, event_type, log,
- ev_offset, &info->error_gtid)))
+ if (event_type != START_ENCRYPTION_EVENT &&
+ ((info->errmsg= send_event_to_slave(info, event_type, log,
+ ev_offset, &info->error_gtid))))
return 1;
if (unlikely(info->send_fake_gtid_list) &&
@@ -2661,11 +2719,6 @@ static int send_events(binlog_send_info *info,
}
return 0;
-
-read_err:
- set_read_error(info, error);
-
- return 1;
}
/**
@@ -2811,9 +2864,9 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
BINLOG_GTID_POS(). So test case sets a DBUG trigger which causes us to
set the real DBUG injection here.
*/
- DBUG_EXECUTE_IF("corrupt_read_log_event_to_slave_set",
+ DBUG_EXECUTE_IF("corrupt_read_log_event2_set",
{
- DBUG_SET("-d,corrupt_read_log_event_to_slave_set");
+ DBUG_SET("-d,corrupt_read_log_event2_set");
DBUG_SET("+d,corrupt_read_log_event2");
});
@@ -3047,8 +3100,6 @@ int start_slave(THD* thd , Master_info* mi, bool net_report)
}
else if (thd->lex->mi.relay_log_pos)
{
- if (thd->lex->mi.pos)
- slave_errno=ER_BAD_SLAVE_UNTIL_COND;
mi->rli.until_condition= Relay_log_info::UNTIL_RELAY_POS;
mi->rli.until_log_pos= thd->lex->mi.relay_log_pos;
strmake_buf(mi->rli.until_log_name, thd->lex->mi.relay_log_name);
@@ -3099,17 +3150,19 @@ int start_slave(THD* thd , Master_info* mi, bool net_report)
if (!opt_skip_slave_start)
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_MISSING_SKIP_SLAVE,
- ER(ER_MISSING_SKIP_SLAVE));
+ ER_THD(thd, ER_MISSING_SKIP_SLAVE));
}
mysql_mutex_unlock(&mi->rli.data_lock);
}
else if (thd->lex->mi.pos || thd->lex->mi.relay_log_pos)
- push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_UNTIL_COND_IGNORED,
- ER(ER_UNTIL_COND_IGNORED));
+ push_warning(thd,
+ Sql_condition::WARN_LEVEL_NOTE, ER_UNTIL_COND_IGNORED,
+ ER_THD(thd, ER_UNTIL_COND_IGNORED));
if (!slave_errno)
- slave_errno = start_slave_threads(0 /*no mutex */,
+ slave_errno = start_slave_threads(thd,
+ 0 /*no mutex */,
1 /* wait for start */,
mi,
master_info_file_tmp,
@@ -3123,7 +3176,7 @@ int start_slave(THD* thd , Master_info* mi, bool net_report)
{
/* no error if all threads are already started, only a warning */
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_SLAVE_WAS_RUNNING,
- ER(ER_SLAVE_WAS_RUNNING));
+ ER_THD(thd, ER_SLAVE_WAS_RUNNING));
}
err:
@@ -3190,14 +3243,14 @@ int stop_slave(THD* thd, Master_info* mi, bool net_report )
//no error if both threads are already stopped, only a warning
slave_errno= 0;
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_SLAVE_WAS_NOT_RUNNING,
- ER(ER_SLAVE_WAS_NOT_RUNNING));
+ ER_THD(thd, ER_SLAVE_WAS_NOT_RUNNING));
}
unlock_slave_threads(mi);
if (slave_errno)
{
if (net_report)
- my_message(slave_errno, ER(slave_errno), MYF(0));
+ my_message(slave_errno, ER_THD(thd, slave_errno), MYF(0));
DBUG_RETURN(1);
}
@@ -3590,7 +3643,8 @@ bool change_master(THD* thd, Master_info* mi, bool *master_info_added)
lex_mi->ssl_cert || lex_mi->ssl_cipher || lex_mi->ssl_key ||
lex_mi->ssl_verify_server_cert || lex_mi->ssl_crl || lex_mi->ssl_crlpath)
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_SLAVE_IGNORED_SSL_PARAMS, ER(ER_SLAVE_IGNORED_SSL_PARAMS));
+ ER_SLAVE_IGNORED_SSL_PARAMS,
+ ER_THD(thd, ER_SLAVE_IGNORED_SSL_PARAMS));
#endif
if (lex_mi->relay_log_name)
@@ -3770,16 +3824,19 @@ err:
@retval 0 success
@retval 1 error
*/
-int reset_master(THD* thd, rpl_gtid *init_state, uint32 init_state_len)
+int reset_master(THD* thd, rpl_gtid *init_state, uint32 init_state_len,
+ ulong next_log_number)
{
if (!mysql_bin_log.is_open())
{
my_message(ER_FLUSH_MASTER_BINLOG_CLOSED,
- ER(ER_FLUSH_MASTER_BINLOG_CLOSED), MYF(ME_BELL+ME_WAITTANG));
+ ER_THD(thd, ER_FLUSH_MASTER_BINLOG_CLOSED),
+ MYF(ME_BELL+ME_WAITTANG));
return 1;
}
- if (mysql_bin_log.reset_logs(thd, 1, init_state, init_state_len))
+ if (mysql_bin_log.reset_logs(thd, 1, init_state, init_state_len,
+ next_log_number))
return 1;
RUN_HOOK(binlog_transmit, after_reset_master, (thd, 0 /* flags */));
return 0;
@@ -3807,10 +3864,11 @@ bool mysql_show_binlog_events(THD* thd)
int old_max_allowed_packet= thd->variables.max_allowed_packet;
Master_info *mi= 0;
LOG_INFO linfo;
+ LEX_MASTER_INFO *lex_mi= &thd->lex->mi;
DBUG_ENTER("mysql_show_binlog_events");
- Log_event::init_show_field_list(&field_list);
+ Log_event::init_show_field_list(thd, &field_list);
if (protocol->send_result_set_metadata(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(TRUE);
@@ -3828,10 +3886,12 @@ bool mysql_show_binlog_events(THD* thd)
}
else /* showing relay log contents */
{
+ if (!lex_mi->connection_name.str)
+ lex_mi->connection_name= thd->variables.default_master_connection;
mysql_mutex_lock(&LOCK_active_mi);
if (!master_info_index ||
!(mi= master_info_index->
- get_master_info(&thd->variables.default_master_connection,
+ get_master_info(&lex_mi->connection_name,
Sql_condition::WARN_LEVEL_ERROR)))
{
mysql_mutex_unlock(&LOCK_active_mi);
@@ -3842,7 +3902,6 @@ bool mysql_show_binlog_events(THD* thd)
if (binary_log->is_open())
{
- LEX_MASTER_INFO *lex_mi= &thd->lex->mi;
SELECT_LEX_UNIT *unit= &thd->lex->unit;
ha_rows event_count, limit_start, limit_end;
my_off_t pos = MY_MAX(BIN_LOG_HEADER_SIZE, lex_mi->pos); // user-friendly
@@ -3895,38 +3954,52 @@ bool mysql_show_binlog_events(THD* thd)
Read the first event in case it's a Format_description_log_event, to
know the format. If there's no such event, we are 3.23 or 4.x. This
code, like before, can't read 3.23 binlogs.
+ Also read the second event, in case it's a Start_encryption_log_event.
This code will fail on a mixed relay log (one which has Format_desc then
Rotate then Format_desc).
*/
- ev= Log_event::read_log_event(&log, (mysql_mutex_t*)0, description_event,
- opt_master_verify_checksum);
- if (ev)
+
+ my_off_t scan_pos = BIN_LOG_HEADER_SIZE;
+ while (scan_pos < pos)
{
+ ev= Log_event::read_log_event(&log, (mysql_mutex_t*)0, description_event,
+ opt_master_verify_checksum);
+ scan_pos = my_b_tell(&log);
+ if (ev == NULL || !ev->is_valid())
+ {
+ mysql_mutex_unlock(log_lock);
+ errmsg = "Wrong offset or I/O error";
+ goto err;
+ }
if (ev->get_type_code() == FORMAT_DESCRIPTION_EVENT)
{
delete description_event;
description_event= (Format_description_log_event*) ev;
}
else
+ {
+ if (ev->get_type_code() == START_ENCRYPTION_EVENT)
+ {
+ if (description_event->start_decryption((Start_encryption_log_event*) ev))
+ {
+ delete ev;
+ mysql_mutex_unlock(log_lock);
+ errmsg = "Could not initialize decryption of binlog.";
+ goto err;
+ }
+ }
delete ev;
+ break;
+ }
}
my_b_seek(&log, pos);
- if (!description_event->is_valid())
- {
- errmsg="Invalid Format_description event; could be out of memory";
- goto err;
- }
-
for (event_count = 0;
(ev = Log_event::read_log_event(&log, (mysql_mutex_t*) 0,
description_event,
opt_master_verify_checksum)); )
{
- if (ev->get_type_code() == FORMAT_DESCRIPTION_EVENT)
- description_event->checksum_alg= ev->checksum_alg;
-
if (event_count >= limit_start &&
ev->net_send(thd, protocol, linfo.log_file_name, pos))
{
@@ -3936,8 +4009,30 @@ bool mysql_show_binlog_events(THD* thd)
goto err;
}
+ if (ev->get_type_code() == FORMAT_DESCRIPTION_EVENT)
+ {
+ Format_description_log_event* new_fdle=
+ (Format_description_log_event*) ev;
+ new_fdle->copy_crypto_data(description_event);
+ delete description_event;
+ description_event= new_fdle;
+ }
+ else
+ {
+ if (ev->get_type_code() == START_ENCRYPTION_EVENT)
+ {
+ if (description_event->start_decryption((Start_encryption_log_event*) ev))
+ {
+ errmsg = "Error starting decryption";
+ delete ev;
+ mysql_mutex_unlock(log_lock);
+ goto err;
+ }
+ }
+ delete ev;
+ }
+
pos = my_b_tell(&log);
- delete ev;
if (++event_count >= limit_end)
break;
@@ -3994,13 +4089,23 @@ err:
bool show_binlog_info(THD* thd)
{
Protocol *protocol= thd->protocol;
+ MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("show_binlog_info");
+
List<Item> field_list;
- field_list.push_back(new Item_empty_string("File", FN_REFLEN));
- field_list.push_back(new Item_return_int("Position",20,
- MYSQL_TYPE_LONGLONG));
- field_list.push_back(new Item_empty_string("Binlog_Do_DB",255));
- field_list.push_back(new Item_empty_string("Binlog_Ignore_DB",255));
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "File", FN_REFLEN),
+ mem_root);
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "Position", 20,
+ MYSQL_TYPE_LONGLONG),
+ mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Binlog_Do_DB", 255),
+ mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Binlog_Ignore_DB", 255),
+ mem_root);
if (protocol->send_result_set_metadata(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
@@ -4043,6 +4148,7 @@ bool show_binlogs(THD* thd)
uint length;
int cur_dir_len;
Protocol *protocol= thd->protocol;
+ MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("show_binlogs");
if (!mysql_bin_log.is_open())
@@ -4051,9 +4157,13 @@ bool show_binlogs(THD* thd)
DBUG_RETURN(TRUE);
}
- field_list.push_back(new Item_empty_string("Log_name", 255));
- field_list.push_back(new Item_return_int("File_size", 20,
- MYSQL_TYPE_LONGLONG));
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Log_name", 255),
+ mem_root);
+ field_list.push_back(new (mem_root)
+ Item_return_int(thd, "File_size", 20,
+ MYSQL_TYPE_LONGLONG),
+ mem_root);
if (protocol->send_result_set_metadata(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(TRUE);
@@ -4313,7 +4423,7 @@ rpl_gtid_pos_check(THD *thd, char *str, size_t len)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_MASTER_GTID_POS_MISSING_DOMAIN,
- ER(ER_MASTER_GTID_POS_MISSING_DOMAIN),
+ ER_THD(thd, ER_MASTER_GTID_POS_MISSING_DOMAIN),
binlog_gtid->domain_id, binlog_gtid->domain_id,
binlog_gtid->server_id, binlog_gtid->seq_no);
gave_missing_warning= true;
@@ -4333,7 +4443,7 @@ rpl_gtid_pos_check(THD *thd, char *str, size_t len)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG,
- ER(ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG),
+ ER_THD(thd, ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG),
slave_gtid->domain_id, slave_gtid->server_id,
slave_gtid->seq_no, binlog_gtid->domain_id,
binlog_gtid->server_id, binlog_gtid->seq_no);
diff --git a/sql/sql_repl.h b/sql/sql_repl.h
index a9fdce9e5e2..774e43c0a87 100644
--- a/sql/sql_repl.h
+++ b/sql/sql_repl.h
@@ -46,7 +46,8 @@ int stop_slave(THD* thd, Master_info* mi, bool net_report);
bool change_master(THD* thd, Master_info* mi, bool *master_info_added);
bool mysql_show_binlog_events(THD* thd);
int reset_slave(THD *thd, Master_info* mi);
-int reset_master(THD* thd, rpl_gtid *init_state, uint32 init_state_len);
+int reset_master(THD* thd, rpl_gtid *init_state, uint32 init_state_len,
+ ulong next_log_number);
bool purge_master_logs(THD* thd, const char* to_log);
bool purge_master_logs_before_date(THD* thd, time_t purge_time);
bool log_in_use(const char* log_name);
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 0372a06c469..f245bd89dba 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -116,7 +116,7 @@ static store_key *get_store_key(THD *thd,
uint maybe_null);
static bool make_outerjoin_info(JOIN *join);
static Item*
-make_cond_after_sjm(Item *root_cond, Item *cond, table_map tables,
+make_cond_after_sjm(THD *thd, Item *root_cond, Item *cond, table_map tables,
table_map sjm_tables, bool inside_or_clause);
static bool make_join_select(JOIN *join,SQL_SELECT *select,COND *item);
static void revise_cache_usage(JOIN_TAB *join_tab);
@@ -137,7 +137,7 @@ static COND *build_equal_items(JOIN *join, COND *cond,
bool ignore_on_conds,
COND_EQUAL **cond_equal_ref,
bool link_equal_fields= FALSE);
-static COND* substitute_for_best_equal_field(JOIN_TAB *context_tab,
+static COND* substitute_for_best_equal_field(THD *thd, JOIN_TAB *context_tab,
COND *cond,
COND_EQUAL *cond_equal,
void *table_join_idx);
@@ -276,10 +276,8 @@ Item_equal *find_item_equal(COND_EQUAL *cond_equal, Field *field,
JOIN_TAB *first_depth_first_tab(JOIN* join);
JOIN_TAB *next_depth_first_tab(JOIN* join, JOIN_TAB* tab);
-enum enum_exec_or_opt {WALK_OPTIMIZATION_TABS , WALK_EXECUTION_TABS};
-JOIN_TAB *first_breadth_first_tab(JOIN *join, enum enum_exec_or_opt tabs_kind);
-JOIN_TAB *next_breadth_first_tab(JOIN *join, enum enum_exec_or_opt tabs_kind,
- JOIN_TAB *tab);
+static JOIN_TAB *next_breadth_first_tab(JOIN_TAB *first_top_tab,
+ uint n_top_tabs_count, JOIN_TAB *tab);
static double table_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s,
table_map rem_tables);
@@ -385,7 +383,7 @@ bool handle_select(THD *thd, LEX *lex, select_result *result,
*/
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT,
- ER(ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT),
+ ER_THD(thd, ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT),
thd->accessed_rows_and_keys,
thd->lex->limit_rows_examined->val_uint());
thd->reset_killed();
@@ -483,7 +481,7 @@ fix_inner_refs(THD *thd, List<Item> &all_fields, SELECT_LEX *select,
int el= all_fields.elements;
ref_pointer_array[el]= item;
/* Add the field item to the select list of the current select. */
- all_fields.push_front(item);
+ all_fields.push_front(item, thd->mem_root);
/*
If it's needed reset each Item_ref item that refers this field with
a new reference taken from ref_pointer_array.
@@ -514,9 +512,9 @@ fix_inner_refs(THD *thd, List<Item> &all_fields, SELECT_LEX *select,
direct_ref= TRUE;
new_ref= direct_ref ?
- new Item_direct_ref(ref->context, item_ref, ref->table_name,
+ new (thd->mem_root) Item_direct_ref(thd, ref->context, item_ref, ref->table_name,
ref->field_name, ref->alias_name_used) :
- new Item_ref(ref->context, item_ref, ref->table_name,
+ new (thd->mem_root) Item_ref(thd, ref->context, item_ref, ref->table_name,
ref->field_name, ref->alias_name_used);
if (!new_ref)
return TRUE;
@@ -856,7 +854,7 @@ JOIN::prepare(Item ***rref_pointer_array,
real_order= TRUE;
if (item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM)
- item->split_sum_func(thd, ref_pointer_array, all_fields);
+ item->split_sum_func(thd, ref_pointer_array, all_fields, 0);
}
if (!real_order)
order= NULL;
@@ -864,7 +862,7 @@ JOIN::prepare(Item ***rref_pointer_array,
if (having && having->with_sum_func)
having->split_sum_func2(thd, ref_pointer_array, all_fields,
- &having, TRUE);
+ &having, SPLIT_SUM_SKIP_REGISTERED);
if (select_lex->inner_sum_func_list)
{
Item_sum *end=select_lex->inner_sum_func_list;
@@ -873,7 +871,7 @@ JOIN::prepare(Item ***rref_pointer_array,
{
item_sum= item_sum->next;
item_sum->split_sum_func2(thd, ref_pointer_array,
- all_fields, item_sum->ref_by, FALSE);
+ all_fields, item_sum->ref_by, 0);
} while (item_sum != end);
}
@@ -894,10 +892,10 @@ JOIN::prepare(Item ***rref_pointer_array,
if ((*ord->item)->type() == Item::FIELD_ITEM &&
(*ord->item)->field_type() == MYSQL_TYPE_BIT)
{
- Item_field *field= new Item_field(thd, *(Item_field**)ord->item);
+ Item_field *field= new (thd->mem_root) Item_field(thd, *(Item_field**)ord->item);
int el= all_fields.elements;
ref_pointer_array[el]= field;
- all_fields.push_front(field);
+ all_fields.push_front(field, thd->mem_root);
ord->item= ref_pointer_array + el;
}
}
@@ -916,7 +914,7 @@ JOIN::prepare(Item ***rref_pointer_array,
select_lex->agg_func_used())
{
my_message(ER_MIX_OF_GROUP_FUNC_AND_FIELDS,
- ER(ER_MIX_OF_GROUP_FUNC_AND_FIELDS), MYF(0));
+ ER_THD(thd, ER_MIX_OF_GROUP_FUNC_AND_FIELDS), MYF(0));
DBUG_RETURN(-1);
}
{
@@ -938,14 +936,14 @@ JOIN::prepare(Item ***rref_pointer_array,
{
if (!test_if_subpart(procedure->group,group_list))
{ /* purecov: inspected */
- my_message(ER_DIFF_GROUPS_PROC, ER(ER_DIFF_GROUPS_PROC),
+ my_message(ER_DIFF_GROUPS_PROC, ER_THD(thd, ER_DIFF_GROUPS_PROC),
MYF(0)); /* purecov: inspected */
goto err; /* purecov: inspected */
}
}
if (order && (procedure->flags & PROC_NO_SORT))
{ /* purecov: inspected */
- my_message(ER_ORDER_WITH_PROC, ER(ER_ORDER_WITH_PROC),
+ my_message(ER_ORDER_WITH_PROC, ER_THD(thd, ER_ORDER_WITH_PROC),
MYF(0)); /* purecov: inspected */
goto err; /* purecov: inspected */
}
@@ -1003,7 +1001,7 @@ bool JOIN::prepare_stage2()
#ifdef RESTRICTED_GROUP
if (implicit_grouping)
{
- my_message(ER_WRONG_SUM_SELECT,ER(ER_WRONG_SUM_SELECT),MYF(0));
+ my_message(ER_WRONG_SUM_SELECT,ER_THD(thd, ER_WRONG_SUM_SELECT),MYF(0));
goto err;
}
#endif
@@ -1066,6 +1064,7 @@ JOIN::optimize_inner()
{
ulonglong select_opts_for_readinfo;
uint no_jbuf_after;
+ JOIN_TAB *tab;
DBUG_ENTER("JOIN::optimize");
do_send_rows = (unit->select_limit_cnt) ? 1 : 0;
@@ -1151,7 +1150,7 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
conds= having;
having= 0;
}
- else if ((conds=new Item_cond_and(conds,having)))
+ else if ((conds=new (thd->mem_root) Item_cond_and(conds,having)))
{
/*
Item_cond_and can't be fixed after creation, so we do not check
@@ -1336,6 +1335,24 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
/* get_sort_by_table() call used to be here: */
MEM_UNDEFINED(&sort_by_table, sizeof(sort_by_table));
+ /*
+ We have to remove constants and duplicates from group_list before
+ calling make_join_statistics() as this may call get_best_group_min_max()
+ which needs a simplfied group_list.
+ */
+ simple_group= 1;
+ if (group_list && table_count == 1)
+ {
+ group_list= remove_const(this, group_list, conds,
+ rollup.state == ROLLUP::STATE_NONE,
+ &simple_group);
+ if (thd->is_error())
+ {
+ error= 1;
+ DBUG_RETURN(1);
+ }
+ }
+
/* Calculate how to do the join */
THD_STAGE_INFO(thd, stage_statistics);
if (make_join_statistics(this, select_lex->leaf_tables, &keyuse) ||
@@ -1381,7 +1398,7 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
best_read > (double) thd->variables.max_join_size &&
!(select_options & SELECT_DESCRIBE))
{ /* purecov: inspected */
- my_message(ER_TOO_BIG_SELECT, ER(ER_TOO_BIG_SELECT), MYF(0));
+ my_message(ER_TOO_BIG_SELECT, ER_THD(thd, ER_TOO_BIG_SELECT), MYF(0));
error= -1;
DBUG_RETURN(1);
}
@@ -1391,7 +1408,7 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
if (!conds && outer_join)
{
/* Handle the case where we have an OUTER JOIN without a WHERE */
- conds=new Item_int((longlong) 1,1); // Always true
+ conds= new (thd->mem_root) Item_int(thd, (longlong) 1,1); // Always true
}
if (impossible_where)
@@ -1425,7 +1442,7 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
*/
if (conds)
{
- conds= substitute_for_best_equal_field(NO_PARTICULAR_TAB, conds,
+ conds= substitute_for_best_equal_field(thd, NO_PARTICULAR_TAB, conds,
cond_equal, map2table);
if (thd->is_error())
{
@@ -1444,13 +1461,12 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
Perform the optimization on fields evaluation mentioned above
for all on expressions.
*/
- JOIN_TAB *tab;
for (tab= first_linear_tab(this, WITH_BUSH_ROOTS, WITHOUT_CONST_TABLES); tab;
tab= next_linear_tab(this, tab, WITH_BUSH_ROOTS))
{
if (*tab->on_expr_ref)
{
- *tab->on_expr_ref= substitute_for_best_equal_field(NO_PARTICULAR_TAB,
+ *tab->on_expr_ref= substitute_for_best_equal_field(thd, NO_PARTICULAR_TAB,
*tab->on_expr_ref,
tab->cond_equal,
map2table);
@@ -1482,7 +1498,7 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
JOIN_TAB *first_inner= tab->first_inner;
while (equals)
{
- ref_item= substitute_for_best_equal_field(tab, ref_item,
+ ref_item= substitute_for_best_equal_field(thd, tab, ref_item,
equals, map2table);
if (first_inner)
{
@@ -1528,12 +1544,15 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
if (conds && const_table_map != found_const_table_map &&
(select_options & SELECT_DESCRIBE))
{
- conds=new Item_int((longlong) 0,1); // Always false
+ conds=new (thd->mem_root) Item_int(thd, (longlong) 0, 1); // Always false
}
/* Cache constant expressions in WHERE, HAVING, ON clauses. */
cache_const_exprs();
+ if (setup_semijoin_loosescan(this))
+ DBUG_RETURN(1);
+
if (make_join_select(this, select, conds))
{
zero_result_cause=
@@ -1551,7 +1570,6 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
if (thd->is_error())
{
error= 1;
- DBUG_PRINT("error",("Error from remove_const"));
DBUG_RETURN(1);
}
@@ -1574,14 +1592,14 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
The FROM clause must contain a single non-constant table.
*/
- if (table_count - const_tables == 1 && (group_list || select_distinct) &&
+ if (table_count - const_tables == 1 && (group || select_distinct) &&
!tmp_table_param.sum_func_count &&
(!join_tab[const_tables].select ||
!join_tab[const_tables].select->quick ||
join_tab[const_tables].select->quick->get_type() !=
QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX))
{
- if (group_list && rollup.state == ROLLUP::STATE_NONE &&
+ if (group && rollup.state == ROLLUP::STATE_NONE &&
list_contains_unique_index(join_tab[const_tables].table,
find_field_in_order_list,
(void *) group_list))
@@ -1627,7 +1645,7 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
select_distinct= 0;
}
}
- if (group_list || tmp_table_param.sum_func_count)
+ if (group || tmp_table_param.sum_func_count)
{
if (! hidden_group_fields && rollup.state == ROLLUP::STATE_NONE)
select_distinct=0;
@@ -1650,8 +1668,9 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
because in this case we can just create a temporary table that
holds LIMIT rows and stop when this table is full.
*/
- JOIN_TAB *tab= &join_tab[const_tables];
bool all_order_fields_used;
+
+ tab= &join_tab[const_tables];
if (order)
{
skip_sort_order= test_if_skip_sort_order(tab, order, select_limit, 1,
@@ -1692,32 +1711,29 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
else if (thd->is_fatal_error) // End of memory
DBUG_RETURN(1);
}
- simple_group= 0;
+ if (group)
{
- ORDER *old_group_list;
- group_list= remove_const(this, (old_group_list= group_list), conds,
+ /*
+ Update simple_group and group_list as we now have more information, like
+ which tables or columns are constant.
+ */
+ group_list= remove_const(this, group_list, conds,
rollup.state == ROLLUP::STATE_NONE,
- &simple_group);
+ &simple_group);
if (thd->is_error())
{
error= 1;
- DBUG_PRINT("error",("Error from remove_const"));
DBUG_RETURN(1);
}
- if (old_group_list && !group_list)
+ if (!group_list)
{
- DBUG_ASSERT(group);
+ /* The output has only one row */
+ order=0;
+ simple_order=1;
select_distinct= 0;
+ group_optimized_away= 1;
}
}
- if (!group_list && group)
- {
- order=0; // The output has only one row
- simple_order=1;
- select_distinct= 0; // No need in distinct for 1 row
- group_optimized_away= 1;
- }
-
calc_group_buffer(this, group_list);
send_group_parts= tmp_table_param.group_parts; /* Save org parts */
if (procedure && procedure->group)
@@ -1727,7 +1743,6 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
if (thd->is_error())
{
error= 1;
- DBUG_PRINT("error",("Error from remove_const"));
DBUG_RETURN(1);
}
calc_group_buffer(this, group_list);
@@ -1878,14 +1893,6 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
if ((select_lex->options & OPTION_SCHEMA_TABLE))
optimize_schema_tables_reads(this);
- tmp_having= having;
- if (select_options & SELECT_DESCRIBE)
- {
- error= 0;
- goto derived_exit;
- }
- having= 0;
-
/*
The loose index scan access method guarantees that all grouping or
duplicate row elimination (for distinct) is already performed
@@ -1909,6 +1916,11 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
error= 0;
+ tmp_having= having;
+ if (select_options & SELECT_DESCRIBE)
+ goto derived_exit;
+ having= 0;
+
DBUG_RETURN(0);
setup_subq_exit:
@@ -1946,8 +1958,9 @@ int JOIN::init_execution()
/*
Enable LIMIT ROWS EXAMINED during query execution if:
(1) This JOIN is the outermost query (not a subquery or derived table)
- This ensures that the limit is enabled when actual execution begins, and
- not if a subquery is evaluated during optimization of the outer query.
+ This ensures that the limit is enabled when actual execution begins,
+ and not if a subquery is evaluated during optimization of the outer
+ query.
(2) This JOIN is not the result of a UNION. In this case do not apply the
limit in order to produce the partial query result stored in the
UNION temp table.
@@ -2106,32 +2119,32 @@ bool JOIN::setup_subquery_caches()
select_lex->expr_cache_may_be_used[NO_MATTER])
{
if (conds)
- conds= conds->transform(&Item::expr_cache_insert_transformer,
- (uchar*) thd);
+ conds= conds->transform(thd, &Item::expr_cache_insert_transformer,
+ NULL);
JOIN_TAB *tab;
for (tab= first_linear_tab(this, WITH_BUSH_ROOTS, WITHOUT_CONST_TABLES);
tab; tab= next_linear_tab(this, tab, WITH_BUSH_ROOTS))
{
if (tab->select_cond)
tab->select_cond=
- tab->select_cond->transform(&Item::expr_cache_insert_transformer,
- (uchar*) thd);
+ tab->select_cond->transform(thd, &Item::expr_cache_insert_transformer,
+ NULL);
if (tab->cache_select && tab->cache_select->cond)
tab->cache_select->cond=
tab->cache_select->
- cond->transform(&Item::expr_cache_insert_transformer,
- (uchar*) thd);
+ cond->transform(thd, &Item::expr_cache_insert_transformer,
+ NULL);
}
if (having)
- having= having->transform(&Item::expr_cache_insert_transformer,
- (uchar*) thd);
+ having= having->transform(thd, &Item::expr_cache_insert_transformer,
+ NULL);
if (tmp_having)
{
DBUG_ASSERT(having == NULL);
- tmp_having= tmp_having->transform(&Item::expr_cache_insert_transformer,
- (uchar*) thd);
+ tmp_having= tmp_having->transform(thd, &Item::expr_cache_insert_transformer,
+ NULL);
}
}
if (select_lex->expr_cache_may_be_used[SELECT_LIST] ||
@@ -2143,17 +2156,18 @@ bool JOIN::setup_subquery_caches()
while ((item= li++))
{
Item *new_item=
- item->transform(&Item::expr_cache_insert_transformer, (uchar*) thd);
+ item->transform(thd, &Item::expr_cache_insert_transformer,
+ NULL);
if (new_item != item)
{
thd->change_item_tree(li.ref(), new_item);
}
}
- for (ORDER *group= group_list; group ; group= group->next)
+ for (ORDER *tmp_group= group_list; tmp_group ; tmp_group= tmp_group->next)
{
- *group->item=
- (*group->item)->transform(&Item::expr_cache_insert_transformer,
- (uchar*) thd);
+ *tmp_group->item=
+ (*tmp_group->item)->transform(thd, &Item::expr_cache_insert_transformer,
+ NULL);
}
}
if (select_lex->expr_cache_may_be_used[NO_MATTER])
@@ -2161,8 +2175,8 @@ bool JOIN::setup_subquery_caches()
for (ORDER *ord= order; ord; ord= ord->next)
{
*ord->item=
- (*ord->item)->transform(&Item::expr_cache_insert_transformer,
- (uchar*) thd);
+ (*ord->item)->transform(thd, &Item::expr_cache_insert_transformer,
+ NULL);
}
}
DBUG_RETURN(FALSE);
@@ -2430,7 +2444,7 @@ void JOIN::exec_inner()
if (procedure)
{
procedure_fields_list= fields_list;
- if (procedure->change_columns(procedure_fields_list) ||
+ if (procedure->change_columns(thd, procedure_fields_list) ||
result->prepare(procedure_fields_list, unit))
{
thd->set_examined_row_count(0);
@@ -2439,7 +2453,8 @@ void JOIN::exec_inner()
}
columns_list= &procedure_fields_list;
}
- (void) result->prepare2(); // Currently, this cannot fail.
+ if (result->prepare2())
+ DBUG_VOID_RETURN;
if (!tables_list && (table_count || !select_lex->with_sum_func))
{ // Only test of functions
@@ -2562,19 +2577,26 @@ void JOIN::exec_inner()
simple_order= simple_group;
skip_sort_order= 0;
}
- bool made_call= false;
- if (order &&
- (order != group_list || !(select_options & SELECT_BIG_RESULT)) &&
- (const_tables == table_count ||
- ((simple_order || skip_sort_order) &&
- (made_call=true) &&
- test_if_skip_sort_order(&join_tab[const_tables], order,
- select_limit, 0,
- &join_tab[const_tables].table->
+ if (order && join_tab)
+ {
+ bool made_call= false;
+ SQL_SELECT *tmp_select= join_tab[const_tables].select;
+ if ((order != group_list ||
+ !(select_options & SELECT_BIG_RESULT) ||
+ (tmp_select && tmp_select->quick &&
+ tmp_select->quick->get_type() ==
+ QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX)) &&
+ (const_tables == table_count ||
+ ((simple_order || skip_sort_order) &&
+ (made_call=true) &&
+ test_if_skip_sort_order(&join_tab[const_tables], order,
+ select_limit, 0,
+ &join_tab[const_tables].table->
keys_in_use_for_query))))
- order=0;
- if (made_call)
- join_tab[const_tables].update_explain_data(const_tables);
+ order=0;
+ if (made_call)
+ join_tab[const_tables].update_explain_data(const_tables);
+ }
having= tmp_having;
select_describe(this, need_tmp,
order != 0 && !skip_sort_order,
@@ -2607,7 +2629,7 @@ void JOIN::exec_inner()
must be accumulated in examined_row_count. Hence every join
iteration must count from zero.
*/
- curr_join->examined_rows= 0;
+ curr_join->join_examined_rows= 0;
/* Create a tmp table if distinct or if the sort is too complicated */
if (need_tmp)
@@ -2957,8 +2979,8 @@ void JOIN::exec_inner()
else
{
if (!(curr_table->select->cond=
- new Item_cond_and(curr_table->select->cond,
- sort_table_cond)))
+ new (thd->mem_root) Item_cond_and(thd, curr_table->select->cond,
+ sort_table_cond)))
DBUG_VOID_RETURN;
}
if (curr_table->pre_idx_push_select_cond)
@@ -2966,7 +2988,7 @@ void JOIN::exec_inner()
if (sort_table_cond->type() == Item::COND_ITEM)
sort_table_cond= sort_table_cond->copy_andor_structure(thd);
if (!(curr_table->pre_idx_push_select_cond=
- new Item_cond_and(curr_table->pre_idx_push_select_cond,
+ new (thd->mem_root) Item_cond_and(thd, curr_table->pre_idx_push_select_cond,
sort_table_cond)))
DBUG_VOID_RETURN;
}
@@ -3104,7 +3126,7 @@ void JOIN::exec_inner()
}
/* Accumulate the counts from all join iterations of all join parts. */
- thd->inc_examined_row_count(curr_join->examined_rows);
+ thd->inc_examined_row_count(curr_join->join_examined_rows);
DBUG_PRINT("counts", ("thd->examined_row_count: %lu",
(ulong) thd->get_examined_row_count()));
@@ -3600,7 +3622,8 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
if (s->dependent & s->table->map)
{
join->table_count=0; // Don't use join->table
- my_message(ER_WRONG_OUTER_JOIN, ER(ER_WRONG_OUTER_JOIN), MYF(0));
+ my_message(ER_WRONG_OUTER_JOIN,
+ ER_THD(join->thd, ER_WRONG_OUTER_JOIN), MYF(0));
goto error;
}
s->key_dependent= s->dependent;
@@ -3868,7 +3891,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
if (join->cond_value == Item::COND_FALSE)
{
join->impossible_where= true;
- conds=new Item_int((longlong) 0,1);
+ conds= new (join->thd->mem_root) Item_int(join->thd, (longlong) 0, 1);
}
join->cond_equal= NULL;
@@ -3883,7 +3906,8 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
if (!join->cond_equal)
join->cond_equal= new COND_EQUAL;
join->cond_equal->current_level.empty();
- join->cond_equal->current_level.push_back((Item_equal*) conds);
+ join->cond_equal->current_level.push_back((Item_equal*) conds,
+ join->thd->mem_root);
}
}
@@ -4072,7 +4096,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
{
memcpy((uchar*) join->best_positions,(uchar*) join->positions,
sizeof(POSITION)*join->const_tables);
- join->record_count= 1.0;
+ join->join_record_count= 1.0;
join->best_read=1.0;
}
@@ -4107,10 +4131,10 @@ error:
Dangling TABLE::reginfo.join_tab may cause part_of_refkey to choke.
*/
{
- TABLE_LIST *table;
- List_iterator<TABLE_LIST> ti(tables_list);
- while ((table= ti++))
- table->table->reginfo.join_tab= NULL;
+ TABLE_LIST *tmp_table;
+ List_iterator<TABLE_LIST> ti2(tables_list);
+ while ((tmp_table= ti2++))
+ tmp_table->table->reginfo.join_tab= NULL;
}
DBUG_RETURN (1);
}
@@ -4127,7 +4151,7 @@ error:
/// Used when finding key fields
struct KEY_FIELD {
Field *field;
- Item_func *cond;
+ Item_bool_func *cond;
Item *val; ///< May be empty if diff constant
uint level;
uint optimize;
@@ -4380,7 +4404,7 @@ static uint get_semi_join_select_list_index(Field *field)
static void
add_key_field(JOIN *join,
- KEY_FIELD **key_fields,uint and_level, Item_func *cond,
+ KEY_FIELD **key_fields,uint and_level, Item_bool_func *cond,
Field *field, bool eq_func, Item **value, uint num_values,
table_map usable_tables, SARGABLE_PARAM **sargables)
{
@@ -4532,7 +4556,7 @@ add_key_field(JOIN *join,
static void
add_key_equal_fields(JOIN *join, KEY_FIELD **key_fields, uint and_level,
- Item_func *cond, Item *field_item,
+ Item_bool_func *cond, Item *field_item,
bool eq_func, Item **val,
uint num_values, table_map usable_tables,
SARGABLE_PARAM **sargables)
@@ -4745,12 +4769,25 @@ Item_func_ne::add_key_fields(JOIN *join, KEY_FIELD **key_fields,
uint *and_level, table_map usable_tables,
SARGABLE_PARAM **sargables)
{
- if (is_local_field(args[0]) && !(used_tables() & OUTER_REF_TABLE_BIT))
+ if (!(used_tables() & OUTER_REF_TABLE_BIT))
{
- Item **values= is_local_field(args[1]) ? args : args + 1;
- add_key_equal_fields(join, key_fields, *and_level, this,
- (Item_field*) (args[0]->real_item()), false,
- values, 1, usable_tables, sargables);
+ /*
+ QQ: perhaps test for !is_local_field(args[1]) is not really needed here.
+ Other comparison functions, e.g. Item_func_le, Item_func_gt, etc,
+ do not have this test. See Item_bool_func2::add_key_field_optimize_op().
+ Check with the optimizer team.
+ */
+ if (is_local_field(args[0]) && !is_local_field(args[1]))
+ add_key_equal_fields(join, key_fields, *and_level, this,
+ (Item_field*) (args[0]->real_item()), false,
+ &args[1], 1, usable_tables, sargables);
+ /*
+ QQ: perhaps test for !is_local_field(args[0]) is not really needed here.
+ */
+ if (is_local_field(args[1]) && !is_local_field(args[0]))
+ add_key_equal_fields(join, key_fields, *and_level, this,
+ (Item_field*) (args[1]->real_item()), false,
+ &args[0], 1, usable_tables, sargables);
}
}
@@ -4760,8 +4797,7 @@ Item_func_like::add_key_fields(JOIN *join, KEY_FIELD **key_fields,
uint *and_level, table_map usable_tables,
SARGABLE_PARAM **sargables)
{
- if (is_local_field(args[0]) &&
- Item_func_like::select_optimize() == OPTIMIZE_OP)
+ if (is_local_field(args[0]) && with_sargable_pattern())
{
/*
SELECT * FROM t1 WHERE field LIKE const_pattern
@@ -4775,11 +4811,11 @@ Item_func_like::add_key_fields(JOIN *join, KEY_FIELD **key_fields,
void
-Item_bool_func::add_key_fields_optimize_op(JOIN *join, KEY_FIELD **key_fields,
- uint *and_level,
- table_map usable_tables,
- SARGABLE_PARAM **sargables,
- bool equal_func)
+Item_bool_func2::add_key_fields_optimize_op(JOIN *join, KEY_FIELD **key_fields,
+ uint *and_level,
+ table_map usable_tables,
+ SARGABLE_PARAM **sargables,
+ bool equal_func)
{
/* If item is of type 'field op field/constant' add it to key_fields */
if (is_local_field(args[0]))
@@ -4806,7 +4842,7 @@ Item_func_null_predicate::add_key_fields(JOIN *join, KEY_FIELD **key_fields,
/* column_name IS [NOT] NULL */
if (is_local_field(args[0]) && !(used_tables() & OUTER_REF_TABLE_BIT))
{
- Item *tmp= new Item_null;
+ Item *tmp= new (join->thd->mem_root) Item_null(join->thd);
if (unlikely(!tmp)) // Should never be true
return;
add_key_equal_fields(join, key_fields, *and_level, this,
@@ -4822,9 +4858,9 @@ Item_equal::add_key_fields(JOIN *join, KEY_FIELD **key_fields,
uint *and_level, table_map usable_tables,
SARGABLE_PARAM **sargables)
{
- Item *const_item= get_const();
+ Item *const_item2= get_const();
Item_equal_fields_iterator it(*this);
- if (const_item)
+ if (const_item2)
{
/*
@@ -4836,7 +4872,7 @@ Item_equal::add_key_fields(JOIN *join, KEY_FIELD **key_fields,
{
Field *equal_field= it.get_curr_field();
add_key_field(join, key_fields, *and_level, this, equal_field,
- TRUE, &const_item, 1, usable_tables, sargables);
+ TRUE, &const_item2, 1, usable_tables, sargables);
}
}
else
@@ -5210,6 +5246,8 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
KEY_FIELD *key_fields, *end, *field;
uint sz;
uint m= MY_MAX(select_lex->max_equal_elems,1);
+ DBUG_ENTER("update_ref_and_keys");
+ DBUG_PRINT("enter", ("normal_tables: %llx", normal_tables));
SELECT_LEX *sel=thd->lex->current_select;
sel->cond_count= 0;
@@ -5256,7 +5294,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
sz= MY_MAX(sizeof(KEY_FIELD),sizeof(SARGABLE_PARAM))*
((sel->cond_count*2 + sel->between_count)*m+1);
if (!(key_fields=(KEY_FIELD*) thd->alloc(sz)))
- return TRUE; /* purecov: inspected */
+ DBUG_RETURN(TRUE); /* purecov: inspected */
and_level= 0;
field= end= key_fields;
*sargables= (SARGABLE_PARAM *) key_fields +
@@ -5267,7 +5305,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
if (my_init_dynamic_array2(keyuse, sizeof(KEYUSE),
thd->alloc(sizeof(KEYUSE) * 20), 20, 64,
MYF(MY_THREAD_SPECIFIC)))
- return TRUE;
+ DBUG_RETURN(TRUE);
if (cond)
{
@@ -5318,16 +5356,16 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
for ( ; field != end ; field++)
{
if (add_key_part(keyuse,field))
- return TRUE;
+ DBUG_RETURN(TRUE);
}
if (select_lex->ftfunc_list->elements)
{
if (add_ft_keys(keyuse,join_tab,cond,normal_tables))
- return TRUE;
+ DBUG_RETURN(TRUE);
}
- return FALSE;
+ DBUG_RETURN(FALSE);
}
@@ -5535,7 +5573,7 @@ is_indexed_agg_distinct(JOIN *join, List<Item_field> *out_args)
Item_field* item= static_cast<Item_field*>(expr->real_item());
if (out_args)
- out_args->push_back(item);
+ out_args->push_back(item, join->thd->mem_root);
cur_aggdistinct_fields.set_bit(item->field->field_index);
result= true;
@@ -5934,7 +5972,6 @@ best_access_path(JOIN *join,
}
else
{
- uint key_parts= table->actual_n_key_parts(keyinfo);
if (!(records= keyinfo->actual_rec_per_key(key_parts-1)))
{ /* Prefer longer keys */
records=
@@ -6859,7 +6896,7 @@ optimize_straight_join(JOIN *join, table_map join_tables)
read_time+= record_count; // We have to make a temp table
memcpy((uchar*) join->best_positions, (uchar*) join->positions,
sizeof(POSITION)*idx);
- join->record_count= record_count;
+ join->join_record_count= record_count;
join->best_read= read_time - 0.001;
}
@@ -7202,12 +7239,13 @@ double JOIN::get_examined_rows()
{
double examined_rows;
double prev_fanout= 1;
- JOIN_TAB *tab= first_breadth_first_tab(this, WALK_OPTIMIZATION_TABS);
+ JOIN_TAB *tab= first_breadth_first_optimization_tab();
JOIN_TAB *prev_tab= tab;
examined_rows= tab->get_examined_rows();
- while ((tab= next_breadth_first_tab(this, WALK_OPTIMIZATION_TABS, tab)))
+ while ((tab= next_breadth_first_tab(first_breadth_first_optimization_tab(),
+ top_table_access_tabs_count, tab)))
{
prev_fanout *= prev_tab->records_read;
examined_rows+= tab->get_examined_rows() * prev_fanout;
@@ -7262,7 +7300,6 @@ double table_multi_eq_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s,
if (item_equal->get_const())
continue;
- Field *fld;
bool adjust_sel= FALSE;
Item_equal_fields_iterator fi(*item_equal);
while((fi++) && !adjust_sel)
@@ -7328,7 +7365,7 @@ double table_multi_eq_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s,
while ((fi++))
{
double curr_eq_fld_sel;
- fld= fi.get_curr_field();
+ Field *fld= fi.get_curr_field();
if (!fld->table->map & ~(table_bit | rem_tables))
continue;
curr_eq_fld_sel= get_column_avg_frequency(fld) /
@@ -7840,7 +7877,7 @@ best_extension_by_limited_search(JOIN *join,
{
memcpy((uchar*) join->best_positions, (uchar*) join->positions,
sizeof(POSITION) * (idx + 1));
- join->record_count= partial_join_cardinality;
+ join->join_record_count= partial_join_cardinality;
join->best_read= current_read_time - 0.001;
}
DBUG_EXECUTE("opt", print_plan(join, idx+1,
@@ -8201,21 +8238,9 @@ prev_record_reads(POSITION *positions, uint idx, table_map found_ref)
Enumerate join tabs in breadth-first fashion, including const tables.
*/
-JOIN_TAB *first_breadth_first_tab(JOIN *join, enum enum_exec_or_opt tabs_kind)
-{
- /* There's always one (i.e. first) table */
- return (tabs_kind == WALK_EXECUTION_TABS)? join->join_tab:
- join->table_access_tabs;
-}
-
-
-JOIN_TAB *next_breadth_first_tab(JOIN *join, enum enum_exec_or_opt tabs_kind,
- JOIN_TAB *tab)
+static JOIN_TAB *next_breadth_first_tab(JOIN_TAB *first_top_tab,
+ uint n_top_tabs_count, JOIN_TAB *tab)
{
- JOIN_TAB* const first_top_tab= first_breadth_first_tab(join, tabs_kind);
- const uint n_top_tabs_count= (tabs_kind == WALK_EXECUTION_TABS)?
- join->top_join_tab_count:
- join->top_table_access_tabs_count;
if (!tab->bush_root_tab)
{
/* We're at top level. Get the next top-level tab */
@@ -8307,7 +8332,8 @@ JOIN_TAB *first_top_level_tab(JOIN *join, enum enum_with_const_tables const_tbls
JOIN_TAB *next_top_level_tab(JOIN *join, JOIN_TAB *tab)
{
- tab= next_breadth_first_tab(join, WALK_EXECUTION_TABS, tab);
+ tab= next_breadth_first_tab(join->first_breadth_first_execution_tab(),
+ join->top_join_tab_count, tab);
if (tab && tab->bush_root_tab)
tab= NULL;
return tab;
@@ -8549,7 +8575,7 @@ get_best_combination(JOIN *join)
DBUG_RETURN(TRUE);
jt_range->start= jt;
jt_range->end= jt + sjm->tables;
- join->join_tab_ranges.push_back(jt_range);
+ join->join_tab_ranges.push_back(jt_range, join->thd->mem_root);
j->bush_children= jt_range;
sjm_nest_end= jt + sjm->tables;
sjm_nest_root= j;
@@ -9136,7 +9162,7 @@ inline void add_cond_and_fix(THD *thd, Item **e1, Item *e2)
if (!e2)
return;
Item *res;
- if ((res= new Item_cond_and(*e1, e2)))
+ if ((res= new (thd->mem_root) Item_cond_and(thd, *e1, e2)))
{
res->fix_fields(thd, 0);
res->update_used_tables();
@@ -9237,7 +9263,8 @@ static void add_not_null_conds(JOIN *join)
*/
if (!referred_tab)
continue;
- if (!(notnull= new Item_func_isnotnull(not_null_item)))
+ if (!(notnull= new (join->thd->mem_root)
+ Item_func_isnotnull(join->thd, not_null_item)))
DBUG_VOID_RETURN;
/*
We need to do full fix_fields() call here in order to have correct
@@ -9293,14 +9320,15 @@ static void add_not_null_conds(JOIN *join)
*/
static COND*
-add_found_match_trig_cond(JOIN_TAB *tab, COND *cond, JOIN_TAB *root_tab)
+add_found_match_trig_cond(THD *thd, JOIN_TAB *tab, COND *cond,
+ JOIN_TAB *root_tab)
{
COND *tmp;
DBUG_ASSERT(cond != 0);
if (tab == root_tab)
return cond;
- if ((tmp= add_found_match_trig_cond(tab->first_upper, cond, root_tab)))
- tmp= new Item_func_trig_cond(tmp, &tab->found);
+ if ((tmp= add_found_match_trig_cond(thd, tab->first_upper, cond, root_tab)))
+ tmp= new (thd->mem_root) Item_func_trig_cond(thd, tmp, &tab->found);
if (tmp)
{
tmp->quick_fix_field();
@@ -9387,7 +9415,8 @@ make_outerjoin_info(JOIN *join)
}
}
- for (JOIN_TAB *tab= first_linear_tab(join, WITH_BUSH_ROOTS, WITHOUT_CONST_TABLES); tab;
+ for (tab= first_linear_tab(join, WITH_BUSH_ROOTS, WITHOUT_CONST_TABLES);
+ tab;
tab= next_linear_tab(join, tab, WITH_BUSH_ROOTS))
{
TABLE *table= tab->table;
@@ -9606,8 +9635,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
if (tab->bush_children)
{
// Reached the materialization tab
- tmp= make_cond_after_sjm(cond, cond, save_used_tables, used_tables,
- /*inside_or_clause=*/FALSE);
+ tmp= make_cond_after_sjm(thd, cond, cond, save_used_tables,
+ used_tables, /*inside_or_clause=*/FALSE);
used_tables= save_used_tables | used_tables;
save_used_tables= 0;
}
@@ -9651,7 +9680,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
below to check if we should use 'quick' instead.
*/
DBUG_PRINT("info", ("Item_int"));
- tmp= new Item_int((longlong) 1,1); // Always true
+ tmp= new (thd->mem_root) Item_int(thd, (longlong) 1, 1); // Always true
}
}
@@ -9678,10 +9707,12 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
Because of QUICK_GROUP_MIN_MAX_SELECT there may be a select without
a cond, so neutralize the hack above.
*/
- if (!(tmp= add_found_match_trig_cond(first_inner_tab, tmp, 0)))
+ COND *tmp_cond;
+ if (!(tmp_cond= add_found_match_trig_cond(thd, first_inner_tab, tmp,
+ 0)))
DBUG_RETURN(1);
- sel->cond= tmp;
- tab->set_select_cond(tmp, __LINE__);
+ sel->cond= tmp_cond;
+ tab->set_select_cond(tmp_cond, __LINE__);
/* Push condition to storage engine if this is enabled
and the condition is not guarded */
if (tab->table)
@@ -9692,7 +9723,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
!first_inner_tab)
{
COND *push_cond=
- make_cond_for_table(thd, tmp, current_map, current_map,
+ make_cond_for_table(thd, tmp_cond, current_map, current_map,
-1, FALSE, FALSE);
if (push_cond)
{
@@ -9752,9 +9783,14 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
Check again if we should use an index.
We could have used an column from a previous table in
the index if we are using limit and this is the first table
+
+ (1) - Don't switch the used index if we are using semi-join
+ LooseScan on this table. Using different index will not
+ produce the desired ordering and de-duplication.
*/
if (!tab->table->is_filled_at_execution() &&
+ !tab->loosescan_match_tab && // (1)
((cond && (!tab->keys.is_subset(tab->const_keys) && i > 0)) ||
(!tab->const_keys.is_clear_all() && i == join->const_tables &&
join->unit->select_limit_cnt <
@@ -9763,7 +9799,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
{
/* Join with outer join condition */
COND *orig_cond=sel->cond;
- sel->cond= and_conds(sel->cond, *tab->on_expr_ref);
+ sel->cond= and_conds(thd, sel->cond, *tab->on_expr_ref);
/*
We can't call sel->cond->fix_fields,
@@ -9814,10 +9850,24 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
if (!sel->quick_keys.is_subset(tab->checked_keys) ||
!sel->needed_reg.is_subset(tab->checked_keys))
{
+ /*
+ "Range checked for each record" is a "last resort" access method
+ that should only be used when the other option is a cross-product
+ join.
+
+ We use the following condition (it's approximate):
+ 1. There are potential keys for (sel->needed_reg)
+ 2. There were no possible ways to construct a quick select, or
+ the quick select would be more expensive than the full table
+ scan.
+ */
tab->use_quick= (!sel->needed_reg.is_clear_all() &&
(sel->quick_keys.is_clear_all() ||
- (sel->quick &&
- (sel->quick->records >= 100L)))) ?
+ (sel->quick &&
+ sel->quick->read_time >
+ tab->table->file->scan_time() +
+ tab->table->file->stats.records/TIME_FOR_COMPARE
+ ))) ?
2 : 1;
sel->read_tables= used_tables & ~current_map;
sel->quick_keys.clear_all();
@@ -9863,17 +9913,19 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
if (*join_tab->on_expr_ref)
{
JOIN_TAB *cond_tab= join_tab->first_inner;
- COND *tmp= make_cond_for_table(thd, *join_tab->on_expr_ref,
- join->const_table_map,
- (table_map) 0, -1, FALSE, FALSE);
- if (!tmp)
+ COND *tmp_cond= make_cond_for_table(thd, *join_tab->on_expr_ref,
+ join->const_table_map,
+ (table_map) 0, -1, FALSE, FALSE);
+ if (!tmp_cond)
continue;
- tmp= new Item_func_trig_cond(tmp, &cond_tab->not_null_compl);
- if (!tmp)
+ tmp_cond= new (thd->mem_root) Item_func_trig_cond(thd, tmp_cond,
+ &cond_tab->not_null_compl);
+ if (!tmp_cond)
DBUG_RETURN(1);
- tmp->quick_fix_field();
- cond_tab->select_cond= !cond_tab->select_cond ? tmp :
- new Item_cond_and(cond_tab->select_cond,tmp);
+ tmp_cond->quick_fix_field();
+ cond_tab->select_cond= !cond_tab->select_cond ? tmp_cond :
+ new (thd->mem_root) Item_cond_and(thd, cond_tab->select_cond,
+ tmp_cond);
if (!cond_tab->select_cond)
DBUG_RETURN(1);
cond_tab->select_cond->quick_fix_field();
@@ -9905,23 +9957,26 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
start_from= tab->bush_root_tab?
tab->bush_root_tab->bush_children->start :
join->join_tab + join->const_tables;
- for (JOIN_TAB *tab= start_from; tab <= last_tab; tab++)
+ for (JOIN_TAB *inner_tab= start_from;
+ inner_tab <= last_tab;
+ inner_tab++)
{
- DBUG_ASSERT(tab->table);
- current_map= tab->table->map;
+ DBUG_ASSERT(inner_tab->table);
+ current_map= inner_tab->table->map;
used_tables2|= current_map;
/*
psergey: have put the -1 below. It's bad, will need to fix it.
*/
COND *tmp_cond= make_cond_for_table(thd, on_expr, used_tables2,
- current_map, /*(tab - first_tab)*/ -1,
+ current_map,
+ /*(inner_tab - first_tab)*/ -1,
FALSE, FALSE);
bool is_sjm_lookup_tab= FALSE;
- if (tab->bush_children)
+ if (inner_tab->bush_children)
{
/*
- 'tab' is an SJ-Materialization tab, i.e. we have a join order
- like this:
+ 'inner_tab' is an SJ-Materialization tab, i.e. we have a join
+ order like this:
ot1 sjm_tab LEFT JOIN ot2 ot3
^ ^
@@ -9941,24 +9996,27 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
would be true anyway.
*/
SJ_MATERIALIZATION_INFO *sjm=
- tab->bush_children->start->emb_sj_nest->sj_mat_info;
+ inner_tab->bush_children->start->emb_sj_nest->sj_mat_info;
if (sjm->is_used && !sjm->is_sj_scan)
is_sjm_lookup_tab= TRUE;
}
- if (tab == first_inner_tab && tab->on_precond && !is_sjm_lookup_tab)
- add_cond_and_fix(thd, &tmp_cond, tab->on_precond);
+ if (inner_tab == first_inner_tab && inner_tab->on_precond &&
+ !is_sjm_lookup_tab)
+ add_cond_and_fix(thd, &tmp_cond, inner_tab->on_precond);
if (tmp_cond && !is_sjm_lookup_tab)
{
- JOIN_TAB *cond_tab= tab < first_inner_tab ? first_inner_tab : tab;
- Item **sel_cond_ref= tab < first_inner_tab ?
- &first_inner_tab->on_precond :
- &tab->select_cond;
+ JOIN_TAB *cond_tab= (inner_tab < first_inner_tab ?
+ first_inner_tab : inner_tab);
+ Item **sel_cond_ref= (inner_tab < first_inner_tab ?
+ &first_inner_tab->on_precond :
+ &inner_tab->select_cond);
/*
First add the guards for match variables of
all embedding outer join operations.
*/
- if (!(tmp_cond= add_found_match_trig_cond(cond_tab->first_inner,
+ if (!(tmp_cond= add_found_match_trig_cond(thd,
+ cond_tab->first_inner,
tmp_cond,
first_inner_tab)))
DBUG_RETURN(1);
@@ -9967,7 +10025,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
the null complemented row.
*/
DBUG_PRINT("info", ("Item_func_trig_cond"));
- tmp_cond= new Item_func_trig_cond(tmp_cond,
+ tmp_cond= new (thd->mem_root) Item_func_trig_cond(thd, tmp_cond,
&first_inner_tab->
not_null_compl);
DBUG_PRINT("info", ("Item_func_trig_cond 0x%lx",
@@ -9978,7 +10036,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
DBUG_PRINT("info", ("Item_cond_and"));
*sel_cond_ref= !(*sel_cond_ref) ?
tmp_cond :
- new Item_cond_and(*sel_cond_ref, tmp_cond);
+ new (thd->mem_root) Item_cond_and(thd, *sel_cond_ref, tmp_cond);
DBUG_PRINT("info", ("Item_cond_and 0x%lx",
(ulong)(*sel_cond_ref)));
if (!(*sel_cond_ref))
@@ -10181,21 +10239,21 @@ void JOIN::drop_unused_derived_keys()
tab= next_linear_tab(this, tab, WITH_BUSH_ROOTS))
{
- TABLE *table=tab->table;
- if (!table)
+ TABLE *tmp_tbl= tab->table;
+ if (!tmp_tbl)
continue;
- if (!table->pos_in_table_list->is_materialized_derived())
+ if (!tmp_tbl->pos_in_table_list->is_materialized_derived())
continue;
- if (table->max_keys > 1)
- table->use_index(tab->ref.key);
- if (table->s->keys)
+ if (tmp_tbl->max_keys > 1)
+ tmp_tbl->use_index(tab->ref.key);
+ if (tmp_tbl->s->keys)
{
if (tab->ref.key >= 0)
tab->ref.key= 0;
else
- table->s->keys= 0;
+ tmp_tbl->s->keys= 0;
}
- tab->keys= (key_map) (table->s->keys ? 1 : 0);
+ tab->keys= (key_map) (tmp_tbl->s->keys ? 1 : 0);
}
}
@@ -10966,7 +11024,8 @@ void JOIN_TAB::remove_redundant_bnl_scan_conds()
{
List_iterator<Item> pushed_cond_li(*((Item_cond*) select_cond)->argument_list());
Item *pushed_item;
- Item_cond_and *reduced_select_cond= new Item_cond_and;
+ Item_cond_and *reduced_select_cond= new (join->thd->mem_root)
+ Item_cond_and(join->thd);
if (is_cond_and(cache_select->cond))
{
@@ -10974,18 +11033,18 @@ void JOIN_TAB::remove_redundant_bnl_scan_conds()
Item *scan_item;
while ((pushed_item= pushed_cond_li++))
{
- bool found= false;
+ bool found_cond= false;
scan_cond_li.rewind();
while ((scan_item= scan_cond_li++))
{
if (pushed_item->eq(scan_item, 0))
{
- found= true;
+ found_cond= true;
break;
}
}
- if (!found)
- reduced_select_cond->add(pushed_item);
+ if (!found_cond)
+ reduced_select_cond->add(pushed_item, join->thd->mem_root);
}
}
else
@@ -10993,7 +11052,7 @@ void JOIN_TAB::remove_redundant_bnl_scan_conds()
while ((pushed_item= pushed_cond_li++))
{
if (!pushed_item->eq(cache_select->cond, 0))
- reduced_select_cond->add(pushed_item);
+ reduced_select_cond->add(pushed_item, join->thd->mem_root);
}
}
@@ -11361,7 +11420,8 @@ bool error_if_full_join(JOIN *join)
if (tab->type == JT_ALL && (!tab->select || !tab->select->quick))
{
my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE,
- ER(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE), MYF(0));
+ ER_THD(join->thd,
+ ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE), MYF(0));
return(1);
}
}
@@ -11800,27 +11860,21 @@ void JOIN::cleanup(bool full)
w/o tables: they don't have some members initialized and
WALK_OPTIMIZATION_TABS may not work correctly for them.
*/
- enum enum_exec_or_opt tabs_kind;
- if (first_breadth_first_tab(this, WALK_OPTIMIZATION_TABS))
- tabs_kind= WALK_OPTIMIZATION_TABS;
- else
- tabs_kind= WALK_EXECUTION_TABS;
if (table_count)
{
- for (tab= first_breadth_first_tab(this, tabs_kind); tab;
- tab= next_breadth_first_tab(this, tabs_kind, tab))
- {
+ for (tab= first_breadth_first_optimization_tab(); tab;
+ tab= next_breadth_first_tab(first_breadth_first_optimization_tab(),
+ top_table_access_tabs_count, tab))
tab->cleanup();
- }
- if (tabs_kind == WALK_OPTIMIZATION_TABS &&
- first_breadth_first_tab(this, WALK_OPTIMIZATION_TABS) !=
- first_breadth_first_tab(this, WALK_EXECUTION_TABS))
+ /* We've walked optimization tabs, do execution ones too. */
+ if (first_breadth_first_execution_tab() !=
+ first_breadth_first_optimization_tab())
{
- JOIN_TAB *jt= first_breadth_first_tab(this, WALK_EXECUTION_TABS);
- /* We've walked optimization tabs. do execution ones too */
- if (jt)
- jt->cleanup();
+ for (tab= first_breadth_first_execution_tab(); tab;
+ tab= next_breadth_first_tab(first_breadth_first_execution_tab(),
+ top_join_tab_count, tab))
+ tab->cleanup();
}
}
cleaned= true;
@@ -12026,7 +12080,8 @@ static void update_depend_map_for_order(JOIN *join, ORDER *order)
order->used= 0;
// Not item_sum(), RAND() and no reference to table outside of sub select
if (!(order->depend_map & (OUTER_REF_TABLE_BIT | RAND_TABLE_BIT))
- && !order->item[0]->with_sum_func)
+ && !order->item[0]->with_sum_func &&
+ join->join_tab)
{
for (JOIN_TAB **tab=join->map2table;
depend_map ;
@@ -12054,7 +12109,8 @@ static void update_depend_map_for_order(JOIN *join, ORDER *order)
@param cond WHERE statement
@param change_list Set to 1 if we should remove things from list.
If this is not set, then only simple_order is
- calculated.
+ calculated. This is not set when we
+ are using ROLLUP
@param simple_order Set to 1 if we are only using simple
expressions.
@@ -12066,6 +12122,7 @@ static ORDER *
remove_const(JOIN *join,ORDER *first_order, COND *cond,
bool change_list, bool *simple_order)
{
+ *simple_order= 1;
if (join->table_count == join->const_tables)
return change_list ? 0 : first_order; // No need to sort
@@ -12076,23 +12133,37 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond,
bool first_is_base_table= FALSE;
DBUG_ENTER("remove_const");
- if (join->join_tab[join->const_tables].table)
- {
- first_table= join->join_tab[join->const_tables].table->map;
- first_is_base_table= TRUE;
- }
-
/*
- Cleanup to avoid interference of calls of this function for
- ORDER BY and GROUP BY
+ Join tab is set after make_join_statistics() has been called.
+ In case of one table with GROUP BY this function is called before
+ join_tab is set for the GROUP_BY expression
*/
- for (JOIN_TAB *tab= join->join_tab + join->const_tables;
- tab < join->join_tab + join->table_count;
- tab++)
- tab->cached_eq_ref_table= FALSE;
+ if (join->join_tab)
+ {
+ if (join->join_tab[join->const_tables].table)
+ {
+ first_table= join->join_tab[join->const_tables].table->map;
+ first_is_base_table= TRUE;
+ }
+
+ /*
+ Cleanup to avoid interference of calls of this function for
+ ORDER BY and GROUP BY
+ */
+ for (JOIN_TAB *tab= join->join_tab + join->const_tables;
+ tab < join->join_tab + join->table_count;
+ tab++)
+ tab->cached_eq_ref_table= FALSE;
+
+ *simple_order= *join->join_tab[join->const_tables].on_expr_ref ? 0 : 1;
+ }
+ else
+ {
+ first_is_base_table= FALSE;
+ first_table= 0; // Not used, for gcc
+ }
prev_ptr= &first_order;
- *simple_order= *join->join_tab[join->const_tables].on_expr_ref ? 0 : 1;
/* NOTE: A variable of not_const_tables ^ first_table; breaks gcc 2.7 */
@@ -12122,7 +12193,8 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond,
Delay the evaluation of constant ORDER and/or GROUP expressions that
contain subqueries until the execution phase.
*/
- join->exec_const_order_group_cond.push_back(order->item[0]);
+ join->exec_const_order_group_cond.push_back(order->item[0],
+ join->thd->mem_root);
}
DBUG_PRINT("info",("removing: %s", order->item[0]->full_name()));
continue;
@@ -12138,7 +12210,8 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond,
DBUG_PRINT("info",("removing: %s", order->item[0]->full_name()));
continue;
}
- if (first_is_base_table && (ref=order_tables & (not_const_tables ^ first_table)))
+ if (first_is_base_table &&
+ (ref=order_tables & (not_const_tables ^ first_table)))
{
if (!(order_tables & first_table) &&
only_eq_ref_tables(join,first_order, ref))
@@ -12169,6 +12242,10 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond,
*prev_ptr=0;
if (prev_ptr == &first_order) // Nothing to sort/group
*simple_order=1;
+#ifndef DBUG_OFF
+ if (join->thd->is_error())
+ DBUG_PRINT("error",("Error from remove_const"));
+#endif
DBUG_PRINT("exit",("simple_order: %d",(int) *simple_order));
DBUG_RETURN(first_order);
}
@@ -12445,8 +12522,9 @@ finish:
FALSE otherwise
*/
-static bool check_simple_equality(THD *thd, Item *left_item, Item *right_item,
- Item *item, COND_EQUAL *cond_equal)
+static bool check_simple_equality(THD *thd, const Item::Context &ctx,
+ Item *left_item, Item *right_item,
+ COND_EQUAL *cond_equal)
{
Item *orig_left_item= left_item;
Item *orig_right_item= right_item;
@@ -12502,23 +12580,23 @@ static bool check_simple_equality(THD *thd, Item *left_item, Item *right_item,
if (left_copyfl)
{
/* left_item_equal of an upper level contains left_item */
- left_item_equal= new (thd->mem_root) Item_equal(left_item_equal);
+ left_item_equal= new (thd->mem_root) Item_equal(thd, left_item_equal);
left_item_equal->set_context_field(((Item_field*) left_item));
- cond_equal->current_level.push_back(left_item_equal);
+ cond_equal->current_level.push_back(left_item_equal, thd->mem_root);
}
if (right_copyfl)
{
/* right_item_equal of an upper level contains right_item */
- right_item_equal= new (thd->mem_root) Item_equal(right_item_equal);
+ right_item_equal= new (thd->mem_root) Item_equal(thd, right_item_equal);
right_item_equal->set_context_field(((Item_field*) right_item));
- cond_equal->current_level.push_back(right_item_equal);
+ cond_equal->current_level.push_back(right_item_equal, thd->mem_root);
}
if (left_item_equal)
{
/* left item was found in the current or one of the upper levels */
if (! right_item_equal)
- left_item_equal->add(orig_right_item);
+ left_item_equal->add(orig_right_item, thd->mem_root);
else
{
/* Merge two multiple equalities forming a new one */
@@ -12533,15 +12611,16 @@ static bool check_simple_equality(THD *thd, Item *left_item, Item *right_item,
{
/* left item was not found neither the current nor in upper levels */
if (right_item_equal)
- right_item_equal->add(orig_left_item);
+ right_item_equal->add(orig_left_item, thd->mem_root);
else
{
/* None of the fields was found in multiple equalities */
- Item_equal *item_equal= new (thd->mem_root) Item_equal(orig_left_item,
+ Item_equal *item_equal= new (thd->mem_root) Item_equal(thd,
+ orig_left_item,
orig_right_item,
FALSE);
item_equal->set_context_field((Item_field*)left_item);
- cond_equal->current_level.push_back(item_equal);
+ cond_equal->current_level.push_back(item_equal, thd->mem_root);
}
}
return TRUE;
@@ -12570,36 +12649,49 @@ static bool check_simple_equality(THD *thd, Item *left_item, Item *right_item,
}
if (const_item &&
- field_item->result_type() == const_item->result_type())
+ field_item->field->test_if_equality_guarantees_uniqueness(const_item))
{
+ /*
+ field_item and const_item are arguments of a scalar or a row
+ comparison function:
+ WHERE column=constant
+ WHERE (column, ...) = (constant, ...)
+
+ The owner comparison function has previously called fix_fields(),
+ so field_item and const_item should be directly comparable items,
+ field_item->cmp_context and const_item->cmp_context should be set.
+ In case of string comparison, charsets and collations of
+ field_item and const_item should have already be aggregated
+ for comparison, all necessary character set converters installed
+ and fixed.
+
+ In case of string comparison, const_item can be either:
+ - a weaker constant that does not need to be converted to field_item:
+ WHERE latin1_field = 'latin1_const'
+ WHERE varbinary_field = 'latin1_const'
+ WHERE latin1_bin_field = 'latin1_general_ci_const'
+ - a stronger constant that does not need to be converted to field_item:
+ WHERE latin1_field = binary 0xDF
+ WHERE latin1_field = 'a' COLLATE latin1_bin
+ - a result of conversion (e.g. from the session character set)
+ to the character set of field_item:
+ WHERE latin1_field = 'utf8_string_with_latin1_repertoire'
+ */
bool copyfl;
- if (field_item->cmp_type() == STRING_RESULT)
- {
- CHARSET_INFO *cs= field_item->field->charset();
- if (!item)
- {
- Item_func_eq *eq_item;
- if (!(eq_item= new (thd->mem_root) Item_func_eq(orig_left_item,
- orig_right_item)) ||
- eq_item->set_cmp_func())
- return FALSE;
- eq_item->quick_fix_field();
- item= eq_item;
- }
- if ((cs != ((Item_func *) item)->compare_collation()) ||
- !cs->coll->propagate(cs, 0, 0))
- return FALSE;
- }
-
Item_equal *item_equal = find_item_equal(cond_equal,
field_item->field, &copyfl);
if (copyfl)
{
- item_equal= new (thd->mem_root) Item_equal(item_equal);
- cond_equal->current_level.push_back(item_equal);
+ item_equal= new (thd->mem_root) Item_equal(thd, item_equal);
+ cond_equal->current_level.push_back(item_equal, thd->mem_root);
item_equal->set_context_field(field_item);
}
+ Item *const_item2= field_item->field->get_equal_const_item(thd, ctx,
+ const_item);
+ if (!const_item2)
+ return false;
+
if (item_equal)
{
/*
@@ -12607,12 +12699,12 @@ static bool check_simple_equality(THD *thd, Item *left_item, Item *right_item,
already contains a constant and its value is not equal to
the value of const_item.
*/
- item_equal->add_const(thd, const_item, orig_field_item);
+ item_equal->add_const(thd, const_item2);
}
else
{
- item_equal= new (thd->mem_root) Item_equal(const_item, orig_field_item,
- TRUE);
+ item_equal= new (thd->mem_root) Item_equal(thd, const_item2,
+ orig_field_item, TRUE);
item_equal->set_context_field(field_item);
cond_equal->current_level.push_back(item_equal, thd->mem_root);
}
@@ -12649,7 +12741,8 @@ static bool check_simple_equality(THD *thd, Item *left_item, Item *right_item,
FALSE otherwise
*/
-static bool check_row_equality(THD *thd, Item *left_row, Item_row *right_row,
+static bool check_row_equality(THD *thd, const Arg_comparator *comparators,
+ Item *left_row, Item_row *right_row,
COND_EQUAL *cond_equal, List<Item>* eq_list)
{
uint n= left_row->cols();
@@ -12661,25 +12754,31 @@ static bool check_row_equality(THD *thd, Item *left_row, Item_row *right_row,
if (left_item->type() == Item::ROW_ITEM &&
right_item->type() == Item::ROW_ITEM)
{
- is_converted= check_row_equality(thd,
+ is_converted= check_row_equality(thd,
+ comparators[i].subcomparators(),
(Item_row *) left_item,
(Item_row *) right_item,
cond_equal, eq_list);
}
else
{
- is_converted= check_simple_equality(thd, left_item, right_item, 0,
+ const Arg_comparator *tmp= &comparators[i];
+ is_converted= check_simple_equality(thd,
+ Item::Context(Item::ANY_SUBST,
+ tmp->compare_type(),
+ tmp->cmp_collation.collation),
+ left_item, right_item,
cond_equal);
}
if (!is_converted)
{
Item_func_eq *eq_item;
- if (!(eq_item= new Item_func_eq(left_item, right_item)) ||
+ if (!(eq_item= new (thd->mem_root) Item_func_eq(thd, left_item, right_item)) ||
eq_item->set_cmp_func())
return FALSE;
eq_item->quick_fix_field();
- eq_list->push_back(eq_item);
+ eq_list->push_back(eq_item, thd->mem_root);
}
}
return TRUE;
@@ -12726,11 +12825,16 @@ bool Item_func_eq::check_equality(THD *thd, COND_EQUAL *cond_equal,
right_item->type() == Item::ROW_ITEM)
{
return check_row_equality(thd,
+ cmp.subcomparators(),
(Item_row *) left_item,
(Item_row *) right_item,
cond_equal, eq_list);
}
- return check_simple_equality(thd, left_item, right_item, this, cond_equal);
+ return check_simple_equality(thd,
+ Context(ANY_SUBST,
+ compare_type(),
+ compare_collation()),
+ left_item, right_item, cond_equal);
}
@@ -12812,9 +12916,9 @@ COND *Item_cond_and::build_equal_items(THD *thd,
cond_equal.upper_levels= inherited;
List<Item> eq_list;
- List<Item> *args= argument_list();
+ List<Item> *cond_args= argument_list();
- List_iterator<Item> li(*args);
+ List_iterator<Item> li(*cond_args);
Item *item;
DBUG_ASSERT(!cond_equal_ref || !cond_equal_ref[0]);
@@ -12839,10 +12943,10 @@ COND *Item_cond_and::build_equal_items(THD *thd,
Check if we eliminated all the predicates of the level, e.g.
(a=a AND b=b AND a=a).
*/
- if (!args->elements &&
+ if (!cond_args->elements &&
!cond_equal.current_level.elements &&
!eq_list.elements)
- return new (thd->mem_root) Item_int((longlong) 1, 1);
+ return new (thd->mem_root) Item_int(thd, (longlong) 1, 1);
List_iterator_fast<Item_equal> it(cond_equal.current_level);
while ((item_equal= it++))
@@ -12872,14 +12976,14 @@ COND *Item_cond_and::build_equal_items(THD *thd,
/* This replacement happens only for standalone equalities */
/*
This is ok with PS/SP as the replacement is done for
- arguments of an AND/OR item, which are restored for each
+ cond_args of an AND/OR item, which are restored for each
execution of PS/SP.
*/
li.replace(new_item);
}
}
- args->append(&eq_list);
- args->append((List<Item> *)&cond_equal.current_level);
+ cond_args->append(&eq_list);
+ cond_args->append((List<Item> *)&cond_equal.current_level);
update_used_tables();
if (cond_equal_ref)
*cond_equal_ref= &m_cond_equal;
@@ -12892,9 +12996,9 @@ COND *Item_cond::build_equal_items(THD *thd,
bool link_item_fields,
COND_EQUAL **cond_equal_ref)
{
- List<Item> *args= argument_list();
+ List<Item> *cond_args= argument_list();
- List_iterator<Item> li(*args);
+ List_iterator<Item> li(*cond_args);
Item *item;
DBUG_ASSERT(!cond_equal_ref || !cond_equal_ref[0]);
@@ -12949,7 +13053,7 @@ COND *Item_func_eq::build_equal_items(THD *thd,
Item_equal *item_equal;
int n= cond_equal.current_level.elements + eq_list.elements;
if (n == 0)
- return new (thd->mem_root) Item_int((longlong) 1,1);
+ return new (thd->mem_root) Item_int(thd, (longlong) 1, 1);
else if (n == 1)
{
if ((item_equal= cond_equal.current_level.pop()))
@@ -12975,9 +13079,9 @@ COND *Item_func_eq::build_equal_items(THD *thd,
Here a new AND level must be created. It can happen only
when a row equality is processed as a standalone predicate.
*/
- Item_cond_and *and_cond= new Item_cond_and(eq_list);
+ Item_cond_and *and_cond= new (thd->mem_root) Item_cond_and(thd, eq_list);
and_cond->quick_fix_field();
- List<Item> *args= and_cond->argument_list();
+ List<Item> *cond_args= and_cond->argument_list();
List_iterator_fast<Item_equal> it(cond_equal.current_level);
while ((item_equal= it++))
{
@@ -12988,7 +13092,7 @@ COND *Item_func_eq::build_equal_items(THD *thd,
}
and_cond->m_cond_equal.copy(cond_equal);
cond_equal.current_level= and_cond->m_cond_equal.current_level;
- args->append((List<Item> *)&cond_equal.current_level);
+ cond_args->append((List<Item> *)&cond_equal.current_level);
and_cond->update_used_tables();
if (cond_equal_ref)
*cond_equal_ref= &and_cond->m_cond_equal;
@@ -13010,11 +13114,7 @@ COND *Item_func::build_equal_items(THD *thd, COND_EQUAL *inherited,
as soon the field is not of a string type or the field reference is
an argument of a comparison predicate.
*/
- uchar* is_subst_valid= (uchar *) Item::ANY_SUBST;
- COND *cond= compile(&Item::subst_argument_checker,
- &is_subst_valid,
- &Item::equal_fields_propagator,
- (uchar *) inherited);
+ COND *cond= propagate_equal_fields(thd, Context_boolean(), inherited);
cond->update_used_tables();
DBUG_ASSERT(cond == this);
DBUG_ASSERT(!cond_equal_ref || !cond_equal_ref[0]);
@@ -13328,13 +13428,13 @@ static TABLE_LIST* embedding_sjm(Item *item)
- 0, otherwise.
*/
-Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
+Item *eliminate_item_equal(THD *thd, COND *cond, COND_EQUAL *upper_levels,
Item_equal *item_equal)
{
List<Item> eq_list;
Item_func_eq *eq_item= 0;
if (((Item *) item_equal)->const_item() && !item_equal->val_int())
- return new Item_int((longlong) 0,1);
+ return new (thd->mem_root) Item_int(thd, (longlong) 0, 1);
Item *item_const= item_equal->get_const();
Item_equal_fields_iterator it(*item_equal);
Item *head;
@@ -13399,7 +13499,7 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
Upper item also has "field_item=const".
Don't produce equality if const is equal to item_const.
*/
- Item_func_eq *func= new Item_func_eq(item_const, upper_const);
+ Item_func_eq *func= new (thd->mem_root) Item_func_eq(thd, item_const, upper_const);
func->set_cmp_func();
func->quick_fix_field();
if (func->val_int())
@@ -13430,7 +13530,7 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
if (produce_equality)
{
- if (eq_item && eq_list.push_back(eq_item))
+ if (eq_item && eq_list.push_back(eq_item, thd->mem_root))
return 0;
/*
@@ -13448,7 +13548,7 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
if (head_real_item->type() == Item::FIELD_ITEM)
head_item= head_real_item;
- eq_item= new Item_func_eq(field_item->real_item(), head_item);
+ eq_item= new (thd->mem_root) Item_func_eq(thd, field_item->real_item(), head_item);
if (!eq_item || eq_item->set_cmp_func())
return 0;
@@ -13475,13 +13575,13 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
- if we have only one condition to return, we don't create an Item_cond_and
*/
- if (eq_item && eq_list.push_back(eq_item))
+ if (eq_item && eq_list.push_back(eq_item, thd->mem_root))
return 0;
COND *res= 0;
switch (eq_list.elements)
{
case 0:
- res= cond ? cond : new Item_int((longlong) 1, 1);
+ res= cond ? cond : new (thd->mem_root) Item_int(thd, (longlong) 1, 1);
break;
case 1:
if (!cond || cond->type() == Item::INT_ITEM)
@@ -13499,12 +13599,12 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
res= cond;
((Item_cond *) res)->add_at_end(&eq_list);
}
- else if (eq_list.push_front(cond))
+ else if (eq_list.push_front(cond, thd->mem_root))
return 0;
}
}
if (!res)
- res= new Item_cond_and(eq_list);
+ res= new (thd->mem_root) Item_cond_and(thd, eq_list);
if (res)
{
res->quick_fix_field();
@@ -13571,7 +13671,7 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
The transformed condition, or NULL in case of error
*/
-static COND* substitute_for_best_equal_field(JOIN_TAB *context_tab,
+static COND* substitute_for_best_equal_field(THD *thd, JOIN_TAB *context_tab,
COND *cond,
COND_EQUAL *cond_equal,
void *table_join_idx)
@@ -13601,7 +13701,7 @@ static COND* substitute_for_best_equal_field(JOIN_TAB *context_tab,
Item *item;
while ((item= li++))
{
- Item *new_item= substitute_for_best_equal_field(context_tab,
+ Item *new_item= substitute_for_best_equal_field(thd, context_tab,
item, cond_equal,
table_join_idx);
/*
@@ -13619,8 +13719,8 @@ static COND* substitute_for_best_equal_field(JOIN_TAB *context_tab,
bool false_eq_cond= FALSE;
while ((item_equal= it++))
{
- eq_cond= eliminate_item_equal(eq_cond, cond_equal->upper_levels,
- item_equal);
+ eq_cond= eliminate_item_equal(thd, eq_cond, cond_equal->upper_levels,
+ item_equal);
if (!eq_cond)
{
eq_cond= 0;
@@ -13652,7 +13752,7 @@ static COND* substitute_for_best_equal_field(JOIN_TAB *context_tab,
{
/* Do not add an equality condition if it's always true */
if (eq_cond->type() != Item::INT_ITEM &&
- cond_list->push_front(eq_cond))
+ cond_list->push_front(eq_cond, thd->mem_root))
eq_cond= 0;
}
}
@@ -13676,7 +13776,7 @@ static COND* substitute_for_best_equal_field(JOIN_TAB *context_tab,
cond_equal= item_equal->upper_levels;
if (cond_equal && cond_equal->current_level.head() == item_equal)
cond_equal= cond_equal->upper_levels;
- cond= eliminate_item_equal(0, cond_equal, item_equal);
+ cond= eliminate_item_equal(thd, 0, cond_equal, item_equal);
return cond ? cond : org_cond;
}
else
@@ -13687,7 +13787,7 @@ static COND* substitute_for_best_equal_field(JOIN_TAB *context_tab,
while((item_equal= it++))
{
REPLACE_EQUAL_FIELD_ARG arg= {item_equal, context_tab};
- cond= cond->transform(&Item::replace_equal_field, (uchar *) &arg);
+ cond= cond->transform(thd, &Item::replace_equal_field, (uchar *) &arg);
}
cond_equal= cond_equal->upper_levels;
}
@@ -13752,14 +13852,14 @@ static void update_const_equal_items(THD *thd, COND *cond, JOIN_TAB *tab,
*/
if (!possible_keys.is_clear_all())
{
- TABLE *tab= field->table;
+ TABLE *field_tab= field->table;
KEYUSE *use;
- for (use= stat->keyuse; use && use->table == tab; use++)
+ for (use= stat->keyuse; use && use->table == field_tab; use++)
if (const_key &&
!use->is_for_hash_join() && possible_keys.is_set(use->key) &&
- tab->key_info[use->key].key_part[use->keypart].field ==
+ field_tab->key_info[use->key].key_part[use->keypart].field ==
field)
- tab->const_key_parts[use->key]|= use->keypart_map;
+ field_tab->const_key_parts[use->key]|= use->keypart_map;
}
}
}
@@ -13793,9 +13893,9 @@ can_change_cond_ref_to_const(Item_bool_func2 *target,
{
if (!target_expr->eq(source_expr,0) ||
target_value == source_const ||
- target_expr->cmp_context != source_expr->cmp_context)
+ target->compare_type() != source->compare_type())
return false;
- if (target_expr->cmp_context == STRING_RESULT)
+ if (target->compare_type() == STRING_RESULT)
{
/*
In this example:
@@ -13832,6 +13932,29 @@ can_change_cond_ref_to_const(Item_bool_func2 *target,
target->compare_collation() == source->compare_collation() &&
target_value->collation.collation == source_const->collation.collation;
}
+ if (target->compare_type() == TIME_RESULT)
+ {
+ if (target_value->cmp_type() != TIME_RESULT)
+ {
+ /*
+ Can't rewrite:
+ WHERE COALESCE(time_column)='00:00:00'
+ AND COALESCE(time_column)=DATE'2015-09-11'
+ to
+ WHERE DATE'2015-09-11'='00:00:00'
+ AND COALESCE(time_column)=DATE'2015-09-11'
+ because the left part will erroneously try to parse '00:00:00'
+ as DATE, not as TIME.
+
+ TODO: It could still be rewritten to:
+ WHERE DATE'2015-09-11'=TIME'00:00:00'
+ AND COALESCE(time_column)=DATE'2015-09-11'
+ i.e. we need to replace both target_expr and target_value
+ at the same time. This is not supported yet.
+ */
+ return false;
+ }
+ }
return true; // Non-string comparison
}
@@ -13870,7 +13993,7 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
if (can_change_cond_ref_to_const(func, right_item, left_item,
field_value_owner, field, value))
{
- Item *tmp=value->clone_item();
+ Item *tmp=value->clone_item(thd);
if (tmp)
{
tmp->collation.set(right_item->collation);
@@ -13899,7 +14022,7 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
else if (can_change_cond_ref_to_const(func, left_item, right_item,
field_value_owner, field, value))
{
- Item *tmp= value->clone_item();
+ Item *tmp= value->clone_item(thd);
if (tmp)
{
tmp->collation.set(left_item->collation);
@@ -14192,7 +14315,7 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top,
/* Add ON expression to the WHERE or upper-level ON condition. */
if (conds)
{
- conds= and_conds(conds, table->on_expr);
+ conds= and_conds(join->thd, conds, table->on_expr);
conds->top_level_item();
/* conds is always a new item as both cond and on_expr existed */
DBUG_ASSERT(!conds->fixed);
@@ -14269,7 +14392,7 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top,
If this is a semi-join that is not contained within another semi-join,
leave it intact (otherwise it is flattened)
*/
- join->select_lex->sj_nests.push_back(table);
+ join->select_lex->sj_nests.push_back(table, join->thd->mem_root);
/*
Also, walk through semi-join children and mark those that are now
@@ -14294,7 +14417,7 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top,
if (!tbl->embedding && !tbl->on_expr && tbl->table)
tbl->table->maybe_null= FALSE;
tbl->join_list= table->join_list;
- repl_list.push_back(tbl);
+ repl_list.push_back(tbl, join->thd->mem_root);
tbl->dep_tables|= table->dep_tables;
}
li.replace(repl_list);
@@ -14839,11 +14962,8 @@ void propagate_new_equalities(THD *thd, Item *cond,
}
else
{
- uchar* is_subst_valid= (uchar *) Item::ANY_SUBST;
- cond= cond->compile(&Item::subst_argument_checker,
- &is_subst_valid,
- &Item::equal_fields_propagator,
- (uchar *) inherited);
+ cond= cond->propagate_equal_fields(thd,
+ Item::Context_boolean(), inherited);
cond->update_used_tables();
}
}
@@ -14986,7 +15106,7 @@ bool cond_is_datetime_is_null(Item *cond)
COND *
Item_cond::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
- bool top_level)
+ bool top_level_arg)
{
bool and_level= functype() == Item_func::COND_AND_FUNC;
List<Item> *cond_arg_list= argument_list();
@@ -15087,7 +15207,7 @@ Item_cond::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
Item_func::MULT_EQUAL_FUNC)
{
li.remove();
- new_equalities.push_back((Item_equal *) new_item);
+ new_equalities.push_back((Item_equal *) new_item, thd->mem_root);
}
else
{
@@ -15200,7 +15320,7 @@ Item_cond::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
COND *
-Item::remove_eq_conds(THD *thd, Item::cond_result *cond_value, bool top_level)
+Item::remove_eq_conds(THD *thd, Item::cond_result *cond_value, bool top_level_arg)
{
if (const_item() && !is_expensive())
{
@@ -15214,7 +15334,7 @@ Item::remove_eq_conds(THD *thd, Item::cond_result *cond_value, bool top_level)
COND *
Item_bool_func2::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
- bool top_level)
+ bool top_level_arg)
{
if (const_item() && !is_expensive())
{
@@ -15256,7 +15376,7 @@ Item_bool_func2::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
COND *
Item_func_isnull::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
- bool top_level)
+ bool top_level_arg)
{
if (args[0]->type() == Item::FIELD_ITEM)
{
@@ -15280,8 +15400,8 @@ Item_func_isnull::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
*/
- Item *item0= new(thd->mem_root) Item_int((longlong)0, 1);
- Item *eq_cond= new(thd->mem_root) Item_func_eq(args[0], item0);
+ Item *item0= new(thd->mem_root) Item_int(thd, (longlong) 0, 1);
+ Item *eq_cond= new(thd->mem_root) Item_func_eq(thd, args[0], item0);
if (!eq_cond)
return this;
@@ -15289,7 +15409,7 @@ Item_func_isnull::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
if (field->table->pos_in_table_list->is_inner_table_of_outer_join())
{
// outer join: transform "col IS NULL" to "col IS NULL or col=0"
- Item *or_cond= new(thd->mem_root) Item_cond_or(eq_cond, this);
+ Item *or_cond= new(thd->mem_root) Item_cond_or(thd, eq_cond, this);
if (!or_cond)
return this;
cond= or_cond;
@@ -15330,7 +15450,7 @@ Item_func_isnull::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
WHERE auto_increment IS NULL AND something_else
*/
- if (top_level) // "auto_increment_column IS NULL" is the only condition
+ if (top_level_arg) // "auto_increment_column IS NULL" is the only condition
{
if (field->flags & AUTO_INCREMENT_FLAG && !field->table->maybe_null &&
(thd->variables.option_bits & OPTION_AUTO_IS_NULL) &&
@@ -15338,11 +15458,11 @@ Item_func_isnull::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
thd->substitute_null_with_insert_id))
{
#ifdef HAVE_QUERY_CACHE
- query_cache_abort(&thd->query_cache_tls);
+ query_cache_abort(thd, &thd->query_cache_tls);
#endif
COND *new_cond, *cond= this;
- if ((new_cond= new Item_func_eq(args[0],
- new Item_int("last_insert_id()",
+ if ((new_cond= new (thd->mem_root) Item_func_eq(thd, args[0],
+ new (thd->mem_root) Item_int(thd, "last_insert_id()",
thd->read_first_successful_insert_id_in_prev_stmt(),
MY_INT64_NUM_DECIMAL_DIGITS))))
{
@@ -15365,7 +15485,7 @@ Item_func_isnull::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
}
}
}
- return Item::remove_eq_conds(thd, cond_value, top_level);
+ return Item::remove_eq_conds(thd, cond_value, top_level_arg);
}
@@ -15396,12 +15516,14 @@ Item_func_isnull::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
/*
psergey-todo: this returns false for int_column='1234' (here '1234' is a
constant. Need to discuss this with Bar).
+
+ See also Field::test_if_equality_guaranees_uniqueness(const Item *item);
*/
static bool
test_if_equality_guarantees_uniqueness(Item *l, Item *r)
{
return (r->const_item() || !(r->used_tables() & ~OUTER_REF_TABLE_BIT)) &&
- item_cmp_type(l->cmp_type(), r->cmp_type()) == l->cmp_type() &&
+ item_cmp_type(l, r) == l->cmp_type() &&
(l->cmp_type() != STRING_RESULT ||
l->collation.collation == r->collation.collation);
}
@@ -15546,8 +15668,8 @@ Field *create_tmp_field_from_field(THD *thd, Field *org_field,
org_field->field_name, table->s,
org_field->charset());
else
- new_field= org_field->new_field(thd->mem_root, table,
- table == org_field->table);
+ new_field= org_field->make_new_field(thd->mem_root, table,
+ table == org_field->table);
if (new_field)
{
new_field->init(table);
@@ -15604,11 +15726,13 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
{
bool maybe_null= item->maybe_null;
Field *UNINIT_VAR(new_field);
+ MEM_ROOT *mem_root= thd->mem_root;
switch (item->result_type()) {
case REAL_RESULT:
- new_field= new Field_double(item->max_length, maybe_null,
- item->name, item->decimals, TRUE);
+ new_field= new (mem_root)
+ Field_double(item->max_length, maybe_null,
+ item->name, item->decimals, TRUE);
break;
case INT_RESULT:
/*
@@ -15618,11 +15742,13 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
Field_long : make them Field_longlong.
*/
if (item->max_length >= (MY_INT32_NUM_DECIMAL_DIGITS - 1))
- new_field=new Field_longlong(item->max_length, maybe_null,
- item->name, item->unsigned_flag);
+ new_field=new (mem_root)
+ Field_longlong(item->max_length, maybe_null,
+ item->name, item->unsigned_flag);
else
- new_field=new Field_long(item->max_length, maybe_null,
- item->name, item->unsigned_flag);
+ new_field=new (mem_root)
+ Field_long(item->max_length, maybe_null, item->name,
+ item->unsigned_flag);
break;
case STRING_RESULT:
DBUG_ASSERT(item->collation.collation);
@@ -15641,15 +15767,16 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
else if (item->max_length/item->collation.collation->mbmaxlen > 255 &&
convert_blob_length <= Field_varstring::MAX_SIZE &&
convert_blob_length)
- new_field= new Field_varstring(convert_blob_length, maybe_null,
- item->name, table->s,
- item->collation.collation);
+ new_field= new (mem_root)
+ Field_varstring(convert_blob_length, maybe_null,
+ item->name, table->s,
+ item->collation.collation);
else
new_field= item->make_string_field(table);
new_field->set_derivation(item->collation.derivation);
break;
case DECIMAL_RESULT:
- new_field= Field_new_decimal::create_from_item(item);
+ new_field= Field_new_decimal::create_from_item(mem_root, item);
break;
case ROW_RESULT:
default:
@@ -16201,7 +16328,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
string_total_length+= new_field->pack_length();
}
thd->mem_root= mem_root_save;
- arg= sum_item->set_arg(i, thd, new Item_field(new_field));
+ arg= sum_item->set_arg(i, thd, new (thd->mem_root) Item_field(thd, new_field));
thd->mem_root= &table->mem_root;
if (param->force_not_null_cols)
{
@@ -16467,20 +16594,17 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
inherit the default value that is defined for the field referred
by the Item_field object from which 'field' has been created.
*/
- my_ptrdiff_t diff;
- Field *orig_field= default_field[i];
+ const Field *orig_field= default_field[i];
/* Get the value from default_values */
- diff= (my_ptrdiff_t) (orig_field->table->s->default_values-
- orig_field->table->record[0]);
- orig_field->move_field_offset(diff); // Points now at default_values
- if (orig_field->is_real_null())
+ if (orig_field->is_null_in_record(orig_field->table->s->default_values))
field->set_null();
else
{
field->set_notnull();
- memcpy(field->ptr, orig_field->ptr, field->pack_length());
+ memcpy(field->ptr,
+ orig_field->ptr_in_record(orig_field->table->s->default_values),
+ field->pack_length());
}
- orig_field->move_field_offset(-diff); // Back to record[0]
}
if (from_field[i])
@@ -16860,7 +16984,7 @@ TABLE *create_virtual_tmp_table(THD *thd, List<Create_field> &field_list)
List_iterator_fast<Create_field> it(field_list);
while ((cdef= it++))
{
- *field= make_field(share, 0, cdef->length,
+ *field= make_field(share, thd->mem_root, 0, cdef->length,
(uchar*) (f_maybe_null(cdef->pack_flag) ? "" : 0),
f_maybe_null(cdef->pack_flag) ? 1 : 0,
cdef->pack_flag, cdef->sql_type, cdef->charset,
@@ -17641,8 +17765,8 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
here. join->send_records is increased on success in end_send(),
so we don't touch it here.
*/
- join->examined_rows++;
- DBUG_ASSERT(join->examined_rows <= 1);
+ join->join_examined_rows++;
+ DBUG_ASSERT(join->join_examined_rows <= 1);
}
else if (join->send_row_on_empty_set())
{
@@ -18235,9 +18359,9 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
of the newly activated predicates is evaluated as false
(See above join->return_tab= tab).
*/
- join->examined_rows++;
+ join->join_examined_rows++;
DBUG_PRINT("counts", ("join->examined_rows++: %lu found: %d",
- (ulong) join->examined_rows, (int) found));
+ (ulong) join->join_examined_rows, (int) found));
if (found)
{
@@ -18272,7 +18396,7 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
The condition pushed down to the table join_tab rejects all rows
with the beginning coinciding with the current partial join.
*/
- join->examined_rows++;
+ join->join_examined_rows++;
join->thd->get_stmt_da()->inc_current_row_for_warning();
join_tab->read_record.unlock_row(join_tab);
}
@@ -19785,7 +19909,7 @@ make_cond_for_table_from_pred(THD *thd, Item *root_cond, Item *cond,
if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC)
{
/* Create new top level AND item */
- Item_cond_and *new_cond=new Item_cond_and;
+ Item_cond_and *new_cond=new (thd->mem_root) Item_cond_and(thd);
if (!new_cond)
return (COND*) 0; // OOM /* purecov: inspected */
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
@@ -19798,7 +19922,7 @@ make_cond_for_table_from_pred(THD *thd, Item *root_cond, Item *cond,
exclude_expensive_cond,
retain_ref_cond);
if (fix)
- new_cond->argument_list()->push_back(fix);
+ new_cond->argument_list()->push_back(fix, thd->mem_root);
}
switch (new_cond->argument_list()->elements) {
case 0:
@@ -19820,7 +19944,7 @@ make_cond_for_table_from_pred(THD *thd, Item *root_cond, Item *cond,
}
else
{ // Or list
- Item_cond_or *new_cond=new Item_cond_or;
+ Item_cond_or *new_cond=new (thd->mem_root) Item_cond_or(thd);
if (!new_cond)
return (COND*) 0; // OOM /* purecov: inspected */
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
@@ -19834,7 +19958,7 @@ make_cond_for_table_from_pred(THD *thd, Item *root_cond, Item *cond,
retain_ref_cond);
if (!fix)
return (COND*) 0; // Always true
- new_cond->argument_list()->push_back(fix);
+ new_cond->argument_list()->push_back(fix, thd->mem_root);
}
/*
Call fix_fields to propagate all properties of the children to
@@ -19897,7 +20021,7 @@ make_cond_for_table_from_pred(THD *thd, Item *root_cond, Item *cond,
*/
static COND *
-make_cond_after_sjm(Item *root_cond, Item *cond, table_map tables,
+make_cond_after_sjm(THD *thd, Item *root_cond, Item *cond, table_map tables,
table_map sjm_tables, bool inside_or_clause)
{
/*
@@ -19915,17 +20039,17 @@ make_cond_after_sjm(Item *root_cond, Item *cond, table_map tables,
if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC)
{
/* Create new top level AND item */
- Item_cond_and *new_cond=new Item_cond_and;
+ Item_cond_and *new_cond= new (thd->mem_root) Item_cond_and(thd);
if (!new_cond)
return (COND*) 0; // OOM /* purecov: inspected */
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
Item *item;
while ((item=li++))
{
- Item *fix=make_cond_after_sjm(root_cond, item, tables, sjm_tables,
+ Item *fix=make_cond_after_sjm(thd, root_cond, item, tables, sjm_tables,
inside_or_clause);
if (fix)
- new_cond->argument_list()->push_back(fix);
+ new_cond->argument_list()->push_back(fix, thd->mem_root);
}
switch (new_cond->argument_list()->elements) {
case 0:
@@ -19946,18 +20070,18 @@ make_cond_after_sjm(Item *root_cond, Item *cond, table_map tables,
}
else
{ // Or list
- Item_cond_or *new_cond=new Item_cond_or;
+ Item_cond_or *new_cond= new (thd->mem_root) Item_cond_or(thd);
if (!new_cond)
return (COND*) 0; // OOM /* purecov: inspected */
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
Item *item;
while ((item=li++))
{
- Item *fix= make_cond_after_sjm(root_cond, item, tables, sjm_tables,
+ Item *fix= make_cond_after_sjm(thd, root_cond, item, tables, sjm_tables,
/*inside_or_clause= */TRUE);
if (!fix)
return (COND*) 0; // Always true
- new_cond->argument_list()->push_back(fix);
+ new_cond->argument_list()->push_back(fix, thd->mem_root);
}
/*
Item_cond_or do not need fix_fields for execution, its parameters
@@ -20660,11 +20784,11 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
if (select && // psergey: why doesn't this use a quick?
table->quick_keys.is_set(best_key) && best_key != ref_key)
{
- key_map map;
- map.clear_all(); // Force the creation of quick select
- map.set_bit(best_key); // only best_key.
+ key_map tmp_map;
+ tmp_map.clear_all(); // Force the creation of quick select
+ tmp_map.set_bit(best_key); // only best_key.
select->quick= 0;
- select->test_quick_select(join->thd, map, 0,
+ select->test_quick_select(join->thd, tmp_map, 0,
join->select_options & OPTION_FOUND_ROWS ?
HA_POS_ERROR :
join->unit->select_limit_cnt,
@@ -20988,6 +21112,8 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
and thus force sorting on disk unless a group min-max optimization
is going to be used as it is applied now only for one table queries
with covering indexes.
+ The expections is if we are already using the index for GROUP BY
+ (in which case sort would be free) or ORDER and GROUP BY are different.
*/
if ((order != join->group_list ||
!(join->select_options & SELECT_BIG_RESULT) ||
@@ -21057,7 +21183,7 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
filesort_retval= filesort(thd, table, join->sortorder, length,
select, filesort_limit, 0,
&examined_rows, &found_rows,
- join->explain->ops_tracker.report_sorting());
+ join->explain->ops_tracker.report_sorting(thd));
table->sort.found_records= filesort_retval;
tab->records= found_rows; // For SQL_CALC_ROWS
@@ -21086,7 +21212,7 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
if (err)
goto err;
- tab->join->examined_rows+=examined_rows;
+ tab->join->join_examined_rows+= examined_rows;
DBUG_RETURN(filesort_retval == HA_POS_ERROR);
err:
DBUG_RETURN(-1);
@@ -21178,6 +21304,7 @@ remove_duplicates(JOIN *join, TABLE *table, List<Item> &fields, Item *having)
THD *thd= join->thd;
DBUG_ENTER("remove_duplicates");
+ join->explain->ops_tracker.report_duplicate_removal();
table->reginfo.lock_type=TL_WRITE;
@@ -21267,7 +21394,8 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field,
}
if (copy_blobs(first_field))
{
- my_message(ER_OUTOFMEMORY, ER(ER_OUTOFMEMORY), MYF(ME_FATALERROR));
+ my_message(ER_OUTOFMEMORY, ER_THD(thd,ER_OUTOFMEMORY),
+ MYF(ME_FATALERROR));
error=0;
goto err;
}
@@ -21685,9 +21813,9 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
*/
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_NON_UNIQ_ERROR,
- ER(ER_NON_UNIQ_ERROR),
+ ER_THD(thd, ER_NON_UNIQ_ERROR),
((Item_ident*) order_item)->field_name,
- current_thd->where);
+ thd->where);
}
}
@@ -21710,7 +21838,8 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
return TRUE; /* Wrong field. */
uint el= all_fields.elements;
- all_fields.push_front(order_item); /* Add new field to field list. */
+ /* Add new field to field list. */
+ all_fields.push_front(order_item, thd->mem_root);
ref_pointer_array[el]= order_item;
/*
If the order_item is a SUM_FUNC_ITEM, when fix_fields is called
@@ -21826,7 +21955,7 @@ setup_group(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
Item_field *field;
int cur_pos_in_select_list= 0;
List_iterator<Item> li(fields);
- List_iterator<Item_field> naf_it(thd->lex->current_select->non_agg_fields);
+ List_iterator<Item_field> naf_it(thd->lex->current_select->join->non_agg_fields);
field= naf_it++;
while (field && (item=li++))
@@ -21896,7 +22025,7 @@ setup_new_fields(THD *thd, List<Item> &fields,
thd->where="procedure list";
if ((*new_field->item)->fix_fields(thd, new_field->item))
DBUG_RETURN(1); /* purecov: inspected */
- all_fields.push_front(*new_field->item);
+ all_fields.push_front(*new_field->item, thd->mem_root);
new_field->item=all_fields.head_ref();
}
}
@@ -21967,10 +22096,10 @@ create_distinct_group(THD *thd, Item **ref_pointer_array,
converted to a LONG field. Original field will remain of the
BIT type and will be returned to a client.
*/
- Item_field *new_item= new Item_field(thd, (Item_field*)item);
+ Item_field *new_item= new (thd->mem_root) Item_field(thd, (Item_field*)item);
int el= all_fields.elements;
orig_ref_pointer_array[el]= new_item;
- all_fields.push_front(new_item);
+ all_fields.push_front(new_item, thd->mem_root);
ord->item= orig_ref_pointer_array + el;
}
else
@@ -22377,7 +22506,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
((Item_ref *)pos)->ref_type() == Item_ref::AGGREGATE_REF))
{
Item_field *item;
- if (!(item= new Item_field(thd, ((Item_field*) real_pos))))
+ if (!(item= new (thd->mem_root) Item_field(thd, ((Item_field*) real_pos))))
goto err;
if (pos->type() == Item::REF_ITEM)
{
@@ -22390,7 +22519,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
pos= item;
if (item->field->flags & BLOB_FLAG)
{
- if (!(pos= new Item_copy_string(pos)))
+ if (!(pos= new (thd->mem_root) Item_copy_string(thd, pos)))
goto err;
/*
Item_copy_string::copy for function can call
@@ -22401,7 +22530,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
copy_funcs
(to see full test case look at having.test, BUG #4358)
*/
- if (param->copy_funcs.push_front(pos))
+ if (param->copy_funcs.push_front(pos, thd->mem_root))
goto err;
}
else
@@ -22411,13 +22540,14 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
saved value
*/
field= item->field;
- item->result_field=field->new_field(thd->mem_root,field->table, 1);
+ item->result_field=field->make_new_field(thd->mem_root,
+ field->table, 1);
/*
We need to allocate one extra byte for null handling and
another extra byte to not get warnings from purify in
Field_string::val_int
*/
- if (!(tmp= (uchar*) sql_alloc(field->pack_length()+2)))
+ if (!(tmp= (uchar*) thd->alloc(field->pack_length()+2)))
goto err;
if (copy)
{
@@ -22444,14 +22574,14 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
on how the value is to be used: In some cases this may be an
argument in a group function, like: IF(ISNULL(col),0,COUNT(*))
*/
- if (!(pos=new Item_copy_string(pos)))
+ if (!(pos=new (thd->mem_root) Item_copy_string(thd, pos)))
goto err;
if (i < border) // HAVING, ORDER and GROUP BY
{
- if (extra_funcs.push_back(pos))
+ if (extra_funcs.push_back(pos, thd->mem_root))
goto err;
}
- else if (param->copy_funcs.push_back(pos))
+ else if (param->copy_funcs.push_back(pos, thd->mem_root))
goto err;
}
res_all_fields.push_back(pos, thd->mem_root);
@@ -22652,25 +22782,27 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
if (field != NULL)
{
/*
- Replace "@:=<expression>" with "@:=<tmp table column>". Otherwise, we
- would re-evaluate <expression>, and if expression were a subquery, this
- would access already-unlocked tables.
+ Replace "@:=<expression>" with "@:=<tmp table
+ column>". Otherwise, we would re-evaluate <expression>, and
+ if expression were a subquery, this would access
+ already-unlocked tables.
*/
Item_func_set_user_var* suv=
- new Item_func_set_user_var(thd, (Item_func_set_user_var*) item);
- Item_field *new_field= new Item_field(field);
+ new (thd->mem_root) Item_func_set_user_var(thd, (Item_func_set_user_var*) item);
+ Item_field *new_field= new (thd->mem_root) Item_field(thd, field);
if (!suv || !new_field)
DBUG_RETURN(true); // Fatal error
/*
- We are replacing the argument of Item_func_set_user_var after its value
- has been read. The argument's null_value should be set by now, so we
- must set it explicitly for the replacement argument since the null_value
- may be read without any preceding call to val_*().
+ We are replacing the argument of Item_func_set_user_var
+ after its value has been read. The argument's null_value
+ should be set by now, so we must set it explicitly for the
+ replacement argument since the null_value may be read
+ without any preceding call to val_*().
*/
new_field->update_null_value();
List<Item> list;
- list.push_back(new_field);
- suv->set_arguments(list);
+ list.push_back(new_field, thd->mem_root);
+ suv->set_arguments(thd, list);
item_field= suv;
}
else
@@ -22679,9 +22811,9 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
else if ((field= item->get_tmp_table_field()))
{
if (item->type() == Item::SUM_FUNC_ITEM && field->table->group)
- item_field= ((Item_sum*) item)->result_item(field);
+ item_field= ((Item_sum*) item)->result_item(thd, field);
else
- item_field= (Item*) new Item_field(field);
+ item_field= (Item *) new (thd->mem_root) Item_field(thd, field);
if (!item_field)
DBUG_RETURN(true); // Fatal error
@@ -22754,7 +22886,8 @@ change_refs_to_tmp_fields(THD *thd, Item **ref_pointer_array,
uint i, border= all_fields.elements - elements;
for (i= 0; (item= it++); i++)
{
- res_all_fields.push_back(new_item= item->get_tmp_table_item(thd));
+ res_all_fields.push_back(new_item= item->get_tmp_table_item(thd),
+ thd->mem_root);
ref_pointer_array[((i < border)? all_fields.elements-i-1 : i-border)]=
new_item;
}
@@ -22921,7 +23054,7 @@ static bool add_ref_to_table_cond(THD *thd, JOIN_TAB *join_tab)
if (!join_tab->ref.key_parts)
DBUG_RETURN(FALSE);
- Item_cond_and *cond=new Item_cond_and();
+ Item_cond_and *cond= new (thd->mem_root) Item_cond_and(thd);
TABLE *table=join_tab->table;
int error= 0;
if (!cond)
@@ -22932,7 +23065,10 @@ static bool add_ref_to_table_cond(THD *thd, JOIN_TAB *join_tab)
Field *field=table->field[table->key_info[join_tab->ref.key].key_part[i].
fieldnr-1];
Item *value=join_tab->ref.items[i];
- cond->add(new Item_func_equal(new Item_field(field), value));
+ cond->add(new (thd->mem_root)
+ Item_func_equal(thd, new (thd->mem_root) Item_field(thd, field),
+ value),
+ thd->mem_root);
}
if (thd->is_fatal_error)
DBUG_RETURN(TRUE);
@@ -22948,11 +23084,12 @@ static bool add_ref_to_table_cond(THD *thd, JOIN_TAB *join_tab)
if (join_tab->select->pre_idx_push_select_cond)
cond_copy= cond->copy_andor_structure(thd);
if (join_tab->select->cond)
- error=(int) cond->add(join_tab->select->cond);
+ error=(int) cond->add(join_tab->select->cond, thd->mem_root);
join_tab->select->cond= cond;
if (join_tab->select->pre_idx_push_select_cond)
{
- Item *new_cond= and_conds(cond_copy, join_tab->select->pre_idx_push_select_cond);
+ Item *new_cond= and_conds(thd, cond_copy,
+ join_tab->select->pre_idx_push_select_cond);
if (!new_cond->fixed && new_cond->fix_fields(thd, &new_cond))
error= 1;
join_tab->pre_idx_push_select_cond=
@@ -23048,8 +23185,8 @@ static bool change_group_ref(THD *thd, Item_func *expr, ORDER *group_list,
if (item->eq(*group_tmp->item,0))
{
Item *new_item;
- if (!(new_item= new Item_ref(context, group_tmp->item, 0,
- item->name)))
+ if (!(new_item= new (thd->mem_root) Item_ref(thd, context, group_tmp->item, 0,
+ item->name)))
return 1; // fatal_error is set
thd->change_item_tree(arg, new_item);
arg_changed= TRUE;
@@ -23106,7 +23243,7 @@ bool JOIN::rollup_init()
*/
for (i= 0 ; i < send_group_parts ; i++)
{
- rollup.null_items[i]= new (thd->mem_root) Item_null_result();
+ rollup.null_items[i]= new (thd->mem_root) Item_null_result(thd);
List<Item> *rollup_fields= &rollup.fields[i];
rollup_fields->empty();
rollup.ref_pointer_arrays[i]= ref_array;
@@ -23115,7 +23252,7 @@ bool JOIN::rollup_init()
for (i= 0 ; i < send_group_parts; i++)
{
for (j=0 ; j < fields_list.elements ; j++)
- rollup.fields[i].push_back(rollup.null_items[i]);
+ rollup.fields[i].push_back(rollup.null_items[i], thd->mem_root);
}
List_iterator<Item> it(all_fields);
Item *item;
@@ -23186,7 +23323,7 @@ bool JOIN::rollup_process_const_fields()
{
if (*group_tmp->item == item)
{
- Item* new_item= new Item_func_rollup_const(item);
+ Item* new_item= new (thd->mem_root) Item_func_rollup_const(thd, item);
if (!new_item)
return 1;
new_item->fix_fields(thd, (Item **) 0);
@@ -23311,7 +23448,7 @@ bool JOIN::rollup_make_fields(List<Item> &fields_arg, List<Item> &sel_fields,
This is an element that is used by the GROUP BY and should be
set to NULL in this level
*/
- Item_null_result *null_item= new (thd->mem_root) Item_null_result();
+ Item_null_result *null_item= new (thd->mem_root) Item_null_result(thd);
if (!null_item)
return 1;
item->maybe_null= 1; // Value will be null sometimes
@@ -23464,48 +23601,54 @@ int print_explain_message_line(select_result_sink *result,
ha_rows *rows,
const char *message)
{
- Item *item_null= new Item_null();
+ THD *thd= result->thd;
+ MEM_ROOT *mem_root= thd->mem_root;
+ Item *item_null= new (mem_root) Item_null(thd);
List<Item> item_list;
- item_list.push_back(new Item_int((int32) select_number));
- item_list.push_back(new Item_string_sys(select_type));
+ item_list.push_back(new (mem_root) Item_int(thd, (int32) select_number),
+ mem_root);
+ item_list.push_back(new (mem_root) Item_string_sys(thd, select_type),
+ mem_root);
/* `table` */
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
/* `partitions` */
if (options & DESCRIBE_PARTITIONS)
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
/* type, possible_keys, key, key_len, ref */
for (uint i=0 ; i < 5; i++)
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
/* `rows` */
if (rows)
{
- item_list.push_back(new Item_int(*rows,
- MY_INT64_NUM_DECIMAL_DIGITS));
+ item_list.push_back(new (mem_root) Item_int(thd, *rows,
+ MY_INT64_NUM_DECIMAL_DIGITS),
+ mem_root);
}
else
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
/* `r_rows` */
if (is_analyze)
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
/* `filtered` */
if (is_analyze || options & DESCRIBE_EXTENDED)
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
/* `r_filtered` */
if (is_analyze)
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
/* `Extra` */
if (message)
- item_list.push_back(new Item_string_sys(message));
+ item_list.push_back(new (mem_root) Item_string_sys(thd, message),
+ mem_root);
else
- item_list.push_back(item_null);
+ item_list.push_back(item_null, mem_root);
if (result->send_data(item_list))
return 1;
@@ -23554,50 +23697,48 @@ int append_possible_keys(MEM_ROOT *alloc, String_list &list, TABLE *table,
void JOIN_TAB::update_explain_data(uint idx)
{
- if (this == first_breadth_first_tab(join, WALK_OPTIMIZATION_TABS) + join->const_tables &&
+ if (this == join->first_breadth_first_optimization_tab() + join->const_tables &&
join->select_lex->select_number != INT_MAX &&
join->select_lex->select_number != UINT_MAX)
{
- Explain_table_access *eta= new (join->thd->mem_root) Explain_table_access(join->thd->mem_root);
- JOIN_TAB* const first_top_tab= first_breadth_first_tab(join, WALK_OPTIMIZATION_TABS);
- save_explain_data(eta, join->const_table_map, join->select_distinct, first_top_tab);
+ Explain_table_access *eta= new (join->thd->mem_root)
+ Explain_table_access(join->thd->mem_root);
+ save_explain_data(eta, join->const_table_map, join->select_distinct,
+ join->first_breadth_first_optimization_tab());
- Explain_select *sel= join->thd->lex->explain->get_select(join->select_lex->select_number);
+ Explain_select *sel= join->thd->lex->explain->
+ get_select(join->select_lex->select_number);
idx -= my_count_bits(join->eliminated_tables);
sel->replace_table(idx, eta);
}
}
-void JOIN_TAB::save_explain_data(Explain_table_access *eta, table_map prefix_tables,
+void JOIN_TAB::save_explain_data(Explain_table_access *eta,
+ table_map prefix_tables,
bool distinct, JOIN_TAB *first_top_tab)
{
int quick_type;
CHARSET_INFO *cs= system_charset_info;
-
- JOIN_TAB *tab= this;
- THD *thd=join->thd;
-
- TABLE *table=tab->table;
- TABLE_LIST *table_list= tab->table->pos_in_table_list;
+ THD *thd= join->thd;
+ TABLE_LIST *table_list= table->pos_in_table_list;
+ QUICK_SELECT_I *cur_quick= NULL;
my_bool key_read;
char table_name_buffer[SAFE_NAME_LEN];
KEY *key_info= 0;
uint key_len= 0;
quick_type= -1;
- QUICK_SELECT_I *quick= NULL;
-
explain_plan= eta;
eta->key.clear();
eta->quick_info= NULL;
- tab->tracker= &eta->tracker;
- tab->jbuf_tracker= &eta->jbuf_tracker;
+ tracker= &eta->tracker;
+ jbuf_tracker= &eta->jbuf_tracker;
/* Enable the table access time tracker only for "ANALYZE stmt" */
if (thd->lex->analyze_stmt)
- tab->table->file->set_time_tracker(&eta->op_tracker);
+ table->file->set_time_tracker(&eta->op_tracker);
/* No need to save id and select_type here, they are kept in Explain_select */
@@ -23610,9 +23751,9 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta, table_map prefix_tab
table->derived_select_number);
eta->table_name.copy(table_name_buffer, len, cs);
}
- else if (tab->bush_children)
+ else if (bush_children)
{
- JOIN_TAB *ctab= tab->bush_children->start;
+ JOIN_TAB *ctab= bush_children->start;
/* table */
int len= my_snprintf(table_name_buffer,
sizeof(table_name_buffer)-1,
@@ -23666,19 +23807,19 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta, table_map prefix_tab
}
/* "type" column */
- enum join_type tab_type= tab->type;
- if ((tab->type == JT_ALL || tab->type == JT_HASH) &&
- tab->select && tab->select->quick && tab->use_quick != 2)
+ enum join_type tab_type= type;
+ if ((type == JT_ALL || type == JT_HASH) &&
+ select && select->quick && use_quick != 2)
{
- quick= tab->select->quick;
- quick_type= tab->select->quick->get_type();
+ cur_quick= select->quick;
+ quick_type= cur_quick->get_type();
if ((quick_type == QUICK_SELECT_I::QS_TYPE_INDEX_MERGE) ||
(quick_type == QUICK_SELECT_I::QS_TYPE_INDEX_INTERSECT) ||
(quick_type == QUICK_SELECT_I::QS_TYPE_ROR_INTERSECT) ||
(quick_type == QUICK_SELECT_I::QS_TYPE_ROR_UNION))
- tab_type= tab->type == JT_ALL ? JT_INDEX_MERGE : JT_HASH_INDEX_MERGE;
+ tab_type= type == JT_ALL ? JT_INDEX_MERGE : JT_HASH_INDEX_MERGE;
else
- tab_type= tab->type == JT_ALL ? JT_RANGE : JT_HASH_RANGE;
+ tab_type= type == JT_ALL ? JT_RANGE : JT_HASH_RANGE;
}
eta->type= tab_type;
@@ -23686,45 +23827,45 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta, table_map prefix_tab
// psergey-todo: why does this use thd MEM_ROOT??? Doesn't this
// break ANALYZE ? thd->mem_root will be freed, and after that we will
// attempt to print the query plan?
- append_possible_keys(thd->mem_root, eta->possible_keys, table, tab->keys);
+ append_possible_keys(thd->mem_root, eta->possible_keys, table, keys);
// psergey-todo: ^ check for error return code
/* Build "key", "key_len", and "ref" */
if (tab_type == JT_NEXT)
{
- key_info= table->key_info+tab->index;
+ key_info= table->key_info+index;
key_len= key_info->key_length;
}
- else if (tab->ref.key_parts)
+ else if (ref.key_parts)
{
- key_info= tab->get_keyinfo_by_key_no(tab->ref.key);
- key_len= tab->ref.key_length;
+ key_info= get_keyinfo_by_key_no(ref.key);
+ key_len= ref.key_length;
}
/*
In STRAIGHT_JOIN queries, there can be join tabs with JT_CONST type
that still have quick selects.
*/
- if (tab->select && tab->select->quick && tab_type != JT_CONST)
+ if (select && select->quick && tab_type != JT_CONST)
{
- eta->quick_info= tab->select->quick->get_explain(thd->mem_root);
+ eta->quick_info= select->quick->get_explain(thd->mem_root);
}
if (key_info) /* 'index' or 'ref' access */
{
eta->key.set(thd->mem_root, key_info, key_len);
- if (tab->ref.key_parts && tab_type != JT_FT)
+ if (ref.key_parts && tab_type != JT_FT)
{
- store_key **ref=tab->ref.key_copy;
- for (uint kp= 0; kp < tab->ref.key_parts; kp++)
+ store_key **key_ref= ref.key_copy;
+ for (uint kp= 0; kp < ref.key_parts; kp++)
{
- if ((key_part_map(1) << kp) & tab->ref.const_ref_part_map)
+ if ((key_part_map(1) << kp) & ref.const_ref_part_map)
eta->ref_list.append_str(thd->mem_root, "const");
else
{
- eta->ref_list.append_str(thd->mem_root, (*ref)->name());
- ref++;
+ eta->ref_list.append_str(thd->mem_root, (*key_ref)->name());
+ key_ref++;
}
}
}
@@ -23733,8 +23874,8 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta, table_map prefix_tab
if (tab_type == JT_HASH_NEXT) /* full index scan + hash join */
{
eta->hash_next_key.set(thd->mem_root,
- & table->key_info[tab->index],
- table->key_info[tab->index].key_length);
+ & table->key_info[index],
+ table->key_info[index].key_length);
// psergey-todo: ^ is the above correct? are we necessarily joining on all
// columns?
}
@@ -23784,7 +23925,7 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta, table_map prefix_tab
}
else
{
- double examined_rows= tab->get_examined_rows();
+ double examined_rows= get_examined_rows();
eta->rows_set= true;
eta->rows= (ha_rows) examined_rows;
@@ -23793,9 +23934,9 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta, table_map prefix_tab
float f= 0.0;
if (examined_rows)
{
- double pushdown_cond_selectivity= tab->cond_selectivity;
+ double pushdown_cond_selectivity= cond_selectivity;
if (pushdown_cond_selectivity == 1.0)
- f= (float) (100.0 * tab->records_read / examined_rows);
+ f= (float) (100.0 * records_read / examined_rows);
else
f= (float) (100.0 * pushdown_cond_selectivity);
}
@@ -23807,32 +23948,32 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta, table_map prefix_tab
/* Build "Extra" field and save it */
key_read=table->key_read;
if ((tab_type == JT_NEXT || tab_type == JT_CONST) &&
- table->covering_keys.is_set(tab->index))
+ table->covering_keys.is_set(index))
key_read=1;
if (quick_type == QUICK_SELECT_I::QS_TYPE_ROR_INTERSECT &&
- !((QUICK_ROR_INTERSECT_SELECT*)quick)->need_to_fetch_row)
+ !((QUICK_ROR_INTERSECT_SELECT*)cur_quick)->need_to_fetch_row)
key_read=1;
- if (tab->info)
+ if (info)
{
- eta->push_extra(tab->info);
+ eta->push_extra(info);
}
- else if (tab->packed_info & TAB_INFO_HAVE_VALUE)
+ else if (packed_info & TAB_INFO_HAVE_VALUE)
{
- if (tab->packed_info & TAB_INFO_USING_INDEX)
+ if (packed_info & TAB_INFO_USING_INDEX)
eta->push_extra(ET_USING_INDEX);
- if (tab->packed_info & TAB_INFO_USING_WHERE)
+ if (packed_info & TAB_INFO_USING_WHERE)
eta->push_extra(ET_USING_WHERE);
- if (tab->packed_info & TAB_INFO_FULL_SCAN_ON_NULL)
+ if (packed_info & TAB_INFO_FULL_SCAN_ON_NULL)
eta->push_extra(ET_FULL_SCAN_ON_NULL_KEY);
}
else
{
uint keyno= MAX_KEY;
- if (tab->ref.key_parts)
- keyno= tab->ref.key;
- else if (tab->select && quick)
- keyno = quick->index;
+ if (ref.key_parts)
+ keyno= ref.key;
+ else if (select && cur_quick)
+ keyno = cur_quick->index;
if (keyno != MAX_KEY && keyno == table->file->pushed_idx_cond_keyno &&
table->file->pushed_idx_cond)
@@ -23840,7 +23981,7 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta, table_map prefix_tab
eta->push_extra(ET_USING_INDEX_CONDITION);
eta->pushed_index_cond= table->file->pushed_idx_cond;
}
- else if (tab->cache_idx_cond)
+ else if (cache_idx_cond)
eta->push_extra(ET_USING_INDEX_CONDITION_BKA);
if (quick_type == QUICK_SELECT_I::QS_TYPE_ROR_UNION ||
@@ -23850,22 +23991,22 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta, table_map prefix_tab
{
eta->push_extra(ET_USING);
}
- if (tab->select)
+ if (select)
{
- if (tab->use_quick == 2)
+ if (use_quick == 2)
{
eta->push_extra(ET_RANGE_CHECKED_FOR_EACH_RECORD);
eta->range_checked_fer= new (thd->mem_root) Explain_range_checked_fer;
if (eta->range_checked_fer)
eta->range_checked_fer->
- append_possible_keys_stat(thd->mem_root, table, tab->keys);
+ append_possible_keys_stat(thd->mem_root, table, keys);
}
- else if (tab->select->cond ||
- (tab->cache_select && tab->cache_select->cond))
+ else if (select->cond ||
+ (cache_select && cache_select->cond))
{
- const COND *pushed_cond= tab->table->file->pushed_cond;
+ const COND *pushed_cond= table->file->pushed_cond;
- if ((tab->table->file->ha_table_flags() &
+ if ((table->file->ha_table_flags() &
HA_CAN_TABLE_CONDITION_PUSHDOWN) &&
pushed_cond)
{
@@ -23873,8 +24014,8 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta, table_map prefix_tab
}
else
{
- eta->where_cond= tab->select->cond;
- eta->cache_cond= tab->cache_select? tab->cache_select->cond : NULL;
+ eta->where_cond= select->cond;
+ eta->cache_cond= cache_select? cache_select->cond : NULL;
eta->push_extra(ET_USING_WHERE);
}
}
@@ -23905,7 +24046,7 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta, table_map prefix_tab
if (quick_type == QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX)
{
QUICK_GROUP_MIN_MAX_SELECT *qgs=
- (QUICK_GROUP_MIN_MAX_SELECT *) tab->select->quick;
+ (QUICK_GROUP_MIN_MAX_SELECT *) select->quick;
eta->push_extra(ET_USING_INDEX_FOR_GROUP_BY);
eta->loose_scan_is_scanning= qgs->loose_scan_is_scanning();
}
@@ -23917,7 +24058,7 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta, table_map prefix_tab
if (quick_type == QUICK_SELECT_I::QS_TYPE_RANGE)
{
- explain_append_mrr_info((QUICK_RANGE_SELECT*)(tab->select->quick),
+ explain_append_mrr_info((QUICK_RANGE_SELECT*)(select->quick),
&eta->mrr_type);
if (eta->mrr_type.length() > 0)
eta->push_extra(ET_USING_MRR);
@@ -23925,30 +24066,30 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta, table_map prefix_tab
if (distinct & test_all_bits(prefix_tables, join->select_list_used_tables))
eta->push_extra(ET_DISTINCT);
- if (tab->loosescan_match_tab)
+ if (loosescan_match_tab)
{
eta->push_extra(ET_LOOSESCAN);
}
- if (tab->first_weedout_table)
+ if (first_weedout_table)
{
eta->start_dups_weedout= true;
eta->push_extra(ET_START_TEMPORARY);
}
- if (tab->check_weed_out_table)
+ if (check_weed_out_table)
{
eta->push_extra(ET_END_TEMPORARY);
eta->end_dups_weedout= true;
}
- else if (tab->do_firstmatch)
+ else if (do_firstmatch)
{
- if (tab->do_firstmatch == /*join->join_tab*/ first_top_tab - 1)
+ if (do_firstmatch == /*join->join_tab*/ first_top_tab - 1)
eta->push_extra(ET_FIRST_MATCH);
else
{
eta->push_extra(ET_FIRST_MATCH);
- TABLE *prev_table=tab->do_firstmatch->table;
+ TABLE *prev_table=do_firstmatch->table;
if (prev_table->derived_select_number)
{
char namebuf[NAME_LEN];
@@ -23963,9 +24104,9 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta, table_map prefix_tab
}
}
- for (uint part= 0; part < tab->ref.key_parts; part++)
+ for (uint part= 0; part < ref.key_parts; part++)
{
- if (tab->ref.cond_guards[part])
+ if (ref.cond_guards[part])
{
eta->push_extra(ET_FULL_SCAN_ON_NULL_KEY);
eta->full_scan_on_null_key= true;
@@ -23973,10 +24114,10 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta, table_map prefix_tab
}
}
- if (tab->cache)
+ if (cache)
{
eta->push_extra(ET_USING_JOIN_BUFFER);
- tab->cache->save_explain_data(&eta->bka_type);
+ cache->save_explain_data(&eta->bka_type);
}
}
@@ -24003,7 +24144,7 @@ int JOIN::save_explain_data_intern(Explain_query *output, bool need_tmp_table,
const char *message)
{
JOIN *join= this; /* Legacy: this code used to be a non-member function */
- int error= 0;
+ int cur_error= 0;
DBUG_ENTER("JOIN::save_explain_data_intern");
DBUG_PRINT("info", ("Select 0x%lx, type %s, message %s",
(ulong)join->select_lex, join->select_lex->type,
@@ -24057,7 +24198,7 @@ int JOIN::save_explain_data_intern(Explain_query *output, bool need_tmp_table,
xpl_sel->exec_const_cond= exec_const_cond;
- JOIN_TAB* const first_top_tab= first_breadth_first_tab(join, WALK_OPTIMIZATION_TABS);
+ JOIN_TAB* const first_top_tab= join->first_breadth_first_optimization_tab();
JOIN_TAB* prev_bush_root_tab= NULL;
Explain_basic_join *cur_parent= xpl_sel;
@@ -24066,12 +24207,12 @@ int JOIN::save_explain_data_intern(Explain_query *output, bool need_tmp_table,
tab= next_explain_order_tab(join, tab))
{
JOIN_TAB *saved_join_tab= NULL;
- TABLE *table=tab->table;
+ TABLE *cur_table= tab->table;
/* Don't show eliminated tables */
- if (table->map & join->eliminated_tables)
+ if (cur_table->map & join->eliminated_tables)
{
- used_tables|=table->map;
+ used_tables|= cur_table->map;
continue;
}
@@ -24119,14 +24260,14 @@ int JOIN::save_explain_data_intern(Explain_query *output, bool need_tmp_table,
tab= saved_join_tab;
// For next iteration
- used_tables|=table->map;
+ used_tables|= cur_table->map;
}
output->add_node(xpl_sel);
}
- for (SELECT_LEX_UNIT *unit= join->select_lex->first_inner_unit();
- unit;
- unit= unit->next_unit())
+ for (SELECT_LEX_UNIT *tmp_unit= join->select_lex->first_inner_unit();
+ tmp_unit;
+ tmp_unit= tmp_unit->next_unit())
{
/*
Display subqueries only if
@@ -24134,17 +24275,18 @@ int JOIN::save_explain_data_intern(Explain_query *output, bool need_tmp_table,
elimination.
(2) they are not merged derived tables
*/
- if (!(unit->item && unit->item->eliminated) && // (1)
- (!unit->derived || unit->derived->is_materialized_derived())) // (2)
+ if (!(tmp_unit->item && tmp_unit->item->eliminated) && // (1)
+ (!tmp_unit->derived ||
+ tmp_unit->derived->is_materialized_derived())) // (2)
{
- explain->add_child(unit->first_select()->select_number);
+ explain->add_child(tmp_unit->first_select()->select_number);
}
}
- if (!error && select_lex->is_top_level_node())
+ if (!cur_error && select_lex->is_top_level_node())
output->query_plan_ready();
- DBUG_RETURN(error);
+ DBUG_RETURN(cur_error);
}
@@ -24393,7 +24535,7 @@ static void print_join(THD *thd,
{
if (!(*t2)->sj_inner_tables)
{
- TABLE_LIST *tmp= *t2;
+ tmp= *t2;
*t2= *table;
*table= tmp;
break;
@@ -24990,11 +25132,11 @@ void JOIN::cache_const_exprs()
return;
if (conds)
- conds->compile(&Item::cache_const_expr_analyzer, (uchar **)&analyzer_arg,
+ conds->compile(thd, &Item::cache_const_expr_analyzer, (uchar **)&analyzer_arg,
&Item::cache_const_expr_transformer, (uchar *)&cache_flag);
cache_flag= FALSE;
if (having)
- having->compile(&Item::cache_const_expr_analyzer, (uchar **)&analyzer_arg,
+ having->compile(thd, &Item::cache_const_expr_analyzer, (uchar **)&analyzer_arg,
&Item::cache_const_expr_transformer, (uchar *)&cache_flag);
for (JOIN_TAB *tab= first_depth_first_tab(this); tab;
@@ -25003,7 +25145,7 @@ void JOIN::cache_const_exprs()
if (*tab->on_expr_ref)
{
cache_flag= FALSE;
- (*tab->on_expr_ref)->compile(&Item::cache_const_expr_analyzer,
+ (*tab->on_expr_ref)->compile(thd, &Item::cache_const_expr_analyzer,
(uchar **)&analyzer_arg,
&Item::cache_const_expr_transformer,
(uchar *)&cache_flag);
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 6621e4e9928..57c66bae8e2 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -745,8 +745,7 @@ public:
struct st_position *pos,
struct st_position *loose_scan_pos);
friend bool get_best_combination(JOIN *join);
- friend int setup_semijoin_dups_elimination(JOIN *join, ulonglong options,
- uint no_jbuf_after);
+ friend int setup_semijoin_loosescan(JOIN *join);
friend void fix_semijoin_strategies_for_picked_join_order(JOIN *join);
};
@@ -963,6 +962,9 @@ public:
Item *pre_sort_idx_pushed_cond;
void clean_pre_sort_join_tab();
+ /* List of fields that aren't under an aggregate function */
+ List<Item_field> non_agg_fields;
+
/*
For "Using temporary+Using filesort" queries, JOIN::join_tab can point to
either:
@@ -1049,7 +1051,7 @@ public:
table_map outer_join;
/* Bitmap of tables used in the select list items */
table_map select_list_used_tables;
- ha_rows send_records,found_records,examined_rows;
+ ha_rows send_records,found_records,join_examined_rows;
/*
LIMIT for the JOIN operation. When not using aggregation or DISITNCT, this
@@ -1122,7 +1124,7 @@ public:
reexecutions. This value is equal to the multiplication of all
join->positions[i].records_read of a JOIN.
*/
- double record_count;
+ double join_record_count;
List<Item> *fields;
List<Cached_item> group_fields, group_fields_cache;
TABLE *tmp_table;
@@ -1327,6 +1329,7 @@ public:
table_count= 0;
top_join_tab_count= 0;
const_tables= 0;
+ const_table_map= 0;
eliminated_tables= 0;
join_list= 0;
implicit_grouping= FALSE;
@@ -1336,7 +1339,7 @@ public:
send_records= 0;
found_records= 0;
fetch_limit= HA_POS_ERROR;
- examined_rows= 0;
+ join_examined_rows= 0;
exec_tmp_table1= 0;
exec_tmp_table2= 0;
sortorder= 0;
@@ -1381,6 +1384,7 @@ public:
all_fields= fields_arg;
if (&fields_list != &fields_arg) /* Avoid valgrind-warning */
fields_list= fields_arg;
+ non_agg_fields.empty();
bzero((char*) &keyuse,sizeof(keyuse));
tmp_table_param.init();
tmp_table_param.end_write_records= HA_POS_ERROR;
@@ -1531,6 +1535,8 @@ public:
int save_explain_data_intern(Explain_query *output, bool need_tmp_table,
bool need_order, bool distinct,
const char *message);
+ JOIN_TAB *first_breadth_first_optimization_tab() { return table_access_tabs; }
+ JOIN_TAB *first_breadth_first_execution_tab() { return join_tab; }
private:
/**
TRUE if the query contains an aggregate function but has no GROUP
@@ -1847,9 +1853,9 @@ int test_if_item_cache_changed(List<Cached_item> &list);
int join_init_read_record(JOIN_TAB *tab);
int join_read_record_no_init(JOIN_TAB *tab);
void set_position(JOIN *join,uint idx,JOIN_TAB *table,KEYUSE *key);
-inline Item * and_items(Item* cond, Item *item)
+inline Item * and_items(THD *thd, Item* cond, Item *item)
{
- return (cond? (new Item_cond_and(cond, item)) : item);
+ return (cond ? (new (thd->mem_root) Item_cond_and(thd, cond, item)) : item);
}
bool choose_plan(JOIN *join, table_map join_tables);
void optimize_wo_join_buffering(JOIN *join, uint first_tab, uint last_tab,
diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc
index 9b944662545..0138c3e5a3b 100644
--- a/sql/sql_servers.cc
+++ b/sql/sql_servers.cc
@@ -320,7 +320,8 @@ get_server_from_table_to_cache(TABLE *table)
table->use_all_columns();
/* get each field into the server struct ptr */
- server->server_name= get_field(&mem, table->field[0]);
+ ptr= get_field(&mem, table->field[0]);
+ server->server_name= ptr ? ptr : blank;
server->server_name_length= (uint) strlen(server->server_name);
ptr= get_field(&mem, table->field[1]);
server->host= ptr ? ptr : blank;
@@ -1006,7 +1007,7 @@ int create_server(THD *thd, LEX_SERVER_OPTIONS *server_options)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_FOREIGN_SERVER_EXISTS,
- ER(ER_FOREIGN_SERVER_EXISTS),
+ ER_THD(thd, ER_FOREIGN_SERVER_EXISTS),
server_options->server_name.str);
error= 0;
goto end;
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 1e4723d1529..42da649e3d7 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
- Copyright (c) 2009, 2014, SkySQL Ab.
+/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2015, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -106,8 +106,7 @@ static TYPELIB grant_types = { sizeof(grant_names)/sizeof(char **),
/* Match the values of enum ha_choice */
static const char *ha_choice_values[] = {"", "0", "1"};
-static void store_key_options(THD *thd, String *packet, TABLE *table,
- KEY *key_info);
+static void store_key_options(THD *, String *, TABLE *, KEY *);
#ifdef WITH_PARTITION_STORAGE_ENGINE
static void get_cs_converted_string_value(THD *thd,
@@ -451,14 +450,19 @@ bool mysqld_show_authors(THD *thd)
{
List<Item> field_list;
Protocol *protocol= thd->protocol;
+ MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("mysqld_show_authors");
- field_list.push_back(new Item_empty_string("Name",40));
- field_list.push_back(new Item_empty_string("Location",40));
- field_list.push_back(new Item_empty_string("Comment",512));
+ field_list.push_back(new (mem_root) Item_empty_string(thd, "Name", 40),
+ mem_root);
+ field_list.push_back(new (mem_root) Item_empty_string(thd, "Location", 40),
+ mem_root);
+ field_list.push_back(new (mem_root) Item_empty_string(thd, "Comment", 512),
+ mem_root);
if (protocol->send_result_set_metadata(&field_list,
- Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
+ Protocol::SEND_NUM_ROWS |
+ Protocol::SEND_EOF))
DBUG_RETURN(TRUE);
show_table_authors_st *authors;
@@ -485,14 +489,19 @@ bool mysqld_show_contributors(THD *thd)
{
List<Item> field_list;
Protocol *protocol= thd->protocol;
+ MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("mysqld_show_contributors");
- field_list.push_back(new Item_empty_string("Name",40));
- field_list.push_back(new Item_empty_string("Location",40));
- field_list.push_back(new Item_empty_string("Comment", 512));
+ field_list.push_back(new (mem_root) Item_empty_string(thd, "Name", 40),
+ mem_root);
+ field_list.push_back(new (mem_root) Item_empty_string(thd, "Location", 40),
+ mem_root);
+ field_list.push_back(new (mem_root) Item_empty_string(thd, "Comment", 512),
+ mem_root);
if (protocol->send_result_set_metadata(&field_list,
- Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
+ Protocol::SEND_NUM_ROWS |
+ Protocol::SEND_EOF))
DBUG_RETURN(TRUE);
show_table_contributors_st *contributors;
@@ -562,14 +571,20 @@ bool mysqld_show_privileges(THD *thd)
{
List<Item> field_list;
Protocol *protocol= thd->protocol;
+ MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("mysqld_show_privileges");
- field_list.push_back(new Item_empty_string("Privilege",10));
- field_list.push_back(new Item_empty_string("Context",15));
- field_list.push_back(new Item_empty_string("Comment",NAME_CHAR_LEN));
+ field_list.push_back(new (mem_root) Item_empty_string(thd, "Privilege", 10),
+ mem_root);
+ field_list.push_back(new (mem_root) Item_empty_string(thd, "Context", 15),
+ mem_root);
+ field_list.push_back(new (mem_root) Item_empty_string(thd, "Comment",
+ NAME_CHAR_LEN),
+ mem_root);
if (protocol->send_result_set_metadata(&field_list,
- Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
+ Protocol::SEND_NUM_ROWS |
+ Protocol::SEND_EOF))
DBUG_RETURN(TRUE);
show_privileges_st *privilege= sys_privileges;
@@ -1002,13 +1017,13 @@ public:
failed is not available at this point. The only way for us to check is by
reconstructing the actual error message and see if it's the same.
*/
- char* get_view_access_denied_message()
+ char* get_view_access_denied_message(THD *thd)
{
if (!m_view_access_denied_message_ptr)
{
m_view_access_denied_message_ptr= m_view_access_denied_message;
my_snprintf(m_view_access_denied_message, MYSQL_ERRMSG_SIZE,
- ER(ER_TABLEACCESS_DENIED_ERROR), "SHOW VIEW",
+ ER_THD(thd, ER_TABLEACCESS_DENIED_ERROR), "SHOW VIEW",
m_sctx->priv_user,
m_sctx->host_or_ip, m_top_view->get_table_name());
}
@@ -1033,7 +1048,7 @@ public:
switch (sql_errno)
{
case ER_TABLEACCESS_DENIED_ERROR:
- if (!strcmp(get_view_access_denied_message(), message))
+ if (!strcmp(get_view_access_denied_message(thd), message))
{
/* Access to top view is not granted, don't interfere. */
is_handled= FALSE;
@@ -1053,7 +1068,7 @@ public:
are missing. */
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_VIEW_INVALID,
- ER(ER_VIEW_INVALID),
+ ER_THD(thd, ER_VIEW_INVALID),
m_top_view->get_db_name(),
m_top_view->get_table_name());
is_handled= TRUE;
@@ -1092,6 +1107,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
String buffer(buff, sizeof(buff), system_charset_info);
List<Item> field_list;
bool error= TRUE;
+ MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("mysqld_show_create");
DBUG_PRINT("enter",("db: %s table: %s",table_list->db,
table_list->table_name));
@@ -1144,24 +1160,37 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
if (table_list->view)
{
- field_list.push_back(new Item_empty_string("View",NAME_CHAR_LEN));
- field_list.push_back(new Item_empty_string("Create View",
- MY_MAX(buffer.length(),1024)));
- field_list.push_back(new Item_empty_string("character_set_client",
- MY_CS_NAME_SIZE));
- field_list.push_back(new Item_empty_string("collation_connection",
- MY_CS_NAME_SIZE));
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "View", NAME_CHAR_LEN),
+ mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Create View",
+ MY_MAX(buffer.length(),1024)),
+ mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "character_set_client",
+ MY_CS_NAME_SIZE),
+ mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "collation_connection",
+ MY_CS_NAME_SIZE),
+ mem_root);
}
else
{
- field_list.push_back(new Item_empty_string("Table",NAME_CHAR_LEN));
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Table", NAME_CHAR_LEN),
+ mem_root);
// 1024 is for not to confuse old clients
- field_list.push_back(new Item_empty_string("Create Table",
- MY_MAX(buffer.length(),1024)));
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Create Table",
+ MY_MAX(buffer.length(),1024)),
+ mem_root);
}
if (protocol->send_result_set_metadata(&field_list,
- Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
+ Protocol::SEND_NUM_ROWS |
+ Protocol::SEND_EOF))
goto exit;
protocol->prepare_for_resend();
@@ -1215,6 +1244,7 @@ bool mysqld_show_create_db(THD *thd, LEX_STRING *dbname,
#endif
Schema_specification_st create;
Protocol *protocol=thd->protocol;
+ MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("mysql_show_create_db");
#ifndef NO_EMBEDDED_ACCESS_CHECKS
@@ -1228,7 +1258,7 @@ bool mysqld_show_create_db(THD *thd, LEX_STRING *dbname,
status_var_increment(thd->status_var.access_denied_errors);
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
sctx->priv_user, sctx->host_or_ip, dbname->str);
- general_log_print(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR),
+ general_log_print(thd,COM_INIT_DB,ER_THD(thd, ER_DBACCESS_DENIED_ERROR),
sctx->priv_user, sctx->host_or_ip, orig_dbname->str);
DBUG_RETURN(TRUE);
}
@@ -1249,11 +1279,16 @@ bool mysqld_show_create_db(THD *thd, LEX_STRING *dbname,
load_db_opt_by_name(thd, dbname->str, &create);
}
List<Item> field_list;
- field_list.push_back(new Item_empty_string("Database",NAME_CHAR_LEN));
- field_list.push_back(new Item_empty_string("Create Database",1024));
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Database", NAME_CHAR_LEN),
+ mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Create Database", 1024),
+ mem_root);
if (protocol->send_result_set_metadata(&field_list,
- Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
+ Protocol::SEND_NUM_ROWS |
+ Protocol::SEND_EOF))
DBUG_RETURN(TRUE);
protocol->prepare_for_resend();
@@ -1295,6 +1330,7 @@ void
mysqld_list_fields(THD *thd, TABLE_LIST *table_list, const char *wild)
{
TABLE *table;
+ MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("mysqld_list_fields");
DBUG_PRINT("enter",("table: %s",table_list->table_name));
@@ -1313,16 +1349,19 @@ mysqld_list_fields(THD *thd, TABLE_LIST *table_list, const char *wild)
!wild_case_compare(system_charset_info, field->field_name,wild))
{
if (table_list->view)
- field_list.push_back(new Item_ident_for_show(field,
- table_list->view_db.str,
- table_list->view_name.str));
+ field_list.push_back(new (mem_root)
+ Item_ident_for_show(thd, field,
+ table_list->view_db.str,
+ table_list->view_name.str),
+ mem_root);
else
- field_list.push_back(new Item_field(field));
+ field_list.push_back(new (mem_root) Item_field(thd, field), mem_root);
}
}
restore_record(table, s->default_values); // Get empty record
table->use_all_columns();
- if (thd->protocol->send_result_set_metadata(&field_list, Protocol::SEND_DEFAULTS))
+ if (thd->protocol->send_result_set_metadata(&field_list,
+ Protocol::SEND_DEFAULTS))
DBUG_VOID_RETURN;
my_eof(thd);
DBUG_VOID_RETURN;
@@ -1810,35 +1849,36 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
else
packet->append(STRING_WITH_LEN(" VIRTUAL"));
}
-
- if (flags & NOT_NULL_FLAG)
- packet->append(STRING_WITH_LEN(" NOT NULL"));
- else if (field->type() == MYSQL_TYPE_TIMESTAMP)
- {
- /*
- TIMESTAMP field require explicit NULL flag, because unlike
- all other fields they are treated as NOT NULL by default.
- */
- packet->append(STRING_WITH_LEN(" NULL"));
- }
-
- if (!field->vcol_info &&
- get_field_default_value(thd, field, &def_value, 1))
+ else
{
- packet->append(STRING_WITH_LEN(" DEFAULT "));
- packet->append(def_value.ptr(), def_value.length(), system_charset_info);
- }
+ if (flags & NOT_NULL_FLAG)
+ packet->append(STRING_WITH_LEN(" NOT NULL"));
+ else if (field->type() == MYSQL_TYPE_TIMESTAMP)
+ {
+ /*
+ TIMESTAMP field require explicit NULL flag, because unlike
+ all other fields they are treated as NOT NULL by default.
+ */
+ packet->append(STRING_WITH_LEN(" NULL"));
+ }
- if (!limited_mysql_mode && print_on_update_clause(field, &def_value, false))
- {
- packet->append(STRING_WITH_LEN(" "));
- packet->append(def_value);
- }
+ if (get_field_default_value(thd, field, &def_value, 1))
+ {
+ packet->append(STRING_WITH_LEN(" DEFAULT "));
+ packet->append(def_value.ptr(), def_value.length(), system_charset_info);
+ }
+ if (!limited_mysql_mode &&
+ print_on_update_clause(field, &def_value, false))
+ {
+ packet->append(STRING_WITH_LEN(" "));
+ packet->append(def_value);
+ }
- if (field->unireg_check == Field::NEXT_NUMBER &&
- !(sql_mode & MODE_NO_FIELD_OPTIONS))
- packet->append(STRING_WITH_LEN(" AUTO_INCREMENT"));
+ if (field->unireg_check == Field::NEXT_NUMBER &&
+ !(sql_mode & MODE_NO_FIELD_OPTIONS))
+ packet->append(STRING_WITH_LEN(" AUTO_INCREMENT"));
+ }
if (field->comment.length)
{
@@ -2152,11 +2192,13 @@ static void store_key_options(THD *thd, String *packet, TABLE *table,
}
-void
-view_store_options(THD *thd, TABLE_LIST *table, String *buff)
+void view_store_options(THD *thd, TABLE_LIST *table, String *buff)
{
- buff->append(STRING_WITH_LEN("ALGORITHM="));
- buff->append(view_algorithm(table));
+ if (table->algorithm != VIEW_ALGORITHM_INHERIT)
+ {
+ buff->append(STRING_WITH_LEN("ALGORITHM="));
+ buff->append(view_algorithm(table));
+ }
buff->append(' ');
append_definer(thd, buff, &table->definer.user, &table->definer.host);
if (table->view_suid)
@@ -2166,15 +2208,8 @@ view_store_options(THD *thd, TABLE_LIST *table, String *buff)
}
-/*
- Append DEFINER clause to the given buffer.
-
- SYNOPSIS
- append_definer()
- thd [in] thread handle
- buffer [inout] buffer to hold DEFINER clause
- definer_user [in] user name part of definer
- definer_host [in] host name part of definer
+/**
+ Returns ALGORITHM clause of a view
*/
static const LEX_STRING *view_algorithm(TABLE_LIST *table)
@@ -2292,16 +2327,15 @@ static int show_create_view(THD *thd, TABLE_LIST *table, String *buff)
class thread_info :public ilink {
public:
- static void *operator new(size_t size)
- {
- return (void*) sql_alloc((uint) size);
- }
+ static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
+ { return alloc_root(mem_root, size); }
static void operator delete(void *ptr __attribute__((unused)),
size_t size __attribute__((unused)))
{ TRASH(ptr, size); }
ulong thread_id;
- time_t start_time;
+ ulong os_thread_id;
+ ulonglong start_time;
uint command;
const char *user,*host,*db,*proc_info,*state_info;
CSET_STRING query_string;
@@ -2340,28 +2374,49 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
ulong max_query_length= (verbose ? thd->variables.max_allowed_packet :
PROCESS_LIST_WIDTH);
Protocol *protocol= thd->protocol;
+ MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("mysqld_list_processes");
- field_list.push_back(new Item_int("Id", 0, MY_INT32_NUM_DECIMAL_DIGITS));
- field_list.push_back(new Item_empty_string("User", USERNAME_CHAR_LENGTH));
- field_list.push_back(new Item_empty_string("Host",LIST_PROCESS_HOST_LEN));
- field_list.push_back(field=new Item_empty_string("db",NAME_CHAR_LEN));
+ field_list.push_back(new (mem_root)
+ Item_int(thd, "Id", 0, MY_INT32_NUM_DECIMAL_DIGITS),
+ mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "User",
+ USERNAME_CHAR_LENGTH),
+ mem_root);
+ field_list.push_back(new (mem_root)
+ Item_empty_string(thd, "Host",
+ LIST_PROCESS_HOST_LEN),
+ mem_root);
+ field_list.push_back(field=new (mem_root)
+ Item_empty_string(thd, "db", NAME_CHAR_LEN),
+ mem_root);
field->maybe_null=1;
- field_list.push_back(new Item_empty_string("Command",16));
- field_list.push_back(field= new Item_return_int("Time",7, MYSQL_TYPE_LONG));
+ field_list.push_back(new (mem_root) Item_empty_string(thd, "Command", 16),
+ mem_root);
+ field_list.push_back(field= new (mem_root)
+ Item_return_int(thd, "Time", 7, MYSQL_TYPE_LONG),
+ mem_root);
field->unsigned_flag= 0;
- field_list.push_back(field=new Item_empty_string("State",30));
+ field_list.push_back(field=new (mem_root)
+ Item_empty_string(thd, "State", 30),
+ mem_root);
field->maybe_null=1;
- field_list.push_back(field=new Item_empty_string("Info",max_query_length));
+ field_list.push_back(field=new (mem_root)
+ Item_empty_string(thd, "Info", max_query_length),
+ mem_root);
field->maybe_null=1;
if (!thd->variables.old_mode &&
!(thd->variables.old_behavior & OLD_MODE_NO_PROGRESS_INFO))
{
- field_list.push_back(field= new Item_float("Progress", 0.0, 3, 7));
+ field_list.push_back(field= new (mem_root)
+ Item_float(thd, "Progress", 0.0, 3, 7),
+ mem_root);
field->maybe_null= 0;
}
if (protocol->send_result_set_metadata(&field_list,
- Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
+ Protocol::SEND_NUM_ROWS |
+ Protocol::SEND_EOF))
DBUG_VOID_RETURN;
if (thd->killed)
@@ -2375,11 +2430,13 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
Security_context *tmp_sctx= tmp->security_ctx;
struct st_my_thread_var *mysys_var;
if ((tmp->vio_ok() || tmp->system_thread) &&
- (!user || (tmp_sctx->user && !strcmp(tmp_sctx->user, user))))
+ (!user || (!tmp->system_thread &&
+ tmp_sctx->user && !strcmp(tmp_sctx->user, user))))
{
- thread_info *thd_info= new thread_info;
+ thread_info *thd_info= new (thd->mem_root) thread_info;
thd_info->thread_id=tmp->thread_id;
+ thd_info->os_thread_id=tmp->os_thread_id;
thd_info->user= thd->strdup(tmp_sctx->user ? tmp_sctx->user :
(tmp->system_thread ?
"system user" : "unauthenticated user"));
@@ -2432,7 +2489,10 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
}
else
thd_info->progress= 0.0;
- thd_info->start_time= tmp->start_time;
+ thd_info->start_time= tmp->start_utime;
+ ulonglong utime_after_query_snapshot= tmp->utime_after_query;
+ if (thd_info->start_time < utime_after_query_snapshot)
+ thd_info->start_time= utime_after_query_snapshot; // COM_SLEEP
mysql_mutex_unlock(&tmp->LOCK_thd_data);
thread_infos.append(thd_info);
}
@@ -2440,7 +2500,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
mysql_mutex_unlock(&LOCK_thread_count);
thread_info *thd_info;
- time_t now= my_time(0);
+ ulonglong now= microsecond_interval_timer();
char buff[20]; // For progress
String store_buffer(buff, sizeof(buff), system_charset_info);
@@ -2455,8 +2515,8 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
protocol->store(thd_info->proc_info, system_charset_info);
else
protocol->store(command_name[thd_info->command].str, system_charset_info);
- if (thd_info->start_time)
- protocol->store_long ((longlong) (now - thd_info->start_time));
+ if (thd_info->start_time && now > thd_info->start_time)
+ protocol->store_long((now - thd_info->start_time) / HRTIME_RESOLUTION);
else
protocol->store_null();
protocol->store(thd_info->state_info, system_charset_info);
@@ -2530,11 +2590,11 @@ int select_result_explain_buffer::send_data(List<Item> &items)
DBUG_RETURN(MY_TEST(res));
}
-bool select_result_text_buffer::send_result_set_metadata(List<Item> &fields, uint flag)
+bool select_result_text_buffer::send_result_set_metadata(List<Item> &fields,
+ uint flag)
{
n_columns= fields.elements;
return append_row(fields, true /*send item names */);
- return send_data(fields);
}
@@ -2550,16 +2610,18 @@ int select_result_text_buffer::append_row(List<Item> &items, bool send_names)
char **row;
int column= 0;
- if (!(row= (char**) thd->alloc(sizeof(char*) * n_columns)))
+ if (!(row= (char**) thd->alloc(sizeof(char*) * n_columns)) ||
+ rows.push_back(row, thd->mem_root))
return true;
- rows.push_back(row);
while ((item= it++))
{
DBUG_ASSERT(column < n_columns);
StringBuffer<32> buf;
const char *data_ptr;
+ char *ptr;
size_t data_len;
+
if (send_names)
{
data_ptr= item->name;
@@ -2581,8 +2643,8 @@ int select_result_text_buffer::append_row(List<Item> &items, bool send_names)
}
}
- char *ptr= (char*)thd->alloc(data_len + 1);
- memcpy(ptr, data_ptr, data_len + 1);
+ if (!(ptr= (char*) thd->memdup(data_ptr, data_len + 1)))
+ return true;
row[column]= ptr;
column++;
@@ -2730,7 +2792,7 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
TABLE *table= tables->table;
CHARSET_INFO *cs= system_charset_info;
char *user;
- my_hrtime_t unow= my_hrtime();
+ ulonglong unow= microsecond_interval_timer();
DBUG_ENTER("fill_schema_processlist");
DEBUG_SYNC(thd,"fill_schema_processlist_after_unow");
@@ -2753,7 +2815,8 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
ulonglong max_counter;
if ((!tmp->vio_ok() && !tmp->system_thread) ||
- (user && (!tmp_sctx->user || strcmp(tmp_sctx->user, user))))
+ (user && (tmp->system_thread || !tmp_sctx->user ||
+ strcmp(tmp_sctx->user, user))))
continue;
restore_record(table, s->default_values);
@@ -2793,9 +2856,12 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
table->field[4]->store(command_name[tmp->get_command()].str,
command_name[tmp->get_command()].length, cs);
/* MYSQL_TIME */
- ulonglong start_utime= tmp->start_time * HRTIME_RESOLUTION + tmp->start_time_sec_part;
- ulonglong utime= start_utime && start_utime < unow.val
- ? unow.val - start_utime : 0;
+ ulonglong utime= tmp->start_utime;
+ ulonglong utime_after_query_snapshot= tmp->utime_after_query;
+ if (utime < utime_after_query_snapshot)
+ utime= utime_after_query_snapshot; // COM_SLEEP
+ utime= utime && utime < unow ? unow - utime : 0;
+
table->field[5]->store(utime / HRTIME_RESOLUTION, TRUE);
/* STATE */
if ((val= thread_state_info(tmp)))
@@ -2859,6 +2925,8 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
table->field[15]->set_notnull();
}
+ table->field[16]->store(tmp->os_thread_id);
+
if (schema_table_store_record(thd, table))
{
mysql_mutex_unlock(&LOCK_thread_count);
@@ -3293,7 +3361,10 @@ void calc_sum_of_all_status(STATUS_VAR *to)
/* Add to this status from existing threads */
while ((tmp= it++))
- add_to_status(to, &tmp->status_var);
+ {
+ if (!tmp->status_in_global)
+ add_to_status(to, &tmp->status_var);
+ }
mysql_mutex_unlock(&LOCK_thread_count);
DBUG_VOID_RETURN;
@@ -3519,7 +3590,7 @@ bool uses_only_table_name_fields(Item *item, TABLE_LIST *table)
}
-COND *make_cond_for_info_schema(COND *cond, TABLE_LIST *table)
+COND *make_cond_for_info_schema(THD *thd, COND *cond, TABLE_LIST *table)
{
if (!cond)
return (COND*) 0;
@@ -3528,16 +3599,16 @@ COND *make_cond_for_info_schema(COND *cond, TABLE_LIST *table)
if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC)
{
/* Create new top level AND item */
- Item_cond_and *new_cond=new Item_cond_and;
+ Item_cond_and *new_cond=new (thd->mem_root) Item_cond_and(thd);
if (!new_cond)
return (COND*) 0;
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
Item *item;
while ((item=li++))
{
- Item *fix= make_cond_for_info_schema(item, table);
+ Item *fix= make_cond_for_info_schema(thd, item, table);
if (fix)
- new_cond->argument_list()->push_back(fix);
+ new_cond->argument_list()->push_back(fix, thd->mem_root);
}
switch (new_cond->argument_list()->elements) {
case 0:
@@ -3551,17 +3622,17 @@ COND *make_cond_for_info_schema(COND *cond, TABLE_LIST *table)
}
else
{ // Or list
- Item_cond_or *new_cond=new Item_cond_or;
+ Item_cond_or *new_cond= new (thd->mem_root) Item_cond_or(thd);
if (!new_cond)
return (COND*) 0;
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
Item *item;
while ((item=li++))
{
- Item *fix=make_cond_for_info_schema(item, table);
+ Item *fix=make_cond_for_info_schema(thd, item, table);
if (!fix)
return (COND*) 0;
- new_cond->argument_list()->push_back(fix);
+ new_cond->argument_list()->push_back(fix, thd->mem_root);
}
new_cond->quick_fix_field();
new_cond->top_level_item();
@@ -4353,7 +4424,7 @@ static int fill_schema_table_from_frm(THD *thd, TABLE_LIST *tables,
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_I_S_SKIPPED_TABLE,
- ER(ER_WARN_I_S_SKIPPED_TABLE),
+ ER_THD(thd, ER_WARN_I_S_SKIPPED_TABLE),
table_list.db, table_list.table_name);
return 0;
}
@@ -5518,6 +5589,7 @@ bool store_schema_params(THD *thd, TABLE *table, TABLE *proc_table,
sp_head *sp;
stored_procedure_type routine_type;
bool free_sp_head;
+ bool error= 0;
DBUG_ENTER("store_schema_params");
bzero((char*) &tbl, sizeof(TABLE));
@@ -5568,7 +5640,8 @@ bool store_schema_params(THD *thd, TABLE *table, TABLE *proc_table,
&tmp_string);
table->field[15]->store(tmp_string.ptr(), tmp_string.length(), cs);
field_def= &sp->m_return_field_def;
- field= make_field(&share, (uchar*) 0, field_def->length,
+ field= make_field(&share, thd->mem_root,
+ (uchar*) 0, field_def->length,
(uchar*) "", 0, field_def->pack_flag,
field_def->sql_type, field_def->charset,
field_def->geom_type, field_def->srid, Field::NONE,
@@ -5621,7 +5694,7 @@ bool store_schema_params(THD *thd, TABLE *table, TABLE *proc_table,
&tmp_string);
table->field[15]->store(tmp_string.ptr(), tmp_string.length(), cs);
- field= make_field(&share, (uchar*) 0, field_def->length,
+ field= make_field(&share, thd->mem_root, (uchar*) 0, field_def->length,
(uchar*) "", 0, field_def->pack_flag,
field_def->sql_type, field_def->charset,
field_def->geom_type, field_def->srid, Field::NONE,
@@ -5632,17 +5705,15 @@ bool store_schema_params(THD *thd, TABLE *table, TABLE *proc_table,
store_column_type(table, field, cs, 6);
if (schema_table_store_record(thd, table))
{
- free_table_share(&share);
- if (free_sp_head)
- delete sp;
- DBUG_RETURN(1);
+ error= 1;
+ break;
}
}
if (free_sp_head)
delete sp;
}
free_table_share(&share);
- DBUG_RETURN(0);
+ DBUG_RETURN(error);
}
@@ -5720,7 +5791,8 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
bzero((char*) &tbl, sizeof(TABLE));
(void) build_table_filename(path, sizeof(path), "", "", "", 0);
init_tmp_table_share(thd, &share, "", 0, "", path);
- field= make_field(&share, (uchar*) 0, field_def->length,
+ field= make_field(&share, thd->mem_root, (uchar*) 0,
+ field_def->length,
(uchar*) "", 0, field_def->pack_flag,
field_def->sql_type, field_def->charset,
field_def->geom_type, field_def->srid, Field::NONE,
@@ -7049,7 +7121,7 @@ int fill_variables(THD *thd, TABLE_LIST *tables, COND *cond)
schema_table_idx == SCH_GLOBAL_VARIABLES)
scope= OPT_GLOBAL;
- COND *partial_cond= make_cond_for_info_schema(cond, tables);
+ COND *partial_cond= make_cond_for_info_schema(thd, cond, tables);
mysql_rwlock_rdlock(&LOCK_system_variables_hash);
res= show_status_array(thd, wild, enumerate_sys_vars(thd, sorted_vars, scope),
@@ -7091,7 +7163,7 @@ int fill_status(THD *thd, TABLE_LIST *tables, COND *cond)
tmp1= &thd->status_var;
}
- COND *partial_cond= make_cond_for_info_schema(cond, tables);
+ COND *partial_cond= make_cond_for_info_schema(thd, cond, tables);
// Evaluate and cache const subqueries now, before the mutex.
if (partial_cond)
partial_cond->val_int();
@@ -7304,6 +7376,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
ST_SCHEMA_TABLE *schema_table= table_list->schema_table;
ST_FIELD_INFO *fields_info= schema_table->fields_info;
CHARSET_INFO *cs= system_charset_info;
+ MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("create_schema_table");
for (; fields_info->field_name; fields_info++)
@@ -7314,43 +7387,50 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
case MYSQL_TYPE_SHORT:
case MYSQL_TYPE_LONGLONG:
case MYSQL_TYPE_INT24:
- if (!(item= new Item_return_int(fields_info->field_name,
- fields_info->field_length,
- fields_info->field_type,
- fields_info->value)))
+ if (!(item= new (mem_root)
+ Item_return_int(thd, fields_info->field_name,
+ fields_info->field_length,
+ fields_info->field_type,
+ fields_info->value)))
{
DBUG_RETURN(0);
}
item->unsigned_flag= (fields_info->field_flags & MY_I_S_UNSIGNED);
break;
case MYSQL_TYPE_DATE:
- if (!(item=new Item_return_date_time(fields_info->field_name,
- strlen(fields_info->field_name),
- fields_info->field_type)))
+ if (!(item=new (mem_root)
+ Item_return_date_time(thd, fields_info->field_name,
+ strlen(fields_info->field_name),
+ fields_info->field_type)))
DBUG_RETURN(0);
break;
case MYSQL_TYPE_TIME:
- if (!(item=new Item_return_date_time(fields_info->field_name,
- strlen(fields_info->field_name),
- fields_info->field_type)))
+ if (!(item=new (mem_root)
+ Item_return_date_time(thd, fields_info->field_name,
+ strlen(fields_info->field_name),
+ fields_info->field_type)))
DBUG_RETURN(0);
break;
case MYSQL_TYPE_TIMESTAMP:
case MYSQL_TYPE_DATETIME:
- if (!(item=new Item_return_date_time(fields_info->field_name,
- strlen(fields_info->field_name),
- fields_info->field_type)))
+ if (!(item=new (mem_root)
+ Item_return_date_time(thd, fields_info->field_name,
+ strlen(fields_info->field_name),
+ fields_info->field_type)))
DBUG_RETURN(0);
break;
case MYSQL_TYPE_FLOAT:
case MYSQL_TYPE_DOUBLE:
- if ((item= new Item_float(fields_info->field_name, 0.0, NOT_FIXED_DEC,
- fields_info->field_length)) == NULL)
+ if ((item= new (mem_root)
+ Item_float(thd, fields_info->field_name, 0.0,
+ NOT_FIXED_DEC,
+ fields_info->field_length)) == NULL)
DBUG_RETURN(NULL);
break;
case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_NEWDECIMAL:
- if (!(item= new Item_decimal((longlong) fields_info->value, false)))
+ if (!(item= new (mem_root)
+ Item_decimal(thd, (longlong) fields_info->value, false)))
{
DBUG_RETURN(0);
}
@@ -7358,7 +7438,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
Create a type holder, as we want the type of the item to defined
the type of the object, not the value
*/
- if (!(item= new Item_type_holder(thd, item)))
+ if (!(item= new (mem_root) Item_type_holder(thd, item)))
DBUG_RETURN(0);
item->unsigned_flag= (fields_info->field_flags & MY_I_S_UNSIGNED);
item->decimals= fields_info->field_length%10;
@@ -7374,8 +7454,9 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
case MYSQL_TYPE_MEDIUM_BLOB:
case MYSQL_TYPE_LONG_BLOB:
case MYSQL_TYPE_BLOB:
- if (!(item= new Item_blob(fields_info->field_name,
- fields_info->field_length)))
+ if (!(item= new (mem_root)
+ Item_blob(thd, fields_info->field_name,
+ fields_info->field_length)))
{
DBUG_RETURN(0);
}
@@ -7384,7 +7465,8 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
/* Don't let unimplemented types pass through. Could be a grave error. */
DBUG_ASSERT(fields_info->field_type == MYSQL_TYPE_STRING);
- if (!(item= new Item_empty_string("", fields_info->field_length, cs)))
+ if (!(item= new (mem_root)
+ Item_empty_string(thd, "", fields_info->field_length, cs)))
{
DBUG_RETURN(0);
}
@@ -7392,7 +7474,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
strlen(fields_info->field_name), cs);
break;
}
- field_list.push_back(item);
+ field_list.push_back(item, thd->mem_root);
item->maybe_null= (fields_info->field_flags & MY_I_S_MAYBE_NULL);
field_count++;
}
@@ -7443,8 +7525,8 @@ static int make_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
{
if (field_info->old_name)
{
- Item_field *field= new Item_field(context,
- NullS, NullS, field_info->field_name);
+ Item_field *field= new (thd->mem_root)
+ Item_field(thd, context, NullS, NullS, field_info->field_name);
if (field)
{
field->set_name(field_info->old_name,
@@ -7470,7 +7552,7 @@ int make_schemata_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
{
ST_FIELD_INFO *field_info= &schema_table->fields_info[1];
String buffer(tmp,sizeof(tmp), system_charset_info);
- Item_field *field= new Item_field(context,
+ Item_field *field= new (thd->mem_root) Item_field(thd, context,
NullS, NullS, field_info->field_name);
if (!field || add_item_to_list(thd, field))
return 1;
@@ -7505,7 +7587,7 @@ int make_table_names_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
buffer.append(lex->wild->ptr());
buffer.append(')');
}
- Item_field *field= new Item_field(context,
+ Item_field *field= new (thd->mem_root) Item_field(thd, context,
NullS, NullS, field_info->field_name);
if (add_item_to_list(thd, field))
return 1;
@@ -7514,7 +7596,7 @@ int make_table_names_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
{
field->set_name(buffer.ptr(), buffer.length(), system_charset_info);
field_info= &schema_table->fields_info[3];
- field= new Item_field(context, NullS, NullS, field_info->field_name);
+ field= new (thd->mem_root) Item_field(thd, context, NullS, NullS, field_info->field_name);
if (add_item_to_list(thd, field))
return 1;
field->set_name(field_info->old_name, strlen(field_info->old_name),
@@ -7538,7 +7620,7 @@ int make_columns_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
*field_num == 18 ||
*field_num == 19))
continue;
- Item_field *field= new Item_field(context,
+ Item_field *field= new (thd->mem_root) Item_field(thd, context,
NullS, NullS, field_info->field_name);
if (field)
{
@@ -7563,7 +7645,7 @@ int make_character_sets_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
for (; *field_num >= 0; field_num++)
{
field_info= &schema_table->fields_info[*field_num];
- Item_field *field= new Item_field(context,
+ Item_field *field= new (thd->mem_root) Item_field(thd, context,
NullS, NullS, field_info->field_name);
if (field)
{
@@ -7588,7 +7670,7 @@ int make_proc_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
for (; *field_num >= 0; field_num++)
{
field_info= &schema_table->fields_info[*field_num];
- Item_field *field= new Item_field(context,
+ Item_field *field= new (thd->mem_root) Item_field(thd, context,
NullS, NullS, field_info->field_name);
if (field)
{
@@ -7806,7 +7888,7 @@ static bool optimize_for_get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond
if (plan->has_db_lookup_value() && plan->has_table_lookup_value())
plan->partial_cond= 0;
else
- plan->partial_cond= make_cond_for_info_schema(cond, tables);
+ plan->partial_cond= make_cond_for_info_schema(thd, cond, tables);
end:
DBUG_RETURN(0);
@@ -7905,15 +7987,28 @@ bool get_schema_tables_result(JOIN *join,
TABLE_LIST *table_list= tab->table->pos_in_table_list;
if (table_list->schema_table && thd->fill_information_schema_tables())
{
- bool is_subselect= (&lex->unit != lex->current_select->master_unit() &&
- lex->current_select->master_unit()->item);
+ /*
+ Note, currently I_S tables are filled once per query.
+ This needs to be changed if if make_cond_for_info_schema()
+ will preserve outer fields (and thus I_S content will depend on
+ the outer subquery) - in this new case I_S tables will need to
+ be re-populated here.
+
+ And in that case, get_all_tables() might be called O(N^2) times
+ (in self-join of TABLES, for example) and it will allocate
+ table names on THD::mem_root O(N^2) times. To fix it, get_all_tables
+ needs to be fixed to use a local memroot, that is reset or destroyed
+ between get_all_tables invocations. Or fixed not to allocate
+ table names on THD::memroot if these names don't satisfy lookup_field
+ */
+ const bool is_subselect= false;
/* A value of 0 indicates a dummy implementation */
if (table_list->schema_table->fill_table == 0)
continue;
/* skip I_S optimizations specific to get_all_tables */
- if (thd->lex->describe &&
+ if (lex->describe &&
(table_list->schema_table->fill_table != get_all_tables))
continue;
@@ -7946,7 +8041,6 @@ bool get_schema_tables_result(JOIN *join,
}
else
table_list->table->file->stats.records= 0;
-
Item *cond= tab->select_cond;
if (tab->cache_select && tab->cache_select->cond)
@@ -8599,7 +8693,7 @@ ST_FIELD_INFO variables_fields_info[]=
{
{"VARIABLE_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Variable_name",
SKIP_OPEN_TABLE},
- {"VARIABLE_VALUE", 1024, MYSQL_TYPE_STRING, 0, 0, "Value", SKIP_OPEN_TABLE},
+ {"VARIABLE_VALUE", 2048, MYSQL_TYPE_STRING, 0, 0, "Value", SKIP_OPEN_TABLE},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
};
@@ -8607,10 +8701,10 @@ ST_FIELD_INFO variables_fields_info[]=
ST_FIELD_INFO sysvars_fields_info[]=
{
{"VARIABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, 0},
- {"SESSION_VALUE", 1024, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0},
- {"GLOBAL_VALUE", 1024, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0},
+ {"SESSION_VALUE", 2048, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0},
+ {"GLOBAL_VALUE", 2048, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0},
{"GLOBAL_VALUE_ORIGIN", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, 0},
- {"DEFAULT_VALUE", 1024, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0},
+ {"DEFAULT_VALUE", 2048, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0},
{"VARIABLE_SCOPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, 0},
{"VARIABLE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, 0},
{"VARIABLE_COMMENT", TABLE_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0, 0, 0},
@@ -8648,6 +8742,7 @@ ST_FIELD_INFO processlist_fields_info[]=
{"QUERY_ID", 4, MYSQL_TYPE_LONGLONG, 0, 0, 0, SKIP_OPEN_TABLE},
{"INFO_BINARY", PROCESS_LIST_INFO_WIDTH, MYSQL_TYPE_BLOB, 0, 1,
"Info_binary", SKIP_OPEN_TABLE},
+ {"TID", 4, MYSQL_TYPE_LONGLONG, 0, 0, "Tid", SKIP_OPEN_TABLE},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
};
@@ -9087,10 +9182,8 @@ static bool show_create_trigger_impl(THD *thd,
int trigger_idx)
{
int ret_code;
-
Protocol *p= thd->protocol;
List<Item> fields;
-
LEX_STRING trg_name;
ulonglong trg_sql_mode;
LEX_STRING trg_sql_mode_str;
@@ -9098,8 +9191,8 @@ static bool show_create_trigger_impl(THD *thd,
LEX_STRING trg_client_cs_name;
LEX_STRING trg_connection_cl_name;
LEX_STRING trg_db_cl_name;
-
CHARSET_INFO *trg_client_cs;
+ MEM_ROOT *mem_root= thd->mem_root;
/*
TODO: Check privileges here. This functionality will be added by
@@ -9131,8 +9224,11 @@ static bool show_create_trigger_impl(THD *thd,
/* Send header. */
- fields.push_back(new Item_empty_string("Trigger", NAME_LEN));
- fields.push_back(new Item_empty_string("sql_mode", trg_sql_mode_str.length));
+ fields.push_back(new (mem_root) Item_empty_string(thd, "Trigger", NAME_LEN),
+ mem_root);
+ fields.push_back(new (mem_root)
+ Item_empty_string(thd, "sql_mode", trg_sql_mode_str.length),
+ mem_root);
{
/*
@@ -9141,24 +9237,33 @@ static bool show_create_trigger_impl(THD *thd,
*/
Item_empty_string *stmt_fld=
- new Item_empty_string("SQL Original Statement",
- MY_MAX(trg_sql_original_stmt.length, 1024));
+ new (mem_root) Item_empty_string(thd, "SQL Original Statement",
+ MY_MAX(trg_sql_original_stmt.length,
+ 1024));
stmt_fld->maybe_null= TRUE;
- fields.push_back(stmt_fld);
+ fields.push_back(stmt_fld, mem_root);
}
- fields.push_back(new Item_empty_string("character_set_client",
- MY_CS_NAME_SIZE));
+ fields.push_back(new (mem_root)
+ Item_empty_string(thd, "character_set_client",
+ MY_CS_NAME_SIZE),
+ mem_root);
- fields.push_back(new Item_empty_string("collation_connection",
- MY_CS_NAME_SIZE));
+ fields.push_back(new (mem_root)
+ Item_empty_string(thd, "collation_connection",
+ MY_CS_NAME_SIZE),
+ mem_root);
- fields.push_back(new Item_empty_string("Database Collation",
- MY_CS_NAME_SIZE));
+ fields.push_back(new (mem_root)
+ Item_empty_string(thd, "Database Collation",
+ MY_CS_NAME_SIZE),
+ mem_root);
- if (p->send_result_set_metadata(&fields, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
+ if (p->send_result_set_metadata(&fields,
+ Protocol::SEND_NUM_ROWS |
+ Protocol::SEND_EOF))
return TRUE;
/* Send data. */
diff --git a/sql/sql_show.h b/sql/sql_show.h
index 4bdfe95701b..029249f4129 100644
--- a/sql/sql_show.h
+++ b/sql/sql_show.h
@@ -112,7 +112,7 @@ void view_store_options(THD *thd, TABLE_LIST *table, String *buff);
void init_fill_schema_files_row(TABLE* table);
bool schema_table_store_record(THD *thd, TABLE *table);
void initialize_information_schema_acl();
-COND *make_cond_for_info_schema(COND *cond, TABLE_LIST *table);
+COND *make_cond_for_info_schema(THD *thd, COND *cond, TABLE_LIST *table);
ST_SCHEMA_TABLE *find_schema_table(THD *thd, const char* table_name);
ST_SCHEMA_TABLE *get_schema_table(enum enum_schema_tables schema_table_idx);
diff --git a/sql/sql_signal.cc b/sql/sql_signal.cc
index f9933e68595..5f4862f173c 100644
--- a/sql/sql_signal.cc
+++ b/sql/sql_signal.cc
@@ -89,11 +89,11 @@ void Set_signal_information::clear()
memset(m_item, 0, sizeof(m_item));
}
-void Sql_cmd_common_signal::assign_defaults(
- Sql_condition *cond,
- bool set_level_code,
- Sql_condition::enum_warning_level level,
- int sqlcode)
+void
+Sql_cmd_common_signal::assign_defaults(Sql_condition *cond,
+ bool set_level_code,
+ Sql_condition::enum_warning_level level,
+ int sqlcode)
{
if (set_level_code)
{
@@ -506,7 +506,7 @@ bool Sql_cmd_resignal::execute(THD *thd)
if (m_cond)
{
- query_cache_abort(&thd->query_cache_tls);
+ query_cache_abort(thd, &thd->query_cache_tls);
/* Keep handled conditions. */
da->unmark_sql_conditions_from_removal();
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 1b8ea936c0d..379609ad6e7 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -879,13 +879,7 @@ my_copy_with_hex_escaping(CHARSET_INFO *cs,
with optional character set conversion,
with optional left padding (for binary -> UCS2 conversion)
- In case if there is a Unicode conversion (i.e. to_cs and from_cs are
- different character sets and both are not &my_charset_bin), bad input bytes
- as well as characters that cannot be encoded in to_cs are replaced to '?'.
-
- In case of non-Unicode copying (i.e. to_cs and from_cs are same character set,
- or from_cs is &my_charset_bin), the function stops on the first bad
- byte sequence.
+ Bad input bytes are replaced to '?'.
The string that is written to "to" is always well-formed.
diff --git a/sql/sql_string.h b/sql/sql_string.h
index 518b8e5ba4b..99fe6b60d37 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -69,8 +69,7 @@ public:
srccs, src, src_length, nchars, this);
}
/*
- Copy a string. Fix bad bytes/characters one Unicode conversion,
- break on bad bytes in case of non-Unicode copying.
+ Copy a string. Fix bad bytes/characters to '?'.
*/
uint well_formed_copy(CHARSET_INFO *to_cs, char *to, uint to_length,
CHARSET_INFO *from_cs, const char *from,
@@ -84,32 +83,6 @@ public:
from_cs, from, from_length,
from_length /* No limit on "nchars"*/);
}
- /*
- Copy a string. If a bad byte sequence is found in case of non-Unicode
- copying, continues processing and replaces bad bytes to '?'.
- */
- uint copy_fix(CHARSET_INFO *to_cs, char *to, uint to_length,
- CHARSET_INFO *from_cs, const char *from, uint from_length)
- {
- uint length= well_formed_copy(to_cs, to, to_length,
- from_cs, from, from_length,
- from_length /* No limit on nchars */);
- if (well_formed_error_pos() && source_end_pos() < from + from_length)
- {
- /*
- There was an error and there are still some bytes in the source string.
- This is possible if there were no character set conversion and a
- malformed byte sequence was found. Copy the rest and replace bad
- bytes to '?'. Note: m_source_end_pos is not updated!!!
- */
- uint dummy_errors;
- length+= copy_and_convert(to + length, to_length - length, to_cs,
- source_end_pos(),
- from_length - (source_end_pos() - from),
- from_cs, &dummy_errors);
- }
- return length;
- }
};
@@ -226,13 +199,13 @@ public:
}
LEX_STRING lex_string() const
{
- LEX_STRING lex_string = { (char*) ptr(), length() };
- return lex_string;
+ LEX_STRING str = { (char*) ptr(), length() };
+ return str;
}
LEX_CSTRING lex_cstring() const
{
- LEX_CSTRING lex_cstring = { ptr(), length() };
- return lex_cstring;
+ LEX_CSTRING skr = { ptr(), length() };
+ return skr;
}
void set(String &str,uint32 offset,uint32 arg_length)
@@ -284,16 +257,25 @@ public:
bool set(ulonglong num, CHARSET_INFO *cs) { return set_int((longlong)num, true, cs); }
bool set_real(double num,uint decimals, CHARSET_INFO *cs);
- /* Move handling of buffer from some other object to String */
- void reassociate(char *ptr, uint32 length, uint32 alloced_length,
- CHARSET_INFO *cs)
+ /* Take over handling of buffer from some other object */
+ void reset(char *ptr_arg, uint32 length_arg, uint32 alloced_length_arg,
+ CHARSET_INFO *cs)
{
free();
- Ptr= ptr;
- str_length= length;
- Alloced_length= alloced_length;
+ Ptr= ptr_arg;
+ str_length= length_arg;
+ Alloced_length= alloced_length_arg;
str_charset= cs;
- alloced= ptr != 0;
+ alloced= ptr_arg != 0;
+ }
+
+ /* Forget about the buffer, let some other object handle it */
+ char *release()
+ {
+ char *old= Ptr;
+ Ptr=0; str_length= Alloced_length= extra_alloc= 0;
+ alloced= thread_specific= 0;
+ return old;
}
/*
@@ -477,7 +459,7 @@ public:
}
bool append_hex(const char *src, uint32 srclen)
{
- for (const char *end= src + srclen ; src != end ; src++)
+ for (const char *src_end= src + srclen ; src != src_end ; src++)
{
if (append(_dig_vec_lower[((uchar) *src) >> 4]) ||
append(_dig_vec_lower[((uchar) *src) & 0x0F]))
@@ -485,6 +467,10 @@ public:
}
return false;
}
+ bool append_hex(const uchar *src, uint32 srclen)
+ {
+ return append_hex((const char*)src, srclen);
+ }
bool fill(uint32 max_length,char fill);
void strip_sp();
friend int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
@@ -613,7 +599,7 @@ public:
return TRUE;
if (charset()->mbminlen > 1)
return FALSE;
- for (const char *c= ptr(), *end= c + length(); c < end; c++)
+ for (const char *c= ptr(), *c_end= c + length(); c < c_end; c++)
{
if (!my_isascii(*c))
return FALSE;
@@ -655,10 +641,10 @@ public:
{
length(0);
}
- StringBuffer(const char *str, size_t length, CHARSET_INFO *cs)
+ StringBuffer(const char *str, size_t length_arg, CHARSET_INFO *cs)
: String(buff, buff_sz, cs)
{
- set(str, length, cs);
+ set(str, length_arg, cs);
}
};
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 954970d9d5b..61120970ecb 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1672,6 +1672,7 @@ void execute_ddl_log_recovery()
(void) mysql_file_delete(key_file_global_ddl_log, file_name, MYF(0));
global_ddl_log.recovery_phase= FALSE;
mysql_mutex_unlock(&LOCK_gdl);
+ thd->reset_query();
delete thd;
DBUG_VOID_RETURN;
}
@@ -2177,15 +2178,13 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
char path[FN_REFLEN + 1], wrong_tables_buff[160], *alias= NULL;
String wrong_tables(wrong_tables_buff, sizeof(wrong_tables_buff)-1,
system_charset_info);
- uint path_length= 0;
+ uint path_length= 0, errors= 0;
int error= 0;
int non_temp_tables_count= 0;
- bool foreign_key_error=0;
bool non_tmp_error= 0;
bool trans_tmp_table_deleted= 0, non_trans_tmp_table_deleted= 0;
bool non_tmp_table_deleted= 0;
bool is_drop_tmp_if_exists_added= 0;
- bool one_table= tables->next_local == 0;
bool was_view= 0;
String built_query;
String built_trans_tmp_query, built_non_trans_tmp_query;
@@ -2419,7 +2418,8 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
tbl_name.append('.');
tbl_name.append(table->table_name);
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR),
+ ER_BAD_TABLE_ERROR,
+ ER_THD(thd, ER_BAD_TABLE_ERROR),
tbl_name.c_ptr_safe());
}
else
@@ -2471,12 +2471,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
error= ha_delete_table(thd, table_type, path, db, table->table_name,
!dont_log_query);
- if (error == HA_ERR_ROW_IS_REFERENCED)
- {
- /* the table is referenced by a foreign key constraint */
- foreign_key_error= 1;
- }
- if (!error || error == ENOENT || error == HA_ERR_NO_SUCH_TABLE)
+ if (!error)
{
int frm_delete_error, trigger_drop_error= 0;
/* Delete the table definition file */
@@ -2494,11 +2489,8 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
if (trigger_drop_error ||
(frm_delete_error && frm_delete_error != ENOENT))
error= 1;
- else if (!frm_delete_error || !error || if_exists)
- {
- error= 0;
+ else if (frm_delete_error && if_exists)
thd->clear_error();
- }
}
non_tmp_error= error ? TRUE : non_tmp_error;
}
@@ -2509,6 +2501,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
wrong_tables.append(db);
wrong_tables.append('.');
wrong_tables.append(table->table_name);
+ errors++;
}
else
{
@@ -2522,7 +2515,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
DBUG_EXECUTE_IF("bug43138",
my_printf_error(ER_BAD_TABLE_ERROR,
- ER(ER_BAD_TABLE_ERROR), MYF(0),
+ ER_THD(thd, ER_BAD_TABLE_ERROR), MYF(0),
table->table_name););
}
DEBUG_SYNC(thd, "rm_table_no_locks_before_binlog");
@@ -2532,14 +2525,14 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
err:
if (wrong_tables.length())
{
- if (one_table && was_view)
- my_printf_error(ER_IT_IS_A_VIEW, ER(ER_IT_IS_A_VIEW), MYF(0),
+ DBUG_ASSERT(errors);
+ if (errors == 1 && was_view)
+ my_printf_error(ER_IT_IS_A_VIEW, ER_THD(thd, ER_IT_IS_A_VIEW), MYF(0),
wrong_tables.c_ptr_safe());
- else if (!foreign_key_error)
- my_printf_error(ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), MYF(0),
+ else if (errors > 1 || !thd->is_error())
+ my_printf_error(ER_BAD_TABLE_ERROR, ER_THD(thd, ER_BAD_TABLE_ERROR),
+ MYF(0),
wrong_tables.c_ptr_safe());
- else
- my_message(ER_ROW_IS_REFERENCED, ER(ER_ROW_IS_REFERENCED), MYF(0));
error= 1;
}
@@ -2590,8 +2583,8 @@ err:
/* Chop of the last comma */
built_query.chop();
built_query.append(" /* generated by server */");
- int error_code = (non_tmp_error ?
- (foreign_key_error ? ER_ROW_IS_REFERENCED : ER_BAD_TABLE_ERROR) : 0);
+ int error_code = non_tmp_error ? thd->get_stmt_da()->sql_errno()
+ : 0;
error |= thd->binlog_query(THD::STMT_QUERY_TYPE,
built_query.ptr(),
built_query.length(),
@@ -2825,7 +2818,7 @@ bool check_duplicates_in_interval(const char *set_or_name,
}
push_warning_printf(thd,Sql_condition::WARN_LEVEL_NOTE,
ER_DUPLICATED_VALUE_IN_TYPE,
- ER(ER_DUPLICATED_VALUE_IN_TYPE),
+ ER_THD(thd, ER_DUPLICATED_VALUE_IN_TYPE),
name, err.ptr(), set_or_name);
(*dup_val_count)++;
}
@@ -3068,6 +3061,9 @@ CHARSET_INFO* get_sql_field_charset(Create_field *sql_field,
Modifies the first column definition whose SQL type is TIMESTAMP
by adding the features DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP.
+ If the first TIMESTAMP column appears to be nullable, or to have an
+ explicit default, or to be a virtual column, then no promition is done.
+
@param column_definitions The list of column definitions, in the physical
order in which they appear in the table.
*/
@@ -3083,7 +3079,8 @@ void promote_first_timestamp_column(List<Create_field> *column_definitions)
{
if ((column_definition->flags & NOT_NULL_FLAG) != 0 && // NOT NULL,
column_definition->def == NULL && // no constant default,
- column_definition->unireg_check == Field::NONE) // no function default
+ column_definition->unireg_check == Field::NONE && // no function default
+ column_definition->vcol_info == NULL)
{
DBUG_PRINT("info", ("First TIMESTAMP column '%s' was promoted to "
"DEFAULT CURRENT_TIMESTAMP ON UPDATE "
@@ -3172,7 +3169,7 @@ static void check_duplicate_key(THD *thd,
if (all_columns_are_identical)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_DUP_INDEX, ER(ER_DUP_INDEX),
+ ER_DUP_INDEX, ER_THD(thd, ER_DUP_INDEX),
key_info->name,
thd->lex->query_tables->db,
thd->lex->query_tables->table_name);
@@ -3271,7 +3268,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
pointer in the parsed tree of a prepared statement or a
stored procedure statement.
*/
- sql_field->def= sql_field->def->safe_charset_converter(save_cs);
+ sql_field->def= sql_field->def->safe_charset_converter(thd, save_cs);
if (sql_field->def == NULL)
{
@@ -3530,7 +3527,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
}
if (auto_increment > 1)
{
- my_message(ER_WRONG_AUTO_KEY, ER(ER_WRONG_AUTO_KEY), MYF(0));
+ my_message(ER_WRONG_AUTO_KEY, ER_THD(thd, ER_WRONG_AUTO_KEY), MYF(0));
DBUG_RETURN(TRUE);
}
if (auto_increment &&
@@ -3585,7 +3582,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
my_error(ER_WRONG_FK_DEF, MYF(0),
(fk_key->name.str ? fk_key->name.str :
"foreign key without name"),
- ER(ER_KEY_REF_DO_NOT_MATCH_TABLE_REF));
+ ER_THD(thd, ER_KEY_REF_DO_NOT_MATCH_TABLE_REF));
DBUG_RETURN(TRUE);
}
continue;
@@ -3597,7 +3594,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
my_error(ER_TOO_MANY_KEY_PARTS,MYF(0),tmp);
DBUG_RETURN(TRUE);
}
- if (check_string_char_length(&key->name, "", NAME_CHAR_LEN,
+ if (check_string_char_length(&key->name, 0, NAME_CHAR_LEN,
system_charset_info, 1))
{
my_error(ER_TOO_LONG_IDENT, MYF(0), key->name.str);
@@ -3651,8 +3648,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
DBUG_RETURN(TRUE);
}
- (*key_info_buffer)= key_info= (KEY*) sql_calloc(sizeof(KEY) * (*key_count));
- key_part_info=(KEY_PART_INFO*) sql_calloc(sizeof(KEY_PART_INFO)*key_parts);
+ (*key_info_buffer)= key_info= (KEY*) thd->calloc(sizeof(KEY) * (*key_count));
+ key_part_info=(KEY_PART_INFO*) thd->calloc(sizeof(KEY_PART_INFO)*key_parts);
if (!*key_info_buffer || ! key_part_info)
DBUG_RETURN(TRUE); // Out of memory
@@ -3798,7 +3795,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
column->field_name.str, dup_column->field_name.str))
{
my_printf_error(ER_DUP_FIELDNAME,
- ER(ER_DUP_FIELDNAME),MYF(0),
+ ER_THD(thd, ER_DUP_FIELDNAME),MYF(0),
column->field_name.str);
DBUG_RETURN(TRUE);
}
@@ -3906,7 +3903,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
if (key->type == Key::SPATIAL)
{
my_message(ER_SPATIAL_CANT_HAVE_NULL,
- ER(ER_SPATIAL_CANT_HAVE_NULL), MYF(0));
+ ER_THD(thd, ER_SPATIAL_CANT_HAVE_NULL), MYF(0));
DBUG_RETURN(TRUE);
}
}
@@ -3938,8 +3935,9 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
{
/* not a critical problem */
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_TOO_LONG_KEY, ER(ER_TOO_LONG_KEY),
- key_part_length);
+ ER_TOO_LONG_KEY,
+ ER_THD(thd, ER_TOO_LONG_KEY),
+ key_part_length);
/* Align key length to multibyte char boundary */
key_part_length-= key_part_length % sql_field->charset->mbmaxlen;
}
@@ -3965,7 +3963,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
// and is this a 'unique' key?
(key_info->flags & HA_NOSAME))))
{
- my_message(ER_WRONG_SUB_KEY, ER(ER_WRONG_SUB_KEY), MYF(0));
+ my_message(ER_WRONG_SUB_KEY, ER_THD(thd, ER_WRONG_SUB_KEY), MYF(0));
DBUG_RETURN(TRUE);
}
else if (!(file->ha_table_flags() & HA_NO_PREFIX_CHAR_KEYS))
@@ -3985,8 +3983,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
{
/* not a critical problem */
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_TOO_LONG_KEY, ER(ER_TOO_LONG_KEY),
- key_part_length);
+ ER_TOO_LONG_KEY, ER_THD(thd, ER_TOO_LONG_KEY),
+ key_part_length);
/* Align key length to multibyte char boundary */
key_part_length-= key_part_length % sql_field->charset->mbmaxlen;
}
@@ -4025,7 +4023,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
{
if (primary_key)
{
- my_message(ER_MULTIPLE_PRI_KEY, ER(ER_MULTIPLE_PRI_KEY),
+ my_message(ER_MULTIPLE_PRI_KEY, ER_THD(thd, ER_MULTIPLE_PRI_KEY),
MYF(0));
DBUG_RETURN(TRUE);
}
@@ -4048,7 +4046,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key_info->name);
DBUG_RETURN(TRUE);
}
- if (!(key_info->flags & HA_NULL_PART_KEY))
+ if (key->type == Key::UNIQUE && !(key_info->flags & HA_NULL_PART_KEY))
unique_key=1;
key_info->key_length=(uint16) key_length;
if (key_length > max_key_length && key->type != Key::FULLTEXT)
@@ -4078,12 +4076,13 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
if (!unique_key && !primary_key &&
(file->ha_table_flags() & HA_REQUIRE_PRIMARY_KEY))
{
- my_message(ER_REQUIRES_PRIMARY_KEY, ER(ER_REQUIRES_PRIMARY_KEY), MYF(0));
+ my_message(ER_REQUIRES_PRIMARY_KEY, ER_THD(thd, ER_REQUIRES_PRIMARY_KEY),
+ MYF(0));
DBUG_RETURN(TRUE);
}
if (auto_increment > 0)
{
- my_message(ER_WRONG_AUTO_KEY, ER(ER_WRONG_AUTO_KEY), MYF(0));
+ my_message(ER_WRONG_AUTO_KEY, ER_THD(thd, ER_WRONG_AUTO_KEY), MYF(0));
DBUG_RETURN(TRUE);
}
/* Sort keys in optimized order */
@@ -4097,6 +4096,20 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
{
Field::utype type= (Field::utype) MTYP_TYPENR(sql_field->unireg_check);
+ /*
+ Set NO_DEFAULT_VALUE_FLAG if this field doesn't have a default value and
+ it is NOT NULL, not an AUTO_INCREMENT field, not a TIMESTAMP and not
+ updated trough a NOW() function.
+ */
+ if (!sql_field->def &&
+ !sql_field->has_default_function() &&
+ (sql_field->flags & NOT_NULL_FLAG) &&
+ !is_timestamp_type(sql_field->sql_type))
+ {
+ sql_field->flags|= NO_DEFAULT_VALUE_FLAG;
+ sql_field->pack_flag|= FIELDFLAG_NO_DEFAULT;
+ }
+
if (thd->variables.sql_mode & MODE_NO_ZERO_DATE &&
!sql_field->def &&
is_timestamp_type(sql_field->sql_type) &&
@@ -4130,7 +4143,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
if (create_info->transactional)
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
- ER(ER_ILLEGAL_HA_CREATE_OPTION),
+ ER_THD(thd, ER_ILLEGAL_HA_CREATE_OPTION),
file->engine_name()->str,
"TRANSACTIONAL=1");
@@ -4174,7 +4187,8 @@ bool validate_comment_length(THD *thd, LEX_STRING *comment, size_t max_len,
DBUG_RETURN(true);
}
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, err_code,
- ER(err_code), name, static_cast<ulong>(max_len));
+ ER_THD(thd, err_code), name,
+ static_cast<ulong>(max_len));
comment->length= tmp_len;
}
DBUG_RETURN(false);
@@ -4245,9 +4259,11 @@ static bool prepare_blob_field(THD *thd, Create_field *sql_field)
}
sql_field->sql_type= MYSQL_TYPE_BLOB;
sql_field->flags|= BLOB_FLAG;
- my_snprintf(warn_buff, sizeof(warn_buff), ER(ER_AUTO_CONVERT), sql_field->field_name,
- (sql_field->charset == &my_charset_bin) ? "VARBINARY" : "VARCHAR",
- (sql_field->charset == &my_charset_bin) ? "BLOB" : "TEXT");
+ my_snprintf(warn_buff, sizeof(warn_buff), ER_THD(thd, ER_AUTO_CONVERT),
+ sql_field->field_name,
+ (sql_field->charset == &my_charset_bin) ? "VARBINARY" :
+ "VARCHAR",
+ (sql_field->charset == &my_charset_bin) ? "BLOB" : "TEXT");
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_AUTO_CONVERT,
warn_buff);
}
@@ -4635,11 +4651,13 @@ int create_table_impl(THD *thd,
{
if (create_info->data_file_name)
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
+ WARN_OPTION_IGNORED,
+ ER_THD(thd, WARN_OPTION_IGNORED),
"DATA DIRECTORY");
if (create_info->index_file_name)
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
+ WARN_OPTION_IGNORED,
+ ER_THD(thd, WARN_OPTION_IGNORED),
"INDEX DIRECTORY");
create_info->data_file_name= create_info->index_file_name= 0;
}
@@ -4662,12 +4680,12 @@ int create_table_impl(THD *thd,
bool table_creation_was_logged= tmp_table->s->table_creation_was_logged;
if (options.or_replace())
{
- bool is_trans;
+ bool tmp;
/*
We are using CREATE OR REPLACE on an existing temporary table
Remove the old table so that we can re-create it.
*/
- if (drop_temporary_table(thd, tmp_table, &is_trans))
+ if (drop_temporary_table(thd, tmp_table, &tmp))
goto err;
}
else if (options.if_not_exists())
@@ -4876,7 +4894,8 @@ err:
warn:
error= -1;
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
+ ER_TABLE_EXISTS_ERROR,
+ ER_THD(thd, ER_TABLE_EXISTS_ERROR),
alias);
goto err;
}
@@ -5119,6 +5138,7 @@ mysql_rename_table(handlerton *base, const char *old_db,
ulonglong save_bits= thd->variables.option_bits;
int length;
DBUG_ENTER("mysql_rename_table");
+ DBUG_ASSERT(base);
DBUG_PRINT("enter", ("old: '%s'.'%s' new: '%s'.'%s'",
old_db, old_name, new_db, new_name));
@@ -5126,8 +5146,7 @@ mysql_rename_table(handlerton *base, const char *old_db,
if (flags & NO_FK_CHECKS)
thd->variables.option_bits|= OPTION_NO_FOREIGN_KEY_CHECKS;
- file= (base == NULL ? 0 :
- get_new_handler((TABLE_SHARE*) 0, thd->mem_root, base));
+ file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root, base);
build_table_filename(from, sizeof(from) - 1, old_db, old_name, "",
flags & FN_FROM_IS_TMP);
@@ -5303,7 +5322,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
#ifdef WITH_PARTITION_STORAGE_ENGINE
/* Partition info is not handled by mysql_prepare_alter_table() call. */
if (src_table->table->part_info)
- thd->work_part_info= src_table->table->part_info->get_clone();
+ thd->work_part_info= src_table->table->part_info->get_clone(thd);
#endif
/*
@@ -5454,8 +5473,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
if (!table->view)
{
int result __attribute__((unused))=
- show_create_table(thd, table, &query,
- create_info, WITHOUT_DB_NAME);
+ show_create_table(thd, table, &query, create_info, WITH_DB_NAME);
DBUG_ASSERT(result == 0); // show_create_table() always return 0
do_logging= FALSE;
@@ -5679,8 +5697,8 @@ handle_if_exists_options(THD *thd, TABLE *table, Alter_info *alter_info)
continue;
drop_create_field:
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_DUP_FIELDNAME, ER(ER_DUP_FIELDNAME),
- sql_field->field_name);
+ ER_DUP_FIELDNAME, ER_THD(thd, ER_DUP_FIELDNAME),
+ sql_field->field_name);
it.remove();
if (alter_info->create_list.is_empty())
{
@@ -5716,8 +5734,9 @@ drop_create_field:
if (*f_ptr == NULL)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR),
- sql_field->change, table->s->table_name.str);
+ ER_BAD_FIELD_ERROR,
+ ER_THD(thd, ER_BAD_FIELD_ERROR),
+ sql_field->change, table->s->table_name.str);
it.remove();
if (alter_info->create_list.is_empty())
{
@@ -5811,8 +5830,9 @@ drop_create_field:
if (remove_drop)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_CANT_DROP_FIELD_OR_KEY, ER(ER_CANT_DROP_FIELD_OR_KEY),
- drop->name);
+ ER_CANT_DROP_FIELD_OR_KEY,
+ ER_THD(thd, ER_CANT_DROP_FIELD_OR_KEY),
+ drop->name);
drop_it.remove();
if (alter_info->drop_list.is_empty())
alter_info->flags&= ~(Alter_info::ALTER_DROP_COLUMN |
@@ -5837,12 +5857,17 @@ drop_create_field:
/* let us check the name of the first key part. */
if ((keyname= key->name.str) == NULL)
{
- List_iterator<Key_part_spec> part_it(key->columns);
- Key_part_spec *kp;
- if ((kp= part_it++))
- keyname= kp->field_name.str;
- if (keyname == NULL)
- continue;
+ if (key->type == Key::PRIMARY)
+ keyname= primary_key_name;
+ else
+ {
+ List_iterator<Key_part_spec> part_it(key->columns);
+ Key_part_spec *kp;
+ if ((kp= part_it++))
+ keyname= kp->field_name.str;
+ if (keyname == NULL)
+ continue;
+ }
}
if (key->type != Key::FOREIGN_KEY)
{
@@ -5895,7 +5920,8 @@ remove_key:
if (key->if_not_exists())
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_DUP_KEYNAME, ER(ER_DUP_KEYNAME), keyname);
+ ER_DUP_KEYNAME, ER_THD(thd, ER_DUP_KEYNAME),
+ keyname);
key_it.remove();
if (key->type == Key::FOREIGN_KEY)
{
@@ -5915,7 +5941,7 @@ remove_key:
{
// Adding the index into the drop list for replacing
alter_info->flags |= Alter_info::ALTER_DROP_INDEX;
- alter_info->drop_list.push_back(ad);
+ alter_info->drop_list.push_back(ad, thd->mem_root);
}
}
}
@@ -5939,8 +5965,9 @@ remove_key:
if (!tab_part_info->has_unique_name(pe))
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_SAME_NAME_PARTITION, ER(ER_SAME_NAME_PARTITION),
- pe->partition_name);
+ ER_SAME_NAME_PARTITION,
+ ER_THD(thd, ER_SAME_NAME_PARTITION),
+ pe->partition_name);
alter_info->flags&= ~Alter_info::ALTER_ADD_PARTITION;
thd->lex->part_info= NULL;
break;
@@ -5968,8 +5995,9 @@ remove_key:
if (!part_elem)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_DROP_PARTITION_NON_EXISTENT,
- ER(ER_DROP_PARTITION_NON_EXISTENT), "DROP");
+ ER_DROP_PARTITION_NON_EXISTENT,
+ ER_THD(thd, ER_DROP_PARTITION_NON_EXISTENT),
+ "DROP");
names_it.remove();
}
}
@@ -6769,12 +6797,14 @@ bool alter_table_manage_keys(TABLE *table, int indexes_were_disabled,
if (error == HA_ERR_WRONG_COMMAND)
{
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA),
+ THD *thd= table->in_use;
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
+ ER_ILLEGAL_HA, ER_THD(thd, ER_ILLEGAL_HA),
table->file->table_type(),
table->s->db.str, table->s->table_name.str);
error= 0;
- } else if (error)
+ }
+ else if (error)
table->file->print_error(error, MYF(0));
DBUG_RETURN(error);
@@ -7360,7 +7390,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
Note that columns with AFTER clauses are added to the end
of the list for now. Their positions will be corrected later.
*/
- new_create_list.push_back(def);
+ new_create_list.push_back(def, thd->mem_root);
if (field->stored_in_db != def->stored_in_db)
{
my_error(ER_UNSUPPORTED_ACTION_ON_VIRTUAL_COLUMN, MYF(0));
@@ -7384,8 +7414,8 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
This field was not dropped and not changed, add it to the list
for the new table.
*/
- def= new Create_field(field, field);
- new_create_list.push_back(def);
+ def= new (thd->mem_root) Create_field(thd, field, field);
+ new_create_list.push_back(def, thd->mem_root);
alter_it.rewind(); // Change default if ALTER
Alter_column *alter;
while ((alter=alter_it++))
@@ -7436,7 +7466,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
alter_ctx->error_if_not_empty= TRUE;
}
if (!def->after)
- new_create_list.push_back(def);
+ new_create_list.push_back(def, thd->mem_root);
else
{
Create_field *find;
@@ -7464,7 +7494,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
}
}
if (def->after == first_keyword)
- new_create_list.push_front(def);
+ new_create_list.push_front(def, thd->mem_root);
else
{
find_it.rewind();
@@ -7490,7 +7520,8 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
}
if (!new_create_list.elements)
{
- my_message(ER_CANT_REMOVE_ALL_FIELDS, ER(ER_CANT_REMOVE_ALL_FIELDS),
+ my_message(ER_CANT_REMOVE_ALL_FIELDS,
+ ER_THD(thd, ER_CANT_REMOVE_ALL_FIELDS),
MYF(0));
goto err;
}
@@ -7602,7 +7633,8 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
key_part_length /= key_part->field->charset()->mbmaxlen;
key_parts.push_back(new Key_part_spec(cfield->field_name,
strlen(cfield->field_name),
- key_part_length));
+ key_part_length),
+ thd->mem_root);
}
if (table->s->tmp_table == NO_TMP_TABLE)
{
@@ -7652,7 +7684,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
&key_create_info,
MY_TEST(key_info->flags & HA_GENERATED_KEY),
key_parts, key_info->option_list, DDL_options());
- new_key_list.push_back(key);
+ new_key_list.push_back(key, thd->mem_root);
}
}
{
@@ -7662,7 +7694,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
if (key->type == Key::FOREIGN_KEY &&
((Foreign_key *)key)->validate(new_create_list))
goto err;
- new_key_list.push_back(key);
+ new_key_list.push_back(key, thd->mem_root);
if (key->name.str &&
!my_strcasecmp(system_charset_info, key->name.str, primary_key_name))
{
@@ -7968,7 +8000,7 @@ static bool fk_prepare_copy_alter_table(THD *thd, TABLE *table,
case FK_COLUMN_RENAMED:
my_error(ER_ALTER_OPERATION_NOT_SUPPORTED_REASON, MYF(0),
"ALGORITHM=COPY",
- ER(ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_RENAME),
+ ER_THD(thd, ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_RENAME),
"ALGORITHM=INPLACE");
DBUG_RETURN(true);
case FK_COLUMN_DROPPED:
@@ -8034,7 +8066,7 @@ static bool fk_prepare_copy_alter_table(THD *thd, TABLE *table,
case FK_COLUMN_RENAMED:
my_error(ER_ALTER_OPERATION_NOT_SUPPORTED_REASON, MYF(0),
"ALGORITHM=COPY",
- ER(ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_RENAME),
+ ER_THD(thd, ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_RENAME),
"ALGORITHM=INPLACE");
DBUG_RETURN(true);
case FK_COLUMN_DROPPED:
@@ -8263,6 +8295,17 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
DEBUG_SYNC(thd, "alter_opened_table");
+#ifdef WITH_WSREP
+ DBUG_EXECUTE_IF("sync.alter_opened_table",
+ {
+ const char act[]=
+ "now "
+ "wait_for signal.alter_opened_table";
+ DBUG_ASSERT(!debug_sync_set_action(thd,
+ STRING_WITH_LEN(act)));
+ };);
+#endif // WITH_WSREP
+
if (error)
DBUG_RETURN(true);
@@ -8443,7 +8486,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (alter_info->flags == 0)
{
my_snprintf(alter_ctx.tmp_name, sizeof(alter_ctx.tmp_name),
- ER(ER_INSERT_INFO), 0L, 0L,
+ ER_THD(thd, ER_INSERT_INFO), 0L, 0L,
thd->get_stmt_da()->current_statement_warn_count());
my_ok(thd, 0L, 0L, alter_ctx.tmp_name);
DBUG_RETURN(false);
@@ -8507,7 +8550,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
{
my_error(ER_ALTER_OPERATION_NOT_SUPPORTED_REASON, MYF(0),
"LOCK=NONE/SHARED/EXCLUSIVE",
- ER(ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_PARTITION),
+ ER_THD(thd, ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_PARTITION),
"LOCK=DEFAULT");
DBUG_RETURN(true);
}
@@ -8516,7 +8559,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
{
my_error(ER_ALTER_OPERATION_NOT_SUPPORTED_REASON, MYF(0),
"ALGORITHM=COPY/INPLACE",
- ER(ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_PARTITION),
+ ER_THD(thd, ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_PARTITION),
"ALGORITHM=DEFAULT");
DBUG_RETURN(true);
}
@@ -8845,7 +8888,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
{
my_error(ER_ALTER_OPERATION_NOT_SUPPORTED_REASON, MYF(0),
"LOCK=NONE",
- ER(ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COPY),
+ ER_THD(thd, ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COPY),
"LOCK=SHARED");
goto err_new_table_cleanup;
}
@@ -9124,7 +9167,7 @@ end_inplace:
end_temporary:
my_snprintf(alter_ctx.tmp_name, sizeof(alter_ctx.tmp_name),
- ER(ER_INSERT_INFO),
+ ER_THD(thd, ER_INSERT_INFO),
(ulong) (copied + deleted), (ulong) deleted,
(ulong) thd->get_stmt_da()->current_statement_warn_count());
my_ok(thd, copied + deleted, 0L, alter_ctx.tmp_name);
@@ -9350,7 +9393,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
tables.db= from->s->db.str;
THD_STAGE_INFO(thd, stage_sorting);
- Filesort_tracker dummy_tracker;
+ Filesort_tracker dummy_tracker(false);
if (thd->lex->select_lex.setup_ref_array(thd, order_num) ||
setup_order(thd, thd->lex->select_lex.ref_pointer_array,
&tables, fields, all_fields, order) ||
@@ -9467,11 +9510,11 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
uint key_nr= to->file->get_dup_key(error);
if ((int) key_nr >= 0)
{
- const char *err_msg= ER(ER_DUP_ENTRY_WITH_KEY_NAME);
+ const char *err_msg= ER_THD(thd, ER_DUP_ENTRY_WITH_KEY_NAME);
if (key_nr == 0 &&
(to->key_info[0].key_part[0].field->flags &
AUTO_INCREMENT_FLAG))
- err_msg= ER(ER_DUP_ENTRY_AUTOINCREMENT_CASE);
+ err_msg= ER_THD(thd, ER_DUP_ENTRY_AUTOINCREMENT_CASE);
print_keydup_error(to, key_nr == MAX_KEY ? NULL :
&to->key_info[key_nr],
err_msg, MYF(0));
@@ -9584,11 +9627,14 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables,
*/
DBUG_ASSERT(! thd->in_sub_stmt);
- field_list.push_back(item = new Item_empty_string("Table", NAME_LEN*2));
+ field_list.push_back(item= new (thd->mem_root)
+ Item_empty_string(thd, "Table", NAME_LEN*2),
+ thd->mem_root);
item->maybe_null= 1;
- field_list.push_back(item= new Item_int("Checksum",
- (longlong) 1,
- MY_INT64_NUM_DECIMAL_DIGITS));
+ field_list.push_back(item= new (thd->mem_root)
+ Item_int(thd, "Checksum", (longlong) 1,
+ MY_INT64_NUM_DECIMAL_DIGITS),
+ thd->mem_root);
item->maybe_null= 1;
if (protocol->send_result_set_metadata(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
@@ -9772,13 +9818,21 @@ static bool check_engine(THD *thd, const char *db_name,
DBUG_ENTER("check_engine");
handlerton **new_engine= &create_info->db_type;
handlerton *req_engine= *new_engine;
- handlerton *enf_engine= thd->variables.enforced_table_plugin ? plugin_hton(thd->variables.enforced_table_plugin) : NULL;
+ handlerton *enf_engine= NULL;
bool no_substitution= thd->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION;
*new_engine= ha_checktype(thd, req_engine, no_substitution);
DBUG_ASSERT(*new_engine);
if (!*new_engine)
DBUG_RETURN(true);
+ /* Enforced storage engine should not be used in
+ ALTER TABLE that does not use explicit ENGINE = x to
+ avoid unwanted unrelated changes.*/
+ if (!(thd->lex->sql_command == SQLCOM_ALTER_TABLE &&
+ !(create_info->used_fields & HA_CREATE_USED_ENGINE)))
+ enf_engine= thd->variables.enforced_table_plugin ?
+ plugin_hton(thd->variables.enforced_table_plugin) : NULL;
+
if (enf_engine && enf_engine != *new_engine)
{
if (no_substitution)
@@ -9794,7 +9848,7 @@ static bool check_engine(THD *thd, const char *db_name,
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_WARN_USING_OTHER_HANDLER,
- ER(ER_WARN_USING_OTHER_HANDLER),
+ ER_THD(thd, ER_WARN_USING_OTHER_HANDLER),
ha_resolve_storage_engine_name(*new_engine),
table_name);
}
diff --git a/sql/sql_tablespace.cc b/sql/sql_tablespace.cc
index 2991b16350c..8b9e14e5a18 100644
--- a/sql/sql_tablespace.cc
+++ b/sql/sql_tablespace.cc
@@ -38,7 +38,7 @@ int mysql_alter_tablespace(THD *thd, st_alter_tablespace *ts_info)
if (ts_info->storage_engine != 0)
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_USING_OTHER_HANDLER,
- ER(ER_WARN_USING_OTHER_HANDLER),
+ ER_THD(thd, ER_WARN_USING_OTHER_HANDLER),
hton_name(hton)->str,
ts_info->tablespace_name ? ts_info->tablespace_name
: ts_info->logfile_group_name);
@@ -68,7 +68,7 @@ int mysql_alter_tablespace(THD *thd, st_alter_tablespace *ts_info)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
- ER(ER_ILLEGAL_HA_CREATE_OPTION),
+ ER_THD(thd, ER_ILLEGAL_HA_CREATE_OPTION),
hton_name(hton)->str,
"TABLESPACE or LOGFILE GROUP");
}
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index ec65bd037b9..8e7525893eb 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -224,7 +224,7 @@ TEST_join(JOIN *join)
#define FT_KEYPART (MAX_FIELDS+10)
-void print_keyuse(KEYUSE *keyuse)
+static void print_keyuse(KEYUSE *keyuse)
{
char buff[256];
char buf2[64];
@@ -242,14 +242,11 @@ void print_keyuse(KEYUSE *keyuse)
else
fieldname= key_info->key_part[keyuse->keypart].field->field_name;
ll2str(keyuse->used_tables, buf2, 16, 0);
- DBUG_LOCK_FILE;
fprintf(DBUG_FILE, "KEYUSE: %s.%s=%s optimize: %u used_tables: %s "
"ref_table_rows: %lu keypart_map: %0lx\n",
keyuse->table->alias.c_ptr(), fieldname, str.ptr(),
(uint) keyuse->optimize, buf2, (ulong) keyuse->ref_table_rows,
(ulong) keyuse->keypart_map);
- DBUG_UNLOCK_FILE;
- //key_part_map keypart_map; --?? there can be several?
}
@@ -258,9 +255,9 @@ void print_keyuse_array(DYNAMIC_ARRAY *keyuse_array)
{
DBUG_LOCK_FILE;
fprintf(DBUG_FILE, "KEYUSE array (%d elements)\n", keyuse_array->elements);
- DBUG_UNLOCK_FILE;
for(uint i=0; i < keyuse_array->elements; i++)
print_keyuse((KEYUSE*)dynamic_array_ptr(keyuse_array, i));
+ DBUG_UNLOCK_FILE;
}
diff --git a/sql/sql_time.cc b/sql/sql_time.cc
index 267b183562b..ccba3d16575 100644
--- a/sql/sql_time.cc
+++ b/sql/sql_time.cc
@@ -877,18 +877,18 @@ void make_truncated_value_warning(THD *thd,
}
if (field_name)
cs->cset->snprintf(cs, warn_buff, sizeof(warn_buff),
- ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
+ ER_THD(thd, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
type_str, sval->ptr(), field_name,
(ulong) thd->get_stmt_da()->current_row_for_warning());
else
{
if (time_type > MYSQL_TIMESTAMP_ERROR)
cs->cset->snprintf(cs, warn_buff, sizeof(warn_buff),
- ER(ER_TRUNCATED_WRONG_VALUE),
+ ER_THD(thd, ER_TRUNCATED_WRONG_VALUE),
type_str, sval->ptr());
else
cs->cset->snprintf(cs, warn_buff, sizeof(warn_buff),
- ER(ER_WRONG_VALUE), type_str, sval->ptr());
+ ER_THD(thd, ER_WRONG_VALUE), type_str, sval->ptr());
}
push_warning(thd, level,
ER_TRUNCATED_WRONG_VALUE, warn_buff);
@@ -1011,11 +1011,14 @@ bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type,
return 0; // Ok
invalid_date:
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_DATETIME_FUNCTION_OVERFLOW,
- ER(ER_DATETIME_FUNCTION_OVERFLOW),
- ltime->time_type == MYSQL_TIMESTAMP_TIME ?
- "time" : "datetime");
+ {
+ THD *thd= current_thd;
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_DATETIME_FUNCTION_OVERFLOW,
+ ER_THD(thd, ER_DATETIME_FUNCTION_OVERFLOW),
+ ltime->time_type == MYSQL_TIMESTAMP_TIME ?
+ "time" : "datetime");
+ }
null_date:
return 1;
}
@@ -1097,6 +1100,35 @@ calc_time_diff(const MYSQL_TIME *l_time1, const MYSQL_TIME *l_time2,
}
+bool calc_time_diff(const MYSQL_TIME *l_time1, const MYSQL_TIME *l_time2,
+ int l_sign, MYSQL_TIME *l_time3, ulonglong fuzzydate)
+{
+ longlong seconds;
+ long microseconds;
+ bzero((char *) l_time3, sizeof(*l_time3));
+ l_time3->neg= calc_time_diff(l_time1, l_time2, l_sign,
+ &seconds, &microseconds);
+ /*
+ For MYSQL_TIMESTAMP_TIME only:
+ If first argument was negative and diff between arguments
+ is non-zero we need to swap sign to get proper result.
+ */
+ if (l_time1->neg && (seconds || microseconds))
+ l_time3->neg= 1 - l_time3->neg; // Swap sign of result
+
+ /*
+ seconds is longlong, when casted to long it may become a small number
+ even if the original seconds value was too large and invalid.
+ as a workaround we limit seconds by a large invalid long number
+ ("invalid" means > TIME_MAX_SECOND)
+ */
+ set_if_smaller(seconds, INT_MAX32);
+ calc_time_from_sec(l_time3, (long) seconds, microseconds);
+ return ((fuzzydate & TIME_NO_ZERO_DATE) && (seconds == 0) &&
+ (microseconds == 0));
+}
+
+
/*
Compares 2 MYSQL_TIME structures
@@ -1338,3 +1370,23 @@ time_to_datetime_with_warn(THD *thd,
}
return false;
}
+
+
+bool datetime_to_time_with_warn(THD *thd, const MYSQL_TIME *dt,
+ MYSQL_TIME *tm, uint dec)
+{
+ if (thd->variables.old_behavior & OLD_MODE_ZERO_DATE_TIME_CAST)
+ {
+ *tm= *dt;
+ datetime_to_time(tm);
+ return false;
+ }
+ else /* new mode */
+ {
+ MYSQL_TIME current_date;
+ set_current_date(thd, &current_date);
+ calc_time_diff(dt, &current_date, 1, tm, 0);
+ }
+ int warnings= 0;
+ return check_time_range(tm, dec, &warnings);
+}
diff --git a/sql/sql_time.h b/sql/sql_time.h
index dc8e4668e1e..5a985710ee1 100644
--- a/sql/sql_time.h
+++ b/sql/sql_time.h
@@ -55,6 +55,10 @@ bool time_to_datetime(THD *thd, const MYSQL_TIME *tm, MYSQL_TIME *dt);
bool time_to_datetime_with_warn(THD *thd,
const MYSQL_TIME *tm, MYSQL_TIME *dt,
ulonglong fuzzydate);
+/*
+ Simply truncate the YYYY-MM-DD part to 0000-00-00
+ and change time_type to MYSQL_TIMESTAMP_TIME
+*/
inline void datetime_to_time(MYSQL_TIME *ltime)
{
DBUG_ASSERT(ltime->time_type == MYSQL_TIMESTAMP_DATE ||
@@ -63,6 +67,39 @@ inline void datetime_to_time(MYSQL_TIME *ltime)
ltime->year= ltime->month= ltime->day= 0;
ltime->time_type= MYSQL_TIMESTAMP_TIME;
}
+
+
+/**
+ Convert DATE/DATETIME to TIME(dec)
+ using CURRENT_DATE in a non-old mode,
+ or using simple truncation in old mode (OLD_MODE_ZERO_DATE_TIME_CAST).
+
+ @param thd - the thread to get the variables.old_behaviour value from
+ @param dt - the DATE of DATETIME value to convert
+ @param[out] tm - store result here
+ @param dec - the desired scale. The fractional part of the result
+ is checked according to this parameter before returning
+ the conversion result. "dec" is important in the corner
+ cases near the max/min limits.
+ If the result is '838:59:59.999999' and the desired scale
+ is less than 6, an error is returned.
+ Note, dec is not important in the
+ OLD_MODE_ZERO_DATE_TIME_CAST old mode.
+
+ - in case of OLD_MODE_ZERO_DATE_TIME_CAST
+ the TIME part is simply truncated and "false" is returned.
+ - otherwise, the result is calculated effectively similar to:
+ TIMEDIFF(dt, CAST(CURRENT_DATE AS DATETIME))
+ If the difference fits into the supported TIME range, "false" is returned,
+ otherwise a warning is issued and "true" is returned.
+
+ @return false - on success
+ @return true - on error
+*/
+bool datetime_to_time_with_warn(THD *, const MYSQL_TIME *dt,
+ MYSQL_TIME *tm, uint dec);
+
+
inline void datetime_to_date(MYSQL_TIME *ltime)
{
DBUG_ASSERT(ltime->time_type == MYSQL_TIMESTAMP_DATE ||
@@ -107,6 +144,30 @@ bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type,
INTERVAL interval);
bool calc_time_diff(const MYSQL_TIME *l_time1, const MYSQL_TIME *l_time2,
int l_sign, longlong *seconds_out, long *microseconds_out);
+/**
+ Calculate time difference between two MYSQL_TIME values and
+ store the result as an out MYSQL_TIME value in MYSQL_TIMESTAMP_TIME format.
+
+ The result can be outside of the supported TIME range.
+ For example, calc_time_diff('2002-01-01 00:00:00', '2001-01-01 00:00:00')
+ returns '8760:00:00'. So the caller might want to do check_time_range() or
+ adjust_time_range_with_warn() on the result of a calc_time_diff() call.
+
+ @param l_time1 - the minuend (TIME/DATE/DATETIME value)
+ @param l_time2 - the subtrahend TIME/DATE/DATETIME value
+ @param l_sign - +1 if absolute values are to be subtracted,
+ or -1 if absolute values are to be added.
+ @param[out] l_time3 - the result
+ @param fuzzydate - flags
+
+ @return true - if TIME_NO_ZERO_DATE was passed in flags and
+ the result appeared to be '00:00:00.000000'.
+ This is important when calc_time_diff() is called
+ when calculating DATE_ADD(TIMEDIFF(...),...)
+ @return false - otherwise
+*/
+bool calc_time_diff(const MYSQL_TIME *l_time1, const MYSQL_TIME *l_time2,
+ int lsign, MYSQL_TIME *l_time3, ulonglong fuzzydate);
int my_time_compare(const MYSQL_TIME *a, const MYSQL_TIME *b);
void localtime_to_TIME(MYSQL_TIME *to, struct tm *from);
void calc_time_from_sec(MYSQL_TIME *to, long seconds, long microseconds);
@@ -143,13 +204,24 @@ extern DATE_TIME_FORMAT global_time_format;
extern KNOWN_DATE_TIME_FORMAT known_date_time_formats[];
extern LEX_STRING interval_type_to_name[];
-
static inline bool
-non_zero_date(const MYSQL_TIME *ltime)
+non_zero_hhmmssuu(const MYSQL_TIME *ltime)
+{
+ return ltime->hour || ltime->minute || ltime->second || ltime->second_part;
+}
+static inline bool
+non_zero_YYMMDD(const MYSQL_TIME *ltime)
{
return ltime->year || ltime->month || ltime->day;
}
static inline bool
+non_zero_date(const MYSQL_TIME *ltime)
+{
+ return non_zero_YYMMDD(ltime) ||
+ (ltime->time_type == MYSQL_TIMESTAMP_DATETIME &&
+ non_zero_hhmmssuu(ltime));
+}
+static inline bool
check_date(const MYSQL_TIME *ltime, ulonglong flags, int *was_cut)
{
return check_date(ltime, non_zero_date(ltime), flags, was_cut);
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index 54a68da28c9..58fd7aeb7dc 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -159,7 +159,7 @@ Trigger_creation_ctx::create(THD *thd,
push_warning_printf(thd,
Sql_condition::WARN_LEVEL_WARN,
ER_TRG_INVALID_CREATION_CTX,
- ER(ER_TRG_INVALID_CREATION_CTX),
+ ER_THD(thd, ER_TRG_INVALID_CREATION_CTX),
(const char *) db_name,
(const char *) table_name);
}
@@ -340,11 +340,11 @@ public:
m_trigger_name= &thd->lex->spname->m_name;
if (m_trigger_name)
my_snprintf(m_message, sizeof(m_message),
- ER(ER_ERROR_IN_TRIGGER_BODY),
+ ER_THD(thd, ER_ERROR_IN_TRIGGER_BODY),
m_trigger_name->str, message);
else
my_snprintf(m_message, sizeof(m_message),
- ER(ER_ERROR_IN_UNKNOWN_TRIGGER_BODY), message);
+ ER_THD(thd, ER_ERROR_IN_UNKNOWN_TRIGGER_BODY), message);
return true;
}
return false;
@@ -801,7 +801,8 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
else if (lex->create_info.if_not_exists())
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_TRG_ALREADY_EXISTS, ER(ER_TRG_ALREADY_EXISTS),
+ ER_TRG_ALREADY_EXISTS,
+ ER_THD(thd, ER_TRG_ALREADY_EXISTS),
trigname_buff);
LEX_STRING trg_definer_tmp;
build_trig_stmt_query(thd, tables, stmt_query,
@@ -1042,7 +1043,8 @@ bool Table_triggers_list::drop_trigger(THD *thd, TABLE_LIST *tables,
}
}
- my_message(ER_TRG_DOES_NOT_EXIST, ER(ER_TRG_DOES_NOT_EXIST), MYF(0));
+ my_message(ER_TRG_DOES_NOT_EXIST, ER_THD(thd, ER_TRG_DOES_NOT_EXIST),
+ MYF(0));
return 1;
}
@@ -1086,8 +1088,8 @@ bool Table_triggers_list::prepare_record1_accessors(TABLE *table)
QQ: it is supposed that it is ok to use this function for field
cloning...
*/
- if (!(*old_fld= (*fld)->new_field(&table->mem_root, table,
- table == (*fld)->table)))
+ if (!(*old_fld= (*fld)->make_new_field(&table->mem_root, table,
+ table == (*fld)->table)))
return 1;
(*old_fld)->move_field_offset((my_ptrdiff_t)(table->record[1] -
table->record[0]));
@@ -1275,7 +1277,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_TRG_NO_CREATION_CTX,
- ER(ER_TRG_NO_CREATION_CTX),
+ ER_THD(thd, ER_TRG_NO_CREATION_CTX),
(const char*) db,
(const char*) table_name);
@@ -1458,7 +1460,8 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
*/
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_TRG_NO_DEFINER, ER(ER_TRG_NO_DEFINER),
+ ER_TRG_NO_DEFINER,
+ ER_THD(thd, ER_TRG_NO_DEFINER),
(const char*) db,
(const char*) sp->m_name.str);
@@ -1732,7 +1735,7 @@ bool add_table_for_trigger(THD *thd,
push_warning_printf(thd,
Sql_condition::WARN_LEVEL_NOTE,
ER_TRG_DOES_NOT_EXIST,
- ER(ER_TRG_DOES_NOT_EXIST));
+ ER_THD(thd, ER_TRG_DOES_NOT_EXIST));
*table= NULL;
@@ -2327,13 +2330,14 @@ process_unknown_string(const char *&unknown_key, uchar* base,
unknown_key[INVALID_SQL_MODES_LENGTH] == '=' &&
!memcmp(unknown_key, STRING_WITH_LEN("sql_modes")))
{
+ THD *thd= current_thd;
const char *ptr= unknown_key + INVALID_SQL_MODES_LENGTH + 1;
DBUG_PRINT("info", ("sql_modes affected by BUG#14090 detected"));
- push_warning_printf(current_thd,
+ push_warning_printf(thd,
Sql_condition::WARN_LEVEL_NOTE,
ER_OLD_FILE_FORMAT,
- ER(ER_OLD_FILE_FORMAT),
+ ER_THD(thd, ER_OLD_FILE_FORMAT),
(char *)path, "TRIGGER");
if (get_file_options_ulllist(ptr, end, unknown_key, base,
&sql_modes_parameters, mem_root))
@@ -2368,13 +2372,14 @@ process_unknown_string(const char *&unknown_key, uchar* base,
unknown_key[INVALID_TRIGGER_TABLE_LENGTH] == '=' &&
!memcmp(unknown_key, STRING_WITH_LEN("trigger_table")))
{
+ THD *thd= current_thd;
const char *ptr= unknown_key + INVALID_TRIGGER_TABLE_LENGTH + 1;
DBUG_PRINT("info", ("trigger_table affected by BUG#15921 detected"));
- push_warning_printf(current_thd,
+ push_warning_printf(thd,
Sql_condition::WARN_LEVEL_NOTE,
ER_OLD_FILE_FORMAT,
- ER(ER_OLD_FILE_FORMAT),
+ ER_THD(thd, ER_OLD_FILE_FORMAT),
(char *)path, "TRIGGER");
if (!(ptr= parse_escaped_string(ptr, end, mem_root, trigger_table_value)))
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index d266e8f6bc7..d962df6257d 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -90,10 +90,11 @@ static char *init_syms(udf_func *tmp, char *nm)
*/
if (!tmp->func_init && !tmp->func_deinit && tmp->type != UDFTYPE_AGGREGATE)
{
+ THD *thd= current_thd;
if (!opt_allow_suspicious_udfs)
return nm;
- if (current_thd->variables.log_warnings)
- sql_print_warning(ER(ER_CANT_FIND_DL_ENTRY), nm);
+ if (thd->variables.log_warnings)
+ sql_print_warning(ER_THD(thd, ER_CANT_FIND_DL_ENTRY), nm);
}
return 0;
}
@@ -207,7 +208,7 @@ void udf_init()
On windows we must check both FN_LIBCHAR and '/'.
*/
if (check_valid_path(dl_name, strlen(dl_name)) ||
- check_string_char_length(&name, "", NAME_CHAR_LEN,
+ check_string_char_length(&name, 0, NAME_CHAR_LEN,
system_charset_info, 1))
{
sql_print_error("Invalid row in mysql.func table for function '%.64s'",
@@ -232,7 +233,8 @@ void udf_init()
if (!(dl= dlopen(dlpath, RTLD_NOW)))
{
/* Print warning to log */
- sql_print_error(ER(ER_CANT_OPEN_LIBRARY), tmp->dl, errno, dlerror());
+ sql_print_error(ER_THD(new_thd, ER_CANT_OPEN_LIBRARY),
+ tmp->dl, errno, dlerror());
/* Keep the udf in the hash so that we can remove it later */
continue;
}
@@ -243,7 +245,7 @@ void udf_init()
char buf[SAFE_NAME_LEN+16], *missing;
if ((missing= init_syms(tmp, buf)))
{
- sql_print_error(ER(ER_CANT_FIND_DL_ENTRY), missing);
+ sql_print_error(ER_THD(new_thd, ER_CANT_FIND_DL_ENTRY), missing);
del_udf(tmp);
if (new_dl)
dlclose(dl);
@@ -481,7 +483,8 @@ int mysql_create_function(THD *thd,udf_func *udf)
udf->name.str,
"UDFs are unavailable with the --skip-grant-tables option");
else
- my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
+ my_message(ER_OUT_OF_RESOURCES, ER_THD(thd, ER_OUT_OF_RESOURCES),
+ MYF(0));
DBUG_RETURN(1);
}
@@ -492,10 +495,10 @@ int mysql_create_function(THD *thd,udf_func *udf)
*/
if (check_valid_path(udf->dl, strlen(udf->dl)))
{
- my_message(ER_UDF_NO_PATHS, ER(ER_UDF_NO_PATHS), MYF(0));
+ my_message(ER_UDF_NO_PATHS, ER_THD(thd, ER_UDF_NO_PATHS), MYF(0));
DBUG_RETURN(1);
}
- if (check_string_char_length(&udf->name, "", NAME_CHAR_LEN,
+ if (check_string_char_length(&udf->name, 0, NAME_CHAR_LEN,
system_charset_info, 1))
{
my_error(ER_TOO_LONG_IDENT, MYF(0), udf->name.str);
@@ -519,7 +522,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
else if (thd->lex->create_info.if_not_exists())
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, ER_UDF_EXISTS,
- ER(ER_UDF_EXISTS), udf->name.str);
+ ER_THD(thd, ER_UDF_EXISTS), udf->name.str);
goto done;
}
@@ -615,7 +618,8 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
if (opt_noacl)
my_error(ER_FUNCTION_NOT_DEFINED, MYF(0), udf_name->str);
else
- my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
+ my_message(ER_OUT_OF_RESOURCES, ER_THD(thd, ER_OUT_OF_RESOURCES),
+ MYF(0));
DBUG_RETURN(1);
}
@@ -631,7 +635,8 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
if (thd->lex->check_exists)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_FUNCTION_NOT_DEFINED, ER(ER_FUNCTION_NOT_DEFINED),
+ ER_FUNCTION_NOT_DEFINED,
+ ER_THD(thd, ER_FUNCTION_NOT_DEFINED),
udf_name->str);
goto done;
}
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index f7df0fd1538..c8350838ee8 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -342,6 +342,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
bool is_union_select;
bool instantiate_tmp_table= false;
DBUG_ENTER("st_select_lex_unit::prepare");
+ DBUG_ASSERT(thd == thd_arg && thd == current_thd);
describe= MY_TEST(additional_options & SELECT_DESCRIBE);
@@ -484,7 +485,8 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
while ((item_tmp= it++))
{
/* Error's in 'new' will be detected after loop */
- types.push_back(new Item_type_holder(thd_arg, item_tmp));
+ types.push_back(new (thd_arg->mem_root)
+ Item_type_holder(thd_arg, item_tmp));
}
if (thd_arg->is_fatal_error)
@@ -495,7 +497,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
if (types.elements != sl->item_list.elements)
{
my_message(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT,
- ER(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT),MYF(0));
+ ER_THD(thd, ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT),MYF(0));
goto err;
}
List_iterator_fast<Item> it(sl->item_list);
@@ -886,7 +888,7 @@ bool st_select_lex_unit::exec()
*/
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT,
- ER(ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT),
+ ER_THD(thd, ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT),
thd->accessed_rows_and_keys,
thd->lex->limit_rows_examined->val_uint());
thd->reset_killed();
@@ -985,7 +987,7 @@ bool st_select_lex_unit::exec()
}
else
{
- join->examined_rows= 0;
+ join->join_examined_rows= 0;
saved_error= join->reinit();
join->exec();
}
@@ -1176,7 +1178,6 @@ bool st_select_lex::cleanup()
{
error= (bool) ((uint) error | (uint) lex_unit->cleanup());
}
- non_agg_fields.empty();
inner_refs_list.empty();
exclude_from_table_unique_test= FALSE;
DBUG_RETURN(error);
@@ -1187,6 +1188,7 @@ void st_select_lex::cleanup_all_joins(bool full)
{
SELECT_LEX_UNIT *unit;
SELECT_LEX *sl;
+ DBUG_ENTER("st_select_lex::cleanup_all_joins");
if (join)
join->cleanup(full);
@@ -1194,6 +1196,7 @@ void st_select_lex::cleanup_all_joins(bool full)
for (unit= first_inner_unit(); unit; unit= unit->next_unit())
for (sl= unit->first_select(); sl; sl= sl->next_select())
sl->cleanup_all_joins(full);
+ DBUG_VOID_RETURN;
}
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 171a63a0a6e..7a66cc3734c 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -148,7 +148,7 @@ static bool check_fields(THD *thd, List<Item> &items)
we make temporary copy of Item_field, to avoid influence of changing
result_field on Item_ref which refer on this field
*/
- thd->change_item_tree(it.ref(), new Item_field(thd, field));
+ thd->change_item_tree(it.ref(), new (thd->mem_root) Item_field(thd, field));
}
return FALSE;
}
@@ -447,7 +447,7 @@ int mysql_update(THD *thd,
if (safe_update && !using_limit)
{
my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE,
- ER(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE), MYF(0));
+ ER_THD(thd, ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE), MYF(0));
goto err;
}
}
@@ -1017,7 +1017,7 @@ int mysql_update(THD *thd,
if (error < 0 && !thd->lex->analyze_stmt)
{
char buff[MYSQL_ERRMSG_SIZE];
- my_snprintf(buff, sizeof(buff), ER(ER_UPDATE_INFO), (ulong) found,
+ my_snprintf(buff, sizeof(buff), ER_THD(thd, ER_UPDATE_INFO), (ulong) found,
(ulong) updated,
(ulong) thd->get_stmt_da()->current_statement_warn_count());
my_ok(thd, (thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated,
@@ -1186,7 +1186,7 @@ bool unsafe_key_update(List<TABLE_LIST> leaves, table_map tables_for_update)
while ((tl= it++))
{
- if (tl->table->map & tables_for_update)
+ if (!tl->is_jtbm() && (tl->table->map & tables_for_update))
{
TABLE *table1= tl->table;
bool primkey_clustered= (table1->file->primary_key_is_clustered() &&
@@ -1203,6 +1203,8 @@ bool unsafe_key_update(List<TABLE_LIST> leaves, table_map tables_for_update)
it2.rewind();
while ((tl2= it2++))
{
+ if (tl2->is_jtbm())
+ continue;
/*
Look at "next" tables only since all previous tables have
already been checked
@@ -1434,6 +1436,9 @@ int mysql_multi_update_prepare(THD *thd)
{
TABLE *table= tl->table;
+ if (tl->is_jtbm())
+ continue;
+
/* if table will be updated then check that it is unique */
if (table->map & tables_for_update)
{
@@ -1482,6 +1487,8 @@ int mysql_multi_update_prepare(THD *thd)
for (tl= table_list; tl; tl= tl->next_local)
{
bool not_used= false;
+ if (tl->is_jtbm())
+ continue;
if (multi_update_check_table_access(thd, tl, tables_for_update, &not_used))
DBUG_RETURN(TRUE);
}
@@ -1489,6 +1496,8 @@ int mysql_multi_update_prepare(THD *thd)
/* check single table update for view compound from several tables */
for (tl= table_list; tl; tl= tl->next_local)
{
+ if (tl->is_jtbm())
+ continue;
if (tl->is_merged_derived())
{
TABLE_LIST *for_update= 0;
@@ -1518,6 +1527,8 @@ int mysql_multi_update_prepare(THD *thd)
ti.rewind();
while ((tl= ti++))
{
+ if (tl->is_jtbm())
+ continue;
TABLE *table= tl->table;
TABLE_LIST *tlist;
if (!(tlist= tl->top_table())->derived)
@@ -1650,7 +1661,7 @@ int multi_update::prepare(List<Item> &not_used_values,
if (!tables_to_update)
{
- my_message(ER_NO_TABLES_USED, ER(ER_NO_TABLES_USED), MYF(0));
+ my_message(ER_NO_TABLES_USED, ER_THD(thd, ER_NO_TABLES_USED), MYF(0));
DBUG_RETURN(1);
}
@@ -1661,6 +1672,9 @@ int multi_update::prepare(List<Item> &not_used_values,
*/
while ((table_ref= ti++))
{
+ if (table_ref->is_jtbm())
+ continue;
+
TABLE *table= table_ref->table;
if (tables_to_update & table->map)
{
@@ -1680,6 +1694,9 @@ int multi_update::prepare(List<Item> &not_used_values,
ti.rewind();
while ((table_ref= ti++))
{
+ if (table_ref->is_jtbm())
+ continue;
+
TABLE *table= table_ref->table;
if (tables_to_update & table->map)
{
@@ -1710,6 +1727,8 @@ int multi_update::prepare(List<Item> &not_used_values,
while ((table_ref= ti++))
{
/* TODO: add support of view of join support */
+ if (table_ref->is_jtbm())
+ continue;
TABLE *table=table_ref->table;
leaf_table_count++;
if (tables_to_update & table->map)
@@ -1755,8 +1774,8 @@ int multi_update::prepare(List<Item> &not_used_values,
{
Item *value= value_it++;
uint offset= item->field->table->pos_in_table_list->shared;
- fields_for_table[offset]->push_back(item);
- values_for_table[offset]->push_back(value);
+ fields_for_table[offset]->push_back(item, thd->mem_root);
+ values_for_table[offset]->push_back(value, thd->mem_root);
}
if (thd->is_fatal_error)
DBUG_RETURN(1);
@@ -1978,11 +1997,11 @@ loop_end:
table to be updated was created by mysql 4.1. Deny this.
*/
field->can_alter_field_type= 0;
- Item_field *ifield= new Item_field((Field *) field);
+ Item_field *ifield= new (thd->mem_root) Item_field(join->thd, (Field *) field);
if (!ifield)
DBUG_RETURN(1);
ifield->maybe_null= 0;
- if (temp_fields.push_back(ifield))
+ if (temp_fields.push_back(ifield, thd->mem_root))
DBUG_RETURN(1);
} while ((tbl= tbl_it++));
@@ -2549,7 +2568,7 @@ bool multi_update::send_eof()
{
id= thd->arg_of_last_insert_id_function ?
thd->first_successful_insert_id_in_prev_stmt : 0;
- my_snprintf(buff, sizeof(buff), ER(ER_UPDATE_INFO),
+ my_snprintf(buff, sizeof(buff), ER_THD(thd, ER_UPDATE_INFO),
(ulong) found, (ulong) updated, (ulong) thd->cuted_fields);
::my_ok(thd, (thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated,
id, buff);
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 07a85afdf82..e1b8bf0bb79 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -224,7 +224,7 @@ fill_defined_view_parts (THD *thd, TABLE_LIST *view)
view->definer.user= decoy.definer.user;
lex->definer= &view->definer;
}
- if (lex->create_view_algorithm == DTYPE_ALGORITHM_UNDEFINED)
+ if (lex->create_view_algorithm == VIEW_ALGORITHM_INHERIT)
lex->create_view_algorithm= (uint8) decoy.algorithm;
if (lex->create_view_suid == VIEW_SUID_DEFAULT)
lex->create_view_suid= decoy.view_suid ?
@@ -533,7 +533,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
if (lex->view_list.elements != select_lex->item_list.elements)
{
- my_message(ER_VIEW_WRONG_LIST, ER(ER_VIEW_WRONG_LIST), MYF(0));
+ my_message(ER_VIEW_WRONG_LIST, ER_THD(thd, ER_VIEW_WRONG_LIST), MYF(0));
res= TRUE;
goto err;
}
@@ -939,7 +939,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
!lex->can_be_merged())
{
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_WARN_VIEW_MERGE,
- ER(ER_WARN_VIEW_MERGE));
+ ER_THD(thd, ER_WARN_VIEW_MERGE));
lex->create_view_algorithm= DTYPE_ALGORITHM_UNDEFINED;
}
view->algorithm= lex->create_view_algorithm;
@@ -1002,7 +1002,8 @@ loop_out:
if (lex->create_info.if_not_exists())
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
+ ER_TABLE_EXISTS_ERROR,
+ ER_THD(thd, ER_TABLE_EXISTS_ERROR),
view->table_name);
DBUG_RETURN(0);
}
@@ -1232,7 +1233,7 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table,
!table->definer.user.length &&
!table->definer.host.length);
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_VIEW_FRM_NO_USER, ER(ER_VIEW_FRM_NO_USER),
+ ER_VIEW_FRM_NO_USER, ER_THD(thd, ER_VIEW_FRM_NO_USER),
table->db, table->table_name);
get_default_definer(thd, &table->definer, false);
}
@@ -1413,7 +1414,8 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table,
check_table_access(thd, SHOW_VIEW_ACL, &view_no_suid,
FALSE, UINT_MAX, TRUE))
{
- my_message(ER_VIEW_NO_EXPLAIN, ER(ER_VIEW_NO_EXPLAIN), MYF(0));
+ my_message(ER_VIEW_NO_EXPLAIN, ER_THD(thd, ER_VIEW_NO_EXPLAIN),
+ MYF(0));
goto err;
}
}
@@ -1644,7 +1646,7 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table,
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_VIEW_ORDERBY_IGNORED,
- ER(ER_VIEW_ORDERBY_IGNORED),
+ ER_THD(thd, ER_VIEW_ORDERBY_IGNORED),
table->db, table->table_name);
}
}
@@ -1757,7 +1759,8 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
if (thd->lex->if_exists())
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR),
+ ER_BAD_TABLE_ERROR,
+ ER_THD(thd, ER_BAD_TABLE_ERROR),
name);
continue;
}
@@ -1937,7 +1940,8 @@ bool check_key_in_view(THD *thd, TABLE_LIST *view)
{
/* update allowed, but issue warning */
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_WARN_VIEW_WITHOUT_KEY, ER(ER_WARN_VIEW_WITHOUT_KEY));
+ ER_WARN_VIEW_WITHOUT_KEY,
+ ER_THD(thd, ER_WARN_VIEW_WITHOUT_KEY));
DBUG_RETURN(FALSE);
}
/* prohibit update */
@@ -1977,7 +1981,7 @@ bool insert_view_fields(THD *thd, List<Item> *list, TABLE_LIST *view)
{
Item_field *fld;
if ((fld= entry->item->field_for_view_update()))
- list->push_back(fld);
+ list->push_back(fld, thd->mem_root);
else
{
my_error(ER_NON_INSERTABLE_TABLE, MYF(0), view->alias, "INSERT");
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index e54a315894c..29a46e21fbf 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -93,11 +93,11 @@ int yylex(void *yylval, void *yythd);
YYABORT; \
} while (0)
-#define MYSQL_YYABORT_UNLESS(A) \
- if (!(A)) \
- { \
- my_parse_error(ER(ER_SYNTAX_ERROR));\
- MYSQL_YYABORT; \
+#define MYSQL_YYABORT_UNLESS(A) \
+ if (!(A)) \
+ { \
+ my_parse_error(thd, ER_SYNTAX_ERROR); \
+ MYSQL_YYABORT; \
}
/*
@@ -140,25 +140,31 @@ int yylex(void *yylval, void *yythd);
parser.
*/
-void my_parse_error(const char *s, const char *yytext=0)
+static void my_parse_error_intern(THD *thd, const char *err_text,
+ const char *yytext)
{
- THD *thd= current_thd;
- Lex_input_stream *lip= & thd->m_parser_state->m_lip;
-
+ Lex_input_stream *lip= &thd->m_parser_state->m_lip;
if (!yytext)
- yytext= lip->get_tok_start();
- if (!yytext)
- yytext= "";
-
+ {
+ if (!(yytext= lip->get_tok_start()))
+ yytext= "";
+ }
/* Push an error into the error stack */
- ErrConvString err(yytext, strlen(yytext), thd->variables.character_set_client);
- my_printf_error(ER_PARSE_ERROR, ER(ER_PARSE_ERROR), MYF(0), s,
- err.ptr(), lip->yylineno);
+ ErrConvString err(yytext, strlen(yytext),
+ thd->variables.character_set_client);
+ my_printf_error(ER_PARSE_ERROR, ER_THD(thd, ER_PARSE_ERROR), MYF(0),
+ err_text, err.ptr(), lip->yylineno);
+}
+
+
+static void my_parse_error(THD *thd, uint err_number, const char *yytext=0)
+{
+ return my_parse_error_intern(thd, ER_THD(thd, err_number), yytext);
}
void LEX::parse_error()
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
}
@@ -193,8 +199,8 @@ void MYSQLerror(THD *thd, const char *s)
/* "parse error" changed into "syntax error" between bison 1.75 and 1.875 */
if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0)
- s= ER(ER_SYNTAX_ERROR);
- my_parse_error(s);
+ s= ER_THD(thd, ER_SYNTAX_ERROR);
+ my_parse_error_intern(thd, s, 0);
}
@@ -284,8 +290,9 @@ int case_stmt_action_expr(LEX *lex, Item* expr)
if (parsing_ctx->push_case_expr_id(case_expr_id))
return 1;
- i= new sp_instr_set_case_expr(sp->instructions(),
- parsing_ctx, case_expr_id, expr, lex);
+ i= new (lex->thd->mem_root)
+ sp_instr_set_case_expr(sp->instructions(), parsing_ctx, case_expr_id, expr,
+ lex);
sp->add_cont_backpatch(i);
return sp->add_instr(i);
@@ -307,10 +314,12 @@ int case_stmt_action_when(LEX *lex, Item *when, bool simple)
sp_instr_jump_if_not *i;
Item_case_expr *var;
Item *expr;
+ THD *thd= lex->thd;
if (simple)
{
- var= new Item_case_expr(ctx->get_current_case_expr_id());
+ var= new (thd->mem_root)
+ Item_case_expr(thd, ctx->get_current_case_expr_id());
#ifndef DBUG_OFF
if (var)
@@ -319,11 +328,11 @@ int case_stmt_action_when(LEX *lex, Item *when, bool simple)
}
#endif
- expr= new Item_func_eq(var, when);
- i= new sp_instr_jump_if_not(ip, ctx, expr, lex);
+ expr= new (thd->mem_root) Item_func_eq(thd, var, when);
+ i= new (thd->mem_root) sp_instr_jump_if_not(ip, ctx, expr, lex);
}
else
- i= new sp_instr_jump_if_not(ip, ctx, when, lex);
+ i= new (thd->mem_root) sp_instr_jump_if_not(ip, ctx, when, lex);
/*
BACKPATCH: Registering forward jump from
@@ -332,7 +341,7 @@ int case_stmt_action_when(LEX *lex, Item *when, bool simple)
*/
return !MY_TEST(i) ||
- sp->push_backpatch(i, ctx->push_label(current_thd, empty_lex_str, 0)) ||
+ sp->push_backpatch(i, ctx->push_label(thd, empty_lex_str, 0)) ||
sp->add_cont_backpatch(i) ||
sp->add_instr(i);
}
@@ -348,7 +357,7 @@ int case_stmt_action_then(LEX *lex)
sp_head *sp= lex->sphead;
sp_pcontext *ctx= lex->spcont;
uint ip= sp->instructions();
- sp_instr_jump *i = new sp_instr_jump(ip, ctx);
+ sp_instr_jump *i= new (lex->thd->mem_root) sp_instr_jump(ip, ctx);
if (!MY_TEST(i) || sp->add_instr(i))
return 1;
@@ -411,10 +420,11 @@ set_system_variable(THD *thd, struct sys_var_with_base *tmp,
return TRUE;
}
- if (! (var= new set_var(var_type, tmp->var, &tmp->base_name, val)))
+ if (! (var= new (thd->mem_root)
+ set_var(thd, var_type, tmp->var, &tmp->base_name, val)))
return TRUE;
- return lex->var_list.push_back(var);
+ return lex->var_list.push_back(var, thd->mem_root);
}
@@ -442,13 +452,14 @@ set_local_variable(THD *thd, sp_variable *spv, Item *val)
it= spv->default_value;
else
{
- it= new (thd->mem_root) Item_null();
+ it= new (thd->mem_root) Item_null(thd);
if (it == NULL)
return TRUE;
}
- sp_set= new sp_instr_set(lex->sphead->instructions(), lex->spcont,
- spv->offset, it, spv->type, lex, TRUE);
+ sp_set= new (thd->mem_root)
+ sp_instr_set(lex->sphead->instructions(), lex->spcont,
+ spv->offset, it, spv->type, lex, TRUE);
return (sp_set == NULL || lex->sphead->add_instr(sp_set));
}
@@ -474,22 +485,24 @@ set_trigger_new_row(THD *thd, LEX_STRING *name, Item *val)
/* QQ: Shouldn't this be field's default value ? */
if (! val)
- val= new Item_null();
+ val= new (thd->mem_root) Item_null(thd);
DBUG_ASSERT(lex->trg_chistics.action_time == TRG_ACTION_BEFORE &&
(lex->trg_chistics.event == TRG_EVENT_INSERT ||
lex->trg_chistics.event == TRG_EVENT_UPDATE));
trg_fld= new (thd->mem_root)
- Item_trigger_field(lex->current_context(),
+ Item_trigger_field(thd, lex->current_context(),
Item_trigger_field::NEW_ROW,
name->str, UPDATE_ACL, FALSE);
if (trg_fld == NULL)
return TRUE;
- sp_fld= new sp_instr_set_trigger_field(lex->sphead->instructions(),
- lex->spcont, trg_fld, val, lex);
+ sp_fld= new (thd->mem_root)
+ sp_instr_set_trigger_field(lex->sphead->instructions(),
+ lex->spcont, trg_fld, val,
+ lex);
if (sp_fld == NULL)
return TRUE;
@@ -545,7 +558,7 @@ create_item_for_sp_var(THD *thd, LEX_STRING name, sp_variable *spvar,
len_in_q= end_in_q - start_in_q;
item= new (thd->mem_root)
- Item_splocal(name, spvar->offset, spvar->type, pos_in_q, len_in_q);
+ Item_splocal(thd, name, spvar->offset, spvar->type, pos_in_q, len_in_q);
#ifndef DBUG_OFF
if (item)
@@ -623,9 +636,9 @@ Item* handle_sql2003_note184_exception(THD *thd, Item* left, bool equal,
}
if (equal)
- result= new (thd->mem_root) Item_func_eq(left, expr);
+ result= new (thd->mem_root) Item_func_eq(thd, left, expr);
else
- result= new (thd->mem_root) Item_func_ne(left, expr);
+ result= new (thd->mem_root) Item_func_ne(thd, left, expr);
DBUG_RETURN(result);
}
@@ -639,11 +652,11 @@ Item* handle_sql2003_note184_exception(THD *thd, Item* left, bool equal,
@param lex The parser state.
- @param is_union_distinct True if the union preceding the new select statement
- uses UNION DISTINCT.
+ @param is_union_distinct True if the union preceding the new select
+ statement uses UNION DISTINCT.
@param is_top_level This should be @c TRUE if the newly created SELECT_LEX
- is a non-nested statement.
+ is a non-nested statement.
@return <code>false</code> if successful, <code>true</code> if an error was
reported. In the latter case parsing should stop.
@@ -673,7 +686,7 @@ bool add_select_to_union_list(LEX *lex, bool is_union_distinct,
}
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(lex->thd, ER_SYNTAX_ERROR);
return TRUE;
}
/* This counter shouldn't be incremented for UNION parts */
@@ -701,7 +714,7 @@ bool setup_select_in_parentheses(LEX *lex)
/*
if (sel->set_braces(1))
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(lex->thd, ER_SYNTAX_ERROR);
return TRUE;
}
*/
@@ -711,7 +724,7 @@ bool setup_select_in_parentheses(LEX *lex)
sel->master_unit()->first_select()->linkage ==
UNION_TYPE)
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(lex->thd, ER_SYNTAX_ERROR);
return TRUE;
}
if (sel->linkage == UNION_TYPE &&
@@ -814,8 +827,8 @@ static bool sp_create_assignment_instr(THD *thd, bool no_lookahead)
sp_instr_stmt *i;
Lex_input_stream *lip= &thd->m_parser_state->m_lip;
- if (!(i= new sp_instr_stmt(sp->instructions(), lex->spcont,
- lex)))
+ if (!(i= new (thd->mem_root)
+ sp_instr_stmt(sp->instructions(), lex->spcont, lex)))
return true;
/*
@@ -853,18 +866,23 @@ static void add_key_to_list(LEX *lex, LEX_STRING *field_name,
enum Key::Keytype type, bool check_exists)
{
Key *key;
- key= new Key(type, null_lex_str, HA_KEY_ALG_UNDEF, false,
- DDL_options(check_exists ? DDL_options::OPT_IF_NOT_EXISTS :
- DDL_options::OPT_NONE));
- key->columns.push_back(new Key_part_spec(*field_name, 0));
- lex->alter_info.key_list.push_back(key);
+ MEM_ROOT *mem_root= lex->thd->mem_root;
+ key= new (mem_root)
+ Key(type, null_lex_str, HA_KEY_ALG_UNDEF, false,
+ DDL_options(check_exists ?
+ DDL_options::OPT_IF_NOT_EXISTS :
+ DDL_options::OPT_NONE));
+ key->columns.push_back(new (mem_root) Key_part_spec(*field_name, 0),
+ mem_root);
+ lex->alter_info.key_list.push_back(key, mem_root);
}
-void LEX::init_last_field(Create_field *field, const char *name, CHARSET_INFO *cs)
+void LEX::init_last_field(Create_field *field, const char *field_name,
+ CHARSET_INFO *cs)
{
last_field= field;
- field->field_name= name;
+ field->field_name= field_name;
/* reset LEX fields that are used in Create_field::set_and_check() */
length= 0;
@@ -872,9 +890,9 @@ void LEX::init_last_field(Create_field *field, const char *name, CHARSET_INFO *c
charset= cs;
}
-void LEX::set_last_field_type(enum enum_field_types type)
+void LEX::set_last_field_type(enum enum_field_types field_type)
{
- last_field->sql_type= type;
+ last_field->sql_type= field_type;
last_field->create_if_not_exists= check_exists;
last_field->charset= charset;
@@ -1717,8 +1735,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%type <num>
order_dir lock_option
- udf_type opt_local opt_table_options table_options
- table_option opt_no_write_to_binlog
+ udf_type opt_local opt_no_write_to_binlog
opt_temporary all_or_any opt_distinct
opt_ignore_leaves fulltext_options union_option
opt_not opt_union_order_or_limit
@@ -2001,7 +2018,7 @@ query:
if (!thd->bootstrap &&
(!(thd->lex->select_lex.options & OPTION_FOUND_COMMENT)))
{
- my_message(ER_EMPTY_QUERY, ER(ER_EMPTY_QUERY), MYF(0));
+ my_message(ER_EMPTY_QUERY, ER_THD(thd, ER_EMPTY_QUERY), MYF(0));
MYSQL_YYABORT;
}
thd->lex->sql_command= SQLCOM_EMPTY_QUERY;
@@ -2174,7 +2191,8 @@ execute_var_ident:
{
LEX *lex=Lex;
LEX_STRING *lexstr= (LEX_STRING*)thd->memdup(&$2, sizeof(LEX_STRING));
- if (!lexstr || lex->prepared_stmt_params.push_back(lexstr))
+ if (!lexstr || lex->prepared_stmt_params.push_back(lexstr,
+ thd->mem_root))
MYSQL_YYABORT;
}
;
@@ -2290,7 +2308,7 @@ master_def:
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX,
- ER(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX));
+ ER_THD(thd, ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX));
}
if (Lex->mi.heartbeat_period < 0.001)
{
@@ -2298,7 +2316,7 @@ master_def:
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN,
- ER(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN));
+ ER_THD(thd, ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN));
Lex->mi.heartbeat_period= 0.0;
}
Lex->mi.heartbeat_opt= LEX_MASTER_INFO::LEX_MI_DISABLE;
@@ -2332,6 +2350,7 @@ ignore_server_id:
{
insert_dynamic(&Lex->mi.repl_ignore_server_ids, (uchar*) &($1));
}
+ ;
do_domain_id_list:
/* Empty */
@@ -2344,6 +2363,7 @@ do_domain_id:
{
insert_dynamic(&Lex->mi.repl_do_domain_ids, (uchar*) &($1));
}
+ ;
ignore_domain_id_list:
/* Empty */
@@ -2356,6 +2376,7 @@ ignore_domain_id:
{
insert_dynamic(&Lex->mi.repl_ignore_domain_ids, (uchar*) &($1));
}
+ ;
master_file_def:
MASTER_LOG_FILE_SYM EQ TEXT_STRING_sys
@@ -2364,7 +2385,6 @@ master_file_def:
}
| MASTER_LOG_POS_SYM EQ ulonglong_num
{
- Lex->mi.pos = $3;
/*
If the user specified a value < BIN_LOG_HEADER_SIZE, adjust it
instead of causing subsequent errors.
@@ -2376,7 +2396,7 @@ master_file_def:
from 0" (4 in fact), unspecified means "don't change the position
(keep the preceding value)").
*/
- Lex->mi.pos= MY_MAX(BIN_LOG_HEADER_SIZE, Lex->mi.pos);
+ Lex->mi.pos= MY_MAX(BIN_LOG_HEADER_SIZE, $3);
}
| RELAY_LOG_FILE_SYM EQ TEXT_STRING_sys
{
@@ -2397,7 +2417,6 @@ master_file_def:
}
Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_CURRENT_POS;
}
- ;
| MASTER_USE_GTID_SYM EQ SLAVE_POS_SYM
{
if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED)
@@ -2407,7 +2426,6 @@ master_file_def:
}
Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_SLAVE_POS;
}
- ;
| MASTER_USE_GTID_SYM EQ NO_SYM
{
if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED)
@@ -2425,7 +2443,7 @@ optional_connection_name:
LEX *lex= thd->lex;
lex->mi.connection_name= null_lex_str;
}
- | connection_name;
+ | connection_name
;
connection_name:
@@ -2440,11 +2458,12 @@ connection_name:
}
#endif
}
+ ;
/* create a table */
create:
- create_or_replace opt_table_options TABLE_SYM opt_if_not_exists table_ident
+ create_or_replace opt_temporary TABLE_SYM opt_if_not_exists table_ident
{
LEX *lex= thd->lex;
lex->create_info.init();
@@ -2474,7 +2493,7 @@ create:
lex->create_info.use_default_db_type(thd);
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_USING_OTHER_HANDLER,
- ER(ER_WARN_USING_OTHER_HANDLER),
+ ER_THD(thd, ER_WARN_USING_OTHER_HANDLER),
hton_name(lex->create_info.db_type)->str,
$5->table.str);
}
@@ -2680,7 +2699,7 @@ opt_ev_status:
ev_starts:
/* empty */
{
- Item *item= new (thd->mem_root) Item_func_now_local(0);
+ Item *item= new (thd->mem_root) Item_func_now_local(thd, 0);
if (item == NULL)
MYSQL_YYABORT;
Lex->event_parse_data->item_starts= item;
@@ -2796,7 +2815,7 @@ sp_name:
{
MYSQL_YYABORT;
}
- $$= new sp_name($1, $3, true);
+ $$= new (thd->mem_root) sp_name($1, $3, true);
if ($$ == NULL)
MYSQL_YYABORT;
$$->init_qname(thd);
@@ -2811,7 +2830,7 @@ sp_name:
}
if (lex->copy_db_to(&db.str, &db.length))
MYSQL_YYABORT;
- $$= new sp_name(db, $1, false);
+ $$= new (lex->thd->mem_root) sp_name(db, $1, false);
if ($$ == NULL)
MYSQL_YYABORT;
$$->init_qname(thd);
@@ -2890,11 +2909,11 @@ opt_sp_cparams:
sp_cparams:
sp_cparams ',' expr
{
- Lex->value_list.push_back($3);
+ Lex->value_list.push_back($3, thd->mem_root);
}
| expr
{
- Lex->value_list.push_back($1);
+ Lex->value_list.push_back($1, thd->mem_root);
}
;
@@ -2991,13 +3010,13 @@ sp_decls:
if (($2.vars || $2.conds) && ($1.curs || $1.hndlrs))
{ /* Variable or condition following cursor or handler */
my_message(ER_SP_VARCOND_AFTER_CURSHNDLR,
- ER(ER_SP_VARCOND_AFTER_CURSHNDLR), MYF(0));
+ ER_THD(thd, ER_SP_VARCOND_AFTER_CURSHNDLR), MYF(0));
MYSQL_YYABORT;
}
if ($2.curs && $1.hndlrs)
{ /* Cursor following handler */
my_message(ER_SP_CURSOR_AFTER_HANDLER,
- ER(ER_SP_CURSOR_AFTER_HANDLER), MYF(0));
+ ER_THD(thd, ER_SP_CURSOR_AFTER_HANDLER), MYF(0));
MYSQL_YYABORT;
}
$$.vars= $1.vars + $2.vars;
@@ -3034,7 +3053,7 @@ sp_decl:
if (!dflt_value_item)
{
- dflt_value_item= new (thd->mem_root) Item_null();
+ dflt_value_item= new (thd->mem_root) Item_null(thd);
if (dflt_value_item == NULL)
MYSQL_YYABORT;
/* QQ Set to the var_type with null_value? */
@@ -3066,13 +3085,14 @@ sp_decl:
/* The last instruction is responsible for freeing LEX. */
- sp_instr_set *is= new sp_instr_set(lex->sphead->instructions(),
- pctx,
- var_idx,
- dflt_value_item,
- var_type,
- lex,
- last);
+ sp_instr_set *is= (new (lex->thd->mem_root)
+ sp_instr_set(lex->sphead->instructions(),
+ pctx,
+ var_idx,
+ dflt_value_item,
+ var_type,
+ lex,
+ last));
if (is == NULL ||
lex->sphead->add_instr(is))
MYSQL_YYABORT;
@@ -3112,7 +3132,8 @@ sp_decl:
sp_pcontext *ctx= lex->spcont;
sp_instr_hpush_jump *i=
- new sp_instr_hpush_jump(sp->instructions(), ctx, h);
+ new (lex->thd->mem_root) sp_instr_hpush_jump(sp->instructions(),
+ ctx, h);
if (i == NULL || sp->add_instr(i))
MYSQL_YYABORT;
@@ -3135,14 +3156,16 @@ sp_decl:
if ($2 == sp_handler::CONTINUE)
{
- i= new sp_instr_hreturn(sp->instructions(), ctx);
+ i= new (lex->thd->mem_root)
+ sp_instr_hreturn(sp->instructions(), ctx);
if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT;
}
else
{ /* EXIT or UNDO handler, just jump to the end of the block */
- i= new sp_instr_hreturn(sp->instructions(), ctx);
+ i= new (lex->thd->mem_root)
+ sp_instr_hreturn(sp->instructions(), ctx);
if (i == NULL ||
sp->add_instr(i) ||
sp->push_backpatch(i, lex->spcont->last_label())) /* Block end */
@@ -3169,8 +3192,9 @@ sp_decl:
delete $5;
MYSQL_YYABORT;
}
- i= new sp_instr_cpush(sp->instructions(), ctx, $5,
- ctx->current_cursor_count());
+ i= new (lex->thd->mem_root)
+ sp_instr_cpush(sp->instructions(), ctx, $5,
+ ctx->current_cursor_count());
if (i == NULL ||
sp->add_instr(i) ||
ctx->add_cursor($2))
@@ -3192,7 +3216,7 @@ sp_cursor_stmt:
if (lex->result)
{
- my_message(ER_SP_BAD_CURSOR_SELECT, ER(ER_SP_BAD_CURSOR_SELECT),
+ my_message(ER_SP_BAD_CURSOR_SELECT, ER_THD(thd, ER_SP_BAD_CURSOR_SELECT),
MYF(0));
MYSQL_YYABORT;
}
@@ -3225,7 +3249,7 @@ sp_hcond_element:
if (ctx->check_duplicate_handler($1))
{
- my_message(ER_SP_DUP_HANDLER, ER(ER_SP_DUP_HANDLER), MYF(0));
+ my_message(ER_SP_DUP_HANDLER, ER_THD(thd, ER_SP_DUP_HANDLER), MYF(0));
MYSQL_YYABORT;
}
else
@@ -3414,7 +3438,7 @@ signal_allowed_expr:
SIGNAL/RESIGNAL ...
SET <signal condition item name> = @foo := expr
*/
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
}
@@ -3508,12 +3532,12 @@ statement_information:
statement_information_item
{
$$= new (thd->mem_root) List<Statement_information_item>;
- if ($$ == NULL || $$->push_back($1))
+ if ($$ == NULL || $$->push_back($1, thd->mem_root))
MYSQL_YYABORT;
}
| statement_information ',' statement_information_item
{
- if ($1->push_back($3))
+ if ($1->push_back($3, thd->mem_root))
MYSQL_YYABORT;
$$= $1;
}
@@ -3539,7 +3563,7 @@ simple_target_specification:
}
| '@' ident_or_text
{
- $$= new (thd->mem_root) Item_func_get_user_var($2);
+ $$= new (thd->mem_root) Item_func_get_user_var(thd, $2);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -3565,12 +3589,12 @@ condition_information:
condition_information_item
{
$$= new (thd->mem_root) List<Condition_information_item>;
- if ($$ == NULL || $$->push_back($1))
+ if ($$ == NULL || $$->push_back($1, thd->mem_root))
MYSQL_YYABORT;
}
| condition_information ',' condition_information_item
{
- if ($1->push_back($3))
+ if ($1->push_back($3, thd->mem_root))
MYSQL_YYABORT;
$$= $1;
}
@@ -3712,8 +3736,8 @@ sp_proc_stmt_statement:
lex->var_list.is_empty());
if (lex->sql_command != SQLCOM_SET_OPTION)
{
- sp_instr_stmt *i=new sp_instr_stmt(sp->instructions(),
- lex->spcont, lex);
+ sp_instr_stmt *i=new (lex->thd->mem_root)
+ sp_instr_stmt(sp->instructions(), lex->spcont, lex);
if (i == NULL)
MYSQL_YYABORT;
@@ -3747,15 +3771,16 @@ sp_proc_stmt_return:
if (sp->m_type != TYPE_ENUM_FUNCTION)
{
- my_message(ER_SP_BADRETURN, ER(ER_SP_BADRETURN), MYF(0));
+ my_message(ER_SP_BADRETURN, ER_THD(thd, ER_SP_BADRETURN), MYF(0));
MYSQL_YYABORT;
}
else
{
sp_instr_freturn *i;
- i= new sp_instr_freturn(sp->instructions(), lex->spcont, $3,
- sp->m_return_field_def.sql_type, lex);
+ i= new (lex->thd->mem_root)
+ sp_instr_freturn(sp->instructions(), lex->spcont, $3,
+ sp->m_return_field_def.sql_type, lex);
if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT;
@@ -3811,7 +3836,8 @@ sp_proc_stmt_leave:
n= ctx->diff_handlers(lab->ctx, exclusive);
if (n)
{
- sp_instr_hpop *hpop= new sp_instr_hpop(ip++, ctx, n);
+ sp_instr_hpop *hpop= new (lex->thd->mem_root)
+ sp_instr_hpop(ip++, ctx, n);
if (hpop == NULL)
MYSQL_YYABORT;
sp->add_instr(hpop);
@@ -3819,12 +3845,13 @@ sp_proc_stmt_leave:
n= ctx->diff_cursors(lab->ctx, exclusive);
if (n)
{
- sp_instr_cpop *cpop= new sp_instr_cpop(ip++, ctx, n);
+ sp_instr_cpop *cpop= new (lex->thd->mem_root)
+ sp_instr_cpop(ip++, ctx, n);
if (cpop == NULL)
MYSQL_YYABORT;
sp->add_instr(cpop);
}
- i= new sp_instr_jump(ip, ctx);
+ i= new (lex->thd->mem_root) sp_instr_jump(ip, ctx);
if (i == NULL)
MYSQL_YYABORT;
sp->push_backpatch(i, lab); /* Jumping forward */
@@ -3855,7 +3882,8 @@ sp_proc_stmt_iterate:
n= ctx->diff_handlers(lab->ctx, FALSE); /* Inclusive the dest. */
if (n)
{
- sp_instr_hpop *hpop= new sp_instr_hpop(ip++, ctx, n);
+ sp_instr_hpop *hpop= new (lex->thd->mem_root)
+ sp_instr_hpop(ip++, ctx, n);
if (hpop == NULL ||
sp->add_instr(hpop))
MYSQL_YYABORT;
@@ -3863,12 +3891,14 @@ sp_proc_stmt_iterate:
n= ctx->diff_cursors(lab->ctx, FALSE); /* Inclusive the dest. */
if (n)
{
- sp_instr_cpop *cpop= new sp_instr_cpop(ip++, ctx, n);
+ sp_instr_cpop *cpop= new (lex->thd->mem_root)
+ sp_instr_cpop(ip++, ctx, n);
if (cpop == NULL ||
sp->add_instr(cpop))
MYSQL_YYABORT;
}
- i= new sp_instr_jump(ip, ctx, lab->ip); /* Jump back */
+ i= new (lex->thd->mem_root)
+ sp_instr_jump(ip, ctx, lab->ip); /* Jump back */
if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT;
@@ -3889,7 +3919,8 @@ sp_proc_stmt_open:
my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str);
MYSQL_YYABORT;
}
- i= new sp_instr_copen(sp->instructions(), lex->spcont, offset);
+ i= new (lex->thd->mem_root)
+ sp_instr_copen(sp->instructions(), lex->spcont, offset);
if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT;
@@ -3909,7 +3940,8 @@ sp_proc_stmt_fetch:
my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $3.str);
MYSQL_YYABORT;
}
- i= new sp_instr_cfetch(sp->instructions(), lex->spcont, offset);
+ i= new (lex->thd->mem_root)
+ sp_instr_cfetch(sp->instructions(), lex->spcont, offset);
if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT;
@@ -3931,7 +3963,8 @@ sp_proc_stmt_close:
my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str);
MYSQL_YYABORT;
}
- i= new sp_instr_cclose(sp->instructions(), lex->spcont, offset);
+ i= new (lex->thd->mem_root)
+ sp_instr_cclose(sp->instructions(), lex->spcont, offset);
if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT;
@@ -3995,8 +4028,8 @@ sp_if:
sp_head *sp= lex->sphead;
sp_pcontext *ctx= lex->spcont;
uint ip= sp->instructions();
- sp_instr_jump_if_not *i = new sp_instr_jump_if_not(ip, ctx,
- $2, lex);
+ sp_instr_jump_if_not *i= new (lex->thd->mem_root)
+ sp_instr_jump_if_not(ip, ctx, $2, lex);
if (i == NULL ||
sp->push_backpatch(i, ctx->push_label(thd, empty_lex_str, 0)) ||
sp->add_cont_backpatch(i) ||
@@ -4010,7 +4043,7 @@ sp_if:
sp_head *sp= Lex->sphead;
sp_pcontext *ctx= Lex->spcont;
uint ip= sp->instructions();
- sp_instr_jump *i = new sp_instr_jump(ip, ctx);
+ sp_instr_jump *i= new (thd->mem_root) sp_instr_jump(ip, ctx);
if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT;
@@ -4080,7 +4113,7 @@ case_stmt_specification:
BACKPATCH: Creating target label for the jump to after END CASE
(instruction 12 in the example)
*/
- Lex->spcont->push_label(current_thd, empty_lex_str, Lex->sphead->instructions());
+ Lex->spcont->push_label(thd, empty_lex_str, Lex->sphead->instructions());
}
case_stmt_body
else_clause_opt
@@ -4181,8 +4214,8 @@ else_clause_opt:
LEX *lex= Lex;
sp_head *sp= lex->sphead;
uint ip= sp->instructions();
- sp_instr_error *i= new sp_instr_error(ip, lex->spcont,
- ER_SP_CASE_NOT_FOUND);
+ sp_instr_error *i= new (thd->mem_root)
+ sp_instr_error(ip, lex->spcont, ER_SP_CASE_NOT_FOUND);
if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT;
@@ -4298,14 +4331,16 @@ sp_block_content:
sp->backpatch(ctx->last_label()); /* We always have a label */
if ($2.hndlrs)
{
- i= new sp_instr_hpop(sp->instructions(), ctx, $2.hndlrs);
+ i= new (thd->mem_root)
+ sp_instr_hpop(sp->instructions(), ctx, $2.hndlrs);
if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT;
}
if ($2.curs)
{
- i= new sp_instr_cpop(sp->instructions(), ctx, $2.curs);
+ i= new (lex->thd->mem_root)
+ sp_instr_cpop(sp->instructions(), ctx, $2.curs);
if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT;
@@ -4322,7 +4357,8 @@ sp_control_content:
LEX *lex= Lex;
uint ip= lex->sphead->instructions();
sp_label *lab= lex->spcont->last_label(); /* Jumping back */
- sp_instr_jump *i = new sp_instr_jump(ip, lex->spcont, lab->ip);
+ sp_instr_jump *i= new (lex->thd->mem_root)
+ sp_instr_jump(ip, lex->spcont, lab->ip);
if (i == NULL ||
lex->sphead->add_instr(i))
MYSQL_YYABORT;
@@ -4334,8 +4370,8 @@ sp_control_content:
LEX *lex= Lex;
sp_head *sp= lex->sphead;
uint ip= sp->instructions();
- sp_instr_jump_if_not *i = new sp_instr_jump_if_not(ip, lex->spcont,
- $3, lex);
+ sp_instr_jump_if_not *i= new (lex->thd->mem_root)
+ sp_instr_jump_if_not(ip, lex->spcont, $3, lex);
if (i == NULL ||
/* Jumping forward */
sp->push_backpatch(i, lex->spcont->last_label()) ||
@@ -4350,7 +4386,8 @@ sp_control_content:
LEX *lex= Lex;
uint ip= lex->sphead->instructions();
sp_label *lab= lex->spcont->last_label(); /* Jumping back */
- sp_instr_jump *i = new sp_instr_jump(ip, lex->spcont, lab->ip);
+ sp_instr_jump *i= new (lex->thd->mem_root)
+ sp_instr_jump(ip, lex->spcont, lab->ip);
if (i == NULL ||
lex->sphead->add_instr(i))
MYSQL_YYABORT;
@@ -4363,9 +4400,8 @@ sp_control_content:
LEX *lex= Lex;
uint ip= lex->sphead->instructions();
sp_label *lab= lex->spcont->last_label(); /* Jumping back */
- sp_instr_jump_if_not *i = new sp_instr_jump_if_not(ip, lex->spcont,
- $5, lab->ip,
- lex);
+ sp_instr_jump_if_not *i= new (lex->thd->mem_root)
+ sp_instr_jump_if_not(ip, lex->spcont, $5, lab->ip, lex);
if (i == NULL ||
lex->sphead->add_instr(i))
MYSQL_YYABORT;
@@ -4584,7 +4620,8 @@ tablespace_name:
ident
{
LEX *lex= Lex;
- lex->alter_tablespace_info= new st_alter_tablespace();
+ lex->alter_tablespace_info= (new (thd->mem_root)
+ st_alter_tablespace());
if (lex->alter_tablespace_info == NULL)
MYSQL_YYABORT;
lex->alter_tablespace_info->tablespace_name= $1.str;
@@ -4596,7 +4633,8 @@ logfile_group_name:
ident
{
LEX *lex= Lex;
- lex->alter_tablespace_info= new st_alter_tablespace();
+ lex->alter_tablespace_info= (new (thd->mem_root)
+ st_alter_tablespace());
if (lex->alter_tablespace_info == NULL)
MYSQL_YYABORT;
lex->alter_tablespace_info->logfile_group_name= $1.str;
@@ -4870,7 +4908,7 @@ partitioning:
PARTITION_SYM have_partitioning
{
LEX *lex= Lex;
- lex->part_info= new partition_info();
+ lex->part_info= new (thd->mem_root) partition_info();
if (!lex->part_info)
{
mem_alloc_error(sizeof(partition_info));
@@ -4909,7 +4947,7 @@ partition_entry:
LEX *lex= Lex;
if (!lex->part_info)
{
- my_parse_error(ER(ER_PARTITION_ENTRY_ERROR));
+ my_parse_error(thd, ER_PARTITION_ENTRY_ERROR);
MYSQL_YYABORT;
}
/*
@@ -4964,7 +5002,7 @@ opt_key_algo:
Lex->part_info->key_algorithm= partition_info::KEY_ALGORITHM_55;
break;
default:
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
}
@@ -4985,7 +5023,7 @@ part_field_item:
{
partition_info *part_info= Lex->part_info;
part_info->num_columns++;
- if (part_info->part_field_list.push_back($1.str))
+ if (part_info->part_field_list.push_back($1.str, thd->mem_root))
{
mem_alloc_error(1);
MYSQL_YYABORT;
@@ -5070,7 +5108,7 @@ sub_part_field_item:
ident
{
partition_info *part_info= Lex->part_info;
- if (part_info->subpart_field_list.push_back($1.str))
+ if (part_info->subpart_field_list.push_back($1.str, thd->mem_root))
{
mem_alloc_error(1);
MYSQL_YYABORT;
@@ -5093,7 +5131,7 @@ part_func_expr:
lex->safe_to_cache_query= 1;
if (not_corr_func)
{
- my_parse_error(ER(ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR));
+ my_parse_error(thd, ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR);
MYSQL_YYABORT;
}
$$=$1;
@@ -5142,7 +5180,7 @@ part_defs:
if (part_info->num_parts !=
count_curr_parts)
{
- my_parse_error(ER(ER_PARTITION_WRONG_NO_PART_ERROR));
+ my_parse_error(thd, ER_PARTITION_WRONG_NO_PART_ERROR);
MYSQL_YYABORT;
}
}
@@ -5163,9 +5201,10 @@ part_definition:
PARTITION_SYM
{
partition_info *part_info= Lex->part_info;
- partition_element *p_elem= new partition_element();
+ partition_element *p_elem= new (thd->mem_root) partition_element();
- if (!p_elem || part_info->partitions.push_back(p_elem))
+ if (!p_elem ||
+ part_info->partitions.push_back(p_elem, thd->mem_root))
{
mem_alloc_error(sizeof(partition_element));
MYSQL_YYABORT;
@@ -5260,16 +5299,16 @@ part_func_max:
part_info->num_columns != 1U)
{
part_info->print_debug("Kilroy II", NULL);
- my_parse_error(ER(ER_PARTITION_COLUMN_LIST_ERROR));
+ my_parse_error(thd, ER_PARTITION_COLUMN_LIST_ERROR);
MYSQL_YYABORT;
}
else
part_info->num_columns= 1U;
- if (part_info->init_column_part())
+ if (part_info->init_column_part(thd))
{
MYSQL_YYABORT;
}
- if (part_info->add_max_value())
+ if (part_info->add_max_value(thd))
{
MYSQL_YYABORT;
}
@@ -5291,7 +5330,7 @@ part_values_in:
part_info->num_columns > MAX_REF_PARTS)
{
part_info->print_debug("Kilroy III", NULL);
- my_parse_error(ER(ER_PARTITION_COLUMN_LIST_ERROR));
+ my_parse_error(thd, ER_PARTITION_COLUMN_LIST_ERROR);
MYSQL_YYABORT;
}
/*
@@ -5301,7 +5340,7 @@ part_values_in:
we ADD or REORGANIZE partitions. Also can only happen
for LIST partitions.
*/
- if (part_info->reorganize_into_single_field_col_val())
+ if (part_info->reorganize_into_single_field_col_val(thd))
{
MYSQL_YYABORT;
}
@@ -5312,7 +5351,7 @@ part_values_in:
partition_info *part_info= Lex->part_info;
if (part_info->num_columns < 2U)
{
- my_parse_error(ER(ER_ROW_SINGLE_PARTITION_FIELD_ERROR));
+ my_parse_error(thd, ER_ROW_SINGLE_PARTITION_FIELD_ERROR);
MYSQL_YYABORT;
}
}
@@ -5331,7 +5370,7 @@ part_value_item:
/* Initialisation code needed for each list of value expressions */
if (!(part_info->part_type == LIST_PARTITION &&
part_info->num_columns == 1U) &&
- part_info->init_column_part())
+ part_info->init_column_part(thd))
{
MYSQL_YYABORT;
}
@@ -5353,7 +5392,7 @@ part_value_item:
error.
*/
part_info->print_debug("Kilroy I", NULL);
- my_parse_error(ER(ER_PARTITION_COLUMN_LIST_ERROR));
+ my_parse_error(thd, ER_PARTITION_COLUMN_LIST_ERROR);
MYSQL_YYABORT;
}
part_info->curr_list_object= 0;
@@ -5371,10 +5410,10 @@ part_value_expr_item:
partition_info *part_info= Lex->part_info;
if (part_info->part_type == LIST_PARTITION)
{
- my_parse_error(ER(ER_MAXVALUE_IN_VALUES_IN));
+ my_parse_error(thd, ER_MAXVALUE_IN_VALUES_IN);
MYSQL_YYABORT;
}
- if (part_info->add_max_value())
+ if (part_info->add_max_value(thd))
{
MYSQL_YYABORT;
}
@@ -5387,7 +5426,7 @@ part_value_expr_item:
if (!lex->safe_to_cache_query)
{
- my_parse_error(ER(ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR));
+ my_parse_error(thd, ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR);
MYSQL_YYABORT;
}
if (part_info->add_column_list_value(thd, part_expr))
@@ -5409,7 +5448,7 @@ opt_sub_partition:
We come here when we have defined subpartitions on the first
partition but not on all the subsequent partitions.
*/
- my_parse_error(ER(ER_PARTITION_WRONG_NO_SUBPART_ERROR));
+ my_parse_error(thd, ER_PARTITION_WRONG_NO_SUBPART_ERROR);
MYSQL_YYABORT;
}
}
@@ -5421,7 +5460,7 @@ opt_sub_partition:
if (part_info->num_subparts !=
part_info->count_curr_subparts)
{
- my_parse_error(ER(ER_PARTITION_WRONG_NO_SUBPART_ERROR));
+ my_parse_error(thd, ER_PARTITION_WRONG_NO_SUBPART_ERROR);
MYSQL_YYABORT;
}
}
@@ -5429,7 +5468,7 @@ opt_sub_partition:
{
if (part_info->partitions.elements > 1)
{
- my_parse_error(ER(ER_PARTITION_WRONG_NO_SUBPART_ERROR));
+ my_parse_error(thd, ER_PARTITION_WRONG_NO_SUBPART_ERROR);
MYSQL_YYABORT;
}
part_info->num_subparts= part_info->count_curr_subparts;
@@ -5448,7 +5487,8 @@ sub_part_definition:
{
partition_info *part_info= Lex->part_info;
partition_element *curr_part= part_info->current_partition;
- partition_element *sub_p_elem= new partition_element(curr_part);
+ partition_element *sub_p_elem= new (thd->mem_root)
+ partition_element(curr_part);
if (part_info->use_default_subpartitions &&
part_info->partitions.elements >= 2)
{
@@ -5463,11 +5503,11 @@ sub_part_definition:
the second partition (the current partition processed
have already been put into the partitions list.
*/
- my_parse_error(ER(ER_PARTITION_WRONG_NO_SUBPART_ERROR));
+ my_parse_error(thd, ER_PARTITION_WRONG_NO_SUBPART_ERROR);
MYSQL_YYABORT;
}
if (!sub_p_elem ||
- curr_part->subpartitions.push_back(sub_p_elem))
+ curr_part->subpartitions.push_back(sub_p_elem, thd->mem_root))
{
mem_alloc_error(sizeof(partition_element));
MYSQL_YYABORT;
@@ -5578,20 +5618,6 @@ create_database_option:
| default_charset {}
;
-opt_table_options:
- /* empty */ { $$= 0; }
- | table_options { $$= $1;}
- ;
-
-table_options:
- table_option { $$=$1; }
- | table_option table_options { $$= $1 | $2; }
- ;
-
-table_option:
- TEMPORARY { $$=HA_LEX_CREATE_TMP_TABLE; }
- ;
-
opt_if_not_exists_table_element:
/* empty */
{
@@ -5687,7 +5713,7 @@ create_table_option:
Lex->create_info.table_options|= HA_OPTION_PACK_KEYS;
break;
default:
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
Lex->create_info.used_fields|= HA_CREATE_USED_PACK_KEYS;
@@ -5708,7 +5734,7 @@ create_table_option:
Lex->create_info.stats_auto_recalc= HA_STATS_AUTO_RECALC_ON;
break;
default:
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
Lex->create_info.used_fields|= HA_CREATE_USED_STATS_AUTO_RECALC;
@@ -5728,7 +5754,7 @@ create_table_option:
Lex->create_info.table_options|= HA_OPTION_STATS_PERSISTENT;
break;
default:
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
Lex->create_info.used_fields|= HA_CREATE_USED_STATS_PERSISTENT;
@@ -5751,7 +5777,7 @@ create_table_option:
we can store the higher bits from stats_sample_pages in .frm too. */
if ($3 == 0 || $3 > 0xffff)
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
Lex->create_info.stats_sample_pages=$3;
@@ -5921,7 +5947,7 @@ storage_engines:
$$= 0;
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_UNKNOWN_STORAGE_ENGINE,
- ER(ER_UNKNOWN_STORAGE_ENGINE),
+ ER_THD(thd, ER_UNKNOWN_STORAGE_ENGINE),
$1.str);
}
}
@@ -6041,31 +6067,33 @@ key_def:
| opt_constraint FOREIGN KEY_SYM opt_if_not_exists opt_ident
{
if (Lex->check_add_key($4) ||
- !(Lex->last_key= new Key(Key::MULTIPLE, $1.str ? $1 : $5,
- HA_KEY_ALG_UNDEF, true, $4)))
+ !(Lex->last_key= (new (thd->mem_root)
+ Key(Key::MULTIPLE, $1.str ? $1 : $5,
+ HA_KEY_ALG_UNDEF, true, $4))))
MYSQL_YYABORT;
Lex->option_list= NULL;
}
'(' key_list ')' references
{
LEX *lex=Lex;
- Key *key= new Foreign_key($5.str ? $5 : $1,
- lex->last_key->columns,
- $10->db,
- $10->table,
- lex->ref_list,
- lex->fk_delete_opt,
- lex->fk_update_opt,
- lex->fk_match_option,
- $4);
+ Key *key= (new (thd->mem_root)
+ Foreign_key($5.str ? $5 : $1,
+ lex->last_key->columns,
+ $10->db,
+ $10->table,
+ lex->ref_list,
+ lex->fk_delete_opt,
+ lex->fk_update_opt,
+ lex->fk_match_option,
+ $4));
if (key == NULL)
MYSQL_YYABORT;
/*
handle_if_exists_options() expectes the two keys in this order:
the Foreign_key, followed by its auto-generated Key.
*/
- lex->alter_info.key_list.push_back(key);
- lex->alter_info.key_list.push_back(Lex->last_key);
+ lex->alter_info.key_list.push_back(key, thd->mem_root);
+ lex->alter_info.key_list.push_back(Lex->last_key, thd->mem_root);
lex->option_list= NULL;
/* Only used for ALTER TABLE. Ignored otherwise. */
@@ -6096,9 +6124,9 @@ field_spec:
field_ident
{
LEX *lex=Lex;
- Create_field *f= new Create_field();
+ Create_field *f= new (thd->mem_root) Create_field();
- if (check_string_char_length(&$1, "", NAME_CHAR_LEN,
+ if (check_string_char_length(&$1, 0, NAME_CHAR_LEN,
system_charset_info, 1))
{
my_error(ER_TOO_LONG_IDENT, MYF(0), $1.str);
@@ -6119,7 +6147,7 @@ field_spec:
if (f->check(thd))
MYSQL_YYABORT;
- lex->alter_info.create_list.push_back(f);
+ lex->alter_info.create_list.push_back(f, thd->mem_root);
if (f->flags & PRI_KEY_FLAG)
add_key_to_list(lex, &$1, Key::PRIMARY, Lex->check_exists);
@@ -6191,7 +6219,7 @@ parse_vcol_expr:
*/
if (!Lex->parse_vcol_expr)
{
- my_message(ER_SYNTAX_ERROR, ER(ER_SYNTAX_ERROR), MYF(0));
+ my_message(ER_SYNTAX_ERROR, ER_THD(thd, ER_SYNTAX_ERROR), MYF(0));
MYSQL_YYABORT;
}
}
@@ -6200,7 +6228,7 @@ parse_vcol_expr:
virtual_column_func:
remember_name expr remember_end
{
- Virtual_column_info *v= new Virtual_column_info();
+ Virtual_column_info *v= new (thd->mem_root) Virtual_column_info();
if (!v)
{
mem_alloc_error(sizeof(Virtual_column_info));
@@ -6311,7 +6339,7 @@ field_type:
my_snprintf(buff, sizeof(buff), "YEAR(%lu)", length);
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_WARN_DEPRECATED_SYNTAX,
- ER(ER_WARN_DEPRECATED_SYNTAX),
+ ER_THD(thd, ER_WARN_DEPRECATED_SYNTAX),
buff, "YEAR(4)");
}
}
@@ -6541,7 +6569,7 @@ attribute:
| DEFAULT now_or_signed_literal { Lex->last_field->def= $2; }
| ON UPDATE_SYM NOW_SYM opt_default_time_precision
{
- Item *item= new (thd->mem_root) Item_func_now_local($4);
+ Item *item= new (thd->mem_root) Item_func_now_local(thd, $4);
if (item == NULL)
MYSQL_YYABORT;
Lex->last_field->on_update= item;
@@ -6629,7 +6657,7 @@ type_with_opt_collate:
now_or_signed_literal:
NOW_SYM opt_default_time_precision
{
- $$= new (thd->mem_root) Item_func_now_local($2);
+ $$= new (thd->mem_root) Item_func_now_local(thd, $2);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -6736,7 +6764,7 @@ ws_nweights:
{
if ($2 == 0)
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
}
@@ -6824,19 +6852,19 @@ opt_ref_list:
ref_list:
ref_list ',' ident
{
- Key_part_spec *key= new Key_part_spec($3, 0);
+ Key_part_spec *key= new (thd->mem_root) Key_part_spec($3, 0);
if (key == NULL)
MYSQL_YYABORT;
- Lex->ref_list.push_back(key);
+ Lex->ref_list.push_back(key, thd->mem_root);
}
| ident
{
- Key_part_spec *key= new Key_part_spec($1, 0);
+ Key_part_spec *key= new (thd->mem_root) Key_part_spec($1, 0);
if (key == NULL)
MYSQL_YYABORT;
LEX *lex= Lex;
lex->ref_list.empty();
- lex->ref_list.push_back(key);
+ lex->ref_list.push_back(key, thd->mem_root);
}
;
@@ -7046,18 +7074,18 @@ btree_or_rtree:
key_list:
key_list ',' key_part order_dir
{
- Lex->last_key->columns.push_back($3);
+ Lex->last_key->columns.push_back($3, thd->mem_root);
}
| key_part order_dir
{
- Lex->last_key->columns.push_back($1);
+ Lex->last_key->columns.push_back($1, thd->mem_root);
}
;
key_part:
ident
{
- $$= new Key_part_spec($1, 0);
+ $$= new (thd->mem_root) Key_part_spec($1, 0);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -7068,7 +7096,7 @@ key_part:
{
my_error(ER_KEY_PART_0, MYF(0), $1.str);
}
- $$= new Key_part_spec($1, (uint) key_part_len);
+ $$= new (thd->mem_root) Key_part_spec($1, (uint) key_part_len);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -7085,8 +7113,10 @@ opt_component:
;
string_list:
- text_string { Lex->last_field->interval_list.push_back($1); }
- | string_list ',' text_string { Lex->last_field->interval_list.push_back($3); };
+ text_string
+ { Lex->last_field->interval_list.push_back($1, thd->mem_root); }
+ | string_list ',' text_string
+ { Lex->last_field->interval_list.push_back($3, thd->mem_root); };
/*
** Alter table
@@ -7215,7 +7245,7 @@ alter:
my_error(ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW");
MYSQL_YYABORT;
}
- lex->create_view_algorithm= DTYPE_ALGORITHM_UNDEFINED;
+ lex->create_view_algorithm= VIEW_ALGORITHM_INHERIT;
lex->create_view_mode= VIEW_ALTER;
}
view_tail
@@ -7245,7 +7275,7 @@ alter:
{
if (!($7 || $8 || $9 || $10 || $11))
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
/*
@@ -7471,7 +7501,7 @@ add_partition_rule:
opt_no_write_to_binlog
{
LEX *lex= Lex;
- lex->part_info= new partition_info();
+ lex->part_info= new (thd->mem_root) partition_info();
if (!lex->part_info)
{
mem_alloc_error(sizeof(partition_info));
@@ -7503,7 +7533,7 @@ reorg_partition_rule:
REORGANIZE_SYM PARTITION_SYM opt_no_write_to_binlog
{
LEX *lex= Lex;
- lex->part_info= new partition_info();
+ lex->part_info= new (thd->mem_root) partition_info();
if (!lex->part_info)
{
mem_alloc_error(sizeof(partition_info));
@@ -7538,7 +7568,8 @@ alt_part_name_list:
alt_part_name_item:
ident
{
- if (Lex->alter_info.partition_names.push_back($1.str))
+ if (Lex->alter_info.partition_names.push_back($1.str,
+ thd->mem_root))
{
mem_alloc_error(1);
MYSQL_YYABORT;
@@ -7595,38 +7626,42 @@ alter_list_item:
| DROP opt_column opt_if_exists_table_element field_ident opt_restrict
{
LEX *lex=Lex;
- Alter_drop *ad= new Alter_drop(Alter_drop::COLUMN, $4.str, $3);
+ Alter_drop *ad= (new (thd->mem_root)
+ Alter_drop(Alter_drop::COLUMN, $4.str, $3));
if (ad == NULL)
MYSQL_YYABORT;
- lex->alter_info.drop_list.push_back(ad);
+ lex->alter_info.drop_list.push_back(ad, thd->mem_root);
lex->alter_info.flags|= Alter_info::ALTER_DROP_COLUMN;
}
| DROP FOREIGN KEY_SYM opt_if_exists_table_element field_ident
{
LEX *lex=Lex;
- Alter_drop *ad= new Alter_drop(Alter_drop::FOREIGN_KEY, $5.str, $4);
+ Alter_drop *ad= (new (thd->mem_root)
+ Alter_drop(Alter_drop::FOREIGN_KEY, $5.str, $4));
if (ad == NULL)
MYSQL_YYABORT;
- lex->alter_info.drop_list.push_back(ad);
+ lex->alter_info.drop_list.push_back(ad, thd->mem_root);
lex->alter_info.flags|= Alter_info::DROP_FOREIGN_KEY;
}
| DROP PRIMARY_SYM KEY_SYM
{
LEX *lex=Lex;
- Alter_drop *ad= new Alter_drop(Alter_drop::KEY, primary_key_name,
- FALSE);
+ Alter_drop *ad= (new (thd->mem_root)
+ Alter_drop(Alter_drop::KEY, primary_key_name,
+ FALSE));
if (ad == NULL)
MYSQL_YYABORT;
- lex->alter_info.drop_list.push_back(ad);
+ lex->alter_info.drop_list.push_back(ad, thd->mem_root);
lex->alter_info.flags|= Alter_info::ALTER_DROP_INDEX;
}
| DROP key_or_index opt_if_exists_table_element field_ident
{
LEX *lex=Lex;
- Alter_drop *ad= new Alter_drop(Alter_drop::KEY, $4.str, $3);
+ Alter_drop *ad= (new (thd->mem_root)
+ Alter_drop(Alter_drop::KEY, $4.str, $3));
if (ad == NULL)
MYSQL_YYABORT;
- lex->alter_info.drop_list.push_back(ad);
+ lex->alter_info.drop_list.push_back(ad, thd->mem_root);
lex->alter_info.flags|= Alter_info::ALTER_DROP_INDEX;
}
| DISABLE_SYM KEYS
@@ -7644,19 +7679,20 @@ alter_list_item:
| ALTER opt_column field_ident SET DEFAULT signed_literal
{
LEX *lex=Lex;
- Alter_column *ac= new Alter_column($3.str,$6);
+ Alter_column *ac= new (thd->mem_root) Alter_column($3.str,$6);
if (ac == NULL)
MYSQL_YYABORT;
- lex->alter_info.alter_list.push_back(ac);
+ lex->alter_info.alter_list.push_back(ac, thd->mem_root);
lex->alter_info.flags|= Alter_info::ALTER_CHANGE_COLUMN_DEFAULT;
}
| ALTER opt_column field_ident DROP DEFAULT
{
LEX *lex=Lex;
- Alter_column *ac= new Alter_column($3.str, (Item*) 0);
+ Alter_column *ac= (new (thd->mem_root)
+ Alter_column($3.str, (Item*) 0));
if (ac == NULL)
MYSQL_YYABORT;
- lex->alter_info.alter_list.push_back(ac);
+ lex->alter_info.alter_list.push_back(ac, thd->mem_root);
lex->alter_info.flags|= Alter_info::ALTER_CHANGE_COLUMN_DEFAULT;
}
| RENAME opt_to table_ident
@@ -7860,7 +7896,7 @@ start:
if (($3 & MYSQL_START_TRANS_OPT_READ_WRITE) &&
($3 & MYSQL_START_TRANS_OPT_READ_ONLY))
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
lex->start_transaction_opt= $3;
@@ -7932,7 +7968,7 @@ slave_until:
(lex->mi.relay_log_name && lex->mi.relay_log_pos)))
{
my_message(ER_BAD_SLAVE_UNTIL_COND,
- ER(ER_BAD_SLAVE_UNTIL_COND), MYF(0));
+ ER_THD(thd, ER_BAD_SLAVE_UNTIL_COND), MYF(0));
MYSQL_YYABORT;
}
}
@@ -7965,8 +8001,13 @@ opt_checksum_type:
| EXTENDED_SYM { Lex->check_opt.flags= T_EXTEND; }
;
+repair_table_or_view:
+ table_or_tables table_list opt_mi_repair_type
+ | VIEW_SYM { Lex->only_view= TRUE; } table_list opt_view_repair_type
+ ;
+
repair:
- REPAIR opt_no_write_to_binlog table_or_view
+ REPAIR opt_no_write_to_binlog
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_REPAIR;
@@ -7976,18 +8017,9 @@ repair:
/* Will be overriden during execution. */
YYPS->m_lock_type= TL_UNLOCK;
}
- table_list opt_mi_repair_type
+ repair_table_or_view
{
LEX* lex= thd->lex;
- if ((lex->only_view &&
- ((lex->check_opt.flags & (T_QUICK | T_EXTEND)) ||
- (lex->check_opt.sql_flags & TT_USEFRM))) ||
- (!lex->only_view &&
- (lex->check_opt.sql_flags & TT_FROM_MYSQL)))
- {
- my_parse_error(ER(ER_SYNTAX_ERROR));
- MYSQL_YYABORT;
- }
DBUG_ASSERT(!lex->m_sql_cmd);
lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_repair_table();
if (lex->m_sql_cmd == NULL)
@@ -8009,6 +8041,10 @@ mi_repair_type:
QUICK { Lex->check_opt.flags|= T_QUICK; }
| EXTENDED_SYM { Lex->check_opt.flags|= T_EXTEND; }
| USE_FRM { Lex->check_opt.sql_flags|= TT_USEFRM; }
+ ;
+
+opt_view_repair_type:
+ /* empty */ { }
| FROM MYSQL_SYM { Lex->check_opt.sql_flags|= TT_FROM_MYSQL; }
;
@@ -8062,7 +8098,7 @@ persistent_column_stat_spec:
| '('
{
LEX* lex= thd->lex;
- lex->column_list= new List<LEX_STRING>;
+ lex->column_list= new (thd->mem_root) List<LEX_STRING>;
if (lex->column_list == NULL)
MYSQL_YYABORT;
}
@@ -8075,7 +8111,7 @@ persistent_index_stat_spec:
| '('
{
LEX* lex= thd->lex;
- lex->index_list= new List<LEX_STRING>;
+ lex->index_list= new (thd->mem_root) List<LEX_STRING>;
if (lex->index_list == NULL)
MYSQL_YYABORT;
}
@@ -8089,12 +8125,12 @@ table_column_list:
| ident
{
Lex->column_list->push_back((LEX_STRING*)
- thd->memdup(&$1, sizeof(LEX_STRING)));
+ thd->memdup(&$1, sizeof(LEX_STRING)), thd->mem_root);
}
| table_column_list ',' ident
{
Lex->column_list->push_back((LEX_STRING*)
- thd->memdup(&$3, sizeof(LEX_STRING)));
+ thd->memdup(&$3, sizeof(LEX_STRING)), thd->mem_root);
}
;
@@ -8108,15 +8144,17 @@ table_index_list:
table_index_name:
ident
{
- Lex->index_list->push_back(
- (LEX_STRING*) thd->memdup(&$1, sizeof(LEX_STRING)));
+ Lex->index_list->push_back((LEX_STRING*)
+ thd->memdup(&$1, sizeof(LEX_STRING)),
+ thd->mem_root);
}
|
PRIMARY_SYM
{
LEX_STRING str= {(char*) "PRIMARY", 7};
- Lex->index_list->push_back(
- (LEX_STRING*) thd->memdup(&str, sizeof(LEX_STRING)));
+ Lex->index_list->push_back((LEX_STRING*)
+ thd->memdup(&str, sizeof(LEX_STRING)),
+ thd->mem_root);
}
;
@@ -8128,30 +8166,27 @@ binlog_base64_event:
}
;
-check:
- CHECK_SYM table_or_view
+check_view_or_table:
+ table_or_tables table_list opt_mi_check_type
+ | VIEW_SYM { Lex->only_view= TRUE; } table_list opt_view_check_type
+ ;
+
+check: CHECK_SYM
{
LEX *lex=Lex;
- if (lex->sphead)
- {
- my_error(ER_SP_BADSTATEMENT, MYF(0), "CHECK");
- MYSQL_YYABORT;
- }
lex->sql_command = SQLCOM_CHECK;
lex->check_opt.init();
lex->alter_info.reset();
/* Will be overriden during execution. */
YYPS->m_lock_type= TL_UNLOCK;
}
- table_list opt_mi_check_type
+ check_view_or_table
{
LEX* lex= thd->lex;
- if (lex->only_view &&
- (lex->check_opt.flags & (T_QUICK | T_FAST | T_EXTEND |
- T_CHECK_ONLY_CHANGED)))
+ if (lex->sphead)
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_error(ER_SP_BADSTATEMENT, MYF(0), "CHECK");
MYSQL_YYABORT;
}
DBUG_ASSERT(!lex->m_sql_cmd);
@@ -8180,6 +8215,11 @@ mi_check_type:
| FOR_SYM UPGRADE_SYM { Lex->check_opt.sql_flags|= TT_FOR_UPGRADE; }
;
+opt_view_check_type:
+ /* empty */ { }
+ | FOR_SYM UPGRADE_SYM { Lex->check_opt.sql_flags|= TT_FOR_UPGRADE; }
+ ;
+
optimize:
OPTIMIZE opt_no_write_to_binlog table_or_tables
{
@@ -8223,12 +8263,14 @@ rename:
rename_list:
user TO_SYM user
{
- if (Lex->users_list.push_back($1) || Lex->users_list.push_back($3))
+ if (Lex->users_list.push_back($1, thd->mem_root) ||
+ Lex->users_list.push_back($3, thd->mem_root))
MYSQL_YYABORT;
}
| rename_list ',' user TO_SYM user
{
- if (Lex->users_list.push_back($3) || Lex->users_list.push_back($5))
+ if (Lex->users_list.push_back($3, thd->mem_root) ||
+ Lex->users_list.push_back($5, thd->mem_root))
MYSQL_YYABORT;
}
;
@@ -8261,7 +8303,6 @@ keycache:
LEX *lex=Lex;
lex->sql_command= SQLCOM_ASSIGN_TO_KEYCACHE;
lex->ident= $6;
- lex->only_view= FALSE;
}
;
@@ -8306,7 +8347,6 @@ preload:
LEX *lex=Lex;
lex->sql_command=SQLCOM_PRELOAD_KEYS;
lex->alter_info.reset();
- lex->only_view= FALSE;
}
preload_list_or_parts
{}
@@ -8567,7 +8607,7 @@ select_item_list:
| '*'
{
Item *item= new (thd->mem_root)
- Item_field(&thd->lex->current_select->context,
+ Item_field(thd, &thd->lex->current_select->context,
NULL, NULL, "*");
if (item == NULL)
MYSQL_YYABORT;
@@ -8682,7 +8722,7 @@ expr:
/*
(X1 OR X2) OR Y ==> OR (X1, X2, Y)
*/
- item1->add($3);
+ item1->add($3, thd->mem_root);
$$ = $1;
}
}
@@ -8692,13 +8732,13 @@ expr:
/*
X OR (Y1 OR Y2) ==> OR (X, Y1, Y2)
*/
- item3->add_at_head($1);
+ item3->add_at_head($1, thd->mem_root);
$$ = $3;
}
else
{
/* X OR Y */
- $$ = new (thd->mem_root) Item_cond_or($1, $3);
+ $$= new (thd->mem_root) Item_cond_or(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -8706,7 +8746,7 @@ expr:
| expr XOR expr %prec XOR
{
/* XOR is a proprietary extension */
- $$ = new (thd->mem_root) Item_func_xor($1, $3);
+ $$= new (thd->mem_root) Item_func_xor(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -8732,7 +8772,7 @@ expr:
/*
(X1 AND X2) AND Y ==> AND (X1, X2, Y)
*/
- item1->add($3);
+ item1->add($3, thd->mem_root);
$$ = $1;
}
}
@@ -8742,13 +8782,13 @@ expr:
/*
X AND (Y1 AND Y2) ==> AND (X, Y1, Y2)
*/
- item3->add_at_head($1);
+ item3->add_at_head($1, thd->mem_root);
$$ = $3;
}
else
{
/* X AND Y */
- $$ = new (thd->mem_root) Item_cond_and($1, $3);
+ $$= new (thd->mem_root) Item_cond_and(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -8761,37 +8801,37 @@ expr:
}
| bool_pri IS TRUE_SYM %prec IS
{
- $$= new (thd->mem_root) Item_func_istrue($1);
+ $$= new (thd->mem_root) Item_func_istrue(thd, $1);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bool_pri IS not TRUE_SYM %prec IS
{
- $$= new (thd->mem_root) Item_func_isnottrue($1);
+ $$= new (thd->mem_root) Item_func_isnottrue(thd, $1);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bool_pri IS FALSE_SYM %prec IS
{
- $$= new (thd->mem_root) Item_func_isfalse($1);
+ $$= new (thd->mem_root) Item_func_isfalse(thd, $1);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bool_pri IS not FALSE_SYM %prec IS
{
- $$= new (thd->mem_root) Item_func_isnotfalse($1);
+ $$= new (thd->mem_root) Item_func_isnotfalse(thd, $1);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bool_pri IS UNKNOWN_SYM %prec IS
{
- $$= new (thd->mem_root) Item_func_isnull($1);
+ $$= new (thd->mem_root) Item_func_isnull(thd, $1);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bool_pri IS not UNKNOWN_SYM %prec IS
{
- $$= new (thd->mem_root) Item_func_isnotnull($1);
+ $$= new (thd->mem_root) Item_func_isnotnull(thd, $1);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -8801,25 +8841,25 @@ expr:
bool_pri:
bool_pri IS NULL_SYM %prec IS
{
- $$= new (thd->mem_root) Item_func_isnull($1);
+ $$= new (thd->mem_root) Item_func_isnull(thd, $1);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bool_pri IS not NULL_SYM %prec IS
{
- $$= new (thd->mem_root) Item_func_isnotnull($1);
+ $$= new (thd->mem_root) Item_func_isnotnull(thd, $1);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bool_pri EQUAL_SYM predicate %prec EQUAL_SYM
{
- $$= new (thd->mem_root) Item_func_equal($1,$3);
+ $$= new (thd->mem_root) Item_func_equal(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bool_pri comp_op predicate %prec EQ
{
- $$= (*$2)(0)->create(thd->mem_root, $1, $3);
+ $$= (*$2)(0)->create(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -8856,9 +8896,9 @@ predicate:
}
| bit_expr IN_SYM '(' expr ',' expr_list ')'
{
- $6->push_front($4);
- $6->push_front($1);
- $$= new (thd->mem_root) Item_func_in(*$6);
+ $6->push_front($4, thd->mem_root);
+ $6->push_front($1, thd->mem_root);
+ $$= new (thd->mem_root) Item_func_in(thd, *$6);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -8870,9 +8910,9 @@ predicate:
}
| bit_expr not IN_SYM '(' expr ',' expr_list ')'
{
- $7->push_front($5);
- $7->push_front($1);
- Item_func_in *item = new (thd->mem_root) Item_func_in(*$7);
+ $7->push_front($5, thd->mem_root);
+ $7->push_front($1, thd->mem_root);
+ Item_func_in *item= new (thd->mem_root) Item_func_in(thd, *$7);
if (item == NULL)
MYSQL_YYABORT;
item->negate();
@@ -8880,14 +8920,14 @@ predicate:
}
| bit_expr BETWEEN_SYM bit_expr AND_SYM predicate
{
- $$= new (thd->mem_root) Item_func_between($1,$3,$5);
+ $$= new (thd->mem_root) Item_func_between(thd, $1, $3, $5);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bit_expr not BETWEEN_SYM bit_expr AND_SYM predicate
{
Item_func_between *item;
- item= new (thd->mem_root) Item_func_between($1,$4,$6);
+ item= new (thd->mem_root) Item_func_between(thd, $1, $4, $6);
if (item == NULL)
MYSQL_YYABORT;
item->negate();
@@ -8895,39 +8935,40 @@ predicate:
}
| bit_expr SOUNDS_SYM LIKE bit_expr
{
- Item *item1= new (thd->mem_root) Item_func_soundex($1);
- Item *item4= new (thd->mem_root) Item_func_soundex($4);
+ Item *item1= new (thd->mem_root) Item_func_soundex(thd, $1);
+ Item *item4= new (thd->mem_root) Item_func_soundex(thd, $4);
if ((item1 == NULL) || (item4 == NULL))
MYSQL_YYABORT;
- $$= new (thd->mem_root) Item_func_eq(item1, item4);
+ $$= new (thd->mem_root) Item_func_eq(thd, item1, item4);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bit_expr LIKE simple_expr opt_escape
{
- $$= new (thd->mem_root) Item_func_like($1,$3,$4,Lex->escape_used);
+ $$= new (thd->mem_root) Item_func_like(thd, $1, $3, $4,
+ Lex->escape_used);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bit_expr not LIKE simple_expr opt_escape
{
- Item *item= new (thd->mem_root) Item_func_like($1,$4,$5,
+ Item *item= new (thd->mem_root) Item_func_like(thd, $1, $4, $5,
Lex->escape_used);
if (item == NULL)
MYSQL_YYABORT;
- $$= new (thd->mem_root) Item_func_not(item);
+ $$= new (thd->mem_root) Item_func_not(thd, item);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bit_expr REGEXP bit_expr
{
- $$= new (thd->mem_root) Item_func_regex($1,$3);
+ $$= new (thd->mem_root) Item_func_regex(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bit_expr not REGEXP bit_expr
{
- Item *item= new (thd->mem_root) Item_func_regex($1,$4);
+ Item *item= new (thd->mem_root) Item_func_regex(thd, $1, $4);
if (item == NULL)
MYSQL_YYABORT;
$$= negate_expression(thd, item);
@@ -8940,85 +8981,85 @@ predicate:
bit_expr:
bit_expr '|' bit_expr %prec '|'
{
- $$= new (thd->mem_root) Item_func_bit_or($1,$3);
+ $$= new (thd->mem_root) Item_func_bit_or(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bit_expr '&' bit_expr %prec '&'
{
- $$= new (thd->mem_root) Item_func_bit_and($1,$3);
+ $$= new (thd->mem_root) Item_func_bit_and(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bit_expr SHIFT_LEFT bit_expr %prec SHIFT_LEFT
{
- $$= new (thd->mem_root) Item_func_shift_left($1,$3);
+ $$= new (thd->mem_root) Item_func_shift_left(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bit_expr SHIFT_RIGHT bit_expr %prec SHIFT_RIGHT
{
- $$= new (thd->mem_root) Item_func_shift_right($1,$3);
+ $$= new (thd->mem_root) Item_func_shift_right(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bit_expr '+' bit_expr %prec '+'
{
- $$= new (thd->mem_root) Item_func_plus($1,$3);
+ $$= new (thd->mem_root) Item_func_plus(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bit_expr '-' bit_expr %prec '-'
{
- $$= new (thd->mem_root) Item_func_minus($1,$3);
+ $$= new (thd->mem_root) Item_func_minus(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bit_expr '+' INTERVAL_SYM expr interval %prec '+'
{
- $$= new (thd->mem_root) Item_date_add_interval($1,$4,$5,0);
+ $$= new (thd->mem_root) Item_date_add_interval(thd, $1, $4, $5, 0);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bit_expr '-' INTERVAL_SYM expr interval %prec '-'
{
- $$= new (thd->mem_root) Item_date_add_interval($1,$4,$5,1);
+ $$= new (thd->mem_root) Item_date_add_interval(thd, $1, $4, $5, 1);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bit_expr '*' bit_expr %prec '*'
{
- $$= new (thd->mem_root) Item_func_mul($1,$3);
+ $$= new (thd->mem_root) Item_func_mul(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bit_expr '/' bit_expr %prec '/'
{
- $$= new (thd->mem_root) Item_func_div($1,$3);
+ $$= new (thd->mem_root) Item_func_div(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bit_expr '%' bit_expr %prec '%'
{
- $$= new (thd->mem_root) Item_func_mod($1,$3);
+ $$= new (thd->mem_root) Item_func_mod(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bit_expr DIV_SYM bit_expr %prec DIV_SYM
{
- $$= new (thd->mem_root) Item_func_int_div($1,$3);
+ $$= new (thd->mem_root) Item_func_int_div(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bit_expr MOD_SYM bit_expr %prec MOD_SYM
{
- $$= new (thd->mem_root) Item_func_mod($1,$3);
+ $$= new (thd->mem_root) Item_func_mod(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| bit_expr '^' bit_expr
{
- $$= new (thd->mem_root) Item_func_bit_xor($1,$3);
+ $$= new (thd->mem_root) Item_func_bit_xor(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -9179,11 +9220,11 @@ dyncall_create_list:
$$= new (thd->mem_root) List<DYNCALL_CREATE_DEF>;
if ($$ == NULL)
MYSQL_YYABORT;
- $$->push_back($1);
+ $$->push_back($1, thd->mem_root);
}
| dyncall_create_list ',' dyncall_create_element
{
- $1->push_back($3);
+ $1->push_back($3, thd->mem_root);
$$= $1;
}
;
@@ -9196,12 +9237,12 @@ simple_expr:
| function_call_conflict
| simple_expr COLLATE_SYM ident_or_text %prec NEG
{
- Item *i1= new (thd->mem_root) Item_string($3.str,
+ Item *i1= new (thd->mem_root) Item_string(thd, $3.str,
$3.length,
thd->charset());
if (i1 == NULL)
MYSQL_YYABORT;
- $$= new (thd->mem_root) Item_func_set_collation($1, i1);
+ $$= new (thd->mem_root) Item_func_set_collation(thd, $1, i1);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -9211,7 +9252,7 @@ simple_expr:
| sum_expr
| simple_expr OR_OR_SYM simple_expr
{
- $$= new (thd->mem_root) Item_func_concat($1, $3);
+ $$= new (thd->mem_root) Item_func_concat(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -9221,13 +9262,13 @@ simple_expr:
}
| '-' simple_expr %prec NEG
{
- $$= new (thd->mem_root) Item_func_neg($2);
+ $$= new (thd->mem_root) Item_func_neg(thd, $2);
if ($$ == NULL)
MYSQL_YYABORT;
}
| '~' simple_expr %prec NEG
{
- $$= new (thd->mem_root) Item_func_bit_neg($2);
+ $$= new (thd->mem_root) Item_func_bit_neg(thd, $2);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -9247,15 +9288,15 @@ simple_expr:
{ $$= $2; }
| '(' expr ',' expr_list ')'
{
- $4->push_front($2);
- $$= new (thd->mem_root) Item_row(*$4);
+ $4->push_front($2, thd->mem_root);
+ $$= new (thd->mem_root) Item_row(thd, *$4);
if ($$ == NULL)
MYSQL_YYABORT;
}
| ROW_SYM '(' expr ',' expr_list ')'
{
- $5->push_front($3);
- $$= new (thd->mem_root) Item_row(*$5);
+ $5->push_front($3, thd->mem_root);
+ $$= new (thd->mem_root) Item_row(thd, *$5);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -9291,11 +9332,12 @@ simple_expr:
}
| MATCH ident_list_arg AGAINST '(' bit_expr fulltext_options ')'
{
- $2->push_front($5);
- Item_func_match *i1= new (thd->mem_root) Item_func_match(*$2, $6);
+ $2->push_front($5, thd->mem_root);
+ Item_func_match *i1= new (thd->mem_root) Item_func_match(thd, *$2,
+ $6);
if (i1 == NULL)
MYSQL_YYABORT;
- Select->add_ftfunc_to_list(i1);
+ Select->add_ftfunc_to_list(thd, i1);
$$= i1;
}
| BINARY simple_expr %prec NEG
@@ -9315,7 +9357,7 @@ simple_expr:
}
| CASE_SYM opt_expr when_list opt_else END
{
- $$= new (thd->mem_root) Item_func_case(* $3, $2, $4 );
+ $$= new (thd->mem_root) Item_func_case(thd, *$3, $2, $4);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -9328,7 +9370,7 @@ simple_expr:
}
| CONVERT_SYM '(' expr USING charset_name ')'
{
- $$= new (thd->mem_root) Item_func_conv_charset($3,$5);
+ $$= new (thd->mem_root) Item_func_conv_charset(thd, $3, $5);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -9341,14 +9383,14 @@ simple_expr:
my_error(ER_WRONG_COLUMN_NAME, MYF(0), il->my_name()->str);
MYSQL_YYABORT;
}
- $$= new (thd->mem_root) Item_default_value(Lex->current_context(),
+ $$= new (thd->mem_root) Item_default_value(thd, Lex->current_context(),
$3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| VALUES '(' simple_ident_nospvar ')'
{
- $$= new (thd->mem_root) Item_insert_value(Lex->current_context(),
+ $$= new (thd->mem_root) Item_insert_value(thd, Lex->current_context(),
$3);
if ($$ == NULL)
MYSQL_YYABORT;
@@ -9356,7 +9398,7 @@ simple_expr:
| INTERVAL_SYM expr interval '+' expr %prec INTERVAL_SYM
/* we cannot put interval before - */
{
- $$= new (thd->mem_root) Item_date_add_interval($5,$2,$3,0);
+ $$= new (thd->mem_root) Item_date_add_interval(thd, $5, $2, $3, 0);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -9371,19 +9413,20 @@ simple_expr:
function_call_keyword:
CHAR_SYM '(' expr_list ')'
{
- $$= new (thd->mem_root) Item_func_char(*$3);
+ $$= new (thd->mem_root) Item_func_char(thd, *$3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| CHAR_SYM '(' expr_list USING charset_name ')'
{
- $$= new (thd->mem_root) Item_func_char(*$3, $5);
+ $$= new (thd->mem_root) Item_func_char(thd, *$3, $5);
if ($$ == NULL)
MYSQL_YYABORT;
}
| CURRENT_USER optional_braces
{
- $$= new (thd->mem_root) Item_func_current_user(Lex->current_context());
+ $$= new (thd->mem_root) Item_func_current_user(thd,
+ Lex->current_context());
if ($$ == NULL)
MYSQL_YYABORT;
Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
@@ -9391,7 +9434,8 @@ function_call_keyword:
}
| CURRENT_ROLE optional_braces
{
- $$= new (thd->mem_root) Item_func_current_role(Lex->current_context());
+ $$= new (thd->mem_root) Item_func_current_role(thd,
+ Lex->current_context());
if ($$ == NULL)
MYSQL_YYABORT;
Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
@@ -9399,25 +9443,25 @@ function_call_keyword:
}
| DATE_SYM '(' expr ')'
{
- $$= new (thd->mem_root) Item_date_typecast($3);
+ $$= new (thd->mem_root) Item_date_typecast(thd, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| DAY_SYM '(' expr ')'
{
- $$= new (thd->mem_root) Item_func_dayofmonth($3);
+ $$= new (thd->mem_root) Item_func_dayofmonth(thd, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| HOUR_SYM '(' expr ')'
{
- $$= new (thd->mem_root) Item_func_hour($3);
+ $$= new (thd->mem_root) Item_func_hour(thd, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| INSERT '(' expr ',' expr ',' expr ',' expr ')'
{
- $$= new (thd->mem_root) Item_func_insert($3,$5,$7,$9);
+ $$= new (thd->mem_root) Item_func_insert(thd, $3, $5, $7, $9);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -9426,125 +9470,127 @@ function_call_keyword:
List<Item> *list= new (thd->mem_root) List<Item>;
if (list == NULL)
MYSQL_YYABORT;
- list->push_front($5);
- list->push_front($3);
- Item_row *item= new (thd->mem_root) Item_row(*list);
+ list->push_front($5, thd->mem_root);
+ list->push_front($3, thd->mem_root);
+ Item_row *item= new (thd->mem_root) Item_row(thd, *list);
if (item == NULL)
MYSQL_YYABORT;
- $$= new (thd->mem_root) Item_func_interval(item);
+ $$= new (thd->mem_root) Item_func_interval(thd, item);
if ($$ == NULL)
MYSQL_YYABORT;
}
| INTERVAL_SYM '(' expr ',' expr ',' expr_list ')' %prec INTERVAL_SYM
{
- $7->push_front($5);
- $7->push_front($3);
- Item_row *item= new (thd->mem_root) Item_row(*$7);
+ $7->push_front($5, thd->mem_root);
+ $7->push_front($3, thd->mem_root);
+ Item_row *item= new (thd->mem_root) Item_row(thd, *$7);
if (item == NULL)
MYSQL_YYABORT;
- $$= new (thd->mem_root) Item_func_interval(item);
+ $$= new (thd->mem_root) Item_func_interval(thd, item);
if ($$ == NULL)
MYSQL_YYABORT;
}
| LEFT '(' expr ',' expr ')'
{
- $$= new (thd->mem_root) Item_func_left($3,$5);
+ $$= new (thd->mem_root) Item_func_left(thd, $3, $5);
if ($$ == NULL)
MYSQL_YYABORT;
}
| MINUTE_SYM '(' expr ')'
{
- $$= new (thd->mem_root) Item_func_minute($3);
+ $$= new (thd->mem_root) Item_func_minute(thd, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| MONTH_SYM '(' expr ')'
{
- $$= new (thd->mem_root) Item_func_month($3);
+ $$= new (thd->mem_root) Item_func_month(thd, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| RIGHT '(' expr ',' expr ')'
{
- $$= new (thd->mem_root) Item_func_right($3,$5);
+ $$= new (thd->mem_root) Item_func_right(thd, $3, $5);
if ($$ == NULL)
MYSQL_YYABORT;
}
| SECOND_SYM '(' expr ')'
{
- $$= new (thd->mem_root) Item_func_second($3);
+ $$= new (thd->mem_root) Item_func_second(thd, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| TIME_SYM '(' expr ')'
{
- $$= new (thd->mem_root) Item_time_typecast($3, AUTO_SEC_PART_DIGITS);
+ $$= new (thd->mem_root) Item_time_typecast(thd, $3,
+ AUTO_SEC_PART_DIGITS);
if ($$ == NULL)
MYSQL_YYABORT;
}
| TIMESTAMP '(' expr ')'
{
- $$= new (thd->mem_root) Item_datetime_typecast($3, AUTO_SEC_PART_DIGITS);
+ $$= new (thd->mem_root) Item_datetime_typecast(thd, $3,
+ AUTO_SEC_PART_DIGITS);
if ($$ == NULL)
MYSQL_YYABORT;
}
| TIMESTAMP '(' expr ',' expr ')'
{
- $$= new (thd->mem_root) Item_func_add_time($3, $5, 1, 0);
+ $$= new (thd->mem_root) Item_func_add_time(thd, $3, $5, 1, 0);
if ($$ == NULL)
MYSQL_YYABORT;
}
| TRIM '(' expr ')'
{
- $$= new (thd->mem_root) Item_func_trim($3);
+ $$= new (thd->mem_root) Item_func_trim(thd, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| TRIM '(' LEADING expr FROM expr ')'
{
- $$= new (thd->mem_root) Item_func_ltrim($6,$4);
+ $$= new (thd->mem_root) Item_func_ltrim(thd, $6, $4);
if ($$ == NULL)
MYSQL_YYABORT;
}
| TRIM '(' TRAILING expr FROM expr ')'
{
- $$= new (thd->mem_root) Item_func_rtrim($6,$4);
+ $$= new (thd->mem_root) Item_func_rtrim(thd, $6, $4);
if ($$ == NULL)
MYSQL_YYABORT;
}
| TRIM '(' BOTH expr FROM expr ')'
{
- $$= new (thd->mem_root) Item_func_trim($6,$4);
+ $$= new (thd->mem_root) Item_func_trim(thd, $6, $4);
if ($$ == NULL)
MYSQL_YYABORT;
}
| TRIM '(' LEADING FROM expr ')'
{
- $$= new (thd->mem_root) Item_func_ltrim($5);
+ $$= new (thd->mem_root) Item_func_ltrim(thd, $5);
if ($$ == NULL)
MYSQL_YYABORT;
}
| TRIM '(' TRAILING FROM expr ')'
{
- $$= new (thd->mem_root) Item_func_rtrim($5);
+ $$= new (thd->mem_root) Item_func_rtrim(thd, $5);
if ($$ == NULL)
MYSQL_YYABORT;
}
| TRIM '(' BOTH FROM expr ')'
{
- $$= new (thd->mem_root) Item_func_trim($5);
+ $$= new (thd->mem_root) Item_func_trim(thd, $5);
if ($$ == NULL)
MYSQL_YYABORT;
}
| TRIM '(' expr FROM expr ')'
{
- $$= new (thd->mem_root) Item_func_trim($5,$3);
+ $$= new (thd->mem_root) Item_func_trim(thd, $5, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| USER '(' ')'
{
- $$= new (thd->mem_root) Item_func_user();
+ $$= new (thd->mem_root) Item_func_user(thd);
if ($$ == NULL)
MYSQL_YYABORT;
Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
@@ -9552,7 +9598,7 @@ function_call_keyword:
}
| YEAR_SYM '(' expr ')'
{
- $$= new (thd->mem_root) Item_func_year($3);
+ $$= new (thd->mem_root) Item_func_year(thd, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -9573,27 +9619,27 @@ function_call_keyword:
function_call_nonkeyword:
ADDDATE_SYM '(' expr ',' expr ')'
{
- $$= new (thd->mem_root) Item_date_add_interval($3, $5,
+ $$= new (thd->mem_root) Item_date_add_interval(thd, $3, $5,
INTERVAL_DAY, 0);
if ($$ == NULL)
MYSQL_YYABORT;
}
| ADDDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')'
{
- $$= new (thd->mem_root) Item_date_add_interval($3, $6, $7, 0);
+ $$= new (thd->mem_root) Item_date_add_interval(thd, $3, $6, $7, 0);
if ($$ == NULL)
MYSQL_YYABORT;
}
| CURDATE optional_braces
{
- $$= new (thd->mem_root) Item_func_curdate_local();
+ $$= new (thd->mem_root) Item_func_curdate_local(thd);
if ($$ == NULL)
MYSQL_YYABORT;
Lex->safe_to_cache_query=0;
}
| CURTIME opt_time_precision
{
- $$= new (thd->mem_root) Item_func_curtime_local($2);
+ $$= new (thd->mem_root) Item_func_curtime_local(thd, $2);
if ($$ == NULL)
MYSQL_YYABORT;
Lex->safe_to_cache_query=0;
@@ -9601,76 +9647,76 @@ function_call_nonkeyword:
| DATE_ADD_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')'
%prec INTERVAL_SYM
{
- $$= new (thd->mem_root) Item_date_add_interval($3,$6,$7,0);
+ $$= new (thd->mem_root) Item_date_add_interval(thd, $3, $6, $7, 0);
if ($$ == NULL)
MYSQL_YYABORT;
}
| DATE_SUB_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')'
%prec INTERVAL_SYM
{
- $$= new (thd->mem_root) Item_date_add_interval($3,$6,$7,1);
+ $$= new (thd->mem_root) Item_date_add_interval(thd, $3, $6, $7, 1);
if ($$ == NULL)
MYSQL_YYABORT;
}
| EXTRACT_SYM '(' interval FROM expr ')'
{
- $$=new (thd->mem_root) Item_extract( $3, $5);
+ $$=new (thd->mem_root) Item_extract(thd, $3, $5);
if ($$ == NULL)
MYSQL_YYABORT;
}
| GET_FORMAT '(' date_time_type ',' expr ')'
{
- $$= new (thd->mem_root) Item_func_get_format($3, $5);
+ $$= new (thd->mem_root) Item_func_get_format(thd, $3, $5);
if ($$ == NULL)
MYSQL_YYABORT;
}
| NOW_SYM opt_time_precision
{
- $$= new (thd->mem_root) Item_func_now_local($2);
+ $$= new (thd->mem_root) Item_func_now_local(thd, $2);
if ($$ == NULL)
MYSQL_YYABORT;
Lex->safe_to_cache_query=0;
}
| POSITION_SYM '(' bit_expr IN_SYM expr ')'
{
- $$ = new (thd->mem_root) Item_func_locate($5,$3);
+ $$= new (thd->mem_root) Item_func_locate(thd, $5, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| SUBDATE_SYM '(' expr ',' expr ')'
{
- $$= new (thd->mem_root) Item_date_add_interval($3, $5,
+ $$= new (thd->mem_root) Item_date_add_interval(thd, $3, $5,
INTERVAL_DAY, 1);
if ($$ == NULL)
MYSQL_YYABORT;
}
| SUBDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')'
{
- $$= new (thd->mem_root) Item_date_add_interval($3, $6, $7, 1);
+ $$= new (thd->mem_root) Item_date_add_interval(thd, $3, $6, $7, 1);
if ($$ == NULL)
MYSQL_YYABORT;
}
| SUBSTRING '(' expr ',' expr ',' expr ')'
{
- $$= new (thd->mem_root) Item_func_substr($3,$5,$7);
+ $$= new (thd->mem_root) Item_func_substr(thd, $3, $5, $7);
if ($$ == NULL)
MYSQL_YYABORT;
}
| SUBSTRING '(' expr ',' expr ')'
{
- $$= new (thd->mem_root) Item_func_substr($3,$5);
+ $$= new (thd->mem_root) Item_func_substr(thd, $3, $5);
if ($$ == NULL)
MYSQL_YYABORT;
}
| SUBSTRING '(' expr FROM expr FOR_SYM expr ')'
{
- $$= new (thd->mem_root) Item_func_substr($3,$5,$7);
+ $$= new (thd->mem_root) Item_func_substr(thd, $3, $5, $7);
if ($$ == NULL)
MYSQL_YYABORT;
}
| SUBSTRING '(' expr FROM expr ')'
{
- $$= new (thd->mem_root) Item_func_substr($3,$5);
+ $$= new (thd->mem_root) Item_func_substr(thd, $3, $5);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -9685,42 +9731,42 @@ function_call_nonkeyword:
*/
Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
if (global_system_variables.sysdate_is_now == 0)
- $$= new (thd->mem_root) Item_func_sysdate_local($2);
+ $$= new (thd->mem_root) Item_func_sysdate_local(thd, $2);
else
- $$= new (thd->mem_root) Item_func_now_local($2);
+ $$= new (thd->mem_root) Item_func_now_local(thd, $2);
if ($$ == NULL)
MYSQL_YYABORT;
Lex->safe_to_cache_query=0;
}
| TIMESTAMP_ADD '(' interval_time_stamp ',' expr ',' expr ')'
{
- $$= new (thd->mem_root) Item_date_add_interval($7,$5,$3,0);
+ $$= new (thd->mem_root) Item_date_add_interval(thd, $7, $5, $3, 0);
if ($$ == NULL)
MYSQL_YYABORT;
}
| TIMESTAMP_DIFF '(' interval_time_stamp ',' expr ',' expr ')'
{
- $$= new (thd->mem_root) Item_func_timestamp_diff($5,$7,$3);
+ $$= new (thd->mem_root) Item_func_timestamp_diff(thd, $5, $7, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| UTC_DATE_SYM optional_braces
{
- $$= new (thd->mem_root) Item_func_curdate_utc();
+ $$= new (thd->mem_root) Item_func_curdate_utc(thd);
if ($$ == NULL)
MYSQL_YYABORT;
Lex->safe_to_cache_query=0;
}
| UTC_TIME_SYM opt_time_precision
{
- $$= new (thd->mem_root) Item_func_curtime_utc($2);
+ $$= new (thd->mem_root) Item_func_curtime_utc(thd, $2);
if ($$ == NULL)
MYSQL_YYABORT;
Lex->safe_to_cache_query=0;
}
| UTC_TIMESTAMP_SYM opt_time_precision
{
- $$= new (thd->mem_root) Item_func_now_utc($2);
+ $$= new (thd->mem_root) Item_func_now_utc(thd, $2);
if ($$ == NULL)
MYSQL_YYABORT;
Lex->safe_to_cache_query=0;
@@ -9742,7 +9788,7 @@ function_call_nonkeyword:
|
COLUMN_CHECK_SYM '(' expr ')'
{
- $$= new (thd->mem_root) Item_func_dyncol_check($3);
+ $$= new (thd->mem_root) Item_func_dyncol_check(thd, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -9773,113 +9819,113 @@ function_call_nonkeyword:
function_call_conflict:
ASCII_SYM '(' expr ')'
{
- $$= new (thd->mem_root) Item_func_ascii($3);
+ $$= new (thd->mem_root) Item_func_ascii(thd, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| CHARSET '(' expr ')'
{
- $$= new (thd->mem_root) Item_func_charset($3);
+ $$= new (thd->mem_root) Item_func_charset(thd, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| COALESCE '(' expr_list ')'
{
- $$= new (thd->mem_root) Item_func_coalesce(* $3);
+ $$= new (thd->mem_root) Item_func_coalesce(thd, *$3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| COLLATION_SYM '(' expr ')'
{
- $$= new (thd->mem_root) Item_func_collation($3);
+ $$= new (thd->mem_root) Item_func_collation(thd, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| DATABASE '(' ')'
{
- $$= new (thd->mem_root) Item_func_database();
+ $$= new (thd->mem_root) Item_func_database(thd);
if ($$ == NULL)
MYSQL_YYABORT;
Lex->safe_to_cache_query=0;
}
| IF_SYM '(' expr ',' expr ',' expr ')'
{
- $$= new (thd->mem_root) Item_func_if($3,$5,$7);
+ $$= new (thd->mem_root) Item_func_if(thd, $3, $5, $7);
if ($$ == NULL)
MYSQL_YYABORT;
}
| FORMAT_SYM '(' expr ',' expr ')'
{
- $$= new (thd->mem_root) Item_func_format($3, $5);
+ $$= new (thd->mem_root) Item_func_format(thd, $3, $5);
if ($$ == NULL)
MYSQL_YYABORT;
}
| FORMAT_SYM '(' expr ',' expr ',' expr ')'
{
- $$= new (thd->mem_root) Item_func_format($3, $5, $7);
+ $$= new (thd->mem_root) Item_func_format(thd, $3, $5, $7);
if ($$ == NULL)
MYSQL_YYABORT;
}
| LAST_VALUE '(' expr_list ')'
{
- $$= new (thd->mem_root) Item_func_last_value(* $3);
+ $$= new (thd->mem_root) Item_func_last_value(thd, *$3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| MICROSECOND_SYM '(' expr ')'
{
- $$= new (thd->mem_root) Item_func_microsecond($3);
+ $$= new (thd->mem_root) Item_func_microsecond(thd, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| MOD_SYM '(' expr ',' expr ')'
{
- $$ = new (thd->mem_root) Item_func_mod($3, $5);
+ $$= new (thd->mem_root) Item_func_mod(thd, $3, $5);
if ($$ == NULL)
MYSQL_YYABORT;
}
| OLD_PASSWORD_SYM '(' expr ')'
{
$$= new (thd->mem_root)
- Item_func_password($3, Item_func_password::OLD);
+ Item_func_password(thd, $3, Item_func_password::OLD);
if ($$ == NULL)
MYSQL_YYABORT;
}
| PASSWORD_SYM '(' expr ')'
{
Item* i1;
- i1= new (thd->mem_root) Item_func_password($3);
+ i1= new (thd->mem_root) Item_func_password(thd, $3);
if (i1 == NULL)
MYSQL_YYABORT;
$$= i1;
}
| QUARTER_SYM '(' expr ')'
{
- $$ = new (thd->mem_root) Item_func_quarter($3);
+ $$= new (thd->mem_root) Item_func_quarter(thd, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| REPEAT_SYM '(' expr ',' expr ')'
{
- $$= new (thd->mem_root) Item_func_repeat($3,$5);
+ $$= new (thd->mem_root) Item_func_repeat(thd, $3, $5);
if ($$ == NULL)
MYSQL_YYABORT;
}
| REPLACE '(' expr ',' expr ',' expr ')'
{
- $$= new (thd->mem_root) Item_func_replace($3,$5,$7);
+ $$= new (thd->mem_root) Item_func_replace(thd, $3, $5, $7);
if ($$ == NULL)
MYSQL_YYABORT;
}
| REVERSE_SYM '(' expr ')'
{
- $$= new (thd->mem_root) Item_func_reverse($3);
+ $$= new (thd->mem_root) Item_func_reverse(thd, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| ROW_COUNT_SYM '(' ')'
{
- $$= new (thd->mem_root) Item_func_row_count();
+ $$= new (thd->mem_root) Item_func_row_count(thd);
if ($$ == NULL)
MYSQL_YYABORT;
Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
@@ -9887,7 +9933,7 @@ function_call_conflict:
}
| TRUNCATE_SYM '(' expr ',' expr ')'
{
- $$= new (thd->mem_root) Item_func_round($3,$5,1);
+ $$= new (thd->mem_root) Item_func_round(thd, $3, $5, 1);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -9901,43 +9947,46 @@ function_call_conflict:
i1->set_name((const char *)
STRING_WITH_LEN("@@default_week_format"),
system_charset_info);
- $$= new (thd->mem_root) Item_func_week($3, i1);
+ $$= new (thd->mem_root) Item_func_week(thd, $3, i1);
if ($$ == NULL)
MYSQL_YYABORT;
}
| WEEK_SYM '(' expr ',' expr ')'
{
- $$= new (thd->mem_root) Item_func_week($3,$5);
+ $$= new (thd->mem_root) Item_func_week(thd, $3, $5);
if ($$ == NULL)
MYSQL_YYABORT;
}
| WEIGHT_STRING_SYM '(' expr opt_ws_levels ')'
{
- $$= new (thd->mem_root) Item_func_weight_string($3, 0, 0, $4);
+ $$= new (thd->mem_root) Item_func_weight_string(thd, $3, 0, 0, $4);
if ($$ == NULL)
MYSQL_YYABORT;
}
| WEIGHT_STRING_SYM '(' expr AS CHAR_SYM ws_nweights opt_ws_levels ')'
{
$$= new (thd->mem_root)
- Item_func_weight_string($3, 0, $6,
+ Item_func_weight_string(thd, $3, 0, $6,
$7 | MY_STRXFRM_PAD_WITH_SPACE);
if ($$ == NULL)
MYSQL_YYABORT;
}
| WEIGHT_STRING_SYM '(' expr AS BINARY ws_nweights ')'
{
- Item *item= new (thd->mem_root) Item_char_typecast($3, $6, &my_charset_bin);
+ Item *item= new (thd->mem_root) Item_char_typecast(thd, $3, $6,
+ &my_charset_bin);
if (item == NULL)
MYSQL_YYABORT;
$$= new (thd->mem_root)
- Item_func_weight_string(item, 0, $6, MY_STRXFRM_PAD_WITH_SPACE);
+ Item_func_weight_string(thd, item, 0, $6,
+ MY_STRXFRM_PAD_WITH_SPACE);
if ($$ == NULL)
MYSQL_YYABORT;
}
| WEIGHT_STRING_SYM '(' expr ',' ulong_num ',' ulong_num ',' ulong_num ')'
{
- $$= new (thd->mem_root) Item_func_weight_string($3, $5, $7, $9);
+ $$= new (thd->mem_root) Item_func_weight_string(thd, $3, $5, $7,
+ $9);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -9960,52 +10009,52 @@ geometry_function:
CONTAINS_SYM '(' expr ',' expr ')'
{
$$= GEOM_NEW(thd,
- Item_func_spatial_precise_rel($3, $5,
+ Item_func_spatial_precise_rel(thd, $3, $5,
Item_func::SP_CONTAINS_FUNC));
}
| GEOMETRYCOLLECTION '(' expr_list ')'
{
$$= GEOM_NEW(thd,
- Item_func_spatial_collection(* $3,
+ Item_func_spatial_collection(thd, *$3,
Geometry::wkb_geometrycollection,
Geometry::wkb_point));
}
| LINESTRING '(' expr_list ')'
{
$$= GEOM_NEW(thd,
- Item_func_spatial_collection(* $3,
+ Item_func_spatial_collection(thd, *$3,
Geometry::wkb_linestring,
Geometry::wkb_point));
}
| MULTILINESTRING '(' expr_list ')'
{
$$= GEOM_NEW(thd,
- Item_func_spatial_collection(* $3,
+ Item_func_spatial_collection(thd, *$3,
Geometry::wkb_multilinestring,
Geometry::wkb_linestring));
}
| MULTIPOINT '(' expr_list ')'
{
$$= GEOM_NEW(thd,
- Item_func_spatial_collection(* $3,
+ Item_func_spatial_collection(thd, *$3,
Geometry::wkb_multipoint,
Geometry::wkb_point));
}
| MULTIPOLYGON '(' expr_list ')'
{
$$= GEOM_NEW(thd,
- Item_func_spatial_collection(* $3,
+ Item_func_spatial_collection(thd, *$3,
Geometry::wkb_multipolygon,
Geometry::wkb_polygon));
}
| POINT_SYM '(' expr ',' expr ')'
{
- $$= GEOM_NEW(thd, Item_func_point($3,$5));
+ $$= GEOM_NEW(thd, Item_func_point(thd, $3, $5));
}
| POLYGON '(' expr_list ')'
{
$$= GEOM_NEW(thd,
- Item_func_spatial_collection(* $3,
+ Item_func_spatial_collection(thd, *$3,
Geometry::wkb_polygon,
Geometry::wkb_linestring));
}
@@ -10032,7 +10081,7 @@ function_call_generic:
{
if (lex->current_select->inc_in_sum_expr())
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
}
@@ -10161,11 +10210,11 @@ udf_expr_list:
$$= new (thd->mem_root) List<Item>;
if ($$ == NULL)
MYSQL_YYABORT;
- $$->push_back($1);
+ $$->push_back($1, thd->mem_root);
}
| udf_expr_list ',' udf_expr
{
- $1->push_back($3);
+ $1->push_back($3, thd->mem_root);
$$= $1;
}
;
@@ -10200,46 +10249,46 @@ udf_expr:
sum_expr:
AVG_SYM '(' in_sum_expr ')'
{
- $$= new (thd->mem_root) Item_sum_avg($3, FALSE);
+ $$= new (thd->mem_root) Item_sum_avg(thd, $3, FALSE);
if ($$ == NULL)
MYSQL_YYABORT;
}
| AVG_SYM '(' DISTINCT in_sum_expr ')'
{
- $$= new (thd->mem_root) Item_sum_avg($4, TRUE);
+ $$= new (thd->mem_root) Item_sum_avg(thd, $4, TRUE);
if ($$ == NULL)
MYSQL_YYABORT;
}
| BIT_AND '(' in_sum_expr ')'
{
- $$= new (thd->mem_root) Item_sum_and($3);
+ $$= new (thd->mem_root) Item_sum_and(thd, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| BIT_OR '(' in_sum_expr ')'
{
- $$= new (thd->mem_root) Item_sum_or($3);
+ $$= new (thd->mem_root) Item_sum_or(thd, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| BIT_XOR '(' in_sum_expr ')'
{
- $$= new (thd->mem_root) Item_sum_xor($3);
+ $$= new (thd->mem_root) Item_sum_xor(thd, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| COUNT_SYM '(' opt_all '*' ')'
{
- Item *item= new (thd->mem_root) Item_int((int32) 0L,1);
+ Item *item= new (thd->mem_root) Item_int(thd, (int32) 0L, 1);
if (item == NULL)
MYSQL_YYABORT;
- $$= new (thd->mem_root) Item_sum_count(item);
+ $$= new (thd->mem_root) Item_sum_count(thd, item);
if ($$ == NULL)
MYSQL_YYABORT;
}
| COUNT_SYM '(' in_sum_expr ')'
{
- $$= new (thd->mem_root) Item_sum_count($3);
+ $$= new (thd->mem_root) Item_sum_count(thd, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -10249,13 +10298,13 @@ sum_expr:
{ Select->in_sum_expr--; }
')'
{
- $$= new (thd->mem_root) Item_sum_count(* $5);
+ $$= new (thd->mem_root) Item_sum_count(thd, *$5);
if ($$ == NULL)
MYSQL_YYABORT;
}
| MIN_SYM '(' in_sum_expr ')'
{
- $$= new (thd->mem_root) Item_sum_min($3);
+ $$= new (thd->mem_root) Item_sum_min(thd, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -10266,55 +10315,55 @@ sum_expr:
*/
| MIN_SYM '(' DISTINCT in_sum_expr ')'
{
- $$= new (thd->mem_root) Item_sum_min($4);
+ $$= new (thd->mem_root) Item_sum_min(thd, $4);
if ($$ == NULL)
MYSQL_YYABORT;
}
| MAX_SYM '(' in_sum_expr ')'
{
- $$= new (thd->mem_root) Item_sum_max($3);
+ $$= new (thd->mem_root) Item_sum_max(thd, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| MAX_SYM '(' DISTINCT in_sum_expr ')'
{
- $$= new (thd->mem_root) Item_sum_max($4);
+ $$= new (thd->mem_root) Item_sum_max(thd, $4);
if ($$ == NULL)
MYSQL_YYABORT;
}
| STD_SYM '(' in_sum_expr ')'
{
- $$= new (thd->mem_root) Item_sum_std($3, 0);
+ $$= new (thd->mem_root) Item_sum_std(thd, $3, 0);
if ($$ == NULL)
MYSQL_YYABORT;
}
| VARIANCE_SYM '(' in_sum_expr ')'
{
- $$= new (thd->mem_root) Item_sum_variance($3, 0);
+ $$= new (thd->mem_root) Item_sum_variance(thd, $3, 0);
if ($$ == NULL)
MYSQL_YYABORT;
}
| STDDEV_SAMP_SYM '(' in_sum_expr ')'
{
- $$= new (thd->mem_root) Item_sum_std($3, 1);
+ $$= new (thd->mem_root) Item_sum_std(thd, $3, 1);
if ($$ == NULL)
MYSQL_YYABORT;
}
| VAR_SAMP_SYM '(' in_sum_expr ')'
{
- $$= new (thd->mem_root) Item_sum_variance($3, 1);
+ $$= new (thd->mem_root) Item_sum_variance(thd, $3, 1);
if ($$ == NULL)
MYSQL_YYABORT;
}
| SUM_SYM '(' in_sum_expr ')'
{
- $$= new (thd->mem_root) Item_sum_sum($3, FALSE);
+ $$= new (thd->mem_root) Item_sum_sum(thd, $3, FALSE);
if ($$ == NULL)
MYSQL_YYABORT;
}
| SUM_SYM '(' DISTINCT in_sum_expr ')'
{
- $$= new (thd->mem_root) Item_sum_sum($4, TRUE);
+ $$= new (thd->mem_root) Item_sum_sum(thd, $4, TRUE);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -10327,7 +10376,7 @@ sum_expr:
SELECT_LEX *sel= Select;
sel->in_sum_expr--;
$$= new (thd->mem_root)
- Item_func_group_concat(Lex->current_context(), $3, $5,
+ Item_func_group_concat(thd, Lex->current_context(), $3, $5,
sel->gorder_list, $7);
if ($$ == NULL)
MYSQL_YYABORT;
@@ -10355,16 +10404,16 @@ variable_aux:
ident_or_text SET_VAR expr
{
Item_func_set_user_var *item;
- $$= item= new (thd->mem_root) Item_func_set_user_var($1, $3);
+ $$= item= new (thd->mem_root) Item_func_set_user_var(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
LEX *lex= Lex;
lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
- lex->set_var_list.push_back(item);
+ lex->set_var_list.push_back(item, thd->mem_root);
}
| ident_or_text
{
- $$= new (thd->mem_root) Item_func_get_user_var($1);
+ $$= new (thd->mem_root) Item_func_get_user_var(thd, $1);
if ($$ == NULL)
MYSQL_YYABORT;
LEX *lex= Lex;
@@ -10375,7 +10424,7 @@ variable_aux:
/* disallow "SELECT @@global.global.variable" */
if ($3.str && $4.str && check_reserved_words(&$3))
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
if (!($$= get_system_var(thd, $2, $3, $4)))
@@ -10431,7 +10480,7 @@ in_sum_expr:
LEX *lex= Lex;
if (lex->current_select->inc_in_sum_expr())
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
}
@@ -10493,11 +10542,11 @@ expr_list:
$$= new (thd->mem_root) List<Item>;
if ($$ == NULL)
MYSQL_YYABORT;
- $$->push_back($1);
+ $$->push_back($1, thd->mem_root);
}
| expr_list ',' expr
{
- $1->push_back($3);
+ $1->push_back($3, thd->mem_root);
$$= $1;
}
;
@@ -10513,11 +10562,11 @@ ident_list:
$$= new (thd->mem_root) List<Item>;
if ($$ == NULL)
MYSQL_YYABORT;
- $$->push_back($1);
+ $$->push_back($1, thd->mem_root);
}
| ident_list ',' simple_ident
{
- $1->push_back($3);
+ $1->push_back($3, thd->mem_root);
$$= $1;
}
;
@@ -10535,16 +10584,16 @@ opt_else:
when_list:
WHEN_SYM expr THEN_SYM expr
{
- $$= new List<Item>;
+ $$= new (thd->mem_root) List<Item>;
if ($$ == NULL)
MYSQL_YYABORT;
- $$->push_back($2);
- $$->push_back($4);
+ $$->push_back($2, thd->mem_root);
+ $$->push_back($4, thd->mem_root);
}
| when_list WHEN_SYM expr THEN_SYM expr
{
- $1->push_back($3);
- $1->push_back($5);
+ $1->push_back($3, thd->mem_root);
+ $1->push_back($5, thd->mem_root);
$$= $1;
}
;
@@ -10558,7 +10607,7 @@ table_ref:
LEX *lex= Lex;
if (!($$= lex->current_select->nest_last_join(lex->thd)))
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
}
@@ -10618,7 +10667,7 @@ join_table:
expr
{
$3->straight=$2;
- add_join_on($3,$6);
+ add_join_on(thd, $3, $6);
Lex->pop_context();
Select->parsing_place= NO_MATTER;
}
@@ -10652,7 +10701,7 @@ join_table:
}
expr
{
- add_join_on($5,$8);
+ add_join_on(thd, $5, $8);
Lex->pop_context();
$5->outer_join|=JOIN_TYPE_LEFT;
$$=$5;
@@ -10691,7 +10740,7 @@ join_table:
LEX *lex= Lex;
if (!($$= lex->current_select->convert_right_join()))
MYSQL_YYABORT;
- add_join_on($$, $8);
+ add_join_on(thd, $$, $8);
Lex->pop_context();
Select->parsing_place= NO_MATTER;
}
@@ -10776,7 +10825,7 @@ table_factor:
{
if (sel->set_braces(1))
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
}
@@ -10826,7 +10875,7 @@ table_factor:
SELECT_LEX *sel= lex->current_select;
SELECT_LEX_UNIT *unit= sel->master_unit();
lex->current_select= sel= unit->outer_select();
- Table_ident *ti= new Table_ident(unit);
+ Table_ident *ti= new (thd->mem_root) Table_ident(unit);
if (ti == NULL)
MYSQL_YYABORT;
if (!($$= sel->add_table_to_list(lex->thd,
@@ -10848,7 +10897,7 @@ table_factor:
Tables with or without joins within parentheses cannot
have aliases, and we ruled out derived tables above.
*/
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
else
@@ -10884,7 +10933,7 @@ select_derived_union:
{
if ($1 && $2)
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
}
@@ -10907,7 +10956,7 @@ select_derived_union:
{
if ($1 != NULL)
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
}
@@ -10921,13 +10970,13 @@ select_init2_derived:
SELECT_LEX * sel= lex->current_select;
if (lex->current_select->set_braces(0))
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
if (sel->linkage == UNION_TYPE &&
sel->master_unit()->first_select()->braces)
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
}
@@ -10967,7 +11016,7 @@ select_derived:
MYSQL_YYABORT;
if (!$3 && $$)
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
}
@@ -10980,7 +11029,7 @@ select_derived2:
if (!lex->expr_allows_subselect ||
lex->sql_command == (int)SQLCOM_PURGE)
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE ||
@@ -11017,7 +11066,7 @@ select_derived_init:
if (!sel->embedding || sel->end_nested_join(lex->thd))
{
/* we are not in parentheses */
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
embedding= Select->embedding;
@@ -11095,14 +11144,14 @@ key_usage_list:
using_list:
ident
{
- if (!($$= new List<String>))
+ if (!($$= new (thd->mem_root) List<String>))
MYSQL_YYABORT;
String *s= new (thd->mem_root) String((const char *) $1.str,
$1.length,
system_charset_info);
if (s == NULL)
MYSQL_YYABORT;
- $$->push_back(s);
+ $$->push_back(s, thd->mem_root);
}
| using_list ',' ident
{
@@ -11111,7 +11160,7 @@ using_list:
system_charset_info);
if (s == NULL)
MYSQL_YYABORT;
- $1->push_back(s);
+ $1->push_back(s, thd->mem_root);
$$= $1;
}
;
@@ -11180,7 +11229,7 @@ where_clause:
expr
{
SELECT_LEX *select= Select;
- select->where= normalize_cond($3);
+ select->where= normalize_cond(thd, $3);
select->parsing_place= NO_MATTER;
if ($3)
$3->top_level_item();
@@ -11196,7 +11245,7 @@ having_clause:
expr
{
SELECT_LEX *sel= Select;
- sel->having= normalize_cond($3);
+ sel->having= normalize_cond(thd, $3);
sel->parsing_place= NO_MATTER;
if ($3)
$3->top_level_item();
@@ -11213,8 +11262,8 @@ opt_escape:
{
Lex->escape_used= FALSE;
$$= ((thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) ?
- new (thd->mem_root) Item_string_ascii("", 0) :
- new (thd->mem_root) Item_string_ascii("\\", 1));
+ new (thd->mem_root) Item_string_ascii(thd, "", 0) :
+ new (thd->mem_root) Item_string_ascii(thd, "\\", 1));
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -11351,7 +11400,6 @@ order_clause:
*/
DBUG_ASSERT(sel->master_unit()->fake_select_lex);
lex->current_select= sel->master_unit()->fake_select_lex;
- lex->push_context(&lex->current_select->context, thd->mem_root);
}
}
order_list
@@ -11464,7 +11512,7 @@ limit_option:
if (spc && (spv = spc->find_variable($1, false)))
{
splocal= new (thd->mem_root)
- Item_splocal($1, spv->offset, spv->type,
+ Item_splocal(thd, $1, spv->offset, spv->type,
lip->get_tok_start() - lex->sphead->m_tmp_query,
lip->get_ptr() - lip->get_tok_start());
if (splocal == NULL)
@@ -11493,19 +11541,19 @@ limit_option:
}
| ULONGLONG_NUM
{
- $$= new (thd->mem_root) Item_uint($1.str, $1.length);
+ $$= new (thd->mem_root) Item_uint(thd, $1.str, $1.length);
if ($$ == NULL)
MYSQL_YYABORT;
}
| LONG_NUM
{
- $$= new (thd->mem_root) Item_uint($1.str, $1.length);
+ $$= new (thd->mem_root) Item_uint(thd, $1.str, $1.length);
if ($$ == NULL)
MYSQL_YYABORT;
}
| NUM
{
- $$= new (thd->mem_root) Item_uint($1.str, $1.length);
+ $$= new (thd->mem_root) Item_uint(thd, $1.str, $1.length);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -11531,8 +11579,8 @@ delete_limit_clause:
Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_LIMIT);
sel->explicit_limit= 1;
}
- | LIMIT ROWS_SYM EXAMINED_SYM { my_parse_error(ER(ER_SYNTAX_ERROR)); MYSQL_YYABORT; }
- | LIMIT limit_option ROWS_SYM EXAMINED_SYM { my_parse_error(ER(ER_SYNTAX_ERROR)); MYSQL_YYABORT; }
+ | LIMIT ROWS_SYM EXAMINED_SYM { my_parse_error(thd, ER_SYNTAX_ERROR); MYSQL_YYABORT; }
+ | LIMIT limit_option ROWS_SYM EXAMINED_SYM { my_parse_error(thd, ER_SYNTAX_ERROR); MYSQL_YYABORT; }
;
int_num:
@@ -11576,7 +11624,7 @@ real_ulonglong_num:
dec_num_error:
dec_num
- { my_parse_error(ER(ER_ONLY_INTEGERS_ALLOWED)); }
+ { my_parse_error(thd, ER_ONLY_INTEGERS_ALLOWED); }
;
dec_num:
@@ -11610,7 +11658,7 @@ procedure_clause:
lex->proc_list.first=0;
lex->proc_list.next= &lex->proc_list.first;
Item_field *item= new (thd->mem_root)
- Item_field(&lex->current_select->context,
+ Item_field(thd, &lex->current_select->context,
NULL, NULL, $2.str);
if (item == NULL)
MYSQL_YYABORT;
@@ -11663,7 +11711,7 @@ select_var_ident: select_outvar
{
if ($1 == NULL)
MYSQL_YYABORT;
- ((select_dumpvar *)Lex->result)->var_list.push_back($1);
+ ((select_dumpvar *)Lex->result)->var_list.push_back($1, thd->mem_root);
}
else
{
@@ -11679,7 +11727,7 @@ select_var_ident: select_outvar
select_outvar:
'@' ident_or_text
{
- $$ = Lex->result ? new my_var_user($2) : NULL;
+ $$ = Lex->result ? new (thd->mem_root) my_var_user($2) : NULL;
}
| ident_or_text
{
@@ -11690,8 +11738,10 @@ select_outvar:
my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str);
MYSQL_YYABORT;
}
- $$ = Lex->result ? new my_var_sp($1, t->offset, t->type, Lex->sphead)
- : NULL;
+ $$ = Lex->result ? (new (thd->mem_root)
+ my_var_sp($1, t->offset, t->type,
+ Lex->sphead)) :
+ NULL;
}
;
@@ -11727,7 +11777,7 @@ into_destination:
if (!lex->describe)
{
lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
- if (!(lex->exchange= new sql_exchange($2.str,1)))
+ if (!(lex->exchange= new (thd->mem_root) sql_exchange($2.str,1)))
MYSQL_YYABORT;
if (!(lex->result=
new (thd->mem_root) select_dump(thd, lex->exchange)))
@@ -11774,13 +11824,14 @@ drop:
| DROP INDEX_SYM opt_if_exists_table_element ident ON table_ident {}
{
LEX *lex=Lex;
- Alter_drop *ad= new Alter_drop(Alter_drop::KEY, $4.str, $3);
+ Alter_drop *ad= (new (thd->mem_root)
+ Alter_drop(Alter_drop::KEY, $4.str, $3));
if (ad == NULL)
MYSQL_YYABORT;
lex->sql_command= SQLCOM_DROP_INDEX;
lex->alter_info.reset();
lex->alter_info.flags= Alter_info::ALTER_DROP_INDEX;
- lex->alter_info.drop_list.push_back(ad);
+ lex->alter_info.drop_list.push_back(ad, thd->mem_root);
if (!lex->current_select->add_table_to_list(lex->thd, $6, NULL,
TL_OPTION_UPDATING,
TL_READ_NO_INSERT,
@@ -11808,7 +11859,7 @@ drop:
MYSQL_YYABORT;
}
lex->set_command(SQLCOM_DROP_FUNCTION, $3);
- spname= new sp_name($4, $6, true);
+ spname= new (lex->thd->mem_root) sp_name($4, $6, true);
if (spname == NULL)
MYSQL_YYABORT;
spname->init_qname(thd);
@@ -11827,7 +11878,7 @@ drop:
if (thd->db && lex->copy_db_to(&db.str, &db.length))
MYSQL_YYABORT;
lex->set_command(SQLCOM_DROP_FUNCTION, $3);
- spname= new sp_name(db, $4, false);
+ spname= new (lex->thd->mem_root) sp_name(db, $4, false);
if (spname == NULL)
MYSQL_YYABORT;
spname->init_qname(thd);
@@ -11960,7 +12011,7 @@ opt_if_exists:
opt_temporary:
/* empty */ { $$= 0; }
- | TEMPORARY { $$= HA_LEX_CREATE_TMP_TABLE;; }
+ | TEMPORARY { $$= HA_LEX_CREATE_TMP_TABLE; }
;
/*
** Insert : add new data to table
@@ -12056,16 +12107,17 @@ insert_field_spec:
| SET
{
LEX *lex=Lex;
- if (!(lex->insert_list = new List_item) ||
- lex->many_values.push_back(lex->insert_list))
+ if (!(lex->insert_list= new (thd->mem_root) List_item) ||
+ lex->many_values.push_back(lex->insert_list, thd->mem_root))
MYSQL_YYABORT;
}
ident_eq_list
;
fields:
- fields ',' insert_ident { Lex->field_list.push_back($3); }
- | insert_ident { Lex->field_list.push_back($1); }
+ fields ',' insert_ident
+ { Lex->field_list.push_back($3, thd->mem_root); }
+ | insert_ident { Lex->field_list.push_back($1, thd->mem_root); }
;
insert_values:
@@ -12093,8 +12145,8 @@ ident_eq_value:
simple_ident_nospvar equal expr_or_default
{
LEX *lex=Lex;
- if (lex->field_list.push_back($1) ||
- lex->insert_list->push_back($3))
+ if (lex->field_list.push_back($1, thd->mem_root) ||
+ lex->insert_list->push_back($3, thd->mem_root))
MYSQL_YYABORT;
}
;
@@ -12112,13 +12164,13 @@ opt_equal:
no_braces:
'('
{
- if (!(Lex->insert_list = new List_item))
+ if (!(Lex->insert_list= new (thd->mem_root) List_item))
MYSQL_YYABORT;
}
opt_values ')'
{
LEX *lex=Lex;
- if (lex->many_values.push_back(lex->insert_list))
+ if (lex->many_values.push_back(lex->insert_list, thd->mem_root))
MYSQL_YYABORT;
}
;
@@ -12131,12 +12183,12 @@ opt_values:
values:
values ',' expr_or_default
{
- if (Lex->insert_list->push_back($3))
+ if (Lex->insert_list->push_back($3, thd->mem_root))
MYSQL_YYABORT;
}
| expr_or_default
{
- if (Lex->insert_list->push_back($1))
+ if (Lex->insert_list->push_back($1, thd->mem_root))
MYSQL_YYABORT;
}
;
@@ -12145,7 +12197,7 @@ expr_or_default:
expr { $$= $1;}
| DEFAULT
{
- $$= new (thd->mem_root) Item_default_value(Lex->current_context());
+ $$= new (thd->mem_root) Item_default_value(thd, Lex->current_context());
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -12212,8 +12264,8 @@ insert_update_elem:
simple_ident_nospvar equal expr_or_default
{
LEX *lex= Lex;
- if (lex->update_list.push_back($1) ||
- lex->value_list.push_back($3))
+ if (lex->update_list.push_back($1, thd->mem_root) ||
+ lex->value_list.push_back($3, thd->mem_root))
MYSQL_YYABORT;
}
;
@@ -12292,7 +12344,7 @@ table_wild_list:
table_wild_one:
ident opt_wild
{
- Table_ident *ti= new Table_ident($1);
+ Table_ident *ti= new (thd->mem_root) Table_ident($1);
if (ti == NULL)
MYSQL_YYABORT;
if (!Select->add_table_to_list(thd,
@@ -12305,7 +12357,7 @@ table_wild_one:
}
| ident '.' ident opt_wild
{
- Table_ident *ti= new Table_ident(thd, $1, $3, 0);
+ Table_ident *ti= new (thd->mem_root) Table_ident(thd, $1, $3, 0);
if (ti == NULL)
MYSQL_YYABORT;
if (!Select->add_table_to_list(thd,
@@ -12640,7 +12692,6 @@ show_param:
lex->sql_command = SQLCOM_SHOW_CREATE;
if (!lex->select_lex.add_table_to_list(thd, $3, NULL,0))
MYSQL_YYABORT;
- lex->only_view= 0;
lex->create_info.storage_media= HA_SM_DEFAULT;
}
| CREATE VIEW_SYM table_ident
@@ -12735,12 +12786,12 @@ show_param:
ST_SCHEMA_TABLE *table= find_schema_table(thd, $1.str);
if (!table || !table->old_format)
{
- my_parse_error(ER(ER_SYNTAX_ERROR), $2);
+ my_parse_error(thd, ER_SYNTAX_ERROR, $2);
MYSQL_YYABORT;
}
if (lex->wild && table->idx_field1 < 0)
{
- my_parse_error(ER(ER_SYNTAX_ERROR), $3);
+ my_parse_error(thd, ER_SYNTAX_ERROR, $3);
MYSQL_YYABORT;
}
if (make_schema_select(thd, Lex->current_select, table))
@@ -12804,7 +12855,7 @@ wild_and_where:
}
| WHERE remember_tok_start expr
{
- Select->where= normalize_cond($3);
+ Select->where= normalize_cond(thd, $3);
if ($3)
$3->top_level_item();
$$= $2;
@@ -12946,7 +12997,7 @@ flush_lock:
{
if (Lex->query_tables == NULL) // Table list can't be empty
{
- my_parse_error(ER(ER_NO_TABLES_USED));
+ my_parse_error(thd, ER_NO_TABLES_USED);
MYSQL_YYABORT;
}
Lex->type|= REFRESH_FOR_EXPORT;
@@ -13017,11 +13068,12 @@ flush_option:
ST_SCHEMA_TABLE *table= find_schema_table(thd, $1.str);
if (!table || !table->reset_table)
{
- my_parse_error(ER(ER_SYNTAX_ERROR), $2);
+ my_parse_error(thd, ER_SYNTAX_ERROR, $2);
MYSQL_YYABORT;
}
- Lex->view_list.push_back(
- (LEX_STRING*)thd->memdup(&$1, sizeof(LEX_STRING)));
+ Lex->view_list.push_back((LEX_STRING*)
+ thd->memdup(&$1, sizeof(LEX_STRING)),
+ thd->mem_root);
}
;
@@ -13053,7 +13105,12 @@ reset_option:
SLAVE { Lex->type|= REFRESH_SLAVE; }
optional_connection_name
slave_reset_options { }
- | MASTER_SYM { Lex->type|= REFRESH_MASTER; }
+ | MASTER_SYM
+ {
+ Lex->type|= REFRESH_MASTER;
+ Lex->next_binlog_file_number= 0;
+ }
+ master_reset_options
| QUERY_SYM CACHE_SYM { Lex->type|= REFRESH_QUERY_CACHE;}
;
@@ -13062,6 +13119,14 @@ slave_reset_options:
| ALL { Lex->reset_slave_info.all= true; }
;
+master_reset_options:
+ /* empty */ {}
+ | TO_SYM ulong_num
+ {
+ Lex->next_binlog_file_number = $2;
+ }
+ ;
+
purge:
PURGE
{
@@ -13086,7 +13151,7 @@ purge_option:
{
LEX *lex= Lex;
lex->value_list.empty();
- lex->value_list.push_front($2);
+ lex->value_list.push_front($2, thd->mem_root);
lex->sql_command= SQLCOM_PURGE_BEFORE;
}
;
@@ -13127,11 +13192,11 @@ kill_option:
kill_expr:
expr
{
- Lex->value_list.push_front($$);
+ Lex->value_list.push_front($$, thd->mem_root);
}
| USER user
{
- Lex->users_list.push_back($2);
+ Lex->users_list.push_back($2, thd->mem_root);
Lex->kill_type= KILL_TYPE_USER;
}
;
@@ -13173,7 +13238,7 @@ load:
lex->local_file= $5;
lex->duplicates= DUP_ERROR;
lex->ignore= 0;
- if (!(lex->exchange= new sql_exchange($7.str, 0, $2)))
+ if (!(lex->exchange= new (thd->mem_root) sql_exchange($7.str, 0, $2)))
MYSQL_YYABORT;
}
opt_duplicate INTO TABLE_SYM table_ident opt_use_partition
@@ -13308,16 +13373,16 @@ opt_field_or_var_spec:
fields_or_vars:
fields_or_vars ',' field_or_var
- { Lex->field_list.push_back($3); }
+ { Lex->field_list.push_back($3, thd->mem_root); }
| field_or_var
- { Lex->field_list.push_back($1); }
+ { Lex->field_list.push_back($1, thd->mem_root); }
;
field_or_var:
simple_ident_nospvar {$$= $1;}
| '@' ident_or_text
{
- $$= new (thd->mem_root) Item_user_var_as_out_param($2);
+ $$= new (thd->mem_root) Item_user_var_as_out_param(thd, $2);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -13337,8 +13402,8 @@ load_data_set_elem:
simple_ident_nospvar equal remember_name expr_or_default remember_end
{
LEX *lex= Lex;
- if (lex->update_list.push_back($1) ||
- lex->value_list.push_back($4))
+ if (lex->update_list.push_back($1, thd->mem_root) ||
+ lex->value_list.push_back($4, thd->mem_root))
MYSQL_YYABORT;
$4->set_name_no_truncate($3, (uint) ($5 - $3), thd->charset());
}
@@ -13364,7 +13429,8 @@ text_literal:
if (thd->convert_string(&tmp, cs_con, $1.str, $1.length, cs_cli))
MYSQL_YYABORT;
}
- $$= new (thd->mem_root) Item_string(tmp.str, tmp.length, cs_con,
+ $$= new (thd->mem_root) Item_string(thd, tmp.str, tmp.length,
+ cs_con,
DERIVATION_COERCIBLE,
repertoire);
if ($$ == NULL)
@@ -13375,7 +13441,7 @@ text_literal:
uint repertoire= Lex->text_string_is_7bit ?
MY_REPERTOIRE_ASCII : MY_REPERTOIRE_UNICODE30;
DBUG_ASSERT(my_charset_is_ascii_based(national_charset_info));
- $$= new (thd->mem_root) Item_string($1.str, $1.length,
+ $$= new (thd->mem_root) Item_string(thd, $1.str, $1.length,
national_charset_info,
DERIVATION_COERCIBLE,
repertoire);
@@ -13384,7 +13450,7 @@ text_literal:
}
| UNDERSCORE_CHARSET TEXT_STRING
{
- $$= new (thd->mem_root) Item_string_with_introducer($2.str,
+ $$= new (thd->mem_root) Item_string_with_introducer(thd, $2.str,
$2.length, $1);
if ($$ == NULL)
MYSQL_YYABORT;
@@ -13423,7 +13489,8 @@ text_string:
hex_or_bin_String:
HEX_NUM
{
- Item *tmp= new (thd->mem_root) Item_hex_hybrid($1.str, $1.length);
+ Item *tmp= new (thd->mem_root) Item_hex_hybrid(thd, $1.str,
+ $1.length);
if (tmp == NULL)
MYSQL_YYABORT;
/*
@@ -13435,7 +13502,8 @@ hex_or_bin_String:
}
| HEX_STRING
{
- Item *tmp= new (thd->mem_root) Item_hex_string($1.str, $1.length);
+ Item *tmp= new (thd->mem_root) Item_hex_string(thd, $1.str,
+ $1.length);
if (tmp == NULL)
MYSQL_YYABORT;
tmp->quick_fix_field();
@@ -13443,7 +13511,8 @@ hex_or_bin_String:
}
| BIN_NUM
{
- Item *tmp= new (thd->mem_root) Item_bin_string($1.str, $1.length);
+ Item *tmp= new (thd->mem_root) Item_bin_string(thd, $1.str,
+ $1.length);
if (tmp == NULL)
MYSQL_YYABORT;
/*
@@ -13468,10 +13537,11 @@ param_marker:
}
const char *query_start= lex->sphead ? lex->sphead->m_tmp_query
: thd->query();
- item= new (thd->mem_root) Item_param(lip->get_tok_start() - query_start);
- if (!($$= item) || lex->param_list.push_back(item))
+ item= new (thd->mem_root) Item_param(thd, lip->get_tok_start() -
+ query_start);
+ if (!($$= item) || lex->param_list.push_back(item, thd->mem_root))
{
- my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
+ my_message(ER_OUT_OF_RESOURCES, ER_THD(thd, ER_OUT_OF_RESOURCES), MYF(0));
MYSQL_YYABORT;
}
}
@@ -13483,7 +13553,7 @@ signed_literal:
| '-' NUM_literal
{
$2->max_length++;
- $$= $2->neg();
+ $$= $2->neg(thd);
}
;
@@ -13500,38 +13570,38 @@ literal:
TOK_GENERIC_VALUE := NULL_SYM
*/
YYLIP->reduce_digest_token(TOK_GENERIC_VALUE, NULL_SYM);
- $$ = new (thd->mem_root) Item_null();
+ $$= new (thd->mem_root) Item_null(thd);
if ($$ == NULL)
MYSQL_YYABORT;
YYLIP->next_state= MY_LEX_OPERATOR_OR_IDENT;
}
| FALSE_SYM
{
- $$= new (thd->mem_root) Item_int((char*) "FALSE",0,1);
+ $$= new (thd->mem_root) Item_int(thd, (char*) "FALSE",0,1);
if ($$ == NULL)
MYSQL_YYABORT;
}
| TRUE_SYM
{
- $$= new (thd->mem_root) Item_int((char*) "TRUE",1,1);
+ $$= new (thd->mem_root) Item_int(thd, (char*) "TRUE",1,1);
if ($$ == NULL)
MYSQL_YYABORT;
}
| HEX_NUM
{
- $$ = new (thd->mem_root) Item_hex_hybrid($1.str, $1.length);
+ $$= new (thd->mem_root) Item_hex_hybrid(thd, $1.str, $1.length);
if ($$ == NULL)
MYSQL_YYABORT;
}
| HEX_STRING
{
- $$ = new (thd->mem_root) Item_hex_string($1.str, $1.length);
+ $$= new (thd->mem_root) Item_hex_string(thd, $1.str, $1.length);
if ($$ == NULL)
MYSQL_YYABORT;
}
| BIN_NUM
{
- $$= new (thd->mem_root) Item_bin_string($1.str, $1.length);
+ $$= new (thd->mem_root) Item_bin_string(thd, $1.str, $1.length);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -13543,7 +13613,8 @@ literal:
will include the introducer and the original hex/bin notation.
*/
item_str= new (thd->mem_root)
- Item_string_with_introducer(NULL, $2->ptr(), $2->length(), $1);
+ Item_string_with_introducer(thd, NULL, $2->ptr(), $2->length(),
+ $1);
if (!item_str || !item_str->check_well_formed_result(true))
MYSQL_YYABORT;
@@ -13556,7 +13627,7 @@ NUM_literal:
{
int error;
$$= new (thd->mem_root)
- Item_int($1.str,
+ Item_int(thd, $1.str,
(longlong) my_strtoll10($1.str, NULL, &error),
$1.length);
if ($$ == NULL)
@@ -13566,7 +13637,7 @@ NUM_literal:
{
int error;
$$= new (thd->mem_root)
- Item_int($1.str,
+ Item_int(thd, $1.str,
(longlong) my_strtoll10($1.str, NULL, &error),
$1.length);
if ($$ == NULL)
@@ -13574,13 +13645,13 @@ NUM_literal:
}
| ULONGLONG_NUM
{
- $$= new (thd->mem_root) Item_uint($1.str, $1.length);
+ $$= new (thd->mem_root) Item_uint(thd, $1.str, $1.length);
if ($$ == NULL)
MYSQL_YYABORT;
}
| DECIMAL_NUM
{
- $$= new (thd->mem_root) Item_decimal($1.str, $1.length,
+ $$= new (thd->mem_root) Item_decimal(thd, $1.str, $1.length,
thd->charset());
if (($$ == NULL) || (thd->is_error()))
{
@@ -13589,7 +13660,7 @@ NUM_literal:
}
| FLOAT_NUM
{
- $$= new (thd->mem_root) Item_float($1.str, $1.length);
+ $$= new (thd->mem_root) Item_float(thd, $1.str, $1.length);
if (($$ == NULL) || (thd->is_error()))
{
MYSQL_YYABORT;
@@ -13635,7 +13706,7 @@ table_wild:
ident '.' '*'
{
SELECT_LEX *sel= Select;
- $$= new (thd->mem_root) Item_field(Lex->current_context(),
+ $$= new (thd->mem_root) Item_field(thd, Lex->current_context(),
NullS, $1.str, "*");
if ($$ == NULL)
MYSQL_YYABORT;
@@ -13646,7 +13717,7 @@ table_wild:
SELECT_LEX *sel= Select;
const char* schema= thd->client_capabilities & CLIENT_NO_SCHEMA ?
NullS : $1.str;
- $$= new (thd->mem_root) Item_field(Lex->current_context(),
+ $$= new (thd->mem_root) Item_field(thd, Lex->current_context(),
schema,
$3.str,"*");
if ($$ == NULL)
@@ -13677,7 +13748,7 @@ simple_ident:
Item_splocal *splocal;
splocal= new (thd->mem_root)
- Item_splocal($1, spv->offset, spv->type,
+ Item_splocal(thd, $1, spv->offset, spv->type,
lip->get_tok_start_prev() - lex->sphead->m_tmp_query,
lip->get_tok_end() - lip->get_tok_start_prev());
if (splocal == NULL)
@@ -13694,12 +13765,12 @@ simple_ident:
if ((sel->parsing_place != IN_HAVING) ||
(sel->get_in_sum_expr() > 0))
{
- $$= new (thd->mem_root) Item_field(Lex->current_context(),
+ $$= new (thd->mem_root) Item_field(thd, Lex->current_context(),
NullS, NullS, $1.str);
}
else
{
- $$= new (thd->mem_root) Item_ref(Lex->current_context(),
+ $$= new (thd->mem_root) Item_ref(thd, Lex->current_context(),
NullS, NullS, $1.str);
}
if ($$ == NULL)
@@ -13716,12 +13787,12 @@ simple_ident_nospvar:
if ((sel->parsing_place != IN_HAVING) ||
(sel->get_in_sum_expr() > 0))
{
- $$= new (thd->mem_root) Item_field(Lex->current_context(),
+ $$= new (thd->mem_root) Item_field(thd, Lex->current_context(),
NullS, NullS, $1.str);
}
else
{
- $$= new (thd->mem_root) Item_ref(Lex->current_context(),
+ $$= new (thd->mem_root) Item_ref(thd, Lex->current_context(),
NullS, NullS, $1.str);
}
if ($$ == NULL)
@@ -13764,16 +13835,16 @@ simple_ident_q:
DBUG_ASSERT(!new_row ||
(lex->trg_chistics.event == TRG_EVENT_INSERT ||
lex->trg_chistics.event == TRG_EVENT_UPDATE));
- const bool read_only=
+ const bool tmp_read_only=
!(new_row && lex->trg_chistics.action_time == TRG_ACTION_BEFORE);
trg_fld= new (thd->mem_root)
- Item_trigger_field(Lex->current_context(),
+ Item_trigger_field(thd, Lex->current_context(),
new_row ?
Item_trigger_field::NEW_ROW:
Item_trigger_field::OLD_ROW,
$3.str,
SELECT_ACL,
- read_only);
+ tmp_read_only);
if (trg_fld == NULL)
MYSQL_YYABORT;
@@ -13797,12 +13868,12 @@ simple_ident_q:
if ((sel->parsing_place != IN_HAVING) ||
(sel->get_in_sum_expr() > 0))
{
- $$= new (thd->mem_root) Item_field(Lex->current_context(),
+ $$= new (thd->mem_root) Item_field(thd, Lex->current_context(),
NullS, $1.str, $3.str);
}
else
{
- $$= new (thd->mem_root) Item_ref(Lex->current_context(),
+ $$= new (thd->mem_root) Item_ref(thd, Lex->current_context(),
NullS, $1.str, $3.str);
}
if ($$ == NULL)
@@ -13821,13 +13892,13 @@ simple_ident_q:
if ((sel->parsing_place != IN_HAVING) ||
(sel->get_in_sum_expr() > 0))
{
- $$= new (thd->mem_root) Item_field(Lex->current_context(),
+ $$= new (thd->mem_root) Item_field(thd, Lex->current_context(),
NullS, $2.str, $4.str);
}
else
{
- $$= new (thd->mem_root) Item_ref(Lex->current_context(),
+ $$= new (thd->mem_root) Item_ref(thd, Lex->current_context(),
NullS, $2.str, $4.str);
}
if ($$ == NULL)
@@ -13847,13 +13918,13 @@ simple_ident_q:
if ((sel->parsing_place != IN_HAVING) ||
(sel->get_in_sum_expr() > 0))
{
- $$= new (thd->mem_root) Item_field(Lex->current_context(),
+ $$= new (thd->mem_root) Item_field(thd, Lex->current_context(),
schema,
$3.str, $5.str);
}
else
{
- $$= new (thd->mem_root) Item_ref(Lex->current_context(),
+ $$= new (thd->mem_root) Item_ref(thd, Lex->current_context(),
schema,
$3.str, $5.str);
}
@@ -14051,7 +14122,7 @@ user_maybe_role:
$$->plugin= empty_lex_str;
$$->auth= empty_lex_str;
- if (check_string_char_length(&$$->user, ER(ER_USERNAME),
+ if (check_string_char_length(&$$->user, ER_USERNAME,
username_char_length,
system_charset_info, 0))
MYSQL_YYABORT;
@@ -14065,7 +14136,7 @@ user_maybe_role:
$$->plugin= empty_lex_str;
$$->auth= empty_lex_str;
- if (check_string_char_length(&$$->user, ER(ER_USERNAME),
+ if (check_string_char_length(&$$->user, ER_USERNAME,
username_char_length,
system_charset_info, 0) ||
check_host_name(&$$->host))
@@ -14662,7 +14733,7 @@ option_value_following_option_type:
Not in trigger assigning value to new row,
and option_type preceding local variable is illegal.
*/
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
}
@@ -14699,13 +14770,13 @@ option_value_no_option_type:
| '@' ident_or_text equal expr
{
Item_func_set_user_var *item;
- item= new (thd->mem_root) Item_func_set_user_var($2, $4);
+ item= new (thd->mem_root) Item_func_set_user_var(thd, $2, $4);
if (item == NULL)
MYSQL_YYABORT;
- set_var_user *var= new set_var_user(item);
+ set_var_user *var= new (thd->mem_root) set_var_user(item);
if (var == NULL)
MYSQL_YYABORT;
- Lex->var_list.push_back(var);
+ Lex->var_list.push_back(var, thd->mem_root);
}
| '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default
{
@@ -14725,12 +14796,13 @@ option_value_no_option_type:
CHARSET_INFO *cs2;
cs2= $2 ? $2: global_system_variables.character_set_client;
set_var_collation_client *var;
- var= new set_var_collation_client(cs2,
- thd->variables.collation_database,
- cs2);
+ var= (new (thd->mem_root)
+ set_var_collation_client(cs2,
+ thd->variables.collation_database,
+ cs2));
if (var == NULL)
MYSQL_YYABORT;
- lex->var_list.push_back(var);
+ lex->var_list.push_back(var, thd->mem_root);
}
| NAMES_SYM equal expr
{
@@ -14743,7 +14815,7 @@ option_value_no_option_type:
if (spc && spc->find_variable(names, false))
my_error(ER_SP_BAD_VAR_SHADOW, MYF(0), names.str);
else
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
@@ -14761,10 +14833,10 @@ option_value_no_option_type:
MYSQL_YYABORT;
}
set_var_collation_client *var;
- var= new set_var_collation_client(cs3, cs3, cs3);
+ var= new (thd->mem_root) set_var_collation_client(cs3, cs3, cs3);
if (var == NULL)
MYSQL_YYABORT;
- lex->var_list.push_back(var);
+ lex->var_list.push_back(var, thd->mem_root);
}
| DEFAULT ROLE_SYM grant_role
{
@@ -14773,11 +14845,12 @@ option_value_no_option_type:
if (!(user=(LEX_USER *) thd->calloc(sizeof(LEX_USER))))
MYSQL_YYABORT;
user->user= current_user;
- set_var_default_role *var= new set_var_default_role(user,
- $3->user);
+ set_var_default_role *var= (new (thd->mem_root)
+ set_var_default_role(user,
+ $3->user));
if (var == NULL)
MYSQL_YYABORT;
- lex->var_list.push_back(var);
+ lex->var_list.push_back(var, thd->mem_root);
thd->lex->autocommit= TRUE;
if (lex->sphead)
lex->sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT;
@@ -14785,10 +14858,11 @@ option_value_no_option_type:
| DEFAULT ROLE_SYM grant_role FOR_SYM user
{
LEX *lex = Lex;
- set_var_default_role *var= new set_var_default_role($5, $3->user);
+ set_var_default_role *var= (new (thd->mem_root)
+ set_var_default_role($5, $3->user));
if (var == NULL)
MYSQL_YYABORT;
- lex->var_list.push_back(var);
+ lex->var_list.push_back(var, thd->mem_root);
thd->lex->autocommit= TRUE;
if (lex->sphead)
lex->sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT;
@@ -14796,18 +14870,19 @@ option_value_no_option_type:
| ROLE_SYM ident_or_text
{
LEX *lex = Lex;
- set_var_role *var= new set_var_role($2);
+ set_var_role *var= new (thd->mem_root) set_var_role($2);
if (var == NULL)
MYSQL_YYABORT;
- lex->var_list.push_back(var);
+ lex->var_list.push_back(var, thd->mem_root);
}
| PASSWORD_SYM opt_for_user text_or_password
{
LEX *lex = Lex;
- set_var_password *var= new set_var_password(lex->definer);
+ set_var_password *var= (new (thd->mem_root)
+ set_var_password(lex->definer));
if (var == NULL)
MYSQL_YYABORT;
- lex->var_list.push_back(var);
+ lex->var_list.push_back(var, thd->mem_root);
lex->autocommit= TRUE;
if (lex->sphead)
lex->sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT;
@@ -14847,7 +14922,7 @@ internal_variable_name:
LEX *lex= Lex;
if (check_reserved_words(&$1))
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
if (lex->sphead && lex->sphead->m_type == TYPE_ENUM_TRIGGER &&
@@ -14909,16 +14984,17 @@ transaction_access_mode:
transaction_access_mode_types
{
LEX *lex=Lex;
- Item *item= new (thd->mem_root) Item_int((int32) $1);
+ Item *item= new (thd->mem_root) Item_int(thd, (int32) $1);
if (item == NULL)
MYSQL_YYABORT;
- set_var *var= new set_var(lex->option_type,
- find_sys_var(thd, "tx_read_only"),
- &null_lex_str,
- item);
+ set_var *var= (new (thd->mem_root)
+ set_var(thd, lex->option_type,
+ find_sys_var(thd, "tx_read_only"),
+ &null_lex_str,
+ item));
if (var == NULL)
MYSQL_YYABORT;
- lex->var_list.push_back(var);
+ lex->var_list.push_back(var, thd->mem_root);
}
;
@@ -14926,16 +15002,17 @@ isolation_level:
ISOLATION LEVEL_SYM isolation_types
{
LEX *lex=Lex;
- Item *item= new (thd->mem_root) Item_int((int32) $3);
+ Item *item= new (thd->mem_root) Item_int(thd, (int32) $3);
if (item == NULL)
MYSQL_YYABORT;
- set_var *var= new set_var(lex->option_type,
- find_sys_var(thd, "tx_isolation"),
- &null_lex_str,
- item);
+ set_var *var= (new (thd->mem_root)
+ set_var(thd, lex->option_type,
+ find_sys_var(thd, "tx_isolation"),
+ &null_lex_str,
+ item));
if (var == NULL)
MYSQL_YYABORT;
- lex->var_list.push_back(var);
+ lex->var_list.push_back(var, thd->mem_root);
}
;
@@ -14989,19 +15066,19 @@ set_expr_or_default:
| DEFAULT { $$=0; }
| ON
{
- $$=new (thd->mem_root) Item_string_sys("ON", 2);
+ $$=new (thd->mem_root) Item_string_sys(thd, "ON", 2);
if ($$ == NULL)
MYSQL_YYABORT;
}
| ALL
{
- $$=new (thd->mem_root) Item_string_sys("ALL", 3);
+ $$=new (thd->mem_root) Item_string_sys(thd, "ALL", 3);
if ($$ == NULL)
MYSQL_YYABORT;
}
| BINARY
{
- $$=new (thd->mem_root) Item_string_sys("binary", 6);
+ $$=new (thd->mem_root) Item_string_sys(thd, "binary", 6);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -15026,13 +15103,8 @@ lock:
;
table_or_tables:
- TABLE_SYM { Lex->only_view= FALSE; }
- | TABLES { Lex->only_view= FALSE; }
- ;
-
-table_or_view:
- table_or_tables
- | VIEW_SYM { Lex->only_view= TRUE; }
+ TABLE_SYM { }
+ | TABLES { }
;
table_lock_list:
@@ -15123,7 +15195,7 @@ handler:
lex->expr_allows_subselect= FALSE;
lex->sql_command = SQLCOM_HA_READ;
lex->ha_rkey_mode= HA_READ_KEY_EXACT; /* Avoid purify warnings */
- Item *one= new (thd->mem_root) Item_int((int32) 1);
+ Item *one= new (thd->mem_root) Item_int(thd, (int32) 1);
if (one == NULL)
MYSQL_YYABORT;
lex->current_select->select_limit= one;
@@ -15165,7 +15237,7 @@ handler_rkey_function:
LEX *lex=Lex;
lex->ha_read_mode = RKEY;
lex->ha_rkey_mode=$1;
- if (!(lex->insert_list = new List_item))
+ if (!(lex->insert_list= new (thd->mem_root) List_item))
MYSQL_YYABORT;
}
'(' values ')'
@@ -15199,7 +15271,7 @@ revoke_command:
LEX *lex= Lex;
if (lex->columns.elements)
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
lex->sql_command= SQLCOM_REVOKE;
@@ -15210,7 +15282,7 @@ revoke_command:
LEX *lex= Lex;
if (lex->columns.elements)
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
lex->sql_command= SQLCOM_REVOKE;
@@ -15230,7 +15302,7 @@ revoke_command:
| admin_option_for_role FROM user_and_role_list
{
Lex->sql_command= SQLCOM_REVOKE_ROLE;
- if (Lex->users_list.push_front($1))
+ if (Lex->users_list.push_front($1, thd->mem_root))
MYSQL_YYABORT;
}
;
@@ -15261,7 +15333,7 @@ grant_command:
LEX *lex= Lex;
if (lex->columns.elements)
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
lex->sql_command= SQLCOM_GRANT;
@@ -15273,7 +15345,7 @@ grant_command:
LEX *lex= Lex;
if (lex->columns.elements)
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
lex->sql_command= SQLCOM_GRANT;
@@ -15291,7 +15363,7 @@ grant_command:
LEX *lex= Lex;
lex->sql_command= SQLCOM_GRANT_ROLE;
/* The first role is the one that is granted */
- if (Lex->users_list.push_front($1))
+ if (Lex->users_list.push_front($1, thd->mem_root))
MYSQL_YYABORT;
}
@@ -15308,12 +15380,12 @@ opt_with_admin_option:
role_list:
grant_role
{
- if (Lex->users_list.push_back($1))
+ if (Lex->users_list.push_back($1, thd->mem_root))
MYSQL_YYABORT;
}
| role_list ',' grant_role
{
- if (Lex->users_list.push_back($3))
+ if (Lex->users_list.push_back($3, thd->mem_root))
MYSQL_YYABORT;
}
;
@@ -15346,7 +15418,7 @@ grant_role:
$$->plugin= empty_lex_str;
$$->auth= empty_lex_str;
- if (check_string_char_length(&$$->user, ER(ER_USERNAME),
+ if (check_string_char_length(&$$->user, ER_USERNAME,
username_char_length,
system_charset_info, 0))
MYSQL_YYABORT;
@@ -15474,7 +15546,7 @@ grant_ident:
else if (lex->columns.elements)
{
my_message(ER_ILLEGAL_GRANT_FOR_TABLE,
- ER(ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0));
+ ER_THD(thd, ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0));
MYSQL_YYABORT;
}
}
@@ -15487,7 +15559,7 @@ grant_ident:
else if (lex->columns.elements)
{
my_message(ER_ILLEGAL_GRANT_FOR_TABLE,
- ER(ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0));
+ ER_THD(thd, ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0));
MYSQL_YYABORT;
}
}
@@ -15500,7 +15572,7 @@ grant_ident:
else if (lex->columns.elements)
{
my_message(ER_ILLEGAL_GRANT_FOR_TABLE,
- ER(ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0));
+ ER_THD(thd, ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0));
MYSQL_YYABORT;
}
}
@@ -15518,12 +15590,12 @@ grant_ident:
user_list:
user
{
- if (Lex->users_list.push_back($1))
+ if (Lex->users_list.push_back($1, thd->mem_root))
MYSQL_YYABORT;
}
| user_list ',' user
{
- if (Lex->users_list.push_back($3))
+ if (Lex->users_list.push_back($3, thd->mem_root))
MYSQL_YYABORT;
}
;
@@ -15531,12 +15603,12 @@ user_list:
grant_list:
grant_user
{
- if (Lex->users_list.push_back($1))
+ if (Lex->users_list.push_back($1, thd->mem_root))
MYSQL_YYABORT;
}
| grant_list ',' grant_user
{
- if (Lex->users_list.push_back($3))
+ if (Lex->users_list.push_back($3, thd->mem_root))
MYSQL_YYABORT;
}
;
@@ -15544,12 +15616,12 @@ grant_list:
user_and_role_list:
user_or_role
{
- if (Lex->users_list.push_back($1))
+ if (Lex->users_list.push_back($1, thd->mem_root))
MYSQL_YYABORT;
}
| user_and_role_list ',' user_or_role
{
- if (Lex->users_list.push_back($3))
+ if (Lex->users_list.push_back($3, thd->mem_root))
MYSQL_YYABORT;
}
;
@@ -15602,7 +15674,7 @@ column_list:
column_list_id:
ident
{
- String *new_str = new (thd->mem_root) String((const char*) $1.str,$1.length,system_charset_info);
+ String *new_str= new (thd->mem_root) String((const char*) $1.str,$1.length,system_charset_info);
if (new_str == NULL)
MYSQL_YYABORT;
List_iterator <LEX_COLUMN> iter(Lex->columns);
@@ -15619,10 +15691,11 @@ column_list_id:
point->rights |= lex->which_columns;
else
{
- LEX_COLUMN *col= new LEX_COLUMN (*new_str,lex->which_columns);
+ LEX_COLUMN *col= (new (thd->mem_root)
+ LEX_COLUMN(*new_str,lex->which_columns));
if (col == NULL)
MYSQL_YYABORT;
- lex->columns.push_back(col);
+ lex->columns.push_back(col, thd->mem_root);
}
}
;
@@ -15902,7 +15975,7 @@ subselect_start:
if (!lex->expr_allows_subselect ||
lex->sql_command == (int)SQLCOM_PURGE)
{
- my_parse_error(ER(ER_SYNTAX_ERROR));
+ my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
/*
@@ -16097,15 +16170,17 @@ view_list_opt:
view_list:
ident
- {
- Lex->view_list.push_back((LEX_STRING*)
- thd->memdup(&$1, sizeof(LEX_STRING)));
- }
+ {
+ Lex->view_list.push_back((LEX_STRING*)
+ thd->memdup(&$1, sizeof(LEX_STRING)),
+ thd->mem_root);
+ }
| view_list ',' ident
- {
- Lex->view_list.push_back((LEX_STRING*)
- thd->memdup(&$3, sizeof(LEX_STRING)));
- }
+ {
+ Lex->view_list.push_back((LEX_STRING*)
+ thd->memdup(&$3, sizeof(LEX_STRING)),
+ thd->mem_root);
+ }
;
view_select:
@@ -16338,9 +16413,9 @@ sf_tail:
- The user deploys 5.{N+1}. At this point, 'select foo()'
means something different, and the user code is most likely
broken (it's only safe if the code is 'select db.foo()').
- With a warning printed when the SF is loaded (which has to occur
- before the call), the warning will provide a hint explaining
- the root cause of a later failure of 'select foo()'.
+ With a warning printed when the SF is loaded (which has to
+ occur before the call), the warning will provide a hint
+ explaining the root cause of a later failure of 'select foo()'.
With no warning printed, the user code will fail with no
apparent reason.
Printing a warning each time db_load_routine is executed for
@@ -16352,7 +16427,7 @@ sf_tail:
push_warning_printf(thd,
Sql_condition::WARN_LEVEL_NOTE,
ER_NATIVE_FCT_NAME_COLLISION,
- ER(ER_NATIVE_FCT_NAME_COLLISION),
+ ER_THD(thd, ER_NATIVE_FCT_NAME_COLLISION),
sp->m_name.str);
}
sp->restore_thd_mem_root(thd);
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 88e5f1b392b..d52316a8fab 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -34,7 +34,7 @@
#include "sql_plugin.h" // Includes my_global.h
#include "sql_priv.h"
#include "sql_class.h" // set_var.h: THD
-#include "sys_vars.h"
+#include "sys_vars.ic"
#include "events.h"
#include <thr_alarm.h>
@@ -325,6 +325,14 @@ static Sys_var_long Sys_pfs_digest_size(
DEFAULT(-1),
BLOCK_SIZE(1));
+static Sys_var_long Sys_pfs_max_digest_length(
+ "performance_schema_max_digest_length",
+ "Maximum length considered for digest text, when stored in performance_schema tables.",
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_max_digest_length),
+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024 * 1024),
+ DEFAULT(1024),
+ BLOCK_SIZE(1));
+
static Sys_var_long Sys_pfs_connect_attrs_size(
"performance_schema_session_connect_attrs_size",
"Size of session attribute string buffer per thread."
@@ -362,10 +370,10 @@ static Sys_var_mybool Sys_automatic_sp_privileges(
static Sys_var_ulong Sys_back_log(
"back_log", "The number of outstanding connection requests "
- "MySQL can have. This comes into play when the main MySQL thread "
+ "MariaDB can have. This comes into play when the main MySQL thread "
"gets very many connection requests in a very short time",
- READ_ONLY GLOBAL_VAR(back_log), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(1, 65535), DEFAULT(150), BLOCK_SIZE(1));
+ AUTO_SET READ_ONLY GLOBAL_VAR(back_log), CMD_LINE(REQUIRED_ARG),
+ VALID_RANGE(0, 65535), DEFAULT(150), BLOCK_SIZE(1));
static Sys_var_charptr Sys_basedir(
"basedir", "Path to installation directory. All paths are "
@@ -1027,7 +1035,7 @@ static Sys_var_ulonglong Sys_join_buffer_size(
"join_buffer_size",
"The size of the buffer that is used for joins",
SESSION_VAR(join_buff_size), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(128, SIZE_T_MAX), DEFAULT(128*1024), BLOCK_SIZE(128));
+ VALID_RANGE(128, SIZE_T_MAX), DEFAULT(256*1024), BLOCK_SIZE(128));
static Sys_var_keycache Sys_key_buffer_size(
"key_buffer_size", "The size of the buffer used for "
@@ -1124,7 +1132,6 @@ static Sys_var_mybool Sys_log_bin(
"log_bin", "Whether the binary log is enabled",
READ_ONLY GLOBAL_VAR(opt_bin_log), NO_CMD_LINE, DEFAULT(FALSE));
-
static Sys_var_mybool Sys_trust_function_creators(
"log_bin_trust_function_creators",
"If set to FALSE (the default), then when --log-bin is used, creation "
@@ -1267,7 +1274,8 @@ static bool check_max_allowed_packet(sys_var *self, THD *thd, set_var *var)
if (val < (longlong) global_system_variables.net_buffer_length)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- WARN_OPTION_BELOW_LIMIT, ER(WARN_OPTION_BELOW_LIMIT),
+ WARN_OPTION_BELOW_LIMIT,
+ ER_THD(thd, WARN_OPTION_BELOW_LIMIT),
"max_allowed_packet", "net_buffer_length");
}
return false;
@@ -1278,7 +1286,7 @@ static Sys_var_ulong Sys_max_allowed_packet(
"max_allowed_packet",
"Max packet length to send to or receive from the server",
SESSION_VAR(max_allowed_packet), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(1024, 1024*1024*1024), DEFAULT(1024*1024),
+ VALID_RANGE(1024, 1024*1024*1024), DEFAULT(4*1024*1024),
BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_max_allowed_packet));
@@ -1348,7 +1356,7 @@ static Sys_var_ulong Sys_max_connect_errors(
static Sys_var_uint Sys_max_digest_length(
"max_digest_length", "Maximum length considered for digest text.",
- PARSED_EARLY READ_ONLY GLOBAL_VAR(max_digest_length),
+ READ_ONLY GLOBAL_VAR(max_digest_length),
CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 1024 * 1024), DEFAULT(1024), BLOCK_SIZE(1));
@@ -1714,7 +1722,7 @@ Sys_var_gtid_binlog_state::global_update(THD *thd, set_var *var)
struct gtid_binlog_state_data *data=
(struct gtid_binlog_state_data *)var->save_result.ptr;
mysql_mutex_unlock(&LOCK_global_system_variables);
- res= (0 != reset_master(thd, data->list, data->list_len));
+ res= (reset_master(thd, data->list, data->list_len, 0) != 0);
mysql_mutex_lock(&LOCK_global_system_variables);
my_free(data->list);
my_free(data);
@@ -2171,7 +2179,8 @@ static bool check_net_buffer_length(sys_var *self, THD *thd, set_var *var)
if (val > (longlong) global_system_variables.max_allowed_packet)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- WARN_OPTION_BELOW_LIMIT, ER(WARN_OPTION_BELOW_LIMIT),
+ WARN_OPTION_BELOW_LIMIT,
+ ER_THD(thd, WARN_OPTION_BELOW_LIMIT),
"max_allowed_packet", "net_buffer_length");
}
return false;
@@ -2355,7 +2364,7 @@ static bool fix_optimizer_switch(sys_var *self, THD *thd,
if (sv->optimizer_switch & deprecated_ENGINE_CONDITION_PUSHDOWN)
push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,
- ER(ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT),
+ ER_THD(thd, ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT),
"engine_condition_pushdown=on");
return false;
}
@@ -2682,17 +2691,6 @@ static Sys_var_enum Sys_thread_handling(
);
#ifdef HAVE_QUERY_CACHE
-static bool check_query_cache_size(sys_var *self, THD *thd, set_var *var)
-{
- if (global_system_variables.query_cache_type == 0 &&
- var->value && var->value->val_int() != 0)
- {
- my_error(ER_QUERY_CACHE_DISABLED, MYF(0));
- return true;
- }
-
- return false;
-}
static bool fix_query_cache_size(sys_var *self, THD *thd, enum_var_type type)
{
ulong new_cache_size= query_cache.resize(query_cache_size);
@@ -2702,12 +2700,14 @@ static bool fix_query_cache_size(sys_var *self, THD *thd, enum_var_type type)
*/
if (query_cache_size != new_cache_size)
push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_WARN_QC_RESIZE, ER(ER_WARN_QC_RESIZE),
+ ER_WARN_QC_RESIZE, ER_THD(thd, ER_WARN_QC_RESIZE),
query_cache_size, new_cache_size);
query_cache_size= new_cache_size;
+
return false;
}
+
static bool fix_query_cache_limit(sys_var *self, THD *thd, enum_var_type type)
{
query_cache.result_size_limit(query_cache_limit);
@@ -2717,8 +2717,8 @@ static Sys_var_ulonglong Sys_query_cache_size(
"query_cache_size",
"The memory allocated to store results from old queries",
GLOBAL_VAR(query_cache_size), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1024),
- NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_query_cache_size),
+ VALID_RANGE(0, ULONG_MAX), DEFAULT(1024*1024), BLOCK_SIZE(1024),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, NULL,
ON_UPDATE(fix_query_cache_size));
static Sys_var_ulong Sys_query_cache_limit(
@@ -2744,6 +2744,7 @@ static Sys_var_ulong Sys_query_cache_min_res_unit(
ON_UPDATE(fix_qcache_min_res_unit));
static const char *query_cache_type_names[]= { "OFF", "ON", "DEMAND", 0 };
+
static bool check_query_cache_type(sys_var *self, THD *thd, set_var *var)
{
if (query_cache.is_disable_in_progress())
@@ -2751,16 +2752,22 @@ static bool check_query_cache_type(sys_var *self, THD *thd, set_var *var)
my_error(ER_QUERY_CACHE_IS_DISABLED, MYF(0));
return true;
}
- if (var->type != OPT_GLOBAL &&
- global_system_variables.query_cache_type == 0 &&
- var->value->val_int() != 0)
+
+ if (var->type != OPT_GLOBAL && global_system_variables.query_cache_type == 0)
{
- my_error(ER_QUERY_CACHE_IS_GLOBALY_DISABLED, MYF(0));
- return true;
+ if (var->value)
+ {
+ if (var->save_result.ulonglong_value != 0)
+ {
+ my_error(ER_QUERY_CACHE_IS_GLOBALY_DISABLED, MYF(0));
+ return true;
+ }
+ }
}
-
return false;
}
+
+
static bool fix_query_cache_type(sys_var *self, THD *thd, enum_var_type type)
{
if (type != OPT_GLOBAL)
@@ -2784,7 +2791,7 @@ static Sys_var_enum Sys_query_cache_type(
"except SELECT SQL_NO_CACHE ... queries. DEMAND = Cache only "
"SELECT SQL_CACHE ... queries",
NO_SET_STMT SESSION_VAR(query_cache_type), CMD_LINE(REQUIRED_ARG),
- query_cache_type_names, DEFAULT(1), NO_MUTEX_GUARD, NOT_IN_BINLOG,
+ query_cache_type_names, DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_query_cache_type),
ON_UPDATE(fix_query_cache_type));
@@ -2800,7 +2807,7 @@ static Sys_var_mybool Sys_secure_auth(
"Disallow authentication for accounts that have old (pre-4.1) "
"passwords",
GLOBAL_VAR(opt_secure_auth), CMD_LINE(OPT_ARG),
- DEFAULT(FALSE));
+ DEFAULT(TRUE));
static Sys_var_charptr Sys_secure_file_priv(
"secure_file_priv",
@@ -3053,7 +3060,10 @@ static Sys_var_set Sys_sql_mode(
"sql_mode",
"Sets the sql mode",
SESSION_VAR(sql_mode), CMD_LINE(REQUIRED_ARG),
- sql_mode_names, DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
+ sql_mode_names,
+ DEFAULT(MODE_NO_ENGINE_SUBSTITUTION |
+ MODE_NO_AUTO_CREATE_USER),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_sql_mode), ON_UPDATE(fix_sql_mode));
static const char *old_mode_names[]=
@@ -3426,7 +3436,7 @@ static Sys_var_plugin Sys_default_tmp_storage_engine(
static Sys_var_plugin Sys_enforce_storage_engine(
"enforce_storage_engine", "Force the use of a storage engine for new tables",
- SESSION_ONLY(enforced_table_plugin),
+ SESSION_VAR(enforced_table_plugin),
NO_CMD_LINE, MYSQL_STORAGE_ENGINE_PLUGIN,
DEFAULT(&enforced_storage_engine), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_has_super));
@@ -4170,10 +4180,37 @@ static Sys_var_charptr Sys_relay_log(
READ_ONLY GLOBAL_VAR(opt_relay_logname), CMD_LINE(REQUIRED_ARG),
IN_FS_CHARSET, DEFAULT(0));
+/*
+ Uses NO_CMD_LINE since the --relay-log-index option set
+ opt_relaylog_index_name variable and computes a value for the
+ relay_log_index variable.
+*/
static Sys_var_charptr Sys_relay_log_index(
"relay_log_index", "The location and name to use for the file "
"that keeps a list of the last relay logs",
- READ_ONLY GLOBAL_VAR(opt_relaylog_index_name), CMD_LINE(REQUIRED_ARG),
+ READ_ONLY GLOBAL_VAR(relay_log_index), NO_CMD_LINE,
+ IN_FS_CHARSET, DEFAULT(0));
+
+/*
+ Uses NO_CMD_LINE since the --log-bin-index option set
+ opt_binlog_index_name variable and computes a value for the
+ log_bin_index variable.
+*/
+static Sys_var_charptr Sys_binlog_index(
+ "log_bin_index", "File that holds the names for last binary log files.",
+ READ_ONLY GLOBAL_VAR(log_bin_index), NO_CMD_LINE,
+ IN_FS_CHARSET, DEFAULT(0));
+
+static Sys_var_charptr Sys_relay_log_basename(
+ "relay_log_basename",
+ "The full path of the relay log file names, excluding the extension.",
+ READ_ONLY GLOBAL_VAR(relay_log_basename), NO_CMD_LINE,
+ IN_FS_CHARSET, DEFAULT(0));
+
+static Sys_var_charptr Sys_log_bin_basename(
+ "log_bin_basename",
+ "The full path of the binary log file names, excluding the extension.",
+ READ_ONLY GLOBAL_VAR(log_bin_basename), NO_CMD_LINE,
IN_FS_CHARSET, DEFAULT(0));
static Sys_var_charptr Sys_relay_log_info_file(
@@ -4471,16 +4508,16 @@ static Sys_var_ulonglong Sys_relay_log_space_limit(
static Sys_var_uint Sys_sync_relaylog_period(
"sync_relay_log", "Synchronously flush relay log to disk after "
- "every #th event. Use 0 (default) to disable synchronous flushing",
+ "every #th event. Use 0 to disable synchronous flushing",
GLOBAL_VAR(sync_relaylog_period), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1));
+ VALID_RANGE(0, UINT_MAX), DEFAULT(10000), BLOCK_SIZE(1));
static Sys_var_uint Sys_sync_relayloginfo_period(
"sync_relay_log_info", "Synchronously flush relay log info "
- "to disk after every #th transaction. Use 0 (default) to disable "
+ "to disk after every #th transaction. Use 0 to disable "
"synchronous flushing",
GLOBAL_VAR(sync_relayloginfo_period), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1));
+ VALID_RANGE(0, UINT_MAX), DEFAULT(10000), BLOCK_SIZE(1));
#endif
static Sys_var_uint Sys_sync_binlog_period(
@@ -4491,9 +4528,9 @@ static Sys_var_uint Sys_sync_binlog_period(
static Sys_var_uint Sys_sync_masterinfo_period(
"sync_master_info", "Synchronously flush master info to disk "
- "after every #th event. Use 0 (default) to disable synchronous flushing",
+ "after every #th event. Use 0 to disable synchronous flushing",
GLOBAL_VAR(sync_masterinfo_period), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1));
+ VALID_RANGE(0, UINT_MAX), DEFAULT(10000), BLOCK_SIZE(1));
#ifdef HAVE_REPLICATION
static Sys_var_ulong Sys_slave_trans_retries(
@@ -4558,11 +4595,22 @@ static bool check_locale(sys_var *self, THD *thd, set_var *var)
return false;
}
+static bool update_locale(sys_var *self, THD* thd, enum_var_type type)
+{
+ /* Cache pointer to error messages */
+ if (type == OPT_SESSION)
+ thd->variables.errmsgs= thd->variables.lc_messages->errmsgs->errmsgs;
+ else
+ global_system_variables.errmsgs=
+ global_system_variables.lc_messages->errmsgs->errmsgs;
+ return false;
+}
+
static Sys_var_struct Sys_lc_messages(
"lc_messages", "Set the language used for the error messages",
SESSION_VAR(lc_messages), NO_CMD_LINE,
my_offsetof(MY_LOCALE, name), DEFAULT(&my_default_lc_messages),
- NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_locale));
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_locale), ON_UPDATE(update_locale));
static Sys_var_struct Sys_lc_time_names(
"lc_time_names", "Set the language used for the month "
@@ -4783,8 +4831,10 @@ static Sys_var_uint Sys_wsrep_sync_wait(
static const char *wsrep_OSU_method_names[]= { "TOI", "RSU", NullS };
static Sys_var_enum Sys_wsrep_OSU_method(
"wsrep_OSU_method", "Method for Online Schema Upgrade",
- GLOBAL_VAR(wsrep_OSU_method_options), CMD_LINE(OPT_ARG),
- wsrep_OSU_method_names, DEFAULT(WSREP_OSU_TOI));
+ SESSION_VAR(wsrep_OSU_method), CMD_LINE(OPT_ARG),
+ wsrep_OSU_method_names, DEFAULT(WSREP_OSU_TOI),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
+ ON_UPDATE(0));
static PolyLock_mutex PLock_wsrep_desync(&LOCK_wsrep_desync);
static Sys_var_mybool Sys_wsrep_desync (
@@ -4880,7 +4930,7 @@ static bool fix_host_cache_size(sys_var *, THD *, enum_var_type)
static Sys_var_ulong Sys_host_cache_size(
"host_cache_size",
"How many host names should be cached to avoid resolving.",
- GLOBAL_VAR(host_cache_size),
+ AUTO_SET GLOBAL_VAR(host_cache_size),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 65536),
DEFAULT(HOST_CACHE_SIZE),
BLOCK_SIZE(1),
@@ -4936,14 +4986,6 @@ static Sys_var_ulong Sys_deadlock_timeout_depth_long(
SESSION_VAR(wt_timeout_long), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(50000000), BLOCK_SIZE(1));
-#ifndef DBUG_OFF
-static Sys_var_ulong Sys_debug_crc_break(
- "debug_crc_break",
- "Call my_debug_put_break_here() if crc matches this number (for debug)",
- GLOBAL_VAR(my_crc_dbug_check), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1));
-#endif
-
static Sys_var_uint Sys_extra_port(
"extra_port",
"Extra port number to use for tcp connections in a "
@@ -5171,7 +5213,28 @@ static Sys_var_mybool Sys_encrypt_tmp_files(
"encrypt_tmp_files",
"Encrypt temporary files (created for filesort, binary log cache, etc)",
READ_ONLY GLOBAL_VAR(encrypt_tmp_files),
- CMD_LINE(OPT_ARG), DEFAULT(TRUE));
+ CMD_LINE(OPT_ARG), DEFAULT(FALSE));
+
+static Sys_var_mybool Sys_binlog_encryption(
+ "encrypt_binlog", "Encrypt binary logs (including relay logs)",
+ READ_ONLY GLOBAL_VAR(encrypt_binlog), CMD_LINE(OPT_ARG),
+ DEFAULT(FALSE));
+
+static const char *binlog_row_image_names[]= {"MINIMAL", "NOBLOB", "FULL", NullS};
+static Sys_var_enum Sys_binlog_row_image(
+ "binlog_row_image",
+ "Controls whether rows should be logged in 'FULL', 'NOBLOB' or "
+ "'MINIMAL' formats. 'FULL', means that all columns in the before "
+ "and after image are logged. 'NOBLOB', means that mysqld avoids logging "
+ "blob columns whenever possible (eg, blob column was not changed or "
+ "is not part of primary key). 'MINIMAL', means that a PK equivalent (PK "
+ "columns or full row if there is no PK in the table) is logged in the "
+ "before image, and only changed columns are logged in the after image. "
+ "(Default: FULL).",
+ SESSION_VAR(binlog_row_image), CMD_LINE(REQUIRED_ARG),
+ binlog_row_image_names, DEFAULT(BINLOG_ROW_IMAGE_FULL),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL),
+ ON_UPDATE(NULL));
static bool check_pseudo_slave_mode(sys_var *self, THD *thd, set_var *var)
{
diff --git a/sql/sys_vars.h b/sql/sys_vars.ic
index 7c0359a7427..2badd5d997a 100644
--- a/sql/sys_vars.h
+++ b/sql/sys_vars.ic
@@ -54,6 +54,7 @@
#define ON_CHECK(X) X
#define ON_UPDATE(X) X
#define READ_ONLY sys_var::READONLY+
+#define AUTO_SET sys_var::AUTO_SET+
// this means that Sys_var_charptr initial value was malloc()ed
#define PREALLOCATED sys_var::ALLOCATED+
#define PARSED_EARLY sys_var::PARSE_EARLY+
@@ -137,7 +138,7 @@ public:
getopt.arg_type, SHOWT, def_val, lock, binlog_status_arg,
on_check_func, on_update_func, substitute)
{
- option.var_type= ARGT;
+ option.var_type|= ARGT;
option.min_value= min_val;
option.max_value= max_val;
option.block_size= block_size;
@@ -342,7 +343,7 @@ public:
binlog_status_arg, on_check_func, on_update_func,
substitute)
{
- option.var_type= GET_ENUM;
+ option.var_type|= GET_ENUM;
global_var(ulong)= def_val;
SYSVAR_ASSERT(def_val < typelib.count);
SYSVAR_ASSERT(size == sizeof(ulong));
@@ -393,7 +394,7 @@ public:
binlog_status_arg, on_check_func, on_update_func,
substitute)
{
- option.var_type= GET_BOOL;
+ option.var_type|= GET_BOOL;
global_var(my_bool)= def_val;
SYSVAR_ASSERT(def_val < 2);
SYSVAR_ASSERT(getopt.arg_type == OPT_ARG || getopt.id < 0);
@@ -459,7 +460,7 @@ public:
otherwise (GET_STR) you'll never know whether to free it or not.
(think of an exit because of an error right after my_getopt)
*/
- option.var_type= (flags & ALLOCATED) ? GET_STR_ALLOC : GET_STR;
+ option.var_type|= (flags & ALLOCATED) ? GET_STR_ALLOC : GET_STR;
global_var(const char*)= def_val;
SYSVAR_ASSERT(scope() == GLOBAL);
SYSVAR_ASSERT(size == sizeof(char *));
@@ -546,7 +547,7 @@ public:
NULL, NULL, NULL)
{
is_os_charset= is_os_charset_arg == IN_FS_CHARSET;
- option.var_type= GET_STR;
+ option.var_type|= GET_STR;
}
bool do_check(THD *thd, set_var *var)
{
@@ -602,7 +603,7 @@ public:
NO_ARG, SHOW_CHAR, 0, NULL, VARIABLE_NOT_IN_BINLOG,
NULL, NULL, NULL), opt_id(getopt_id)
{
- option.var_type= GET_STR | GET_ASK_ADDR;
+ option.var_type|= GET_STR | GET_ASK_ADDR;
}
bool do_check(THD *thd, set_var *var)
@@ -691,7 +692,7 @@ public:
0, VARIABLE_NOT_IN_BINLOG, on_check_func, on_update_func,
0),max_length(max_length_arg)
{
- option.var_type= GET_STR;
+ option.var_type|= GET_STR;
SYSVAR_ASSERT(scope() == ONLY_SESSION)
*const_cast<SHOW_TYPE*>(&show_val_type)= SHOW_LEX_STRING;
}
@@ -778,7 +779,7 @@ public:
getopt.arg_type, SHOW_CHAR, (intptr)def_val,
lock, binlog_status_arg, on_check_func, on_update_func,
substitute)
- { option.var_type= GET_STR; }
+ { option.var_type|= GET_STR; }
bool do_check(THD *thd, set_var *var)
{
char buff[STRING_BUFFER_USUAL_SIZE];
@@ -1025,7 +1026,7 @@ public:
lock, binlog_status_arg, on_check_func, on_update_func,
substitute)
{
- option.var_type= GET_DOUBLE;
+ option.var_type|= GET_DOUBLE;
option.min_value= (longlong) getopt_double2ulonglong(min_val);
option.max_value= (longlong) getopt_double2ulonglong(max_val);
global_var(double)= (double)option.def_value;
@@ -1126,7 +1127,7 @@ public:
binlog_status_arg, on_check_func, on_update_func,
substitute)
{
- option.var_type= GET_FLAGSET;
+ option.var_type|= GET_FLAGSET;
global_var(ulonglong)= def_val;
SYSVAR_ASSERT(typelib.count > 1);
SYSVAR_ASSERT(typelib.count <= 65);
@@ -1235,7 +1236,7 @@ public:
binlog_status_arg, on_check_func, on_update_func,
substitute)
{
- option.var_type= GET_SET;
+ option.var_type|= GET_SET;
global_var(ulonglong)= def_val;
SYSVAR_ASSERT(typelib.count > 0);
SYSVAR_ASSERT(typelib.count <= 64);
@@ -1340,7 +1341,7 @@ public:
substitute),
plugin_type(plugin_type_arg)
{
- option.var_type= GET_STR;
+ option.var_type|= GET_STR;
SYSVAR_ASSERT(size == sizeof(plugin_ref));
SYSVAR_ASSERT(getopt.id < 0); // force NO_CMD_LINE
}
@@ -1456,7 +1457,7 @@ public:
substitute)
{
SYSVAR_ASSERT(scope() == ONLY_SESSION);
- option.var_type= GET_STR;
+ option.var_type|= GET_STR;
}
bool do_check(THD *thd, set_var *var)
{
@@ -1548,7 +1549,7 @@ public:
binlog_status_arg, on_check_func, on_update_func,
substitute)
{
- option.var_type= GET_BOOL;
+ option.var_type|= GET_BOOL;
reverse_semantics= my_count_bits(bitmask_arg) > 1;
bitmask= reverse_semantics ? ~bitmask_arg : bitmask_arg;
set(global_var_ptr(), def_val);
@@ -1756,7 +1757,7 @@ public:
SYSVAR_ASSERT(is_readonly());
SYSVAR_ASSERT(on_update == 0);
SYSVAR_ASSERT(size == sizeof(enum SHOW_COMP_OPTION));
- option.var_type= GET_STR;
+ option.var_type|= GET_STR;
}
bool do_check(THD *thd, set_var *var) {
DBUG_ASSERT(FALSE);
@@ -1818,7 +1819,7 @@ public:
substitute),
name_offset(name_off)
{
- option.var_type= GET_ENUM; // because we accept INT and STRING here
+ option.var_type|= GET_ENUM; // because we accept INT and STRING here
/*
struct variables are special on the command line - often (e.g. for
charsets) the name cannot be immediately resolved, but only after all
@@ -1887,7 +1888,7 @@ public:
{
SYSVAR_ASSERT(getopt.id < 0);
SYSVAR_ASSERT(size == sizeof(Time_zone *));
- option.var_type= GET_STR;
+ option.var_type|= GET_STR;
}
bool do_check(THD *thd, set_var *var)
{
@@ -2106,7 +2107,7 @@ public:
{
SYSVAR_ASSERT(getopt.id < 0);
SYSVAR_ASSERT(is_readonly());
- option.var_type= GET_STR;
+ option.var_type|= GET_STR;
}
bool do_check(THD *thd, set_var *var)
{
@@ -2155,7 +2156,7 @@ public:
{
SYSVAR_ASSERT(getopt.id < 0);
SYSVAR_ASSERT(is_readonly());
- option.var_type= GET_STR;
+ option.var_type|= GET_STR;
}
bool do_check(THD *thd, set_var *var)
{
@@ -2202,7 +2203,7 @@ public:
getopt.arg_type, SHOW_CHAR, 0, NULL, VARIABLE_NOT_IN_BINLOG,
NULL, NULL, NULL)
{
- option.var_type= GET_STR;
+ option.var_type|= GET_STR;
}
bool do_check(THD *thd, set_var *var);
bool session_update(THD *thd, set_var *var)
@@ -2244,7 +2245,7 @@ public:
getopt.arg_type, SHOW_CHAR, 0, NULL, VARIABLE_NOT_IN_BINLOG,
NULL, NULL, NULL)
{
- option.var_type= GET_STR;
+ option.var_type|= GET_STR;
}
bool do_check(THD *thd, set_var *var);
bool session_update(THD *thd, set_var *var)
@@ -2287,7 +2288,7 @@ public:
{
SYSVAR_ASSERT(getopt.id < 0);
SYSVAR_ASSERT(is_readonly());
- option.var_type= GET_STR;
+ option.var_type|= GET_STR;
}
bool do_check(THD *thd, set_var *var)
{
diff --git a/sql/table.cc b/sql/table.cc
index 5d2c1884482..76cb4b86a81 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -150,7 +150,7 @@ View_creation_ctx * View_creation_ctx::create(THD *thd,
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_VIEW_NO_CREATION_CTX,
- ER(ER_VIEW_NO_CREATION_CTX),
+ ER_THD(thd, ER_VIEW_NO_CREATION_CTX),
(const char *) view->db,
(const char *) view->table_name);
@@ -184,7 +184,7 @@ View_creation_ctx * View_creation_ctx::create(THD *thd,
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_VIEW_INVALID_CREATION_CTX,
- ER(ER_VIEW_INVALID_CREATION_CTX),
+ ER_THD(thd, ER_VIEW_INVALID_CREATION_CTX),
(const char *) view->db,
(const char *) view->table_name);
}
@@ -1657,7 +1657,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
#endif
*field_ptr= reg_field=
- make_field(share, record+recpos,
+ make_field(share, &share->mem_root, record+recpos,
(uint32) field_length,
null_pos, null_bit_pos,
pack_flag,
@@ -2740,8 +2740,8 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
We are using only a prefix of the column as a key:
Create a new field for the key part that matches the index
*/
- field= key_part->field=field->new_field(&outparam->mem_root,
- outparam, 0);
+ field= key_part->field=field->make_new_field(&outparam->mem_root,
+ outparam, 0);
field->field_length= key_part->length;
}
}
@@ -3694,13 +3694,14 @@ Table_check_intact::check(TABLE *table, const TABLE_FIELD_DEF *table_def)
if (table->s->fields != table_def->count)
{
+ THD *thd= current_thd;
DBUG_PRINT("info", ("Column count has changed, checking the definition"));
/* previous MySQL version */
if (MYSQL_VERSION_ID > table->s->mysql_version)
{
report_error(ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE,
- ER(ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE),
+ ER_THD(thd, ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE),
table->alias.c_ptr(), table_def->count, table->s->fields,
static_cast<int>(table->s->mysql_version),
MYSQL_VERSION_ID);
@@ -3709,7 +3710,7 @@ Table_check_intact::check(TABLE *table, const TABLE_FIELD_DEF *table_def)
else if (MYSQL_VERSION_ID == table->s->mysql_version)
{
report_error(ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2,
- ER(ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2),
+ ER_THD(thd, ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2),
table->s->db.str, table->s->table_name.str,
table_def->count, table->s->fields);
DBUG_RETURN(TRUE);
@@ -4141,7 +4142,7 @@ bool TABLE::fill_item_list(List<Item> *item_list) const
*/
for (Field **ptr= field; *ptr; ptr++)
{
- Item_field *item= new Item_field(*ptr);
+ Item_field *item= new (in_use->mem_root) Item_field(in_use, *ptr);
if (!item || item_list->push_back(item))
return TRUE;
}
@@ -4389,7 +4390,7 @@ bool TABLE_LIST::prep_where(THD *thd, Item **conds,
this expression will not be moved to WHERE condition (i.e. will
be clean correctly for PS/SP)
*/
- tbl->on_expr= and_conds(tbl->on_expr,
+ tbl->on_expr= and_conds(thd, tbl->on_expr,
where->copy_andor_structure(thd));
break;
}
@@ -4399,7 +4400,7 @@ bool TABLE_LIST::prep_where(THD *thd, Item **conds,
if (*conds && !(*conds)->fixed)
res= (*conds)->fix_fields(thd, conds);
if (!res)
- *conds= and_conds(*conds, where->copy_andor_structure(thd));
+ *conds= and_conds(thd, *conds, where->copy_andor_structure(thd));
if (*conds && !(*conds)->fixed && !res)
res= (*conds)->fix_fields(thd, conds);
}
@@ -4471,7 +4472,7 @@ merge_on_conds(THD *thd, TABLE_LIST *table, bool is_cascaded)
{
if (tbl->view && !is_cascaded)
continue;
- cond= and_conds(cond, merge_on_conds(thd, tbl, is_cascaded));
+ cond= and_conds(thd, cond, merge_on_conds(thd, tbl, is_cascaded));
}
DBUG_RETURN(cond);
}
@@ -4531,10 +4532,10 @@ bool TABLE_LIST::prep_check_option(THD *thd, uint8 check_opt_type)
for (TABLE_LIST *tbl= merge_underlying_list; tbl; tbl= tbl->next_local)
{
if (tbl->check_option)
- check_option= and_conds(check_option, tbl->check_option);
+ check_option= and_conds(thd, check_option, tbl->check_option);
}
}
- check_option= and_conds(check_option,
+ check_option= and_conds(thd, check_option,
merge_on_conds(thd, this, is_cascaded));
if (arena)
@@ -4680,7 +4681,8 @@ int TABLE_LIST::view_check_option(THD *thd, bool ignore_failure)
if (ignore_failure)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_VIEW_CHECK_FAILED, ER(ER_VIEW_CHECK_FAILED),
+ ER_VIEW_CHECK_FAILED,
+ ER_THD(thd, ER_VIEW_CHECK_FAILED),
main_view->view_db.str, main_view->view_name.str);
return(VIEW_CHECK_SKIP);
}
@@ -4976,7 +4978,7 @@ bool TABLE_LIST::prepare_view_security_context(THD *thd)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_NO_SUCH_USER,
- ER(ER_NO_SUCH_USER),
+ ER_THD(thd, ER_NO_SUCH_USER),
definer.user.str, definer.host.str);
}
else
@@ -4996,7 +4998,8 @@ bool TABLE_LIST::prepare_view_security_context(THD *thd)
my_error(ER_ACCESS_DENIED_ERROR, MYF(0),
thd->security_ctx->priv_user,
thd->security_ctx->priv_host,
- (thd->password ? ER(ER_YES) : ER(ER_NO)));
+ (thd->password ? ER_THD(thd, ER_YES) :
+ ER_THD(thd, ER_NO)));
}
DBUG_RETURN(TRUE);
}
@@ -5294,11 +5297,11 @@ Item *Field_iterator_table::create_item(THD *thd)
{
SELECT_LEX *select= thd->lex->current_select;
- Item_field *item= new Item_field(thd, &select->context, *ptr);
+ Item_field *item= new (thd->mem_root) Item_field(thd, &select->context, *ptr);
if (item && thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY &&
!thd->lex->in_sum_func && select->cur_pos_in_select_list != UNDEF_POS)
{
- select->non_agg_fields.push_back(item);
+ select->join->non_agg_fields.push_back(item);
item->marker= select->cur_pos_in_select_list;
select->set_non_agg_field_used(true);
}
@@ -5351,9 +5354,10 @@ Item *create_view_field(THD *thd, TABLE_LIST *view, Item **field_ref,
{
DBUG_RETURN(field);
}
- Item *item= new Item_direct_view_ref(&view->view->select_lex.context,
- field_ref, view->alias,
- name, view);
+ Item *item= (new (thd->mem_root)
+ Item_direct_view_ref(thd, &view->view->select_lex.context,
+ field_ref, view->alias,
+ name, view));
/*
Force creation of nullable item for the result tmp table for outer joined
views/derived tables.
@@ -5361,7 +5365,13 @@ Item *create_view_field(THD *thd, TABLE_LIST *view, Item **field_ref,
if (view->table && view->table->maybe_null)
item->maybe_null= TRUE;
/* Save item in case we will need to fall back to materialization. */
- view->used_items.push_front(item);
+ view->used_items.push_front(item, thd->mem_root);
+ /*
+ If we create this reference on persistent memory then it should be
+ present in persistent list
+ */
+ if (thd->mem_root == thd->stmt_arena->mem_root)
+ view->persistent_used_items.push_front(item, thd->mem_root);
DBUG_RETURN(item);
}
@@ -5556,7 +5566,7 @@ Field_iterator_table_ref::get_or_create_column_ref(THD *thd, TABLE_LIST *parent_
/* The field belongs to a stored table. */
Field *tmp_field= table_field_it.field();
Item_field *tmp_item=
- new Item_field(thd, &thd->lex->current_select->context, tmp_field);
+ new (thd->mem_root) Item_field(thd, &thd->lex->current_select->context, tmp_field);
if (!tmp_item)
return NULL;
nj_col= new Natural_join_column(tmp_item, table_ref);
@@ -5826,6 +5836,8 @@ void TABLE::mark_auto_increment_column()
void TABLE::mark_columns_needed_for_delete()
{
+ mark_columns_per_binlog_row_image();
+
if (triggers)
triggers->mark_fields_used(TRG_EVENT_DELETE);
if (file->ha_table_flags() & HA_REQUIRES_KEY_COLUMNS_FOR_DELETE)
@@ -5877,6 +5889,9 @@ void TABLE::mark_columns_needed_for_delete()
void TABLE::mark_columns_needed_for_update()
{
DBUG_ENTER("mark_columns_needed_for_update");
+
+ mark_columns_per_binlog_row_image();
+
if (triggers)
triggers->mark_fields_used(TRG_EVENT_UPDATE);
if (file->ha_table_flags() & HA_REQUIRES_KEY_COLUMNS_FOR_DELETE)
@@ -5921,6 +5936,8 @@ void TABLE::mark_columns_needed_for_update()
void TABLE::mark_columns_needed_for_insert()
{
+ mark_columns_per_binlog_row_image();
+
if (triggers)
{
/*
@@ -5938,6 +5955,101 @@ void TABLE::mark_columns_needed_for_insert()
mark_virtual_columns_for_write(TRUE);
}
+/*
+ Mark columns according the binlog row image option.
+
+ When logging in RBR, the user can select whether to
+ log partial or full rows, depending on the table
+ definition, and the value of binlog_row_image.
+
+ Semantics of the binlog_row_image are the following
+ (PKE - primary key equivalent, ie, PK fields if PK
+ exists, all fields otherwise):
+
+ binlog_row_image= MINIMAL
+ - This marks the PKE fields in the read_set
+ - This marks all fields where a value was specified
+ in the write_set
+
+ binlog_row_image= NOBLOB
+ - This marks PKE + all non-blob fields in the read_set
+ - This marks all fields where a value was specified
+ and all non-blob fields in the write_set
+
+ binlog_row_image= FULL
+ - all columns in the read_set
+ - all columns in the write_set
+
+ This marking is done without resetting the original
+ bitmaps. This means that we will strip extra fields in
+ the read_set at binlogging time (for those cases that
+ we only want to log a PK and we needed other fields for
+ execution).
+*/
+void TABLE::mark_columns_per_binlog_row_image()
+{
+ DBUG_ENTER("mark_columns_per_binlog_row_image");
+ DBUG_ASSERT(read_set->bitmap);
+ DBUG_ASSERT(write_set->bitmap);
+
+ THD *thd= current_thd;
+
+ /**
+ If in RBR we may need to mark some extra columns,
+ depending on the binlog-row-image command line argument.
+ */
+ if ((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) &&
+ in_use &&
+ in_use->is_current_stmt_binlog_format_row() &&
+ !ha_check_storage_engine_flag(s->db_type(), HTON_NO_BINLOG_ROW_OPT))
+ {
+ /* if there is no PK, then mark all columns for the BI. */
+ if (s->primary_key >= MAX_KEY)
+ bitmap_set_all(read_set);
+
+ switch (thd->variables.binlog_row_image)
+ {
+ case BINLOG_ROW_IMAGE_FULL:
+ if (s->primary_key < MAX_KEY)
+ bitmap_set_all(read_set);
+ bitmap_set_all(write_set);
+ break;
+ case BINLOG_ROW_IMAGE_NOBLOB:
+ /* for every field that is not set, mark it unless it is a blob */
+ for (Field **ptr=field ; *ptr ; ptr++)
+ {
+ Field *my_field= *ptr;
+ /*
+ bypass blob fields. These can be set or not set, we don't care.
+ Later, at binlogging time, if we don't need them in the before
+ image, we will discard them.
+
+ If set in the AI, then the blob is really needed, there is
+ nothing we can do about it.
+ */
+ if ((s->primary_key < MAX_KEY) &&
+ ((my_field->flags & PRI_KEY_FLAG) ||
+ (my_field->type() != MYSQL_TYPE_BLOB)))
+ bitmap_set_bit(read_set, my_field->field_index);
+
+ if (my_field->type() != MYSQL_TYPE_BLOB)
+ bitmap_set_bit(write_set, my_field->field_index);
+ }
+ break;
+ case BINLOG_ROW_IMAGE_MINIMAL:
+ /* mark the primary key if available in the read_set */
+ if (s->primary_key < MAX_KEY)
+ mark_columns_used_by_index_no_reset(s->primary_key, read_set);
+ break;
+
+ default:
+ DBUG_ASSERT(FALSE);
+ }
+ file->column_bitmaps_signal();
+ }
+
+ DBUG_VOID_RETURN;
+}
/*
@brief Mark a column as virtual used by the query
@@ -6896,6 +7008,48 @@ bool TABLE::prepare_triggers_for_update_stmt_or_event()
return FALSE;
}
+
+/**
+ Validates default value of fields which are not specified in
+ the column list of INSERT/LOAD statement.
+
+ @Note s->default_values should be properly populated
+ before calling this function.
+
+ @param thd thread context
+ @param record the record to check values in
+
+ @return
+ @retval false Success.
+ @retval true Failure.
+*/
+
+bool TABLE::validate_default_values_of_unset_fields(THD *thd) const
+{
+ DBUG_ENTER("TABLE::validate_default_values_of_unset_fields");
+ for (Field **fld= field; *fld; fld++)
+ {
+ if (!bitmap_is_set(write_set, (*fld)->field_index) &&
+ !((*fld)->flags & NO_DEFAULT_VALUE_FLAG))
+ {
+ if (!(*fld)->is_null_in_record(s->default_values) &&
+ (*fld)->validate_value_in_record_with_warn(thd, s->default_values) &&
+ thd->is_error())
+ {
+ /*
+ We're here if:
+ - validate_value_in_record_with_warn() failed and
+ strict mode converted WARN to ERROR
+ - or the connection was killed, or closed unexpectedly
+ */
+ DBUG_RETURN(true);
+ }
+ }
+ }
+ DBUG_RETURN(false);
+}
+
+
/*
@brief Reset const_table flag
@@ -6938,6 +7092,7 @@ bool TABLE_LIST::handle_derived(LEX *lex, uint phases)
{
SELECT_LEX_UNIT *unit;
DBUG_ENTER("handle_derived");
+ DBUG_PRINT("enter", ("phases: 0x%x", phases));
if ((unit= get_unit()))
{
for (SELECT_LEX *sl= unit->first_select(); sl; sl= sl->next_select())
@@ -7181,7 +7336,7 @@ bool TABLE_LIST::change_refs_to_fields()
DBUG_ASSERT(!field_it.end_of_fields());
if (!materialized_items[idx])
{
- materialized_items[idx]= new Item_field(table->field[idx]);
+ materialized_items[idx]= new (thd->mem_root) Item_field(thd, table->field[idx]);
if (!materialized_items[idx])
return TRUE;
}
diff --git a/sql/table.h b/sql/table.h
index 3c9938d41c8..b150e4f2238 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -1275,6 +1275,7 @@ public:
void mark_columns_needed_for_update(void);
void mark_columns_needed_for_delete(void);
void mark_columns_needed_for_insert(void);
+ void mark_columns_per_binlog_row_image(void);
bool mark_virtual_col(Field *field);
void mark_virtual_columns_for_write(bool insert_fl);
void mark_default_fields_for_write();
@@ -1378,6 +1379,8 @@ public:
void prepare_triggers_for_insert_stmt_or_event();
bool prepare_triggers_for_delete_stmt_or_event();
bool prepare_triggers_for_update_stmt_or_event();
+
+ bool validate_default_values_of_unset_fields(THD *thd) const;
};
@@ -1533,6 +1536,8 @@ class IS_table_read_plan;
#define DT_PHASES_MATERIALIZE (DT_COMMON | DT_MATERIALIZE)
#define VIEW_ALGORITHM_UNDEFINED 0
+/* Special value for ALTER VIEW: inherit original algorithm. */
+#define VIEW_ALGORITHM_INHERIT DTYPE_VIEW
#define VIEW_ALGORITHM_MERGE (DTYPE_VIEW | DTYPE_MERGE)
#define VIEW_ALGORITHM_TMPTABLE (DTYPE_VIEW | DTYPE_MATERIALIZE)
diff --git a/sql/table_cache.h b/sql/table_cache.h
index 2d70e4c90a5..2c5b0fc45a2 100644
--- a/sql/table_cache.h
+++ b/sql/table_cache.h
@@ -16,8 +16,10 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+#ifdef HAVE_PSI_INTERFACE
extern PSI_mutex_key key_TABLE_SHARE_LOCK_table_share;
extern PSI_cond_key key_TABLE_SHARE_COND_release;
+#endif
class TDC_element
{
@@ -52,9 +54,9 @@ public:
TDC_element() {}
- TDC_element(const char *key, uint key_length) : m_key_length(key_length)
+ TDC_element(const char *key_arg, uint key_length) : m_key_length(key_length)
{
- memcpy(m_key, key, key_length);
+ memcpy(m_key, key_arg, key_length);
}
@@ -107,7 +109,7 @@ public:
TABLE *free_tables_back()
{
- TABLE_list::Iterator it(share->tdc->free_tables);
+ TABLE_list::Iterator it(free_tables);
TABLE *entry, *last= 0;
while ((entry= it++))
last= entry;
diff --git a/sql/thr_malloc.cc b/sql/thr_malloc.cc
index 9786f1a6942..b82d29e51f4 100644
--- a/sql/thr_malloc.cc
+++ b/sql/thr_malloc.cc
@@ -54,8 +54,7 @@ extern "C" {
/* Skip writing to the error log to avoid mtr complaints */
DBUG_EXECUTE_IF("simulate_out_of_memory", return;);
- sql_print_error("%s", ER(ER_OUT_OF_RESOURCES));
-
+ sql_print_error("%s", ER_THD_OR_DEFAULT(thd, ER_OUT_OF_RESOURCES));
}
}
diff --git a/sql/transaction.cc b/sql/transaction.cc
index 8f0cbcc5eb4..8b188709ce6 100644
--- a/sql/transaction.cc
+++ b/sql/transaction.cc
@@ -657,7 +657,7 @@ bool trans_rollback_to_savepoint(THD *thd, LEX_STRING name)
!thd->slave_thread)
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARNING_NOT_COMPLETE_ROLLBACK,
- ER(ER_WARNING_NOT_COMPLETE_ROLLBACK));
+ ER_THD(thd, ER_WARNING_NOT_COMPLETE_ROLLBACK));
thd->transaction.savepoints= sv;
diff --git a/sql/tztime.cc b/sql/tztime.cc
index 9fa065eefa0..5e5f34f29a5 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -2517,7 +2517,8 @@ scan_tz_dir(char * name_end, uint symlink_recursion_level, uint verbose)
for (i= 0; i < cur_dir->number_of_files; i++)
{
- if (cur_dir->dir_entry[i].name[0] != '.')
+ if (cur_dir->dir_entry[i].name[0] != '.' &&
+ strcmp(cur_dir->dir_entry[i].name, "Factory"))
{
name_end_tmp= strmake(name_end, cur_dir->dir_entry[i].name,
FN_REFLEN - (name_end - fullname));
diff --git a/sql/unireg.cc b/sql/unireg.cc
index 7e4a64189d9..66959f400d9 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -501,7 +501,7 @@ static bool pack_header(THD *thd, uchar *forminfo,
if (create_fields.elements > MAX_FIELDS)
{
- my_message(ER_TOO_MANY_FIELDS, ER(ER_TOO_MANY_FIELDS), MYF(0));
+ my_message(ER_TOO_MANY_FIELDS, ER_THD(thd, ER_TOO_MANY_FIELDS), MYF(0));
DBUG_RETURN(1);
}
@@ -583,14 +583,14 @@ static bool pack_header(THD *thd, uchar *forminfo,
The HEX representation is created from this copy.
*/
field->save_interval= field->interval;
- field->interval= (TYPELIB*) sql_alloc(sizeof(TYPELIB));
+ field->interval= (TYPELIB*) thd->alloc(sizeof(TYPELIB));
*field->interval= *field->save_interval;
field->interval->type_names=
- (const char **) sql_alloc(sizeof(char*) *
- (field->interval->count+1));
+ (const char **) thd->alloc(sizeof(char*) *
+ (field->interval->count+1));
field->interval->type_names[field->interval->count]= 0;
field->interval->type_lengths=
- (uint *) sql_alloc(sizeof(uint) * field->interval->count);
+ (uint *) thd->alloc(sizeof(uint) * field->interval->count);
for (uint pos= 0; pos < field->interval->count; pos++)
{
@@ -600,8 +600,8 @@ static bool pack_header(THD *thd, uchar *forminfo,
length= field->save_interval->type_lengths[pos];
hex_length= length * 2;
field->interval->type_lengths[pos]= hex_length;
- field->interval->type_names[pos]= dst= (char*) sql_alloc(hex_length +
- 1);
+ field->interval->type_names[pos]= dst=
+ (char*) thd->alloc(hex_length + 1);
octet2hex(dst, src, length);
}
}
@@ -631,7 +631,7 @@ static bool pack_header(THD *thd, uchar *forminfo,
n_length+int_length+com_length+vcol_info_length > 65535L ||
int_count > 255)
{
- my_message(ER_TOO_MANY_FIELDS, ER(ER_TOO_MANY_FIELDS), MYF(0));
+ my_message(ER_TOO_MANY_FIELDS, ER_THD(thd, ER_TOO_MANY_FIELDS), MYF(0));
DBUG_RETURN(1);
}
@@ -825,9 +825,11 @@ static bool pack_fields(uchar *buff, List<Create_field> &create_fields,
}
}
- if(!sep) /* disaster, enum uses all characters, none left as separator */
+ if (!sep)
{
- my_message(ER_WRONG_FIELD_TERMINATORS,ER(ER_WRONG_FIELD_TERMINATORS),
+ /* disaster, enum uses all characters, none left as separator */
+ my_message(ER_WRONG_FIELD_TERMINATORS,
+ ER(ER_WRONG_FIELD_TERMINATORS),
MYF(0));
DBUG_RETURN(1);
}
@@ -922,7 +924,7 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options,
/*
regfield don't have to be deleted as it's allocated with sql_alloc()
*/
- Field *regfield= make_field(&share,
+ Field *regfield= make_field(&share, thd->mem_root,
buff+field->offset + data_offset,
field->length,
null_pos + null_count / 8,
@@ -974,9 +976,11 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options,
regfield->store((longlong) 1, TRUE);
}
else if (type == Field::YES) // Old unireg type
- regfield->store(ER(ER_YES),(uint) strlen(ER(ER_YES)),system_charset_info);
+ regfield->store(ER_THD(thd, ER_YES),(uint) strlen(ER_THD(thd, ER_YES)),
+ system_charset_info);
else if (type == Field::NO) // Old unireg type
- regfield->store(ER(ER_NO), (uint) strlen(ER(ER_NO)),system_charset_info);
+ regfield->store(ER_THD(thd, ER_NO), (uint) strlen(ER_THD(thd, ER_NO)),
+ system_charset_info);
else
regfield->reset();
}
diff --git a/sql/unireg.h b/sql/unireg.h
index 25335d11e4a..7599003566c 100644
--- a/sql/unireg.h
+++ b/sql/unireg.h
@@ -43,14 +43,14 @@
#define PLUGINDIR "lib/plugin"
#endif
-#define CURRENT_THD_ERRMSGS current_thd->variables.lc_messages->errmsgs->errmsgs
+#define CURRENT_THD_ERRMSGS current_thd->variables.errmsgs
#define DEFAULT_ERRMSGS my_default_lc_messages->errmsgs->errmsgs
#define ER(X) CURRENT_THD_ERRMSGS[(X) - ER_ERROR_FIRST]
#define ER_DEFAULT(X) DEFAULT_ERRMSGS[(X) - ER_ERROR_FIRST]
#define ER_SAFE(X) (((X) >= ER_ERROR_FIRST && (X) <= ER_ERROR_LAST) ? ER(X) : "Invalid error code")
-#define ER_THD(thd,X) ((thd)->variables.lc_messages->errmsgs->errmsgs[(X) - \
- ER_ERROR_FIRST])
+#define ER_SAFE_THD(T,X) (((X) >= ER_ERROR_FIRST && (X) <= ER_ERROR_LAST) ? ER_THD(T,X) : "Invalid error code")
+#define ER_THD(thd,X) ((thd)->variables.errmsgs[(X) - ER_ERROR_FIRST])
#define ER_THD_OR_DEFAULT(thd,X) ((thd) ? ER_THD(thd, X) : ER_DEFAULT(X))
#define ME_INFO (ME_HOLDTANG+ME_OLDWIN+ME_NOREFRESH)
diff --git a/sql/winservice.h b/sql/winservice.h
index fca7b129de5..c3e2bfe1b20 100644
--- a/sql/winservice.h
+++ b/sql/winservice.h
@@ -1,40 +1,40 @@
-/*
- Copyright (c) 2011, 2012, Monty Program Ab
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/*
- Extract properties of a windows service binary path
-*/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <windows.h>
-typedef struct mysqld_service_properties_st
-{
- char mysqld_exe[MAX_PATH];
- char inifile[MAX_PATH];
- char datadir[MAX_PATH];
- int version_major;
- int version_minor;
- int version_patch;
-} mysqld_service_properties;
-
-extern int get_mysql_service_properties(const wchar_t *bin_path,
- mysqld_service_properties *props);
-
-#ifdef __cplusplus
-}
-#endif
+/*
+ Copyright (c) 2011, 2012, Monty Program Ab
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/*
+ Extract properties of a windows service binary path
+*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <windows.h>
+typedef struct mysqld_service_properties_st
+{
+ char mysqld_exe[MAX_PATH];
+ char inifile[MAX_PATH];
+ char datadir[MAX_PATH];
+ int version_major;
+ int version_minor;
+ int version_patch;
+} mysqld_service_properties;
+
+extern int get_mysql_service_properties(const wchar_t *bin_path,
+ mysqld_service_properties *props);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/sql/wsrep_applier.cc b/sql/wsrep_applier.cc
index 789c6b19dd6..c1c6a90e614 100644
--- a/sql/wsrep_applier.cc
+++ b/sql/wsrep_applier.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 Codership Oy <info@codership.com>
+/* Copyright (C) 2013-2015 Codership Oy <info@codership.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -14,9 +14,10 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
#include "wsrep_priv.h"
-#include "wsrep_binlog.h"
+#include "wsrep_binlog.h" // wsrep_dump_rbr_buf()
+#include "wsrep_xid.h"
-#include "log_event.h" // EVENT_LEN_OFFSET, etc.
+#include "log_event.h" // class THD, EVENT_LEN_OFFSET, etc.
#include "wsrep_applier.h"
/*
@@ -74,13 +75,10 @@ void wsrep_set_apply_format(THD* thd, Format_description_log_event* ev)
Format_description_log_event* wsrep_get_apply_format(THD* thd)
{
if (thd->wsrep_apply_format)
- return (Format_description_log_event*) thd->wsrep_apply_format;
- /* TODO: mariadb does not support rli->get_rli_description_event()
- * => look for alternative way to remember last FDE in replication
- */
- //return thd->wsrep_rli->get_rli_description_event();
- thd->wsrep_apply_format = new Format_description_log_event(4);
- return (Format_description_log_event*) thd->wsrep_apply_format;
+ {
+ return (Format_description_log_event*) thd->wsrep_apply_format;
+ }
+ return thd->wsrep_rgi->rli->relay_log.description_event_for_exec;
}
static wsrep_cb_status_t wsrep_apply_events(THD* thd,
@@ -90,6 +88,7 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd,
char *buf= (char *)events_buf;
int rcode= 0;
int event= 1;
+ Log_event_type typ;
DBUG_ENTER("wsrep_apply_events");
@@ -124,7 +123,9 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd,
goto error;
}
- switch (ev->get_type_code()) {
+ typ= ev->get_type_code();
+
+ switch (typ) {
case FORMAT_DESCRIPTION_EVENT:
wsrep_set_apply_format(thd, (Format_description_log_event*)ev);
continue;
@@ -144,10 +145,11 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd,
break;
}
- thd->set_server_id(ev->server_id); // use the original server id for logging
- thd->set_time(); // time the query
+ /* Use the original server id for logging. */
+ thd->set_server_id(ev->server_id);
+ thd->set_time(); // time the query
wsrep_xid_init(&thd->transaction.xid_state.xid,
- &thd->wsrep_trx_meta.gtid.uuid,
+ thd->wsrep_trx_meta.gtid.uuid,
thd->wsrep_trx_meta.gtid.seqno);
thd->lex->current_select= 0;
if (!ev->when)
@@ -157,8 +159,11 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd,
ev->when_sec_part= hrtime_sec_part(hrtime);
}
+ thd->variables.option_bits=
+ (thd->variables.option_bits & ~OPTION_SKIP_REPLICATION) |
+ (ev->flags & LOG_EVENT_SKIP_REPLICATION_F ? OPTION_SKIP_REPLICATION : 0);
+
ev->thd = thd;
- //exec_res = ev->apply_event(thd->wsrep_rli);
exec_res = ev->apply_event(thd->wsrep_rgi);
DBUG_PRINT("info", ("exec_event result: %d", exec_res));
@@ -190,7 +195,7 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd,
DBUG_RETURN(WSREP_CB_FAILURE);
}
- delete ev;
+ delete_or_keep_event_post_apply(thd->wsrep_rgi, typ, ev);
}
error:
@@ -288,14 +293,6 @@ static wsrep_cb_status_t wsrep_commit(THD* const thd,
wsrep_cb_status_t const rcode(trans_commit(thd) ?
WSREP_CB_FAILURE : WSREP_CB_SUCCESS);
-#ifdef WSREP_PROC_INFO
- snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
- "committed %lld", (long long)wsrep_thd_trx_seqno(thd));
- thd_proc_info(thd, thd->wsrep_info);
-#else
- thd_proc_info(thd, "committed");
-#endif /* WSREP_PROC_INFO */
-
if (WSREP_CB_SUCCESS == rcode)
{
thd->wsrep_rgi->cleanup_context(thd, false);
@@ -305,6 +302,14 @@ static wsrep_cb_status_t wsrep_commit(THD* const thd,
// TODO: mark snapshot with global_seqno.
}
+#ifdef WSREP_PROC_INFO
+ snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
+ "committed %lld", (long long) wsrep_thd_trx_seqno(thd));
+ thd_proc_info(thd, thd->wsrep_info);
+#else
+ thd_proc_info(thd, "committed");
+#endif /* WSREP_PROC_INFO */
+
return rcode;
}
diff --git a/sql/wsrep_applier.h b/sql/wsrep_applier.h
index c3892e2dac4..b6497776e87 100644
--- a/sql/wsrep_applier.h
+++ b/sql/wsrep_applier.h
@@ -16,7 +16,8 @@
#ifndef WSREP_APPLIER_H
#define WSREP_APPLIER_H
-#include <sys/types.h>
+#include <my_config.h>
+#include "../wsrep/wsrep_api.h"
void wsrep_set_apply_format(THD* thd, Format_description_log_event* ev);
Format_description_log_event* wsrep_get_apply_format(THD* thd);
diff --git a/sql/wsrep_binlog.cc b/sql/wsrep_binlog.cc
index 3788a6c9074..36917674128 100644
--- a/sql/wsrep_binlog.cc
+++ b/sql/wsrep_binlog.cc
@@ -71,7 +71,13 @@ int wsrep_write_cache_buf(IO_CACHE *cache, uchar **buf, size_t *buf_len)
memcpy(*buf + *buf_len, cache->read_pos, length);
*buf_len = total_length;
- } while ((cache->file >= 0) && (length = my_b_fill(cache)));
+
+ if (cache->file < 0)
+ {
+ cache->read_pos= cache->read_end;
+ break;
+ }
+ } while ((length = my_b_fill(cache)));
if (reinit_io_cache(cache, WRITE_CACHE, saved_pos, 0, 0))
{
@@ -199,7 +205,12 @@ static int wsrep_write_cache_once(wsrep_t* const wsrep,
memcpy(buf + used, cache->read_pos, length);
used = total_length;
- } while ((cache->file >= 0) && (length = my_b_fill(cache)));
+ if (cache->file < 0)
+ {
+ cache->read_pos= cache->read_end;
+ break;
+ }
+ } while ((length = my_b_fill(cache)));
if (used > 0)
err = wsrep_append_data(wsrep, &thd->wsrep_ws_handle, buf, used);
@@ -268,7 +279,12 @@ static int wsrep_write_cache_inc(wsrep_t* const wsrep,
cache->read_pos, length)))
goto cleanup;
- } while ((cache->file >= 0) && (length = my_b_fill(cache)));
+ if (cache->file < 0)
+ {
+ cache->read_pos= cache->read_end;
+ break;
+ }
+ } while ((length = my_b_fill(cache)));
if (WSREP_OK == err) *len = total_length;
@@ -394,7 +410,13 @@ void wsrep_dump_rbr_direct(THD* thd, IO_CACHE* cache)
WSREP_ERROR("Failed to write file '%s'", filename);
goto cleanup;
}
- } while ((cache->file >= 0) && (bytes_in_cache= my_b_fill(cache)));
+
+ if (cache->file < 0)
+ {
+ cache->read_pos= cache->read_end;
+ break;
+ }
+ } while ((bytes_in_cache= my_b_fill(cache)));
if(cache->error == -1)
{
WSREP_ERROR("RBR inconsistent");
@@ -423,6 +445,7 @@ void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf,
char filename[PATH_MAX]= {0};
File file;
IO_CACHE cache;
+ Log_event_writer writer(&cache);
Format_description_log_event *ev= wsrep_get_apply_format(thd);
int len= my_snprintf(filename, PATH_MAX, "%s/GRA_%ld_%lld_v2.log",
@@ -454,7 +477,7 @@ void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf,
goto cleanup2;
}
- if (ev->write(&cache) || my_b_write(&cache, (uchar*)rbr_buf, buf_len) ||
+ if (writer.write(ev) || my_b_write(&cache, (uchar*)rbr_buf, buf_len) ||
flush_io_cache(&cache))
{
WSREP_ERROR("Failed to write to '%s'.", filename);
diff --git a/sql/wsrep_dummy.cc b/sql/wsrep_dummy.cc
index 1a6f5128e9e..5cbf6821e7c 100644
--- a/sql/wsrep_dummy.cc
+++ b/sql/wsrep_dummy.cc
@@ -47,6 +47,9 @@ my_bool get_wsrep_drupal_282555_workaround()
my_bool get_wsrep_load_data_splitting()
{ return 0; }
+my_bool get_wsrep_recovery()
+{ return 0; }
+
my_bool get_wsrep_log_conflicts()
{ return 0; }
diff --git a/sql/wsrep_hton.cc b/sql/wsrep_hton.cc
index 8ef51548e79..f45ba5e5a39 100644
--- a/sql/wsrep_hton.cc
+++ b/sql/wsrep_hton.cc
@@ -1,4 +1,4 @@
-/* Copyright 2008 Codership Oy <http://www.codership.com>
+/* Copyright 2008-2015 Codership Oy <http://www.codership.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
#include <sql_class.h>
#include "wsrep_mysqld.h"
#include "wsrep_binlog.h"
+#include "wsrep_xid.h"
#include <cstdio>
#include <cstdlib>
@@ -96,17 +97,40 @@ void wsrep_register_hton(THD* thd, bool all)
*/
void wsrep_post_commit(THD* thd, bool all)
{
- if (thd->wsrep_exec_mode == LOCAL_COMMIT)
+ /*
+ TODO: It can perhaps be fixed in a more elegant fashion by turning off
+ wsrep_emulate_binlog if wsrep_on=0 on server start.
+ https://github.com/codership/mysql-wsrep/issues/112
+ */
+ if (!WSREP_ON)
+ return;
+
+ switch (thd->wsrep_exec_mode)
{
- DBUG_ASSERT(thd->wsrep_trx_meta.gtid.seqno != WSREP_SEQNO_UNDEFINED);
- if (wsrep->post_commit(wsrep, &thd->wsrep_ws_handle))
+ case LOCAL_COMMIT:
{
+ DBUG_ASSERT(thd->wsrep_trx_meta.gtid.seqno != WSREP_SEQNO_UNDEFINED);
+ if (wsrep->post_commit(wsrep, &thd->wsrep_ws_handle))
+ {
DBUG_PRINT("wsrep", ("set committed fail"));
WSREP_WARN("set committed fail: %llu %d",
(long long)thd->real_id, thd->get_stmt_da()->status());
+ }
+ wsrep_cleanup_transaction(thd);
+ break;
}
- wsrep_cleanup_transaction(thd);
+ case LOCAL_STATE:
+ {
+ /*
+ Non-InnoDB statements may have populated events in stmt cache => cleanup
+ */
+ WSREP_DEBUG("cleanup transaction for LOCAL_STATE: %s", thd->query());
+ wsrep_cleanup_transaction(thd);
+ break;
+ }
+ default: break;
}
+
}
/*
@@ -489,7 +513,7 @@ wsrep_run_wsrep_commit(THD *thd, bool all)
if (thd->transaction.xid_state.xid.get_my_xid())
{
wsrep_xid_init(&thd->transaction.xid_state.xid,
- &thd->wsrep_trx_meta.gtid.uuid,
+ thd->wsrep_trx_meta.gtid.uuid,
thd->wsrep_trx_meta.gtid.seqno);
}
DBUG_PRINT("wsrep", ("replicating commit success"));
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 33d1d2a0966..d72d9fdf151 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -1,4 +1,4 @@
-/* Copyright 2008-2014 Codership Oy <http://www.codership.com>
+/* Copyright 2008-2015 Codership Oy <http://www.codership.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -31,6 +31,7 @@
#include "wsrep_var.h"
#include "wsrep_binlog.h"
#include "wsrep_applier.h"
+#include "wsrep_xid.h"
#include <cstdio>
#include <cstdlib>
#include "log_event.h"
@@ -164,10 +165,6 @@ static PSI_file_info wsrep_files[]=
{
{ &key_file_wsrep_gra_log, "wsrep_gra_log", 0}
};
-
-#else
-#define mysql_mutex_register(X,Y,Z)
-#define mysql_cond_register(X,Y,Z)
#endif
my_bool wsrep_inited = 0; // initialized ?
@@ -252,62 +249,22 @@ static void wsrep_log_states (wsrep_log_level_t const level,
wsrep_log_cb (level, msg);
}
-static my_bool set_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg)
-{
- XID* xid= reinterpret_cast<XID*>(arg);
- handlerton* hton= plugin_data(plugin, handlerton *);
- if (hton->set_checkpoint)
- {
- const wsrep_uuid_t* uuid(wsrep_xid_uuid(xid));
- char uuid_str[40] = {0, };
- wsrep_uuid_print(uuid, uuid_str, sizeof(uuid_str));
- WSREP_DEBUG("Set WSREPXid for InnoDB: %s:%lld",
- uuid_str, (long long)wsrep_xid_seqno(xid));
- hton->set_checkpoint(hton, xid);
- }
- return FALSE;
-}
-
-void wsrep_set_SE_checkpoint(XID* xid)
-{
- plugin_foreach(NULL, set_SE_checkpoint, MYSQL_STORAGE_ENGINE_PLUGIN, xid);
-}
-
-static my_bool get_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg)
-{
- XID* xid= reinterpret_cast<XID*>(arg);
- handlerton* hton= plugin_data(plugin, handlerton *);
- if (hton->get_checkpoint)
- {
- hton->get_checkpoint(hton, xid);
- const wsrep_uuid_t* uuid(wsrep_xid_uuid(xid));
- char uuid_str[40] = {0, };
- wsrep_uuid_print(uuid, uuid_str, sizeof(uuid_str));
- WSREP_DEBUG("Read WSREPXid from InnoDB: %s:%lld",
- uuid_str, (long long)wsrep_xid_seqno(xid));
- }
- return FALSE;
-}
-
-void wsrep_get_SE_checkpoint(XID* xid)
-{
- plugin_foreach(NULL, get_SE_checkpoint, MYSQL_STORAGE_ENGINE_PLUGIN, xid);
-}
-
#ifdef GTID_SUPPORT
-void wsrep_init_sidno(const wsrep_uuid_t& uuid)
+void wsrep_init_sidno(const wsrep_uuid_t& wsrep_uuid)
{
/* generate new Sid map entry from inverted uuid */
rpl_sid sid;
wsrep_uuid_t ltid_uuid;
+
for (size_t i= 0; i < sizeof(ltid_uuid.data); ++i)
{
- ltid_uuid.data[i] = ~local_uuid.data[i];
+ ltid_uuid.data[i] = ~wsrep_uuid.data[i];
}
+
sid.copy_from(ltid_uuid.data);
global_sid_lock->wrlock();
wsrep_sidno= global_sid_map->add_sid(sid);
- WSREP_INFO("inited wsrep sidno %d", wsrep_sidno);
+ WSREP_INFO("Initialized wsrep sidno %d", wsrep_sidno);
global_sid_lock->unlock();
}
#endif /* GTID_SUPPORT */
@@ -448,13 +405,11 @@ wsrep_view_handler_cb (void* app_ctx,
local_seqno= view->state_id.seqno;
}
/* Init storage engine XIDs from first view */
- XID xid;
- wsrep_xid_init(&xid, &local_uuid, local_seqno);
- wsrep_set_SE_checkpoint(&xid);
- memb_status= WSREP_MEMBER_JOINED;
+ wsrep_set_SE_checkpoint(local_uuid, local_seqno);
#ifdef GTID_SUPPORT
wsrep_init_sidno(local_uuid);
#endif /* GTID_SUPPORT */
+ memb_status= WSREP_MEMBER_JOINED;
}
// just some sanity check
@@ -547,12 +502,13 @@ static void wsrep_synced_cb(void* app_ctx)
wsrep_restart_slave_activated= FALSE;
mysql_mutex_lock(&LOCK_active_mi);
- if ((rcode = start_slave_threads(1 /* need mutex */,
- 0 /* no wait for start*/,
- active_mi,
- master_info_file,
- relay_log_info_file,
- SLAVE_SQL)))
+ if ((rcode = start_slave_threads(0,
+ 1 /* need mutex */,
+ 0 /* no wait for start*/,
+ active_mi,
+ master_info_file,
+ relay_log_info_file,
+ SLAVE_SQL)))
{
WSREP_WARN("Failed to create slave threads: %d", rcode);
}
@@ -564,38 +520,28 @@ static void wsrep_synced_cb(void* app_ctx)
static void wsrep_init_position()
{
/* read XIDs from storage engines */
- XID xid;
- memset(&xid, 0, sizeof(xid));
- xid.formatID= -1;
- wsrep_get_SE_checkpoint(&xid);
+ wsrep_uuid_t uuid;
+ wsrep_seqno_t seqno;
+ wsrep_get_SE_checkpoint(uuid, seqno);
- if (xid.formatID == -1)
+ if (!memcmp(&uuid, &WSREP_UUID_UNDEFINED, sizeof(wsrep_uuid_t)))
{
WSREP_INFO("Read nil XID from storage engines, skipping position init");
return;
}
- else if (!wsrep_is_wsrep_xid(&xid))
- {
- WSREP_WARN("Read non-wsrep XID from storage engines, skipping position init");
- return;
- }
-
- const wsrep_uuid_t* uuid= wsrep_xid_uuid(&xid);
- const wsrep_seqno_t seqno= wsrep_xid_seqno(&xid);
char uuid_str[40] = {0, };
- wsrep_uuid_print(uuid, uuid_str, sizeof(uuid_str));
+ wsrep_uuid_print(&uuid, uuid_str, sizeof(uuid_str));
WSREP_INFO("Initial position: %s:%lld", uuid_str, (long long)seqno);
-
if (!memcmp(&local_uuid, &WSREP_UUID_UNDEFINED, sizeof(local_uuid)) &&
local_seqno == WSREP_SEQNO_UNDEFINED)
{
// Initial state
- local_uuid= *uuid;
+ local_uuid= uuid;
local_seqno= seqno;
}
- else if (memcmp(&local_uuid, uuid, sizeof(local_uuid)) ||
+ else if (memcmp(&local_uuid, &uuid, sizeof(local_uuid)) ||
local_seqno != seqno)
{
WSREP_WARN("Initial position was provided by configuration or SST, "
@@ -672,6 +618,7 @@ int wsrep_init()
wsrep->provider_vendor, sizeof(provider_vendor) - 1);
}
+ /* Initialize node address */
char node_addr[512]= { 0, };
size_t const node_addr_max= sizeof(node_addr) - 1;
if (!wsrep_node_address || !strcmp(wsrep_node_address, ""))
@@ -689,86 +636,81 @@ int wsrep_init()
strncpy(node_addr, wsrep_node_address, node_addr_max);
}
+ /* Initialize node's incoming address */
char inc_addr[512]= { 0, };
size_t const inc_addr_max= sizeof (inc_addr);
+
+ /*
+ In case wsrep_node_incoming_address is either not set or set to AUTO,
+ we need to use mysqld's my_bind_addr_str:mysqld_port, lastly fallback
+ to wsrep_node_address' value if mysqld's bind-address is not set either.
+ */
if ((!wsrep_node_incoming_address ||
!strcmp (wsrep_node_incoming_address, WSREP_NODE_INCOMING_AUTO)))
{
+ bool is_ipv6= false;
unsigned int my_bind_ip= INADDR_ANY; // default if not set
+
if (my_bind_addr_str && strlen(my_bind_addr_str))
{
- my_bind_ip= wsrep_check_ip(my_bind_addr_str);
+ my_bind_ip= wsrep_check_ip(my_bind_addr_str, &is_ipv6);
}
if (INADDR_ANY != my_bind_ip)
{
+ /*
+ If its a not a valid address, leave inc_addr as empty string. mysqld
+ is not listening for client connections on network interfaces.
+ */
if (INADDR_NONE != my_bind_ip && INADDR_LOOPBACK != my_bind_ip)
{
- snprintf(inc_addr, inc_addr_max, "%s:%u",
- my_bind_addr_str, (int)mysqld_port);
- } // else leave inc_addr an empty string - mysqld is not listening for
- // client connections on network interfaces.
+ const char *fmt= (is_ipv6) ? "[%s]:%u" : "%s:%u";
+ snprintf(inc_addr, inc_addr_max, fmt, my_bind_addr_str, mysqld_port);
+ }
}
- else // mysqld binds to 0.0.0.0, take IP from wsrep_node_address if possible
+ else /* mysqld binds to 0.0.0.0, try taking IP from wsrep_node_address. */
{
size_t const node_addr_len= strlen(node_addr);
if (node_addr_len > 0)
{
- const char* const colon= strrchr(node_addr, ':');
- if (strchr(node_addr, ':') == colon) // 1 or 0 ':'
- {
- size_t const ip_len= colon ? colon - node_addr : node_addr_len;
- if (ip_len + 7 /* :55555\0 */ < inc_addr_max)
- {
- memcpy (inc_addr, node_addr, ip_len);
- snprintf(inc_addr + ip_len, inc_addr_max - ip_len, ":%u",
- (int)mysqld_port);
- }
- else
- {
- WSREP_WARN("Guessing address for incoming client connections: "
- "address too long.");
- inc_addr[0]= '\0';
- }
- }
- else
- {
- WSREP_WARN("Guessing address for incoming client connections: "
- "too many colons :) .");
- inc_addr[0]= '\0';
- }
- }
+ wsp::Address addr(node_addr);
- if (!strlen(inc_addr))
- {
+ if (!addr.is_valid())
+ {
+ WSREP_DEBUG("Could not parse node address : %s", node_addr);
WSREP_WARN("Guessing address for incoming client connections failed. "
"Try setting wsrep_node_incoming_address explicitly.");
+ goto done;
+ }
+
+ const char *fmt= (addr.is_ipv6()) ? "[%s]:%u" : "%s:%u";
+ snprintf(inc_addr, inc_addr_max, fmt, addr.get_address(),
+ (int) mysqld_port);
}
}
}
- else if (!strchr(wsrep_node_incoming_address, ':')) // no port included
- {
- if ((int)inc_addr_max <=
- snprintf(inc_addr, inc_addr_max, "%s:%u",
- wsrep_node_incoming_address,(int)mysqld_port))
- {
- WSREP_WARN("Guessing address for incoming client connections: "
- "address too long.");
- inc_addr[0]= '\0';
- }
- }
else
{
- size_t const need = strlen (wsrep_node_incoming_address);
- if (need >= inc_addr_max) {
- WSREP_WARN("wsrep_node_incoming_address too long: %zu", need);
- inc_addr[0]= '\0';
- }
- else {
- memcpy (inc_addr, wsrep_node_incoming_address, need);
+ wsp::Address addr(wsrep_node_incoming_address);
+
+ if (!addr.is_valid())
+ {
+ WSREP_WARN("Could not parse wsrep_node_incoming_address : %s",
+ wsrep_node_incoming_address);
+ goto done;
}
+
+ /*
+ In case port is not specified in wsrep_node_incoming_address, we use
+ mysqld_port.
+ */
+ int port= (addr.get_port() > 0) ? addr.get_port() : (int) mysqld_port;
+ const char *fmt= (addr.is_ipv6()) ? "[%s]:%u" : "%s:%u";
+
+ snprintf(inc_addr, inc_addr_max, fmt, addr.get_address(), port);
}
+done:
struct wsrep_init_args wsrep_args;
struct wsrep_gtid const state_id = { local_uuid, local_seqno };
@@ -811,8 +753,11 @@ int wsrep_init()
/* Initialize wsrep thread LOCKs and CONDs */
void wsrep_thr_init()
{
+#ifdef HAVE_PSI_INTERFACE
mysql_mutex_register("sql", wsrep_mutexes, array_elements(wsrep_mutexes));
mysql_cond_register("sql", wsrep_conds, array_elements(wsrep_conds));
+ mysql_file_register("sql", wsrep_files, array_elements(wsrep_files));
+#endif
mysql_mutex_init(key_LOCK_wsrep_ready, &LOCK_wsrep_ready, MY_MUTEX_INIT_FAST);
mysql_cond_init(key_COND_wsrep_ready, &COND_wsrep_ready, NULL);
@@ -827,8 +772,6 @@ void wsrep_thr_init()
mysql_mutex_init(key_LOCK_wsrep_slave_threads, &LOCK_wsrep_slave_threads, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_wsrep_desync, &LOCK_wsrep_desync, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_wsrep_config_state, &LOCK_wsrep_config_state, MY_MUTEX_INIT_FAST);
-
- mysql_file_register("sql", wsrep_files, array_elements(wsrep_files));
}
@@ -864,6 +807,7 @@ void wsrep_deinit(bool free_options)
provider_name[0]= '\0';
provider_version[0]= '\0';
provider_vendor[0]= '\0';
+
wsrep_inited= 0;
if (free_options)
@@ -902,13 +846,11 @@ void wsrep_recover()
uuid_str, (long long)local_seqno);
return;
}
- XID xid;
- memset(&xid, 0, sizeof(xid));
- xid.formatID= -1;
- wsrep_get_SE_checkpoint(&xid);
- wsrep_uuid_print(wsrep_xid_uuid(&xid), uuid_str, sizeof(uuid_str));
- WSREP_INFO("Recovered position: %s:%lld", uuid_str,
- (long long)wsrep_xid_seqno(&xid));
+ wsrep_uuid_t uuid;
+ wsrep_seqno_t seqno;
+ wsrep_get_SE_checkpoint(uuid, seqno);
+ wsrep_uuid_print(&uuid, uuid_str, sizeof(uuid_str));
+ WSREP_INFO("Recovered position: %s:%lld", uuid_str, (long long)seqno);
}
@@ -1269,17 +1211,23 @@ int wsrep_to_buf_helper(
THD* thd, const char *query, uint query_len, uchar** buf, size_t* buf_len)
{
IO_CACHE tmp_io_cache;
+ Log_event_writer writer(&tmp_io_cache);
if (open_cached_file(&tmp_io_cache, mysql_tmpdir, TEMP_PREFIX,
65536, MYF(MY_WME)))
return 1;
int ret(0);
+ Format_description_log_event *tmp_fd= new Format_description_log_event(4);
+ tmp_fd->checksum_alg= (enum_binlog_checksum_alg)binlog_checksum_options;
+ writer.write(tmp_fd);
+ delete tmp_fd;
+
#ifdef GTID_SUPPORT
if (thd->variables.gtid_next.type == GTID_GROUP)
{
Gtid_log_event gtid_ev(thd, FALSE, &thd->variables.gtid_next);
if (!gtid_ev.is_valid()) ret= 0;
- if (!ret && gtid_ev.write(&tmp_io_cache)) ret= 1;
+ if (!ret && writer.write(&gtid_ev)) ret= 1;
}
#endif /* GTID_SUPPORT */
@@ -1289,12 +1237,12 @@ int wsrep_to_buf_helper(
Query_log_event ev(thd, thd->wsrep_TOI_pre_query,
thd->wsrep_TOI_pre_query_len,
FALSE, FALSE, FALSE, 0);
- if (ev.write(&tmp_io_cache)) ret= 1;
+ if (writer.write(&ev)) ret= 1;
}
/* continue to append the actual query */
Query_log_event ev(thd, query, query_len, FALSE, FALSE, FALSE, 0);
- if (!ret && ev.write(&tmp_io_cache)) ret= 1;
+ if (!ret && writer.write(&ev)) ret= 1;
if (!ret && wsrep_write_cache_buf(&tmp_io_cache, buf, buf_len)) ret= 1;
close_cached_file(&tmp_io_cache);
return ret;
@@ -1347,7 +1295,13 @@ create_view_query(THD *thd, uchar** buf, size_t* buf_len)
buff.append(command[thd->lex->create_view_mode].str,
command[thd->lex->create_view_mode].length);
- if (!lex->definer)
+ LEX_USER *definer;
+
+ if (lex->definer)
+ {
+ definer= get_current_user(thd, lex->definer);
+ }
+ else
{
/*
DEFINER-clause is missing; we have to create default definer in
@@ -1355,16 +1309,19 @@ create_view_query(THD *thd, uchar** buf, size_t* buf_len)
If this is an ALTER VIEW then the current user should be set as
the definer.
*/
+ definer= create_default_definer(thd, false);
+ }
- if (!(lex->definer= create_default_definer(thd, false)))
- {
- WSREP_WARN("view default definer issue");
- }
+ if (definer)
+ {
+ views->definer.user = definer->user;
+ views->definer.host = definer->host;
+ } else {
+ WSREP_ERROR("Failed to get DEFINER for VIEW.");
+ return 1;
}
views->algorithm = lex->create_view_algorithm;
- views->definer.user = lex->definer->user;
- views->definer.host = lex->definer->host;
views->view_suid = lex->create_view_suid;
views->with_check = lex->create_view_check;
@@ -1403,6 +1360,12 @@ create_view_query(THD *thd, uchar** buf, size_t* buf_len)
return wsrep_to_buf_helper(thd, buff.ptr(), buff.length(), buf, buf_len);
}
+/*
+ returns:
+ 0: statement was replicated as TOI
+ 1: TOI replication was skipped
+ -1: TOI replication failed
+ */
static int wsrep_TOI_begin(THD *thd, char *db_, char *table_,
const TABLE_LIST* table_list)
{
@@ -1410,6 +1373,7 @@ static int wsrep_TOI_begin(THD *thd, char *db_, char *table_,
uchar* buf(0);
size_t buf_len(0);
int buf_err;
+ int rc= 0;
WSREP_DEBUG("TO BEGIN: %lld, %d : %s", (long long)wsrep_thd_trx_seqno(thd),
thd->wsrep_exec_mode, thd->query() );
@@ -1439,32 +1403,39 @@ static int wsrep_TOI_begin(THD *thd, char *db_, char *table_,
wsrep_key_arr_t key_arr= {0, 0};
struct wsrep_buf buff = { buf, buf_len };
- if (!buf_err &&
+ if (!buf_err &&
wsrep_prepare_keys_for_isolation(thd, db_, table_, table_list, &key_arr)&&
+ key_arr.keys_len > 0 &&
WSREP_OK == (ret = wsrep->to_execute_start(wsrep, thd->thread_id,
- key_arr.keys, key_arr.keys_len,
- &buff, 1,
- &thd->wsrep_trx_meta)))
+ key_arr.keys, key_arr.keys_len,
+ &buff, 1,
+ &thd->wsrep_trx_meta)))
{
thd->wsrep_exec_mode= TOTAL_ORDER;
wsrep_to_isolation++;
- my_free(buf);
wsrep_keys_free(&key_arr);
WSREP_DEBUG("TO BEGIN: %lld, %d",(long long)wsrep_thd_trx_seqno(thd),
- thd->wsrep_exec_mode);
+ thd->wsrep_exec_mode);
}
- else {
+ else if (key_arr.keys_len > 0) {
/* jump to error handler in mysql_execute_command() */
WSREP_WARN("TO isolation failed for: %d, sql: %s. Check wsrep "
"connection state and retry the query.",
ret, (thd->query()) ? thd->query() : "void");
my_error(ER_LOCK_DEADLOCK, MYF(0), "WSREP replication failed. Check "
- "your wsrep connection state and retry the query.");
- if (buf) my_free(buf);
+ "your wsrep connection state and retry the query.");
wsrep_keys_free(&key_arr);
- return -1;
+ rc= -1;
}
- return 0;
+ else {
+ /* non replicated DDL, affecting temporary tables only */
+ WSREP_DEBUG("TO isolation skipped for: %d, sql: %s."
+ "Only temporary tables affected.",
+ ret, (thd->query()) ? thd->query() : "void");
+ rc= 1;
+ }
+ if (buf) my_free(buf);
+ return rc;
}
static void wsrep_TOI_end(THD *thd) {
@@ -1473,11 +1444,9 @@ static void wsrep_TOI_end(THD *thd) {
WSREP_DEBUG("TO END: %lld, %d : %s", (long long)wsrep_thd_trx_seqno(thd),
thd->wsrep_exec_mode, (thd->query()) ? thd->query() : "void");
-
- XID xid;
- wsrep_xid_init(&xid, &thd->wsrep_trx_meta.gtid.uuid,
- thd->wsrep_trx_meta.gtid.seqno);
- wsrep_set_SE_checkpoint(&xid);
+
+ wsrep_set_SE_checkpoint(thd->wsrep_trx_meta.gtid.uuid,
+ thd->wsrep_trx_meta.gtid.seqno);
WSREP_DEBUG("TO END: %lld, update seqno",
(long long)wsrep_thd_trx_seqno(thd));
@@ -1613,14 +1582,25 @@ int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_,
if (thd->variables.wsrep_on && thd->wsrep_exec_mode==LOCAL_STATE)
{
- switch (wsrep_OSU_method_options) {
+ switch (thd->variables.wsrep_OSU_method) {
case WSREP_OSU_TOI: ret = wsrep_TOI_begin(thd, db_, table_,
table_list); break;
case WSREP_OSU_RSU: ret = wsrep_RSU_begin(thd, db_, table_); break;
+ default:
+ WSREP_ERROR("Unsupported OSU method: %lu",
+ thd->variables.wsrep_OSU_method);
+ ret= -1;
+ break;
}
- if (!ret)
- {
- thd->wsrep_exec_mode= TOTAL_ORDER;
+ switch (ret) {
+ case 0: thd->wsrep_exec_mode= TOTAL_ORDER; break;
+ case 1:
+ /* TOI replication skipped, treat as success */
+ ret = 0;
+ break;
+ case -1:
+ /* TOI replication failed, treat as error */
+ break;
}
}
return ret;
@@ -1630,10 +1610,14 @@ void wsrep_to_isolation_end(THD *thd)
{
if (thd->wsrep_exec_mode == TOTAL_ORDER)
{
- switch(wsrep_OSU_method_options)
+ switch(thd->variables.wsrep_OSU_method)
{
case WSREP_OSU_TOI: wsrep_TOI_end(thd); break;
case WSREP_OSU_RSU: wsrep_RSU_end(thd); break;
+ default:
+ WSREP_WARN("Unsupported wsrep OSU method at isolation end: %lu",
+ thd->variables.wsrep_OSU_method);
+ break;
}
wsrep_cleanup_transaction(thd);
}
@@ -1652,10 +1636,21 @@ void wsrep_to_isolation_end(THD *thd)
gra->wsrep_exec_mode, gra->wsrep_query_state, gra->wsrep_conflict_state, \
gra->get_command(), gra->lex->sql_command, gra->query());
+/**
+ Check if request for the metadata lock should be granted to the requester.
+
+ @param requestor_ctx The MDL context of the requestor
+ @param ticket MDL ticket for the requested lock
+
+ @retval TRUE Lock request can be granted
+ @retval FALSE Lock request cannot be granted
+*/
+
bool
wsrep_grant_mdl_exception(MDL_context *requestor_ctx,
MDL_ticket *ticket
) {
+ /* Fallback to the non-wsrep behaviour */
if (!WSREP_ON) return FALSE;
THD *request_thd = requestor_ctx->get_thd();
@@ -1748,7 +1743,7 @@ pthread_handler_t start_wsrep_THD(void *arg)
thread_created++;
threads.append(thd);
- my_net_init(&thd->net,(st_vio*) 0, MYF(0));
+ my_net_init(&thd->net,(st_vio*) 0, thd, MYF(0));
DBUG_PRINT("wsrep",(("creating thread %lld"), (long long)thd->thread_id));
thd->prior_thr_create_utime= thd->start_utime= microsecond_interval_timer();
@@ -2477,9 +2472,13 @@ int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len)
if (lex->definer)
{
/* SUID trigger. */
+ LEX_USER *d= get_current_user(thd, lex->definer);
+
+ if (!d)
+ return 1;
- definer_user= lex->definer->user;
- definer_host= lex->definer->host;
+ definer_user= d->user;
+ definer_host= d->host;
}
else
{
@@ -2530,6 +2529,11 @@ my_bool get_wsrep_drupal_282555_workaround()
return wsrep_drupal_282555_workaround;
}
+my_bool get_wsrep_recovery()
+{
+ return wsrep_recovery;
+}
+
my_bool get_wsrep_log_conflicts()
{
return wsrep_log_conflicts;
diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h
index f68b89e7994..d02d59e767e 100644
--- a/sql/wsrep_mysqld.h
+++ b/sql/wsrep_mysqld.h
@@ -1,4 +1,4 @@
-/* Copyright 2008-2013 Codership Oy <http://www.codership.com>
+/* Copyright 2008-2015 Codership Oy <http://www.codership.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -77,9 +77,7 @@ extern ulong wsrep_max_ws_rows;
extern const char* wsrep_notify_cmd;
extern long wsrep_max_protocol_version;
extern ulong wsrep_forced_binlog_format;
-extern ulong wsrep_OSU_method_options;
extern my_bool wsrep_desync;
-extern my_bool wsrep_recovery;
extern my_bool wsrep_replicate_myisam;
extern ulong wsrep_mysql_replication_bundle;
extern my_bool wsrep_restart_slave;
@@ -91,7 +89,12 @@ extern bool wsrep_new_cluster;
extern bool wsrep_gtid_mode;
extern uint32 wsrep_gtid_domain_id;
-enum enum_wsrep_OSU_method { WSREP_OSU_TOI, WSREP_OSU_RSU };
+enum enum_wsrep_OSU_method {
+ WSREP_OSU_TOI,
+ WSREP_OSU_RSU,
+ WSREP_OSU_NONE,
+};
+
enum enum_wsrep_sync_wait {
WSREP_SYNC_WAIT_NONE = 0x0,
// show, select, begin
@@ -283,14 +286,6 @@ int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len);
int wsrep_create_event_query(THD *thd, uchar** buf, size_t* buf_len);
int wsrep_alter_event_query(THD *thd, uchar** buf, size_t* buf_len);
-struct xid_t;
-void wsrep_get_SE_checkpoint(xid_t*);
-void wsrep_set_SE_checkpoint(xid_t*);
-void wsrep_init_sidno(const wsrep_uuid_t&);
-void wsrep_xid_init(xid_t*, const wsrep_uuid_t*, wsrep_seqno_t);
-const wsrep_uuid_t* wsrep_xid_uuid(const xid_t*);
-wsrep_seqno_t wsrep_xid_seqno(const xid_t*);
-
extern bool
wsrep_grant_mdl_exception(MDL_context *requestor_ctx,
MDL_ticket *ticket);
@@ -329,7 +324,6 @@ int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len);
#define wsrep_emulate_bin_log (0)
#define wsrep_xid_seqno(X) (0)
#define wsrep_to_isolation (0)
-#define wsrep_recovery (0)
#define wsrep_init() (1)
#define wsrep_prepend_PATH(X)
#define wsrep_before_SE() (0)
@@ -346,6 +340,7 @@ int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len);
#define wsrep_replicate_myisam (0)
#define wsrep_thr_init() do {} while(0)
#define wsrep_thr_deinit() do {} while(0)
+#define wsrep_running_threads (0)
#endif /* WITH_WSREP */
#endif /* WSREP_MYSQLD_H */
diff --git a/sql/wsrep_priv.h b/sql/wsrep_priv.h
index 5c66587d757..30dce78c1a4 100644
--- a/sql/wsrep_priv.h
+++ b/sql/wsrep_priv.h
@@ -32,22 +32,20 @@ ssize_t wsrep_sst_prepare (void** msg);
wsrep_cb_status wsrep_sst_donate_cb (void* app_ctx,
void* recv_ctx,
const void* msg, size_t msg_len,
- const wsrep_gtid_t* current_id,
+ const wsrep_gtid_t* state_id,
const char* state, size_t state_len,
bool bypass);
-extern unsigned int wsrep_check_ip (const char* addr);
-extern size_t wsrep_guess_ip (char* buf, size_t buf_len);
-extern size_t wsrep_guess_address(char* buf, size_t buf_len);
extern wsrep_uuid_t local_uuid;
extern wsrep_seqno_t local_seqno;
// a helper function
-extern void wsrep_sst_received(wsrep_t*, const wsrep_uuid_t*, wsrep_seqno_t,
- const void*, size_t);
+void wsrep_sst_received(wsrep_t*, const wsrep_uuid_t&, wsrep_seqno_t,
+ const void*, size_t);
/*! SST thread signals init thread about sst completion */
-extern void wsrep_sst_complete(const wsrep_uuid_t*, wsrep_seqno_t, bool);
+void wsrep_sst_complete(const wsrep_uuid_t*, wsrep_seqno_t, bool);
void wsrep_notify_status (wsrep_member_status_t new_status,
const wsrep_view_info_t* view = 0);
+
#endif /* WSREP_PRIV_H */
diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc
index d37c6c0e96c..b31d433de08 100644
--- a/sql/wsrep_sst.cc
+++ b/sql/wsrep_sst.cc
@@ -1,4 +1,4 @@
-/* Copyright 2008-2012 Codership Oy <http://www.codership.com>
+/* Copyright 2008-2015 Codership Oy <http://www.codership.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,6 +26,7 @@
#include <sql_parse.h>
#include "wsrep_priv.h"
#include "wsrep_utils.h"
+#include "wsrep_xid.h"
#include <cstdio>
#include <cstdlib>
@@ -264,19 +265,41 @@ void wsrep_sst_complete (const wsrep_uuid_t* sst_uuid,
}
void wsrep_sst_received (wsrep_t* const wsrep,
- const wsrep_uuid_t* const uuid,
+ const wsrep_uuid_t& uuid,
wsrep_seqno_t const seqno,
const void* const state,
size_t const state_len)
{
- int const rcode(seqno < 0 ? seqno : 0);
- wsrep_gtid_t const state_id = {
- *uuid, (rcode ? WSREP_SEQNO_UNDEFINED : seqno)
- };
+ wsrep_get_SE_checkpoint(local_uuid, local_seqno);
+
+ if (memcmp(&local_uuid, &uuid, sizeof(wsrep_uuid_t)) ||
+ local_seqno < seqno || seqno < 0)
+ {
+ wsrep_set_SE_checkpoint(uuid, seqno);
+ local_uuid = uuid;
+ local_seqno = seqno;
+ }
+ else if (local_seqno > seqno)
+ {
+ WSREP_WARN("SST postion is in the past: %lld, current: %lld. "
+ "Can't continue.",
+ (long long)seqno, (long long)local_seqno);
+ unireg_abort(1);
+ }
+
#ifdef GTID_SUPPORT
- wsrep_init_sidno(state_id.uuid);
+ wsrep_init_sidno(uuid);
#endif /* GTID_SUPPORT */
- wsrep->sst_received(wsrep, &state_id, state, state_len, rcode);
+
+ if (wsrep)
+ {
+ int const rcode(seqno < 0 ? seqno : 0);
+ wsrep_gtid_t const state_id = {
+ uuid, (rcode ? WSREP_SEQNO_UNDEFINED : seqno)
+ };
+
+ wsrep->sst_received(wsrep, &state_id, state, state_len, rcode);
+ }
}
// Let applier threads to continue
@@ -285,7 +308,7 @@ void wsrep_sst_continue ()
if (sst_needed)
{
WSREP_INFO("Signalling provider to continue.");
- wsrep_sst_received (wsrep, &local_uuid, local_seqno, NULL, 0);
+ wsrep_sst_received (wsrep, local_uuid, local_seqno, NULL, 0);
}
}
@@ -606,8 +629,6 @@ static bool SE_initialized = false;
ssize_t wsrep_sst_prepare (void** msg)
{
- const ssize_t ip_max= 256;
- char ip_buf[ip_max];
const char* addr_in= NULL;
const char* addr_out= NULL;
@@ -623,27 +644,34 @@ ssize_t wsrep_sst_prepare (void** msg)
return ret;
}
- // Figure out SST address. Common for all SST methods
+ /*
+ Figure out SST receive address. Common for all SST methods.
+ */
+ char ip_buf[256];
+ const ssize_t ip_max= sizeof(ip_buf);
+
+ // Attempt 1: wsrep_sst_receive_address
if (wsrep_sst_receive_address &&
strcmp (wsrep_sst_receive_address, WSREP_SST_ADDRESS_AUTO))
{
addr_in= wsrep_sst_receive_address;
}
+
+ //Attempt 2: wsrep_node_address
else if (wsrep_node_address && strlen(wsrep_node_address))
{
- const char* const colon= strchr (wsrep_node_address, ':');
- if (colon)
- {
- ptrdiff_t const len= colon - wsrep_node_address;
- strncpy (ip_buf, wsrep_node_address, len);
- ip_buf[len]= '\0';
- addr_in= ip_buf;
- }
- else
+ wsp::Address addr(wsrep_node_address);
+
+ if (!addr.is_valid())
{
- addr_in= wsrep_node_address;
+ WSREP_ERROR("Could not parse wsrep_node_address : %s",
+ wsrep_node_address);
+ unireg_abort(1);
}
+ memcpy(ip_buf, addr.get_address(), addr.get_address_len());
+ addr_in= ip_buf;
}
+ // Attempt 3: Try to get the IP from the list of available interfaces.
else
{
ssize_t ret= wsrep_guess_ip (ip_buf, ip_max);
@@ -654,8 +682,7 @@ ssize_t wsrep_sst_prepare (void** msg)
}
else
{
- WSREP_ERROR("Could not prepare state transfer request: "
- "failed to guess address to accept state transfer at. "
+ WSREP_ERROR("Failed to guess address to accept state transfer. "
"wsrep_sst_receive_address must be set manually.");
unireg_abort(1);
}
@@ -755,8 +782,10 @@ static void sst_reject_queries(my_bool close_conn)
if (TRUE == close_conn) wsrep_close_client_connections(FALSE);
}
-static int sst_mysqldump_check_addr (const char* user, const char* pswd,
- const char* host, const char* port)
+static int sst_mysqldump_check_addr (const char* user,
+ const char* pswd,
+ const char* host,
+ int port)
{
return 0;
}
@@ -767,25 +796,17 @@ static int sst_donate_mysqldump (const char* addr,
wsrep_seqno_t seqno,
bool bypass)
{
- size_t host_len;
- const char* port = strchr (addr, ':');
+ char host[256];
+ wsp::Address address(addr);
- if (port)
+ if (!address.is_valid())
{
- port += 1;
- host_len = port - addr;
- }
- else
- {
- port = "";
- host_len = strlen (addr) + 1;
+ WSREP_ERROR("Could not parse SST address : %s", addr);
+ return 0;
}
- char *host=(char*)alloca(host_len);
-
- strncpy (host, addr, host_len - 1);
- host[host_len - 1] = '\0';
-
+ memcpy(host, address.get_address(), address.get_address_len());
+ int port= address.get_port();
const char* auth = sst_auth_real;
const char* pswd = (auth) ? strchr (auth, ':') : NULL;
size_t user_len;
@@ -801,7 +822,7 @@ static int sst_donate_mysqldump (const char* addr,
user_len = (auth) ? strlen (auth) + 1 : 1;
}
- char *user=(char*)alloca(user_len);
+ char *user= (char *) alloca(user_len);
strncpy (user, (auth) ? auth : "", user_len - 1);
user[user_len - 1] = '\0';
@@ -820,7 +841,7 @@ static int sst_donate_mysqldump (const char* addr,
WSREP_SST_OPT_USER" '%s' "
WSREP_SST_OPT_PSWD" '%s' "
WSREP_SST_OPT_HOST" '%s' "
- WSREP_SST_OPT_PORT" '%s' "
+ WSREP_SST_OPT_PORT" '%d' "
WSREP_SST_OPT_LPORT" '%u' "
WSREP_SST_OPT_SOCKET" '%s' "
" %s "
@@ -912,11 +933,13 @@ static int sst_flush_tables(THD* thd)
{
WSREP_INFO("Tables flushed.");
const char base_name[]= "tables_flushed";
+
ssize_t const full_len= strlen(mysql_real_data_home) + strlen(base_name)+2;
- char *real_name=(char*)alloca(full_len);
- sprintf(real_name, "%s/%s", mysql_real_data_home, base_name);
- char *tmp_name=(char*)alloca(full_len + 4);
- sprintf(tmp_name, "%s.tmp", real_name);
+ char *real_name= (char *) alloca(full_len);
+ snprintf(real_name, (size_t) full_len, "%s/%s", mysql_real_data_home,
+ base_name);
+ char *tmp_name= (char *) alloca(full_len + 4);
+ snprintf(tmp_name, (size_t) full_len + 4, "%s.tmp", real_name);
FILE* file= fopen(tmp_name, "w+");
if (0 == file)
@@ -1078,7 +1101,7 @@ static int sst_donate_other (const char* method,
wsrep_seqno_t seqno,
bool bypass)
{
- char cmd_str[4096];
+ char cmd_str[4096];
const char* binlog_opt= "";
char* binlog_opt_val= NULL;
@@ -1111,7 +1134,7 @@ static int sst_donate_other (const char* method,
bypass ? " "WSREP_SST_OPT_BYPASS : "");
my_free(binlog_opt_val);
- if (ret < 0 || ret >= (int)sizeof(cmd_str))
+ if (ret < 0 || ret >= (int) sizeof(cmd_str))
{
WSREP_ERROR("sst_donate_other(): snprintf() failed: %d", ret);
return (ret < 0 ? ret : -EMSGSIZE);
diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc
index 2baee3a252d..9e608f94848 100644
--- a/sql/wsrep_thd.cc
+++ b/sql/wsrep_thd.cc
@@ -122,10 +122,13 @@ static rpl_group_info* wsrep_relay_group_init(const char* log_fname)
*/
rli->mi = new Master_info(&connection_name, false);
- rli->sql_driver_thd= current_thd;
-
struct rpl_group_info *rgi= new rpl_group_info(rli);
- rgi->thd= current_thd;
+ rgi->thd= rli->sql_driver_thd= current_thd;
+
+ if ((rgi->deferred_events_collecting= rli->mi->rpl_filter->is_on()))
+ {
+ rgi->deferred_events= new Deferred_log_events(rli);
+ }
return rgi;
}
@@ -173,6 +176,8 @@ static void wsrep_return_from_bf_mode(THD *thd, struct wsrep_thd_shadow* shadow)
delete thd->system_thread_info.rpl_sql_info;
delete thd->wsrep_rgi->rli->mi;
delete thd->wsrep_rgi->rli;
+
+ thd->wsrep_rgi->cleanup_after_session();
delete thd->wsrep_rgi;
thd->wsrep_rgi = NULL;
}
@@ -567,10 +572,21 @@ int wsrep_abort_thd(void *bf_thd_ptr, void *victim_thd_ptr, my_bool signal)
DBUG_ENTER("wsrep_abort_thd");
if ( (WSREP(bf_thd) ||
- ( (WSREP_ON || wsrep_OSU_method_options == WSREP_OSU_RSU) &&
- bf_thd->wsrep_exec_mode == TOTAL_ORDER) ) &&
+ ( (WSREP_ON || bf_thd->variables.wsrep_OSU_method == WSREP_OSU_RSU) &&
+ bf_thd->wsrep_exec_mode == TOTAL_ORDER) ) &&
victim_thd)
{
+ if ((victim_thd->wsrep_conflict_state == MUST_ABORT) ||
+ (victim_thd->wsrep_conflict_state == ABORTED) ||
+ (victim_thd->wsrep_conflict_state == ABORTING))
+ {
+ WSREP_DEBUG("wsrep_abort_thd called by %llu with victim %llu already "
+ "aborted. Ignoring.",
+ (bf_thd) ? (long long)bf_thd->real_id : 0,
+ (long long)victim_thd->real_id);
+ DBUG_RETURN(1);
+ }
+
WSREP_DEBUG("wsrep_abort_thd, by: %llu, victim: %llu", (bf_thd) ?
(long long)bf_thd->real_id : 0, (long long)victim_thd->real_id);
ha_abort_transaction(bf_thd, victim_thd, signal);
diff --git a/sql/wsrep_utils.cc b/sql/wsrep_utils.cc
index 7172f77bfed..80f8bd4c7d4 100644
--- a/sql/wsrep_utils.cc
+++ b/sql/wsrep_utils.cc
@@ -1,4 +1,4 @@
-/* Copyright 2010 Codership Oy <http://www.codership.com>
+/* Copyright 2010-2015 Codership Oy <http://www.codership.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -150,7 +150,35 @@ process::process (const char* cmd, const char* type)
goto cleanup_pipe;
}
- err_ = posix_spawnattr_setflags (&attr, POSIX_SPAWN_SETSIGDEF |
+ /* make sure that no signlas are masked in child process */
+ sigset_t sigmask_empty; sigemptyset(&sigmask_empty);
+ err_ = posix_spawnattr_setsigmask(&attr, &sigmask_empty);
+ if (err_)
+ {
+ WSREP_ERROR ("posix_spawnattr_setsigmask() failed: %d (%s)",
+ err_, strerror(err_));
+ goto cleanup_attr;
+ }
+
+ /* make sure the following signals are not ignored in child process */
+ sigset_t default_signals; sigemptyset(&default_signals);
+ sigaddset(&default_signals, SIGHUP);
+ sigaddset(&default_signals, SIGINT);
+ sigaddset(&default_signals, SIGQUIT);
+ sigaddset(&default_signals, SIGPIPE);
+ sigaddset(&default_signals, SIGTERM);
+ sigaddset(&default_signals, SIGCHLD);
+ err_ = posix_spawnattr_setsigdefault(&attr, &default_signals);
+ if (err_)
+ {
+ WSREP_ERROR ("posix_spawnattr_setsigdefault() failed: %d (%s)",
+ err_, strerror(err_));
+ goto cleanup_attr;
+ }
+
+ err_ = posix_spawnattr_setflags (&attr, POSIX_SPAWN_SETSIGDEF |
+ POSIX_SPAWN_SETSIGMASK |
+ /* start a new process group */ POSIX_SPAWN_SETPGROUP |
POSIX_SPAWN_USEVFORK);
if (err_)
{
@@ -324,7 +352,7 @@ thd::~thd ()
} // namespace wsp
/* Returns INADDR_NONE, INADDR_ANY, INADDR_LOOPBACK or something else */
-unsigned int wsrep_check_ip (const char* const addr)
+unsigned int wsrep_check_ip (const char* const addr, bool *is_ipv6)
{
unsigned int ret = INADDR_NONE;
struct addrinfo *res, hints;
@@ -334,6 +362,8 @@ unsigned int wsrep_check_ip (const char* const addr)
hints.ai_socktype= SOCK_STREAM;
hints.ai_family= AF_UNSPEC;
+ *is_ipv6= false;
+
int gai_ret = getaddrinfo(addr, NULL, &hints, &res);
if (0 == gai_ret)
{
@@ -351,6 +381,8 @@ unsigned int wsrep_check_ip (const char* const addr)
ret= INADDR_LOOPBACK;
else
ret= 0xdeadbeef;
+
+ *is_ipv6= true;
}
freeaddrinfo (res);
}
@@ -359,10 +391,6 @@ unsigned int wsrep_check_ip (const char* const addr)
addr, gai_ret, gai_strerror(gai_ret));
}
- // uint8_t* b= (uint8_t*)&ret;
- // fprintf (stderr, "########## wsrep_check_ip returning: %hhu.%hhu.%hhu.%hhu\n",
- // b[0], b[1], b[2], b[3]);
-
return ret;
}
@@ -370,44 +398,47 @@ extern char* my_bind_addr_str;
size_t wsrep_guess_ip (char* buf, size_t buf_len)
{
- size_t ip_len = 0;
+ size_t ret= 0;
+ // Attempt 1: Try to get the IP from bind-address.
if (my_bind_addr_str && my_bind_addr_str[0] != '\0')
{
- unsigned int const ip_type= wsrep_check_ip(my_bind_addr_str);
+ bool unused;
+ unsigned int const ip_type= wsrep_check_ip(my_bind_addr_str, &unused);
if (INADDR_NONE == ip_type) {
WSREP_ERROR("Networking not configured, cannot receive state "
"transfer.");
- return 0;
- }
-
- if (INADDR_ANY != ip_type) {
+ ret= 0;
+ } else if (INADDR_ANY != ip_type) {
strncpy (buf, my_bind_addr_str, buf_len);
- return strlen(buf);
+ ret= strlen(buf);
}
+ goto done;
}
- // mysqld binds to all interfaces - try IP from wsrep_node_address
+ // Attempt 2: mysqld binds to all interfaces, try IP from wsrep_node_address.
if (wsrep_node_address && wsrep_node_address[0] != '\0') {
- const char* const colon_ptr = strchr(wsrep_node_address, ':');
-
- if (colon_ptr)
- ip_len = colon_ptr - wsrep_node_address;
- else
- ip_len = strlen(wsrep_node_address);
-
- if (ip_len >= buf_len) {
- WSREP_WARN("default_ip(): buffer too short: %zu <= %zd", buf_len, ip_len);
- return 0;
+ wsp::Address addr(wsrep_node_address);
+ if (!addr.is_valid())
+ {
+ WSREP_WARN("Could not parse wsrep_node_address : %s",
+ wsrep_node_address);
+ ret= 0;
+ goto done;
}
- memcpy (buf, wsrep_node_address, ip_len);
- buf[ip_len] = '\0';
- return ip_len;
+ /* Safety check: Buffer length should be sufficiently large. */
+ DBUG_ASSERT(buf_len >= addr.get_address_len());
+
+ memcpy(buf, addr.get_address(), addr.get_address_len());
+ ret= addr.get_address_len();
+ goto done;
}
/*
+ Attempt 3: Try to get the IP from the list of available interfaces.
+
getifaddrs() is avaiable at least on Linux since glib 2.3, FreeBSD,
MAC OSX, OpenSolaris, Solaris.
@@ -416,80 +447,42 @@ size_t wsrep_guess_ip (char* buf, size_t buf_len)
*/
#if HAVE_GETIFADDRS
struct ifaddrs *ifaddr, *ifa;
+ int family;
+
if (getifaddrs(&ifaddr) == 0)
{
for (ifa= ifaddr; ifa != NULL; ifa = ifa->ifa_next)
{
- if (!ifa->ifa_addr || ifa->ifa_addr->sa_family != AF_INET) // TODO AF_INET6
+ if (!ifa->ifa_addr)
+ continue;
+
+ family= ifa->ifa_addr->sa_family;
+
+ if ((family != AF_INET) && (family != AF_INET6))
continue;
// Skip loopback interfaces (like lo:127.0.0.1)
if (ifa->ifa_flags & IFF_LOOPBACK)
continue;
+ /*
+ Get IP address from the socket address. The resulting address may have
+ zone ID appended for IPv6 addresses (<address>%<zone-id>).
+ */
if (vio_getnameinfo(ifa->ifa_addr, buf, buf_len, NULL, 0, NI_NUMERICHOST))
continue;
freeifaddrs(ifaddr);
- return strlen(buf);
+
+ ret= strlen(buf);
+ goto done;
}
freeifaddrs(ifaddr);
}
#endif /* HAVE_GETIFADDRS */
- return 0;
-}
-
-/*
- * WSREPXid
- */
-
-#define WSREP_XID_PREFIX "WSREPXid"
-#define WSREP_XID_PREFIX_LEN MYSQL_XID_PREFIX_LEN
-#define WSREP_XID_UUID_OFFSET 8
-#define WSREP_XID_SEQNO_OFFSET (WSREP_XID_UUID_OFFSET + sizeof(wsrep_uuid_t))
-#define WSREP_XID_GTRID_LEN (WSREP_XID_SEQNO_OFFSET + sizeof(wsrep_seqno_t))
-
-void wsrep_xid_init(XID* xid, const wsrep_uuid_t* uuid, wsrep_seqno_t seqno)
-{
- xid->formatID= 1;
- xid->gtrid_length= WSREP_XID_GTRID_LEN;
- xid->bqual_length= 0;
- memset(xid->data, 0, sizeof(xid->data));
- memcpy(xid->data, WSREP_XID_PREFIX, WSREP_XID_PREFIX_LEN);
- memcpy(xid->data + WSREP_XID_UUID_OFFSET, uuid, sizeof(wsrep_uuid_t));
- memcpy(xid->data + WSREP_XID_SEQNO_OFFSET, &seqno, sizeof(wsrep_seqno_t));
-}
-
-const wsrep_uuid_t* wsrep_xid_uuid(const XID* xid)
-{
- if (wsrep_is_wsrep_xid(xid))
- return reinterpret_cast<const wsrep_uuid_t*>(xid->data
- + WSREP_XID_UUID_OFFSET);
- else
- return &WSREP_UUID_UNDEFINED;
-}
-
-wsrep_seqno_t wsrep_xid_seqno(const XID* xid)
-{
-
- if (wsrep_is_wsrep_xid(xid))
- {
- wsrep_seqno_t seqno;
- memcpy(&seqno, xid->data + WSREP_XID_SEQNO_OFFSET, sizeof(wsrep_seqno_t));
- return seqno;
- }
- else
- {
- return WSREP_SEQNO_UNDEFINED;
- }
+done:
+ WSREP_DEBUG("wsrep_guess_ip() : %s", (ret > 0) ? buf : "????");
+ return ret;
}
-extern
-int wsrep_is_wsrep_xid(const XID* xid)
-{
- return (xid->formatID == 1 &&
- xid->gtrid_length == WSREP_XID_GTRID_LEN &&
- xid->bqual_length == 0 &&
- !memcmp(xid->data, WSREP_XID_PREFIX, WSREP_XID_PREFIX_LEN));
-}
diff --git a/sql/wsrep_utils.h b/sql/wsrep_utils.h
index 1cc65578202..32829c605fb 100644
--- a/sql/wsrep_utils.h
+++ b/sql/wsrep_utils.h
@@ -19,11 +19,153 @@
#include "wsrep_priv.h"
#include "wsrep_mysqld.h"
-unsigned int wsrep_check_ip (const char* addr);
+unsigned int wsrep_check_ip (const char* addr, bool *is_ipv6);
size_t wsrep_guess_ip (char* buf, size_t buf_len);
namespace wsp {
+class Address {
+public:
+ Address()
+ : m_address_len(0), m_family(UNSPEC), m_port(0), m_valid(false)
+ {
+ memset(m_address, 0, sizeof(m_address));
+ }
+ Address(const char *addr_in)
+ : m_address_len(0), m_family(UNSPEC), m_port(0), m_valid(false)
+ {
+ memset(m_address, 0, sizeof(m_address));
+ parse_addr(addr_in);
+ }
+ bool is_valid() { return m_valid; }
+ bool is_ipv6() { return (m_family == INET6); }
+
+ const char* get_address() { return m_address; }
+ size_t get_address_len() { return m_address_len; }
+ int get_port() { return m_port; }
+
+private:
+ enum family {
+ UNSPEC= 0,
+ INET, /* IPv4 */
+ INET6, /* IPv6 */
+ };
+
+ char m_address[256];
+ size_t m_address_len;
+ family m_family;
+ int m_port;
+ bool m_valid;
+
+ void parse_addr(const char *addr_in) {
+ const char *start;
+ const char *end;
+ const char *port;
+ const char* open_bracket= strchr(const_cast<char *>(addr_in), '[');
+ const char* close_bracket= strchr(const_cast<char *>(addr_in), ']');
+ const char* colon= strchr(const_cast<char *>(addr_in), ':');
+ const char* dot= strchr(const_cast<char *>(addr_in), '.');
+
+ int cc= colon_count(addr_in);
+
+ if (open_bracket != NULL ||
+ dot == NULL ||
+ (colon != NULL && (dot == NULL || colon < dot)))
+ {
+ // This could be an IPv6 address or a hostname
+ if (open_bracket != NULL) {
+ /* Sanity check: Address with '[' must include ']' */
+ if (close_bracket == NULL &&
+ open_bracket < close_bracket) /* Error: malformed address */
+ {
+ m_valid= false;
+ return;
+ }
+
+ start= open_bracket + 1;
+ end= close_bracket;
+
+ /* Check for port */
+ port= strchr(close_bracket, ':');
+ if ((port != NULL) && parse_port(port + 1))
+ {
+ return; /* Error: invalid port */
+ }
+ m_family= INET6;
+ }
+ else
+ {
+ switch (cc) {
+ case 0:
+ /* Hostname with no port */
+ start= addr_in;
+ end= addr_in + strlen(addr_in);
+ break;
+ case 1:
+ /* Hostname with port (host:port) */
+ start= addr_in;
+ end= colon;
+ parse_port(colon + 1);
+ break;
+ default:
+ /* IPv6 address */
+ start= addr_in;
+ end= addr_in + strlen(addr_in);
+ m_family= INET6;
+ break;
+ }
+ }
+ } else { /* IPv4 address or hostname */
+ start= addr_in;
+ if (colon != NULL) { /* Port */
+ end= colon;
+ if (parse_port(colon + 1))
+ return; /* Error: invalid port */
+ } else {
+ end= addr_in + strlen(addr_in);
+ }
+ }
+
+ size_t len= end - start;
+
+ /* Safety */
+ if (len >= sizeof(m_address))
+ {
+ // The supplied address is too large to fit into the internal buffer.
+ m_valid= false;
+ return;
+ }
+
+ memcpy(m_address, start, len);
+ m_address[len]= '\0';
+ m_address_len= ++ len;
+ m_valid= true;
+ return;
+ }
+
+ int colon_count(const char *addr) {
+ int count= 0, i= 0;
+
+ while(addr[i] != '\0')
+ {
+ if (addr[i] == ':') ++count;
+ ++ i;
+ }
+ return count;
+ }
+
+ bool parse_port(const char *port) {
+ m_port= strtol(port, NULL, 10);
+ if (errno == EINVAL || errno == ERANGE)
+ {
+ m_port= 0; /* Error: invalid port */
+ m_valid= false;
+ return true;
+ }
+ return false;
+ }
+};
+
class Config_state
{
public:
diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc
index a6c2bafef13..d6aa1ca5c79 100644
--- a/sql/wsrep_var.cc
+++ b/sql/wsrep_var.cc
@@ -1,4 +1,4 @@
-/* Copyright 2008 Codership Oy <http://www.codership.com>
+/* Copyright 2008-2015 Codership Oy <http://www.codership.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -21,6 +21,7 @@
#include <sql_acl.h>
#include "wsrep_priv.h"
#include "wsrep_thd.h"
+#include "wsrep_xid.h"
#include <my_dir.h>
#include <cstdio>
#include <cstdlib>
@@ -33,7 +34,6 @@ const char* wsrep_node_name = 0;
const char* wsrep_node_address = 0;
const char* wsrep_node_incoming_address = 0;
const char* wsrep_start_position = 0;
-ulong wsrep_OSU_method_options;
int wsrep_init_vars()
{
@@ -128,29 +128,30 @@ err:
return 1;
}
-void wsrep_set_local_position (const char* value)
+static
+void wsrep_set_local_position(const char* const value, bool const sst)
{
- size_t value_len = strlen (value);
- size_t uuid_len = wsrep_uuid_scan (value, value_len, &local_uuid);
+ size_t const value_len = strlen(value);
+ wsrep_uuid_t uuid;
+ size_t const uuid_len = wsrep_uuid_scan(value, value_len, &uuid);
+ wsrep_seqno_t const seqno = strtoll(value + uuid_len + 1, NULL, 10);
- local_seqno = strtoll (value + uuid_len + 1, NULL, 10);
-
- XID xid;
- wsrep_xid_init(&xid, &local_uuid, local_seqno);
- wsrep_set_SE_checkpoint(&xid);
- WSREP_INFO ("wsrep_start_position var submitted: '%s'", wsrep_start_position);
+ if (sst) {
+ wsrep_sst_received (wsrep, uuid, seqno, NULL, 0);
+ } else {
+ // initialization
+ local_uuid = uuid;
+ local_seqno = seqno;
+ }
}
bool wsrep_start_position_update (sys_var *self, THD* thd, enum_var_type type)
{
+ WSREP_INFO ("wsrep_start_position var submitted: '%s'",
+ wsrep_start_position);
// since this value passed wsrep_start_position_check, don't check anything
// here
- wsrep_set_local_position (wsrep_start_position);
-
- if (wsrep) {
- wsrep_sst_received (wsrep, &local_uuid, local_seqno, NULL, 0);
- }
-
+ wsrep_set_local_position (wsrep_start_position, true);
return 0;
}
@@ -163,7 +164,7 @@ void wsrep_start_position_init (const char* val)
return;
}
- wsrep_set_local_position (val);
+ wsrep_set_local_position (val, false);
}
static bool refresh_provider_options()
@@ -200,7 +201,7 @@ static int wsrep_provider_verify (const char* provider_str)
return 1;
/* check that provider file exists */
- bzero(&f_stat, sizeof(MY_STAT));
+ memset(&f_stat, 0, sizeof(MY_STAT));
if (!my_stat(path, &f_stat, MYF(0)))
{
return 1;
@@ -295,7 +296,11 @@ bool wsrep_provider_options_check(sys_var *self, THD* thd, set_var* var)
bool wsrep_provider_options_update(sys_var *self, THD* thd, enum_var_type type)
{
- DBUG_ASSERT(wsrep != NULL);
+ if (wsrep == NULL)
+ {
+ my_message(ER_WRONG_ARGUMENTS, "WSREP (galera) not started", MYF(0));
+ return true;
+ }
wsrep_status_t ret= wsrep->options_set(wsrep, wsrep_provider_options);
if (ret != WSREP_OK)
@@ -497,7 +502,11 @@ bool wsrep_desync_check (sys_var *self, THD* thd, set_var* var)
bool wsrep_desync_update (sys_var *self, THD* thd, enum_var_type type)
{
- DBUG_ASSERT(wsrep != NULL);
+ if (wsrep == NULL)
+ {
+ my_message(ER_WRONG_ARGUMENTS, "WSREP (galera) not started", MYF(0));
+ return true;
+ }
wsrep_status_t ret(WSREP_WARNING);
if (wsrep_desync) {
@@ -552,33 +561,36 @@ int wsrep_show_status (THD *thd, SHOW_VAR *var, char *buff,
*v++= wsrep_status_vars[i];
DBUG_ASSERT(i < maxi);
- DBUG_ASSERT(wsrep != NULL);
- wsrep_stats_var* stats= wsrep->stats_get(wsrep);
- for (wsrep_stats_var *sv= stats; i < maxi && sv && sv->name; i++, sv++, v++)
+ if (wsrep != NULL)
{
- v->name = thd->strdup(sv->name);
- switch (sv->type) {
- case WSREP_VAR_INT64:
- v->value = (char*)thd->memdup(&sv->value._int64, sizeof(longlong));
- v->type = SHOW_LONGLONG;
- break;
- case WSREP_VAR_STRING:
- v->value = thd->strdup(sv->value._string);
- v->type = SHOW_CHAR;
- break;
- case WSREP_VAR_DOUBLE:
- v->value = (char*)thd->memdup(&sv->value._double, sizeof(double));
- v->type = SHOW_DOUBLE;
- break;
+ wsrep_stats_var* stats= wsrep->stats_get(wsrep);
+ for (wsrep_stats_var *sv= stats;
+ i < maxi && sv && sv->name; i++,
+ sv++, v++)
+ {
+ v->name = thd->strdup(sv->name);
+ switch (sv->type) {
+ case WSREP_VAR_INT64:
+ v->value = (char*)thd->memdup(&sv->value._int64, sizeof(longlong));
+ v->type = SHOW_LONGLONG;
+ break;
+ case WSREP_VAR_STRING:
+ v->value = thd->strdup(sv->value._string);
+ v->type = SHOW_CHAR;
+ break;
+ case WSREP_VAR_DOUBLE:
+ v->value = (char*)thd->memdup(&sv->value._double, sizeof(double));
+ v->type = SHOW_DOUBLE;
+ break;
+ }
}
- DBUG_ASSERT(i < maxi);
+ wsrep->stats_free(wsrep, stats);
}
- wsrep->stats_free(wsrep, stats);
my_qsort(buff, i, sizeof(*v), show_var_cmp);
- v->name= 0; // terminator
+ v->name= 0; // terminator
return 0;
}
diff --git a/sql/wsrep_xid.cc b/sql/wsrep_xid.cc
new file mode 100644
index 00000000000..133e9cba825
--- /dev/null
+++ b/sql/wsrep_xid.cc
@@ -0,0 +1,147 @@
+/* Copyright 2015 Codership Oy <http://www.codership.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+//! @file some utility functions and classes not directly related to replication
+
+#include "wsrep_xid.h"
+#include "sql_class.h"
+#include "wsrep_mysqld.h" // for logging macros
+
+/*
+ * WSREPXid
+ */
+
+#define WSREP_XID_PREFIX "WSREPXid"
+#define WSREP_XID_PREFIX_LEN MYSQL_XID_PREFIX_LEN
+#define WSREP_XID_UUID_OFFSET 8
+#define WSREP_XID_SEQNO_OFFSET (WSREP_XID_UUID_OFFSET + sizeof(wsrep_uuid_t))
+#define WSREP_XID_GTRID_LEN (WSREP_XID_SEQNO_OFFSET + sizeof(wsrep_seqno_t))
+
+void wsrep_xid_init(XID* xid, const wsrep_uuid_t& uuid, wsrep_seqno_t seqno)
+{
+ xid->formatID= 1;
+ xid->gtrid_length= WSREP_XID_GTRID_LEN;
+ xid->bqual_length= 0;
+ memset(xid->data, 0, sizeof(xid->data));
+ memcpy(xid->data, WSREP_XID_PREFIX, WSREP_XID_PREFIX_LEN);
+ memcpy(xid->data + WSREP_XID_UUID_OFFSET, &uuid, sizeof(wsrep_uuid_t));
+ memcpy(xid->data + WSREP_XID_SEQNO_OFFSET, &seqno, sizeof(wsrep_seqno_t));
+}
+
+int wsrep_is_wsrep_xid(const XID* xid)
+{
+ return (xid->formatID == 1 &&
+ xid->gtrid_length == WSREP_XID_GTRID_LEN &&
+ xid->bqual_length == 0 &&
+ !memcmp(xid->data, WSREP_XID_PREFIX, WSREP_XID_PREFIX_LEN));
+}
+
+const wsrep_uuid_t* wsrep_xid_uuid(const XID& xid)
+{
+ if (wsrep_is_wsrep_xid(&xid))
+ return reinterpret_cast<const wsrep_uuid_t*>(xid.data
+ + WSREP_XID_UUID_OFFSET);
+ else
+ return &WSREP_UUID_UNDEFINED;
+}
+
+wsrep_seqno_t wsrep_xid_seqno(const XID& xid)
+{
+ if (wsrep_is_wsrep_xid(&xid))
+ {
+ wsrep_seqno_t seqno;
+ memcpy(&seqno, xid.data + WSREP_XID_SEQNO_OFFSET, sizeof(wsrep_seqno_t));
+ return seqno;
+ }
+ else
+ {
+ return WSREP_SEQNO_UNDEFINED;
+ }
+}
+
+static my_bool set_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg)
+{
+ XID* xid= static_cast<XID*>(arg);
+ handlerton* hton= plugin_data(plugin, handlerton *);
+
+ if (hton->set_checkpoint)
+ {
+ const wsrep_uuid_t* uuid(wsrep_xid_uuid(*xid));
+ char uuid_str[40] = {0, };
+ wsrep_uuid_print(uuid, uuid_str, sizeof(uuid_str));
+ WSREP_DEBUG("Set WSREPXid for InnoDB: %s:%lld",
+ uuid_str, (long long)wsrep_xid_seqno(*xid));
+ hton->set_checkpoint(hton, xid);
+ }
+ return FALSE;
+}
+
+void wsrep_set_SE_checkpoint(XID& xid)
+{
+ plugin_foreach(NULL, set_SE_checkpoint, MYSQL_STORAGE_ENGINE_PLUGIN, &xid);
+}
+
+void wsrep_set_SE_checkpoint(const wsrep_uuid_t& uuid, wsrep_seqno_t seqno)
+{
+ XID xid;
+ wsrep_xid_init(&xid, uuid, seqno);
+ wsrep_set_SE_checkpoint(xid);
+}
+
+static my_bool get_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg)
+{
+ XID* xid= reinterpret_cast<XID*>(arg);
+ handlerton* hton= plugin_data(plugin, handlerton *);
+
+ if (hton->get_checkpoint)
+ {
+ hton->get_checkpoint(hton, xid);
+ const wsrep_uuid_t* uuid(wsrep_xid_uuid(*xid));
+ char uuid_str[40] = {0, };
+ wsrep_uuid_print(uuid, uuid_str, sizeof(uuid_str));
+ WSREP_DEBUG("Read WSREPXid from InnoDB: %s:%lld",
+ uuid_str, (long long)wsrep_xid_seqno(*xid));
+ }
+ return FALSE;
+}
+
+void wsrep_get_SE_checkpoint(XID& xid)
+{
+ plugin_foreach(NULL, get_SE_checkpoint, MYSQL_STORAGE_ENGINE_PLUGIN, &xid);
+}
+
+void wsrep_get_SE_checkpoint(wsrep_uuid_t& uuid, wsrep_seqno_t& seqno)
+{
+ uuid= WSREP_UUID_UNDEFINED;
+ seqno= WSREP_SEQNO_UNDEFINED;
+
+ XID xid;
+ memset(&xid, 0, sizeof(xid));
+ xid.formatID= -1;
+
+ wsrep_get_SE_checkpoint(xid);
+
+ if (xid.formatID == -1) return; // nil XID
+
+ if (!wsrep_is_wsrep_xid(&xid))
+ {
+ WSREP_WARN("Read non-wsrep XID from storage engines.");
+ return;
+ }
+
+ uuid= *wsrep_xid_uuid(xid);
+ seqno= wsrep_xid_seqno(xid);
+}
diff --git a/sql/wsrep_xid.h b/sql/wsrep_xid.h
new file mode 100644
index 00000000000..c3cad0231d7
--- /dev/null
+++ b/sql/wsrep_xid.h
@@ -0,0 +1,36 @@
+/* Copyright (C) 2015 Codership Oy <info@codership.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef WSREP_XID_H
+#define WSREP_XID_H
+
+#include <my_config.h>
+
+#ifdef WITH_WSREP
+
+#include "../wsrep/wsrep_api.h"
+#include "handler.h" // XID typedef
+
+void wsrep_xid_init(xid_t*, const wsrep_uuid_t&, wsrep_seqno_t);
+const wsrep_uuid_t* wsrep_xid_uuid(const XID&);
+wsrep_seqno_t wsrep_xid_seqno(const XID&);
+
+//void wsrep_get_SE_checkpoint(XID&); /* uncomment if needed */
+void wsrep_get_SE_checkpoint(wsrep_uuid_t&, wsrep_seqno_t&);
+//void wsrep_set_SE_checkpoint(XID&); /* uncomment if needed */
+void wsrep_set_SE_checkpoint(const wsrep_uuid_t&, wsrep_seqno_t);
+
+#endif /* WITH_WSREP */
+#endif /* WSREP_UTILS_H */
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index 36471c2a069..93276d2f278 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -1873,7 +1873,7 @@ void ha_archive::destroy_record_buffer(archive_record_buffer *r)
frm image in the ARZ file. And this cannot be done in-place, it
requires ARZ file to be recreated from scratch
*/
-bool ha_archive::check_if_incompatible_data(HA_CREATE_INFO *info,
+bool ha_archive::check_if_incompatible_data(HA_CREATE_INFO *info_arg,
uint table_changes)
{
return COMPATIBLE_DATA_NO;
diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc
index e69e740bfcd..aa4a9bbad47 100644
--- a/storage/cassandra/ha_cassandra.cc
+++ b/storage/cassandra/ha_cassandra.cc
@@ -2283,7 +2283,7 @@ bool ha_cassandra::mrr_start_read()
rowkey_converter->mariadb_to_cassandra(&cass_key, &cass_key_len);
// Primitive buffer control
- if (se->add_lookup_key(cass_key, cass_key_len) >
+ if ((ulong) se->add_lookup_key(cass_key, cass_key_len) >
THDVAR(table->in_use, multiget_batch_size))
break;
}
diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt
index 02fe5ee8dad..2de00db1bfd 100644
--- a/storage/connect/CMakeLists.txt
+++ b/storage/connect/CMakeLists.txt
@@ -48,7 +48,7 @@ IF(UNIX)
# Bar: -Wfatal-errors removed (does not present in gcc on solaris10)
if(WITH_WARNINGS)
add_definitions(-Wall -Wextra -Wmissing-declarations)
- message(STATUS "CONNECT: GCC: All warnings enabled")
+ #message(STATUS "CONNECT: GCC: All warnings enabled")
else()
add_definitions(-Wall -Wmissing-declarations)
add_definitions(-Wno-write-strings)
@@ -69,7 +69,7 @@ IF(UNIX)
# These switches are for C++ only
# add_definitions(-Wno-reorder)
- message(STATUS "CONNECT: GCC: Some warnings disabled")
+ #message(STATUS "CONNECT: GCC: Some warnings disabled")
endif(WITH_WARNINGS)
add_definitions( -DUNIX -DLINUX -DUBUNTU )
diff --git a/storage/connect/filamzip.cpp b/storage/connect/filamzip.cpp
index 56faa555069..883ec73e039 100644
--- a/storage/connect/filamzip.cpp
+++ b/storage/connect/filamzip.cpp
@@ -1405,7 +1405,7 @@ void ZLBFAM::Rewind(void)
if (CurBlk >= 0) { // Nothing to do if no block read yet
if (!Optimized) { // If optimized, fseek will be done in ReadBuffer
rewind(Stream);
- fread(Zlenp, sizeof(int), 1, Stream);
+ (void) fread(Zlenp, sizeof(int), 1, Stream);
fseek(Stream, *Zlenp + sizeof(int), SEEK_SET);
OldBlk = -1;
} // endif Optimized
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index ed34c1541e2..dcfb6a3da8c 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -4089,7 +4089,27 @@ bool ha_connect::check_privileges(THD *thd, PTOS options, char *dbn)
case TAB_MAC:
case TAB_WMI:
case TAB_OEM:
- return check_access(thd, FILE_ACL, db, NULL, NULL, 0, 0);
+#ifdef NO_EMBEDDED_ACCESS_CHECKS
+ return false;
+#endif
+ /*
+ If table or table->mdl_ticket is NULL - it's a DLL, e.g. CREATE TABLE.
+ if the table has an MDL_EXCLUSIVE lock - it's a DDL too, e.g. the
+ insert step of CREATE ... SELECT.
+
+ Otherwise it's a DML, the table was normally opened, locked,
+ privilege were already checked, and table->grant.privilege is set.
+ With SQL SECURITY DEFINER, table->grant.privilege has definer's privileges.
+ */
+ if (!table || !table->mdl_ticket || table->mdl_ticket->get_type() == MDL_EXCLUSIVE)
+ return check_access(thd, FILE_ACL, db, NULL, NULL, 0, 0);
+ if (table->grant.privilege & FILE_ACL)
+ return false;
+ status_var_increment(thd->status_var.access_denied_errors);
+ my_error(access_denied_error_code(thd->password), MYF(0),
+ thd->security_ctx->priv_user, thd->security_ctx->priv_host,
+ (thd->password ? ER(ER_YES) : ER(ER_NO)));
+ return true;
// This is temporary until a solution is found
case TAB_TBL:
@@ -4476,15 +4496,16 @@ int ha_connect::external_lock(THD *thd, int lock_type)
xmod= MODE_ANY; // For info commands
DBUG_RETURN(rc);
} // endif MODE_ANY
-
- DBUG_ASSERT(table && table->s);
-
+ else
if (check_privileges(thd, options, table->s->db.str)) {
strcpy(g->Message, "This operation requires the FILE privilege");
htrc("%s\n", g->Message);
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
} // endif check_privileges
+
+ DBUG_ASSERT(table && table->s);
+
// Table mode depends on the query type
newmode= CheckMode(g, thd, newmode, &xcheck, &cras);
@@ -5123,7 +5144,6 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
hdr= (int)topt->header;
tbl= topt->tablist;
col= topt->colist;
- lrecl= (int)topt->lrecl;
if (topt->oplist) {
host= GetListOption(g, "host", topt->oplist, "localhost");
@@ -5739,6 +5759,14 @@ int ha_connect::create(const char *name, TABLE *table_arg,
PGLOBAL g= xp->g;
DBUG_ENTER("ha_connect::create");
+ /*
+ This assignment fixes test failures if some
+ "ALTER TABLE t1 ADD KEY(a)" query exits on ER_ACCESS_DENIED_ERROR
+ (e.g. on missing FILE_ACL). All following "CREATE TABLE" failed with
+ "ERROR 1105: CONNECT index modification should be in-place"
+ TODO: check with Olivier.
+ */
+ g->Xchk= NULL;
int sqlcom= thd_sql_command(table_arg->in_use);
PTOS options= GetTableOptionStruct(table_arg->s);
diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp
index 1304366b83a..08b555ebd71 100644
--- a/storage/connect/jsonudf.cpp
+++ b/storage/connect/jsonudf.cpp
@@ -1092,7 +1092,6 @@ static my_bool CalcLen(UDF_ARGS *args, my_bool obj,
break;
case TIME_RESULT:
case ROW_RESULT:
- case IMPOSSIBLE_RESULT:
default:
// What should we do here ?
break;
@@ -1143,7 +1142,6 @@ static my_bool CalcLen(UDF_ARGS *args, my_bool obj,
break;
case TIME_RESULT:
case ROW_RESULT:
- case IMPOSSIBLE_RESULT:
default:
// What should we do here ?
break;
@@ -1350,7 +1348,6 @@ static PJVAL MakeValue(PGLOBAL g, UDF_ARGS *args, uint i)
break;
case TIME_RESULT:
case ROW_RESULT:
- case IMPOSSIBLE_RESULT:
default:
break;
} // endswitch arg_type
@@ -1375,7 +1372,7 @@ my_bool JsonValue_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
} // end of JsonValue_init
char *JsonValue(UDF_INIT *initid, UDF_ARGS *args, char *result,
- unsigned long *res_length, char *, char *)
+ unsigned long *res_length, char *, char *)
{
char *str;
PGLOBAL g = (PGLOBAL)initid->ptr;
diff --git a/storage/connect/mycat.h b/storage/connect/mycat.h
index d4024e6b6c3..dfcbb2f6766 100644
--- a/storage/connect/mycat.h
+++ b/storage/connect/mycat.h
@@ -74,6 +74,7 @@ struct ha_table_option_struct {
typedef class ha_connect *PHC;
+char *GetPluginDir(void);
TABTYPE GetTypeID(const char *type);
bool IsFileType(TABTYPE type);
bool IsExactType(TABTYPE type);
diff --git a/storage/connect/mysql-test/connect/r/grant.result b/storage/connect/mysql-test/connect/r/grant.result
index ba5728703a5..4e64b983ea7 100644
--- a/storage/connect/mysql-test/connect/r/grant.result
+++ b/storage/connect/mysql-test/connect/r/grant.result
@@ -1,3 +1,4 @@
+set sql_mode="";
#
# Testing FILE privilege
#
@@ -46,7 +47,7 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT user();
user()
root@localhost
-CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
SELECT user();
user()
user@localhost
@@ -70,6 +71,7 @@ DROP USER user@localhost;
#
# Beginning of grant.inc
#
+CREATE USER user@localhost;
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
SELECT user();
@@ -130,7 +132,7 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT user();
user()
root@localhost
-CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
SELECT user();
user()
user@localhost
@@ -164,6 +166,7 @@ DROP USER user@localhost;
#
# Beginning of grant.inc
#
+CREATE USER user@localhost;
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
SELECT user();
@@ -224,7 +227,7 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT user();
user()
root@localhost
-CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
SELECT user();
user()
user@localhost
@@ -258,6 +261,7 @@ DROP USER user@localhost;
#
# Beginning of grant.inc
#
+CREATE USER user@localhost;
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
SELECT user();
@@ -318,7 +322,7 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT user();
user()
root@localhost
-CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
SELECT user();
user()
user@localhost
@@ -352,6 +356,7 @@ DROP USER user@localhost;
#
# Beginning of grant.inc
#
+CREATE USER user@localhost;
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
SELECT user();
@@ -412,7 +417,7 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT user();
user()
root@localhost
-CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
SELECT user();
user()
user@localhost
@@ -446,6 +451,7 @@ DROP USER user@localhost;
#
# Beginning of grant.inc
#
+CREATE USER user@localhost;
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
SELECT user();
@@ -506,7 +512,7 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT user();
user()
root@localhost
-CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
SELECT user();
user()
user@localhost
@@ -537,3 +543,4 @@ DROP USER user@localhost;
#
# End of grant.inc
#
+set sql_mode=default;
diff --git a/storage/connect/mysql-test/connect/r/grant2.result b/storage/connect/mysql-test/connect/r/grant2.result
new file mode 100644
index 00000000000..acefe6df659
--- /dev/null
+++ b/storage/connect/mysql-test/connect/r/grant2.result
@@ -0,0 +1,691 @@
+#
+# MDEV-7574 Security definer views don't work with CONNECT ODBC tables
+#
+CREATE USER user@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user@localhost;
+REVOKE FILE ON *.* FROM user@localhost;
+# Testing SQLCOM_SELECT
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+CREATE DEFINER=user@localhost SQL SECURITY DEFINER VIEW v1_baddefiner AS SELECT * FROM t1;
+SELECT * FROM t1;
+a
+10
+SELECT * FROM v1_invoker;
+a
+10
+SELECT * FROM v1_definer;
+a
+10
+SELECT * FROM v1_baddefiner;
+ERROR 28000: Access denied for user 'root'@'localhost' (using password: NO)
+SELECT * FROM t1;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+SELECT * FROM v1_invoker;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+SELECT * FROM v1_definer;
+a
+10
+DROP VIEW v1_invoker, v1_definer, v1_baddefiner;
+DROP TABLE t1;
+# Testing SQLCOM_UPDATE
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+UPDATE t1 SET a=11;
+UPDATE v1_invoker SET a=12;
+UPDATE v1_definer SET a=13;
+UPDATE t1 SET a=21;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v1_invoker SET a=22;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v1_definer SET a=23;
+DROP VIEW v1_invoker, v1_definer;
+DROP TABLE t1;
+# Testing SQLCOM_INSERT
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+INSERT INTO t1 VALUES (11);
+INSERT INTO v1_invoker VALUES (12);
+INSERT INTO v1_definer VALUES (13);
+INSERT INTO t1 VALUES (21);
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+INSERT INTO v1_invoker VALUES (22);
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+INSERT INTO v1_definer VALUES (23);
+DROP VIEW v1_invoker, v1_definer;
+DROP TABLE t1;
+# Testing SQLCOM_REPLACE
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+REPLACE INTO t1 VALUES (11);
+ERROR 42000: CONNECT Unsupported command
+REPLACE INTO v1_invoker VALUES (12);
+ERROR 42000: CONNECT Unsupported command
+REPLACE INTO v1_definer VALUES (13);
+ERROR 42000: CONNECT Unsupported command
+REPLACE INTO t1 VALUES (21);
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+REPLACE INTO v1_invoker VALUES (22);
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+REPLACE INTO v1_definer VALUES (23);
+ERROR 42000: CONNECT Unsupported command
+DROP VIEW v1_invoker, v1_definer;
+DROP TABLE t1;
+# Testing SQLCOM_DELETE
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10),(11),(12),(13),(21),(22),(23);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+DELETE FROM t1 WHERE a=11;
+DELETE FROM v1_invoker WHERE a=12;
+DELETE FROM v1_definer WHERE a=13;
+DELETE FROM t1 WHERE a=21;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE FROM v1_invoker WHERE a=22;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE FROM v1_definer WHERE a=23;
+DROP VIEW v1_invoker, v1_definer;
+DROP TABLE t1;
+# Testing SQLCOM_LOAD
+CREATE TABLE t1 (a VARCHAR(128)) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE t1;
+LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_invoker;
+LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_definer;
+LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE t1;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_invoker;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_definer;
+DROP VIEW v1_invoker, v1_definer;
+DROP TABLE t1;
+# Testing SQLCOM_TRUNCATE
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+TRUNCATE TABLE t1;
+INSERT INTO t1 VALUES (11);
+TRUNCATE TABLE t1;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DROP TABLE t1;
+# Testing SQLCOM_DROP_TABLE
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+DROP TABLE t1;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DROP TABLE t1;
+# Testing SQLCOM_DROP_VIEW
+# DROP VIEW does not need FILE_ACL.
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10),(11),(12),(13),(21),(22),(23);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+DROP VIEW v1_invoker, v1_definer;
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+DROP VIEW v1_invoker;
+DROP VIEW v1_definer;
+DROP TABLE t1;
+# Testing SQLCOM_CREATE_TABLE
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+# Testing SQLCOM_LOCK_TABLES
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+LOCK TABLE t1 READ;
+UNLOCK TABLES;
+LOCK TABLE t1 WRITE;
+UNLOCK TABLES;
+LOCK TABLE v1_invoker READ;
+UNLOCK TABLES;
+LOCK TABLE v1_invoker WRITE;
+UNLOCK TABLES;
+LOCK TABLE v1_definer READ;
+UNLOCK TABLES;
+LOCK TABLE v1_definer WRITE;
+UNLOCK TABLES;
+LOCK TABLE t1 READ;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+LOCK TABLE t1 WRITE;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+LOCK TABLE v1_invoker READ;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+LOCK TABLE v1_invoker WRITE;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+LOCK TABLE v1_definer READ;
+UNLOCK TABLES;
+LOCK TABLE v1_definer WRITE;
+UNLOCK TABLES;
+DROP VIEW v1_invoker, v1_definer;
+DROP TABLE t1;
+# Testing SQLCOM_UPDATE_MULTI
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+CREATE TABLE t2 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t2.fix';
+CREATE TABLE t3 (a INT);
+INSERT INTO t1 VALUES (10);
+INSERT INTO t2 VALUES (20);
+INSERT INTO t3 VALUES (30);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+CREATE SQL SECURITY INVOKER VIEW v2_invoker AS SELECT * FROM t2;
+CREATE SQL SECURITY DEFINER VIEW v2_definer AS SELECT * FROM t2;
+UPDATE t1 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t1 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t1 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t1 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t1 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t1 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t1 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t2 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t2 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t2 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t2 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t2 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t2 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t2 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t3 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t3 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t3 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t3 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t3 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t3 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t3 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_invoker a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_invoker a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_invoker a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_invoker a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_invoker a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_invoker a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_invoker a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_definer a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_definer a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_definer a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_definer a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_definer a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_definer a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_invoker a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_invoker a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_invoker a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_invoker a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_invoker a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_invoker a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_invoker a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_definer a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_definer a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_definer a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_definer a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_definer a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_definer a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t1 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE t1 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE t1 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE t1 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE t1 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE t1 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE t1 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE t2 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE t2 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE t2 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE t2 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE t2 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE t2 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE t2 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE t3 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE t3 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE t3 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t3 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE t3 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t3 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE t3 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_invoker a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v1_invoker a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v1_invoker a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v1_invoker a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v1_invoker a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v1_invoker a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v1_invoker a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v1_definer a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v1_definer a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v1_definer a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_definer a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v1_definer a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_definer a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v1_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_invoker a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v2_invoker a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v2_invoker a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v2_invoker a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v2_invoker a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v2_invoker a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v2_invoker a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v2_definer a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v2_definer a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v2_definer a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_definer a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v2_definer a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_definer a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+UPDATE v2_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+DROP VIEW v1_invoker, v1_definer, v2_invoker, v2_definer;
+DROP TABLE t1, t2, t3;
+# Testing SQLCOM_DELETE_MULTI
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+CREATE TABLE t2 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t2.fix';
+CREATE TABLE t3 (a INT);
+INSERT INTO t1 VALUES (10);
+INSERT INTO t2 VALUES (20);
+INSERT INTO t3 VALUES (30);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+CREATE SQL SECURITY INVOKER VIEW v2_invoker AS SELECT * FROM t2;
+CREATE SQL SECURITY DEFINER VIEW v2_definer AS SELECT * FROM t2;
+DELETE a1 FROM t1 a1,t1 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t1 a1,t2 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t1 a1,t3 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t1 a1,v1_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t1 a1,v1_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t1 a1,v2_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t1 a1,v2_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t2 a1,t1 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t2 a1,t2 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t2 a1,t3 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t2 a1,v1_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t2 a1,v1_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t2 a1,v2_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t2 a1,v2_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t3 a1,t1 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t3 a1,t2 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t3 a1,t3 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t3 a1,v1_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t3 a1,v1_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t3 a1,v2_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t3 a1,v2_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_invoker a1,t1 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_invoker a1,t2 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_invoker a1,t3 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_invoker a1,v1_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_invoker a1,v1_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_invoker a1,v2_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_invoker a1,v2_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_definer a1,t1 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_definer a1,t2 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_definer a1,t3 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_definer a1,v1_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_definer a1,v1_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_definer a1,v2_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_definer a1,v2_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_invoker a1,t1 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_invoker a1,t2 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_invoker a1,t3 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_invoker a1,v1_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_invoker a1,v1_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_invoker a1,v2_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_invoker a1,v2_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_definer a1,t1 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_definer a1,t2 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_definer a1,t3 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_definer a1,v1_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_definer a1,v1_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_definer a1,v2_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_definer a1,v2_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t1 a1,t1 a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM t1 a1,t2 a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM t1 a1,t3 a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM t1 a1,v1_invoker a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM t1 a1,v1_definer a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM t1 a1,v2_invoker a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM t1 a1,v2_definer a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM t2 a1,t1 a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM t2 a1,t2 a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM t2 a1,t3 a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM t2 a1,v1_invoker a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM t2 a1,v1_definer a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM t2 a1,v2_invoker a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM t2 a1,v2_definer a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM t3 a1,t1 a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM t3 a1,t2 a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM t3 a1,t3 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t3 a1,v1_invoker a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM t3 a1,v1_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t3 a1,v2_invoker a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM t3 a1,v2_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_invoker a1,t1 a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM v1_invoker a1,t2 a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM v1_invoker a1,t3 a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM v1_invoker a1,v1_invoker a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM v1_invoker a1,v1_definer a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM v1_invoker a1,v2_invoker a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM v1_invoker a1,v2_definer a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM v1_definer a1,t1 a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM v1_definer a1,t2 a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM v1_definer a1,t3 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_definer a1,v1_invoker a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM v1_definer a1,v1_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_definer a1,v2_invoker a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM v1_definer a1,v2_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_invoker a1,t1 a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM v2_invoker a1,t2 a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM v2_invoker a1,t3 a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM v2_invoker a1,v1_invoker a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM v2_invoker a1,v1_definer a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM v2_invoker a1,v2_invoker a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM v2_invoker a1,v2_definer a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM v2_definer a1,t1 a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM v2_definer a1,t2 a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM v2_definer a1,t3 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_definer a1,v1_invoker a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM v2_definer a1,v1_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_definer a1,v2_invoker a2 WHERE a1.a=a2.a;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DELETE a1 FROM v2_definer a1,v2_definer a2 WHERE a1.a=a2.a;
+DROP VIEW v1_invoker, v1_definer, v2_invoker, v2_definer;
+DROP TABLE t1, t2, t3;
+# Testing SQLCOM_CREATE_VIEW
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+CREATE VIEW v2 AS SELECT * FROM v1_invoker;
+DROP VIEW v2;
+CREATE VIEW v2 AS SELECT * FROM v1_definer;
+DROP VIEW v2;
+CREATE VIEW v2 AS SELECT * FROM t1;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+CREATE VIEW v2 AS SELECT * FROM v1_invoker;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+CREATE VIEW v2 AS SELECT * FROM v1_definer;
+DROP VIEW v2;
+DROP VIEW v1_invoker, v1_definer;
+DROP TABLE t1;
+# Testing SQLCOM_INSERT_SELECT
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1 WHERE a=20;
+INSERT INTO t1 SELECT * FROM v1_invoker WHERE a=20;
+INSERT INTO t1 SELECT * FROM v1_definer WHERE a=20;
+INSERT INTO v1_invoker SELECT * FROM t1 WHERE a=20;
+INSERT INTO v1_invoker SELECT * FROM v1_invoker WHERE a=20;
+INSERT INTO v1_invoker SELECT * FROM v1_definer WHERE a=20;
+INSERT INTO v1_definer SELECT * FROM t1 WHERE a=20;
+INSERT INTO v1_definer SELECT * FROM v1_invoker WHERE a=20;
+INSERT INTO v1_definer SELECT * FROM v1_definer WHERE a=20;
+INSERT INTO t1 SELECT * FROM t1 WHERE a=20;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+INSERT INTO t1 SELECT * FROM v1_invoker WHERE a=20;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+INSERT INTO t1 SELECT * FROM v1_definer WHERE a=20;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+INSERT INTO v1_invoker SELECT * FROM t1 WHERE a=20;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+INSERT INTO v1_invoker SELECT * FROM v1_invoker WHERE a=20;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+INSERT INTO v1_invoker SELECT * FROM v1_definer WHERE a=20;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+INSERT INTO v1_definer SELECT * FROM t1 WHERE a=20;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+INSERT INTO v1_definer SELECT * FROM v1_invoker WHERE a=20;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+INSERT INTO v1_definer SELECT * FROM v1_definer WHERE a=20;
+DROP VIEW v1_invoker, v1_definer;
+DROP TABLE t1;
+# Testing SQLCOM_REPLACE_SELECT
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+REPLACE INTO t1 SELECT * FROM t1 WHERE a=20;
+ERROR 42000: CONNECT Unsupported command
+REPLACE INTO t1 SELECT * FROM v1_invoker WHERE a=20;
+ERROR 42000: CONNECT Unsupported command
+REPLACE INTO t1 SELECT * FROM v1_definer WHERE a=20;
+ERROR 42000: CONNECT Unsupported command
+REPLACE INTO v1_invoker SELECT * FROM t1 WHERE a=20;
+ERROR 42000: CONNECT Unsupported command
+REPLACE INTO v1_invoker SELECT * FROM v1_invoker WHERE a=20;
+ERROR 42000: CONNECT Unsupported command
+REPLACE INTO v1_invoker SELECT * FROM v1_definer WHERE a=20;
+ERROR 42000: CONNECT Unsupported command
+REPLACE INTO v1_definer SELECT * FROM t1 WHERE a=20;
+ERROR 42000: CONNECT Unsupported command
+REPLACE INTO v1_definer SELECT * FROM v1_invoker WHERE a=20;
+ERROR 42000: CONNECT Unsupported command
+REPLACE INTO v1_definer SELECT * FROM v1_definer WHERE a=20;
+ERROR 42000: CONNECT Unsupported command
+REPLACE INTO t1 SELECT * FROM t1 WHERE a=20;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+REPLACE INTO t1 SELECT * FROM v1_invoker WHERE a=20;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+REPLACE INTO t1 SELECT * FROM v1_definer WHERE a=20;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+REPLACE INTO v1_invoker SELECT * FROM t1 WHERE a=20;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+REPLACE INTO v1_invoker SELECT * FROM v1_invoker WHERE a=20;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+REPLACE INTO v1_invoker SELECT * FROM v1_definer WHERE a=20;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+REPLACE INTO v1_definer SELECT * FROM t1 WHERE a=20;
+ERROR 42000: CONNECT Unsupported command
+REPLACE INTO v1_definer SELECT * FROM v1_invoker WHERE a=20;
+ERROR 42000: CONNECT Unsupported command
+REPLACE INTO v1_definer SELECT * FROM v1_definer WHERE a=20;
+ERROR 42000: CONNECT Unsupported command
+DROP VIEW v1_invoker, v1_definer;
+DROP TABLE t1;
+# Testing SQLCOM_RENAME_TABLE
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+RENAME TABLE t1 TO t2;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=fix `FILE_NAME`='t1.fix'
+RENAME TABLE t2 TO t1;
+RENAME TABLE t1 TO t2;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DROP TABLE t1;
+# Testing SQLCOM_ALTER_TABLE (for ALTER..RENAME)
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+ALTER TABLE t1 RENAME TO t2;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=fix `FILE_NAME`='t1.fix'
+ALTER TABLE t2 RENAME TO t1;
+ALTER TABLE t1 RENAME TO t2;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DROP TABLE t1;
+# Testing SQLCOM_ALTER_TABLE (changing ENGINE to non-CONNECT)
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+ALTER TABLE t1 ENGINE=MyISAM;
+DROP TABLE t1;
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+ALTER TABLE t1 ENGINE=MyISAM;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DROP TABLE t1;
+# Testing SQLCOM_ALTER_TABLE (changing ENGINE to CONNECT)
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (10);
+SELECT * FROM t1;
+a
+10
+ALTER TABLE t1 ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+DROP TABLE t1;
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (10);
+ALTER TABLE t1 ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DROP TABLE t1;
+# Testing SQLCOM_OPTIMIZE
+CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize Error Access denied for user 'user'@'localhost' (using password: NO)
+test.t1 optimize Error Can't lock file (errno: 122 "Internal (unspecified) error in handler")
+test.t1 optimize error Corrupt
+DROP TABLE t1;
+# Testing SQLCOM_ALTER_TABLE (adding columns)
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+ALTER TABLE t1 ADD b INT;
+Warnings:
+Warning 1105 This is an outward table, table data were not modified.
+ALTER TABLE t1 ADD c INT;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DROP TABLE t1;
+# Testing SQLCOM_ALTER_TABLE (removing columns)
+CREATE TABLE t1 (a INT,b INT,c INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10,10,10);
+ALTER TABLE t1 DROP b;
+Warnings:
+Warning 1105 This is an outward table, table data were not modified.
+ALTER TABLE t1 DROP c;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DROP TABLE t1;
+# Testing SQLCOM_ALTER_TABLE (adding keys)
+CREATE TABLE t1 (a INT NOT NULL,b INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10,10);
+ALTER TABLE t1 ADD KEY(a);
+ALTER TABLE t1 ADD KEY(b);
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DROP TABLE t1;
+# Testing SQLCOM_ALTER_TABLE (removing keys)
+CREATE TABLE t1 (a INT NOT NULL,b INT NOT NULL, KEY a(a), KEY b(b)) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10,10);
+ALTER TABLE t1 DROP KEY a;
+ALTER TABLE t1 DROP KEY b;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DROP TABLE t1;
+# Testing SQLCOM_CREATE_INDEX and SQLCOM_DROP_INDEX
+CREATE TABLE t1 (a INT NOT NULL,b INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10,10);
+CREATE INDEX a ON t1 (a);
+DROP INDEX a ON t1;
+CREATE INDEX a ON t1 (a);
+CREATE INDEX b ON t1 (b);
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DROP INDEX a ON t1;
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+DROP TABLE t1;
+# Testing stored procedures
+CREATE PROCEDURE p_definer() SQL SECURITY DEFINER
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+CREATE PROCEDURE p_invoker() SQL SECURITY INVOKER
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+CREATE DEFINER=user@localhost PROCEDURE p_baddefiner() SQL SECURITY DEFINER
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+CALL p_definer();
+DROP TABLE t1;
+CALL p_invoker();
+DROP TABLE t1;
+CALL p_baddefiner();
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+CALL p_invoker();
+ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+CALL p_definer();
+DROP TABLE t1;
+DROP PROCEDURE p_definer;
+DROP PROCEDURE p_invoker;
+DROP PROCEDURE p_baddefiner;
+DROP USER user@localhost;
diff --git a/storage/connect/mysql-test/connect/r/ini_grant.result b/storage/connect/mysql-test/connect/r/ini_grant.result
index c3acf7c8dfc..68330278183 100644
--- a/storage/connect/mysql-test/connect/r/ini_grant.result
+++ b/storage/connect/mysql-test/connect/r/ini_grant.result
@@ -1,8 +1,10 @@
#
# Checking FILE privileges
#
+set sql_mode="";
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
+set sql_mode=default;
SELECT user();
user()
user@localhost
@@ -59,7 +61,7 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT user();
user()
root@localhost
-CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
SELECT user();
user()
user@localhost
diff --git a/storage/connect/mysql-test/connect/r/mysql_grant.result b/storage/connect/mysql-test/connect/r/mysql_grant.result
index f8d0ee6ad6f..5f630834392 100644
--- a/storage/connect/mysql-test/connect/r/mysql_grant.result
+++ b/storage/connect/mysql-test/connect/r/mysql_grant.result
@@ -1,8 +1,10 @@
#
# Testing FILE privilege
#
+set sql_mode="";
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
+set sql_mode=default;
SELECT user();
user()
user@localhost
@@ -40,7 +42,7 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT user();
user()
root@localhost
-CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
SELECT user();
user()
user@localhost
diff --git a/storage/connect/mysql-test/connect/r/odbc_sqlite3_grant.result b/storage/connect/mysql-test/connect/r/odbc_sqlite3_grant.result
index 364f340eddf..06b4239bd69 100644
--- a/storage/connect/mysql-test/connect/r/odbc_sqlite3_grant.result
+++ b/storage/connect/mysql-test/connect/r/odbc_sqlite3_grant.result
@@ -49,10 +49,11 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
CREATE VIEW v1 AS SELECT * FROM t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
# Testing a VIEW created with FILE privileges but accessed with no FILE
+# using SQL SECIRITY INVOKER
SELECT user();
user()
root@localhost
-CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
SELECT user();
user()
user@localhost
@@ -64,6 +65,19 @@ UPDATE v1 SET a=123;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE FROM v1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+# Testing a VIEW created with FILE privileges but accessed with no FILE
+# using SQL SECIRITY DEFINER
+DROP VIEW v1;
+SELECT user();
+user()
+root@localhost
+CREATE SQL SECURITY DEFINER VIEW v1 AS SELECT * FROM t1;
+SELECT user();
+user()
+user@localhost
+SELECT * FROM v1 WHERE a='test1';
+a
+test1
SELECT user();
user()
root@localhost
diff --git a/storage/connect/mysql-test/connect/r/xml_grant.result b/storage/connect/mysql-test/connect/r/xml_grant.result
index ea38e57af86..9eb818bf32f 100644
--- a/storage/connect/mysql-test/connect/r/xml_grant.result
+++ b/storage/connect/mysql-test/connect/r/xml_grant.result
@@ -3,6 +3,7 @@ Warning 1105 No file name. Table will use t1.xml
#
# Beginning of grant.inc
#
+CREATE USER user@localhost;
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
SELECT user();
@@ -63,7 +64,7 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT user();
user()
root@localhost
-CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
SELECT user();
user()
user@localhost
diff --git a/storage/connect/mysql-test/connect/t/grant.inc b/storage/connect/mysql-test/connect/t/grant.inc
index 7bb214dc9fd..6580c845b56 100644
--- a/storage/connect/mysql-test/connect/t/grant.inc
+++ b/storage/connect/mysql-test/connect/t/grant.inc
@@ -1,6 +1,7 @@
--echo #
--echo # Beginning of grant.inc
--echo #
+CREATE USER user@localhost;
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
--connect(user,localhost,user,,)
@@ -53,7 +54,7 @@ CREATE VIEW v1 AS SELECT * FROM t1;
--echo # Testing a VIEW created with FILE privileges but accessed with no FILE
--connection default
SELECT user();
-CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
--connection user
SELECT user();
--error ER_ACCESS_DENIED_ERROR
diff --git a/storage/connect/mysql-test/connect/t/grant.test b/storage/connect/mysql-test/connect/t/grant.test
index 909bb4117a1..738f156d8a4 100644
--- a/storage/connect/mysql-test/connect/t/grant.test
+++ b/storage/connect/mysql-test/connect/t/grant.test
@@ -1,4 +1,5 @@
-- source include/not_embedded.inc
+set sql_mode="";
let $MYSQLD_DATADIR= `select @@datadir`;
@@ -49,7 +50,7 @@ CREATE VIEW v1 AS SELECT * FROM t1;
--echo # Testing a VIEW created with FILE privileges but accessed with no FILE
--connection default
SELECT user();
-CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
--connection user
SELECT user();
--error ER_ACCESS_DENIED_ERROR
@@ -92,4 +93,4 @@ let $TABLE_OPTIONS=TABLE_TYPE=VEC MAX_ROWS=100;
let $FILE_EXT=VEC;
--source grant.inc
-
+set sql_mode=default;
diff --git a/storage/connect/mysql-test/connect/t/grant2.test b/storage/connect/mysql-test/connect/t/grant2.test
new file mode 100644
index 00000000000..8e7d9453e70
--- /dev/null
+++ b/storage/connect/mysql-test/connect/t/grant2.test
@@ -0,0 +1,869 @@
+-- source include/not_embedded.inc
+
+# Tests that involve SQL SECURITY DEFINER (e.g. in VIEWs)
+# TODO: add test with stored routines eventually.
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--echo #
+--echo # MDEV-7574 Security definer views don't work with CONNECT ODBC tables
+--echo #
+
+CREATE USER user@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user@localhost;
+REVOKE FILE ON *.* FROM user@localhost;
+
+--echo # Testing SQLCOM_SELECT
+--connection default
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+CREATE DEFINER=user@localhost SQL SECURITY DEFINER VIEW v1_baddefiner AS SELECT * FROM t1;
+SELECT * FROM t1;
+SELECT * FROM v1_invoker;
+SELECT * FROM v1_definer;
+--error ER_ACCESS_DENIED_ERROR
+SELECT * FROM v1_baddefiner;
+
+--connect(user,localhost,user,,)
+--error ER_ACCESS_DENIED_ERROR
+SELECT * FROM t1;
+--error ER_ACCESS_DENIED_ERROR
+SELECT * FROM v1_invoker;
+SELECT * FROM v1_definer;
+--connection default
+DROP VIEW v1_invoker, v1_definer, v1_baddefiner;
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+
+--echo # Testing SQLCOM_UPDATE
+--connection default
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+UPDATE t1 SET a=11;
+UPDATE v1_invoker SET a=12;
+UPDATE v1_definer SET a=13;
+--connection user
+--error ER_ACCESS_DENIED_ERROR
+UPDATE t1 SET a=21;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v1_invoker SET a=22;
+UPDATE v1_definer SET a=23;
+--connection default
+DROP VIEW v1_invoker, v1_definer;
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+
+--echo # Testing SQLCOM_INSERT
+--connection default
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+INSERT INTO t1 VALUES (11);
+INSERT INTO v1_invoker VALUES (12);
+INSERT INTO v1_definer VALUES (13);
+--connection user
+--error ER_ACCESS_DENIED_ERROR
+INSERT INTO t1 VALUES (21);
+--error ER_ACCESS_DENIED_ERROR
+INSERT INTO v1_invoker VALUES (22);
+INSERT INTO v1_definer VALUES (23);
+--connection default
+DROP VIEW v1_invoker, v1_definer;
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+
+--echo # Testing SQLCOM_REPLACE
+# REPLACE is not supported by ConnectSE, so we're testing the difference
+# between ER_ACCESS_DENIED_ERROR vs ER_NOT_ALLOWED_COMMAND
+--connection default
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+--error ER_NOT_ALLOWED_COMMAND
+REPLACE INTO t1 VALUES (11);
+--error ER_NOT_ALLOWED_COMMAND
+REPLACE INTO v1_invoker VALUES (12);
+--error ER_NOT_ALLOWED_COMMAND
+REPLACE INTO v1_definer VALUES (13);
+--connection user
+--error ER_ACCESS_DENIED_ERROR
+REPLACE INTO t1 VALUES (21);
+--error ER_ACCESS_DENIED_ERROR
+REPLACE INTO v1_invoker VALUES (22);
+--error ER_NOT_ALLOWED_COMMAND
+REPLACE INTO v1_definer VALUES (23);
+--connection default
+DROP VIEW v1_invoker, v1_definer;
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+
+--echo # Testing SQLCOM_DELETE
+--connection default
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10),(11),(12),(13),(21),(22),(23);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+DELETE FROM t1 WHERE a=11;
+DELETE FROM v1_invoker WHERE a=12;
+DELETE FROM v1_definer WHERE a=13;
+--connection user
+--error ER_ACCESS_DENIED_ERROR
+DELETE FROM t1 WHERE a=21;
+--error ER_ACCESS_DENIED_ERROR
+DELETE FROM v1_invoker WHERE a=22;
+DELETE FROM v1_definer WHERE a=23;
+--connection default
+DROP VIEW v1_invoker, v1_definer;
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+
+--echo # Testing SQLCOM_LOAD
+--connection default
+CREATE TABLE t1 (a VARCHAR(128)) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+--replace_result $MTR_SUITE_DIR MTR_SUITE_DIR
+--eval LOAD DATA LOCAL INFILE '$MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE t1
+--replace_result $MTR_SUITE_DIR MTR_SUITE_DIR
+--eval LOAD DATA LOCAL INFILE '$MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_invoker
+--replace_result $MTR_SUITE_DIR MTR_SUITE_DIR
+--eval LOAD DATA LOCAL INFILE '$MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_definer
+--connection user
+--replace_result $MTR_SUITE_DIR MTR_SUITE_DIR
+--error ER_ACCESS_DENIED_ERROR
+--eval LOAD DATA LOCAL INFILE '$MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE t1
+--replace_result $MTR_SUITE_DIR MTR_SUITE_DIR
+--error ER_ACCESS_DENIED_ERROR
+--eval LOAD DATA LOCAL INFILE '$MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_invoker
+--replace_result $MTR_SUITE_DIR MTR_SUITE_DIR
+--eval LOAD DATA LOCAL INFILE '$MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_definer
+--connection default
+DROP VIEW v1_invoker, v1_definer;
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+
+--echo # Testing SQLCOM_TRUNCATE
+--connection default
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+TRUNCATE TABLE t1;
+INSERT INTO t1 VALUES (11);
+--connection user
+--error ER_ACCESS_DENIED_ERROR
+TRUNCATE TABLE t1;
+--connection default
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+
+# TODO: Perhaps FILE_ACL is not needed for DROP TABLE. Discuss with Olivier.
+--echo # Testing SQLCOM_DROP_TABLE
+--connection default
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+--connection user
+--error ER_ACCESS_DENIED_ERROR
+DROP TABLE t1;
+--connection default
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+
+--echo # Testing SQLCOM_DROP_VIEW
+--echo # DROP VIEW does not need FILE_ACL.
+--connection default
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10),(11),(12),(13),(21),(22),(23);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+DROP VIEW v1_invoker, v1_definer;
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+--connection user
+DROP VIEW v1_invoker;
+DROP VIEW v1_definer;
+--connection default
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+
+--echo # Testing SQLCOM_CREATE_TABLE
+--connection user
+--error ER_ACCESS_DENIED_ERROR
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+--connection default
+
+--echo # Testing SQLCOM_LOCK_TABLES
+--connection default
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+LOCK TABLE t1 READ;
+UNLOCK TABLES;
+LOCK TABLE t1 WRITE;
+UNLOCK TABLES;
+LOCK TABLE v1_invoker READ;
+UNLOCK TABLES;
+LOCK TABLE v1_invoker WRITE;
+UNLOCK TABLES;
+LOCK TABLE v1_definer READ;
+UNLOCK TABLES;
+LOCK TABLE v1_definer WRITE;
+UNLOCK TABLES;
+--connection user
+--error ER_ACCESS_DENIED_ERROR
+LOCK TABLE t1 READ;
+--error ER_ACCESS_DENIED_ERROR
+LOCK TABLE t1 WRITE;
+--error ER_ACCESS_DENIED_ERROR
+LOCK TABLE v1_invoker READ;
+--error ER_ACCESS_DENIED_ERROR
+LOCK TABLE v1_invoker WRITE;
+LOCK TABLE v1_definer READ;
+UNLOCK TABLES;
+LOCK TABLE v1_definer WRITE;
+UNLOCK TABLES;
+--connection default
+DROP VIEW v1_invoker, v1_definer;
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+
+--echo # Testing SQLCOM_UPDATE_MULTI
+--connection default
+# t1 and t2 require FILE_ACL, t3 does not
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+CREATE TABLE t2 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t2.fix';
+CREATE TABLE t3 (a INT);
+INSERT INTO t1 VALUES (10);
+INSERT INTO t2 VALUES (20);
+INSERT INTO t3 VALUES (30);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+CREATE SQL SECURITY INVOKER VIEW v2_invoker AS SELECT * FROM t2;
+CREATE SQL SECURITY DEFINER VIEW v2_definer AS SELECT * FROM t2;
+UPDATE t1 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t1 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t1 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t1 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t1 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t1 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t1 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t2 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t2 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t2 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t2 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t2 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t2 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t2 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t3 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t3 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t3 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t3 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t3 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t3 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE t3 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_invoker a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_invoker a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_invoker a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_invoker a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_invoker a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_invoker a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_invoker a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_definer a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_definer a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_definer a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_definer a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_definer a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_definer a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_invoker a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_invoker a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_invoker a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_invoker a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_invoker a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_invoker a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_invoker a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_definer a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_definer a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_definer a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_definer a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_definer a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_definer a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+
+--connection user
+
+# All queries with t1 should fail
+--error ER_ACCESS_DENIED_ERROR
+UPDATE t1 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE t1 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE t1 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE t1 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE t1 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE t1 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE t1 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+
+# All queries with t2 should fail
+--error ER_ACCESS_DENIED_ERROR
+UPDATE t2 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE t2 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE t2 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE t2 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE t2 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE t2 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE t2 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+
+# t3 does not need FILE_ALC
+--error ER_ACCESS_DENIED_ERROR
+UPDATE t3 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE t3 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+# This is OK:
+UPDATE t3 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE t3 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+# This is OK:
+UPDATE t3 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE t3 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+# This is OK:
+UPDATE t3 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+
+# All queries with v1_invoker should fail
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v1_invoker a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v1_invoker a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v1_invoker a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v1_invoker a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v1_invoker a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v1_invoker a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v1_invoker a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+
+# v1_definer does not need FILE_ACL from the invoker
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v1_definer a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v1_definer a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_definer a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v1_definer a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_definer a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v1_definer a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v1_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+
+# All queries with v2_invoker should fail
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v2_invoker a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v2_invoker a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v2_invoker a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v2_invoker a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v2_invoker a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v2_invoker a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v2_invoker a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+
+# v2_definer does not need FILE_ACL from the invoker
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v2_definer a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v2_definer a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_definer a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v2_definer a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_definer a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v2_definer a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
+UPDATE v2_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
+
+--connection default
+DROP VIEW v1_invoker, v1_definer, v2_invoker, v2_definer;
+DROP TABLE t1, t2, t3;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+--remove_file $MYSQLD_DATADIR/test/t2.fix
+
+--echo # Testing SQLCOM_DELETE_MULTI
+--connection default
+# t1 and t2 require FILE_ACL, t3 does not
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+CREATE TABLE t2 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t2.fix';
+CREATE TABLE t3 (a INT);
+INSERT INTO t1 VALUES (10);
+INSERT INTO t2 VALUES (20);
+INSERT INTO t3 VALUES (30);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+CREATE SQL SECURITY INVOKER VIEW v2_invoker AS SELECT * FROM t2;
+CREATE SQL SECURITY DEFINER VIEW v2_definer AS SELECT * FROM t2;
+DELETE a1 FROM t1 a1,t1 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t1 a1,t2 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t1 a1,t3 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t1 a1,v1_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t1 a1,v1_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t1 a1,v2_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t1 a1,v2_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t2 a1,t1 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t2 a1,t2 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t2 a1,t3 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t2 a1,v1_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t2 a1,v1_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t2 a1,v2_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t2 a1,v2_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t3 a1,t1 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t3 a1,t2 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t3 a1,t3 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t3 a1,v1_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t3 a1,v1_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t3 a1,v2_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM t3 a1,v2_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_invoker a1,t1 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_invoker a1,t2 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_invoker a1,t3 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_invoker a1,v1_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_invoker a1,v1_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_invoker a1,v2_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_invoker a1,v2_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_definer a1,t1 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_definer a1,t2 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_definer a1,t3 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_definer a1,v1_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_definer a1,v1_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_definer a1,v2_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_definer a1,v2_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_invoker a1,t1 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_invoker a1,t2 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_invoker a1,t3 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_invoker a1,v1_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_invoker a1,v1_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_invoker a1,v2_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_invoker a1,v2_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_definer a1,t1 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_definer a1,t2 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_definer a1,t3 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_definer a1,v1_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_definer a1,v1_definer a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_definer a1,v2_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_definer a1,v2_definer a2 WHERE a1.a=a2.a;
+
+--connection user
+
+# All queries with t1 should fail
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM t1 a1,t1 a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM t1 a1,t2 a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM t1 a1,t3 a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM t1 a1,v1_invoker a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM t1 a1,v1_definer a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM t1 a1,v2_invoker a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM t1 a1,v2_definer a2 WHERE a1.a=a2.a;
+
+# All queries with t2 should fail
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM t2 a1,t1 a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM t2 a1,t2 a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM t2 a1,t3 a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM t2 a1,v1_invoker a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM t2 a1,v1_definer a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM t2 a1,v2_invoker a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM t2 a1,v2_definer a2 WHERE a1.a=a2.a;
+
+# t3 does not need FILE_ALC
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM t3 a1,t1 a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM t3 a1,t2 a2 WHERE a1.a=a2.a;
+# This is OK:
+DELETE a1 FROM t3 a1,t3 a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM t3 a1,v1_invoker a2 WHERE a1.a=a2.a;
+# This is OK:
+DELETE a1 FROM t3 a1,v1_definer a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM t3 a1,v2_invoker a2 WHERE a1.a=a2.a;
+# This is OK:
+DELETE a1 FROM t3 a1,v2_definer a2 WHERE a1.a=a2.a;
+
+# All queries with v1_invoker should fail
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM v1_invoker a1,t1 a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM v1_invoker a1,t2 a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM v1_invoker a1,t3 a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM v1_invoker a1,v1_invoker a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM v1_invoker a1,v1_definer a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM v1_invoker a1,v2_invoker a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM v1_invoker a1,v2_definer a2 WHERE a1.a=a2.a;
+
+# v1_definer does not need FILE_ACL from the invoker
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM v1_definer a1,t1 a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM v1_definer a1,t2 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_definer a1,t3 a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM v1_definer a1,v1_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_definer a1,v1_definer a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM v1_definer a1,v2_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v1_definer a1,v2_definer a2 WHERE a1.a=a2.a;
+
+# All queries with v2_invoker should fail
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM v2_invoker a1,t1 a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM v2_invoker a1,t2 a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM v2_invoker a1,t3 a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM v2_invoker a1,v1_invoker a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM v2_invoker a1,v1_definer a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM v2_invoker a1,v2_invoker a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM v2_invoker a1,v2_definer a2 WHERE a1.a=a2.a;
+
+# v2_definer does not need FILE_ACL from the invoker
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM v2_definer a1,t1 a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM v2_definer a1,t2 a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_definer a1,t3 a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM v2_definer a1,v1_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_definer a1,v1_definer a2 WHERE a1.a=a2.a;
+--error ER_ACCESS_DENIED_ERROR
+DELETE a1 FROM v2_definer a1,v2_invoker a2 WHERE a1.a=a2.a;
+DELETE a1 FROM v2_definer a1,v2_definer a2 WHERE a1.a=a2.a;
+
+--connection default
+DROP VIEW v1_invoker, v1_definer, v2_invoker, v2_definer;
+DROP TABLE t1, t2, t3;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+--remove_file $MYSQLD_DATADIR/test/t2.fix
+
+--echo # Testing SQLCOM_CREATE_VIEW
+--connection default
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+CREATE VIEW v2 AS SELECT * FROM v1_invoker;
+DROP VIEW v2;
+CREATE VIEW v2 AS SELECT * FROM v1_definer;
+DROP VIEW v2;
+--connection user
+--error ER_ACCESS_DENIED_ERROR
+CREATE VIEW v2 AS SELECT * FROM t1;
+--error ER_ACCESS_DENIED_ERROR
+CREATE VIEW v2 AS SELECT * FROM v1_invoker;
+CREATE VIEW v2 AS SELECT * FROM v1_definer;
+DROP VIEW v2;
+--connection default
+DROP VIEW v1_invoker, v1_definer;
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+
+--echo # Testing SQLCOM_INSERT_SELECT
+--connection default
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1 WHERE a=20;
+INSERT INTO t1 SELECT * FROM v1_invoker WHERE a=20;
+INSERT INTO t1 SELECT * FROM v1_definer WHERE a=20;
+INSERT INTO v1_invoker SELECT * FROM t1 WHERE a=20;
+INSERT INTO v1_invoker SELECT * FROM v1_invoker WHERE a=20;
+INSERT INTO v1_invoker SELECT * FROM v1_definer WHERE a=20;
+INSERT INTO v1_definer SELECT * FROM t1 WHERE a=20;
+INSERT INTO v1_definer SELECT * FROM v1_invoker WHERE a=20;
+INSERT INTO v1_definer SELECT * FROM v1_definer WHERE a=20;
+--connection user
+--error ER_ACCESS_DENIED_ERROR
+INSERT INTO t1 SELECT * FROM t1 WHERE a=20;
+--error ER_ACCESS_DENIED_ERROR
+INSERT INTO t1 SELECT * FROM v1_invoker WHERE a=20;
+--error ER_ACCESS_DENIED_ERROR
+INSERT INTO t1 SELECT * FROM v1_definer WHERE a=20;
+--error ER_ACCESS_DENIED_ERROR
+INSERT INTO v1_invoker SELECT * FROM t1 WHERE a=20;
+--error ER_ACCESS_DENIED_ERROR
+INSERT INTO v1_invoker SELECT * FROM v1_invoker WHERE a=20;
+--error ER_ACCESS_DENIED_ERROR
+INSERT INTO v1_invoker SELECT * FROM v1_definer WHERE a=20;
+--error ER_ACCESS_DENIED_ERROR
+INSERT INTO v1_definer SELECT * FROM t1 WHERE a=20;
+--error ER_ACCESS_DENIED_ERROR
+INSERT INTO v1_definer SELECT * FROM v1_invoker WHERE a=20;
+# This is OK:
+INSERT INTO v1_definer SELECT * FROM v1_definer WHERE a=20;
+--connection default
+DROP VIEW v1_invoker, v1_definer;
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+
+--echo # Testing SQLCOM_REPLACE_SELECT
+# REPLACE is not supported by CONNECT
+# so we're testing ER_NOT_ALLOWED_COMMAND vs ER_ACCESS_DENIED_ERROR here
+--connection default
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
+--error ER_NOT_ALLOWED_COMMAND
+REPLACE INTO t1 SELECT * FROM t1 WHERE a=20;
+--error ER_NOT_ALLOWED_COMMAND
+REPLACE INTO t1 SELECT * FROM v1_invoker WHERE a=20;
+--error ER_NOT_ALLOWED_COMMAND
+REPLACE INTO t1 SELECT * FROM v1_definer WHERE a=20;
+--error ER_NOT_ALLOWED_COMMAND
+REPLACE INTO v1_invoker SELECT * FROM t1 WHERE a=20;
+--error ER_NOT_ALLOWED_COMMAND
+REPLACE INTO v1_invoker SELECT * FROM v1_invoker WHERE a=20;
+--error ER_NOT_ALLOWED_COMMAND
+REPLACE INTO v1_invoker SELECT * FROM v1_definer WHERE a=20;
+--error ER_NOT_ALLOWED_COMMAND
+REPLACE INTO v1_definer SELECT * FROM t1 WHERE a=20;
+--error ER_NOT_ALLOWED_COMMAND
+REPLACE INTO v1_definer SELECT * FROM v1_invoker WHERE a=20;
+--error ER_NOT_ALLOWED_COMMAND
+REPLACE INTO v1_definer SELECT * FROM v1_definer WHERE a=20;
+
+--connection user
+--error ER_ACCESS_DENIED_ERROR
+REPLACE INTO t1 SELECT * FROM t1 WHERE a=20;
+--error ER_ACCESS_DENIED_ERROR
+REPLACE INTO t1 SELECT * FROM v1_invoker WHERE a=20;
+--error ER_ACCESS_DENIED_ERROR
+REPLACE INTO t1 SELECT * FROM v1_definer WHERE a=20;
+--error ER_ACCESS_DENIED_ERROR
+REPLACE INTO v1_invoker SELECT * FROM t1 WHERE a=20;
+--error ER_ACCESS_DENIED_ERROR
+REPLACE INTO v1_invoker SELECT * FROM v1_invoker WHERE a=20;
+--error ER_ACCESS_DENIED_ERROR
+REPLACE INTO v1_invoker SELECT * FROM v1_definer WHERE a=20;
+--error ER_NOT_ALLOWED_COMMAND
+REPLACE INTO v1_definer SELECT * FROM t1 WHERE a=20;
+--error ER_NOT_ALLOWED_COMMAND
+REPLACE INTO v1_definer SELECT * FROM v1_invoker WHERE a=20;
+--error ER_NOT_ALLOWED_COMMAND
+REPLACE INTO v1_definer SELECT * FROM v1_definer WHERE a=20;
+--connection default
+DROP VIEW v1_invoker, v1_definer;
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+
+--echo # Testing SQLCOM_RENAME_TABLE
+--connection default
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+RENAME TABLE t1 TO t2;
+SHOW CREATE TABLE t2;
+RENAME TABLE t2 TO t1;
+--connection user
+# TODO: Perhaps FILE_ACL is needed for RENAME. Discuss with Oliver.
+--error ER_ACCESS_DENIED_ERROR
+RENAME TABLE t1 TO t2;
+--connection default
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+
+--echo # Testing SQLCOM_ALTER_TABLE (for ALTER..RENAME)
+--connection default
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+ALTER TABLE t1 RENAME TO t2;
+SHOW CREATE TABLE t2;
+ALTER TABLE t2 RENAME TO t1;
+--connection user
+# TODO: Perhaps FILE_ACL is not needed for ALTER..RENAME. Discuss with Olivier.
+--error ER_ACCESS_DENIED_ERROR
+ALTER TABLE t1 RENAME TO t2;
+--connection default
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+
+--echo # Testing SQLCOM_ALTER_TABLE (changing ENGINE to non-CONNECT)
+--connection default
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+ALTER TABLE t1 ENGINE=MyISAM;
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+--connection user
+--error ER_ACCESS_DENIED_ERROR
+ALTER TABLE t1 ENGINE=MyISAM;
+--connection default
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+
+--echo # Testing SQLCOM_ALTER_TABLE (changing ENGINE to CONNECT)
+--connection default
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (10);
+SELECT * FROM t1;
+# This should succeed, as 't1.fix' does not exists.
+ALTER TABLE t1 ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+DROP TABLE t1;
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (10);
+--connection user
+--error ER_ACCESS_DENIED_ERROR
+ALTER TABLE t1 ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+--connection default
+DROP TABLE t1;
+
+--echo # Testing SQLCOM_OPTIMIZE
+--connection default
+CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+OPTIMIZE TABLE t1;
+--connection user
+# This command succeeds, but reports "Access denied" in the "Msg_text" column.
+OPTIMIZE TABLE t1;
+--connection default
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+
+--echo # Testing SQLCOM_ALTER_TABLE (adding columns)
+--connection default
+CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10);
+ALTER TABLE t1 ADD b INT;
+--connection user
+--error ER_ACCESS_DENIED_ERROR
+ALTER TABLE t1 ADD c INT;
+--connection default
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+
+--echo # Testing SQLCOM_ALTER_TABLE (removing columns)
+--connection default
+CREATE TABLE t1 (a INT,b INT,c INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10,10,10);
+ALTER TABLE t1 DROP b;
+--connection user
+--error ER_ACCESS_DENIED_ERROR
+ALTER TABLE t1 DROP c;
+--connection default
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+
+--echo # Testing SQLCOM_ALTER_TABLE (adding keys)
+--connection default
+CREATE TABLE t1 (a INT NOT NULL,b INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10,10);
+ALTER TABLE t1 ADD KEY(a);
+--connection user
+--error ER_ACCESS_DENIED_ERROR
+ALTER TABLE t1 ADD KEY(b);
+--connection default
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+--remove_file $MYSQLD_DATADIR/test/t1.fnx
+
+--echo # Testing SQLCOM_ALTER_TABLE (removing keys)
+--connection default
+CREATE TABLE t1 (a INT NOT NULL,b INT NOT NULL, KEY a(a), KEY b(b)) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10,10);
+ALTER TABLE t1 DROP KEY a;
+--connection user
+--error ER_ACCESS_DENIED_ERROR
+ALTER TABLE t1 DROP KEY b;
+--connection default
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+--remove_file $MYSQLD_DATADIR/test/t1.fnx
+
+--echo # Testing SQLCOM_CREATE_INDEX and SQLCOM_DROP_INDEX
+--connection default
+CREATE TABLE t1 (a INT NOT NULL,b INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+INSERT INTO t1 VALUES (10,10);
+CREATE INDEX a ON t1 (a);
+DROP INDEX a ON t1;
+CREATE INDEX a ON t1 (a);
+--connection user
+--error ER_ACCESS_DENIED_ERROR
+CREATE INDEX b ON t1 (b);
+--error ER_ACCESS_DENIED_ERROR
+DROP INDEX a ON t1;
+--connection default
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.fix
+--remove_file $MYSQLD_DATADIR/test/t1.fnx
+
+--echo # Testing stored procedures
+CREATE PROCEDURE p_definer() SQL SECURITY DEFINER
+ CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+CREATE PROCEDURE p_invoker() SQL SECURITY INVOKER
+ CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+CREATE DEFINER=user@localhost PROCEDURE p_baddefiner() SQL SECURITY DEFINER
+ CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
+
+CALL p_definer();
+DROP TABLE t1;
+CALL p_invoker();
+DROP TABLE t1;
+--error ER_ACCESS_DENIED_ERROR
+CALL p_baddefiner();
+
+--connection user
+--error ER_ACCESS_DENIED_ERROR
+CALL p_invoker();
+CALL p_definer();
+
+--connection default
+DROP TABLE t1;
+DROP PROCEDURE p_definer;
+DROP PROCEDURE p_invoker;
+DROP PROCEDURE p_baddefiner;
+
+DROP USER user@localhost;
diff --git a/storage/connect/mysql-test/connect/t/ini_grant.test b/storage/connect/mysql-test/connect/t/ini_grant.test
index 30678645692..b0ddcb57979 100644
--- a/storage/connect/mysql-test/connect/t/ini_grant.test
+++ b/storage/connect/mysql-test/connect/t/ini_grant.test
@@ -5,8 +5,10 @@ let $MYSQLD_DATADIR= `select @@datadir`;
--echo #
--echo # Checking FILE privileges
--echo #
+set sql_mode="";
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
+set sql_mode=default;
--connect(user,localhost,user,,)
--connection user
SELECT user();
@@ -54,7 +56,7 @@ CREATE VIEW v1 AS SELECT * FROM t1;
--echo # Testing a VIEW created with FILE privileges but accessed with no FILE
--connection default
SELECT user();
-CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
--connection user
SELECT user();
--error ER_ACCESS_DENIED_ERROR
diff --git a/storage/connect/mysql-test/connect/t/mysql_grant.test b/storage/connect/mysql-test/connect/t/mysql_grant.test
index 7c75103ed3b..7d3d05cb8fd 100644
--- a/storage/connect/mysql-test/connect/t/mysql_grant.test
+++ b/storage/connect/mysql-test/connect/t/mysql_grant.test
@@ -19,8 +19,10 @@ DROP TABLE t1;
--echo #
--echo # Testing FILE privilege
--echo #
+set sql_mode="";
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
+set sql_mode=default;
--connect(user,localhost,user,,)
--connection user
SELECT user();
@@ -54,7 +56,7 @@ CREATE VIEW v1 AS SELECT * FROM t1;
--echo # Testing a VIEW created with FILE privileges but accessed with no FILE
--connection default
SELECT user();
-CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
--connection user
SELECT user();
--error ER_ACCESS_DENIED_ERROR
diff --git a/storage/connect/mysql-test/connect/t/odbc_postgresql.test b/storage/connect/mysql-test/connect/t/odbc_postgresql.test
index f634b34323f..7fc16130713 100644
--- a/storage/connect/mysql-test/connect/t/odbc_postgresql.test
+++ b/storage/connect/mysql-test/connect/t/odbc_postgresql.test
@@ -27,6 +27,15 @@
#Servername=localhost
#Port=5432
#
+# 5. Allow user "mtr" to connect to the database "mtr"
+# Add this line into the begginning of pg_hba.conf
+# (usually /var/lib/pgsql/data/pg_hba.conf on Linux):
+#host mtr mtr 127.0.0.1/32 password
+#
+# 6. Restart the server:
+# sudo service postgresql restart
+#
+#
SET NAMES utf8;
diff --git a/storage/connect/mysql-test/connect/t/odbc_sqlite3_grant.test b/storage/connect/mysql-test/connect/t/odbc_sqlite3_grant.test
index 7664a4473ba..887385af2dc 100644
--- a/storage/connect/mysql-test/connect/t/odbc_sqlite3_grant.test
+++ b/storage/connect/mysql-test/connect/t/odbc_sqlite3_grant.test
@@ -56,9 +56,10 @@ ALTER TABLE t1 READONLY=1;
CREATE VIEW v1 AS SELECT * FROM t1;
--echo # Testing a VIEW created with FILE privileges but accessed with no FILE
+--echo # using SQL SECIRITY INVOKER
--connection default
SELECT user();
-CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
--connection user
SELECT user();
--error ER_ACCESS_DENIED_ERROR
@@ -70,6 +71,17 @@ UPDATE v1 SET a=123;
--error ER_ACCESS_DENIED_ERROR
DELETE FROM v1;
+--echo # Testing a VIEW created with FILE privileges but accessed with no FILE
+--echo # using SQL SECIRITY DEFINER
+--connection default
+DROP VIEW v1;
+SELECT user();
+CREATE SQL SECURITY DEFINER VIEW v1 AS SELECT * FROM t1;
+--connection user
+SELECT user();
+SELECT * FROM v1 WHERE a='test1';
+
+
--disconnect user
--connection default
SELECT user();
diff --git a/storage/connect/reldef.cpp b/storage/connect/reldef.cpp
index 60d515a61ca..8f9328c0b2f 100644
--- a/storage/connect/reldef.cpp
+++ b/storage/connect/reldef.cpp
@@ -47,6 +47,7 @@
#include "valblk.h"
#include "tabmul.h"
#include "ha_connect.h"
+#include "mycat.h"
#if !defined(__WIN__)
extern handlerton *connect_hton;
diff --git a/storage/connect/xobject.cpp b/storage/connect/xobject.cpp
index c2d77e206cb..a0b7849543d 100644
--- a/storage/connect/xobject.cpp
+++ b/storage/connect/xobject.cpp
@@ -11,6 +11,7 @@
/* Include mariaDB header file. */
/***********************************************************************/
#include "my_global.h"
+#include "m_string.h"
/***********************************************************************/
/* Include required application header files */
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index 92ac20a8f82..21bcae8ad94 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -1741,7 +1741,7 @@ int ha_tina::reset(void)
}
-bool ha_tina::check_if_incompatible_data(HA_CREATE_INFO *info,
+bool ha_tina::check_if_incompatible_data(HA_CREATE_INFO *info_arg,
uint table_changes)
{
return COMPATIBLE_DATA_YES;
diff --git a/storage/federatedx/README.windows b/storage/federatedx/README.windows
index 3f1f2a3c79a..74de15c6521 100644
--- a/storage/federatedx/README.windows
+++ b/storage/federatedx/README.windows
@@ -1,23 +1,23 @@
-The following files are changed in order to build a new engine on Windows:
-
-- Update win\configure.js with
-case "WITH_FEDERATEDX_STORAGE_ENGINE":
-to make sure it will pass WITH_FEDERATEDX_STORAGE_ENGINE in.
-
-- Update CMakeFiles.txt under mysql root:
- IF(WITH_FEDERATEDX_STORAGE_ENGINE)
- ADD_DEFINITIONS(-D WITH_FEDERATEDX_STORAGE_ENGINE)
- SET (mysql_plugin_defs
- "${mysql_plugin_defs},builtin_skeleton_plugin")
- ENDIF(WITH_FEDERATEDX_STORAGE_ENGINE)
-
- and,
-
- IF(WITH_FEDERATEDX_STORAGE_ENGINE)
- ADD_SUBDIRECTORY(storage/skeleton/src)
- ENDIF(WITH_FEDERATEDX_STORAGE_ENGINE)
-
- - Update CMakeFiles.txt under sql:
- IF(WITH_FEDERATEDX_STORAGE_ENGINE)
- TARGET_LINK_LIBRARIES(mysqld skeleton)
- ENDIF(WITH_FEDERATEDX_STORAGE_ENGINE)
+The following files are changed in order to build a new engine on Windows:
+
+- Update win\configure.js with
+case "WITH_FEDERATEDX_STORAGE_ENGINE":
+to make sure it will pass WITH_FEDERATEDX_STORAGE_ENGINE in.
+
+- Update CMakeFiles.txt under mysql root:
+ IF(WITH_FEDERATEDX_STORAGE_ENGINE)
+ ADD_DEFINITIONS(-D WITH_FEDERATEDX_STORAGE_ENGINE)
+ SET (mysql_plugin_defs
+ "${mysql_plugin_defs},builtin_skeleton_plugin")
+ ENDIF(WITH_FEDERATEDX_STORAGE_ENGINE)
+
+ and,
+
+ IF(WITH_FEDERATEDX_STORAGE_ENGINE)
+ ADD_SUBDIRECTORY(storage/skeleton/src)
+ ENDIF(WITH_FEDERATEDX_STORAGE_ENGINE)
+
+ - Update CMakeFiles.txt under sql:
+ IF(WITH_FEDERATEDX_STORAGE_ENGINE)
+ TARGET_LINK_LIBRARIES(mysqld skeleton)
+ ENDIF(WITH_FEDERATEDX_STORAGE_ENGINE)
diff --git a/storage/federatedx/federatedx_io_mysql.cc b/storage/federatedx/federatedx_io_mysql.cc
index 1ff6abc4c77..6f551b41311 100644
--- a/storage/federatedx/federatedx_io_mysql.cc
+++ b/storage/federatedx/federatedx_io_mysql.cc
@@ -30,6 +30,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define MYSQL_SERVER 1
#include <my_global.h>
#include "sql_priv.h"
+#include <mysqld_error.h>
#include "ha_federatedx.h"
diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc
index 5c856ba3ac3..28b9b33b1e5 100644
--- a/storage/federatedx/ha_federatedx.cc
+++ b/storage/federatedx/ha_federatedx.cc
@@ -3085,7 +3085,7 @@ error:
else if (remote_error_number != -1 /* error already reported */)
{
error_code= remote_error_number;
- my_error(error_code, MYF(0), ER(error_code));
+ my_error(error_code, MYF(0), ER_THD(thd, error_code));
}
fail:
tmp_txn->release(&tmp_io);
diff --git a/storage/innobase/api/api0api.cc b/storage/innobase/api/api0api.cc
index 8769fc47166..739ea9f7572 100644
--- a/storage/innobase/api/api0api.cc
+++ b/storage/innobase/api/api0api.cc
@@ -245,7 +245,7 @@ ib_open_table_by_id(
dict_mutex_enter_for_mysql();
}
- table = dict_table_open_on_id(table_id, FALSE, DICT_TABLE_OP_NORMAL);
+ table = dict_table_open_on_id(table_id, TRUE, DICT_TABLE_OP_NORMAL);
if (table != NULL && table->ibd_file_missing) {
table = NULL;
@@ -595,6 +595,21 @@ ib_trx_begin(
return(static_cast<ib_trx_t>(trx));
}
+
+/*****************************************************************//**
+Check if transaction is read_only
+@return transaction read_only status */
+UNIV_INTERN
+ib_u32_t
+ib_trx_read_only(
+/*=============*/
+ ib_trx_t ib_trx) /*!< in: trx handle */
+{
+ trx_t* trx = (trx_t*) ib_trx;
+
+ return(trx->read_only);
+}
+
/*****************************************************************//**
Get the transaction's state.
@return transaction state */
@@ -2101,6 +2116,10 @@ ib_cursor_moveto(
n_fields = dict_index_get_n_ordering_defined_by_user(prebuilt->index);
+ if (n_fields > dtuple_get_n_fields(tuple->ptr)) {
+ n_fields = dtuple_get_n_fields(tuple->ptr);
+ }
+
dtuple_set_n_fields(search_tuple, n_fields);
dtuple_set_n_fields_cmp(search_tuple, n_fields);
@@ -3738,14 +3757,14 @@ ib_table_truncate(
if (trunc_err == DB_SUCCESS) {
ut_a(ib_trx_state(ib_trx) == static_cast<ib_trx_state_t>(
TRX_STATE_NOT_STARTED));
-
- err = ib_trx_release(ib_trx);
- ut_a(err == DB_SUCCESS);
} else {
err = ib_trx_rollback(ib_trx);
ut_a(err == DB_SUCCESS);
}
+ err = ib_trx_release(ib_trx);
+ ut_a(err == DB_SUCCESS);
+
/* Set the memcached_sync_count back. */
if (table != NULL && memcached_sync != 0) {
dict_mutex_enter_for_mysql();
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index 92539ce1524..c5d5bf0b7aa 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -2,6 +2,7 @@
Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
+Copyright (c) 2014, 2015, MariaDB Corporation
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -733,7 +734,21 @@ btr_root_block_get(
zip_size = dict_table_zip_size(index->table);
root_page_no = dict_index_get_page(index);
- block = btr_block_get(space, zip_size, root_page_no, mode, index, mtr);
+ block = btr_block_get(space, zip_size, root_page_no, mode, (dict_index_t*)index, mtr);
+
+ if (!block) {
+ index->table->is_encrypted = TRUE;
+ index->table->corrupted = FALSE;
+
+ ib_push_warning(index->table->thd, DB_DECRYPTION_FAILED,
+ "Table %s in tablespace %lu is encrypted but encryption service or"
+ " used key_id is not available. "
+ " Can't continue reading table.",
+ index->table->name, space);
+
+ return NULL;
+ }
+
btr_assert_not_corrupted(block, index);
#ifdef UNIV_BTR_DEBUG
if (!dict_index_is_ibuf(index)) {
@@ -759,8 +774,10 @@ btr_root_get(
const dict_index_t* index, /*!< in: index tree */
mtr_t* mtr) /*!< in: mtr */
{
- return(buf_block_get_frame(btr_root_block_get(index, RW_X_LATCH,
- mtr)));
+ buf_block_t* root = btr_root_block_get(index, RW_X_LATCH,
+ mtr);
+
+ return(root ? buf_block_get_frame(root) : NULL);
}
/**************************************************************//**
@@ -775,7 +792,7 @@ btr_height_get(
dict_index_t* index, /*!< in: index tree */
mtr_t* mtr) /*!< in/out: mini-transaction */
{
- ulint height;
+ ulint height=0;
buf_block_t* root_block;
ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
@@ -786,13 +803,15 @@ btr_height_get(
/* S latches the page */
root_block = btr_root_block_get(index, RW_S_LATCH, mtr);
- height = btr_page_get_level(buf_block_get_frame(root_block), mtr);
+ if (root_block) {
+ height = btr_page_get_level(buf_block_get_frame(root_block), mtr);
- /* Release the S latch on the root page. */
- mtr_memo_release(mtr, root_block, MTR_MEMO_PAGE_S_FIX);
+ /* Release the S latch on the root page. */
+ mtr_memo_release(mtr, root_block, MTR_MEMO_PAGE_S_FIX);
#ifdef UNIV_SYNC_DEBUG
- sync_thread_reset_level(&root_block->lock);
+ sync_thread_reset_level(&root_block->lock);
#endif /* UNIV_SYNC_DEBUG */
+ }
return(height);
}
@@ -857,7 +876,7 @@ btr_root_adjust_on_import(
return(DB_CORRUPTION););
block = btr_block_get(
- space_id, zip_size, root_page_no, RW_X_LATCH, index, &mtr);
+ space_id, zip_size, root_page_no, RW_X_LATCH, (dict_index_t*)index, &mtr);
page = buf_block_get_frame(block);
page_zip = buf_block_get_page_zip(block);
@@ -1240,7 +1259,7 @@ btr_get_size_and_reserved(
{
fseg_header_t* seg_header;
page_t* root;
- ulint n;
+ ulint n=ULINT_UNDEFINED;
ulint dummy;
ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
@@ -1254,17 +1273,21 @@ btr_get_size_and_reserved(
}
root = btr_root_get(index, mtr);
+ *used = 0;
- seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_LEAF;
+ if (root) {
- n = fseg_n_reserved_pages(seg_header, used, mtr);
+ seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_LEAF;
- if (flag == BTR_TOTAL_SIZE) {
- seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_TOP;
+ n = fseg_n_reserved_pages(seg_header, used, mtr);
- n += fseg_n_reserved_pages(seg_header, &dummy, mtr);
- *used += dummy;
+ if (flag == BTR_TOTAL_SIZE) {
+ seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_TOP;
+ n += fseg_n_reserved_pages(seg_header, &dummy, mtr);
+ *used += dummy;
+
+ }
}
return(n);
@@ -3477,9 +3500,7 @@ btr_level_list_remove_func(
ulint zip_size,/*!< in: compressed page size in bytes
or 0 for uncompressed pages */
page_t* page, /*!< in/out: page to remove */
-#ifdef UNIV_SYNC_DEBUG
- const dict_index_t* index, /*!< in: index tree */
-#endif /* UNIV_SYNC_DEBUG */
+ dict_index_t* index, /*!< in: index tree */
mtr_t* mtr) /*!< in/out: mini-transaction */
{
ulint prev_page_no;
@@ -5100,18 +5121,20 @@ node_ptr_fails:
/**************************************************************//**
Checks the consistency of an index tree.
-@return TRUE if ok */
+@return DB_SUCCESS if ok, error code if not */
UNIV_INTERN
-bool
+dberr_t
btr_validate_index(
/*===============*/
dict_index_t* index, /*!< in: index */
const trx_t* trx) /*!< in: transaction or NULL */
{
+ dberr_t err = DB_SUCCESS;
+
/* Full Text index are implemented by auxiliary tables,
not the B-tree */
if (dict_index_is_online_ddl(index) || (index->type & DICT_FTS)) {
- return(true);
+ return(err);
}
mtr_t mtr;
@@ -5120,21 +5143,27 @@ btr_validate_index(
mtr_x_lock(dict_index_get_lock(index), &mtr);
- bool ok = true;
page_t* root = btr_root_get(index, &mtr);
+
+ if (root == NULL && index->table->is_encrypted) {
+ err = DB_DECRYPTION_FAILED;
+ mtr_commit(&mtr);
+ return err;
+ }
+
ulint n = btr_page_get_level(root, &mtr);
for (ulint i = 0; i <= n; ++i) {
if (!btr_validate_level(index, trx, n - i)) {
- ok = false;
+ err = DB_CORRUPTION;
break;
}
}
mtr_commit(&mtr);
- return(ok);
+ return(err);
}
/**************************************************************//**
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index 1a4eb347cd2..db23b75edf1 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -3,6 +3,7 @@
Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2012, Facebook Inc.
+Copyright (c) 2015, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -347,7 +348,7 @@ search tuple should be performed in the B-tree. InnoDB does an insert
immediately after the cursor. Thus, the cursor may end up on a user record,
or on a page infimum record. */
UNIV_INTERN
-void
+dberr_t
btr_cur_search_to_nth_level(
/*========================*/
dict_index_t* index, /*!< in: index */
@@ -397,6 +398,7 @@ btr_cur_search_to_nth_level(
page_cur_t* page_cursor;
btr_op_t btr_op;
ulint root_height = 0; /* remove warning */
+ dberr_t err = DB_SUCCESS;
#ifdef BTR_CUR_ADAPT
btr_search_t* info;
@@ -513,7 +515,7 @@ btr_cur_search_to_nth_level(
|| mode != PAGE_CUR_LE);
btr_cur_n_sea++;
- return;
+ return err;
}
# endif /* BTR_CUR_HASH_ADAPT */
#endif /* BTR_CUR_ADAPT */
@@ -609,7 +611,21 @@ search_loop:
retry_page_get:
block = buf_page_get_gen(
space, zip_size, page_no, rw_latch, guess, buf_mode,
- file, line, mtr);
+ file, line, mtr, &err);
+
+ if (err != DB_SUCCESS) {
+ if (err == DB_DECRYPTION_FAILED) {
+ ib_push_warning((void *)NULL,
+ DB_DECRYPTION_FAILED,
+ "Table %s is encrypted but encryption service or"
+ " used key_id is not available. "
+ " Can't continue reading table.",
+ index->table->name);
+ index->table->is_encrypted = true;
+ }
+
+ goto func_exit;
+ }
if (block == NULL) {
/* This must be a search to perform an insert/delete
@@ -822,12 +838,14 @@ func_exit:
rw_lock_s_lock(&btr_search_latch);
}
+
+ return err;
}
/*****************************************************************//**
Opens a cursor at either end of an index. */
UNIV_INTERN
-void
+dberr_t
btr_cur_open_at_index_side_func(
/*============================*/
bool from_left, /*!< in: true if open to the low end,
@@ -853,6 +871,8 @@ btr_cur_open_at_index_side_func(
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
+ dberr_t err = DB_SUCCESS;
+
rec_offs_init(offsets_);
estimate = latch_mode & BTR_ESTIMATE;
@@ -890,11 +910,26 @@ btr_cur_open_at_index_side_func(
height = ULINT_UNDEFINED;
for (;;) {
- buf_block_t* block;
- page_t* page;
+ buf_block_t* block=NULL;
+ page_t* page=NULL;
+
block = buf_page_get_gen(space, zip_size, page_no,
RW_NO_LATCH, NULL, BUF_GET,
- file, line, mtr);
+ file, line, mtr, &err);
+ if (err != DB_SUCCESS) {
+ if (err == DB_DECRYPTION_FAILED) {
+ ib_push_warning((void *)NULL,
+ DB_DECRYPTION_FAILED,
+ "Table %s is encrypted but encryption service or"
+ " used key_id is not available. "
+ " Can't continue reading table.",
+ index->table->name);
+ index->table->is_encrypted = true;
+ }
+
+ goto exit_loop;
+ }
+
page = buf_block_get_frame(block);
ut_ad(fil_page_get_type(page) == FIL_PAGE_INDEX);
ut_ad(index->id == btr_page_get_index_id(page));
@@ -979,9 +1014,12 @@ btr_cur_open_at_index_side_func(
page_no = btr_node_ptr_get_child_page_no(node_ptr, offsets);
}
+ exit_loop:
if (heap) {
mem_heap_free(heap);
}
+
+ return err;
}
/**********************************************************************//**
@@ -1029,10 +1067,25 @@ btr_cur_open_at_rnd_pos_func(
for (;;) {
buf_block_t* block;
page_t* page;
+ dberr_t err=DB_SUCCESS;
block = buf_page_get_gen(space, zip_size, page_no,
RW_NO_LATCH, NULL, BUF_GET,
- file, line, mtr);
+ file, line, mtr, &err);
+
+ if (err != DB_SUCCESS) {
+ if (err == DB_DECRYPTION_FAILED) {
+ ib_push_warning((void *)NULL,
+ DB_DECRYPTION_FAILED,
+ "Table %s is encrypted but encryption service or"
+ " used key_id is not available. "
+ " Can't continue reading table.",
+ index->table->name);
+ index->table->is_encrypted = true;
+ }
+ goto exit_loop;
+ }
+
page = buf_block_get_frame(block);
ut_ad(fil_page_get_type(page) == FIL_PAGE_INDEX);
ut_ad(index->id == btr_page_get_index_id(page));
@@ -1066,6 +1119,7 @@ btr_cur_open_at_rnd_pos_func(
page_no = btr_node_ptr_get_child_page_no(node_ptr, offsets);
}
+ exit_loop:
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -1617,15 +1671,24 @@ btr_cur_pessimistic_insert(
btr_cur_get_page_zip(cursor),
thr_get_trx(thr)->id, mtr);
}
- if (!page_rec_is_infimum(btr_cur_get_rec(cursor))
- || btr_page_get_prev(
- buf_block_get_frame(
- btr_cur_get_block(cursor)), mtr)
- == FIL_NULL) {
+
+ if (!page_rec_is_infimum(btr_cur_get_rec(cursor))) {
/* split and inserted need to call
lock_update_insert() always. */
inherit = TRUE;
}
+
+ buf_block_t* block = btr_cur_get_block(cursor);
+ buf_frame_t* frame = NULL;
+
+ if (block) {
+ frame = buf_block_get_frame(block);
+ }
+ /* split and inserted need to call
+ lock_update_insert() always. */
+ if (frame && btr_page_get_prev(frame, mtr) == FIL_NULL) {
+ inherit = TRUE;
+ }
}
#ifdef BTR_CUR_ADAPT
@@ -3562,6 +3625,7 @@ btr_estimate_n_rows_in_range_on_level(
mtr_t mtr;
page_t* page;
buf_block_t* block;
+ dberr_t err=DB_SUCCESS;
mtr_start(&mtr);
@@ -3572,7 +3636,23 @@ btr_estimate_n_rows_in_range_on_level(
silence a debug assertion about this. */
block = buf_page_get_gen(space, zip_size, page_no, RW_S_LATCH,
NULL, BUF_GET_POSSIBLY_FREED,
- __FILE__, __LINE__, &mtr);
+ __FILE__, __LINE__, &mtr, &err);
+
+ if (err != DB_SUCCESS) {
+ if (err == DB_DECRYPTION_FAILED) {
+ ib_push_warning((void *)NULL,
+ DB_DECRYPTION_FAILED,
+ "Table %s is encrypted but encryption service or"
+ " used key_id is not available. "
+ " Can't continue reading table.",
+ index->table->name);
+ index->table->is_encrypted = true;
+ }
+
+ mtr_commit(&mtr);
+ goto inexact;
+ }
+
page = buf_block_get_frame(block);
diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc
index dfb2cd8dffd..26bab936de5 100644
--- a/storage/innobase/btr/btr0defragment.cc
+++ b/storage/innobase/btr/btr0defragment.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (C) 2013, 2014 Facebook, Inc. All Rights Reserved.
-Copyright (C) 2014, SkySQL Ab. All Rights Reserved.
+Copyright (C) 2014, 2015, MariaDB Corporation. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -22,7 +22,7 @@ Index defragmentation.
Created 05/29/2014 Rongrong Zhong
Modified 16/07/2014 Sunguck Lee
-Modified 30/07/2014 Jan Lindström jan.lindstrom@skysql.com
+Modified 30/07/2014 Jan Lindström jan.lindstrom@mariadb.com
*******************************************************/
#include "btr0defragment.h"
@@ -208,16 +208,31 @@ synchronized defragmentation. */
os_event_t
btr_defragment_add_index(
dict_index_t* index, /*!< index to be added */
- bool async) /*!< whether this is an async defragmentation */
+ bool async, /*!< whether this is an async
+ defragmentation */
+ dberr_t* err) /*!< out: error code */
{
mtr_t mtr;
ulint space = dict_index_get_space(index);
ulint zip_size = dict_table_zip_size(index->table);
ulint page_no = dict_index_get_page(index);
+ *err = DB_SUCCESS;
+
mtr_start(&mtr);
// Load index rood page.
- page_t* page = btr_page_get(space, zip_size, page_no,
- RW_NO_LATCH, index, &mtr);
+ buf_block_t* block = btr_block_get(space, zip_size, page_no, RW_NO_LATCH, index, &mtr);
+ page_t* page = NULL;
+
+ if (block) {
+ page = buf_block_get_frame(block);
+ }
+
+ if (page == NULL && index->table->is_encrypted) {
+ mtr_commit(&mtr);
+ *err = DB_DECRYPTION_FAILED;
+ return NULL;
+ }
+
if (btr_page_get_level(page, &mtr) == 0) {
// Index root is a leaf page, no need to defragment.
mtr_commit(&mtr);
diff --git a/storage/innobase/btr/btr0scrub.cc b/storage/innobase/btr/btr0scrub.cc
index d53b478e429..e6acb7802f1 100644
--- a/storage/innobase/btr/btr0scrub.cc
+++ b/storage/innobase/btr/btr0scrub.cc
@@ -750,9 +750,13 @@ btr_scrub_page(
mtr_t* mtr) /*!< in: mtr */
{
/* recheck if page needs scrubbing (knowing allocation status) */
- int needs_scrubbing = btr_page_needs_scrubbing(
- scrub_data, block, allocated);
- if (needs_scrubbing != BTR_SCRUB_PAGE) {
+ int needs_scrubbing = BTR_SCRUB_SKIP_PAGE_AND_CLOSE_TABLE;
+
+ if (block) {
+ btr_page_needs_scrubbing(scrub_data, block, allocated);
+ }
+
+ if (!block || needs_scrubbing != BTR_SCRUB_PAGE) {
mtr_commit(mtr);
return needs_scrubbing;
}
@@ -784,7 +788,12 @@ btr_scrub_page(
return BTR_SCRUB_SKIP_PAGE_AND_CLOSE_TABLE;
}
- if (btr_page_get_index_id(buf_block_get_frame(block)) !=
+ buf_frame_t* frame = NULL;
+
+ if (block) {
+ frame = buf_block_get_frame(block);
+ }
+ if (!frame || btr_page_get_index_id(frame) !=
scrub_data->current_index->id) {
/* page has been reallocated to new index */
mtr_commit(mtr);
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index 39ef7dadea3..2cadaa18b9c 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2013, 2015, MariaDB Corporation. All Rights Reserved.
@@ -56,6 +56,7 @@ Created 11/5/1995 Heikki Tuuri
#include "srv0mon.h"
#include "buf0checksum.h"
#include "fil0pagecompress.h"
+#include "ha_prototypes.h"
#include "ut0byte.h"
#include <new>
@@ -63,10 +64,6 @@ Created 11/5/1995 Heikki Tuuri
#include "lzo/lzo1x.h"
#endif
-/* Number of temporary slots used for encryption/compression
-memory allocation before/after I/O operations */
-#define BUF_MAX_TMP_SLOTS 200
-
/*
IMPLEMENTATION OF THE BUFFER POOL
=================================
@@ -317,6 +314,18 @@ on the io_type */
: (counter##_WRITTEN))
/********************************************************************//**
+Check if page is maybe compressed, encrypted or both when we encounter
+corrupted page. Note that we can't be 100% sure if page is corrupted
+or decrypt/decompress just failed.
+*/
+static
+ibool
+buf_page_check_corrupt(
+/*===================*/
+ buf_page_t* bpage); /*!< in/out: buffer page read from
+ disk */
+
+/********************************************************************//**
Gets the smallest oldest_modification lsn for any page in the pool. Returns
zero if all modified pages have been flushed to disk.
@return oldest modification in pool, zero if none */
@@ -499,6 +508,79 @@ buf_page_is_zeroes(
return(true);
}
+/** Checks if the page is in crc32 checksum format.
+@param[in] read_buf database page
+@param[in] checksum_field1 new checksum field
+@param[in] checksum_field2 old checksum field
+@return true if the page is in crc32 checksum format */
+UNIV_INLINE
+bool
+buf_page_is_checksum_valid_crc32(
+ const byte* read_buf,
+ ulint checksum_field1,
+ ulint checksum_field2)
+{
+ ib_uint32_t crc32 = buf_calc_page_crc32(read_buf);
+
+ return(checksum_field1 == crc32 && checksum_field2 == crc32);
+}
+
+/** Checks if the page is in innodb checksum format.
+@param[in] read_buf database page
+@param[in] checksum_field1 new checksum field
+@param[in] checksum_field2 old checksum field
+@return true if the page is in innodb checksum format */
+UNIV_INLINE
+bool
+buf_page_is_checksum_valid_innodb(
+ const byte* read_buf,
+ ulint checksum_field1,
+ ulint checksum_field2)
+{
+ /* There are 2 valid formulas for
+ checksum_field2 (old checksum field) which algo=innodb could have
+ written to the page:
+
+ 1. Very old versions of InnoDB only stored 8 byte lsn to the
+ start and the end of the page.
+
+ 2. Newer InnoDB versions store the old formula checksum
+ (buf_calc_page_old_checksum()). */
+
+ if (checksum_field2 != mach_read_from_4(read_buf + FIL_PAGE_LSN)
+ && checksum_field2 != buf_calc_page_old_checksum(read_buf)) {
+ return(false);
+ }
+
+ /* old field is fine, check the new field */
+
+ /* InnoDB versions < 4.0.14 and < 4.1.1 stored the space id
+ (always equal to 0), to FIL_PAGE_SPACE_OR_CHKSUM */
+
+ if (checksum_field1 != 0
+ && checksum_field1 != buf_calc_page_new_checksum(read_buf)) {
+ return(false);
+ }
+
+ return(true);
+}
+
+/** Checks if the page is in none checksum format.
+@param[in] read_buf database page
+@param[in] checksum_field1 new checksum field
+@param[in] checksum_field2 old checksum field
+@return true if the page is in none checksum format */
+UNIV_INLINE
+bool
+buf_page_is_checksum_valid_none(
+ const byte* read_buf,
+ ulint checksum_field1,
+ ulint checksum_field2)
+{
+ return(checksum_field1 == checksum_field2
+ && checksum_field1 == BUF_NO_CHECKSUM_MAGIC);
+}
+
/********************************************************************//**
Checks if a page is corrupt.
@return TRUE if corrupted */
@@ -515,8 +597,6 @@ buf_page_is_corrupted(
ulint page_encrypted = fil_page_is_encrypted(read_buf);
ulint checksum_field1;
ulint checksum_field2;
- ibool crc32_inited = FALSE;
- ib_uint32_t crc32 = ULINT32_UNDEFINED;
if (!page_encrypted && !zip_size
&& memcmp(read_buf + FIL_PAGE_LSN + 4,
@@ -599,148 +679,121 @@ buf_page_is_corrupted(
return(FALSE);
}
- switch ((srv_checksum_algorithm_t) srv_checksum_algorithm) {
- case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
-
- crc32 = buf_calc_page_crc32(read_buf);
-
- return(checksum_field1 != crc32 || checksum_field2 != crc32);
-
- case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
-
- return(checksum_field1
- != buf_calc_page_new_checksum(read_buf)
- || checksum_field2
- != buf_calc_page_old_checksum(read_buf));
-
- case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
+ DBUG_EXECUTE_IF("buf_page_is_corrupt_failure", return(TRUE); );
- return(checksum_field1 != BUF_NO_CHECKSUM_MAGIC
- || checksum_field2 != BUF_NO_CHECKSUM_MAGIC);
+ ulint page_no = mach_read_from_4(read_buf + FIL_PAGE_OFFSET);
+ ulint space_id = mach_read_from_4(read_buf + FIL_PAGE_SPACE_ID);
+ const srv_checksum_algorithm_t curr_algo =
+ static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
+ switch (curr_algo) {
case SRV_CHECKSUM_ALGORITHM_CRC32:
- case SRV_CHECKSUM_ALGORITHM_INNODB:
- /* There are 3 valid formulas for
- checksum_field2 (old checksum field):
-
- 1. Very old versions of InnoDB only stored 8 byte lsn to the
- start and the end of the page.
-
- 2. InnoDB versions before MySQL 5.6.3 store the old formula
- checksum (buf_calc_page_old_checksum()).
-
- 3. InnoDB versions 5.6.3 and newer with
- innodb_checksum_algorithm=strict_crc32|crc32 store CRC32. */
-
- /* since innodb_checksum_algorithm is not strict_* allow
- any of the algos to match for the old field */
-
- if (checksum_field2
- != mach_read_from_4(read_buf + FIL_PAGE_LSN)
- && checksum_field2 != BUF_NO_CHECKSUM_MAGIC) {
-
- /* The checksum does not match any of the
- fast to check. First check the selected algorithm
- for writing checksums because we assume that the
- chance of it matching is higher. */
-
- if (srv_checksum_algorithm
- == SRV_CHECKSUM_ALGORITHM_CRC32) {
-
- crc32 = buf_calc_page_crc32(read_buf);
- crc32_inited = TRUE;
-
- if (checksum_field2 != crc32
- && checksum_field2
- != buf_calc_page_old_checksum(read_buf)) {
+ case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
- return(TRUE);
- }
- } else {
- ut_ad(srv_checksum_algorithm
- == SRV_CHECKSUM_ALGORITHM_INNODB);
+ if (buf_page_is_checksum_valid_crc32(read_buf,
+ checksum_field1, checksum_field2)) {
+ return(FALSE);
+ }
- if (checksum_field2
- != buf_calc_page_old_checksum(read_buf)) {
+ if (buf_page_is_checksum_valid_none(read_buf,
+ checksum_field1, checksum_field2)) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_NONE,
+ space_id, page_no);
+ }
- crc32 = buf_calc_page_crc32(read_buf);
- crc32_inited = TRUE;
+ return(FALSE);
+ }
- if (checksum_field2 != crc32) {
- return(TRUE);
- }
- }
+ if (buf_page_is_checksum_valid_innodb(read_buf,
+ checksum_field1, checksum_field2)) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_INNODB,
+ space_id, page_no);
}
- }
- /* old field is fine, check the new field */
+ return(FALSE);
+ }
- /* InnoDB versions < 4.0.14 and < 4.1.1 stored the space id
- (always equal to 0), to FIL_PAGE_SPACE_OR_CHKSUM */
+ return(TRUE);
- if (checksum_field1 != 0
- && checksum_field1 != BUF_NO_CHECKSUM_MAGIC) {
+ case SRV_CHECKSUM_ALGORITHM_INNODB:
+ case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
- /* The checksum does not match any of the
- fast to check. First check the selected algorithm
- for writing checksums because we assume that the
- chance of it matching is higher. */
+ if (buf_page_is_checksum_valid_innodb(read_buf,
+ checksum_field1, checksum_field2)) {
+ return(FALSE);
+ }
- if (srv_checksum_algorithm
- == SRV_CHECKSUM_ALGORITHM_CRC32) {
+ if (buf_page_is_checksum_valid_none(read_buf,
+ checksum_field1, checksum_field2)) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_NONE,
+ space_id, page_no);
+ }
- if (!crc32_inited) {
- crc32 = buf_calc_page_crc32(read_buf);
- crc32_inited = TRUE;
- }
+ return(FALSE);
+ }
- if (checksum_field1 != crc32
- && checksum_field1
- != buf_calc_page_new_checksum(read_buf)) {
+ if (buf_page_is_checksum_valid_crc32(read_buf,
+ checksum_field1, checksum_field2)) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_CRC32,
+ space_id, page_no);
+ }
- return(TRUE);
- }
- } else {
- ut_ad(srv_checksum_algorithm
- == SRV_CHECKSUM_ALGORITHM_INNODB);
+ return(FALSE);
+ }
- if (checksum_field1
- != buf_calc_page_new_checksum(read_buf)) {
+ return(TRUE);
- if (!crc32_inited) {
- crc32 = buf_calc_page_crc32(
- read_buf);
- crc32_inited = TRUE;
- }
+ case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
- if (checksum_field1 != crc32) {
- return(TRUE);
- }
- }
- }
+ if (buf_page_is_checksum_valid_none(read_buf,
+ checksum_field1, checksum_field2)) {
+ return(FALSE);
}
- /* If CRC32 is stored in at least one of the fields, then the
- other field must also be CRC32 */
- if (crc32_inited
- && ((checksum_field1 == crc32
- && checksum_field2 != crc32)
- || (checksum_field1 != crc32
- && checksum_field2 == crc32))) {
+ if (buf_page_is_checksum_valid_crc32(read_buf,
+ checksum_field1, checksum_field2)) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_CRC32,
+ space_id, page_no);
+ return(FALSE);
+ }
- return(TRUE);
+ if (buf_page_is_checksum_valid_innodb(read_buf,
+ checksum_field1, checksum_field2)) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_INNODB,
+ space_id, page_no);
+ return(FALSE);
}
- break;
+ return(TRUE);
+
case SRV_CHECKSUM_ALGORITHM_NONE:
/* should have returned FALSE earlier */
- ut_error;
+ break;
/* no default so the compiler will emit a warning if new enum
is added and not handled here */
}
- DBUG_EXECUTE_IF("buf_page_is_corrupt_failure", return(TRUE); );
-
+ ut_error;
return(FALSE);
}
@@ -1010,6 +1063,11 @@ buf_block_init(
block->page.buf_fix_count = 0;
block->page.io_fix = BUF_IO_NONE;
block->page.key_version = 0;
+ block->page.page_encrypted = false;
+ block->page.page_compressed = false;
+ block->page.encrypted = false;
+ block->page.stored_checksum = BUF_NO_CHECKSUM_MAGIC;
+ block->page.calculated_checksum = BUF_NO_CHECKSUM_MAGIC;
block->page.real_size = 0;
block->page.write_size = 0;
block->modify_clock = 0;
@@ -1368,8 +1426,9 @@ buf_pool_init_instance(
/* Initialize the temporal memory array and slots */
buf_pool->tmp_arr = (buf_tmp_array_t *)mem_zalloc(sizeof(buf_tmp_array_t));
- buf_pool->tmp_arr->n_slots = BUF_MAX_TMP_SLOTS;
- buf_pool->tmp_arr->slots = (buf_tmp_buffer_t*)mem_zalloc(sizeof(buf_tmp_buffer_t) * BUF_MAX_TMP_SLOTS);
+ ulint n_slots = srv_n_read_io_threads * srv_n_write_io_threads * (8 * OS_AIO_N_PENDING_IOS_PER_THREAD);
+ buf_pool->tmp_arr->n_slots = n_slots;
+ buf_pool->tmp_arr->slots = (buf_tmp_buffer_t*)mem_zalloc(sizeof(buf_tmp_buffer_t) * n_slots);
buf_pool_mutex_exit(buf_pool);
@@ -1424,23 +1483,30 @@ buf_pool_free_instance(
hash_table_free(buf_pool->zip_hash);
/* Free all used temporary slots */
- for(ulint i = 0; i < buf_pool->tmp_arr->n_slots; i++) {
- buf_tmp_buffer_t* slot = &buf_pool->tmp_arr->slots[i];
+ if (buf_pool->tmp_arr) {
+ for(ulint i = 0; i < buf_pool->tmp_arr->n_slots; i++) {
+ buf_tmp_buffer_t* slot = &(buf_pool->tmp_arr->slots[i]);
#ifdef HAVE_LZO
- if (slot->lzo_mem) {
- ut_free(slot->lzo_mem);
- }
+ if (slot && slot->lzo_mem) {
+ ut_free(slot->lzo_mem);
+ slot->lzo_mem = NULL;
+ }
#endif
- if (slot->crypt_buf_free) {
- ut_free(slot->crypt_buf_free);
- }
- if (slot->comp_buf_free) {
- ut_free(slot->comp_buf_free);
+ if (slot && slot->crypt_buf_free) {
+ ut_free(slot->crypt_buf_free);
+ slot->crypt_buf_free = NULL;
+ }
+
+ if (slot && slot->comp_buf_free) {
+ ut_free(slot->comp_buf_free);
+ slot->comp_buf_free = NULL;
+ }
}
}
mem_free(buf_pool->tmp_arr->slots);
mem_free(buf_pool->tmp_arr);
+ buf_pool->tmp_arr = NULL;
}
/********************************************************************//**
@@ -1819,6 +1885,9 @@ page_found:
goto page_found;
}
+ /* The maximum number of purge threads should never exceed
+ BUF_POOL_WATCH_SIZE. So there is no way for purge thread
+ instance to hold a watch when setting another watch. */
for (i = 0; i < BUF_POOL_WATCH_SIZE; i++) {
bpage = &buf_pool->watch[i];
@@ -2190,7 +2259,7 @@ lookup:
/* Page not in buf_pool: needs to be read from file */
ut_ad(!hash_lock);
- buf_read_page(space, zip_size, offset);
+ buf_read_page(space, zip_size, offset, NULL);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(++buf_dbg_counter % 5771 || buf_validate());
@@ -2665,7 +2734,8 @@ buf_page_get_gen(
BUF_GET_IF_IN_POOL_OR_WATCH */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
- mtr_t* mtr) /*!< in: mini-transaction */
+ mtr_t* mtr, /*!< in: mini-transaction */
+ dberr_t* err) /*!< out: error code */
{
buf_block_t* block;
ulint fold;
@@ -2682,6 +2752,11 @@ buf_page_get_gen(
ut_ad((rw_latch == RW_S_LATCH)
|| (rw_latch == RW_X_LATCH)
|| (rw_latch == RW_NO_LATCH));
+
+ if (err) {
+ *err = DB_SUCCESS;
+ }
+
#ifdef UNIV_DEBUG
switch (mode) {
case BUF_GET_NO_LATCH:
@@ -2742,6 +2817,8 @@ loop:
}
if (block == NULL) {
+ buf_page_t* bpage=NULL;
+
/* Page not in buf_pool: needs to be read from file */
if (mode == BUF_GET_IF_IN_POOL_OR_WATCH) {
@@ -2774,35 +2851,83 @@ loop:
return(NULL);
}
- if (buf_read_page(space, zip_size, offset)) {
+ if (buf_read_page(space, zip_size, offset, &bpage)) {
buf_read_ahead_random(space, zip_size, offset,
ibuf_inside(mtr));
retries = 0;
} else if (retries < BUF_PAGE_READ_MAX_RETRIES) {
++retries;
+
+ bool corrupted = true;
+
+ if (bpage) {
+ corrupted = buf_page_check_corrupt(bpage);
+ }
+
+ /* Do not try again for encrypted pages */
+ if (!corrupted) {
+ ib_mutex_t* pmutex = buf_page_get_mutex(bpage);
+ buf_pool_mutex_enter(buf_pool);
+ mutex_enter(pmutex);
+ buf_block_t* block = buf_page_get_block(bpage);
+ buf_page_set_io_fix(bpage, BUF_IO_NONE);
+ buf_block_set_state(block, BUF_BLOCK_NOT_USED);
+ buf_block_set_state(block, BUF_BLOCK_READY_FOR_USE);
+ buf_pool_mutex_exit(buf_pool);
+ mutex_exit(pmutex);
+
+ if (err) {
+ *err = DB_DECRYPTION_FAILED;
+ }
+ return (NULL);
+ }
+
DBUG_EXECUTE_IF(
"innodb_page_corruption_retries",
retries = BUF_PAGE_READ_MAX_RETRIES;
);
} else {
- fprintf(stderr, "InnoDB: Error: Unable"
- " to read tablespace %lu page no"
- " %lu into the buffer pool after"
- " %lu attempts\n"
- "InnoDB: The most probable cause"
- " of this error may be that the"
- " table has been corrupted.\n"
- "InnoDB: You can try to fix this"
- " problem by using"
- " innodb_force_recovery.\n"
- "InnoDB: Please see reference manual"
- " for more details.\n"
- "InnoDB: Aborting...\n",
- space, offset,
- BUF_PAGE_READ_MAX_RETRIES);
+ bool corrupted = true;
- ut_error;
+ if (bpage) {
+ corrupted = buf_page_check_corrupt(bpage);
+ }
+
+ if (corrupted) {
+ fprintf(stderr, "InnoDB: Error: Unable"
+ " to read tablespace %lu page no"
+ " %lu into the buffer pool after"
+ " %lu attempts\n"
+ "InnoDB: The most probable cause"
+ " of this error may be that the"
+ " table has been corrupted.\n"
+ "InnoDB: You can try to fix this"
+ " problem by using"
+ " innodb_force_recovery.\n"
+ "InnoDB: Please see reference manual"
+ " for more details.\n"
+ "InnoDB: Aborting...\n",
+ space, offset,
+ BUF_PAGE_READ_MAX_RETRIES);
+
+ ut_error;
+ } else {
+ ib_mutex_t* pmutex = buf_page_get_mutex(bpage);
+ buf_pool_mutex_enter(buf_pool);
+ mutex_enter(pmutex);
+ buf_block_t* block = buf_page_get_block(bpage);
+ buf_page_set_io_fix(bpage, BUF_IO_NONE);
+ buf_block_set_state(block, BUF_BLOCK_NOT_USED);
+ buf_block_set_state(block, BUF_BLOCK_READY_FOR_USE);
+ buf_pool_mutex_exit(buf_pool);
+ mutex_exit(pmutex);
+
+ if (err) {
+ *err = DB_DECRYPTION_FAILED;
+ }
+ return (NULL);
+ }
}
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
@@ -3537,6 +3662,11 @@ buf_page_init_low(
bpage->oldest_modification = 0;
bpage->write_size = 0;
bpage->key_version = 0;
+ bpage->stored_checksum = BUF_NO_CHECKSUM_MAGIC;
+ bpage->calculated_checksum = BUF_NO_CHECKSUM_MAGIC;
+ bpage->page_encrypted = false;
+ bpage->page_compressed = false;
+ bpage->encrypted = false;
bpage->real_size = 0;
bpage->slot = NULL;
@@ -4189,39 +4319,124 @@ buf_mark_space_corrupt(
ulint space = bpage->space;
ibool ret = TRUE;
- /* First unfix and release lock on the bpage */
- buf_pool_mutex_enter(buf_pool);
- mutex_enter(buf_page_get_mutex(bpage));
- ut_ad(buf_page_get_io_fix(bpage) == BUF_IO_READ);
- ut_ad(bpage->buf_fix_count == 0);
+ if (!bpage->encrypted) {
+ /* First unfix and release lock on the bpage */
+ buf_pool_mutex_enter(buf_pool);
+ mutex_enter(buf_page_get_mutex(bpage));
+ ut_ad(buf_page_get_io_fix(bpage) == BUF_IO_READ);
+ ut_ad(bpage->buf_fix_count == 0);
- /* Set BUF_IO_NONE before we remove the block from LRU list */
- buf_page_set_io_fix(bpage, BUF_IO_NONE);
+ /* Set BUF_IO_NONE before we remove the block from LRU list */
+ buf_page_set_io_fix(bpage, BUF_IO_NONE);
- if (uncompressed) {
- rw_lock_x_unlock_gen(
- &((buf_block_t*) bpage)->lock,
- BUF_IO_READ);
- }
+ if (uncompressed) {
+ rw_lock_x_unlock_gen(
+ &((buf_block_t*) bpage)->lock,
+ BUF_IO_READ);
+ }
- mutex_exit(buf_page_get_mutex(bpage));
+ mutex_exit(buf_page_get_mutex(bpage));
+ }
/* Find the table with specified space id, and mark it corrupted */
if (dict_set_corrupted_by_space(space)) {
- buf_LRU_free_one_page(bpage);
+ if (!bpage->encrypted) {
+ buf_LRU_free_one_page(bpage);
+ }
} else {
ret = FALSE;
}
- ut_ad(buf_pool->n_pend_reads > 0);
- buf_pool->n_pend_reads--;
+ if (!bpage->encrypted) {
+ ut_ad(buf_pool->n_pend_reads > 0);
+ buf_pool->n_pend_reads--;
- buf_pool_mutex_exit(buf_pool);
+ buf_pool_mutex_exit(buf_pool);
+ }
return(ret);
}
/********************************************************************//**
+Check if page is maybe compressed, encrypted or both when we encounter
+corrupted page. Note that we can't be 100% sure if page is corrupted
+or decrypt/decompress just failed.
+*/
+static
+ibool
+buf_page_check_corrupt(
+/*===================*/
+ buf_page_t* bpage) /*!< in/out: buffer page read from disk */
+{
+ ulint zip_size = buf_page_get_zip_size(bpage);
+ byte* dst_frame = (zip_size) ? bpage->zip.data :
+ ((buf_block_t*) bpage)->frame;
+ unsigned key_version = bpage->key_version;
+ bool page_compressed = bpage->page_encrypted;
+ ulint stored_checksum = bpage->stored_checksum;
+ ulint calculated_checksum = bpage->stored_checksum;
+ bool page_compressed_encrypted = bpage->page_compressed;
+ ulint space_id = mach_read_from_4(
+ dst_frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
+ fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space_id);
+ fil_space_t* space = fil_space_found_by_id(space_id);
+ bool corrupted = true;
+
+ if (key_version != 0 || page_compressed_encrypted) {
+ bpage->encrypted = true;
+ }
+
+ if (key_version != 0 ||
+ (crypt_data && crypt_data->type != CRYPT_SCHEME_UNENCRYPTED) ||
+ page_compressed || page_compressed_encrypted) {
+
+ /* Page is really corrupted if post encryption stored
+ checksum does not match calculated checksum after page was
+ read. For pages compressed and then encrypted, there is no
+ checksum. */
+ corrupted = (!page_compressed_encrypted && stored_checksum != calculated_checksum);
+
+ if (corrupted) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "%s: Block in space_id %lu in file %s corrupted.",
+ page_compressed_encrypted ? "Maybe corruption" : "Corruption",
+ space_id, space ? space->name : "NULL");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Page based on contents %s encrypted.",
+ (key_version == 0 && page_compressed_encrypted == false) ? "not" : "maybe");
+ if (stored_checksum != BUF_NO_CHECKSUM_MAGIC || calculated_checksum != BUF_NO_CHECKSUM_MAGIC) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Page stored checksum %lu but calculated checksum %lu.",
+ stored_checksum, calculated_checksum);
+ }
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Reason could be that key_version %u in page "
+ "or in crypt_data %p could not be found.",
+ key_version, crypt_data);
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Reason could be also that key management plugin is not found or"
+ " used encryption algorithm or method does not match.");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Based on page page compressed %d, compressed and encrypted %d.",
+ page_compressed, page_compressed_encrypted);
+ } else {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Block in space_id %lu in file %s encrypted.",
+ space_id, space ? space->name : "NULL");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "However key management plugin or used key_id %u is not found or"
+ " used encryption algorithm or method does not match.",
+ key_version);
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Marking tablespace as missing. You may drop this table or"
+ " install correct key management plugin and key file.");
+ }
+ }
+
+ return corrupted;
+}
+
+/********************************************************************//**
Completes an asynchronous read or write request of a file page to or from
the buffer pool.
@return true if successful */
@@ -4337,47 +4552,46 @@ buf_page_io_complete(
goto page_not_corrupt;
;);
corrupt:
- fil_system_enter();
- space = fil_space_get_by_id(bpage->space);
- fil_system_exit();
-
- fprintf(stderr,
- "InnoDB: Database page corruption on disk"
- " or a failed\n"
- "InnoDB: space %lu file %s read of page %lu.\n"
- "InnoDB: You may have to recover"
- " from a backup.\n",
- (ulint)bpage->space,
- space ? space->name : "NULL",
- (ulong) bpage->offset);
- buf_page_print(frame, buf_page_get_zip_size(bpage),
- BUF_PAGE_PRINT_NO_CRASH);
- fprintf(stderr,
- "InnoDB: Database page corruption on disk"
- " or a failed\n"
- "InnoDB: file read of page %lu.\n"
- "InnoDB: You may have to recover"
- " from a backup.\n",
- (ulong) bpage->offset);
- fputs("InnoDB: It is also possible that"
- " your operating\n"
- "InnoDB: system has corrupted its"
- " own file cache\n"
- "InnoDB: and rebooting your computer"
- " removes the\n"
- "InnoDB: error.\n"
- "InnoDB: If the corrupt page is an index page\n"
- "InnoDB: you can also try to"
- " fix the corruption\n"
- "InnoDB: by dumping, dropping,"
- " and reimporting\n"
- "InnoDB: the corrupt table."
- " You can use CHECK\n"
- "InnoDB: TABLE to scan your"
- " table for corruption.\n"
- "InnoDB: See also "
- REFMAN "forcing-innodb-recovery.html\n"
- "InnoDB: about forcing recovery.\n", stderr);
+ bool corrupted = buf_page_check_corrupt(bpage);
+
+ if (corrupted) {
+ fil_system_enter();
+ space = fil_space_get_by_id(bpage->space);
+ fil_system_exit();
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Database page corruption on disk"
+ " or a failed");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Space %lu file %s read of page %lu.",
+ (ulint)bpage->space,
+ space ? space->name : "NULL",
+ (ulong) bpage->offset);
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "You may have to recover"
+ " from a backup.");
+
+
+ buf_page_print(frame, buf_page_get_zip_size(bpage),
+ BUF_PAGE_PRINT_NO_CRASH);
+
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "It is also possible that your operating"
+ "system has corrupted its own file cache.");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "and rebooting your computer removes the error.");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "If the corrupt page is an index page you can also try to");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "fix the corruption by dumping, dropping, and reimporting");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "the corrupt table. You can use CHECK");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "TABLE to scan your table for corruption.");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "See also "
+ REFMAN "forcing-innodb-recovery.html"
+ " about forcing recovery.");
+ }
if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {
/* If page space id is larger than TRX_SYS_SPACE
@@ -4387,12 +4601,30 @@ corrupt:
&& buf_mark_space_corrupt(bpage)) {
return(false);
} else {
- fputs("InnoDB: Ending processing"
- " because of"
- " a corrupt database page.\n",
- stderr);
+ corrupted = buf_page_check_corrupt(bpage);
- ut_error;
+ if (corrupted) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Ending processing because of a corrupt database page.");
+
+ ut_error;
+ }
+
+ ib_push_warning((void *)NULL, DB_DECRYPTION_FAILED,
+ "Table in tablespace %lu encrypted."
+ "However key management plugin or used key_id %lu is not found or"
+ " used encryption algorithm or method does not match."
+ " Can't continue opening the table.",
+ bpage->key_version);
+
+ if (bpage->space > TRX_SYS_SPACE) {
+ if (corrupted) {
+ buf_mark_space_corrupt(bpage);
+ }
+ } else {
+ ut_error;
+ }
+ return(false);
}
}
}
@@ -4533,11 +4765,13 @@ buf_all_freed_instance(
const buf_block_t* block = buf_chunk_not_freed(chunk);
if (UNIV_LIKELY_NULL(block)) {
- fprintf(stderr,
- "Page %lu %lu still fixed or dirty\n",
- (ulong) block->page.space,
- (ulong) block->page.offset);
- ut_error;
+ if (block->page.key_version == 0) {
+ fprintf(stderr,
+ "Page %lu %lu still fixed or dirty\n",
+ (ulong) block->page.space,
+ (ulong) block->page.offset);
+ ut_error;
+ }
}
}
@@ -5714,30 +5948,31 @@ Encrypts a buffer page right before it's flushed to disk
byte*
buf_page_encrypt_before_write(
/*==========================*/
- buf_page_t* bpage, /*!< in/out: buffer page to be flushed */
- const byte* src_frame, /*!< in: src frame */
- ulint space_id) /*!< in: space id */
+ buf_page_t* bpage, /*!< in/out: buffer page to be flushed */
+ byte* src_frame, /*!< in: src frame */
+ ulint space_id) /*!< in: space id */
{
fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space_id);
ulint zip_size = buf_page_get_zip_size(bpage);
ulint page_size = (zip_size) ? zip_size : UNIV_PAGE_SIZE;
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
bool page_compressed = fil_space_is_page_compressed(bpage->space);
- bpage->real_size = UNIV_PAGE_SIZE;
bool encrypted = true;
+ bpage->real_size = UNIV_PAGE_SIZE;
+
fil_page_type_validate(src_frame);
if (bpage->offset == 0) {
/* Page 0 of a tablespace is not encrypted/compressed */
ut_ad(bpage->key_version == 0);
- return const_cast<byte*>(src_frame);
+ return src_frame;
}
if (bpage->space == TRX_SYS_SPACE && bpage->offset == TRX_SYS_PAGE_NO) {
/* don't encrypt/compress page as it contains address to dblwr buffer */
bpage->key_version = 0;
- return const_cast<byte*>(src_frame);
+ return src_frame;
}
if (crypt_data != NULL && crypt_data->encryption == FIL_SPACE_ENCRYPTION_OFF) {
@@ -5759,31 +5994,35 @@ buf_page_encrypt_before_write(
if (!encrypted && !page_compressed) {
/* No need to encrypt or page compress the page */
- return const_cast<byte*>(src_frame);
+ return src_frame;
}
/* Find free slot from temporary memory array */
buf_tmp_buffer_t* slot = buf_pool_reserve_tmp_slot(buf_pool, page_compressed);
+ slot->out_buf = NULL;
bpage->slot = slot;
- byte *dst_frame = bpage->slot->out_buf = slot->crypt_buf;
+ byte *dst_frame = slot->crypt_buf;
if (!page_compressed) {
/* Encrypt page content */
- fil_space_encrypt(bpage->space,
- bpage->offset,
- bpage->newest_modification,
- src_frame,
- zip_size,
- dst_frame);
+ byte* tmp = fil_space_encrypt(bpage->space,
+ bpage->offset,
+ bpage->newest_modification,
+ src_frame,
+ zip_size,
+ dst_frame);
unsigned key_version =
mach_read_from_4(dst_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
ut_ad(key_version == 0 || key_version >= bpage->key_version);
bpage->key_version = key_version;
bpage->real_size = page_size;
+ slot->out_buf = dst_frame = tmp;
- fil_page_type_validate(dst_frame);
+#ifdef UNIV_DEBUG
+ fil_page_type_validate(tmp);
+#endif
} else {
/* First we compress the page content */
@@ -5803,22 +6042,27 @@ buf_page_encrypt_before_write(
bpage->real_size = out_len;
+#ifdef UNIV_DEBUG
fil_page_type_validate(tmp);
+#endif
+
if(encrypted) {
/* And then we encrypt the page content */
- fil_space_encrypt(bpage->space,
- bpage->offset,
- bpage->newest_modification,
- tmp,
- zip_size,
- dst_frame);
- } else {
- bpage->slot->out_buf = dst_frame = tmp;
+ tmp = fil_space_encrypt(bpage->space,
+ bpage->offset,
+ bpage->newest_modification,
+ tmp,
+ zip_size,
+ dst_frame);
}
+
+ slot->out_buf = dst_frame = tmp;
}
+#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
+#endif
// return dst_frame which will be written
return dst_frame;
@@ -5830,7 +6074,7 @@ Decrypt page after it has been read from disk
ibool
buf_page_decrypt_after_read(
/*========================*/
- buf_page_t* bpage) /*!< in/out: buffer page read from disk */
+ buf_page_t* bpage) /*!< in/out: buffer page read from disk */
{
ulint zip_size = buf_page_get_zip_size(bpage);
ulint size = (zip_size) ? zip_size : UNIV_PAGE_SIZE;
@@ -5843,6 +6087,11 @@ buf_page_decrypt_after_read(
bool page_compressed_encrypted = fil_page_is_compressed_encrypted(dst_frame);
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+ /* If page is encrypted read post-encryption checksum */
+ if (!page_compressed_encrypted && key_version != 0) {
+ bpage->stored_checksum = mach_read_from_4(dst_frame + + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4);
+ }
+
ut_ad(bpage->key_version == 0);
if (bpage->offset == 0) {
@@ -5850,13 +6099,21 @@ buf_page_decrypt_after_read(
return (TRUE);
}
+ /* Store these for corruption check */
+ bpage->key_version = key_version;
+ bpage->page_encrypted = page_compressed_encrypted;
+ bpage->page_compressed = page_compressed;
+
if (page_compressed) {
/* the page we read is unencrypted */
/* Find free slot from temporary memory array */
buf_tmp_buffer_t* slot = buf_pool_reserve_tmp_slot(buf_pool, page_compressed);
+#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
+#endif
+ /* decompress using comp_buf to dst_frame */
fil_decompress_page(slot->comp_buf,
dst_frame,
size,
@@ -5866,24 +6123,34 @@ buf_page_decrypt_after_read(
slot->reserved = false;
key_version = 0;
+#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
+#endif
} else {
buf_tmp_buffer_t* slot = NULL;
if (key_version) {
/* Find free slot from temporary memory array */
slot = buf_pool_reserve_tmp_slot(buf_pool, page_compressed);
- memcpy(slot->crypt_buf, dst_frame, size);
+#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
- fil_page_type_validate(slot->crypt_buf);
- /* decrypt from crypt_buf to dst_frame */
+#endif
+
+ /* Calculate checksum before decrypt, this will be
+ used later to find out if incorrect key was used. */
+ if (!page_compressed_encrypted) {
+ bpage->calculated_checksum = fil_crypt_calculate_checksum(zip_size, dst_frame);
+ }
+
+ /* decrypt using crypt_buf to dst_frame */
fil_space_decrypt(bpage->space,
- slot->crypt_buf,
- size,
- dst_frame);
+ slot->crypt_buf,
+ size,
+ dst_frame);
+#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
- fil_page_type_validate(slot->crypt_buf);
+#endif
}
if (page_compressed_encrypted) {
@@ -5894,13 +6161,16 @@ buf_page_decrypt_after_read(
#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
#endif
+ /* decompress using comp_buf to dst_frame */
fil_decompress_page(slot->comp_buf,
dst_frame,
size,
&bpage->write_size);
}
+#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
+#endif
/* Mark this slot as free */
if (slot) {
diff --git a/storage/innobase/buf/buf0checksum.cc b/storage/innobase/buf/buf0checksum.cc
index aa02cda2937..4101d117896 100644
--- a/storage/innobase/buf/buf0checksum.cc
+++ b/storage/innobase/buf/buf0checksum.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -141,14 +141,17 @@ buf_checksum_algorithm_name(
{
switch (algo) {
case SRV_CHECKSUM_ALGORITHM_CRC32:
- case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
return("crc32");
+ case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
+ return("strict_crc32");
case SRV_CHECKSUM_ALGORITHM_INNODB:
- case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
return("innodb");
+ case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
+ return("strict_innodb");
case SRV_CHECKSUM_ALGORITHM_NONE:
- case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
return("none");
+ case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
+ return("strict_none");
}
ut_error;
diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc
index 934ff07090e..35188b8ba16 100644
--- a/storage/innobase/buf/buf0dblwr.cc
+++ b/storage/innobase/buf/buf0dblwr.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2014, SkySQL Ab. All Rights Reserved.
+Copyright (c) 2013, 2015, MariaDB Corporation. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -391,11 +391,11 @@ buf_dblwr_init_or_load_pages(
doublewrite = read_buf + TRX_SYS_DOUBLEWRITE;
if (mach_read_from_4(read_buf + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) != 0) {
- fil_space_decrypt((ulint)TRX_SYS_SPACE,
- read_buf,
- UNIV_PAGE_SIZE, /* page size */
- read_buf + UNIV_PAGE_SIZE);
- doublewrite = read_buf + UNIV_PAGE_SIZE + TRX_SYS_DOUBLEWRITE;
+ byte* tmp = fil_space_decrypt((ulint)TRX_SYS_SPACE,
+ read_buf + UNIV_PAGE_SIZE,
+ UNIV_PAGE_SIZE, /* page size */
+ read_buf);
+ doublewrite = tmp + TRX_SYS_DOUBLEWRITE;
}
if (mach_read_from_4(doublewrite + TRX_SYS_DOUBLEWRITE_MAGIC)
diff --git a/storage/innobase/buf/buf0dump.cc b/storage/innobase/buf/buf0dump.cc
index 4311e81a0fe..14aadb4bb4d 100644
--- a/storage/innobase/buf/buf0dump.cc
+++ b/storage/innobase/buf/buf0dump.cc
@@ -211,6 +211,8 @@ buf_dump(
buf_dump_t* dump;
ulint n_pages;
ulint j;
+ ulint limit;
+ ulint counter;
buf_pool = buf_pool_from_array(i);
@@ -254,6 +256,9 @@ buf_dump(
buf_pool_mutex_exit(buf_pool);
+ limit = (ulint)((double)n_pages * ((double)srv_buf_dump_status_frequency / (double)100));
+ counter = 0;
+
for (j = 0; j < n_pages && !SHOULD_QUIT(); j++) {
ret = fprintf(f, ULINTPF "," ULINTPF "\n",
BUF_DUMP_SPACE(dump[j]),
@@ -268,7 +273,14 @@ buf_dump(
return;
}
- if (j % 128 == 0) {
+ counter++;
+
+ /* Print buffer pool dump status only if
+ srv_buf_dump_status_frequency is > 0 and
+ we have processed that amount of pages. */
+ if (srv_buf_dump_status_frequency &&
+ counter == limit) {
+ counter = 0;
buf_dump_status(
STATUS_INFO,
"Dumping buffer pool "
@@ -578,8 +590,8 @@ DECLARE_THREAD(buf_dump_thread)(
srv_buf_dump_thread_active = TRUE;
- buf_dump_status(STATUS_INFO, "not started");
- buf_load_status(STATUS_INFO, "not started");
+ buf_dump_status(STATUS_INFO, "Dumping buffer pool(s) not yet started");
+ buf_load_status(STATUS_INFO, "Loading buffer pool(s) not yet started");
if (srv_buffer_pool_load_at_startup) {
buf_load();
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index d893d424b02..780230b38ba 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -1,8 +1,8 @@
/*****************************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2014, SkySQL Ab. All Rights Reserved.
-Copyright (c) 2013, 2014, Fusion-io. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates
+Copyright (c) 2013, 2015, MariaDB Corporation
+Copyright (c) 2013, 2014, Fusion-io
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -889,11 +889,11 @@ buf_flush_write_block_low(
break;
case BUF_BLOCK_ZIP_DIRTY:
frame = bpage->zip.data;
+ mach_write_to_8(frame + FIL_PAGE_LSN,
+ bpage->newest_modification);
ut_a(page_zip_verify_checksum(frame, zip_size));
- mach_write_to_8(frame + FIL_PAGE_LSN,
- bpage->newest_modification);
memset(frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, 0, 8);
break;
case BUF_BLOCK_FILE_PAGE:
diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc
index b4b474c547f..285fc465160 100644
--- a/storage/innobase/buf/buf0rea.cc
+++ b/storage/innobase/buf/buf0rea.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2015. MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -105,21 +106,22 @@ ulint
buf_read_page_low(
/*==============*/
dberr_t* err, /*!< out: DB_SUCCESS or DB_TABLESPACE_DELETED if we are
- trying to read from a non-existent tablespace, or a
- tablespace which is just now being dropped */
- bool sync, /*!< in: true if synchronous aio is desired */
- ulint mode, /*!< in: BUF_READ_IBUF_PAGES_ONLY, ...,
- ORed to OS_AIO_SIMULATED_WAKE_LATER (see below
- at read-ahead functions) */
- ulint space, /*!< in: space id */
- ulint zip_size,/*!< in: compressed page size, or 0 */
- ibool unzip, /*!< in: TRUE=request uncompressed page */
- ib_int64_t tablespace_version, /*!< in: if the space memory object has
- this timestamp different from what we are giving here,
- treat the tablespace as dropped; this is a timestamp we
- use to stop dangling page reads from a tablespace
- which we have DISCARDed + IMPORTed back */
- ulint offset) /*!< in: page number */
+ trying to read from a non-existent tablespace, or a
+ tablespace which is just now being dropped */
+ bool sync, /*!< in: true if synchronous aio is desired */
+ ulint mode, /*!< in: BUF_READ_IBUF_PAGES_ONLY, ...,
+ ORed to OS_AIO_SIMULATED_WAKE_LATER (see below
+ at read-ahead functions) */
+ ulint space, /*!< in: space id */
+ ulint zip_size,/*!< in: compressed page size, or 0 */
+ ibool unzip, /*!< in: TRUE=request uncompressed page */
+ ib_int64_t tablespace_version, /*!< in: if the space memory object has
+ this timestamp different from what we are giving here,
+ treat the tablespace as dropped; this is a timestamp we
+ use to stop dangling page reads from a tablespace
+ which we have DISCARDed + IMPORTed back */
+ ulint offset, /*!< in: page number */
+ buf_page_t** rbpage) /*!< out: page */
{
buf_page_t* bpage;
ulint wake_later;
@@ -214,10 +216,17 @@ buf_read_page_low(
/* The i/o is already completed when we arrive from
fil_read */
if (!buf_page_io_complete(bpage)) {
+ if (rbpage) {
+ *rbpage = bpage;
+ }
return(0);
}
}
+ if (rbpage) {
+ *rbpage = bpage;
+ }
+
return(1);
}
@@ -348,7 +357,7 @@ read_ahead:
&err, false,
ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
space, zip_size, FALSE,
- tablespace_version, i);
+ tablespace_version, i, NULL);
if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr);
fprintf(stderr,
@@ -398,7 +407,8 @@ buf_read_page(
/*==========*/
ulint space, /*!< in: space id */
ulint zip_size,/*!< in: compressed page size in bytes, or 0 */
- ulint offset) /*!< in: page number */
+ ulint offset, /*!< in: page number */
+ buf_page_t** bpage) /*!< out: page */
{
ib_int64_t tablespace_version;
ulint count;
@@ -411,7 +421,7 @@ buf_read_page(
count = buf_read_page_low(&err, true, BUF_READ_ANY_PAGE, space,
zip_size, FALSE,
- tablespace_version, offset);
+ tablespace_version, offset, bpage);
srv_stats.buf_pool_reads.add(count);
if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr);
@@ -459,7 +469,7 @@ buf_read_page_async(
| OS_AIO_SIMULATED_WAKE_LATER
| BUF_READ_IGNORE_NONEXISTENT_PAGES,
space, zip_size, FALSE,
- tablespace_version, offset);
+ tablespace_version, offset, NULL);
srv_stats.buf_pool_reads.add(count);
/* We do not increment number of I/O operations used for LRU policy
@@ -718,7 +728,7 @@ buf_read_ahead_linear(
count += buf_read_page_low(
&err, false,
ibuf_mode,
- space, zip_size, FALSE, tablespace_version, i);
+ space, zip_size, FALSE, tablespace_version, i, NULL);
if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr);
fprintf(stderr,
@@ -808,7 +818,7 @@ buf_read_ibuf_merge_pages(
buf_read_page_low(&err, sync && (i + 1 == n_stored),
BUF_READ_ANY_PAGE, space_ids[i],
zip_size, TRUE, space_versions[i],
- page_nos[i]);
+ page_nos[i], NULL);
if (UNIV_UNLIKELY(err == DB_TABLESPACE_DELETED)) {
tablespace_deleted:
@@ -903,12 +913,12 @@ buf_read_recv_pages(
if ((i + 1 == n_stored) && sync) {
buf_read_page_low(&err, true, BUF_READ_ANY_PAGE, space,
zip_size, TRUE, tablespace_version,
- page_nos[i]);
+ page_nos[i], NULL);
} else {
buf_read_page_low(&err, false, BUF_READ_ANY_PAGE
| OS_AIO_SIMULATED_WAKE_LATER,
space, zip_size, TRUE,
- tablespace_version, page_nos[i]);
+ tablespace_version, page_nos[i], NULL);
}
}
diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc
index 30523ff2af4..6ba9be07348 100644
--- a/storage/innobase/dict/dict0crea.cc
+++ b/storage/innobase/dict/dict0crea.cc
@@ -309,7 +309,8 @@ dict_build_table_def_step(
space, table->name, path,
dict_tf_to_fsp_flags(table->flags),
table->flags2,
- FIL_IBD_FILE_INITIAL_SIZE);
+ FIL_IBD_FILE_INITIAL_SIZE,
+ node->mode, node->key_id);
table->space = (unsigned int) space;
@@ -934,8 +935,10 @@ tab_create_graph_create(
dict_table_t* table, /*!< in: table to create, built as a memory data
structure */
mem_heap_t* heap, /*!< in: heap where created */
- bool commit) /*!< in: true if the commit node should be
+ bool commit, /*!< in: true if the commit node should be
added to the query graph */
+ fil_encryption_t mode, /*!< in: encryption mode */
+ ulint key_id) /*!< in: encryption key_id */
{
tab_node_t* node;
@@ -948,6 +951,8 @@ tab_create_graph_create(
node->state = TABLE_BUILD_TABLE_DEF;
node->heap = mem_heap_create(256);
+ node->mode = mode;
+ node->key_id = key_id;
node->tab_def = ins_node_create(INS_DIRECT, dict_sys->sys_tables,
heap);
@@ -1042,7 +1047,6 @@ dict_create_table_step(
/* DO THE CHECKS OF THE CONSISTENCY CONSTRAINTS HERE */
err = dict_build_table_def_step(thr, node);
-
if (err != DB_SUCCESS) {
goto function_exit;
@@ -1562,12 +1566,111 @@ dict_create_add_foreign_field_to_dictionary(
}
/********************************************************************//**
+Construct foreign key constraint defintion from data dictionary information.
+*/
+UNIV_INTERN
+char*
+dict_foreign_def_get(
+/*=================*/
+ dict_foreign_t* foreign,/*!< in: foreign */
+ trx_t* trx) /*!< in: trx */
+{
+ char* fk_def = (char *)mem_heap_alloc(foreign->heap, 4*1024);
+ const char* tbname;
+ char tablebuf[MAX_TABLE_NAME_LEN + 1] = "";
+ int i;
+ char* bufend;
+
+ tbname = dict_remove_db_name(foreign->id);
+ bufend = innobase_convert_name(tablebuf, MAX_TABLE_NAME_LEN,
+ tbname, strlen(tbname), trx->mysql_thd, FALSE);
+ tablebuf[bufend - tablebuf] = '\0';
+
+ sprintf(fk_def,
+ (char *)"CONSTRAINT %s FOREIGN KEY (", (char *)tablebuf);
+
+ for(i = 0; i < foreign->n_fields; i++) {
+ char buf[MAX_TABLE_NAME_LEN + 1] = "";
+ innobase_convert_name(buf, MAX_TABLE_NAME_LEN,
+ foreign->foreign_col_names[i],
+ strlen(foreign->foreign_col_names[i]),
+ trx->mysql_thd, FALSE);
+ strcat(fk_def, buf);
+ if (i < foreign->n_fields-1) {
+ strcat(fk_def, (char *)",");
+ }
+ }
+
+ strcat(fk_def,(char *)") REFERENCES ");
+
+ bufend = innobase_convert_name(tablebuf, MAX_TABLE_NAME_LEN,
+ foreign->referenced_table_name,
+ strlen(foreign->referenced_table_name),
+ trx->mysql_thd, TRUE);
+ tablebuf[bufend - tablebuf] = '\0';
+
+ strcat(fk_def, tablebuf);
+ strcat(fk_def, " (");
+
+ for(i = 0; i < foreign->n_fields; i++) {
+ char buf[MAX_TABLE_NAME_LEN + 1] = "";
+ bufend = innobase_convert_name(buf, MAX_TABLE_NAME_LEN,
+ foreign->referenced_col_names[i],
+ strlen(foreign->referenced_col_names[i]),
+ trx->mysql_thd, FALSE);
+ buf[bufend - buf] = '\0';
+ strcat(fk_def, buf);
+ if (i < foreign->n_fields-1) {
+ strcat(fk_def, (char *)",");
+ }
+ }
+ strcat(fk_def, (char *)")");
+
+ return fk_def;
+}
+
+/********************************************************************//**
+Convert foreign key column names from data dictionary to SQL-layer.
+*/
+static
+void
+dict_foreign_def_get_fields(
+/*========================*/
+ dict_foreign_t* foreign,/*!< in: foreign */
+ trx_t* trx, /*!< in: trx */
+ char** field, /*!< out: foreign column */
+ char** field2, /*!< out: referenced column */
+ int col_no) /*!< in: column number */
+{
+ char* bufend;
+ char* fieldbuf = (char *)mem_heap_alloc(foreign->heap, MAX_TABLE_NAME_LEN+1);
+ char* fieldbuf2 = (char *)mem_heap_alloc(foreign->heap, MAX_TABLE_NAME_LEN+1);
+
+ bufend = innobase_convert_name(fieldbuf, MAX_TABLE_NAME_LEN,
+ foreign->foreign_col_names[col_no],
+ strlen(foreign->foreign_col_names[col_no]),
+ trx->mysql_thd, FALSE);
+
+ fieldbuf[bufend - fieldbuf] = '\0';
+
+ bufend = innobase_convert_name(fieldbuf2, MAX_TABLE_NAME_LEN,
+ foreign->referenced_col_names[col_no],
+ strlen(foreign->referenced_col_names[col_no]),
+ trx->mysql_thd, FALSE);
+
+ fieldbuf2[bufend - fieldbuf2] = '\0';
+ *field = fieldbuf;
+ *field2 = fieldbuf2;
+}
+
+/********************************************************************//**
Add a foreign key definition to the data dictionary tables.
@return error code or DB_SUCCESS */
UNIV_INTERN
dberr_t
dict_create_add_foreign_to_dictionary(
/*==================================*/
+ dict_table_t* table, /*!< in: table */
const char* name, /*!< in: table name */
const dict_foreign_t* foreign,/*!< in: foreign key */
trx_t* trx) /*!< in/out: dictionary transaction */
@@ -1595,6 +1698,29 @@ dict_create_add_foreign_to_dictionary(
if (error != DB_SUCCESS) {
+ if (error == DB_DUPLICATE_KEY) {
+ char buf[MAX_TABLE_NAME_LEN + 1] = "";
+ char tablename[MAX_TABLE_NAME_LEN + 1] = "";
+ char* fk_def;
+
+ innobase_convert_name(tablename, MAX_TABLE_NAME_LEN,
+ table->name, strlen(table->name),
+ trx->mysql_thd, TRUE);
+
+ innobase_convert_name(buf, MAX_TABLE_NAME_LEN,
+ foreign->id, strlen(foreign->id), trx->mysql_thd, FALSE);
+
+ fk_def = dict_foreign_def_get((dict_foreign_t*)foreign, trx);
+
+ ib_push_warning(trx, error,
+ "Create or Alter table %s with foreign key constraint"
+ " failed. Foreign key constraint %s"
+ " already exists on data dictionary."
+ " Foreign key constraint names need to be unique in database."
+ " Error in foreign key definition: %s.",
+ tablename, buf, fk_def);
+ }
+
return(error);
}
@@ -1603,6 +1729,26 @@ dict_create_add_foreign_to_dictionary(
i, name, foreign, trx);
if (error != DB_SUCCESS) {
+ char buf[MAX_TABLE_NAME_LEN + 1] = "";
+ char tablename[MAX_TABLE_NAME_LEN + 1] = "";
+ char* field=NULL;
+ char* field2=NULL;
+ char* fk_def;
+
+ innobase_convert_name(tablename, MAX_TABLE_NAME_LEN,
+ table->name, strlen(table->name),
+ trx->mysql_thd, TRUE);
+ innobase_convert_name(buf, MAX_TABLE_NAME_LEN,
+ foreign->id, strlen(foreign->id), trx->mysql_thd, FALSE);
+ fk_def = dict_foreign_def_get((dict_foreign_t*)foreign, trx);
+ dict_foreign_def_get_fields((dict_foreign_t*)foreign, trx, &field, &field2, i);
+
+ ib_push_warning(trx, error,
+ "Create or Alter table %s with foreign key constraint"
+ " failed. Error adding foreign key constraint name %s"
+ " fields %s or %s to the dictionary."
+ " Error in foreign key definition: %s.",
+ tablename, buf, i+1, fk_def);
return(error);
}
@@ -1649,7 +1795,7 @@ dict_create_add_foreigns_to_dictionary(
foreign = *it;
ut_ad(foreign->id != NULL);
- error = dict_create_add_foreign_to_dictionary(table->name,
+ error = dict_create_add_foreign_to_dictionary((dict_table_t*)table, table->name,
foreign, trx);
if (error != DB_SUCCESS) {
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 48053a954cf..b8c8cc690aa 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -1151,8 +1151,28 @@ dict_table_open_on_name(
if (table != NULL) {
- /* If table is corrupted, return NULL */
+ /* If table is encrypted return table */
if (ignore_err == DICT_ERR_IGNORE_NONE
+ && table->is_encrypted) {
+ /* Make life easy for drop table. */
+ if (table->can_be_evicted) {
+ dict_table_move_from_lru_to_non_lru(table);
+ }
+
+ if (table->can_be_evicted) {
+ dict_move_to_mru(table);
+ }
+
+ ++table->n_ref_count;
+
+ if (!dict_locked) {
+ mutex_exit(&dict_sys->mutex);
+ }
+
+ return (table);
+ }
+ /* If table is corrupted, return NULL */
+ else if (ignore_err == DICT_ERR_IGNORE_NONE
&& table->corrupted) {
/* Make life easy for drop table. */
@@ -3276,6 +3296,11 @@ dict_index_build_internal_fts(
}
/*====================== FOREIGN KEY PROCESSING ========================*/
+#define DB_FOREIGN_KEY_IS_PREFIX_INDEX 200
+#define DB_FOREIGN_KEY_COL_NOT_NULL 201
+#define DB_FOREIGN_KEY_COLS_NOT_EQUAL 202
+#define DB_FOREIGN_KEY_INDEX_NOT_FOUND 203
+
/*********************************************************************//**
Checks if a table is referenced by foreign keys.
@return TRUE if table is referenced by a foreign key */
@@ -3288,71 +3313,6 @@ dict_table_is_referenced_by_foreign_key(
return(!table->referenced_set.empty());
}
-/*********************************************************************//**
-Check if the index is referenced by a foreign key, if TRUE return foreign
-else return NULL
-@return pointer to foreign key struct if index is defined for foreign
-key, otherwise NULL */
-UNIV_INTERN
-dict_foreign_t*
-dict_table_get_referenced_constraint(
-/*=================================*/
- dict_table_t* table, /*!< in: InnoDB table */
- dict_index_t* index) /*!< in: InnoDB index */
-{
- dict_foreign_t* foreign;
-
- ut_ad(index != NULL);
- ut_ad(table != NULL);
-
- for (dict_foreign_set::iterator it = table->referenced_set.begin();
- it != table->referenced_set.end();
- ++it) {
-
- foreign = *it;
-
- if (foreign->referenced_index == index) {
-
- return(foreign);
- }
- }
-
- return(NULL);
-}
-
-/*********************************************************************//**
-Checks if a index is defined for a foreign key constraint. Index is a part
-of a foreign key constraint if the index is referenced by foreign key
-or index is a foreign key index.
-@return pointer to foreign key struct if index is defined for foreign
-key, otherwise NULL */
-UNIV_INTERN
-dict_foreign_t*
-dict_table_get_foreign_constraint(
-/*==============================*/
- dict_table_t* table, /*!< in: InnoDB table */
- dict_index_t* index) /*!< in: InnoDB index */
-{
- dict_foreign_t* foreign;
-
- ut_ad(index != NULL);
- ut_ad(table != NULL);
-
- for (dict_foreign_set::iterator it = table->foreign_set.begin();
- it != table->foreign_set.end();
- ++it) {
-
- foreign = *it;
-
- if (foreign->foreign_index == index) {
-
- return(foreign);
- }
- }
-
- return(NULL);
-}
-
/**********************************************************************//**
Removes a foreign constraint struct from the dictionary cache. */
UNIV_INTERN
@@ -3430,15 +3390,26 @@ dict_foreign_find_index(
/*!< in: whether to check
charsets. only has an effect
if types_idx != NULL */
- ulint check_null)
+ ulint check_null,
/*!< in: nonzero if none of
the columns must be declared
NOT NULL */
+ ulint* error, /*!< out: error code */
+ ulint* err_col_no,
+ /*!< out: column number where
+ error happened */
+ dict_index_t** err_index)
+ /*!< out: index where error
+ happened */
{
dict_index_t* index;
ut_ad(mutex_own(&dict_sys->mutex));
+ if (error) {
+ *error = DB_FOREIGN_KEY_INDEX_NOT_FOUND;
+ }
+
index = dict_table_get_first_index(table);
while (index != NULL) {
@@ -3448,7 +3419,12 @@ dict_foreign_find_index(
&& dict_foreign_qualify_index(
table, col_names, columns, n_cols,
index, types_idx,
- check_charsets, check_null)) {
+ check_charsets, check_null,
+ error, err_col_no,err_index)) {
+ if (error) {
+ *error = DB_SUCCESS;
+ }
+
return(index);
}
@@ -3477,7 +3453,7 @@ wsrep_dict_foreign_find_index(
{
return dict_foreign_find_index(
table, col_names, columns, n_cols, types_idx, check_charsets,
- check_null);
+ check_null, NULL, NULL, NULL);
}
#endif /* WITH_WSREP */
/**********************************************************************//**
@@ -3575,11 +3551,15 @@ dict_foreign_add_to_cache(
}
if (ref_table && !for_in_cache->referenced_table) {
+ ulint index_error;
+ ulint err_col;
+ dict_index_t *err_index=NULL;
+
index = dict_foreign_find_index(
ref_table, NULL,
for_in_cache->referenced_col_names,
for_in_cache->n_fields, for_in_cache->foreign_index,
- check_charsets, false);
+ check_charsets, false, &index_error, &err_col, &err_index);
if (index == NULL
&& !(ignore_err & DICT_ERR_IGNORE_FK_NOKEY)) {
@@ -3611,6 +3591,10 @@ dict_foreign_add_to_cache(
}
if (for_table && !for_in_cache->foreign_table) {
+ ulint index_error;
+ ulint err_col;
+ dict_index_t *err_index=NULL;
+
index = dict_foreign_find_index(
for_table, col_names,
for_in_cache->foreign_col_names,
@@ -3618,7 +3602,8 @@ dict_foreign_add_to_cache(
for_in_cache->referenced_index, check_charsets,
for_in_cache->type
& (DICT_FOREIGN_ON_DELETE_SET_NULL
- | DICT_FOREIGN_ON_UPDATE_SET_NULL));
+ | DICT_FOREIGN_ON_UPDATE_SET_NULL),
+ &index_error, &err_col, &err_index);
if (index == NULL
&& !(ignore_err & DICT_ERR_IGNORE_FK_NOKEY)) {
@@ -4278,6 +4263,8 @@ static
void
dict_foreign_report_syntax_err(
/*===========================*/
+ const char* fmt, /*!< in: syntax err msg */
+ const char* oper, /*!< in: operation */
const char* name, /*!< in: table name */
const char* start_of_latest_foreign,
/*!< in: start of the foreign key clause
@@ -4290,12 +4277,102 @@ dict_foreign_report_syntax_err(
mutex_enter(&dict_foreign_err_mutex);
dict_foreign_error_report_low(ef, name);
- fprintf(ef, "%s:\nSyntax error close to:\n%s\n",
- start_of_latest_foreign, ptr);
+ fprintf(ef, fmt, oper, name, start_of_latest_foreign, ptr);
mutex_exit(&dict_foreign_err_mutex);
}
/*********************************************************************//**
+Push warning message to SQL-layer based on foreign key constraint
+index match error. */
+static
+void
+dict_foreign_push_index_error(
+/*==========================*/
+ trx_t* trx, /*!< in: trx */
+ const char* operation, /*!< in: operation create or alter
+ */
+ const char* create_name, /*!< in: table name in create or
+ alter table */
+ const char* latest_foreign, /*!< in: start of latest foreign key
+ constraint name */
+ const char** columns, /*!< in: foreign key columns */
+ ulint index_error, /*!< in: error code */
+ ulint err_col, /*!< in: column where error happened
+ */
+ dict_index_t* err_index, /*!< in: index where error happened
+ */
+ dict_table_t* table, /*!< in: table */
+ FILE* ef) /*!< in: output stream */
+{
+ switch (index_error) {
+ case DB_FOREIGN_KEY_INDEX_NOT_FOUND: {
+ fprintf(ef,
+ "%s table '%s' with foreign key constraint"
+ " failed. There is no index in the referenced"
+ " table where the referenced columns appear"
+ " as the first columns. Error close to %s.\n",
+ operation, create_name, latest_foreign);
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table '%s' with foreign key constraint"
+ " failed. There is no index in the referenced"
+ " table where the referenced columns appear"
+ " as the first columns. Error close to %s.",
+ operation, create_name, latest_foreign);
+ break;
+ }
+ case DB_FOREIGN_KEY_IS_PREFIX_INDEX: {
+ fprintf(ef,
+ "%s table '%s' with foreign key constraint"
+ " failed. There is only prefix index in the referenced"
+ " table where the referenced columns appear"
+ " as the first columns. Error close to %s.\n",
+ operation, create_name, latest_foreign);
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table '%s' with foreign key constraint"
+ " failed. There is only prefix index in the referenced"
+ " table where the referenced columns appear"
+ " as the first columns. Error close to %s.",
+ operation, create_name, latest_foreign);
+ break;
+ }
+ case DB_FOREIGN_KEY_COL_NOT_NULL: {
+ fprintf(ef,
+ "%s table %s with foreign key constraint"
+ " failed. You have defined a SET NULL condition but "
+ "field %s on index is defined as NOT NULL close to %s\n",
+ operation, create_name, columns[err_col], latest_foreign);
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. You have defined a SET NULL condition but "
+ "field %s on index is defined as NOT NULL close to %s",
+ operation, create_name, columns[err_col], latest_foreign);
+ break;
+ }
+ case DB_FOREIGN_KEY_COLS_NOT_EQUAL: {
+ dict_field_t* field;
+ const char* col_name;
+ field = dict_index_get_nth_field(err_index, err_col);
+
+ col_name = dict_table_get_col_name(
+ table, dict_col_get_no(field->col));
+ fprintf(ef,
+ "%s table %s with foreign key constraint"
+ " failed. Field type or character set for column %s "
+ "does not mach referenced column %s close to %s\n",
+ operation, create_name, columns[err_col], col_name, latest_foreign);
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Field type or character set for column %s "
+ "does not mach referenced column %s close to %s",
+ operation, create_name, columns[err_col], col_name, latest_foreign);
+ break;
+ }
+ default:
+ ut_error;
+ }
+}
+
+/*********************************************************************//**
Scans a table create SQL string and adds to the data dictionary the foreign
key constraints declared in the string. This function should be called after
the indexes for a table have been created. Each foreign key constraint must
@@ -4323,16 +4400,21 @@ dict_create_foreign_constraints_low(
DB_CANNOT_ADD_CONSTRAINT if any foreign
keys are found. */
{
- dict_table_t* table;
- dict_table_t* referenced_table;
- dict_table_t* table_to_alter;
+ dict_table_t* table = NULL;
+ dict_table_t* referenced_table = NULL;
+ dict_table_t* table_to_alter = NULL;
+ dict_table_t* table_to_create = NULL;
ulint highest_id_so_far = 0;
ulint number = 1;
- dict_index_t* index;
- dict_foreign_t* foreign;
+ dict_index_t* index = NULL;
+ dict_foreign_t* foreign = NULL;
const char* ptr = sql_string;
const char* start_of_latest_foreign = sql_string;
+ const char* start_of_latest_set = NULL;
FILE* ef = dict_foreign_err_file;
+ ulint index_error = DB_SUCCESS;
+ dict_index_t* err_index = NULL;
+ ulint err_col;
const char* constraint_name;
ibool success;
dberr_t error;
@@ -4345,37 +4427,80 @@ dict_create_foreign_constraints_low(
ulint n_on_updates;
const dict_col_t*columns[500];
const char* column_names[500];
+ const char* ref_column_names[500];
const char* referenced_table_name;
dict_foreign_set local_fk_set;
dict_foreign_set_free local_fk_set_free(local_fk_set);
+ const char* create_table_name;
+ const char* orig;
+ char create_name[MAX_TABLE_NAME_LEN + 1];
+ char operation[8];
ut_ad(!srv_read_only_mode);
ut_ad(mutex_own(&(dict_sys->mutex)));
table = dict_table_get_low(name);
+ /* First check if we are actually doing an ALTER TABLE, and in that
+ case look for the table being altered */
+ orig = ptr;
+ ptr = dict_accept(cs, ptr, "ALTER", &success);
+
+ strcpy((char *)operation, success ? "Alter " : "Create ");
+
+ if (!success) {
+ orig = ptr;
+ ptr = dict_scan_to(ptr, "CREATE");
+ ptr = dict_scan_to(ptr, "TABLE");
+ ptr = dict_accept(cs, ptr, "TABLE", &success);
+
+ if (success) {
+ ptr = dict_scan_table_name(cs, ptr, &table_to_create, name,
+ &success, heap, &create_table_name);
+ }
+
+ if (success) {
+ char *bufend;
+ bufend = innobase_convert_name((char *)create_name, MAX_TABLE_NAME_LEN,
+ create_table_name, strlen(create_table_name),
+ trx->mysql_thd, TRUE);
+ create_name[bufend-create_name]='\0';
+ ptr = orig;
+ } else {
+ char *bufend;
+ ptr = orig;
+ bufend = innobase_convert_name((char *)create_name, MAX_TABLE_NAME_LEN,
+ name, strlen(name), trx->mysql_thd, TRUE);
+ create_name[bufend-create_name]='\0';
+ }
+
+ goto loop;
+ }
if (table == NULL) {
mutex_enter(&dict_foreign_err_mutex);
- dict_foreign_error_report_low(ef, name);
- fprintf(ef,
- "Cannot find the table in the internal"
- " data dictionary of InnoDB.\n"
- "Create table statement:\n%s\n", sql_string);
+ dict_foreign_error_report_low(ef, create_name);
+ dict_foreign_error_report_low(ef, create_name);
+ fprintf(ef, "%s table %s with foreign key constraint"
+ " failed. Table %s not found from data dictionary."
+ " Error close to %s.\n",
+ operation, create_name, create_name, start_of_latest_foreign);
mutex_exit(&dict_foreign_err_mutex);
+ ib_push_warning(trx, DB_ERROR,
+ "%s table %s with foreign key constraint"
+ " failed. Table %s not found from data dictionary."
+ " Error close to %s.",
+ operation, create_name, create_name, start_of_latest_foreign);
return(DB_ERROR);
}
- /* First check if we are actually doing an ALTER TABLE, and in that
- case look for the table being altered */
-
- ptr = dict_accept(cs, ptr, "ALTER", &success);
-
+ /* If not alter table jump to loop */
if (!success) {
goto loop;
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, "TABLE", &success);
if (!success) {
@@ -4385,13 +4510,40 @@ dict_create_foreign_constraints_low(
/* We are doing an ALTER TABLE: scan the table name we are altering */
+ orig = ptr;
ptr = dict_scan_table_name(cs, ptr, &table_to_alter, name,
&success, heap, &referenced_table_name);
+
+ if (table_to_alter) {
+ char *bufend;
+ bufend = innobase_convert_name((char *)create_name, MAX_TABLE_NAME_LEN,
+ table_to_alter->name, strlen(table_to_alter->name),
+ trx->mysql_thd, TRUE);
+ create_name[bufend-create_name]='\0';
+ } else {
+ char *bufend;
+ bufend = innobase_convert_name((char *)create_name, MAX_TABLE_NAME_LEN,
+ referenced_table_name, strlen(referenced_table_name),
+ trx->mysql_thd, TRUE);
+ create_name[bufend-create_name]='\0';
+
+ }
+
if (!success) {
- fprintf(stderr,
- "InnoDB: Error: could not find"
- " the table being ALTERED in:\n%s\n",
- sql_string);
+ mutex_enter(&dict_foreign_err_mutex);
+ dict_foreign_error_report_low(ef, create_name);
+ fprintf(ef,
+ "%s table %s with foreign key constraint"
+ " failed. Table %s not found from data dictionary."
+ " Error close to %s.\n",
+ operation, create_name, create_name, orig);
+ mutex_exit(&dict_foreign_err_mutex);
+
+ ib_push_warning(trx, DB_ERROR,
+ "%s table %s with foreign key constraint"
+ " failed. Table %s not found from data dictionary."
+ " Error close to %s.",
+ operation, create_name, create_name, orig);
return(DB_ERROR);
}
@@ -4428,6 +4580,7 @@ loop:
of the constraint to system tables. */
ptr = ptr1;
+ orig = ptr;
ptr = dict_accept(cs, ptr, "CONSTRAINT", &success);
ut_a(success);
@@ -4458,6 +4611,19 @@ loop:
if so, immediately reject the command if the table is a
temporary one. For now, this kludge will work. */
if (reject_fks && !local_fk_set.empty()) {
+ mutex_enter(&dict_foreign_err_mutex);
+ dict_foreign_error_report_low(ef, create_name);
+ fprintf(ef, "%s table %s with foreign key constraint"
+ " failed. Temporary tables can't have foreign key constraints."
+ " Error close to %s.\n",
+ operation, create_name, start_of_latest_foreign);
+ mutex_exit(&dict_foreign_err_mutex);
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Temporary tables can't have foreign key constraints."
+ " Error close to %s.",
+ operation, create_name, start_of_latest_foreign);
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -4483,6 +4649,7 @@ loop:
start_of_latest_foreign = ptr;
+ orig = ptr;
ptr = dict_accept(cs, ptr, "FOREIGN", &success);
if (!success) {
@@ -4493,6 +4660,7 @@ loop:
goto loop;
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, "KEY", &success);
if (!success) {
@@ -4518,6 +4686,7 @@ loop:
}
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, "(", &success);
if (!success) {
@@ -4527,8 +4696,17 @@ loop:
ptr = dict_skip_word(cs, ptr, &success);
if (!success) {
dict_foreign_report_syntax_err(
- name, start_of_latest_foreign, ptr);
- return(DB_CANNOT_ADD_CONSTRAINT);
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.\n",
+ operation, create_name, start_of_latest_foreign, orig);
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.",
+ operation, create_name, start_of_latest_foreign, orig);
+ return(DB_CANNOT_ADD_CONSTRAINT);
}
}
else {
@@ -4555,15 +4733,26 @@ loop:
/* Scan the columns in the first list */
col_loop1:
ut_a(i < (sizeof column_names) / sizeof *column_names);
+ orig = ptr;
ptr = dict_scan_col(cs, ptr, &success, table, columns + i,
heap, column_names + i);
if (!success) {
mutex_enter(&dict_foreign_err_mutex);
- dict_foreign_error_report_low(ef, name);
- fprintf(ef, "%s:\nCannot resolve column name close to:\n%s\n",
- start_of_latest_foreign, ptr);
+ dict_foreign_error_report_low(ef, create_name);
+ fprintf(ef,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.\n",
+ operation, create_name, start_of_latest_foreign, orig);
+
mutex_exit(&dict_foreign_err_mutex);
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.",
+ operation, create_name, start_of_latest_foreign, orig);
+
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -4575,11 +4764,22 @@ col_loop1:
goto col_loop1;
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, ")", &success);
if (!success) {
dict_foreign_report_syntax_err(
- name, start_of_latest_foreign, ptr);
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.\n",
+ operation, create_name, start_of_latest_foreign, orig);
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.",
+ operation, create_name, start_of_latest_foreign, orig);
+
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -4590,27 +4790,41 @@ col_loop1:
set to 0 */
index = dict_foreign_find_index(
- table, NULL, column_names, i, NULL, TRUE, FALSE);
+ table, NULL, column_names, i,
+ NULL, TRUE, FALSE, &index_error, &err_col, &err_index);
if (!index) {
mutex_enter(&dict_foreign_err_mutex);
- dict_foreign_error_report_low(ef, name);
+ dict_foreign_error_report_low(ef, create_name);
fputs("There is no index in table ", ef);
- ut_print_name(ef, NULL, TRUE, name);
+ ut_print_name(ef, NULL, TRUE, create_name);
fprintf(ef, " where the columns appear\n"
"as the first columns. Constraint:\n%s\n"
"See " REFMAN "innodb-foreign-key-constraints.html\n"
"for correct foreign key definition.\n",
start_of_latest_foreign);
- mutex_exit(&dict_foreign_err_mutex);
+ dict_foreign_push_index_error(trx, operation, create_name, start_of_latest_foreign,
+ column_names, index_error, err_col, err_index, table, ef);
- return(DB_CHILD_NO_INDEX);
+ mutex_exit(&dict_foreign_err_mutex);
+ return(DB_CANNOT_ADD_CONSTRAINT);
}
+
+ orig = ptr;
ptr = dict_accept(cs, ptr, "REFERENCES", &success);
if (!success || !my_isspace(cs, *ptr)) {
dict_foreign_report_syntax_err(
- name, start_of_latest_foreign, ptr);
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.\n",
+ operation, create_name, start_of_latest_foreign, orig);
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.",
+ operation, create_name, start_of_latest_foreign, orig);
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -4679,21 +4893,46 @@ col_loop1:
checking of foreign key constraints! */
if (!success || (!referenced_table && trx->check_foreigns)) {
+ char buf[MAX_TABLE_NAME_LEN + 1] = "";
+ char* bufend;
+
+ bufend = innobase_convert_name(buf, MAX_TABLE_NAME_LEN,
+ referenced_table_name, strlen(referenced_table_name),
+ trx->mysql_thd, TRUE);
+ buf[bufend - buf] = '\0';
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint failed. Referenced table %s not found in the data dictionary "
+ "close to %s.",
+ operation, create_name, buf, start_of_latest_foreign);
mutex_enter(&dict_foreign_err_mutex);
- dict_foreign_error_report_low(ef, name);
- fprintf(ef, "%s:\nCannot resolve table name close to:\n"
- "%s\n",
- start_of_latest_foreign, ptr);
+ dict_foreign_error_report_low(ef, create_name);
+ fprintf(ef,
+ "%s table %s with foreign key constraint failed. Referenced table %s not found in the data dictionary "
+ "close to %s.\n",
+ operation, create_name, buf, start_of_latest_foreign);
+
mutex_exit(&dict_foreign_err_mutex);
return(DB_CANNOT_ADD_CONSTRAINT);
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, "(", &success);
if (!success) {
- dict_foreign_report_syntax_err(name, start_of_latest_foreign,
- ptr);
+ dict_foreign_report_syntax_err(
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.\n",
+ operation, create_name, start_of_latest_foreign, orig);
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.",
+ operation, create_name, start_of_latest_foreign, orig);
+
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -4701,34 +4940,54 @@ col_loop1:
i = 0;
col_loop2:
+ orig = ptr;
ptr = dict_scan_col(cs, ptr, &success, referenced_table, columns + i,
- heap, column_names + i);
+ heap, ref_column_names + i);
i++;
if (!success) {
mutex_enter(&dict_foreign_err_mutex);
- dict_foreign_error_report_low(ef, name);
- fprintf(ef, "%s:\nCannot resolve column name close to:\n"
- "%s\n",
- start_of_latest_foreign, ptr);
+ dict_foreign_error_report_low(ef, create_name);
+ fprintf(ef,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.\n",
+ operation, create_name, start_of_latest_foreign, orig);
mutex_exit(&dict_foreign_err_mutex);
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.",
+ operation, create_name, start_of_latest_foreign, orig);
return(DB_CANNOT_ADD_CONSTRAINT);
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, ",", &success);
if (success) {
goto col_loop2;
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, ")", &success);
if (!success || foreign->n_fields != i) {
- dict_foreign_report_syntax_err(name, start_of_latest_foreign,
- ptr);
+ dict_foreign_report_syntax_err(
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s. Too few referenced columns.\n",
+ operation, create_name, start_of_latest_foreign, orig);
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s. Too few referenced columns, you have %d when you should have %d.",
+ operation, create_name, start_of_latest_foreign, orig, i, foreign->n_fields);
+
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -4738,6 +4997,7 @@ col_loop2:
scan_on_conditions:
/* Loop here as long as we can find ON ... conditions */
+ start_of_latest_set = ptr;
ptr = dict_accept(cs, ptr, "ON", &success);
if (!success) {
@@ -4745,15 +5005,27 @@ scan_on_conditions:
goto try_find_index;
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, "DELETE", &success);
if (!success) {
+ orig = ptr;
ptr = dict_accept(cs, ptr, "UPDATE", &success);
if (!success) {
dict_foreign_report_syntax_err(
- name, start_of_latest_foreign, ptr);
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.\n",
+ operation, create_name, start_of_latest_foreign, start_of_latest_set);
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.",
+ operation, create_name, start_of_latest_foreign, start_of_latest_set);
+
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -4764,12 +5036,14 @@ scan_on_conditions:
n_on_deletes++;
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, "RESTRICT", &success);
if (success) {
goto scan_on_conditions;
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, "CASCADE", &success);
if (success) {
@@ -4782,14 +5056,25 @@ scan_on_conditions:
goto scan_on_conditions;
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, "NO", &success);
if (success) {
+ orig = ptr;
ptr = dict_accept(cs, ptr, "ACTION", &success);
if (!success) {
dict_foreign_report_syntax_err(
- name, start_of_latest_foreign, ptr);
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.\n",
+ operation, create_name, start_of_latest_foreign, start_of_latest_set);
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.",
+ operation, create_name, start_of_latest_foreign, start_of_latest_set);
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -4803,38 +5088,69 @@ scan_on_conditions:
goto scan_on_conditions;
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, "SET", &success);
if (!success) {
- dict_foreign_report_syntax_err(name, start_of_latest_foreign,
- ptr);
+ dict_foreign_report_syntax_err(
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.\n",
+ operation, create_name, start_of_latest_foreign, start_of_latest_set);
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.",
+ operation, create_name, start_of_latest_foreign, start_of_latest_set);
return(DB_CANNOT_ADD_CONSTRAINT);
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, "NULL", &success);
if (!success) {
- dict_foreign_report_syntax_err(name, start_of_latest_foreign,
- ptr);
+ dict_foreign_report_syntax_err(
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.\n",
+ operation, create_name, start_of_latest_foreign, start_of_latest_set);
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.",
+ operation, create_name, start_of_latest_foreign, start_of_latest_set);
+
return(DB_CANNOT_ADD_CONSTRAINT);
}
for (j = 0; j < foreign->n_fields; j++) {
if ((dict_index_get_nth_col(foreign->foreign_index, j)->prtype)
& DATA_NOT_NULL) {
+ const dict_col_t* col
+ = dict_index_get_nth_col(foreign->foreign_index, j);
+ const char* col_name = dict_table_get_col_name(foreign->foreign_index->table,
+ dict_col_get_no(col));
/* It is not sensible to define SET NULL
if the column is not allowed to be NULL! */
mutex_enter(&dict_foreign_err_mutex);
- dict_foreign_error_report_low(ef, name);
- fprintf(ef, "%s:\n"
- "You have defined a SET NULL condition"
- " though some of the\n"
- "columns are defined as NOT NULL.\n",
- start_of_latest_foreign);
+ dict_foreign_error_report_low(ef, create_name);
+ fprintf(ef,
+ "%s table %s with foreign key constraint"
+ " failed. You have defined a SET NULL condition but column %s is defined as NOT NULL"
+ " in %s close to %s.\n",
+ operation, create_name, col_name, start_of_latest_foreign, start_of_latest_set);
mutex_exit(&dict_foreign_err_mutex);
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. You have defined a SET NULL condition but column %s is defined as NOT NULL"
+ " in %s close to %s.",
+ operation, create_name, col_name, start_of_latest_foreign, start_of_latest_set);
+
return(DB_CANNOT_ADD_CONSTRAINT);
}
}
@@ -4852,11 +5168,20 @@ try_find_index:
/* It is an error to define more than 1 action */
mutex_enter(&dict_foreign_err_mutex);
- dict_foreign_error_report_low(ef, name);
- fprintf(ef, "%s:\n"
- "You have twice an ON DELETE clause"
- " or twice an ON UPDATE clause.\n",
- start_of_latest_foreign);
+ dict_foreign_error_report_low(ef, create_name);
+ fprintf(ef,
+ "%s table %s with foreign key constraint"
+ " failed. You have more than one on delete or on update clause"
+ " in %s close to %s.\n",
+ operation, create_name, start_of_latest_foreign, start_of_latest_set);
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. You have more than one on delete or on update clause"
+ " in %s close to %s.",
+ operation, create_name, start_of_latest_foreign, start_of_latest_set);
+
+ dict_foreign_free(foreign);
mutex_exit(&dict_foreign_err_mutex);
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4868,12 +5193,12 @@ try_find_index:
if (referenced_table) {
index = dict_foreign_find_index(referenced_table, NULL,
- column_names, i,
+ ref_column_names, i,
foreign->foreign_index,
- TRUE, FALSE);
+ TRUE, FALSE, &index_error, &err_col, &err_index);
if (!index) {
mutex_enter(&dict_foreign_err_mutex);
- dict_foreign_error_report_low(ef, name);
+ dict_foreign_error_report_low(ef, create_name);
fprintf(ef, "%s:\n"
"Cannot find an index in the"
" referenced table where the\n"
@@ -4891,9 +5216,13 @@ try_find_index:
"innodb-foreign-key-constraints.html\n"
"for correct foreign key definition.\n",
start_of_latest_foreign);
+
+ dict_foreign_push_index_error(trx, operation, create_name, start_of_latest_foreign,
+ column_names, index_error, err_col, err_index, referenced_table, ef);
+
mutex_exit(&dict_foreign_err_mutex);
- return(DB_PARENT_NO_INDEX);
+ return(DB_CANNOT_ADD_CONSTRAINT);
}
} else {
ut_a(trx->check_foreigns == FALSE);
@@ -4912,11 +5241,12 @@ try_find_index:
for (i = 0; i < foreign->n_fields; i++) {
foreign->referenced_col_names[i]
- = mem_heap_strdup(foreign->heap, column_names[i]);
+ = mem_heap_strdup(foreign->heap, ref_column_names[i]);
}
goto loop;
}
+
/**************************************************************************
Determines whether a string starts with the specified keyword.
@return TRUE if str starts with keyword */
@@ -6068,7 +6398,8 @@ dict_foreign_replace_index(
foreign->foreign_table, col_names,
foreign->foreign_col_names,
foreign->n_fields, index,
- /*check_charsets=*/TRUE, /*check_null=*/FALSE);
+ /*check_charsets=*/TRUE, /*check_null=*/FALSE,
+ NULL, NULL, NULL);
if (new_index) {
ut_ad(new_index->table == index->table);
ut_ad(!new_index->to_be_dropped);
@@ -6092,7 +6423,8 @@ dict_foreign_replace_index(
foreign->referenced_table, NULL,
foreign->referenced_col_names,
foreign->n_fields, index,
- /*check_charsets=*/TRUE, /*check_null=*/FALSE);
+ /*check_charsets=*/TRUE, /*check_null=*/FALSE,
+ NULL, NULL, NULL);
/* There must exist an alternative index,
since this must have been checked earlier. */
if (new_index) {
@@ -6661,10 +6993,17 @@ dict_foreign_qualify_index(
/*!< in: whether to check
charsets. only has an effect
if types_idx != NULL */
- ulint check_null)
+ ulint check_null,
/*!< in: nonzero if none of
the columns must be declared
NOT NULL */
+ ulint* error, /*!< out: error code */
+ ulint* err_col_no,
+ /*!< out: column number where
+ error happened */
+ dict_index_t** err_index)
+ /*!< out: index where error
+ happened */
{
if (dict_index_get_n_fields(index) < n_cols) {
return(false);
@@ -6681,11 +7020,21 @@ dict_foreign_qualify_index(
if (field->prefix_len != 0) {
/* We do not accept column prefix
indexes here */
+ if (error && err_col_no && err_index) {
+ *error = DB_FOREIGN_KEY_IS_PREFIX_INDEX;
+ *err_col_no = i;
+ *err_index = (dict_index_t*)index;
+ }
return(false);
}
if (check_null
&& (field->col->prtype & DATA_NOT_NULL)) {
+ if (error && err_col_no && err_index) {
+ *error = DB_FOREIGN_KEY_COL_NOT_NULL;
+ *err_col_no = i;
+ *err_index = (dict_index_t*)index;
+ }
return(false);
}
@@ -6701,6 +7050,12 @@ dict_foreign_qualify_index(
dict_index_get_nth_col(index, i),
dict_index_get_nth_col(types_idx, i),
check_charsets)) {
+ if (error && err_col_no && err_index) {
+ *error = DB_FOREIGN_KEY_COLS_NOT_EQUAL;
+ *err_col_no = i;
+ *err_index = (dict_index_t*)index;
+ }
+
return(false);
}
}
diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc
index 149811dab60..d8bd0a66ade 100644
--- a/storage/innobase/dict/dict0load.cc
+++ b/storage/innobase/dict/dict0load.cc
@@ -1168,7 +1168,7 @@ loop:
dberr_t err = fil_open_single_table_tablespace(
read_page_0, srv_read_only_mode ? false : true,
space_id, dict_tf_to_fsp_flags(flags),
- name, filepath);
+ name, filepath, NULL);
if (err != DB_SUCCESS) {
ib_logf(IB_LOG_LEVEL_ERROR,
@@ -2412,7 +2412,7 @@ err_exit:
err = fil_open_single_table_tablespace(
true, false, table->space,
dict_tf_to_fsp_flags(table->flags),
- name, filepath);
+ name, filepath, table);
if (err != DB_SUCCESS) {
/* We failed to find a sensible
diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc
index 9c186304d27..1724ac024fa 100644
--- a/storage/innobase/dict/dict0mem.cc
+++ b/storage/innobase/dict/dict0mem.cc
@@ -417,7 +417,8 @@ dict_mem_table_col_rename_low(
dict_index_t* new_index = dict_foreign_find_index(
foreign->foreign_table, NULL,
foreign->foreign_col_names,
- foreign->n_fields, NULL, true, false);
+ foreign->n_fields, NULL, true, false,
+ NULL, NULL, NULL);
/* There must be an equivalent index in this case. */
ut_ad(new_index != NULL);
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index b96003d2b9e..18f8983d79c 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -222,6 +222,7 @@ fil_space_create_crypt_data(
my_random_bytes(crypt_data->iv, sizeof(crypt_data->iv));
crypt_data->encryption = encrypt_mode;
crypt_data->key_id = key_id;
+ crypt_data->inited = true;
return crypt_data;
}
@@ -243,13 +244,11 @@ fil_space_merge_crypt_data(
ut_a(dst->type == CRYPT_SCHEME_UNENCRYPTED ||
dst->type == CRYPT_SCHEME_1);
- /* no support for changing iv (yet?) */
- ut_a(memcmp(src->iv, dst->iv, sizeof(src->iv)) == 0);
-
dst->encryption = src->encryption;
dst->type = src->type;
dst->min_key_version = src->min_key_version;
dst->keyserver_requests += src->keyserver_requests;
+ dst->inited = src->inited;
mutex_exit(&dst->mutex);
}
@@ -271,6 +270,7 @@ fil_space_read_crypt_data(
}
if (memcmp(page + offset, CRYPT_MAGIC, MAGIC_SZ) != 0) {
+#ifdef UNIV_DEBUG
ib_logf(IB_LOG_LEVEL_WARN,
"Found potentially bogus bytes on "
"page 0 offset %lu for space %lu : "
@@ -283,7 +283,8 @@ fil_space_read_crypt_data(
page[offset + 3],
page[offset + 4],
page[offset + 5]);
- /* Create data is not stored. */
+#endif
+ /* Crypt data is not stored. */
return NULL;
}
@@ -345,6 +346,7 @@ fil_space_read_crypt_data(
mutex_create(fil_crypt_data_mutex_key,
&crypt_data->mutex, SYNC_NO_ORDER_CHECK);
crypt_data->locker = crypt_data_scheme_locker;
+ crypt_data->inited = true;
memcpy(crypt_data->iv, page + offset + MAGIC_SZ + 2, iv_length);
return crypt_data;
@@ -359,7 +361,14 @@ fil_space_destroy_crypt_data(
fil_space_crypt_t **crypt_data) /*!< out: crypt data */
{
if (crypt_data != NULL && (*crypt_data) != NULL) {
+ /* Make sure that this thread owns the crypt_data
+ and make it unawailable, this does not fully
+ avoid the race between drop table and crypt thread */
+ mutex_enter(&(*crypt_data)->mutex);
+ (*crypt_data)->inited = false;
+ mutex_exit(&(*crypt_data)->mutex);
mutex_free(& (*crypt_data)->mutex);
+ memset(*crypt_data, 0, sizeof(fil_space_crypt_t));
free(*crypt_data);
(*crypt_data) = NULL;
}
@@ -543,46 +552,22 @@ fil_space_clear_crypt_data(
}
/******************************************************************
-Encrypt a page */
+Encrypt a buffer */
UNIV_INTERN
-void
-fil_space_encrypt(
-/*==============*/
+byte*
+fil_encrypt_buf(
+/*============*/
+ fil_space_crypt_t* crypt_data, /*!< in: crypt data */
ulint space, /*!< in: Space id */
ulint offset, /*!< in: Page offset */
lsn_t lsn, /*!< in: lsn */
- const byte* src_frame, /*!< in: Source page to be encrypted */
+ byte* src_frame, /*!< in: Source page to be encrypted */
ulint zip_size, /*!< in: compressed size if
- row_format compressed */
+ row format compressed */
byte* dst_frame) /*!< in: outbut buffer */
{
- fil_space_crypt_t* crypt_data = NULL;
ulint page_size = (zip_size) ? zip_size : UNIV_PAGE_SIZE;
- uint key_version;
-
- ulint orig_page_type = mach_read_from_2(src_frame+FIL_PAGE_TYPE);
-
- if (orig_page_type==FIL_PAGE_TYPE_FSP_HDR
- || orig_page_type==FIL_PAGE_TYPE_XDES) {
- /* File space header or extent descriptor do not need to be
- encrypted. */
- //TODO: is this really needed ?
- memcpy(dst_frame, src_frame, page_size);
- return;
- }
-
- /* Get crypt data from file space */
- crypt_data = fil_space_get_crypt_data(space);
-
- if (crypt_data == NULL) {
- //TODO: Is this really needed ?
- memcpy(dst_frame, src_frame, page_size);
- return;
- }
-
- ut_ad(crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF);
-
- key_version = fil_crypt_get_latest_key_version(crypt_data);
+ uint key_version = fil_crypt_get_latest_key_version(crypt_data);
if (key_version == ENCRYPTION_KEY_VERSION_INVALID) {
ib_logf(IB_LOG_LEVEL_FATAL,
@@ -591,21 +576,31 @@ fil_space_encrypt(
ut_error;
}
+ ulint orig_page_type = mach_read_from_2(src_frame+FIL_PAGE_TYPE);
ibool page_compressed = (orig_page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
+ ulint header_len = FIL_PAGE_DATA;
+
+ if (page_compressed) {
+ header_len += (FIL_PAGE_COMPRESSED_SIZE + FIL_PAGE_COMPRESSION_METHOD_SIZE);
+ }
/* FIL page header is not encrypted */
- memcpy(dst_frame, src_frame, FIL_PAGE_DATA);
+ memcpy(dst_frame, src_frame, header_len);
/* Store key version */
mach_write_to_4(dst_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, key_version);
/* Calculate the start offset in a page */
- ulint unencrypted_bytes = FIL_PAGE_DATA + FIL_PAGE_DATA_END;
+ ulint unencrypted_bytes = header_len + FIL_PAGE_DATA_END;
ulint srclen = page_size - unencrypted_bytes;
- const byte* src = src_frame + FIL_PAGE_DATA;
- byte* dst = dst_frame + FIL_PAGE_DATA;
+ const byte* src = src_frame + header_len;
+ byte* dst = dst_frame + header_len;
uint32 dstlen = 0;
+ if (page_compressed) {
+ srclen = mach_read_from_2(src_frame + FIL_PAGE_DATA);
+ }
+
int rc = encryption_scheme_encrypt(src, srclen, dst, &dstlen,
crypt_data, key_version,
space, offset, lsn);
@@ -633,36 +628,54 @@ fil_space_encrypt(
/* handle post encryption checksum */
ib_uint32_t checksum = 0;
- srv_checksum_algorithm_t algorithm =
- static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
- if (zip_size == 0) {
- switch (algorithm) {
- case SRV_CHECKSUM_ALGORITHM_CRC32:
- case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
- checksum = buf_calc_page_crc32(dst_frame);
- break;
- case SRV_CHECKSUM_ALGORITHM_INNODB:
- case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
- checksum = (ib_uint32_t) buf_calc_page_new_checksum(
- dst_frame);
- break;
- case SRV_CHECKSUM_ALGORITHM_NONE:
- case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
- checksum = BUF_NO_CHECKSUM_MAGIC;
- break;
- /* no default so the compiler will emit a warning
- * if new enum is added and not handled here */
- }
- } else {
- checksum = page_zip_calc_checksum(dst_frame, zip_size,
- algorithm);
- }
+ checksum = fil_crypt_calculate_checksum(zip_size, dst_frame);
// store the post-encryption checksum after the key-version
mach_write_to_4(dst_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4, checksum);
srv_stats.pages_encrypted.inc();
+
+ return dst_frame;
+}
+
+/******************************************************************
+Encrypt a page */
+UNIV_INTERN
+byte*
+fil_space_encrypt(
+/*==============*/
+ ulint space, /*!< in: Space id */
+ ulint offset, /*!< in: Page offset */
+ lsn_t lsn, /*!< in: lsn */
+ byte* src_frame, /*!< in: Source page to be encrypted */
+ ulint zip_size, /*!< in: compressed size if
+ row_format compressed */
+ byte* dst_frame) /*!< in: outbut buffer */
+{
+ fil_space_crypt_t* crypt_data = NULL;
+
+ ulint orig_page_type = mach_read_from_2(src_frame+FIL_PAGE_TYPE);
+
+ if (orig_page_type==FIL_PAGE_TYPE_FSP_HDR
+ || orig_page_type==FIL_PAGE_TYPE_XDES) {
+ /* File space header or extent descriptor do not need to be
+ encrypted. */
+ return src_frame;
+ }
+
+ /* Get crypt data from file space */
+ crypt_data = fil_space_get_crypt_data(space);
+
+ if (crypt_data == NULL) {
+ return src_frame;
+ }
+
+ ut_ad(crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF);
+
+ byte* tmp = fil_encrypt_buf(crypt_data, space, offset, lsn, src_frame, zip_size, dst_frame);
+
+ return tmp;
}
/*********************************************************************
@@ -693,24 +706,26 @@ fil_space_check_encryption_read(
/******************************************************************
Decrypt a page
-@return true if page was encrypted */
+@return true if page decrypted, false if not.*/
UNIV_INTERN
bool
fil_space_decrypt(
/*==============*/
fil_space_crypt_t* crypt_data, /*!< in: crypt data */
- const byte* src_frame, /*!< in: input buffer */
+ byte* tmp_frame, /*!< in: temporary buffer */
ulint page_size, /*!< in: page size */
- byte* dst_frame) /*!< out: output buffer */
+ byte* src_frame, /*!< in: out: page buffer */
+ dberr_t* err) /*!< in: out: DB_SUCCESS or
+ error code */
{
ulint page_type = mach_read_from_2(src_frame+FIL_PAGE_TYPE);
uint key_version = mach_read_from_4(src_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
bool page_compressed = (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
+ *err = DB_SUCCESS;
+
if (key_version == ENCRYPTION_KEY_NOT_ENCRYPTED) {
- //TODO: is this really needed ?
- memcpy(dst_frame, src_frame, page_size);
- return false; /* page not decrypted */
+ return false;
}
ut_ad(crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF);
@@ -721,21 +736,36 @@ fil_space_decrypt(
ulint offset = mach_read_from_4(
src_frame + FIL_PAGE_OFFSET);
ib_uint64_t lsn = mach_read_from_8(src_frame + FIL_PAGE_LSN);
+ ulint header_len = FIL_PAGE_DATA;
+
+ if (page_compressed) {
+ header_len += (FIL_PAGE_COMPRESSED_SIZE + FIL_PAGE_COMPRESSION_METHOD_SIZE);
+ }
/* Copy FIL page header, it is not encrypted */
- memcpy(dst_frame, src_frame, FIL_PAGE_DATA);
+ memcpy(tmp_frame, src_frame, header_len);
/* Calculate the offset where decryption starts */
- const byte* src = src_frame + FIL_PAGE_DATA;
- byte* dst = dst_frame + FIL_PAGE_DATA;
+ const byte* src = src_frame + header_len;
+ byte* dst = tmp_frame + header_len;
uint32 dstlen = 0;
- ulint srclen = page_size - (FIL_PAGE_DATA + FIL_PAGE_DATA_END);
+ ulint srclen = page_size - (header_len + FIL_PAGE_DATA_END);
+
+ if (page_compressed) {
+ srclen = mach_read_from_2(src_frame + FIL_PAGE_DATA);
+ }
int rc = encryption_scheme_decrypt(src, srclen, dst, &dstlen,
crypt_data, key_version,
space, offset, lsn);
if (! ((rc == MY_AES_OK) && ((ulint) dstlen == srclen))) {
+
+ if (rc == -1) {
+ *err = DB_DECRYPTION_FAILED;
+ return false;
+ }
+
ib_logf(IB_LOG_LEVEL_FATAL,
"Unable to decrypt data-block "
" src: %p srclen: %ld buf: %p buflen: %d."
@@ -751,12 +781,12 @@ fil_space_decrypt(
to sector boundary is written. */
if (!page_compressed) {
/* Copy FIL trailer */
- memcpy(dst_frame + page_size - FIL_PAGE_DATA_END,
+ memcpy(tmp_frame + page_size - FIL_PAGE_DATA_END,
src_frame + page_size - FIL_PAGE_DATA_END,
FIL_PAGE_DATA_END);
// clear key-version & crypt-checksum from dst
- memset(dst_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, 0, 8);
+ memset(tmp_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, 0, 8);
}
srv_stats.pages_decrypted.inc();
@@ -765,18 +795,75 @@ fil_space_decrypt(
}
/******************************************************************
-Decrypt a page */
+Decrypt a page
+@return encrypted page, or original not encrypted page if encryption is
+not needed. */
UNIV_INTERN
-void
+byte*
fil_space_decrypt(
/*==============*/
ulint space, /*!< in: Fil space id */
- const byte* src_frame, /*!< in: input buffer */
+ byte* tmp_frame, /*!< in: temporary buffer */
ulint page_size, /*!< in: page size */
- byte* dst_frame) /*!< out: output buffer */
+ byte* src_frame) /*!< in/out: page buffer */
+{
+ dberr_t err = DB_SUCCESS;
+
+ bool encrypted = fil_space_decrypt(
+ fil_space_get_crypt_data(space),
+ tmp_frame,
+ page_size,
+ src_frame,
+ &err);
+
+ if (encrypted) {
+ /* Copy the decrypted page back to page buffer, not
+ really any other options. */
+ memcpy(src_frame, tmp_frame, page_size);
+ }
+
+ return src_frame;
+}
+
+/******************************************************************
+Calculate post encryption checksum
+@return page checksum or BUF_NO_CHECKSUM_MAGIC
+not needed. */
+UNIV_INTERN
+ulint
+fil_crypt_calculate_checksum(
+/*=========================*/
+ ulint zip_size, /*!< in: zip_size or 0 */
+ byte* dst_frame) /*!< in: page where to calculate */
{
- fil_space_decrypt(fil_space_get_crypt_data(space),
- src_frame, page_size, dst_frame);
+ ib_uint32_t checksum = 0;
+ srv_checksum_algorithm_t algorithm =
+ static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
+
+ if (zip_size == 0) {
+ switch (algorithm) {
+ case SRV_CHECKSUM_ALGORITHM_CRC32:
+ case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
+ checksum = buf_calc_page_crc32(dst_frame);
+ break;
+ case SRV_CHECKSUM_ALGORITHM_INNODB:
+ case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
+ checksum = (ib_uint32_t) buf_calc_page_new_checksum(
+ dst_frame);
+ break;
+ case SRV_CHECKSUM_ALGORITHM_NONE:
+ case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
+ checksum = BUF_NO_CHECKSUM_MAGIC;
+ break;
+ /* no default so the compiler will emit a warning
+ * if new enum is added and not handled here */
+ }
+ } else {
+ checksum = page_zip_calc_checksum(dst_frame, zip_size,
+ algorithm);
+ }
+
+ return checksum;
}
/*********************************************************************
@@ -1018,7 +1105,7 @@ fil_crypt_start_encrypting_space(
do
{
if (fil_crypt_is_closing(space) ||
- fil_space_found_by_id(space)) {
+ fil_space_found_by_id(space) == NULL) {
break;
}
@@ -2016,7 +2103,7 @@ fil_crypt_complete_rotate_space(
fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space);
/* Space might already be dropped */
- if (crypt_data) {
+ if (crypt_data != NULL && crypt_data->inited) {
mutex_enter(&crypt_data->mutex);
/**
@@ -2208,7 +2295,7 @@ fil_crypt_set_thread_cnt(
os_thread_id_t rotation_thread_id;
os_thread_create(fil_crypt_thread, NULL, &rotation_thread_id);
ib_logf(IB_LOG_LEVEL_INFO,
- "Creating #%d thread id %lu total threads %u\n",
+ "Creating #%d thread id %lu total threads %u.",
i+1, os_thread_pf(rotation_thread_id), new_cnt);
}
} else if (new_cnt < srv_n_fil_crypt_threads) {
@@ -2269,11 +2356,11 @@ fil_crypt_threads_init()
fil_crypt_threads_event = os_event_create();
mutex_create(fil_crypt_threads_mutex_key,
&fil_crypt_threads_mutex, SYNC_NO_ORDER_CHECK);
- fil_crypt_threads_inited = true;
uint cnt = srv_n_fil_crypt_threads;
srv_n_fil_crypt_threads = 0;
fil_crypt_set_thread_cnt(cnt);
+ fil_crypt_threads_inited = true;
}
/*********************************************************************
@@ -2341,7 +2428,7 @@ fil_space_crypt_close_tablespace(
fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space);
- if (crypt_data == NULL) {
+ if (crypt_data == NULL || !crypt_data->inited) {
mutex_exit(&fil_crypt_threads_mutex);
return;
}
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 28f292e2c78..b3dae5d24d7 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
-Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2015, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates.
+Copyright (c) 2013, 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -457,7 +457,7 @@ fil_space_get_latch(
/*******************************************************************//**
Returns the type of a file space.
-@return FIL_TABLESPACE or FIL_LOG */
+@return ULINT_UNDEFINED, or FIL_TABLESPACE or FIL_LOG */
UNIV_INTERN
ulint
fil_space_get_type(
@@ -465,6 +465,7 @@ fil_space_get_type(
ulint id) /*!< in: space id */
{
fil_space_t* space;
+ ulint type = ULINT_UNDEFINED;
ut_ad(fil_system);
@@ -472,11 +473,13 @@ fil_space_get_type(
space = fil_space_get_by_id(id);
- ut_a(space);
-
mutex_exit(&fil_system->mutex);
- return(space->purpose);
+ if (space) {
+ type = space->purpose;
+ }
+
+ return(type);
}
#endif /* !UNIV_HOTBACKUP */
@@ -1975,8 +1978,6 @@ fil_read_first_page(
lsn values in data files */
lsn_t* max_flushed_lsn, /*!< out: max of flushed
lsn values in data files */
- ulint orig_space_id, /*!< in: original file space
- id */
fil_space_crypt_t** crypt_data) /*< out: crypt data */
{
byte* buf;
@@ -1985,6 +1986,7 @@ fil_read_first_page(
const char* check_msg = NULL;
fil_space_crypt_t* cdata;
+
buf = static_cast<byte*>(ut_malloc(2 * UNIV_PAGE_SIZE));
/* Align the memory for a possible read from a raw device */
@@ -2014,6 +2016,10 @@ fil_read_first_page(
fsp_flags_get_zip_size(*flags), NULL);
cdata = fil_space_read_crypt_data(space, page, offset);
+ if (crypt_data) {
+ *crypt_data = cdata;
+ }
+
/* If file space is encrypted we need to have at least some
encryption service available where to get keys */
if ((cdata && cdata->encryption == FIL_SPACE_ENCRYPTION_ON) ||
@@ -2021,16 +2027,14 @@ fil_read_first_page(
cdata && cdata->encryption == FIL_SPACE_ENCRYPTION_DEFAULT)) {
if (!encryption_key_id_exists(cdata->key_id)) {
- ib_logf(IB_LOG_LEVEL_FATAL,
- "Tablespace id %ld encrypted but encryption service"
- " not available. Can't continue opening tablespace.\n",
- space);
- ut_error;
- }
- }
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Tablespace id %ld is encrypted but encryption service"
+ " or used key_id %u is not available. Can't continue opening tablespace.",
+ space, cdata->key_id);
- if (crypt_data) {
- *crypt_data = cdata;
+ return ("table encrypted but encryption service not available.");
+
+ }
}
ut_free(buf);
@@ -2393,7 +2397,9 @@ fil_op_log_parse_or_replay(
if (fil_create_new_single_table_tablespace(
space_id, name, path, flags,
DICT_TF2_USE_TABLESPACE,
- FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
+ FIL_IBD_FILE_INITIAL_SIZE,
+ FIL_SPACE_ENCRYPTION_DEFAULT,
+ FIL_DEFAULT_ENCRYPTION_KEY) != DB_SUCCESS) {
ut_error;
}
}
@@ -3330,9 +3336,11 @@ fil_create_new_single_table_tablespace(
const char* dir_path, /*!< in: NULL or a dir path */
ulint flags, /*!< in: tablespace flags */
ulint flags2, /*!< in: table flags2 */
- ulint size) /*!< in: the initial size of the
+ ulint size, /*!< in: the initial size of the
tablespace file in pages,
must be >= FIL_IBD_FILE_INITIAL_SIZE */
+ fil_encryption_t mode, /*!< in: encryption mode */
+ ulint key_id) /*!< in: encryption key_id */
{
os_file_t file;
ibool ret;
@@ -3499,7 +3507,7 @@ fil_create_new_single_table_tablespace(
}
success = fil_space_create(tablename, space_id, flags, FIL_TABLESPACE,
- fil_space_create_crypt_data(FIL_SPACE_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY));
+ fil_space_create_crypt_data(mode, key_id));
if (!success || !fil_node_create(path, size, space_id, FALSE)) {
err = DB_ERROR;
@@ -3616,7 +3624,8 @@ fil_open_single_table_tablespace(
ulint flags, /*!< in: tablespace flags */
const char* tablename, /*!< in: table name in the
databasename/tablename format */
- const char* path_in) /*!< in: tablespace filepath */
+ const char* path_in, /*!< in: tablespace filepath */
+ dict_table_t* table) /*!< in: table */
{
dberr_t err = DB_SUCCESS;
bool dict_filepath_same_as_default = false;
@@ -3730,9 +3739,13 @@ fil_open_single_table_tablespace(
#ifdef UNIV_LOG_ARCHIVE
&space_arch_log_no, &space_arch_log_no,
#endif /* UNIV_LOG_ARCHIVE */
- &def.lsn, &def.lsn, id, &def.crypt_data);
+ &def.lsn, &def.lsn, &def.crypt_data);
def.valid = !def.check_msg;
+ if (table) {
+ table->crypt_data = def.crypt_data;
+ }
+
/* Validate this single-table-tablespace with SYS_TABLES,
but do not compare the DATA_DIR flag, in case the
tablespace was relocated. */
@@ -3755,9 +3768,13 @@ fil_open_single_table_tablespace(
#ifdef UNIV_LOG_ARCHIVE
&remote.arch_log_no, &remote.arch_log_no,
#endif /* UNIV_LOG_ARCHIVE */
- &remote.lsn, &remote.lsn, id, &remote.crypt_data);
+ &remote.lsn, &remote.lsn, &remote.crypt_data);
remote.valid = !remote.check_msg;
+ if (table) {
+ table->crypt_data = remote.crypt_data;
+ }
+
/* Validate this single-table-tablespace with SYS_TABLES,
but do not compare the DATA_DIR flag, in case the
tablespace was relocated. */
@@ -3781,9 +3798,13 @@ fil_open_single_table_tablespace(
#ifdef UNIV_LOG_ARCHIVE
&dict.arch_log_no, &dict.arch_log_no,
#endif /* UNIV_LOG_ARCHIVE */
- &dict.lsn, &dict.lsn, id, &dict.crypt_data);
+ &dict.lsn, &dict.lsn, &dict.crypt_data);
dict.valid = !dict.check_msg;
+ if (table) {
+ table->crypt_data = dict.crypt_data;
+ }
+
/* Validate this single-table-tablespace with SYS_TABLES,
but do not compare the DATA_DIR flag, in case the
tablespace was relocated. */
@@ -3965,7 +3986,9 @@ cleanup_and_exit:
mem_free(remote.filepath);
}
if (remote.crypt_data && remote.crypt_data != crypt_data) {
- fil_space_destroy_crypt_data(&remote.crypt_data);
+ if (err == DB_SUCCESS) {
+ fil_space_destroy_crypt_data(&remote.crypt_data);
+ }
}
if (dict.success) {
os_file_close(dict.file);
@@ -3980,7 +4003,9 @@ cleanup_and_exit:
os_file_close(def.file);
}
if (def.crypt_data && def.crypt_data != crypt_data) {
- fil_space_destroy_crypt_data(&def.crypt_data);
+ if (err == DB_SUCCESS) {
+ fil_space_destroy_crypt_data(&def.crypt_data);
+ }
}
mem_free(def.filepath);
@@ -4204,7 +4229,7 @@ check_first_page:
#ifdef UNIV_LOG_ARCHIVE
&fsp->arch_log_no, &fsp->arch_log_no,
#endif /* UNIV_LOG_ARCHIVE */
- &fsp->lsn, &fsp->lsn, ULINT_UNDEFINED, &fsp->crypt_data)) {
+ &fsp->lsn, &fsp->lsn, &fsp->crypt_data)) {
ib_logf(IB_LOG_LEVEL_ERROR,
"%s in tablespace %s (table %s)",
check_msg, fsp->filepath, tablename);
@@ -5725,9 +5750,10 @@ fil_io(
space = fil_space_get_by_id(space_id);
- /* If we are deleting a tablespace we don't allow any read
- operations on that. However, we do allow write operations. */
- if (space == 0 || (type == OS_FILE_READ && space->stop_new_ops)) {
+ /* If we are deleting a tablespace we don't allow async read operations
+ on that. However, we do allow write and sync read operations */
+ if (space == 0
+ || (type == OS_FILE_READ && !sync && space->stop_new_ops)) {
mutex_exit(&fil_system->mutex);
ib_logf(IB_LOG_LEVEL_ERROR,
@@ -5866,9 +5892,9 @@ fil_io(
if (!ret) {
return(DB_OUT_OF_FILE_SPACE);
- } else {
- return(DB_SUCCESS);
}
+
+ return(DB_SUCCESS);
}
#ifndef UNIV_HOTBACKUP
@@ -6392,8 +6418,17 @@ fil_iterate(
ut_ad(!(n_bytes % iter.page_size));
byte* readptr = io_buffer;
- if (iter.crypt_data != NULL) {
+ byte* writeptr = io_buffer;
+ bool encrypted = false;
+
+ /* Use additional crypt io buffer if tablespace is encrypted */
+ if ((iter.crypt_data != NULL && iter.crypt_data->encryption == FIL_SPACE_ENCRYPTION_ON) ||
+ (srv_encrypt_tables &&
+ iter.crypt_data && iter.crypt_data->encryption == FIL_SPACE_ENCRYPTION_DEFAULT)) {
+
+ encrypted = true;
readptr = iter.crypt_io_buffer;
+ writeptr = iter.crypt_io_buffer;
}
if (!os_file_read(iter.file, readptr, offset, (ulint) n_bytes)) {
@@ -6406,24 +6441,36 @@ fil_iterate(
bool updated = false;
os_offset_t page_off = offset;
ulint n_pages_read = (ulint) n_bytes / iter.page_size;
+ bool decrypted = false;
for (ulint i = 0; i < n_pages_read; ++i) {
+ ulint size = iter.page_size;
+ dberr_t err = DB_SUCCESS;
+
+ /* If tablespace is encrypted, we need to decrypt
+ the page. */
+ if (encrypted) {
+ decrypted = fil_space_decrypt(
+ iter.crypt_data,
+ io_buffer + i * size, //dst
+ iter.page_size,
+ readptr + i * size, // src
+ &err); // src
+
+ if (err != DB_SUCCESS) {
+ return(err);
+ }
- if (iter.crypt_data != NULL) {
- bool decrypted = fil_space_decrypt(
- iter.crypt_data,
- readptr + i * iter.page_size, // src
- iter.page_size,
- io_buffer + i * iter.page_size); // dst
if (decrypted) {
- /* write back unencrypted page */
updated = true;
+ } else {
+ /* TODO: remove unnecessary memcpy's */
+ memcpy(io_buffer + i * size, readptr + i * size, size);
}
}
buf_block_set_file_page(block, space_id, page_no++);
- dberr_t err;
if ((err = callback(page_off, block)) != DB_SUCCESS) {
@@ -6437,6 +6484,32 @@ fil_iterate(
buf_block_set_state(block, BUF_BLOCK_NOT_USED);
buf_block_set_state(block, BUF_BLOCK_READY_FOR_USE);
+ /* If tablespace is encrypted, encrypt page before we
+ write it back. Note that we should not encrypt the
+ buffer that is in buffer pool. */
+ if (decrypted && encrypted) {
+ unsigned char *src = io_buffer + (i * size);
+ unsigned char *dst = writeptr + (i * size);
+ ulint space = mach_read_from_4(
+ src + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
+ ulint offset = mach_read_from_4(src + FIL_PAGE_OFFSET);
+ ib_uint64_t lsn = mach_read_from_8(src + FIL_PAGE_LSN);
+
+ byte* tmp = fil_encrypt_buf(
+ iter.crypt_data,
+ space,
+ offset,
+ lsn,
+ src,
+ iter.page_size == UNIV_PAGE_SIZE ? 0 : iter.page_size,
+ dst);
+
+ if (tmp == src) {
+ /* TODO: remove unnecessary memcpy's */
+ memcpy(writeptr, src, size);
+ }
+ }
+
page_off += iter.page_size;
block->frame += iter.page_size;
}
@@ -6444,7 +6517,7 @@ fil_iterate(
/* A page was updated in the set, write back to disk. */
if (updated
&& !os_file_write(
- iter.filepath, iter.file, io_buffer,
+ iter.filepath, iter.file, writeptr,
offset, (ulint) n_bytes)) {
ib_logf(IB_LOG_LEVEL_ERROR, "os_file_write() failed");
@@ -6606,28 +6679,6 @@ fil_tablespace_iterate(
mem_free(io_buffer);
if (iter.crypt_data != NULL) {
- /* clear crypt data from page 0 and write it back */
- os_file_read(file, page, 0, UNIV_PAGE_SIZE);
- fil_space_clear_crypt_data(page, crypt_data_offset);
- lsn_t lsn = mach_read_from_8(page + FIL_PAGE_LSN);
- if (callback.get_zip_size() == 0) {
- buf_flush_init_for_writing(
- page, 0, lsn);
- } else {
- buf_flush_update_zip_checksum(
- page, callback.get_zip_size(), lsn);
- }
-
- if (!os_file_write(
- iter.filepath, iter.file, page,
- 0, iter.page_size)) {
-
- ib_logf(IB_LOG_LEVEL_ERROR,
- "os_file_write() failed");
-
- return(DB_IO_ERROR);
- }
-
mem_free(crypt_io_buffer);
iter.crypt_io_buffer = NULL;
fil_space_destroy_crypt_data(&iter.crypt_data);
diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc
index e508d4733db..ff8541a40a5 100644
--- a/storage/innobase/fil/fil0pagecompress.cc
+++ b/storage/innobase/fil/fil0pagecompress.cc
@@ -355,12 +355,16 @@ fil_compress_page(
write_size+=header_len;
+ if (block_size <= 0) {
+ block_size = 512;
+ }
+
+ ut_ad(write_size > 0 && block_size > 0);
+
/* Actual write needs to be alligned on block size */
if (write_size % block_size) {
size_t tmp = write_size;
-#ifdef UNIV_DEBUG
- ut_a(block_size > 0);
-#endif
+
write_size = (size_t)ut_uint64_align_up((ib_uint64_t)write_size, block_size);
#ifdef UNIV_DEBUG
ut_a(write_size > 0 && ((write_size % block_size) == 0));
diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc
index 5c5e2d69514..927763cec01 100644
--- a/storage/innobase/fsp/fsp0fsp.cc
+++ b/storage/innobase/fsp/fsp0fsp.cc
@@ -2721,6 +2721,8 @@ fsp_reserve_free_extents(
ulint reserve;
ibool success;
ulint n_pages_added;
+ size_t total_reserved = 0;
+ ulint rounds = 0;
ut_ad(mtr);
*n_reserved = n_ext;
@@ -2789,6 +2791,7 @@ try_again:
}
success = fil_space_reserve_free_extents(space, n_free, n_ext);
+ *n_reserved = n_ext;
if (success) {
return(TRUE);
@@ -2796,8 +2799,19 @@ try_again:
try_to_extend:
success = fsp_try_extend_data_file(&n_pages_added, space,
space_header, mtr);
+
if (success && n_pages_added > 0) {
+ rounds++;
+ total_reserved += n_pages_added;
+
+ if (rounds > 50) {
+ ib_logf(IB_LOG_LEVEL_INFO,
+ "Space id %lu trying to reserve %lu extents actually reserved %lu "
+ " reserve %lu free %lu size %lu rounds %lu total_reserved %lu",
+ space, n_ext, n_pages_added, reserve, n_free, size, rounds, total_reserved);
+ }
+
goto try_again;
}
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index 4351dc0b765..cc4a4f9f1a8 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -1981,7 +1981,7 @@ fts_create_one_index_table(
dict_mem_table_add_col(new_table, heap, "ilist", DATA_BLOB,
4130048, 0);
- error = row_create_table_for_mysql(new_table, trx, false);
+ error = row_create_table_for_mysql(new_table, trx, false, FIL_SPACE_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
if (error != DB_SUCCESS) {
trx->error_state = error;
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 4c02676be87..6bd932491d3 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -108,7 +108,7 @@ this program; if not, write to the Free Software Foundation, Inc.,
#define thd_get_trx_isolation(X) ((enum_tx_isolation)thd_tx_isolation(X))
#ifdef MYSQL_DYNAMIC_PLUGIN
-#define tc_size 400
+#define tc_size 2000
#define tdc_size 400
#endif
@@ -544,7 +544,8 @@ ib_cb_t innodb_api_cb[] = {
(ib_cb_t) ib_get_idx_field_name,
(ib_cb_t) ib_trx_get_start_time,
(ib_cb_t) ib_cfg_bk_commit_interval,
- (ib_cb_t) ib_cursor_stmt_begin
+ (ib_cb_t) ib_cursor_stmt_begin,
+ (ib_cb_t) ib_trx_read_only
};
@@ -1748,6 +1749,9 @@ convert_error_code_to_mysql(
case DB_TABLE_NOT_FOUND:
return(HA_ERR_NO_SUCH_TABLE);
+ case DB_DECRYPTION_FAILED:
+ return(HA_ERR_DECRYPTION_FAILED);
+
case DB_TABLESPACE_NOT_FOUND:
return(HA_ERR_NO_SUCH_TABLE);
@@ -2364,6 +2368,7 @@ check_trx_exists(
if (trx == NULL) {
trx = innobase_trx_allocate(thd);
+ thd_set_ha_data(thd, innodb_hton_ptr, trx);
} else if (UNIV_UNLIKELY(trx->magic_n != TRX_MAGIC_N)) {
mem_analyze_corruption(trx);
ut_error;
@@ -4604,11 +4609,12 @@ innobase_kill_query(
THD *cur = current_thd;
THD *owner = trx->current_lock_mutex_owner;
- /* Cancel a pending lock request. */
if (!owner || owner != cur) {
lock_mutex_enter();
}
trx_mutex_enter(trx);
+
+ /* Cancel a pending lock request. */
if (trx->lock.wait_lock) {
lock_cancel_waiting_and_release(trx->lock.wait_lock);
}
@@ -5589,7 +5595,14 @@ table_opened:
innobase_copy_frm_flags_from_table_share(ib_table, table->s);
- dict_stats_init(ib_table);
+ ib_table->thd = (void*)thd;
+
+ /* No point to init any statistics if tablespace is still encrypted. */
+ if (!ib_table->is_encrypted) {
+ dict_stats_init(ib_table);
+ } else {
+ ib_table->stat_initialized = 1;
+ }
MONITOR_INC(MONITOR_TABLE_OPEN);
@@ -5618,6 +5631,11 @@ table_opened:
file, best to play it safe. */
no_tablespace = true;
+ } else if (ib_table->is_encrypted) {
+ /* This means that tablespace was found but we could not
+ decrypt encrypted page. */
+ no_tablespace = true;
+ ib_table->ibd_file_missing = true;
} else {
no_tablespace = false;
}
@@ -5625,10 +5643,40 @@ table_opened:
if (!thd_tablespace_op(thd) && no_tablespace) {
free_share(share);
my_errno = ENOENT;
+ int ret_err = HA_ERR_NO_SUCH_TABLE;
+
+ /* If table has no talespace but it has crypt data, check
+ is tablespace made unaccessible because encryption service
+ or used key_id is not available. */
+ if (ib_table) {
+ fil_space_crypt_t* crypt_data = ib_table->crypt_data;
+ if ((crypt_data && crypt_data->encryption == FIL_SPACE_ENCRYPTION_ON) ||
+ (srv_encrypt_tables &&
+ crypt_data && crypt_data->encryption == FIL_SPACE_ENCRYPTION_DEFAULT)) {
+
+ if (!encryption_key_id_exists(crypt_data->key_id)) {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ HA_ERR_DECRYPTION_FAILED,
+ "Table %s is encrypted but encryption service or"
+ " used key_id %u is not available. "
+ " Can't continue reading table.",
+ ib_table->name, crypt_data->key_id);
+ ret_err = HA_ERR_DECRYPTION_FAILED;
+ }
+ } else if (ib_table->is_encrypted) {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ HA_ERR_DECRYPTION_FAILED,
+ "Table %s is encrypted but encryption service or"
+ " used key_id is not available. "
+ " Can't continue reading table.",
+ ib_table->name);
+ ret_err = HA_ERR_DECRYPTION_FAILED;
+ }
+ }
dict_table_close(ib_table, FALSE, FALSE);
- DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
+ DBUG_RETURN(ret_err);
}
prebuilt = row_create_prebuilt(ib_table, table->s->stored_rec_length);
@@ -6801,6 +6849,10 @@ wsrep_store_key_val_for_row(
DBUG_RETURN((uint)(buff - buff_start));
}
#endif /* WITH_WSREP */
+
+/*******************************************************************//**
+Stores a key value for a row to a buffer.
+@return key value length as stored in buff */
UNIV_INTERN
uint
ha_innobase::store_key_val_for_row(
@@ -7749,15 +7801,20 @@ no_commit:
;
} else if (src_table == prebuilt->table) {
#ifdef WITH_WSREP
- if (wsrep_on(user_thd)) {
+ if (wsrep_on(user_thd) &&
+ wsrep_load_data_splitting &&
+ sql_command == SQLCOM_LOAD &&
+ !thd_test_options(user_thd,
+ OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
+ {
switch (wsrep_run_wsrep_commit(user_thd, 1))
{
case WSREP_TRX_OK:
- break;
+ break;
case WSREP_TRX_SIZE_EXCEEDED:
case WSREP_TRX_CERT_FAIL:
case WSREP_TRX_ERROR:
- DBUG_RETURN(1);
+ DBUG_RETURN(1);
}
if (binlog_hton->commit(binlog_hton, user_thd, 1))
@@ -7776,15 +7833,20 @@ no_commit:
prebuilt->sql_stat_start = TRUE;
} else {
#ifdef WITH_WSREP
- if (wsrep_on(user_thd)) {
+ if (wsrep_on(user_thd) &&
+ wsrep_load_data_splitting &&
+ sql_command == SQLCOM_LOAD &&
+ !thd_test_options(user_thd,
+ OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
+ {
switch (wsrep_run_wsrep_commit(user_thd, 1))
{
case WSREP_TRX_OK:
- break;
+ break;
case WSREP_TRX_SIZE_EXCEEDED:
case WSREP_TRX_CERT_FAIL:
case WSREP_TRX_ERROR:
- DBUG_RETURN(1);
+ DBUG_RETURN(1);
}
if (binlog_hton->commit(binlog_hton, user_thd, 1))
@@ -7997,14 +8059,15 @@ report_error:
user_thd);
#ifdef WITH_WSREP
- if (!error_result && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
- wsrep_on(user_thd) && !wsrep_consistency_check(user_thd) &&
- (sql_command != SQLCOM_LOAD ||
- thd_binlog_format(user_thd) == BINLOG_FORMAT_ROW)) {
-
- if (wsrep_append_keys(user_thd, false, record, NULL)) {
- DBUG_PRINT("wsrep", ("row key failed"));
- error_result = HA_ERR_INTERNAL_ERROR;
+ if (!error_result &&
+ wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
+ wsrep_on(user_thd) &&
+ !wsrep_consistency_check(user_thd))
+ {
+ if (wsrep_append_keys(user_thd, false, record, NULL))
+ {
+ DBUG_PRINT("wsrep", ("row key failed"));
+ error_result = HA_ERR_INTERNAL_ERROR;
goto wsrep_error;
}
}
@@ -8583,18 +8646,18 @@ ha_innobase::delete_row(
innobase_active_small();
#ifdef WITH_WSREP
- if (error == DB_SUCCESS &&
+ if (error == DB_SUCCESS &&
wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
- wsrep_on(user_thd)) {
+ wsrep_on(user_thd)) {
if (wsrep_append_keys(user_thd, false, record, NULL)) {
DBUG_PRINT("wsrep", ("delete fail"));
- error = (dberr_t)HA_ERR_INTERNAL_ERROR;
+ error = (dberr_t) HA_ERR_INTERNAL_ERROR;
goto wsrep_error;
}
}
wsrep_error:
-#endif
+#endif /* WITH_WSREP */
DBUG_RETURN(convert_error_code_to_mysql(
error, prebuilt->table->flags, user_thd));
}
@@ -9190,6 +9253,11 @@ ha_innobase::general_fetch(
DBUG_ENTER("general_fetch");
+ /* If transaction is not startted do not continue, instead return a error code. */
+ if(!(prebuilt->sql_stat_start || (prebuilt->trx && prebuilt->trx->state == 1))) {
+ DBUG_RETURN(HA_ERR_END_OF_FILE);
+ }
+
ut_a(prebuilt->trx == thd_to_trx(user_thd));
innobase_srv_conc_enter_innodb(prebuilt->trx);
@@ -9958,7 +10026,7 @@ wsrep_append_foreign_key(
wsrep_thd_query(thd) : "void");
return DB_ERROR;
}
- wsrep_t *wsrep= get_wsrep();
+ wsrep_t *wsrep= get_wsrep();
rcode = (int)wsrep->append_key(
wsrep,
wsrep_ws_handle(thd, trx),
@@ -10015,7 +10083,7 @@ wsrep_append_key(
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
}
- wsrep_t *wsrep= get_wsrep();
+ wsrep_t *wsrep= get_wsrep();
int rcode = (int)wsrep->append_key(
wsrep,
wsrep_ws_handle(thd, trx),
@@ -10033,6 +10101,27 @@ wsrep_append_key(
DBUG_RETURN(0);
}
+static bool
+referenced_by_foreign_key2(dict_table_t* table,
+ dict_index_t* index) {
+ ut_ad(table != NULL);
+ ut_ad(index != NULL);
+
+ const dict_foreign_set* fks = &table->referenced_set;
+ for (dict_foreign_set::const_iterator it = fks->begin();
+ it != fks->end();
+ ++it)
+ {
+ dict_foreign_t* foreign = *it;
+ if (foreign->referenced_index != index) {
+ continue;
+ }
+ ut_ad(table == foreign->referenced_table);
+ return true;
+ }
+ return false;
+}
+
int
ha_innobase::wsrep_append_keys(
/*==================*/
@@ -10063,7 +10152,7 @@ ha_innobase::wsrep_append_keys(
ibool is_null;
len = wsrep_store_key_val_for_row(
- thd, table, 0, key, WSREP_MAX_SUPPORTED_KEY_LENGTH,
+ thd, table, 0, key, WSREP_MAX_SUPPORTED_KEY_LENGTH,
record0, &is_null);
if (!is_null) {
@@ -10112,7 +10201,7 @@ ha_innobase::wsrep_append_keys(
/* !hasPK == table with no PK, must append all non-unique keys */
if (!hasPK || key_info->flags & HA_NOSAME ||
((tab &&
- dict_table_get_referenced_constraint(tab, idx)) ||
+ referenced_by_foreign_key2(tab, idx)) ||
(!tab && referenced_by_foreign_key()))) {
len = wsrep_store_key_val_for_row(
@@ -10300,7 +10389,9 @@ create_table_def(
is a zero length-string */
const char* remote_path, /*!< in: Remote path or zero length-string */
ulint flags, /*!< in: table flags */
- ulint flags2) /*!< in: table flags2 */
+ ulint flags2, /*!< in: table flags2 */
+ fil_encryption_t mode, /*!< in: encryption mode */
+ ulint key_id) /*!< in: encryption key_id */
{
THD* thd = trx->mysql_thd;
dict_table_t* table;
@@ -10325,7 +10416,8 @@ create_table_def(
/* MySQL does the name length check. But we do additional check
on the name length here */
- if (strlen(table_name) > MAX_FULL_NAME_LEN) {
+ const size_t table_name_len = strlen(table_name);
+ if (table_name_len > MAX_FULL_NAME_LEN) {
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN,
ER_TABLE_NAME,
@@ -10334,6 +10426,15 @@ create_table_def(
DBUG_RETURN(ER_TABLE_NAME);
}
+ if (table_name[table_name_len - 1] == '/') {
+ push_warning_printf(
+ thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_TABLE_NAME,
+ "InnoDB: Table name is empty");
+
+ DBUG_RETURN(ER_WRONG_TABLE_NAME);
+ }
+
n_cols = form->s->fields;
/* Check whether there already exists a FTS_DOC_ID column */
@@ -10480,7 +10581,7 @@ err_col:
fts_add_doc_id_column(table, heap);
}
- err = row_create_table_for_mysql(table, trx, false);
+ err = row_create_table_for_mysql(table, trx, false, mode, key_id);
mem_heap_free(heap);
@@ -11392,12 +11493,12 @@ ha_innobase::check_table_options(
if (encrypt == FIL_SPACE_ENCRYPTION_ON ||
(encrypt == FIL_SPACE_ENCRYPTION_DEFAULT && srv_encrypt_tables)) {
- if (!encryption_key_id_exists(options->encryption_key_id)) {
+ if (!encryption_key_id_exists((unsigned int)options->encryption_key_id)) {
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN,
HA_WRONG_CREATE_OPTION,
- "InnoDB: ENCRYPTION_KEY_ID %lu not available",
- options->encryption_key_id
+ "InnoDB: ENCRYPTION_KEY_ID %u not available",
+ (uint)options->encryption_key_id
);
return "ENCRYPTION_KEY_ID";
}
@@ -11463,7 +11564,7 @@ ha_innobase::create(
/* Cache table options */
ha_table_option_struct *options= form->s->option_struct;
fil_encryption_t encrypt = (fil_encryption_t)options->encryption;
- ulint key_id = options->encryption_key_id;
+ uint key_id = (uint)options->encryption_key_id;
DBUG_ENTER("ha_innobase::create");
@@ -11556,7 +11657,7 @@ ha_innobase::create(
row_mysql_lock_data_dictionary(trx);
error = create_table_def(trx, form, norm_name, temp_path,
- remote_path, flags, flags2);
+ remote_path, flags, flags2, encrypt, key_id);
if (error) {
goto cleanup;
}
@@ -11716,48 +11817,6 @@ ha_innobase::create(
DBUG_ASSERT(innobase_table != 0);
- /* If user has requested that table should be encrypted or table
- should remain as unencrypted store crypt data */
- if (encrypt != FIL_SPACE_ENCRYPTION_DEFAULT) {
- ulint maxsize=0;
- ulint zip_size = fil_space_get_zip_size(innobase_table->space);
- fil_space_crypt_t* old_crypt_data = fil_space_get_crypt_data(innobase_table->space);
- fil_space_crypt_t* crypt_data;
-
- crypt_data = fil_space_create_crypt_data(encrypt, key_id);
- crypt_data->page0_offset = fsp_header_get_crypt_offset(zip_size, &maxsize);
- crypt_data->encryption = encrypt;
-
- /* If there is old crypt data, copy IV */
- if (old_crypt_data) {
- memcpy(crypt_data->iv, old_crypt_data->iv, sizeof(crypt_data->iv));
- }
-
- mtr_t mtr;
- mtr_start(&mtr);
- /* Get page 0*/
- ulint offset = 0;
- buf_block_t* block = buf_page_get_gen(innobase_table->space,
- zip_size,
- offset,
- RW_X_LATCH,
- NULL,
- BUF_GET,
- __FILE__, __LINE__,
- &mtr);
-
- /* Set up new crypt data */
- crypt_data = fil_space_set_crypt_data(innobase_table->space, crypt_data);
-
- /* Compute location to store crypt data */
- byte* frame = buf_block_get_frame(block);
-
- /* Write crypt data to page 0 */
- fil_space_write_crypt_data(innobase_table->space, frame, crypt_data->page0_offset, maxsize, &mtr);
-
- mtr_commit(&mtr);
- }
-
innobase_copy_frm_flags_from_create_info(innobase_table, create_info);
dict_stats_update(innobase_table, DICT_STATS_EMPTY_TABLE);
@@ -11922,6 +11981,8 @@ ha_innobase::discard_or_import_tablespace(
| HA_STATUS_CONST
| HA_STATUS_VARIABLE
| HA_STATUS_AUTO);
+
+ fil_crypt_set_encrypt_tables(srv_encrypt_tables);
}
}
@@ -12107,21 +12168,29 @@ ha_innobase::defragment_table(
const char* index_name, /*!< in: index name */
bool async) /*!< in: whether to wait until finish */
{
- char norm_name[FN_REFLEN];
- dict_table_t* table;
- dict_index_t* index;
+ char norm_name[FN_REFLEN];
+ dict_table_t* table = NULL;
+ dict_index_t* index = NULL;
ibool one_index = (index_name != 0);
int ret = 0;
+ dberr_t err = DB_SUCCESS;
+
if (!srv_defragment) {
return ER_FEATURE_DISABLED;
}
+
normalize_table_name(norm_name, name);
+
table = dict_table_open_on_name(norm_name, FALSE,
FALSE, DICT_ERR_IGNORE_NONE);
+
for (index = dict_table_get_first_index(table); index;
index = dict_table_get_next_index(index)) {
- if (one_index && strcasecmp(index_name, index->name) != 0)
+
+ if (one_index && strcasecmp(index_name, index->name) != 0) {
continue;
+ }
+
if (btr_defragment_find_index(index)) {
// We borrow this error code. When the same index is
// already in the defragmentation queue, issue another
@@ -12136,7 +12205,23 @@ ha_innobase::defragment_table(
ret = ER_SP_ALREADY_EXISTS;
break;
}
- os_event_t event = btr_defragment_add_index(index, async);
+
+ os_event_t event = btr_defragment_add_index(index, async, &err);
+
+ if (err != DB_SUCCESS) {
+ push_warning_printf(
+ current_thd,
+ Sql_condition::WARN_LEVEL_WARN,
+ ER_NO_SUCH_TABLE,
+ "Table %s is encrypted but encryption service or"
+ " used key_id is not available. "
+ " Can't continue checking table.",
+ index->table->name);
+
+ ret = convert_error_code_to_mysql(err, 0, current_thd);
+ break;
+ }
+
if (!async && event) {
while(os_event_wait_time(event, 1000000)) {
if (thd_killed(current_thd)) {
@@ -12147,18 +12232,23 @@ ha_innobase::defragment_table(
}
os_event_free(event);
}
+
if (ret) {
break;
}
+
if (one_index) {
one_index = FALSE;
break;
}
}
+
dict_table_close(table, FALSE, FALSE);
+
if (ret == 0 && one_index) {
ret = ER_NO_SUCH_INDEX;
}
+
return ret;
}
@@ -12606,6 +12696,13 @@ ha_innobase::estimate_rows_upper_bound()
prebuilt->trx->op_info = "";
+ /* Set num_rows less than MERGEBUFF to simulate the case where we do
+ not have enough space to merge the externally sorted file blocks. */
+ DBUG_EXECUTE_IF("set_num_rows_lt_MERGEBUFF",
+ estimate = 2;
+ DBUG_SET("-d,set_num_rows_lt_MERGEBUFF");
+ );
+
DBUG_RETURN((ha_rows) estimate);
}
@@ -12871,7 +12968,6 @@ ha_innobase::info_low(
dict_table_t* ib_table;
ha_rows rec_per_key;
ib_uint64_t n_rows;
- char path[FN_REFLEN];
os_file_stat_t stat_info;
DBUG_ENTER("info");
@@ -12929,17 +13025,6 @@ ha_innobase::info_low(
"returning various info to MySQL";
}
- my_snprintf(path, sizeof(path), "%s/%s%s",
- mysql_data_home, ib_table->name, reg_ext);
-
- unpack_filename(path,path);
-
- /* Note that we do not know the access time of the table,
- nor the CHECK TABLE time, nor the UPDATE or INSERT time. */
-
- if (os_file_get_status(path, &stat_info, false) == DB_SUCCESS) {
- stats.create_time = (ulong) stat_info.ctime;
- }
}
if (flag & HA_STATUS_VARIABLE) {
@@ -13071,6 +13156,7 @@ ha_innobase::info_low(
if (flag & HA_STATUS_CONST) {
ulong i;
+ char path[FN_REFLEN];
/* Verify the number of index in InnoDB and MySQL
matches up. If prebuilt->clust_index_was_generated
holds, InnoDB defines GEN_CLUST_INDEX internally */
@@ -13224,6 +13310,20 @@ ha_innobase::info_low(
if (!(flag & HA_STATUS_NO_LOCK)) {
dict_table_stats_unlock(ib_table, RW_S_LATCH);
}
+
+ my_snprintf(path, sizeof(path), "%s/%s%s",
+ mysql_data_home,
+ table->s->normalized_path.str,
+ reg_ext);
+
+ unpack_filename(path,path);
+
+ /* Note that we do not know the access time of the table,
+ nor the CHECK TABLE time, nor the UPDATE or INSERT time. */
+
+ if (os_file_get_status(path, &stat_info, false) == DB_SUCCESS) {
+ stats.create_time = (ulong) stat_info.ctime;
+ }
}
if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
@@ -13441,7 +13541,7 @@ ha_innobase::check(
server_mutex,
srv_fatal_semaphore_wait_threshold,
SRV_SEMAPHORE_WAIT_EXTENSION);
- bool valid = btr_validate_index(index, prebuilt->trx);
+ dberr_t err = btr_validate_index(index, prebuilt->trx);
/* Restore the fatal lock wait timeout after
CHECK TABLE. */
@@ -13450,19 +13550,32 @@ ha_innobase::check(
srv_fatal_semaphore_wait_threshold,
SRV_SEMAPHORE_WAIT_EXTENSION);
- if (!valid) {
+ if (err != DB_SUCCESS) {
is_ok = false;
innobase_format_name(
index_name, sizeof index_name,
index->name, TRUE);
- push_warning_printf(
- thd,
- Sql_condition::WARN_LEVEL_WARN,
- ER_NOT_KEYFILE,
- "InnoDB: The B-tree of"
- " index %s is corrupted.",
- index_name);
+
+ if (err == DB_DECRYPTION_FAILED) {
+ push_warning_printf(
+ thd,
+ Sql_condition::WARN_LEVEL_WARN,
+ ER_NO_SUCH_TABLE,
+ "Table %s is encrypted but encryption service or"
+ " used key_id is not available. "
+ " Can't continue checking table.",
+ index->table->name);
+ } else {
+ push_warning_printf(
+ thd,
+ Sql_condition::WARN_LEVEL_WARN,
+ ER_NOT_KEYFILE,
+ "InnoDB: The B-tree of"
+ " index %s is corrupted.",
+ index_name);
+ }
+
continue;
}
}
@@ -14256,7 +14369,7 @@ ha_innobase::external_lock(
DBUG_EXECUTE_IF("no_innodb_binlog_errors", skip = true;);
if (!skip) {
#ifdef WITH_WSREP
- if (!wsrep_on(thd) || wsrep_thd_exec_mode(thd) == LOCAL_STATE)
+ if (!wsrep_on(thd) || wsrep_thd_exec_mode(thd) == LOCAL_STATE)
{
#endif /* WITH_WSREP */
my_error(ER_BINLOG_STMT_MODE_AND_ROW_ENGINE, MYF(0),
@@ -15451,8 +15564,13 @@ ha_innobase::get_error_message(
{
trx_t* trx = check_trx_exists(ha_thd());
- buf->copy(trx->detailed_error, (uint) strlen(trx->detailed_error),
- system_charset_info);
+ if (error == HA_ERR_DECRYPTION_FAILED) {
+ const char *msg = "Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.";
+ buf->copy(msg, (uint)strlen(msg), system_charset_info);
+ } else {
+ buf->copy(trx->detailed_error, (uint) strlen(trx->detailed_error),
+ system_charset_info);
+ }
return(FALSE);
}
@@ -17881,7 +17999,7 @@ innodb_encrypt_tables_update(
const void* save) /*!< in: immediate result
from check function */
{
- fil_crypt_set_encrypt_tables(*static_cast<const uint*>(save));
+ fil_crypt_set_encrypt_tables(*static_cast<const ulong*>(save));
}
static SHOW_VAR innodb_status_variables_export[]= {
@@ -17991,7 +18109,7 @@ wsrep_innobase_kill_one_trx(void * const bf_thd_ptr,
wsrep_abort_slave_trx(bf_seqno,
wsrep_thd_trx_seqno(thd));
} else {
- wsrep_t *wsrep= get_wsrep();
+ wsrep_t *wsrep= get_wsrep();
rcode = wsrep->abort_pre_commit(
wsrep, bf_seqno,
(wsrep_trx_id_t)victim_trx->id
@@ -18077,20 +18195,20 @@ wsrep_innobase_kill_one_trx(void * const bf_thd_ptr,
wsrep_lock_rollback();
- if (wsrep_aborting_thd_contains(thd)) {
- WSREP_WARN("duplicate thd aborter %lu",
- thd_get_thread_id(thd));
- } else {
- wsrep_aborting_thd_enqueue(thd);
- DBUG_PRINT("wsrep",("enqueuing trx abort for %lu",
- thd_get_thread_id(thd)));
- WSREP_DEBUG("enqueuing trx abort for (%lu)",
- thd_get_thread_id(thd));
+ if (wsrep_aborting_thd_contains(thd)) {
+ WSREP_WARN("duplicate thd aborter %lu",
+ thd_get_thread_id(thd));
+ } else {
+ wsrep_aborting_thd_enqueue(thd);
+ DBUG_PRINT("wsrep",("enqueuing trx abort for %lu",
+ thd_get_thread_id(thd)));
+ WSREP_DEBUG("enqueuing trx abort for (%lu)",
+ thd_get_thread_id(thd));
}
DBUG_PRINT("wsrep",("signalling wsrep rollbacker"));
WSREP_DEBUG("signaling aborter");
- wsrep_unlock_rollback();
+ wsrep_unlock_rollback();
wsrep_thd_UNLOCK(thd);
break;
@@ -18105,8 +18223,7 @@ wsrep_innobase_kill_one_trx(void * const bf_thd_ptr,
DBUG_RETURN(0);
}
-static
-int
+static int
wsrep_abort_transaction(handlerton* hton, THD *bf_thd, THD *victim_thd,
my_bool signal)
{
@@ -18133,7 +18250,7 @@ wsrep_abort_transaction(handlerton* hton, THD *bf_thd, THD *victim_thd,
wsrep_thd_LOCK(victim_thd);
wsrep_thd_set_conflict_state(victim_thd, MUST_ABORT);
wsrep_thd_UNLOCK(victim_thd);
- wsrep_thd_awake(victim_thd, signal);
+ wsrep_thd_awake(victim_thd, signal);
}
DBUG_RETURN(-1);
}
@@ -18985,6 +19102,14 @@ static MYSQL_SYSVAR_BOOL(disable_background_merge,
NULL, NULL, FALSE);
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
+static MYSQL_SYSVAR_ULONG(buf_dump_status_frequency, srv_buf_dump_status_frequency,
+ PLUGIN_VAR_RQCMDARG,
+ "A number between [0, 100] that tells how oftern buffer pool dump status "
+ "in percentages should be printed. E.g. 10 means that buffer pool dump "
+ "status is printed when every 10% of number of buffer pool pages are "
+ "dumped. Default is 0 (only start and end status is printed).",
+ NULL, NULL, 0, 0, 100, 0);
+
#ifdef WITH_INNODB_DISALLOW_WRITES
/*******************************************************
* innobase_disallow_writes variable definition *
@@ -19485,6 +19610,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(debug_force_scrubbing),
#endif
MYSQL_SYSVAR(instrument_semaphores),
+ MYSQL_SYSVAR(buf_dump_status_frequency),
NULL
};
@@ -20115,7 +20241,7 @@ innodb_encrypt_tables_validate(
if (check_sysvar_enum(thd, var, save, value))
return 1;
- long encrypt_tables = *(long*)save;
+ ulong encrypt_tables = *(ulong*)save;
if (encrypt_tables
&& !encryption_key_id_exists(FIL_DEFAULT_ENCRYPTION_KEY)) {
@@ -20134,3 +20260,59 @@ static void innodb_remember_check_sysvar_funcs()
ut_ad((MYSQL_SYSVAR_NAME(checksum_algorithm).flags & 0x1FF) == PLUGIN_VAR_ENUM);
check_sysvar_enum = MYSQL_SYSVAR_NAME(checksum_algorithm).check;
}
+
+/********************************************************************//**
+Helper function to push warnings from InnoDB internals to SQL-layer. */
+UNIV_INTERN
+void
+ib_push_warning(
+ trx_t* trx, /*!< in: trx */
+ ulint error, /*!< in: error code to push as warning */
+ const char *format,/*!< in: warning message */
+ ...)
+{
+ va_list args;
+ THD *thd = (THD *)trx->mysql_thd;
+ char *buf;
+#define MAX_BUF_SIZE 4*1024
+
+ va_start(args, format);
+ buf = (char *)my_malloc(MAX_BUF_SIZE, MYF(MY_WME));
+ vsprintf(buf,format, args);
+
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ convert_error_code_to_mysql((dberr_t)error, 0, thd),
+ buf);
+ my_free(buf);
+ va_end(args);
+}
+
+/********************************************************************//**
+Helper function to push warnings from InnoDB internals to SQL-layer. */
+UNIV_INTERN
+void
+ib_push_warning(
+ void* ithd, /*!< in: thd */
+ ulint error, /*!< in: error code to push as warning */
+ const char *format,/*!< in: warning message */
+ ...)
+{
+ va_list args;
+ THD *thd = (THD *)ithd;
+ char *buf;
+#define MAX_BUF_SIZE 4*1024
+
+ if (ithd == NULL) {
+ thd = current_thd;
+ }
+
+ va_start(args, format);
+ buf = (char *)my_malloc(MAX_BUF_SIZE, MYF(MY_WME));
+ vsprintf(buf,format, args);
+
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ convert_error_code_to_mysql((dberr_t)error, 0, thd),
+ buf);
+ my_free(buf);
+ va_end(args);
+}
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index b613053a992..4f4a0b2f999 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -60,18 +60,18 @@ struct row_prebuilt_t;
/** Engine specific table options are defined using this struct */
struct ha_table_option_struct
{
- bool page_compressed; /*!< Table is using page compression
- if this option is true. */
- int page_compression_level; /*!< Table page compression level
- or UNIV_UNSPECIFIED. */
- uint atomic_writes; /*!< Use atomic writes for this
- table if this options is ON or
- in DEFAULT if
- srv_use_atomic_writes=1.
- Atomic writes are not used if
- value OFF.*/
- uint encryption; /*!< DEFAULT, ON, OFF */
- int encryption_key_id; /*!< encryption key id*/
+ bool page_compressed; /*!< Table is using page compression
+ if this option is true. */
+ ulonglong page_compression_level; /*!< Table page compression level
+ 0-9. */
+ uint atomic_writes; /*!< Use atomic writes for this
+ table if this options is ON or
+ in DEFAULT if
+ srv_use_atomic_writes=1.
+ Atomic writes are not used if
+ value OFF.*/
+ uint encryption; /*!< DEFAULT, ON, OFF */
+ ulonglong encryption_key_id; /*!< encryption key id */
};
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 4cb912cd023..2cede8cd82c 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
-Copyright (c) 2005, 2014, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2014, SkySQL Ab. All Rights Reserved.
+Copyright (c) 2005, 2015, Oracle and/or its affiliates
+Copyright (c) 2013, 2015, MariaDB Corporation. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -30,6 +30,7 @@ Smart ALTER TABLE
#include <innodb_priv.h>
#include <sql_alter.h>
#include <sql_class.h>
+#include <sql_table.h>
#include "dict0crea.h"
#include "dict0dict.h"
@@ -396,6 +397,35 @@ ha_innobase::check_if_supported_inplace_alter(
}
}
+ /* If we have column that has changed from NULL -> NOT NULL
+ and column default has changed we need to do additional
+ check. */
+ if ((ha_alter_info->handler_flags
+ & Alter_inplace_info::ALTER_COLUMN_NOT_NULLABLE) &&
+ (ha_alter_info->handler_flags
+ & Alter_inplace_info::ALTER_COLUMN_DEFAULT)) {
+ Alter_info *alter_info = ha_alter_info->alter_info;
+ List_iterator<Create_field> def_it(alter_info->create_list);
+ Create_field *def;
+ while ((def=def_it++)) {
+
+ /* If this is first column definition whose SQL type
+ is TIMESTAMP and it is defined as NOT NULL and
+ it has either constant default or function default
+ we must use "Copy" method. */
+ if (is_timestamp_type(def->sql_type)) {
+ if ((def->flags & NOT_NULL_FLAG) != 0 && // NOT NULL
+ (def->def != NULL || // constant default ?
+ def->unireg_check != Field::NONE)) { // function default
+ ha_alter_info->unsupported_reason = innobase_get_err_msg(
+ ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOT_NULL);
+ DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
+ }
+ break;
+ }
+ }
+ }
+
/* We should be able to do the operation in-place.
See if we can do it online (LOCK=NONE). */
bool online = true;
@@ -523,12 +553,9 @@ ha_innobase::check_if_supported_inplace_alter(
} else if (((ha_alter_info->handler_flags
& Alter_inplace_info::ADD_PK_INDEX)
|| innobase_need_rebuild(ha_alter_info))
- && (innobase_fulltext_exist(altered_table)
- || (prebuilt->table->flags2
- & DICT_TF2_FTS_HAS_DOC_ID))) {
+ && (innobase_fulltext_exist(altered_table))) {
/* Refuse to rebuild the table online, if
- fulltext indexes are to survive the rebuild,
- or if the table contains a hidden FTS_DOC_ID column. */
+ fulltext indexes are to survive the rebuild. */
online = false;
/* If the table already contains fulltext indexes,
refuse to rebuild the table natively altogether. */
@@ -819,7 +846,8 @@ innobase_find_fk_index(
if (!(index->type & DICT_FTS)
&& dict_foreign_qualify_index(
table, col_names, columns, n_cols,
- index, NULL, true, 0)) {
+ index, NULL, true, 0,
+ NULL, NULL, NULL)) {
for (ulint i = 0; i < n_drop_index; i++) {
if (index == drop_index[i]) {
/* Skip to-be-dropped indexes. */
@@ -886,10 +914,8 @@ innobase_get_foreign_key_info(
char* tbl_namep = NULL;
ulint db_name_len = 0;
ulint tbl_name_len = 0;
-#ifdef __WIN__
char db_name[MAX_DATABASE_NAME_LEN];
char tbl_name[MAX_TABLE_NAME_LEN];
-#endif
fk_key = static_cast<Foreign_key*>(key);
@@ -942,24 +968,29 @@ innobase_get_foreign_key_info(
add_fk[num_fk] = dict_mem_foreign_create();
#ifndef __WIN__
- tbl_namep = fk_key->ref_table.str;
- tbl_name_len = fk_key->ref_table.length;
- db_namep = fk_key->ref_db.str;
- db_name_len = fk_key->ref_db.length;
+ if(fk_key->ref_db.str) {
+ tablename_to_filename(fk_key->ref_db.str, db_name,
+ MAX_DATABASE_NAME_LEN);
+ db_namep = db_name;
+ db_name_len = strlen(db_name);
+ }
+ if (fk_key->ref_table.str) {
+ tablename_to_filename(fk_key->ref_table.str, tbl_name,
+ MAX_TABLE_NAME_LEN);
+ tbl_namep = tbl_name;
+ tbl_name_len = strlen(tbl_name);
+ }
#else
ut_ad(fk_key->ref_table.str);
-
- memcpy(tbl_name, fk_key->ref_table.str,
- fk_key->ref_table.length);
- tbl_name[fk_key->ref_table.length] = 0;
+ tablename_to_filename(fk_key->ref_table.str, tbl_name,
+ MAX_TABLE_NAME_LEN);
innobase_casedn_str(tbl_name);
tbl_name_len = strlen(tbl_name);
tbl_namep = &tbl_name[0];
if (fk_key->ref_db.str != NULL) {
- memcpy(db_name, fk_key->ref_db.str,
- fk_key->ref_db.length);
- db_name[fk_key->ref_db.length] = 0;
+ tablename_to_filename(fk_key->ref_db.str, db_name,
+ MAX_DATABASE_NAME_LEN);
innobase_casedn_str(db_name);
db_name_len = strlen(db_name);
db_namep = &db_name[0];
@@ -1009,7 +1040,8 @@ innobase_get_foreign_key_info(
referenced_table, 0,
referenced_column_names,
i, index,
- TRUE, FALSE);
+ TRUE, FALSE,
+ NULL, NULL, NULL);
DBUG_EXECUTE_IF(
"innodb_test_no_reference_idx",
@@ -2791,6 +2823,7 @@ prepare_inplace_alter_table_dict(
to rebuild the table with a temporary name. */
if (new_clustered) {
+ fil_space_crypt_t* crypt_data;
const char* new_table_name
= dict_mem_create_temporary_tablename(
ctx->heap,
@@ -2798,6 +2831,15 @@ prepare_inplace_alter_table_dict(
ctx->new_table->id);
ulint n_cols;
dtuple_t* add_cols;
+ ulint key_id = FIL_DEFAULT_ENCRYPTION_KEY;
+ fil_encryption_t mode = FIL_SPACE_ENCRYPTION_DEFAULT;
+
+ crypt_data = fil_space_get_crypt_data(ctx->prebuilt->table->space);
+
+ if (crypt_data) {
+ key_id = crypt_data->key_id;
+ mode = crypt_data->encryption;
+ }
if (innobase_check_foreigns(
ha_alter_info, altered_table, old_table,
@@ -2929,7 +2971,7 @@ prepare_inplace_alter_table_dict(
}
error = row_create_table_for_mysql(
- ctx->new_table, ctx->trx, false);
+ ctx->new_table, ctx->trx, false, mode, key_id);
switch (error) {
dict_table_t* temp_table;
@@ -3300,58 +3342,74 @@ innobase_check_foreign_key_index(
ulint n_drop_fk) /*!< in: Number of foreign keys
to drop */
{
- dict_foreign_t* foreign;
+ ut_ad(index != NULL);
+ ut_ad(indexed_table != NULL);
- /* Check if the index is referenced. */
- foreign = dict_table_get_referenced_constraint(indexed_table, index);
-
- ut_ad(!foreign || indexed_table
- == foreign->referenced_table);
-
- if (foreign
- && !dict_foreign_find_index(
- indexed_table, col_names,
- foreign->referenced_col_names,
- foreign->n_fields, index,
- /*check_charsets=*/TRUE,
- /*check_null=*/FALSE)
- && !innobase_find_equiv_index(
- foreign->referenced_col_names,
- foreign->n_fields,
- ha_alter_info->key_info_buffer,
- ha_alter_info->index_add_buffer,
- ha_alter_info->index_add_count)
- ) {
- trx->error_info = index;
- return(true);
+ const dict_foreign_set* fks = &indexed_table->referenced_set;
+
+ /* Check for all FK references from other tables to the index. */
+ for (dict_foreign_set::const_iterator it = fks->begin();
+ it != fks->end(); ++it) {
+
+ dict_foreign_t* foreign = *it;
+ if (foreign->referenced_index != index) {
+ continue;
+ }
+ ut_ad(indexed_table == foreign->referenced_table);
+
+ if (NULL == dict_foreign_find_index(
+ indexed_table, col_names,
+ foreign->referenced_col_names,
+ foreign->n_fields, index,
+ /*check_charsets=*/TRUE,
+ /*check_null=*/FALSE,
+ NULL, NULL, NULL)
+ && NULL == innobase_find_equiv_index(
+ foreign->referenced_col_names,
+ foreign->n_fields,
+ ha_alter_info->key_info_buffer,
+ ha_alter_info->index_add_buffer,
+ ha_alter_info->index_add_count)) {
+
+ /* Index cannot be dropped. */
+ trx->error_info = index;
+ return(true);
+ }
}
- /* Check if this index references some
- other table */
- foreign = dict_table_get_foreign_constraint(
- indexed_table, index);
-
- ut_ad(!foreign || indexed_table
- == foreign->foreign_table);
-
- if (foreign
- && !innobase_dropping_foreign(
- foreign, drop_fk, n_drop_fk)
- && !dict_foreign_find_index(
- indexed_table, col_names,
- foreign->foreign_col_names,
- foreign->n_fields, index,
- /*check_charsets=*/TRUE,
- /*check_null=*/FALSE)
- && !innobase_find_equiv_index(
- foreign->foreign_col_names,
- foreign->n_fields,
- ha_alter_info->key_info_buffer,
- ha_alter_info->index_add_buffer,
- ha_alter_info->index_add_count)
- ) {
- trx->error_info = index;
- return(true);
+ fks = &indexed_table->foreign_set;
+
+ /* Check for all FK references in current table using the index. */
+ for (dict_foreign_set::const_iterator it = fks->begin();
+ it != fks->end(); ++it) {
+
+ dict_foreign_t* foreign = *it;
+ if (foreign->foreign_index != index) {
+ continue;
+ }
+
+ ut_ad(indexed_table == foreign->foreign_table);
+
+ if (!innobase_dropping_foreign(
+ foreign, drop_fk, n_drop_fk)
+ && NULL == dict_foreign_find_index(
+ indexed_table, col_names,
+ foreign->foreign_col_names,
+ foreign->n_fields, index,
+ /*check_charsets=*/TRUE,
+ /*check_null=*/FALSE,
+ NULL, NULL, NULL)
+ && NULL == innobase_find_equiv_index(
+ foreign->foreign_col_names,
+ foreign->n_fields,
+ ha_alter_info->key_info_buffer,
+ ha_alter_info->index_add_buffer,
+ ha_alter_info->index_add_count)) {
+
+ /* Index cannot be dropped. */
+ trx->error_info = index;
+ return(true);
+ }
}
return(false);
@@ -3586,6 +3644,19 @@ check_if_ok_to_rename:
if (index->type & DICT_FTS) {
DBUG_ASSERT(index->type == DICT_FTS
|| (index->type & DICT_CORRUPT));
+
+ /* We need to drop any corrupted fts indexes
+ before we add a new fts index. */
+ if (add_fts_idx && index->type & DICT_CORRUPT) {
+ ib_errf(user_thd, IB_LOG_LEVEL_ERROR,
+ ER_INNODB_INDEX_CORRUPT,
+ "Fulltext index '%s' is corrupt. "
+ "you should drop this index first.",
+ index->name);
+
+ goto err_exit_no_heap;
+ }
+
continue;
}
@@ -4108,6 +4179,13 @@ oom:
: ha_alter_info->key_info_buffer[
prebuilt->trx->error_key_num].name);
break;
+ case DB_DECRYPTION_FAILED: {
+ String str;
+ const char* engine= table_type();
+ get_error_message(HA_ERR_DECRYPTION_FAILED, &str);
+ my_error(ER_GET_ERRMSG, MYF(0), HA_ERR_DECRYPTION_FAILED, str.c_ptr(), engine);
+ break;
+ }
default:
my_error_innodb(error,
table_share->table_name.str,
@@ -4807,7 +4885,8 @@ innobase_update_foreign_try(
fk->n_fields, fk->referenced_index, TRUE,
fk->type
& (DICT_FOREIGN_ON_DELETE_SET_NULL
- | DICT_FOREIGN_ON_UPDATE_SET_NULL));
+ | DICT_FOREIGN_ON_UPDATE_SET_NULL),
+ NULL, NULL, NULL);
if (!fk->foreign_index) {
my_error(ER_FK_INCORRECT_OPTION,
MYF(0), table_name, fk->id);
@@ -4819,7 +4898,7 @@ innobase_update_foreign_try(
names, while the columns in ctx->old_table have not
been renamed yet. */
error = dict_create_add_foreign_to_dictionary(
- ctx->old_table->name, fk, trx);
+ (dict_table_t*)ctx->old_table,ctx->old_table->name, fk, trx);
DBUG_EXECUTE_IF(
"innodb_test_cannot_add_fk_system",
diff --git a/storage/innobase/include/api0api.h b/storage/innobase/include/api0api.h
index d77d691becc..e4c9c941de5 100644
--- a/storage/innobase/include/api0api.h
+++ b/storage/innobase/include/api0api.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2011, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -494,6 +494,14 @@ ib_trx_state(
/*=========*/
ib_trx_t ib_trx); /*!< in: trx handle */
+
+/*****************************************************************//**
+Check if the transaction is read_only */
+ib_u32_t
+ib_trx_read_only(
+/*=============*/
+ ib_trx_t ib_trx); /*!< in: trx handle */
+
/*****************************************************************//**
Release the resources of the transaction. If the transaction was
selected as a victim by InnoDB and rolled back then use this function
diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h
index 3cd44e3a39f..95ce104e7ea 100644
--- a/storage/innobase/include/btr0btr.h
+++ b/storage/innobase/include/btr0btr.h
@@ -2,7 +2,7 @@
Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2014, SkySQL Ab. All Rights Reserved.
+Copyright (c) 2014, 2015, MariaDB Corporation. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -259,10 +259,8 @@ btr_block_get_func(
ulint mode, /*!< in: latch mode */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
-# ifdef UNIV_SYNC_DEBUG
- const dict_index_t* index, /*!< in: index tree, may be NULL
+ dict_index_t* index, /*!< in: index tree, may be NULL
if it is not an insert buffer tree */
-# endif /* UNIV_SYNC_DEBUG */
mtr_t* mtr); /*!< in/out: mini-transaction */
# ifdef UNIV_SYNC_DEBUG
/** Gets a buffer page and declares its latching order level.
@@ -286,7 +284,8 @@ btr_block_get_func(
@param mtr mini-transaction handle
@return the block descriptor */
# define btr_block_get(space,zip_size,page_no,mode,idx,mtr) \
- btr_block_get_func(space,zip_size,page_no,mode,__FILE__,__LINE__,mtr)
+ btr_block_get_func(space,zip_size,page_no,mode, \
+ __FILE__,__LINE__,idx,mtr)
# endif /* UNIV_SYNC_DEBUG */
/** Gets a buffer page and declares its latching order level.
@param space tablespace identifier
@@ -297,7 +296,8 @@ btr_block_get_func(
@param mtr mini-transaction handle
@return the uncompressed page frame */
# define btr_page_get(space,zip_size,page_no,mode,idx,mtr) \
- buf_block_get_frame(btr_block_get(space,zip_size,page_no,mode,idx,mtr))
+ buf_block_get_frame(btr_block_get(space,zip_size,page_no, \
+ mode,idx,mtr))
#endif /* !UNIV_HOTBACKUP */
/**************************************************************//**
Gets the index id field of a page.
@@ -797,9 +797,9 @@ btr_index_rec_validate(
__attribute__((nonnull, warn_unused_result));
/**************************************************************//**
Checks the consistency of an index tree.
-@return TRUE if ok */
+@return DB_SUCCESS if ok, error code if not */
UNIV_INTERN
-bool
+dberr_t
btr_validate_index(
/*===============*/
dict_index_t* index, /*!< in: index */
@@ -825,7 +825,7 @@ Removes a page from the level list of pages.
@param index in: index tree
@param mtr in/out: mini-transaction */
# define btr_level_list_remove(space,zip_size,page,index,mtr) \
- btr_level_list_remove_func(space,zip_size,page,mtr)
+ btr_level_list_remove_func(space,zip_size,page,index,mtr)
#endif /* UNIV_SYNC_DEBUG */
/*************************************************************//**
@@ -838,11 +838,8 @@ btr_level_list_remove_func(
ulint zip_size,/*!< in: compressed page size in bytes
or 0 for uncompressed pages */
page_t* page, /*!< in/out: page to remove */
-#ifdef UNIV_SYNC_DEBUG
- const dict_index_t* index, /*!< in: index tree */
-#endif /* UNIV_SYNC_DEBUG */
- mtr_t* mtr) /*!< in/out: mini-transaction */
- __attribute__((nonnull));
+ dict_index_t* index, /*!< in: index tree */
+ mtr_t* mtr); /*!< in/out: mini-transaction */
/*************************************************************//**
If page is the only on its level, this function moves its records to the
diff --git a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0btr.ic
index 40b468b200a..5fc621f469d 100644
--- a/storage/innobase/include/btr0btr.ic
+++ b/storage/innobase/include/btr0btr.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -48,22 +49,27 @@ btr_block_get_func(
ulint mode, /*!< in: latch mode */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
-#ifdef UNIV_SYNC_DEBUG
- const dict_index_t* index, /*!< in: index tree, may be NULL
+ dict_index_t* index, /*!< in: index tree, may be NULL
if it is not an insert buffer tree */
-#endif /* UNIV_SYNC_DEBUG */
mtr_t* mtr) /*!< in/out: mtr */
{
buf_block_t* block;
+ dberr_t err;
block = buf_page_get_gen(space, zip_size, page_no, mode,
- NULL, BUF_GET, file, line, mtr);
+ NULL, BUF_GET, file, line, mtr, &err);
- if (mode != RW_NO_LATCH) {
+ if (err == DB_DECRYPTION_FAILED) {
+ index->table->is_encrypted = true;
+ }
+
+ if (block) {
+ if (mode != RW_NO_LATCH) {
- buf_block_dbg_add_level(
- block, index != NULL && dict_index_is_ibuf(index)
- ? SYNC_IBUF_TREE_NODE : SYNC_TREE_NODE);
+ buf_block_dbg_add_level(
+ block, index != NULL && dict_index_is_ibuf(index)
+ ? SYNC_IBUF_TREE_NODE : SYNC_TREE_NODE);
+ }
}
return(block);
diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h
index d0fd5c2158a..88e3b84e04b 100644
--- a/storage/innobase/include/btr0cur.h
+++ b/storage/innobase/include/btr0cur.h
@@ -136,7 +136,7 @@ Note that if mode is PAGE_CUR_LE, which is used in inserts, then
cursor->up_match and cursor->low_match both will have sensible values.
If mode is PAGE_CUR_GE, then up_match will a have a sensible value. */
UNIV_INTERN
-void
+dberr_t
btr_cur_search_to_nth_level(
/*========================*/
dict_index_t* index, /*!< in: index */
@@ -173,7 +173,7 @@ btr_cur_search_to_nth_level(
/*****************************************************************//**
Opens a cursor at either end of an index. */
UNIV_INTERN
-void
+dberr_t
btr_cur_open_at_index_side_func(
/*============================*/
bool from_left, /*!< in: true if open to the low end,
diff --git a/storage/innobase/include/btr0defragment.h b/storage/innobase/include/btr0defragment.h
index 8fef3c6519a..6257c4bc996 100644
--- a/storage/innobase/include/btr0defragment.h
+++ b/storage/innobase/include/btr0defragment.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (C) 2013, 2014 Facebook, Inc. All Rights Reserved.
+Copyright (C) 2014, 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -67,7 +68,9 @@ is a synchronized defragmentation. */
os_event_t
btr_defragment_add_index(
dict_index_t* index, /*!< index to be added */
- bool async); /*!< whether this is an async defragmentation */
+ bool async, /*!< whether this is an async
+ defragmentation */
+ dberr_t* err); /*!< out: error code */
/******************************************************************//**
When table is dropped, this function is called to mark a table as removed in
btr_efragment_wq. The difference between this function and the remove_index
diff --git a/storage/innobase/include/btr0pcur.h b/storage/innobase/include/btr0pcur.h
index cfbaacf4de3..d8e7cf6b283 100644
--- a/storage/innobase/include/btr0pcur.h
+++ b/storage/innobase/include/btr0pcur.h
@@ -114,7 +114,7 @@ btr_pcur_open_low(
Opens an persistent cursor to an index tree without initializing the
cursor. */
UNIV_INLINE
-void
+dberr_t
btr_pcur_open_with_no_init_func(
/*============================*/
dict_index_t* index, /*!< in: index */
@@ -143,7 +143,7 @@ btr_pcur_open_with_no_init_func(
/*****************************************************************//**
Opens a persistent cursor at either end of an index. */
UNIV_INLINE
-void
+dberr_t
btr_pcur_open_at_index_side(
/*========================*/
bool from_left, /*!< in: true if open to the low end,
diff --git a/storage/innobase/include/btr0pcur.ic b/storage/innobase/include/btr0pcur.ic
index 7e355d3709d..1cd13824542 100644
--- a/storage/innobase/include/btr0pcur.ic
+++ b/storage/innobase/include/btr0pcur.ic
@@ -447,7 +447,7 @@ btr_pcur_open_low(
Opens an persistent cursor to an index tree without initializing the
cursor. */
UNIV_INLINE
-void
+dberr_t
btr_pcur_open_with_no_init_func(
/*============================*/
dict_index_t* index, /*!< in: index */
@@ -472,6 +472,7 @@ btr_pcur_open_with_no_init_func(
mtr_t* mtr) /*!< in: mtr */
{
btr_cur_t* btr_cursor;
+ dberr_t err = DB_SUCCESS;
cursor->latch_mode = latch_mode;
cursor->search_mode = mode;
@@ -480,20 +481,21 @@ btr_pcur_open_with_no_init_func(
btr_cursor = btr_pcur_get_btr_cur(cursor);
- btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode,
- btr_cursor, has_search_latch,
- file, line, mtr);
+ err = btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode,
+ btr_cursor, has_search_latch,
+ file, line, mtr);
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
cursor->trx_if_known = NULL;
+ return err;
}
/*****************************************************************//**
Opens a persistent cursor at either end of an index. */
UNIV_INLINE
-void
+dberr_t
btr_pcur_open_at_index_side(
/*========================*/
bool from_left, /*!< in: true if open to the low end,
@@ -506,6 +508,8 @@ btr_pcur_open_at_index_side(
(0=leaf) */
mtr_t* mtr) /*!< in/out: mini-transaction */
{
+ dberr_t err = DB_SUCCESS;
+
pcur->latch_mode = BTR_LATCH_MODE_WITHOUT_FLAGS(latch_mode);
pcur->search_mode = from_left ? PAGE_CUR_G : PAGE_CUR_L;
@@ -514,13 +518,15 @@ btr_pcur_open_at_index_side(
btr_pcur_init(pcur);
}
- btr_cur_open_at_index_side(from_left, index, latch_mode,
- btr_pcur_get_btr_cur(pcur), level, mtr);
+ err = btr_cur_open_at_index_side(from_left, index, latch_mode,
+ btr_pcur_get_btr_cur(pcur), level, mtr);
pcur->pos_state = BTR_PCUR_IS_POSITIONED;
pcur->old_stored = BTR_PCUR_OLD_NOT_STORED;
pcur->trx_if_known = NULL;
+
+ return (err);
}
/**********************************************************************//**
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index 4ade85b0975..6c8e8e00507 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2014, SkySQL Ab. All Rights Reserved.
+Copyright (c) 2013, 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -430,7 +430,8 @@ buf_page_get_gen(
BUF_GET_IF_IN_POOL_OR_WATCH */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
- mtr_t* mtr); /*!< in: mini-transaction */
+ mtr_t* mtr, /*!< in: mini-transaction */
+ dberr_t* err = NULL); /*!< out: error code */
/********************************************************************//**
Initializes a page to the buffer buf_pool. The page is usually not read
from a file even if it cannot be found in the buffer buf_pool. This is one
@@ -1449,9 +1450,9 @@ UNIV_INTERN
byte*
buf_page_encrypt_before_write(
/*==========================*/
- buf_page_t* page, /*!< in/out: buffer page to be flushed */
- const byte* frame,
- ulint space_id);
+ buf_page_t* page, /*!< in/out: buffer page to be flushed */
+ byte* frame, /*!< in: src frame */
+ ulint space_id); /*!< in: space id */
/**********************************************************************
The hook that is called after page is written to disk.
@@ -1582,6 +1583,14 @@ struct buf_page_t{
operation needed. */
unsigned key_version; /*!< key version for this block */
+ bool page_encrypted; /*!< page is page encrypted */
+ bool page_compressed;/*!< page is page compressed */
+ ulint stored_checksum;/*!< stored page checksum if page
+ encrypted */
+ bool encrypted; /*!< page is still encrypted */
+ ulint calculated_checksum;
+ /*!< calculated checksum if page
+ encrypted */
ulint real_size; /*!< Real size of the page
Normal pages == UNIV_PAGE_SIZE
page compressed pages, payload
diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
index 6c128b097b0..a80a4c0a391 100644
--- a/storage/innobase/include/buf0buf.ic
+++ b/storage/innobase/include/buf0buf.ic
@@ -663,13 +663,18 @@ buf_block_get_frame(
/*================*/
const buf_block_t* block) /*!< in: pointer to the control block */
{
- ut_ad(block);
+ if (!block) {
+ return NULL;
+ }
switch (buf_block_get_state(block)) {
case BUF_BLOCK_POOL_WATCH:
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
case BUF_BLOCK_NOT_USED:
+ if (block->page.encrypted) {
+ goto ok;
+ }
ut_error;
break;
case BUF_BLOCK_FILE_PAGE:
diff --git a/storage/innobase/include/buf0rea.h b/storage/innobase/include/buf0rea.h
index d2a1f264ff5..10714031710 100644
--- a/storage/innobase/include/buf0rea.h
+++ b/storage/innobase/include/buf0rea.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -41,7 +42,8 @@ buf_read_page(
/*==========*/
ulint space, /*!< in: space id */
ulint zip_size,/*!< in: compressed page size in bytes, or 0 */
- ulint offset);/*!< in: page number */
+ ulint offset, /*!< in: page number */
+ buf_page_t** bpage);/*!< out: page */
/********************************************************************//**
High-level function which reads a page asynchronously from a file to the
buffer buf_pool if it is not already there. Sets the io_fix flag and sets
diff --git a/storage/innobase/include/db0err.h b/storage/innobase/include/db0err.h
index 1e87ce3fdb8..feac81af98e 100644
--- a/storage/innobase/include/db0err.h
+++ b/storage/innobase/include/db0err.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -132,6 +133,11 @@ enum dberr_t {
/*< Too many words in a phrase */
DB_TOO_BIG_FOR_REDO, /* Record length greater than 10%
of redo log */
+ DB_DECRYPTION_FAILED, /* Tablespace encrypted and
+ decrypt operation failed because
+ of missing key management plugin,
+ or missing or incorrect key or
+ incorret AES method or algorithm. */
/* The following are partial failure codes */
DB_FAIL = 1000,
DB_OVERFLOW,
diff --git a/storage/innobase/include/dict0crea.h b/storage/innobase/include/dict0crea.h
index 67eab9058da..564fad35748 100644
--- a/storage/innobase/include/dict0crea.h
+++ b/storage/innobase/include/dict0crea.h
@@ -32,6 +32,7 @@ Created 1/8/1996 Heikki Tuuri
#include "que0types.h"
#include "row0types.h"
#include "mtr0mtr.h"
+#include "fil0crypt.h"
/*********************************************************************//**
Creates a table create graph.
@@ -43,8 +44,10 @@ tab_create_graph_create(
dict_table_t* table, /*!< in: table to create, built as a memory data
structure */
mem_heap_t* heap, /*!< in: heap where created */
- bool commit);/*!< in: true if the commit node should be
+ bool commit, /*!< in: true if the commit node should be
added to the query graph */
+ fil_encryption_t mode, /*!< in: encryption mode */
+ ulint key_id);/*!< in: encryption key_id */
/*********************************************************************//**
Creates an index create graph.
@return own: index create node */
@@ -110,6 +113,17 @@ UNIV_INTERN
dberr_t
dict_create_or_check_foreign_constraint_tables(void);
/*================================================*/
+
+/********************************************************************//**
+Construct foreign key constraint defintion from data dictionary information.
+*/
+UNIV_INTERN
+char*
+dict_foreign_def_get(
+/*=================*/
+ dict_foreign_t* foreign,/*!< in: foreign */
+ trx_t* trx); /*!< in: trx */
+
/********************************************************************//**
Generate a foreign key constraint name when it was not named by the user.
A generated constraint has a name of the format dbname/tablename_ibfk_NUMBER,
@@ -174,11 +188,22 @@ UNIV_INTERN
dberr_t
dict_create_add_foreign_to_dictionary(
/*==================================*/
+ dict_table_t* table, /*!< in: table */
const char* name, /*!< in: table name */
const dict_foreign_t* foreign,/*!< in: foreign key */
trx_t* trx) /*!< in/out: dictionary transaction */
__attribute__((nonnull, warn_unused_result));
+/********************************************************************//**
+Construct foreign key constraint defintion from data dictionary information.
+*/
+UNIV_INTERN
+char*
+dict_foreign_def_get(
+/*=================*/
+ dict_foreign_t* foreign,/*!< in: foreign */
+ trx_t* trx); /*!< in: trx */
+
/* Table create node structure */
struct tab_node_t{
que_common_t common; /*!< node type: QUE_NODE_TABLE_CREATE */
@@ -197,6 +222,8 @@ struct tab_node_t{
/* Local storage for this graph node */
ulint state; /*!< node execution state */
ulint col_no; /*!< next column definition to insert */
+ ulint key_id; /*!< encryption key_id */
+ fil_encryption_t mode; /*!< encryption mode */
mem_heap_t* heap; /*!< memory heap used as auxiliary storage */
};
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index 820353a0c93..6b1856b8187 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, SkySQL Ab. All Rights Reserved.
@@ -449,18 +449,6 @@ dict_foreign_add_to_cache(
/*!< in: error to be ignored */
__attribute__((nonnull(1), warn_unused_result));
/*********************************************************************//**
-Check if the index is referenced by a foreign key, if TRUE return the
-matching instance NULL otherwise.
-@return pointer to foreign key struct if index is defined for foreign
-key, otherwise NULL */
-UNIV_INTERN
-dict_foreign_t*
-dict_table_get_referenced_constraint(
-/*=================================*/
- dict_table_t* table, /*!< in: InnoDB table */
- dict_index_t* index) /*!< in: InnoDB index */
- __attribute__((nonnull, warn_unused_result));
-/*********************************************************************//**
Checks if a table is referenced by foreign keys.
@return TRUE if table is referenced by a foreign key */
UNIV_INTERN
@@ -495,19 +483,6 @@ dict_str_starts_with_keyword(
const char* keyword) /*!< in: keyword to look for */
__attribute__((nonnull, warn_unused_result));
/*********************************************************************//**
-Checks if a index is defined for a foreign key constraint. Index is a part
-of a foreign key constraint if the index is referenced by foreign key
-or index is a foreign key index
-@return pointer to foreign key struct if index is defined for foreign
-key, otherwise NULL */
-UNIV_INTERN
-dict_foreign_t*
-dict_table_get_foreign_constraint(
-/*==============================*/
- dict_table_t* table, /*!< in: InnoDB table */
- dict_index_t* index) /*!< in: InnoDB index */
- __attribute__((nonnull, warn_unused_result));
-/*********************************************************************//**
Scans a table create SQL string and adds to the data dictionary
the foreign key constraints declared in the string. This function
should be called after the indexes for a table have been created.
@@ -596,10 +571,18 @@ dict_foreign_find_index(
/*!< in: whether to check
charsets. only has an effect
if types_idx != NULL */
- ulint check_null)
+ ulint check_null,
/*!< in: nonzero if none of
the columns must be declared
NOT NULL */
+ ulint* error, /*!< out: error code */
+ ulint* err_col_no,
+ /*!< out: column number where
+ error happened */
+ dict_index_t** err_index)
+ /*!< out: index where error
+ happened */
+
__attribute__((nonnull(1,3), warn_unused_result));
/**********************************************************************//**
Returns a column's name.
@@ -691,10 +674,17 @@ dict_foreign_qualify_index(
/*!< in: whether to check
charsets. only has an effect
if types_idx != NULL */
- ulint check_null)
+ ulint check_null,
/*!< in: nonzero if none of
the columns must be declared
NOT NULL */
+ ulint* error, /*!< out: error code */
+ ulint* err_col_no,
+ /*!< out: column number where
+ error happened */
+ dict_index_t** err_index)
+ /*!< out: index where error
+ happened */
__attribute__((nonnull(1,3), warn_unused_result));
#ifdef UNIV_DEBUG
/********************************************************************//**
diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic
index dd42b478c1f..a3a3446d507 100644
--- a/storage/innobase/include/dict0dict.ic
+++ b/storage/innobase/include/dict0dict.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
-Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2014, SkySQL Ab. All Rights Reserved.
+Copyright (c) 1996, 2015, Oracle and/or its affiliates
+Copyright (c) 2013, 2015, SkySQL Ab
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index 24db728ae08..53a5d6cb08b 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -2,7 +2,7 @@
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, SkySQL Ab. All Rights Reserved.
+Copyright (c) 2013, 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -48,6 +48,9 @@ Created 1/8/1996 Heikki Tuuri
#include "trx0types.h"
#include "fts0fts.h"
#include "os0once.h"
+#include "fil0fil.h"
+#include <my_crypt.h>
+#include "fil0crypt.h"
#include <set>
#include <algorithm>
#include <iterator>
@@ -1014,6 +1017,8 @@ struct dict_table_t{
table_id_t id; /*!< id of the table */
mem_heap_t* heap; /*!< memory heap */
char* name; /*!< table name */
+ void* thd; /*!< thd */
+ fil_space_crypt_t *crypt_data; /*!< crypt data if present */
const char* dir_path_of_temp_table;/*!< NULL or the directory path
where a TEMPORARY table that was explicitly
created by a user should be placed if
@@ -1326,6 +1331,7 @@ struct dict_table_t{
locks; /*!< list of locks on the table; protected
by lock_sys->mutex */
#endif /* !UNIV_HOTBACKUP */
+ ibool is_encrypted;
#ifdef UNIV_DEBUG
ulint magic_n;/*!< magic number */
diff --git a/storage/innobase/include/fil0crypt.h b/storage/innobase/include/fil0crypt.h
index df69ec28932..9230ffd3e7c 100644
--- a/storage/innobase/include/fil0crypt.h
+++ b/storage/innobase/include/fil0crypt.h
@@ -1,5 +1,5 @@
/*****************************************************************************
-
+Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
Copyright (c) 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
@@ -66,17 +66,20 @@ struct key_struct
struct fil_space_rotate_state_t
{
- time_t start_time; // time when rotation started
- ulint active_threads; // active threads in space
- ulint next_offset; // next "free" offset
- ulint max_offset; // max offset needing to be rotated
- uint min_key_version_found; // min key version found but not rotated
- lsn_t end_lsn; // max lsn created when rotating this space
- bool starting; // initial write of IV
- bool flushing; // space is being flushed at end of rotate
+ time_t start_time; /*!< time when rotation started */
+ ulint active_threads; /*!< active threads in space */
+ ulint next_offset; /*!< next "free" offset */
+ ulint max_offset; /*!< max offset needing to be rotated */
+ uint min_key_version_found; /*!< min key version found but not
+ rotated */
+ lsn_t end_lsn; /*!< max lsn created when rotating this
+ space */
+ bool starting; /*!< initial write of IV */
+ bool flushing; /*!< space is being flushed at end of rotate */
struct {
- bool is_active; // is scrubbing active in this space
- time_t last_scrub_completed; // when was last scrub completed
+ bool is_active; /*!< is scrubbing active in this space */
+ time_t last_scrub_completed; /*!< when was last scrub
+ completed */
} scrubbing;
};
@@ -88,6 +91,7 @@ struct fil_space_crypt_struct : st_encryption_scheme
ib_mutex_t mutex; // mutex protecting following variables
bool closing; // is tablespace being closed
+ bool inited;
fil_space_rotate_state_t rotate_state;
};
@@ -197,43 +201,48 @@ bool
fil_space_check_encryption_read(
/*============================*/
ulint space); /*!< in: tablespace id */
-
-/*********************************************************************
-Encrypt buffer page */
+/******************************************************************
+Decrypt a page
+@return true if page is decrypted, false if not. */
UNIV_INTERN
-void
-fil_space_encrypt(
+bool
+fil_space_decrypt(
/*==============*/
- ulint space, /*!< in: tablespace id */
- ulint offset, /*!< in: page no */
- lsn_t lsn, /*!< in: page lsn */
- const byte* src_frame,/*!< in: page frame */
- ulint size, /*!< in: size of data to encrypt */
- byte* dst_frame); /*!< in: where to encrypt to */
+ fil_space_crypt_t* crypt_data, /*!< in: crypt data */
+ byte* tmp_frame, /*!< in: temporary buffer */
+ ulint page_size, /*!< in: page size */
+ byte* src_frame, /*!< in:out: page buffer */
+ dberr_t* err); /*!< in: out: DB_SUCCESS or
+ error code */
+
/*********************************************************************
-Decrypt buffer page */
+Encrypt buffer page
+@return encrypted page, or original not encrypted page if encrypt
+is not needed. */
UNIV_INTERN
-void
-fil_space_decrypt(
+byte*
+fil_space_encrypt(
/*==============*/
- ulint space, /*!< in: tablespace id */
- const byte* src_frame,/*!< in: page frame */
- ulint page_size, /*!< in: size of data to encrypt */
- byte* dst_frame); /*!< in: where to decrypt to */
-
+ ulint space, /*!< in: tablespace id */
+ ulint offset, /*!< in: page no */
+ lsn_t lsn, /*!< in: page lsn */
+ byte* src_frame, /*!< in: page frame */
+ ulint size, /*!< in: size of data to encrypt */
+ byte* dst_frame); /*!< in: where to encrypt to */
/*********************************************************************
Decrypt buffer page
-@return true if page was encrypted */
+@return decrypted page, or original not encrypted page if decrypt is
+not needed.*/
UNIV_INTERN
-bool
+byte*
fil_space_decrypt(
/*==============*/
- fil_space_crypt_t* crypt_data, /*!< in: crypt data */
- const byte* src_frame,/*!< in: page frame */
- ulint page_size, /*!< in: page size */
- byte* dst_frame); /*!< in: where to decrypt to */
+ ulint space, /*!< in: tablespace id */
+ byte* src_frame, /*!< in: page frame */
+ ulint page_size, /*!< in: size of data to encrypt */
+ byte* dst_frame); /*!< in: where to decrypt to */
/*********************************************************************
fil_space_verify_crypt_checksum
@@ -375,6 +384,31 @@ fil_crypt_set_encrypt_tables(
/*=========================*/
uint val); /*!< in: New srv_encrypt_tables setting */
+/******************************************************************
+Encrypt a buffer */
+UNIV_INTERN
+byte*
+fil_encrypt_buf(
+/*============*/
+ fil_space_crypt_t* crypt_data, /*!< in: crypt data */
+ ulint space, /*!< in: Space id */
+ ulint offset, /*!< in: Page offset */
+ lsn_t lsn, /*!< in: lsn */
+ byte* src_frame, /*!< in: Source page to be encrypted */
+ ulint zip_size, /*!< in: compressed size if
+ row_format compressed */
+ byte* dst_frame); /*!< in: outbut buffer */
+
+/******************************************************************
+Calculate post encryption checksum
+@return page checksum or BUF_NO_CHECKSUM_MAGIC
+not needed. */
+UNIV_INTERN
+ulint
+fil_crypt_calculate_checksum(
+/*=========================*/
+ ulint zip_size, /*!< in: zip_size or 0 */
+ byte* dst_frame); /*!< in: page where to calculate */
#ifndef UNIV_NONINL
#include "fil0crypt.ic"
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index 9f6e1ac4f62..e842049e734 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -213,7 +213,8 @@ struct fsp_open_info {
#ifdef UNIV_LOG_ARCHIVE
ulint arch_log_no; /*!< latest archived log file number */
#endif /* UNIV_LOG_ARCHIVE */
- fil_space_crypt_t* crypt_data; /*!< crypt data */
+ fil_space_crypt_t* crypt_data; /*!< crypt data */
+ dict_table_t* table; /*!< table */
};
struct fil_space_t;
@@ -611,8 +612,6 @@ fil_read_first_page(
lsn values in data files */
lsn_t* max_flushed_lsn, /*!< out: max of flushed
lsn values in data files */
- ulint orig_space_id, /*!< in: file space id or
- ULINT_UNDEFINED */
fil_space_crypt_t** crypt_data) /*!< out: crypt data */
__attribute__((warn_unused_result));
@@ -776,6 +775,9 @@ char*
fil_read_link_file(
/*===============*/
const char* name); /*!< in: tablespace name */
+
+#include "fil0crypt.h"
+
/*******************************************************************//**
Creates a new single-table tablespace to a database directory of MySQL.
Database directories are under the 'datadir' of MySQL. The datadir is the
@@ -794,9 +796,11 @@ fil_create_new_single_table_tablespace(
const char* dir_path, /*!< in: NULL or a dir path */
ulint flags, /*!< in: tablespace flags */
ulint flags2, /*!< in: table flags2 */
- ulint size) /*!< in: the initial size of the
+ ulint size, /*!< in: the initial size of the
tablespace file in pages,
must be >= FIL_IBD_FILE_INITIAL_SIZE */
+ fil_encryption_t mode, /*!< in: encryption mode */
+ ulint key_id) /*!< in: encryption key_id */
__attribute__((nonnull, warn_unused_result));
#ifndef UNIV_HOTBACKUP
/********************************************************************//**
@@ -830,7 +834,8 @@ fil_open_single_table_tablespace(
ulint flags, /*!< in: tablespace flags */
const char* tablename, /*!< in: table name in the
databasename/tablename format */
- const char* filepath) /*!< in: tablespace filepath */
+ const char* filepath, /*!< in: tablespace filepath */
+ dict_table_t* table) /*!< in: table */
__attribute__((nonnull(5), warn_unused_result));
#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h
index a2996ecacc8..d54ed281d9a 100644
--- a/storage/innobase/include/fts0fts.h
+++ b/storage/innobase/include/fts0fts.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2011, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h
index 4d523cf1289..59abb0863d9 100644
--- a/storage/innobase/include/ha_prototypes.h
+++ b/storage/innobase/include/ha_prototypes.h
@@ -625,5 +625,22 @@ innobase_convert_to_filename_charset(
const char* from, /* in: identifier to convert */
ulint len); /* in: length of 'to', in bytes */
-
+/********************************************************************//**
+Helper function to push warnings from InnoDB internals to SQL-layer. */
+UNIV_INTERN
+void
+ib_push_warning(
+ trx_t* trx, /*!< in: trx */
+ ulint error, /*!< in: error code to push as warning */
+ const char *format,/*!< in: warning message */
+ ...);
+/********************************************************************//**
+Helper function to push warnings from InnoDB internals to SQL-layer. */
+UNIV_INTERN
+void
+ib_push_warning(
+ void* ithd, /*!< in: thd */
+ ulint error, /*!< in: error code to push as warning */
+ const char *format,/*!< in: warning message */
+ ...);
#endif /* HA_INNODB_PROTOTYPES_H */
diff --git a/storage/innobase/include/log0crypt.h b/storage/innobase/include/log0crypt.h
index 8d82a6c637a..7e737853465 100644
--- a/storage/innobase/include/log0crypt.h
+++ b/storage/innobase/include/log0crypt.h
@@ -1,8 +1,27 @@
+/*****************************************************************************
+
+Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
+Copyright (C) 2014, 2015, MariaDB Corporation. All Rights Reserved.
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation; version 2 of the License.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+*****************************************************************************/
/**************************************************//**
@file include/log0crypt.h
Innodb log encrypt/decrypt
Created 11/25/2013 Minli Zhu
+Modified Jan Lindström jan.lindstrom@mariadb.com
*******************************************************/
#ifndef log0crypt_h
#define log0crypt_h
@@ -22,7 +41,7 @@ UNIV_INTERN
void
log_crypt_set_ver_and_key(
/*======================*/
- ib_uint64_t next_checkpoint_no);
+ ib_uint64_t next_checkpoint_no);/*!< in: next checkpoint no */
/*********************************************************************//**
@@ -40,20 +59,20 @@ Read the crypto (version, msg and iv) info, which has been used for
log blocks with lsn <= this checkpoint's lsn, from a log header's
checkpoint buf. */
UNIV_INTERN
-void
+bool
log_crypt_read_checkpoint_buf(
/*===========================*/
- const byte* buf); /*!< in: checkpoint buffer */
+ const byte* buf); /*!< in: checkpoint buffer */
/********************************************************
Encrypt one or more log block before it is flushed to disk */
UNIV_INTERN
void
log_encrypt_before_write(
-/*===========================*/
- ib_uint64_t next_checkpoint_no, /*!< in: log group to be flushed */
- byte* block, /*!< in/out: pointer to a log block */
- const ulint size); /*!< in: size of log blocks */
+/*=====================*/
+ ib_uint64_t next_checkpoint_no, /*!< in: log group to be flushed */
+ byte* block, /*!< in/out: pointer to a log block */
+ const ulint size); /*!< in: size of log blocks */
/********************************************************
Decrypt a specified log segment after they are read from a log file to a buffer.
@@ -61,8 +80,41 @@ Decrypt a specified log segment after they are read from a log file to a buffer.
UNIV_INTERN
void
log_decrypt_after_read(
-/*==========================*/
- byte* frame, /*!< in/out: log segment */
- const ulint size); /*!< in: log segment size */
+/*===================*/
+ byte* frame, /*!< in/out: log segment */
+ const ulint size); /*!< in: log segment size */
+
+/* Error codes for crypt info */
+typedef enum {
+ LOG_UNENCRYPTED = 0,
+ LOG_CRYPT_KEY_NOT_FOUND = 1,
+ LOG_DECRYPT_MAYBE_FAILED = 2
+} log_crypt_err_t;
+
+/********************************************************
+Check is the checkpoint information encrypted. This check
+is based on fact has log group crypt info and based
+on this crypt info was the key version different from
+unencrypted key version. There is no realible way to
+distinguish encrypted log block from corrupted log block,
+but if log block corruption is found this function is
+used to find out if log block is maybe encrypted but
+encryption key, key management plugin or encryption
+algorithm does not match.
+@return TRUE, if log block may be encrypted */
+UNIV_INTERN
+ibool
+log_crypt_block_maybe_encrypted(
+/*============================*/
+ const byte* log_block, /*!< in: log block */
+ log_crypt_err_t* err_info); /*!< out: error info */
+
+/********************************************************
+Print crypt error message to error log */
+UNIV_INTERN
+void
+log_crypt_print_error(
+/*==================*/
+ log_crypt_err_t err_info); /*!< out: error info */
#endif // log0crypt.h
diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h
index fe6b755dc59..04593f5b754 100644
--- a/storage/innobase/include/os0file.h
+++ b/storage/innobase/include/os0file.h
@@ -1,6 +1,6 @@
/***********************************************************************
-Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2015, MariaDB Corporation.
@@ -387,10 +387,10 @@ to original un-instrumented file I/O APIs */
enum os_file_type_t {
OS_FILE_TYPE_UNKNOWN = 0,
- OS_FILE_TYPE_FILE, /* regular file */
+ OS_FILE_TYPE_FILE, /* regular file
+ (or a character/block device) */
OS_FILE_TYPE_DIR, /* directory */
- OS_FILE_TYPE_LINK, /* symbolic link */
- OS_FILE_TYPE_BLOCK /* block device */
+ OS_FILE_TYPE_LINK /* symbolic link */
};
/* Maximum path string length in bytes when referring to tables with in the
diff --git a/storage/innobase/include/os0sync.h b/storage/innobase/include/os0sync.h
index b16a99b51c0..feb64fb1e41 100644
--- a/storage/innobase/include/os0sync.h
+++ b/storage/innobase/include/os0sync.h
@@ -452,7 +452,7 @@ Returns the old value of *ptr, atomically sets *ptr to new_val */
# define os_atomic_test_and_set_ulint(ptr, new_val) \
__sync_lock_test_and_set(ptr, new_val)
-#ifdef __powerpc__
+#if defined(__powerpc__) || defined(__aarch64__)
/*
os_atomic_test_and_set_byte_release() should imply a release barrier before
setting, and a full barrier after. But __sync_lock_test_and_set() is only
diff --git a/storage/innobase/include/page0cur.ic b/storage/innobase/include/page0cur.ic
index 028d33b17aa..6e068d9f739 100644
--- a/storage/innobase/include/page0cur.ic
+++ b/storage/innobase/include/page0cur.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -39,7 +40,10 @@ page_cur_get_page(
page_cur_t* cur) /*!< in: page cursor */
{
ut_ad(cur);
- ut_ad(page_align(cur->rec) == cur->block->frame);
+
+ if (cur->rec) {
+ ut_ad(page_align(cur->rec) == cur->block->frame);
+ }
return(page_align(cur->rec));
}
@@ -54,7 +58,11 @@ page_cur_get_block(
page_cur_t* cur) /*!< in: page cursor */
{
ut_ad(cur);
- ut_ad(page_align(cur->rec) == cur->block->frame);
+
+ if (cur->rec) {
+ ut_ad(page_align(cur->rec) == cur->block->frame);
+ }
+
return(cur->block);
}
@@ -80,7 +88,10 @@ page_cur_get_rec(
page_cur_t* cur) /*!< in: page cursor */
{
ut_ad(cur);
- ut_ad(page_align(cur->rec) == cur->block->frame);
+
+ if (cur->rec) {
+ ut_ad(page_align(cur->rec) == cur->block->frame);
+ }
return(cur->rec);
}
diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h
index 2b47aef8790..d83b6e1985d 100644
--- a/storage/innobase/include/page0page.h
+++ b/storage/innobase/include/page0page.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -1123,6 +1123,20 @@ page_find_rec_with_heap_no(
const rec_t*
page_find_rec_max_not_deleted(
const page_t* page);
+
+/** Issue a warning when the checksum that is stored in the page is valid,
+but different than the global setting innodb_checksum_algorithm.
+@param[in] current_algo current checksum algorithm
+@param[in] page_checksum page valid checksum
+@param[in] space_id tablespace id
+@param[in] page_no page number */
+void
+page_warn_strict_checksum(
+ srv_checksum_algorithm_t curr_algo,
+ srv_checksum_algorithm_t page_checksum,
+ ulint space_id,
+ ulint page_no);
+
#ifdef UNIV_MATERIALIZE
#undef UNIV_INLINE
#define UNIV_INLINE UNIV_INLINE_ORIGINAL
diff --git a/storage/innobase/include/page0zip.h b/storage/innobase/include/page0zip.h
index 6fe6934e35c..0c2abef4b09 100644
--- a/storage/innobase/include/page0zip.h
+++ b/storage/innobase/include/page0zip.h
@@ -545,6 +545,21 @@ from outside the buffer pool.
# define UNIV_INLINE UNIV_INLINE_ORIGINAL
#endif
+#ifdef UNIV_INNOCHECKSUM
+/** Issue a warning when the checksum that is stored in the page is valid,
+but different than the global setting innodb_checksum_algorithm.
+@param[in] current_algo current checksum algorithm
+@param[in] page_checksum page valid checksum
+@param[in] space_id tablespace id
+@param[in] page_no page number */
+void
+page_warn_strict_checksum(
+ srv_checksum_algorithm_t curr_algo,
+ srv_checksum_algorithm_t page_checksum,
+ ulint space_id,
+ ulint page_no);
+#endif /* UNIV_INNOCHECKSUM */
+
#ifndef UNIV_INNOCHECKSUM
#ifndef UNIV_NONINL
# include "page0zip.ic"
diff --git a/storage/innobase/include/row0ftsort.h b/storage/innobase/include/row0ftsort.h
index 4e04a099140..eeef10f3397 100644
--- a/storage/innobase/include/row0ftsort.h
+++ b/storage/innobase/include/row0ftsort.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2010, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -71,6 +72,7 @@ struct fts_psort_common_t {
store Doc ID during sort, if
Doc ID will not be big enough
to use 8 bytes value */
+ fil_space_crypt_t* crypt_data; /*!< crypt data or NULL */
};
struct fts_psort_t {
@@ -83,6 +85,10 @@ struct fts_psort_t {
/*!< buffer to write to file */
row_merge_block_t* block_alloc[FTS_NUM_AUX_INDEX];
/*!< buffer to allocated */
+ row_merge_block_t* crypt_block[FTS_NUM_AUX_INDEX];
+ /*!< buffer to crypt data */
+ row_merge_block_t* crypt_alloc[FTS_NUM_AUX_INDEX];
+ /*!< buffer to allocated */
ulint child_status; /*!< child thread status */
ulint state; /*!< parent thread state */
fts_doc_list_t fts_doc_list; /*!< doc list to process */
diff --git a/storage/innobase/include/row0merge.h b/storage/innobase/include/row0merge.h
index f280644de70..fa00700b225 100644
--- a/storage/innobase/include/row0merge.h
+++ b/storage/innobase/include/row0merge.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2005, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -351,7 +352,11 @@ row_merge_write(
int fd, /*!< in: file descriptor */
ulint offset, /*!< in: offset where to write,
in number of row_merge_block_t elements */
- const void* buf); /*!< in: data */
+ const void* buf, /*!< in: data */
+ fil_space_crypt_t* crypt_data, /*!< in: table crypt data */
+ void* crypt_buf, /*!< in: crypt buf or NULL */
+ ulint space); /*!< in: space id */
+
/********************************************************************//**
Empty a sort buffer.
@return sort buffer */
@@ -386,8 +391,11 @@ row_merge_sort(
int* tmpfd, /*!< in/out: temporary file handle */
const bool update_progress, /*!< in: update progress status variable or not */
const float pct_progress, /*!< in: total progress percent until now */
- const float pct_cost) /*!< in: current progress percent */
- __attribute__((nonnull));
+ const float pct_cost, /*!< in: current progress percent */
+ fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
+ row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
+ ulint space) /*!< in: space id */
+ __attribute__((nonnull(1,2,3,4,5)));
/*********************************************************************//**
Allocate a sort buffer.
@return own: sort buffer */
@@ -424,7 +432,11 @@ row_merge_read(
ulint offset, /*!< in: offset where to read
in number of row_merge_block_t
elements */
- row_merge_block_t* buf); /*!< out: data */
+ row_merge_block_t* buf, /*!< out: data */
+ fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
+ row_merge_block_t* crypt_buf, /*!< in: crypt buf or NULL */
+ ulint space); /*!< in: space id */
+
/********************************************************************//**
Read a merge record.
@return pointer to next record, or NULL on I/O error or end of list */
@@ -441,6 +453,9 @@ row_merge_read_rec(
const mrec_t** mrec, /*!< out: pointer to merge record,
or NULL on end of list
(non-NULL on I/O error) */
- ulint* offsets)/*!< out: offsets of mrec */
- __attribute__((nonnull, warn_unused_result));
+ ulint* offsets,/*!< out: offsets of mrec */
+ fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
+ row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
+ ulint space) /*!< in: space id */
+ __attribute__((nonnull(1,2,3,4,6,7,8), warn_unused_result));
#endif /* row0merge.h */
diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h
index 440001410f0..7fda64e21b7 100644
--- a/storage/innobase/include/row0mysql.h
+++ b/storage/innobase/include/row0mysql.h
@@ -35,6 +35,7 @@ Created 9/17/2000 Heikki Tuuri
#include "row0types.h"
#include "btr0pcur.h"
#include "trx0types.h"
+#include "fil0crypt.h"
// Forward declaration
struct SysIndexCallback;
@@ -386,7 +387,9 @@ row_create_table_for_mysql(
(will be freed, or on DB_SUCCESS
added to the data dictionary cache) */
trx_t* trx, /*!< in/out: transaction */
- bool commit) /*!< in: if true, commit the transaction */
+ bool commit, /*!< in: if true, commit the transaction */
+ fil_encryption_t mode, /*!< in: encryption mode */
+ ulint key_id) /*!< in: encryption key_id */
__attribute__((nonnull, warn_unused_result));
/*********************************************************************//**
Does an index creation operation for MySQL. TODO: currently failure
diff --git a/storage/innobase/include/row0purge.h b/storage/innobase/include/row0purge.h
index 93dcf9cf49b..888289a6c79 100644
--- a/storage/innobase/include/row0purge.h
+++ b/storage/innobase/include/row0purge.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1997, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -119,6 +119,16 @@ struct purge_node_t{
clustered index record */
ibool done; /* Debug flag */
+#ifdef UNIV_DEBUG
+ /***********************************************************//**
+ Validate the persisent cursor. The purge node has two references
+ to the clustered index record - one via the ref member, and the
+ other via the persistent cursor. These two references must match
+ each other if the found_clust flag is set.
+ @return true if the persistent cursor is consistent with
+ the ref member.*/
+ bool validate_pcur();
+#endif
};
#ifndef UNIV_NONINL
diff --git a/storage/innobase/include/srv0mon.h b/storage/innobase/include/srv0mon.h
index 79a8a5bf848..5964f2c4819 100644
--- a/storage/innobase/include/srv0mon.h
+++ b/storage/innobase/include/srv0mon.h
@@ -378,6 +378,8 @@ enum monitor_id_t {
MONITOR_SRV_MEM_VALIDATE_MICROSECOND,
MONITOR_SRV_PURGE_MICROSECOND,
MONITOR_SRV_DICT_LRU_MICROSECOND,
+ MONITOR_SRV_DICT_LRU_EVICT_COUNT_ACTIVE,
+ MONITOR_SRV_DICT_LRU_EVICT_COUNT_IDLE,
MONITOR_SRV_CHECKPOINT_MICROSECOND,
MONITOR_OVLD_SRV_DBLWR_WRITES,
MONITOR_OVLD_SRV_DBLWR_PAGES_WRITTEN,
diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index 34f8432d19f..2ae5f1ea13e 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -563,6 +563,9 @@ extern ulong srv_fatal_semaphore_wait_threshold;
/** Enable semaphore request instrumentation */
extern my_bool srv_instrument_semaphores;
+/** Buffer pool dump status frequence in percentages */
+extern ulong srv_buf_dump_status_frequency;
+
# ifdef UNIV_PFS_THREAD
/* Keys to register InnoDB threads with performance schema */
extern mysql_pfs_key_t buf_page_cleaner_thread_key;
diff --git a/storage/innobase/include/sync0rw.h b/storage/innobase/include/sync0rw.h
index cfd9776959f..d212ac17871 100644
--- a/storage/innobase/include/sync0rw.h
+++ b/storage/innobase/include/sync0rw.h
@@ -162,7 +162,7 @@ defined, the rwlock are instrumented with performance schema probes. */
# endif/* UNIV_SYNC_DEBUG */
# else /* UNIV_DEBUG */
# define rw_lock_create(K, L, level) \
- rw_lock_create_func((L), __FILE__, __LINE__)
+ rw_lock_create_func((L), #L, __FILE__, __LINE__)
# endif /* UNIV_DEBUG */
/**************************************************************//**
diff --git a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h
index 2ffa14fd7fb..d9c9d7cfbac 100644
--- a/storage/innobase/include/sync0sync.h
+++ b/storage/innobase/include/sync0sync.h
@@ -210,7 +210,7 @@ original non-instrumented functions */
# endif /* UNIV_SYNC_DEBUG */
# else /* UNIV_DEBUG */
# define mutex_create(K, M, level) \
- mutex_create_func((M), __FILE__, __LINE__)
+ mutex_create_func((M), #M, __FILE__, __LINE__)
# endif /* UNIV_DEBUG */
# define mutex_enter(M) mutex_enter_func((M), __FILE__, __LINE__)
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index f8dad7b3ced..8dd97cf0070 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -45,7 +45,7 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 5
#define INNODB_VERSION_MINOR 6
-#define INNODB_VERSION_BUGFIX 24
+#define INNODB_VERSION_BUGFIX 26
/* The following is the InnoDB version as shown in
SELECT plugin_version FROM information_schema.plugins;
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index 85be4b3ad0b..ac01752bbb1 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -1066,12 +1066,13 @@ lock_rec_has_to_wait(
#ifdef WITH_WSREP
/* if BF thread is locking and has conflict with another BF
thread, we need to look at trx ordering and lock types */
- if (for_locking &&
- wsrep_thd_is_BF(trx->mysql_thd, FALSE) &&
+ if (wsrep_thd_is_BF(trx->mysql_thd, FALSE) &&
wsrep_thd_is_BF(lock2->trx->mysql_thd, TRUE)) {
if (wsrep_debug) {
- fprintf(stderr, "\n BF-BF lock conflict \n");
+ fprintf(stderr,
+ "BF-BF lock conflict, locking: %lu\n",
+ for_locking);
lock_rec_print(stderr, lock2);
}
@@ -1080,16 +1081,21 @@ lock_rec_has_to_wait(
(type_mode & LOCK_MODE_MASK) == LOCK_X &&
(lock2->type_mode & LOCK_MODE_MASK) == LOCK_X)
{
- /* exclusive lock conflicts are not accepted */
- fprintf(stderr, "BF-BF X lock conflict,"
- "type_mode: %lu supremum: %lu\n",
- type_mode, lock_is_on_supremum);
- fprintf(stderr, "conflicts states: my %d locked %d\n",
- wsrep_thd_conflict_state(trx->mysql_thd, FALSE),
- wsrep_thd_conflict_state(lock2->trx->mysql_thd, FALSE) );
- lock_rec_print(stderr, lock2);
- return FALSE;
- //abort();
+ if (for_locking || wsrep_debug) {
+ /* exclusive lock conflicts are not
+ accepted */
+ fprintf(stderr,
+ "BF-BF X lock conflict,"
+ "mode: %lu supremum: %lu\n",
+ type_mode, lock_is_on_supremum);
+ fprintf(stderr,
+ "conflicts states: my %d locked %d\n",
+ wsrep_thd_conflict_state(trx->mysql_thd, FALSE),
+ wsrep_thd_conflict_state(lock2->trx->mysql_thd, FALSE) );
+ lock_rec_print(stderr, lock2);
+ if (for_locking) return FALSE;
+ //abort();
+ }
} else {
/* if lock2->index->n_uniq <=
lock2->index->n_user_defined_cols
@@ -1109,7 +1115,7 @@ lock_rec_has_to_wait(
#endif /* WITH_WSREP */
return(TRUE);
}
-
+
return(FALSE);
}
diff --git a/storage/innobase/log/log0crypt.cc b/storage/innobase/log/log0crypt.cc
index cd84dbe6e6d..8c4fd623fc6 100644
--- a/storage/innobase/log/log0crypt.cc
+++ b/storage/innobase/log/log0crypt.cc
@@ -86,6 +86,9 @@ log_block_get_start_lsn(
return start_lsn;
}
+/*********************************************************************//**
+Get crypt info from checkpoint.
+@return a crypt info or NULL if not present. */
static
const crypt_info_t*
get_crypt_info(
@@ -107,6 +110,9 @@ get_crypt_info(
return NULL;
}
+/*********************************************************************//**
+Get crypt info from log block
+@return a crypt info or NULL if not present. */
static
const crypt_info_t*
get_crypt_info(
@@ -125,15 +131,16 @@ log_blocks_crypt(
const byte* block, /*!< in: blocks before encrypt/decrypt*/
ulint size, /*!< in: size of block */
byte* dst_block, /*!< out: blocks after encrypt/decrypt */
- bool is_encrypt) /*!< in: encrypt or decrypt*/
+ int what) /*!< in: encrypt or decrypt*/
{
byte *log_block = (byte*)block;
Crypt_result rc = MY_AES_OK;
uint dst_len;
byte aes_ctr_counter[MY_AES_BLOCK_SIZE];
+ byte is_encrypt= what == ENCRYPTION_FLAG_ENCRYPT;
lsn_t lsn = is_encrypt ? log_sys->lsn : srv_start_lsn;
- const int src_len = OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_HDR_SIZE;
+ const uint src_len = OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_HDR_SIZE;
for (ulint i = 0; i < size ; i += OS_FILE_LOG_BLOCK_SIZE) {
ulint log_block_no = log_block_get_hdr_no(log_block);
lsn_t log_block_start_lsn = log_block_get_start_lsn(
@@ -168,21 +175,13 @@ log_blocks_crypt(
bzero(aes_ctr_counter + 15, 1);
int rc;
- if (is_encrypt) {
- rc = encryption_encrypt(log_block + LOG_BLOCK_HDR_SIZE, src_len,
- dst_block + LOG_BLOCK_HDR_SIZE, &dst_len,
- (unsigned char*)(info->crypt_key), 16,
- aes_ctr_counter, MY_AES_BLOCK_SIZE, 1,
- LOG_DEFAULT_ENCRYPTION_KEY,
- info->key_version);
- } else {
- rc = encryption_decrypt(log_block + LOG_BLOCK_HDR_SIZE, src_len,
- dst_block + LOG_BLOCK_HDR_SIZE, &dst_len,
- (unsigned char*)(info->crypt_key), 16,
- aes_ctr_counter, MY_AES_BLOCK_SIZE, 1,
- LOG_DEFAULT_ENCRYPTION_KEY,
- info->key_version);
- }
+ rc = encryption_crypt(log_block + LOG_BLOCK_HDR_SIZE, src_len,
+ dst_block + LOG_BLOCK_HDR_SIZE, &dst_len,
+ (unsigned char*)(info->crypt_key), 16,
+ aes_ctr_counter, MY_AES_BLOCK_SIZE,
+ what | ENCRYPTION_FLAG_NOPAD,
+ LOG_DEFAULT_ENCRYPTION_KEY,
+ info->key_version);
ut_a(rc == MY_AES_OK);
ut_a(dst_len == src_len);
@@ -195,9 +194,10 @@ next:
}
/*********************************************************************//**
-Generate crypt key from crypt msg. */
+Generate crypt key from crypt msg.
+@return true if successfull, false if not. */
static
-void
+bool
init_crypt_key(
/*===========*/
crypt_info_t* info) /*< in/out: crypt info */
@@ -206,7 +206,7 @@ init_crypt_key(
memset(info->crypt_key, 0, sizeof(info->crypt_key));
memset(info->crypt_msg, 0, sizeof(info->crypt_msg));
memset(info->crypt_nonce, 0, sizeof(info->crypt_nonce));
- return;
+ return true;
}
byte mysqld_key[MY_AES_BLOCK_SIZE] = {0};
@@ -216,42 +216,59 @@ init_crypt_key(
{
ib_logf(IB_LOG_LEVEL_ERROR,
"Redo log crypto: getting mysqld crypto key "
- "from key version failed.");
- ut_error;
+ "from key version failed. Reason could be that requested"
+ " key_version %u is not found or required encryption "
+ " key management is not found.", info->key_version);
+ return false;
}
uint dst_len;
- int rc= my_aes_encrypt_ecb(info->crypt_msg, sizeof(info->crypt_msg), //src, srclen
- info->crypt_key, &dst_len, //dst, &dstlen
- (unsigned char*)&mysqld_key, sizeof(mysqld_key),
- NULL, 0, 1);
+ int rc= my_aes_crypt(MY_AES_ECB, ENCRYPTION_FLAG_NOPAD|ENCRYPTION_FLAG_ENCRYPT,
+ info->crypt_msg, sizeof(info->crypt_msg), //src, srclen
+ info->crypt_key, &dst_len, //dst, &dstlen
+ (unsigned char*)&mysqld_key, sizeof(mysqld_key),
+ NULL, 0);
if (rc != MY_AES_OK || dst_len != MY_AES_BLOCK_SIZE) {
fprintf(stderr,
"\nInnodb redo log crypto: getting redo log crypto key "
"failed.\n");
- ut_error;
+ return false;
}
+
+ return true;
}
-static bool mysort(const crypt_info_t& i,
- const crypt_info_t& j)
+/*********************************************************************//**
+Compare function for checkpoint numbers
+@return true if first checkpoint is larger than second one */
+static
+bool
+mysort(const crypt_info_t& i,
+ const crypt_info_t& j)
{
return i.checkpoint_no > j.checkpoint_no;
}
+/*********************************************************************//**
+Add crypt info to set if it is not already present
+@return true if successfull, false if not- */
static
-bool add_crypt_info(crypt_info_t* info)
+bool
+add_crypt_info(crypt_info_t* info)
{
/* so that no one is searching array while we modify it */
ut_ad(mutex_own(&(log_sys->mutex)));
if (get_crypt_info(info->checkpoint_no) != NULL) {
// already present...
+ return true;
+ }
+
+ if (!init_crypt_key(info)) {
return false;
}
- init_crypt_key(info);
crypt_info.push_back(*info);
/* a log block only stores 4-bytes of checkpoint no */
@@ -273,7 +290,7 @@ log_blocks_encrypt(
const ulint size, /*!< in: size of blocks, must be multiple of a log block */
byte* dst_block) /*!< out: blocks after encryption */
{
- return log_blocks_crypt(block, size, dst_block, true);
+ return log_blocks_crypt(block, size, dst_block, ENCRYPTION_FLAG_ENCRYPT);
}
/*********************************************************************//**
@@ -324,7 +341,7 @@ Encrypt one or more log block before it is flushed to disk */
UNIV_INTERN
void
log_encrypt_before_write(
-/*===========================*/
+/*=====================*/
ib_uint64_t next_checkpoint_no, /*!< in: log group to be flushed */
byte* block, /*!< in/out: pointer to a log block */
const ulint size) /*!< in: size of log blocks */
@@ -343,7 +360,7 @@ log_encrypt_before_write(
byte* dst_frame = (byte*)malloc(size);
//encrypt log blocks content
- Crypt_result result = log_blocks_crypt(block, size, dst_frame, true);
+ Crypt_result result = log_blocks_crypt(block, size, dst_frame, ENCRYPTION_FLAG_ENCRYPT);
if (result == MY_AES_OK) {
ut_ad(block[0] == dst_frame[0]);
@@ -361,7 +378,7 @@ Decrypt a specified log segment after they are read from a log file to a buffer.
*/
void
log_decrypt_after_read(
-/*==========================*/
+/*===================*/
byte* frame, /*!< in/out: log segment */
const ulint size) /*!< in: log segment size */
{
@@ -369,7 +386,7 @@ log_decrypt_after_read(
byte* dst_frame = (byte*)malloc(size);
// decrypt log blocks content
- Crypt_result result = log_blocks_crypt(frame, size, dst_frame, false);
+ Crypt_result result = log_blocks_crypt(frame, size, dst_frame, ENCRYPTION_FLAG_DECRYPT);
if (result == MY_AES_OK) {
memcpy(frame, dst_frame, size);
@@ -450,7 +467,7 @@ Read the crypto (version, msg and iv) info, which has been used for
log blocks with lsn <= this checkpoint's lsn, from a log header's
checkpoint buf. */
UNIV_INTERN
-void
+bool
log_crypt_read_checkpoint_buf(
/*===========================*/
const byte* buf) { /*!< in: checkpoint buffer */
@@ -459,7 +476,7 @@ log_crypt_read_checkpoint_buf(
byte scheme = buf[0];
if (scheme != redo_log_purpose_byte) {
- return;
+ return true;
}
buf++;
size_t n = buf[0];
@@ -471,7 +488,10 @@ log_crypt_read_checkpoint_buf(
info.key_version = mach_read_from_4(buf + 4);
memcpy(info.crypt_msg, buf + 8, MY_AES_BLOCK_SIZE);
memcpy(info.crypt_nonce, buf + 24, MY_AES_BLOCK_SIZE);
- add_crypt_info(&info);
+
+ if (!add_crypt_info(&info)) {
+ return false;
+ }
buf += LOG_CRYPT_ENTRY_SIZE;
}
@@ -485,5 +505,77 @@ log_crypt_read_checkpoint_buf(
}
fprintf(stderr, "\n");
#endif
+ return true;
}
+/********************************************************
+Check is the checkpoint information encrypted. This check
+is based on fact has log group crypt info and based
+on this crypt info was the key version different from
+unencrypted key version. There is no realible way to
+distinguish encrypted log block from corrupted log block,
+but if log block corruption is found this function is
+used to find out if log block is maybe encrypted but
+encryption key, key management plugin or encryption
+algorithm does not match.
+@return TRUE, if log block may be encrypted */
+UNIV_INTERN
+ibool
+log_crypt_block_maybe_encrypted(
+/*============================*/
+ const byte* log_block, /*!< in: log block */
+ log_crypt_err_t* err_info) /*!< out: error info */
+{
+ ibool maybe_encrypted = FALSE;
+ const crypt_info_t* crypt_info;
+
+ *err_info = LOG_UNENCRYPTED;
+ crypt_info = get_crypt_info(log_block);
+
+ if (crypt_info &&
+ crypt_info->key_version != UNENCRYPTED_KEY_VER) {
+ byte mysqld_key[MY_AES_BLOCK_SIZE] = {0};
+ uint keylen= sizeof(mysqld_key);
+
+ /* Log block contains crypt info and based on key
+ version block could be encrypted. */
+ *err_info = LOG_DECRYPT_MAYBE_FAILED;
+ maybe_encrypted = TRUE;
+
+ if (encryption_key_get(LOG_DEFAULT_ENCRYPTION_KEY,
+ crypt_info->key_version, mysqld_key, &keylen)) {
+ *err_info = LOG_CRYPT_KEY_NOT_FOUND;
+ }
+ }
+
+ return (maybe_encrypted);
+}
+
+/********************************************************
+Print crypt error message to error log */
+UNIV_INTERN
+void
+log_crypt_print_error(
+/*==================*/
+ log_crypt_err_t err_info) /*!< out: error info */
+{
+ switch(err_info) {
+ case LOG_CRYPT_KEY_NOT_FOUND:
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Redo log crypto: getting mysqld crypto key "
+ "from key version failed. Reason could be that "
+ "requested key version is not found or required "
+ "encryption key management plugin is not found.");
+ break;
+ case LOG_DECRYPT_MAYBE_FAILED:
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Redo log crypto: failed to decrypt log block. "
+ "Reason could be that requested key version is "
+ "not found, required encryption key management "
+ "plugin is not found or configured encryption "
+ "algorithm and/or method does not match.");
+ break;
+ default:
+ ut_error; /* Real bug */
+ }
+}
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index 1f881c6fedd..bb39d9804f6 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -2,7 +2,7 @@
Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, SkySQL Ab. All Rights Reserved.
+Copyright (c) 2013, 2015, MariaDB Corporation. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -36,6 +36,8 @@ Created 9/20/1997 Heikki Tuuri
#include "log0recv.ic"
#endif
+#include "log0crypt.h"
+
#include "mem0mem.h"
#include "buf0buf.h"
#include "buf0flu.h"
@@ -805,7 +807,10 @@ recv_find_max_checkpoint(
buf + LOG_CHECKPOINT_OFFSET_HIGH32)) << 32;
checkpoint_no = mach_read_from_8(
buf + LOG_CHECKPOINT_NO);
- log_crypt_read_checkpoint_buf(buf);
+
+ if (!log_crypt_read_checkpoint_buf(buf)) {
+ return DB_ERROR;
+ }
#ifdef UNIV_DEBUG
if (log_debug_writes) {
@@ -2701,8 +2706,9 @@ recv_scan_log_recs(
lsn_t* contiguous_lsn, /*!< in/out: it is known that all log
groups contain contiguous log data up
to this lsn */
- lsn_t* group_scanned_lsn)/*!< out: scanning succeeded up to
+ lsn_t* group_scanned_lsn,/*!< out: scanning succeeded up to
this lsn */
+ dberr_t* err) /*!< out: error code or DB_SUCCESS */
{
const byte* log_block;
ulint no;
@@ -2721,6 +2727,7 @@ recv_scan_log_recs(
log_block = buf;
scanned_lsn = start_lsn;
more_data = FALSE;
+ *err = DB_SUCCESS;
do {
no = log_block_get_hdr_no(log_block);
@@ -2732,6 +2739,7 @@ recv_scan_log_recs(
*/
if (no != log_block_convert_lsn_to_no(scanned_lsn)
|| !log_block_checksum_is_ok_or_old_format(log_block)) {
+ log_crypt_err_t log_crypt_err;
if (no == log_block_convert_lsn_to_no(scanned_lsn)
&& !log_block_checksum_is_ok_or_old_format(
@@ -2753,6 +2761,14 @@ recv_scan_log_recs(
finished = TRUE;
+ if (log_crypt_block_maybe_encrypted(log_block,
+ &log_crypt_err)) {
+ /* Log block maybe encrypted */
+ log_crypt_print_error(log_crypt_err);
+ *err = DB_ERROR;
+ return (TRUE);
+ }
+
/* Crash if we encounter a garbage log block */
if (!srv_force_recovery) {
fputs("InnoDB: Set innodb_force_recovery"
@@ -2941,14 +2957,16 @@ recv_group_scan_log_recs(
lsn_t* contiguous_lsn, /*!< in/out: it is known that all log
groups contain contiguous log data up
to this lsn */
- lsn_t* group_scanned_lsn)/*!< out: scanning succeeded up to
+ lsn_t* group_scanned_lsn,/*!< out: scanning succeeded up to
this lsn */
+ dberr_t* err) /*!< out: error code or DB_SUCCESS */
{
ibool finished;
lsn_t start_lsn;
lsn_t end_lsn;
finished = FALSE;
+ *err = DB_SUCCESS;
start_lsn = *contiguous_lsn;
@@ -2963,7 +2981,13 @@ recv_group_scan_log_recs(
- (recv_n_pool_free_frames * srv_buf_pool_instances))
* UNIV_PAGE_SIZE,
TRUE, log_sys->buf, RECV_SCAN_SIZE,
- start_lsn, contiguous_lsn, group_scanned_lsn);
+ start_lsn, contiguous_lsn, group_scanned_lsn,
+ err);
+
+ if (*err != DB_SUCCESS) {
+ break;
+ }
+
start_lsn = end_lsn;
}
@@ -3171,6 +3195,7 @@ recv_recovery_from_checkpoint_start_func(
up_to_date_group = max_cp_group;
} else {
ulint capacity;
+ dberr_t err;
/* Try to recover the remaining part from logs: first from
the logs of the archived group */
@@ -3190,8 +3215,9 @@ recv_recovery_from_checkpoint_start_func(
}
recv_group_scan_log_recs(group, &contiguous_lsn,
- &group_scanned_lsn);
- if (recv_sys->scanned_lsn < checkpoint_lsn) {
+ &group_scanned_lsn, &err);
+
+ if (err != DB_SUCCESS || recv_sys->scanned_lsn < checkpoint_lsn) {
mutex_exit(&(log_sys->mutex));
@@ -3223,9 +3249,15 @@ recv_recovery_from_checkpoint_start_func(
#ifdef UNIV_LOG_ARCHIVE
lsn_t old_scanned_lsn = recv_sys->scanned_lsn;
#endif /* UNIV_LOG_ARCHIVE */
+ dberr_t err;
recv_group_scan_log_recs(group, &contiguous_lsn,
- &group_scanned_lsn);
+ &group_scanned_lsn, &err);
+
+ if (err != DB_SUCCESS) {
+ return (err);
+ }
+
group->scanned_lsn = group_scanned_lsn;
#ifdef UNIV_LOG_ARCHIVE
@@ -3704,6 +3736,7 @@ log_group_recover_from_archive_file(
os_offset_t file_size;
int input_char;
char name[10000];
+ dberr_t err;
ut_a(0);
@@ -3848,7 +3881,11 @@ ask_again:
(buf_pool_get_n_pages()
- (recv_n_pool_free_frames * srv_buf_pool_instances))
* UNIV_PAGE_SIZE, TRUE, buf, len, start_lsn,
- &dummy_lsn, &scanned_lsn);
+ &dummy_lsn, &scanned_lsn, &err);
+
+ if (err != DB_SUCCESS) {
+ return (FALSE);
+ }
if (scanned_lsn == file_end_lsn) {
diff --git a/storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff b/storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff
index d3fb59e6ce3..154116b748c 100644
--- a/storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff
+++ b/storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff
@@ -414,12 +414,12 @@
-Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
-FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
-first second w c o e d t i r
--120 120 1 1 0 1 0 1 1 0
+-120 120 1 1 0 1 0 0 1 0
-120 121 0 0 1 0 0 0 1 0
-120 122 NULL NULL NULL NULL NULL NULL NULL NULL
-120 123 NULL NULL NULL NULL NULL NULL NULL NULL
-121 120 0 0 1 0 0 0 1 0
--121 121 1 1 0 1 0 1 1 0
+-121 121 1 1 0 1 0 0 1 0
-121 122 NULL NULL NULL NULL NULL NULL NULL NULL
-121 123 NULL NULL NULL NULL NULL NULL NULL NULL
-122 120 NULL NULL NULL NULL NULL NULL NULL NULL
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index abebb5a9b4c..c939f3d5a6c 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -1,6 +1,6 @@
/***********************************************************************
-Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2015, MariaDB Corporation.
@@ -1572,6 +1572,7 @@ os_file_create_simple_no_error_handling_func(
*success = (file != INVALID_HANDLE_VALUE);
#else /* __WIN__ */
int create_flag;
+ const char* mode_str = NULL;
ut_a(name);
if (create_mode != OS_FILE_OPEN && create_mode != OS_FILE_OPEN_RAW)
@@ -1582,6 +1583,8 @@ os_file_create_simple_no_error_handling_func(
if (create_mode == OS_FILE_OPEN) {
+ mode_str = "OPEN";
+
if (access_type == OS_FILE_READ_ONLY) {
create_flag = O_RDONLY;
@@ -1600,10 +1603,14 @@ os_file_create_simple_no_error_handling_func(
} else if (srv_read_only_mode) {
+ mode_str = "OPEN";
+
create_flag = O_RDONLY;
} else if (create_mode == OS_FILE_CREATE) {
+ mode_str = "CREATE";
+
create_flag = O_RDWR | O_CREAT | O_EXCL;
} else {
@@ -1618,6 +1625,17 @@ os_file_create_simple_no_error_handling_func(
*success = file == -1 ? FALSE : TRUE;
+ /* This function is always called for data files, we should disable
+ OS caching (O_DIRECT) here as we do in os_file_create_func(), so
+ we open the same file in the same mode, see man page of open(2). */
+ if (!srv_read_only_mode
+ && *success
+ && (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT
+ || srv_unix_file_flush_method == SRV_UNIX_O_DIRECT_NO_FSYNC)) {
+
+ os_file_set_nocache(file, name, mode_str);
+ }
+
#ifdef USE_FILE_LOCK
if (!srv_read_only_mode
&& *success
@@ -3471,8 +3489,9 @@ os_file_get_status(
stat_info->type = OS_FILE_TYPE_LINK;
break;
case S_IFBLK:
- stat_info->type = OS_FILE_TYPE_BLOCK;
- break;
+ /* Handle block device as regular file. */
+ case S_IFCHR:
+ /* Handle character device as regular file. */
case S_IFREG:
stat_info->type = OS_FILE_TYPE_FILE;
break;
@@ -3481,8 +3500,8 @@ os_file_get_status(
}
- if (check_rw_perm && (stat_info->type == OS_FILE_TYPE_FILE
- || stat_info->type == OS_FILE_TYPE_BLOCK)) {
+ if (check_rw_perm && stat_info->type == OS_FILE_TYPE_FILE) {
+
int fh;
int access;
diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc
index 4aff88818bb..fca8641342c 100644
--- a/storage/innobase/page/page0page.cc
+++ b/storage/innobase/page/page0page.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
This program is free software; you can redistribute it and/or modify it under
@@ -2819,3 +2819,45 @@ page_find_rec_max_not_deleted(
}
return(prev_rec);
}
+
+/** Issue a warning when the checksum that is stored in the page is valid,
+but different than the global setting innodb_checksum_algorithm.
+@param[in] current_algo current checksum algorithm
+@param[in] page_checksum page valid checksum
+@param[in] space_id tablespace id
+@param[in] page_no page number */
+void
+page_warn_strict_checksum(
+ srv_checksum_algorithm_t curr_algo,
+ srv_checksum_algorithm_t page_checksum,
+ ulint space_id,
+ ulint page_no)
+{
+ srv_checksum_algorithm_t curr_algo_nonstrict;
+ switch (curr_algo) {
+ case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
+ curr_algo_nonstrict = SRV_CHECKSUM_ALGORITHM_CRC32;
+ break;
+ case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
+ curr_algo_nonstrict = SRV_CHECKSUM_ALGORITHM_INNODB;
+ break;
+ case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
+ curr_algo_nonstrict = SRV_CHECKSUM_ALGORITHM_NONE;
+ break;
+ default:
+ ut_error;
+ }
+
+ ib_logf(IB_LOG_LEVEL_WARN,
+ "innodb_checksum_algorithm is set to \"%s\""
+ " but the page [page id: space=" ULINTPF ","
+ " page number=" ULINTPF "] contains a valid checksum \"%s\"."
+ " Accepting the page as valid. Change innodb_checksum_algorithm"
+ " to \"%s\" to silently accept such pages or rewrite all pages"
+ " so that they contain \"%s\" checksum.",
+ buf_checksum_algorithm_name(curr_algo),
+ space_id, page_no,
+ buf_checksum_algorithm_name(page_checksum),
+ buf_checksum_algorithm_name(curr_algo_nonstrict),
+ buf_checksum_algorithm_name(curr_algo_nonstrict));
+}
diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc
index 0e36040ffe2..94e3f645cbe 100644
--- a/storage/innobase/page/page0zip.cc
+++ b/storage/innobase/page/page0zip.cc
@@ -47,6 +47,8 @@ using namespace std;
#include "btr0cur.h"
#include "page0types.h"
#include "log0recv.h"
+#else
+#define page_warn_strict_checksum(A,B,C,D)
#endif /* !UNIV_INNOCHECKSUM */
#include "zlib.h"
#ifndef UNIV_HOTBACKUP
@@ -4926,6 +4928,13 @@ page_zip_verify_checksum(
stored = static_cast<ib_uint32_t>(mach_read_from_4(
static_cast<const unsigned char*>(data) + FIL_PAGE_SPACE_OR_CHKSUM));
+ ulint page_no __attribute__((unused)) =
+ mach_read_from_4(static_cast<const unsigned char*>
+ (data) + FIL_PAGE_OFFSET);
+ ulint space_id __attribute__((unused)) =
+ mach_read_from_4(static_cast<const unsigned char*>
+ (data) + FIL_PAGE_SPACE_ID);
+
#if FIL_PAGE_LSN % 8
#error "FIL_PAGE_LSN must be 64 bit aligned"
#endif
@@ -4951,40 +4960,113 @@ page_zip_verify_checksum(
}
#endif
+ const srv_checksum_algorithm_t curr_algo =
+ static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
+
+ if (curr_algo == SRV_CHECKSUM_ALGORITHM_NONE) {
+ return(TRUE);
+ }
+
calc = static_cast<ib_uint32_t>(page_zip_calc_checksum(
- data, size, static_cast<srv_checksum_algorithm_t>(
- srv_checksum_algorithm)));
+ data, size, curr_algo));
if (stored == calc) {
return(TRUE);
}
- switch ((srv_checksum_algorithm_t) srv_checksum_algorithm) {
+ switch (curr_algo) {
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
- case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
- case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
- return(stored == calc);
case SRV_CHECKSUM_ALGORITHM_CRC32:
+
if (stored == BUF_NO_CHECKSUM_MAGIC) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_NONE,
+ space_id, page_no);
+ }
+
return(TRUE);
}
- crc32 = calc;
+
innodb = static_cast<ib_uint32_t>(page_zip_calc_checksum(
data, size, SRV_CHECKSUM_ALGORITHM_INNODB));
+
+ if (stored == innodb) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_INNODB,
+ space_id, page_no);
+ }
+
+ return(TRUE);
+ }
+
break;
+ case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
case SRV_CHECKSUM_ALGORITHM_INNODB:
+
if (stored == BUF_NO_CHECKSUM_MAGIC) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_NONE,
+ space_id, page_no);
+ }
+
+ return(TRUE);
+ }
+
+ crc32 = static_cast<ib_uint32_t>(page_zip_calc_checksum(
+ data, size, SRV_CHECKSUM_ALGORITHM_CRC32));
+
+ if (stored == crc32) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_CRC32,
+ space_id, page_no);
+ }
+
return(TRUE);
}
+
+ break;
+ case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
+
crc32 = static_cast<ib_uint32_t>(page_zip_calc_checksum(
data, size, SRV_CHECKSUM_ALGORITHM_CRC32));
- innodb = calc;
+
+ if (stored == crc32) {
+ page_warn_strict_checksum(
+ curr_algo, SRV_CHECKSUM_ALGORITHM_CRC32,
+ space_id, page_no);
+
+ return(TRUE);
+ }
+
+ innodb = static_cast<ib_uint32_t>(page_zip_calc_checksum(
+ data, size, SRV_CHECKSUM_ALGORITHM_INNODB));
+
+ if (stored == innodb) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_INNODB,
+ space_id, page_no);
+ return(TRUE);
+ }
+
break;
case SRV_CHECKSUM_ALGORITHM_NONE:
- return(TRUE);
+ ut_error;
/* no default so the compiler will emit a warning if new enum
is added and not handled here */
}
- return(stored == crc32 || stored == innodb);
+ return(FALSE);
}
diff --git a/storage/innobase/pars/pars0pars.cc b/storage/innobase/pars/pars0pars.cc
index c87e1f8e247..da08939d78a 100644
--- a/storage/innobase/pars/pars0pars.cc
+++ b/storage/innobase/pars/pars0pars.cc
@@ -2019,7 +2019,8 @@ pars_create_table(
column = static_cast<sym_node_t*>(que_node_get_next(column));
}
- node = tab_create_graph_create(table, pars_sym_tab_global->heap, true);
+ node = tab_create_graph_create(table, pars_sym_tab_global->heap, true,
+ FIL_SPACE_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
table_sym->resolved = TRUE;
table_sym->token_type = SYM_TABLE;
diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc
index b3817e86080..2dba7081d09 100644
--- a/storage/innobase/row/row0ftsort.cc
+++ b/storage/innobase/row/row0ftsort.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2010, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -37,7 +38,8 @@ Created 10/13/2010 Jimmy Yang
do { \
b[N] = row_merge_read_rec( \
block[N], buf[N], b[N], index, \
- fd[N], &foffs[N], &mrec[N], offsets[N]); \
+ fd[N], &foffs[N], &mrec[N], offsets[N], \
+ crypt_data, crypt_block[N], space); \
if (UNIV_UNLIKELY(!b[N])) { \
if (mrec[N]) { \
goto exit; \
@@ -191,6 +193,8 @@ row_fts_psort_info_init(
fts_psort_t* merge_info = NULL;
ulint block_size;
ibool ret = TRUE;
+ fil_space_crypt_t* crypt_data = NULL;
+ bool encrypted = false;
block_size = 3 * srv_sort_buf_size;
@@ -219,6 +223,19 @@ row_fts_psort_info_init(
common_info->sort_event = os_event_create();
common_info->merge_event = os_event_create();
common_info->opt_doc_id_size = opt_doc_id_size;
+ crypt_data = fil_space_get_crypt_data(new_table->space);
+
+ if ((crypt_data && crypt_data->encryption == FIL_SPACE_ENCRYPTION_ON) ||
+ (srv_encrypt_tables &&
+ crypt_data && crypt_data->encryption == FIL_SPACE_ENCRYPTION_DEFAULT)) {
+
+ common_info->crypt_data = crypt_data;
+ encrypted = true;
+ } else {
+ /* Not needed */
+ common_info->crypt_data = NULL;
+ crypt_data = NULL;
+ }
/* There will be FTS_NUM_AUX_INDEX number of "sort buckets" for
each parallel sort thread. Each "sort bucket" holds records for
@@ -256,6 +273,29 @@ row_fts_psort_info_init(
ut_align(
psort_info[j].block_alloc[i], 1024));
+ /* If tablespace is encrypted, allocate additional buffer for
+ encryption/decryption. */
+ if (encrypted) {
+
+ /* Need to align memory for O_DIRECT write */
+ psort_info[j].crypt_alloc[i] =
+ static_cast<row_merge_block_t*>(ut_malloc(
+ block_size + 1024));
+
+ psort_info[j].crypt_block[i] =
+ static_cast<row_merge_block_t*>(
+ ut_align(
+ psort_info[j].crypt_alloc[i], 1024));
+
+ if (!psort_info[j].crypt_block[i]) {
+ ret = FALSE;
+ goto func_exit;
+ }
+ } else {
+ psort_info[j].crypt_alloc[i] = NULL;
+ psort_info[j].crypt_block[i] = NULL;
+ }
+
if (!psort_info[j].merge_block[i]) {
ret = FALSE;
goto func_exit;
@@ -313,6 +353,11 @@ row_fts_psort_info_destroy(
if (psort_info[j].block_alloc[i]) {
ut_free(psort_info[j].block_alloc[i]);
}
+
+ if (psort_info[j].crypt_alloc[i]) {
+ ut_free(psort_info[j].crypt_alloc[i]);
+ }
+
mem_free(psort_info[j].merge_file[i]);
}
@@ -595,6 +640,7 @@ fts_parallel_tokenization(
ibool processed = FALSE;
merge_file_t** merge_file;
row_merge_block_t** block;
+ row_merge_block_t** crypt_block;
int tmpfd[FTS_NUM_AUX_INDEX];
ulint mycount[FTS_NUM_AUX_INDEX];
ib_uint64_t total_rec = 0;
@@ -609,6 +655,7 @@ fts_parallel_tokenization(
fts_tokenize_ctx_t t_ctx;
ulint retried = 0;
dberr_t error = DB_SUCCESS;
+ fil_space_crypt_t* crypt_data = NULL;
ut_ad(psort_info);
@@ -630,6 +677,8 @@ fts_parallel_tokenization(
? DATA_VARCHAR : DATA_VARMYSQL;
block = psort_info->merge_block;
+ crypt_block = psort_info->crypt_block;
+ crypt_data = psort_info->psort_common->crypt_data;
zip_size = dict_table_zip_size(table);
row_merge_fts_get_next_doc_item(psort_info, &doc_item);
@@ -724,7 +773,10 @@ loop:
if (!row_merge_write(merge_file[t_ctx.buf_used]->fd,
merge_file[t_ctx.buf_used]->offset++,
- block[t_ctx.buf_used])) {
+ block[t_ctx.buf_used],
+ crypt_data,
+ crypt_block[t_ctx.buf_used],
+ table->space)) {
error = DB_TEMP_FILE_WRITE_FAILURE;
goto func_exit;
}
@@ -817,13 +869,21 @@ exit:
if (merge_file[i]->offset != 0) {
if (!row_merge_write(merge_file[i]->fd,
merge_file[i]->offset++,
- block[i])) {
+ block[i],
+ crypt_data,
+ crypt_block[i],
+ table->space)) {
error = DB_TEMP_FILE_WRITE_FAILURE;
goto func_exit;
}
UNIV_MEM_INVALID(block[i][0],
srv_sort_buf_size);
+
+ if (crypt_block[i]) {
+ UNIV_MEM_INVALID(crypt_block[i][0],
+ srv_sort_buf_size);
+ }
}
buf[i] = row_merge_buf_empty(buf[i]);
@@ -848,7 +908,10 @@ exit:
error = row_merge_sort(psort_info->psort_common->trx,
psort_info->psort_common->dup,
- merge_file[i], block[i], &tmpfd[i], false, 0.0/* pct_progress */, 0.0/* pct_cost */);
+ merge_file[i], block[i], &tmpfd[i],
+ false, 0.0/* pct_progress */, 0.0/* pct_cost */,
+ crypt_data, crypt_block[i], table->space);
+
if (error != DB_SUCCESS) {
close(tmpfd[i]);
goto func_exit;
@@ -1352,6 +1415,7 @@ row_fts_merge_insert(
mrec_buf_t** buf;
int* fd;
byte** block;
+ byte** crypt_block;
const mrec_t** mrec;
ulint count = 0;
int* sel_tree;
@@ -1359,6 +1423,8 @@ row_fts_merge_insert(
ulint start;
fts_psort_insert_t ins_ctx;
ulint count_diag = 0;
+ fil_space_crypt_t* crypt_data = NULL;
+ ulint space;
ut_ad(index);
ut_ad(table);
@@ -1371,6 +1437,7 @@ row_fts_merge_insert(
ins_ctx.trx->op_info = "inserting index entries";
ins_ctx.opt_doc_id_size = psort_info[0].psort_common->opt_doc_id_size;
+ crypt_data = psort_info[0].psort_common->crypt_data;
heap = mem_heap_create(500 + sizeof(mrec_buf_t));
@@ -1385,6 +1452,8 @@ row_fts_merge_insert(
fd = (int*) mem_heap_alloc(heap, sizeof(*fd) * fts_sort_pll_degree);
block = (byte**) mem_heap_alloc(
heap, sizeof(*block) * fts_sort_pll_degree);
+ crypt_block = (byte**) mem_heap_alloc(
+ heap, sizeof(*block) * fts_sort_pll_degree);
mrec = (const mrec_t**) mem_heap_alloc(
heap, sizeof(*mrec) * fts_sort_pll_degree);
sel_tree = (int*) mem_heap_alloc(
@@ -1405,6 +1474,7 @@ row_fts_merge_insert(
offsets[i][0] = num;
offsets[i][1] = dict_index_get_n_fields(index);
block[i] = psort_info[i].merge_block[id];
+ crypt_block[i] = psort_info[i].crypt_block[id];
b[i] = psort_info[i].merge_block[id];
fd[i] = psort_info[i].merge_file[id]->fd;
foffs[i] = 0;
@@ -1447,6 +1517,7 @@ row_fts_merge_insert(
ins_ctx.fts_table.table_id = table->id;
ins_ctx.fts_table.parent = index->table->name;
ins_ctx.fts_table.table = index->table;
+ space = table->space;
for (i = 0; i < fts_sort_pll_degree; i++) {
if (psort_info[i].merge_file[id]->n_rec == 0) {
@@ -1459,7 +1530,10 @@ row_fts_merge_insert(
if (psort_info[i].merge_file[id]->offset > 0
&& (!row_merge_read(
fd[i], foffs[i],
- (row_merge_block_t*) block[i]))) {
+ (row_merge_block_t*) block[i],
+ crypt_data,
+ (row_merge_block_t*) crypt_block[i],
+ space))) {
error = DB_CORRUPTION;
goto exit;
}
diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
index d5f766ef51b..ac6380e5a27 100644
--- a/storage/innobase/row/row0import.cc
+++ b/storage/innobase/row/row0import.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
-Copyright (c) 2012, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2012, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -139,14 +140,6 @@ struct row_import {
ulint find_col(const char* name) const UNIV_NOTHROW;
/**
- Find the index field entry in in the cfg indexes fields.
- @name - of the index to look for
- @return instance if found else 0. */
- const dict_field_t* find_field(
- const row_index_t* cfg_index,
- const char* name) const UNIV_NOTHROW;
-
- /**
Get the number of rows for which purge failed during the convert phase.
@param name - index name
@return number of rows for which purge failed. */
@@ -1141,30 +1134,6 @@ row_import::find_col(
}
/**
-Find the index field entry in in the cfg indexes fields.
-@name - of the index to look for
-@return instance if found else 0. */
-const dict_field_t*
-row_import::find_field(
- const row_index_t* cfg_index,
- const char* name) const UNIV_NOTHROW
-{
- const dict_field_t* field = cfg_index->m_fields;
-
- for (ulint i = 0; i < cfg_index->m_n_fields; ++i, ++field) {
- const char* field_name;
-
- field_name = reinterpret_cast<const char*>(field->name);
-
- if (strcmp(field_name, name) == 0) {
- return(field);
- }
- }
-
- return(0);
-}
-
-/**
Check if the index schema that was read from the .cfg file matches the
in memory index definition.
@return DB_SUCCESS or error code. */
@@ -1187,51 +1156,60 @@ row_import::match_index_columns(
return(DB_ERROR);
}
- cfg_index->m_srv_index = index;
+ if (cfg_index->m_n_fields != index->n_fields) {
- const dict_field_t* field = index->fields;
+ ib_errf(thd, IB_LOG_LEVEL_ERROR,
+ ER_TABLE_SCHEMA_MISMATCH,
+ "Index field count %lu doesn't match"
+ " tablespace metadata file value %lu",
+ (ulong) index->n_fields,
+ (ulong) cfg_index->m_n_fields);
- for (ulint i = 0; i < index->n_fields; ++i, ++field) {
+ return(DB_ERROR);
+ }
- const dict_field_t* cfg_field;
+ cfg_index->m_srv_index = index;
- cfg_field = find_field(cfg_index, field->name);
+ const dict_field_t* field = index->fields;
+ const dict_field_t* cfg_field = cfg_index->m_fields;
+
+ for (ulint i = 0; i < index->n_fields; ++i, ++field, ++cfg_field) {
- if (cfg_field == 0) {
+ if (strcmp(field->name, cfg_field->name) != 0) {
ib_errf(thd, IB_LOG_LEVEL_ERROR,
ER_TABLE_SCHEMA_MISMATCH,
- "Index %s field %s not found in tablespace "
- "meta-data file.",
- index->name, field->name);
+ "Index field name %s doesn't match"
+ " tablespace metadata field name %s"
+ " for field position %lu",
+ field->name, cfg_field->name, (ulong) i);
err = DB_ERROR;
- } else {
+ }
- if (cfg_field->prefix_len != field->prefix_len) {
- ib_errf(thd, IB_LOG_LEVEL_ERROR,
- ER_TABLE_SCHEMA_MISMATCH,
- "Index %s field %s prefix len %lu "
- "doesn't match meta-data file value "
- "%lu",
- index->name, field->name,
- (ulong) field->prefix_len,
- (ulong) cfg_field->prefix_len);
+ if (cfg_field->prefix_len != field->prefix_len) {
+ ib_errf(thd, IB_LOG_LEVEL_ERROR,
+ ER_TABLE_SCHEMA_MISMATCH,
+ "Index %s field %s prefix len %lu"
+ " doesn't match metadata file value"
+ " %lu",
+ index->name, field->name,
+ (ulong) field->prefix_len,
+ (ulong) cfg_field->prefix_len);
- err = DB_ERROR;
- }
+ err = DB_ERROR;
+ }
- if (cfg_field->fixed_len != field->fixed_len) {
- ib_errf(thd, IB_LOG_LEVEL_ERROR,
- ER_TABLE_SCHEMA_MISMATCH,
- "Index %s field %s fixed len %lu "
- "doesn't match meta-data file value "
- "%lu",
- index->name, field->name,
- (ulong) field->fixed_len,
- (ulong) cfg_field->fixed_len);
+ if (cfg_field->fixed_len != field->fixed_len) {
+ ib_errf(thd, IB_LOG_LEVEL_ERROR,
+ ER_TABLE_SCHEMA_MISMATCH,
+ "Index %s field %s fixed len %lu"
+ " doesn't match metadata file value"
+ " %lu",
+ index->name, field->name,
+ (ulong) field->fixed_len,
+ (ulong) cfg_field->fixed_len);
- err = DB_ERROR;
- }
+ err = DB_ERROR;
}
}
@@ -3620,10 +3598,13 @@ row_import_for_mysql(
innobase_format_name(
table_name, sizeof(table_name), table->name, FALSE);
- ib_errf(trx->mysql_thd, IB_LOG_LEVEL_ERROR,
- ER_INTERNAL_ERROR,
- "Cannot reset LSNs in table '%s' : %s",
- table_name, ut_strerr(err));
+ if (err != DB_DECRYPTION_FAILED) {
+
+ ib_errf(trx->mysql_thd, IB_LOG_LEVEL_ERROR,
+ ER_INTERNAL_ERROR,
+ "Cannot reset LSNs in table '%s' : %s",
+ table_name, ut_strerr(err));
+ }
return(row_import_cleanup(prebuilt, trx, err));
}
@@ -3651,7 +3632,7 @@ row_import_for_mysql(
err = fil_open_single_table_tablespace(
true, true, table->space,
dict_tf_to_fsp_flags(table->flags),
- table->name, filepath);
+ table->name, filepath, table);
DBUG_EXECUTE_IF("ib_import_open_tablespace_failure",
err = DB_TABLESPACE_NOT_FOUND;);
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index 44c9ac32d16..44ffe9982e9 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -2338,7 +2338,7 @@ row_ins_clust_index_entry_low(
{
btr_cur_t cursor;
ulint* offsets = NULL;
- dberr_t err;
+ dberr_t err = DB_SUCCESS;
big_rec_t* big_rec = NULL;
mtr_t mtr;
mem_heap_t* offsets_heap = NULL;
@@ -2361,9 +2361,16 @@ row_ins_clust_index_entry_low(
the function will return in both low_match and up_match of the
cursor sensible values */
- btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE, mode,
+ err = btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE, mode,
&cursor, 0, __FILE__, __LINE__, &mtr);
+ if (err != DB_SUCCESS) {
+ index->table->is_encrypted = true;
+ index->table->ibd_file_missing = true;
+ mtr_commit(&mtr);
+ goto func_exit;
+ }
+
#ifdef UNIV_DEBUG
{
page_t* page = btr_cur_get_page(&cursor);
@@ -2669,9 +2676,22 @@ row_ins_sec_index_entry_low(
search_mode |= BTR_IGNORE_SEC_UNIQUE;
}
- btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
- search_mode,
- &cursor, 0, __FILE__, __LINE__, &mtr);
+ err = btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
+ search_mode,
+ &cursor, 0, __FILE__, __LINE__, &mtr);
+
+ if (err != DB_SUCCESS) {
+ if (err == DB_DECRYPTION_FAILED) {
+ ib_push_warning(trx->mysql_thd,
+ DB_DECRYPTION_FAILED,
+ "Table %s is encrypted but encryption service or"
+ " used key_id is not available. "
+ " Can't continue reading table.",
+ index->table->name);
+ index->table->is_encrypted = true;
+ }
+ goto func_exit;
+ }
if (cursor.flag == BTR_CUR_INSERT_TO_IBUF) {
/* The insert was buffered during the search: we are done */
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index c1d3e08beaa..0669dfef34f 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2005, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -41,6 +42,7 @@ Completed by Sunny Bains and Marko Makela
#include "handler0alter.h"
#include "ha_prototypes.h"
#include "math.h" /* log() */
+#include "fil0crypt.h"
float my_log2f(float n)
{
@@ -76,6 +78,92 @@ UNIV_INTERN char srv_disable_sort_file_cache;
/* Maximum pending doc memory limit in bytes for a fts tokenization thread */
#define FTS_PENDING_DOC_MEMORY_LIMIT 1000000
+/* Reserve free space from every block for key_version */
+#define ROW_MERGE_RESERVE_SIZE 4
+
+/******************************************************//**
+Encrypt a merge block. */
+static
+void
+row_merge_encrypt_buf(
+/*==================*/
+ fil_space_crypt_t* crypt_data, /*!< in: table crypt data */
+ ulint offset, /*!< in: offset where to
+ write */
+ ulint space, /*!< in: tablespace id */
+ const byte* input_buf, /*!< in: input buffer */
+ byte* crypted_buf) /*!< out: crypted buffer */
+{
+ uint key_version;
+ uint dstlen=0;
+ os_offset_t ofs = (os_offset_t)srv_sort_buf_size * (os_offset_t)offset;
+
+ key_version = encryption_key_get_latest_version(crypt_data->key_id);
+
+ /* Store key_version at the begining of the input buffer */
+ mach_write_to_4((byte *)crypted_buf, key_version);
+
+ int rc = encryption_scheme_encrypt(input_buf+ROW_MERGE_RESERVE_SIZE,
+ srv_sort_buf_size-ROW_MERGE_RESERVE_SIZE,
+ crypted_buf+ROW_MERGE_RESERVE_SIZE, &dstlen,
+ crypt_data, key_version,
+ space, ofs, 0);
+
+ if (! ((rc == MY_AES_OK) && ((ulint)dstlen == srv_sort_buf_size-ROW_MERGE_RESERVE_SIZE))) {
+ ib_logf(IB_LOG_LEVEL_FATAL,
+ "Unable to encrypt data-block "
+ " src: %p srclen: %lu buf: %p buflen: %d."
+ " return-code: %d. Can't continue!\n",
+ input_buf, (size_t)srv_sort_buf_size,
+ crypted_buf, dstlen, rc);
+ ut_error;
+ }
+}
+
+/******************************************************//**
+Decrypt a merge block. */
+static
+bool
+row_merge_decrypt_buf(
+/*==================*/
+ fil_space_crypt_t* crypt_data, /*!< in: table crypt data */
+ ulint offset, /*!< in: offset where to
+ write */
+ ulint space, /*!< in: tablespace id */
+ const byte* input_buf, /*!< in: input buffer */
+ byte* crypted_buf) /*!< out: crypted buffer */
+{
+ uint key_version;
+ uint dstlen=0;
+ os_offset_t ofs = (os_offset_t)srv_sort_buf_size * (os_offset_t)offset;
+
+ /* Read key_version from begining of the buffer */
+ key_version = mach_read_from_4((byte *)input_buf);
+
+ if (key_version == 0) {
+ /* block not encrypted */
+ return false;
+ }
+
+ int rc = encryption_scheme_decrypt(input_buf+ROW_MERGE_RESERVE_SIZE,
+ srv_sort_buf_size-ROW_MERGE_RESERVE_SIZE,
+ crypted_buf+ROW_MERGE_RESERVE_SIZE, &dstlen,
+ crypt_data, key_version,
+ space, ofs, 0);
+
+ if (! ((rc == MY_AES_OK) && ((ulint)dstlen == srv_sort_buf_size-ROW_MERGE_RESERVE_SIZE))) {
+ ib_logf(IB_LOG_LEVEL_FATAL,
+ "Unable to encrypt data-block "
+ " src: %p srclen: %lu buf: %p buflen: %d."
+ " return-code: %d. Can't continue!\n",
+ input_buf, (size_t)srv_sort_buf_size,
+ crypted_buf, dstlen, rc);
+ ut_error;
+ }
+
+ return true;
+}
+
#ifdef UNIV_DEBUG
/******************************************************//**
Display a merge tuple. */
@@ -193,7 +281,7 @@ row_merge_buf_create(
ulint buf_size;
mem_heap_t* heap;
- max_tuples = srv_sort_buf_size
+ max_tuples = (srv_sort_buf_size - ROW_MERGE_RESERVE_SIZE)
/ ut_max(1, dict_index_get_min_size(index));
buf_size = (sizeof *buf);
@@ -608,8 +696,8 @@ row_merge_buf_add(
ut_ad(data_size < srv_sort_buf_size);
- /* Reserve one byte for the end marker of row_merge_block_t. */
- if (buf->total_size + data_size >= srv_sort_buf_size - 1) {
+ /* Reserve bytes for the end marker of row_merge_block_t. */
+ if (buf->total_size + data_size >= (srv_sort_buf_size - ROW_MERGE_RESERVE_SIZE)) {
DBUG_RETURN(0);
}
@@ -781,7 +869,7 @@ row_merge_buf_write(
{
const dict_index_t* index = buf->index;
ulint n_fields= dict_index_get_n_fields(index);
- byte* b = &block[0];
+ byte* b = &block[ROW_MERGE_RESERVE_SIZE];
for (ulint i = 0; i < buf->n_tuples; i++) {
const mtuple_t* entry = &buf->tuples[i];
@@ -800,7 +888,7 @@ row_merge_buf_write(
/* Write an "end-of-chunk" marker. */
ut_a(b < &block[srv_sort_buf_size]);
- ut_a(b == &block[0] + buf->total_size);
+ ut_a(b == &block[0] + buf->total_size + ROW_MERGE_RESERVE_SIZE);
*b++ = 0;
#ifdef UNIV_DEBUG_VALGRIND
/* The rest of the block is uninitialized. Initialize it
@@ -857,7 +945,10 @@ row_merge_read(
ulint offset, /*!< in: offset where to read
in number of row_merge_block_t
elements */
- row_merge_block_t* buf) /*!< out: data */
+ row_merge_block_t* buf, /*!< out: data */
+ fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
+ row_merge_block_t* crypt_buf, /*!< in: crypt buf or NULL */
+ ulint space) /*!< in: space id */
{
os_offset_t ofs = ((os_offset_t) offset) * srv_sort_buf_size;
ibool success;
@@ -881,6 +972,13 @@ row_merge_read(
success = os_file_read_no_error_handling(OS_FILE_FROM_FD(fd), buf,
ofs, srv_sort_buf_size);
+ /* For encrypted tables, decrypt data after reading and copy data */
+ if (crypt_data && crypt_buf) {
+ if (row_merge_decrypt_buf(crypt_data, offset, space, buf, crypt_buf)) {
+ memcpy(buf, crypt_buf, srv_sort_buf_size);
+ }
+ }
+
#ifdef POSIX_FADV_DONTNEED
/* Each block is read exactly once. Free up the file cache. */
posix_fadvise(fd, ofs, srv_sort_buf_size, POSIX_FADV_DONTNEED);
@@ -903,18 +1001,32 @@ UNIV_INTERN
ibool
row_merge_write(
/*============*/
- int fd, /*!< in: file descriptor */
- ulint offset, /*!< in: offset where to write,
- in number of row_merge_block_t elements */
- const void* buf) /*!< in: data */
+ int fd, /*!< in: file descriptor */
+ ulint offset, /*!< in: offset where to write,
+ in number of row_merge_block_t elements */
+ const void* buf, /*!< in: data */
+ fil_space_crypt_t* crypt_data, /*!< in: table crypt data */
+ void* crypt_buf, /*!< in: crypt buf or NULL */
+ ulint space) /*!< in: space id */
{
size_t buf_len = srv_sort_buf_size;
os_offset_t ofs = buf_len * (os_offset_t) offset;
ibool ret;
+ void* out_buf = (void *)buf;
DBUG_EXECUTE_IF("row_merge_write_failure", return(FALSE););
- ret = os_file_write("(merge)", OS_FILE_FROM_FD(fd), buf, ofs, buf_len);
+ /* For encrypted tables, encrypt data before writing */
+ if (crypt_data && crypt_buf) {
+ row_merge_encrypt_buf(crypt_data, offset, space, (const byte *)buf, (byte *)crypt_buf);
+ out_buf = crypt_buf;
+ } else {
+ /* Mark block unencrypted */
+ mach_write_to_4((byte *)out_buf, 0);
+ }
+
+ ret = os_file_write("(merge)", OS_FILE_FROM_FD(fd), out_buf, ofs, buf_len);
+
#ifdef UNIV_DEBUG
if (row_merge_print_block_write) {
@@ -948,7 +1060,10 @@ row_merge_read_rec(
const mrec_t** mrec, /*!< out: pointer to merge record,
or NULL on end of list
(non-NULL on I/O error) */
- ulint* offsets)/*!< out: offsets of mrec */
+ ulint* offsets,/*!< out: offsets of mrec */
+ fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
+ row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
+ ulint space) /*!< in: space id */
{
ulint extra_size;
ulint data_size;
@@ -966,6 +1081,10 @@ row_merge_read_rec(
ut_ad(*offsets == 1 + REC_OFFS_HEADER_SIZE
+ dict_index_get_n_fields(index));
+ if (b == &block[0]) {
+ b+= ROW_MERGE_RESERVE_SIZE;
+ }
+
extra_size = *b++;
if (UNIV_UNLIKELY(!extra_size)) {
@@ -985,7 +1104,8 @@ row_merge_read_rec(
/* Read another byte of extra_size. */
if (UNIV_UNLIKELY(b >= &block[srv_sort_buf_size])) {
- if (!row_merge_read(fd, ++(*foffs), block)) {
+ if (!row_merge_read(fd, ++(*foffs), block,
+ crypt_data, crypt_block, space)) {
err_exit:
/* Signal I/O error. */
*mrec = b;
@@ -993,7 +1113,7 @@ err_exit:
}
/* Wrap around to the beginning of the buffer. */
- b = &block[0];
+ b = &block[ROW_MERGE_RESERVE_SIZE];
}
extra_size = (extra_size & 0x7f) << 8;
@@ -1014,13 +1134,14 @@ err_exit:
ut_ad(avail_size < sizeof *buf);
memcpy(*buf, b, avail_size);
- if (!row_merge_read(fd, ++(*foffs), block)) {
+ if (!row_merge_read(fd, ++(*foffs), block,
+ crypt_data, crypt_block, space)) {
goto err_exit;
}
/* Wrap around to the beginning of the buffer. */
- b = &block[0];
+ b = &block[ROW_MERGE_RESERVE_SIZE];
/* Copy the record. */
memcpy(*buf + avail_size, b, extra_size - avail_size);
@@ -1075,13 +1196,14 @@ err_exit:
offsets[3] = (ulint) index;
#endif /* UNIV_DEBUG */
- if (!row_merge_read(fd, ++(*foffs), block)) {
+ if (!row_merge_read(fd, ++(*foffs), block,
+ crypt_data, crypt_block, space)) {
goto err_exit;
}
/* Wrap around to the beginning of the buffer. */
- b = &block[0];
+ b = &block[ROW_MERGE_RESERVE_SIZE];
/* Copy the rest of the record. */
memcpy(*buf + avail_size, b, extra_size + data_size - avail_size);
@@ -1157,7 +1279,10 @@ row_merge_write_rec(
int fd, /*!< in: file descriptor */
ulint* foffs, /*!< in/out: file offset */
const mrec_t* mrec, /*!< in: record to write */
- const ulint* offsets)/*!< in: offsets of mrec */
+ const ulint* offsets,/*!< in: offsets of mrec */
+ fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
+ row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
+ ulint space) /*!< in: space id */
{
ulint extra_size;
ulint size;
@@ -1178,6 +1303,10 @@ row_merge_write_rec(
size = extra_size + (extra_size >= 0x80)
+ rec_offs_data_size(offsets);
+ if (b == &block[0]) {
+ b+= ROW_MERGE_RESERVE_SIZE;
+ }
+
if (UNIV_UNLIKELY(b + size >= &block[srv_sort_buf_size])) {
/* The record spans two blocks.
Copy it to the temporary buffer first. */
@@ -1192,14 +1321,15 @@ row_merge_write_rec(
record to the head of the new block. */
memcpy(b, buf[0], avail_size);
- if (!row_merge_write(fd, (*foffs)++, block)) {
+ if (!row_merge_write(fd, (*foffs)++, block,
+ crypt_data, crypt_block, space)) {
return(NULL);
}
UNIV_MEM_INVALID(&block[0], srv_sort_buf_size);
/* Copy the rest. */
- b = &block[0];
+ b = &block[ROW_MERGE_RESERVE_SIZE];
memcpy(b, buf[0] + avail_size, size - avail_size);
b += size - avail_size;
} else {
@@ -1218,10 +1348,13 @@ static
byte*
row_merge_write_eof(
/*================*/
- row_merge_block_t* block, /*!< in/out: file buffer */
- byte* b, /*!< in: pointer to end of block */
- int fd, /*!< in: file descriptor */
- ulint* foffs) /*!< in/out: file offset */
+ row_merge_block_t* block, /*!< in/out: file buffer */
+ byte* b, /*!< in: pointer to end of block */
+ int fd, /*!< in: file descriptor */
+ ulint* foffs, /*!< in/out: file offset */
+ fil_space_crypt_t* crypt_data, /*!< in: table crypt data */
+ row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
+ ulint space) /*!< in: space id */
{
ut_ad(block);
ut_ad(b >= &block[0]);
@@ -1234,20 +1367,27 @@ row_merge_write_eof(
}
#endif /* UNIV_DEBUG */
+ if (b == &block[0]) {
+ b+= ROW_MERGE_RESERVE_SIZE;
+ }
+
*b++ = 0;
UNIV_MEM_ASSERT_RW(&block[0], b - &block[0]);
UNIV_MEM_ASSERT_W(&block[0], srv_sort_buf_size);
+
#ifdef UNIV_DEBUG_VALGRIND
/* The rest of the block is uninitialized. Initialize it
to avoid bogus warnings. */
memset(b, 0xff, &block[srv_sort_buf_size] - b);
#endif /* UNIV_DEBUG_VALGRIND */
- if (!row_merge_write(fd, (*foffs)++, block)) {
+ if (!row_merge_write(fd, (*foffs)++, block,
+ crypt_data, crypt_block, space)) {
return(NULL);
}
UNIV_MEM_INVALID(&block[0], srv_sort_buf_size);
+
return(&block[0]);
}
@@ -1292,7 +1432,11 @@ row_merge_read_clustered_index(
ULINT_UNDEFINED if none is added */
ib_sequence_t& sequence,/*!< in/out: autoinc sequence */
row_merge_block_t* block, /*!< in/out: file buffer */
- float pct_cost) /*!< in: percent of task weight out of total alter job */
+ float pct_cost, /*!< in: percent of task weight
+ out of total alter job */
+ fil_space_crypt_t* crypt_data,/*!< in: crypt data or NULL */
+ row_merge_block_t* crypt_block)/*!< in: in/out: crypted file
+ buffer */
{
dict_index_t* clust_index; /* Clustered index */
mem_heap_t* row_heap; /* Heap memory to create
@@ -1314,9 +1458,10 @@ row_merge_read_clustered_index(
ib_int64_t sig_count = 0;
mem_heap_t* conv_heap = NULL;
- float curr_progress;
+ float curr_progress = 0.0;
ib_int64_t read_rows = 0;
- ib_int64_t table_total_rows;
+ ib_int64_t table_total_rows = 0;
+
DBUG_ENTER("row_merge_read_clustered_index");
ut_ad((old_table == new_table) == !col_map);
@@ -1431,6 +1576,13 @@ row_merge_read_clustered_index(
row_ext_t* ext;
page_cur_t* cur = btr_pcur_get_page_cur(&pcur);
+ /* Do not continue if table pages are still encrypted */
+ if (old_table->is_encrypted || new_table->is_encrypted) {
+ err = DB_DECRYPTION_FAILED;
+ trx->error_key_num = 0;
+ goto func_exit;
+ }
+
page_cur_move_to_next(cur);
if (page_cur_is_after_last(cur)) {
@@ -1800,14 +1952,15 @@ write_buffers:
row_merge_buf_write(buf, file, block);
- if (!row_merge_write(file->fd, file->offset++,
- block)) {
+ if (!row_merge_write(file->fd, file->offset++, block,
+ crypt_data, crypt_block, new_table->space)) {
err = DB_TEMP_FILE_WRITE_FAILURE;
trx->error_key_num = i;
break;
}
UNIV_MEM_INVALID(&block[0], srv_sort_buf_size);
+
merge_buf[i] = row_merge_buf_empty(buf);
if (UNIV_LIKELY(row != NULL)) {
@@ -1976,14 +2129,21 @@ wait_again:
b2 = row_merge_write_rec(&block[2 * srv_sort_buf_size], \
&buf[2], b2, \
of->fd, &of->offset, \
- mrec##N, offsets##N); \
+ mrec##N, offsets##N, \
+ crypt_data, \
+ crypt_block ? &crypt_block[2 * srv_sort_buf_size] : NULL , \
+ space); \
if (UNIV_UNLIKELY(!b2 || ++of->n_rec > file->n_rec)) { \
goto corrupt; \
} \
b##N = row_merge_read_rec(&block[N * srv_sort_buf_size],\
&buf[N], b##N, INDEX, \
file->fd, foffs##N, \
- &mrec##N, offsets##N); \
+ &mrec##N, offsets##N, \
+ crypt_data, \
+ crypt_block ? &crypt_block[N * srv_sort_buf_size] : NULL, \
+ space); \
+ \
if (UNIV_UNLIKELY(!b##N)) { \
if (mrec##N) { \
goto corrupt; \
@@ -1995,7 +2155,7 @@ wait_again:
/*************************************************************//**
Merge two blocks of records on disk and write a bigger block.
@return DB_SUCCESS or error code */
-static __attribute__((nonnull, warn_unused_result))
+static __attribute__((nonnull(1,2,3,4,5,6), warn_unused_result))
dberr_t
row_merge_blocks(
/*=============*/
@@ -2008,7 +2168,11 @@ row_merge_blocks(
source list in the file */
ulint* foffs1, /*!< in/out: offset of second
source list in the file */
- merge_file_t* of) /*!< in/out: output file */
+ merge_file_t* of, /*!< in/out: output file */
+ fil_space_crypt_t* crypt_data,/*!< in: crypt data or NULL */
+ row_merge_block_t* crypt_block,/*!< in: in/out: crypted file
+ buffer */
+ ulint space) /*!< in: space id */
{
mem_heap_t* heap; /*!< memory heap for offsets0, offsets1 */
@@ -2039,8 +2203,10 @@ row_merge_blocks(
/* Write a record and read the next record. Split the output
file in two halves, which can be merged on the following pass. */
- if (!row_merge_read(file->fd, *foffs0, &block[0])
- || !row_merge_read(file->fd, *foffs1, &block[srv_sort_buf_size])) {
+ if (!row_merge_read(file->fd, *foffs0, &block[0],
+ crypt_data, crypt_block ? &crypt_block[0] : NULL, space)
+ || !row_merge_read(file->fd, *foffs1, &block[srv_sort_buf_size],
+ crypt_data, crypt_block ? &crypt_block[srv_sort_buf_size] : NULL, space)) {
corrupt:
mem_heap_free(heap);
return(DB_CORRUPTION);
@@ -2052,11 +2218,15 @@ corrupt:
b0 = row_merge_read_rec(
&block[0], &buf[0], b0, dup->index,
- file->fd, foffs0, &mrec0, offsets0);
+ file->fd, foffs0, &mrec0, offsets0,
+ crypt_data, crypt_block ? &crypt_block[0] : NULL, space);
+
b1 = row_merge_read_rec(
&block[srv_sort_buf_size],
&buf[srv_sort_buf_size], b1, dup->index,
- file->fd, foffs1, &mrec1, offsets1);
+ file->fd, foffs1, &mrec1, offsets1,
+ crypt_data, crypt_block ? &crypt_block[srv_sort_buf_size] : NULL, space);
+
if (UNIV_UNLIKELY(!b0 && mrec0)
|| UNIV_UNLIKELY(!b1 && mrec1)) {
@@ -2098,15 +2268,18 @@ done0:
done1:
mem_heap_free(heap);
+
b2 = row_merge_write_eof(&block[2 * srv_sort_buf_size],
- b2, of->fd, &of->offset);
+ b2, of->fd, &of->offset,
+ crypt_data, crypt_block ? &crypt_block[2 * srv_sort_buf_size] : NULL, space);
+
return(b2 ? DB_SUCCESS : DB_CORRUPTION);
}
/*************************************************************//**
Copy a block of index entries.
@return TRUE on success, FALSE on failure */
-static __attribute__((nonnull, warn_unused_result))
+static __attribute__((nonnull(1,2,3,4,5), warn_unused_result))
ibool
row_merge_blocks_copy(
/*==================*/
@@ -2114,7 +2287,10 @@ row_merge_blocks_copy(
const merge_file_t* file, /*!< in: input file */
row_merge_block_t* block, /*!< in/out: 3 buffers */
ulint* foffs0, /*!< in/out: input file offset */
- merge_file_t* of) /*!< in/out: output file */
+ merge_file_t* of, /*!< in/out: output file */
+ fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
+ row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
+ ulint space) /*!< in: space id */
{
mem_heap_t* heap; /*!< memory heap for offsets0, offsets1 */
@@ -2141,7 +2317,8 @@ row_merge_blocks_copy(
/* Write a record and read the next record. Split the output
file in two halves, which can be merged on the following pass. */
- if (!row_merge_read(file->fd, *foffs0, &block[0])) {
+ if (!row_merge_read(file->fd, *foffs0, &block[0],
+ crypt_data, crypt_block ? &crypt_block[0] : NULL, space)) {
corrupt:
mem_heap_free(heap);
return(FALSE);
@@ -2152,7 +2329,9 @@ corrupt:
b2 = &block[2 * srv_sort_buf_size];
b0 = row_merge_read_rec(&block[0], &buf[0], b0, index,
- file->fd, foffs0, &mrec0, offsets0);
+ file->fd, foffs0, &mrec0, offsets0,
+ crypt_data, crypt_block ? &crypt_block[0] : NULL, space);
+
if (UNIV_UNLIKELY(!b0 && mrec0)) {
goto corrupt;
@@ -2171,15 +2350,18 @@ done0:
(*foffs0)++;
mem_heap_free(heap);
+
return(row_merge_write_eof(&block[2 * srv_sort_buf_size],
- b2, of->fd, &of->offset)
+ b2, of->fd, &of->offset,
+ crypt_data,
+ crypt_block ? &crypt_block[2 * srv_sort_buf_size] : NULL, space)
!= NULL);
}
/*************************************************************//**
Merge disk files.
@return DB_SUCCESS or error code */
-static __attribute__((nonnull))
+static __attribute__((nonnull(1,2,3,4,5,6,7)))
dberr_t
row_merge(
/*======*/
@@ -2192,9 +2374,12 @@ row_merge(
int* tmpfd, /*!< in/out: temporary file handle */
ulint* num_run,/*!< in/out: Number of runs remain
to be merged */
- ulint* run_offset) /*!< in/out: Array contains the
+ ulint* run_offset, /*!< in/out: Array contains the
first offset number for each merge
run */
+ fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
+ row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
+ ulint space) /*!< in: space id */
{
ulint foffs0; /*!< first input offset */
ulint foffs1; /*!< second input offset */
@@ -2207,6 +2392,10 @@ row_merge(
UNIV_MEM_ASSERT_W(&block[0], 3 * srv_sort_buf_size);
+ if (crypt_block) {
+ UNIV_MEM_ASSERT_W(&crypt_block[0], 3 * srv_sort_buf_size);
+ }
+
ut_ad(ihalf < file->offset);
of.fd = *tmpfd;
@@ -2237,7 +2426,8 @@ row_merge(
run_offset[n_run++] = of.offset;
error = row_merge_blocks(dup, file, block,
- &foffs0, &foffs1, &of);
+ &foffs0, &foffs1, &of,
+ crypt_data, crypt_block, space);
if (error != DB_SUCCESS) {
return(error);
@@ -2257,7 +2447,8 @@ row_merge(
run_offset[n_run++] = of.offset;
if (!row_merge_blocks_copy(dup->index, file, block,
- &foffs0, &of)) {
+ &foffs0, &of,
+ crypt_data, crypt_block, space)) {
return(DB_CORRUPTION);
}
}
@@ -2274,7 +2465,8 @@ row_merge(
run_offset[n_run++] = of.offset;
if (!row_merge_blocks_copy(dup->index, file, block,
- &foffs1, &of)) {
+ &foffs1, &of,
+ crypt_data, crypt_block, space)) {
return(DB_CORRUPTION);
}
}
@@ -2329,7 +2521,10 @@ row_merge_sort(
const float pct_progress,
/*!< in: total progress percent
until now */
- const float pct_cost) /*!< in: current progress percent */
+ const float pct_cost, /*!< in: current progress percent */
+ fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
+ row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
+ ulint space) /*!< in: space id */
{
const ulint half = file->offset / 2;
ulint num_runs;
@@ -2381,7 +2576,8 @@ row_merge_sort(
sql_print_information("InnoDB: Online DDL : merge-sorting current run %lu estimated %lu runs", cur_run, num_runs);
error = row_merge(trx, dup, file, block, tmpfd,
- &num_runs, run_offset);
+ &num_runs, run_offset,
+ crypt_data, crypt_block, space);
if(update_progress) {
merge_count++;
@@ -2453,7 +2649,7 @@ row_merge_copy_blobs(
Read sorted file containing index data tuples and insert these data
tuples to the index
@return DB_SUCCESS or error number */
-static __attribute__((nonnull, warn_unused_result))
+static __attribute__((nonnull(2,3,5), warn_unused_result))
dberr_t
row_merge_insert_index_tuples(
/*==========================*/
@@ -2464,7 +2660,11 @@ row_merge_insert_index_tuples(
row_merge_block_t* block, /*!< in/out: file buffer */
const ib_int64_t table_total_rows, /*!< in: total rows of old table */
const float pct_progress, /*!< in: total progress percent until now */
- const float pct_cost) /*!< in: current progress percent */
+ const float pct_cost, /*!< in: current progress percent
+ */
+ fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
+ row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
+ ulint space) /*!< in: space id */
{
const byte* b;
mem_heap_t* heap;
@@ -2495,9 +2695,10 @@ row_merge_insert_index_tuples(
offsets[1] = dict_index_get_n_fields(index);
}
- b = block;
+ b = &block[0];
- if (!row_merge_read(fd, foffs, block)) {
+ if (!row_merge_read(fd, foffs, block,
+ crypt_data, crypt_block, space)) {
error = DB_CORRUPTION;
} else {
buf = static_cast<mrec_buf_t*>(
@@ -2513,7 +2714,8 @@ row_merge_insert_index_tuples(
mtr_t mtr;
b = row_merge_read_rec(block, buf, b, index,
- fd, &foffs, &mrec, offsets);
+ fd, &foffs, &mrec, offsets,
+ crypt_data, crypt_block, space);
if (UNIV_UNLIKELY(!b)) {
/* End of list, or I/O error */
if (mrec) {
@@ -3654,6 +3856,7 @@ row_merge_build_indexes(
{
merge_file_t* merge_files;
row_merge_block_t* block;
+ row_merge_block_t* crypt_block;
ulint block_size;
ulint i;
ulint j;
@@ -3664,6 +3867,7 @@ row_merge_build_indexes(
fts_psort_t* merge_info = NULL;
ib_int64_t sig_count = 0;
bool fts_psort_initiated = false;
+ fil_space_crypt_t * crypt_data = NULL;
float total_static_cost = 0;
float total_dynamic_cost = 0;
@@ -3688,6 +3892,27 @@ row_merge_build_indexes(
DBUG_RETURN(DB_OUT_OF_MEMORY);
}
+ /* Get crypt data from tablespace if present. */
+ crypt_data = fil_space_get_crypt_data(new_table->space);
+ crypt_block = NULL;
+
+ /* If tablespace is encrypted, allocate additional buffer for
+ encryption/decryption. */
+ if ((crypt_data && crypt_data->encryption == FIL_SPACE_ENCRYPTION_ON) ||
+ (srv_encrypt_tables &&
+ crypt_data && crypt_data->encryption == FIL_SPACE_ENCRYPTION_DEFAULT)) {
+
+ crypt_block = static_cast<row_merge_block_t*>(
+ os_mem_alloc_large(&block_size));
+
+ if (crypt_block == NULL) {
+ DBUG_RETURN(DB_OUT_OF_MEMORY);
+ }
+ } else {
+ /* Not needed */
+ crypt_data = NULL;
+ }
+
trx_start_if_not_started_xa(trx);
merge_files = static_cast<merge_file_t*>(
@@ -3754,14 +3979,26 @@ row_merge_build_indexes(
pct_cost = COST_READ_CLUSTERED_INDEX * 100 / (total_static_cost + total_dynamic_cost);
+ /* Do not continue if we can't encrypt table pages */
+ if (old_table->is_encrypted || new_table->is_encrypted) {
+ error = DB_DECRYPTION_FAILED;
+ ib_push_warning(trx->mysql_thd, DB_DECRYPTION_FAILED,
+ "Table %s is encrypted but encryption service or"
+ " used key_id is not available. "
+ " Can't continue reading table.",
+ old_table->is_encrypted ? old_table->name : new_table->name);
+ goto func_exit;
+ }
+
/* Read clustered index of the table and create files for
secondary index entries for merge sort */
error = row_merge_read_clustered_index(
- trx, table, old_table, new_table, online, indexes,
- fts_sort_idx, psort_info, merge_files, key_numbers,
- n_indexes, add_cols, col_map,
- add_autoinc, sequence, block, pct_cost);
+ trx, table, old_table, new_table, online, indexes,
+ fts_sort_idx, psort_info, merge_files, key_numbers,
+ n_indexes, add_cols, col_map,
+ add_autoinc, sequence, block, pct_cost,
+ crypt_data, crypt_block);
pct_progress += pct_cost;
@@ -3781,6 +4018,10 @@ row_merge_build_indexes(
/* Now we have files containing index entries ready for
sorting and inserting. */
+ DBUG_EXECUTE_IF(
+ "ib_merge_wait_after_read",
+ os_thread_sleep(20000000);); /* 20 sec */
+
for (i = 0; i < n_indexes; i++) {
dict_index_t* sort_idx = indexes[i];
@@ -3874,8 +4115,10 @@ wait_again:
buf, (i+1), n_indexes, pct_cost);
error = row_merge_sort(
- trx, &dup, &merge_files[i],
- block, &tmpfd, true, pct_progress, pct_cost);
+ trx, &dup, &merge_files[i],
+ block, &tmpfd, true,
+ pct_progress, pct_cost,
+ crypt_data, crypt_block, new_table->space);
pct_progress += pct_cost;
@@ -3883,6 +4126,10 @@ wait_again:
" merge-sorting index %s (%lu / %lu)",
buf, (i+1), n_indexes);
+ DBUG_EXECUTE_IF(
+ "ib_merge_wait_after_sort",
+ os_thread_sleep(20000000);); /* 20 sec */
+
if (error == DB_SUCCESS) {
pct_cost = (COST_BUILD_INDEX_STATIC +
(total_dynamic_cost * merge_files[i].offset /
@@ -3898,7 +4145,8 @@ wait_again:
error = row_merge_insert_index_tuples(
trx->id, sort_idx, old_table,
merge_files[i].fd, block,
- merge_files[i].n_rec, pct_progress, pct_cost);
+ merge_files[i].n_rec, pct_progress, pct_cost,
+ crypt_data, crypt_block, new_table->space);
pct_progress += pct_cost;
sql_print_information("InnoDB: Online DDL : "
@@ -3972,6 +4220,10 @@ func_exit:
mem_free(merge_files);
os_mem_free_large(block, block_size);
+ if (crypt_block) {
+ os_mem_free_large(crypt_block, block_size);
+ }
+
DICT_TF2_FLAG_UNSET(new_table, DICT_TF2_FTS_ADD_DOC_ID);
if (online && old_table == new_table && error != DB_SUCCESS) {
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index b225669b0f7..d609f9649fd 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -623,6 +623,8 @@ handle_new_error:
case DB_FTS_INVALID_DOCID:
case DB_INTERRUPTED:
case DB_DICT_CHANGED:
+ case DB_TABLE_NOT_FOUND:
+ case DB_DECRYPTION_FAILED:
if (savept) {
/* Roll back the latest, possibly incomplete insertion
or update */
@@ -1315,7 +1317,13 @@ row_insert_for_mysql(
prebuilt->table->name);
return(DB_TABLESPACE_NOT_FOUND);
-
+ } else if (prebuilt->table->is_encrypted) {
+ ib_push_warning(trx, DB_DECRYPTION_FAILED,
+ "Table %s in tablespace %lu encrypted."
+ "However key management plugin or used key_id is not found or"
+ " used encryption algorithm or method does not match.",
+ prebuilt->table->name, prebuilt->table->space);
+ return(DB_DECRYPTION_FAILED);
} else if (prebuilt->magic_n != ROW_PREBUILT_ALLOCATED) {
fprintf(stderr,
"InnoDB: Error: trying to free a corrupt\n"
@@ -1327,18 +1335,14 @@ row_insert_for_mysql(
mem_analyze_corruption(prebuilt);
ut_error;
- } else if (srv_created_new_raw || srv_force_recovery) {
- fputs("InnoDB: A new raw disk partition was initialized or\n"
- "InnoDB: innodb_force_recovery is on: we do not allow\n"
+ } else if (srv_force_recovery) {
+ fputs("InnoDB: innodb_force_recovery is on: we do not allow\n"
"InnoDB: database modifications by the user. Shut down\n"
"InnoDB: mysqld and edit my.cnf so that"
- " newraw is replaced\n"
- "InnoDB: with raw, and innodb_force_... is removed.\n",
+ "InnoDB: innodb_force_... is removed.\n",
stderr);
- if(srv_force_recovery) {
- return(DB_READ_ONLY);
- }
- return(DB_ERROR);
+
+ return(DB_READ_ONLY);
}
trx->op_info = "inserting";
@@ -1714,6 +1718,13 @@ row_update_for_mysql(
"InnoDB: how you can resolve the problem.\n",
prebuilt->table->name);
return(DB_ERROR);
+ } else if (prebuilt->table->is_encrypted) {
+ ib_push_warning(trx, DB_DECRYPTION_FAILED,
+ "Table %s in tablespace %lu encrypted."
+ "However key management plugin or used key_id is not found or"
+ " used encryption algorithm or method does not match.",
+ prebuilt->table->name, prebuilt->table->space);
+ return (DB_TABLE_NOT_FOUND);
}
if (UNIV_UNLIKELY(prebuilt->magic_n != ROW_PREBUILT_ALLOCATED)) {
@@ -1729,18 +1740,14 @@ row_update_for_mysql(
ut_error;
}
- if (UNIV_UNLIKELY(srv_created_new_raw || srv_force_recovery)) {
- fputs("InnoDB: A new raw disk partition was initialized or\n"
- "InnoDB: innodb_force_recovery is on: we do not allow\n"
+ if (UNIV_UNLIKELY(srv_force_recovery)) {
+ fputs("InnoDB: innodb_force_recovery is on: we do not allow\n"
"InnoDB: database modifications by the user. Shut down\n"
- "InnoDB: mysqld and edit my.cnf so that newraw"
- " is replaced\n"
- "InnoDB: with raw, and innodb_force_... is removed.\n",
+ "InnoDB: mysqld and edit my.cnf so that"
+ "InnoDB: innodb_force_... is removed.\n",
stderr);
- if(srv_force_recovery) {
- return(DB_READ_ONLY);
- }
- return(DB_ERROR);
+
+ return(DB_READ_ONLY);
}
DEBUG_SYNC_C("innodb_row_update_for_mysql_begin");
@@ -2219,7 +2226,9 @@ row_create_table_for_mysql(
(will be freed, or on DB_SUCCESS
added to the data dictionary cache) */
trx_t* trx, /*!< in/out: transaction */
- bool commit) /*!< in: if true, commit the transaction */
+ bool commit, /*!< in: if true, commit the transaction */
+ fil_encryption_t mode, /*!< in: encryption mode */
+ ulint key_id) /*!< in: encryption key_id */
{
tab_node_t* node;
mem_heap_t* heap;
@@ -2239,22 +2248,6 @@ row_create_table_for_mysql(
goto err_exit;
);
- if (srv_created_new_raw) {
- fputs("InnoDB: A new raw disk partition was initialized:\n"
- "InnoDB: we do not allow database modifications"
- " by the user.\n"
- "InnoDB: Shut down mysqld and edit my.cnf so that newraw"
- " is replaced with raw.\n", stderr);
-err_exit:
- dict_mem_table_free(table);
-
- if (commit) {
- trx_commit_for_mysql(trx);
- }
-
- return(DB_ERROR);
- }
-
trx->op_info = "creating table";
if (row_mysql_is_system_table(table->name)) {
@@ -2265,7 +2258,19 @@ err_exit:
"InnoDB: MySQL system tables must be"
" of the MyISAM type!\n",
table->name);
- goto err_exit;
+
+#ifndef DBUG_OFF
+err_exit:
+#endif /* !DBUG_OFF */
+ dict_mem_table_free(table);
+
+ if (commit) {
+ trx_commit_for_mysql(trx);
+ }
+
+ trx->op_info = "";
+
+ return(DB_ERROR);
}
trx_start_if_not_started_xa(trx);
@@ -2336,7 +2341,7 @@ err_exit:
ut_ad(strstr(table->name, "/FTS_") != NULL);
}
- node = tab_create_graph_create(table, heap, commit);
+ node = tab_create_graph_create(table, heap, commit, mode, key_id);
thr = pars_complete_graph_for_exec(node, trx, heap);
@@ -3134,6 +3139,8 @@ row_discard_tablespace_for_mysql(
if (table == 0) {
err = DB_TABLE_NOT_FOUND;
+ } else if (table->is_encrypted) {
+ err = DB_DECRYPTION_FAILED;
} else if (table->space == TRX_SYS_SPACE) {
char table_name[MAX_FULL_NAME_LEN + 1];
@@ -3350,18 +3357,10 @@ row_truncate_table_for_mysql(
ut_ad(table);
- if (srv_created_new_raw) {
- fputs("InnoDB: A new raw disk partition was initialized:\n"
- "InnoDB: we do not allow database modifications"
- " by the user.\n"
- "InnoDB: Shut down mysqld and edit my.cnf so that newraw"
- " is replaced with raw.\n", stderr);
-
- return(DB_ERROR);
- }
-
if (dict_table_is_discarded(table)) {
return(DB_TABLESPACE_DELETED);
+ } else if (table->is_encrypted) {
+ return(DB_DECRYPTION_FAILED);
} else if (table->ibd_file_missing) {
return(DB_TABLESPACE_NOT_FOUND);
}
@@ -3483,10 +3482,19 @@ row_truncate_table_for_mysql(
if (table->space && !DICT_TF2_FLAG_IS_SET(table, DICT_TF2_TEMPORARY)) {
/* Discard and create the single-table tablespace. */
+ fil_space_crypt_t* crypt_data;
ulint space = table->space;
ulint flags = fil_space_get_flags(space);
+ ulint key_id = FIL_DEFAULT_ENCRYPTION_KEY;
+ fil_encryption_t mode = FIL_SPACE_ENCRYPTION_DEFAULT;
dict_get_and_save_data_dir_path(table, true);
+ crypt_data = fil_space_get_crypt_data(space);
+
+ if (crypt_data) {
+ key_id = crypt_data->key_id;
+ mode = crypt_data->encryption;
+ }
if (flags != ULINT_UNDEFINED
&& fil_discard_tablespace(space) == DB_SUCCESS) {
@@ -3505,7 +3513,8 @@ row_truncate_table_for_mysql(
space, table->name,
table->data_dir_path,
flags, table->flags2,
- FIL_IBD_FILE_INITIAL_SIZE)
+ FIL_IBD_FILE_INITIAL_SIZE,
+ mode, key_id)
!= DB_SUCCESS) {
dict_table_x_unlock_indexes(table);
@@ -3839,16 +3848,6 @@ row_drop_table_for_mysql(
ut_a(name != NULL);
- if (srv_created_new_raw) {
- fputs("InnoDB: A new raw disk partition was initialized:\n"
- "InnoDB: we do not allow database modifications"
- " by the user.\n"
- "InnoDB: Shut down mysqld and edit my.cnf so that newraw"
- " is replaced with raw.\n", stderr);
-
- DBUG_RETURN(DB_ERROR);
- }
-
/* The table name is prefixed with the database name and a '/'.
Certain table names starting with 'innodb_' have their special
meaning regardless of the database name. Thus, we need to
@@ -3939,6 +3938,19 @@ row_drop_table_for_mysql(
goto funct_exit;
}
+ /* If table is encrypted and table page encryption failed
+ return error. */
+ if (table->is_encrypted) {
+
+ if (table->can_be_evicted) {
+ dict_table_move_from_lru_to_non_lru(table);
+ }
+
+ dict_table_close(table, TRUE, FALSE);
+ err = DB_DECRYPTION_FAILED;
+ goto funct_exit;
+ }
+
/* Turn on this drop bit before we could release the dictionary
latch */
table->to_be_dropped = true;
@@ -4866,19 +4878,16 @@ row_rename_table_for_mysql(
ut_a(new_name != NULL);
ut_ad(trx->state == TRX_STATE_ACTIVE);
- if (srv_created_new_raw || srv_force_recovery) {
- fputs("InnoDB: A new raw disk partition was initialized or\n"
- "InnoDB: innodb_force_recovery is on: we do not allow\n"
+ if (srv_force_recovery) {
+ fputs("InnoDB: innodb_force_recovery is on: we do not allow\n"
"InnoDB: database modifications by the user. Shut down\n"
- "InnoDB: mysqld and edit my.cnf so that newraw"
- " is replaced\n"
- "InnoDB: with raw, and innodb_force_... is removed.\n",
+ "InnoDB: mysqld and edit my.cnf so that"
+ "InnoDB: innodb_force_... is removed.\n",
stderr);
- if(srv_force_recovery) {
- err = DB_READ_ONLY;
- }
+ err = DB_READ_ONLY;
goto funct_exit;
+
} else if (row_mysql_is_system_table(new_name)) {
fprintf(stderr,
diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc
index 8212a7b43e0..b26ba971a95 100644
--- a/storage/innobase/row/row0purge.cc
+++ b/storage/innobase/row/row0purge.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1997, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -84,7 +84,7 @@ row_purge_node_create(
/***********************************************************//**
Repositions the pcur in the purge node on the clustered index record,
-if found.
+if found. If the record is not found, close pcur.
@return TRUE if the record was found */
static
ibool
@@ -95,11 +95,10 @@ row_purge_reposition_pcur(
mtr_t* mtr) /*!< in: mtr */
{
if (node->found_clust) {
- ibool found;
+ ut_ad(node->validate_pcur());
- found = btr_pcur_restore_position(mode, &node->pcur, mtr);
+ node->found_clust = btr_pcur_restore_position(mode, &node->pcur, mtr);
- return(found);
} else {
node->found_clust = row_search_on_row_ref(
&node->pcur, mode, node->table, node->ref, mtr);
@@ -109,6 +108,11 @@ row_purge_reposition_pcur(
}
}
+ /* Close the current cursor if we fail to position it correctly. */
+ if (!node->found_clust) {
+ btr_pcur_close(&node->pcur);
+ }
+
return(node->found_clust);
}
@@ -182,7 +186,12 @@ func_exit:
mem_heap_free(heap);
}
- btr_pcur_commit_specify_mtr(&node->pcur, &mtr);
+ /* Persistent cursor is closed if reposition fails. */
+ if (node->found_clust) {
+ btr_pcur_commit_specify_mtr(&node->pcur, &mtr);
+ } else {
+ mtr_commit(&mtr);
+ }
return(success);
}
@@ -251,7 +260,12 @@ row_purge_poss_sec(
btr_pcur_get_rec(&node->pcur),
&mtr, index, entry);
- btr_pcur_commit_specify_mtr(&node->pcur, &mtr);
+ /* Persistent cursor is closed if reposition fails. */
+ if (node->found_clust) {
+ btr_pcur_commit_specify_mtr(&node->pcur, &mtr);
+ } else {
+ mtr_commit(&mtr);
+ }
return(can_delete);
}
@@ -831,6 +845,8 @@ row_purge_record_func(
dict_index_t* clust_index;
bool purged = true;
+ ut_ad(!node->found_clust);
+
clust_index = dict_table_get_first_index(node->table);
node->index = dict_table_get_next_index(clust_index);
@@ -986,3 +1002,52 @@ row_purge_step(
return(thr);
}
+
+#ifdef UNIV_DEBUG
+/***********************************************************//**
+Validate the persisent cursor. The purge node has two references
+to the clustered index record - one via the ref member, and the
+other via the persistent cursor. These two references must match
+each other if the found_clust flag is set.
+@return true if the stored copy of persistent cursor is consistent
+with the ref member.*/
+bool
+purge_node_t::validate_pcur()
+{
+ if (!found_clust) {
+ return(true);
+ }
+
+ if (index == NULL) {
+ return(true);
+ }
+
+ if (index->type == DICT_FTS) {
+ return(true);
+ }
+
+ if (pcur.old_stored != BTR_PCUR_OLD_STORED) {
+ return(true);
+ }
+
+ dict_index_t* clust_index = pcur.btr_cur.index;
+
+ ulint* offsets = rec_get_offsets(
+ pcur.old_rec, clust_index, NULL, pcur.old_n_fields, &heap);
+
+ /* Here we are comparing the purge ref record and the stored initial
+ part in persistent cursor. Both cases we store n_uniq fields of the
+ cluster index and so it is fine to do the comparison. We note this
+ dependency here as pcur and ref belong to different modules. */
+ int st = cmp_dtuple_rec(ref, pcur.old_rec, offsets);
+
+ if (st != 0) {
+ fprintf(stderr, "Purge node pcur validation failed\n");
+ dtuple_print(stderr, ref);
+ rec_print(stderr, pcur.old_rec, clust_index);
+ return(false);
+ }
+
+ return(true);
+}
+#endif /* UNIV_DEBUG */
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index b0e0c89b778..ea2f93dd788 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -1,7 +1,8 @@
/*****************************************************************************
-Copyright (c) 1997, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
+Copyright (c) 2015, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -3717,6 +3718,9 @@ row_search_for_mysql(
return(DB_TABLESPACE_NOT_FOUND);
+ } else if (prebuilt->table->is_encrypted) {
+
+ return(DB_DECRYPTION_FAILED);
} else if (!prebuilt->index_usable) {
return(DB_MISSING_HISTORY);
@@ -4143,9 +4147,14 @@ wait_table_again:
} else if (dtuple_get_n_fields(search_tuple) > 0) {
- btr_pcur_open_with_no_init(index, search_tuple, mode,
- BTR_SEARCH_LEAF,
- pcur, 0, &mtr);
+ err = btr_pcur_open_with_no_init(index, search_tuple, mode,
+ BTR_SEARCH_LEAF,
+ pcur, 0, &mtr);
+
+ if (err != DB_SUCCESS) {
+ rec = NULL;
+ goto lock_wait_or_error;
+ }
pcur->trx_if_known = trx;
@@ -4179,9 +4188,23 @@ wait_table_again:
}
}
} else if (mode == PAGE_CUR_G || mode == PAGE_CUR_L) {
- btr_pcur_open_at_index_side(
+ err = btr_pcur_open_at_index_side(
mode == PAGE_CUR_G, index, BTR_SEARCH_LEAF,
pcur, false, 0, &mtr);
+
+ if (err != DB_SUCCESS) {
+ if (err == DB_DECRYPTION_FAILED) {
+ ib_push_warning(trx->mysql_thd,
+ DB_DECRYPTION_FAILED,
+ "Table %s is encrypted but encryption service or"
+ " used key_id is not available. "
+ " Can't continue reading table.",
+ prebuilt->table->name);
+ index->table->is_encrypted = true;
+ }
+ rec = NULL;
+ goto lock_wait_or_error;
+ }
}
rec_loop:
@@ -4196,6 +4219,12 @@ rec_loop:
/* PHASE 4: Look for matching records in a loop */
rec = btr_pcur_get_rec(pcur);
+
+ if (!rec) {
+ err = DB_DECRYPTION_FAILED;
+ goto lock_wait_or_error;
+ }
+
ut_ad(!!page_rec_is_comp(rec) == comp);
#ifdef UNIV_SEARCH_DEBUG
/*
@@ -5113,7 +5142,9 @@ lock_wait_or_error:
/*-------------------------------------------------------------*/
- btr_pcur_store_position(pcur, &mtr);
+ if (rec) {
+ btr_pcur_store_position(pcur, &mtr);
+ }
lock_table_wait:
mtr_commit(&mtr);
diff --git a/storage/innobase/srv/srv0mon.cc b/storage/innobase/srv/srv0mon.cc
index 0bcc876f591..d8254c2b8ed 100644
--- a/storage/innobase/srv/srv0mon.cc
+++ b/storage/innobase/srv/srv0mon.cc
@@ -1196,6 +1196,16 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_NONE,
MONITOR_DEFAULT_START, MONITOR_SRV_DICT_LRU_MICROSECOND},
+ {"innodb_dict_lru_count_active", "server",
+ "Number of tables evicted from DICT LRU list in the active loop",
+ MONITOR_NONE,
+ MONITOR_DEFAULT_START, MONITOR_SRV_DICT_LRU_EVICT_COUNT_ACTIVE},
+
+ {"innodb_dict_lru_count_idle", "server",
+ "Number of tables evicted from DICT LRU list in the idle loop",
+ MONITOR_NONE,
+ MONITOR_DEFAULT_START, MONITOR_SRV_DICT_LRU_EVICT_COUNT_IDLE},
+
{"innodb_checkpoint_usec", "server",
"Time (in microseconds) spent by master thread to do checkpoint",
MONITOR_NONE,
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index 17470855fc4..9dd062f3d37 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -544,6 +544,9 @@ current_time % 5 != 0. */
/** Simulate compression failures. */
UNIV_INTERN uint srv_simulate_comp_failures = 0;
+/** Buffer pool dump status frequence in percentages */
+UNIV_INTERN ulong srv_buf_dump_status_frequency = 0;
+
/** Acquire the system_mutex. */
#define srv_sys_mutex_enter() do { \
mutex_enter(&srv_sys->mutex); \
@@ -2271,6 +2274,7 @@ srv_master_do_active_tasks(void)
{
ib_time_t cur_time = ut_time();
ullint counter_time = ut_time_us(NULL);
+ ulint n_evicted = 0;
/* First do the tasks that we are suppose to do at each
invocation of this function. */
@@ -2331,7 +2335,9 @@ srv_master_do_active_tasks(void)
if (cur_time % SRV_MASTER_DICT_LRU_INTERVAL == 0) {
srv_main_thread_op_info = "enforcing dict cache limit";
- srv_master_evict_from_table_cache(50);
+ n_evicted = srv_master_evict_from_table_cache(50);
+ MONITOR_INC_VALUE(
+ MONITOR_SRV_DICT_LRU_EVICT_COUNT_ACTIVE, n_evicted);
MONITOR_INC_TIME_IN_MICRO_SECS(
MONITOR_SRV_DICT_LRU_MICROSECOND, counter_time);
}
@@ -2363,6 +2369,7 @@ srv_master_do_idle_tasks(void)
/*==========================*/
{
ullint counter_time;
+ ulint n_evicted = 0;
++srv_main_idle_loops;
@@ -2400,7 +2407,9 @@ srv_master_do_idle_tasks(void)
}
srv_main_thread_op_info = "enforcing dict cache limit";
- srv_master_evict_from_table_cache(100);
+ n_evicted = srv_master_evict_from_table_cache(100);
+ MONITOR_INC_VALUE(
+ MONITOR_SRV_DICT_LRU_EVICT_COUNT_IDLE, n_evicted);
MONITOR_INC_TIME_IN_MICRO_SECS(
MONITOR_SRV_DICT_LRU_MICROSECOND, counter_time);
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index be98ece404c..7d5405ec02f 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2015, MariaDB Corporation
@@ -71,6 +71,8 @@ Created 2/16/1996 Heikki Tuuri
#include "srv0srv.h"
#include "btr0defragment.h"
+#include <mysql/service_wsrep.h>
+
#ifndef UNIV_HOTBACKUP
# include "trx0rseg.h"
# include "os0proc.h"
@@ -244,8 +246,8 @@ srv_file_check_mode(
/* Note: stat.rw_perm is only valid of files */
- if (stat.type == OS_FILE_TYPE_FILE
- || stat.type == OS_FILE_TYPE_BLOCK) {
+ if (stat.type == OS_FILE_TYPE_FILE) {
+
if (!stat.rw_perm) {
ib_logf(IB_LOG_LEVEL_ERROR,
@@ -442,14 +444,16 @@ srv_parse_data_file_paths_and_sizes(
&& *(str + 1) == 'e'
&& *(str + 2) == 'w') {
str += 3;
+ /* Initialize new raw device only during bootstrap */
(srv_data_file_is_raw_partition)[i] = SRV_NEW_RAW;
}
if (*str == 'r' && *(str + 1) == 'a' && *(str + 2) == 'w') {
str += 3;
+ /* Initialize new raw device only during bootstrap */
if ((srv_data_file_is_raw_partition)[i] == 0) {
- (srv_data_file_is_raw_partition)[i] = SRV_OLD_RAW;
+ (srv_data_file_is_raw_partition)[i] = SRV_NEW_RAW;
}
}
@@ -905,6 +909,24 @@ open_or_create_data_files(
return(DB_ERROR);
}
+
+ const char* check_msg;
+ check_msg = fil_read_first_page(
+ files[i], FALSE, &flags, &space,
+#ifdef UNIV_LOG_ARCHIVE
+ min_arch_log_no, max_arch_log_no,
+#endif /* UNIV_LOG_ARCHIVE */
+ min_flushed_lsn, max_flushed_lsn, NULL);
+
+ /* If first page is valid, don't overwrite DB.
+ It prevents overwriting DB when mysql_install_db
+ starts mysqld multiple times during bootstrap. */
+ if (check_msg == NULL) {
+
+ srv_created_new_raw = FALSE;
+ ret = FALSE;
+ }
+
} else if (srv_data_file_is_raw_partition[i] == SRV_OLD_RAW) {
srv_start_raw_disk_in_use = TRUE;
@@ -1025,8 +1047,7 @@ check_first_page:
#ifdef UNIV_LOG_ARCHIVE
min_arch_log_no, max_arch_log_no,
#endif /* UNIV_LOG_ARCHIVE */
- min_flushed_lsn, max_flushed_lsn,
- ULINT_UNDEFINED, &crypt_data);
+ min_flushed_lsn, max_flushed_lsn, &crypt_data);
if (check_msg) {
@@ -2924,9 +2945,24 @@ files_checked:
}
if (!srv_read_only_mode) {
+#ifdef WITH_WSREP
+ /*
+ Create the dump/load thread only when not running with
+ --wsrep-recover.
+ */
+ if (!wsrep_recovery) {
+#endif /* WITH_WSREP */
/* Create the buffer pool dump/load thread */
- buf_dump_thread_handle = os_thread_create(buf_dump_thread, NULL, NULL);
+ buf_dump_thread_handle=
+ os_thread_create(buf_dump_thread, NULL, NULL);
buf_dump_thread_started = true;
+#ifdef WITH_WSREP
+ } else {
+ ib_logf(IB_LOG_LEVEL_WARN,
+ "Skipping buffer pool dump/restore during "
+ "wsrep recovery.");
+ }
+#endif /* WITH_WSREP */
/* Create the dict stats gathering thread */
dict_stats_thread_handle = os_thread_create(dict_stats_thread, NULL, NULL);
@@ -3168,9 +3204,9 @@ innobase_shutdown_for_mysql(void)
ibuf_close();
log_shutdown();
- lock_sys_close();
trx_sys_file_format_close();
trx_sys_close();
+ lock_sys_close();
/* We don't create these mutexes in RO mode because we don't create
the temp files that the cover. */
diff --git a/storage/innobase/sync/sync0arr.cc b/storage/innobase/sync/sync0arr.cc
index aa0cdfee4c0..d464515a228 100644
--- a/storage/innobase/sync/sync0arr.cc
+++ b/storage/innobase/sync/sync0arr.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2013, 2015, MariaDB Corporation. All Rights Reserved.
@@ -1119,8 +1119,8 @@ sync_array_print_info_low(
os_thread_id_t r = 0;
fprintf(file,
- "OS WAIT ARRAY INFO: reservation count %ld\n",
- (long) arr->res_count);
+ "OS WAIT ARRAY INFO: reservation count " ULINTPF "\n",
+ arr->res_count);
for (i = 0; count < arr->n_reserved; ++i) {
sync_cell_t* cell;
@@ -1215,7 +1215,7 @@ sync_array_print(
}
fprintf(file,
- "OS WAIT ARRAY INFO: signal count %ld\n", (long) sg_count);
+ "OS WAIT ARRAY INFO: signal count " ULINTPF "\n", sg_count);
}
diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc
index 2c31af9442c..81df8062c54 100644
--- a/storage/innobase/trx/trx0sys.cc
+++ b/storage/innobase/trx/trx0sys.cc
@@ -1319,8 +1319,6 @@ trx_sys_close(void)
/* Free the double write data structures. */
buf_dblwr_free();
- mutex_enter(&trx_sys->mutex);
-
ut_a(UT_LIST_GET_LEN(trx_sys->ro_trx_list) == 0);
/* Only prepared transactions may be left in the system. Free them. */
@@ -1360,8 +1358,6 @@ trx_sys_close(void)
ut_a(UT_LIST_GET_LEN(trx_sys->rw_trx_list) == 0);
ut_a(UT_LIST_GET_LEN(trx_sys->mysql_trx_list) == 0);
- mutex_exit(&trx_sys->mutex);
-
mutex_free(&trx_sys->mutex);
mem_free(trx_sys);
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index 5410bb98190..7f3cfa22255 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -312,11 +312,10 @@ trx_free_prepared(
/*==============*/
trx_t* trx) /*!< in, own: trx object */
{
- ut_ad(mutex_own(&trx_sys->mutex));
-
ut_a(trx_state_eq(trx, TRX_STATE_PREPARED));
ut_a(trx->magic_n == TRX_MAGIC_N);
+ lock_trx_release_locks(trx);
trx_undo_free_prepared(trx);
assert_trx_in_rw_list(trx);
diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc
index 68446cc85ef..e7a22c15d16 100644
--- a/storage/innobase/ut/ut0ut.cc
+++ b/storage/innobase/ut/ut0ut.cc
@@ -824,6 +824,8 @@ ut_strerr(
return("Too many words in a FTS phrase or proximity search");
case DB_TOO_BIG_FOR_REDO:
return("BLOB record length is greater than 10%% of redo log");
+ case DB_DECRYPTION_FAILED:
+ return("Table is encrypted but decrypt failed.");
/* do not add default: in order to produce a warning if new code
is added to the enum but not added here */
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index fba0beda802..7043a2cb7ca 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -1597,7 +1597,7 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize)
param->db_name= table->s->db.str;
param->table_name= table->alias.c_ptr();
- param->tmpfile_createflag= O_RDWR | O_TRUNC | O_EXCL;
+ param->tmpfile_createflag= O_RDWR | O_TRUNC;
param->using_global_keycache= 1;
param->thd= thd;
param->tmpdir= &mysql_tmpdir_list;
@@ -1614,7 +1614,7 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize)
locking= 1;
if (maria_lock_database(file, table->s->tmp_table ? F_EXTRA_LCK : F_WRLCK))
{
- _ma_check_print_error(param, ER(ER_CANT_LOCK), my_errno);
+ _ma_check_print_error(param, ER_THD(thd, ER_CANT_LOCK), my_errno);
DBUG_RETURN(HA_ADMIN_FAILED);
}
}
@@ -1688,7 +1688,7 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize)
thd_proc_info(thd, "Sorting index");
error= maria_sort_index(param, file, fixed_name);
}
- if (!statistics_done && (local_testflag & T_STATISTICS))
+ if (!error && !statistics_done && (local_testflag & T_STATISTICS))
{
if (share->state.changed & STATE_NOT_ANALYZED)
{
diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c
index bf66424e539..2f2558d22c0 100644
--- a/storage/maria/ma_blockrec.c
+++ b/storage/maria/ma_blockrec.c
@@ -1208,7 +1208,6 @@ static my_bool extend_directory(MARIA_HA *info, uchar *buff, uint block_size,
{
uint length, first_pos;
uchar *dir, *first_dir;
- MARIA_SHARE *share= info->s;
DBUG_ENTER("extend_directory");
/*
@@ -1254,10 +1253,10 @@ static my_bool extend_directory(MARIA_HA *info, uchar *buff, uint block_size,
}
}
- check_directory(share,
+ check_directory(info->s,
buff, block_size,
- head_page ? MY_MIN(share->base.min_block_length, length) : 0,
- *empty_space);
+ head_page ? MY_MIN(info->s->base.min_block_length, length) :
+ 0, *empty_space);
DBUG_RETURN(0);
}
@@ -5188,8 +5187,7 @@ my_bool _ma_cmp_block_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
Don't allocate more than 16K on the stack to ensure we don't get
stack overflow.
*/
- if (!(old_record= my_safe_alloca(info->s->base.reclength,
- MARIA_MAX_RECORD_ON_STACK)))
+ if (!(old_record= my_safe_alloca(info->s->base.reclength)))
DBUG_RETURN(1);
/* Don't let the compare destroy blobs that may be in use */
@@ -5211,8 +5209,7 @@ my_bool _ma_cmp_block_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
info->rec_buff_size= org_rec_buff_size;
}
DBUG_PRINT("exit", ("result: %d", error));
- my_safe_afree(old_record, info->s->base.reclength,
- MARIA_MAX_RECORD_ON_STACK);
+ my_safe_afree(old_record, info->s->base.reclength);
DBUG_RETURN(error != 0);
}
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index 506ce2307a3..c031c7f2500 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -3117,10 +3117,8 @@ int maria_sort_index(HA_CHECK *param, register MARIA_HA *info, char *name)
for (key= 0,keyinfo= &share->keyinfo[0]; key < share->base.keys ;
key++,keyinfo++)
{
- if (! maria_is_key_active(share->state.key_map, key))
- continue;
-
- if (share->state.key_root[key] != HA_OFFSET_ERROR)
+ if (maria_is_key_active(share->state.key_map, key) &&
+ share->state.key_root[key] != HA_OFFSET_ERROR)
{
index_pos[key]=param->new_file_pos; /* Write first block here */
if (sort_one_index(param,info,keyinfo,share->state.key_root[key],
diff --git a/storage/maria/ma_check_standalone.h b/storage/maria/ma_check_standalone.h
index c240ca056e7..6626a62c4ef 100644
--- a/storage/maria/ma_check_standalone.h
+++ b/storage/maria/ma_check_standalone.h
@@ -30,7 +30,7 @@ static unsigned int no_key()
struct encryption_service_st encryption_handler=
{
- no_key, 0, 0, 0, 0, 0
+ no_key, 0, 0, 0, 0, 0, 0
};
int encryption_scheme_encrypt(const unsigned char* src __attribute__((unused)),
diff --git a/storage/maria/ma_crypt.c b/storage/maria/ma_crypt.c
index 5e0e8190a52..55fa8430d22 100644
--- a/storage/maria/ma_crypt.c
+++ b/storage/maria/ma_crypt.c
@@ -421,6 +421,10 @@ static my_bool ma_crypt_index_pre_write_hook(PAGECACHE_IO_HOOK_ARGS *args)
memcpy(dst + block_size - tail, src + block_size - tail, tail);
/* 4 - store key version */
_ma_store_key_version(share, dst, key_version);
+#ifdef HAVE_valgrind
+ /* 5 - keep valgrind happy by zeroing not used bytes */
+ bzero(dst+head+size, block_size - size - tail - head);
+#endif
}
/* swap pointers to instead write out the encrypted block */
diff --git a/storage/maria/ma_dynrec.c b/storage/maria/ma_dynrec.c
index eb6352b7a87..2e17a95f390 100644
--- a/storage/maria/ma_dynrec.c
+++ b/storage/maria/ma_dynrec.c
@@ -250,8 +250,7 @@ my_bool _ma_write_blob_record(MARIA_HA *info, const uchar *record)
MARIA_DYN_DELETE_BLOCK_HEADER+1);
reclength= (info->s->base.pack_reclength +
_ma_calc_total_blob_length(info,record)+ extra);
- if (!(rec_buff=(uchar*) my_safe_alloca(reclength,
- MARIA_MAX_RECORD_ON_STACK)))
+ if (!(rec_buff=(uchar*) my_safe_alloca(reclength)))
{
my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */
return(1);
@@ -265,7 +264,7 @@ my_bool _ma_write_blob_record(MARIA_HA *info, const uchar *record)
error= write_dynamic_record(info,
rec_buff+ALIGN_SIZE(MARIA_MAX_DYN_BLOCK_HEADER),
reclength2);
- my_safe_afree(rec_buff, reclength, MARIA_MAX_RECORD_ON_STACK);
+ my_safe_afree(rec_buff, reclength);
return(error != 0);
}
@@ -289,8 +288,7 @@ my_bool _ma_update_blob_record(MARIA_HA *info, MARIA_RECORD_POS pos,
return 1;
}
#endif
- if (!(rec_buff=(uchar*) my_safe_alloca(reclength,
- MARIA_MAX_RECORD_ON_STACK)))
+ if (!(rec_buff=(uchar*) my_safe_alloca(reclength)))
{
my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */
return(1);
@@ -300,7 +298,7 @@ my_bool _ma_update_blob_record(MARIA_HA *info, MARIA_RECORD_POS pos,
error=update_dynamic_record(info,pos,
rec_buff+ALIGN_SIZE(MARIA_MAX_DYN_BLOCK_HEADER),
reclength);
- my_safe_afree(rec_buff, reclength, MARIA_MAX_RECORD_ON_STACK);
+ my_safe_afree(rec_buff, reclength);
return(error != 0);
}
@@ -1555,8 +1553,7 @@ my_bool _ma_cmp_dynamic_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
my_bool error;
DBUG_ENTER("_ma_cmp_dynamic_unique");
- if (!(old_record= my_safe_alloca(info->s->base.reclength,
- MARIA_MAX_RECORD_ON_STACK)))
+ if (!(old_record= my_safe_alloca(info->s->base.reclength)))
DBUG_RETURN(1);
/* Don't let the compare destroy blobs that may be in use */
@@ -1577,8 +1574,7 @@ my_bool _ma_cmp_dynamic_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
info->rec_buff= old_rec_buff;
info->rec_buff_size= old_rec_buff_size;
}
- my_safe_afree(old_record, info->s->base.reclength,
- MARIA_MAX_RECORD_ON_STACK);
+ my_safe_afree(old_record, info->s->base.reclength);
DBUG_RETURN(error);
}
@@ -1613,8 +1609,7 @@ my_bool _ma_cmp_dynamic_record(register MARIA_HA *info,
{
buffer_length= (info->s->base.pack_reclength +
_ma_calc_total_blob_length(info,record));
- if (!(buffer=(uchar*) my_safe_alloca(buffer_length,
- MARIA_MAX_RECORD_ON_STACK)))
+ if (!(buffer=(uchar*) my_safe_alloca(buffer_length)))
DBUG_RETURN(1);
}
reclength= _ma_rec_pack(info,buffer,record);
@@ -1666,7 +1661,7 @@ my_bool _ma_cmp_dynamic_record(register MARIA_HA *info,
error= 0;
err:
if (buffer != info->rec_buff)
- my_safe_afree(buffer, buffer_length, MARIA_MAX_RECORD_ON_STACK);
+ my_safe_afree(buffer, buffer_length);
DBUG_PRINT("exit", ("result: %d", error));
DBUG_RETURN(error);
}
diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c
index 8315c3136c5..bba99703119 100644
--- a/storage/maria/ma_pagecache.c
+++ b/storage/maria/ma_pagecache.c
@@ -833,17 +833,23 @@ ulong init_pagecache(PAGECACHE *pagecache, size_t use_mem,
Allocate memory for blocks, hash_links and hash entries;
For each block 2 hash links are allocated
*/
- if (my_multi_malloc(MYF(MY_ZEROFILL),
- &pagecache->block_root, blocks * sizeof(PAGECACHE_BLOCK_LINK),
- &pagecache->hash_root,
- sizeof(PAGECACHE_HASH_LINK*) * pagecache->hash_entries,
- &pagecache->hash_link_root,
- hash_links * sizeof(PAGECACHE_HASH_LINK),
- &pagecache->changed_blocks,
- sizeof(PAGECACHE_BLOCK_LINK*) * changed_blocks_hash_size,
- &pagecache->file_blocks,
- sizeof(PAGECACHE_BLOCK_LINK*) * changed_blocks_hash_size,
- NullS))
+ if (my_multi_malloc_large(MYF(MY_ZEROFILL),
+ &pagecache->block_root,
+ (ulonglong) (blocks *
+ sizeof(PAGECACHE_BLOCK_LINK)),
+ &pagecache->hash_root,
+ (ulonglong) (sizeof(PAGECACHE_HASH_LINK*) *
+ pagecache->hash_entries),
+ &pagecache->hash_link_root,
+ (ulonglong) (hash_links *
+ sizeof(PAGECACHE_HASH_LINK)),
+ &pagecache->changed_blocks,
+ (ulonglong) (sizeof(PAGECACHE_BLOCK_LINK*) *
+ changed_blocks_hash_size),
+ &pagecache->file_blocks,
+ (ulonglong) (sizeof(PAGECACHE_BLOCK_LINK*) *
+ changed_blocks_hash_size),
+ NullS))
break;
my_large_free(pagecache->block_mem);
pagecache->block_mem= 0;
diff --git a/storage/maria/maria_pack.c b/storage/maria/maria_pack.c
index 7eca9e14e93..280c5ff8f0a 100644
--- a/storage/maria/maria_pack.c
+++ b/storage/maria/maria_pack.c
@@ -861,7 +861,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
reclength= mrg->file[0]->s->base.reclength;
null_bytes= mrg->file[0]->s->base.null_bytes;
- record=(uchar*) my_safe_alloca(reclength, MARIA_MAX_RECORD_ON_STACK);
+ record=(uchar*) my_safe_alloca(reclength);
end_count=huff_counts+mrg->file[0]->s->base.fields;
record_count=0; glob_crc=0;
max_blob_length=0;
@@ -1145,7 +1145,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
mrg->records=record_count;
mrg->max_blob_length=max_blob_length;
- my_safe_afree(record, reclength, MARIA_MAX_RECORD_ON_STACK);
+ my_safe_afree(record, reclength);
DBUG_RETURN(error != HA_ERR_END_OF_FILE);
}
@@ -2415,8 +2415,7 @@ static int compress_maria_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
DBUG_ENTER("compress_maria_file");
/* Allocate a buffer for the records (excluding blobs). */
- if (!(record=(uchar*) my_safe_alloca(isam_file->s->base.reclength,
- MARIA_MAX_RECORD_ON_STACK)))
+ if (!(record=(uchar*) my_safe_alloca(isam_file->s->base.reclength)))
return -1;
end_count=huff_counts+isam_file->s->base.fields;
@@ -2779,8 +2778,7 @@ static int compress_maria_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
if (verbose >= 2)
printf("wrote %s records.\n", llstr((longlong) record_count, llbuf));
- my_safe_afree(record, isam_file->s->base.reclength,
- MARIA_MAX_RECORD_ON_STACK);
+ my_safe_afree(record, isam_file->s->base.reclength);
mrg->ref_length=max_pack_length;
mrg->min_pack_length=max_record_length ? min_record_length : 0;
mrg->max_pack_length=max_record_length;
diff --git a/storage/mroonga/CMakeLists.txt b/storage/mroonga/CMakeLists.txt
index e5d0abe5dcd..9aa5a4bd990 100644
--- a/storage/mroonga/CMakeLists.txt
+++ b/storage/mroonga/CMakeLists.txt
@@ -39,11 +39,6 @@ if(BIG_ENDIAN)
endif()
endif()
-if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
- message(STATUS "Mroonga is not supported on Solaris")
- return()
-endif()
-
if(MSVC)
if(MSVC_VERSION LESS 1800)
set(MRN_OLD_MSVC_MESSAGE "Mroonga supports only MSVC 2013 or later")
@@ -115,6 +110,8 @@ if(MRN_GROONGA_BUNDLED)
add_subdirectory("${MRN_BUNDLED_GROONGA_RELATIVE_DIR}")
else()
+ set(MRN_GROONGA_EMBED OFF)
+
file(READ ${MRN_SOURCE_DIR}/required_groonga_version REQUIRED_GROONGA_VERSION)
string(STRIP "${REQUIRED_GROONGA_VERSION}" REQUIRED_GROONGA_VERSION)
@@ -135,31 +132,6 @@ include(${MRN_SOURCE_DIR}/build/cmake_modules/ReadFileList.cmake)
set(MRN_C_COMPILE_FLAGS "")
set(MRN_CXX_COMPILE_FLAGS "")
-macro(mrn_check_cflag flag)
- string(REGEX REPLACE "[-=]" "_" temporary_variable_name ${flag})
- string(TOUPPER "${temporary_variable_name}" temporary_variable_name)
- set(temporary_variable_name "CFLAG${temporary_variable_name}")
- check_c_compiler_flag(${flag} ${temporary_variable_name})
- if(${temporary_variable_name})
- set(MRN_C_COMPILE_FLAGS "${MRN_C_COMPILE_FLAGS} ${flag}")
- endif()
-endmacro()
-
-macro(mrn_check_cxxflag flag)
- string(REGEX REPLACE "[-=]" "_" temporary_variable_name ${flag})
- string(TOUPPER "${temporary_variable_name}" temporary_variable_name)
- set(temporary_variable_name "CXXFLAG${temporary_variable_name}")
- check_cxx_compiler_flag(${flag} ${temporary_variable_name})
- if(${temporary_variable_name})
- set(MRN_CXX_COMPILE_FLAGS "${MRN_CXX_COMPILE_FLAGS} ${flag}")
- endif()
-endmacro()
-
-macro(mrn_build_flag flag)
- mrn_check_cflag(${flag})
- mrn_check_cxxflag(${flag})
-endmacro()
-
if(MRN_BUNDLED)
set(MRN_RELATIVE_DIR_PREFIX "${MRN_SOURCE_DIR}/")
else()
@@ -323,8 +295,7 @@ set(MRN_ALL_SOURCES
if(MRN_BUNDLED)
mysql_add_plugin(mroonga
${MRN_ALL_SOURCES}
- STORAGE_ENGINE MODULE_ONLY DISABLED # see MDEV-7246
- RECOMPILE_FOR_EMBEDDED
+ STORAGE_ENGINE MODULE_ONLY
LINK_LIBRARIES ${MRN_LIBRARIES})
else()
add_library(mroonga MODULE ${MRN_ALL_SOURCES})
@@ -334,44 +305,45 @@ else()
option(WITH_DEBUG "Enable debug options" OFF)
if(WITH_DEBUG)
- add_definitions("-DSAFE_MUTEX")
+ set_property(TARGET mroonga APPEND PROPERTY
+ COMPILE_DEFINITIONS "SAFE_MUTEX")
if(CMAKE_COMPILER_IS_GNUCXX)
set(MRN_C_COMPILE_FLAGS "${MRN_C_COMPILE_FLAGS} -g3 -O0")
set(MRN_CXX_COMPILE_FLAGS "${MRN_CXX_COMPILE_FLAGS} -g3 -O0")
endif()
else()
- add_definitions("-DDBUG_OFF")
+ set_property(TARGET mroonga APPEND PROPERTY
+ COMPILE_DEFINITIONS "DBUG_OFF")
endif()
option(WITH_DEBUG_FULL "Enable full debug options" OFF)
if(WITH_DEBUG_FULL)
- add_definitions("-DSAFE_MUTEX" "SAFEMALLOC")
+ set_property(TARGET mroonga APPEND PROPERTY
+ COMPILE_DEFINITIONS "SAFE_MUTEX" "SAFEMALLOC")
endif()
option(DISABLE_FAST_MUTEXES "Force disabling fast mutex" OFF)
if(DISABLE_FAST_MUTEXES)
- add_definitions("-DFORCE_FAST_MUTEX_DISABLED=1")
+ set_property(TARGET mroonga APPEND PROPERTY
+ COMPILE_DEFINITIONS "FORCE_FAST_MUTEX_DISABLED=1")
endif()
option(WITH_FAST_MUTEXES "Enable fast mutex" OFF)
if(WITH_FAST_MUTEXES)
- add_definitions("-DMY_PTHREAD_FASTMUTEX")
+ set_property(TARGET mroonga APPEND PROPERTY
+ COMPILE_DEFINITIONS "MY_PTHREAD_FASTMUTEX")
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
- mrn_build_flag("-Wall")
- mrn_build_flag("-Wextra")
- mrn_build_flag("-Wno-unused-parameter")
- mrn_build_flag("-Wno-strict-aliasing")
- mrn_build_flag("-Wno-deprecated")
- mrn_check_cxxflag("-fno-implicit-templates")
- if(("${MYSQL_VARIANT}" STREQUAL "MariaDB") OR
- ("${MYSQL_VARIANT}" STREQUAL "MySQL" AND
- ${MYSQL_VERSION} VERSION_LESS "5.7.0"))
- mrn_check_cxxflag("-fno-exceptions")
- mrn_check_cxxflag("-fno-rtti")
- endif()
- mrn_check_cxxflag("-felide-constructors")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wall")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wextra")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-parameter")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-strict-aliasing")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-deprecated")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-fno-implicit-templates")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-fno-exceptions")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-fno-rtti")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-felide-constructors")
endif()
set_source_files_properties(${MRN_SOURCES} PROPERTIES
COMPILE_FLAGS "${MYSQL_CFLAGS} ${MRN_CXX_COMPILE_FLAGS}")
@@ -381,7 +353,8 @@ else()
COMPILE_FLAGS "${MRN_CXX_COMPILE_FLAGS}")
set_source_files_properties(${LIBMRN_NO_MYSQL_SOURCES} PROPERTIES
COMPILE_FLAGS "${MRN_CXX_COMPILE_FLAGS}")
- add_definitions("-DMYSQL_DYNAMIC_PLUGIN")
+ set_property(TARGET mroonga APPEND PROPERTY
+ COMPILE_DEFINITIONS "MYSQL_DYNAMIC_PLUGIN")
set_target_properties(mroonga PROPERTIES
PREFIX ""
OUTPUT_NAME "ha_mroonga")
@@ -392,14 +365,28 @@ endif()
if(GROONGA_NORMALIZER_MYSQL_FOUND)
add_definitions("-DWITH_GROONGA_NORMALIZER_MYSQL=1")
if(MRN_GROONGA_NORMALIZER_MYSQL_EMBED)
- add_definitions("-DMRN_GROONGA_NORMALIZER_MYSQL_EMBED")
+ add_definitions("-DMRN_GROONGA_NORMALIZER_MYSQL_EMBEDDED")
else()
- add_definitions("-DGROONGA_NORMALIZER_MYSQL_PLUGIN_NAME=\"normalizers/mysql\"")
+ set_property(TARGET mroonga APPEND PROPERTY
+ COMPILE_DEFINITIONS "GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME=\"normalizers/mysql\"")
endif()
endif()
-set(MRN_DEFAULT_PARSER "TokenBigram" CACHE STRING "The default fulltext parser")
-add_definitions("-DMRN_PARSER_DEFAULT=\"${MRN_DEFAULT_PARSER}\"")
+if(MRN_GROONGA_EMBED)
+ add_definitions("-DMRN_GROONGA_EMBEDDED")
+endif()
+
+set(MRN_DEFAULT_PARSER "" CACHE STRING
+ "The default fulltext parser (Deprecated. Use MRN_DEFAULT_TOKENIZER instead.)")
+set(MRN_DEFAULT_TOKENIZER "" CACHE STRING
+ "The default tokenizer for fulltext index")
+if(NOT ${MRN_DEFAULT_TOKENIZER} STREQUAL "")
+ set_property(TARGET mroonga APPEND PROPERTY
+ COMPILE_DEFINITIONS "MRN_DEFAULT_TOKENIZER=\"${MRN_DEFAULT_TOKENIZER}\"")
+elseif(NOT ${MRN_DEFAULT_PARSER} STREQUAL "")
+ set_property(TARGET mroonga APPEND PROPERTY
+ COMPILE_DEFINITIONS "MRN_DEFAULT_TOKENIZER=\"${MRN_DEFAULT_PARSER}\"")
+endif()
configure_file(
"${PROJECT_SOURCE_DIR}/mrn_version.h.in"
diff --git a/storage/mroonga/appveyor.yml b/storage/mroonga/appveyor.yml
index de368b85660..038d590054e 100644
--- a/storage/mroonga/appveyor.yml
+++ b/storage/mroonga/appveyor.yml
@@ -3,16 +3,16 @@ clone_depth: 10
install:
- cd ..
- choco install -y curl 7zip.commandline
- - curl -O http://mirror.jmu.edu/pub/mariadb/mariadb-10.0.17/source/mariadb-10.0.17.tar.gz
- - 7z x mariadb-10.0.17.tar.gz
- - 7z x mariadb-10.0.17.tar > nul
- - cd mariadb-10.0.17
+ - curl -O http://mirror.jmu.edu/pub/mariadb/mariadb-10.0.20/source/mariadb-10.0.20.tar.gz
+ - 7z x mariadb-10.0.20.tar.gz
+ - 7z x mariadb-10.0.20.tar > nul
+ - cd mariadb-10.0.20
- rmdir /S /Q storage\mroonga\
- move ..\mroonga storage\mroonga
- git clone --quiet --depth 1 https://github.com/groonga/groonga.git ..\groonga
- cd ..\groonga
- git submodule update --init
- - cd ..\mariadb-10.0.17
+ - cd ..\mariadb-10.0.20
- rmdir /S /Q ..\groonga\test\
- mkdir storage\mroonga\vendor
- move ..\groonga storage\mroonga\vendor\groonga
diff --git a/storage/mroonga/build/makefiles/gettext.am b/storage/mroonga/build/makefiles/gettext.am
index 9706b485dd1..9cea8ce63c1 100644
--- a/storage/mroonga/build/makefiles/gettext.am
+++ b/storage/mroonga/build/makefiles/gettext.am
@@ -1,6 +1,8 @@
include $(top_srcdir)/doc/files.am
include $(top_srcdir)/build/makefiles/sphinx-build.am
+CLEANFILES =
+
EXTRA_DIST += \
$(po_files)
@@ -11,9 +13,11 @@ endif
if DOCUMENT_BUILDABLE
BUILT_SOURCES += \
+ mo-build-stamp
+CLEANFILES += \
pot-build-stamp \
edit-po-build-stamp \
- $(mo_files)
+ mo-build-stamp
endif
SUFFIXES += .pot .po .mo .edit
@@ -47,8 +51,8 @@ SUFFIXES += .pot .po .mo .edit
msgfmt -o $@ $<
if DOCUMENT_BUILDABLE
-update: pot-build-stamp edit-po-build-stamp
-build: update $(mo_files)
+update: edit-po-build-stamp
+build: mo-build-stamp
else
update:
build:
@@ -68,6 +72,15 @@ pot-build-stamp: $(absolute_source_files)
$(MAKE) gettext
@touch $@
-edit-po-build-stamp: $(absolute_source_files)
+edit-po-build-stamp: pot-build-stamp
$(MAKE) $(edit_po_files)
@touch $@
+
+mo_build_stamp_dependencies = edit-po-build-stamp
+if DOCUMENT_BUILDABLE
+mo_build_stamp_dependencies += $(edit_po_files)
+endif
+
+mo-build-stamp: $(mo_build_stamp_dependencies)
+ $(MAKE) $(mo_files)
+ @touch $@
diff --git a/storage/mroonga/build/makefiles/sphinx.am b/storage/mroonga/build/makefiles/sphinx.am
index f84fb23b739..c68f62e26ec 100644
--- a/storage/mroonga/build/makefiles/sphinx.am
+++ b/storage/mroonga/build/makefiles/sphinx.am
@@ -106,7 +106,7 @@ help:
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
man: man-build-stamp
-html: html-build-stamp
+html: html-recursive html-build-stamp
dirhtml: dirhtml-build-stamp
pickle: pickle-build-stamp
json: json-build-stamp
diff --git a/storage/mroonga/configure.ac b/storage/mroonga/configure.ac
index dc127c17838..f60b481e0ea 100644
--- a/storage/mroonga/configure.ac
+++ b/storage/mroonga/configure.ac
@@ -309,20 +309,30 @@ CONFIG_OPTION_GROONGA_NORMALIZER_MYSQL
AC_ARG_WITH(default_parser,
[AS_HELP_STRING([--with-default-parser=PARSER],
- [specify the default fulltext parser like
+ [Deprecated. Use --with-default-tokenizer=TOKENIZER instead.
+ specify the default fulltext parser like
--with-default-parser=TokenMecab.
(default: TokenBigram)])],
[default_parser=$withval],
[default_parser=no])
if test x"$default_parser" != x"no"; then
- AC_DEFINE_UNQUOTED(MRN_PARSER_DEFAULT,
+ AC_DEFINE_UNQUOTED(MRN_TOKENIZER_DEFAULT,
"$default_parser",
- "specified default fulltext parser")
- MRN_DEFAULT_PARSER=$default_parser
-else
- MRN_DEFAULT_PARSER=TokenBigram
+ "specified the default tokenizer for fulltext index")
+fi
+
+AC_ARG_WITH(default_tokenizer,
+ [AS_HELP_STRING([--with-default-tokenizer=TOKENIZER],
+ [specify the default tokenizer for fulltext index like
+ --with-default-tokenizer=TokenMecab.
+ (default: TokenBigram)])],
+ [default_tokenizer=$withval],
+ [default_tokenizer=no])
+if test x"$default_tokenizer" != x"no"; then
+ AC_DEFINE_UNQUOTED(MRN_DEFAULT_TOKENIZER,
+ "$default_tokenizer",
+ "specified the default tokenizer for fulltext index")
fi
-AC_SUBST(MRN_DEFAULT_PARSER)
AC_ARG_ENABLE(fast_mutexes,
[AS_HELP_STRING([--disable-fast-mutexes],
diff --git a/storage/mroonga/ha_mroonga.cpp b/storage/mroonga/ha_mroonga.cpp
index 83f03fcb272..a94278e19c2 100644
--- a/storage/mroonga/ha_mroonga.cpp
+++ b/storage/mroonga/ha_mroonga.cpp
@@ -27,14 +27,11 @@
#pragma implementation
#endif
-#if MYSQL_VERSION_ID >= 50500
-# include <sql_plugin.h>
-# include <sql_show.h>
-# include <key.h>
-# include <tztime.h>
-# include <sql_base.h>
-#endif
-
+#include <sql_plugin.h>
+#include <sql_show.h>
+#include <key.h>
+#include <tztime.h>
+#include <sql_base.h>
#include <sql_select.h>
#include <item_sum.h>
@@ -102,6 +99,10 @@
# include <sql_table.h>
#endif
+#ifdef MRN_SUPPORT_CUSTOM_OPTIONS
+# include <create_options.h>
+#endif
+
// for debug
#define MRN_CLASS_NAME "ha_mroonga"
@@ -110,7 +111,11 @@
#define MRN_LONG_TEXT_SIZE (1 << 31) // 2Gbytes
#ifdef MRN_HAVE_TDC_LOCK_TABLE_SHARE
-# define mrn_open_mutex(share) &((share)->tdc.LOCK_table_share)
+# ifdef MRN_TABLE_SHARE_TDC_IS_POINTER
+# define mrn_open_mutex(share) &((share)->tdc->LOCK_table_share)
+# else
+# define mrn_open_mutex(share) &((share)->tdc.LOCK_table_share)
+# endif
# define mrn_open_mutex_lock(share) do { \
TABLE_SHARE *share_ = share; \
if (share_ && share_->tmp_table == NO_TMP_TABLE) { \
@@ -156,24 +161,10 @@ static mysql_mutex_t *mrn_LOCK_open;
# define mrn_declare_plugin(NAME) maria_declare_plugin(NAME)
# define mrn_declare_plugin_end maria_declare_plugin_end
# define MRN_PLUGIN_LAST_VALUES MRN_VERSION, MariaDB_PLUGIN_MATURITY_STABLE
-# if MYSQL_VERSION_ID >= 100000
-# define MRN_ABORT_ON_WARNING(thd) thd_kill_level(thd)
-# else
-# define MRN_ABORT_ON_WARNING(thd) thd->abort_on_warning
-# endif
#else
# define mrn_declare_plugin(NAME) mysql_declare_plugin(NAME)
# define mrn_declare_plugin_end mysql_declare_plugin_end
-# ifdef MRN_PLUGIN_HAVE_FLAGS
-# define MRN_PLUGIN_LAST_VALUES NULL, 0
-# else
-# define MRN_PLUGIN_LAST_VALUES NULL
-# endif
-# if MYSQL_VERSION_ID >= 50706
-# define MRN_ABORT_ON_WARNING(thd) false
-# else
-# define MRN_ABORT_ON_WARNING(thd) thd->abort_on_warning
-# endif
+# define MRN_PLUGIN_LAST_VALUES NULL, 0
#endif
#if MYSQL_VERSION_ID >= 100007 && defined(MRN_MARIADB_P)
@@ -267,9 +258,7 @@ uint grn_atoui(const char *nptr, const char *end, const char **rest);
# ifdef MRN_TABLE_SHARE_HAVE_LOCK_SHARE
PSI_mutex_key *mrn_table_share_lock_share;
# endif
-# ifdef MRN_TABLE_SHARE_HAVE_LOCK_HA_DATA
PSI_mutex_key *mrn_table_share_lock_ha_data;
-# endif
# endif
static PSI_mutex_key mrn_open_tables_mutex_key;
static PSI_mutex_key mrn_long_term_share_mutex_key;
@@ -357,11 +346,6 @@ static const char *mrn_inspect_thr_lock_type(enum thr_lock_type lock_type)
case TL_WRITE_ALLOW_WRITE:
inspected = "TL_WRITE_ALLOW_WRITE";
break;
-#ifdef MRN_HAVE_TL_WRITE_ALLOW_READ
- case TL_WRITE_ALLOW_READ:
- inspected = "TL_WRITE_ALLOW_READ";
- break;
-#endif
#ifdef MRN_HAVE_TL_WRITE_CONCURRENT_DEFAULT
case TL_WRITE_CONCURRENT_DEFAULT:
inspected = "TL_WRITE_CONCURRENT_DEFAULT";
@@ -524,19 +508,15 @@ static const char *mrn_inspect_extra_function(enum ha_extra_function operation)
case HA_EXTRA_PREPARE_FOR_RENAME:
inspected = "HA_EXTRA_PREPARE_FOR_RENAME";
break;
-#ifdef MRN_HAVE_HA_EXTRA_ADD_CHILDREN_LIST
case HA_EXTRA_ADD_CHILDREN_LIST:
inspected = "HA_EXTRA_ADD_CHILDREN_LIST";
break;
-#endif
case HA_EXTRA_ATTACH_CHILDREN:
inspected = "HA_EXTRA_ATTACH_CHILDREN";
break;
-#ifdef MRN_HAVE_HA_EXTRA_IS_ATTACHED_CHILDREN
case HA_EXTRA_IS_ATTACHED_CHILDREN:
inspected = "HA_EXTRA_IS_ATTACHED_CHILDREN";
break;
-#endif
case HA_EXTRA_DETACH_CHILDREN:
inspected = "HA_EXTRA_DETACH_CHILDREN";
break;
@@ -597,7 +577,7 @@ static bool mrn_log_file_opened = false;
static grn_log_level mrn_log_level_default = GRN_LOG_DEFAULT_LEVEL;
static ulong mrn_log_level = mrn_log_level_default;
-char *mrn_default_parser = NULL;
+char *mrn_default_tokenizer = NULL;
char *mrn_default_wrapper_engine = NULL;
static int mrn_lock_timeout = grn_get_lock_timeout();
static char *mrn_libgroonga_version = const_cast<char *>(grn_get_version());
@@ -630,6 +610,11 @@ static TYPELIB mrn_boolean_mode_syntax_flags_typelib = {
NULL
};
#endif
+#ifdef MRN_GROONGA_EMBEDDED
+static my_bool mrn_libgroonga_embedded = TRUE;
+#else
+static my_bool mrn_libgroonga_embedded = FALSE;
+#endif
typedef enum {
MRN_ACTION_ON_ERROR_ERROR,
@@ -836,8 +821,8 @@ static MYSQL_SYSVAR_STR(log_file, mrn_log_file_path,
mrn_log_file_update,
MRN_LOG_FILE_PATH);
-static void mrn_default_parser_update(THD *thd, struct st_mysql_sys_var *var,
- void *var_ptr, const void *save)
+static void mrn_default_tokenizer_update(THD *thd, struct st_mysql_sys_var *var,
+ void *var_ptr, const void *save)
{
MRN_DBUG_ENTER_FUNCTION();
const char *new_value = *((const char **)save);
@@ -848,12 +833,12 @@ static void mrn_default_parser_update(THD *thd, struct st_mysql_sys_var *var,
mrn_change_encoding(&ctx, system_charset_info);
if (strcmp(*old_value_ptr, new_value) == 0) {
GRN_LOG(&ctx, GRN_LOG_NOTICE,
- "default parser isn't changed "
- "because the requested default parser isn't different: <%s>",
+ "default tokenizer for fulltext index isn't changed "
+ "because the requested default tokenizer isn't different: <%s>",
new_value);
} else {
GRN_LOG(&ctx, GRN_LOG_NOTICE,
- "default fulltext parser is changed: <%s> -> <%s>",
+ "default tokenizer for fulltext index is changed: <%s> -> <%s>",
*old_value_ptr, new_value);
}
@@ -869,12 +854,20 @@ static void mrn_default_parser_update(THD *thd, struct st_mysql_sys_var *var,
DBUG_VOID_RETURN;
}
-static MYSQL_SYSVAR_STR(default_parser, mrn_default_parser,
+static MYSQL_SYSVAR_STR(default_parser, mrn_default_tokenizer,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC,
- "default fulltext parser",
+ "default fulltext parser "
+ "(Deprecated. Use mroonga_default_tokenizer instead.)",
NULL,
- mrn_default_parser_update,
- MRN_PARSER_DEFAULT);
+ mrn_default_tokenizer_update,
+ MRN_DEFAULT_TOKENIZER);
+
+static MYSQL_SYSVAR_STR(default_tokenizer, mrn_default_tokenizer,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC,
+ "default tokenizer for fulltext index",
+ NULL,
+ mrn_default_tokenizer_update,
+ MRN_DEFAULT_TOKENIZER);
static MYSQL_THDVAR_BOOL(
dry_write, /* name */
@@ -1084,11 +1077,19 @@ static MYSQL_THDVAR_INT(max_n_records_for_estimate,
INT_MAX,
0);
+static MYSQL_SYSVAR_BOOL(libgroonga_embedded, mrn_libgroonga_embedded,
+ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
+ "Whether libgroonga is embedded or not",
+ NULL,
+ NULL,
+ mrn_libgroonga_embedded);
+
static struct st_mysql_sys_var *mrn_system_variables[] =
{
MYSQL_SYSVAR(log_level),
MYSQL_SYSVAR(log_file),
MYSQL_SYSVAR(default_parser),
+ MYSQL_SYSVAR(default_tokenizer),
MYSQL_SYSVAR(dry_write),
MYSQL_SYSVAR(enable_optimization),
MYSQL_SYSVAR(match_escalation_threshold),
@@ -1105,6 +1106,7 @@ static struct st_mysql_sys_var *mrn_system_variables[] =
MYSQL_SYSVAR(boolean_mode_syntax_flags),
#endif
MYSQL_SYSVAR(max_n_records_for_estimate),
+ MYSQL_SYSVAR(libgroonga_embedded),
NULL
};
@@ -1213,7 +1215,7 @@ static int mrn_close_connection(handlerton *hton, THD *thd)
MRN_DBUG_ENTER_FUNCTION();
void *p = *thd_ha_data(thd, mrn_hton_ptr);
if (p) {
- mrn_clear_alter_share(thd);
+ mrn_clear_slot_data(thd);
free(p);
*thd_ha_data(thd, mrn_hton_ptr) = (void *) NULL;
{
@@ -1409,13 +1411,14 @@ static grn_builtin_type mrn_grn_type_from_field(grn_ctx *ctx, Field *field,
return type;
}
-grn_obj_flags mrn_parse_grn_column_create_flags(THD *thd,
- grn_ctx *ctx,
- const char *flag_names,
- uint flag_names_length)
+static bool mrn_parse_grn_column_create_flags(THD *thd,
+ grn_ctx *ctx,
+ const char *flag_names,
+ uint flag_names_length,
+ grn_obj_flags *column_flags)
{
- grn_obj_flags flags = 0;
const char *flag_names_end = flag_names + flag_names_length;
+ bool found = false;
while (flag_names < flag_names_end) {
uint rest_length = flag_names_end - flag_names;
@@ -1425,14 +1428,17 @@ grn_obj_flags mrn_parse_grn_column_create_flags(THD *thd,
continue;
}
if (rest_length >= 13 && !memcmp(flag_names, "COLUMN_SCALAR", 13)) {
- flags |= GRN_OBJ_COLUMN_SCALAR;
+ *column_flags |= GRN_OBJ_COLUMN_SCALAR;
flag_names += 13;
+ found = true;
} else if (rest_length >= 13 && !memcmp(flag_names, "COLUMN_VECTOR", 13)) {
- flags |= GRN_OBJ_COLUMN_VECTOR;
+ *column_flags |= GRN_OBJ_COLUMN_VECTOR;
flag_names += 13;
+ found = true;
} else if (rest_length >= 13 && !memcmp(flag_names, "COMPRESS_ZLIB", 13)) {
if (mrn_libgroonga_support_zlib) {
- flags |= GRN_OBJ_COMPRESS_ZLIB;
+ *column_flags |= GRN_OBJ_COMPRESS_ZLIB;
+ found = true;
} else {
push_warning_printf(thd, MRN_SEVERITY_WARNING,
ER_MRN_UNSUPPORTED_COLUMN_FLAG_NUM,
@@ -1442,7 +1448,8 @@ grn_obj_flags mrn_parse_grn_column_create_flags(THD *thd,
flag_names += 13;
} else if (rest_length >= 12 && !memcmp(flag_names, "COMPRESS_LZ4", 12)) {
if (mrn_libgroonga_support_lz4) {
- flags |= GRN_OBJ_COMPRESS_LZ4;
+ *column_flags |= GRN_OBJ_COMPRESS_LZ4;
+ found = true;
} else {
push_warning_printf(thd, MRN_SEVERITY_WARNING,
ER_MRN_UNSUPPORTED_COLUMN_FLAG_NUM,
@@ -1459,20 +1466,18 @@ grn_obj_flags mrn_parse_grn_column_create_flags(THD *thd,
push_warning_printf(thd, MRN_SEVERITY_WARNING,
ER_MRN_INVALID_COLUMN_FLAG_NUM,
ER_MRN_INVALID_COLUMN_FLAG_STR,
- invalid_flag_name,
- "COLUMN_SCALAR");
- flags |= GRN_OBJ_COLUMN_SCALAR;
+ invalid_flag_name);
break;
}
}
- return flags;
+ return found;
}
-bool mrn_parse_grn_index_column_flags(THD *thd,
- grn_ctx *ctx,
- const char *flag_names,
- uint flag_names_length,
- grn_obj_flags *index_column_flags)
+static bool mrn_parse_grn_index_column_flags(THD *thd,
+ grn_ctx *ctx,
+ const char *flag_names,
+ uint flag_names_length,
+ grn_obj_flags *index_column_flags)
{
const char *flag_names_end = flag_names + flag_names_length;
bool found = false;
@@ -1588,6 +1593,24 @@ static uint mrn_alter_table_flags(uint flags)
}
#endif
+#ifdef MRN_SUPPORT_CUSTOM_OPTIONS
+static ha_create_table_option mrn_field_options[] =
+{
+ HA_FOPTION_STRING("GROONGA_TYPE", groonga_type),
+ HA_FOPTION_STRING("FLAGS", flags),
+ HA_FOPTION_END
+};
+
+static ha_create_table_option mrn_index_options[] =
+{
+ HA_IOPTION_STRING("TOKENIZER", tokenizer),
+ HA_IOPTION_STRING("NORMALIZER", normalizer),
+ HA_IOPTION_STRING("TOKEN_FILTERS", token_filters),
+ HA_IOPTION_STRING("FLAGS", flags),
+ HA_IOPTION_END
+};
+#endif
+
static int mrn_init(void *p)
{
// init handlerton
@@ -1606,6 +1629,10 @@ static int mrn_init(void *p)
#ifdef MRN_HAVE_HTON_ALTER_TABLE_FLAGS
hton->alter_table_flags = mrn_alter_table_flags;
#endif
+#ifdef MRN_SUPPORT_CUSTOM_OPTIONS
+ hton->field_options = mrn_field_options;
+ hton->index_options = mrn_index_options;
+#endif
mrn_hton_ptr = hton;
#ifdef _WIN32
@@ -1629,11 +1656,9 @@ static int mrn_init(void *p)
(PSI_mutex_key *)GetProcAddress(current_module,
MRN_TABLE_SHARE_LOCK_SHARE_PROC);
# endif
-# ifdef MRN_TABLE_SHARE_HAVE_LOCK_HA_DATA
- mrn_table_share_lock_ha_data =
- (PSI_mutex_key *)GetProcAddress(current_module,
- MRN_TABLE_SHARE_LOCK_HA_DATA_PROC);
-# endif
+ mrn_table_share_lock_ha_data =
+ (PSI_mutex_key *)GetProcAddress(current_module,
+ MRN_TABLE_SHARE_LOCK_HA_DATA_PROC);
# endif
#else
mrn_binlog_filter = binlog_filter;
@@ -1790,7 +1815,7 @@ static int mrn_deinit(void *p)
mrn::Lock lock(&mrn_allocated_thds_mutex);
while ((tmp_thd = (THD *) my_hash_element(&mrn_allocated_thds, 0)))
{
- mrn_clear_alter_share(tmp_thd);
+ mrn_clear_slot_data(tmp_thd);
void *slot_ptr = mrn_get_slot_data(tmp_thd, false);
if (slot_ptr) free(slot_ptr);
*thd_ha_data(tmp_thd, mrn_hton_ptr) = (void *) NULL;
@@ -2367,10 +2392,10 @@ const char *ha_mroonga::table_type() const
const char *ha_mroonga::index_type(uint key_nr)
{
MRN_DBUG_ENTER_METHOD();
- KEY key_info = table->s->key_info[key_nr];
- if (key_info.algorithm == HA_KEY_ALG_FULLTEXT) {
+ KEY *key_info = &(table->s->key_info[key_nr]);
+ if (key_info->algorithm == HA_KEY_ALG_FULLTEXT) {
DBUG_RETURN("FULLTEXT");
- } else if (key_info.algorithm == HA_KEY_ALG_HASH) {
+ } else if (key_info->algorithm == HA_KEY_ALG_HASH) {
DBUG_RETURN("HASH");
} else {
DBUG_RETURN("BTREE");
@@ -2655,9 +2680,10 @@ ulonglong ha_mroonga::table_flags() const
ulong ha_mroonga::wrapper_index_flags(uint idx, uint part, bool all_parts) const
{
ulong index_flags;
- KEY key = table_share->key_info[idx];
+ KEY *key = &(table_share->key_info[idx]);
MRN_DBUG_ENTER_METHOD();
- if (key.algorithm == HA_KEY_ALG_BTREE || key.algorithm == HA_KEY_ALG_UNDEF) {
+ if (key->algorithm == HA_KEY_ALG_BTREE ||
+ key->algorithm == HA_KEY_ALG_UNDEF) {
MRN_SET_WRAP_SHARE_KEY(share, table->s);
MRN_SET_WRAP_TABLE_KEY(this, table);
index_flags = wrap_handler->index_flags(idx, part, all_parts);
@@ -2673,18 +2699,27 @@ ulong ha_mroonga::storage_index_flags(uint idx, uint part, bool all_parts) const
{
MRN_DBUG_ENTER_METHOD();
ulong flags;
- KEY key = table_share->key_info[idx];
- if (key.algorithm == HA_KEY_ALG_BTREE || key.algorithm == HA_KEY_ALG_UNDEF) {
+ KEY *key = &(table_share->key_info[idx]);
+ if (key->algorithm == HA_KEY_ALG_BTREE ||
+ key->algorithm == HA_KEY_ALG_UNDEF) {
flags = HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE;
bool need_normalize_p = false;
- Field *field = &key.key_part[part].field[0];
+ // TODO: MariaDB 10.1 passes key->user_defined_key_parts as part
+ // for ORDER BY DESC. We just it fallback to part = 0. We may use
+ // it for optimization in the future.
+ //
+ // See also: test_if_order_by_key() in sql/sql_select.cc.
+ if (KEY_N_KEY_PARTS(key) == part) {
+ part = 0;
+ }
+ Field *field = &(key->key_part[part].field[0]);
if (field && should_normalize(field)) {
need_normalize_p = true;
}
if (!need_normalize_p) {
flags |= HA_KEYREAD_ONLY;
}
- if (KEY_N_KEY_PARTS(&key) > 1 || !need_normalize_p) {
+ if (KEY_N_KEY_PARTS(key) > 1 || !need_normalize_p) {
flags |= HA_READ_ORDER;
}
} else {
@@ -2697,11 +2732,11 @@ ulong ha_mroonga::index_flags(uint idx, uint part, bool all_parts) const
{
MRN_DBUG_ENTER_METHOD();
- KEY key = table_share->key_info[idx];
- if (key.algorithm == HA_KEY_ALG_FULLTEXT) {
+ KEY *key = &(table_share->key_info[idx]);
+ if (key->algorithm == HA_KEY_ALG_FULLTEXT) {
DBUG_RETURN(HA_ONLY_WHOLE_INDEX | HA_KEY_SCAN_NOT_ROR);
}
- if (mrn_is_geo_key(&key)) {
+ if (mrn_is_geo_key(key)) {
DBUG_RETURN(HA_ONLY_WHOLE_INDEX | HA_KEY_SCAN_NOT_ROR);
}
@@ -2833,9 +2868,23 @@ int ha_mroonga::wrapper_create(const char *name, TABLE *table,
share = tmp_share;
MRN_SET_WRAP_SHARE_KEY(tmp_share, table->s);
MRN_SET_WRAP_TABLE_KEY(this, table);
- if (!(hnd =
- tmp_share->hton->create(tmp_share->hton, table->s,
- current_thd->mem_root)))
+#ifdef MRN_SUPPORT_CUSTOM_OPTIONS
+ if (parse_engine_table_options(ha_thd(), tmp_share->hton, table->s)) {
+ MRN_SET_BASE_SHARE_KEY(tmp_share, table->s);
+ MRN_SET_BASE_TABLE_KEY(this, table);
+ share = NULL;
+ if (wrap_key_info)
+ {
+ my_free(wrap_key_info);
+ wrap_key_info = NULL;
+ }
+ base_key_info = NULL;
+ error = MRN_GET_ERROR_NUMBER;
+ DBUG_RETURN(error);
+ }
+#endif
+ hnd = get_new_handler(table->s, current_thd->mem_root, tmp_share->hton);
+ if (!hnd)
{
MRN_SET_BASE_SHARE_KEY(tmp_share, table->s);
MRN_SET_BASE_TABLE_KEY(this, table);
@@ -2848,7 +2897,6 @@ int ha_mroonga::wrapper_create(const char *name, TABLE *table,
base_key_info = NULL;
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
- hnd->init();
error = hnd->ha_create(name, table, info);
MRN_SET_BASE_SHARE_KEY(tmp_share, table->s);
MRN_SET_BASE_TABLE_KEY(this, table);
@@ -2856,7 +2904,7 @@ int ha_mroonga::wrapper_create(const char *name, TABLE *table,
delete hnd;
if (error) {
- wrapper_delete_index(name, tmp_share, mapper.table_name());
+ generic_delete_table(name, mapper.table_name());
}
if (wrap_key_info)
@@ -2949,8 +2997,7 @@ int ha_mroonga::wrapper_create_index_fulltext(const char *grn_table_name,
mrn_change_encoding(ctx, system_charset_info);
index_tables[i] = index_table;
- grn_obj *tokenizer = find_tokenizer(tmp_share->key_parser[i],
- tmp_share->key_parser_length[i]);
+ grn_obj *tokenizer = find_tokenizer(key_info, tmp_share, i);
if (tokenizer) {
grn_info_type info_type = GRN_INFO_DEFAULT_TOKENIZER;
grn_obj_set_info(ctx, index_table, info_type, tokenizer);
@@ -3097,14 +3144,14 @@ int ha_mroonga::wrapper_create_index(const char *name, TABLE *table,
for (i = 0; i < n_keys; i++) {
index_tables[i] = NULL;
- KEY key_info = table->s->key_info[i];
- if (key_info.algorithm == HA_KEY_ALG_FULLTEXT) {
+ KEY *key_info = &(table->s->key_info[i]);
+ if (key_info->algorithm == HA_KEY_ALG_FULLTEXT) {
error = wrapper_create_index_fulltext(grn_table_name,
- i, &key_info,
+ i, key_info,
index_tables, NULL, tmp_share);
- } else if (mrn_is_geo_key(&key_info)) {
+ } else if (mrn_is_geo_key(key_info)) {
error = wrapper_create_index_geo(grn_table_name,
- i, &key_info,
+ i, key_info,
index_tables, NULL, tmp_share);
}
}
@@ -3160,12 +3207,12 @@ int ha_mroonga::storage_create(const char *name, TABLE *table,
grn_obj *pkey_type;
uint pkey_nr = table->s->primary_key;
if (pkey_nr != MAX_INDEXES) {
- KEY key_info = table->s->key_info[pkey_nr];
+ KEY *key_info = &(table->s->key_info[pkey_nr]);
bool is_id;
- int key_parts = KEY_N_KEY_PARTS(&key_info);
+ int key_parts = KEY_N_KEY_PARTS(key_info);
if (key_parts == 1) {
- Field *pkey_field = key_info.key_part[0].field;
+ Field *pkey_field = key_info->key_part[0].field;
const char *column_name = pkey_field->field_name;
is_id = (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0);
@@ -3177,7 +3224,7 @@ int ha_mroonga::storage_create(const char *name, TABLE *table,
}
// default algorithm is BTREE ==> PAT
- if (!is_id && key_info.algorithm == HA_KEY_ALG_HASH) {
+ if (!is_id && key_info->algorithm == HA_KEY_ALG_HASH) {
table_flags |= GRN_OBJ_TABLE_HASH_KEY;
} else if (!is_id) {
table_flags |= GRN_OBJ_TABLE_PAT_KEY;
@@ -3212,8 +3259,8 @@ int ha_mroonga::storage_create(const char *name, TABLE *table,
if (table_flags == (GRN_OBJ_PERSISTENT | GRN_OBJ_TABLE_PAT_KEY) ||
table_flags == (GRN_OBJ_PERSISTENT | GRN_OBJ_TABLE_HASH_KEY)) {
- KEY key_info = table->s->key_info[pkey_nr];
- int key_parts = KEY_N_KEY_PARTS(&key_info);
+ KEY *key_info = &(table->s->key_info[pkey_nr]);
+ int key_parts = KEY_N_KEY_PARTS(key_info);
if (key_parts == 1) {
grn_obj *normalizer = NULL;
if (tmp_share->normalizer) {
@@ -3221,9 +3268,9 @@ int ha_mroonga::storage_create(const char *name, TABLE *table,
tmp_share->normalizer,
tmp_share->normalizer_length);
} else {
- Field *field = &(key_info.key_part->field[0]);
+ Field *field = &(key_info->key_part->field[0]);
if (should_normalize(field)) {
- normalizer = find_normalizer(&key_info);
+ normalizer = find_normalizer(key_info);
}
}
if (normalizer) {
@@ -3259,7 +3306,6 @@ int ha_mroonga::storage_create(const char *name, TABLE *table,
/* create columns */
uint n_columns = table->s->fields;
for (uint i = 0; i < n_columns; i++) {
- grn_obj *col_type;
Field *field = table->s->field[i];
const char *column_name = field->field_name;
int column_name_size = strlen(column_name);
@@ -3280,19 +3326,18 @@ int ha_mroonga::storage_create(const char *name, TABLE *table,
#endif
grn_obj_flags col_flags = GRN_OBJ_PERSISTENT;
- if (tmp_share->col_flags[i]) {
- col_flags |= mrn_parse_grn_column_create_flags(ha_thd(),
- ctx,
- tmp_share->col_flags[i],
- tmp_share->col_flags_length[i]);
- } else {
+ if (!find_column_flags(field, tmp_share, i, &col_flags)) {
col_flags |= GRN_OBJ_COLUMN_SCALAR;
}
- grn_builtin_type gtype = mrn_grn_type_from_field(ctx, field, false);
- if (tmp_share->col_type[i]) {
- col_type = grn_ctx_get(ctx, tmp_share->col_type[i], -1);
- } else {
- col_type = grn_ctx_at(ctx, gtype);
+
+ grn_obj *col_type;
+ {
+ int column_type_error_code = ER_CANT_CREATE_TABLE;
+ col_type = find_column_type(field, tmp_share, i, column_type_error_code);
+ if (!col_type) {
+ grn_obj_remove(ctx, table_obj);
+ DBUG_RETURN(column_type_error_code);
+ }
}
char *col_path = NULL; // we don't specify path
@@ -3445,17 +3490,11 @@ bool ha_mroonga::storage_create_foreign_key(TABLE *table,
DBUG_RETURN(false);
}
-#ifdef MRN_TABLE_LIST_INIT_REQUIRE_ALIAS
table_list.init_one_table(mapper.db_name(),
strlen(mapper.db_name()),
mapper.mysql_table_name(),
strlen(mapper.mysql_table_name()),
mapper.mysql_table_name(), TL_WRITE);
-#else
- table_list.init_one_table(mapper.db_name(),
- mapper.mysql_table_name(),
- TL_WRITE);
-#endif
mrn_open_mutex_lock(table->s);
tmp_ref_table_share =
mrn_create_tmp_table_share(&table_list, ref_path, &error);
@@ -3572,16 +3611,16 @@ int ha_mroonga::storage_create_validate_index(TABLE *table)
/* checking if index is used for virtual columns */
uint n_keys = table->s->keys;
for (i = 0; i < n_keys; i++) {
- KEY key_info = table->s->key_info[i];
+ KEY *key_info = &(table->s->key_info[i]);
// must be single column key
- int key_parts = KEY_N_KEY_PARTS(&key_info);
+ int key_parts = KEY_N_KEY_PARTS(key_info);
if (key_parts != 1) {
continue;
}
- Field *field = key_info.key_part[0].field;
+ Field *field = key_info->key_part[0].field;
const char *column_name = field->field_name;
if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) {
- if (key_info.algorithm == HA_KEY_ALG_HASH) {
+ if (key_info->algorithm == HA_KEY_ALG_HASH) {
continue; // hash index is ok
}
GRN_LOG(ctx, GRN_LOG_ERROR, "only hash index can be defined for _id");
@@ -3660,8 +3699,7 @@ int ha_mroonga::storage_create_index_table(TABLE *table,
}
if (key_info->flags & HA_FULLTEXT) {
- grn_obj *tokenizer = find_tokenizer(tmp_share->key_parser[i],
- tmp_share->key_parser_length[i]);
+ grn_obj *tokenizer = find_tokenizer(key_info, tmp_share, i);
if (tokenizer) {
grn_info_type info_type = GRN_INFO_DEFAULT_TOKENIZER;
grn_obj_set_info(ctx, index_table, info_type, tokenizer);
@@ -3909,6 +3947,8 @@ int ha_mroonga::create(const char *name, TABLE *table, HA_CREATE_INFO *info)
if (error) {
mrn_free_long_term_share(tmp_share->long_term_share);
tmp_share->long_term_share = NULL;
+ } else {
+ error = add_wrap_hton(tmp_share->table_name, tmp_share->hton);
}
mrn_free_share(tmp_share);
DBUG_RETURN(error);
@@ -3956,8 +3996,8 @@ int ha_mroonga::wrapper_open(const char *name, int mode, uint test_if_locked)
MRN_SET_WRAP_TABLE_KEY(this, table);
if (!is_clone)
{
- if (!(wrap_handler =
- share->hton->create(share->hton, table->s, &mem_root)))
+ wrap_handler = get_new_handler(table->s, &mem_root, share->hton);
+ if (!wrap_handler)
{
MRN_SET_BASE_SHARE_KEY(share, table->s);
MRN_SET_BASE_TABLE_KEY(this, table);
@@ -3969,19 +4009,13 @@ int ha_mroonga::wrapper_open(const char *name, int mode, uint test_if_locked)
base_key_info = NULL;
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
- wrap_handler->init();
#ifdef MRN_HANDLER_HAVE_SET_HA_SHARE_REF
wrap_handler->set_ha_share_ref(&table->s->ha_share);
#endif
error = wrap_handler->ha_open(table, name, mode, test_if_locked);
} else {
-#ifdef MRN_HANDLER_CLONE_NEED_NAME
if (!(wrap_handler = parent_for_clone->wrap_handler->clone(name,
mem_root_for_clone)))
-#else
- if (!(wrap_handler = parent_for_clone->wrap_handler->clone(
- mem_root_for_clone)))
-#endif
{
MRN_SET_BASE_SHARE_KEY(share, table->s);
MRN_SET_BASE_TABLE_KEY(this, table);
@@ -4047,12 +4081,12 @@ int ha_mroonga::wrapper_open_indexes(const char *name)
mrn::PathMapper mapper(name);
uint i = 0;
for (i = 0; i < n_keys; i++) {
- KEY key_info = table->s->key_info[i];
+ KEY *key_info = &(table->s->key_info[i]);
grn_index_tables[i] = NULL;
grn_index_columns[i] = NULL;
- if (!(wrapper_is_target_index(&key_info))) {
+ if (!(wrapper_is_target_index(key_info))) {
continue;
}
@@ -4060,7 +4094,7 @@ int ha_mroonga::wrapper_open_indexes(const char *name)
continue;
}
- mrn::IndexTableName index_table_name(mapper.table_name(), key_info.name);
+ mrn::IndexTableName index_table_name(mapper.table_name(), key_info->name);
grn_index_tables[i] = grn_ctx_get(ctx,
index_table_name.c_str(),
index_table_name.length());
@@ -4077,7 +4111,7 @@ int ha_mroonga::wrapper_open_indexes(const char *name)
strlen(INDEX_COLUMN_NAME));
if (!grn_index_columns[i]) {
/* just for backward compatibility before 1.0. */
- Field *field = key_info.key_part[0].field;
+ Field *field = key_info->key_part[0].field;
grn_index_columns[i] = grn_obj_column(ctx, grn_index_tables[i],
field->field_name,
strlen(field->field_name));
@@ -4337,10 +4371,10 @@ int ha_mroonga::storage_open_indexes(const char *name)
continue;
}
- KEY key_info = table->s->key_info[i];
- if (KEY_N_KEY_PARTS(&key_info) > 1) {
- KEY_PART_INFO *key_part = key_info.key_part;
- for (j = 0; j < KEY_N_KEY_PARTS(&key_info); j++) {
+ KEY *key_info = &(table->s->key_info[i]);
+ if (KEY_N_KEY_PARTS(key_info) > 1) {
+ KEY_PART_INFO *key_part = key_info->key_part;
+ for (j = 0; j < KEY_N_KEY_PARTS(key_info); j++) {
bitmap_set_bit(&multiple_column_key_bitmap,
key_part[j].field->field_index);
}
@@ -4355,11 +4389,11 @@ int ha_mroonga::storage_open_indexes(const char *name)
if (ctx->rc == GRN_SUCCESS) {
grn_index_columns[i] = grn_obj_column(ctx,
grn_index_tables[i],
- key_info.name,
- strlen(key_info.name));
+ key_info->name,
+ strlen(key_info->name));
}
} else {
- mrn::IndexTableName index_table_name(mapper.table_name(), key_info.name);
+ mrn::IndexTableName index_table_name(mapper.table_name(), key_info->name);
grn_index_tables[i] = grn_ctx_get(ctx,
index_table_name.c_str(),
index_table_name.length());
@@ -4370,7 +4404,7 @@ int ha_mroonga::storage_open_indexes(const char *name)
strlen(INDEX_COLUMN_NAME));
if (!grn_index_columns[i] && ctx->rc == GRN_SUCCESS) {
/* just for backward compatibility before 1.0. */
- Field *field = key_info.key_part[0].field;
+ Field *field = key_info->key_part[0].field;
grn_index_columns[i] = grn_obj_column(ctx, grn_index_tables[i],
field->field_name,
strlen(field->field_name));
@@ -4504,40 +4538,20 @@ int ha_mroonga::close()
error = storage_close();
}
- if (is_temporary_table_name(share->table_name)) {
- TABLE_LIST table_list;
- TABLE_SHARE *tmp_table_share;
- int tmp_error;
- /* no need to decode */
- mrn::PathMapper mapper(share->table_name);
-#ifdef MRN_TABLE_LIST_INIT_REQUIRE_ALIAS
- table_list.init_one_table(mapper.db_name(), strlen(mapper.db_name()),
- mapper.mysql_table_name(),
- strlen(mapper.mysql_table_name()),
- mapper.mysql_table_name(),
- TL_WRITE);
-#else
- table_list.init_one_table(mapper.db_name(), mapper.mysql_table_name(),
- TL_WRITE);
-#endif
- mrn_open_mutex_lock(NULL);
- tmp_table_share =
- mrn_create_tmp_table_share(&table_list, share->table_name, &tmp_error);
- mrn_open_mutex_unlock(NULL);
- if (!tmp_table_share) {
- error = tmp_error;
- } else if ((tmp_error = alter_share_add(share->table_name,
- tmp_table_share))) {
- error = tmp_error;
- mrn_open_mutex_lock(NULL);
- mrn_free_tmp_table_share(tmp_table_share);
- mrn_open_mutex_unlock(NULL);
- }
+ if (error != 0)
+ {
+ DBUG_RETURN(error);
}
+
+ error = add_wrap_hton(share->table_name, share->hton);
bitmap_free(&multiple_column_key_bitmap);
+ if (share->use_count == 1) {
+ mrn_free_long_term_share(share->long_term_share);
+ }
mrn_free_share(share);
share = NULL;
is_clone = false;
+
if (
thd &&
thd_sql_command(thd) == SQLCOM_FLUSH
@@ -4554,76 +4568,28 @@ int ha_mroonga::close()
DBUG_RETURN(error);
}
-int ha_mroonga::wrapper_delete_table(const char *name, MRN_SHARE *tmp_share,
+int ha_mroonga::wrapper_delete_table(const char *name,
+ handlerton *wrap_handlerton,
const char *table_name)
{
int error = 0;
- handler *hnd;
MRN_DBUG_ENTER_METHOD();
- MRN_SET_WRAP_SHARE_KEY(tmp_share, tmp_share->table_share);
- if (!(hnd =
- tmp_share->hton->create(tmp_share->hton, tmp_share->table_share,
- current_thd->mem_root)))
- {
- MRN_SET_BASE_SHARE_KEY(tmp_share, tmp_share->table_share);
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- hnd->init();
- MRN_SET_BASE_SHARE_KEY(tmp_share, tmp_share->table_share);
- if ((error = hnd->ha_delete_table(name)))
+ handler *hnd = get_new_handler(NULL, current_thd->mem_root, wrap_handlerton);
+ if (!hnd)
{
- delete hnd;
- DBUG_RETURN(error);
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
- error = wrapper_delete_index(name, tmp_share, table_name);
-
+ error = hnd->ha_delete_table(name);
delete hnd;
- DBUG_RETURN(error);
-}
-
-int ha_mroonga::wrapper_delete_index(const char *name, MRN_SHARE *tmp_share,
- const char *table_name)
-{
- int error = 0;
- MRN_DBUG_ENTER_METHOD();
-
- error = ensure_database_open(name);
- if (error)
- DBUG_RETURN(error);
-
- error = mrn_change_encoding(ctx, system_charset_info);
- if (error)
- DBUG_RETURN(error);
- TABLE_SHARE *tmp_table_share = tmp_share->table_share;
-
- uint i;
- for (i = 0; i < tmp_table_share->keys; i++) {
- error = drop_index(tmp_share, i);
- if (error) {
- DBUG_RETURN(error);
- }
- }
-
- grn_obj *table = grn_ctx_get(ctx, table_name, strlen(table_name));
- if (!ctx->rc) {
- grn_obj_remove(ctx, table);
- }
- if (ctx->rc) {
- error = ER_CANT_OPEN_FILE;
- my_message(error, ctx->errbuf, MYF(0));
- DBUG_RETURN(error);
- }
DBUG_RETURN(error);
}
-int ha_mroonga::storage_delete_table(const char *name, MRN_SHARE *tmp_share,
- const char *table_name)
+int ha_mroonga::generic_delete_table(const char *name, const char *table_name)
{
int error = 0;
- TABLE_SHARE *tmp_table_share = tmp_share->table_share;
MRN_DBUG_ENTER_METHOD();
error = ensure_database_open(name);
@@ -4634,14 +4600,7 @@ int ha_mroonga::storage_delete_table(const char *name, MRN_SHARE *tmp_share,
if (error)
DBUG_RETURN(error);
- uint i;
- for (i = 0; i < tmp_table_share->keys; i++) {
- error = drop_index(tmp_share, i);
- if (error) {
- DBUG_RETURN(error);
- }
- }
-
+ error = drop_indexes(table_name);
grn_obj *table_obj = grn_ctx_get(ctx, table_name, strlen(table_name));
if (!ctx->rc) {
grn_obj_remove(ctx, table_obj);
@@ -4656,86 +4615,50 @@ int ha_mroonga::storage_delete_table(const char *name, MRN_SHARE *tmp_share,
int ha_mroonga::delete_table(const char *name)
{
+ MRN_DBUG_ENTER_METHOD();
+
int error = 0;
THD *thd = ha_thd();
- TABLE_LIST table_list;
- TABLE_SHARE *tmp_table_share = NULL;
- TABLE tmp_table;
- MRN_SHARE *tmp_share;
- st_mrn_alter_share *alter_share, *tmp_alter_share;
- MRN_DBUG_ENTER_METHOD();
+ handlerton *wrap_handlerton = NULL;
mrn::PathMapper mapper(name);
st_mrn_slot_data *slot_data = mrn_get_slot_data(thd, false);
- if (slot_data && slot_data->first_alter_share)
+ if (slot_data && slot_data->first_wrap_hton)
{
- tmp_alter_share = NULL;
- alter_share = slot_data->first_alter_share;
- while (alter_share)
+ st_mrn_wrap_hton *wrap_hton, *tmp_wrap_hton;
+ tmp_wrap_hton = NULL;
+ wrap_hton = slot_data->first_wrap_hton;
+ while (wrap_hton)
{
- if (!strcmp(alter_share->path, name))
+ if (!strcmp(wrap_hton->path, name))
{
/* found */
- tmp_table_share = alter_share->alter_share;
- if (tmp_alter_share)
- tmp_alter_share->next = alter_share->next;
+ wrap_handlerton = wrap_hton->hton;
+ if (tmp_wrap_hton)
+ tmp_wrap_hton->next = wrap_hton->next;
else
- slot_data->first_alter_share = alter_share->next;
- free(alter_share);
+ slot_data->first_wrap_hton = wrap_hton->next;
+ free(wrap_hton);
break;
}
- tmp_alter_share = alter_share;
- alter_share = alter_share->next;
+ tmp_wrap_hton = wrap_hton;
+ wrap_hton = wrap_hton->next;
}
}
- if (!tmp_table_share)
- {
-#ifdef MRN_TABLE_LIST_INIT_REQUIRE_ALIAS
- table_list.init_one_table(mapper.db_name(), strlen(mapper.db_name()),
- mapper.mysql_table_name(),
- strlen(mapper.mysql_table_name()),
- mapper.mysql_table_name(),
- TL_WRITE);
-#else
- table_list.init_one_table(mapper.db_name(), mapper.mysql_table_name(),
- TL_WRITE);
-#endif
- mrn_open_mutex_lock(NULL);
- tmp_table_share = mrn_create_tmp_table_share(&table_list, name, &error);
- mrn_open_mutex_unlock(NULL);
- if (!tmp_table_share) {
- DBUG_RETURN(error);
- }
- }
- tmp_table.s = tmp_table_share;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
- tmp_table.part_info = NULL;
-#endif
- if (!(tmp_share = mrn_get_share(name, &tmp_table, &error)))
+
+ if (wrap_handlerton)
{
- mrn_open_mutex_lock(NULL);
- mrn_free_tmp_table_share(tmp_table_share);
- mrn_open_mutex_unlock(NULL);
- DBUG_RETURN(error);
+ error = wrapper_delete_table(name, wrap_handlerton, mapper.table_name());
}
- if (tmp_share->wrapper_mode)
+ if (!error)
{
- error = wrapper_delete_table(name, tmp_share, mapper.table_name());
- } else {
- error = storage_delete_table(name, tmp_share, mapper.table_name());
+ error = generic_delete_table(name, mapper.table_name());
}
- if (!error) {
- mrn_free_long_term_share(tmp_share->long_term_share);
- tmp_share->long_term_share = NULL;
- }
- mrn_free_share(tmp_share);
- mrn_open_mutex_lock(NULL);
- mrn_free_tmp_table_share(tmp_table_share);
- mrn_open_mutex_unlock(NULL);
- if (is_temporary_table_name(name)) {
+ if (!error && is_temporary_table_name(name)) {
mrn_db_manager->drop(name);
}
+
DBUG_RETURN(error);
}
@@ -5331,9 +5254,9 @@ bool ha_mroonga::wrapper_have_target_index()
uint i;
uint n_keys = table->s->keys;
for (i = 0; i < n_keys; i++) {
- KEY key_info = table->key_info[i];
+ KEY *key_info = &(table->key_info[i]);
- if (wrapper_is_target_index(&key_info)) {
+ if (wrapper_is_target_index(key_info)) {
have_target_index = true;
break;
}
@@ -5406,9 +5329,9 @@ int ha_mroonga::wrapper_write_row_index(uchar *buf)
uint i;
uint n_keys = table->s->keys;
for (i = 0; i < n_keys; i++) {
- KEY key_info = table->key_info[i];
+ KEY *key_info = &(table->key_info[i]);
- if (!(wrapper_is_target_index(&key_info))) {
+ if (!(wrapper_is_target_index(key_info))) {
continue;
}
@@ -5418,8 +5341,8 @@ int ha_mroonga::wrapper_write_row_index(uchar *buf)
}
uint j;
- for (j = 0; j < KEY_N_KEY_PARTS(&key_info); j++) {
- Field *field = key_info.key_part[j].field;
+ for (j = 0; j < KEY_N_KEY_PARTS(key_info); j++) {
+ Field *field = key_info->key_part[j].field;
if (field->is_null())
continue;
@@ -5481,7 +5404,8 @@ int ha_mroonga::storage_write_row(uchar *buf)
if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) {
push_warning_printf(thd, MRN_SEVERITY_WARNING,
- WARN_DATA_TRUNCATED, MRN_GET_ERR_MSG(WARN_DATA_TRUNCATED),
+ WARN_DATA_TRUNCATED,
+ MRN_GET_ERR_MSG(WARN_DATA_TRUNCATED),
MRN_COLUMN_NAME_ID,
MRN_GET_CURRENT_ROW_FOR_WARNING(thd));
if (MRN_ABORT_ON_WARNING(thd)) {
@@ -5490,66 +5414,79 @@ int ha_mroonga::storage_write_row(uchar *buf)
}
}
- char *pkey;
- int pkey_size;
- uint pkey_nr;
- pkey_nr = table->s->primary_key;
- GRN_BULK_REWIND(&key_buffer);
- if (pkey_nr == MAX_INDEXES) {
- pkey = NULL;
- pkey_size = 0;
- } else {
- KEY key_info = table->key_info[pkey_nr];
- if (KEY_N_KEY_PARTS(&key_info) == 1) {
- Field *pkey_field = key_info.key_part[0].field;
- error = mrn_change_encoding(ctx, pkey_field->charset());
- if (error) {
- DBUG_RETURN(error);
- }
- generic_store_bulk(pkey_field, &key_buffer);
- pkey = GRN_TEXT_VALUE(&key_buffer);
- pkey_size = GRN_TEXT_LEN(&key_buffer);
- } else {
- mrn_change_encoding(ctx, NULL);
- uchar key[MRN_MAX_KEY_SIZE];
- key_copy(key, buf, &key_info, key_info.key_length);
- grn_bulk_space(ctx, &key_buffer, key_info.key_length);
- pkey = GRN_TEXT_VALUE(&key_buffer);
- storage_encode_multiple_column_key(&key_info,
- key, key_info.key_length,
- (uchar *)pkey, (uint *)&pkey_size);
+ uint pkey_nr = table->s->primary_key;
+
+ int added = 0;
+ {
+ mrn::Lock lock(&(share->record_mutex), have_unique_index());
+ if ((error = storage_write_row_unique_indexes(buf)))
+ {
+ DBUG_RETURN(error);
}
- }
+ unique_indexes_are_processed = true;
- if (grn_table->header.type != GRN_TABLE_NO_KEY && pkey_size == 0) {
- my_message(ER_ERROR_ON_WRITE, "primary key is empty", MYF(0));
- DBUG_RETURN(ER_ERROR_ON_WRITE);
- }
+ char *pkey;
+ int pkey_size;
+ GRN_BULK_REWIND(&key_buffer);
+ if (pkey_nr == MAX_INDEXES) {
+ pkey = NULL;
+ pkey_size = 0;
+ } else {
+ KEY *key_info = &(table->key_info[pkey_nr]);
+ if (KEY_N_KEY_PARTS(key_info) == 1) {
+ Field *pkey_field = key_info->key_part[0].field;
+ error = mrn_change_encoding(ctx, pkey_field->charset());
+ if (error) {
+ DBUG_RETURN(error);
+ }
+ generic_store_bulk(pkey_field, &key_buffer);
+ pkey = GRN_TEXT_VALUE(&key_buffer);
+ pkey_size = GRN_TEXT_LEN(&key_buffer);
+ } else {
+ mrn_change_encoding(ctx, NULL);
+ uchar key[MRN_MAX_KEY_SIZE];
+ key_copy(key, buf, key_info, key_info->key_length);
+ grn_bulk_reserve(ctx, &key_buffer, MRN_MAX_KEY_SIZE);
+ pkey = GRN_TEXT_VALUE(&key_buffer);
+ storage_encode_multiple_column_key(key_info,
+ key, key_info->key_length,
+ (uchar *)pkey, (uint *)&pkey_size);
+ }
+ }
- int added;
- record_id = grn_table_add(ctx, grn_table, pkey, pkey_size, &added);
- if (ctx->rc) {
- my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0));
- DBUG_RETURN(ER_ERROR_ON_WRITE);
- }
- if (!added) {
- // duplicated error
- error = HA_ERR_FOUND_DUPP_KEY;
- memcpy(dup_ref, &record_id, sizeof(grn_id));
- dup_key = pkey_nr;
- if (!ignoring_duplicated_key) {
- GRN_LOG(ctx, GRN_LOG_ERROR,
- "duplicated id on insert: update primary key: <%.*s>",
- pkey_size, pkey);
+ if (grn_table->header.type != GRN_TABLE_NO_KEY && pkey_size == 0) {
+ my_message(ER_ERROR_ON_WRITE, "primary key is empty", MYF(0));
+ DBUG_RETURN(ER_ERROR_ON_WRITE);
}
- DBUG_RETURN(error);
- }
- if ((error = storage_write_row_unique_indexes(buf)))
- {
- goto err;
+ record_id = grn_table_add(ctx, grn_table, pkey, pkey_size, &added);
+ if (ctx->rc) {
+ my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0));
+ DBUG_RETURN(ER_ERROR_ON_WRITE);
+ }
+ if (!added) {
+ // duplicated error
+ error = HA_ERR_FOUND_DUPP_KEY;
+ memcpy(dup_ref, &record_id, sizeof(grn_id));
+ dup_key = pkey_nr;
+ if (!ignoring_duplicated_key) {
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "duplicated id on insert: update primary key: <%.*s>",
+ pkey_size, pkey);
+ }
+ uint j;
+ for (j = 0; j < table->s->keys; j++) {
+ if (j == pkey_nr) {
+ continue;
+ }
+ KEY *key_info = &table->key_info[j];
+ if (key_info->flags & HA_NOSAME) {
+ grn_table_delete_by_id(ctx, grn_index_tables[j], key_id[j]);
+ }
+ }
+ DBUG_RETURN(error);
+ }
}
- unique_indexes_are_processed = true;
grn_obj colbuf;
GRN_VOID_INIT(&colbuf);
@@ -5673,16 +5610,16 @@ int ha_mroonga::storage_write_row_multiple_column_index(uchar *buf,
key_info,
key_info->key_length);
GRN_BULK_REWIND(&encoded_key_buffer);
- grn_bulk_space(ctx, &encoded_key_buffer, key_info->key_length);
+ grn_bulk_reserve(ctx, &encoded_key_buffer, MRN_MAX_KEY_SIZE);
uint encoded_key_length;
storage_encode_multiple_column_key(key_info,
(uchar *)(GRN_TEXT_VALUE(&key_buffer)),
key_info->key_length,
(uchar *)(GRN_TEXT_VALUE(&encoded_key_buffer)),
&encoded_key_length);
+ grn_bulk_space(ctx, &encoded_key_buffer, encoded_key_length);
DBUG_PRINT("info", ("mroonga: key_length=%u", key_info->key_length));
DBUG_PRINT("info", ("mroonga: encoded_key_length=%u", encoded_key_length));
- DBUG_ASSERT(key_info->key_length >= encoded_key_length);
grn_rc rc;
rc = grn_column_index_update(ctx, index_column, record_id, 1, NULL,
@@ -5709,9 +5646,9 @@ int ha_mroonga::storage_write_row_multiple_column_indexes(uchar *buf,
continue;
}
- KEY key_info = table->key_info[i];
+ KEY *key_info = &(table->key_info[i]);
- if (KEY_N_KEY_PARTS(&key_info) == 1 || (key_info.flags & HA_FULLTEXT)) {
+ if (KEY_N_KEY_PARTS(key_info) == 1 || (key_info->flags & HA_FULLTEXT)) {
continue;
}
@@ -5722,7 +5659,7 @@ int ha_mroonga::storage_write_row_multiple_column_indexes(uchar *buf,
if ((error = storage_write_row_multiple_column_index(buf,
record_id,
- &key_info,
+ key_info,
index_column)))
{
goto err;
@@ -5757,7 +5694,7 @@ int ha_mroonga::storage_write_row_unique_index(uchar *buf,
mrn_change_encoding(ctx, NULL);
uchar key[MRN_MAX_KEY_SIZE];
key_copy(key, buf, key_info, key_info->key_length);
- grn_bulk_space(ctx, &key_buffer, key_info->key_length);
+ grn_bulk_reserve(ctx, &key_buffer, MRN_MAX_KEY_SIZE);
ukey = GRN_TEXT_VALUE(&key_buffer);
storage_encode_multiple_column_key(key_info,
key, key_info->key_length,
@@ -5949,11 +5886,11 @@ int ha_mroonga::wrapper_update_row_index(const uchar *old_data, uchar *new_data)
}
mrn_change_encoding(ctx, NULL);
- KEY key_info = table->key_info[table_share->primary_key];
+ KEY *key_info = &(table->key_info[table_share->primary_key]);
GRN_BULK_REWIND(&key_buffer);
key_copy((uchar *)(GRN_TEXT_VALUE(&key_buffer)),
new_data,
- &key_info, key_info.key_length);
+ key_info, key_info->key_length);
int added;
grn_id new_record_id;
new_record_id = grn_table_add(ctx, grn_table,
@@ -5972,15 +5909,15 @@ int ha_mroonga::wrapper_update_row_index(const uchar *old_data, uchar *new_data)
grn_id old_record_id;
my_ptrdiff_t ptr_diff = PTR_BYTE_DIFF(old_data, table->record[0]);
- for (uint j = 0; j < KEY_N_KEY_PARTS(&key_info); j++) {
- Field *field = key_info.key_part[j].field;
+ for (uint j = 0; j < KEY_N_KEY_PARTS(key_info); j++) {
+ Field *field = key_info->key_part[j].field;
field->move_field_offset(ptr_diff);
}
error = wrapper_get_record_id((uchar *)old_data, &old_record_id,
"failed to get old record ID "
"for updating from groonga");
- for (uint j = 0; j < KEY_N_KEY_PARTS(&key_info); j++) {
- Field *field = key_info.key_part[j].field;
+ for (uint j = 0; j < KEY_N_KEY_PARTS(key_info); j++) {
+ Field *field = key_info->key_part[j].field;
field->move_field_offset(-ptr_diff);
}
if (error) {
@@ -5991,9 +5928,9 @@ int ha_mroonga::wrapper_update_row_index(const uchar *old_data, uchar *new_data)
uint i;
uint n_keys = table->s->keys;
for (i = 0; i < n_keys; i++) {
- KEY key_info = table->key_info[i];
+ KEY *key_info = &(table->key_info[i]);
- if (!(wrapper_is_target_index(&key_info))) {
+ if (!(wrapper_is_target_index(key_info))) {
continue;
}
@@ -6004,8 +5941,8 @@ int ha_mroonga::wrapper_update_row_index(const uchar *old_data, uchar *new_data)
}
uint j;
- for (j = 0; j < KEY_N_KEY_PARTS(&key_info); j++) {
- Field *field = key_info.key_part[j].field;
+ for (j = 0; j < KEY_N_KEY_PARTS(key_info); j++) {
+ Field *field = key_info->key_part[j].field;
generic_store_bulk(field, &new_value_buffer);
@@ -6086,6 +6023,7 @@ int ha_mroonga::storage_update_row(const uchar *old_data, uchar *new_data)
KEY *pkey_info = NULL;
storage_store_fields_for_prep_update(old_data, new_data, record_id);
{
+ mrn::Lock lock(&(share->record_mutex), have_unique_index());
mrn::DebugColumnAccess debug_column_access(table, table->read_set);
if ((error = storage_prepare_delete_row_unique_indexes(old_data,
record_id))) {
@@ -6233,9 +6171,9 @@ int ha_mroonga::storage_update_row_index(const uchar *old_data, uchar *new_data)
continue;
}
- KEY key_info = table->key_info[i];
+ KEY *key_info = &(table->key_info[i]);
- if (KEY_N_KEY_PARTS(&key_info) == 1 || (key_info.flags & HA_FULLTEXT)) {
+ if (KEY_N_KEY_PARTS(key_info) == 1 || (key_info->flags & HA_FULLTEXT)) {
continue;
}
@@ -6246,42 +6184,44 @@ int ha_mroonga::storage_update_row_index(const uchar *old_data, uchar *new_data)
}
GRN_BULK_REWIND(&old_key);
- grn_bulk_space(ctx, &old_key, key_info.key_length);
- for (uint j = 0; j < KEY_N_KEY_PARTS(&key_info); j++) {
- Field *field = key_info.key_part[j].field;
+ grn_bulk_space(ctx, &old_key, key_info->key_length);
+ for (uint j = 0; j < KEY_N_KEY_PARTS(key_info); j++) {
+ Field *field = key_info->key_part[j].field;
field->move_field_offset(ptr_diff);
}
key_copy((uchar *)(GRN_TEXT_VALUE(&old_key)),
(uchar *)old_data,
- &key_info,
- key_info.key_length);
- for (uint j = 0; j < KEY_N_KEY_PARTS(&key_info); j++) {
- Field *field = key_info.key_part[j].field;
+ key_info,
+ key_info->key_length);
+ for (uint j = 0; j < KEY_N_KEY_PARTS(key_info); j++) {
+ Field *field = key_info->key_part[j].field;
field->move_field_offset(-ptr_diff);
}
GRN_BULK_REWIND(&old_encoded_key);
- grn_bulk_space(ctx, &old_encoded_key, key_info.key_length);
+ grn_bulk_reserve(ctx, &old_encoded_key, MRN_MAX_KEY_SIZE);
uint old_encoded_key_length;
- storage_encode_multiple_column_key(&key_info,
+ storage_encode_multiple_column_key(key_info,
(uchar *)(GRN_TEXT_VALUE(&old_key)),
- key_info.key_length,
+ key_info->key_length,
(uchar *)(GRN_TEXT_VALUE(&old_encoded_key)),
&old_encoded_key_length);
+ grn_bulk_space(ctx, &old_encoded_key, old_encoded_key_length);
GRN_BULK_REWIND(&new_key);
- grn_bulk_space(ctx, &new_key, key_info.key_length);
+ grn_bulk_space(ctx, &new_key, key_info->key_length);
key_copy((uchar *)(GRN_TEXT_VALUE(&new_key)),
(uchar *)new_data,
- &key_info,
- key_info.key_length);
+ key_info,
+ key_info->key_length);
GRN_BULK_REWIND(&new_encoded_key);
- grn_bulk_space(ctx, &new_encoded_key, key_info.key_length);
+ grn_bulk_reserve(ctx, &new_encoded_key, MRN_MAX_KEY_SIZE);
uint new_encoded_key_length;
- storage_encode_multiple_column_key(&key_info,
+ storage_encode_multiple_column_key(key_info,
(uchar *)(GRN_TEXT_VALUE(&new_key)),
- key_info.key_length,
+ key_info->key_length,
(uchar *)(GRN_TEXT_VALUE(&new_encoded_key)),
&new_encoded_key_length);
+ grn_bulk_space(ctx, &new_encoded_key, new_encoded_key_length);
grn_rc rc;
rc = grn_column_index_update(ctx, index_column, record_id, 1,
@@ -6436,9 +6376,9 @@ int ha_mroonga::wrapper_delete_row_index(const uchar *buf)
uint i;
uint n_keys = table->s->keys;
for (i = 0; i < n_keys; i++) {
- KEY key_info = table->key_info[i];
+ KEY *key_info = &(table->key_info[i]);
- if (!(wrapper_is_target_index(&key_info))) {
+ if (!(wrapper_is_target_index(key_info))) {
continue;
}
@@ -6449,8 +6389,8 @@ int ha_mroonga::wrapper_delete_row_index(const uchar *buf)
}
uint j;
- for (j = 0; j < KEY_N_KEY_PARTS(&key_info); j++) {
- Field *field = key_info.key_part[j].field;
+ for (j = 0; j < KEY_N_KEY_PARTS(key_info); j++) {
+ Field *field = key_info->key_part[j].field;
if (field->is_null())
continue;
@@ -6487,20 +6427,23 @@ int ha_mroonga::storage_delete_row(const uchar *buf)
}
storage_store_fields_for_prep_update(buf, NULL, record_id);
- if ((error = storage_prepare_delete_row_unique_indexes(buf, record_id))) {
- DBUG_RETURN(error);
- }
- mrn_change_encoding(ctx, NULL);
- grn_table_delete_by_id(ctx, grn_table, record_id);
- if (ctx->rc) {
- my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0));
- DBUG_RETURN(ER_ERROR_ON_WRITE);
- }
- if (
- (error = storage_delete_row_index(buf)) ||
- (error = storage_delete_row_unique_indexes())
- ) {
- DBUG_RETURN(error);
+ {
+ mrn::Lock lock(&(share->record_mutex), have_unique_index());
+ if ((error = storage_prepare_delete_row_unique_indexes(buf, record_id))) {
+ DBUG_RETURN(error);
+ }
+ mrn_change_encoding(ctx, NULL);
+ grn_table_delete_by_id(ctx, grn_table, record_id);
+ if (ctx->rc) {
+ my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0));
+ DBUG_RETURN(ER_ERROR_ON_WRITE);
+ }
+ if (
+ (error = storage_delete_row_index(buf)) ||
+ (error = storage_delete_row_unique_indexes())
+ ) {
+ DBUG_RETURN(error);
+ }
}
grn_db_touch(ctx, grn_ctx_db(ctx));
@@ -6526,9 +6469,9 @@ int ha_mroonga::storage_delete_row_index(const uchar *buf)
continue;
}
- KEY key_info = table->key_info[i];
+ KEY *key_info = &(table->key_info[i]);
- if (KEY_N_KEY_PARTS(&key_info) == 1 || (key_info.flags & HA_FULLTEXT)) {
+ if (KEY_N_KEY_PARTS(key_info) == 1 || (key_info->flags & HA_FULLTEXT)) {
continue;
}
@@ -6539,19 +6482,20 @@ int ha_mroonga::storage_delete_row_index(const uchar *buf)
}
GRN_BULK_REWIND(&key);
- grn_bulk_space(ctx, &key, key_info.key_length);
+ grn_bulk_space(ctx, &key, key_info->key_length);
key_copy((uchar *)(GRN_TEXT_VALUE(&key)),
(uchar *)buf,
- &key_info,
- key_info.key_length);
+ key_info,
+ key_info->key_length);
GRN_BULK_REWIND(&encoded_key);
- grn_bulk_space(ctx, &encoded_key, key_info.key_length);
+ grn_bulk_reserve(ctx, &encoded_key, MRN_MAX_KEY_SIZE);
uint encoded_key_length;
- storage_encode_multiple_column_key(&key_info,
+ storage_encode_multiple_column_key(key_info,
(uchar *)(GRN_TEXT_VALUE(&key)),
- key_info.key_length,
+ key_info->key_length,
(uchar *)(GRN_TEXT_VALUE(&encoded_key)),
&encoded_key_length);
+ grn_bulk_space(ctx, &encoded_key, encoded_key_length);
grn_rc rc;
rc = grn_column_index_update(ctx, index_column, record_id, 1,
@@ -6627,7 +6571,7 @@ int ha_mroonga::storage_prepare_delete_row_unique_index(const uchar *buf,
mrn_change_encoding(ctx, NULL);
uchar key[MRN_MAX_KEY_SIZE];
key_copy(key, (uchar *) buf, key_info, key_info->key_length);
- grn_bulk_space(ctx, &key_buffer, key_info->key_length);
+ grn_bulk_reserve(ctx, &key_buffer, MRN_MAX_KEY_SIZE);
ukey = GRN_TEXT_VALUE(&key_buffer);
storage_encode_multiple_column_key(key_info,
key, key_info->key_length,
@@ -6737,8 +6681,8 @@ ha_rows ha_mroonga::wrapper_records_in_range(uint key_nr, key_range *range_min,
{
ha_rows row_count;
MRN_DBUG_ENTER_METHOD();
- KEY key_info = table->s->key_info[key_nr];
- if (mrn_is_geo_key(&key_info)) {
+ KEY *key_info = &(table->s->key_info[key_nr]);
+ if (mrn_is_geo_key(key_info)) {
row_count = generic_records_in_range_geo(key_nr, range_min, range_max);
} else {
MRN_SET_WRAP_SHARE_KEY(share, table->s);
@@ -6760,8 +6704,8 @@ ha_rows ha_mroonga::storage_records_in_range(uint key_nr, key_range *range_min,
uchar *key_min = NULL, *key_max = NULL;
uchar key_min_entity[MRN_MAX_KEY_SIZE];
uchar key_max_entity[MRN_MAX_KEY_SIZE];
- KEY key_info = table->s->key_info[key_nr];
- bool is_multiple_column_index = KEY_N_KEY_PARTS(&key_info) > 1;
+ KEY *key_info = &(table->s->key_info[key_nr]);
+ bool is_multiple_column_index = KEY_N_KEY_PARTS(key_info) > 1;
if (is_multiple_column_index) {
mrn_change_encoding(ctx, NULL);
@@ -6770,24 +6714,23 @@ ha_rows ha_mroonga::storage_records_in_range(uint key_nr, key_range *range_min,
memcmp(range_min->key, range_max->key, range_min->length) == 0) {
flags |= GRN_CURSOR_PREFIX;
key_min = key_min_entity;
- storage_encode_multiple_column_key(&key_info,
+ storage_encode_multiple_column_key(key_info,
range_min->key, range_min->length,
key_min, &size_min);
} else {
key_min = key_min_entity;
key_max = key_max_entity;
- storage_encode_multiple_column_key_range(&key_info,
+ storage_encode_multiple_column_key_range(key_info,
range_min, range_max,
key_min, &size_min,
key_max, &size_max);
}
- } else if (mrn_is_geo_key(&key_info)) {
- mrn_change_encoding(ctx, key_info.key_part->field->charset());
+ } else if (mrn_is_geo_key(key_info)) {
+ mrn_change_encoding(ctx, key_info->key_part->field->charset());
row_count = generic_records_in_range_geo(key_nr, range_min, range_max);
DBUG_RETURN(row_count);
} else {
- KEY_PART_INFO key_part = key_info.key_part[0];
- Field *field = key_part.field;
+ Field *field = key_info->key_part[0].field;
const char *column_name = field->field_name;
mrn_change_encoding(ctx, field->charset());
@@ -6909,12 +6852,12 @@ ha_rows ha_mroonga::records_in_range(uint key_nr, key_range *range_min, key_rang
int ha_mroonga::wrapper_index_init(uint idx, bool sorted)
{
- int error = 0;
- KEY key_info = table->s->key_info[idx];
MRN_DBUG_ENTER_METHOD();
+ int error = 0;
+ KEY *key_info = &(table->s->key_info[idx]);
MRN_SET_WRAP_SHARE_KEY(share, table->s);
MRN_SET_WRAP_TABLE_KEY(this, table);
- if (!mrn_is_geo_key(&key_info) && key_info.algorithm != HA_KEY_ALG_FULLTEXT)
+ if (!mrn_is_geo_key(key_info) && key_info->algorithm != HA_KEY_ALG_FULLTEXT)
{
error = wrap_handler->ha_index_init(share->wrap_key_nr[idx], sorted);
} else {
@@ -6985,8 +6928,8 @@ int ha_mroonga::wrapper_index_read_map(uchar *buf, const uchar *key,
{
int error = 0;
MRN_DBUG_ENTER_METHOD();
- KEY key_info = table->key_info[active_index];
- if (mrn_is_geo_key(&key_info)) {
+ KEY *key_info = &(table->key_info[active_index]);
+ if (mrn_is_geo_key(key_info)) {
clear_cursor_geo();
error = generic_geo_open_cursor(key, find_flag);
if (!error) {
@@ -7019,7 +6962,7 @@ int ha_mroonga::storage_index_read_map(uchar *buf, const uchar *key,
int error = 0;
uint key_nr = active_index;
- KEY key_info = table->key_info[key_nr];
+ KEY *key_info = &(table->key_info[key_nr]);
int flags = 0;
uint size_min = 0, size_max = 0;
uchar *key_min = NULL, *key_max = NULL;
@@ -7030,7 +6973,7 @@ int ha_mroonga::storage_index_read_map(uchar *buf, const uchar *key,
clear_cursor_geo();
clear_empty_value_records();
- bool is_multiple_column_index = KEY_N_KEY_PARTS(&key_info) > 1;
+ bool is_multiple_column_index = KEY_N_KEY_PARTS(key_info) > 1;
if (is_multiple_column_index) {
mrn_change_encoding(ctx, NULL);
uint key_length =
@@ -7039,17 +6982,17 @@ int ha_mroonga::storage_index_read_map(uchar *buf, const uchar *key,
("mroonga: multiple column index: "
"search key length=<%u>, "
"multiple column index key length=<%u>",
- key_length, key_info.key_length));
- if (key_length == key_info.key_length) {
+ key_length, key_info->key_length));
+ if (key_length == key_info->key_length) {
if (find_flag == HA_READ_BEFORE_KEY ||
find_flag == HA_READ_PREFIX_LAST_OR_PREV) {
key_max = key_max_entity;
- storage_encode_multiple_column_key(&key_info,
+ storage_encode_multiple_column_key(key_info,
key, key_length,
key_max, &size_max);
} else {
key_min = key_min_entity;
- storage_encode_multiple_column_key(&key_info,
+ storage_encode_multiple_column_key(key_info,
key, key_length,
key_min, &size_min);
if (find_flag == HA_READ_KEY_EXACT) {
@@ -7060,12 +7003,12 @@ int ha_mroonga::storage_index_read_map(uchar *buf, const uchar *key,
} else {
flags |= GRN_CURSOR_PREFIX;
key_min = key_min_entity;
- storage_encode_multiple_column_key(&key_info,
+ storage_encode_multiple_column_key(key_info,
key, key_length,
key_min, &size_min);
}
- } else if (mrn_is_geo_key(&key_info)) {
- error = mrn_change_encoding(ctx, key_info.key_part->field->charset());
+ } else if (mrn_is_geo_key(key_info)) {
+ error = mrn_change_encoding(ctx, key_info->key_part->field->charset());
if (error)
DBUG_RETURN(error);
error = generic_geo_open_cursor(key, find_flag);
@@ -7074,8 +7017,7 @@ int ha_mroonga::storage_index_read_map(uchar *buf, const uchar *key,
}
DBUG_RETURN(error);
} else {
- KEY_PART_INFO key_part = key_info.key_part[0];
- Field *field = key_part.field;
+ Field *field = key_info->key_part[0].field;
error = mrn_change_encoding(ctx, field->charset());
if (error)
DBUG_RETURN(error);
@@ -7150,7 +7092,7 @@ int ha_mroonga::storage_index_read_map(uchar *buf, const uchar *key,
GRN_EXPR_CREATE_FOR_QUERY(ctx, grn_table,
expression, expression_variable);
grn_obj *target_column =
- grn_columns[key_info.key_part->field->field_index];
+ grn_columns[key_info->key_part->field->field_index];
grn_expr_append_const(ctx, expression, target_column, GRN_OP_GET_VALUE, 1);
grn_obj empty_value;
GRN_TEXT_INIT(&empty_value, 0);
@@ -7229,7 +7171,7 @@ int ha_mroonga::storage_index_read_last_map(uchar *buf, const uchar *key,
{
MRN_DBUG_ENTER_METHOD();
uint key_nr = active_index;
- KEY key_info = table->key_info[key_nr];
+ KEY *key_info = &(table->key_info[key_nr]);
int flags = GRN_CURSOR_DESCENDING, error;
uint size_min = 0, size_max = 0;
@@ -7238,19 +7180,18 @@ int ha_mroonga::storage_index_read_last_map(uchar *buf, const uchar *key,
clear_cursor();
- bool is_multiple_column_index = KEY_N_KEY_PARTS(&key_info) > 1;
+ bool is_multiple_column_index = KEY_N_KEY_PARTS(key_info) > 1;
if (is_multiple_column_index) {
mrn_change_encoding(ctx, NULL);
flags |= GRN_CURSOR_PREFIX;
uint key_length =
mrn_calculate_key_len(table, active_index, key, keypart_map);
key_min = key_min_entity;
- storage_encode_multiple_column_key(&key_info,
+ storage_encode_multiple_column_key(key_info,
key, key_length,
key_min, &size_min);
} else {
- KEY_PART_INFO key_part = key_info.key_part[0];
- Field *field = key_part.field;
+ Field *field = key_info->key_part[0].field;
error = mrn_change_encoding(ctx, field->charset());
if (error)
DBUG_RETURN(error);
@@ -7308,8 +7249,8 @@ int ha_mroonga::wrapper_index_next(uchar *buf)
{
int error = 0;
MRN_DBUG_ENTER_METHOD();
- KEY key_info = table->key_info[active_index];
- if (mrn_is_geo_key(&key_info)) {
+ KEY *key_info = &(table->key_info[active_index]);
+ if (mrn_is_geo_key(key_info)) {
error = wrapper_get_next_geo_record(buf);
} else {
MRN_SET_WRAP_SHARE_KEY(share, table->s);
@@ -7351,8 +7292,8 @@ int ha_mroonga::wrapper_index_prev(uchar *buf)
{
int error = 0;
MRN_DBUG_ENTER_METHOD();
- KEY key_info = table->key_info[active_index];
- if (mrn_is_geo_key(&key_info)) {
+ KEY *key_info = &(table->key_info[active_index]);
+ if (mrn_is_geo_key(key_info)) {
error = wrapper_get_next_geo_record(buf);
} else {
MRN_SET_WRAP_SHARE_KEY(share, table->s);
@@ -7525,8 +7466,8 @@ int ha_mroonga::wrapper_index_next_same(uchar *buf, const uchar *key,
{
MRN_DBUG_ENTER_METHOD();
int error = 0;
- KEY key_info = table->s->key_info[active_index];
- if (mrn_is_geo_key(&key_info)) {
+ KEY *key_info = &(table->s->key_info[active_index]);
+ if (mrn_is_geo_key(key_info)) {
error = wrapper_get_next_geo_record(buf);
} else {
MRN_SET_WRAP_SHARE_KEY(share, table->s);
@@ -7571,8 +7512,8 @@ int ha_mroonga::wrapper_read_range_first(const key_range *start_key,
{
int error = 0;
MRN_DBUG_ENTER_METHOD();
- KEY key_info = table->key_info[active_index];
- if (mrn_is_geo_key(&key_info)) {
+ KEY *key_info = &(table->key_info[active_index]);
+ if (mrn_is_geo_key(key_info)) {
clear_cursor_geo();
error = generic_geo_open_cursor(start_key->key, start_key->flag);
if (!error) {
@@ -7603,11 +7544,11 @@ int ha_mroonga::storage_read_range_first(const key_range *start_key,
uchar *key_min = NULL, *key_max = NULL;
uchar key_min_entity[MRN_MAX_KEY_SIZE];
uchar key_max_entity[MRN_MAX_KEY_SIZE];
- KEY key_info = table->s->key_info[active_index];
+ KEY *key_info = &(table->s->key_info[active_index]);
clear_cursor();
- bool is_multiple_column_index = KEY_N_KEY_PARTS(&key_info) > 1;
+ bool is_multiple_column_index = KEY_N_KEY_PARTS(key_info) > 1;
if (is_multiple_column_index) {
mrn_change_encoding(ctx, NULL);
if (start_key && end_key &&
@@ -7615,13 +7556,13 @@ int ha_mroonga::storage_read_range_first(const key_range *start_key,
memcmp(start_key->key, end_key->key, start_key->length) == 0) {
flags |= GRN_CURSOR_PREFIX;
key_min = key_min_entity;
- storage_encode_multiple_column_key(&key_info,
+ storage_encode_multiple_column_key(key_info,
start_key->key, start_key->length,
key_min, &size_min);
} else {
key_min = key_min_entity;
key_max = key_max_entity;
- storage_encode_multiple_column_key_range(&key_info,
+ storage_encode_multiple_column_key_range(key_info,
start_key, end_key,
key_min, &size_min,
key_max, &size_max);
@@ -7633,8 +7574,7 @@ int ha_mroonga::storage_read_range_first(const key_range *start_key,
}
}
} else {
- KEY_PART_INFO key_part = key_info.key_part[0];
- Field *field = key_part.field;
+ Field *field = key_info->key_part[0].field;
const char *column_name = field->field_name;
error = mrn_change_encoding(ctx, field->charset());
if (error)
@@ -7742,8 +7682,8 @@ int ha_mroonga::wrapper_read_range_next()
{
int error = 0;
MRN_DBUG_ENTER_METHOD();
- KEY key_info = table->key_info[active_index];
- if (mrn_is_geo_key(&key_info)) {
+ KEY *key_info = &(table->key_info[active_index]);
+ if (mrn_is_geo_key(key_info)) {
error = wrapper_get_next_geo_record(table->record[0]);
DBUG_RETURN(error);
}
@@ -8082,7 +8022,7 @@ grn_rc ha_mroonga::generic_ft_init_ext_prepare_expression_in_boolean_mode(
bool parsed = false;
bool done = false;
keyword++;
- keyword_length++;
+ keyword_length--;
while (!done) {
uint consumed_keyword_length = 0;
switch (keyword[0]) {
@@ -8283,12 +8223,11 @@ FT_INFO *ha_mroonga::generic_ft_init_ext(uint flags, uint key_nr, String *key)
check_count_skip(0, 0, true);
mrn_change_encoding(ctx, system_charset_info);
- grn_operator operation = GRN_OP_AND;
+ grn_operator operation = GRN_OP_OR;
if (!matched_record_keys) {
matched_record_keys = grn_table_create(ctx, NULL, 0, NULL,
GRN_OBJ_TABLE_HASH_KEY | GRN_OBJ_WITH_SUBREC,
grn_table, 0);
- operation = GRN_OP_OR;
}
grn_table_sort_key *sort_keys = NULL;
@@ -8317,6 +8256,24 @@ FT_INFO *ha_mroonga::generic_ft_init_ext(uint flags, uint key_nr, String *key)
matched_record_keys);
grn_table_sort(ctx, matched_record_keys, 0, static_cast<int>(limit),
sorted_result, sort_keys, n_sort_keys);
+ } else if (flags & FT_SORTED) {
+ grn_table_sort_key score_sort_key;
+ score_sort_key.key = grn_obj_column(ctx,
+ matched_record_keys,
+ MRN_COLUMN_NAME_SCORE,
+ strlen(MRN_COLUMN_NAME_SCORE));
+ score_sort_key.offset = 0;
+ score_sort_key.flags = GRN_TABLE_SORT_DESC;
+ if (sorted_result) {
+ grn_obj_unlink(ctx, sorted_result);
+ }
+ sorted_result = grn_table_create(ctx, NULL,
+ 0, NULL,
+ GRN_OBJ_TABLE_NO_KEY, NULL,
+ matched_record_keys);
+ grn_table_sort(ctx, matched_record_keys, 0, -1,
+ sorted_result, &score_sort_key, 1);
+ grn_obj_unlink(ctx, score_sort_key.key);
}
if (sort_keys) {
for (int i = 0; i < n_sort_keys; i++) {
@@ -8586,6 +8543,26 @@ ulonglong ha_mroonga::file_size(const char *path)
}
}
+bool ha_mroonga::have_unique_index()
+{
+ MRN_DBUG_ENTER_METHOD();
+
+ uint n_keys = table->s->keys;
+
+ for (uint i = 0; i < n_keys; i++) {
+ if (i == table->s->primary_key) {
+ continue;
+ }
+
+ KEY *key_info = &(table->key_info[i]);
+ if (key_info->flags & HA_NOSAME) {
+ DBUG_RETURN(true);
+ }
+ }
+
+ DBUG_RETURN(false);
+}
+
void ha_mroonga::push_warning_unsupported_spatial_index_search(enum ha_rkey_function flag)
{
char search_name[MRN_BUFFER_SIZE];
@@ -8712,27 +8689,27 @@ void ha_mroonga::clear_indexes()
DBUG_VOID_RETURN;
}
-int ha_mroonga::alter_share_add(const char *path, TABLE_SHARE *table_share)
+int ha_mroonga::add_wrap_hton(const char *path, handlerton *wrap_handlerton)
{
MRN_DBUG_ENTER_METHOD();
st_mrn_slot_data *slot_data = mrn_get_slot_data(ha_thd(), true);
if (!slot_data)
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- st_mrn_alter_share *alter_share =
- (st_mrn_alter_share *)malloc(sizeof(st_mrn_alter_share));
- if (!alter_share)
+ st_mrn_wrap_hton *wrap_hton =
+ (st_mrn_wrap_hton *)malloc(sizeof(st_mrn_wrap_hton));
+ if (!wrap_hton)
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- alter_share->next = NULL;
- strcpy(alter_share->path, path);
- alter_share->alter_share = table_share;
- if (slot_data->first_alter_share)
+ wrap_hton->next = NULL;
+ strcpy(wrap_hton->path, path);
+ wrap_hton->hton = wrap_handlerton;
+ if (slot_data->first_wrap_hton)
{
- st_mrn_alter_share *tmp_alter_share = slot_data->first_alter_share;
- while (tmp_alter_share->next)
- tmp_alter_share = tmp_alter_share->next;
- tmp_alter_share->next = alter_share;
+ st_mrn_wrap_hton *tmp_wrap_hton = slot_data->first_wrap_hton;
+ while (tmp_wrap_hton->next)
+ tmp_wrap_hton = tmp_wrap_hton->next;
+ tmp_wrap_hton->next = wrap_hton;
} else {
- slot_data->first_alter_share = alter_share;
+ slot_data->first_wrap_hton = wrap_hton;
}
DBUG_RETURN(0);
}
@@ -8848,6 +8825,320 @@ int ha_mroonga::drop_index(MRN_SHARE *target_share, uint key_index)
DBUG_RETURN(error);
}
+int ha_mroonga::drop_indexes_normal(const char *table_name, grn_obj *table)
+{
+ MRN_DBUG_ENTER_METHOD();
+
+ int error = 0;
+
+ grn_hash *columns_raw = grn_hash_create(ctx, NULL, sizeof(grn_id), 0,
+ GRN_OBJ_TABLE_HASH_KEY);
+ mrn::SmartGrnObj columns(ctx, reinterpret_cast<grn_obj *>(columns_raw));
+ if (!columns.get()) {
+ char error_message[MRN_MESSAGE_BUFFER_SIZE];
+ snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE,
+ "failed to allocate columns buffer: <%s>: <%s>",
+ table_name, ctx->errbuf);
+ error = HA_ERR_OUT_OF_MEM;
+ my_message(ER_ERROR_ON_WRITE, error_message, MYF(0));
+ GRN_LOG(ctx, GRN_LOG_ERROR, "%s", error_message);
+ DBUG_RETURN(error);
+ }
+
+ grn_table_columns(ctx, table, "", 0, columns.get());
+ grn_table_cursor *cursor = grn_table_cursor_open(ctx,
+ columns.get(),
+ NULL, 0,
+ NULL, 0,
+ 0, -1,
+ 0);
+ if (!cursor) {
+ char error_message[MRN_MESSAGE_BUFFER_SIZE];
+ snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE,
+ "failed to allocate columns cursor: <%s>: <%s>",
+ table_name, ctx->errbuf);
+ error = HA_ERR_OUT_OF_MEM;
+ my_message(ER_ERROR_ON_WRITE, error_message, MYF(0));
+ GRN_LOG(ctx, GRN_LOG_ERROR, "%s", error_message);
+ DBUG_RETURN(error);
+ }
+
+ while (grn_table_cursor_next(ctx, cursor) != GRN_ID_NIL) {
+ void *key;
+ grn_table_cursor_get_key(ctx, cursor, &key);
+ grn_id *id = reinterpret_cast<grn_id *>(key);
+ mrn::SmartGrnObj column(ctx, grn_ctx_at(ctx, *id));
+ if (!column.get()) {
+ continue;
+ }
+
+ grn_operator index_operators[] = {
+ GRN_OP_EQUAL,
+ GRN_OP_MATCH,
+ GRN_OP_LESS,
+ GRN_OP_REGEXP
+ };
+ size_t n_index_operators = sizeof(index_operators) / sizeof(grn_operator);
+ for (size_t i = 0; i < n_index_operators; i++) {
+ grn_index_datum index_datum;
+ while (grn_column_find_index_data(ctx,
+ column.get(),
+ index_operators[i],
+ &index_datum,
+ 1) > 0) {
+ grn_id index_table_id = index_datum.index->header.domain;
+ mrn::SmartGrnObj index_table(ctx, grn_ctx_at(ctx, index_table_id));
+ char index_table_name[GRN_TABLE_MAX_KEY_SIZE];
+ int index_table_name_length;
+ index_table_name_length = grn_obj_name(ctx, index_table.get(),
+ index_table_name,
+ GRN_TABLE_MAX_KEY_SIZE);
+ if (mrn::IndexTableName::is_custom_name(table_name,
+ strlen(table_name),
+ index_table_name,
+ index_table_name_length)) {
+ char index_column_name[GRN_TABLE_MAX_KEY_SIZE];
+ int index_column_name_length;
+ index_column_name_length = grn_obj_name(ctx,
+ index_datum.index,
+ index_column_name,
+ GRN_TABLE_MAX_KEY_SIZE);
+ grn_rc rc = grn_obj_remove(ctx, index_datum.index);
+ if (rc != GRN_SUCCESS) {
+ char error_message[MRN_MESSAGE_BUFFER_SIZE];
+ snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE,
+ "failed to drop index column: <%.*s>: <%s>",
+ index_column_name_length, index_column_name,
+ ctx->errbuf);
+ error = ER_ERROR_ON_WRITE;
+ my_message(error, error_message, MYF(0));
+ GRN_LOG(ctx, GRN_LOG_ERROR, "%s", error_message);
+ }
+ } else {
+ grn_rc rc = grn_obj_remove(ctx, index_table.get());
+ if (rc == GRN_SUCCESS) {
+ index_table.release();
+ } else {
+ char error_message[MRN_MESSAGE_BUFFER_SIZE];
+ snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE,
+ "failed to drop index table: <%.*s>: <%s>",
+ index_table_name_length, index_table_name,
+ ctx->errbuf);
+ error = ER_ERROR_ON_WRITE;
+ my_message(error, error_message, MYF(0));
+ GRN_LOG(ctx, GRN_LOG_ERROR, "%s", error_message);
+ }
+ }
+
+ if (error != 0) {
+ break;
+ }
+ }
+
+ if (error != 0) {
+ break;
+ }
+ }
+
+ if (error != 0) {
+ break;
+ }
+ }
+
+ grn_table_cursor_close(ctx, cursor);
+
+ DBUG_RETURN(error);
+}
+
+int ha_mroonga::drop_indexes_multiple(const char *table_name, grn_obj *table)
+{
+ MRN_DBUG_ENTER_METHOD();
+
+ int error = 0;
+
+ char index_table_name_prefix[GRN_TABLE_MAX_KEY_SIZE];
+ snprintf(index_table_name_prefix, GRN_TABLE_MAX_KEY_SIZE,
+ "%s%s", table_name, mrn::IndexTableName::SEPARATOR);
+ grn_table_cursor *cursor =
+ grn_table_cursor_open(ctx,
+ grn_ctx_db(ctx),
+ index_table_name_prefix,
+ strlen(index_table_name_prefix),
+ NULL, 0,
+ 0, -1,
+ GRN_CURSOR_PREFIX);
+ if (!cursor) {
+ char error_message[MRN_MESSAGE_BUFFER_SIZE];
+ snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE,
+ "failed to allocate index tables cursor: <%s>: <%s>",
+ table_name, ctx->errbuf);
+ error = HA_ERR_OUT_OF_MEM;
+ my_message(ER_ERROR_ON_WRITE, error_message, MYF(0));
+ GRN_LOG(ctx, GRN_LOG_ERROR, "%s", error_message);
+ DBUG_RETURN(error);
+ }
+
+ grn_id table_id = grn_obj_id(ctx, table);
+ grn_id id;
+ while ((id = grn_table_cursor_next(ctx, cursor)) != GRN_ID_NIL) {
+ mrn::SmartGrnObj object(ctx, grn_ctx_at(ctx, id));
+ if (!object.get()) {
+ continue;
+ }
+ if (!grn_obj_is_table(ctx, object.get())) {
+ continue;
+ }
+
+ char multiple_column_index_table_name[GRN_TABLE_MAX_KEY_SIZE];
+ int multiple_column_index_table_name_length;
+ multiple_column_index_table_name_length =
+ grn_obj_name(ctx,
+ object.get(),
+ multiple_column_index_table_name,
+ GRN_TABLE_MAX_KEY_SIZE);
+
+ char multiple_column_index_name[GRN_TABLE_MAX_KEY_SIZE];
+ snprintf(multiple_column_index_name, GRN_TABLE_MAX_KEY_SIZE,
+ "%.*s.%s",
+ multiple_column_index_table_name_length,
+ multiple_column_index_table_name,
+ INDEX_COLUMN_NAME);
+ mrn::SmartGrnObj index_column(ctx, multiple_column_index_name);
+ if (!index_column.get()) {
+ continue;
+ }
+
+ if (grn_obj_get_range(ctx, index_column.get()) != table_id) {
+ continue;
+ }
+
+ grn_rc rc = grn_obj_remove(ctx, object.get());
+ if (rc == GRN_SUCCESS) {
+ object.release();
+ index_column.release();
+ } else {
+ char error_message[MRN_MESSAGE_BUFFER_SIZE];
+ snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE,
+ "failed to drop multiple column index table: <%.*s>: <%s>",
+ multiple_column_index_table_name_length,
+ multiple_column_index_table_name,
+ ctx->errbuf);
+ error = ER_ERROR_ON_WRITE;
+ my_message(error, error_message, MYF(0));
+ GRN_LOG(ctx, GRN_LOG_ERROR, "%s", error_message);
+ break;
+ }
+ }
+
+ grn_table_cursor_close(ctx, cursor);
+
+ DBUG_RETURN(error);
+}
+
+int ha_mroonga::drop_indexes(const char *table_name)
+{
+ MRN_DBUG_ENTER_METHOD();
+ int error = 0;
+
+ mrn::SmartGrnObj table(ctx, table_name);
+ if (!table.get()) {
+ DBUG_RETURN(0);
+ }
+
+ error = drop_indexes_normal(table_name, table.get());
+ if (error == 0) {
+ error = drop_indexes_multiple(table_name, table.get());
+ }
+
+ DBUG_RETURN(error);
+}
+
+bool ha_mroonga::find_column_flags(Field *field, MRN_SHARE *mrn_share, int i,
+ grn_obj_flags *column_flags)
+{
+ MRN_DBUG_ENTER_METHOD();
+ bool found = false;
+
+#ifdef MRN_SUPPORT_CUSTOM_OPTIONS
+ {
+ const char *names = field->option_struct->flags;
+ if (names) {
+ found = mrn_parse_grn_column_create_flags(ha_thd(),
+ ctx,
+ names,
+ strlen(names),
+ column_flags);
+ DBUG_RETURN(found);
+ }
+ }
+#endif
+
+ if (mrn_share->col_flags[i]) {
+ found = mrn_parse_grn_column_create_flags(ha_thd(),
+ ctx,
+ mrn_share->col_flags[i],
+ mrn_share->col_flags_length[i],
+ column_flags);
+ DBUG_RETURN(found);
+ }
+
+ DBUG_RETURN(found);
+}
+
+grn_obj *ha_mroonga::find_column_type(Field *field, MRN_SHARE *mrn_share, int i,
+ int error_code)
+{
+ MRN_DBUG_ENTER_METHOD();
+
+ const char *grn_type_name = NULL;
+#ifdef MRN_SUPPORT_CUSTOM_OPTIONS
+ grn_type_name = field->option_struct->groonga_type;
+#endif
+ if (!grn_type_name) {
+ grn_type_name = mrn_share->col_type[i];
+ }
+
+ grn_obj *type = NULL;
+ if (grn_type_name) {
+ type = grn_ctx_get(ctx, grn_type_name, -1);
+ if (!type) {
+ char error_message[MRN_BUFFER_SIZE];
+ snprintf(error_message, MRN_BUFFER_SIZE,
+ "unknown custom Groonga type name for <%s> column: <%s>",
+ field->field_name, grn_type_name);
+ GRN_LOG(ctx, GRN_LOG_ERROR, "%s", error_message);
+ my_message(error_code, error_message, MYF(0));
+
+ DBUG_RETURN(NULL);
+ }
+ } else {
+ grn_builtin_type grn_type_id = mrn_grn_type_from_field(ctx, field, false);
+ type = grn_ctx_at(ctx, grn_type_id);
+ }
+
+ DBUG_RETURN(type);
+}
+
+grn_obj *ha_mroonga::find_tokenizer(KEY *key, MRN_SHARE *mrn_share, int i)
+{
+ MRN_DBUG_ENTER_METHOD();
+ grn_obj *tokenizer;
+ const char *tokenizer_name = NULL;
+ uint tokenizer_name_length = 0;
+#ifdef MRN_SUPPORT_CUSTOM_OPTIONS
+ if (key->option_struct->tokenizer) {
+ tokenizer_name = key->option_struct->tokenizer;
+ tokenizer_name_length = strlen(tokenizer_name);
+ }
+#endif
+ if (!tokenizer_name) {
+ tokenizer_name = mrn_share->key_tokenizer[i];
+ tokenizer_name_length = mrn_share->key_tokenizer_length[i];
+ }
+ tokenizer = find_tokenizer(tokenizer_name, tokenizer_name_length);
+ DBUG_RETURN(tokenizer);
+}
+
grn_obj *ha_mroonga::find_tokenizer(const char *name, int name_length)
{
MRN_DBUG_ENTER_METHOD();
@@ -8862,92 +9153,137 @@ grn_obj *ha_mroonga::find_tokenizer(const char *name, int name_length)
if (!tokenizer) {
char message[MRN_BUFFER_SIZE];
sprintf(message,
- "specified fulltext parser <%.*s> doesn't exist. "
- "default fulltext parser <%s> is used instead.",
+ "specified tokenizer for fulltext index <%.*s> doesn't exist. "
+ "The default tokenizer for fulltext index <%s> is used instead.",
name_length, name,
- MRN_PARSER_DEFAULT);
+ MRN_DEFAULT_TOKENIZER);
push_warning(ha_thd(),
MRN_SEVERITY_WARNING, ER_UNSUPPORTED_EXTENSION,
message);
tokenizer = grn_ctx_get(ctx,
- MRN_PARSER_DEFAULT,
- strlen(MRN_PARSER_DEFAULT));
+ MRN_DEFAULT_TOKENIZER,
+ strlen(MRN_DEFAULT_TOKENIZER));
}
if (!tokenizer) {
push_warning(ha_thd(),
MRN_SEVERITY_WARNING, ER_UNSUPPORTED_EXTENSION,
- "couldn't find fulltext parser. "
- "Bigram fulltext parser is used instead.");
+ "couldn't find tokenizer for fulltext index. "
+ "Bigram tokenizer is used instead.");
tokenizer = grn_ctx_at(ctx, GRN_DB_BIGRAM);
}
DBUG_RETURN(tokenizer);
}
-grn_obj *ha_mroonga::find_normalizer(KEY *key_info)
+grn_obj *ha_mroonga::find_normalizer(KEY *key)
+{
+ MRN_DBUG_ENTER_METHOD();
+
+#ifdef MRN_SUPPORT_CUSTOM_OPTIONS
+ if (key->option_struct->normalizer) {
+ grn_obj *normalizer = find_normalizer(key,
+ key->option_struct->normalizer);
+ DBUG_RETURN(normalizer);
+ }
+#endif
+
+ if (key->comment.length > 0) {
+ mrn::ParametersParser parser(key->comment.str,
+ key->comment.length);
+ parser.parse();
+ grn_obj *normalizer = find_normalizer(key, parser["normalizer"]);
+ DBUG_RETURN(normalizer);
+ }
+
+ grn_obj *normalizer = find_normalizer(key, NULL);
+ DBUG_RETURN(normalizer);
+}
+
+grn_obj *ha_mroonga::find_normalizer(KEY *key, const char *name)
{
MRN_DBUG_ENTER_METHOD();
+
grn_obj *normalizer = NULL;
bool use_normalizer = true;
-#if MYSQL_VERSION_ID >= 50500
- if (key_info->comment.length > 0) {
- mrn::ParametersParser parser(key_info->comment.str,
- key_info->comment.length);
- parser.parse();
- const char *normalizer_name = parser["normalizer"];
- if (normalizer_name) {
- if (strcmp(normalizer_name, "none") == 0) {
- use_normalizer = false;
- } else {
- normalizer = grn_ctx_get(ctx, normalizer_name, -1);
- }
+ if (name) {
+ if (strcmp(name, "none") == 0) {
+ use_normalizer = false;
+ } else {
+ normalizer = grn_ctx_get(ctx, name, -1);
}
}
-#endif
if (use_normalizer && !normalizer) {
- Field *field = key_info->key_part[0].field;
+ Field *field = key->key_part[0].field;
mrn::FieldNormalizer field_normalizer(ctx, ha_thd(), field);
normalizer = field_normalizer.find_grn_normalizer();
}
+
DBUG_RETURN(normalizer);
}
-bool ha_mroonga::find_index_column_flags(KEY *key_info, grn_obj_flags *index_column_flags)
+bool ha_mroonga::find_index_column_flags(KEY *key, grn_obj_flags *index_column_flags)
{
MRN_DBUG_ENTER_METHOD();
bool found = false;
-#if MYSQL_VERSION_ID >= 50500
- if (key_info->comment.length > 0) {
- mrn::ParametersParser parser(key_info->comment.str,
- key_info->comment.length);
- parser.parse();
- const char *names = parser["index_flags"];
+
+#ifdef MRN_SUPPORT_CUSTOM_OPTIONS
+ {
+ const char *names = key->option_struct->flags;
if (names) {
found = mrn_parse_grn_index_column_flags(ha_thd(),
ctx,
names,
strlen(names),
index_column_flags);
+ DBUG_RETURN(found);
}
}
#endif
+
+ if (key->comment.length > 0) {
+ mrn::ParametersParser parser(key->comment.str,
+ key->comment.length);
+ parser.parse();
+ const char *names = parser["flags"];
+ if (!names) {
+ // Deprecated. It's for backward compatibility.
+ names = parser["index_flags"];
+ }
+ if (names) {
+ found = mrn_parse_grn_index_column_flags(ha_thd(),
+ ctx,
+ names,
+ strlen(names),
+ index_column_flags);
+ }
+ }
+
DBUG_RETURN(found);
}
-bool ha_mroonga::find_token_filters(KEY *key_info, grn_obj *token_filters)
+bool ha_mroonga::find_token_filters(KEY *key, grn_obj *token_filters)
{
MRN_DBUG_ENTER_METHOD();
bool found = false;
-#if MYSQL_VERSION_ID >= 50500
- if (key_info->comment.length > 0) {
- mrn::ParametersParser parser(key_info->comment.str,
- key_info->comment.length);
+
+#ifdef MRN_SUPPORT_CUSTOM_OPTIONS
+ if (key->option_struct->token_filters) {
+ found = find_token_filters_fill(token_filters,
+ key->option_struct->token_filters,
+ strlen(key->option_struct->token_filters));
+ DBUG_RETURN(found);
+ }
+#endif
+
+ if (key->comment.length > 0) {
+ mrn::ParametersParser parser(key->comment.str,
+ key->comment.length);
parser.parse();
const char *names = parser["token_filters"];
if (names) {
found = find_token_filters_fill(token_filters, names, strlen(names));
}
}
-#endif
+
DBUG_RETURN(found);
}
@@ -9356,8 +9692,8 @@ void ha_mroonga::check_count_skip(key_part_map start_key_part_map,
} else {
DBUG_PRINT("info", ("mroonga: count skip: without fulltext"));
uint key_nr = active_index;
- KEY key_info = table->key_info[key_nr];
- KEY_PART_INFO *key_part = key_info.key_part;
+ KEY *key_info = &(table->key_info[key_nr]);
+ KEY_PART_INFO *key_part = key_info->key_part;
for (where = MRN_SELECT_LEX_GET_WHERE_COND(select_lex);
where;
where = where->next) {
@@ -9386,17 +9722,17 @@ void ha_mroonga::check_count_skip(key_part_map start_key_part_map,
if (field->table != table)
break;
uint j;
- for (j = 0; j < KEY_N_KEY_PARTS(&key_info); j++) {
+ for (j = 0; j < KEY_N_KEY_PARTS(key_info); j++) {
if (key_part[j].field == field)
{
if (!(start_key_part_map >> j) && !(end_key_part_map >> j))
- j = KEY_N_KEY_PARTS(&key_info);
+ j = KEY_N_KEY_PARTS(key_info);
else
i++;
break;
}
}
- if (j >= KEY_N_KEY_PARTS(&key_info))
+ if (j >= KEY_N_KEY_PARTS(key_info))
break;
}
if (i >= select_lex->select_n_where_fields)
@@ -9864,8 +10200,12 @@ int ha_mroonga::generic_store_bulk_datetime(Field *field, grn_obj *buf)
long long int time = time_converter.mysql_time_to_grn_time(&mysql_time,
&truncated);
if (truncated) {
+ if (MRN_ABORT_ON_WARNING(ha_thd())) {
+ error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd());
+ }
field->set_warning(MRN_SEVERITY_WARNING,
- WARN_DATA_TRUNCATED, 1);
+ MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()),
+ 1);
}
grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0);
GRN_TIME_SET(ctx, buf, time);
@@ -9896,8 +10236,12 @@ int ha_mroonga::generic_store_bulk_year(Field *field, grn_obj *buf)
mrn::TimeConverter time_converter;
long long int time = time_converter.tm_to_grn_time(&date, usec, &truncated);
if (truncated) {
+ if (MRN_ABORT_ON_WARNING(ha_thd())) {
+ error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd());
+ }
field->set_warning(MRN_SEVERITY_WARNING,
- WARN_DATA_TRUNCATED, 1);
+ MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()),
+ 1);
}
grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0);
GRN_TIME_SET(ctx, buf, time);
@@ -9917,8 +10261,12 @@ int ha_mroonga::generic_store_bulk_datetime2(Field *field, grn_obj *buf)
long long int time = time_converter.mysql_time_to_grn_time(&mysql_time,
&truncated);
if (truncated) {
+ if (MRN_ABORT_ON_WARNING(ha_thd())) {
+ error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd());
+ }
field->set_warning(MRN_SEVERITY_WARNING,
- WARN_DATA_TRUNCATED, 1);
+ MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()),
+ 1);
}
grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0);
GRN_TIME_SET(ctx, buf, time);
@@ -9938,8 +10286,12 @@ int ha_mroonga::generic_store_bulk_time2(Field *field, grn_obj *buf)
long long int time = time_converter.mysql_time_to_grn_time(&mysql_time,
&truncated);
if (truncated) {
+ if (MRN_ABORT_ON_WARNING(ha_thd())) {
+ error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd());
+ }
field->set_warning(MRN_SEVERITY_WARNING,
- WARN_DATA_TRUNCATED, 1);
+ MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()),
+ 1);
}
grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0);
GRN_TIME_SET(ctx, buf, time);
@@ -9959,8 +10311,12 @@ int ha_mroonga::generic_store_bulk_new_date(Field *field, grn_obj *buf)
long long int time = time_converter.mysql_time_to_grn_time(&mysql_date,
&truncated);
if (truncated) {
+ if (MRN_ABORT_ON_WARNING(ha_thd())) {
+ error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd());
+ }
field->set_warning(MRN_SEVERITY_WARNING,
- WARN_DATA_TRUNCATED, 1);
+ MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()),
+ 1);
}
grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0);
GRN_TIME_SET(ctx, buf, time);
@@ -10628,8 +10984,8 @@ void ha_mroonga::storage_store_fields(uchar *buf, grn_id record_id)
const char *column_name = field->field_name;
if (ignoring_no_key_columns) {
- KEY key_info = table->s->key_info[active_index];
- if (strcmp(key_info.key_part[0].field->field_name, column_name)) {
+ KEY *key_info = &(table->s->key_info[active_index]);
+ if (strcmp(key_info->key_part[0].field->field_name, column_name)) {
continue;
}
}
@@ -10831,8 +11187,12 @@ int ha_mroonga::storage_encode_key_timestamp(Field *field, const uchar *key,
mrn::TimeConverter time_converter;
time = time_converter.mysql_time_to_grn_time(&mysql_time, &truncated);
if (truncated) {
+ if (MRN_ABORT_ON_WARNING(ha_thd())) {
+ error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd());
+ }
field->set_warning(MRN_SEVERITY_WARNING,
- WARN_DATA_TRUNCATED, 1);
+ MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()),
+ 1);
}
memcpy(buf, &time, 8);
*size = 8;
@@ -10878,8 +11238,12 @@ int ha_mroonga::storage_encode_key_time(Field *field, const uchar *key,
mrn::TimeConverter time_converter;
time = time_converter.mysql_time_to_grn_time(&mysql_time, &truncated);
if (truncated) {
+ if (MRN_ABORT_ON_WARNING(ha_thd())) {
+ error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd());
+ }
field->set_warning(MRN_SEVERITY_WARNING,
- WARN_DATA_TRUNCATED, 1);
+ MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()),
+ 1);
}
#else
int mysql_time = (int)sint3korr(key);
@@ -10913,8 +11277,12 @@ int ha_mroonga::storage_encode_key_year(Field *field, const uchar *key,
long long int time = time_converter.tm_to_grn_time(&datetime, usec,
&truncated);
if (truncated) {
+ if (MRN_ABORT_ON_WARNING(ha_thd())) {
+ error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd());
+ }
field->set_warning(MRN_SEVERITY_WARNING,
- WARN_DATA_TRUNCATED, 1);
+ MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()),
+ 1);
}
memcpy(buf, &time, 8);
*size = 8;
@@ -10962,8 +11330,12 @@ int ha_mroonga::storage_encode_key_datetime(Field *field, const uchar *key,
time = time_converter.tm_to_grn_time(&date, usec, &truncated);
}
if (truncated) {
+ if (MRN_ABORT_ON_WARNING(ha_thd())) {
+ error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd());
+ }
field->set_warning(MRN_SEVERITY_WARNING,
- WARN_DATA_TRUNCATED, 1);
+ MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()),
+ 1);
}
memcpy(buf, &time, 8);
*size = 8;
@@ -10988,8 +11360,12 @@ int ha_mroonga::storage_encode_key_timestamp2(Field *field, const uchar *key,
long long int grn_time = time_converter.mysql_time_to_grn_time(&mysql_time,
&truncated);
if (truncated) {
+ if (MRN_ABORT_ON_WARNING(ha_thd())) {
+ error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd());
+ }
field->set_warning(MRN_SEVERITY_WARNING,
- WARN_DATA_TRUNCATED, 1);
+ MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()),
+ 1);
}
memcpy(buf, &grn_time, 8);
*size = 8;
@@ -11015,8 +11391,12 @@ int ha_mroonga::storage_encode_key_datetime2(Field *field, const uchar *key,
long long int grn_time = time_converter.mysql_time_to_grn_time(&mysql_time,
&truncated);
if (truncated) {
+ if (MRN_ABORT_ON_WARNING(ha_thd())) {
+ error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd());
+ }
field->set_warning(MRN_SEVERITY_WARNING,
- WARN_DATA_TRUNCATED, 1);
+ MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()),
+ 1);
}
memcpy(buf, &grn_time, 8);
*size = 8;
@@ -11042,8 +11422,12 @@ int ha_mroonga::storage_encode_key_time2(Field *field, const uchar *key,
long long int grn_time = time_converter.mysql_time_to_grn_time(&mysql_time,
&truncated);
if (truncated) {
+ if (MRN_ABORT_ON_WARNING(ha_thd())) {
+ error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd());
+ }
field->set_warning(MRN_SEVERITY_WARNING,
- WARN_DATA_TRUNCATED, 1);
+ MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()),
+ 1);
}
memcpy(buf, &grn_time, 8);
*size = 8;
@@ -11212,8 +11596,12 @@ int ha_mroonga::storage_encode_key(Field *field, const uchar *key,
long long int time = time_converter.tm_to_grn_time(&date, usec,
&truncated);
if (truncated) {
+ if (MRN_ABORT_ON_WARNING(ha_thd())) {
+ error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd());
+ }
field->set_warning(MRN_SEVERITY_WARNING,
- WARN_DATA_TRUNCATED, 1);
+ MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()),
+ 1);
}
memcpy(buf, &time, 8);
*size = 8;
@@ -11381,12 +11769,11 @@ int ha_mroonga::reset()
replacing_ = false;
written_by_row_based_binlog = 0;
mrn_lock_type = F_UNLCK;
- mrn_clear_alter_share(thd);
+ mrn_clear_slot_data(thd);
current_ft_item = NULL;
DBUG_RETURN(error);
}
-#ifdef MRN_HANDLER_CLONE_NEED_NAME
handler *ha_mroonga::wrapper_clone(const char *name, MEM_ROOT *mem_root)
{
handler *cloned_handler;
@@ -11426,47 +11813,6 @@ handler *ha_mroonga::clone(const char *name, MEM_ROOT *mem_root)
}
DBUG_RETURN(cloned_handler);
}
-#else
-handler *ha_mroonga::wrapper_clone(MEM_ROOT *mem_root)
-{
- handler *cloned_handler;
- MRN_DBUG_ENTER_METHOD();
- if (!(cloned_handler = get_new_handler(table->s, mem_root,
- table->s->db_type())))
- DBUG_RETURN(NULL);
- ((ha_mroonga *) cloned_handler)->is_clone = true;
- ((ha_mroonga *) cloned_handler)->parent_for_clone = this;
- ((ha_mroonga *) cloned_handler)->mem_root_for_clone = mem_root;
- if (cloned_handler->ha_open(table, table->s->normalized_path.str,
- table->db_stat, HA_OPEN_IGNORE_IF_LOCKED))
- {
- delete cloned_handler;
- DBUG_RETURN(NULL);
- }
- DBUG_RETURN(cloned_handler);
-}
-
-handler *ha_mroonga::storage_clone(MEM_ROOT *mem_root)
-{
- MRN_DBUG_ENTER_METHOD();
- handler *cloned_handler;
- cloned_handler = handler::clone(mem_root);
- DBUG_RETURN(cloned_handler);
-}
-
-handler *ha_mroonga::clone(MEM_ROOT *mem_root)
-{
- MRN_DBUG_ENTER_METHOD();
- handler *cloned_handler;
- if (share->wrapper_mode)
- {
- cloned_handler = wrapper_clone(mem_root);
- } else {
- cloned_handler = storage_clone(mem_root);
- }
- DBUG_RETURN(cloned_handler);
-}
-#endif
uint8 ha_mroonga::wrapper_table_cache_type()
{
@@ -11511,8 +11857,8 @@ ha_rows ha_mroonga::wrapper_multi_range_read_info_const(uint keyno,
{
MRN_DBUG_ENTER_METHOD();
ha_rows rows;
- KEY key_info = table->key_info[keyno];
- if (mrn_is_geo_key(&key_info)) {
+ KEY *key_info = &(table->key_info[keyno]);
+ if (mrn_is_geo_key(key_info)) {
rows = handler::multi_range_read_info_const(keyno, seq, seq_init_param,
n_ranges, bufsz, flags, cost);
DBUG_RETURN(rows);
@@ -11577,8 +11923,8 @@ ha_rows ha_mroonga::wrapper_multi_range_read_info(uint keyno, uint n_ranges,
{
MRN_DBUG_ENTER_METHOD();
ha_rows rows;
- KEY key_info = table->key_info[keyno];
- if (mrn_is_geo_key(&key_info)) {
+ KEY *key_info = &(table->key_info[keyno]);
+ if (mrn_is_geo_key(key_info)) {
rows = handler::multi_range_read_info(keyno, n_ranges, keys,
#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS
key_parts,
@@ -11651,8 +11997,8 @@ int ha_mroonga::wrapper_multi_range_read_init(RANGE_SEQ_IF *seq,
{
MRN_DBUG_ENTER_METHOD();
int error = 0;
- KEY key_info = table->key_info[active_index];
- if (mrn_is_geo_key(&key_info)) {
+ KEY *key_info = &(table->key_info[active_index]);
+ if (mrn_is_geo_key(key_info)) {
error = handler::multi_range_read_init(seq, seq_init_param,
n_ranges, mode, buf);
DBUG_RETURN(error);
@@ -11700,8 +12046,8 @@ int ha_mroonga::wrapper_multi_range_read_next(range_id_t *range_info)
{
MRN_DBUG_ENTER_METHOD();
int error = 0;
- KEY key_info = table->key_info[active_index];
- if (mrn_is_geo_key(&key_info)) {
+ KEY *key_info = &(table->key_info[active_index]);
+ if (mrn_is_geo_key(key_info)) {
error = handler::multi_range_read_next(range_info);
DBUG_RETURN(error);
}
@@ -11743,8 +12089,8 @@ int ha_mroonga::wrapper_read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
{
int error = 0;
MRN_DBUG_ENTER_METHOD();
- KEY key_info = table->key_info[active_index];
- if (mrn_is_geo_key(&key_info)) {
+ KEY *key_info = &(table->key_info[active_index]);
+ if (mrn_is_geo_key(key_info)) {
error = handler::read_multi_range_first(found_range_p, ranges,
range_count, sorted, buffer);
DBUG_RETURN(error);
@@ -11795,8 +12141,8 @@ int ha_mroonga::wrapper_read_multi_range_next(KEY_MULTI_RANGE **found_range_p)
{
int error = 0;
MRN_DBUG_ENTER_METHOD();
- KEY key_info = table->key_info[active_index];
- if (mrn_is_geo_key(&key_info)) {
+ KEY *key_info = &(table->key_info[active_index]);
+ if (mrn_is_geo_key(key_info)) {
error = handler::read_multi_range_next(found_range_p);
DBUG_RETURN(error);
}
@@ -11970,9 +12316,9 @@ int ha_mroonga::wrapper_delete_all_rows()
uint i;
uint n_keys = table->s->keys;
for (i = 0; i < n_keys; i++) {
- KEY key_info = table->key_info[i];
+ KEY *key_info = &(table->key_info[i]);
- if (!(wrapper_is_target_index(&key_info))) {
+ if (!(wrapper_is_target_index(key_info))) {
continue;
}
@@ -12016,7 +12362,6 @@ int ha_mroonga::delete_all_rows()
DBUG_RETURN(error);
}
-#ifdef MRN_HANDLER_HAVE_TRUNCATE
int ha_mroonga::wrapper_truncate()
{
int error = 0;
@@ -12033,7 +12378,6 @@ int ha_mroonga::wrapper_truncate()
DBUG_RETURN(error);
}
-#endif
int ha_mroonga::wrapper_truncate_index()
{
@@ -12055,9 +12399,9 @@ int ha_mroonga::wrapper_truncate_index()
uint i;
uint n_keys = table->s->keys;
for (i = 0; i < n_keys; i++) {
- KEY key_info = table->key_info[i];
+ KEY *key_info = &(table->key_info[i]);
- if (!(wrapper_is_target_index(&key_info))) {
+ if (!(wrapper_is_target_index(key_info))) {
continue;
}
@@ -12130,11 +12474,11 @@ int ha_mroonga::storage_truncate_index()
continue;
}
- KEY key_info = table->key_info[i];
+ KEY *key_info = &(table->key_info[i]);
if (
- !(key_info.flags & HA_NOSAME) &&
- (KEY_N_KEY_PARTS(&key_info) == 1 || (key_info.flags & HA_FULLTEXT))
+ !(key_info->flags & HA_NOSAME) &&
+ (KEY_N_KEY_PARTS(key_info) == 1 || (key_info->flags & HA_FULLTEXT))
) {
continue;
}
@@ -12155,7 +12499,6 @@ err:
DBUG_RETURN(error);
}
-#ifdef MRN_HANDLER_HAVE_TRUNCATE
int ha_mroonga::truncate()
{
MRN_DBUG_ENTER_METHOD();
@@ -12168,7 +12511,6 @@ int ha_mroonga::truncate()
}
DBUG_RETURN(error);
}
-#endif
double ha_mroonga::wrapper_scan_time()
{
@@ -12207,8 +12549,8 @@ double ha_mroonga::wrapper_read_time(uint index, uint ranges, ha_rows rows)
double res;
MRN_DBUG_ENTER_METHOD();
if (index < MAX_KEY) {
- KEY key_info = table->key_info[index];
- if (mrn_is_geo_key(&key_info)) {
+ KEY *key_info = &(table->key_info[index]);
+ if (mrn_is_geo_key(key_info)) {
res = handler::read_time(index, ranges, rows);
DBUG_RETURN(res);
}
@@ -12387,16 +12729,14 @@ int ha_mroonga::wrapper_rename_table(const char *from, const char *to,
int error = 0;
handler *hnd;
MRN_DBUG_ENTER_METHOD();
- MRN_SET_WRAP_SHARE_KEY(tmp_share, tmp_share->table_share);
- if (!(hnd =
- tmp_share->hton->create(tmp_share->hton, tmp_share->table_share,
- current_thd->mem_root)))
+
+ hnd = get_new_handler(tmp_share->table_share,
+ current_thd->mem_root,
+ tmp_share->hton);
+ if (!hnd)
{
- MRN_SET_BASE_SHARE_KEY(tmp_share, tmp_share->table_share);
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
- hnd->init();
- MRN_SET_BASE_SHARE_KEY(tmp_share, tmp_share->table_share);
if ((error = hnd->ha_rename_table(from, to)))
{
@@ -12610,17 +12950,11 @@ int ha_mroonga::rename_table(const char *from, const char *to)
if (strcmp(from_mapper.db_name(), to_mapper.db_name()))
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
-#ifdef MRN_TABLE_LIST_INIT_REQUIRE_ALIAS
table_list.init_one_table(from_mapper.db_name(),
strlen(from_mapper.db_name()),
from_mapper.mysql_table_name(),
strlen(from_mapper.mysql_table_name()),
from_mapper.mysql_table_name(), TL_WRITE);
-#else
- table_list.init_one_table(from_mapper.db_name(),
- from_mapper.mysql_table_name(),
- TL_WRITE);
-#endif
mrn_open_mutex_lock(NULL);
tmp_table_share = mrn_create_tmp_table_share(&table_list, from, &error);
mrn_open_mutex_unlock(NULL);
@@ -12650,21 +12984,20 @@ int ha_mroonga::rename_table(const char *from, const char *to)
to_mapper.table_name());
}
+ if (!error && to_mapper.table_name()[0] == '#') {
+ error = add_wrap_hton(to, tmp_share->hton);
+ } else if (error && from_mapper.table_name()[0] == '#') {
+ add_wrap_hton(from, tmp_share->hton);
+ }
if (!error) {
mrn_free_long_term_share(tmp_share->long_term_share);
tmp_share->long_term_share = NULL;
}
mrn_free_share(tmp_share);
- if (!error && to_mapper.table_name()[0] == '#') {
- if ((error = alter_share_add(to, tmp_table_share)))
- DBUG_RETURN(error);
- } else if (error && from_mapper.table_name()[0] == '#') {
- alter_share_add(from, tmp_table_share);
- } else {
- mrn_open_mutex_lock(NULL);
- mrn_free_tmp_table_share(tmp_table_share);
- mrn_open_mutex_unlock(NULL);
- }
+ mrn_open_mutex_lock(NULL);
+ mrn_free_tmp_table_share(tmp_table_share);
+ mrn_open_mutex_unlock(NULL);
+
DBUG_RETURN(error);
}
@@ -13669,6 +14002,7 @@ enum_alter_inplace_result ha_mroonga::wrapper_check_if_supported_inplace_alter(
}
memcpy(wrap_altered_table, altered_table, sizeof(TABLE));
memcpy(wrap_altered_table_share, altered_table->s, sizeof(TABLE_SHARE));
+ mrn_init_sql_alloc(ha_thd(), &(wrap_altered_table_share->mem_root));
n_keys = ha_alter_info->index_drop_count;
for (i = 0; i < n_keys; ++i) {
@@ -13785,6 +14119,25 @@ bool ha_mroonga::wrapper_prepare_inplace_alter_table(
if (!alter_handler_flags) {
DBUG_RETURN(false);
}
+
+#ifdef MRN_SUPPORT_CUSTOM_OPTIONS
+ int error = 0;
+ MRN_SHARE *tmp_share;
+ tmp_share = mrn_get_share(altered_table->s->table_name.str,
+ altered_table,
+ &error);
+ if (error != 0) {
+ DBUG_RETURN(true);
+ }
+
+ if (parse_engine_table_options(ha_thd(),
+ tmp_share->hton,
+ wrap_altered_table->s)) {
+ mrn_free_share(tmp_share);
+ DBUG_RETURN(true);
+ }
+#endif
+
MRN_SET_WRAP_ALTER_KEY(this, ha_alter_info);
MRN_SET_WRAP_SHARE_KEY(share, table->s);
MRN_SET_WRAP_TABLE_KEY(this, table);
@@ -13793,6 +14146,11 @@ bool ha_mroonga::wrapper_prepare_inplace_alter_table(
MRN_SET_BASE_ALTER_KEY(this, ha_alter_info);
MRN_SET_BASE_SHARE_KEY(share, table->s);
MRN_SET_BASE_TABLE_KEY(this, table);
+
+#ifdef MRN_SUPPORT_CUSTOM_OPTIONS
+ mrn_free_share(tmp_share);
+#endif
+
DBUG_RETURN(result);
}
@@ -13857,8 +14215,8 @@ bool ha_mroonga::wrapper_inplace_alter_table(
ha_alter_info->key_count);
MRN_SHARE *tmp_share;
TABLE_SHARE tmp_table_share;
- char **key_parser;
- uint *key_parser_length;
+ char **key_tokenizer;
+ uint *key_tokenizer_length;
KEY *p_key_info = &table->key_info[table_share->primary_key];
bool need_fill_index = false;
memset(index_tables, 0, sizeof(grn_obj *) * ha_alter_info->key_count);
@@ -13868,8 +14226,8 @@ bool ha_mroonga::wrapper_inplace_alter_table(
if (!(tmp_share = (MRN_SHARE *)
mrn_my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
&tmp_share, sizeof(*tmp_share),
- &key_parser, sizeof(char *) * (tmp_table_share.keys),
- &key_parser_length, sizeof(uint) * (tmp_table_share.keys),
+ &key_tokenizer, sizeof(char *) * (tmp_table_share.keys),
+ &key_tokenizer_length, sizeof(uint) * (tmp_table_share.keys),
NullS))
) {
MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables);
@@ -13880,8 +14238,8 @@ bool ha_mroonga::wrapper_inplace_alter_table(
tmp_share->table_share = &tmp_table_share;
tmp_share->index_table = NULL;
tmp_share->index_table_length = NULL;
- tmp_share->key_parser = key_parser;
- tmp_share->key_parser_length = key_parser_length;
+ tmp_share->key_tokenizer = key_tokenizer;
+ tmp_share->key_tokenizer_length = key_tokenizer_length;
bitmap_clear_all(table->read_set);
mrn_set_bitmap_by_key(table->read_set, p_key_info);
n_keys = ha_alter_info->index_add_count;
@@ -13939,14 +14297,32 @@ bool ha_mroonga::wrapper_inplace_alter_table(
bitmap_set_all(table->read_set);
if (!error && alter_handler_flags) {
- MRN_SET_WRAP_ALTER_KEY(this, ha_alter_info);
- MRN_SET_WRAP_SHARE_KEY(share, table->s);
- MRN_SET_WRAP_TABLE_KEY(this, table);
- result = wrap_handler->ha_inplace_alter_table(wrap_altered_table,
- ha_alter_info);
- MRN_SET_BASE_ALTER_KEY(this, ha_alter_info);
- MRN_SET_BASE_SHARE_KEY(share, table->s);
- MRN_SET_BASE_TABLE_KEY(this, table);
+#ifdef MRN_SUPPORT_CUSTOM_OPTIONS
+ {
+ MRN_SHARE *alter_tmp_share;
+ alter_tmp_share = mrn_get_share(altered_table->s->table_name.str,
+ altered_table,
+ &error);
+ if (alter_tmp_share) {
+ if (parse_engine_table_options(ha_thd(),
+ alter_tmp_share->hton,
+ wrap_altered_table->s)) {
+ error = MRN_GET_ERROR_NUMBER;
+ }
+ mrn_free_share(alter_tmp_share);
+ }
+ }
+#endif
+ if (!error) {
+ MRN_SET_WRAP_ALTER_KEY(this, ha_alter_info);
+ MRN_SET_WRAP_SHARE_KEY(share, table->s);
+ MRN_SET_WRAP_TABLE_KEY(this, table);
+ result = wrap_handler->ha_inplace_alter_table(wrap_altered_table,
+ ha_alter_info);
+ MRN_SET_BASE_ALTER_KEY(this, ha_alter_info);
+ MRN_SET_BASE_SHARE_KEY(share, table->s);
+ MRN_SET_BASE_TABLE_KEY(this, table);
+ }
}
if (result || error)
@@ -13954,8 +14330,7 @@ bool ha_mroonga::wrapper_inplace_alter_table(
n_keys = ha_alter_info->index_add_count;
for (i = 0; i < n_keys; ++i) {
uint key_pos = ha_alter_info->index_add_buffer[i];
- KEY *key =
- &altered_table->key_info[key_pos];
+ KEY *key = &altered_table->key_info[key_pos];
if (!(key->flags & HA_FULLTEXT || mrn_is_geo_key(key))) {
continue;
}
@@ -14007,8 +14382,8 @@ bool ha_mroonga::storage_inplace_alter_table_index(
ha_alter_info->key_count);
MRN_SHARE *tmp_share;
TABLE_SHARE tmp_table_share;
- char **index_table, **key_parser, **col_flags, **col_type;
- uint *index_table_length, *key_parser_length, *col_flags_length, *col_type_length;
+ char **index_table, **key_tokenizer, **col_flags, **col_type;
+ uint *index_table_length, *key_tokenizer_length, *col_flags_length, *col_type_length;
bool have_multiple_column_index = false;
memset(index_tables, 0, sizeof(grn_obj *) * ha_alter_info->key_count);
memset(index_columns, 0, sizeof(grn_obj *) * ha_alter_info->key_count);
@@ -14019,8 +14394,8 @@ bool ha_mroonga::storage_inplace_alter_table_index(
&tmp_share, sizeof(*tmp_share),
&index_table, sizeof(char *) * tmp_table_share.keys,
&index_table_length, sizeof(uint) * tmp_table_share.keys,
- &key_parser, sizeof(char *) * tmp_table_share.keys,
- &key_parser_length, sizeof(uint) * tmp_table_share.keys,
+ &key_tokenizer, sizeof(char *) * tmp_table_share.keys,
+ &key_tokenizer_length, sizeof(uint) * tmp_table_share.keys,
&col_flags, sizeof(char *) * tmp_table_share.fields,
&col_flags_length, sizeof(uint) * tmp_table_share.fields,
&col_type, sizeof(char *) * tmp_table_share.fields,
@@ -14035,8 +14410,8 @@ bool ha_mroonga::storage_inplace_alter_table_index(
tmp_share->table_share = &tmp_table_share;
tmp_share->index_table = index_table;
tmp_share->index_table_length = index_table_length;
- tmp_share->key_parser = key_parser;
- tmp_share->key_parser_length = key_parser_length;
+ tmp_share->key_tokenizer = key_tokenizer;
+ tmp_share->key_tokenizer_length = key_tokenizer_length;
tmp_share->col_flags = col_flags;
tmp_share->col_flags_length = col_flags_length;
tmp_share->col_type = col_type;
@@ -14145,8 +14520,8 @@ bool ha_mroonga::storage_inplace_alter_table_add_column(
MRN_SHARE *tmp_share;
TABLE_SHARE tmp_table_share;
- char **index_table, **key_parser, **col_flags, **col_type;
- uint *index_table_length, *key_parser_length, *col_flags_length, *col_type_length;
+ char **index_table, **key_tokenizer, **col_flags, **col_type;
+ uint *index_table_length, *key_tokenizer_length, *col_flags_length, *col_type_length;
tmp_table_share.keys = 0;
tmp_table_share.fields = altered_table->s->fields;
tmp_share = (MRN_SHARE *)mrn_my_multi_malloc(
@@ -14154,8 +14529,8 @@ bool ha_mroonga::storage_inplace_alter_table_add_column(
&tmp_share, sizeof(*tmp_share),
&index_table, sizeof(char *) * tmp_table_share.keys,
&index_table_length, sizeof(uint) * tmp_table_share.keys,
- &key_parser, sizeof(char *) * tmp_table_share.keys,
- &key_parser_length, sizeof(uint) * tmp_table_share.keys,
+ &key_tokenizer, sizeof(char *) * tmp_table_share.keys,
+ &key_tokenizer_length, sizeof(uint) * tmp_table_share.keys,
&col_flags, sizeof(char *) * tmp_table_share.fields,
&col_flags_length, sizeof(uint) * tmp_table_share.fields,
&col_type, sizeof(char *) * tmp_table_share.fields,
@@ -14169,8 +14544,8 @@ bool ha_mroonga::storage_inplace_alter_table_add_column(
tmp_share->table_share = &tmp_table_share;
tmp_share->index_table = index_table;
tmp_share->index_table_length = index_table_length;
- tmp_share->key_parser = key_parser;
- tmp_share->key_parser_length = key_parser_length;
+ tmp_share->key_tokenizer = key_tokenizer;
+ tmp_share->key_tokenizer_length = key_tokenizer_length;
tmp_share->col_flags = col_flags;
tmp_share->col_flags_length = col_flags_length;
tmp_share->col_type = col_type;
@@ -14187,7 +14562,6 @@ bool ha_mroonga::storage_inplace_alter_table_add_column(
continue;
}
- grn_obj *col_type;
Field *field = altered_table->s->field[i];
const char *column_name = field->field_name;
int column_name_size = strlen(column_name);
@@ -14199,20 +14573,19 @@ bool ha_mroonga::storage_inplace_alter_table_add_column(
}
grn_obj_flags col_flags = GRN_OBJ_PERSISTENT;
- if (tmp_share->col_flags[i]) {
- col_flags |= mrn_parse_grn_column_create_flags(ha_thd(),
- ctx,
- tmp_share->col_flags[i],
- tmp_share->col_flags_length[i]);
- } else {
+ if (!find_column_flags(field, tmp_share, i, &col_flags)) {
col_flags |= GRN_OBJ_COLUMN_SCALAR;
}
- grn_builtin_type gtype = mrn_grn_type_from_field(ctx, field, false);
- if (tmp_share->col_type[i]) {
- col_type = grn_ctx_get(ctx, tmp_share->col_type[i], -1);
- } else {
- col_type = grn_ctx_at(ctx, gtype);
+ grn_obj *col_type;
+ {
+ int column_type_error_code = ER_WRONG_FIELD_SPEC;
+ col_type = find_column_type(field, tmp_share, i, column_type_error_code);
+ if (!col_type) {
+ error = column_type_error_code;
+ have_error = true;
+ break;
+ }
}
char *col_path = NULL; // we don't specify path
@@ -14418,6 +14791,7 @@ bool ha_mroonga::wrapper_commit_inplace_alter_table(
bool result;
MRN_DBUG_ENTER_METHOD();
if (!alter_handler_flags) {
+ free_root(&(wrap_altered_table_share->mem_root), MYF(0));
my_free(alter_key_info_buffer);
alter_key_info_buffer = NULL;
DBUG_RETURN(false);
@@ -14431,6 +14805,7 @@ bool ha_mroonga::wrapper_commit_inplace_alter_table(
MRN_SET_BASE_ALTER_KEY(this, ha_alter_info);
MRN_SET_BASE_SHARE_KEY(share, table->s);
MRN_SET_BASE_TABLE_KEY(this, table);
+ free_root(&(wrap_altered_table_share->mem_root), MYF(0));
my_free(alter_key_info_buffer);
alter_key_info_buffer = NULL;
DBUG_RETURN(result);
@@ -14538,8 +14913,8 @@ int ha_mroonga::wrapper_add_index(TABLE *table_arg, KEY *key_info,
THD *thd = ha_thd();
MRN_SHARE *tmp_share;
TABLE_SHARE tmp_table_share;
- char **key_parser;
- uint *key_parser_length;
+ char **key_tokenizer;
+ uint *key_tokenizer_length;
MRN_DBUG_ENTER_METHOD();
if (!(wrap_alter_key_info = (KEY *) mrn_my_malloc(sizeof(KEY) * num_of_keys,
MYF(MY_WME)))) {
@@ -14553,8 +14928,8 @@ int ha_mroonga::wrapper_add_index(TABLE *table_arg, KEY *key_info,
if (!(tmp_share = (MRN_SHARE *)
mrn_my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
&tmp_share, sizeof(*tmp_share),
- &key_parser, sizeof(char *) * (n_keys + num_of_keys),
- &key_parser_length, sizeof(uint) * (n_keys + num_of_keys),
+ &key_tokenizer, sizeof(char *) * (n_keys + num_of_keys),
+ &key_tokenizer_length, sizeof(uint) * (n_keys + num_of_keys),
NullS))
) {
MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables);
@@ -14565,8 +14940,8 @@ int ha_mroonga::wrapper_add_index(TABLE *table_arg, KEY *key_info,
tmp_share->table_share = &tmp_table_share;
tmp_share->index_table = NULL;
tmp_share->index_table_length = NULL;
- tmp_share->key_parser = key_parser;
- tmp_share->key_parser_length = key_parser_length;
+ tmp_share->key_tokenizer = key_tokenizer;
+ tmp_share->key_tokenizer_length = key_tokenizer_length;
tmp_share->col_flags = NULL;
tmp_share->col_type = NULL;
#ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX
@@ -14677,8 +15052,8 @@ int ha_mroonga::storage_add_index(TABLE *table_arg, KEY *key_info,
MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_columns, num_of_keys + n_keys);
MRN_SHARE *tmp_share;
TABLE_SHARE tmp_table_share;
- char **index_table, **key_parser, **col_flags, **col_type;
- uint *index_table_length, *key_parser_length, *col_flags_length, *col_type_length;
+ char **index_table, **key_tokenizer, **col_flags, **col_type;
+ uint *index_table_length, *key_tokenizer_length, *col_flags_length, *col_type_length;
bool have_multiple_column_index = false;
MRN_DBUG_ENTER_METHOD();
@@ -14689,8 +15064,8 @@ int ha_mroonga::storage_add_index(TABLE *table_arg, KEY *key_info,
&tmp_share, sizeof(*tmp_share),
&index_table, sizeof(char*) * tmp_table_share.keys,
&index_table_length, sizeof(uint) * tmp_table_share.keys,
- &key_parser, sizeof(char *) * tmp_table_share.keys,
- &key_parser_length, sizeof(uint) * tmp_table_share.keys,
+ &key_tokenizer, sizeof(char *) * tmp_table_share.keys,
+ &key_tokenizer_length, sizeof(uint) * tmp_table_share.keys,
&col_flags, sizeof(char *) * tmp_table_share.fields,
&col_flags_length, sizeof(uint) * tmp_table_share.fields,
&col_type, sizeof(char *) * tmp_table_share.fields,
@@ -14705,8 +15080,8 @@ int ha_mroonga::storage_add_index(TABLE *table_arg, KEY *key_info,
tmp_share->table_share = &tmp_table_share;
tmp_share->index_table = index_table;
tmp_share->index_table_length = index_table_length;
- tmp_share->key_parser = key_parser;
- tmp_share->key_parser_length = key_parser_length;
+ tmp_share->key_tokenizer = key_tokenizer;
+ tmp_share->key_tokenizer_length = key_tokenizer_length;
tmp_share->col_flags = col_flags;
tmp_share->col_flags_length = col_flags_length;
tmp_share->col_type = col_type;
@@ -15238,11 +15613,11 @@ int ha_mroonga::reset_auto_increment(ulonglong value)
void ha_mroonga::set_pk_bitmap()
{
- KEY key_info = table->key_info[table_share->primary_key];
- uint j;
MRN_DBUG_ENTER_METHOD();
- for (j = 0; j < KEY_N_KEY_PARTS(&key_info); j++) {
- Field *field = key_info.key_part[j].field;
+ KEY *key_info = &(table->key_info[table_share->primary_key]);
+ uint j;
+ for (j = 0; j < KEY_N_KEY_PARTS(key_info); j++) {
+ Field *field = key_info->key_part[j].field;
bitmap_set_bit(table->read_set, field->field_index);
}
DBUG_VOID_RETURN;
@@ -15556,17 +15931,11 @@ char *ha_mroonga::storage_get_foreign_key_create_info()
build_table_filename(ref_path, sizeof(ref_path) - 1,
table_share->db.str, ref_table_buff, "", 0);
DBUG_PRINT("info", ("mroonga: ref_path=%s", ref_path));
-#ifdef MRN_TABLE_LIST_INIT_REQUIRE_ALIAS
table_list.init_one_table(table_share->db.str,
table_share->db.length,
ref_table_buff,
ref_table_name_length,
ref_table_buff, TL_WRITE);
-#else
- table_list.init_one_table(table_share->db.str,
- ref_table_buff,
- TL_WRITE);
-#endif
mrn_open_mutex_lock(table_share);
tmp_ref_table_share =
mrn_create_tmp_table_share(&table_list, ref_path, &error);
@@ -15768,17 +16137,11 @@ int ha_mroonga::storage_get_foreign_key_list(THD *thd,
build_table_filename(ref_path, sizeof(ref_path) - 1,
table_share->db.str, ref_table_buff, "", 0);
DBUG_PRINT("info", ("mroonga: ref_path=%s", ref_path));
-#ifdef MRN_TABLE_LIST_INIT_REQUIRE_ALIAS
table_list.init_one_table(table_share->db.str,
table_share->db.length,
ref_table_buff,
ref_table_name_length,
ref_table_buff, TL_WRITE);
-#else
- table_list.init_one_table(table_share->db.str,
- ref_table_buff,
- TL_WRITE);
-#endif
mrn_open_mutex_lock(table_share);
tmp_ref_table_share =
mrn_create_tmp_table_share(&table_list, ref_path, &error);
@@ -15831,7 +16194,6 @@ int ha_mroonga::get_foreign_key_list(THD *thd,
DBUG_RETURN(res);
}
-#ifdef MRN_HANDLER_HAVE_GET_PARENT_FOREIGN_KEY_LIST
int ha_mroonga::wrapper_get_parent_foreign_key_list(THD *thd,
List<FOREIGN_KEY_INFO> *f_key_list)
{
@@ -15866,7 +16228,6 @@ int ha_mroonga::get_parent_foreign_key_list(THD *thd,
}
DBUG_RETURN(res);
}
-#endif
uint ha_mroonga::wrapper_referenced_by_foreign_key()
{
diff --git a/storage/mroonga/ha_mroonga.hpp b/storage/mroonga/ha_mroonga.hpp
index 78d5c3d2465..37059210dd1 100644
--- a/storage/mroonga/ha_mroonga.hpp
+++ b/storage/mroonga/ha_mroonga.hpp
@@ -33,18 +33,11 @@ extern "C" {
#include <groonga.h>
#include "mrn_mysql_compat.h"
-#if (MYSQL_VERSION_ID >= 50603) || \
- (MYSQL_VERSION_ID >= 50513 && MYSQL_VERSION_ID < 50600) || \
- (MYSQL_VERSION_ID >= 50158 && MYSQL_VERSION_ID < 50500)
-# define MRN_HANDLER_CLONE_NEED_NAME 1
-#endif
-
#if (MYSQL_VERSION_ID >= 50514 && MYSQL_VERSION_ID < 50600)
# define MRN_HANDLER_HAVE_FINAL_ADD_INDEX 1
#endif
-#if (MYSQL_VERSION_ID >= 50603) || \
- (defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 50209)
+#if (MYSQL_VERSION_ID >= 50603) || defined(MRN_MARIADB_P)
# define MRN_HANDLER_HAVE_HA_RND_NEXT 1
# define MRN_HANDLER_HAVE_HA_RND_POS 1
# define MRN_HANDLER_HAVE_HA_INDEX_READ_MAP 1
@@ -56,8 +49,7 @@ extern "C" {
# define MRN_HANDLER_HAVE_HA_INDEX_NEXT_SAME 1
#endif
-#if (MYSQL_VERSION_ID >= 50604) || \
- (defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 50302)
+#if (MYSQL_VERSION_ID >= 50604) || defined(MRN_MARIADB_P)
# define MRN_HANDLER_HAVE_HA_CLOSE 1
# define MRN_HANDLER_HAVE_MULTI_RANGE_READ 1
#endif
@@ -77,15 +69,10 @@ extern "C" {
# endif
#endif
-#if (defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 50302)
+#ifdef MRN_MARIADB_P
# define MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS
#endif
-#if MYSQL_VERSION_ID >= 50500
-# define MRN_HANDLER_HAVE_TRUNCATE
-# define MRN_HANDLER_HAVE_GET_PARENT_FOREIGN_KEY_LIST
-#endif
-
#if MYSQL_VERSION_ID < 50600
# define MRN_HANDLER_HAVE_GET_TABLESPACE_NAME
#endif
@@ -94,10 +81,6 @@ extern "C" {
# define MRN_HANDLER_HAVE_SET_HA_SHARE_REF
#endif
-#if MYSQL_VERSION_ID >= 50500
-# define MRN_TABLE_LIST_INIT_REQUIRE_ALIAS
-#endif
-
#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
# define MRN_BIG_TABLES
#elif defined(BIG_TABLES)
@@ -110,17 +93,10 @@ extern "C" {
# define MRN_HA_ROWS_FORMAT "lu"
#endif
-#if (MYSQL_VERSION_ID < 50519) || \
- defined(MRN_MARIADB_P) || \
- (50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID < 50604)
+#ifdef MRN_MARIADB_P
# define MRN_NEED_FREE_STRING_MEMALLOC_PLUGIN_VAR
#endif
-#if MYSQL_VERSION_ID >= 50500
-# define MRN_HAVE_HA_EXTRA_ADD_CHILDREN_LIST
-# define MRN_HAVE_HA_EXTRA_IS_ATTACHED_CHILDREN
-#endif
-
#ifdef MRN_MARIADB_P
# define MRN_HAVE_HA_EXTRA_DETACH_CHILD
# define MRN_HAVE_HA_EXTRA_PREPARE_FOR_FORCED_CLOSE
@@ -147,10 +123,6 @@ extern "C" {
# define MRN_FIELD_STORE_TIME_NEED_TYPE
#endif
-#if MYSQL_VERSION_ID < 50500
-# define MRN_HAVE_TL_WRITE_ALLOW_READ
-#endif
-
#if MYSQL_VERSION_ID < 50706 || defined(MRN_MARIADB_P)
# define MRN_HAVE_TL_WRITE_DELAYED
#endif
@@ -159,9 +131,7 @@ extern "C" {
# define MRN_HAVE_TL_WRITE_CONCURRENT_DEFAULT
#endif
-#if (defined(MRN_MARIADB_P) && \
- ((MYSQL_VERSION_ID >= 50306 && MYSQL_VERSION_ID < 50500) || \
- MYSQL_VERSION_ID >= 50523))
+#ifdef MRN_MARIADB_P
# define MRN_HANDLER_AUTO_REPAIR_HAVE_ERROR
#endif
@@ -191,6 +161,9 @@ extern "C" {
#if (defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100010)
# define MRN_HAVE_TDC_LOCK_TABLE_SHARE
+# if MYSQL_VERSION_ID >= 100100
+# define MRN_TABLE_SHARE_TDC_IS_POINTER
+# endif
#endif
#ifdef MRN_MARIADB_P
@@ -256,6 +229,22 @@ struct st_mrn_ft_info
ha_mroonga *mroonga;
};
+#ifdef MRN_SUPPORT_CUSTOM_OPTIONS
+struct ha_field_option_struct
+{
+ const char *groonga_type;
+ const char *flags;
+};
+
+struct ha_index_option_struct
+{
+ const char *tokenizer;
+ const char *normalizer;
+ const char *token_filters;
+ const char *flags;
+};
+#endif
+
/* handler class */
class ha_mroonga: public handler
{
@@ -446,11 +435,7 @@ public:
int reset();
-#ifdef MRN_HANDLER_CLONE_NEED_NAME
handler *clone(const char *name, MEM_ROOT *mem_root);
-#else
- handler *clone(MEM_ROOT *mem_root);
-#endif
uint8 table_cache_type();
#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ
ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
@@ -481,9 +466,7 @@ public:
#endif
int end_bulk_insert();
int delete_all_rows();
-#ifdef MRN_HANDLER_HAVE_TRUNCATE
int truncate();
-#endif // MRN_HANDLER_HAVE_TRUNCATE
double scan_time();
double read_time(uint index, uint ranges, ha_rows rows);
const key_map *keys_to_use_for_scanning();
@@ -567,9 +550,7 @@ protected:
#endif
bool can_switch_engines();
int get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list);
-#ifdef MRN_HANDLER_HAVE_GET_PARENT_FOREIGN_KEY_LIST
int get_parent_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list);
-#endif
uint referenced_by_foreign_key();
void init_table_handle_for_HANDLER();
void free_foreign_key_create_info(char* str);
@@ -597,6 +578,8 @@ private:
void mkdir_p(const char *directory);
ulonglong file_size(const char *path);
+ bool have_unique_index();
+
void push_warning_unsupported_spatial_index_search(enum ha_rkey_function flag);
void clear_cursor();
void clear_cursor_geo();
@@ -604,14 +587,23 @@ private:
void clear_search_result();
void clear_search_result_geo();
void clear_indexes();
- int alter_share_add(const char *path, TABLE_SHARE *table_share);
+ int add_wrap_hton(const char *path, handlerton *wrap_handlerton);
void remove_related_files(const char *base_path);
void remove_grn_obj_force(const char *name);
int drop_index(MRN_SHARE *target_share, uint key_index);
+ int drop_indexes_normal(const char *table_name, grn_obj *table);
+ int drop_indexes_multiple(const char *table_name, grn_obj *table);
+ int drop_indexes(const char *table_name);
+ bool find_column_flags(Field *field, MRN_SHARE *mrn_share, int i,
+ grn_obj_flags *column_flags);
+ grn_obj *find_column_type(Field *field, MRN_SHARE *mrn_share, int i,
+ int error_code);
+ grn_obj *find_tokenizer(KEY *key, MRN_SHARE *mrn_share, int i);
grn_obj *find_tokenizer(const char *name, int name_length);
- grn_obj *find_normalizer(KEY *key_info);
- bool find_index_column_flags(KEY *key_info, grn_obj_flags *index_column_flags);
- bool find_token_filters(KEY *key_info, grn_obj *token_filters);
+ grn_obj *find_normalizer(KEY *key);
+ grn_obj *find_normalizer(KEY *key, const char *name);
+ bool find_index_column_flags(KEY *key, grn_obj_flags *index_column_flags);
+ bool find_token_filters(KEY *key, grn_obj *token_filters);
bool find_token_filters_put(grn_obj *token_filters,
const char *token_filter_name,
int token_filter_name_length);
@@ -788,12 +780,9 @@ private:
int close_databases();
int ensure_database_open(const char *name);
int ensure_database_remove(const char *name);
- int wrapper_delete_table(const char *name, MRN_SHARE *tmp_share,
- const char *table_name);
- int wrapper_delete_index(const char *name, MRN_SHARE *tmp_share,
- const char *table_name);
- int storage_delete_table(const char *name, MRN_SHARE *tmp_share,
+ int wrapper_delete_table(const char *name, handlerton *wrap_handlerton,
const char *table_name);
+ int generic_delete_table(const char *name, const char *table_name);
int wrapper_open(const char *name, int mode, uint test_if_locked);
int wrapper_open_indexes(const char *name);
int storage_open(const char *name, int mode, uint test_if_locked);
@@ -987,13 +976,8 @@ private:
void storage_cond_pop();
bool wrapper_get_error_message(int error, String *buf);
bool storage_get_error_message(int error, String *buf);
-#ifdef MRN_HANDLER_CLONE_NEED_NAME
handler *wrapper_clone(const char *name, MEM_ROOT *mem_root);
handler *storage_clone(const char *name, MEM_ROOT *mem_root);
-#else
- handler *wrapper_clone(MEM_ROOT *mem_root);
- handler *storage_clone(MEM_ROOT *mem_root);
-#endif
uint8 wrapper_table_cache_type();
uint8 storage_table_cache_type();
#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ
@@ -1049,9 +1033,7 @@ private:
const char *function_name);
int wrapper_delete_all_rows();
int storage_delete_all_rows();
-#ifdef MRN_HANDLER_HAVE_TRUNCATE
int wrapper_truncate();
-#endif // MRN_HANDLER_HAVE_TRUNCATE
int wrapper_truncate_index();
int storage_truncate();
int storage_truncate_index();
@@ -1216,10 +1198,8 @@ private:
bool storage_can_switch_engines();
int wrapper_get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list);
int storage_get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list);
-#ifdef MRN_HANDLER_HAVE_GET_PARENT_FOREIGN_KEY_LIST
int wrapper_get_parent_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list);
int storage_get_parent_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list);
-#endif
uint wrapper_referenced_by_foreign_key();
uint storage_referenced_by_foreign_key();
void wrapper_init_table_handle_for_HANDLER();
diff --git a/storage/mroonga/lib/mrn_condition_converter.cpp b/storage/mroonga/lib/mrn_condition_converter.cpp
index 1bfae1d4f8a..1527a546938 100644
--- a/storage/mroonga/lib/mrn_condition_converter.cpp
+++ b/storage/mroonga/lib/mrn_condition_converter.cpp
@@ -17,10 +17,6 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
#include "mrn_condition_converter.hpp"
#include "mrn_time_converter.hpp"
#include "mrn_smart_grn_obj.hpp"
diff --git a/storage/mroonga/lib/mrn_condition_converter.hpp b/storage/mroonga/lib/mrn_condition_converter.hpp
index bb85f5cdef5..3a7fbd048dc 100644
--- a/storage/mroonga/lib/mrn_condition_converter.hpp
+++ b/storage/mroonga/lib/mrn_condition_converter.hpp
@@ -20,11 +20,12 @@
#ifndef MRN_CONDITION_CONVERTER_HPP_
#define MRN_CONDITION_CONVERTER_HPP_
-#include <groonga.h>
#include <mrn_mysql_compat.h>
#include <item_cmpfunc.h>
+#include <groonga.h>
+
namespace mrn {
class ConditionConverter {
public:
diff --git a/storage/mroonga/lib/mrn_database_manager.cpp b/storage/mroonga/lib/mrn_database_manager.cpp
index 365f47337fa..753d1551ff4 100644
--- a/storage/mroonga/lib/mrn_database_manager.cpp
+++ b/storage/mroonga/lib/mrn_database_manager.cpp
@@ -2,7 +2,7 @@
/*
Copyright(C) 2010 Tetsuro IKEDA
Copyright(C) 2010-2013 Kentoku SHIBA
- Copyright(C) 2011-2014 Kouhei Sutou <kou@clear-code.com>
+ Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -126,13 +126,12 @@ namespace mrn {
mapper.db_name(), strlen(mapper.db_name()),
&db_address, NULL);
memcpy(db_address, db, sizeof(grn_obj *));
+ error = ensure_normalizers_registered(*db);
} else {
memcpy(db, db_address, sizeof(grn_obj *));
grn_ctx_use(ctx_, *db);
}
- error = ensure_normalizers_registered(*db);
-
DBUG_RETURN(error);
}
@@ -313,18 +312,18 @@ namespace mrn {
int error = 0;
#ifdef WITH_GROONGA_NORMALIZER_MYSQL
{
+# ifdef MRN_GROONGA_NORMALIZER_MYSQL_EMBEDDED
+ GRN_PLUGIN_IMPL_NAME_TAGGED(init, normalizers_mysql)(ctx_);
+ GRN_PLUGIN_IMPL_NAME_TAGGED(register, normalizers_mysql)(ctx_);
+# else
grn_obj *mysql_normalizer;
mysql_normalizer = grn_ctx_get(ctx_, "NormalizerMySQLGeneralCI", -1);
if (mysql_normalizer) {
grn_obj_unlink(ctx_, mysql_normalizer);
} else {
-# ifdef MRN_GROONGA_NORMALIZER_MYSQL_EMBED
- GRN_PLUGIN_IMPL_NAME_TAGGED(init, normalizers_mysql)(ctx_);
- GRN_PLUGIN_IMPL_NAME_TAGGED(register, normalizers_mysql)(ctx_);
-# else
grn_plugin_register(ctx_, GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME);
-# endif
}
+# endif
}
#endif
diff --git a/storage/mroonga/lib/mrn_database_repairer.cpp b/storage/mroonga/lib/mrn_database_repairer.cpp
index 151330c9999..f04c027f8bb 100644
--- a/storage/mroonga/lib/mrn_database_repairer.cpp
+++ b/storage/mroonga/lib/mrn_database_repairer.cpp
@@ -233,7 +233,7 @@ namespace mrn {
bool *succeeded = static_cast<bool *>(user_data);
if (grn_db_recover(ctx_, db) != GRN_SUCCESS) {
push_warning_printf(thd_,
- Sql_condition::WARN_LEVEL_WARN,
+ MRN_SEVERITY_WARNING,
ER_NOT_KEYFILE,
"mroonga: repair: "
"Failed to recover database: <%s>: <%s>",
diff --git a/storage/mroonga/lib/mrn_encoding.cpp b/storage/mroonga/lib/mrn_encoding.cpp
index 35b8909fba2..f6f66758b2f 100644
--- a/storage/mroonga/lib/mrn_encoding.cpp
+++ b/storage/mroonga/lib/mrn_encoding.cpp
@@ -18,7 +18,6 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <mrn_mysql.h>
#include <mrn_err.h>
#include "mrn_encoding.hpp"
diff --git a/storage/mroonga/lib/mrn_encoding.hpp b/storage/mroonga/lib/mrn_encoding.hpp
index b29b44d967e..9c3a65da0f1 100644
--- a/storage/mroonga/lib/mrn_encoding.hpp
+++ b/storage/mroonga/lib/mrn_encoding.hpp
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com>
+ Copyright(C) 2013-2015 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,11 +20,11 @@
#ifndef MRN_ENCODING_HPP_
#define MRN_ENCODING_HPP_
-#include <groonga.h>
-
#include <mrn_mysql.h>
#include <mrn_mysql_compat.h>
+#include <groonga.h>
+
namespace mrn {
namespace encoding {
void init(void);
diff --git a/storage/mroonga/lib/mrn_field_normalizer.cpp b/storage/mroonga/lib/mrn_field_normalizer.cpp
index f0b9d921599..d5b0b3ff43e 100644
--- a/storage/mroonga/lib/mrn_field_normalizer.cpp
+++ b/storage/mroonga/lib/mrn_field_normalizer.cpp
@@ -17,8 +17,6 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <mrn_mysql.h>
-
#include "mrn_field_normalizer.hpp"
#include "mrn_encoding.hpp"
diff --git a/storage/mroonga/lib/mrn_field_normalizer.hpp b/storage/mroonga/lib/mrn_field_normalizer.hpp
index 5fd8974ce5b..3a855693481 100644
--- a/storage/mroonga/lib/mrn_field_normalizer.hpp
+++ b/storage/mroonga/lib/mrn_field_normalizer.hpp
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com>
+ Copyright(C) 2013-2015 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,11 +20,11 @@
#ifndef MRN_FIELD_NORMALIZER_HPP_
#define MRN_FIELD_NORMALIZER_HPP_
-#include <groonga.h>
-
#include <mrn_mysql.h>
#include <mrn_mysql_compat.h>
+#include <groonga.h>
+
namespace mrn {
class FieldNormalizer {
public:
diff --git a/storage/mroonga/lib/mrn_index_table_name.cpp b/storage/mroonga/lib/mrn_index_table_name.cpp
index 93f4ff8f8fd..a4a687c7996 100644
--- a/storage/mroonga/lib/mrn_index_table_name.cpp
+++ b/storage/mroonga/lib/mrn_index_table_name.cpp
@@ -26,6 +26,32 @@
#define MRN_CLASS_NAME "mrn::IndexTableName"
namespace mrn {
+ const char *IndexTableName::SEPARATOR = "-";
+
+ bool IndexTableName::is_custom_name(const char *table_name,
+ size_t table_name_length,
+ const char *index_table_name,
+ size_t index_table_name_length)
+ {
+ MRN_DBUG_ENTER_METHOD();
+
+ if (index_table_name_length <= (table_name_length + strlen(SEPARATOR))) {
+ DBUG_RETURN(true);
+ }
+
+ if (strncmp(table_name, index_table_name, table_name_length) != 0) {
+ DBUG_RETURN(true);
+ }
+
+ if (strncmp(SEPARATOR,
+ index_table_name + table_name_length,
+ strlen(SEPARATOR)) != 0) {
+ DBUG_RETURN(true);
+ }
+
+ DBUG_RETURN(false);
+ }
+
IndexTableName::IndexTableName(const char *table_name,
const char *mysql_index_name)
: table_name_(table_name),
@@ -38,7 +64,10 @@ namespace mrn {
mysql_index_name_multibyte,
mysql_index_name_multibyte + strlen(mysql_index_name_));
snprintf(name_, MRN_MAX_KEY_SIZE,
- "%s-%s", table_name_, encoded_mysql_index_name_multibyte);
+ "%s%s%s",
+ table_name_,
+ SEPARATOR,
+ encoded_mysql_index_name_multibyte);
length_ = strlen(name_);
}
diff --git a/storage/mroonga/lib/mrn_index_table_name.hpp b/storage/mroonga/lib/mrn_index_table_name.hpp
index 4ac4bfe087b..c4f16228610 100644
--- a/storage/mroonga/lib/mrn_index_table_name.hpp
+++ b/storage/mroonga/lib/mrn_index_table_name.hpp
@@ -26,6 +26,13 @@
namespace mrn {
class IndexTableName {
public:
+ static const char *SEPARATOR;
+
+ static bool is_custom_name(const char *table_name,
+ size_t table_name_length,
+ const char *index_table_name,
+ size_t index_table_name_length);
+
IndexTableName(const char *table_name, const char *mysql_index_name);
const char *c_str();
size_t length();
diff --git a/storage/mroonga/lib/mrn_lock.cpp b/storage/mroonga/lib/mrn_lock.cpp
index 3340149b237..f518bca9af3 100644
--- a/storage/mroonga/lib/mrn_lock.cpp
+++ b/storage/mroonga/lib/mrn_lock.cpp
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com>
+ Copyright(C) 2013-2015 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,12 +20,17 @@
#include "mrn_lock.hpp"
namespace mrn {
- Lock::Lock(mysql_mutex_t *mutex)
- : mutex_(mutex) {
- mysql_mutex_lock(mutex_);
+ Lock::Lock(mysql_mutex_t *mutex, bool execute)
+ : mutex_(mutex),
+ execute_(execute) {
+ if (execute_) {
+ mysql_mutex_lock(mutex_);
+ }
}
Lock::~Lock() {
- mysql_mutex_unlock(mutex_);
+ if (execute_) {
+ mysql_mutex_unlock(mutex_);
+ }
}
}
diff --git a/storage/mroonga/lib/mrn_lock.hpp b/storage/mroonga/lib/mrn_lock.hpp
index 08e47b39c58..2ec71370fa1 100644
--- a/storage/mroonga/lib/mrn_lock.hpp
+++ b/storage/mroonga/lib/mrn_lock.hpp
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com>
+ Copyright(C) 2013-2015 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -26,10 +26,11 @@
namespace mrn {
class Lock {
public:
- Lock(mysql_mutex_t *mutex);
+ Lock(mysql_mutex_t *mutex, bool execute=true);
~Lock();
private:
mysql_mutex_t *mutex_;
+ bool execute_;
};
}
diff --git a/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp b/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp
index 1e55636f1bc..c7ef9dd5851 100644
--- a/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp
+++ b/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp
@@ -23,6 +23,7 @@
#include "mrn_multiple_column_key_codec.hpp"
#include "mrn_field_normalizer.hpp"
#include "mrn_smart_grn_obj.hpp"
+#include "mrn_time_converter.hpp"
#include "mrn_value_decoder.hpp"
// for debug
@@ -36,6 +37,13 @@
uint8 *key_ = (uint8 *)(key); \
while (size_--) { *buf_++ = *key_++; } \
}
+#define mrn_byte_order_network_to_host(buf, key, size) \
+{ \
+ uint32 size_ = (uint32)(size); \
+ uint8 *buf_ = (uint8 *)(buf); \
+ uint8 *key_ = (uint8 *)(key); \
+ while (size_) { *buf_++ = *key_++; size_--; } \
+}
#else /* WORDS_BIGENDIAN */
#define mrn_byte_order_host_to_network(buf, key, size) \
{ \
@@ -44,6 +52,13 @@
uint8 *key_ = (uint8 *)(key) + size_; \
while (size_--) { *buf_++ = *(--key_); } \
}
+#define mrn_byte_order_network_to_host(buf, key, size) \
+{ \
+ uint32 size_ = (uint32)(size); \
+ uint8 *buf_ = (uint8 *)(buf); \
+ uint8 *key_ = (uint8 *)(key) + size_; \
+ while (size_) { *buf_++ = *(--key_); size_--; } \
+}
#endif /* WORDS_BIGENDIAN */
namespace mrn {
@@ -87,6 +102,7 @@ namespace mrn {
DataType data_type = TYPE_UNKNOWN;
uint data_size = 0;
get_key_info(key_part, &data_type, &data_size);
+ uint grn_key_data_size = data_size;
switch (data_type) {
case TYPE_UNKNOWN:
@@ -97,26 +113,17 @@ namespace mrn {
case TYPE_LONG_LONG_NUMBER:
{
long long int long_long_value = 0;
- switch (data_size) {
- case 3:
- long_long_value = (long long int)sint3korr(current_mysql_key);
- break;
- case 8:
- long_long_value = (long long int)sint8korr(current_mysql_key);
- break;
- }
- mrn_byte_order_host_to_network(current_grn_key, &long_long_value,
- data_size);
- *((uint8 *)(current_grn_key)) ^= 0x80;
+ long_long_value = sint8korr(current_mysql_key);
+ encode_long_long_int(long_long_value, current_grn_key);
}
break;
case TYPE_NUMBER:
- mrn_byte_order_host_to_network(current_grn_key, current_mysql_key, data_size);
{
- Field_num *number_field = (Field_num *)field;
- if (!number_field->unsigned_flag) {
- *((uint8 *)(current_grn_key)) ^= 0x80;
- }
+ Field_num *number_field = static_cast<Field_num *>(field);
+ encode_number(current_mysql_key,
+ data_size,
+ !number_field->unsigned_flag,
+ current_grn_key);
}
break;
case TYPE_FLOAT:
@@ -133,6 +140,44 @@ namespace mrn {
encode_double(value, data_size, current_grn_key);
}
break;
+ case TYPE_DATETIME:
+ {
+ long long int mysql_datetime;
+#ifdef WORDS_BIGENDIAN
+ if (field->table && field->table->s->db_low_byte_first) {
+ mysql_datetime = sint8korr(current_mysql_key);
+ } else
+#endif
+ {
+ value_decoder::decode(&mysql_datetime, current_mysql_key);
+ }
+ TimeConverter time_converter;
+ bool truncated;
+ long long int grn_time =
+ time_converter.mysql_datetime_to_grn_time(mysql_datetime,
+ &truncated);
+ encode_long_long_int(grn_time, current_grn_key);
+ }
+ break;
+#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2
+ case TYPE_DATETIME2:
+ {
+ Field_datetimef *datetimef_field =
+ static_cast<Field_datetimef *>(field);
+ long long int mysql_datetime_packed =
+ my_datetime_packed_from_binary(current_mysql_key,
+ datetimef_field->decimals());
+ MYSQL_TIME mysql_time;
+ TIME_from_longlong_datetime_packed(&mysql_time, mysql_datetime_packed);
+ TimeConverter time_converter;
+ bool truncated;
+ long long int grn_time =
+ time_converter.mysql_time_to_grn_time(&mysql_time, &truncated);
+ grn_key_data_size = 8;
+ encode_long_long_int(grn_time, current_grn_key);
+ }
+ break;
+#endif
case TYPE_BYTE_SEQUENCE:
memcpy(current_grn_key, current_mysql_key, data_size);
break;
@@ -140,7 +185,8 @@ namespace mrn {
encode_reverse(current_mysql_key, data_size, current_grn_key);
break;
case TYPE_BYTE_BLOB:
- encode_blob(field, current_mysql_key, current_grn_key, &data_size);
+ encode_blob(current_mysql_key, &data_size, field, current_grn_key);
+ grn_key_data_size = data_size;
break;
}
@@ -149,8 +195,8 @@ namespace mrn {
}
current_mysql_key += data_size;
- current_grn_key += data_size;
- *grn_key_length += data_size;
+ current_grn_key += grn_key_data_size;
+ *grn_key_length += grn_key_data_size;
}
DBUG_RETURN(error);
@@ -185,6 +231,7 @@ namespace mrn {
DataType data_type = TYPE_UNKNOWN;
uint data_size = 0;
get_key_info(key_part, &data_type, &data_size);
+ uint grn_key_data_size = data_size;
switch (data_type) {
case TYPE_UNKNOWN:
@@ -194,43 +241,68 @@ namespace mrn {
break;
case TYPE_LONG_LONG_NUMBER:
{
- long long int long_long_value = 0;
- switch (data_size) {
- case 3:
- long_long_value = (long long int)sint3korr(current_grn_key);
- break;
- case 8:
- long_long_value = (long long int)sint8korr(current_grn_key);
- break;
- }
- *((uint8 *)(&long_long_value)) ^= 0x80;
- mrn_byte_order_host_to_network(current_mysql_key, &long_long_value,
- data_size);
+ long long int value;
+ decode_long_long_int(current_grn_key, &value);
+ int8store(current_mysql_key, value);
}
break;
case TYPE_NUMBER:
{
- uchar buffer[8];
- memcpy(buffer, current_grn_key, data_size);
- Field_num *number_field = (Field_num *)field;
- if (!number_field->unsigned_flag) {
- buffer[0] ^= 0x80;
- }
- mrn_byte_order_host_to_network(current_mysql_key, buffer,
- data_size);
+ Field_num *number_field = static_cast<Field_num *>(field);
+ decode_number(current_grn_key,
+ grn_key_data_size,
+ !number_field->unsigned_flag,
+ current_mysql_key);
}
break;
case TYPE_FLOAT:
- decode_float(current_grn_key, current_mysql_key, data_size);
+ decode_float(current_grn_key, grn_key_data_size, current_mysql_key);
break;
case TYPE_DOUBLE:
- decode_double(current_grn_key, current_mysql_key, data_size);
+ decode_double(current_grn_key, grn_key_data_size, current_mysql_key);
+ break;
+ case TYPE_DATETIME:
+ {
+ long long int grn_time;
+ decode_long_long_int(current_grn_key, &grn_time);
+ TimeConverter time_converter;
+ long long int mysql_datetime =
+ time_converter.grn_time_to_mysql_datetime(grn_time);
+#ifdef WORDS_BIGENDIAN
+ if (field->table && field->table->s->db_low_byte_first) {
+ int8store(current_mysql_key, mysql_datetime);
+ } else
+#endif
+ {
+ longlongstore(current_mysql_key, mysql_datetime);
+ }
+ }
+ break;
+#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2
+ case TYPE_DATETIME2:
+ {
+ Field_datetimef *datetimef_field =
+ static_cast<Field_datetimef *>(field);
+ long long int grn_time;
+ grn_key_data_size = 8;
+ decode_long_long_int(current_grn_key, &grn_time);
+ TimeConverter time_converter;
+ MYSQL_TIME mysql_time;
+ mysql_time.time_type = MYSQL_TIMESTAMP_DATETIME;
+ time_converter.grn_time_to_mysql_time(grn_time, &mysql_time);
+ long long int mysql_datetime_packed =
+ TIME_to_longlong_datetime_packed(&mysql_time);
+ my_datetime_packed_to_binary(mysql_datetime_packed,
+ current_mysql_key,
+ datetimef_field->decimals());
+ }
break;
+#endif
case TYPE_BYTE_SEQUENCE:
- memcpy(current_mysql_key, current_grn_key, data_size);
+ memcpy(current_mysql_key, current_grn_key, grn_key_data_size);
break;
case TYPE_BYTE_REVERSE:
- decode_reverse(current_grn_key, current_mysql_key, data_size);
+ decode_reverse(current_grn_key, grn_key_data_size, current_mysql_key);
break;
case TYPE_BYTE_BLOB:
memcpy(current_mysql_key,
@@ -240,6 +312,7 @@ namespace mrn {
current_grn_key,
data_size);
data_size += HA_KEY_BLOB_LENGTH;
+ grn_key_data_size = data_size;
break;
}
@@ -247,7 +320,7 @@ namespace mrn {
break;
}
- current_grn_key += data_size;
+ current_grn_key += grn_key_data_size;
current_mysql_key += data_size;
*mysql_key_length += data_size;
}
@@ -275,10 +348,19 @@ namespace mrn {
DataType data_type = TYPE_UNKNOWN;
uint data_size = 0;
get_key_info(key_part, &data_type, &data_size);
- total_size += data_size;
- if (data_type == TYPE_BYTE_BLOB) {
- total_size += HA_KEY_BLOB_LENGTH;
+ switch (data_type) {
+#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2
+ case TYPE_DATETIME2:
+ data_size = 8;
+ break;
+#endif
+ case TYPE_BYTE_BLOB:
+ data_size += HA_KEY_BLOB_LENGTH;
+ break;
+ default:
+ break;
}
+ total_size += data_size;
}
DBUG_RETURN(total_size);
@@ -331,10 +413,22 @@ namespace mrn {
*data_size = 1;
break;
case MYSQL_TYPE_TIMESTAMP:
+ DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_TIMESTAMP"));
+ *data_type = TYPE_BYTE_REVERSE;
+ *data_size = key_part->length;
+ break;
case MYSQL_TYPE_DATE:
+ DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_DATE"));
+ *data_type = TYPE_BYTE_REVERSE;
+ *data_size = key_part->length;
+ break;
case MYSQL_TYPE_DATETIME:
- case MYSQL_TYPE_NEWDATE:
DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_DATETIME"));
+ *data_type = TYPE_DATETIME;
+ *data_size = key_part->length;
+ break;
+ case MYSQL_TYPE_NEWDATE:
+ DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_NEWDATE"));
*data_type = TYPE_BYTE_REVERSE;
*data_size = key_part->length;
break;
@@ -350,7 +444,7 @@ namespace mrn {
break;
case MYSQL_TYPE_TIME:
DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_TIME"));
- *data_type = TYPE_LONG_LONG_NUMBER;
+ *data_type = TYPE_NUMBER;
*data_size = 3;
break;
case MYSQL_TYPE_VARCHAR:
@@ -374,7 +468,7 @@ namespace mrn {
#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2
case MYSQL_TYPE_DATETIME2:
DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_DATETIME2"));
- *data_type = TYPE_BYTE_SEQUENCE;
+ *data_type = TYPE_DATETIME2;
*data_size = key_part->length;
break;
#endif
@@ -428,77 +522,127 @@ namespace mrn {
DBUG_VOID_RETURN;
}
- void MultipleColumnKeyCodec::encode_float(volatile float value, uint data_size,
+ void MultipleColumnKeyCodec::encode_number(const uchar *mysql_key,
+ uint mysql_key_size,
+ bool is_signed,
+ uchar *grn_key) {
+ MRN_DBUG_ENTER_METHOD();
+ mrn_byte_order_host_to_network(grn_key, mysql_key, mysql_key_size);
+ if (is_signed) {
+ grn_key[0] ^= 0x80;
+ }
+ DBUG_VOID_RETURN;
+ }
+
+ void MultipleColumnKeyCodec::decode_number(const uchar *grn_key,
+ uint grn_key_size,
+ bool is_signed,
+ uchar *mysql_key) {
+ MRN_DBUG_ENTER_METHOD();
+ uchar buffer[8];
+ memcpy(buffer, grn_key, grn_key_size);
+ if (is_signed) {
+ buffer[0] ^= 0x80;
+ }
+ mrn_byte_order_network_to_host(mysql_key, buffer, grn_key_size);
+ DBUG_VOID_RETURN;
+ }
+
+ void MultipleColumnKeyCodec::encode_long_long_int(volatile long long int value,
+ uchar *grn_key) {
+ MRN_DBUG_ENTER_METHOD();
+ uint value_size = 8;
+ mrn_byte_order_host_to_network(grn_key, &value, value_size);
+ grn_key[0] ^= 0x80;
+ DBUG_VOID_RETURN;
+ }
+
+ void MultipleColumnKeyCodec::decode_long_long_int(const uchar *grn_key,
+ long long int *value) {
+ MRN_DBUG_ENTER_METHOD();
+ uint grn_key_size = 8;
+ uchar buffer[8];
+ memcpy(buffer, grn_key, grn_key_size);
+ buffer[0] ^= 0x80;
+ mrn_byte_order_network_to_host(value, buffer, grn_key_size);
+ DBUG_VOID_RETURN;
+ }
+
+ void MultipleColumnKeyCodec::encode_float(volatile float value,
+ uint value_size,
uchar *grn_key) {
MRN_DBUG_ENTER_METHOD();
- int n_bits = (data_size * 8 - 1);
+ int n_bits = (value_size * 8 - 1);
volatile int *int_value_pointer = (int *)(&value);
int int_value = *int_value_pointer;
int_value ^= ((int_value >> n_bits) | (1 << n_bits));
- mrn_byte_order_host_to_network(grn_key, &int_value, data_size);
+ mrn_byte_order_host_to_network(grn_key, &int_value, value_size);
DBUG_VOID_RETURN;
}
void MultipleColumnKeyCodec::decode_float(const uchar *grn_key,
- uchar *mysql_key,
- uint data_size) {
+ uint grn_key_size,
+ uchar *mysql_key) {
MRN_DBUG_ENTER_METHOD();
int int_value;
- mrn_byte_order_host_to_network(&int_value, grn_key, data_size);
- int max_bit = (data_size * 8 - 1);
+ mrn_byte_order_network_to_host(&int_value, grn_key, grn_key_size);
+ int max_bit = (grn_key_size * 8 - 1);
*((int *)mysql_key) =
int_value ^ (((int_value ^ (1 << max_bit)) >> max_bit) |
(1 << max_bit));
DBUG_VOID_RETURN;
}
- void MultipleColumnKeyCodec::encode_double(volatile double value, uint data_size,
+ void MultipleColumnKeyCodec::encode_double(volatile double value,
+ uint value_size,
uchar *grn_key) {
MRN_DBUG_ENTER_METHOD();
- int n_bits = (data_size * 8 - 1);
+ int n_bits = (value_size * 8 - 1);
volatile long long int *long_long_value_pointer = (long long int *)(&value);
volatile long long int long_long_value = *long_long_value_pointer;
long_long_value ^= ((long_long_value >> n_bits) | (1LL << n_bits));
- mrn_byte_order_host_to_network(grn_key, &long_long_value, data_size);
+ mrn_byte_order_host_to_network(grn_key, &long_long_value, value_size);
DBUG_VOID_RETURN;
}
void MultipleColumnKeyCodec::decode_double(const uchar *grn_key,
- uchar *mysql_key,
- uint data_size) {
+ uint grn_key_size,
+ uchar *mysql_key) {
MRN_DBUG_ENTER_METHOD();
long long int long_long_value;
- mrn_byte_order_host_to_network(&long_long_value, grn_key, data_size);
- int max_bit = (data_size * 8 - 1);
+ mrn_byte_order_network_to_host(&long_long_value, grn_key, grn_key_size);
+ int max_bit = (grn_key_size * 8 - 1);
*((long long int *)mysql_key) =
long_long_value ^ (((long_long_value ^ (1LL << max_bit)) >> max_bit) |
(1LL << max_bit));
DBUG_VOID_RETURN;
}
- void MultipleColumnKeyCodec::encode_reverse(const uchar *mysql_key, uint data_size,
+ void MultipleColumnKeyCodec::encode_reverse(const uchar *mysql_key,
+ uint mysql_key_size,
uchar *grn_key) {
MRN_DBUG_ENTER_METHOD();
- for (uint i = 0; i < data_size; i++) {
- grn_key[i] = mysql_key[data_size - i - 1];
+ for (uint i = 0; i < mysql_key_size; i++) {
+ grn_key[i] = mysql_key[mysql_key_size - i - 1];
}
DBUG_VOID_RETURN;
}
void MultipleColumnKeyCodec::decode_reverse(const uchar *grn_key,
- uchar *mysql_key,
- uint data_size) {
+ uint grn_key_size,
+ uchar *mysql_key) {
MRN_DBUG_ENTER_METHOD();
- for (uint i = 0; i < data_size; i++) {
- mysql_key[i] = grn_key[data_size - i - 1];
+ for (uint i = 0; i < grn_key_size; i++) {
+ mysql_key[i] = grn_key[grn_key_size - i - 1];
}
DBUG_VOID_RETURN;
}
- void MultipleColumnKeyCodec::encode_blob(Field *field,
- const uchar *mysql_key,
- uchar *grn_key,
- uint *data_size) {
+ void MultipleColumnKeyCodec::encode_blob(const uchar *mysql_key,
+ uint *mysql_key_size,
+ Field *field,
+ uchar *grn_key) {
+ MRN_DBUG_ENTER_METHOD();
FieldNormalizer normalizer(ctx_, thread_, field);
if (normalizer.should_normalize()) {
#if HA_KEY_BLOB_LENGTH != 2
@@ -517,15 +661,15 @@ namespace mrn {
uint16 new_blob_data_length;
if (normalized_length <= UINT_MAX16) {
memcpy(grn_key, normalized, normalized_length);
- if (normalized_length < *data_size) {
+ if (normalized_length < *mysql_key_size) {
memset(grn_key + normalized_length,
- '\0', *data_size - normalized_length);
+ '\0', *mysql_key_size - normalized_length);
}
new_blob_data_length = normalized_length;
} else {
push_warning_printf(thread_,
MRN_SEVERITY_WARNING,
- WARN_DATA_TRUNCATED,
+ MRN_ERROR_CODE_DATA_TRUNCATE(thread_),
"normalized data truncated "
"for multiple column index: "
"normalized-data-size: <%u> "
@@ -539,11 +683,14 @@ namespace mrn {
memcpy(grn_key, normalized, blob_data_length);
new_blob_data_length = blob_data_length;
}
- memcpy(grn_key + *data_size, &new_blob_data_length, HA_KEY_BLOB_LENGTH);
+ memcpy(grn_key + *mysql_key_size,
+ &new_blob_data_length,
+ HA_KEY_BLOB_LENGTH);
} else {
- memcpy(grn_key + *data_size, mysql_key, HA_KEY_BLOB_LENGTH);
- memcpy(grn_key, mysql_key + HA_KEY_BLOB_LENGTH, *data_size);
+ memcpy(grn_key + *mysql_key_size, mysql_key, HA_KEY_BLOB_LENGTH);
+ memcpy(grn_key, mysql_key + HA_KEY_BLOB_LENGTH, *mysql_key_size);
}
- *data_size += HA_KEY_BLOB_LENGTH;
+ *mysql_key_size += HA_KEY_BLOB_LENGTH;
+ DBUG_VOID_RETURN;
}
}
diff --git a/storage/mroonga/lib/mrn_multiple_column_key_codec.hpp b/storage/mroonga/lib/mrn_multiple_column_key_codec.hpp
index fc6ae285357..2b3f935d4e4 100644
--- a/storage/mroonga/lib/mrn_multiple_column_key_codec.hpp
+++ b/storage/mroonga/lib/mrn_multiple_column_key_codec.hpp
@@ -44,6 +44,10 @@ namespace mrn {
TYPE_NUMBER,
TYPE_FLOAT,
TYPE_DOUBLE,
+ TYPE_DATETIME,
+#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2
+ TYPE_DATETIME2,
+#endif
TYPE_BYTE_SEQUENCE,
TYPE_BYTE_REVERSE,
TYPE_BYTE_BLOB
@@ -56,14 +60,40 @@ namespace mrn {
void get_key_info(KEY_PART_INFO *key_part,
DataType *data_type, uint *data_size);
- void encode_float(volatile float value, uint data_size, uchar *grn_key);
- void decode_float(const uchar *grn_key, uchar *mysql_key, uint data_size);
- void encode_double(volatile double value, uint data_size, uchar *grn_key);
- void decode_double(const uchar *grn_key, uchar *mysql_key, uint data_size);
- void encode_reverse(const uchar *mysql_key, uint data_size, uchar *grn_key);
- void decode_reverse(const uchar *grn_key, uchar *mysql_key, uint data_size);
- void encode_blob(Field *field,
- const uchar *mysql_key, uchar *grn_key, uint *data_size);
+ void encode_number(const uchar *mysql_key,
+ uint mysql_key_size,
+ bool is_signed,
+ uchar *grn_key);
+ void decode_number(const uchar *grn_key,
+ uint grn_key_size,
+ bool is_signed,
+ uchar *mysql_key);
+ void encode_long_long_int(volatile long long int value,
+ uchar *grn_key);
+ void decode_long_long_int(const uchar *grn_key,
+ long long int *value);
+ void encode_float(volatile float value,
+ uint value_size,
+ uchar *grn_key);
+ void decode_float(const uchar *grn_key,
+ uint grn_key_size,
+ uchar *mysql_key);
+ void encode_double(volatile double value,
+ uint value_size,
+ uchar *grn_key);
+ void decode_double(const uchar *grn_key,
+ uint grn_key_size,
+ uchar *mysql_key);
+ void encode_reverse(const uchar *mysql_key,
+ uint mysql_key_size,
+ uchar *grn_key);
+ void decode_reverse(const uchar *grn_key,
+ uint grn_key_size,
+ uchar *mysql_key);
+ void encode_blob(const uchar *mysql_key,
+ uint *mysql_key_size,
+ Field *field,
+ uchar *grn_key);
};
}
diff --git a/storage/mroonga/lib/mrn_mysqlservices.cpp b/storage/mroonga/lib/mrn_mysqlservices.cpp
index 9c7af9acfe0..693aa8607c3 100644
--- a/storage/mroonga/lib/mrn_mysqlservices.cpp
+++ b/storage/mroonga/lib/mrn_mysqlservices.cpp
@@ -17,10 +17,6 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
#include <mrn_mysql.h>
#include <mrn_mysql_compat.h>
diff --git a/storage/mroonga/lib/mrn_smart_grn_obj.cpp b/storage/mroonga/lib/mrn_smart_grn_obj.cpp
index 9dbae6528f9..40ea9cb079c 100644
--- a/storage/mroonga/lib/mrn_smart_grn_obj.cpp
+++ b/storage/mroonga/lib/mrn_smart_grn_obj.cpp
@@ -50,4 +50,10 @@ namespace mrn {
grn_obj *SmartGrnObj::get() {
return obj_;
}
+
+ grn_obj *SmartGrnObj::release() {
+ grn_obj *obj = obj_;
+ obj_ = NULL;
+ return obj;
+ }
}
diff --git a/storage/mroonga/lib/mrn_smart_grn_obj.hpp b/storage/mroonga/lib/mrn_smart_grn_obj.hpp
index c9c86f3e46e..0a44a6ac9db 100644
--- a/storage/mroonga/lib/mrn_smart_grn_obj.hpp
+++ b/storage/mroonga/lib/mrn_smart_grn_obj.hpp
@@ -33,6 +33,7 @@ namespace mrn {
~SmartGrnObj();
grn_obj *get();
+ grn_obj *release();
};
}
diff --git a/storage/mroonga/lib/mrn_time_converter.cpp b/storage/mroonga/lib/mrn_time_converter.cpp
index 63b2e53766d..3c6821c8d11 100644
--- a/storage/mroonga/lib/mrn_time_converter.cpp
+++ b/storage/mroonga/lib/mrn_time_converter.cpp
@@ -1,7 +1,7 @@
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2010-2013 Kentoku SHIBA
- Copyright(C) 2011-2013 Kouhei Sutou <kou@clear-code.com>
+ Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -18,10 +18,6 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
#include "mrn_time_converter.hpp"
#ifdef min
@@ -257,4 +253,43 @@ namespace mrn {
}
DBUG_VOID_RETURN;
}
+
+ long long int TimeConverter::mysql_datetime_to_grn_time(long long int mysql_datetime,
+ bool *truncated) {
+ MRN_DBUG_ENTER_METHOD();
+
+ MYSQL_TIME mysql_time;
+ mysql_time.time_type = MYSQL_TIMESTAMP_DATETIME;
+ mysql_time.neg = 0;
+ mysql_time.second_part = 0;
+ mysql_time.second = (mysql_datetime % 100);
+ mysql_time.minute = (mysql_datetime / 100 % 100);
+ mysql_time.hour = (mysql_datetime / 10000 % 100);
+ mysql_time.day = (mysql_datetime / 1000000 % 100);
+ mysql_time.month = (mysql_datetime / 100000000 % 100);
+ mysql_time.year = (mysql_datetime / 10000000000LL % 10000);
+
+ long long int grn_time = mysql_time_to_grn_time(&mysql_time, truncated);
+
+ DBUG_RETURN(grn_time);
+ }
+
+ long long int TimeConverter::grn_time_to_mysql_datetime(long long int grn_time) {
+ MRN_DBUG_ENTER_METHOD();
+
+ MYSQL_TIME mysql_time;
+ mysql_time.time_type = MYSQL_TIMESTAMP_DATETIME;
+
+ grn_time_to_mysql_time(grn_time, &mysql_time);
+
+ long long int mysql_datetime =
+ (mysql_time.second * 1) +
+ (mysql_time.minute * 100) +
+ (mysql_time.hour * 10000) +
+ (mysql_time.day * 1000000) +
+ (mysql_time.month * 100000000) +
+ (mysql_time.year * 10000000000LL);
+
+ DBUG_RETURN(mysql_datetime);
+ }
}
diff --git a/storage/mroonga/lib/mrn_time_converter.hpp b/storage/mroonga/lib/mrn_time_converter.hpp
index c5c69a0a8ad..9d297f92e59 100644
--- a/storage/mroonga/lib/mrn_time_converter.hpp
+++ b/storage/mroonga/lib/mrn_time_converter.hpp
@@ -1,7 +1,7 @@
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2010-2013 Kentoku SHIBA
- Copyright(C) 2011-2013 Kouhei Sutou <kou@clear-code.com>
+ Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -21,9 +21,10 @@
#ifndef MRN_TIME_CONVERTER_HPP_
#define MRN_TIME_CONVERTER_HPP_
-#include <groonga.h>
#include <mrn_mysql_compat.h>
+#include <groonga.h>
+
namespace mrn {
class TimeConverter {
public:
@@ -34,10 +35,13 @@ namespace mrn {
long long int mysql_time_to_grn_time(MYSQL_TIME *mysql_time,
bool *truncated);
+ long long int mysql_datetime_to_grn_time(long long int mysql_datetime,
+ bool *truncated);
long long int tm_to_grn_time(struct tm *time, int usec, bool *truncated);
void grn_time_to_mysql_time(long long int grn_time, MYSQL_TIME *mysql_time);
+ long long int grn_time_to_mysql_datetime(long long int grn_time);
private:
time_t tm_to_time_gm(struct tm *time, bool *truncated);
diff --git a/storage/mroonga/lib/mrn_value_decoder.cpp b/storage/mroonga/lib/mrn_value_decoder.cpp
index 8356789915f..c01b01718b1 100644
--- a/storage/mroonga/lib/mrn_value_decoder.cpp
+++ b/storage/mroonga/lib/mrn_value_decoder.cpp
@@ -60,5 +60,16 @@ namespace mrn {
#endif
DBUG_VOID_RETURN;
}
+ void decode(long long int *dest, const uchar *source) {
+ MRN_DBUG_ENTER_FUNCTION();
+#ifdef MRN_DEST_IS_POINTER
+ longlongget(dest, source);
+#else
+ long long int value;
+ longlongget(value, source);
+ *dest = value;
+#endif
+ DBUG_VOID_RETURN;
+ }
}
}
diff --git a/storage/mroonga/lib/mrn_value_decoder.hpp b/storage/mroonga/lib/mrn_value_decoder.hpp
index 8a48de0b003..fe651f574f0 100644
--- a/storage/mroonga/lib/mrn_value_decoder.hpp
+++ b/storage/mroonga/lib/mrn_value_decoder.hpp
@@ -27,6 +27,7 @@ namespace mrn {
void decode(uint16 *dest, const uchar *source);
void decode(float *dest, const uchar *source);
void decode(double *dest, const uchar *source);
+ void decode(long long int *dest, const uchar *source);
}
}
diff --git a/storage/mroonga/mrn_constants.hpp b/storage/mroonga/mrn_constants.hpp
index 5bc6da6b9b6..b11ebe8bd93 100644
--- a/storage/mroonga/mrn_constants.hpp
+++ b/storage/mroonga/mrn_constants.hpp
@@ -42,8 +42,8 @@
#define MRN_COLUMN_NAME_ID "_id"
#define MRN_COLUMN_NAME_KEY "_key"
#define MRN_COLUMN_NAME_SCORE "_score"
-#ifndef MRN_PARSER_DEFAULT
-# define MRN_PARSER_DEFAULT "TokenBigram"
+#ifndef MRN_DEFAULT_TOKENIZER
+# define MRN_DEFAULT_TOKENIZER "TokenBigram"
#endif
#endif /* MRN_CONSTANTS_HPP_ */
diff --git a/storage/mroonga/mrn_err.h b/storage/mroonga/mrn_err.h
index cd4515a034e..d109f87bb48 100644
--- a/storage/mroonga/mrn_err.h
+++ b/storage/mroonga/mrn_err.h
@@ -1,4 +1,6 @@
-/* Copyright(C) 2011 Kentoku SHIBA
+/*
+ Copyright(C) 2011 Kentoku SHIBA
+ Copyright(C) 2014-2015 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -33,7 +35,7 @@
"The column flag '%-.64s' is unsupported. It is ignored"
#define ER_MRN_INVALID_COLUMN_FLAG_NUM 16507
#define ER_MRN_INVALID_COLUMN_FLAG_STR \
- "The column flag '%-.64s' is invalid. '%-64s' is used instead"
+ "The column flag '%-.64s' is invalid. It is ignored"
#define ER_MRN_INVALID_INDEX_FLAG_NUM 16508
#define ER_MRN_INVALID_INDEX_FLAG_STR \
"The index flag '%-.64s' is invalid. It is ignored"
diff --git a/storage/mroonga/mrn_mysql_compat.h b/storage/mroonga/mrn_mysql_compat.h
index a717220a35c..660c72b4d25 100644
--- a/storage/mroonga/mrn_mysql_compat.h
+++ b/storage/mroonga/mrn_mysql_compat.h
@@ -33,20 +33,11 @@
#endif
#if defined(MRN_MARIADB_P)
-# if MYSQL_VERSION_ID >= 50302 && MYSQL_VERSION_ID < 100000
+# if MYSQL_VERSION_ID < 100000
typedef COST_VECT Cost_estimate;
# endif
#endif
-#if MYSQL_VERSION_ID >= 50516
-# define MRN_PLUGIN_HAVE_FLAGS 1
-#endif
-
-// for MySQL < 5.5
-#ifndef MY_ALL_CHARSETS_SIZE
-# define MY_ALL_CHARSETS_SIZE 256
-#endif
-
#ifndef MRN_MARIADB_P
typedef char *range_id_t;
#endif
@@ -79,9 +70,11 @@
#if MYSQL_VERSION_ID >= 50607
# if MYSQL_VERSION_ID >= 100007 && defined(MRN_MARIADB_P)
# define MRN_GET_ERROR_MESSAGE thd_get_error_message(current_thd)
+# define MRN_GET_ERROR_NUMBER thd_get_error_number(current_thd)
# define MRN_GET_CURRENT_ROW_FOR_WARNING(thd) thd_get_error_row(thd)
# else
# define MRN_GET_ERROR_MESSAGE current_thd->get_stmt_da()->message()
+# define MRN_GET_ERROR_NUMBER current_thd->get_stmt_da()->sql_errno()
# if MYSQL_VERSION_ID >= 50706
# define MRN_GET_CURRENT_ROW_FOR_WARNING(thd) \
thd->get_stmt_da()->current_row_for_condition()
@@ -91,20 +84,16 @@
# endif
# endif
#else
-# if MYSQL_VERSION_ID >= 50500
-# define MRN_GET_ERROR_MESSAGE current_thd->stmt_da->message()
-# define MRN_GET_CURRENT_ROW_FOR_WARNING(thd) thd->warning_info->current_row_for_warning()
-# else
-# define MRN_GET_ERROR_MESSAGE current_thd->main_da.message()
-# define MRN_GET_CURRENT_ROW_FOR_WARNING(thd) thd->row_count
-# endif
+# define MRN_GET_ERROR_MESSAGE current_thd->stmt_da->message()
+# define MRN_GET_ERROR_NUMBER current_thd->stmt_da->sql_errno()
+# define MRN_GET_CURRENT_ROW_FOR_WARNING(thd) thd->warning_info->current_row_for_warning()
#endif
#if MYSQL_VERSION_ID >= 50607 && !defined(MRN_MARIADB_P)
# define MRN_ITEM_HAVE_ITEM_NAME
#endif
-#if MYSQL_VERSION_ID >= 50500 && MYSQL_VERSION_ID < 100000
+#if MYSQL_VERSION_ID < 100000
# define MRN_HAVE_TABLE_DEF_CACHE
#endif
@@ -124,10 +113,6 @@
# define MRN_TABLE_SHARE_HAVE_LOCK_SHARE
#endif
-#if MYSQL_VERSION_ID >= 50404
-# define MRN_TABLE_SHARE_HAVE_LOCK_HA_DATA
-#endif
-
#ifndef TIME_FUZZY_DATE
/* For MariaDB 10. */
# ifdef TIME_FUZZY_DATES
@@ -217,4 +202,42 @@
# define MRN_FORMAT_STRING_LENGTH "u"
#endif
+#ifdef MRN_MARIADB_P
+# define MRN_SUPPORT_CUSTOM_OPTIONS
+#endif
+
+#if defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100000
+# if MYSQL_VERSION_ID >= 100104
+# define mrn_init_sql_alloc(thd, mem_root) \
+ init_sql_alloc(mem_root, \
+ TABLE_ALLOC_BLOCK_SIZE, \
+ 0, \
+ MYF(thd->slave_thread ? 0 : MY_THREAD_SPECIFIC))
+# else
+# define mrn_init_sql_alloc(thd, mem_root) \
+ init_sql_alloc(mem_root, \
+ TABLE_ALLOC_BLOCK_SIZE, \
+ 0, \
+ MYF(0))
+# endif
+#else
+# define mrn_init_sql_alloc(thd, mem_root) \
+ init_sql_alloc(mem_root, \
+ TABLE_ALLOC_BLOCK_SIZE, \
+ 0)
+#endif
+
+#ifdef MRN_MARIADB_P
+# define MRN_ABORT_ON_WARNING(thd) thd->abort_on_warning
+#else
+# if MYSQL_VERSION_ID >= 50706
+# define MRN_ABORT_ON_WARNING(thd) false
+# else
+# define MRN_ABORT_ON_WARNING(thd) thd->abort_on_warning
+# endif
+#endif
+
+#define MRN_ERROR_CODE_DATA_TRUNCATE(thd) \
+ (MRN_ABORT_ON_WARNING(thd) ? ER_WARN_DATA_OUT_OF_RANGE : WARN_DATA_TRUNCATED)
+
#endif /* MRN_MYSQL_COMPAT_H_ */
diff --git a/storage/mroonga/mrn_table.cpp b/storage/mroonga/mrn_table.cpp
index 890d21a415b..af07dc09cf3 100644
--- a/storage/mroonga/mrn_table.cpp
+++ b/storage/mroonga/mrn_table.cpp
@@ -35,10 +35,18 @@
#include "mrn_variables.hpp"
#include <mrn_lock.hpp>
-#if MYSQL_VERSION_ID >= 50603
-# define MRN_HA_RESOLVE_BY_NAME(name) ha_resolve_by_name(NULL, (name), TRUE)
+#ifdef MRN_MARIADB_P
+# if MYSQL_VERSION_ID >= 100100
+# define MRN_HA_RESOLVE_BY_NAME(name) ha_resolve_by_name(NULL, (name), TRUE)
+# else
+# define MRN_HA_RESOLVE_BY_NAME(name) ha_resolve_by_name(NULL, (name))
+# endif
#else
-# define MRN_HA_RESOLVE_BY_NAME(name) ha_resolve_by_name(NULL, (name))
+# if MYSQL_VERSION_ID >= 50603
+# define MRN_HA_RESOLVE_BY_NAME(name) ha_resolve_by_name(NULL, (name), TRUE)
+# else
+# define MRN_HA_RESOLVE_BY_NAME(name) ha_resolve_by_name(NULL, (name))
+# endif
#endif
#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
@@ -68,9 +76,7 @@ extern "C" {
# ifdef MRN_TABLE_SHARE_HAVE_LOCK_SHARE
extern PSI_mutex_key *mrn_table_share_lock_share;
# endif
-# ifdef MRN_TABLE_SHARE_HAVE_LOCK_HA_DATA
extern PSI_mutex_key *mrn_table_share_lock_ha_data;
-# endif
# endif
extern PSI_mutex_key mrn_share_mutex_key;
extern PSI_mutex_key mrn_long_term_share_auto_inc_mutex_key;
@@ -80,7 +86,7 @@ extern HASH mrn_open_tables;
extern mysql_mutex_t mrn_open_tables_mutex;
extern HASH mrn_long_term_share;
extern mysql_mutex_t mrn_long_term_share_mutex;
-extern char *mrn_default_parser;
+extern char *mrn_default_tokenizer;
extern char *mrn_default_wrapper_engine;
extern handlerton *mrn_hton_ptr;
extern HASH mrn_allocated_thds;
@@ -333,8 +339,8 @@ int mrn_parse_table_param(MRN_SHARE *share, TABLE *table)
for (i = 2; i > 0; i--)
#endif
{
- const char *params_string_value;
- uint params_string_length;
+ const char *params_string_value = NULL;
+ uint params_string_length = 0;
switch (i)
{
#ifdef WITH_PARTITION_STORAGE_ENGINE
@@ -515,16 +521,16 @@ int mrn_add_index_param(MRN_SHARE *share, KEY *key_info, int i)
#if MYSQL_VERSION_ID >= 50500
if (key_info->comment.length == 0)
{
- if (share->key_parser[i]) {
- my_free(share->key_parser[i]);
+ if (share->key_tokenizer[i]) {
+ my_free(share->key_tokenizer[i]);
}
- if (
- !(share->key_parser[i] = mrn_my_strdup(mrn_default_parser, MYF(MY_WME)))
- ) {
+ share->key_tokenizer[i] = mrn_my_strdup(mrn_default_tokenizer, MYF(MY_WME));
+ if (!share->key_tokenizer[i]) {
error = HA_ERR_OUT_OF_MEM;
goto error;
}
- share->key_parser_length[i] = strlen(share->key_parser[i]);
+ share->key_tokenizer_length[i] = strlen(share->key_tokenizer[i]);
+
DBUG_RETURN(0);
}
DBUG_PRINT("info", ("mroonga create comment string"));
@@ -572,21 +578,23 @@ int mrn_add_index_param(MRN_SHARE *share, KEY *key_info, int i)
MRN_PARAM_STR_LIST("table", index_table, i);
break;
case 6:
- MRN_PARAM_STR_LIST("parser", key_parser, i);
+ MRN_PARAM_STR_LIST("parser", key_tokenizer, i);
+ break;
+ case 9:
+ MRN_PARAM_STR_LIST("tokenizer", key_tokenizer, i);
break;
default:
break;
}
}
#endif
- if (!share->key_parser[i]) {
- if (
- !(share->key_parser[i] = mrn_my_strdup(mrn_default_parser, MYF(MY_WME)))
- ) {
+ if (!share->key_tokenizer[i]) {
+ share->key_tokenizer[i] = mrn_my_strdup(mrn_default_tokenizer, MYF(MY_WME));
+ if (!share->key_tokenizer[i]) {
error = HA_ERR_OUT_OF_MEM;
goto error;
}
- share->key_parser_length[i] = strlen(share->key_parser[i]);
+ share->key_tokenizer_length[i] = strlen(share->key_tokenizer[i]);
}
if (param_string)
@@ -687,6 +695,9 @@ int mrn_add_column_param(MRN_SHARE *share, Field *field, int i)
case 5:
MRN_PARAM_STR_LIST("flags", col_flags, i);
break;
+ case 12:
+ MRN_PARAM_STR_LIST("groonga_type", col_type, i);
+ break;
default:
break;
}
@@ -741,8 +752,8 @@ int mrn_free_share_alloc(
{
if (share->index_table && share->index_table[i])
my_free(share->index_table[i]);
- if (share->key_parser[i])
- my_free(share->key_parser[i]);
+ if (share->key_tokenizer[i])
+ my_free(share->key_tokenizer[i]);
}
for (i = 0; i < share->table_share->fields; i++)
{
@@ -817,9 +828,9 @@ error_alloc_long_term_share:
MRN_SHARE *mrn_get_share(const char *table_name, TABLE *table, int *error)
{
MRN_SHARE *share;
- char *tmp_name, **index_table, **key_parser, **col_flags, **col_type;
+ char *tmp_name, **index_table, **key_tokenizer, **col_flags, **col_type;
uint length, *wrap_key_nr, *index_table_length;
- uint *key_parser_length, *col_flags_length, *col_type_length, i, j;
+ uint *key_tokenizer_length, *col_flags_length, *col_type_length, i, j;
KEY *wrap_key_info;
TABLE_SHARE *wrap_table_share;
MRN_DBUG_ENTER_FUNCTION();
@@ -834,8 +845,8 @@ MRN_SHARE *mrn_get_share(const char *table_name, TABLE *table, int *error)
&tmp_name, length + 1,
&index_table, sizeof(char *) * table->s->keys,
&index_table_length, sizeof(uint) * table->s->keys,
- &key_parser, sizeof(char *) * table->s->keys,
- &key_parser_length, sizeof(uint) * table->s->keys,
+ &key_tokenizer, sizeof(char *) * table->s->keys,
+ &key_tokenizer_length, sizeof(uint) * table->s->keys,
&col_flags, sizeof(char *) * table->s->fields,
&col_flags_length, sizeof(uint) * table->s->fields,
&col_type, sizeof(char *) * table->s->fields,
@@ -853,8 +864,8 @@ MRN_SHARE *mrn_get_share(const char *table_name, TABLE *table, int *error)
share->table_name = tmp_name;
share->index_table = index_table;
share->index_table_length = index_table_length;
- share->key_parser = key_parser;
- share->key_parser_length = key_parser_length;
+ share->key_tokenizer = key_tokenizer;
+ share->key_tokenizer_length = key_tokenizer_length;
share->col_flags = col_flags;
share->col_flags_length = col_flags_length;
share->col_type = col_type;
@@ -903,6 +914,7 @@ MRN_SHARE *mrn_get_share(const char *table_name, TABLE *table, int *error)
share->wrap_primary_key = MAX_KEY;
}
memcpy(wrap_table_share, table->s, sizeof(*wrap_table_share));
+ mrn_init_sql_alloc(current_thd, &(wrap_table_share->mem_root));
wrap_table_share->keys = share->wrap_keys;
wrap_table_share->key_info = share->wrap_key_info;
wrap_table_share->primary_key = share->wrap_primary_key;
@@ -917,20 +929,18 @@ MRN_SHARE *mrn_get_share(const char *table_name, TABLE *table, int *error)
&(wrap_table_share->LOCK_share), MY_MUTEX_INIT_SLOW);
# endif
#endif
-#ifdef MRN_TABLE_SHARE_HAVE_LOCK_HA_DATA
-# ifdef WIN32
+#ifdef WIN32
mysql_mutex_init(*mrn_table_share_lock_ha_data,
&(wrap_table_share->LOCK_ha_data), MY_MUTEX_INIT_FAST);
-# else
+#else
mysql_mutex_init(key_TABLE_SHARE_LOCK_ha_data,
&(wrap_table_share->LOCK_ha_data), MY_MUTEX_INIT_FAST);
-# endif
#endif
share->wrap_table_share = wrap_table_share;
}
if (mysql_mutex_init(mrn_share_mutex_key,
- &share->mutex,
+ &share->record_mutex,
MY_MUTEX_INIT_FAST) != 0)
{
*error = HA_ERR_OUT_OF_MEM;
@@ -953,7 +963,7 @@ MRN_SHARE *mrn_get_share(const char *table_name, TABLE *table, int *error)
error_hash_insert:
error_get_long_term_share:
- mysql_mutex_destroy(&share->mutex);
+ mysql_mutex_destroy(&share->record_mutex);
error_init_mutex:
error_parse_table_param:
mrn_free_share_alloc(share);
@@ -973,14 +983,13 @@ int mrn_free_share(MRN_SHARE *share)
plugin_unlock(NULL, share->plugin);
mrn_free_share_alloc(share);
thr_lock_delete(&share->lock);
- mysql_mutex_destroy(&share->mutex);
+ mysql_mutex_destroy(&share->record_mutex);
if (share->wrapper_mode) {
#ifdef MRN_TABLE_SHARE_HAVE_LOCK_SHARE
mysql_mutex_destroy(&(share->wrap_table_share->LOCK_share));
#endif
-#ifdef MRN_TABLE_SHARE_HAVE_LOCK_HA_DATA
mysql_mutex_destroy(&(share->wrap_table_share->LOCK_ha_data));
-#endif
+ free_root(&(share->wrap_table_share->mem_root), MYF(0));
}
my_free(share);
}
@@ -1114,7 +1123,7 @@ st_mrn_slot_data *mrn_get_slot_data(THD *thd, bool can_create)
if (slot_data == NULL) {
slot_data = (st_mrn_slot_data*) malloc(sizeof(st_mrn_slot_data));
slot_data->last_insert_record_id = GRN_ID_NIL;
- slot_data->first_alter_share = NULL;
+ slot_data->first_wrap_hton = NULL;
slot_data->alter_create_info = NULL;
slot_data->disable_keys_create_info = NULL;
slot_data->alter_connect_string = NULL;
@@ -1132,22 +1141,21 @@ st_mrn_slot_data *mrn_get_slot_data(THD *thd, bool can_create)
DBUG_RETURN(slot_data);
}
-void mrn_clear_alter_share(THD *thd)
+void mrn_clear_slot_data(THD *thd)
{
MRN_DBUG_ENTER_FUNCTION();
st_mrn_slot_data *slot_data = mrn_get_slot_data(thd, FALSE);
if (slot_data) {
- if (slot_data->first_alter_share) {
- st_mrn_alter_share *tmp_alter_share;
- st_mrn_alter_share *alter_share = slot_data->first_alter_share;
- while (alter_share)
+ if (slot_data->first_wrap_hton) {
+ st_mrn_wrap_hton *tmp_wrap_hton;
+ st_mrn_wrap_hton *wrap_hton = slot_data->first_wrap_hton;
+ while (wrap_hton)
{
- tmp_alter_share = alter_share->next;
- mrn_free_tmp_table_share(alter_share->alter_share);
- free(alter_share);
- alter_share = tmp_alter_share;
+ tmp_wrap_hton = wrap_hton->next;
+ free(wrap_hton);
+ wrap_hton = tmp_wrap_hton;
}
- slot_data->first_alter_share = NULL;
+ slot_data->first_wrap_hton = NULL;
}
slot_data->alter_create_info = NULL;
slot_data->disable_keys_create_info = NULL;
diff --git a/storage/mroonga/mrn_table.hpp b/storage/mroonga/mrn_table.hpp
index 9118455b53d..0066fc23f08 100644
--- a/storage/mroonga/mrn_table.hpp
+++ b/storage/mroonga/mrn_table.hpp
@@ -1,7 +1,7 @@
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2011-2013 Kentoku SHIBA
- Copyright(C) 2011-2013 Kouhei Sutou <kou@clear-code.com>
+ Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -43,7 +43,7 @@ typedef struct st_mroonga_share
char *table_name;
uint table_name_length;
uint use_count;
- mysql_mutex_t mutex;
+ mysql_mutex_t record_mutex;
THR_LOCK lock;
TABLE_SHARE *table_share;
TABLE_SHARE *wrap_table_share;
@@ -60,11 +60,11 @@ typedef struct st_mroonga_share
plugin_ref plugin;
handlerton *hton;
char **index_table;
- char **key_parser;
+ char **key_tokenizer;
char **col_flags;
char **col_type;
uint *index_table_length;
- uint *key_parser_length;
+ uint *key_tokenizer_length;
uint *col_flags_length;
uint *col_type_length;
uint *wrap_key_nr;
@@ -78,17 +78,17 @@ typedef struct st_mroonga_share
bool disable_keys;
} MRN_SHARE;
-struct st_mrn_alter_share
+struct st_mrn_wrap_hton
{
char path[FN_REFLEN + 1];
- TABLE_SHARE *alter_share;
- st_mrn_alter_share *next;
+ handlerton *hton;
+ st_mrn_wrap_hton *next;
};
struct st_mrn_slot_data
{
grn_id last_insert_record_id;
- st_mrn_alter_share *first_alter_share;
+ st_mrn_wrap_hton *first_wrap_hton;
HA_CREATE_INFO *alter_create_info;
HA_CREATE_INFO *disable_keys_create_info;
char *alter_connect_string;
@@ -167,7 +167,7 @@ void mrn_free_tmp_table_share(TABLE_SHARE *table_share);
KEY *mrn_create_key_info_for_table(MRN_SHARE *share, TABLE *table, int *error);
void mrn_set_bitmap_by_key(MY_BITMAP *map, KEY *key_info);
st_mrn_slot_data *mrn_get_slot_data(THD *thd, bool can_create);
-void mrn_clear_alter_share(THD *thd);
+void mrn_clear_slot_data(THD *thd);
#ifdef __cplusplus
}
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_embedded.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_embedded.inc
new file mode 100644
index 00000000000..02c21ff32c6
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_embedded.inc
@@ -0,0 +1,19 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--disable_query_log
+let $libgroonga_embedded = `SELECT @@mroonga_libgroonga_embedded;`;
+--enable_query_log
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_groonga_plugin_register.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_groonga_plugin_register.inc
new file mode 100644
index 00000000000..414eb1702de
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_groonga_plugin_register.inc
@@ -0,0 +1,22 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/check_libgroonga_embedded.inc
+
+if ($libgroonga_embedded) {
+ --source ../../include/mroonga/have_mroonga_deinit.inc
+ skip "This test requires plugin_register of Groonga. libgroonga embedded build doesn't support it.";
+}
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_fulltext_index_comment.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mariadb.inc
index e8c79936cc6..24c65a61dd9 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_fulltext_index_comment.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mariadb.inc
@@ -1,4 +1,4 @@
-# Copyright(C) 2012 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -14,12 +14,8 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---source ../../include/mroonga/check_version.inc
+--source ../../include/mroonga/check_mariadb.inc
-if ($version_55_or_later) {
- let $fulltext_index_comment = 1;
-}
-
-if (!$fulltext_index_comment) {
- skip Fulltext index comment is available in version 5.5 or later;
+if (!$mariadb) {
+ skip This test is for MariaDB;
}
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga.inc
index 2ebec2df8c4..cd17adebfe9 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga.inc
@@ -38,6 +38,9 @@ if (!$have_default_storage_engine_variable) {
let have_default_tmp_storage_engine_variable=`SELECT 1 FROM information_schema.global_variables WHERE variable_name = "default_tmp_storage_engine"`;
if ($have_default_tmp_storage_engine_variable) {
let original_default_tmp_storage_engine=`SELECT variable_value FROM information_schema.global_variables WHERE variable_name = "default_tmp_storage_engine"`;
+ if (!$original_default_tmp_storage_engine) {
+ let original_default_tmp_storage_engine=NULL;
+ }
set default_tmp_storage_engine=Mroonga;
}
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_with_flags.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_flags_comment.result
index e441df32c92..e441df32c92 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_with_flags.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_flags_comment.result
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_flags_parameter.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_flags_parameter.result
new file mode 100644
index 00000000000..6f2a1870ac7
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_flags_parameter.result
@@ -0,0 +1,17 @@
+CREATE TABLE tags (
+id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY
+) DEFAULT CHARSET=utf8;
+ALTER TABLE tags ADD COLUMN name VARCHAR(64) FLAGS='COLUMN_VECTOR';
+SHOW CREATE TABLE tags;
+Table Create Table
+tags CREATE TABLE `tags` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `name` varchar(64) DEFAULT NULL `FLAGS`='COLUMN_VECTOR',
+ PRIMARY KEY (`id`)
+) ENGINE=Mroonga DEFAULT CHARSET=utf8
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
+table_create tags TABLE_PAT_KEY UInt32
+column_create tags id COLUMN_SCALAR UInt32
+column_create tags name COLUMN_VECTOR ShortText
+DROP TABLE tags;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_groonga_type_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_groonga_type_comment.result
new file mode 100644
index 00000000000..0bd8985f2e8
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_groonga_type_comment.result
@@ -0,0 +1,18 @@
+CREATE TABLE tags (
+id INT UNSIGNED PRIMARY KEY
+) DEFAULT CHARSET=utf8;
+CREATE TABLE bugs (
+id INT UNSIGNED PRIMARY KEY
+) DEFAULT CHARSET=utf8;
+ALTER TABLE bugs ADD COLUMN name VARCHAR(64) COMMENT 'groonga_type "tags"';
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
+table_create tags TABLE_PAT_KEY UInt32
+column_create tags id COLUMN_SCALAR UInt32
+
+table_create bugs TABLE_PAT_KEY UInt32
+column_create bugs id COLUMN_SCALAR UInt32
+
+column_create bugs name COLUMN_SCALAR tags
+DROP TABLE bugs;
+DROP TABLE tags;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_groonga_type_parameter.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_groonga_type_parameter.result
new file mode 100644
index 00000000000..fe484372999
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_groonga_type_parameter.result
@@ -0,0 +1,26 @@
+CREATE TABLE tags (
+id INT UNSIGNED PRIMARY KEY
+) DEFAULT CHARSET=utf8;
+CREATE TABLE bugs (
+id INT UNSIGNED PRIMARY KEY
+) DEFAULT CHARSET=utf8;
+ALTER TABLE bugs ADD COLUMN name VARCHAR(64) GROONGA_TYPE='tags';
+SHOW CREATE TABLE bugs;
+Table Create Table
+bugs CREATE TABLE `bugs` (
+ `id` int(10) unsigned NOT NULL,
+ `name` varchar(64) DEFAULT NULL `GROONGA_TYPE`='tags',
+ PRIMARY KEY (`id`),
+ CONSTRAINT `name` FOREIGN KEY (`name`) REFERENCES `test`.`tags` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
+) ENGINE=Mroonga DEFAULT CHARSET=utf8
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
+table_create tags TABLE_PAT_KEY UInt32
+column_create tags id COLUMN_SCALAR UInt32
+
+table_create bugs TABLE_PAT_KEY UInt32
+column_create bugs id COLUMN_SCALAR UInt32
+
+column_create bugs name COLUMN_SCALAR tags
+DROP TABLE bugs;
+DROP TABLE tags;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_with_type.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_type_comment.result
index b4c3044c7d5..b4c3044c7d5 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_with_type.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_type_comment.result
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_token_filters_one_token_filter.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_token_filters_one_token_filter.result
index 21784decb88..65e608dddeb 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_token_filters_one_token_filter.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_token_filters_one_token_filter.result
@@ -1,5 +1,5 @@
-SELECT mroonga_command("register token_filters/stop_word");
-mroonga_command("register token_filters/stop_word")
+SELECT mroonga_command("plugin_register token_filters/stop_word");
+mroonga_command("plugin_register token_filters/stop_word")
true
SET NAMES utf8;
CREATE TABLE memos (
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_multiple.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_multiple.result
index bc5b0132e43..c73030805c8 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_multiple.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_multiple.result
@@ -20,12 +20,14 @@ SHOW CREATE TABLE diaries;
Table Create Table
diaries CREATE TABLE `diaries` (
`description` text,
- `internal_id` int(11) NOT NULL DEFAULT '0',
+ `internal_id` int(11) NOT NULL,
`subject` text,
PRIMARY KEY (`internal_id`)
) ENGINE=Mroonga DEFAULT CHARSET=utf8
INSERT INTO diaries (subject, description)
VALUES ("groonga (1)", "starting groonga.");
+Warnings:
+Warning 1364 Field 'internal_id' doesn't have a default value
SELECT * FROM diaries;
description internal_id subject
starting groonga. 0 groonga (1)
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_token_filter.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_token_filter.result
index 1c96236230b..60d302cc6a5 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_token_filter.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_token_filter.result
@@ -1,5 +1,5 @@
-SELECT mroonga_command("register token_filters/stop_word");
-mroonga_command("register token_filters/stop_word")
+SELECT mroonga_command("plugin_register token_filters/stop_word");
+mroonga_command("plugin_register token_filters/stop_word")
true
CREATE TABLE terms (
term VARCHAR(64) NOT NULL PRIMARY KEY,
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_date_strict.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_date_strict.result
new file mode 100644
index 00000000000..c4d73e2f57d
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_date_strict.result
@@ -0,0 +1,23 @@
+DROP TABLE IF EXISTS timestamps;
+CREATE TABLE timestamps (
+id INT PRIMARY KEY AUTO_INCREMENT,
+create_dt DATETIME
+) DEFAULT CHARSET UTF8;
+SHOW CREATE TABLE timestamps;
+Table Create Table
+timestamps CREATE TABLE `timestamps` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `create_dt` datetime DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=Mroonga DEFAULT CHARSET=utf8
+SET sql_mode='STRICT_TRANS_TABLES';
+INSERT INTO timestamps (create_dt) VALUES ("0000-00-00 00:00:00");
+ERROR 22003: Out of range value for column 'create_dt' at row 1
+SET sql_mode=default;
+SELECT * FROM timestamps;
+id create_dt
+INSERT INTO timestamps (create_dt) VALUES ("2015-06-17 00:00:00");
+SELECT * FROM timestamps;
+id create_dt
+2 2015-06-17 00:00:00
+DROP TABLE timestamps;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_vector.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_flags_comment.result
index af3c19e9bb0..af3c19e9bb0 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_vector.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_flags_comment.result
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_flags_parameter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_flags_parameter.result
new file mode 100644
index 00000000000..9e089e53f49
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_flags_parameter.result
@@ -0,0 +1,17 @@
+CREATE TABLE bugs (
+id INT UNSIGNED PRIMARY KEY,
+tags TEXT FLAGS='COLUMN_VECTOR'
+) DEFAULT CHARSET=utf8;
+SHOW CREATE TABLE bugs;
+Table Create Table
+bugs CREATE TABLE `bugs` (
+ `id` int(10) unsigned NOT NULL,
+ `tags` text `FLAGS`='COLUMN_VECTOR',
+ PRIMARY KEY (`id`)
+) ENGINE=Mroonga DEFAULT CHARSET=utf8
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
+table_create bugs TABLE_PAT_KEY UInt32
+column_create bugs id COLUMN_SCALAR UInt32
+column_create bugs tags COLUMN_VECTOR LongText
+DROP TABLE bugs;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_groonga_type_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_groonga_type_comment.result
new file mode 100644
index 00000000000..5e5980ac62b
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_groonga_type_comment.result
@@ -0,0 +1,18 @@
+CREATE TABLE tags (
+name VARCHAR(64) PRIMARY KEY
+) DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+CREATE TABLE bugs (
+id INT UNSIGNED PRIMARY KEY,
+tag VARCHAR(64) COMMENT 'groonga_type "tags"'
+) DEFAULT CHARSET=utf8;
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
+table_create tags TABLE_PAT_KEY ShortText
+column_create tags name COLUMN_SCALAR ShortText
+
+table_create bugs TABLE_PAT_KEY UInt32
+column_create bugs id COLUMN_SCALAR UInt32
+
+column_create bugs tag COLUMN_SCALAR tags
+DROP TABLE bugs;
+DROP TABLE tags;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_groonga_type_nonexistent.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_groonga_type_nonexistent.result
new file mode 100644
index 00000000000..99dc30aaa02
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_groonga_type_nonexistent.result
@@ -0,0 +1,6 @@
+DROP TABLE IF EXISTS bugs;
+CREATE TABLE bugs (
+id INT UNSIGNED PRIMARY KEY,
+tag VARCHAR(64) COMMENT 'groonga_type "Nonexistent"'
+) DEFAULT CHARSET=utf8mb4;
+ERROR HY000: unknown custom Groonga type name for <tag> column: <Nonexistent>
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_groonga_type_parameter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_groonga_type_parameter.result
new file mode 100644
index 00000000000..24941f043c7
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_groonga_type_parameter.result
@@ -0,0 +1,26 @@
+CREATE TABLE tags (
+name VARCHAR(64) PRIMARY KEY
+) DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+CREATE TABLE bugs (
+id INT UNSIGNED PRIMARY KEY,
+tag VARCHAR(64) GROONGA_TYPE='tags'
+) DEFAULT CHARSET=utf8;
+SHOW CREATE TABLE bugs;
+Table Create Table
+bugs CREATE TABLE `bugs` (
+ `id` int(10) unsigned NOT NULL,
+ `tag` varchar(64) DEFAULT NULL `GROONGA_TYPE`='tags',
+ PRIMARY KEY (`id`),
+ CONSTRAINT `tag` FOREIGN KEY (`tag`) REFERENCES `test`.`tags` (`name`) ON DELETE RESTRICT ON UPDATE RESTRICT
+) ENGINE=Mroonga DEFAULT CHARSET=utf8
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
+table_create tags TABLE_PAT_KEY ShortText
+column_create tags name COLUMN_SCALAR ShortText
+
+table_create bugs TABLE_PAT_KEY UInt32
+column_create bugs id COLUMN_SCALAR UInt32
+
+column_create bugs tag COLUMN_SCALAR tags
+DROP TABLE bugs;
+DROP TABLE tags;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_reference_type.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_type_comment.result
index dc3f39d286e..dc3f39d286e 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_reference_type.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_type_comment.result
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_type_nonexistent.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_type_nonexistent.result
new file mode 100644
index 00000000000..a66a2bd2185
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_type_nonexistent.result
@@ -0,0 +1,6 @@
+DROP TABLE IF EXISTS bugs;
+CREATE TABLE bugs (
+id INT UNSIGNED PRIMARY KEY,
+tag VARCHAR(64) COMMENT 'type "Nonexistent"'
+) DEFAULT CHARSET=utf8mb4;
+ERROR HY000: unknown custom Groonga type name for <tag> column: <Nonexistent>
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_comment.result
new file mode 100644
index 00000000000..828de3ebbad
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_comment.result
@@ -0,0 +1,9 @@
+SET NAMES utf8;
+CREATE TABLE memos (
+content VARCHAR(64) NOT NULL,
+FULLTEXT INDEX (content) COMMENT 'flags "WITH_POSITION|WITH_WEIGHT"'
+) DEFAULT CHARSET=utf8;
+SELECT mroonga_command("dump --dump_plugins no --dump_schema no");
+mroonga_command("dump --dump_plugins no --dump_schema no")
+column_create memos-content index COLUMN_INDEX|WITH_WEIGHT|WITH_POSITION memos content
+DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_none.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_none.result
index c9283db72bb..b5368b433e6 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_none.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_none.result
@@ -1,7 +1,7 @@
SET NAMES utf8;
CREATE TABLE memos (
content VARCHAR(64) NOT NULL,
-FULLTEXT INDEX (content) COMMENT 'index_flags "NONE"'
+FULLTEXT INDEX (content) COMMENT 'flags "NONE"'
) DEFAULT CHARSET=utf8;
SELECT mroonga_command("dump --dump_plugins no --dump_schema no");
mroonga_command("dump --dump_plugins no --dump_schema no")
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_parameter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_parameter.result
new file mode 100644
index 00000000000..7e0d29a1e1f
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_parameter.result
@@ -0,0 +1,15 @@
+SET NAMES utf8;
+CREATE TABLE memos (
+content VARCHAR(64) NOT NULL,
+FULLTEXT INDEX (content) FLAGS='WITH_POSITION|WITH_WEIGHT'
+) DEFAULT CHARSET=utf8;
+SHOW CREATE TABLE memos;
+Table Create Table
+memos CREATE TABLE `memos` (
+ `content` varchar(64) NOT NULL,
+ FULLTEXT KEY `content` (`content`) `FLAGS`='WITH_POSITION|WITH_WEIGHT'
+) ENGINE=Mroonga DEFAULT CHARSET=utf8
+SELECT mroonga_command("dump --dump_plugins no --dump_schema no");
+mroonga_command("dump --dump_plugins no --dump_schema no")
+column_create memos-content index COLUMN_INDEX|WITH_WEIGHT|WITH_POSITION memos content
+DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_index_flags_none.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_index_flags_none.result
new file mode 100644
index 00000000000..c9283db72bb
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_index_flags_none.result
@@ -0,0 +1,9 @@
+SET NAMES utf8;
+CREATE TABLE memos (
+content VARCHAR(64) NOT NULL,
+FULLTEXT INDEX (content) COMMENT 'index_flags "NONE"'
+) DEFAULT CHARSET=utf8;
+SELECT mroonga_command("dump --dump_plugins no --dump_schema no");
+mroonga_command("dump --dump_plugins no --dump_schema no")
+column_create memos-content index COLUMN_INDEX memos content
+DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_with_position_and_with_weight.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_index_flags_with_position_and_with_weight.result
index 853845d5c15..853845d5c15 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_with_position_and_with_weight.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_index_flags_with_position_and_with_weight.result
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_fulltext_index_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_comment.result
index e2d405a1e35..e2d405a1e35 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_fulltext_index_comment.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_comment.result
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_fulltext_index_no_utf8_charset_with_utf8_normalizer.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_no_utf8_charset_with_utf8_normalizer.result
index 9d12e2d0e39..9d12e2d0e39 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_fulltext_index_no_utf8_charset_with_utf8_normalizer.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_no_utf8_charset_with_utf8_normalizer.result
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_fulltext_index_none.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_none.result
index 52c6f055e88..52c6f055e88 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_fulltext_index_none.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_none.result
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_parameter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_parameter.result
new file mode 100644
index 00000000000..d68de436c92
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_parameter.result
@@ -0,0 +1,21 @@
+DROP TABLE IF EXISTS memos;
+SET NAMES utf8;
+CREATE TABLE memos (
+id INT NOT NULL PRIMARY KEY,
+content TEXT NOT NULL,
+FULLTEXT INDEX (content) NORMALIZER='NormalizerAuto'
+) DEFAULT CHARSET=utf8;
+SHOW CREATE TABLE memos;
+Table Create Table
+memos CREATE TABLE `memos` (
+ `id` int(11) NOT NULL,
+ `content` text NOT NULL,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `content` (`content`) `NORMALIZER`='NormalizerAuto'
+) ENGINE=Mroonga DEFAULT CHARSET=utf8
+INSERT INTO memos VALUES (1, "1æ—¥ã®æ¶ˆè²»ãŒã¯ç´„2000㌔ãŒ");
+SELECT * FROM memos
+WHERE MATCH (content) AGAINST ("+カロリー" IN BOOLEAN MODE);
+id content
+1 1æ—¥ã®æ¶ˆè²»ãŒã¯ç´„2000㌔ãŒ
+DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_comment.result
new file mode 100644
index 00000000000..4088caf49d5
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_comment.result
@@ -0,0 +1,31 @@
+DROP TABLE IF EXISTS diaries;
+CREATE TABLE diaries (
+id int PRIMARY KEY AUTO_INCREMENT,
+body text,
+FULLTEXT INDEX body_index (body)
+COMMENT 'parser "TokenBigramSplitSymbolAlphaDigit"'
+) DEFAULT CHARSET utf8;
+SHOW CREATE TABLE diaries;
+Table Create Table
+diaries CREATE TABLE `diaries` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `body` text,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `body_index` (`body`) COMMENT 'parser "TokenBigramSplitSymbolAlphaDigit"'
+) ENGINE=Mroonga DEFAULT CHARSET=utf8
+INSERT INTO diaries (body) VALUES ("will start Groonga!");
+INSERT INTO diaries (body) VALUES ("starting Groonga...");
+INSERT INTO diaries (body) VALUES ("started Groonga.");
+SELECT * FROM diaries;
+id body
+1 will start Groonga!
+2 starting Groonga...
+3 started Groonga.
+SELECT * FROM diaries
+WHERE MATCH(body) AGAINST("+start" IN BOOLEAN MODE)
+ORDER BY id;
+id body
+1 will start Groonga!
+2 starting Groonga...
+3 started Groonga.
+DROP TABLE diaries;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_parser_default.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_default.result
index 6c04cae59f2..a18614d19fc 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_parser_default.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_default.result
@@ -14,20 +14,20 @@ diaries CREATE TABLE `diaries` (
PRIMARY KEY (`id`),
FULLTEXT KEY `body_index` (`body`)
) ENGINE=Mroonga DEFAULT CHARSET=utf8
-insert into diaries (body) values ("will start groonga!");
-insert into diaries (body) values ("starting groonga...");
-insert into diaries (body) values ("started groonga.");
-insert into diaries (body) values ("finished groonga.");
+insert into diaries (body) values ("will start Groonga!");
+insert into diaries (body) values ("starting Groonga...");
+insert into diaries (body) values ("started Groonga.");
+insert into diaries (body) values ("finished Groonga.");
select * from diaries;
id body
-1 will start groonga!
-2 starting groonga...
-3 started groonga.
-4 finished groonga.
-select * from diaries where match(body) against("start");
+1 will start Groonga!
+2 starting Groonga...
+3 started Groonga.
+4 finished Groonga.
+select * from diaries where match(body) against("+start" IN BOOLEAN MODE) order by id;
id body
-1 will start groonga!
-2 starting groonga...
-3 started groonga.
+1 will start Groonga!
+2 starting Groonga...
+3 started Groonga.
drop table diaries;
set global mroonga_default_parser=@mroonga_default_parser_backup;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_parser_off.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_off.result
index 77765f61dc3..77765f61dc3 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_parser_off.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_off.result
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_index_comment_multiple_token_filters.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_multiple_token_filters.result
index 785c5d785b9..c730bafc8e3 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_index_comment_multiple_token_filters.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_multiple_token_filters.result
@@ -1,5 +1,5 @@
-SELECT mroonga_command("register token_filters/stop_word");
-mroonga_command("register token_filters/stop_word")
+SELECT mroonga_command("plugin_register token_filters/stop_word");
+mroonga_command("plugin_register token_filters/stop_word")
true
SET NAMES utf8;
CREATE TABLE memos (
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_index_comment_one_token_filter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_one_token_filter.result
index 9ce60054300..e0809eb0f4b 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_index_comment_one_token_filter.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_one_token_filter.result
@@ -1,5 +1,5 @@
-SELECT mroonga_command("register token_filters/stop_word");
-mroonga_command("register token_filters/stop_word")
+SELECT mroonga_command("plugin_register token_filters/stop_word");
+mroonga_command("plugin_register token_filters/stop_word")
true
SET NAMES utf8;
CREATE TABLE memos (
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_parameter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_parameter.result
new file mode 100644
index 00000000000..df529282a91
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_parameter.result
@@ -0,0 +1,23 @@
+SELECT mroonga_command("plugin_register token_filters/stop_word");
+mroonga_command("plugin_register token_filters/stop_word")
+true
+SET NAMES utf8;
+CREATE TABLE memos (
+content VARCHAR(64) NOT NULL,
+FULLTEXT INDEX (content) TOKEN_FILTERS='TokenFilterStopWord,TokenFilterStopWord'
+) DEFAULT CHARSET=utf8;
+SHOW CREATE TABLE memos;
+Table Create Table
+memos CREATE TABLE `memos` (
+ `content` varchar(64) NOT NULL,
+ FULLTEXT KEY `content` (`content`) `TOKEN_FILTERS`='TokenFilterStopWord,TokenFilterStopWord'
+) ENGINE=Mroonga DEFAULT CHARSET=utf8
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
+table_create memos TABLE_NO_KEY
+column_create memos content COLUMN_SCALAR ShortText
+
+table_create memos-content TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord,TokenFilterStopWord
+
+column_create memos-content index COLUMN_INDEX|WITH_POSITION memos content
+DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_comment.result
new file mode 100644
index 00000000000..5b8d0cd780e
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_comment.result
@@ -0,0 +1,31 @@
+DROP TABLE IF EXISTS diaries;
+CREATE TABLE diaries (
+id int PRIMARY KEY AUTO_INCREMENT,
+body text,
+FULLTEXT INDEX body_index (body)
+COMMENT 'tokenizer "TokenBigramSplitSymbolAlphaDigit"'
+) DEFAULT CHARSET utf8;
+SHOW CREATE TABLE diaries;
+Table Create Table
+diaries CREATE TABLE `diaries` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `body` text,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `body_index` (`body`) COMMENT 'tokenizer "TokenBigramSplitSymbolAlphaDigit"'
+) ENGINE=Mroonga DEFAULT CHARSET=utf8
+INSERT INTO diaries (body) VALUES ("will start Groonga!");
+INSERT INTO diaries (body) VALUES ("starting Groonga...");
+INSERT INTO diaries (body) VALUES ("started Groonga.");
+SELECT * FROM diaries;
+id body
+1 will start Groonga!
+2 starting Groonga...
+3 started Groonga.
+SELECT * FROM diaries
+WHERE MATCH(body) AGAINST("+start" IN BOOLEAN MODE)
+ORDER BY id;
+id body
+1 will start Groonga!
+2 starting Groonga...
+3 started Groonga.
+DROP TABLE diaries;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_default.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_default.result
new file mode 100644
index 00000000000..9efa08bab53
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_default.result
@@ -0,0 +1,33 @@
+drop table if exists diaries;
+set @mroonga_default_tokenizer_backup=@@mroonga_default_tokenizer;
+set global mroonga_default_tokenizer=TokenBigramSplitSymbolAlphaDigit;
+create table diaries (
+id int primary key auto_increment,
+body text,
+fulltext index body_index (body)
+) default charset utf8;
+show create table diaries;
+Table Create Table
+diaries CREATE TABLE `diaries` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `body` text,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `body_index` (`body`)
+) ENGINE=Mroonga DEFAULT CHARSET=utf8
+insert into diaries (body) values ("will start Groonga!");
+insert into diaries (body) values ("starting Groonga...");
+insert into diaries (body) values ("started Groonga.");
+insert into diaries (body) values ("finished Groonga.");
+select * from diaries;
+id body
+1 will start Groonga!
+2 starting Groonga...
+3 started Groonga.
+4 finished Groonga.
+select * from diaries where match(body) against("+start" IN BOOLEAN MODE) order by id;
+id body
+1 will start Groonga!
+2 starting Groonga...
+3 started Groonga.
+drop table diaries;
+set global mroonga_default_tokenizer=@mroonga_default_tokenizer_backup;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_off.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_off.result
new file mode 100644
index 00000000000..780ac2faa3d
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_off.result
@@ -0,0 +1,42 @@
+DROP TABLE IF EXISTS variables;
+CREATE TABLE variables (
+id INT PRIMARY KEY AUTO_INCREMENT,
+name TEXT,
+FULLTEXT INDEX (name) COMMENT 'tokenizer "off"'
+) DEFAULT CHARSET=utf8;
+SHOW CREATE TABLE variables;
+Table Create Table
+variables CREATE TABLE `variables` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` text,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `name` (`name`) COMMENT 'tokenizer "off"'
+) ENGINE=Mroonga DEFAULT CHARSET=utf8
+INSERT INTO variables (name) VALUES ("mroonga_database_path_prefix");
+INSERT INTO variables (name) VALUES ("mroonga_default_tokenizer");
+INSERT INTO variables (name) VALUES ("mroonga_default_wrapper_engine");
+INSERT INTO variables (name) VALUES ("mroonga_dry_write");
+INSERT INTO variables (name) VALUES ("mroonga_enable_optimization");
+INSERT INTO variables (name) VALUES ("mroonga_libgroonga_version");
+INSERT INTO variables (name) VALUES ("mroonga_log_file");
+INSERT INTO variables (name) VALUES ("mroonga_log_level");
+INSERT INTO variables (name) VALUES ("mroonga_match_escalation_threshold");
+INSERT INTO variables (name) VALUES ("mroonga_version");
+SELECT * FROM variables;
+id name
+1 mroonga_database_path_prefix
+2 mroonga_default_tokenizer
+3 mroonga_default_wrapper_engine
+4 mroonga_dry_write
+5 mroonga_enable_optimization
+6 mroonga_libgroonga_version
+7 mroonga_log_file
+8 mroonga_log_level
+9 mroonga_match_escalation_threshold
+10 mroonga_version
+SELECT * FROM variables
+WHERE MATCH (name) AGAINST ("mroonga_default*" IN BOOLEAN MODE);
+id name
+3 mroonga_default_wrapper_engine
+2 mroonga_default_tokenizer
+DROP TABLE variables;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_parameter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_parameter.result
new file mode 100644
index 00000000000..67170925826
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_parameter.result
@@ -0,0 +1,30 @@
+DROP TABLE IF EXISTS diaries;
+CREATE TABLE diaries (
+id int PRIMARY KEY AUTO_INCREMENT,
+body text,
+FULLTEXT INDEX body_index (body) TOKENIZER='TokenBigramSplitSymbolAlphaDigit'
+) DEFAULT CHARSET utf8;
+SHOW CREATE TABLE diaries;
+Table Create Table
+diaries CREATE TABLE `diaries` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `body` text,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `body_index` (`body`) `TOKENIZER`='TokenBigramSplitSymbolAlphaDigit'
+) ENGINE=Mroonga DEFAULT CHARSET=utf8
+INSERT INTO diaries (body) VALUES ("will start Groonga!");
+INSERT INTO diaries (body) VALUES ("starting Groonga...");
+INSERT INTO diaries (body) VALUES ("started Groonga.");
+SELECT * FROM diaries;
+id body
+1 will start Groonga!
+2 starting Groonga...
+3 started Groonga.
+SELECT * FROM diaries
+WHERE MATCH(body) AGAINST("+start" IN BOOLEAN MODE)
+ORDER BY id;
+id body
+1 will start Groonga!
+2 starting Groonga...
+3 started Groonga.
+DROP TABLE diaries;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_primary_key_table_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_normalizer_default.result
index dbf69362ee7..dbf69362ee7 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_primary_key_table_comment.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_normalizer_default.result
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_primary_key_table_comment_with_using_hash.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_normalizer_hash.result
index 5e4f4afa377..5e4f4afa377 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_primary_key_table_comment_with_using_hash.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_normalizer_hash.result
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_table_comment_multiple_token_filters.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_multiple_token_filters.result
index de1946e9214..6308b33d4cf 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_table_comment_multiple_token_filters.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_multiple_token_filters.result
@@ -1,5 +1,5 @@
-SELECT mroonga_command("register token_filters/stop_word");
-mroonga_command("register token_filters/stop_word")
+SELECT mroonga_command("plugin_register token_filters/stop_word");
+mroonga_command("plugin_register token_filters/stop_word")
true
CREATE TABLE terms (
term VARCHAR(64) NOT NULL PRIMARY KEY,
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_table_comment_one_token_filter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_one_token_filter.result
index f3349980db1..2f4a90d4086 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_table_comment_one_token_filter.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_one_token_filter.result
@@ -1,5 +1,5 @@
-SELECT mroonga_command("register token_filters/stop_word");
-mroonga_command("register token_filters/stop_word")
+SELECT mroonga_command("plugin_register token_filters/stop_word");
+mroonga_command("plugin_register token_filters/stop_word")
true
CREATE TABLE terms (
term VARCHAR(64) NOT NULL PRIMARY KEY,
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_token_filters_skip.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_stop_word.result
index 290f96df35d..bc21ed97502 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_token_filters_skip.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_stop_word.result
@@ -1,5 +1,5 @@
-SELECT mroonga_command("register token_filters/stop_word");
-mroonga_command("register token_filters/stop_word")
+SELECT mroonga_command("plugin_register token_filters/stop_word");
+mroonga_command("plugin_register token_filters/stop_word")
true
CREATE TABLE terms (
term VARCHAR(64) NOT NULL PRIMARY KEY,
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result
index f45e8fd4fb6..0c81bf6c3ad 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result
@@ -10,9 +10,10 @@ INSERT INTO memos VALUES ("Today is fine.");
INSERT INTO memos VALUES ("Tomorrow will be fine.");
INSERT INTO memos VALUES ("Yesterday was fine.");
SELECT * FROM memos
-WHERE MATCH (content) AGAINST ("*DOR today good" IN BOOLEAN MODE);
+WHERE MATCH (content) AGAINST ("*DOR today good" IN BOOLEAN MODE)
+ORDER BY content;
content
-Today is good day.
Today is fine.
+Today is good day.
Tomorrow will be good day.
DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result
index 103866902c2..dfeb71f0d14 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result
@@ -10,9 +10,10 @@ INSERT INTO memos VALUES ("Today is fine.");
INSERT INTO memos VALUES ("Tomorrow will be fine.");
INSERT INTO memos VALUES ("Yesterday was fine.");
SELECT * FROM memos
-WHERE MATCH (content) AGAINST ("*DOR today -good tomorrow" IN BOOLEAN MODE);
+WHERE MATCH (content) AGAINST ("*DOR today -good tomorrow" IN BOOLEAN MODE)
+ORDER BY content;
content
-Tomorrow will be good day.
Today is fine.
Tomorrow will be fine.
+Tomorrow will be good day.
DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result
index fd52868b4bc..e72cf8d4052 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result
@@ -10,9 +10,10 @@ INSERT INTO memos VALUES ("Today is fine.");
INSERT INTO memos VALUES ("Tomorrow will be fine.");
INSERT INTO memos VALUES ("Yesterday was fine.");
SELECT * FROM memos
-WHERE MATCH (content) AGAINST ("*DOR today +good tomorrow" IN BOOLEAN MODE);
+WHERE MATCH (content) AGAINST ("*DOR today +good tomorrow" IN BOOLEAN MODE)
+ORDER BY content;
content
Today is good day.
-Tomorrow will be good day.
Tomorrow will be fine.
+Tomorrow will be good day.
DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.result
new file mode 100644
index 00000000000..7a30baab5a0
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.result
@@ -0,0 +1,14 @@
+DROP TABLE IF EXISTS memos;
+SET NAMES utf8;
+CREATE TABLE memos (
+content TEXT,
+FULLTEXT INDEX (content)
+) DEFAULT CHARSET=utf8;
+INSERT INTO memos VALUES ("Today is good day.");
+INSERT INTO memos VALUES ("Tomorrow will be good day.");
+INSERT INTO memos VALUES ("Today is fine.");
+SELECT * FROM memos
+WHERE MATCH (content) AGAINST ("*D+ today fi*" IN BOOLEAN MODE);
+content
+Today is fine.
+DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_not_match_against.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_not_match_against.result
index 2c1666369a5..b6d6febf0b3 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_not_match_against.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_not_match_against.result
@@ -18,21 +18,21 @@ c1 c2 c3
6 20 ka ki ku ke ko
7 20 aa ii uu ee oo
8 20 ka ki ku ke ko
-select * from t1 where match(c3) against("uu");
+select * from t1 where match(c3) against("+uu" in boolean mode) order by c1;
c1 c2 c3
1 10 aa ii uu ee oo
3 10 aa ii uu ee oo
5 20 aa ii uu ee oo
7 20 aa ii uu ee oo
-select * from t1 where not match(c3) against("uu");
+select * from t1 where not match(c3) against("+uu" in boolean mode) order by c1;
c1 c2 c3
2 10 ka ki ku ke ko
4 10 ka ki ku ke ko
6 20 ka ki ku ke ko
8 20 ka ki ku ke ko
-select * from t1 where match(c3) against("dummy");
+select * from t1 where match(c3) against("+dummy" in boolean mode) order by c1;
c1 c2 c3
-select * from t1 where not match(c3) against("dummy");
+select * from t1 where not match(c3) against("+dummy" in boolean mode) order by c1;
c1 c2 c3
1 10 aa ii uu ee oo
2 10 ka ki ku ke ko
@@ -42,26 +42,26 @@ c1 c2 c3
6 20 ka ki ku ke ko
7 20 aa ii uu ee oo
8 20 ka ki ku ke ko
-select * from t1 where c1 = 4 and not match(c3) against("uu");
+select * from t1 where c1 = 4 and not match(c3) against("+uu" in boolean mode) order by c1;
c1 c2 c3
4 10 ka ki ku ke ko
-select * from t1 where c1 <= 4 and not match(c3) against("uu");
+select * from t1 where c1 <= 4 and not match(c3) against("+uu" in boolean mode) order by c1;
c1 c2 c3
2 10 ka ki ku ke ko
4 10 ka ki ku ke ko
-select * from t1 where c1 > 4 and not match(c3) against("uu");
+select * from t1 where c1 > 4 and not match(c3) against("+uu" in boolean mode) order by c1;
c1 c2 c3
6 20 ka ki ku ke ko
8 20 ka ki ku ke ko
-select * from t1 where c2 = 10 and not match(c3) against("uu");
+select * from t1 where c2 = 10 and not match(c3) against("+uu" in boolean mode) order by c1;
c1 c2 c3
2 10 ka ki ku ke ko
4 10 ka ki ku ke ko
-select * from t1 where c2 >= 15 and not match(c3) against("uu");
+select * from t1 where c2 >= 15 and not match(c3) against("+uu" in boolean mode) order by c1;
c1 c2 c3
6 20 ka ki ku ke ko
8 20 ka ki ku ke ko
-select * from t1 where c2 < 15 and not match(c3) against("uu");
+select * from t1 where c2 < 15 and not match(c3) against("+uu" in boolean mode) order by c1;
c1 c2 c3
2 10 ka ki ku ke ko
4 10 ka ki ku ke ko
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_parser_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_parser_comment.result
deleted file mode 100644
index f2abfe85dd6..00000000000
--- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_parser_comment.result
+++ /dev/null
@@ -1,29 +0,0 @@
-drop table if exists diaries;
-create table diaries (
-id int primary key auto_increment,
-body text,
-fulltext index body_index (body)
-comment 'parser "TokenBigramSplitSymbolAlphaDigit"'
-) default charset utf8;
-show create table diaries;
-Table Create Table
-diaries CREATE TABLE `diaries` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `body` text,
- PRIMARY KEY (`id`),
- FULLTEXT KEY `body_index` (`body`) COMMENT 'parser "TokenBigramSplitSymbolAlphaDigit"'
-) ENGINE=Mroonga DEFAULT CHARSET=utf8
-insert into diaries (body) values ("will start groonga!");
-insert into diaries (body) values ("starting groonga...");
-insert into diaries (body) values ("started groonga.");
-select * from diaries;
-id body
-1 will start groonga!
-2 starting groonga...
-3 started groonga.
-select * from diaries where match(body) against("start");
-id body
-1 will start groonga!
-2 starting groonga...
-3 started groonga.
-drop table diaries;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.result
new file mode 100644
index 00000000000..155faf85510
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.result
@@ -0,0 +1,21 @@
+DROP TABLE IF EXISTS ranges;
+CREATE TABLE ranges (
+id int PRIMARY KEY,
+start datetime,
+end datetime,
+UNIQUE KEY range_key(start, end)
+);
+INSERT INTO ranges VALUES (1, "1990-00-00 00:00:00", "2012-10-05 23:59:59");
+Warnings:
+Warning 1265 Data truncated for column 'start' at row 1
+SELECT * FROM ranges;
+id start end
+1 1990-01-01 00:00:00 2012-10-05 23:59:59
+DELETE FROM ranges WHERE id = 1;
+INSERT INTO ranges VALUES (1, "1990-00-00 00:00:00", "2012-10-05 23:59:59");
+Warnings:
+Warning 1265 Data truncated for column 'start' at row 1
+SELECT * FROM ranges;
+id start end
+1 1990-01-01 00:00:00 2012-10-05 23:59:59
+DROP TABLE ranges;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/replace_select_varchar.result b/storage/mroonga/mysql-test/mroonga/storage/r/replace_select_varchar.result
index 9cbe11c5574..b9aebee3f9e 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/replace_select_varchar.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/replace_select_varchar.result
@@ -31,7 +31,8 @@ SELECT v.id, v.video_id, v.description, NULL
FROM videos_master AS v
WHERE v.video_id = (video_id);
SELECT *, MATCH(description) AGAINST("my") FROM videos_groonga
-WHERE MATCH(description) AGAINST("my");
+WHERE MATCH(description) AGAINST("my")
+ORDER BY id;
id video_id description tags_unpack MATCH(description) AGAINST("my")
1 video-1 My Familly 209716
2 video-2 My Cat 209716
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/replace_without_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/replace_without_key.result
index 2c6c1cbc7e8..e67f0fe4007 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/replace_without_key.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/replace_without_key.result
@@ -6,5 +6,5 @@ content text,
FULLTEXT INDEX (content)
) DEFAULT CHARSET=utf8;
REPLACE INTO diaries(content) VALUES("Hello");
-ERROR HY000: primary key is empty
+Got one of the listed errors
DROP TABLE diaries;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/truncate.result b/storage/mroonga/mysql-test/mroonga/storage/r/truncate.result
index 0e33976eb17..104d1d51504 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/truncate.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/truncate.result
@@ -31,15 +31,18 @@ id year month day title content
1 2011 11 9 Hello 今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚
2 2011 11 10 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦
3 2011 11 11 富士山 今日も天気ãŒã‚ˆãã¦ãã‚Œã„ã«è¦‹ãˆã‚‹ã€‚
-SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE);
+SELECT * FROM diaries
+WHERE MATCH(content) AGAINST("+今日" IN BOOLEAN MODE)
+ORDER BY id;
id year month day title content
1 2011 11 9 Hello 今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚
3 2011 11 11 富士山 今日も天気ãŒã‚ˆãã¦ãã‚Œã„ã«è¦‹ãˆã‚‹ã€‚
-2 2011 11 10 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦
TRUNCATE TABLE diaries;
SELECT * FROM diaries;
id year month day title content
-SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE);
+SELECT * FROM diaries
+WHERE MATCH(content) AGAINST("+今日" IN BOOLEAN MODE)
+ORDER BY id;
id year month day title content
INSERT INTO diaries VALUES(1, 2011, 11, 11, "帰りé“", "ã¤ã‹ã‚ŒãŸãƒ¼");
INSERT INTO diaries VALUES(2, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "天気ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚");
@@ -49,7 +52,9 @@ id year month day title content
1 2011 11 11 å¸°ã‚Šé“ ã¤ã‹ã‚ŒãŸãƒ¼
2 2011 12 1 ä¹…ã—ã¶ã‚Š 天気ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚
3 2011 12 2 åˆé›ª 今年ã¯ã˜ã‚ã¦ã®é›ªï¼
-SELECT * FROM diaries WHERE MATCH(content) AGAINST("悪ã„" IN BOOLEAN MODE);
+SELECT * FROM diaries
+WHERE MATCH(content) AGAINST("+悪ã„" IN BOOLEAN MODE)
+ORDER BY id;
id year month day title content
2 2011 12 1 ä¹…ã—ã¶ã‚Š 天気ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚
DROP TABLE diaries;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/suite.pm b/storage/mroonga/mysql-test/mroonga/storage/suite.pm
index 6b345c0fd6f..7e4f8c1776b 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/suite.pm
+++ b/storage/mroonga/mysql-test/mroonga/storage/suite.pm
@@ -5,12 +5,7 @@ package My::Suite::Mroonga;
return "No Mroonga engine" unless $ENV{HA_MROONGA_SO} or
$::mysqld_variables{'mroonga'} eq "ON";
-# RECOMPILE_FOR_EMBEDDED also means that a plugin
-# cannot be dynamically loaded into embedded
-return "Not run for embedded server" if $::opt_embedded_server and
- $ENV{HA_MROONGA_SO};
-
-sub is_default { 1 }
+sub is_default { not $::opt_embedded_server }
my $groonga_normalizer_mysql_dir=$::basedir . '/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql';
my $groonga_normalizer_mysql_install_dir=$::basedir . '/lib/groonga/plugins';
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_with_flags.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test
index 96c99612190..96c99612190 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_with_flags.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test
new file mode 100644
index 00000000000..0c389ba3197
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test
@@ -0,0 +1,41 @@
+# Copyright(C) 2014 Kenji Maruyama <mmmaru777@gmail.com>
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mariadb.inc
+--source include/not_embedded.inc
+--source ../../include/mroonga/have_mroonga.inc
+--source ../../include/mroonga/load_mroonga_functions.inc
+
+--disable_query_log
+DROP DATABASE test;
+CREATE DATABASE test;
+USE test;
+--enable_query_log
+
+CREATE TABLE tags (
+ id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY
+) DEFAULT CHARSET=utf8;
+
+ALTER TABLE tags ADD COLUMN name VARCHAR(64) FLAGS='COLUMN_VECTOR';
+SHOW CREATE TABLE tags;
+
+SELECT mroonga_command("dump --dump_plugins no");
+
+DROP TABLE tags;
+
+--source ../../include/mroonga/unload_mroonga_functions.inc
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test
new file mode 100644
index 00000000000..d77809c1a6c
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test
@@ -0,0 +1,44 @@
+# Copyright(C) 2014 Kenji Maruyama <mmmaru777@gmail.com>
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source include/not_embedded.inc
+--source ../../include/mroonga/have_mroonga.inc
+--source ../../include/mroonga/load_mroonga_functions.inc
+
+--disable_query_log
+DROP DATABASE test;
+CREATE DATABASE test;
+USE test;
+--enable_query_log
+
+CREATE TABLE tags (
+ id INT UNSIGNED PRIMARY KEY
+) DEFAULT CHARSET=utf8;
+
+CREATE TABLE bugs (
+ id INT UNSIGNED PRIMARY KEY
+) DEFAULT CHARSET=utf8;
+
+ALTER TABLE bugs ADD COLUMN name VARCHAR(64) COMMENT 'groonga_type "tags"';
+
+SELECT mroonga_command("dump --dump_plugins no");
+
+DROP TABLE bugs;
+DROP TABLE tags;
+
+--source ../../include/mroonga/unload_mroonga_functions.inc
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test
new file mode 100644
index 00000000000..a65eff4529f
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test
@@ -0,0 +1,47 @@
+# Copyright(C) 2014 Kenji Maruyama <mmmaru777@gmail.com>
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mariadb.inc
+--source ../../include/mroonga/have_version_56_or_later.inc
+--source include/not_embedded.inc
+--source ../../include/mroonga/have_mroonga.inc
+--source ../../include/mroonga/load_mroonga_functions.inc
+
+--disable_query_log
+DROP DATABASE test;
+CREATE DATABASE test;
+USE test;
+--enable_query_log
+
+CREATE TABLE tags (
+ id INT UNSIGNED PRIMARY KEY
+) DEFAULT CHARSET=utf8;
+
+CREATE TABLE bugs (
+ id INT UNSIGNED PRIMARY KEY
+) DEFAULT CHARSET=utf8;
+
+ALTER TABLE bugs ADD COLUMN name VARCHAR(64) GROONGA_TYPE='tags';
+SHOW CREATE TABLE bugs;
+
+SELECT mroonga_command("dump --dump_plugins no");
+
+DROP TABLE bugs;
+DROP TABLE tags;
+
+--source ../../include/mroonga/unload_mroonga_functions.inc
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_with_type.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test
index dd05765585d..dd05765585d 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_with_type.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test
index 9c01dc27e3e..b2312997709 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test
@@ -15,6 +15,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/have_mroonga.inc
+--source ../../include/mroonga/have_groonga_plugin_register.inc
--source ../../include/mroonga/load_mroonga_functions.inc
--disable_query_log
@@ -23,7 +24,7 @@ CREATE DATABASE test;
USE test;
--enable_query_log
-SELECT mroonga_command("register token_filters/stop_word");
+SELECT mroonga_command("plugin_register token_filters/stop_word");
SET NAMES utf8;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test
index 7ec047818e3..ada266fff0c 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test
@@ -15,6 +15,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/have_mroonga.inc
+--source ../../include/mroonga/have_groonga_plugin_register.inc
--source ../../include/mroonga/load_mroonga_functions.inc
--disable_query_log
@@ -23,7 +24,7 @@ CREATE DATABASE test;
USE test;
--enable_query_log
-SELECT mroonga_command("register token_filters/stop_word");
+SELECT mroonga_command("plugin_register token_filters/stop_word");
CREATE TABLE terms (
term VARCHAR(64) NOT NULL PRIMARY KEY,
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date_strict.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date_strict.test
new file mode 100644
index 00000000000..7736fc45b7b
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date_strict.test
@@ -0,0 +1,41 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS timestamps;
+--enable_warnings
+
+CREATE TABLE timestamps (
+ id INT PRIMARY KEY AUTO_INCREMENT,
+ create_dt DATETIME
+) DEFAULT CHARSET UTF8;
+SHOW CREATE TABLE timestamps;
+
+SET sql_mode='STRICT_TRANS_TABLES';
+--error ER_WARN_DATA_OUT_OF_RANGE
+INSERT INTO timestamps (create_dt) VALUES ("0000-00-00 00:00:00");
+SET sql_mode=default;
+
+SELECT * FROM timestamps;
+
+INSERT INTO timestamps (create_dt) VALUES ("2015-06-17 00:00:00");
+SELECT * FROM timestamps;
+
+DROP TABLE timestamps;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_vector.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_flags_comment.test
index 2d5498c99c8..2d5498c99c8 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_vector.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_flags_comment.test
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_flags_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_flags_parameter.test
new file mode 100644
index 00000000000..dbecd47dac6
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_flags_parameter.test
@@ -0,0 +1,39 @@
+# Copyright(C) 2013-2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mariadb.inc
+--source include/not_embedded.inc
+--source ../../include/mroonga/have_mroonga.inc
+--source ../../include/mroonga/load_mroonga_functions.inc
+
+--disable_query_log
+DROP DATABASE test;
+CREATE DATABASE test;
+USE test;
+--enable_query_log
+
+CREATE TABLE bugs (
+ id INT UNSIGNED PRIMARY KEY,
+ tags TEXT FLAGS='COLUMN_VECTOR'
+) DEFAULT CHARSET=utf8;
+SHOW CREATE TABLE bugs;
+
+SELECT mroonga_command("dump --dump_plugins no");
+
+DROP TABLE bugs;
+
+--source ../../include/mroonga/unload_mroonga_functions.inc
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_comment.test
new file mode 100644
index 00000000000..aa4723b087c
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_comment.test
@@ -0,0 +1,42 @@
+# Copyright(C) 2013-2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source include/not_embedded.inc
+--source ../../include/mroonga/have_mroonga.inc
+--source ../../include/mroonga/load_mroonga_functions.inc
+
+--disable_query_log
+DROP DATABASE test;
+CREATE DATABASE test;
+USE test;
+--enable_query_log
+
+CREATE TABLE tags (
+ name VARCHAR(64) PRIMARY KEY
+) DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+
+CREATE TABLE bugs (
+ id INT UNSIGNED PRIMARY KEY,
+ tag VARCHAR(64) COMMENT 'groonga_type "tags"'
+) DEFAULT CHARSET=utf8;
+
+SELECT mroonga_command("dump --dump_plugins no");
+
+DROP TABLE bugs;
+DROP TABLE tags;
+
+--source ../../include/mroonga/unload_mroonga_functions.inc
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_nonexistent.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_nonexistent.test
new file mode 100644
index 00000000000..56d81fad16c
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_nonexistent.test
@@ -0,0 +1,29 @@
+# Copyright(C) 2013-2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS bugs;
+--enable_warnings
+
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE bugs (
+ id INT UNSIGNED PRIMARY KEY,
+ tag VARCHAR(64) COMMENT 'groonga_type "Nonexistent"'
+) DEFAULT CHARSET=utf8mb4;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_parameter.test
new file mode 100644
index 00000000000..325536af3d2
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_parameter.test
@@ -0,0 +1,45 @@
+# Copyright(C) 2013-2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mariadb.inc
+--source ../../include/mroonga/have_version_56_or_later.inc
+--source include/not_embedded.inc
+--source ../../include/mroonga/have_mroonga.inc
+--source ../../include/mroonga/load_mroonga_functions.inc
+
+--disable_query_log
+DROP DATABASE test;
+CREATE DATABASE test;
+USE test;
+--enable_query_log
+
+CREATE TABLE tags (
+ name VARCHAR(64) PRIMARY KEY
+) DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+
+CREATE TABLE bugs (
+ id INT UNSIGNED PRIMARY KEY,
+ tag VARCHAR(64) GROONGA_TYPE='tags'
+) DEFAULT CHARSET=utf8;
+SHOW CREATE TABLE bugs;
+
+SELECT mroonga_command("dump --dump_plugins no");
+
+DROP TABLE bugs;
+DROP TABLE tags;
+
+--source ../../include/mroonga/unload_mroonga_functions.inc
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_reference_type.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_type_comment.test
index 0a1340d24d1..0a1340d24d1 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_reference_type.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_type_comment.test
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_type_nonexistent.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_type_nonexistent.test
new file mode 100644
index 00000000000..2b9a58c887c
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_type_nonexistent.test
@@ -0,0 +1,29 @@
+# Copyright(C) 2013-2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS bugs;
+--enable_warnings
+
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE bugs (
+ id INT UNSIGNED PRIMARY KEY,
+ tag VARCHAR(64) COMMENT 'type "Nonexistent"'
+) DEFAULT CHARSET=utf8mb4;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_comment.test
new file mode 100644
index 00000000000..668a148edf9
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_comment.test
@@ -0,0 +1,39 @@
+# Copyright(C) 2015 Naoya Murakami <naoya@createfield.com>
+# Copyright(C) 2015 Kouhei SUtou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mroonga.inc
+--source ../../include/mroonga/load_mroonga_functions.inc
+
+--disable_query_log
+DROP DATABASE test;
+CREATE DATABASE test;
+USE test;
+--enable_query_log
+
+SET NAMES utf8;
+
+CREATE TABLE memos (
+ content VARCHAR(64) NOT NULL,
+ FULLTEXT INDEX (content) COMMENT 'flags "WITH_POSITION|WITH_WEIGHT"'
+) DEFAULT CHARSET=utf8;
+
+SELECT mroonga_command("dump --dump_plugins no --dump_schema no");
+
+DROP TABLE memos;
+
+--source ../../include/mroonga/unload_mroonga_functions.inc
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_none.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_none.test
index 039c518e673..107b045c8fc 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_none.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_none.test
@@ -1,4 +1,5 @@
# Copyright(C) 2015 Naoya Murakami <naoya@createfield.com>
+# Copyright(C) 2015 Kouhei SUtou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -27,7 +28,7 @@ SET NAMES utf8;
CREATE TABLE memos (
content VARCHAR(64) NOT NULL,
- FULLTEXT INDEX (content) COMMENT 'index_flags "NONE"'
+ FULLTEXT INDEX (content) COMMENT 'flags "NONE"'
) DEFAULT CHARSET=utf8;
SELECT mroonga_command("dump --dump_plugins no --dump_schema no");
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_parameter.test
new file mode 100644
index 00000000000..14c65ad54c1
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_parameter.test
@@ -0,0 +1,41 @@
+# Copyright(C) 2015 Naoya Murakami <naoya@createfield.com>
+# Copyright(C) 2015 Kouhei SUtou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mariadb.inc
+--source ../../include/mroonga/have_mroonga.inc
+--source ../../include/mroonga/load_mroonga_functions.inc
+
+--disable_query_log
+DROP DATABASE test;
+CREATE DATABASE test;
+USE test;
+--enable_query_log
+
+SET NAMES utf8;
+
+CREATE TABLE memos (
+ content VARCHAR(64) NOT NULL,
+ FULLTEXT INDEX (content) FLAGS='WITH_POSITION|WITH_WEIGHT'
+) DEFAULT CHARSET=utf8;
+SHOW CREATE TABLE memos;
+
+SELECT mroonga_command("dump --dump_plugins no --dump_schema no");
+
+DROP TABLE memos;
+
+--source ../../include/mroonga/unload_mroonga_functions.inc
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_none.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_none.test
new file mode 100644
index 00000000000..039c518e673
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_none.test
@@ -0,0 +1,38 @@
+# Copyright(C) 2015 Naoya Murakami <naoya@createfield.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mroonga.inc
+--source ../../include/mroonga/load_mroonga_functions.inc
+
+--disable_query_log
+DROP DATABASE test;
+CREATE DATABASE test;
+USE test;
+--enable_query_log
+
+SET NAMES utf8;
+
+CREATE TABLE memos (
+ content VARCHAR(64) NOT NULL,
+ FULLTEXT INDEX (content) COMMENT 'index_flags "NONE"'
+) DEFAULT CHARSET=utf8;
+
+SELECT mroonga_command("dump --dump_plugins no --dump_schema no");
+
+DROP TABLE memos;
+
+--source ../../include/mroonga/unload_mroonga_functions.inc
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_with_position_and_with_weight.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_with_position_and_with_weight.test
index 9a67644d2c5..9a67644d2c5 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_with_position_and_with_weight.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_with_position_and_with_weight.test
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_fulltext_index_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_comment.test
index 02e2cb9e81a..02e2cb9e81a 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_fulltext_index_comment.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_comment.test
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_fulltext_index_no_utf8_charset_with_utf8_normalizer.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_no_utf8_charset_with_utf8_normalizer.test
index f28fb5b8695..f28fb5b8695 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_fulltext_index_no_utf8_charset_with_utf8_normalizer.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_no_utf8_charset_with_utf8_normalizer.test
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_fulltext_index_none.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_none.test
index ae4d4cb9f1b..ae4d4cb9f1b 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_fulltext_index_none.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_none.test
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_parameter.test
new file mode 100644
index 00000000000..a42b30b72a1
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_parameter.test
@@ -0,0 +1,40 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mariadb.inc
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS memos;
+--enable_warnings
+
+SET NAMES utf8;
+
+CREATE TABLE memos (
+ id INT NOT NULL PRIMARY KEY,
+ content TEXT NOT NULL,
+ FULLTEXT INDEX (content) NORMALIZER='NormalizerAuto'
+) DEFAULT CHARSET=utf8;
+SHOW CREATE TABLE memos;
+
+INSERT INTO memos VALUES (1, "1æ—¥ã®æ¶ˆè²»ãŒã¯ç´„2000㌔ãŒ");
+
+SELECT * FROM memos
+ WHERE MATCH (content) AGAINST ("+カロリー" IN BOOLEAN MODE);
+
+DROP TABLE memos;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_comment.test
new file mode 100644
index 00000000000..1b728afa1c1
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_comment.test
@@ -0,0 +1,42 @@
+# Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS diaries;
+--enable_warnings
+
+CREATE TABLE diaries (
+ id int PRIMARY KEY AUTO_INCREMENT,
+ body text,
+ FULLTEXT INDEX body_index (body)
+ COMMENT 'parser "TokenBigramSplitSymbolAlphaDigit"'
+) DEFAULT CHARSET utf8;
+SHOW CREATE TABLE diaries;
+
+INSERT INTO diaries (body) VALUES ("will start Groonga!");
+INSERT INTO diaries (body) VALUES ("starting Groonga...");
+INSERT INTO diaries (body) VALUES ("started Groonga.");
+
+SELECT * FROM diaries;
+SELECT * FROM diaries
+ WHERE MATCH(body) AGAINST("+start" IN BOOLEAN MODE)
+ ORDER BY id;
+
+DROP TABLE diaries;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_parser_default.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_default.test
index 1e08cc46221..a1756ad268e 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_parser_default.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_default.test
@@ -1,4 +1,4 @@
-# Copyright(C) 2011 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
# Copyright(C) 2014 Kentoku SHIBA
#
# This library is free software; you can redistribute it and/or
@@ -29,12 +29,12 @@ create table diaries (
fulltext index body_index (body)
) default charset utf8;
show create table diaries;
-insert into diaries (body) values ("will start groonga!");
-insert into diaries (body) values ("starting groonga...");
-insert into diaries (body) values ("started groonga.");
-insert into diaries (body) values ("finished groonga.");
+insert into diaries (body) values ("will start Groonga!");
+insert into diaries (body) values ("starting Groonga...");
+insert into diaries (body) values ("started Groonga.");
+insert into diaries (body) values ("finished Groonga.");
select * from diaries;
-select * from diaries where match(body) against("start");
+select * from diaries where match(body) against("+start" IN BOOLEAN MODE) order by id;
drop table diaries;
set global mroonga_default_parser=@mroonga_default_parser_backup;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_parser_off.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_off.test
index 0dcf494c684..0869e2334b7 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_parser_off.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_off.test
@@ -14,7 +14,6 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---source ../../include/mroonga/have_fulltext_index_comment.inc
--source ../../include/mroonga/have_mroonga.inc
--disable_warnings
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_index_comment_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test
index 18a2607fa0b..534ff998ff0 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_index_comment_multiple_token_filters.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test
@@ -15,6 +15,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/have_mroonga.inc
+--source ../../include/mroonga/have_groonga_plugin_register.inc
--source ../../include/mroonga/load_mroonga_functions.inc
--disable_query_log
@@ -23,7 +24,7 @@ CREATE DATABASE test;
USE test;
--enable_query_log
-SELECT mroonga_command("register token_filters/stop_word");
+SELECT mroonga_command("plugin_register token_filters/stop_word");
SET NAMES utf8;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_index_comment_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test
index 20df762d31b..77d886579ba 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_index_comment_one_token_filter.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test
@@ -15,6 +15,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/have_mroonga.inc
+--source ../../include/mroonga/have_groonga_plugin_register.inc
--source ../../include/mroonga/load_mroonga_functions.inc
--disable_query_log
@@ -23,7 +24,7 @@ CREATE DATABASE test;
USE test;
--enable_query_log
-SELECT mroonga_command("register token_filters/stop_word");
+SELECT mroonga_command("plugin_register token_filters/stop_word");
SET NAMES utf8;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test
new file mode 100644
index 00000000000..d9458f4402d
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test
@@ -0,0 +1,44 @@
+# Copyright(C) 2014 Naoya Murakami <naoya@createfield.com>
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mariadb.inc
+--source ../../include/mroonga/have_mroonga.inc
+--source ../../include/mroonga/have_groonga_plugin_register.inc
+--source ../../include/mroonga/load_mroonga_functions.inc
+
+--disable_query_log
+DROP DATABASE test;
+CREATE DATABASE test;
+USE test;
+--enable_query_log
+
+SELECT mroonga_command("plugin_register token_filters/stop_word");
+
+SET NAMES utf8;
+
+CREATE TABLE memos (
+ content VARCHAR(64) NOT NULL,
+ FULLTEXT INDEX (content) TOKEN_FILTERS='TokenFilterStopWord,TokenFilterStopWord'
+) DEFAULT CHARSET=utf8;
+SHOW CREATE TABLE memos;
+
+SELECT mroonga_command("dump --dump_plugins no");
+
+DROP TABLE memos;
+
+--source ../../include/mroonga/unload_mroonga_functions.inc
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_comment.test
new file mode 100644
index 00000000000..4bf386a4c11
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_comment.test
@@ -0,0 +1,42 @@
+# Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS diaries;
+--enable_warnings
+
+CREATE TABLE diaries (
+ id int PRIMARY KEY AUTO_INCREMENT,
+ body text,
+ FULLTEXT INDEX body_index (body)
+ COMMENT 'tokenizer "TokenBigramSplitSymbolAlphaDigit"'
+) DEFAULT CHARSET utf8;
+SHOW CREATE TABLE diaries;
+
+INSERT INTO diaries (body) VALUES ("will start Groonga!");
+INSERT INTO diaries (body) VALUES ("starting Groonga...");
+INSERT INTO diaries (body) VALUES ("started Groonga.");
+
+SELECT * FROM diaries;
+SELECT * FROM diaries
+ WHERE MATCH(body) AGAINST("+start" IN BOOLEAN MODE)
+ ORDER BY id;
+
+DROP TABLE diaries;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_default.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_default.test
new file mode 100644
index 00000000000..069e06b4a84
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_default.test
@@ -0,0 +1,41 @@
+# Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2014 Kentoku SHIBA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+drop table if exists diaries;
+--enable_warnings
+
+set @mroonga_default_tokenizer_backup=@@mroonga_default_tokenizer;
+set global mroonga_default_tokenizer=TokenBigramSplitSymbolAlphaDigit;
+create table diaries (
+ id int primary key auto_increment,
+ body text,
+ fulltext index body_index (body)
+) default charset utf8;
+show create table diaries;
+insert into diaries (body) values ("will start Groonga!");
+insert into diaries (body) values ("starting Groonga...");
+insert into diaries (body) values ("started Groonga.");
+insert into diaries (body) values ("finished Groonga.");
+select * from diaries;
+select * from diaries where match(body) against("+start" IN BOOLEAN MODE) order by id;
+drop table diaries;
+set global mroonga_default_tokenizer=@mroonga_default_tokenizer_backup;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_off.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_off.test
new file mode 100644
index 00000000000..5aff5e3575b
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_off.test
@@ -0,0 +1,47 @@
+# Copyright(C) 2013-2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS variables;
+--enable_warnings
+
+CREATE TABLE variables (
+ id INT PRIMARY KEY AUTO_INCREMENT,
+ name TEXT,
+ FULLTEXT INDEX (name) COMMENT 'tokenizer "off"'
+) DEFAULT CHARSET=utf8;
+SHOW CREATE TABLE variables;
+
+INSERT INTO variables (name) VALUES ("mroonga_database_path_prefix");
+INSERT INTO variables (name) VALUES ("mroonga_default_tokenizer");
+INSERT INTO variables (name) VALUES ("mroonga_default_wrapper_engine");
+INSERT INTO variables (name) VALUES ("mroonga_dry_write");
+INSERT INTO variables (name) VALUES ("mroonga_enable_optimization");
+INSERT INTO variables (name) VALUES ("mroonga_libgroonga_version");
+INSERT INTO variables (name) VALUES ("mroonga_log_file");
+INSERT INTO variables (name) VALUES ("mroonga_log_level");
+INSERT INTO variables (name) VALUES ("mroonga_match_escalation_threshold");
+INSERT INTO variables (name) VALUES ("mroonga_version");
+
+SELECT * FROM variables;
+SELECT * FROM variables
+ WHERE MATCH (name) AGAINST ("mroonga_default*" IN BOOLEAN MODE);
+
+DROP TABLE variables;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_parameter.test
new file mode 100644
index 00000000000..d79eaefe3f6
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_parameter.test
@@ -0,0 +1,42 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mariadb.inc
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS diaries;
+--enable_warnings
+
+CREATE TABLE diaries (
+ id int PRIMARY KEY AUTO_INCREMENT,
+ body text,
+ FULLTEXT INDEX body_index (body) TOKENIZER='TokenBigramSplitSymbolAlphaDigit'
+) DEFAULT CHARSET utf8;
+SHOW CREATE TABLE diaries;
+
+INSERT INTO diaries (body) VALUES ("will start Groonga!");
+INSERT INTO diaries (body) VALUES ("starting Groonga...");
+INSERT INTO diaries (body) VALUES ("started Groonga.");
+
+SELECT * FROM diaries;
+SELECT * FROM diaries
+ WHERE MATCH(body) AGAINST("+start" IN BOOLEAN MODE)
+ ORDER BY id;
+
+DROP TABLE diaries;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_primary_key_table_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_default.test
index 1da8026f56d..1da8026f56d 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_primary_key_table_comment.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_default.test
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_primary_key_table_comment_with_using_hash.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_hash.test
index 14b9ea9ab87..14b9ea9ab87 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_primary_key_table_comment_with_using_hash.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_hash.test
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_table_comment_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test
index e4d7d8618fa..944838e2fe0 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_table_comment_multiple_token_filters.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test
@@ -15,6 +15,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/have_mroonga.inc
+--source ../../include/mroonga/have_groonga_plugin_register.inc
--source ../../include/mroonga/load_mroonga_functions.inc
--disable_query_log
@@ -23,7 +24,7 @@ CREATE DATABASE test;
USE test;
--enable_query_log
-SELECT mroonga_command("register token_filters/stop_word");
+SELECT mroonga_command("plugin_register token_filters/stop_word");
CREATE TABLE terms (
term VARCHAR(64) NOT NULL PRIMARY KEY,
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_table_comment_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test
index 905181175d0..701a4ae425b 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_table_comment_one_token_filter.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test
@@ -15,6 +15,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/have_mroonga.inc
+--source ../../include/mroonga/have_groonga_plugin_register.inc
--source ../../include/mroonga/load_mroonga_functions.inc
--disable_query_log
@@ -23,7 +24,7 @@ CREATE DATABASE test;
USE test;
--enable_query_log
-SELECT mroonga_command("register token_filters/stop_word");
+SELECT mroonga_command("plugin_register token_filters/stop_word");
CREATE TABLE terms (
term VARCHAR(64) NOT NULL PRIMARY KEY,
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_token_filters_skip.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_stop_word.test
index b27fb5b70d6..b2e6be600f1 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_token_filters_skip.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_stop_word.test
@@ -15,6 +15,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/have_mroonga.inc
+--source ../../include/mroonga/have_groonga_plugin_register.inc
--source ../../include/mroonga/load_mroonga_functions.inc
--disable_query_log
@@ -23,7 +24,7 @@ CREATE DATABASE test;
USE test;
--enable_query_log
-SELECT mroonga_command("register token_filters/stop_word");
+SELECT mroonga_command("plugin_register token_filters/stop_word");
CREATE TABLE terms (
term VARCHAR(64) NOT NULL PRIMARY KEY,
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test
index 4d0f15b203a..66ff69d77e2 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test
@@ -1,4 +1,4 @@
-# Copyright(C) 2011-2013 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
# Copyright(C) 2013 Kenji Maruyama <mmmaru777@gmail.com>
#
# This library is free software; you can redistribute it and/or
@@ -34,7 +34,8 @@ INSERT INTO memos VALUES ("Tomorrow will be fine.");
INSERT INTO memos VALUES ("Yesterday was fine.");
SELECT * FROM memos
- WHERE MATCH (content) AGAINST ("*DOR today good" IN BOOLEAN MODE);
+ WHERE MATCH (content) AGAINST ("*DOR today good" IN BOOLEAN MODE)
+ ORDER BY content;
DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test
index ed93b543869..1d91bdc7a56 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test
@@ -1,4 +1,4 @@
-# Copyright(C) 2011-2013 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
# Copyright(C) 2013 Kenji Maruyama <mmmaru777@gmail.com>
#
# This library is free software; you can redistribute it and/or
@@ -34,7 +34,8 @@ INSERT INTO memos VALUES ("Tomorrow will be fine.");
INSERT INTO memos VALUES ("Yesterday was fine.");
SELECT * FROM memos
- WHERE MATCH (content) AGAINST ("*DOR today -good tomorrow" IN BOOLEAN MODE);
+ WHERE MATCH (content) AGAINST ("*DOR today -good tomorrow" IN BOOLEAN MODE)
+ ORDER BY content;
DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test
index 3a078c7eccb..63e5baeeb68 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test
@@ -1,4 +1,4 @@
-# Copyright(C) 2011-2013 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
# Copyright(C) 2013 Kenji Maruyama <mmmaru777@gmail.com>
#
# This library is free software; you can redistribute it and/or
@@ -34,7 +34,8 @@ INSERT INTO memos VALUES ("Tomorrow will be fine.");
INSERT INTO memos VALUES ("Yesterday was fine.");
SELECT * FROM memos
- WHERE MATCH (content) AGAINST ("*DOR today +good tomorrow" IN BOOLEAN MODE);
+ WHERE MATCH (content) AGAINST ("*DOR today +good tomorrow" IN BOOLEAN MODE)
+ ORDER BY content;
DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.test
new file mode 100644
index 00000000000..ded739d8e8b
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.test
@@ -0,0 +1,38 @@
+# Copyright(C) 2015 Naoya Murakami <naoya@createfield.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS memos;
+--enable_warnings
+
+SET NAMES utf8;
+CREATE TABLE memos (
+ content TEXT,
+ FULLTEXT INDEX (content)
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO memos VALUES ("Today is good day.");
+INSERT INTO memos VALUES ("Tomorrow will be good day.");
+INSERT INTO memos VALUES ("Today is fine.");
+
+SELECT * FROM memos
+ WHERE MATCH (content) AGAINST ("*D+ today fi*" IN BOOLEAN MODE);
+
+DROP TABLE memos;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_not_match_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_not_match_against.test
index 7b4e62ba0a9..ffb49f2f396 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_not_match_against.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_not_match_against.test
@@ -1,4 +1,5 @@
# Copyright(C) 2010 Tetsuro IKEDA
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -31,16 +32,16 @@ insert into t1 values(6,20,"ka ki ku ke ko");
insert into t1 values(7,20,"aa ii uu ee oo");
insert into t1 values(8,20,"ka ki ku ke ko");
select * from t1;
-select * from t1 where match(c3) against("uu");
-select * from t1 where not match(c3) against("uu");
-select * from t1 where match(c3) against("dummy");
-select * from t1 where not match(c3) against("dummy");
-select * from t1 where c1 = 4 and not match(c3) against("uu");
-select * from t1 where c1 <= 4 and not match(c3) against("uu");
-select * from t1 where c1 > 4 and not match(c3) against("uu");
-select * from t1 where c2 = 10 and not match(c3) against("uu");
-select * from t1 where c2 >= 15 and not match(c3) against("uu");
-select * from t1 where c2 < 15 and not match(c3) against("uu");
+select * from t1 where match(c3) against("+uu" in boolean mode) order by c1;
+select * from t1 where not match(c3) against("+uu" in boolean mode) order by c1;
+select * from t1 where match(c3) against("+dummy" in boolean mode) order by c1;
+select * from t1 where not match(c3) against("+dummy" in boolean mode) order by c1;
+select * from t1 where c1 = 4 and not match(c3) against("+uu" in boolean mode) order by c1;
+select * from t1 where c1 <= 4 and not match(c3) against("+uu" in boolean mode) order by c1;
+select * from t1 where c1 > 4 and not match(c3) against("+uu" in boolean mode) order by c1;
+select * from t1 where c2 = 10 and not match(c3) against("+uu" in boolean mode) order by c1;
+select * from t1 where c2 >= 15 and not match(c3) against("+uu" in boolean mode) order by c1;
+select * from t1 where c2 < 15 and not match(c3) against("+uu" in boolean mode) order by c1;
drop table t1;
--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.test
new file mode 100644
index 00000000000..2782fc15363
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.test
@@ -0,0 +1,39 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS ranges;
+--enable_warnings
+
+CREATE TABLE ranges (
+ id int PRIMARY KEY,
+ start datetime,
+ end datetime,
+ UNIQUE KEY range_key(start, end)
+);
+
+INSERT INTO ranges VALUES (1, "1990-00-00 00:00:00", "2012-10-05 23:59:59");
+SELECT * FROM ranges;
+
+DELETE FROM ranges WHERE id = 1;
+INSERT INTO ranges VALUES (1, "1990-00-00 00:00:00", "2012-10-05 23:59:59");
+SELECT * FROM ranges;
+
+DROP TABLE ranges;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_select_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_select_varchar.test
index 192a4976cbd..d7cd89cf78c 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/replace_select_varchar.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_select_varchar.test
@@ -57,7 +57,8 @@ REPLACE INTO videos_groonga
FROM videos_master AS v
WHERE v.video_id = (video_id);
SELECT *, MATCH(description) AGAINST("my") FROM videos_groonga
- WHERE MATCH(description) AGAINST("my");
+ WHERE MATCH(description) AGAINST("my")
+ ORDER BY id;
DROP TABLE videos_master, videos_groonga;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_without_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_without_key.test
index a38c4953e67..5cbeab60fb0 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/replace_without_key.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_without_key.test
@@ -27,7 +27,7 @@ CREATE TABLE diaries (
FULLTEXT INDEX (content)
) DEFAULT CHARSET=utf8;
--- error ER_ERROR_ON_WRITE
+-- error ER_ERROR_ON_WRITE, ER_NO_DEFAULT_FOR_FIELD
REPLACE INTO diaries(content) VALUES("Hello");
DROP TABLE diaries;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/truncate.test b/storage/mroonga/mysql-test/mroonga/storage/t/truncate.test
index 5833f77722a..dac32178011 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/truncate.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/truncate.test
@@ -1,4 +1,4 @@
-# Copyright(C) 2011-2012 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -38,17 +38,23 @@ INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ
INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãã‚Œã„ã«è¦‹ãˆã‚‹ã€‚");
SELECT * FROM diaries;
-SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE);
+SELECT * FROM diaries
+ WHERE MATCH(content) AGAINST("+今日" IN BOOLEAN MODE)
+ ORDER BY id;
TRUNCATE TABLE diaries;
SELECT * FROM diaries;
-SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE);
+SELECT * FROM diaries
+ WHERE MATCH(content) AGAINST("+今日" IN BOOLEAN MODE)
+ ORDER BY id;
INSERT INTO diaries VALUES(1, 2011, 11, 11, "帰りé“", "ã¤ã‹ã‚ŒãŸãƒ¼");
INSERT INTO diaries VALUES(2, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "天気ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚");
INSERT INTO diaries VALUES(3, 2011, 12, 2, "åˆé›ª", "今年ã¯ã˜ã‚ã¦ã®é›ªï¼");
SELECT * FROM diaries;
-SELECT * FROM diaries WHERE MATCH(content) AGAINST("悪ã„" IN BOOLEAN MODE);
+SELECT * FROM diaries
+ WHERE MATCH(content) AGAINST("+悪ã„" IN BOOLEAN MODE)
+ ORDER BY id;
DROP TABLE diaries;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_global.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_global.test
index 55a318b786a..9018bd75626 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_global.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_global.test
@@ -14,7 +14,6 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---source ../../include/mroonga/have_fulltext_index_comment.inc
--source ../../include/mroonga/have_mroonga.inc
--disable_warnings
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_session.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_session.test
index c459e50c0d7..49557069965 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_session.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_session.test
@@ -14,7 +14,6 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---source ../../include/mroonga/have_fulltext_index_comment.inc
--source ../../include/mroonga/have_mroonga.inc
--disable_warnings
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_comment.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_comment.result
new file mode 100644
index 00000000000..fb03bfe8d8d
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_comment.result
@@ -0,0 +1,9 @@
+SET NAMES utf8;
+CREATE TABLE memos (
+content VARCHAR(64) NOT NULL PRIMARY KEY,
+FULLTEXT INDEX (content) COMMENT 'flags "WITH_POSITION|WITH_WEIGHT"'
+) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8;
+SELECT mroonga_command("dump --dump_plugins no --dump_schema no");
+mroonga_command("dump --dump_plugins no --dump_schema no")
+column_create memos-content index COLUMN_INDEX|WITH_WEIGHT|WITH_POSITION memos
+DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_none.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_none.result
new file mode 100644
index 00000000000..4a7107146ce
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_none.result
@@ -0,0 +1,9 @@
+SET NAMES utf8;
+CREATE TABLE memos (
+content VARCHAR(64) NOT NULL PRIMARY KEY,
+FULLTEXT INDEX (content) COMMENT 'flags "NONE"'
+) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8;
+SELECT mroonga_command("dump --dump_plugins no --dump_schema no");
+mroonga_command("dump --dump_plugins no --dump_schema no")
+column_create memos-content index COLUMN_INDEX memos
+DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_parameter.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_parameter.result
new file mode 100644
index 00000000000..6e00526c736
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_parameter.result
@@ -0,0 +1,16 @@
+SET NAMES utf8;
+CREATE TABLE memos (
+content VARCHAR(64) NOT NULL PRIMARY KEY,
+FULLTEXT INDEX (content) FLAGS='WITH_POSITION|WITH_WEIGHT'
+) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8;
+SHOW CREATE TABLE memos;
+Table Create Table
+memos CREATE TABLE `memos` (
+ `content` varchar(64) NOT NULL,
+ PRIMARY KEY (`content`),
+ FULLTEXT KEY `content` (`content`) `FLAGS`='WITH_POSITION|WITH_WEIGHT'
+) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"'
+SELECT mroonga_command("dump --dump_plugins no --dump_schema no");
+mroonga_command("dump --dump_plugins no --dump_schema no")
+column_create memos-content index COLUMN_INDEX|WITH_WEIGHT|WITH_POSITION memos
+DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_comment.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_comment.result
new file mode 100644
index 00000000000..1c9bf50fad9
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_comment.result
@@ -0,0 +1,21 @@
+DROP TABLE IF EXISTS memos;
+SET NAMES utf8;
+CREATE TABLE memos (
+id INT NOT NULL PRIMARY KEY,
+content TEXT NOT NULL,
+FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerAuto"'
+) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8;
+SHOW CREATE TABLE memos;
+Table Create Table
+memos CREATE TABLE `memos` (
+ `id` int(11) NOT NULL,
+ `content` text NOT NULL,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `content` (`content`) COMMENT 'normalizer "NormalizerAuto"'
+) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"'
+INSERT INTO memos VALUES (1, "1æ—¥ã®æ¶ˆè²»ãŒã¯ç´„2000㌔ãŒ");
+SELECT * FROM memos
+WHERE MATCH (content) AGAINST ("+カロリー" IN BOOLEAN MODE);
+id content
+1 1æ—¥ã®æ¶ˆè²»ãŒã¯ç´„2000㌔ãŒ
+DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_fulltext_index.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_fulltext_index.result
deleted file mode 100644
index ea992f827ca..00000000000
--- a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_fulltext_index.result
+++ /dev/null
@@ -1,16 +0,0 @@
-DROP TABLE IF EXISTS diaries;
-SET NAMES utf8;
-CREATE TABLE diaries (
-day DATE PRIMARY KEY,
-content VARCHAR(64) NOT NULL,
-FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerAuto"'
-) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-INSERT INTO diaries VALUES ("2013-04-23", "ブラックコーヒーを飲んã ã€‚");
-SELECT * FROM diaries
-WHERE MATCH (content) AGAINST ("+ãµã‚‰ã¤ã" IN BOOLEAN MODE);
-day content
-SELECT * FROM diaries
-WHERE MATCH (content) AGAINST ("+ブラック" IN BOOLEAN MODE);
-day content
-2013-04-23 ブラックコーヒーを飲んã ã€‚
-DROP TABLE diaries;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_parameter.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_parameter.result
new file mode 100644
index 00000000000..d3bc05a9b7d
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_parameter.result
@@ -0,0 +1,21 @@
+DROP TABLE IF EXISTS memos;
+SET NAMES utf8;
+CREATE TABLE memos (
+id INT NOT NULL PRIMARY KEY,
+content TEXT NOT NULL,
+FULLTEXT INDEX (content) NORMALIZER='NormalizerAuto'
+) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8;
+SHOW CREATE TABLE memos;
+Table Create Table
+memos CREATE TABLE `memos` (
+ `id` int(11) NOT NULL,
+ `content` text NOT NULL,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `content` (`content`) `NORMALIZER`='NormalizerAuto'
+) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"'
+INSERT INTO memos VALUES (1, "1æ—¥ã®æ¶ˆè²»ãŒã¯ç´„2000㌔ãŒ");
+SELECT * FROM memos
+WHERE MATCH (content) AGAINST ("+カロリー" IN BOOLEAN MODE);
+id content
+1 1æ—¥ã®æ¶ˆè²»ãŒã¯ç´„2000㌔ãŒ
+DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_parser_comment.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_parser_comment.result
index d7b20a3714f..7ee07329f21 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_parser_comment.result
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_parser_comment.result
@@ -13,17 +13,17 @@ diaries CREATE TABLE `diaries` (
PRIMARY KEY (`id`),
FULLTEXT KEY `body_index` (`body`) COMMENT 'parser "TokenBigramSplitSymbolAlphaDigit"'
) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"'
-insert into diaries (body) values ("will start groonga!");
-insert into diaries (body) values ("starting groonga...");
-insert into diaries (body) values ("started groonga.");
+insert into diaries (body) values ("will start Groonga!");
+insert into diaries (body) values ("starting Groonga...");
+insert into diaries (body) values ("started Groonga.");
select * from diaries;
id body
-1 will start groonga!
-2 starting groonga...
-3 started groonga.
-select * from diaries where match(body) against("start");
+1 will start Groonga!
+2 starting Groonga...
+3 started Groonga.
+select * from diaries where match(body) against("+start" in boolean mode) order by id;
id body
-1 will start groonga!
-2 starting groonga...
-3 started groonga.
+1 will start Groonga!
+2 starting Groonga...
+3 started Groonga.
drop table diaries;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_comment_multiple_token_filters.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_multiple_token_filters.result
index 68319844df8..e1e32dccc37 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_comment_multiple_token_filters.result
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_multiple_token_filters.result
@@ -1,5 +1,5 @@
-SELECT mroonga_command("register token_filters/stop_word");
-mroonga_command("register token_filters/stop_word")
+SELECT mroonga_command("plugin_register token_filters/stop_word");
+mroonga_command("plugin_register token_filters/stop_word")
true
SET NAMES utf8;
CREATE TABLE memos (
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_comment_one_token_filter.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_one_token_filter.result
index fa3012705ad..11ee04e2998 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_comment_one_token_filter.result
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_one_token_filter.result
@@ -1,5 +1,5 @@
-SELECT mroonga_command("register token_filters/stop_word");
-mroonga_command("register token_filters/stop_word")
+SELECT mroonga_command("plugin_register token_filters/stop_word");
+mroonga_command("plugin_register token_filters/stop_word")
true
SET NAMES utf8;
CREATE TABLE memos (
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_parameter.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_parameter.result
new file mode 100644
index 00000000000..f6d6be1b643
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_parameter.result
@@ -0,0 +1,25 @@
+SELECT mroonga_command("plugin_register token_filters/stop_word");
+mroonga_command("plugin_register token_filters/stop_word")
+true
+SET NAMES utf8;
+CREATE TABLE memos (
+id INT NOT NULL PRIMARY KEY,
+content VARCHAR(64) NOT NULL,
+FULLTEXT INDEX (content) TOKEN_FILTERS='TokenFilterStopWord,TokenFilterStopWord'
+) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8;
+SHOW CREATE TABLE memos;
+Table Create Table
+memos CREATE TABLE `memos` (
+ `id` int(11) NOT NULL,
+ `content` varchar(64) NOT NULL,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `content` (`content`) `TOKEN_FILTERS`='TokenFilterStopWord,TokenFilterStopWord'
+) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"'
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
+table_create memos TABLE_HASH_KEY ShortText
+
+table_create memos-content TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord,TokenFilterStopWord
+
+column_create memos-content index COLUMN_INDEX|WITH_POSITION memos
+DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_tokenizer_comment.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_tokenizer_comment.result
new file mode 100644
index 00000000000..f6e15804f42
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_tokenizer_comment.result
@@ -0,0 +1,29 @@
+drop table if exists diaries;
+create table diaries (
+id int primary key auto_increment,
+body text,
+fulltext index body_index (body)
+comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"'
+) comment = 'engine "innodb"' default charset utf8;
+show create table diaries;
+Table Create Table
+diaries CREATE TABLE `diaries` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `body` text,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `body_index` (`body`) COMMENT 'tokenizer "TokenBigramSplitSymbolAlphaDigit"'
+) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"'
+insert into diaries (body) values ("will start Groonga!");
+insert into diaries (body) values ("starting Groonga...");
+insert into diaries (body) values ("started Groonga.");
+select * from diaries;
+id body
+1 will start Groonga!
+2 starting Groonga...
+3 started Groonga.
+select * from diaries where match(body) against("+start" in boolean mode) order by id;
+id body
+1 will start Groonga!
+2 starting Groonga...
+3 started Groonga.
+drop table diaries;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_tokenizer_parameter.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_tokenizer_parameter.result
new file mode 100644
index 00000000000..ddec8fdadbe
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_tokenizer_parameter.result
@@ -0,0 +1,30 @@
+DROP TABLE IF EXISTS diaries;
+CREATE TABLE diaries (
+id int PRIMARY KEY AUTO_INCREMENT,
+body text,
+FULLTEXT INDEX body_index (body) TOKENIZER='TokenBigramSplitSymbolAlphaDigit'
+) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET utf8;
+SHOW CREATE TABLE diaries;
+Table Create Table
+diaries CREATE TABLE `diaries` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `body` text,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `body_index` (`body`) `TOKENIZER`='TokenBigramSplitSymbolAlphaDigit'
+) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"'
+INSERT INTO diaries (body) VALUES ("will start Groonga!");
+INSERT INTO diaries (body) VALUES ("starting Groonga...");
+INSERT INTO diaries (body) VALUES ("started Groonga.");
+SELECT * FROM diaries;
+id body
+1 will start Groonga!
+2 starting Groonga...
+3 started Groonga.
+SELECT * FROM diaries
+WHERE MATCH(body) AGAINST("+start" IN BOOLEAN MODE)
+ORDER BY id;
+id body
+1 will start Groonga!
+2 starting Groonga...
+3 started Groonga.
+DROP TABLE diaries;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result
index 14d30fac260..96d92e535d2 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result
@@ -11,9 +11,10 @@ INSERT INTO memos VALUES (NULL, "Today is fine.");
INSERT INTO memos VALUES (NULL, "Tomorrow will be fine.");
INSERT INTO memos VALUES (NULL, "Yesterday was fine.");
SELECT * FROM memos
-WHERE MATCH (content) AGAINST ("*DOR today good" IN BOOLEAN MODE);
+WHERE MATCH (content) AGAINST ("*DOR today good" IN BOOLEAN MODE)
+ORDER BY id;
id content
1 Today is good day.
-3 Today is fine.
2 Tomorrow will be good day.
+3 Today is fine.
DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result
index d367ba1d21f..ee8d851011f 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result
@@ -11,7 +11,8 @@ INSERT INTO memos VALUES (NULL, "Today is fine.");
INSERT INTO memos VALUES (NULL, "Tomorrow will be fine.");
INSERT INTO memos VALUES (NULL, "Yesterday was fine.");
SELECT * FROM memos
-WHERE MATCH (content) AGAINST ("*DOR today -good tomorrow" IN BOOLEAN MODE);
+WHERE MATCH (content) AGAINST ("*DOR today -good tomorrow" IN BOOLEAN MODE)
+ORDER BY id;
id content
2 Tomorrow will be good day.
3 Today is fine.
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result
index 6bf48ab6556..bb94043256d 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result
@@ -11,7 +11,8 @@ INSERT INTO memos VALUES (NULL, "Today is fine.");
INSERT INTO memos VALUES (NULL, "Tomorrow will be fine.");
INSERT INTO memos VALUES (NULL, "Yesterday was fine.");
SELECT * FROM memos
-WHERE MATCH (content) AGAINST ("*DOR today +good tomorrow" IN BOOLEAN MODE);
+WHERE MATCH (content) AGAINST ("*DOR today +good tomorrow" IN BOOLEAN MODE)
+ORDER BY id;
id content
1 Today is good day.
2 Tomorrow will be good day.
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_select.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_select.result
index 03300e3e9ef..7391ee4ba8d 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_select.result
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_select.result
@@ -55,12 +55,12 @@ c1 c2 match(c2) against("ii")
3 aa ii ii ii oo 524289
select c1,c2,match(c2) against("ii") from t1 where match(c2) against("ii");
c1 c2 match(c2) against("ii")
-1 aa ii uu ee oo 174763
3 aa ii ii ii oo 524289
5 ta ti ii ii to 349526
+1 aa ii uu ee oo 174763
select c1,c2,match(c2) against("ii") from t1 where match(c2) against("ii");
c1 c2 match(c2) against("ii")
-1 aa ii uu ee oo 174763
3 aa ii ii ii oo 524289
5 ta ti ii ii to 349526
+1 aa ii uu ee oo 174763
drop table t1,t2;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_many_records.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_many_records.result
index 3809006038c..03cf96b55f8 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_many_records.result
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_many_records.result
@@ -4112,7 +4112,7 @@ insert into diaries values(4094, "2022-09-28");
insert into diaries values(4095, "2022-09-29");
commit;
set autocommit=1;
-select * from diaries where match(title) against("2022-09-0");
+select * from diaries where match(title) against("2022-09-0") order by id;
id title
3824 2022-01-01
3825 2022-01-02
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_have_where_matched_order.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_have_where_matched_order.result
new file mode 100644
index 00000000000..def5db40cb9
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_have_where_matched_order.result
@@ -0,0 +1,26 @@
+DROP TABLE IF EXISTS texts;
+SET NAMES UTF8;
+CREATE TABLE texts (
+id INT PRIMARY KEY,
+matched TEXT,
+not_matched TEXT,
+FULLTEXT KEY (matched),
+FULLTEXT KEY (not_matched)
+) DEFAULT CHARSET=UTF8 COMMENT='engine "InnoDB"';
+INSERT INTO texts VALUES (1, 'Hello1', 'World1');
+INSERT INTO texts VALUES (2, 'Hello2', 'World2');
+INSERT INTO texts VALUES (3, 'Hello3', 'World3');
+SELECT id,
+matched,
+not_matched,
+MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE),
+MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE)
+FROM texts
+WHERE MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE)
+ORDER BY MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE),
+id;
+id matched not_matched MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE) MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE)
+1 Hello1 World1 1 0
+2 Hello2 World2 1 0
+3 Hello3 World3 1 0
+DROP TABLE texts;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_have_where_no_order.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_have_where_no_order.result
new file mode 100644
index 00000000000..81ce556e745
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_have_where_no_order.result
@@ -0,0 +1,24 @@
+DROP TABLE IF EXISTS texts;
+SET NAMES UTF8;
+CREATE TABLE texts (
+id INT PRIMARY KEY,
+matched TEXT,
+not_matched TEXT,
+FULLTEXT KEY (matched),
+FULLTEXT KEY (not_matched)
+) DEFAULT CHARSET=UTF8 COMMENT='engine "InnoDB"';
+INSERT INTO texts VALUES (1, 'Hello1', 'World1');
+INSERT INTO texts VALUES (2, 'Hello2', 'World2');
+INSERT INTO texts VALUES (3, 'Hello3', 'World3');
+SELECT id,
+matched,
+not_matched,
+MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE),
+MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE)
+FROM texts
+WHERE MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE);
+id matched not_matched MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE) MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE)
+1 Hello1 World1 1 0
+3 Hello3 World3 1 0
+2 Hello2 World2 1 0
+DROP TABLE texts;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_no_where_both_order.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_no_where_both_order.result
new file mode 100644
index 00000000000..f619e467040
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_no_where_both_order.result
@@ -0,0 +1,26 @@
+DROP TABLE IF EXISTS texts;
+SET NAMES UTF8;
+CREATE TABLE texts (
+id INT PRIMARY KEY,
+matched TEXT,
+not_matched TEXT,
+FULLTEXT KEY (matched),
+FULLTEXT KEY (not_matched)
+) DEFAULT CHARSET=UTF8 COMMENT='engine "InnoDB"';
+INSERT INTO texts VALUES (1, 'Hello1', 'World1');
+INSERT INTO texts VALUES (2, 'Hello2', 'World2');
+INSERT INTO texts VALUES (3, 'Hello3', 'World3');
+SELECT id,
+matched,
+not_matched,
+MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE),
+MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE)
+FROM texts
+ORDER BY MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE),
+MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE),
+id;
+id matched not_matched MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE) MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE)
+1 Hello1 World1 1 0
+2 Hello2 World2 1 0
+3 Hello3 World3 1 0
+DROP TABLE texts;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_myisam.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_myisam.result
index de1b8d41906..860c8e548a8 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_myisam.result
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_myisam.result
@@ -36,17 +36,17 @@ c1 c2 c3
3 30 sa si su se so
4 40 ta ti tu te to
5 50 aa ii uu ee oo
-select * from t1 where match(c3) against("su");
+select * from t1 where match(c3) against("su") order by c1;
c1 c2 c3
3 30 sa si su se so
-select * from t1 where match(c3) against("ii");
+select * from t1 where match(c3) against("ii") order by c1;
c1 c2 c3
1 10 aa ii uu ee oo
5 50 aa ii uu ee oo
-select * from t1 where match(c3) against("+su" in boolean mode);
+select * from t1 where match(c3) against("+su" in boolean mode) order by c1;
c1 c2 c3
3 30 sa si su se so
-select * from t1 where match(c3) against("+ii" in boolean mode);
+select * from t1 where match(c3) against("+ii" in boolean mode) order by c1;
c1 c2 c3
1 10 aa ii uu ee oo
5 50 aa ii uu ee oo
@@ -61,10 +61,10 @@ c1 c2 c3
1 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠ã‚ã‚ã‚ã‚ã‚ã‚ã‚
2 ã„ã„ã„ã„ㄠ明日ã®å¯Œå£«å±±ã®å¤©æ°—ã¯åˆ†ã‹ã‚Šã¾ã›ã‚“
3 dummy dummy
-select * from t1 where match(c2) against("富士山");
+select * from t1 where match(c2) against("富士山") order by c1;
c1 c2 c3
1 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠ã‚ã‚ã‚ã‚ã‚ã‚ã‚
-select * from t1 where match(c3) against("富士山");
+select * from t1 where match(c3) against("富士山") order by c1;
c1 c2 c3
2 ã„ã„ã„ã„ㄠ明日ã®å¯Œå£«å±±ã®å¤©æ°—ã¯åˆ†ã‹ã‚Šã¾ã›ã‚“
drop table t1;
@@ -124,14 +124,14 @@ c1 c2 match(c2) against("ii")
3 aa ii ii ii oo 524289
select c1,c2,match(c2) against("ii") from t1 where match(c2) against("ii");
c1 c2 match(c2) against("ii")
-1 aa ii uu ee oo 174763
3 aa ii ii ii oo 524289
5 ta ti ii ii to 349526
+1 aa ii uu ee oo 174763
select c1,c2,match(c2) against("ii") from t1 where match(c2) against("ii");
c1 c2 match(c2) against("ii")
-1 aa ii uu ee oo 174763
3 aa ii ii ii oo 524289
5 ta ti ii ii to 349526
+1 aa ii uu ee oo 174763
drop table t1,t2;
create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)) COMMENT = 'engine "myisam"';
insert into t1 values(1,10,"aa ii uu ee oo");
@@ -152,7 +152,7 @@ c1 c2 c3
6 20 ka ki ku ke ko
7 20 aa ii uu ee oo
8 20 ka ki ku ke ko
-select *,match(c3) against("uu") from t1 where match(c3) against("uu");
+select *,match(c3) against("uu") from t1 where match(c3) against("uu") order by c1;
c1 c2 c3 match(c3) against("uu")
1 10 aa ii uu ee oo 131073
3 10 aa ii uu ee oo 131073
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_not_match_against.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_not_match_against.result
index bbe23df3e0f..4646aad6a20 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_not_match_against.result
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_not_match_against.result
@@ -18,21 +18,21 @@ c1 c2 c3
6 20 ka ki ku ke ko
7 20 aa ii uu ee oo
8 20 ka ki ku ke ko
-select *,match(c3) against("uu") from t1 where match(c3) against("uu");
+select *,match(c3) against("uu") from t1 where match(c3) against("uu") order by c1;
c1 c2 c3 match(c3) against("uu")
1 10 aa ii uu ee oo 131073
3 10 aa ii uu ee oo 131073
5 20 aa ii uu ee oo 131073
7 20 aa ii uu ee oo 131073
-select * from t1 where not match(c3) against("uu");
+select * from t1 where not match(c3) against("uu") order by c1;
c1 c2 c3
2 10 ka ki ku ke ko
4 10 ka ki ku ke ko
6 20 ka ki ku ke ko
8 20 ka ki ku ke ko
-select *,match(c3) against("dummy") from t1 where match(c3) against("dummy");
+select *,match(c3) against("dummy") from t1 where match(c3) against("dummy") order by c1;
c1 c2 c3 match(c3) against("dummy")
-select * from t1 where not match(c3) against("dummy");
+select * from t1 where not match(c3) against("dummy") order by c1;
c1 c2 c3
1 10 aa ii uu ee oo
2 10 ka ki ku ke ko
@@ -42,26 +42,26 @@ c1 c2 c3
6 20 ka ki ku ke ko
7 20 aa ii uu ee oo
8 20 ka ki ku ke ko
-select * from t1 where c1 = 4 and not match(c3) against("uu");
+select * from t1 where c1 = 4 and not match(c3) against("uu") order by c1;
c1 c2 c3
4 10 ka ki ku ke ko
-select * from t1 where c1 <= 4 and not match(c3) against("uu");
+select * from t1 where c1 <= 4 and not match(c3) against("uu") order by c1;
c1 c2 c3
2 10 ka ki ku ke ko
4 10 ka ki ku ke ko
-select * from t1 where c1 > 4 and not match(c3) against("uu");
+select * from t1 where c1 > 4 and not match(c3) against("uu") order by c1;
c1 c2 c3
6 20 ka ki ku ke ko
8 20 ka ki ku ke ko
-select * from t1 where c2 = 10 and not match(c3) against("uu");
+select * from t1 where c2 = 10 and not match(c3) against("uu") order by c1;
c1 c2 c3
2 10 ka ki ku ke ko
4 10 ka ki ku ke ko
-select * from t1 where c2 >= 15 and not match(c3) against("uu");
+select * from t1 where c2 >= 15 and not match(c3) against("uu") order by c1;
c1 c2 c3
6 20 ka ki ku ke ko
8 20 ka ki ku ke ko
-select * from t1 where c2 < 15 and not match(c3) against("uu");
+select * from t1 where c2 < 15 and not match(c3) against("uu") order by c1;
c1 c2 c3
2 10 ka ki ku ke ko
4 10 ka ki ku ke ko
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_TODO_SPLIT_ME.result
index 279ad8bf985..74d7426ebc1 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_TODO_SPLIT_ME.result
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_TODO_SPLIT_ME.result
@@ -11,7 +11,7 @@ FULLTEXT KEY ftx2(c)
SHOW CREATE TABLE ft;
Table Create Table
ft CREATE TABLE `ft` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` text,
`c` text,
PRIMARY KEY (`a`),
@@ -29,22 +29,6 @@ a b c
SELECT a, b, c FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE) ORDER BY MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE);
a b c
2 bbbbb bcdef
-SELECT a, b, c FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE) ORDER BY MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE);
-a b c
-2 bbbbb bcdef
SELECT a, b, c FROM ft WHERE MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE);
a b c
-SELECT a, b, c, MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE), MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE) FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE) ORDER BY MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE);
-a b c MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE) MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE)
-2 bbbbb bcdef 1 0
-SELECT a, b, c, MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE), MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE) FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE);
-a b c MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE) MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE)
-2 bbbbb bcdef 1 0
-SELECT a, b, c, MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE), MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE) FROM ft ORDER BY MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE), MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE), a;
-a b c MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE) MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE)
-1 aaaaa abcde 0 0
-3 ccccc cdefg 0 0
-4 ddddd defgh 0 0
-5 eeeee efghi 0 0
-2 bbbbb bcdef 1 0
DROP TABLE ft;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/truncate.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/truncate.result
index 35b273d348f..d41231ddd33 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/r/truncate.result
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/truncate.result
@@ -31,15 +31,18 @@ id year month day title content
1 2011 11 9 Hello 今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚
2 2011 11 10 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦
3 2011 11 11 富士山 今日も天気ãŒã‚ˆãã¦ãã‚Œã„ã«è¦‹ãˆã‚‹ã€‚
-SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE);
+SELECT * FROM diaries
+WHERE MATCH(content) AGAINST("+今日" IN BOOLEAN MODE)
+ORDER BY id;
id year month day title content
1 2011 11 9 Hello 今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚
3 2011 11 11 富士山 今日も天気ãŒã‚ˆãã¦ãã‚Œã„ã«è¦‹ãˆã‚‹ã€‚
-2 2011 11 10 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦
TRUNCATE TABLE diaries;
SELECT * FROM diaries;
id year month day title content
-SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE);
+SELECT * FROM diaries
+WHERE MATCH(content) AGAINST("+今日" IN BOOLEAN MODE)
+ORDER BY id;
id year month day title content
INSERT INTO diaries VALUES(1, 2011, 11, 11, "帰りé“", "ã¤ã‹ã‚ŒãŸãƒ¼");
INSERT INTO diaries VALUES(2, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "天気ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚");
@@ -49,7 +52,9 @@ id year month day title content
1 2011 11 11 å¸°ã‚Šé“ ã¤ã‹ã‚ŒãŸãƒ¼
2 2011 12 1 ä¹…ã—ã¶ã‚Š 天気ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚
3 2011 12 2 åˆé›ª 今年ã¯ã˜ã‚ã¦ã®é›ªï¼
-SELECT * FROM diaries WHERE MATCH(content) AGAINST("悪ã„" IN BOOLEAN MODE);
+SELECT * FROM diaries
+WHERE MATCH(content) AGAINST("+悪ã„" IN BOOLEAN MODE)
+ORDER BY id;
id year month day title content
2 2011 12 1 ä¹…ã—ã¶ã‚Š 天気ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚
DROP TABLE diaries;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/suite.pm b/storage/mroonga/mysql-test/mroonga/wrapper/suite.pm
index b6e2d741674..7e4f8c1776b 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/suite.pm
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/suite.pm
@@ -4,13 +4,8 @@ package My::Suite::Mroonga;
return "No Mroonga engine" unless $ENV{HA_MROONGA_SO} or
$::mysqld_variables{'mroonga'} eq "ON";
-#
-# RECOMPILE_FOR_EMBEDDED also means that a plugin
-# cannot be dynamically loaded into embedded
-return "Not run for embedded server" if $::opt_embedded_server and
- $ENV{HA_MROONGA_SO};
-sub is_default { 1 }
+sub is_default { not $::opt_embedded_server }
my $groonga_normalizer_mysql_dir=$::basedir . '/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql';
my $groonga_normalizer_mysql_install_dir=$::basedir . '/lib/groonga/plugins';
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_with_index.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_with_index.test
index 70c176b5116..899f00320c9 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_with_index.test
@@ -15,7 +15,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source include/have_innodb.inc
---source ../../include/mroonga/have_fulltext_index_comment.inc
--source ../../include/mroonga/have_mroonga.inc
--disable_query_log
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_comment.test
new file mode 100644
index 00000000000..0b2565f2fb5
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_comment.test
@@ -0,0 +1,40 @@
+# Copyright(C) 2015 Naoya Murakami <naoya@createfield.com>
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source include/have_innodb.inc
+--source ../../include/mroonga/have_mroonga.inc
+--source ../../include/mroonga/load_mroonga_functions.inc
+
+--disable_query_log
+DROP DATABASE test;
+CREATE DATABASE test;
+USE test;
+--enable_query_log
+
+SET NAMES utf8;
+
+CREATE TABLE memos (
+ content VARCHAR(64) NOT NULL PRIMARY KEY,
+ FULLTEXT INDEX (content) COMMENT 'flags "WITH_POSITION|WITH_WEIGHT"'
+) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8;
+
+SELECT mroonga_command("dump --dump_plugins no --dump_schema no");
+
+DROP TABLE memos;
+
+--source ../../include/mroonga/unload_mroonga_functions.inc
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_none.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_none.test
new file mode 100644
index 00000000000..656a349c1be
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_none.test
@@ -0,0 +1,40 @@
+# Copyright(C) 2015 Naoya Murakami <naoya@createfield.com>
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source include/have_innodb.inc
+--source ../../include/mroonga/have_mroonga.inc
+--source ../../include/mroonga/load_mroonga_functions.inc
+
+--disable_query_log
+DROP DATABASE test;
+CREATE DATABASE test;
+USE test;
+--enable_query_log
+
+SET NAMES utf8;
+
+CREATE TABLE memos (
+ content VARCHAR(64) NOT NULL PRIMARY KEY,
+ FULLTEXT INDEX (content) COMMENT 'flags "NONE"'
+) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8;
+
+SELECT mroonga_command("dump --dump_plugins no --dump_schema no");
+
+DROP TABLE memos;
+
+--source ../../include/mroonga/unload_mroonga_functions.inc
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_parameter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_parameter.test
new file mode 100644
index 00000000000..6b1a4c8dec2
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_parameter.test
@@ -0,0 +1,42 @@
+# Copyright(C) 2015 Naoya Murakami <naoya@createfield.com>
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mariadb.inc
+--source include/have_innodb.inc
+--source ../../include/mroonga/have_mroonga.inc
+--source ../../include/mroonga/load_mroonga_functions.inc
+
+--disable_query_log
+DROP DATABASE test;
+CREATE DATABASE test;
+USE test;
+--enable_query_log
+
+SET NAMES utf8;
+
+CREATE TABLE memos (
+ content VARCHAR(64) NOT NULL PRIMARY KEY,
+ FULLTEXT INDEX (content) FLAGS='WITH_POSITION|WITH_WEIGHT'
+) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8;
+SHOW CREATE TABLE memos;
+
+SELECT mroonga_command("dump --dump_plugins no --dump_schema no");
+
+DROP TABLE memos;
+
+--source ../../include/mroonga/unload_mroonga_functions.inc
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_comment.test
new file mode 100644
index 00000000000..3b84e5d1bce
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_comment.test
@@ -0,0 +1,40 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source include/have_innodb.inc
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS memos;
+--enable_warnings
+
+SET NAMES utf8;
+
+CREATE TABLE memos (
+ id INT NOT NULL PRIMARY KEY,
+ content TEXT NOT NULL,
+ FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerAuto"'
+) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8;
+SHOW CREATE TABLE memos;
+
+INSERT INTO memos VALUES (1, "1æ—¥ã®æ¶ˆè²»ãŒã¯ç´„2000㌔ãŒ");
+
+SELECT * FROM memos
+ WHERE MATCH (content) AGAINST ("+カロリー" IN BOOLEAN MODE);
+
+DROP TABLE memos;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_parameter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_parameter.test
new file mode 100644
index 00000000000..b8fe3eb6c7d
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_parameter.test
@@ -0,0 +1,41 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mariadb.inc
+--source include/have_innodb.inc
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS memos;
+--enable_warnings
+
+SET NAMES utf8;
+
+CREATE TABLE memos (
+ id INT NOT NULL PRIMARY KEY,
+ content TEXT NOT NULL,
+ FULLTEXT INDEX (content) NORMALIZER='NormalizerAuto'
+) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8;
+SHOW CREATE TABLE memos;
+
+INSERT INTO memos VALUES (1, "1æ—¥ã®æ¶ˆè²»ãŒã¯ç´„2000㌔ãŒ");
+
+SELECT * FROM memos
+ WHERE MATCH (content) AGAINST ("+カロリー" IN BOOLEAN MODE);
+
+DROP TABLE memos;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_parser_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_parser_comment.test
index fe80aae0804..05fc2fdcb9d 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_parser_comment.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_parser_comment.test
@@ -1,4 +1,4 @@
-# Copyright(C) 2011 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -15,7 +15,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source include/have_innodb.inc
---source ../../include/mroonga/have_fulltext_index_comment.inc
--source ../../include/mroonga/have_mroonga.inc
--disable_warnings
@@ -29,11 +28,11 @@ create table diaries (
comment 'parser "TokenBigramSplitSymbolAlphaDigit"'
) comment = 'engine "innodb"' default charset utf8;
show create table diaries;
-insert into diaries (body) values ("will start groonga!");
-insert into diaries (body) values ("starting groonga...");
-insert into diaries (body) values ("started groonga.");
+insert into diaries (body) values ("will start Groonga!");
+insert into diaries (body) values ("starting Groonga...");
+insert into diaries (body) values ("started Groonga.");
select * from diaries;
-select * from diaries where match(body) against("start");
+select * from diaries where match(body) against("+start" in boolean mode) order by id;
drop table diaries;
--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_comment_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test
index 9ff8e4448d9..472f26cda6e 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_comment_multiple_token_filters.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test
@@ -16,6 +16,7 @@
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
+--source ../../include/mroonga/have_groonga_plugin_register.inc
--source ../../include/mroonga/load_mroonga_functions.inc
--disable_query_log
@@ -24,7 +25,7 @@ CREATE DATABASE test;
USE test;
--enable_query_log
-SELECT mroonga_command("register token_filters/stop_word");
+SELECT mroonga_command("plugin_register token_filters/stop_word");
SET NAMES utf8;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_comment_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test
index eee08309f76..0d3c00e2c98 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_comment_one_token_filter.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test
@@ -16,6 +16,7 @@
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
+--source ../../include/mroonga/have_groonga_plugin_register.inc
--source ../../include/mroonga/load_mroonga_functions.inc
--disable_query_log
@@ -24,7 +25,7 @@ CREATE DATABASE test;
USE test;
--enable_query_log
-SELECT mroonga_command("register token_filters/stop_word");
+SELECT mroonga_command("plugin_register token_filters/stop_word");
SET NAMES utf8;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test
new file mode 100644
index 00000000000..9decafaf1e7
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test
@@ -0,0 +1,46 @@
+# Copyright(C) 2014 Naoya Murakami <naoya@createfield.com>
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mariadb.inc
+--source include/have_innodb.inc
+--source ../../include/mroonga/have_mroonga.inc
+--source ../../include/mroonga/have_groonga_plugin_register.inc
+--source ../../include/mroonga/load_mroonga_functions.inc
+
+--disable_query_log
+DROP DATABASE test;
+CREATE DATABASE test;
+USE test;
+--enable_query_log
+
+SELECT mroonga_command("plugin_register token_filters/stop_word");
+
+SET NAMES utf8;
+
+CREATE TABLE memos (
+ id INT NOT NULL PRIMARY KEY,
+ content VARCHAR(64) NOT NULL,
+ FULLTEXT INDEX (content) TOKEN_FILTERS='TokenFilterStopWord,TokenFilterStopWord'
+) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8;
+SHOW CREATE TABLE memos;
+
+SELECT mroonga_command("dump --dump_plugins no");
+
+DROP TABLE memos;
+
+--source ../../include/mroonga/unload_mroonga_functions.inc
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_parser_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_comment.test
index 24cc173485a..5053de07781 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_parser_comment.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_comment.test
@@ -1,4 +1,4 @@
-# Copyright(C) 2011 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -14,7 +14,7 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---source ../../include/mroonga/have_fulltext_index_comment.inc
+--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
--disable_warnings
@@ -25,14 +25,14 @@ create table diaries (
id int primary key auto_increment,
body text,
fulltext index body_index (body)
- comment 'parser "TokenBigramSplitSymbolAlphaDigit"'
-) default charset utf8;
+ comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"'
+) comment = 'engine "innodb"' default charset utf8;
show create table diaries;
-insert into diaries (body) values ("will start groonga!");
-insert into diaries (body) values ("starting groonga...");
-insert into diaries (body) values ("started groonga.");
+insert into diaries (body) values ("will start Groonga!");
+insert into diaries (body) values ("starting Groonga...");
+insert into diaries (body) values ("started Groonga.");
select * from diaries;
-select * from diaries where match(body) against("start");
+select * from diaries where match(body) against("+start" in boolean mode) order by id;
drop table diaries;
--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_fulltext_index.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_parameter.test
index c4265ffd22e..7c688199314 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_fulltext_index.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_parameter.test
@@ -1,4 +1,4 @@
-# Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -14,30 +14,30 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+--source ../../include/mroonga/have_mariadb.inc
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
---source ../../include/mroonga/load_mroonga_functions.inc
--disable_warnings
DROP TABLE IF EXISTS diaries;
--enable_warnings
-SET NAMES utf8;
-
CREATE TABLE diaries (
- day DATE PRIMARY KEY,
- content VARCHAR(64) NOT NULL,
- FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerAuto"'
-) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+ id int PRIMARY KEY AUTO_INCREMENT,
+ body text,
+ FULLTEXT INDEX body_index (body) TOKENIZER='TokenBigramSplitSymbolAlphaDigit'
+) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET utf8;
+SHOW CREATE TABLE diaries;
-INSERT INTO diaries VALUES ("2013-04-23", "ブラックコーヒーを飲んã ã€‚");
+INSERT INTO diaries (body) VALUES ("will start Groonga!");
+INSERT INTO diaries (body) VALUES ("starting Groonga...");
+INSERT INTO diaries (body) VALUES ("started Groonga.");
+SELECT * FROM diaries;
SELECT * FROM diaries
- WHERE MATCH (content) AGAINST ("+ãµã‚‰ã¤ã" IN BOOLEAN MODE);
-SELECT * FROM diaries
- WHERE MATCH (content) AGAINST ("+ブラック" IN BOOLEAN MODE);
+ WHERE MATCH(body) AGAINST("+start" IN BOOLEAN MODE)
+ ORDER BY id;
DROP TABLE diaries;
---source ../../include/mroonga/unload_mroonga_functions.inc
--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test
index 6a89d7556ab..c561ac84c98 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test
@@ -1,4 +1,4 @@
-# Copyright(C) 2011-2013 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -35,7 +35,8 @@ INSERT INTO memos VALUES (NULL, "Tomorrow will be fine.");
INSERT INTO memos VALUES (NULL, "Yesterday was fine.");
SELECT * FROM memos
- WHERE MATCH (content) AGAINST ("*DOR today good" IN BOOLEAN MODE);
+ WHERE MATCH (content) AGAINST ("*DOR today good" IN BOOLEAN MODE)
+ ORDER BY id;
DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test
index 790d2f1c9a9..cc3c6cef5b8 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test
@@ -1,4 +1,4 @@
-# Copyright(C) 2011-2013 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -35,7 +35,8 @@ INSERT INTO memos VALUES (NULL, "Tomorrow will be fine.");
INSERT INTO memos VALUES (NULL, "Yesterday was fine.");
SELECT * FROM memos
- WHERE MATCH (content) AGAINST ("*DOR today -good tomorrow" IN BOOLEAN MODE);
+ WHERE MATCH (content) AGAINST ("*DOR today -good tomorrow" IN BOOLEAN MODE)
+ ORDER BY id;
DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test
index a45c414580d..7002db06461 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test
@@ -1,4 +1,4 @@
-# Copyright(C) 2011-2013 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -35,7 +35,8 @@ INSERT INTO memos VALUES (NULL, "Tomorrow will be fine.");
INSERT INTO memos VALUES (NULL, "Yesterday was fine.");
SELECT * FROM memos
- WHERE MATCH (content) AGAINST ("*DOR today +good tomorrow" IN BOOLEAN MODE);
+ WHERE MATCH (content) AGAINST ("*DOR today +good tomorrow" IN BOOLEAN MODE)
+ ORDER BY id;
DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_select.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_select.test
index 6037ab61da0..26c784391ab 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_select.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_select.test
@@ -1,5 +1,5 @@
# Copyright(C) 2010 Tetsuro IKEDA
-# Copyright(C) 2011 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_many_records.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_many_records.test
index c12441f3c5a..442b4f248d9 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_many_records.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_many_records.test
@@ -1,4 +1,4 @@
-# Copyright(C) 2011 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -4129,7 +4129,7 @@ insert into diaries values(4095, "2022-09-29");
commit;
set autocommit=1;
-select * from diaries where match(title) against("2022-09-0");
+select * from diaries where match(title) against("2022-09-0") order by id;
drop table diaries;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_matched_order.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_matched_order.test
new file mode 100644
index 00000000000..2ed609d9fe2
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_matched_order.test
@@ -0,0 +1,50 @@
+# Copyright(C) 2012 Kentoku SHIBA
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source include/have_innodb.inc
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS texts;
+--enable_warnings
+
+SET NAMES UTF8;
+CREATE TABLE texts (
+ id INT PRIMARY KEY,
+ matched TEXT,
+ not_matched TEXT,
+ FULLTEXT KEY (matched),
+ FULLTEXT KEY (not_matched)
+) DEFAULT CHARSET=UTF8 COMMENT='engine "InnoDB"';
+
+INSERT INTO texts VALUES (1, 'Hello1', 'World1');
+INSERT INTO texts VALUES (2, 'Hello2', 'World2');
+INSERT INTO texts VALUES (3, 'Hello3', 'World3');
+
+SELECT id,
+ matched,
+ not_matched,
+ MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE),
+ MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE)
+ FROM texts
+ WHERE MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE)
+ ORDER BY MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE),
+ id;
+
+DROP TABLE texts;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_no_order.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_no_order.test
new file mode 100644
index 00000000000..968a763917d
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_no_order.test
@@ -0,0 +1,48 @@
+# Copyright(C) 2012 Kentoku SHIBA
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source include/have_innodb.inc
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS texts;
+--enable_warnings
+
+SET NAMES UTF8;
+CREATE TABLE texts (
+ id INT PRIMARY KEY,
+ matched TEXT,
+ not_matched TEXT,
+ FULLTEXT KEY (matched),
+ FULLTEXT KEY (not_matched)
+) DEFAULT CHARSET=UTF8 COMMENT='engine "InnoDB"';
+
+INSERT INTO texts VALUES (1, 'Hello1', 'World1');
+INSERT INTO texts VALUES (2, 'Hello2', 'World2');
+INSERT INTO texts VALUES (3, 'Hello3', 'World3');
+
+SELECT id,
+ matched,
+ not_matched,
+ MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE),
+ MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE)
+ FROM texts
+ WHERE MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE);
+
+DROP TABLE texts;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_no_where_both_order.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_no_where_both_order.test
new file mode 100644
index 00000000000..a0ae0ef8a2e
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_no_where_both_order.test
@@ -0,0 +1,50 @@
+# Copyright(C) 2012 Kentoku SHIBA
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source include/have_innodb.inc
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS texts;
+--enable_warnings
+
+SET NAMES UTF8;
+CREATE TABLE texts (
+ id INT PRIMARY KEY,
+ matched TEXT,
+ not_matched TEXT,
+ FULLTEXT KEY (matched),
+ FULLTEXT KEY (not_matched)
+) DEFAULT CHARSET=UTF8 COMMENT='engine "InnoDB"';
+
+INSERT INTO texts VALUES (1, 'Hello1', 'World1');
+INSERT INTO texts VALUES (2, 'Hello2', 'World2');
+INSERT INTO texts VALUES (3, 'Hello3', 'World3');
+
+SELECT id,
+ matched,
+ not_matched,
+ MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE),
+ MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE)
+ FROM texts
+ ORDER BY MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE),
+ MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE),
+ id;
+
+DROP TABLE texts;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_myisam.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_myisam.test
index eda8a5f15ef..4b872eb054c 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_myisam.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_myisam.test
@@ -1,5 +1,5 @@
# Copyright(C) 2010 Tetsuro IKEDA
-# Copyright(C) 2011 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -38,10 +38,10 @@ insert into t1 values(3,30,"sa si su se so");
insert into t1 values(4,40,"ta ti tu te to");
insert into t1 values(5,50,"aa ii uu ee oo");
select * from t1;
-select * from t1 where match(c3) against("su");
-select * from t1 where match(c3) against("ii");
-select * from t1 where match(c3) against("+su" in boolean mode);
-select * from t1 where match(c3) against("+ii" in boolean mode);
+select * from t1 where match(c3) against("su") order by c1;
+select * from t1 where match(c3) against("ii") order by c1;
+select * from t1 where match(c3) against("+su" in boolean mode) order by c1;
+select * from t1 where match(c3) against("+ii" in boolean mode) order by c1;
drop table t1;
set names utf8;
@@ -50,8 +50,8 @@ insert into t1 values(1, "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦","ã‚ã‚ã‚ã‚
insert into t1 values(2, "ã„ã„ã„ã„ã„","明日ã®å¯Œå£«å±±ã®å¤©æ°—ã¯åˆ†ã‹ã‚Šã¾ã›ã‚“");
insert into t1 values(3, "dummy", "dummy");
select * from t1;
-select * from t1 where match(c2) against("富士山");
-select * from t1 where match(c3) against("富士山");
+select * from t1 where match(c2) against("富士山") order by c1;
+select * from t1 where match(c3) against("富士山") order by c1;
drop table t1;
create table t1 (c1 int primary key, c2 varchar(100), fulltext index(c2)) default charset utf8 COMMENT = 'engine "myisam"';
@@ -87,7 +87,7 @@ insert into t1 values(6,20,"ka ki ku ke ko");
insert into t1 values(7,20,"aa ii uu ee oo");
insert into t1 values(8,20,"ka ki ku ke ko");
select * from t1;
-select *,match(c3) against("uu") from t1 where match(c3) against("uu");
+select *,match(c3) against("uu") from t1 where match(c3) against("uu") order by c1;
select * from t1 where not match(c3) against("uu");
select *,match(c3) against("dummy") from t1 where match(c3) against("dummy");
select * from t1 where not match(c3) against("dummy");
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_not_match_against.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_not_match_against.test
index 6ce01598136..43fc4b2771a 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_not_match_against.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_not_match_against.test
@@ -1,5 +1,5 @@
# Copyright(C) 2010 Tetsuro IKEDA
-# Copyright(C) 2011 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -32,16 +32,16 @@ insert into t1 values(6,20,"ka ki ku ke ko");
insert into t1 values(7,20,"aa ii uu ee oo");
insert into t1 values(8,20,"ka ki ku ke ko");
select * from t1;
-select *,match(c3) against("uu") from t1 where match(c3) against("uu");
-select * from t1 where not match(c3) against("uu");
-select *,match(c3) against("dummy") from t1 where match(c3) against("dummy");
-select * from t1 where not match(c3) against("dummy");
-select * from t1 where c1 = 4 and not match(c3) against("uu");
-select * from t1 where c1 <= 4 and not match(c3) against("uu");
-select * from t1 where c1 > 4 and not match(c3) against("uu");
-select * from t1 where c2 = 10 and not match(c3) against("uu");
-select * from t1 where c2 >= 15 and not match(c3) against("uu");
-select * from t1 where c2 < 15 and not match(c3) against("uu");
+select *,match(c3) against("uu") from t1 where match(c3) against("uu") order by c1;
+select * from t1 where not match(c3) against("uu") order by c1;
+select *,match(c3) against("dummy") from t1 where match(c3) against("dummy") order by c1;
+select * from t1 where not match(c3) against("dummy") order by c1;
+select * from t1 where c1 = 4 and not match(c3) against("uu") order by c1;
+select * from t1 where c1 <= 4 and not match(c3) against("uu") order by c1;
+select * from t1 where c1 > 4 and not match(c3) against("uu") order by c1;
+select * from t1 where c2 = 10 and not match(c3) against("uu") order by c1;
+select * from t1 where c2 >= 15 and not match(c3) against("uu") order by c1;
+select * from t1 where c2 < 15 and not match(c3) against("uu") order by c1;
drop table t1;
--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_TODO_SPLIT_ME.test
index 5361b151661..4835f3dcd99 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_TODO_SPLIT_ME.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_TODO_SPLIT_ME.test
@@ -40,11 +40,7 @@ INSERT INTO ft VALUES(5,'eeeee','efghi');
SELECT a, b, c FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE);
SELECT a, b, c FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE) ORDER BY MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE);
-SELECT a, b, c FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE) ORDER BY MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE);
SELECT a, b, c FROM ft WHERE MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE);
-SELECT a, b, c, MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE), MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE) FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE) ORDER BY MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE);
-SELECT a, b, c, MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE), MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE) FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE);
-SELECT a, b, c, MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE), MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE) FROM ft ORDER BY MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE), MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE), a;
DROP TABLE ft;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema-master.opt b/storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema-master.opt
index 611d08f0c78..d2ed32ddf34 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema-master.opt
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema-master.opt
@@ -1 +1 @@
---performance-schema
+--loose-performance-schema
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/truncate.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/truncate.test
index 987fd284f74..8723a882ae9 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/truncate.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/truncate.test
@@ -1,4 +1,4 @@
-# Copyright(C) 2011-2012 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -39,17 +39,23 @@ INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ
INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãã‚Œã„ã«è¦‹ãˆã‚‹ã€‚");
SELECT * FROM diaries;
-SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE);
+SELECT * FROM diaries
+ WHERE MATCH(content) AGAINST("+今日" IN BOOLEAN MODE)
+ ORDER BY id;
TRUNCATE TABLE diaries;
SELECT * FROM diaries;
-SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE);
+SELECT * FROM diaries
+ WHERE MATCH(content) AGAINST("+今日" IN BOOLEAN MODE)
+ ORDER BY id;
INSERT INTO diaries VALUES(1, 2011, 11, 11, "帰りé“", "ã¤ã‹ã‚ŒãŸãƒ¼");
INSERT INTO diaries VALUES(2, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "天気ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚");
INSERT INTO diaries VALUES(3, 2011, 12, 2, "åˆé›ª", "今年ã¯ã˜ã‚ã¦ã®é›ªï¼");
SELECT * FROM diaries;
-SELECT * FROM diaries WHERE MATCH(content) AGAINST("悪ã„" IN BOOLEAN MODE);
+SELECT * FROM diaries
+ WHERE MATCH(content) AGAINST("+悪ã„" IN BOOLEAN MODE)
+ ORDER BY id;
DROP TABLE diaries;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_global.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_global.test
index 065b78d44a7..9704d2d3e53 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_global.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_global.test
@@ -15,7 +15,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source include/have_innodb.inc
---source ../../include/mroonga/have_fulltext_index_comment.inc
--source ../../include/mroonga/have_mroonga.inc
--disable_warnings
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_session.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_session.test
index b47dcef3967..c6967790b01 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_session.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_session.test
@@ -15,7 +15,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source include/have_innodb.inc
---source ../../include/mroonga/have_fulltext_index_comment.inc
--source ../../include/mroonga/have_mroonga.inc
--disable_warnings
diff --git a/storage/mroonga/packages/apt/build-deb.sh b/storage/mroonga/packages/apt/build-deb.sh
index 7db24068a7c..510886cb24f 100755
--- a/storage/mroonga/packages/apt/build-deb.sh
+++ b/storage/mroonga/packages/apt/build-deb.sh
@@ -27,8 +27,8 @@ case "${distribution}" in
debian)
component=main
run cat <<EOF > /etc/apt/sources.list.d/groonga.list
-deb http://packages.groonga.org/debian/ wheezy main
-deb-src http://packages.groonga.org/debian/ wheezy main
+deb http://packages.groonga.org/debian/ ${code_name} main
+deb-src http://packages.groonga.org/debian/ ${code_name} main
EOF
if ! grep --quiet security /etc/apt/sources.list; then
run cat <<EOF > /etc/apt/sources.list.d/security.list
@@ -75,4 +75,4 @@ run cd -
package_initial=$(echo "${PACKAGE}" | sed -e 's/\(.\).*/\1/')
pool_dir="/vagrant/repositories/${distribution}/pool/${code_name}/${component}/${package_initial}/${PACKAGE}"
run mkdir -p "${pool_dir}/"
-run cp *.tar.gz *.diff.gz *.dsc *.deb "${pool_dir}/"
+run cp *.tar.* *.diff.gz *.dsc *.deb "${pool_dir}/"
diff --git a/storage/mroonga/packages/debian/changelog b/storage/mroonga/packages/debian/changelog
index d3025d96100..366edca7b4e 100644
--- a/storage/mroonga/packages/debian/changelog
+++ b/storage/mroonga/packages/debian/changelog
@@ -1,3 +1,15 @@
+mroonga (5.04-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Masafumi Yokoyama <myokoym@gmail.com> Mon, 29 Jun 2015 00:00:00 +0900
+
+mroonga (5.03-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Fri, 29 May 2015 00:00:00 +0900
+
mroonga (5.02-1) unstable; urgency=low
* New upstream release.
diff --git a/storage/mroonga/packages/rpm/centos/mariadb-mroonga.spec.in b/storage/mroonga/packages/rpm/centos/mariadb-mroonga.spec.in
index ca48e59aaec..04d1c41f2cc 100644
--- a/storage/mroonga/packages/rpm/centos/mariadb-mroonga.spec.in
+++ b/storage/mroonga/packages/rpm/centos/mariadb-mroonga.spec.in
@@ -154,6 +154,12 @@ fi
%doc mysql-mroonga-doc/*
%changelog
+* Mon Jun 29 2015 Masafumi Yokoyama <myokoym@gmail.com> - 5.04-1
+- new upstream release.
+
+* Fri May 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 5.03-1
+- new upstream release.
+
* Wed Apr 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 5.02-1
- new upstream release.
diff --git a/storage/mroonga/packages/rpm/centos/mysql55-mroonga.spec.in b/storage/mroonga/packages/rpm/centos/mysql55-mroonga.spec.in
index 1fc641b9bca..e20e1b32162 100644
--- a/storage/mroonga/packages/rpm/centos/mysql55-mroonga.spec.in
+++ b/storage/mroonga/packages/rpm/centos/mysql55-mroonga.spec.in
@@ -163,6 +163,12 @@ fi
%doc mysql-mroonga-doc/*
%changelog
+* Mon Jun 29 2015 Masafumi Yokoyama <myokoym@gmail.com> - 5.04-1
+- new upstream release.
+
+* Fri May 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 5.03-1
+- new upstream release.
+
* Wed Apr 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 5.02-1
- new upstream release.
diff --git a/storage/mroonga/packages/rpm/centos/mysql56-community-mroonga.spec.in b/storage/mroonga/packages/rpm/centos/mysql56-community-mroonga.spec.in
index 53759e0c778..f3233d17afe 100644
--- a/storage/mroonga/packages/rpm/centos/mysql56-community-mroonga.spec.in
+++ b/storage/mroonga/packages/rpm/centos/mysql56-community-mroonga.spec.in
@@ -1,14 +1,14 @@
%{!?centos_ver:%define centos_ver 6}
%if %{centos_ver} == 7
-%define mysql_version_default 5.6.24
-%define mysql_release_default 3
+%define mysql_version_default 5.6.25
+%define mysql_release_default 2
%define mysql_dist_default el7
%define mysql_download_base_url_default http://repo.mysql.com/yum/mysql-5.6-community/el/7/SRPMS
%define mysql_spec_file_default mysql.spec
%else
-%define mysql_version_default 5.6.24
-%define mysql_release_default 3
+%define mysql_version_default 5.6.25
+%define mysql_release_default 2
%define mysql_dist_default el6
%define mysql_download_base_url_default http://repo.mysql.com/yum/mysql-5.6-community/el/6/SRPMS
%define mysql_spec_file_default mysql.spec
@@ -77,7 +77,10 @@ if [ ! -d ${mysql_source} ]; then
--define 'optflags -O0' \
../../SPECS/%{mysql_spec_file}
fi
-%configure --disable-static --with-mysql-source=${mysql_source} \
+%configure \
+ --disable-static \
+ --with-mysql-source=${mysql_source} \
+ --enable-fast-mutexes \
%{?mroonga_configure_options}
make %{?_smp_mflags}
@@ -91,6 +94,13 @@ mv $RPM_BUILD_ROOT%{_datadir}/doc/mroonga/ mysql-mroonga-doc/
rm -rf $RPM_BUILD_ROOT
%post
+if ! /sbin/service mysqld status > /dev/null; then
+ /sbin/service mysqld start
+ stop_after_installation=1
+else
+ stop_after_installation=0
+fi
+
mysql_command=`which mysql`
password_option=""
$mysql_command -u root -e "quit"
@@ -129,7 +139,18 @@ eval $command || \
(echo "run the following command to register Mroonga:"; \
echo " $command")
+if [ "$stop_after_installation" = "1" ]; then
+ /sbin/service mysqld stop
+fi
+
%preun
+if ! /sbin/service mysqld status > /dev/null; then
+ /sbin/service mysqld start
+ stop_after_uninstallation=1
+else
+ stop_after_uninstallation=0
+fi
+
uninstall_sql=%{_datadir}/mroonga/uninstall.sql
mysql_command=`which mysql`
if $mysql_command -u root -e "quit"; then
@@ -145,6 +166,10 @@ if [ "$1" = 0 ]; then
echo " $command")
fi
+if [ "$stop_after_uninstallation" = "1" ]; then
+ /sbin/service mysqld stop
+fi
+
%files
%defattr(-,root,root,-)
%{_libdir}/mysql/plugin/
@@ -158,6 +183,15 @@ fi
%doc mysql-mroonga-doc/*
%changelog
+* Mon Jun 29 2015 Masafumi Yokoyama <myokoym@gmail.com> - 5.04-1
+- new upstream release.
+
+* Thu Jun 02 2015 Masafumi Yokoyama <yokoyama@clear-code.com> - 5.03-2
+- build against MySQL 5.6.25.
+
+* Fri May 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 5.03-1
+- new upstream release.
+
* Wed Apr 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 5.02-1
- new upstream release.
diff --git a/storage/mroonga/packages/rpm/centos/percona-server-56-mroonga.spec.in b/storage/mroonga/packages/rpm/centos/percona-server-56-mroonga.spec.in
index f0306cace24..cf1947e2676 100644
--- a/storage/mroonga/packages/rpm/centos/percona-server-56-mroonga.spec.in
+++ b/storage/mroonga/packages/rpm/centos/percona-server-56-mroonga.spec.in
@@ -1,7 +1,7 @@
%{!?centos_ver:%define centos_ver 6}
-%define mysql_version_default 5.6.23
-%define mysql_release_default rel72.1
+%define mysql_version_default 5.6.24
+%define mysql_release_default rel72.2
%define mysql_dist_default %{?dist}
%define mysql_download_base_url_default http://repo.percona.com/centos/%{centos_ver}/SRPMS
%define mysql_spec_file_default percona-server.spec
@@ -85,6 +85,13 @@ mv $RPM_BUILD_ROOT%{_datadir}/doc/mroonga/ mysql-mroonga-doc/
rm -rf $RPM_BUILD_ROOT
%post
+if ! /sbin/service mysql status > /dev/null; then
+ /sbin/service mysql start
+ stop_after_installation=1
+else
+ stop_after_installation=0
+fi
+
mysql_command=`which mysql`
password_option=""
$mysql_command -u root -e "quit"
@@ -123,7 +130,18 @@ eval $command || \
(echo "run the following command to register Mroonga:"; \
echo " $command")
+if [ "$stop_after_installation" = "1" ]; then
+ /sbin/service mysql stop
+fi
+
%preun
+if ! /sbin/service mysql status > /dev/null; then
+ /sbin/service mysql start
+ stop_after_uninstallation=1
+else
+ stop_after_uninstallation=0
+fi
+
uninstall_sql=%{_datadir}/mroonga/uninstall.sql
mysql_command=`which mysql`
if $mysql_command -u root -e "quit"; then
@@ -139,6 +157,10 @@ if [ "$1" = 0 ]; then
echo " $command")
fi
+if [ "$stop_after_uninstallation" = "1" ]; then
+ /sbin/service mysql stop
+fi
+
%files
%defattr(-,root,root,-)
%{_libdir}/mysql/plugin/
diff --git a/storage/mroonga/packages/source/Makefile.am b/storage/mroonga/packages/source/Makefile.am
index 0f242c4e038..143f5d0387e 100644
--- a/storage/mroonga/packages/source/Makefile.am
+++ b/storage/mroonga/packages/source/Makefile.am
@@ -1,17 +1,17 @@
MROONGA_BASE = $(PACKAGE)-$(VERSION)
MROONGA_TAR_GZ = $(MROONGA_BASE).tar.gz
-GROONGA_VERSION = 5.0.3
+GROONGA_VERSION = 5.0.5
GROONGA_BASE = groonga-$(GROONGA_VERSION)
GROONGA_TAR_GZ = $(GROONGA_BASE).tar.gz
-GROONGA_NORMALIZER_MYSQL_VERSION = 1.0.9
+GROONGA_NORMALIZER_MYSQL_VERSION = 1.1.0
GROONGA_NORMALIZER_MYSQL_BASE = \
groonga-normalizer-mysql-$(GROONGA_NORMALIZER_MYSQL_VERSION)
GROONGA_NORMALIZER_MYSQL_TAR_GZ = \
$(GROONGA_NORMALIZER_MYSQL_BASE).tar.gz
-MARIADB_VERSION = 10.0.17
+MARIADB_VERSION = 10.0.20
MARIADB_BASE = mariadb-$(MARIADB_VERSION)
MARIADB_TAR_GZ = $(MARIADB_BASE).tar.gz
diff --git a/storage/mroonga/packages/ubuntu/upload.rb b/storage/mroonga/packages/ubuntu/upload.rb
index 79331a06c8d..8743520b5ac 100755
--- a/storage/mroonga/packages/ubuntu/upload.rb
+++ b/storage/mroonga/packages/ubuntu/upload.rb
@@ -127,8 +127,8 @@ allow_unsigned_uploads = 0
case code_name
when "vivid"
run_command("sed",
- "-i", "-e", "s,5\.5,5\.6,g",
- "debian/rules")
+ "-i", "-e", "s,5\\.5,5.6,g",
+ "debian/rules")
end
run_command("sed",
"-i", "-e", "s,MYSQL_VERSION,#{@mysql_version[code_name]},",
diff --git a/storage/mroonga/packages/yum/sign-rpm.sh b/storage/mroonga/packages/yum/sign-rpm.sh
index b3a45afe7f5..27ec5711010 100755
--- a/storage/mroonga/packages/yum/sign-rpm.sh
+++ b/storage/mroonga/packages/yum/sign-rpm.sh
@@ -24,7 +24,7 @@ run()
unsigned_rpms()
{
while read rpm; do
- rpm --checksig "$rpm" | grep -v 'gpg OK' | cut -d":" -f1
+ rpm --checksig "$rpm" | grep -v 'gpg OK' | grep -v 'MISSING KEYS' | cut -d":" -f1
done
}
diff --git a/storage/mroonga/plugin_version b/storage/mroonga/plugin_version
index 341d0b550fd..48c32b26a12 100644
--- a/storage/mroonga/plugin_version
+++ b/storage/mroonga/plugin_version
@@ -1 +1 @@
-5.2 \ No newline at end of file
+5.4 \ No newline at end of file
diff --git a/storage/mroonga/tools/travis/before_script.sh b/storage/mroonga/tools/travis/before_script.sh
index 7d4d7dcec5f..1b3ba158675 100755
--- a/storage/mroonga/tools/travis/before_script.sh
+++ b/storage/mroonga/tools/travis/before_script.sh
@@ -20,9 +20,26 @@
set -e
if [ "${MROONGA_BUNDLED}" = "yes" ]; then
- cmake_args=(-DCMAKE_BUILD_TYPE=Debug)
+ cmake_args=(-DCMAKE_BUILD_TYPE=Debug -DWITH_UNIT_TESTS=FALSE)
+ cmake_args=("${cmake_args[@]}" -DWITH_EMBEDDED_SERVER=TRUE)
+ cmake_args=("${cmake_args[@]}" -DWITHOUT_ARCHIVE=TRUE)
+ cmake_args=("${cmake_args[@]}" -DWITHOUT_BLACKHOLE=TRUE)
+ cmake_args=("${cmake_args[@]}" -DWITHOUT_CASSANDRA=TRUE)
+ cmake_args=("${cmake_args[@]}" -DWITHOUT_CONNECT=TRUE)
+ cmake_args=("${cmake_args[@]}" -DWITHOUT_CSV=TRUE)
+ cmake_args=("${cmake_args[@]}" -DWITHOUT_EXAMPLE=TRUE)
+ cmake_args=("${cmake_args[@]}" -DWITHOUT_FEDERATED=TRUE)
+ cmake_args=("${cmake_args[@]}" -DWITHOUT_FEDERATEDX=TRUE)
+ cmake_args=("${cmake_args[@]}" -DWITHOUT_HEAP=TRUE)
+ cmake_args=("${cmake_args[@]}" -DWITHOUT_MYISAMMRG=TRUE)
+ cmake_args=("${cmake_args[@]}" -DWITHOUT_OQGRAPH=TRUE)
+ cmake_args=("${cmake_args[@]}" -DWITHOUT_SEQUENCE=TRUE)
+ cmake_args=("${cmake_args[@]}" -DWITHOUT_SPHINX=TRUE)
+ cmake_args=("${cmake_args[@]}" -DWITHOUT_SPIDER=TRUE)
+ cmake_args=("${cmake_args[@]}" -DWITHOUT_TEST_SQL_DISCOVERY=TRUE)
+ cmake_args=("${cmake_args[@]}" -DWITHOUT_TOKUDB=TRUE)
if [ "${MROONGA_TEST_EMBEDDED}" = "yes" ]; then
- cmake_args=("${cmake_args[@]}" "-DWITH_EMBEDDED_SERVER=TRUE")
+ cmake_args=("${cmake_args[@]}" -DWITH_EMBEDDED_SERVER=TRUE)
fi
cmake . "${cmake_args[@]}"
else
@@ -31,6 +48,10 @@ else
if [ -d /opt/mysql/ ]; then
PATH=$(echo /opt/mysql/server-*/bin/):$PATH
fi
- ./configure \
- --with-mysql-source=$PWD/vendor/mysql
+ configure_args=("--with-mysql-source=$PWD/vendor/mysql")
+ if [ "${MYSQL_VERSION}" = "mysql-5.6.25" ]; then
+ configure_args=("${configure_args[@]}" --enable-fast-mutexes)
+ fi
+ ./configure "${configure_args[@]}"
+ cat "$(mysql_config --include | sed -e 's/-I//g')/my_config.h"
fi
diff --git a/storage/mroonga/tools/travis/script.sh b/storage/mroonga/tools/travis/script.sh
index 6ea5c86068b..d8dd188f1f2 100755
--- a/storage/mroonga/tools/travis/script.sh
+++ b/storage/mroonga/tools/travis/script.sh
@@ -32,7 +32,11 @@ else
fi
n_processors="$(grep '^processor' /proc/cpuinfo | wc -l)"
-max_n_processors=8
+if [ "${MROONGA_BUNDLED}" = "yes" ]; then
+ max_n_processors=2
+else
+ max_n_processors=4
+fi
if (( $n_processors > $max_n_processors )); then
n_processors=$max_n_processors
fi
@@ -98,6 +102,14 @@ run_sql_test()
fi
if [ "${MROONGA_BUNDLED}" = "yes" ]; then
+ # Plugins aren't supported.
+ cd ${mroonga_dir}/mysql-test/mroonga/storage
+ rm -rf alter_table/add_index/token_filters/
+ rm -rf alter_table/t/change_token_filter.test
+ rm -rf create/table/token_filters/
+ rm -rf fulltext/token_filters/
+ cd -
+
${mroonga_dir}/test/run-sql-test.sh \
"${test_args[@]}" \
--parallel="${n_processors}"
diff --git a/storage/mroonga/vendor/groonga/CMakeLists.txt b/storage/mroonga/vendor/groonga/CMakeLists.txt
index 85a84f91ef0..625a65b48d0 100644
--- a/storage/mroonga/vendor/groonga/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/CMakeLists.txt
@@ -143,59 +143,34 @@ if(CMAKE_COMPILER_IS_GNUCC)
endif()
-macro(check_cflag flag)
- string(REGEX REPLACE "[-=]" "_" temporary_variable_name ${flag})
- string(TOUPPER "${temporary_variable_name}" temporary_variable_name)
- set(temporary_variable_name "CFLAG${temporary_variable_name}")
- check_c_compiler_flag(${flag} ${temporary_variable_name})
- if(${temporary_variable_name})
- set(GRN_C_COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS} ${flag}")
- endif()
-endmacro()
-
-macro(check_cxxflag flag)
- string(REGEX REPLACE "[-=]" "_" temporary_variable_name ${flag})
- string(TOUPPER "${temporary_variable_name}" temporary_variable_name)
- set(temporary_variable_name "CXXFLAG${temporary_variable_name}")
- check_cxx_compiler_flag(${flag} ${temporary_variable_name})
- if(${temporary_variable_name})
- set(GRN_CXX_COMPILE_FLAGS "${GRN_CXX_COMPILE_FLAGS} ${flag}")
- endif()
-endmacro()
-
-macro(check_build_flag flag)
- check_cflag(${flag})
- check_cxxflag(${flag})
-endmacro()
-
if(CMAKE_COMPILER_IS_GNUCXX)
- check_build_flag("-Wall")
- check_build_flag("-Wextra")
- check_build_flag("-Wno-unused-but-set-variable")
- check_build_flag("-Wno-unused-parameter")
- check_build_flag("-Wno-sign-compare")
- check_cflag("-Wno-pointer-sign")
- check_build_flag("-Wno-missing-field-initializers")
- check_build_flag("-Wformat=2")
- check_build_flag("-Wstrict-aliasing=2")
- check_build_flag("-fno-strict-aliasing")
- check_build_flag("-Wdisabled-optimization")
- check_build_flag("-Wfloat-equal")
- check_build_flag("-Wpointer-arith")
- check_cflag("-Wdeclaration-after-statement")
- check_cflag("-Wbad-function-cast")
- check_build_flag("-Wcast-align")
- check_build_flag("-Wredundant-decls")
- check_build_flag("-Wwrite-strings")
- check_cxxflag("-fexceptions")
- check_cxxflag("-fimplicit-templates")
- check_build_flag("-Wno-clobbered")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wall")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wextra")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-but-set-variable")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-parameter")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-sign-compare")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-pointer-sign")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-missing-field-initializers")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wformat=2")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wstrict-aliasing=2")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-fno-strict-aliasing")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wdisabled-optimization")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wfloat-equal")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wpointer-arith")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wdeclaration-after-statement")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wbad-function-cast")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wcast-align")
+ #MY_CHECK_AND_SET_COMPILER_FLAG("-Wredundant-decls")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wwrite-strings")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-fexceptions")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-fimplicit-templates")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-clobbered")
endif()
if(NOT DEFINED CMAKE_C_COMPILE_OPTIONS_PIC)
# For old CMake
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGCXX)
- check_build_flag("-fPIC")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-fPIC")
endif()
endif()
@@ -210,6 +185,9 @@ endif()
add_definitions(
-DHAVE_CONFIG_H
)
+if(GRN_EMBED)
+ add_definitions(-DGRN_EMBEDDED)
+endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGCXX)
set(_GNU_SOURCE TRUE)
@@ -363,7 +341,9 @@ endif()
set(GRN_WITH_LZ4 "auto"
CACHE STRING "Support data compression by LZ4.")
if(NOT ${GRN_WITH_LZ4} STREQUAL "no")
- pkg_check_modules(LIBLZ4 liblz4)
+ if(NOT DEFINED LIBLZ4_FOUND)
+ pkg_check_modules(LIBLZ4 liblz4)
+ endif()
if(LIBLZ4_FOUND)
set(GRN_WITH_LZ4 TRUE)
else()
@@ -414,7 +394,9 @@ endif()
set(GRN_WITH_KYTEA "auto"
CACHE STRING "use KyTea for morphological analysis")
if(NOT ${GRN_WITH_KYTEA} STREQUAL "no")
- pkg_check_modules(KYTEA kytea)
+ if(NOT DEFINED KYTEA_FOUND)
+ pkg_check_modules(KYTEA kytea)
+ endif()
if(KYTEA_FOUND)
set(GRN_WITH_KYTEA TRUE)
else()
@@ -462,7 +444,9 @@ endif()
set(GRN_WITH_ZEROMQ "auto"
CACHE STRING "use ZeroMQ for suggestion")
if(NOT ${GRN_WITH_ZEROMQ} STREQUAL "no")
- pkg_check_modules(ZEROMQ libzmq)
+ if(NOT DEFINED ZEROMQ_FOUND)
+ pkg_check_modules(ZEROMQ libzmq)
+ endif()
if(ZEROMQ_FOUND)
set(GRN_WITH_ZEROMQ TRUE)
else()
@@ -505,7 +489,9 @@ endif()
set(GRN_WITH_MESSAGE_PACK "auto"
CACHE STRING "use MessagePack for suggestion")
if(NOT ${GRN_WITH_MESSAGE_PACK} STREQUAL "no")
- pkg_check_modules(MESSAGE_PACK msgpack)
+ if(NOT DEFINED MESSAGE_PACK_FOUND)
+ pkg_check_modules(MESSAGE_PACK msgpack)
+ endif()
if(MESSAGE_PACK_FOUND)
set(GRN_WITH_MESSAGE_PACK TRUE)
else()
@@ -556,6 +542,9 @@ endif()
add_definitions(-DONIG_EXTERN=extern)
add_subdirectory(vendor)
+if(GRN_EMBED)
+ add_subdirectory(plugins)
+endif()
add_subdirectory(lib)
if(NOT GRN_EMBED)
add_subdirectory(src)
diff --git a/storage/mroonga/vendor/groonga/base_version b/storage/mroonga/vendor/groonga/base_version
index 26611488b0a..25b08bbc78f 100644
--- a/storage/mroonga/vendor/groonga/base_version
+++ b/storage/mroonga/vendor/groonga/base_version
@@ -1 +1 @@
-5.0.3 \ No newline at end of file
+5.0.5 \ No newline at end of file
diff --git a/storage/mroonga/vendor/groonga/bindings/php/groonga.c b/storage/mroonga/vendor/groonga/bindings/php/groonga.c
index b92cc1a2385..a04bb9cd42f 100644
--- a/storage/mroonga/vendor/groonga/bindings/php/groonga.c
+++ b/storage/mroonga/vendor/groonga/bindings/php/groonga.c
@@ -101,6 +101,9 @@ PHP_FUNCTION(grn_ctx_init)
long flags = 0;
grn_rc rc;
+ if (ctx == NULL) {
+ RETURN_FALSE; // unable to allocate memory for ctx
+ }
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags) == FAILURE) {
return;
diff --git a/storage/mroonga/vendor/groonga/build/ac_macros/check_headers.m4 b/storage/mroonga/vendor/groonga/build/ac_macros/check_headers.m4
index 2a7e0f03acc..9a30ca8fc9c 100644
--- a/storage/mroonga/vendor/groonga/build/ac_macros/check_headers.m4
+++ b/storage/mroonga/vendor/groonga/build/ac_macros/check_headers.m4
@@ -5,14 +5,10 @@ AC_CHECK_HEADERS(dlfcn.h)
AC_CHECK_HEADERS(errno.h)
AC_CHECK_HEADERS(execinfo.h)
AC_CHECK_HEADERS(inttypes.h)
-AC_CHECK_HEADERS(io.h)
AC_CHECK_HEADERS(netdb.h)
-AC_CHECK_HEADERS(netinet/in.h)
-AC_CHECK_HEADERS(netinet/tcp.h)
AC_CHECK_HEADERS(signal.h)
AC_CHECK_HEADERS(stdarg.h)
AC_CHECK_HEADERS(stdint.h)
-AC_CHECK_HEADERS(stdlib.h)
AC_CHECK_HEADERS(string.h)
AC_CHECK_HEADERS(strings.h)
AC_CHECK_HEADERS(sys/mman.h)
@@ -21,7 +17,6 @@ AC_CHECK_HEADERS(sys/resource.h)
AC_CHECK_HEADERS(sys/socket.h)
AC_CHECK_HEADERS(sys/sysctl.h)
AC_CHECK_HEADERS(sys/time.h)
-AC_CHECK_HEADERS(sys/types.h)
AC_CHECK_HEADERS(sys/wait.h)
AC_CHECK_HEADERS(time.h)
AC_CHECK_HEADERS(ucontext.h)
diff --git a/storage/mroonga/vendor/groonga/config.h.cmake b/storage/mroonga/vendor/groonga/config.h.cmake
index cd8e4f6cc2d..8e3bdaf216b 100644
--- a/storage/mroonga/vendor/groonga/config.h.cmake
+++ b/storage/mroonga/vendor/groonga/config.h.cmake
@@ -14,7 +14,7 @@
#define PACKAGE_URL "${PACKAGE_URL}"
#define PACKAGE_VERSION "${VERSION}"
-/* groonga related constants */
+/* Groonga related constants */
#define GRN_CONFIG_PATH "${GRN_CONFIG_PATH}"
#define GRN_LOG_PATH "${GRN_LOG_PATH}"
#define GRN_VERSION "${GRN_VERSION}"
@@ -98,17 +98,13 @@
#cmakedefine HAVE_ERRNO_H
#cmakedefine HAVE_EXECINFO_H
#cmakedefine HAVE_INTTYPES_H
-#cmakedefine HAVE_IO_H
#cmakedefine HAVE_LINUX_FUTEX_H
#cmakedefine HAVE_MEMORY_H
#cmakedefine HAVE_NETDB_H
-#cmakedefine HAVE_NETINET_IN_H
-#cmakedefine HAVE_NETINET_TCP_H
#cmakedefine HAVE_PTHREAD_H
#cmakedefine HAVE_SIGNAL_H
#cmakedefine HAVE_STDARG_H
#cmakedefine HAVE_STDINT_H
-#cmakedefine HAVE_STDLIB_H
#cmakedefine HAVE_STRINGS_H
#cmakedefine HAVE_STRING_H
#cmakedefine HAVE_SYS_MMAN_H
@@ -120,7 +116,6 @@
#cmakedefine HAVE_SYS_SYSCALL_H
#cmakedefine HAVE_SYS_SYSCTL_H
#cmakedefine HAVE_SYS_TIME_H
-#cmakedefine HAVE_SYS_TYPES_H
#cmakedefine HAVE_SYS_WAIT_H
#cmakedefine HAVE_TIME_H
#cmakedefine HAVE_UCONTEXT_H
diff --git a/storage/mroonga/vendor/groonga/configure.ac b/storage/mroonga/vendor/groonga/configure.ac
index 17f3abcc2ed..dad29c78f4c 100644
--- a/storage/mroonga/vendor/groonga/configure.ac
+++ b/storage/mroonga/vendor/groonga/configure.ac
@@ -169,7 +169,7 @@ if test "$GCC" = "yes"; then
if test "$CLANG" = "no"; then
CHECK_BUILD_FLAG([-Wcast-align])
fi
- CHECK_BUILD_FLAG([-Wredundant-decls])
+# CHECK_BUILD_FLAG([-Wredundant-decls])
# CHECK_BUILD_FLAG([-Wunsafe-loop-optimizations])
# CHECK_BUILD_FLAG([-Wunreachable-code])
# CHECK_BUILD_FLAG([-Wswitch-enum])
@@ -1508,6 +1508,8 @@ AM_CONDITIONAL(WITH_SHARED_ONIGMO, test "$enable_shared_onigmo" = "yes")
# TODO: Support using system Onigmo instead of bundled Onigmo.
AC_DEFINE(GRN_WITH_ONIGMO, [1], [Use Onigmo.])
+GRN_WITH_ONIGMO="yes"
+AC_SUBST(GRN_WITH_ONIGMO)
AC_CONFIG_SUBDIRS([vendor/onigmo])
ONIGMO_CFLAGS="-I\$(top_srcdir)/vendor/onigmo-source"
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/edict/edict2grn.rb b/storage/mroonga/vendor/groonga/examples/dictionary/edict/edict2grn.rb
index 664b12c2148..b795e25a50b 100755
--- a/storage/mroonga/vendor/groonga/examples/dictionary/edict/edict2grn.rb
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/edict/edict2grn.rb
@@ -1,47 +1,23 @@
#!/usr/bin/env ruby
-# -*- coding: utf-8 -*-
-$KCODE = 'u'
+require "English"
+require "nkf"
+require "json"
-require 'English'
-require 'kconv'
-
-class String
- def to_json
- a = split(//).map {|char|
- case char
- when '"' then '\\"'
- when '\\' then '\\\\'
- when "\b" then '\b'
- when "\f" then '\f'
- when "\n" then '\n'
- when "\r" then ''
- when "\t" then '\t'
- else char
- end
- }
- "\"#{a.join('')}\""
- end
-end
-
-class Array
- def to_json
- '[' + map {|element|
- element.to_json
- }.join(',') + ']'
- end
-end
-
-puts <<END
+print(<<HEADER.chomp)
column_create item_dictionary edict_desc COLUMN_SCALAR ShortText
column_create bigram item_dictionary_edict_desc COLUMN_INDEX|WITH_POSITION item_dictionary edict_desc
load --table item_dictionary
-[["_key","edict_desc","kana"],
-END
+[
+["_key","edict_desc","kana"]
+HEADER
+
+loop do
+ raw_line = gets
+ break if raw_line.nil?
-while !STDIN.eof?
- line = Kconv.toutf8(gets)
- key, body = line.strip.split('/', 2)
+ line = raw_line.encode("UTF-8", "EUC-JP")
+ key, body = line.strip.split("/", 2)
key = key.strip
if /\s*\[(.+)\]\z/ =~ key
key = $PREMATCH
@@ -51,6 +27,8 @@ while !STDIN.eof?
else
kana = NKF.nkf("-Ww --katakana", key)
end
- puts [key, body, kana].to_json
+ puts(",")
+ puts([key, body, kana].to_json)
end
-puts ']'
+puts
+puts("]")
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/gene95/gene2grn.rb b/storage/mroonga/vendor/groonga/examples/dictionary/gene95/gene2grn.rb
index 0d10cfd1085..c9d9a593b11 100755
--- a/storage/mroonga/vendor/groonga/examples/dictionary/gene95/gene2grn.rb
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/gene95/gene2grn.rb
@@ -1,46 +1,33 @@
#!/usr/bin/env ruby
-# -*- coding: utf-8 -*-
-$KCODE = 'u'
+require "json"
-require 'kconv'
-
-class String
- def to_json
- a = split(//).map {|char|
- case char
- when '"' then '\\"'
- when '\\' then '\\\\'
- when "\b" then '\b'
- when "\f" then '\f'
- when "\n" then '\n'
- when "\r" then ''
- when "\t" then '\t'
- else char
- end
- }
- "\"#{a.join('')}\""
- end
-end
-
-class Array
- def to_json
- '[' + map {|element|
- element.to_json
- }.join(',') + ']'
- end
-end
-
-puts <<END
+print(<<HEADER.chomp)
column_create item_dictionary gene95_desc COLUMN_SCALAR ShortText
column_create bigram item_dictionary_gene95_desc COLUMN_INDEX|WITH_POSITION item_dictionary gene95_desc
load --table item_dictionary
-[["_key","gene95_desc"],
-END
+[
+["_key","gene95_desc"]
+HEADER
-while !STDIN.eof?
- key = Kconv.toutf8(gets.strip)
- body = Kconv.toutf8(gets.strip)
- puts [key, body].to_json
+loop do
+ raw_key = gets
+ break if raw_key.nil?
+ raw_body = gets
+
+ key = nil
+ body = nil
+ begin
+ key = raw_key.encode("UTF-8", "Windows-31J").strip
+ body = raw_body.encode("UTF-8", "Windows-31J").strip
+ rescue EncodingError
+ $stderr.puts("Ignore:")
+ $stderr.puts(" key: <#{raw_key}>")
+ $stderr.puts(" body: <#{raw_body}>")
+ next
+ end
+ puts(",")
+ print([key, body].to_json)
end
-puts ']'
+puts
+puts("]")
diff --git a/storage/mroonga/vendor/groonga/groonga-httpd-conf.sh.in b/storage/mroonga/vendor/groonga/groonga-httpd-conf.sh.in
index 380495bb391..73b8867eafa 100644
--- a/storage/mroonga/vendor/groonga/groonga-httpd-conf.sh.in
+++ b/storage/mroonga/vendor/groonga/groonga-httpd-conf.sh.in
@@ -25,4 +25,6 @@ export GROONGA_HTTPD_DEBUG="@grn_debug@"
export GROONGA_HTTPD_WITH_PCRE="@GRN_WITH_PCRE@"
export GROONGA_HTTPD_PCRE_CFLAGS="@PCRE_CFLAGS@"
export GROONGA_HTTPD_PCRE_LIBS_ONLY_L="@PCRE_LIBS_ONLY_L@"
+export GROONGA_HTTPD_WITH_ONIGMO="@GRN_WITH_ONIGMO@"
+export GROONGA_HTTPD_ONIGMO_IN_TREE_LINK_PATH="@abs_top_builddir@/vendor/onigmo-source/.libs"
export GROONGA_HTTPD_WITH_ZLIB="@GRN_WITH_ZLIB@"
diff --git a/storage/mroonga/vendor/groonga/include/groonga/command.h b/storage/mroonga/vendor/groonga/include/groonga/command.h
index 101956a04f9..ac5270e9798 100644
--- a/storage/mroonga/vendor/groonga/include/groonga/command.h
+++ b/storage/mroonga/vendor/groonga/include/groonga/command.h
@@ -43,6 +43,8 @@ GRN_PLUGIN_EXPORT grn_obj *grn_command_input_get(grn_ctx *ctx,
GRN_PLUGIN_EXPORT grn_obj *grn_command_input_at(grn_ctx *ctx,
grn_command_input *input,
unsigned int offset);
+GRN_PLUGIN_EXPORT grn_obj *grn_command_input_get_arguments(grn_ctx *ctx,
+ grn_command_input *input);
typedef void grn_command_run_func(grn_ctx *ctx,
grn_obj *command,
diff --git a/storage/mroonga/vendor/groonga/include/groonga/groonga.h b/storage/mroonga/vendor/groonga/include/groonga/groonga.h
index 6f2aae79c01..14b21bda05c 100644
--- a/storage/mroonga/vendor/groonga/include/groonga/groonga.h
+++ b/storage/mroonga/vendor/groonga/include/groonga/groonga.h
@@ -907,6 +907,8 @@ GRN_API grn_rc grn_obj_lock(grn_ctx *ctx, grn_obj *obj, grn_id id, int timeout);
GRN_API grn_rc grn_obj_unlock(grn_ctx *ctx, grn_obj *obj, grn_id id);
GRN_API grn_rc grn_obj_clear_lock(grn_ctx *ctx, grn_obj *obj);
GRN_API unsigned int grn_obj_is_locked(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_rc grn_obj_flush(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_rc grn_obj_flush_recursive(grn_ctx *ctx, grn_obj *obj);
GRN_API int grn_obj_defrag(grn_ctx *ctx, grn_obj *obj, int threshold);
GRN_API grn_obj *grn_obj_db(grn_ctx *ctx, grn_obj *obj);
diff --git a/storage/mroonga/vendor/groonga/include/groonga/plugin.h b/storage/mroonga/vendor/groonga/include/groonga/plugin.h
index bbd8923e5d6..98ca6961407 100644
--- a/storage/mroonga/vendor/groonga/include/groonga/plugin.h
+++ b/storage/mroonga/vendor/groonga/include/groonga/plugin.h
@@ -55,6 +55,11 @@ GRN_PLUGIN_EXPORT grn_rc GRN_PLUGIN_INIT(grn_ctx *ctx);
GRN_PLUGIN_EXPORT grn_rc GRN_PLUGIN_REGISTER(grn_ctx *ctx);
GRN_PLUGIN_EXPORT grn_rc GRN_PLUGIN_FIN(grn_ctx *ctx);
+#define GRN_PLUGIN_DECLARE_FUNCTIONS(tag) \
+ extern grn_rc GRN_PLUGIN_IMPL_NAME_TAGGED(init, tag)(grn_ctx *ctx); \
+ extern grn_rc GRN_PLUGIN_IMPL_NAME_TAGGED(register, tag)(grn_ctx *ctx); \
+ extern grn_rc GRN_PLUGIN_IMPL_NAME_TAGGED(fin, tag)(grn_ctx *ctx)
+
/*
Don't call these functions directly. Use GRN_PLUGIN_MALLOC(),
GRN_PLUGIN_REALLOC() and GRN_PLUGIN_FREE() instead.
diff --git a/storage/mroonga/vendor/groonga/lib/CMakeLists.txt b/storage/mroonga/vendor/groonga/lib/CMakeLists.txt
index 8959f883ca3..45b2c923635 100644
--- a/storage/mroonga/vendor/groonga/lib/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/lib/CMakeLists.txt
@@ -36,7 +36,7 @@ string(REGEX REPLACE "([^;]+)" "mrb/\\1"
set_source_files_properties(${LIBGROONGA_SOURCES} ${LIBGRNMRB_SOURCES}
PROPERTIES
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
-set_source_files_properties(dat.cpp ${LIBGRNDAT_SOURCES}
+set_source_files_properties(dat.cpp egn.cpp ${LIBGRNDAT_SOURCES}
PROPERTIES
COMPILE_FLAGS "${GRN_CXX_COMPILE_FLAGS}")
@@ -67,9 +67,14 @@ set(GRN_ALL_LIBRARIES
${MRUBY_LIBS}
${ONIGMO_LIBS})
if(GRN_EMBED)
+ set(GRN_EMBEDDED_PLUGIN_LIBRARIES "")
+ if(GRN_WITH_MECAB)
+ list(APPEND GRN_EMBEDDED_PLUGIN_LIBRARIES mecab_tokenizer)
+ endif()
target_link_libraries(libgroonga
${GRN_ALL_LIBRARIES}
- ${STDCPP_LIBS})
+ ${STDCPP_LIBS}
+ ${GRN_EMBEDDED_PLUGIN_LIBRARIES})
else()
target_link_libraries(libgroonga
${GRN_ALL_LIBRARIES})
diff --git a/storage/mroonga/vendor/groonga/lib/com.c b/storage/mroonga/vendor/groonga/lib/com.c
index eb1cacfd4c1..a7450ec31f0 100644
--- a/storage/mroonga/vendor/groonga/lib/com.c
+++ b/storage/mroonga/vendor/groonga/lib/com.c
@@ -22,20 +22,17 @@
#include "grn_ctx_impl.h"
#ifdef WIN32
-# include <ws2tcpip.h>
+# include <ws2tcpip.h>
#else
-# ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-# endif /* HAVE_SYS_SOCKET_H */
-# ifdef HAVE_NETINET_IN_H
-# include <netinet/in.h>
-# endif /* HAVE_NETINET_IN_H */
-# ifdef HAVE_NETINET_TCP_H
-# include <netinet/tcp.h>
-# endif /* HAVE_NETINET_TCP_H */
-# ifdef HAVE_SIGNAL_H
-# include <signal.h>
-# endif /* HAVE_SIGNAL_H */
+# ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+# endif /* HAVE_SYS_SOCKET_H */
+# include <netinet/in.h>
+# include <netinet/tcp.h>
+# ifdef HAVE_SIGNAL_H
+# include <signal.h>
+# endif /* HAVE_SIGNAL_H */
+# include <sys/uio.h>
#endif /* WIN32 */
#include "grn_ctx.h"
@@ -736,13 +733,11 @@ grn_com_send(grn_ctx *ctx, grn_com *cs,
#else /* WIN32 */
struct iovec msg_iov[2];
struct msghdr msg;
+ memset(&msg, 0, sizeof(struct msghdr));
msg.msg_name = NULL;
msg.msg_namelen = 0;
msg.msg_iov = msg_iov;
msg.msg_iovlen = 2;
- msg.msg_control = NULL;
- msg.msg_controllen = 0;
- msg.msg_flags = 0;
msg_iov[0].iov_base = header;
msg_iov[0].iov_len = sizeof(grn_com_header);
msg_iov[1].iov_base = (char *)body;
diff --git a/storage/mroonga/vendor/groonga/lib/command.c b/storage/mroonga/vendor/groonga/lib/command.c
index e4be0d1ff92..282d15b6a0e 100644
--- a/storage/mroonga/vendor/groonga/lib/command.c
+++ b/storage/mroonga/vendor/groonga/lib/command.c
@@ -129,6 +129,14 @@ grn_command_input_at(grn_ctx *ctx,
GRN_API_RETURN(argument);
}
+grn_obj *
+grn_command_input_get_arguments(grn_ctx *ctx,
+ grn_command_input *input)
+{
+ GRN_API_ENTER;
+ GRN_API_RETURN((grn_obj *)(input->arguments));
+}
+
grn_rc
grn_command_register(grn_ctx *ctx,
const char *command_name,
diff --git a/storage/mroonga/vendor/groonga/lib/ctx.c b/storage/mroonga/vendor/groonga/lib/ctx.c
index 85878036dc2..92caba561eb 100644
--- a/storage/mroonga/vendor/groonga/lib/ctx.c
+++ b/storage/mroonga/vendor/groonga/lib/ctx.c
@@ -21,22 +21,24 @@
#include "grn_request_canceler.h"
#include "grn_tokenizers.h"
#include "grn_ctx_impl.h"
+#include "grn_ii.h"
#include "grn_pat.h"
+#include "grn_proc.h"
#include "grn_plugin.h"
#include "grn_snip.h"
#include "grn_output.h"
#include "grn_normalizer.h"
+#include "grn_mrb.h"
#include "grn_ctx_impl_mrb.h"
#include "grn_logger.h"
#include <stdio.h>
#include <stdarg.h>
#include <time.h>
-#ifdef HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif /* HAVE_NETINET_IN_H */
#ifdef WIN32
# include <share.h>
+#else /* WIN32 */
+# include <netinet/in.h>
#endif /* WIN32 */
#if defined(HAVE__LOCALTIME64_S) && defined(__GNUC__)
@@ -74,6 +76,30 @@ int grn_lock_timeout = GRN_LOCK_TIMEOUT;
int grn_uyield_count = 0;
#endif
+static grn_bool grn_ctx_per_db = GRN_FALSE;
+
+static void
+grn_init_from_env(void)
+{
+ {
+ char grn_ctx_per_db_env[GRN_ENV_BUFFER_SIZE];
+ grn_getenv("GRN_CTX_PER_DB",
+ grn_ctx_per_db_env,
+ GRN_ENV_BUFFER_SIZE);
+ if (grn_ctx_per_db_env[0] && strcmp(grn_ctx_per_db_env, "yes") == 0) {
+ grn_ctx_per_db = GRN_TRUE;
+ }
+ }
+
+ grn_mrb_init_from_env();
+ grn_ctx_impl_mrb_init_from_env();
+ grn_io_init_from_env();
+ grn_ii_init_from_env();
+ grn_db_init_from_env();
+ grn_proc_init_from_env();
+ grn_plugin_init_from_env();
+}
+
void
grn_sleep(uint32_t seconds)
{
@@ -621,14 +647,8 @@ grn_ctx_init_internal(grn_ctx *ctx, int flags)
// if (ctx->stat != GRN_CTX_FIN) { return GRN_INVALID_ARGUMENT; }
ERRCLR(ctx);
ctx->flags = flags;
- {
- char grn_ctx_per_db_env[GRN_ENV_BUFFER_SIZE];
- grn_getenv("GRN_CTX_PER_DB",
- grn_ctx_per_db_env,
- GRN_ENV_BUFFER_SIZE);
- if (grn_ctx_per_db_env[0] && strcmp(grn_ctx_per_db_env, "yes") == 0) {
- ctx->flags |= GRN_CTX_PER_DB;
- }
+ if (grn_ctx_per_db) {
+ ctx->flags |= GRN_CTX_PER_DB;
}
if (ERRP(ctx, GRN_ERROR)) { return ctx->rc; }
ctx->stat = GRN_CTX_INITED;
@@ -821,6 +841,7 @@ grn_init(void)
{
grn_rc rc;
grn_ctx *ctx = &grn_gctx;
+ grn_init_from_env();
grn_logger_init();
grn_query_logger_init();
CRITICAL_SECTION_INIT(grn_glock);
@@ -898,12 +919,8 @@ grn_init(void)
return rc;
}
grn_ctx_impl_init(ctx);
- if ((rc = grn_io_init())) {
- GRN_LOG(ctx, GRN_LOG_ALERT, "io initialize failed (%d)", rc);
- return rc;
- }
if ((rc = grn_plugins_init())) {
- GRN_LOG(ctx, GRN_LOG_ALERT, "plugins initialize failed (%d)", rc);
+ GRN_LOG(ctx, GRN_LOG_ALERT, "grn_plugins_init failed (%d)", rc);
return rc;
}
if ((rc = grn_normalizer_init())) {
@@ -1018,7 +1035,6 @@ grn_fin(void)
grn_tokenizers_fin();
grn_normalizer_fin();
grn_plugins_fin();
- grn_io_fin();
grn_ctx_fin(ctx);
grn_com_fin();
GRN_LOG(ctx, GRN_LOG_NOTICE, "grn_fin (%d)", alloc_count);
@@ -1535,7 +1551,6 @@ grn_ctx_send(grn_ctx *ctx, const char *str, unsigned int str_len, int flags)
goto exit;
} else {
grn_obj *expr = NULL;
- if (comment_command_p(str, str_len)) { goto output; };
if (ctx->impl->qe_next) {
grn_obj *val;
expr = ctx->impl->qe_next;
@@ -1546,6 +1561,7 @@ grn_ctx_send(grn_ctx *ctx, const char *str, unsigned int str_len, int flags)
}
grn_expr_exec(ctx, expr, 0);
} else {
+ if (comment_command_p(str, str_len)) { goto output; };
ctx->impl->mime_type = "application/json";
ctx->impl->output_type = GRN_CONTENT_JSON;
grn_timeval_now(ctx, &ctx->impl->tv);
@@ -2382,9 +2398,8 @@ grn_calloc_default(grn_ctx *ctx, size_t size, const char* file, int line, const
grn_alloc_info_add(res, file, line, func);
} else {
if (!(res = calloc(size, 1))) {
- MERR("calloc fail (%" GRN_FMT_LLU ")=%p (%s:%d) <%" GRN_FMT_LLU ">",
- (unsigned long long int)size, res, file, line,
- (unsigned long long int)alloc_count);
+ MERR("calloc fail (%" GRN_FMT_SIZE ")=%p (%s:%d) <%d>",
+ size, res, file, line, alloc_count);
} else {
GRN_ADD_ALLOC_COUNT(1);
grn_alloc_info_add(res, file, line, func);
diff --git a/storage/mroonga/vendor/groonga/lib/ctx_impl_mrb.c b/storage/mroonga/vendor/groonga/lib/ctx_impl_mrb.c
index 4c1a2a3b4f9..39a1aa17b86 100644
--- a/storage/mroonga/vendor/groonga/lib/ctx_impl_mrb.c
+++ b/storage/mroonga/vendor/groonga/lib/ctx_impl_mrb.c
@@ -18,9 +18,9 @@
#include "grn_ctx_impl.h"
-#ifdef GRN_WITH_MRUBY
-# include <string.h>
+#include <string.h>
+#ifdef GRN_WITH_MRUBY
# include "grn_ctx_impl_mrb.h"
# include "grn_mrb.h"
@@ -40,6 +40,10 @@
# include "mrb/mrb_hash_table.h"
# include "mrb/mrb_patricia_trie.h"
# include "mrb/mrb_double_array_trie.h"
+# include "mrb/mrb_table_group_flags.h"
+# include "mrb/mrb_table_group_result.h"
+# include "mrb/mrb_table_sort_flags.h"
+# include "mrb/mrb_table_sort_key.h"
# include "mrb/mrb_column.h"
# include "mrb/mrb_fixed_size_column.h"
# include "mrb/mrb_variable_size_column.h"
@@ -60,6 +64,23 @@
# include <mruby/variable.h>
#endif /* GRN_WITH_MRUBY */
+static grn_bool grn_ctx_impl_mrb_mruby_enabled = GRN_TRUE;
+
+void
+grn_ctx_impl_mrb_init_from_env(void)
+{
+ {
+ char grn_mruby_enabled_env[GRN_ENV_BUFFER_SIZE];
+ grn_getenv("GRN_MRUBY_ENABLED",
+ grn_mruby_enabled_env,
+ GRN_ENV_BUFFER_SIZE);
+ if (grn_mruby_enabled_env[0] &&
+ strcmp(grn_mruby_enabled_env, "no") == 0) {
+ grn_ctx_impl_mrb_mruby_enabled = GRN_FALSE;
+ }
+ }
+}
+
#ifdef GRN_WITH_MRUBY
static mrb_value
mrb_kernel_load(mrb_state *mrb, mrb_value self)
@@ -125,6 +146,10 @@ grn_ctx_impl_mrb_init_bindings(grn_ctx *ctx)
grn_mrb_hash_table_init(ctx);
grn_mrb_patricia_trie_init(ctx);
grn_mrb_double_array_trie_init(ctx);
+ grn_mrb_table_group_flags_init(ctx);
+ grn_mrb_table_group_result_init(ctx);
+ grn_mrb_table_sort_flags_init(ctx);
+ grn_mrb_table_sort_key_init(ctx);
grn_mrb_column_init(ctx);
grn_mrb_fixed_size_column_init(ctx);
grn_mrb_variable_size_column_init(ctx);
@@ -147,11 +172,7 @@ grn_ctx_impl_mrb_init_bindings(grn_ctx *ctx)
void
grn_ctx_impl_mrb_init(grn_ctx *ctx)
{
- char grn_mruby_enabled[GRN_ENV_BUFFER_SIZE];
- grn_getenv("GRN_MRUBY_ENABLED",
- grn_mruby_enabled,
- GRN_ENV_BUFFER_SIZE);
- if (grn_mruby_enabled[0] && strcmp(grn_mruby_enabled, "no") == 0) {
+ if (!grn_ctx_impl_mrb_mruby_enabled) {
ctx->impl->mrb.state = NULL;
ctx->impl->mrb.base_directory[0] = '\0';
ctx->impl->mrb.module = NULL;
@@ -162,7 +183,6 @@ grn_ctx_impl_mrb_init(grn_ctx *ctx)
ctx->impl->mrb.groonga.operator_class = NULL;
} else {
mrb_state *mrb;
-
mrb = mrb_open();
ctx->impl->mrb.state = mrb;
ctx->impl->mrb.base_directory[0] = '\0';
diff --git a/storage/mroonga/vendor/groonga/lib/dat.cpp b/storage/mroonga/vendor/groonga/lib/dat.cpp
index 60588d55710..51a84da2af9 100644
--- a/storage/mroonga/vendor/groonga/lib/dat.cpp
+++ b/storage/mroonga/vendor/groonga/lib/dat.cpp
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2011-2014 Brazil
+/* Copyright(C) 2011-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -1112,4 +1112,34 @@ grn_dat_repair(grn_ctx *ctx, grn_dat *dat)
return GRN_SUCCESS;
}
+grn_rc
+grn_dat_flush(grn_ctx *ctx, grn_dat *dat)
+{
+ if (!dat->io) {
+ return GRN_SUCCESS;
+ }
+
+ grn_rc rc = grn_io_flush(ctx, dat->io);
+ if (rc != GRN_SUCCESS) {
+ return rc;
+ }
+
+ if (dat->trie) {
+ grn::dat::Trie * const trie = static_cast<grn::dat::Trie *>(dat->trie);
+ try {
+ trie->flush();
+ } catch (const grn::dat::Exception &ex) {
+ const grn_rc error_code = grn_dat_translate_error_code(ex.code());
+ if (error_code == GRN_INPUT_OUTPUT_ERROR) {
+ SERR("grn::dat::Trie::flush failed");
+ } else {
+ ERR(error_code, "grn::dat::Trie::flush failed");
+ }
+ return error_code;
+ }
+ }
+
+ return GRN_SUCCESS;
+}
+
} // extern "C"
diff --git a/storage/mroonga/vendor/groonga/lib/dat/file-impl.cpp b/storage/mroonga/vendor/groonga/lib/dat/file-impl.cpp
index 3643a806292..7a9879aa369 100644
--- a/storage/mroonga/vendor/groonga/lib/dat/file-impl.cpp
+++ b/storage/mroonga/vendor/groonga/lib/dat/file-impl.cpp
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2011 Brazil
+/* Copyright(C) 2011-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -123,6 +123,15 @@ void FileImpl::swap(FileImpl *rhs) {
std::swap(addr_, rhs->addr_);
}
+void FileImpl::flush() {
+ if (!addr_) {
+ return;
+ }
+
+ BOOL succeeded = ::FlushViewOfFile(addr_, size_);
+ GRN_DAT_THROW_IF(IO_ERROR, !succeeded);
+}
+
void FileImpl::create_(const char *path, UInt64 size) {
if ((path != NULL) && (path[0] != '\0')) {
file_ = ::CreateFileA(path, GRN_IO_FILE_CREATE_MODE,
@@ -193,6 +202,15 @@ void FileImpl::swap(FileImpl *rhs) {
std::swap(length_, rhs->length_);
}
+void FileImpl::flush() {
+ if (!addr_) {
+ return;
+ }
+
+ int result = ::msync(addr_, length_, MS_SYNC);
+ GRN_DAT_THROW_IF(IO_ERROR, result != 0);
+}
+
void FileImpl::create_(const char *path, UInt64 size) {
GRN_DAT_THROW_IF(PARAM_ERROR,
size > static_cast<UInt64>(std::numeric_limits< ::off_t>::max()));
diff --git a/storage/mroonga/vendor/groonga/lib/dat/file-impl.hpp b/storage/mroonga/vendor/groonga/lib/dat/file-impl.hpp
index f4e0543635a..245dbfc2ae7 100644
--- a/storage/mroonga/vendor/groonga/lib/dat/file-impl.hpp
+++ b/storage/mroonga/vendor/groonga/lib/dat/file-impl.hpp
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2011-2012 Brazil
+/* Copyright(C) 2011-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -45,6 +45,8 @@ class FileImpl {
void swap(FileImpl *rhs);
+ void flush();
+
private:
void *ptr_;
UInt64 size_;
diff --git a/storage/mroonga/vendor/groonga/lib/dat/file.cpp b/storage/mroonga/vendor/groonga/lib/dat/file.cpp
index 57bfcb9ece6..82d6159ed09 100644
--- a/storage/mroonga/vendor/groonga/lib/dat/file.cpp
+++ b/storage/mroonga/vendor/groonga/lib/dat/file.cpp
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2011 Brazil
+/* Copyright(C) 2011-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -63,5 +63,11 @@ void File::swap(File *rhs) {
rhs->impl_ = temp;
}
+void File::flush() {
+ if (impl_) {
+ impl_->flush();
+ }
+}
+
} // namespace dat
} // namespace grn
diff --git a/storage/mroonga/vendor/groonga/lib/dat/file.hpp b/storage/mroonga/vendor/groonga/lib/dat/file.hpp
index c2be8d86da3..e7dda0e025e 100644
--- a/storage/mroonga/vendor/groonga/lib/dat/file.hpp
+++ b/storage/mroonga/vendor/groonga/lib/dat/file.hpp
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2011 Brazil
+/* Copyright(C) 2011-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -46,6 +46,8 @@ class GRN_DAT_API File {
void swap(File *rhs);
+ void flush();
+
private:
FileImpl *impl_;
diff --git a/storage/mroonga/vendor/groonga/lib/dat/trie.cpp b/storage/mroonga/vendor/groonga/lib/dat/trie.cpp
index 82c8c273286..2f9e79bac56 100644
--- a/storage/mroonga/vendor/groonga/lib/dat/trie.cpp
+++ b/storage/mroonga/vendor/groonga/lib/dat/trie.cpp
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2011 Brazil
+/* Copyright(C) 2011-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -168,6 +168,10 @@ void Trie::swap(Trie *trie) {
key_buf_.swap(&trie->key_buf_);
}
+void Trie::flush() {
+ file_.flush();
+}
+
void Trie::create_file(const char *file_name,
UInt64 file_size,
UInt32 max_num_keys,
diff --git a/storage/mroonga/vendor/groonga/lib/dat/trie.hpp b/storage/mroonga/vendor/groonga/lib/dat/trie.hpp
index 6bd307bb70e..8a272bb7940 100644
--- a/storage/mroonga/vendor/groonga/lib/dat/trie.hpp
+++ b/storage/mroonga/vendor/groonga/lib/dat/trie.hpp
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2011 Brazil
+/* Copyright(C) 2011-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -189,6 +189,8 @@ class GRN_DAT_API Trie {
header_->set_status_flags(status_flags() & ~CHANGING_MASK);
}
+ void flush();
+
private:
File file_;
Header *header_;
diff --git a/storage/mroonga/vendor/groonga/lib/db.c b/storage/mroonga/vendor/groonga/lib/db.c
index 357df82e314..e213812d926 100644
--- a/storage/mroonga/vendor/groonga/lib/db.c
+++ b/storage/mroonga/vendor/groonga/lib/db.c
@@ -85,6 +85,33 @@ inline static void
grn_obj_get_range_info(grn_ctx *ctx, grn_obj *obj,
grn_id *range_id, grn_obj_flags *range_flags);
+
+static char grn_db_key[GRN_ENV_BUFFER_SIZE];
+static uint64_t grn_index_sparsity = 10;
+
+void
+grn_db_init_from_env(void)
+{
+ grn_getenv("GRN_DB_KEY",
+ grn_db_key,
+ GRN_ENV_BUFFER_SIZE);
+
+ {
+ char grn_index_sparsity_env[GRN_ENV_BUFFER_SIZE];
+ grn_getenv("GRN_INDEX_SPARSITY",
+ grn_index_sparsity_env,
+ GRN_ENV_BUFFER_SIZE);
+ if (grn_index_sparsity_env[0]) {
+ uint64_t sparsity;
+ errno = 0;
+ sparsity = strtoull(grn_index_sparsity_env, NULL, 0);
+ if (errno == 0) {
+ grn_index_sparsity = sparsity;
+ }
+ }
+ }
+}
+
inline static void
gen_pathname(const char *path, char *buffer, int fno)
{
@@ -155,15 +182,11 @@ grn_db_create(grn_ctx *ctx, const char *path, grn_db_create_optarg *optarg)
if ((s = GRN_MALLOC(sizeof(grn_db)))) {
grn_bool use_default_db_key = GRN_TRUE;
grn_bool use_pat_as_db_keys = GRN_FALSE;
- char grn_db_key_env[GRN_ENV_BUFFER_SIZE];
- grn_getenv("GRN_DB_KEY",
- grn_db_key_env,
- GRN_ENV_BUFFER_SIZE);
- if (grn_db_key_env[0]) {
- if (!strcmp(grn_db_key_env, "pat")) {
+ if (grn_db_key[0]) {
+ if (!strcmp(grn_db_key, "pat")) {
use_default_db_key = GRN_FALSE;
use_pat_as_db_keys = GRN_TRUE;
- } else if (!strcmp(grn_db_key_env, "dat")) {
+ } else if (!strcmp(grn_db_key, "dat")) {
use_default_db_key = GRN_FALSE;
}
}
@@ -245,6 +268,10 @@ grn_db_open(grn_ctx *ctx, const char *path)
break;
default :
s->keys = NULL;
+ if (ctx->rc == GRN_SUCCESS) {
+ ERR(GRN_INVALID_ARGUMENT,
+ "[db][open] invalid keys table's type: %#x", type);
+ }
break;
}
if (s->keys) {
@@ -870,6 +897,7 @@ grn_table_create_with_max_n_subrecs(grn_ctx *ctx, const char *name,
path = buffer;
} else {
ERR(GRN_INVALID_ARGUMENT, "path not assigned for persistent table");
+ grn_obj_delete_by_id(ctx, db, id, GRN_TRUE);
return NULL;
}
} else {
@@ -878,10 +906,12 @@ grn_table_create_with_max_n_subrecs(grn_ctx *ctx, const char *name,
} else {
if (path) {
ERR(GRN_INVALID_ARGUMENT, "path assigned for temporary table");
+ grn_obj_delete_by_id(ctx, db, id, GRN_TRUE);
return NULL;
}
if (GRN_DB_PERSISTENT_P(db) && name && name_size) {
ERR(GRN_INVALID_ARGUMENT, "name assigned for temporary table");
+ grn_obj_delete_by_id(ctx, db, id, GRN_TRUE);
return NULL;
}
}
@@ -2758,6 +2788,181 @@ grn_table_next(grn_ctx *ctx, grn_obj *table, grn_id id)
GRN_API_RETURN(r);
}
+static grn_rc
+grn_accessor_resolve_one_index_column(grn_ctx *ctx, grn_accessor *accessor,
+ grn_obj *current_res, grn_obj **next_res,
+ grn_search_optarg *optarg)
+{
+ grn_rc rc = GRN_SUCCESS;
+ grn_obj *column = NULL;
+ grn_id next_res_domain_id = GRN_ID_NIL;
+
+ {
+ grn_obj *index;
+ grn_obj source_ids;
+ unsigned int i, n_ids;
+
+ index = accessor->obj;
+ next_res_domain_id = index->header.domain;
+
+ GRN_UINT32_INIT(&source_ids, GRN_OBJ_VECTOR);
+ grn_obj_get_info(ctx, index, GRN_INFO_SOURCE, &source_ids);
+ n_ids = GRN_BULK_VSIZE(&source_ids) / sizeof(grn_id);
+ for (i = 0; i < n_ids; i++) {
+ grn_id source_id;
+ grn_obj *source;
+
+ source_id = GRN_UINT32_VALUE_AT(&source_ids, i);
+ source = grn_ctx_at(ctx, source_id);
+ if (DB_OBJ(source)->range == next_res_domain_id) {
+ column = source;
+ break;
+ }
+ grn_obj_unlink(ctx, source);
+ }
+
+ if (!column) {
+ return GRN_INVALID_ARGUMENT;
+ }
+ }
+
+ {
+ grn_rc rc;
+ grn_obj *next_res_domain = grn_ctx_at(ctx, next_res_domain_id);
+ *next_res = grn_table_create(ctx, NULL, 0, NULL,
+ GRN_TABLE_HASH_KEY|GRN_OBJ_WITH_SUBREC,
+ next_res_domain, NULL);
+ rc = ctx->rc;
+ grn_obj_unlink(ctx, next_res_domain);
+ if (!*next_res) {
+ return rc;
+ }
+ }
+
+ {
+ grn_obj_flags column_value_flags = 0;
+ grn_obj column_value;
+ grn_ii_posting add_posting;
+ grn_id *tid;
+ grn_rset_recinfo *recinfo;
+
+ if (column->header.type == GRN_COLUMN_VAR_SIZE) {
+ column_value_flags |= GRN_OBJ_VECTOR;
+ }
+ GRN_VALUE_FIX_SIZE_INIT(&column_value,
+ column_value_flags,
+ next_res_domain_id);
+
+ add_posting.sid = 0;
+ add_posting.pos = 0;
+ add_posting.weight = 0;
+
+ GRN_HASH_EACH(ctx, (grn_hash *)current_res, id, &tid, NULL, &recinfo, {
+ int i;
+ int n_elements;
+
+ add_posting.weight = recinfo->score - 1;
+
+ GRN_BULK_REWIND(&column_value);
+ grn_obj_get_value(ctx, column, *tid, &column_value);
+
+ n_elements = GRN_BULK_VSIZE(&column_value) / sizeof(grn_id);
+ for (i = 0; i < n_elements; i++) {
+ add_posting.rid = GRN_RECORD_VALUE_AT(&column_value, i);
+ rc = grn_ii_posting_add(ctx,
+ &add_posting,
+ (grn_hash *)*next_res,
+ GRN_OP_OR);
+ if (rc != GRN_SUCCESS) {
+ break;
+ }
+ }
+ if (rc != GRN_SUCCESS) {
+ break;
+ }
+ });
+
+ GRN_OBJ_FIN(ctx, &column_value);
+ }
+
+ if (rc != GRN_SUCCESS) {
+ grn_obj_unlink(ctx, *next_res);
+ }
+
+ return rc;
+}
+
+static grn_rc
+grn_accessor_resolve_one_data_column(grn_ctx *ctx, grn_accessor *accessor,
+ grn_obj *current_res, grn_obj **next_res,
+ grn_search_optarg *optarg)
+{
+ grn_rc rc = GRN_SUCCESS;
+ grn_obj *index = NULL;
+ grn_operator index_op = GRN_OP_MATCH;
+ grn_id next_res_domain_id = GRN_ID_NIL;
+
+ if (grn_column_index(ctx, accessor->obj, index_op, &index, 1, NULL) == 0) {
+ return GRN_INVALID_ARGUMENT;
+ }
+ next_res_domain_id = DB_OBJ(index)->range;
+
+ {
+ grn_rc rc;
+ grn_obj *next_res_domain = grn_ctx_at(ctx, next_res_domain_id);
+ *next_res = grn_table_create(ctx, NULL, 0, NULL,
+ GRN_TABLE_HASH_KEY|GRN_OBJ_WITH_SUBREC,
+ next_res_domain, NULL);
+ rc = ctx->rc;
+ grn_obj_unlink(ctx, next_res_domain);
+ if (!*next_res) {
+ return rc;
+ }
+ }
+
+ {
+ grn_id *tid;
+ grn_rset_recinfo *recinfo;
+
+ GRN_HASH_EACH(ctx, (grn_hash *)current_res, id, &tid, NULL, &recinfo, {
+ grn_ii *ii = (grn_ii *)index;
+ grn_ii_cursor *ii_cursor;
+ grn_ii_posting *posting;
+
+ ii_cursor = grn_ii_cursor_open(ctx, ii, *tid,
+ GRN_ID_NIL, GRN_ID_MAX,
+ ii->n_elements,
+ 0);
+ if (!ii_cursor) {
+ continue;
+ }
+
+ while ((posting = grn_ii_cursor_next(ctx, ii_cursor))) {
+ grn_ii_posting add_posting = *posting;
+ add_posting.weight += recinfo->score - 1;
+ rc = grn_ii_posting_add(ctx,
+ &add_posting,
+ (grn_hash *)*next_res,
+ GRN_OP_OR);
+ if (rc != GRN_SUCCESS) {
+ break;
+ }
+ }
+ grn_ii_cursor_close(ctx, ii_cursor);
+
+ if (rc != GRN_SUCCESS) {
+ break;
+ }
+ });
+ }
+
+ if (rc != GRN_SUCCESS) {
+ grn_obj_unlink(ctx, *next_res);
+ }
+
+ return rc;
+}
+
grn_rc
grn_accessor_resolve(grn_ctx *ctx, grn_obj *accessor, int deep,
grn_obj *base_res, grn_obj **res,
@@ -2780,69 +2985,28 @@ grn_accessor_resolve(grn_ctx *ctx, grn_obj *accessor, int deep,
}
for (i = n_accessors; i > 0; i--) {
- grn_obj *index;
- grn_operator index_op = GRN_OP_MATCH;
+ grn_obj *next_res = NULL;
a = (grn_accessor *)GRN_PTR_VALUE_AT(&accessor_stack, i - 1);
- if (grn_column_index(ctx, a->obj, index_op, &index, 1, NULL) == 0) {
- rc = GRN_INVALID_ARGUMENT;
- break;
+ if (a->obj->header.type == GRN_COLUMN_INDEX) {
+ rc = grn_accessor_resolve_one_index_column(ctx, a,
+ current_res, &next_res,
+ optarg);
+ } else {
+ rc = grn_accessor_resolve_one_data_column(ctx, a,
+ current_res, &next_res,
+ optarg);
}
- {
- grn_id *tid;
- grn_obj *next_res;
- grn_rset_recinfo *recinfo;
- {
- grn_obj *range = grn_ctx_at(ctx, DB_OBJ(index)->range);
- next_res = grn_table_create(ctx, NULL, 0, NULL,
- GRN_TABLE_HASH_KEY|GRN_OBJ_WITH_SUBREC,
- range, NULL);
- rc = ctx->rc;
- grn_obj_unlink(ctx, range);
- if (!next_res) {
- if (current_res != base_res) {
- grn_obj_unlink(ctx, current_res);
- }
- break;
- }
- }
- GRN_HASH_EACH(ctx, (grn_hash *)current_res, id, &tid, NULL, &recinfo, {
- grn_ii *ii = (grn_ii *)index;
- grn_ii_cursor *ii_cursor;
- grn_ii_posting *posting;
-
- ii_cursor = grn_ii_cursor_open(ctx, ii, *tid,
- GRN_ID_NIL, GRN_ID_MAX,
- ii->n_elements,
- 0);
- if (!ii_cursor) {
- continue;
- }
-
- while ((posting = grn_ii_cursor_next(ctx, ii_cursor))) {
- grn_ii_posting add_posting = *posting;
- add_posting.weight += recinfo->score - 1;
- grn_ii_posting_add(ctx,
- &add_posting,
- (grn_hash *)next_res,
- GRN_OP_OR);
- }
- grn_ii_cursor_close(ctx, ii_cursor);
+ if (current_res != base_res) {
+ grn_obj_unlink(ctx, current_res);
+ }
- if (rc != GRN_SUCCESS) {
- break;
- }
- });
- if (current_res != base_res) {
- grn_obj_unlink(ctx, current_res);
- }
- if (rc != GRN_SUCCESS) {
- grn_obj_unlink(ctx, next_res);
- break;
- }
- current_res = next_res;
+ if (rc != GRN_SUCCESS) {
+ break;
}
+
+ current_res = next_res;
}
if (rc == GRN_SUCCESS && current_res != base_res) {
@@ -6846,7 +7010,7 @@ grn_obj_get_value(grn_ctx *ctx, grn_obj *obj, grn_id id, grn_obj *value)
}
switch (value->header.type) {
case GRN_VOID :
- GRN_TEXT_INIT(value, 0);
+ grn_obj_reinit(ctx, value, GRN_DB_TEXT, 0);
break;
case GRN_BULK :
case GRN_VECTOR :
@@ -7225,18 +7389,7 @@ build_index(grn_ctx *ctx, grn_obj *obj)
}
}
if (use_grn_ii_build) {
- uint64_t sparsity = 10;
- char grn_index_sparsity_env[GRN_ENV_BUFFER_SIZE];
- grn_getenv("GRN_INDEX_SPARSITY",
- grn_index_sparsity_env,
- GRN_ENV_BUFFER_SIZE);
- if (grn_index_sparsity_env[0]) {
- uint64_t v;
- errno = 0;
- v = strtoull(grn_index_sparsity_env, NULL, 0);
- if (!errno) { sparsity = v; }
- }
- grn_ii_build(ctx, ii, sparsity);
+ grn_ii_build(ctx, ii, grn_index_sparsity);
} else {
grn_table_cursor *tc;
if ((tc = grn_table_cursor_open(ctx, target, NULL, 0, NULL, 0,
@@ -9528,6 +9681,7 @@ grn_obj_clear_lock(grn_ctx *ctx, grn_obj *obj)
case GRN_TABLE_DAT_KEY:
case GRN_TABLE_NO_KEY:
grn_obj_clear_lock(ctx, tbl);
+ break;
}
} else {
if (ctx->rc != GRN_SUCCESS) {
@@ -9580,6 +9734,132 @@ grn_obj_is_locked(grn_ctx *ctx, grn_obj *obj)
GRN_API_RETURN(res);
}
+grn_rc
+grn_obj_flush(grn_ctx *ctx, grn_obj *obj)
+{
+ grn_rc rc = GRN_SUCCESS;
+ GRN_API_ENTER;
+ switch (obj->header.type) {
+ case GRN_DB :
+ {
+ grn_db *db = (grn_db *)obj;
+ rc = grn_obj_flush(ctx, db->keys);
+ if (rc == GRN_SUCCESS) {
+ rc = grn_obj_flush(ctx, (grn_obj *)(db->specs));
+ }
+ }
+ break;
+ case GRN_TABLE_DAT_KEY :
+ rc = grn_dat_flush(ctx, (grn_dat *)obj);
+ break;
+ case GRN_COLUMN_INDEX :
+ rc = grn_ii_flush(ctx, (grn_ii *)obj);
+ break;
+ default :
+ rc = grn_io_flush(ctx, grn_obj_io(obj));
+ break;
+ }
+ GRN_API_RETURN(rc);
+}
+
+grn_rc
+grn_obj_flush_recursive(grn_ctx *ctx, grn_obj *obj)
+{
+ grn_rc rc = GRN_SUCCESS;
+
+ GRN_API_ENTER;
+ switch (obj->header.type) {
+ case GRN_DB :
+ {
+ grn_table_cursor *cursor;
+ grn_id id;
+
+ cursor = grn_table_cursor_open(ctx, obj, NULL, 0, NULL, 0, 0, -1, 0);
+ if (!cursor) {
+ GRN_API_RETURN(ctx->rc);
+ }
+
+ while ((id = grn_table_cursor_next_inline(ctx, cursor)) != GRN_ID_NIL) {
+ grn_obj *table = grn_ctx_at(ctx, id);
+ rc = GRN_SUCCESS;
+ if (table) {
+ switch (table->header.type) {
+ case GRN_TABLE_HASH_KEY :
+ case GRN_TABLE_PAT_KEY:
+ case GRN_TABLE_DAT_KEY:
+ case GRN_TABLE_NO_KEY:
+ rc = grn_obj_flush_recursive(ctx, table);
+ break;
+ }
+ } else {
+ if (ctx->rc != GRN_SUCCESS) {
+ ERRCLR(ctx);
+ }
+ }
+ if (rc != GRN_SUCCESS) {
+ break;
+ }
+ }
+ grn_table_cursor_close(ctx, cursor);
+ }
+ if (rc == GRN_SUCCESS) {
+ rc = grn_obj_flush(ctx, obj);
+ }
+ break;
+ case GRN_TABLE_NO_KEY :
+ case GRN_TABLE_HASH_KEY :
+ case GRN_TABLE_PAT_KEY :
+ case GRN_TABLE_DAT_KEY :
+ {
+ grn_hash *columns;
+ columns = grn_hash_create(ctx, NULL, sizeof(grn_id), 0,
+ GRN_OBJ_TABLE_HASH_KEY|GRN_HASH_TINY);
+ if (!columns) {
+ GRN_API_RETURN(ctx->rc);
+ }
+
+ if (grn_table_columns(ctx, obj, "", 0, (grn_obj *)columns) > 0) {
+ grn_id *key;
+ GRN_HASH_EACH(ctx, columns, id, &key, NULL, NULL, {
+ grn_obj *column = grn_ctx_at(ctx, *key);
+ if (column) {
+ rc = grn_obj_flush(ctx, column);
+ if (rc != GRN_SUCCESS) {
+ break;
+ }
+ }
+ });
+ }
+ grn_hash_close(ctx, columns);
+ }
+
+ if (rc == GRN_SUCCESS) {
+ rc = grn_obj_flush(ctx, obj);
+ }
+ break;
+ case GRN_COLUMN_FIX_SIZE :
+ case GRN_COLUMN_VAR_SIZE :
+ case GRN_COLUMN_INDEX :
+ rc = grn_obj_flush(ctx, obj);
+ break;
+ default :
+ {
+ grn_obj inspected;
+ GRN_TEXT_INIT(&inspected, 0);
+ grn_inspect(ctx, &inspected, obj);
+ ERR(GRN_INVALID_ARGUMENT,
+ "[flush] object must be DB, table or column: <%.*s>",
+ (int)GRN_TEXT_LEN(&inspected),
+ GRN_TEXT_VALUE(&inspected));
+ rc = ctx->rc;
+ GRN_OBJ_FIN(ctx, &inspected);
+ }
+ break;
+ }
+
+ GRN_API_RETURN(rc);
+}
+
grn_obj *
grn_obj_db(grn_ctx *ctx, grn_obj *obj)
{
@@ -11181,6 +11461,11 @@ grn_table_sort_key_from_str(grn_ctx *ctx, const char *str, unsigned int str_size
const char *p = str;
const char **tokbuf;
grn_table_sort_key *keys = NULL, *k = NULL;
+
+ if (str_size == 0) {
+ return NULL;
+ }
+
if ((keys = grn_table_sort_key_from_str_geo(ctx, str, str_size, table, nkeys))) {
return keys;
}
diff --git a/storage/mroonga/vendor/groonga/lib/egn.cpp b/storage/mroonga/vendor/groonga/lib/egn.cpp
new file mode 100644
index 00000000000..c7e7357fffb
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/egn.cpp
@@ -0,0 +1,3245 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 Brazil
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License version 2.1 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifdef GRN_WITH_EGN
+
+#include "grn_egn.hpp"
+
+#include <cctype>
+#include <cstdio>
+#include <limits>
+#include <memory>
+#include <string>
+
+#include <iostream> // for debug!
+
+#include "grn_ctx_impl.h"
+#include "grn_db.h"
+#include "grn_output.h"
+#include "grn_str.h"
+
+// TODO: Error handling.
+
+namespace {
+
+enum { GRN_EGN_MAX_BATCH_SIZE = 1024 };
+
+bool grn_egn_is_table_cursor(grn_obj *obj) {
+ if (!obj) {
+ return false;
+ }
+ switch (obj->header.type) {
+ case GRN_CURSOR_TABLE_PAT_KEY:
+ case GRN_CURSOR_TABLE_DAT_KEY:
+ case GRN_CURSOR_TABLE_HASH_KEY:
+ case GRN_CURSOR_TABLE_NO_KEY: {
+ return true;
+ }
+ default: {
+ return false;
+ }
+ }
+}
+
+bool grn_egn_is_table(grn_obj *obj) {
+ if (!obj) {
+ return false;
+ }
+ switch (obj->header.type) {
+ case GRN_TABLE_HASH_KEY:
+ case GRN_TABLE_PAT_KEY:
+ case GRN_TABLE_DAT_KEY:
+ case GRN_TABLE_NO_KEY: {
+ return true;
+ }
+ default: {
+ return false;
+ }
+ }
+}
+
+} // namespace
+
+namespace grn {
+namespace egn {
+
+// -- TableCursor --
+
+// TableCursor is a wrapper for grn_table_cursor:
+// - GRN_CURSOR_PAT_KEY
+// - GRN_CURSOR_DAT_KEY
+// - GRN_CURSOR_HASH_KEY
+// - GRN_CURSOR_NO_KEY
+class TableCursor : public Cursor {
+ public:
+ ~TableCursor() {
+ grn_table_cursor_close(ctx_, cursor_);
+ }
+
+ static grn_rc open(grn_ctx *ctx, grn_obj *cursor, Score default_score,
+ Cursor **wrapper) {
+ if (!ctx || !grn_egn_is_table_cursor(cursor) || !wrapper) {
+ return GRN_INVALID_ARGUMENT;
+ }
+ TableCursor *new_wrapper =
+ new (std::nothrow) TableCursor(ctx, cursor, default_score);
+ if (!new_wrapper) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ *wrapper = new_wrapper;
+ return GRN_SUCCESS;
+ }
+
+ grn_rc read(Record *records, size_t size, size_t *count);
+
+ private:
+ grn_ctx *ctx_;
+ grn_obj *cursor_;
+ Score default_score_;
+
+ TableCursor(grn_ctx *ctx, grn_obj *cursor, Score default_score)
+ : Cursor(), ctx_(ctx), cursor_(cursor), default_score_(default_score) {}
+};
+
+grn_rc TableCursor::read(Record *records, size_t size, size_t *count) {
+ if ((!records && (size != 0)) || !count) {
+ return GRN_INVALID_ARGUMENT;
+ }
+ switch (cursor_->header.type) {
+ case GRN_CURSOR_TABLE_PAT_KEY: {
+ for (size_t i = 0; i < size; ++i) {
+ grn_id id = grn_pat_cursor_next(
+ ctx_, reinterpret_cast<grn_pat_cursor *>(cursor_));
+ if (id == GRN_ID_NIL) {
+ *count = i;
+ return GRN_SUCCESS;
+ }
+ records[i].id = id;
+ records[i].score = default_score_;
+ }
+ break;
+ }
+ case GRN_CURSOR_TABLE_DAT_KEY: {
+ for (size_t i = 0; i < size; ++i) {
+ grn_id id = grn_dat_cursor_next(
+ ctx_, reinterpret_cast<grn_dat_cursor *>(cursor_));
+ if (id == GRN_ID_NIL) {
+ *count = i;
+ return GRN_SUCCESS;
+ }
+ records[i].id = id;
+ records[i].score = default_score_;
+ }
+ break;
+ }
+ case GRN_CURSOR_TABLE_HASH_KEY: {
+ for (size_t i = 0; i < size; ++i) {
+ grn_id id = grn_hash_cursor_next(
+ ctx_, reinterpret_cast<grn_hash_cursor *>(cursor_));
+ if (id == GRN_ID_NIL) {
+ *count = i;
+ return GRN_SUCCESS;
+ }
+ records[i].id = id;
+ records[i].score = default_score_;
+ }
+ break;
+ }
+ case GRN_CURSOR_TABLE_NO_KEY: {
+ for (size_t i = 0; i < size; ++i) {
+ grn_id id = grn_array_cursor_next(
+ ctx_, reinterpret_cast<grn_array_cursor *>(cursor_));
+ if (id == GRN_ID_NIL) {
+ *count = i;
+ return GRN_SUCCESS;
+ }
+ records[i].id = id;
+ records[i].score = default_score_;
+ }
+ break;
+ }
+ default: {
+ return GRN_UNKNOWN_ERROR;
+ }
+ }
+ *count = size;
+ return GRN_SUCCESS;
+}
+
+// -- Cursor --
+
+grn_rc Cursor::open_table_cursor(
+ grn_ctx *ctx, grn_obj *table, Cursor **cursor) {
+ if (!ctx || !grn_egn_is_table(table) || !cursor) {
+ return GRN_INVALID_ARGUMENT;
+ }
+ grn_table_cursor *table_cursor = grn_table_cursor_open(
+ ctx, table, NULL, 0, NULL, 0, 0, -1,
+ GRN_CURSOR_ASCENDING | GRN_CURSOR_BY_ID);
+ if (!table_cursor) {
+ return ctx->rc;
+ }
+ grn_rc rc = TableCursor::open(ctx, table_cursor, 0.0, cursor);
+ if (rc != GRN_SUCCESS) {
+ grn_table_cursor_close(ctx, table_cursor);
+ }
+ return rc;
+}
+
+grn_rc Cursor::read(Record *records, size_t size, size_t *count) {
+ if ((!records && (size != 0)) || !count) {
+ return GRN_INVALID_ARGUMENT;
+ }
+ *count = 0;
+ return GRN_SUCCESS;
+}
+
+// -- ExpressionNode --
+
+class ExpressionNode {
+ public:
+ ExpressionNode() {}
+ virtual ~ExpressionNode() {}
+
+ virtual ExpressionNodeType type() const = 0;
+ virtual DataType data_type() const = 0;
+
+ virtual grn_rc filter(Record *input, size_t input_size,
+ Record *output, size_t *output_size) {
+ return GRN_OPERATION_NOT_SUPPORTED;
+ }
+ virtual grn_rc adjust(Record *records, size_t num_records) {
+ return GRN_OPERATION_NOT_SUPPORTED;
+ }
+};
+
+// -- TypedNode<T> --
+
+template <typename T>
+class TypedNode : public ExpressionNode {
+ public:
+ TypedNode() : ExpressionNode() {}
+ virtual ~TypedNode() {}
+
+ DataType data_type() const {
+ return T::data_type();
+ }
+
+ virtual grn_rc evaluate(
+ const Record *records, size_t num_records, T *results) = 0;
+};
+
+// -- TypedNode<Bool> --
+
+template <>
+class TypedNode<Bool> : public ExpressionNode {
+ public:
+ TypedNode() : ExpressionNode(), values_for_filter_() {}
+ virtual ~TypedNode() {}
+
+ DataType data_type() const {
+ return Bool::data_type();
+ }
+
+ virtual grn_rc filter(Record *input, size_t input_size,
+ Record *output, size_t *output_size);
+
+ virtual grn_rc evaluate(
+ const Record *records, size_t num_records, Bool *results) = 0;
+
+ private:
+ std::vector<Bool> values_for_filter_;
+};
+
+grn_rc TypedNode<Bool>::filter(Record *input, size_t input_size,
+ Record *output, size_t *output_size) {
+ if (values_for_filter_.size() < input_size) {
+ values_for_filter_.resize(input_size);
+ }
+ grn_rc rc = evaluate(input, input_size, &*values_for_filter_.begin());
+ if (rc != GRN_SUCCESS) {
+ return rc;
+ }
+ size_t count = 0;
+ for (size_t i = 0; i < input_size; ++i) {
+ if (values_for_filter_[i].raw) {
+ output[count] = input[i];
+ ++count;
+ }
+ }
+ *output_size = count;
+ return GRN_SUCCESS;
+}
+
+// -- TypedNode<Float> --
+
+template <>
+class TypedNode<Float> : public ExpressionNode {
+ public:
+ TypedNode() : ExpressionNode(), values_for_adjust_() {}
+ virtual ~TypedNode() {}
+
+ DataType data_type() const {
+ return Float::data_type();
+ }
+
+ virtual grn_rc adjust(Record *records, size_t num_records);
+
+ virtual grn_rc evaluate(
+ const Record *records, size_t num_records, Float *results) = 0;
+
+ private:
+ std::vector<Float> values_for_adjust_;
+};
+
+grn_rc TypedNode<Float>::adjust(Record *records, size_t num_records) {
+ if (values_for_adjust_.size() < num_records) {
+ values_for_adjust_.resize(num_records);
+ }
+ grn_rc rc = evaluate(records, num_records, &*values_for_adjust_.begin());
+ if (rc != GRN_SUCCESS) {
+ return rc;
+ }
+ for (size_t i = 0; i < num_records; ++i) {
+ records[i].score = values_for_adjust_[i].raw;
+ }
+ return GRN_SUCCESS;
+}
+
+// -- IDNode --
+
+class IDNode : public TypedNode<Int> {
+ public:
+ ~IDNode() {}
+
+ static grn_rc open(ExpressionNode **node) {
+ ExpressionNode *new_node = new (std::nothrow) IDNode();
+ if (!new_node) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ *node = new_node;
+ return GRN_SUCCESS;
+ }
+
+ ExpressionNodeType type() const {
+ return GRN_EGN_ID_NODE;
+ }
+
+ grn_rc evaluate(
+ const Record *records, size_t num_records, Int *results) {
+ for (size_t i = 0; i < num_records; ++i) {
+ results[i] = Int(records[i].id);
+ }
+ return GRN_SUCCESS;
+ }
+
+ private:
+ IDNode() : TypedNode<Int>() {}
+};
+
+// -- ScoreNode --
+
+class ScoreNode : public TypedNode<Float> {
+ public:
+ ~ScoreNode() {}
+
+ static grn_rc open(ExpressionNode **node) {
+ ExpressionNode *new_node = new (std::nothrow) ScoreNode();
+ if (!new_node) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ *node = new_node;
+ return GRN_SUCCESS;
+ }
+
+ ExpressionNodeType type() const {
+ return GRN_EGN_SCORE_NODE;
+ }
+
+ grn_rc evaluate(
+ const Record *records, size_t num_records, Float *results) {
+ for (size_t i = 0; i < num_records; ++i) {
+ results[i] = Float(records[i].score);
+ }
+ return GRN_SUCCESS;
+ }
+
+ private:
+ ScoreNode() : TypedNode<Float>() {}
+};
+
+// -- ConstantNode<T> --
+
+template <typename T>
+class ConstantNode : public TypedNode<T> {
+ public:
+ ~ConstantNode() {}
+
+ static grn_rc open(const T &value, ExpressionNode **node) {
+ ConstantNode *new_node = new (std::nothrow) ConstantNode(value);
+ if (!new_node) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ *node = new_node;
+ return GRN_SUCCESS;
+ }
+
+ ExpressionNodeType type() const {
+ return GRN_EGN_CONSTANT_NODE;
+ }
+
+ grn_rc evaluate(
+ const Record *records, size_t num_records, T *results) {
+ for (size_t i = 0; i < num_records; ++i) {
+ results[i] = value_;
+ }
+ return GRN_SUCCESS;
+ }
+
+ private:
+ T value_;
+
+ explicit ConstantNode(const T &value) : TypedNode<T>(), value_(value) {}
+};
+
+// -- ConstantNode<Bool> --
+
+template <>
+class ConstantNode<Bool> : public TypedNode<Bool> {
+ public:
+ ~ConstantNode() {}
+
+ static grn_rc open(Bool value, ExpressionNode **node) {
+ ConstantNode *new_node = new (std::nothrow) ConstantNode(value);
+ if (!new_node) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ *node = new_node;
+ return GRN_SUCCESS;
+ }
+
+ ExpressionNodeType type() const {
+ return GRN_EGN_CONSTANT_NODE;
+ }
+
+ grn_rc filter(Record *input, size_t input_size,
+ Record *output, size_t *output_size);
+
+ grn_rc evaluate(
+ const Record *records, size_t num_records, Bool *results) {
+ for (size_t i = 0; i < num_records; ++i) {
+ results[i] = value_;
+ }
+ return GRN_SUCCESS;
+ }
+
+ private:
+ Bool value_;
+
+ explicit ConstantNode(Bool value) : TypedNode<Bool>(), value_(value) {}
+};
+
+grn_rc ConstantNode<Bool>::filter(
+ Record *input, size_t input_size,
+ Record *output, size_t *output_size) {
+ if (value_.raw == GRN_TRUE) {
+ // The I/O areas are the same and there is no need to copy records.
+ if (input != output) {
+ for (size_t i = 0; i < input_size; ++i) {
+ output[i] = input[i];
+ }
+ }
+ *output_size = input_size;
+ } else {
+ *output_size = 0;
+ }
+ return GRN_SUCCESS;
+}
+
+// -- ConstantNode<Float> --
+
+template <>
+class ConstantNode<Float> : public TypedNode<Float> {
+ public:
+ ~ConstantNode() {}
+
+ static grn_rc open(Float value, ExpressionNode **node) {
+ ConstantNode *new_node = new (std::nothrow) ConstantNode(value);
+ if (!new_node) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ *node = new_node;
+ return GRN_SUCCESS;
+ }
+
+ ExpressionNodeType type() const {
+ return GRN_EGN_CONSTANT_NODE;
+ }
+
+ grn_rc adjust(Record *records, size_t num_records) {
+ for (size_t i = 0; i < num_records; ++i) {
+ records[i].score = value_.raw;
+ }
+ return GRN_SUCCESS;
+ }
+
+ grn_rc evaluate(
+ const Record *records, size_t num_records, Float *results) {
+ for (size_t i = 0; i < num_records; ++i) {
+ results[i] = value_;
+ }
+ return GRN_SUCCESS;
+ }
+
+ private:
+ Float value_;
+
+ explicit ConstantNode(Float value) : TypedNode<Float>(), value_(value) {}
+};
+
+// -- ConstantNode<Text> --
+
+template <>
+class ConstantNode<Text> : public TypedNode<Text> {
+ public:
+ ~ConstantNode() {}
+
+ static grn_rc open(const Text &value, ExpressionNode **node) {
+ ConstantNode *new_node = new (std::nothrow) ConstantNode(value);
+ if (!new_node) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ try {
+ new_node->value_buf_.resize(value.raw.size);
+ } catch (const std::bad_alloc &) {
+ delete new_node;
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ std::memcpy(&*new_node->value_buf_.begin(), value.raw.ptr, value.raw.size);
+ new_node->value_.raw.ptr = &*new_node->value_buf_.begin();
+ *node = new_node;
+ return GRN_SUCCESS;
+ }
+
+ ExpressionNodeType type() const {
+ return GRN_EGN_CONSTANT_NODE;
+ }
+
+ grn_rc evaluate(
+ const Record *records, size_t num_records, Text *results) {
+ for (size_t i = 0; i < num_records; ++i) {
+ results[i] = value_;
+ }
+ return GRN_SUCCESS;
+ }
+
+ private:
+ Text value_;
+ std::vector<char> value_buf_;
+
+ explicit ConstantNode(const Text &value)
+ : TypedNode<Text>(), value_(value), value_buf_() {}
+};
+
+// -- ColumnNode --
+
+template <typename T>
+class ColumnNode : public TypedNode<T> {
+ public:
+ ~ColumnNode() {}
+
+ static grn_rc open(grn_ctx *ctx, grn_obj *column, ExpressionNode **node) {
+ ColumnNode *new_node = new (std::nothrow) ColumnNode(ctx, column);
+ if (!new_node) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ *node = new_node;
+ return GRN_SUCCESS;
+ }
+
+ ExpressionNodeType type() const {
+ return GRN_EGN_COLUMN_NODE;
+ }
+
+ grn_rc evaluate(
+ const Record *records, size_t num_records, T *results) {
+ // TODO
+ return GRN_OPERATION_NOT_SUPPORTED;
+ }
+
+ private:
+ grn_ctx *ctx_;
+ grn_obj *column_;
+
+ ColumnNode(grn_ctx *ctx, grn_obj *column)
+ : TypedNode<T>(), ctx_(ctx), column_(column) {}
+};
+
+// -- ColumnNode<Bool> --
+
+template <>
+class ColumnNode<Bool> : public TypedNode<Bool> {
+ public:
+ ~ColumnNode() {}
+
+ static grn_rc open(grn_ctx *ctx, grn_obj *column, ExpressionNode **node) {
+ ColumnNode *new_node = new (std::nothrow) ColumnNode(ctx, column);
+ if (!new_node) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ *node = new_node;
+ return GRN_SUCCESS;
+ }
+
+ ExpressionNodeType type() const {
+ return GRN_EGN_COLUMN_NODE;
+ }
+
+ grn_rc filter(
+ Record *input, size_t input_size,
+ Record *output, size_t *output_size);
+
+ grn_rc evaluate(
+ const Record *records, size_t num_records, Bool *results);
+
+ private:
+ grn_ctx *ctx_;
+ grn_obj *column_;
+
+ ColumnNode(grn_ctx *ctx, grn_obj *column)
+ : TypedNode<Bool>(), ctx_(ctx), column_(column) {}
+};
+
+grn_rc ColumnNode<Bool>::filter(
+ Record *input, size_t input_size,
+ Record *output, size_t *output_size) {
+ grn_obj value;
+ GRN_BOOL_INIT(&value, 0);
+ size_t count = 0;
+ for (size_t i = 0; i < input_size; ++i) {
+ GRN_BULK_REWIND(&value);
+ grn_obj_get_value(ctx_, column_, input[i].id, &value);
+ if (ctx_->rc != GRN_SUCCESS) {
+ return ctx_->rc;
+ }
+ if (GRN_BOOL_VALUE(&value) == GRN_TRUE) {
+ output[count] = input[i];
+ ++count;
+ }
+ }
+ GRN_OBJ_FIN(ctx_, &value);
+ *output_size = count;
+ return GRN_SUCCESS;
+}
+
+grn_rc ColumnNode<Bool>::evaluate(
+ const Record *records, size_t num_records, Bool *results) {
+ grn_obj value;
+ GRN_BOOL_INIT(&value, 0);
+ for (size_t i = 0; i < num_records; i++) {
+ GRN_BULK_REWIND(&value);
+ grn_obj_get_value(ctx_, column_, records[i].id, &value);
+ if (ctx_->rc != GRN_SUCCESS) {
+ return ctx_->rc;
+ }
+ results[i] = Bool(GRN_BOOL_VALUE(&value) == GRN_TRUE);
+ }
+ GRN_OBJ_FIN(ctx_, &value);
+ return GRN_SUCCESS;
+}
+
+// -- ColumnNode<Int> --
+
+template <>
+class ColumnNode<Int> : public TypedNode<Int> {
+ public:
+ ~ColumnNode() {}
+
+ static grn_rc open(grn_ctx *ctx, grn_obj *column, ExpressionNode **node) {
+ ColumnNode *new_node = new (std::nothrow) ColumnNode(ctx, column);
+ if (!new_node) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ *node = new_node;
+ return GRN_SUCCESS;
+ }
+
+ ExpressionNodeType type() const {
+ return GRN_EGN_COLUMN_NODE;
+ }
+
+ grn_rc evaluate(
+ const Record *records, size_t num_records, Int *results);
+
+ private:
+ grn_ctx *ctx_;
+ grn_obj *column_;
+
+ ColumnNode(grn_ctx *ctx, grn_obj *column)
+ : TypedNode<Int>(), ctx_(ctx), column_(column) {}
+};
+
+grn_rc ColumnNode<Int>::evaluate(
+ const Record *records, size_t num_records, Int *results) {
+ grn_id range = grn_obj_get_range(ctx_, column_);
+ grn_obj value;
+ switch (range) {
+ case GRN_DB_INT8: {
+ GRN_INT8_INIT(&value, 0);
+ for (size_t i = 0; i < num_records; i++) {
+ GRN_BULK_REWIND(&value);
+ grn_obj_get_value(ctx_, column_, records[i].id, &value);
+ results[i] = Int(GRN_INT8_VALUE(&value));
+ }
+ break;
+ }
+ case GRN_DB_INT16: {
+ GRN_INT16_INIT(&value, 0);
+ for (size_t i = 0; i < num_records; i++) {
+ GRN_BULK_REWIND(&value);
+ grn_obj_get_value(ctx_, column_, records[i].id, &value);
+ results[i] = Int(GRN_INT16_VALUE(&value));
+ }
+ break;
+ }
+ case GRN_DB_INT32: {
+ GRN_INT32_INIT(&value, 0);
+ for (size_t i = 0; i < num_records; i++) {
+ GRN_BULK_REWIND(&value);
+ grn_obj_get_value(ctx_, column_, records[i].id, &value);
+ results[i] = Int(GRN_INT32_VALUE(&value));
+ }
+ break;
+ }
+ case GRN_DB_INT64: {
+ GRN_INT64_INIT(&value, 0);
+ for (size_t i = 0; i < num_records; i++) {
+ GRN_BULK_REWIND(&value);
+ grn_obj_get_value(ctx_, column_, records[i].id, &value);
+ results[i] = Int(GRN_INT64_VALUE(&value));
+ }
+ break;
+ }
+ case GRN_DB_UINT8: {
+ GRN_UINT8_INIT(&value, 0);
+ for (size_t i = 0; i < num_records; i++) {
+ GRN_BULK_REWIND(&value);
+ grn_obj_get_value(ctx_, column_, records[i].id, &value);
+ results[i] = Int(GRN_UINT8_VALUE(&value));
+ }
+ break;
+ }
+ case GRN_DB_UINT16: {
+ GRN_UINT16_INIT(&value, 0);
+ for (size_t i = 0; i < num_records; i++) {
+ GRN_BULK_REWIND(&value);
+ grn_obj_get_value(ctx_, column_, records[i].id, &value);
+ results[i] = Int(GRN_UINT16_VALUE(&value));
+ }
+ break;
+ }
+ case GRN_DB_UINT32: {
+ GRN_UINT32_INIT(&value, 0);
+ for (size_t i = 0; i < num_records; i++) {
+ GRN_BULK_REWIND(&value);
+ grn_obj_get_value(ctx_, column_, records[i].id, &value);
+ results[i] = Int(GRN_UINT32_VALUE(&value));
+ }
+ break;
+ }
+ case GRN_DB_UINT64: {
+ GRN_UINT64_INIT(&value, 0);
+ for (size_t i = 0; i < num_records; i++) {
+ GRN_BULK_REWIND(&value);
+ grn_obj_get_value(ctx_, column_, records[i].id, &value);
+ // FIXME: Type conversion from UInt64 to Int may lose the content.
+ results[i] = Int(GRN_UINT64_VALUE(&value));
+ }
+ break;
+ }
+ }
+ GRN_OBJ_FIN(ctx_, &value);
+ return GRN_SUCCESS;
+}
+
+// -- ColumnNode<Float> --
+
+template <>
+class ColumnNode<Float> : public TypedNode<Float> {
+ public:
+ ~ColumnNode() {}
+
+ static grn_rc open(grn_ctx *ctx, grn_obj *column, ExpressionNode **node) {
+ ColumnNode *new_node = new (std::nothrow) ColumnNode(ctx, column);
+ if (!new_node) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ *node = new_node;
+ return GRN_SUCCESS;
+ }
+
+ ExpressionNodeType type() const {
+ return GRN_EGN_COLUMN_NODE;
+ }
+
+ grn_rc adjust(Record *records, size_t num_records);
+
+ grn_rc evaluate(
+ const Record *records, size_t num_records, Float *results);
+
+ private:
+ grn_ctx *ctx_;
+ grn_obj *column_;
+
+ ColumnNode(grn_ctx *ctx, grn_obj *column)
+ : TypedNode<Float>(), ctx_(ctx), column_(column) {}
+};
+
+grn_rc ColumnNode<Float>::adjust(Record *records, size_t num_records) {
+ grn_obj value;
+ GRN_FLOAT_INIT(&value, 0);
+ for (size_t i = 0; i < num_records; ++i) {
+ GRN_BULK_REWIND(&value);
+ grn_obj_get_value(ctx_, column_, records[i].id, &value);
+ records[i].score = GRN_FLOAT_VALUE(&value);
+ }
+ GRN_OBJ_FIN(ctx_, &value);
+ return GRN_SUCCESS;
+}
+
+grn_rc ColumnNode<Float>::evaluate(
+ const Record *records, size_t num_records, Float *results) {
+ grn_obj value;
+ GRN_FLOAT_INIT(&value, 0);
+ for (size_t i = 0; i < num_records; i++) {
+ GRN_BULK_REWIND(&value);
+ grn_obj_get_value(ctx_, column_, records[i].id, &value);
+ results[i] = Float(GRN_FLOAT_VALUE(&value));
+ }
+ GRN_OBJ_FIN(ctx_, &value);
+ return GRN_SUCCESS;
+}
+
+// -- ColumnNode<Time> --
+
+template <>
+class ColumnNode<Time> : public TypedNode<Time> {
+ public:
+ ~ColumnNode() {}
+
+ static grn_rc open(grn_ctx *ctx, grn_obj *column, ExpressionNode **node) {
+ ColumnNode *new_node = new (std::nothrow) ColumnNode(ctx, column);
+ if (!new_node) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ *node = new_node;
+ return GRN_SUCCESS;
+ }
+
+ ExpressionNodeType type() const {
+ return GRN_EGN_COLUMN_NODE;
+ }
+
+ grn_rc evaluate(
+ const Record *records, size_t num_records, Time *results);
+
+ private:
+ grn_ctx *ctx_;
+ grn_obj *column_;
+
+ ColumnNode(grn_ctx *ctx, grn_obj *column)
+ : TypedNode<Time>(), ctx_(ctx), column_(column) {}
+};
+
+grn_rc ColumnNode<Time>::evaluate(
+ const Record *records, size_t num_records, Time *results) {
+ grn_obj value;
+ GRN_TIME_INIT(&value, 0);
+ for (size_t i = 0; i < num_records; i++) {
+ GRN_BULK_REWIND(&value);
+ grn_obj_get_value(ctx_, column_, records[i].id, &value);
+ results[i] = Time(GRN_TIME_VALUE(&value));
+ }
+ GRN_OBJ_FIN(ctx_, &value);
+ return GRN_SUCCESS;
+}
+
+// -- ColumnNode<Text> --
+
+template <>
+class ColumnNode<Text> : public TypedNode<Text> {
+ public:
+ ~ColumnNode() {
+ GRN_OBJ_FIN(ctx_, &buf_);
+ }
+
+ static grn_rc open(grn_ctx *ctx, grn_obj *column, ExpressionNode **node) {
+ ColumnNode *new_node = new (std::nothrow) ColumnNode(ctx, column);
+ if (!new_node) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ *node = new_node;
+ return GRN_SUCCESS;
+ }
+
+ ExpressionNodeType type() const {
+ return GRN_EGN_COLUMN_NODE;
+ }
+
+ grn_rc evaluate(
+ const Record *records, size_t num_records, Text *results);
+
+ private:
+ grn_ctx *ctx_;
+ grn_obj *column_;
+ grn_obj buf_;
+
+ ColumnNode(grn_ctx *ctx, grn_obj *column)
+ : TypedNode<Text>(), ctx_(ctx), column_(column), buf_() {
+ GRN_TEXT_INIT(&buf_, 0);
+ }
+};
+
+grn_rc ColumnNode<Text>::evaluate(
+ const Record *records, size_t num_records, Text *results) {
+ GRN_BULK_REWIND(&buf_);
+ size_t offset = 0;
+ for (size_t i = 0; i < num_records; i++) {
+ grn_obj_get_value(ctx_, column_, records[i].id, &buf_);
+ if (ctx_->rc != GRN_SUCCESS) {
+ return ctx_->rc;
+ }
+ size_t next_offset = GRN_TEXT_LEN(&buf_);
+ results[i].raw.size = next_offset - offset;
+ offset = next_offset;
+ }
+ char *ptr = GRN_TEXT_VALUE(&buf_);
+ for (size_t i = 0; i < num_records; i++) {
+ results[i].raw.ptr = ptr;
+ ptr += results[i].raw.size;
+ }
+ return GRN_SUCCESS;
+}
+
+// -- ColumnNode<GeoPoint> --
+
+template <>
+class ColumnNode<GeoPoint> : public TypedNode<GeoPoint> {
+ public:
+ ~ColumnNode() {}
+
+ static grn_rc open(grn_ctx *ctx, grn_obj *column, ExpressionNode **node) {
+ ColumnNode *new_node = new (std::nothrow) ColumnNode(ctx, column);
+ if (!new_node) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ *node = new_node;
+ return GRN_SUCCESS;
+ }
+
+ ExpressionNodeType type() const {
+ return GRN_EGN_COLUMN_NODE;
+ }
+
+ grn_rc evaluate(
+ const Record *records, size_t num_records, GeoPoint *results);
+
+ private:
+ grn_ctx *ctx_;
+ grn_obj *column_;
+
+ ColumnNode(grn_ctx *ctx, grn_obj *column)
+ : TypedNode<GeoPoint>(), ctx_(ctx), column_(column) {}
+};
+
+grn_rc ColumnNode<GeoPoint>::evaluate(
+ const Record *records, size_t num_records, GeoPoint *results) {
+ grn_obj value;
+ GRN_WGS84_GEO_POINT_INIT(&value, 0);
+ for (size_t i = 0; i < num_records; i++) {
+ GRN_BULK_REWIND(&value);
+ grn_obj_get_value(ctx_, column_, records[i].id, &value);
+ GRN_GEO_POINT_VALUE(
+ &value, results[i].raw.latitude, results[i].raw.longitude);
+ }
+ GRN_OBJ_FIN(ctx_, &value);
+ return GRN_SUCCESS;
+}
+
+// -- OperatorNode --
+
+template <typename T>
+class OperatorNode : public TypedNode<T> {
+ public:
+ OperatorNode() : TypedNode<T>() {}
+ virtual ~OperatorNode() {}
+
+ ExpressionNodeType type() const {
+ return GRN_EGN_OPERATOR_NODE;
+ }
+};
+
+template <typename T>
+grn_rc operator_node_fill_arg_values(
+ const Record *records, size_t num_records,
+ TypedNode<T> *arg, std::vector<T> *arg_values) {
+ size_t old_size = arg_values->size();
+ if (old_size < num_records) try {
+ arg_values->resize(num_records);
+ } catch (const std::bad_alloc &) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ switch (arg->type()) {
+ case GRN_EGN_CONSTANT_NODE: {
+ if (old_size < num_records) {
+ return arg->evaluate(records + old_size, num_records - old_size,
+ &*arg_values->begin() + old_size);
+ }
+ return GRN_SUCCESS;
+ }
+ default: {
+ return arg->evaluate(records, num_records, &*arg_values->begin());
+ }
+ }
+}
+
+// --- UnaryNode ---
+
+template <typename T, typename U>
+class UnaryNode : public OperatorNode<T> {
+ public:
+ explicit UnaryNode(ExpressionNode *arg)
+ : OperatorNode<T>(), arg_(static_cast<TypedNode<U> *>(arg)),
+ arg_values_() {}
+ virtual ~UnaryNode() {
+ delete arg_;
+ }
+
+ protected:
+ TypedNode<U> *arg_;
+ std::vector<U> arg_values_;
+
+ grn_rc fill_arg_values(const Record *records, size_t num_records) {
+ return operator_node_fill_arg_values(
+ records, num_records, arg_, &arg_values_);
+ }
+};
+
+// ---- LogicalNotNode ----
+
+class LogicalNotNode : public UnaryNode<Bool, Bool> {
+ public:
+ ~LogicalNotNode() {}
+
+ static grn_rc open(ExpressionNode *arg, ExpressionNode **node) {
+ LogicalNotNode *new_node = new (std::nothrow) LogicalNotNode(arg);
+ if (!new_node) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ *node = new_node;
+ return GRN_SUCCESS;
+ }
+
+ grn_rc filter(
+ Record *input, size_t input_size,
+ Record *output, size_t *output_size);
+
+ grn_rc evaluate(
+ const Record *records, size_t num_records, Bool *results);
+
+ private:
+ std::vector<Record> temp_records_;
+
+ explicit LogicalNotNode(ExpressionNode *arg)
+ : UnaryNode<Bool, Bool>(arg), temp_records_() {}
+};
+
+grn_rc LogicalNotNode::filter(
+ Record *input, size_t input_size,
+ Record *output, size_t *output_size) {
+ if (temp_records_.size() <= input_size) {
+ try {
+ temp_records_.resize(input_size + 1);
+ temp_records_[input_size].id = GRN_ID_NIL;
+ } catch (const std::bad_alloc &) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ }
+ size_t temp_size;
+ grn_rc rc =
+ arg_->filter(input, input_size, &*temp_records_.begin(), &temp_size);
+ if (rc != GRN_SUCCESS) {
+ return rc;
+ }
+ if (temp_size == 0) {
+ *output_size = 0;
+ return GRN_SUCCESS;
+ }
+
+ size_t count = 0;
+ for (size_t i = 0; i < input_size; ++i) {
+ if (input[i].id != temp_records_[i - count].id) {
+ output[count] = input[i];
+ ++count;
+ }
+ }
+ *output_size = count;
+ return GRN_SUCCESS;
+}
+
+grn_rc LogicalNotNode::evaluate(
+ const Record *records, size_t num_records, Bool *results) {
+ grn_rc rc = arg_->evaluate(records, num_records, results);
+ if (rc == GRN_SUCCESS) {
+ for (size_t i = 0; i < num_records; ++i) {
+ results[i] = Bool(results[i].raw != GRN_TRUE);
+ }
+ }
+ return rc;
+}
+
+// --- BinaryNode ---
+
+template <typename T, typename U, typename V>
+class BinaryNode : public OperatorNode<T> {
+ public:
+ BinaryNode(ExpressionNode *arg1, ExpressionNode *arg2)
+ : OperatorNode<T>(),
+ arg1_(static_cast<TypedNode<U> *>(arg1)),
+ arg2_(static_cast<TypedNode<V> *>(arg2)),
+ arg1_values_(), arg2_values_() {}
+ virtual ~BinaryNode() {
+ delete arg1_;
+ delete arg2_;
+ }
+
+ protected:
+ TypedNode<U> *arg1_;
+ TypedNode<V> *arg2_;
+ std::vector<U> arg1_values_;
+ std::vector<V> arg2_values_;
+
+ grn_rc fill_arg1_values(const Record *records, size_t num_records) {
+ return operator_node_fill_arg_values(
+ records, num_records, arg1_, &arg1_values_);
+ }
+ grn_rc fill_arg2_values(const Record *records, size_t num_records) {
+ return operator_node_fill_arg_values(
+ records, num_records, arg2_, &arg2_values_);
+ }
+};
+
+// ---- LogicalAndNode ----
+
+class LogicalAndNode : public BinaryNode<Bool, Bool, Bool> {
+ public:
+ ~LogicalAndNode() {}
+
+ static grn_rc open(
+ ExpressionNode *arg1, ExpressionNode *arg2, ExpressionNode **node) {
+ LogicalAndNode *new_node = new (std::nothrow) LogicalAndNode(arg1, arg2);
+ if (!new_node) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ *node = new_node;
+ return GRN_SUCCESS;
+ }
+
+ grn_rc filter(
+ Record *input, size_t input_size,
+ Record *output, size_t *output_size) {
+ grn_rc rc = arg1_->filter(input, input_size, output, output_size);
+ if (rc == GRN_SUCCESS) {
+ rc = arg2_->filter(output, *output_size, output, output_size);
+ }
+ return rc;
+ }
+
+ grn_rc evaluate(
+ const Record *records, size_t num_records, Bool *results);
+
+ private:
+ std::vector<Record> temp_records_;
+
+ LogicalAndNode(ExpressionNode *arg1, ExpressionNode *arg2)
+ : BinaryNode<Bool, Bool, Bool>(arg1, arg2), temp_records_() {}
+};
+
+grn_rc LogicalAndNode::evaluate(
+ const Record *records, size_t num_records, Bool *results) {
+ // Evaluate "arg1" for all the records.
+ // Then, evaluate "arg2" for non-false records.
+ grn_rc rc = arg1_->evaluate(records, num_records, results);
+ if (rc != GRN_SUCCESS) {
+ return rc;
+ }
+ if (temp_records_.size() < num_records) try {
+ temp_records_.resize(num_records);
+ } catch (const std::bad_alloc &) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ size_t count = 0;
+ for (size_t i = 0; i < num_records; ++i) {
+ if (results[i].raw == GRN_TRUE) {
+ temp_records_[count] = records[i];
+ ++count;
+ }
+ }
+ if (count == 0) {
+ // Nothing to do.
+ return GRN_SUCCESS;
+ }
+ rc = fill_arg2_values(&*temp_records_.begin(), count);
+ if (rc != GRN_SUCCESS) {
+ return rc;
+ }
+
+ // Merge the evaluation results.
+ count = 0;
+ for (size_t i = 0; i < num_records; ++i) {
+ if (results[i].raw == GRN_TRUE) {
+ results[i] = arg2_values_[count];
+ ++count;
+ }
+ }
+ return GRN_SUCCESS;
+}
+
+// ---- LogicalOrNode ----
+
+class LogicalOrNode : public BinaryNode<Bool, Bool, Bool> {
+ public:
+ ~LogicalOrNode() {}
+
+ static grn_rc open(
+ ExpressionNode *arg1, ExpressionNode *arg2, ExpressionNode **node) {
+ LogicalOrNode *new_node = new (std::nothrow) LogicalOrNode(arg1, arg2);
+ if (!new_node) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ *node = new_node;
+ return GRN_SUCCESS;
+ }
+
+ grn_rc filter(
+ Record *input, size_t input_size,
+ Record *output, size_t *output_size);
+
+ grn_rc evaluate(
+ const Record *records, size_t num_records, Bool *results);
+
+ private:
+ std::vector<Record> temp_records_;
+
+ LogicalOrNode(ExpressionNode *arg1, ExpressionNode *arg2)
+ : BinaryNode<Bool, Bool, Bool>(arg1, arg2), temp_records_() {}
+};
+
+grn_rc LogicalOrNode::filter(
+ Record *input, size_t input_size,
+ Record *output, size_t *output_size) {
+ // Evaluate "arg1" for all the records.
+ // Then, evaluate "arg2" for non-true records.
+ grn_rc rc = fill_arg1_values(input, input_size);
+ if (rc != GRN_SUCCESS) {
+ return rc;
+ }
+ if (temp_records_.size() < input_size) try {
+ temp_records_.resize(input_size);
+ } catch (const std::bad_alloc &) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ size_t count = 0;
+ for (size_t i = 0; i < input_size; ++i) {
+ if (arg1_values_[i].raw == GRN_FALSE) {
+ temp_records_[count] = input[i];
+ ++count;
+ }
+ }
+ if (count == 0) {
+ if (input != output) {
+ for (size_t i = 0; i < input_size; ++i) {
+ output[i] = input[i];
+ }
+ }
+ *output_size = input_size;
+ return GRN_SUCCESS;
+ }
+ rc = fill_arg2_values(&*temp_records_.begin(), count);
+ if (rc != GRN_SUCCESS) {
+ return rc;
+ }
+
+ // Merge the evaluation results.
+ count = 0;
+ size_t output_count = 0;
+ for (size_t i = 0; i < input_size; ++i) {
+ if (arg1_values_[i].raw == GRN_TRUE) {
+ output[output_count] = input[i];
+ ++output_count;
+ } else {
+ if (arg2_values_[count].raw == GRN_TRUE) {
+ output[output_count] = input[i];
+ ++output_count;
+ }
+ ++count;
+ }
+ }
+ *output_size = output_count;
+ return GRN_SUCCESS;
+}
+
+grn_rc LogicalOrNode::evaluate(
+ const Record *records, size_t num_records, Bool *results) {
+ // Evaluate "arg1" for all the records.
+ // Then, evaluate "arg2" for non-true records.
+ grn_rc rc = arg1_->evaluate(records, num_records, results);
+ if (rc != GRN_SUCCESS) {
+ return rc;
+ }
+ if (temp_records_.size() < num_records) try {
+ temp_records_.resize(num_records);
+ } catch (const std::bad_alloc &) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ size_t count = 0;
+ for (size_t i = 0; i < num_records; ++i) {
+ if (results[i].raw == GRN_FALSE) {
+ temp_records_[count] = records[i];
+ ++count;
+ }
+ }
+ if (count == 0) {
+ // Nothing to do.
+ return GRN_SUCCESS;
+ }
+ rc = fill_arg2_values(&*temp_records_.begin(), count);
+ if (rc != GRN_SUCCESS) {
+ return rc;
+ }
+
+ // Merge the evaluation results.
+ count = 0;
+ for (size_t i = 0; i < num_records; ++i) {
+ if (results[i].raw == GRN_FALSE) {
+ results[i] = arg2_values_[count];
+ ++count;
+ }
+ }
+ return GRN_SUCCESS;
+}
+
+// -- GenericBinaryNode --
+
+template <typename T,
+ typename U = typename T::Value,
+ typename V = typename T::Arg1,
+ typename W = typename T::Arg2>
+class GenericBinaryNode : public BinaryNode<U, V, W> {
+ public:
+ GenericBinaryNode(ExpressionNode *arg1, ExpressionNode *arg2)
+ : BinaryNode<U, V, W>(arg1, arg2), operator_() {}
+ ~GenericBinaryNode() {}
+
+ grn_rc evaluate(
+ const Record *records, size_t num_records, Bool *results);
+
+ private:
+ T operator_;
+};
+
+template <typename T, typename U, typename V, typename W>
+grn_rc GenericBinaryNode<T, U, V, W>::evaluate(
+ const Record *records, size_t num_records, Bool *results) {
+ grn_rc rc = this->fill_arg1_values(records, num_records);
+ if (rc != GRN_SUCCESS) {
+ return rc;
+ }
+ rc = this->fill_arg2_values(records, num_records);
+ if (rc != GRN_SUCCESS) {
+ return rc;
+ }
+ for (size_t i = 0; i < num_records; ++i) {
+ results[i] = operator_(this->arg1_values_[i], this->arg2_values_[i]);
+ }
+ return GRN_SUCCESS;
+}
+
+template <typename T, typename V, typename W>
+class GenericBinaryNode<T, Bool, V, W> : public BinaryNode<Bool, V, W> {
+ public:
+ GenericBinaryNode(ExpressionNode *arg1, ExpressionNode *arg2)
+ : BinaryNode<Bool, V, W>(arg1, arg2), operator_() {}
+ ~GenericBinaryNode() {}
+
+ grn_rc filter(
+ Record *input, size_t input_size,
+ Record *output, size_t *output_size);
+
+ grn_rc evaluate(
+ const Record *records, size_t num_records, Bool *results);
+
+ private:
+ T operator_;
+};
+
+template <typename T, typename V, typename W>
+grn_rc GenericBinaryNode<T, Bool, V, W>::filter(
+ Record *input, size_t input_size,
+ Record *output, size_t *output_size) {
+ grn_rc rc = this->fill_arg1_values(input, input_size);
+ if (rc != GRN_SUCCESS) {
+ return rc;
+ }
+ rc = this->fill_arg2_values(input, input_size);
+ if (rc != GRN_SUCCESS) {
+ return rc;
+ }
+ size_t count = 0;
+ for (size_t i = 0; i < input_size; ++i) {
+ if (operator_(this->arg1_values_[i], this->arg2_values_[i]).raw ==
+ GRN_TRUE) {
+ output[count] = input[i];
+ ++count;
+ }
+ }
+ *output_size = count;
+ return GRN_SUCCESS;
+}
+
+template <typename T, typename V, typename W>
+grn_rc GenericBinaryNode<T, Bool, V, W>::evaluate(
+ const Record *records, size_t num_records, Bool *results) {
+ grn_rc rc = this->fill_arg1_values(records, num_records);
+ if (rc != GRN_SUCCESS) {
+ return rc;
+ }
+ rc = this->fill_arg2_values(records, num_records);
+ if (rc != GRN_SUCCESS) {
+ return rc;
+ }
+ for (size_t i = 0; i < num_records; ++i) {
+ results[i] = operator_(this->arg1_values_[i], this->arg2_values_[i]);
+ }
+ return GRN_SUCCESS;
+}
+
+// ----- EqualNode -----
+
+template <typename T>
+struct EqualOperator {
+ typedef Bool Value;
+ typedef T Arg1;
+ typedef T Arg2;
+ Value operator()(const Arg1 &arg1, const Arg2 &arg2) const {
+ return Bool(arg1 == arg2);
+ }
+};
+
+template <typename T>
+grn_rc equal_node_open(EqualOperator<T> op,
+ ExpressionNode *arg1, ExpressionNode *arg2, ExpressionNode **node) {
+ GenericBinaryNode<EqualOperator<T> > *new_node =
+ new (std::nothrow) GenericBinaryNode<EqualOperator<T> >(arg1, arg2);
+ if (!new_node) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ *node = new_node;
+ return GRN_SUCCESS;
+}
+
+// ----- NotEqualNode -----
+
+template <typename T>
+struct NotEqualOperator {
+ typedef Bool Value;
+ typedef T Arg1;
+ typedef T Arg2;
+ Value operator()(const Arg1 &arg1, const Arg2 &arg2) const {
+ return Bool(arg1 != arg2);
+ }
+};
+
+template <typename T>
+grn_rc not_equal_node_open(NotEqualOperator<T> op,
+ ExpressionNode *arg1, ExpressionNode *arg2, ExpressionNode **node) {
+ GenericBinaryNode<NotEqualOperator<T> > *new_node =
+ new (std::nothrow) GenericBinaryNode<NotEqualOperator<T> >(arg1, arg2);
+ if (!new_node) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ *node = new_node;
+ return GRN_SUCCESS;
+}
+
+// ----- LessNode -----
+
+template <typename T>
+struct LessOperator {
+ typedef Bool Value;
+ typedef T Arg1;
+ typedef T Arg2;
+ Value operator()(const Arg1 &arg1, const Arg2 &arg2) const {
+ return Bool(arg1 < arg2);
+ }
+};
+
+template <typename T>
+grn_rc less_node_open(LessOperator<T> op,
+ ExpressionNode *arg1, ExpressionNode *arg2, ExpressionNode **node) {
+ GenericBinaryNode<LessOperator<T> > *new_node =
+ new (std::nothrow) GenericBinaryNode<LessOperator<T> >(arg1, arg2);
+ if (!new_node) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ *node = new_node;
+ return GRN_SUCCESS;
+}
+
+// ----- LessEqualNode -----
+
+template <typename T>
+struct LessEqualOperator {
+ typedef Bool Value;
+ typedef T Arg1;
+ typedef T Arg2;
+ Value operator()(const Arg1 &arg1, const Arg2 &arg2) const {
+ return Bool(arg1 < arg2);
+ }
+};
+
+template <typename T>
+grn_rc less_equal_node_open(LessEqualOperator<T> op,
+ ExpressionNode *arg1, ExpressionNode *arg2, ExpressionNode **node) {
+ GenericBinaryNode<LessEqualOperator<T> > *new_node =
+ new (std::nothrow) GenericBinaryNode<LessEqualOperator<T> >(arg1, arg2);
+ if (!new_node) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ *node = new_node;
+ return GRN_SUCCESS;
+}
+
+// ----- GreaterNode -----
+
+template <typename T>
+struct GreaterOperator {
+ typedef Bool Value;
+ typedef T Arg1;
+ typedef T Arg2;
+ Value operator()(const Arg1 &arg1, const Arg2 &arg2) const {
+ return Bool(arg1 < arg2);
+ }
+};
+
+template <typename T>
+grn_rc greater_node_open(GreaterOperator<T> op,
+ ExpressionNode *arg1, ExpressionNode *arg2, ExpressionNode **node) {
+ GenericBinaryNode<GreaterOperator<T> > *new_node =
+ new (std::nothrow) GenericBinaryNode<GreaterOperator<T> >(arg1, arg2);
+ if (!new_node) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ *node = new_node;
+ return GRN_SUCCESS;
+}
+
+// ----- GreaterEqualNode -----
+
+template <typename T>
+struct GreaterEqualOperator {
+ typedef Bool Value;
+ typedef T Arg1;
+ typedef T Arg2;
+ Value operator()(const Arg1 &arg1, const Arg2 &arg2) const {
+ return Bool(arg1 < arg2);
+ }
+};
+
+template <typename T>
+grn_rc greater_equal_node_open(GreaterEqualOperator<T> op,
+ ExpressionNode *arg1, ExpressionNode *arg2, ExpressionNode **node) {
+ GenericBinaryNode<GreaterEqualOperator<T> > *new_node =
+ new (std::nothrow) GenericBinaryNode<GreaterEqualOperator<T> >(arg1, arg2);
+ if (!new_node) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ *node = new_node;
+ return GRN_SUCCESS;
+}
+
+// -- ExpressionToken --
+
+enum ExpressionTokenType {
+ DUMMY_TOKEN,
+ CONSTANT_TOKEN,
+ NAME_TOKEN,
+ UNARY_OPERATOR_TOKEN,
+ BINARY_OPERATOR_TOKEN,
+ DEREFERENCE_TOKEN,
+ BRACKET_TOKEN
+};
+
+enum ExpressionBracketType {
+ LEFT_ROUND_BRACKET,
+ RIGHT_ROUND_BRACKET,
+ LEFT_SQUARE_BRACKET,
+ RIGHT_SQUARE_BRACKET
+};
+
+// TODO: std::string should not be used.
+class ExpressionToken {
+ public:
+ ExpressionToken() : string_(), type_(DUMMY_TOKEN), dummy_(0), priority_(0) {}
+ ExpressionToken(const std::string &string, ExpressionTokenType token_type)
+ : string_(string), type_(token_type), dummy_(0), priority_(0) {}
+ ExpressionToken(const std::string &string,
+ ExpressionBracketType bracket_type)
+ : string_(string), type_(BRACKET_TOKEN), bracket_type_(bracket_type),
+ priority_(0) {}
+ ExpressionToken(const std::string &string, OperatorType operator_type)
+ : string_(string), type_(get_operator_token_type(operator_type)),
+ operator_type_(operator_type),
+ priority_(get_operator_priority(operator_type)) {}
+
+ const std::string &string() const {
+ return string_;
+ }
+ ExpressionTokenType type() const {
+ return type_;
+ }
+ ExpressionBracketType bracket_type() const {
+ return bracket_type_;
+ }
+ OperatorType operator_type() const {
+ return operator_type_;
+ }
+ int priority() const {
+ return priority_;
+ }
+
+ private:
+ std::string string_;
+ ExpressionTokenType type_;
+ union {
+ int dummy_;
+ ExpressionBracketType bracket_type_;
+ OperatorType operator_type_;
+ };
+ int priority_;
+
+ static ExpressionTokenType get_operator_token_type(
+ OperatorType operator_type);
+ static int get_operator_priority(OperatorType operator_type);
+};
+
+ExpressionTokenType ExpressionToken::get_operator_token_type(
+ OperatorType operator_type) {
+ switch (operator_type) {
+ case GRN_OP_NOT: {
+ return UNARY_OPERATOR_TOKEN;
+ }
+ case GRN_OP_AND:
+ case GRN_OP_OR:
+ case GRN_OP_EQUAL:
+ case GRN_OP_NOT_EQUAL:
+ case GRN_OP_LESS:
+ case GRN_OP_LESS_EQUAL:
+ case GRN_OP_GREATER:
+ case GRN_OP_GREATER_EQUAL: {
+ return BINARY_OPERATOR_TOKEN;
+ }
+ default: {
+ // TODO: ERROR_TOKEN or something should be used...?
+ // Or, default should be removed?
+ return DUMMY_TOKEN;
+ }
+ }
+}
+
+int ExpressionToken::get_operator_priority(
+ OperatorType operator_type) {
+ switch (operator_type) {
+ case GRN_OP_NOT: {
+// case GRN_OP_BITWISE_NOT:
+// case GRN_OP_POSITIVE:
+// case GRN_OP_NEGATIVE:
+// case GRN_OP_TO_INT:
+// case GRN_OP_TO_FLOAT: {
+ return 3;
+ }
+ case GRN_OP_AND: {
+ return 13;
+ }
+ case GRN_OP_OR: {
+ return 14;
+ }
+ case GRN_OP_EQUAL:
+ case GRN_OP_NOT_EQUAL: {
+ return 9;
+ }
+ case GRN_OP_LESS:
+ case GRN_OP_LESS_EQUAL:
+ case GRN_OP_GREATER:
+ case GRN_OP_GREATER_EQUAL: {
+ return 8;
+ }
+// case GRN_OP_BITWISE_AND: {
+// return 10;
+// }
+// case GRN_OP_BITWISE_OR: {
+// return 12;
+// }
+// case GRN_OP_BITWISE_XOR: {
+// return 11;
+// }
+// case GRN_OP_PLUS:
+// case GRN_OP_MINUS: {
+// return 6;
+// }
+// case GRN_OP_MULTIPLICATION:
+// case GRN_OP_DIVISION:
+// case GRN_OP_MODULUS: {
+// return 5;
+// }
+// case GRN_OP_STARTS_WITH:
+// case GRN_OP_ENDS_WITH:
+// case GRN_OP_CONTAINS: {
+// return 7;
+// }
+// case GRN_OP_SUBSCRIPT: {
+// return 2;
+// }
+ default: {
+ return 100;
+ }
+ }
+}
+
+// -- ExpressionParser --
+
+class ExpressionParser {
+ public:
+ static grn_rc parse(grn_ctx *ctx, grn_obj *table,
+ const char *query, size_t query_size, Expression **expression);
+
+ private:
+ grn_ctx *ctx_;
+ grn_obj *table_;
+ std::vector<ExpressionToken> tokens_;
+ std::vector<ExpressionToken> stack_;
+ Expression *expression_;
+
+ ExpressionParser(grn_ctx *ctx, grn_obj *table)
+ : ctx_(ctx), table_(table), tokens_(), stack_(), expression_(NULL) {}
+ ~ExpressionParser() {
+ delete expression_;
+ }
+
+ grn_rc tokenize(const char *query, size_t query_size);
+ grn_rc compose();
+ grn_rc push_token(const ExpressionToken &token);
+};
+
+grn_rc ExpressionParser::parse(grn_ctx *ctx, grn_obj *table,
+ const char *query, size_t query_size, Expression **expression) {
+ ExpressionParser *parser = new (std::nothrow) ExpressionParser(ctx, table);
+ if (!parser) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ grn_rc rc = parser->tokenize(query, query_size);
+ if (rc == GRN_SUCCESS) {
+ rc = parser->compose();
+ if (rc == GRN_SUCCESS) {
+ *expression = parser->expression_;
+ parser->expression_ = NULL;
+ }
+ }
+ delete parser;
+ return rc;
+}
+
+grn_rc ExpressionParser::tokenize(const char *query, size_t query_size) {
+ const char *rest = query;
+ size_t rest_size = query_size;
+ while (rest_size != 0) {
+ // Ignore white-space characters.
+ size_t pos;
+ for (pos = 0; pos < rest_size; ++pos) {
+ if (!std::isspace(static_cast<uint8_t>(rest[pos]))) {
+ break;
+ }
+ }
+ rest += pos;
+ rest_size -= pos;
+ switch (rest[0]) {
+ case '!': {
+ if ((rest_size >= 2) && (rest[1] == '=')) {
+ tokens_.push_back(ExpressionToken("!=", GRN_OP_NOT_EQUAL));
+ rest += 2;
+ rest_size -= 2;
+ } else {
+ tokens_.push_back(ExpressionToken("!", GRN_OP_NOT));
+ ++rest;
+ --rest_size;
+ }
+ break;
+ }
+// case '~': {
+// tokens_.push_back(ExpressionToken("~", GRN_OP_BITWISE_NOT));
+// rest = rest.substring(1);
+// break;
+// }
+ case '=': {
+ if ((rest_size >= 2) && (rest[1] == '=')) {
+ tokens_.push_back(ExpressionToken("==", GRN_OP_EQUAL));
+ rest += 2;
+ rest_size -= 2;
+ } else {
+ return GRN_INVALID_ARGUMENT;
+ }
+ break;
+ }
+ case '<': {
+ if ((rest_size >= 2) && (rest[1] == '=')) {
+ tokens_.push_back(ExpressionToken("<=", GRN_OP_LESS_EQUAL));
+ rest += 2;
+ rest_size -= 2;
+ } else {
+ tokens_.push_back(ExpressionToken("<", GRN_OP_LESS));
+ ++rest;
+ --rest_size;
+ }
+ break;
+ }
+ case '>': {
+ if ((rest_size >= 2) && (rest[1] == '=')) {
+ tokens_.push_back(ExpressionToken(">=", GRN_OP_GREATER_EQUAL));
+ rest += 2;
+ rest_size -= 2;
+ } else {
+ tokens_.push_back(ExpressionToken(">", GRN_OP_GREATER));
+ ++rest;
+ --rest_size;
+ }
+ break;
+ }
+ case '&': {
+ if ((rest_size >= 2) && (rest[1] == '&')) {
+ tokens_.push_back(ExpressionToken("&&", GRN_OP_AND));
+ rest += 2;
+ rest_size -= 2;
+ } else {
+// tokens_.push_back(ExpressionToken("&", GRN_OP_BITWISE_AND));
+// ++rest;
+// --rest_size;
+ return GRN_INVALID_ARGUMENT;
+ }
+ break;
+ }
+ case '|': {
+ if ((rest_size >= 2) && (rest[1] == '|')) {
+ tokens_.push_back(ExpressionToken("||", GRN_OP_OR));
+ rest += 2;
+ rest_size -= 2;
+ } else {
+// tokens_.push_back(ExpressionToken("|", GRN_OP_BITWISE_OR));
+// ++rest;
+// --rest_size;
+ return GRN_INVALID_ARGUMENT;
+ }
+ break;
+ }
+// case '^': {
+// tokens_.push_back(ExpressionToken("^", GRN_OP_BITWISE_XOR));
+// rest = rest.substring(1);
+// break;
+// }
+// case '+': {
+// tokens_.push_back(ExpressionToken("+", GRN_OP_PLUS));
+// rest = rest.substring(1);
+// break;
+// }
+// case '-': {
+// tokens_.push_back(ExpressionToken("-", GRN_OP_MINUS));
+// rest = rest.substring(1);
+// break;
+// }
+// case '*': {
+// tokens_.push_back(ExpressionToken("*", GRN_OP_MULTIPLICATION));
+// rest = rest.substring(1);
+// break;
+// }
+// case '/': {
+// tokens_.push_back(ExpressionToken("/", GRN_OP_DIVISION));
+// rest = rest.substring(1);
+// break;
+// }
+// case '%': {
+// tokens_.push_back(ExpressionToken("%", GRN_OP_MODULUS));
+// rest = rest.substring(1);
+// break;
+// }
+// case '@': {
+// if ((rest_size >= 2) && (rest[1] == '^')) {
+// tokens_.push_back(ExpressionToken("@^", GRN_OP_STARTS_WITH));
+// rest = rest.substring(2);
+// } else if ((rest_size >= 2) && (rest[1] == '$')) {
+// tokens_.push_back(ExpressionToken("@$", GRN_OP_ENDS_WITH));
+// rest = rest.substring(2);
+// } else {
+// tokens_.push_back(ExpressionToken("@", GRN_OP_CONTAINS));
+// rest = rest.substring(1);
+// }
+// break;
+// }
+// case '.': {
+// tokens_.push_back(ExpressionToken(".", DEREFERENCE_TOKEN));
+// rest = rest.substring(1);
+// break;
+// }
+ case '(': {
+ tokens_.push_back(ExpressionToken("(", LEFT_ROUND_BRACKET));
+ ++rest;
+ --rest_size;
+ break;
+ }
+ case ')': {
+ tokens_.push_back(ExpressionToken(")", RIGHT_ROUND_BRACKET));
+ ++rest;
+ --rest_size;
+ break;
+ }
+// case '[': {
+// tokens_.push_back(ExpressionToken("[", LEFT_SQUARE_BRACKET));
+// rest = rest.substring(1);
+// break;
+// }
+// case ']': {
+// tokens_.push_back(ExpressionToken("]", RIGHT_SQUARE_BRACKET));
+// rest = rest.substring(1);
+// break;
+// }
+ case '"': {
+ for (pos = 1; pos < rest_size; ++pos) {
+ if (rest[pos] == '\\') {
+ if (pos == rest_size) {
+ break;
+ }
+ ++pos;
+ } else if (rest[pos] == '"') {
+ break;
+ }
+ }
+ if (pos == rest_size) {
+ return GRN_INVALID_ARGUMENT;
+ }
+ tokens_.push_back(
+ ExpressionToken(std::string(rest + 1, pos - 1), CONSTANT_TOKEN));
+ rest += pos + 1;
+ rest_size -= pos + 1;
+ break;
+ }
+ case '0' ... '9': {
+ // TODO: Improve this.
+ for (pos = 1; pos < rest_size; ++pos) {
+ if (!std::isdigit(static_cast<uint8_t>(rest[pos]))) {
+ break;
+ }
+ }
+ tokens_.push_back(
+ ExpressionToken(std::string(rest, pos), CONSTANT_TOKEN));
+ rest += pos;
+ rest_size -= pos;
+ break;
+ }
+ case '_':
+ case 'A' ... 'Z':
+ case 'a' ... 'z': {
+ // TODO: Improve this.
+ for (pos = 1; pos < rest_size; ++pos) {
+ if ((rest[pos] != '_') && (!std::isalnum(rest[pos]))) {
+ break;
+ }
+ }
+ std::string token(rest, pos);
+ if ((token == "true") || (token == "false")) {
+ tokens_.push_back(ExpressionToken(token, CONSTANT_TOKEN));
+ } else {
+ tokens_.push_back(ExpressionToken(token, NAME_TOKEN));
+ }
+ rest += pos;
+ rest_size -= pos;
+ break;
+ }
+ default: {
+ return GRN_INVALID_ARGUMENT;
+ }
+ }
+ }
+ return GRN_SUCCESS;
+}
+
+grn_rc ExpressionParser::compose() {
+ if (tokens_.size() == 0) {
+ return GRN_INVALID_ARGUMENT;
+ }
+ expression_ = new (std::nothrow) Expression(ctx_, table_);
+ grn_rc rc = push_token(ExpressionToken("(", LEFT_ROUND_BRACKET));
+ if (rc == GRN_SUCCESS) {
+ for (size_t i = 0; i < tokens_.size(); ++i) {
+ rc = push_token(tokens_[i]);
+ if (rc != GRN_SUCCESS) {
+ break;
+ }
+ }
+ if (rc == GRN_SUCCESS) {
+ rc = push_token(ExpressionToken(")", RIGHT_ROUND_BRACKET));
+ }
+ }
+ return rc;
+}
+
+grn_rc ExpressionParser::push_token(const ExpressionToken &token) {
+ grn_rc rc = GRN_SUCCESS;
+ switch (token.type()) {
+ case DUMMY_TOKEN: {
+ if ((stack_.size() != 0) && (stack_.back().type() == DUMMY_TOKEN)) {
+ return GRN_INVALID_ARGUMENT;
+ }
+ stack_.push_back(token);
+ break;
+ }
+ case CONSTANT_TOKEN: {
+ grn_obj obj;
+ const std::string string = token.string();
+ if (std::isdigit(static_cast<uint8_t>(string[0]))) {
+ if (string.find_first_of('.') == string.npos) {
+ GRN_INT64_INIT(&obj, 0);
+ GRN_INT64_SET(ctx_, &obj, strtoll(string.c_str(), NULL, 10));
+ } else {
+ GRN_FLOAT_INIT(&obj, 0);
+ GRN_FLOAT_SET(ctx_, &obj, strtod(string.c_str(), NULL));
+ }
+ } else if (string == "true") {
+ GRN_BOOL_INIT(&obj, 0);
+ GRN_BOOL_SET(ctx_, &obj, GRN_TRUE);
+ } else if (string == "false") {
+ GRN_BOOL_INIT(&obj, 0);
+ GRN_BOOL_SET(ctx_, &obj, GRN_FALSE);
+ } else {
+ GRN_TEXT_INIT(&obj, 0);
+ GRN_TEXT_SET(ctx_, &obj, string.data(), string.size());
+ }
+ rc = push_token(ExpressionToken(string, DUMMY_TOKEN));
+ if (rc == GRN_SUCCESS) {
+ rc = expression_->push_object(&obj);
+ }
+ GRN_OBJ_FIN(ctx_, &obj);
+ break;
+ }
+ case NAME_TOKEN: {
+ rc = push_token(ExpressionToken(token.string(), DUMMY_TOKEN));
+ if (rc == GRN_SUCCESS) {
+ grn_obj *column = grn_obj_column(
+ ctx_, table_, token.string().data(), token.string().size());
+ rc = expression_->push_object(column);
+ }
+ break;
+ }
+ case UNARY_OPERATOR_TOKEN: {
+ if ((stack_.size() != 0) && (stack_.back().type() == DUMMY_TOKEN)) {
+ // A unary operator must not follow an operand.
+ return GRN_INVALID_ARGUMENT;
+ }
+ stack_.push_back(token);
+ break;
+ }
+ case BINARY_OPERATOR_TOKEN: {
+ if ((stack_.size() == 0) || (stack_.back().type() != DUMMY_TOKEN)) {
+ // A binary operator must follow an operand.
+ return GRN_INVALID_ARGUMENT;
+ }
+ // Apply previous operators if those are prior to the new operator.
+ while (stack_.size() >= 2) {
+ ExpressionToken operator_token = stack_[stack_.size() - 2];
+// if (operator_token.type() == DEREFERENCE_TOKEN) {
+// expression_->end_subexpression();
+// stack_.pop_back();
+// stack_.pop_back();
+// push_token(ExpressionToken("", DUMMY_TOKEN));
+// } else if (operator_token.type() == UNARY_OPERATOR_TOKEN) {
+ if (operator_token.type() == UNARY_OPERATOR_TOKEN) {
+ rc = expression_->push_operator(operator_token.operator_type());
+ if (rc == GRN_SUCCESS) {
+ stack_.pop_back();
+ stack_.pop_back();
+ rc = push_token(ExpressionToken("", DUMMY_TOKEN));
+ }
+ } else if ((operator_token.type() == BINARY_OPERATOR_TOKEN) &&
+ (operator_token.priority() <= token.priority())) {
+ rc = expression_->push_operator(operator_token.operator_type());
+ if (rc == GRN_SUCCESS) {
+ stack_.pop_back();
+ stack_.pop_back();
+ stack_.pop_back();
+ rc = push_token(ExpressionToken("", DUMMY_TOKEN));
+ }
+ } else {
+ break;
+ }
+ if (rc != GRN_SUCCESS) {
+ return rc;
+ }
+ }
+ stack_.push_back(token);
+ break;
+ }
+// case DEREFERENCE_TOKEN: {
+// builder_->begin_subexpression();
+// stack_.pop_back();
+// stack_.push_back(token);
+// break;
+// }
+ case BRACKET_TOKEN: {
+ if (token.bracket_type() == LEFT_ROUND_BRACKET) {
+ // A left round bracket must not follow a dummy.
+ if ((stack_.size() != 0) && (stack_.back().type() == DUMMY_TOKEN)) {
+ return GRN_INVALID_ARGUMENT;
+ }
+ stack_.push_back(token);
+ } else if (token.bracket_type() == RIGHT_ROUND_BRACKET) {
+ // A right round bracket must follow a dummy.
+ // A left round bracket must exist before a right round bracket.
+ if ((stack_.size() < 2) || (stack_.back().type() != DUMMY_TOKEN)) {
+ return GRN_INVALID_ARGUMENT;
+ }
+ // Apply operators in brackets.
+ while (stack_.size() >= 2) {
+ ExpressionToken operator_token = stack_[stack_.size() - 2];
+// if (operator_token.type() == DEREFERENCE_TOKEN) {
+// rc = expression_->end_subexpression();
+// if (rc == GRN_SUCCESS) {
+// stack_.pop_back();
+// stack_.pop_back();
+// rc = push_token(ExpressionToken("", DUMMY_TOKEN));
+// }
+// } else if (operator_token.type() == UNARY_OPERATOR_TOKEN) {
+ if (operator_token.type() == UNARY_OPERATOR_TOKEN) {
+ rc = expression_->push_operator(operator_token.operator_type());
+ if (rc == GRN_SUCCESS) {
+ stack_.pop_back();
+ stack_.pop_back();
+ rc = push_token(ExpressionToken("", DUMMY_TOKEN));
+ }
+ } else if (operator_token.type() == BINARY_OPERATOR_TOKEN) {
+ rc = expression_->push_operator(operator_token.operator_type());
+ if (rc == GRN_SUCCESS) {
+ stack_.pop_back();
+ stack_.pop_back();
+ stack_.pop_back();
+ rc = push_token(ExpressionToken("", DUMMY_TOKEN));
+ }
+ } else {
+ break;
+ }
+ if (rc != GRN_SUCCESS) {
+ return rc;
+ }
+ }
+ if ((stack_.size() < 2) ||
+ (stack_[stack_.size() - 2].type() != BRACKET_TOKEN) ||
+ (stack_[stack_.size() - 2].bracket_type() != LEFT_ROUND_BRACKET)) {
+ return GRN_INVALID_ARGUMENT;
+ }
+ stack_[stack_.size() - 2] = stack_.back();
+ stack_.pop_back();
+// } else if (token.bracket_type() == LEFT_SQUARE_BRACKET) {
+// // A left square bracket must follow a dummy.
+// if ((stack_.size() == 0) || (stack_.back().type() != DUMMY_TOKEN)) {
+// return GRN_INVALID_ARGUMENT;
+// }
+// stack_.push_back(token);
+// } else if (token.bracket_type() == RIGHT_SQUARE_BRACKET) {
+// // A right round bracket must follow a dummy.
+// // A left round bracket must exist before a right round bracket.
+// if ((stack_.size() < 2) || (stack_.back().type() != DUMMY_TOKEN)) {
+// return GRN_INVALID_ARGUMENT;
+// }
+// // Apply operators in bracket.
+// while (stack_.size() >= 2) {
+// ExpressionToken operator_token = stack_[stack_.size() - 2];
+// if (operator_token.type() == DEREFERENCE_TOKEN) {
+// builder_->end_subexpression();
+// stack_.pop_back();
+// stack_.pop_back();
+// push_token(ExpressionToken("", DUMMY_TOKEN));
+// } else if (operator_token.type() == UNARY_OPERATOR_TOKEN) {
+// builder_->push_operator(operator_token.operator_type());
+// stack_.pop_back();
+// stack_.pop_back();
+// push_token(ExpressionToken("", DUMMY_TOKEN));
+// } else if (operator_token.type() == BINARY_OPERATOR_TOKEN) {
+// builder_->push_operator(operator_token.operator_type());
+// stack_.pop_back();
+// stack_.pop_back();
+// stack_.pop_back();
+// push_token(ExpressionToken("", DUMMY_TOKEN));
+// } else {
+// break;
+// }
+// }
+// if ((stack_.size() < 2) ||
+// (stack_[stack_.size() - 2].type() != BRACKET_TOKEN) ||
+// (stack_[stack_.size() - 2].bracket_type() != LEFT_SQUARE_BRACKET)) {
+// return GRN_INVALID_ARGUMENT;
+// }
+// stack_.pop_back();
+// stack_.pop_back();
+// builder_->push_operator(GRNXX_SUBSCRIPT);
+ } else {
+ return GRN_INVALID_ARGUMENT;
+ }
+ break;
+ }
+ default: {
+ return GRN_INVALID_ARGUMENT;
+ }
+ }
+ return rc;
+}
+
+// -- Expression --
+
+Expression::Expression(grn_ctx *ctx, grn_obj *table)
+ : ctx_(ctx), table_(table), type_(GRN_EGN_INCOMPLETE),
+ data_type_(GRN_DB_VOID), stack_() {}
+
+Expression::~Expression() {
+ for (size_t i = 0; i < stack_.size(); ++i) {
+ delete stack_[i];
+ }
+}
+
+grn_rc Expression::open(
+ grn_ctx *ctx, grn_obj *table, Expression **expression) {
+ if (!ctx || !grn_egn_is_table(table) || !expression) {
+ return GRN_INVALID_ARGUMENT;
+ }
+ Expression *new_expression = new (std::nothrow) Expression(ctx, table);
+ if (!new_expression) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ *expression = new_expression;
+ return GRN_SUCCESS;
+}
+
+grn_rc Expression::parse(grn_ctx *ctx, grn_obj *table,
+ const char *query, size_t query_size, Expression **expression) {
+ if (!ctx || !grn_egn_is_table(table) ||
+ !query || (query_size == 0) || !expression) {
+ return GRN_INVALID_ARGUMENT;
+ }
+ return ExpressionParser::parse(ctx, table, query, query_size, expression);
+}
+
+grn_rc Expression::push_object(grn_obj *obj) {
+ if (!obj) {
+ return GRN_INVALID_ARGUMENT;
+ }
+ grn_rc rc = GRN_UNKNOWN_ERROR;
+ switch (obj->header.type) {
+ case GRN_BULK: {
+ rc = push_bulk_object(obj);
+ break;
+ }
+ case GRN_UVECTOR: {
+ // FIXME: To be supported.
+ return GRN_INVALID_ARGUMENT;
+ }
+ case GRN_VECTOR: {
+ // FIXME: To be supported.
+ return GRN_INVALID_ARGUMENT;
+ }
+ case GRN_ACCESSOR: {
+ grn_accessor *accessor = (grn_accessor *)obj;
+ switch (accessor->action) {
+ case GRN_ACCESSOR_GET_ID: {
+ ExpressionNode *node;
+ rc = IDNode::open(&node);
+ if (rc == GRN_SUCCESS) try {
+ stack_.push_back(node);
+ } catch (const std::bad_alloc &) {
+ delete node;
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ break;
+ }
+ case GRN_ACCESSOR_GET_KEY: {
+ // TODO: KeyNode should be provided for performance.
+ ExpressionNode *node;
+ grn_id range = grn_obj_get_range(ctx_, obj);
+ switch (range) {
+ case GRN_DB_BOOL: {
+ rc = ColumnNode<Bool>::open(ctx_, obj, &node);
+ break;
+ }
+ case GRN_DB_INT8:
+ case GRN_DB_INT16:
+ case GRN_DB_INT32:
+ case GRN_DB_INT64:
+ case GRN_DB_UINT8:
+ case GRN_DB_UINT16:
+ case GRN_DB_UINT32:
+ case GRN_DB_UINT64: {
+ rc = ColumnNode<Int>::open(ctx_, obj, &node);
+ break;
+ }
+ case GRN_DB_FLOAT: {
+ rc = ColumnNode<Float>::open(ctx_, obj, &node);
+ break;
+ }
+ case GRN_DB_TIME: {
+ rc = ColumnNode<Time>::open(ctx_, obj, &node);
+ break;
+ }
+ case GRN_DB_TOKYO_GEO_POINT:
+ case GRN_DB_WGS84_GEO_POINT: {
+ rc = ColumnNode<GeoPoint>::open(ctx_, obj, &node);
+ break;
+ }
+ default: {
+ return GRN_INVALID_ARGUMENT;
+ }
+ }
+ if (rc == GRN_SUCCESS) try {
+ stack_.push_back(node);
+ } catch (const std::bad_alloc &) {
+ delete node;
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ break;
+ }
+ case GRN_ACCESSOR_GET_VALUE: {
+ // TODO
+ return GRN_INVALID_ARGUMENT;
+ }
+ case GRN_ACCESSOR_GET_SCORE: {
+ ExpressionNode *node;
+ rc = ScoreNode::open(&node);
+ if (rc == GRN_SUCCESS) try {
+ stack_.push_back(node);
+ } catch (const std::bad_alloc &) {
+ delete node;
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ break;
+ }
+ default: {
+ return GRN_INVALID_ARGUMENT;
+ }
+ }
+ break;
+ }
+ case GRN_COLUMN_FIX_SIZE:
+ case GRN_COLUMN_VAR_SIZE: {
+ rc = push_column_object(obj);
+ break;
+ }
+ default: {
+ return GRN_INVALID_ARGUMENT;
+ }
+ }
+ if (rc == GRN_SUCCESS) {
+ update_types();
+ }
+ return rc;
+}
+
+grn_rc Expression::push_operator(OperatorType operator_type) {
+ grn_rc rc = GRN_UNKNOWN_ERROR;
+ ExpressionNode *node;
+ switch (operator_type) {
+ case GRN_OP_NOT: {
+ if (stack_.size() < 1) {
+ return GRN_INVALID_FORMAT;
+ }
+ ExpressionNode *arg = stack_[stack_.size() - 1];
+ rc = create_unary_node(operator_type, arg, &node);
+ if (rc == GRN_SUCCESS) {
+ stack_.resize(stack_.size() - 1);
+ }
+ break;
+ }
+ case GRN_OP_AND:
+ case GRN_OP_OR:
+ case GRN_OP_EQUAL:
+ case GRN_OP_NOT_EQUAL:
+ case GRN_OP_LESS:
+ case GRN_OP_LESS_EQUAL:
+ case GRN_OP_GREATER:
+ case GRN_OP_GREATER_EQUAL: {
+ if (stack_.size() < 2) {
+ return GRN_INVALID_FORMAT;
+ }
+ ExpressionNode *arg1 = stack_[stack_.size() - 2];
+ ExpressionNode *arg2 = stack_[stack_.size() - 1];
+ rc = create_binary_node(operator_type, arg1, arg2, &node);
+ if (rc == GRN_SUCCESS) {
+ stack_.resize(stack_.size() - 2);
+ }
+ break;
+ }
+ default: {
+ return GRN_INVALID_ARGUMENT;
+ }
+ }
+ if (rc == GRN_SUCCESS) {
+ stack_.push_back(node);
+ update_types();
+ }
+ return rc;
+}
+
+grn_rc Expression::filter(
+ Record *input, size_t input_size,
+ Record *output, size_t *output_size) {
+ if ((!input && (input_size != 0)) ||
+ ((output > input) && (output < (input + input_size))) || !output_size) {
+ return GRN_INVALID_ARGUMENT;
+ }
+ ExpressionNode *root = this->root();
+ if (!root) {
+ return GRN_UNKNOWN_ERROR;
+ }
+ if (!output) {
+ output = input;
+ }
+ size_t total_output_size = 0;
+ while (input_size > 0) {
+ size_t batch_input_size = GRN_EGN_MAX_BATCH_SIZE;
+ if (input_size < batch_input_size) {
+ batch_input_size = input_size;
+ }
+ size_t batch_output_size;
+ grn_rc rc = root->filter(
+ input, batch_input_size, output, &batch_output_size);
+ if (rc != GRN_SUCCESS) {
+ return rc;
+ }
+ input += batch_input_size;
+ input_size -= batch_input_size;
+ output += batch_output_size;
+ total_output_size += batch_output_size;
+ }
+ *output_size = total_output_size;
+ return GRN_SUCCESS;
+}
+
+grn_rc Expression::adjust(Record *records, size_t num_records) {
+ if (!records && (num_records != 0)) {
+ return GRN_INVALID_ARGUMENT;
+ }
+ ExpressionNode *root = this->root();
+ if (!root) {
+ return GRN_UNKNOWN_ERROR;
+ }
+ while (num_records > 0) {
+ size_t batch_size = GRN_EGN_MAX_BATCH_SIZE;
+ if (num_records < batch_size) {
+ batch_size = num_records;
+ }
+ grn_rc rc = root->adjust(records, batch_size);
+ if (rc != GRN_SUCCESS) {
+ return rc;
+ }
+ records += batch_size;
+ num_records -= batch_size;
+ }
+ return GRN_SUCCESS;
+}
+
+template <typename T>
+grn_rc Expression::evaluate(
+ const Record *records, size_t num_records, T *results) {
+ if (((!records || !results) && (num_records != 0)) ||
+ (T::data_type() != data_type())) {
+ return GRN_INVALID_ARGUMENT;
+ }
+ ExpressionNode *root = this->root();
+ if (!root) {
+ return GRN_UNKNOWN_ERROR;
+ }
+ // FIXME: Records should be processed per block.
+ // However, the contents of old blocks will be lost.
+ return static_cast<TypedNode<T> *>(root)->evaluate(
+ records, num_records, results);
+}
+
+template grn_rc Expression::evaluate(
+ const Record *records, size_t num_records, Bool *results);
+template grn_rc Expression::evaluate(
+ const Record *records, size_t num_records, Int *results);
+template grn_rc Expression::evaluate(
+ const Record *records, size_t num_records, Float *results);
+template grn_rc Expression::evaluate(
+ const Record *records, size_t num_records, Time *results);
+template grn_rc Expression::evaluate(
+ const Record *records, size_t num_records, Text *results);
+template grn_rc Expression::evaluate(
+ const Record *records, size_t num_records, GeoPoint *results);
+
+ExpressionNode *Expression::root() const {
+ if (stack_.size() != 1) {
+ return NULL;
+ }
+ return stack_.front();
+}
+
+void Expression::update_types() {
+ ExpressionNode *root = this->root();
+ if (!root) {
+ type_ = GRN_EGN_INCOMPLETE;
+ data_type_ = GRN_DB_VOID;
+ } else {
+ switch (root->type()) {
+ case GRN_EGN_ID_NODE: {
+ type_ = GRN_EGN_ID;
+ break;
+ }
+ case GRN_EGN_SCORE_NODE: {
+ type_ = GRN_EGN_SCORE;
+ break;
+ }
+ case GRN_EGN_CONSTANT_NODE: {
+ type_ = GRN_EGN_CONSTANT;
+ break;
+ }
+ case GRN_EGN_COLUMN_NODE:
+ case GRN_EGN_OPERATOR_NODE: {
+ type_ = GRN_EGN_VARIABLE;
+ break;
+ }
+ default: {
+ type_ = GRN_EGN_INCOMPLETE;
+ break;
+ }
+ }
+ data_type_ = root->data_type();
+ }
+}
+
+grn_rc Expression::push_bulk_object(grn_obj *obj) {
+ grn_rc rc;
+ ExpressionNode *node;
+ switch (obj->header.domain) {
+ case GRN_DB_BOOL: {
+ rc = ConstantNode<Bool>::open(Bool(GRN_BOOL_VALUE(obj)), &node);
+ break;
+ }
+ case GRN_DB_INT8: {
+ rc = ConstantNode<Int>::open(Int(GRN_INT8_VALUE(obj)), &node);
+ break;
+ }
+ case GRN_DB_INT16: {
+ rc = ConstantNode<Int>::open(Int(GRN_INT16_VALUE(obj)), &node);
+ break;
+ }
+ case GRN_DB_INT32: {
+ rc = ConstantNode<Int>::open(Int(GRN_INT32_VALUE(obj)), &node);
+ break;
+ }
+ case GRN_DB_INT64: {
+ rc = ConstantNode<Int>::open(Int(GRN_INT64_VALUE(obj)), &node);
+ break;
+ }
+ case GRN_DB_UINT8: {
+ rc = ConstantNode<Int>::open(Int(GRN_UINT8_VALUE(obj)), &node);
+ break;
+ }
+ case GRN_DB_UINT16: {
+ rc = ConstantNode<Int>::open(Int(GRN_UINT16_VALUE(obj)), &node);
+ break;
+ }
+ case GRN_DB_UINT32: {
+ rc = ConstantNode<Int>::open(Int(GRN_UINT32_VALUE(obj)), &node);
+ break;
+ }
+ case GRN_DB_UINT64: {
+ // FIXME: Type conversion from UInt64 to Int may lose the content.
+ rc = ConstantNode<Int>::open(Int(GRN_UINT64_VALUE(obj)), &node);
+ break;
+ }
+ case GRN_DB_FLOAT: {
+ rc = ConstantNode<Float>::open(Float(GRN_FLOAT_VALUE(obj)), &node);
+ break;
+ }
+ case GRN_DB_TIME: {
+ rc = ConstantNode<Time>::open(Time(GRN_TIME_VALUE(obj)), &node);
+ break;
+ }
+ case GRN_DB_SHORT_TEXT:
+ case GRN_DB_TEXT:
+ case GRN_DB_LONG_TEXT: {
+ Text value(GRN_TEXT_VALUE(obj), GRN_TEXT_LEN(obj));
+ rc = ConstantNode<Text>::open(value, &node);
+ break;
+ }
+ // TODO: TokyoGeoPoint and Wgs84GeoPoint should be provided?
+ case GRN_DB_TOKYO_GEO_POINT:
+ case GRN_DB_WGS84_GEO_POINT: {
+ GeoPoint value;
+ GRN_GEO_POINT_VALUE(obj, value.raw.latitude, value.raw.longitude);
+ rc = ConstantNode<GeoPoint>::open(value, &node);
+ break;
+ }
+ default: {
+ return GRN_INVALID_ARGUMENT;
+ }
+ }
+ if (rc == GRN_SUCCESS) try {
+ stack_.push_back(node);
+ } catch (const std::bad_alloc &) {
+ delete node;
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ return rc;
+}
+
+grn_rc Expression::push_column_object(grn_obj *obj) {
+ grn_obj *owner_table = grn_column_table(ctx_, obj);
+ if (owner_table != table_) {
+ return GRN_INVALID_ARGUMENT;
+ }
+ grn_id range = grn_obj_get_range(ctx_, obj);
+ grn_rc rc;
+ ExpressionNode *node;
+ switch (obj->header.type) {
+ case GRN_COLUMN_FIX_SIZE: {
+ switch (range) {
+ case GRN_DB_BOOL: {
+ rc = ColumnNode<Bool>::open(ctx_, obj, &node);
+ break;
+ }
+ case GRN_DB_INT8:
+ case GRN_DB_INT16:
+ case GRN_DB_INT32:
+ case GRN_DB_INT64:
+ case GRN_DB_UINT8:
+ case GRN_DB_UINT16:
+ case GRN_DB_UINT32:
+ case GRN_DB_UINT64: {
+ rc = ColumnNode<Int>::open(ctx_, obj, &node);
+ break;
+ }
+ case GRN_DB_FLOAT: {
+ rc = ColumnNode<Float>::open(ctx_, obj, &node);
+ break;
+ }
+ case GRN_DB_TIME: {
+ rc = ColumnNode<Time>::open(ctx_, obj, &node);
+ break;
+ }
+ case GRN_DB_TOKYO_GEO_POINT:
+ case GRN_DB_WGS84_GEO_POINT: {
+ rc = ColumnNode<GeoPoint>::open(ctx_, obj, &node);
+ break;
+ }
+ default: {
+ return GRN_INVALID_ARGUMENT;
+ }
+ }
+ break;
+ }
+ case GRN_COLUMN_VAR_SIZE: {
+ grn_obj_flags column_type = obj->header.flags & GRN_OBJ_COLUMN_TYPE_MASK;
+ switch (column_type) {
+ case GRN_OBJ_COLUMN_SCALAR: {
+ switch (range) {
+ case GRN_DB_SHORT_TEXT:
+ case GRN_DB_TEXT:
+ case GRN_DB_LONG_TEXT: {
+ rc = ColumnNode<Text>::open(ctx_, obj, &node);
+ break;
+ }
+ default: {
+ return GRN_INVALID_ARGUMENT;
+ }
+ break;
+ }
+ break;
+ }
+ case GRN_OBJ_COLUMN_VECTOR: {
+ return GRN_OPERATION_NOT_SUPPORTED;
+ }
+ default: {
+ return GRN_INVALID_ARGUMENT;
+ }
+ }
+ break;
+ }
+ default: {
+ return GRN_INVALID_ARGUMENT;
+ }
+ }
+ if (rc == GRN_SUCCESS) try {
+ stack_.push_back(node);
+ } catch (const std::bad_alloc &) {
+ delete node;
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ return rc;
+}
+
+grn_rc Expression::create_unary_node(OperatorType operator_type,
+ ExpressionNode *arg, ExpressionNode **node) {
+ grn_rc rc = GRN_SUCCESS;
+ switch (operator_type) {
+ case GRN_OP_NOT: {
+ if (arg->data_type() != GRN_DB_BOOL) {
+ return GRN_UNKNOWN_ERROR;
+ }
+ rc = LogicalNotNode::open(arg, node);
+ break;
+ }
+ default: {
+ return GRN_INVALID_ARGUMENT;
+ }
+ }
+ return rc;
+}
+
+grn_rc Expression::create_binary_node(OperatorType operator_type,
+ ExpressionNode *arg1, ExpressionNode *arg2, ExpressionNode **node) {
+ switch (operator_type) {
+ case GRN_OP_AND: {
+ if ((arg1->data_type() != GRN_DB_BOOL) ||
+ (arg1->data_type() != GRN_DB_BOOL)) {
+ return GRN_INVALID_FORMAT;
+ }
+ return LogicalAndNode::open(arg1, arg2, node);
+ }
+ case GRN_OP_OR: {
+ if ((arg1->data_type() != GRN_DB_BOOL) ||
+ (arg1->data_type() != GRN_DB_BOOL)) {
+ return GRN_INVALID_FORMAT;
+ }
+ return LogicalOrNode::open(arg1, arg2, node);
+ }
+ case GRN_OP_EQUAL: {
+ if (arg1->data_type() != arg2->data_type()) {
+ return GRN_INVALID_FORMAT;
+ }
+ switch (arg1->data_type()) {
+ case GRN_DB_BOOL: {
+ return equal_node_open(EqualOperator<Bool>(), arg1, arg2, node);
+ }
+ case GRN_DB_INT64: {
+ return equal_node_open(EqualOperator<Int>(), arg1, arg2, node);
+ }
+ case GRN_DB_FLOAT: {
+ return equal_node_open(EqualOperator<Float>(), arg1, arg2, node);
+ }
+ case GRN_DB_TIME: {
+ return equal_node_open(EqualOperator<Time>(), arg1, arg2, node);
+ }
+ case GRN_DB_TEXT: {
+ return equal_node_open(EqualOperator<Text>(), arg1, arg2, node);
+ }
+ case GRN_DB_WGS84_GEO_POINT: {
+ return equal_node_open(EqualOperator<GeoPoint>(), arg1, arg2, node);
+ }
+ default: {
+ return GRN_UNKNOWN_ERROR;
+ }
+ }
+ }
+ case GRN_OP_NOT_EQUAL: {
+ if (arg1->data_type() != arg2->data_type()) {
+ return GRN_INVALID_FORMAT;
+ }
+ switch (arg1->data_type()) {
+ case GRN_DB_BOOL: {
+ return not_equal_node_open(
+ NotEqualOperator<Bool>(), arg1, arg2, node);
+ }
+ case GRN_DB_INT64: {
+ return not_equal_node_open(
+ NotEqualOperator<Int>(), arg1, arg2, node);
+ }
+ case GRN_DB_FLOAT: {
+ return not_equal_node_open(
+ NotEqualOperator<Float>(), arg1, arg2, node);
+ }
+ case GRN_DB_TIME: {
+ return not_equal_node_open(
+ NotEqualOperator<Time>(), arg1, arg2, node);
+ }
+ case GRN_DB_TEXT: {
+ return not_equal_node_open(
+ NotEqualOperator<Text>(), arg1, arg2, node);
+ }
+ case GRN_DB_WGS84_GEO_POINT: {
+ return not_equal_node_open(
+ NotEqualOperator<GeoPoint>(), arg1, arg2, node);
+ }
+ default: {
+ return GRN_UNKNOWN_ERROR;
+ }
+ }
+ }
+ case GRN_OP_LESS: {
+ if (arg1->data_type() != arg2->data_type()) {
+ return GRN_INVALID_FORMAT;
+ }
+ switch (arg1->data_type()) {
+ case GRN_DB_INT64: {
+ return less_node_open(LessOperator<Int>(), arg1, arg2, node);
+ }
+ case GRN_DB_FLOAT: {
+ return less_node_open(LessOperator<Float>(), arg1, arg2, node);
+ }
+ case GRN_DB_TIME: {
+ return less_node_open(LessOperator<Time>(), arg1, arg2, node);
+ }
+ case GRN_DB_TEXT: {
+ return less_node_open(LessOperator<Text>(), arg1, arg2, node);
+ }
+ default: {
+ return GRN_UNKNOWN_ERROR;
+ }
+ }
+ }
+ case GRN_OP_LESS_EQUAL: {
+ if (arg1->data_type() != arg2->data_type()) {
+ return GRN_INVALID_FORMAT;
+ }
+ switch (arg1->data_type()) {
+ case GRN_DB_INT64: {
+ return less_equal_node_open(
+ LessEqualOperator<Int>(), arg1, arg2, node);
+ }
+ case GRN_DB_FLOAT: {
+ return less_equal_node_open(
+ LessEqualOperator<Float>(), arg1, arg2, node);
+ }
+ case GRN_DB_TIME: {
+ return less_equal_node_open(
+ LessEqualOperator<Time>(), arg1, arg2, node);
+ }
+ case GRN_DB_TEXT: {
+ return less_equal_node_open(
+ LessEqualOperator<Text>(), arg1, arg2, node);
+ }
+ default: {
+ return GRN_UNKNOWN_ERROR;
+ }
+ }
+ }
+ case GRN_OP_GREATER: {
+ if (arg1->data_type() != arg2->data_type()) {
+ return GRN_INVALID_FORMAT;
+ }
+ switch (arg1->data_type()) {
+ case GRN_DB_INT64: {
+ return greater_node_open(GreaterOperator<Int>(), arg1, arg2, node);
+ }
+ case GRN_DB_FLOAT: {
+ return greater_node_open(GreaterOperator<Float>(), arg1, arg2, node);
+ }
+ case GRN_DB_TIME: {
+ return greater_node_open(GreaterOperator<Time>(), arg1, arg2, node);
+ }
+ case GRN_DB_TEXT: {
+ return greater_node_open(GreaterOperator<Text>(), arg1, arg2, node);
+ }
+ default: {
+ return GRN_UNKNOWN_ERROR;
+ }
+ }
+ }
+ case GRN_OP_GREATER_EQUAL: {
+ if (arg1->data_type() != arg2->data_type()) {
+ return GRN_INVALID_FORMAT;
+ }
+ switch (arg1->data_type()) {
+ case GRN_DB_INT64: {
+ return greater_equal_node_open(
+ GreaterEqualOperator<Int>(), arg1, arg2, node);
+ }
+ case GRN_DB_FLOAT: {
+ return greater_equal_node_open(
+ GreaterEqualOperator<Float>(), arg1, arg2, node);
+ }
+ case GRN_DB_TIME: {
+ return greater_equal_node_open(
+ GreaterEqualOperator<Time>(), arg1, arg2, node);
+ }
+ case GRN_DB_TEXT: {
+ return greater_equal_node_open(
+ GreaterEqualOperator<Text>(), arg1, arg2, node);
+ }
+ default: {
+ return GRN_UNKNOWN_ERROR;
+ }
+ }
+ }
+ default: {
+ return GRN_INVALID_ARGUMENT;
+ }
+ }
+}
+
+} // namespace egn
+} // namespace grn
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+static grn_rc
+grn_egn_select_filter(grn_ctx *ctx, grn_obj *table,
+ const char *filter, size_t filter_size,
+ int offset, int limit,
+ std::vector<grn_egn_record> *records,
+ size_t *num_hits) {
+ if (offset < 0) {
+ offset = 0;
+ }
+ if (limit < 0) {
+ limit = std::numeric_limits<int>::max();
+ }
+ grn::egn::Cursor *cursor;
+ grn_rc rc = grn::egn::Cursor::open_table_cursor(ctx, table, &cursor);
+ if (rc == GRN_SUCCESS) {
+ grn::egn::Expression *expression;
+ rc = grn::egn::Expression::parse(
+ ctx, table, filter, filter_size, &expression);
+ if (rc == GRN_SUCCESS) {
+ size_t count = 0;
+ for ( ; ; ) {
+ size_t records_offset = records->size();
+ try {
+ records->resize(records->size() + GRN_EGN_MAX_BATCH_SIZE);
+ } catch (const std::bad_alloc &) {
+ rc = GRN_NO_MEMORY_AVAILABLE;
+ break;
+ }
+ size_t batch_size;
+ rc = cursor->read(&(*records)[records_offset],
+ GRN_EGN_MAX_BATCH_SIZE, &batch_size);
+ if (rc != GRN_SUCCESS) {
+ break;
+ }
+ if (batch_size == 0) {
+ records->resize(records_offset);
+ break;
+ }
+ rc = expression->filter(&(*records)[records_offset], batch_size,
+ NULL, &batch_size);
+ if (rc != GRN_SUCCESS) {
+ break;
+ }
+ count += batch_size;
+ if (offset > 0) {
+ if (offset >= batch_size) {
+ offset -= batch_size;
+ batch_size = 0;
+ } else {
+ std::memcpy(&(*records)[0], &(*records)[offset],
+ sizeof(grn_egn_record) * (batch_size - offset));
+ batch_size -= offset;
+ offset = 0;
+ }
+ }
+ if (limit >= batch_size) {
+ limit -= batch_size;
+ } else {
+ batch_size = limit;
+ limit = 0;
+ }
+ records->resize(records_offset + batch_size);
+ }
+ delete expression;
+ *num_hits = count;
+ }
+ delete cursor;
+ }
+ return rc;
+}
+
+static grn_rc
+grn_egn_select_output(grn_ctx *ctx, grn_obj *table,
+ const char *output_columns, size_t output_columns_size,
+ const grn_egn_record *records, size_t num_records,
+ size_t num_hits) {
+ grn_rc rc = GRN_SUCCESS;
+ std::vector<std::string> names;
+ std::vector<grn::egn::Expression *> expressions;
+
+ const char *rest = output_columns;
+ size_t rest_size = output_columns_size;
+ while (rest_size != 0) {
+ size_t pos;
+ for (pos = 0; pos < rest_size; ++pos) {
+ if ((rest[pos] != ',') &&
+ !std::isspace(static_cast<unsigned char>(rest[pos]))) {
+ break;
+ }
+ }
+ if (pos >= rest_size) {
+ break;
+ }
+ rest += pos;
+ rest_size -= pos;
+ for (pos = 0; pos < rest_size; ++pos) {
+ if ((rest[pos] == ',') ||
+ std::isspace(static_cast<unsigned char>(rest[pos]))) {
+ break;
+ }
+ }
+ // TODO: Error handling.
+ std::string name(rest, pos);
+ if (name == "*") {
+ grn_hash *columns;
+ if ((columns = grn_hash_create(ctx, NULL, sizeof(grn_id), 0,
+ GRN_OBJ_TABLE_HASH_KEY|GRN_HASH_TINY))) {
+ if (grn_table_columns(ctx, table, "", 0, (grn_obj *)columns)) {
+ grn_id *key;
+ GRN_HASH_EACH(ctx, columns, id, &key, NULL, NULL, {
+ grn_obj *column = grn_ctx_at(ctx, *key);
+ if (column) {
+ char name_buf[1024];
+ int name_size = grn_column_name(
+ ctx, column, name_buf, sizeof(name_buf));
+ grn::egn::Expression *expression;
+ grn_rc r = grn::egn::Expression::open(ctx, table, &expression);
+ if (r == GRN_SUCCESS) {
+ r = expression->push_object(column);
+ if (r == GRN_SUCCESS) {
+ names.push_back(std::string(name_buf, name_size));
+ expressions.push_back(expression);
+ }
+ }
+ }
+ });
+ }
+ grn_hash_close(ctx, columns);
+ }
+ } else {
+ grn::egn::Expression *expression;
+ grn_rc r = grn::egn::Expression::parse(
+ ctx, table, rest, pos, &expression);
+ if (r == GRN_SUCCESS) {
+ names.push_back(name);
+ expressions.push_back(expression);
+ }
+ }
+ if (pos >= rest_size) {
+ break;
+ }
+ rest += pos + 1;
+ rest_size -= pos + 1;
+ }
+
+ GRN_OUTPUT_ARRAY_OPEN("RESULT", 1);
+ GRN_OUTPUT_ARRAY_OPEN("RESULTSET", 2 + num_records);
+ GRN_OUTPUT_ARRAY_OPEN("NHITS", 1);
+ grn_text_ulltoa(ctx, ctx->impl->outbuf, num_hits);
+ GRN_OUTPUT_ARRAY_CLOSE(); // NHITS.
+ GRN_OUTPUT_ARRAY_OPEN("COLUMNS", expressions.size());
+ for (size_t i = 0; i < expressions.size(); ++i) {
+ GRN_OUTPUT_ARRAY_OPEN("COLUMN", 2);
+ GRN_TEXT_PUTC(ctx, ctx->impl->outbuf, '"');
+ GRN_TEXT_PUT(ctx, ctx->impl->outbuf, names[i].data(), names[i].size());
+ GRN_TEXT_PUT(ctx, ctx->impl->outbuf, "\",\"", 3);
+ switch (expressions[i]->data_type()) {
+ case GRN_DB_BOOL: {
+ GRN_TEXT_PUTS(ctx, ctx->impl->outbuf, "Bool");
+ break;
+ }
+ case GRN_DB_INT64: {
+ GRN_TEXT_PUTS(ctx, ctx->impl->outbuf, "Int64");
+ break;
+ }
+ case GRN_DB_FLOAT: {
+ GRN_TEXT_PUTS(ctx, ctx->impl->outbuf, "Float");
+ break;
+ }
+ case GRN_DB_TIME: {
+ GRN_TEXT_PUTS(ctx, ctx->impl->outbuf, "Time");
+ break;
+ }
+ case GRN_DB_SHORT_TEXT:
+ case GRN_DB_TEXT:
+ case GRN_DB_LONG_TEXT: {
+ GRN_TEXT_PUTS(ctx, ctx->impl->outbuf, "Text");
+ break;
+ }
+ case GRN_DB_WGS84_GEO_POINT: {
+ GRN_TEXT_PUTS(ctx, ctx->impl->outbuf, "GeoPoint");
+ break;
+ }
+ default: {
+ GRN_TEXT_PUTS(ctx, ctx->impl->outbuf, "N/A");
+ break;
+ }
+ }
+ GRN_TEXT_PUTC(ctx, ctx->impl->outbuf, '"');
+ GRN_OUTPUT_ARRAY_CLOSE();
+ }
+ GRN_OUTPUT_ARRAY_CLOSE(); // COLUMNS.
+ if (num_records != 0) {
+ size_t count = 0;
+ std::vector<std::vector<char> > bufs(expressions.size());
+ while (count < num_records) {
+ size_t batch_size = GRN_EGN_MAX_BATCH_SIZE;
+ if (batch_size > (num_records - count)) {
+ batch_size = num_records - count;
+ }
+ for (size_t i = 0; i < expressions.size(); ++i) {
+ switch (expressions[i]->data_type()) {
+ case GRN_DB_BOOL: {
+ bufs[i].resize(sizeof(grn_egn_bool) * batch_size);
+ expressions[i]->evaluate(records + count, batch_size,
+ (grn::egn::Bool *)&bufs[i][0]);
+ break;
+ }
+ case GRN_DB_INT64: {
+ bufs[i].resize(sizeof(grn_egn_int) * batch_size);
+ expressions[i]->evaluate(records + count, batch_size,
+ (grn::egn::Int *)&bufs[i][0]);
+ break;
+ }
+ case GRN_DB_FLOAT: {
+ bufs[i].resize(sizeof(grn_egn_float) * batch_size);
+ expressions[i]->evaluate(records + count, batch_size,
+ (grn::egn::Float *)&bufs[i][0]);
+ break;
+ }
+ case GRN_DB_TIME: {
+ bufs[i].resize(sizeof(grn_egn_time) * batch_size);
+ expressions[i]->evaluate(records + count, batch_size,
+ (grn::egn::Time *)&bufs[i][0]);
+ break;
+ }
+ case GRN_DB_TEXT: {
+ bufs[i].resize(sizeof(grn_egn_text) * batch_size);
+ expressions[i]->evaluate(records + count, batch_size,
+ (grn::egn::Text *)&bufs[i][0]);
+ break;
+ }
+ case GRN_DB_WGS84_GEO_POINT: {
+ bufs[i].resize(sizeof(grn_egn_geo_point) * batch_size);
+ expressions[i]->evaluate(records + count, batch_size,
+ (grn::egn::GeoPoint *)&bufs[i][0]);
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ }
+ for (size_t i = 0; i < batch_size; ++i) {
+ GRN_OUTPUT_ARRAY_OPEN("HIT", expressions.size());
+ for (size_t j = 0; j < expressions.size(); ++j) {
+ if (j != 0) {
+ GRN_TEXT_PUTC(ctx, ctx->impl->outbuf, ',');
+ }
+ switch (expressions[j]->data_type()) {
+ case GRN_DB_BOOL: {
+ if (((grn_egn_bool *)&bufs[j][0])[i]) {
+ GRN_TEXT_PUT(ctx, ctx->impl->outbuf, "true", 4);
+ } else {
+ GRN_TEXT_PUT(ctx, ctx->impl->outbuf, "false", 5);
+ }
+ break;
+ }
+ case GRN_DB_INT64: {
+ grn_text_lltoa(ctx, ctx->impl->outbuf,
+ ((grn_egn_int *)&bufs[j][0])[i]);
+ break;
+ }
+ case GRN_DB_FLOAT: {
+ grn_text_ftoa(ctx, ctx->impl->outbuf,
+ ((grn_egn_float *)&bufs[j][0])[i]);
+ break;
+ }
+ case GRN_DB_TIME: {
+ grn_text_ftoa(ctx, ctx->impl->outbuf,
+ ((grn_egn_time *)&bufs[j][0])[i] * 0.000001);
+ break;
+ }
+ case GRN_DB_TEXT: {
+ grn_egn_text text = ((grn_egn_text *)&bufs[j][0])[i];
+ grn_text_esc(ctx, ctx->impl->outbuf, text.ptr, text.size);
+ break;
+ }
+ case GRN_DB_WGS84_GEO_POINT: {
+ grn_egn_geo_point geo_point =
+ ((grn_egn_geo_point *)&bufs[j][0])[i];
+ GRN_TEXT_PUTC(ctx, ctx->impl->outbuf, '"');
+ grn_text_itoa(ctx, ctx->impl->outbuf, geo_point.latitude);
+ GRN_TEXT_PUTC(ctx, ctx->impl->outbuf, 'x');
+ grn_text_itoa(ctx, ctx->impl->outbuf, geo_point.longitude);
+ GRN_TEXT_PUTC(ctx, ctx->impl->outbuf, '"');
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ }
+ GRN_OUTPUT_ARRAY_CLOSE(); // HITS.
+ }
+ count += batch_size;
+ }
+ }
+ GRN_OUTPUT_ARRAY_CLOSE(); // RESULTSET.
+ GRN_OUTPUT_ARRAY_CLOSE(); // RESET.
+ for (size_t i = 0; i < expressions.size(); ++i) {
+ delete expressions[i];
+ }
+ return rc;
+}
+
+grn_rc
+grn_egn_select(grn_ctx *ctx, grn_obj *table,
+ const char *filter, size_t filter_size,
+ const char *output_columns, size_t output_columns_size,
+ int offset, int limit) {
+ if (!ctx || !grn_egn_is_table(table) || (!filter && (filter_size != 0)) ||
+ (!output_columns && (output_columns_size != 0))) {
+ return GRN_INVALID_ARGUMENT;
+ }
+ std::vector<grn_egn_record> records;
+ size_t num_hits;
+ grn_rc rc = grn_egn_select_filter(ctx, table, filter, filter_size,
+ offset, limit, &records, &num_hits);
+ if (rc == GRN_SUCCESS) {
+ rc = grn_egn_select_output(ctx, table, output_columns, output_columns_size,
+ &*records.begin(), records.size(), num_hits);
+ }
+ return rc;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GRN_WITH_EGN
diff --git a/storage/mroonga/vendor/groonga/lib/error.c b/storage/mroonga/vendor/groonga/lib/error.c
index e14ef3754fd..561394231ea 100644
--- a/storage/mroonga/vendor/groonga/lib/error.c
+++ b/storage/mroonga/vendor/groonga/lib/error.c
@@ -62,3 +62,17 @@ grn_current_error_message(void)
return strerror(errno);
}
#endif
+
+const char *
+grn_strerror(int error_code)
+{
+#ifdef WIN32
+# define MESSAGE_BUFFER_SIZE 1024
+ static char message[MESSAGE_BUFFER_SIZE];
+ strerror_s(message, MESSAGE_BUFFER_SIZE, error_code);
+ return message;
+# undef MESSAGE_BUFFER_SIZE
+#else /* WIN32 */
+ return strerror(error_code);
+#endif /* WIN32 */
+}
diff --git a/storage/mroonga/vendor/groonga/lib/expr.c b/storage/mroonga/vendor/groonga/lib/expr.c
index f13502a0f14..9ce1fa0adfc 100644
--- a/storage/mroonga/vendor/groonga/lib/expr.c
+++ b/storage/mroonga/vendor/groonga/lib/expr.c
@@ -22,6 +22,7 @@
#include "grn_ii.h"
#include "grn_geo.h"
#include "grn_expr.h"
+#include "grn_expr_code.h"
#include "grn_util.h"
#include "grn_mrb.h"
#include "mrb/mrb_expr.h"
@@ -782,8 +783,9 @@ grn_expr_append_obj(grn_ctx *ctx, grn_obj *expr, grn_obj *obj, grn_operator op,
for (i = 0; i < nargs; i++) {
int rest_n_codes = 1;
while (rest_n_codes > 0) {
- if (!code->value) {
- rest_n_codes += code->nargs;
+ rest_n_codes += code->nargs;
+ if (code->value) {
+ rest_n_codes--;
}
rest_n_codes--;
code--;
@@ -1274,7 +1276,10 @@ grn_proc_call(grn_ctx *ctx, grn_obj *proc, int nargs, grn_obj *caller)
}
#define PUSH1(v) do {\
- if (EXPRVP(v)) { vp++; }\
+ if (EXPRVP(v)) {\
+ vp++;\
+ if (vp - e->values > e->values_tail) { e->values_tail = vp - e->values; }\
+ }\
s1 = s0;\
*sp++ = s0 = v;\
} while (0)
@@ -1301,6 +1306,7 @@ grn_proc_call(grn_ctx *ctx, grn_obj *proc, int nargs, grn_obj *caller)
} else {\
if (sp < s_ + 1) { ERR(GRN_INVALID_ARGUMENT, "stack underflow"); goto exit; }\
sp[-1] = s0 = value = vp++;\
+ if (vp - e->values > e->values_tail) { e->values_tail = vp - e->values; }\
s0->header.impl_flags |= GRN_OBJ_EXPRVALUE;\
}\
} while (0)
@@ -1314,6 +1320,7 @@ grn_proc_call(grn_ctx *ctx, grn_obj *proc, int nargs, grn_obj *caller)
if (sp < s_ + 1) { ERR(GRN_INVALID_ARGUMENT, "stack underflow"); goto exit; }\
s1 = sp[-2];\
sp[-1] = s0 = value = vp++;\
+ if (vp - e->values > e->values_tail) { e->values_tail = vp - e->values; }\
s0->header.impl_flags |= GRN_OBJ_EXPRVALUE;\
} while (0)
@@ -2226,11 +2233,11 @@ grn_proc_call(grn_ctx *ctx, grn_obj *proc, int nargs, grn_obj *caller)
} while (0)
inline static void
-grn_expr_exec_get_member(grn_ctx *ctx,
- grn_obj *expr,
- grn_obj *column_and_record_id,
- grn_obj *index,
- grn_obj *result)
+grn_expr_exec_get_member_vector(grn_ctx *ctx,
+ grn_obj *expr,
+ grn_obj *column_and_record_id,
+ grn_obj *index,
+ grn_obj *result)
{
grn_obj *column;
grn_id record_id;
@@ -2268,6 +2275,34 @@ grn_expr_exec_get_member(grn_ctx *ctx,
GRN_OBJ_FIN(ctx, &values);
}
+inline static void
+grn_expr_exec_get_member_table(grn_ctx *ctx,
+ grn_obj *expr,
+ grn_obj *table,
+ grn_obj *key,
+ grn_obj *result)
+{
+ grn_id id;
+
+ if (table->header.domain == key->header.domain) {
+ id = grn_table_get(ctx, table, GRN_BULK_HEAD(key), GRN_BULK_VSIZE(key));
+ } else {
+ grn_obj casted_key;
+ GRN_OBJ_INIT(&casted_key, GRN_BULK, 0, table->header.domain);
+ if (grn_obj_cast(ctx, key, &casted_key, GRN_FALSE) == GRN_SUCCESS) {
+ id = grn_table_get(ctx, table,
+ GRN_BULK_HEAD(&casted_key),
+ GRN_BULK_VSIZE(&casted_key));
+ } else {
+ id = GRN_ID_NIL;
+ }
+ GRN_OBJ_FIN(ctx, &casted_key);
+ }
+
+ grn_obj_reinit(ctx, result, DB_OBJ(table)->id, 0);
+ GRN_RECORD_SET(ctx, result, id);
+}
+
static inline grn_bool
grn_expr_exec_is_simple_expr(grn_ctx *ctx, grn_obj *expr)
{
@@ -3045,16 +3080,16 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
break;
case GRN_OP_GEO_DISTANCE1 :
{
- grn_obj *e;
+ grn_obj *value;
double lng1, lat1, lng2, lat2, x, y, d;
- POP1(e);
- lng1 = GEO_INT2RAD(GRN_INT32_VALUE(e));
- POP1(e);
- lat1 = GEO_INT2RAD(GRN_INT32_VALUE(e));
- POP1(e);
- lng2 = GEO_INT2RAD(GRN_INT32_VALUE(e));
- POP1ALLOC1(e, res);
- lat2 = GEO_INT2RAD(GRN_INT32_VALUE(e));
+ POP1(value);
+ lng1 = GEO_INT2RAD(GRN_INT32_VALUE(value));
+ POP1(value);
+ lat1 = GEO_INT2RAD(GRN_INT32_VALUE(value));
+ POP1(value);
+ lng2 = GEO_INT2RAD(GRN_INT32_VALUE(value));
+ POP1ALLOC1(value, res);
+ lat2 = GEO_INT2RAD(GRN_INT32_VALUE(value));
x = (lng2 - lng1) * cos((lat1 + lat2) * 0.5);
y = (lat2 - lat1);
d = sqrt((x * x) + (y * y)) * GEO_RADIOUS;
@@ -3066,16 +3101,16 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
break;
case GRN_OP_GEO_DISTANCE2 :
{
- grn_obj *e;
+ grn_obj *value;
double lng1, lat1, lng2, lat2, x, y, d;
- POP1(e);
- lng1 = GEO_INT2RAD(GRN_INT32_VALUE(e));
- POP1(e);
- lat1 = GEO_INT2RAD(GRN_INT32_VALUE(e));
- POP1(e);
- lng2 = GEO_INT2RAD(GRN_INT32_VALUE(e));
- POP1ALLOC1(e, res);
- lat2 = GEO_INT2RAD(GRN_INT32_VALUE(e));
+ POP1(value);
+ lng1 = GEO_INT2RAD(GRN_INT32_VALUE(value));
+ POP1(value);
+ lat1 = GEO_INT2RAD(GRN_INT32_VALUE(value));
+ POP1(value);
+ lng2 = GEO_INT2RAD(GRN_INT32_VALUE(value));
+ POP1ALLOC1(value, res);
+ lat2 = GEO_INT2RAD(GRN_INT32_VALUE(value));
x = sin(fabs(lng2 - lng1) * 0.5);
y = sin(fabs(lat2 - lat1) * 0.5);
d = asin(sqrt((y * y) + cos(lat1) * cos(lat2) * x * x)) * 2 * GEO_RADIOUS;
@@ -3087,16 +3122,16 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
break;
case GRN_OP_GEO_DISTANCE3 :
{
- grn_obj *e;
+ grn_obj *value;
double lng1, lat1, lng2, lat2, p, q, m, n, x, y, d;
- POP1(e);
- lng1 = GEO_INT2RAD(GRN_INT32_VALUE(e));
- POP1(e);
- lat1 = GEO_INT2RAD(GRN_INT32_VALUE(e));
- POP1(e);
- lng2 = GEO_INT2RAD(GRN_INT32_VALUE(e));
- POP1ALLOC1(e, res);
- lat2 = GEO_INT2RAD(GRN_INT32_VALUE(e));
+ POP1(value);
+ lng1 = GEO_INT2RAD(GRN_INT32_VALUE(value));
+ POP1(value);
+ lat1 = GEO_INT2RAD(GRN_INT32_VALUE(value));
+ POP1(value);
+ lng2 = GEO_INT2RAD(GRN_INT32_VALUE(value));
+ POP1ALLOC1(value, res);
+ lat2 = GEO_INT2RAD(GRN_INT32_VALUE(value));
p = (lat1 + lat2) * 0.5;
q = (1 - GEO_BES_C3 * sin(p) * sin(p));
m = GEO_BES_C1 / sqrt(q * q * q);
@@ -3112,16 +3147,16 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
break;
case GRN_OP_GEO_DISTANCE4 :
{
- grn_obj *e;
+ grn_obj *value;
double lng1, lat1, lng2, lat2, p, q, m, n, x, y, d;
- POP1(e);
- lng1 = GEO_INT2RAD(GRN_INT32_VALUE(e));
- POP1(e);
- lat1 = GEO_INT2RAD(GRN_INT32_VALUE(e));
- POP1(e);
- lng2 = GEO_INT2RAD(GRN_INT32_VALUE(e));
- POP1ALLOC1(e, res);
- lat2 = GEO_INT2RAD(GRN_INT32_VALUE(e));
+ POP1(value);
+ lng1 = GEO_INT2RAD(GRN_INT32_VALUE(value));
+ POP1(value);
+ lat1 = GEO_INT2RAD(GRN_INT32_VALUE(value));
+ POP1(value);
+ lng2 = GEO_INT2RAD(GRN_INT32_VALUE(value));
+ POP1ALLOC1(value, res);
+ lat2 = GEO_INT2RAD(GRN_INT32_VALUE(value));
p = (lat1 + lat2) * 0.5;
q = (1 - GEO_GRS_C3 * sin(p) * sin(p));
m = GEO_GRS_C1 / sqrt(q * q * q);
@@ -3138,26 +3173,26 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
case GRN_OP_GEO_WITHINP5 :
{
int r;
- grn_obj *e;
+ grn_obj *value;
double lng0, lat0, lng1, lat1, x, y, d;
- POP1(e);
- lng0 = GEO_INT2RAD(GRN_INT32_VALUE(e));
- POP1(e);
- lat0 = GEO_INT2RAD(GRN_INT32_VALUE(e));
- POP1(e);
- lng1 = GEO_INT2RAD(GRN_INT32_VALUE(e));
- POP1(e);
- lat1 = GEO_INT2RAD(GRN_INT32_VALUE(e));
- POP1ALLOC1(e, res);
+ POP1(value);
+ lng0 = GEO_INT2RAD(GRN_INT32_VALUE(value));
+ POP1(value);
+ lat0 = GEO_INT2RAD(GRN_INT32_VALUE(value));
+ POP1(value);
+ lng1 = GEO_INT2RAD(GRN_INT32_VALUE(value));
+ POP1(value);
+ lat1 = GEO_INT2RAD(GRN_INT32_VALUE(value));
+ POP1ALLOC1(value, res);
x = (lng1 - lng0) * cos((lat0 + lat1) * 0.5);
y = (lat1 - lat0);
d = sqrt((x * x) + (y * y)) * GEO_RADIOUS;
- switch (e->header.domain) {
+ switch (value->header.domain) {
case GRN_DB_INT32 :
- r = d <= GRN_INT32_VALUE(e);
+ r = d <= GRN_INT32_VALUE(value);
break;
case GRN_DB_FLOAT :
- r = d <= GRN_FLOAT_VALUE(e);
+ r = d <= GRN_FLOAT_VALUE(value);
break;
default :
r = 0;
@@ -3172,20 +3207,20 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
case GRN_OP_GEO_WITHINP6 :
{
int r;
- grn_obj *e;
+ grn_obj *value;
double lng0, lat0, lng1, lat1, lng2, lat2, x, y, d;
- POP1(e);
- lng0 = GEO_INT2RAD(GRN_INT32_VALUE(e));
- POP1(e);
- lat0 = GEO_INT2RAD(GRN_INT32_VALUE(e));
- POP1(e);
- lng1 = GEO_INT2RAD(GRN_INT32_VALUE(e));
- POP1(e);
- lat1 = GEO_INT2RAD(GRN_INT32_VALUE(e));
- POP1(e);
- lng2 = GEO_INT2RAD(GRN_INT32_VALUE(e));
- POP1ALLOC1(e, res);
- lat2 = GEO_INT2RAD(GRN_INT32_VALUE(e));
+ POP1(value);
+ lng0 = GEO_INT2RAD(GRN_INT32_VALUE(value));
+ POP1(value);
+ lat0 = GEO_INT2RAD(GRN_INT32_VALUE(value));
+ POP1(value);
+ lng1 = GEO_INT2RAD(GRN_INT32_VALUE(value));
+ POP1(value);
+ lat1 = GEO_INT2RAD(GRN_INT32_VALUE(value));
+ POP1(value);
+ lng2 = GEO_INT2RAD(GRN_INT32_VALUE(value));
+ POP1ALLOC1(value, res);
+ lat2 = GEO_INT2RAD(GRN_INT32_VALUE(value));
x = (lng1 - lng0) * cos((lat0 + lat1) * 0.5);
y = (lat1 - lat0);
d = (x * x) + (y * y);
@@ -3201,24 +3236,24 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
case GRN_OP_GEO_WITHINP8 :
{
int r;
- grn_obj *e;
+ grn_obj *value;
int64_t ln0, la0, ln1, la1, ln2, la2, ln3, la3;
- POP1(e);
- ln0 = GRN_INT32_VALUE(e);
- POP1(e);
- la0 = GRN_INT32_VALUE(e);
- POP1(e);
- ln1 = GRN_INT32_VALUE(e);
- POP1(e);
- la1 = GRN_INT32_VALUE(e);
- POP1(e);
- ln2 = GRN_INT32_VALUE(e);
- POP1(e);
- la2 = GRN_INT32_VALUE(e);
- POP1(e);
- ln3 = GRN_INT32_VALUE(e);
- POP1ALLOC1(e, res);
- la3 = GRN_INT32_VALUE(e);
+ POP1(value);
+ ln0 = GRN_INT32_VALUE(value);
+ POP1(value);
+ la0 = GRN_INT32_VALUE(value);
+ POP1(value);
+ ln1 = GRN_INT32_VALUE(value);
+ POP1(value);
+ la1 = GRN_INT32_VALUE(value);
+ POP1(value);
+ ln2 = GRN_INT32_VALUE(value);
+ POP1(value);
+ la2 = GRN_INT32_VALUE(value);
+ POP1(value);
+ ln3 = GRN_INT32_VALUE(value);
+ POP1ALLOC1(value, res);
+ la3 = GRN_INT32_VALUE(value);
r = ((ln2 <= ln0) && (ln0 <= ln3) && (la2 <= la0) && (la0 <= la3));
GRN_INT32_SET(ctx, res, r);
res->header.type = GRN_BULK;
@@ -3458,9 +3493,15 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
break;
case GRN_OP_GET_MEMBER :
{
- grn_obj *column_and_record_id, *index;
- POP2ALLOC1(column_and_record_id, index, res);
- grn_expr_exec_get_member(ctx, expr, column_and_record_id, index, res);
+ grn_obj *receiver, *index_or_key;
+ POP2ALLOC1(receiver, index_or_key, res);
+ if (receiver->header.type == GRN_PTR) {
+ grn_obj *index = index_or_key;
+ grn_expr_exec_get_member_vector(ctx, expr, receiver, index, res);
+ } else {
+ grn_obj *key = index_or_key;
+ grn_expr_exec_get_member_table(ctx, expr, receiver, key, res);
+ }
code++;
}
break;
@@ -5996,7 +6037,7 @@ resolve_top_level_name(grn_ctx *ctx, const char *name, unsigned int name_size)
}
static grn_rc
-get_identifier(grn_ctx *ctx, efs_info *q)
+get_identifier(grn_ctx *ctx, efs_info *q, grn_obj *name_resolve_context)
{
const char *s;
unsigned int len;
@@ -6072,6 +6113,14 @@ done :
grn_obj *obj;
const char *name = q->cur;
unsigned int name_size = s - q->cur;
+ if (name_resolve_context) {
+ if ((obj = grn_obj_column(ctx, name_resolve_context, name, name_size))) {
+ grn_expr_take_obj(ctx, q->e, obj);
+ PARSE(GRN_EXPR_TOKEN_IDENTIFIER);
+ grn_expr_append_obj(ctx, q->e, obj, GRN_OP_GET_VALUE, 2);
+ goto exit;
+ }
+ }
if ((obj = grn_expr_get_var(ctx, q->e, name, name_size))) {
PARSE(GRN_EXPR_TOKEN_IDENTIFIER);
grn_expr_append_obj(ctx, q->e, obj, GRN_OP_PUSH, 1);
@@ -6108,11 +6157,59 @@ set_tos_minor_to_curr(grn_ctx *ctx, efs_info *q)
yytos->minor.yy0 = ((grn_expr *)(q->e))->codes_curr;
}
+static grn_obj *
+parse_script_extract_name_resolve_context(grn_ctx *ctx, efs_info *q)
+{
+ grn_expr *expr = (grn_expr *)(q->e);
+ grn_expr_code *code_start;
+ grn_expr_code *code_last;
+
+ if (expr->codes_curr == 0) {
+ return NULL;
+ }
+
+ code_start = expr->codes;
+ code_last = code_start + (expr->codes_curr - 1);
+ switch (code_last->op) {
+ case GRN_OP_GET_MEMBER :
+ {
+ unsigned int n_used_codes_for_key;
+ grn_expr_code *code_key;
+ grn_expr_code *code_receiver;
+
+ code_key = code_last - 1;
+ if (code_key < code_start) {
+ return NULL;
+ }
+
+ n_used_codes_for_key = grn_expr_code_n_used_codes(ctx,
+ code_start,
+ code_key);
+ if (n_used_codes_for_key == 0) {
+ return NULL;
+ }
+ code_receiver = code_key - n_used_codes_for_key;
+ if (code_receiver < code_start) {
+ return NULL;
+ }
+ return code_receiver->value;
+ }
+ break;
+ default :
+ /* TODO: Support other operators. */
+ return NULL;
+ break;
+ }
+}
+
static grn_rc
parse_script(grn_ctx *ctx, efs_info *q)
{
grn_rc rc = GRN_SUCCESS;
+ grn_obj *name_resolve_context = NULL;
for (;;) {
+ grn_obj *current_name_resolve_context = name_resolve_context;
+ name_resolve_context = NULL;
skip_space(ctx, q);
if (q->cur >= q->str_end) { rc = GRN_END_OF_DATA; goto exit; }
switch (*q->cur) {
@@ -6150,6 +6247,7 @@ parse_script(grn_ctx *ctx, efs_info *q)
break;
case '.' :
PARSE(GRN_EXPR_TOKEN_DOT);
+ name_resolve_context = parse_script_extract_name_resolve_context(ctx, q);
q->cur++;
break;
case ':' :
@@ -6538,7 +6636,9 @@ parse_script(grn_ctx *ctx, efs_info *q)
}
break;
default :
- if ((rc = get_identifier(ctx, q))) { goto exit; }
+ if ((rc = get_identifier(ctx, q, current_name_resolve_context))) {
+ goto exit;
+ }
break;
}
if (ctx->rc) { rc = ctx->rc; break; }
diff --git a/storage/mroonga/vendor/groonga/lib/expr_code.c b/storage/mroonga/vendor/groonga/lib/expr_code.c
new file mode 100644
index 00000000000..4f03867402a
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/expr_code.c
@@ -0,0 +1,71 @@
+/* -*- c-basic-offset: 2 -*- */
+/* Copyright(C) 2014-2015 Brazil
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License version 2.1 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "grn_expr_code.h"
+
+unsigned int
+grn_expr_code_n_used_codes(grn_ctx *ctx,
+ grn_expr_code *start,
+ grn_expr_code *target)
+{
+ unsigned int n_codes;
+ int i, n_args;
+ grn_bool have_proc_push_code = GRN_FALSE;
+ grn_expr_code *sub_code;
+
+ if (start == target) {
+ return 0;
+ }
+
+ n_args = target->nargs;
+ if (target->op == GRN_OP_CALL) {
+ if (!target->value) {
+ have_proc_push_code = GRN_TRUE;
+ }
+ } else {
+ if (target->value) {
+ n_args--;
+ if (n_args == 0) {
+ return 1;
+ }
+ }
+ }
+
+ n_codes = 1;
+ sub_code = target - 1;
+ for (i = 0; i < n_args; i++) {
+ int sub_n_codes;
+ sub_n_codes = grn_expr_code_n_used_codes(ctx, start, sub_code);
+ n_codes += sub_n_codes;
+ sub_code -= sub_n_codes;
+ if (sub_code < start) {
+ /* TODO: report error */
+ return 0;
+ }
+ }
+
+ if (have_proc_push_code) {
+ n_codes++;
+ sub_code--;
+ if (sub_code < start) {
+ /* TODO: report error */
+ return 0;
+ }
+ }
+
+ return n_codes;
+}
diff --git a/storage/mroonga/vendor/groonga/lib/grn.h b/storage/mroonga/vendor/groonga/lib/grn.h
index f4ee6e962a9..80622a8421b 100644
--- a/storage/mroonga/vendor/groonga/lib/grn.h
+++ b/storage/mroonga/vendor/groonga/lib/grn.h
@@ -31,17 +31,13 @@
# define __STDC_LIMIT_MACROS
#endif
-#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-#endif /* HAVE_STDLIB_H */
+#include <stdlib.h>
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif /* HAVE_STDINT_H */
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif /* HAVE_SYS_TYPES_H */
+#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
diff --git a/storage/mroonga/vendor/groonga/lib/grn_ctx.h b/storage/mroonga/vendor/groonga/lib/grn_ctx.h
index 2f052f5f1c5..4ba5f3c9bc6 100644
--- a/storage/mroonga/vendor/groonga/lib/grn_ctx.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_ctx.h
@@ -153,7 +153,6 @@ GRN_API void grn_ctx_impl_set_current_error_message(grn_ctx *ctx);
#ifdef WIN32
-#define SYSTEM_ERROR_MESSAGE_BUFFER_SIZE 1024
#define SERR(str) do {\
grn_rc rc;\
const char *system_message;\
@@ -333,8 +332,8 @@ GRN_API void grn_ctx_impl_set_current_error_message(grn_ctx *ctx);
grn_rc rc;\
int errno_keep = errno;\
grn_bool show_errno = GRN_FALSE;\
- char system_message[SYSTEM_ERROR_MESSAGE_BUFFER_SIZE];\
- strerror_s(system_message, SYSTEM_ERROR_MESSAGE_BUFFER_SIZE, errno);\
+ const char *system_message;\
+ system_message = grn_strerror(errno);\
switch (errno_keep) {\
case EPERM : rc = GRN_OPERATION_NOT_PERMITTED; break;\
case ENOENT : rc = GRN_NO_SUCH_FILE_OR_DIRECTORY; break;\
diff --git a/storage/mroonga/vendor/groonga/lib/grn_ctx_impl_mrb.h b/storage/mroonga/vendor/groonga/lib/grn_ctx_impl_mrb.h
index 61cf088b2ae..3e46d2e417f 100644
--- a/storage/mroonga/vendor/groonga/lib/grn_ctx_impl_mrb.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_ctx_impl_mrb.h
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2013 Brazil
+ Copyright(C) 2013-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -26,6 +26,7 @@
extern "C" {
#endif
+void grn_ctx_impl_mrb_init_from_env(void);
void grn_ctx_impl_mrb_init(grn_ctx *ctx);
void grn_ctx_impl_mrb_fin(grn_ctx *ctx);
diff --git a/storage/mroonga/vendor/groonga/lib/grn_dat.h b/storage/mroonga/vendor/groonga/lib/grn_dat.h
index aefd044d0b7..d3c768fa65c 100644
--- a/storage/mroonga/vendor/groonga/lib/grn_dat.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_dat.h
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2011-2014 Brazil
+/* Copyright(C) 2011-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -79,6 +79,8 @@ GRN_API grn_rc grn_dat_clear_status_flags(grn_ctx *ctx, grn_dat *dat);
*/
GRN_API grn_rc grn_dat_repair(grn_ctx *ctx, grn_dat *dat);
+GRN_API grn_rc grn_dat_flush(grn_ctx *ctx, grn_dat *dat);
+
#ifdef __cplusplus
}
#endif
diff --git a/storage/mroonga/vendor/groonga/lib/grn_db.h b/storage/mroonga/vendor/groonga/lib/grn_db.h
index cbc2cccaf4e..6c84ad921f4 100644
--- a/storage/mroonga/vendor/groonga/lib/grn_db.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_db.h
@@ -56,6 +56,8 @@ typedef struct {
grn_id range;
} grn_obj_spec;
+void grn_db_init_from_env(void);
+
GRN_API grn_rc grn_db_close(grn_ctx *ctx, grn_obj *db);
grn_obj *grn_db_keys(grn_obj *s);
diff --git a/storage/mroonga/vendor/groonga/lib/grn_egn.h b/storage/mroonga/vendor/groonga/lib/grn_egn.h
new file mode 100644
index 00000000000..3d1d54ca9aa
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/grn_egn.h
@@ -0,0 +1,90 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 Brazil
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License version 2.1 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef GRN_EGN_H
+#define GRN_EGN_H
+
+#include "grn.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Constant values.
+
+typedef grn_operator grn_egn_operator_type;
+typedef grn_builtin_type grn_egn_data_type;
+
+typedef enum {
+ GRN_EGN_ID_NODE,
+ GRN_EGN_SCORE_NODE,
+ GRN_EGN_CONSTANT_NODE,
+ GRN_EGN_COLUMN_NODE,
+ GRN_EGN_OPERATOR_NODE
+} grn_egn_expression_node_type;
+
+typedef enum {
+ GRN_EGN_INCOMPLETE,
+ GRN_EGN_ID,
+ GRN_EGN_SCORE,
+ GRN_EGN_CONSTANT,
+ GRN_EGN_VARIABLE
+} grn_egn_expression_type;
+
+// Built-in data types.
+
+typedef grn_id grn_egn_id;
+typedef float grn_egn_score;
+typedef struct {
+ grn_egn_id id;
+ grn_egn_score score;
+} grn_egn_record;
+
+typedef grn_bool grn_egn_bool;
+typedef int64_t grn_egn_int;
+typedef double grn_egn_float;
+typedef int64_t grn_egn_time;
+typedef struct {
+ const char *ptr;
+ size_t size;
+} grn_egn_text;
+typedef grn_geo_point grn_egn_geo_point;
+
+/*
+ * grn_egn_select() finds records passing through a filter (specified by
+ * `filter' and `filter_size') and writes the associated values (specified by
+ * `output_columns' and `output_columns_size') into the output buffer of `ctx'
+ * (`ctx->impl->outbuf').
+ *
+ * Note that the first `offset` records will be discarded and at most `limit`
+ * records will be output.
+ *
+ * On success, grn_egn_select() returns GRN_SUCCESS.
+ * On failure, grn_egn_select() returns an error code and set the details into
+ * `ctx`.
+ */
+grn_rc grn_egn_select(grn_ctx *ctx, grn_obj *table,
+ const char *filter, size_t filter_size,
+ const char *output_columns, size_t output_columns_size,
+ int offset, int limit);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_EGN_H */
diff --git a/storage/mroonga/vendor/groonga/lib/grn_egn.hpp b/storage/mroonga/vendor/groonga/lib/grn_egn.hpp
new file mode 100644
index 00000000000..46511afd6ca
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/grn_egn.hpp
@@ -0,0 +1,318 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 Brazil
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License version 2.1 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef GRN_EGN_HPP
+#define GRN_EGN_HPP
+
+#include <cstring>
+#include <vector>
+
+#include "grn_egn.h"
+
+namespace grn {
+namespace egn {
+
+// Constant values.
+
+typedef grn_egn_operator_type OperatorType;
+typedef grn_egn_data_type DataType;
+
+typedef grn_egn_expression_node_type ExpressionNodeType;
+typedef grn_egn_expression_type ExpressionType;
+
+// Built-in data types.
+
+typedef grn_egn_id ID;
+typedef grn_egn_score Score;
+typedef grn_egn_record Record;
+
+//typedef grn_egn_bool Bool;
+//typedef grn_egn_int Int;
+//typedef grn_egn_float Float;
+//typedef grn_egn_time Time;
+//typedef grn_egn_text Text;
+//typedef grn_egn_geo_point GeoPoint;
+
+//inline bool operator==(const Text &lhs, const Text &rhs) {
+// if (lhs.size != rhs.size) {
+// return false;
+// }
+// return std::memcmp(lhs.ptr, rhs.ptr, lhs.size) == 0;
+//}
+//inline bool operator!=(const Text &lhs, const Text &rhs) {
+// if (lhs.size != rhs.size) {
+// return true;
+// }
+// return std::memcmp(lhs.ptr, rhs.ptr, lhs.size) != 0;
+//}
+//inline bool operator<(const Text &lhs, const Text &rhs) {
+// size_t min_size = (lhs.size < rhs.size) ? lhs.size : rhs.size;
+// int result = std::memcmp(lhs.ptr, rhs.ptr, min_size);
+// if (result == 0) {
+// return lhs.size < rhs.size;
+// }
+// return result < 0;
+//}
+//inline bool operator<=(const Text &lhs, const Text &rhs) {
+// size_t min_size = (lhs.size < rhs.size) ? lhs.size : rhs.size;
+// int result = std::memcmp(lhs.ptr, rhs.ptr, min_size);
+// if (result == 0) {
+// return lhs.size <= rhs.size;
+// }
+// return result <= 0;
+//}
+//inline bool operator>(const Text &lhs, const Text &rhs) {
+// return rhs < lhs;
+//}
+//inline bool operator>=(const Text &lhs, const Text &rhs) {
+// return rhs <= lhs;
+//}
+
+//inline bool operator==(const GeoPoint &lhs, const GeoPoint &rhs) {
+// return (lhs.latitude == rhs.latitude) && (lhs.longitude == rhs.longitude);
+//}
+//inline bool operator!=(const GeoPoint &lhs, const GeoPoint &rhs) {
+// return (lhs.latitude != rhs.latitude) || (lhs.longitude != rhs.longitude);
+//}
+
+struct Bool {
+ typedef grn_egn_bool Raw;
+ Raw raw;
+
+ static DataType data_type() {
+ return GRN_DB_BOOL;
+ }
+
+ Bool() : raw() {}
+ Bool(const Bool &value) : raw(value.raw) {}
+ explicit Bool(Raw value) : raw(value) {}
+ ~Bool() {}
+};
+
+inline bool operator!(Bool value) { return !value.raw; }
+inline bool operator==(Bool lhs, Bool rhs) { return lhs.raw == rhs.raw; }
+inline bool operator!=(Bool lhs, Bool rhs) { return lhs.raw != rhs.raw; }
+
+struct Int {
+ typedef grn_egn_int Raw;
+ Raw raw;
+
+ static DataType data_type() {
+ return GRN_DB_INT64;
+ }
+
+ Int() : raw() {}
+ Int(const Int &value) : raw(value.raw) {}
+ explicit Int(Raw value) : raw(value) {}
+ ~Int() {}
+};
+
+inline bool operator==(Int lhs, Int rhs) { return lhs.raw == rhs.raw; }
+inline bool operator!=(Int lhs, Int rhs) { return lhs.raw != rhs.raw; }
+inline bool operator<(Int lhs, Int rhs) { return lhs.raw < rhs.raw; }
+inline bool operator<=(Int lhs, Int rhs) { return lhs.raw <= rhs.raw; }
+inline bool operator>(Int lhs, Int rhs) { return lhs.raw > rhs.raw; }
+inline bool operator>=(Int lhs, Int rhs) { return lhs.raw >= rhs.raw; }
+
+struct Float {
+ typedef grn_egn_float Raw;
+ Raw raw;
+
+ static DataType data_type() {
+ return GRN_DB_FLOAT;
+ }
+
+ Float() : raw() {}
+ Float(const Float &value) : raw(value.raw) {}
+ explicit Float(Raw value) : raw(value) {}
+ ~Float() {}
+};
+
+inline bool operator==(Float lhs, Float rhs) { return lhs.raw == rhs.raw; }
+inline bool operator!=(Float lhs, Float rhs) { return lhs.raw != rhs.raw; }
+inline bool operator<(Float lhs, Float rhs) { return lhs.raw < rhs.raw; }
+inline bool operator<=(Float lhs, Float rhs) { return lhs.raw <= rhs.raw; }
+inline bool operator>(Float lhs, Float rhs) { return lhs.raw > rhs.raw; }
+inline bool operator>=(Float lhs, Float rhs) { return lhs.raw >= rhs.raw; }
+
+struct Time {
+ typedef grn_egn_time Raw;
+ Raw raw;
+
+ static DataType data_type() {
+ return GRN_DB_TIME;
+ }
+
+ Time() : raw() {}
+ Time(const Time &value) : raw(value.raw) {}
+ explicit Time(Raw value) : raw(value) {}
+ ~Time() {}
+};
+
+inline bool operator==(Time lhs, Time rhs) { return lhs.raw == rhs.raw; }
+inline bool operator!=(Time lhs, Time rhs) { return lhs.raw != rhs.raw; }
+inline bool operator<(Time lhs, Time rhs) { return lhs.raw < rhs.raw; }
+inline bool operator<=(Time lhs, Time rhs) { return lhs.raw <= rhs.raw; }
+inline bool operator>(Time lhs, Time rhs) { return lhs.raw > rhs.raw; }
+inline bool operator>=(Time lhs, Time rhs) { return lhs.raw >= rhs.raw; }
+
+struct Text {
+ typedef grn_egn_text Raw;
+ Raw raw;
+
+ static DataType data_type() {
+ return GRN_DB_TEXT;
+ }
+
+ Text() : raw() {}
+ Text(const Text &value) : raw(value.raw) {}
+ explicit Text(const Raw &value) : raw(value) {}
+ Text(const char *ptr, size_t size) : raw((Raw){ptr, size}) {}
+ ~Text() {}
+};
+
+inline bool operator==(const Text &lhs, const Text &rhs) {
+ if (lhs.raw.size != rhs.raw.size) {
+ return false;
+ }
+ return std::memcmp(lhs.raw.ptr, rhs.raw.ptr, lhs.raw.size) == 0;
+}
+inline bool operator!=(const Text &lhs, const Text &rhs) {
+ if (lhs.raw.size != rhs.raw.size) {
+ return true;
+ }
+ return std::memcmp(lhs.raw.ptr, rhs.raw.ptr, lhs.raw.size) != 0;
+}
+inline bool operator<(const Text &lhs, const Text &rhs) {
+ size_t min_size = (lhs.raw.size < rhs.raw.size) ?
+ lhs.raw.size : rhs.raw.size;
+ int result = std::memcmp(lhs.raw.ptr, rhs.raw.ptr, min_size);
+ if (result == 0) {
+ return lhs.raw.size < rhs.raw.size;
+ }
+ return result < 0;
+}
+inline bool operator<=(const Text &lhs, const Text &rhs) {
+ size_t min_size = (lhs.raw.size < rhs.raw.size) ?
+ lhs.raw.size : rhs.raw.size;
+ int result = std::memcmp(lhs.raw.ptr, rhs.raw.ptr, min_size);
+ if (result == 0) {
+ return lhs.raw.size <= rhs.raw.size;
+ }
+ return result <= 0;
+}
+inline bool operator>(const Text &lhs, const Text &rhs) { return rhs < lhs; }
+inline bool operator>=(const Text &lhs, const Text &rhs) { return rhs <= lhs; }
+
+struct GeoPoint {
+ typedef grn_egn_geo_point Raw;
+ Raw raw;
+
+ static DataType data_type() {
+ return GRN_DB_WGS84_GEO_POINT;
+ }
+
+ GeoPoint() : raw() {}
+ GeoPoint(const GeoPoint &value) : raw(value.raw) {}
+ explicit GeoPoint(Raw value) : raw(value) {}
+ GeoPoint(int latitude, int longitude) : raw((Raw){ latitude, longitude }) {}
+ ~GeoPoint() {}
+};
+
+inline bool operator==(GeoPoint lhs, GeoPoint rhs) {
+ return (lhs.raw.latitude == rhs.raw.latitude) &&
+ (lhs.raw.longitude == rhs.raw.longitude);
+}
+inline bool operator!=(GeoPoint lhs, GeoPoint rhs) {
+ return (lhs.raw.latitude != rhs.raw.latitude) ||
+ (lhs.raw.longitude != rhs.raw.longitude);
+}
+
+// Cursor is a base class which provides an interface for sequential access to
+// records.
+class Cursor {
+ public:
+ Cursor() {}
+ virtual ~Cursor() {}
+
+ // FIXME: Give me options.
+ static grn_rc open_table_cursor(grn_ctx *ctx, grn_obj *table,
+ Cursor **cursor);
+
+ virtual grn_rc read(Record *records, size_t size, size_t *count);
+};
+
+// ExpressionNode is an element of Expression.
+class ExpressionNode;
+
+// Expression is a class which represents an expression.
+class Expression {
+ public:
+ Expression(grn_ctx *ctx, grn_obj *table);
+ ~Expression();
+
+ static grn_rc open(grn_ctx *ctx, grn_obj *table, Expression **expression);
+ static grn_rc parse(grn_ctx *ctx, grn_obj *table,
+ const char *query, size_t query_size,
+ Expression **expression);
+
+ ExpressionType type() const {
+ return type_;
+ }
+ DataType data_type() const {
+ return data_type_;
+ }
+
+ grn_rc push_object(grn_obj *obj);
+ grn_rc push_operator(grn_operator operator_type);
+
+ grn_rc filter(Record *input, size_t input_size,
+ Record *output, size_t *output_size);
+ grn_rc adjust(Record *records, size_t num_records);
+
+ template <typename T>
+ grn_rc evaluate(const Record *records, size_t num_records, T *results);
+
+ private:
+ grn_ctx *ctx_;
+ grn_obj *table_;
+ ExpressionType type_;
+ DataType data_type_;
+ std::vector<ExpressionNode *> stack_;
+
+ // Disable copy and assignment.
+ Expression(const Expression &);
+ Expression &operator=(const Expression &);
+
+ ExpressionNode *root() const;
+
+ void update_types();
+
+ grn_rc push_bulk_object(grn_obj *obj);
+ grn_rc push_column_object(grn_obj *obj);
+
+ grn_rc create_unary_node(OperatorType operator_type,
+ ExpressionNode *arg, ExpressionNode **node);
+ grn_rc create_binary_node(OperatorType operator_type,
+ ExpressionNode *arg1, ExpressionNode *arg2, ExpressionNode **node);
+};
+
+} // namespace egn
+} // namespace grn
+
+#endif // GRN_EGN_HPP
diff --git a/storage/mroonga/vendor/groonga/lib/grn_error.h b/storage/mroonga/vendor/groonga/lib/grn_error.h
index 2581f934135..a0b18ca7183 100644
--- a/storage/mroonga/vendor/groonga/lib/grn_error.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_error.h
@@ -27,6 +27,7 @@ extern "C" {
#endif
GRN_API const char *grn_current_error_message(void);
+GRN_API const char *grn_strerror(int error_code);
#ifdef __cplusplus
}
diff --git a/storage/mroonga/vendor/groonga/lib/grn_expr_code.h b/storage/mroonga/vendor/groonga/lib/grn_expr_code.h
new file mode 100644
index 00000000000..a0fd680e7d4
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/grn_expr_code.h
@@ -0,0 +1,37 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 Brazil
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License version 2.1 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef GRN_EXPR_CODE_H
+#define GRN_EXPR_CODE_H
+
+#include "grn_db.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+unsigned int grn_expr_code_n_used_codes(grn_ctx *ctx,
+ grn_expr_code *start,
+ grn_expr_code *target);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_EXPR_CODE_H */
+
diff --git a/storage/mroonga/vendor/groonga/lib/grn_ii.h b/storage/mroonga/vendor/groonga/lib/grn_ii.h
index fe9b1ec26a4..1ac9528e4cd 100644
--- a/storage/mroonga/vendor/groonga/lib/grn_ii.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_ii.h
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2009-2012 Brazil
+/* Copyright(C) 2009-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -87,6 +87,8 @@ struct _grn_ii_updspec {
typedef struct _grn_ii_updspec grn_ii_updspec;
+void grn_ii_init_from_env(void);
+
GRN_API grn_ii *grn_ii_create(grn_ctx *ctx, const char *path, grn_obj *lexicon,
uint32_t flags);
GRN_API grn_ii *grn_ii_open(grn_ctx *ctx, const char *path, grn_obj *lexicon);
@@ -103,6 +105,7 @@ grn_rc grn_ii_updspec_add(grn_ctx *ctx, grn_ii_updspec *u, int pos, int32_t weig
int grn_ii_updspec_cmp(grn_ii_updspec *a, grn_ii_updspec *b);
void grn_ii_expire(grn_ctx *ctx, grn_ii *ii);
+grn_rc grn_ii_flush(grn_ctx *ctx, grn_ii *ii);
typedef struct {
grn_id rid;
diff --git a/storage/mroonga/vendor/groonga/lib/grn_io.h b/storage/mroonga/vendor/groonga/lib/grn_io.h
index 14f5e496f8b..6de63bd172a 100644
--- a/storage/mroonga/vendor/groonga/lib/grn_io.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_io.h
@@ -350,12 +350,13 @@ uint32_t grn_io_detect_type(grn_ctx *ctx, const char *path);
grn_rc grn_io_set_type(grn_io *io, uint32_t type);
uint32_t grn_io_get_type(grn_io *io);
-grn_rc grn_io_init(void);
-grn_rc grn_io_fin(void);
+void grn_io_init_from_env(void);
uint32_t grn_io_expire(grn_ctx *ctx, grn_io *io, int count_thresh, uint32_t limit);
uint32_t grn_expire(grn_ctx *ctx, int count_thresh, uint32_t limit);
+grn_rc grn_io_flush(grn_ctx *ctx, grn_io *io);
+
/* encode/decode */
#define GRN_B_ENC(v,p) do {\
diff --git a/storage/mroonga/vendor/groonga/lib/grn_mrb.h b/storage/mroonga/vendor/groonga/lib/grn_mrb.h
index 7fae820d342..3726cdcba29 100644
--- a/storage/mroonga/vendor/groonga/lib/grn_mrb.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_mrb.h
@@ -30,6 +30,8 @@
extern "C" {
#endif
+void grn_mrb_init_from_env(void);
+
#ifdef GRN_WITH_MRUBY
GRN_API mrb_value grn_mrb_eval(grn_ctx *ctx, const char *script, int script_length);
GRN_API mrb_value grn_mrb_load(grn_ctx *ctx, const char *path);
diff --git a/storage/mroonga/vendor/groonga/lib/grn_plugin.h b/storage/mroonga/vendor/groonga/lib/grn_plugin.h
index 75b29f56cc9..22749c634aa 100644
--- a/storage/mroonga/vendor/groonga/lib/grn_plugin.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_plugin.h
@@ -46,6 +46,7 @@ struct _grn_plugin {
int refcount;
};
+void grn_plugin_init_from_env(void);
grn_rc grn_plugins_init(void);
grn_rc grn_plugins_fin(void);
grn_id grn_plugin_open(grn_ctx *ctx, const char *filename);
diff --git a/storage/mroonga/vendor/groonga/lib/grn_proc.h b/storage/mroonga/vendor/groonga/lib/grn_proc.h
index fb01698ea69..b75d11079a2 100644
--- a/storage/mroonga/vendor/groonga/lib/grn_proc.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_proc.h
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2009 Brazil
+/* Copyright(C) 2009-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -23,6 +23,8 @@
extern "C" {
#endif
+void grn_proc_init_from_env(void);
+
GRN_VAR const char *grn_document_root;
void grn_db_init_builtin_query(grn_ctx *ctx);
diff --git a/storage/mroonga/vendor/groonga/lib/ii.c b/storage/mroonga/vendor/groonga/lib/ii.c
index 2d32df2fd4d..388e0566756 100644
--- a/storage/mroonga/vendor/groonga/lib/ii.c
+++ b/storage/mroonga/vendor/groonga/lib/ii.c
@@ -74,6 +74,36 @@
# define S_IWUSR 0200
#endif /* S_IWUSR */
+static grn_bool grn_ii_cursor_set_min_enable = GRN_FALSE;
+static double grn_ii_select_too_many_index_match_ratio = -1;
+
+void
+grn_ii_init_from_env(void)
+{
+ {
+ char grn_ii_cursor_set_min_enable_env[GRN_ENV_BUFFER_SIZE];
+ grn_getenv("GRN_II_CURSOR_SET_MIN_ENABLE",
+ grn_ii_cursor_set_min_enable_env,
+ GRN_ENV_BUFFER_SIZE);
+ if (grn_ii_cursor_set_min_enable_env[0]) {
+ grn_ii_cursor_set_min_enable = GRN_TRUE;
+ } else {
+ grn_ii_cursor_set_min_enable = GRN_FALSE;
+ }
+ }
+
+ {
+ char grn_ii_select_too_many_index_match_ratio_env[GRN_ENV_BUFFER_SIZE];
+ grn_getenv("GRN_II_SELECT_TOO_MANY_INDEX_MATCH_RATIO",
+ grn_ii_select_too_many_index_match_ratio_env,
+ GRN_ENV_BUFFER_SIZE);
+ if (grn_ii_select_too_many_index_match_ratio_env[0]) {
+ grn_ii_select_too_many_index_match_ratio =
+ atof(grn_ii_select_too_many_index_match_ratio_env);
+ }
+ }
+}
+
/* segment */
inline static uint32_t
@@ -3492,6 +3522,7 @@ _grn_ii_create(grn_ctx *ctx, grn_ii *ii, const char *path, grn_obj *lexicon, uin
}
if (!chunk) {
grn_io_close(ctx, seg);
+ grn_io_remove(ctx, path);
return NULL;
}
header = grn_io_header(seg);
@@ -3688,6 +3719,19 @@ grn_ii_expire(grn_ctx *ctx, grn_ii *ii)
grn_io_expire(ctx, ii->chunk, 0, 1000000);
}
+grn_rc
+grn_ii_flush(grn_ctx *ctx, grn_ii *ii)
+{
+ grn_rc rc;
+
+ rc = grn_io_flush(ctx, ii->seg);
+ if (rc == GRN_SUCCESS) {
+ rc = grn_io_flush(ctx, ii->chunk);
+ }
+
+ return rc;
+}
+
#define BIT11_01(x) ((x >> 1) & 0x7ff)
#define BIT31_12(x) (x >> 12)
@@ -4023,6 +4067,7 @@ grn_ii_cursor_open(grn_ctx *ctx, grn_ii *ii, grn_id tid,
uint32_t pos, *a;
if (!(a = array_at(ctx, ii, tid))) { return NULL; }
for (;;) {
+ c = NULL;
if (!(pos = a[0])) { goto exit; }
if (!(c = GRN_MALLOC(sizeof(grn_ii_cursor)))) { goto exit; }
memset(c, 0, sizeof(grn_ii_cursor));
@@ -4112,16 +4157,11 @@ exit :
static inline void
grn_ii_cursor_set_min(grn_ctx *ctx, grn_ii_cursor *c, grn_id min)
{
- char grn_ii_cursor_set_min_enable_env[GRN_ENV_BUFFER_SIZE];
-
if (c->min >= min) {
return;
}
- grn_getenv("GRN_II_CURSOR_SET_MIN_ENABLE",
- grn_ii_cursor_set_min_enable_env,
- GRN_ENV_BUFFER_SIZE);
- if (grn_ii_cursor_set_min_enable_env[0]) {
+ if (grn_ii_cursor_set_min_enable) {
c->min = min;
if (c->buf && c->pc.rid < c->min && c->curr_chunk < c->nchunks) {
uint32_t i, skip_chunk = 0;
@@ -6019,6 +6059,77 @@ grn_ii_term_extract(grn_ctx *ctx, grn_ii *ii, const char *string,
return rc;
}
+static grn_rc
+grn_ii_select_regexp(grn_ctx *ctx, grn_ii *ii,
+ const char *string, unsigned int string_len,
+ grn_hash *s, grn_operator op, grn_select_optarg *optarg)
+{
+ grn_rc rc;
+ grn_obj parsed_string;
+ grn_bool escaping = GRN_FALSE;
+ int nth_char = 0;
+ const char *current = string;
+ const char *string_end = string + string_len;
+
+ GRN_TEXT_INIT(&parsed_string, 0);
+ while (current < string_end) {
+ const char *target;
+ int char_len;
+
+ char_len = grn_charlen(ctx, current, string_end);
+ if (char_len == 0) {
+ ERR(GRN_INVALID_ARGUMENT,
+ "[ii][select][regexp] invalid encoding character: <%.*s|%#x|>",
+ (int)(current - string), string,
+ *current);
+ return ctx->rc;
+ }
+ target = current;
+ current += char_len;
+
+ if (escaping) {
+ escaping = GRN_FALSE;
+ if (char_len == 1) {
+ switch (*target) {
+ case 'A' :
+ if (nth_char == 0) {
+ target = GRN_TOKENIZER_BEGIN_MARK_UTF8;
+ char_len = GRN_TOKENIZER_BEGIN_MARK_UTF8_LEN;
+ }
+ break;
+ case 'z' :
+ if (current == string_end) {
+ target = GRN_TOKENIZER_END_MARK_UTF8;
+ char_len = GRN_TOKENIZER_END_MARK_UTF8_LEN;
+ }
+ break;
+ default :
+ break;
+ }
+ }
+ } else {
+ if (char_len == 1 && *target == '\\') {
+ escaping = GRN_TRUE;
+ continue;
+ }
+ }
+
+ GRN_TEXT_PUT(ctx, &parsed_string, target, char_len);
+ nth_char++;
+ }
+
+ if (optarg) {
+ optarg->mode = GRN_OP_MATCH;
+ }
+
+ rc = grn_ii_select(ctx, ii,
+ GRN_TEXT_VALUE(&parsed_string),
+ GRN_TEXT_LEN(&parsed_string),
+ s, op, optarg);
+
+ return rc;
+}
+
#ifdef GRN_II_SELECT_ENABLE_SEQUENTIAL_SEARCH
static grn_bool
grn_ii_select_sequential_search_should_use(grn_ctx *ctx,
@@ -6156,16 +6267,6 @@ grn_ii_select_sequential_search(grn_ctx *ctx,
grn_bool processed = GRN_TRUE;
{
- /* Disabled by default. */
- double too_many_index_match_ratio = -1;
- char too_many_index_match_ratio_env[GRN_ENV_BUFFER_SIZE];
- grn_getenv("GRN_II_SELECT_TOO_MANY_INDEX_MATCH_RATIO",
- too_many_index_match_ratio_env,
- GRN_ENV_BUFFER_SIZE);
- if (too_many_index_match_ratio_env[0]) {
- too_many_index_match_ratio = atof(too_many_index_match_ratio_env);
- }
-
if (!grn_ii_select_sequential_search_should_use(ctx,
ii,
raw_query,
@@ -6176,7 +6277,7 @@ grn_ii_select_sequential_search(grn_ctx *ctx,
optarg,
token_infos,
n_token_infos,
- too_many_index_match_ratio)) {
+ grn_ii_select_too_many_index_match_ratio)) {
return GRN_FALSE;
}
}
@@ -6259,6 +6360,9 @@ grn_ii_select(grn_ctx *ctx, grn_ii *ii, const char *string, unsigned int string_
if (mode == GRN_OP_TERM_EXTRACT) {
return grn_ii_term_extract(ctx, ii, string, string_len, s, op, optarg);
}
+ if (mode == GRN_OP_REGEXP) {
+ return grn_ii_select_regexp(ctx, ii, string, string_len, s, op, optarg);
+ }
/* todo : support subrec
rep = (s->record_unit == grn_rec_position || s->subrec_unit == grn_rec_position);
orp = (s->record_unit == grn_rec_position || op == GRN_OP_OR);
@@ -7907,6 +8011,20 @@ grn_ii_buffer_parse(grn_ctx *ctx, grn_ii_buffer *ii_buffer,
grn_ii_buffer_tokenize(ctx, ii_buffer, rid, sid, 0,
GRN_TEXT_VALUE(&rv), GRN_TEXT_LEN(&rv));
break;
+ case GRN_UVECTOR :
+ {
+ unsigned int i, size;
+ unsigned int element_size;
+
+ size = grn_uvector_size(ctx, &rv);
+ element_size = grn_uvector_element_size(ctx, &rv);
+ for (i = 0; i < size; i++) {
+ grn_ii_buffer_tokenize(ctx, ii_buffer, rid, sid, 0,
+ GRN_BULK_HEAD(&rv) + (element_size * i),
+ element_size);
+ }
+ }
+ break;
case GRN_VECTOR :
if (rv.u.v.body) {
int i;
diff --git a/storage/mroonga/vendor/groonga/lib/io.c b/storage/mroonga/vendor/groonga/lib/io.c
index a78c7f242c9..3cee03f5123 100644
--- a/storage/mroonga/vendor/groonga/lib/io.c
+++ b/storage/mroonga/vendor/groonga/lib/io.c
@@ -30,10 +30,12 @@
#include "grn_ctx_impl.h"
#ifdef WIN32
+# include <io.h>
# include <share.h>
#endif /* WIN32 */
#define GRN_IO_IDSTR "GROONGA:IO:00001"
+#define GRN_IO_IDSTR_LEN (sizeof(GRN_IO_IDSTR) - 1)
#define GRN_IO_VERSION_DEFAULT 1
@@ -99,8 +101,8 @@ inline static int grn_msync(grn_ctx *ctx, void *start, size_t length);
inline static grn_rc grn_pread(grn_ctx *ctx, fileinfo *fi, void *buf, size_t count, off_t offset);
inline static grn_rc grn_pwrite(grn_ctx *ctx, fileinfo *fi, void *buf, size_t count, off_t offset);
-grn_rc
-grn_io_init(void)
+void
+grn_io_init_from_env(void)
{
char version_env[GRN_ENV_BUFFER_SIZE];
@@ -110,14 +112,6 @@ grn_io_init(void)
if (version_env[0]) {
grn_io_version_default = atoi(version_env);
}
-
- return GRN_SUCCESS;
-}
-
-grn_rc
-grn_io_fin(void)
-{
- return GRN_SUCCESS;
}
static inline uint32_t
@@ -320,7 +314,12 @@ grn_io_create(grn_ctx *ctx, const char *path, uint32_t header_size, uint32_t seg
GRN_MUNMAP(&grn_gctx, NULL, &fis->fmo, fis, header, b);
}
grn_fileinfo_close(ctx, fis);
- grn_unlink(path);
+ if (grn_unlink(path) == -1) {
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "failed to grn_unlink() path on grn_io_create() error: "
+ "<%s>: <%s>",
+ path, grn_strerror(errno));
+ }
}
GRN_GFREE(fis);
}
@@ -479,13 +478,19 @@ grn_io_detect_type(grn_ctx *ctx, const char *path)
struct stat s;
if (fstat(fd, &s) != -1 && s.st_size >= sizeof(struct _grn_io_header)) {
if (grn_read(fd, &h, sizeof(struct _grn_io_header)) == sizeof(struct _grn_io_header)) {
- if (!memcmp(h.idstr, GRN_IO_IDSTR, 16)) {
+ if (!memcmp(h.idstr, GRN_IO_IDSTR, GRN_IO_IDSTR_LEN)) {
res = h.type;
} else {
- ERR(GRN_INCOMPATIBLE_FILE_FORMAT, "incompatible file format");
+ ERR(GRN_INCOMPATIBLE_FILE_FORMAT,
+ "failed to detect type: format ID is different: <%s>: <%.*s>",
+ path,
+ (int)GRN_IO_IDSTR_LEN, GRN_IO_IDSTR);
}
} else {
SERR(path);
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "failed to read enough data for detecting type: <%s>",
+ path);
}
} else {
ERR(GRN_INVALID_FORMAT, "grn_io_detect_type failed");
@@ -493,6 +498,9 @@ grn_io_detect_type(grn_ctx *ctx, const char *path)
grn_close(fd);
} else {
ERRNO_ERR(path);
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "failed to open path for detecting type: <%s>",
+ path);
}
return res;
}
@@ -513,17 +521,23 @@ grn_io_open(grn_ctx *ctx, const char *path, grn_io_mode mode)
grn_open(fd, path, O_RDWR | GRN_OPEN_FLAG_BINARY);
if (fd == -1) {
ERRNO_ERR(path);
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "failed to open path: <%s>",
+ path);
return NULL;
}
if (fstat(fd, &s) != -1 && s.st_size >= sizeof(struct _grn_io_header)) {
if (grn_read(fd, &h, sizeof(struct _grn_io_header)) == sizeof(struct _grn_io_header)) {
- if (!memcmp(h.idstr, GRN_IO_IDSTR, 16)) {
+ if (!memcmp(h.idstr, GRN_IO_IDSTR, GRN_IO_IDSTR_LEN)) {
header_size = h.header_size;
segment_size = h.segment_size;
max_segment = h.max_segment;
flags = h.flags;
} else {
- ERR(GRN_INCOMPATIBLE_FILE_FORMAT, "incompatible file format");
+ ERR(GRN_INCOMPATIBLE_FILE_FORMAT,
+ "failed to open: format ID is different: <%s>: <%.*s>",
+ path,
+ (int)GRN_IO_IDSTR_LEN, GRN_IO_IDSTR);
}
}
}
@@ -705,6 +719,9 @@ grn_io_size(grn_ctx *ctx, grn_io *io, uint64_t *size)
gen_pathname(io->path, buffer, fno);
if (stat(buffer, &s)) {
SERR(buffer);
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "failed to stat path to compute size: <%s>",
+ buffer);
} else {
tsize += s.st_size;
}
@@ -722,6 +739,9 @@ grn_io_remove(grn_ctx *ctx, const char *path)
return ctx->rc;
} else if (grn_unlink(path)) {
ERRNO_ERR(path);
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "failed to remove path: <%s>",
+ path);
return ctx->rc;
} else {
int fno;
@@ -731,6 +751,9 @@ grn_io_remove(grn_ctx *ctx, const char *path)
if (!stat(buffer, &s)) {
if (grn_unlink(buffer)) {
ERRNO_ERR(buffer);
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "failed to remove path: <%s>",
+ buffer);
}
} else {
break;
@@ -749,6 +772,9 @@ grn_io_rename(grn_ctx *ctx, const char *old_name, const char *new_name)
return ctx->rc;
} else if (rename(old_name, new_name)) {
SERR(old_name);
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "failed to rename path: <%s> -> <%s>",
+ old_name, new_name);
return ctx->rc;
} else {
int fno;
@@ -758,9 +784,17 @@ grn_io_rename(grn_ctx *ctx, const char *old_name, const char *new_name)
gen_pathname(old_name, old_buffer, fno);
if (!stat(old_buffer, &s)) {
gen_pathname(new_name, new_buffer, fno);
- if (rename(old_buffer, new_buffer)) { SERR(old_buffer); }
+ if (rename(old_buffer, new_buffer)) {
+ SERR(old_buffer);
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "failed to rename path: <%s> -> <%s>",
+ old_buffer, new_buffer);
+ }
} else {
SERR("stat");
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "failed to stat path to rename: <%s>",
+ old_buffer);
return ctx->rc;
}
}
@@ -1057,34 +1091,30 @@ grn_io_win_unmap(grn_io_win *iw)
}\
} while (0)
-#define SEG_MAP(io,segno,info) do {\
- uint32_t segment_size = io->header->segment_size;\
- if ((io->flags & GRN_IO_TEMPORARY)) {\
- DO_MAP(io, &info->fmo, NULL, 0, segment_size, segno, info->map);\
- } else {\
- unsigned long file_size = grn_io_compute_file_size(io->header->version);\
- uint32_t segments_per_file = file_size / segment_size;\
- uint32_t bseg = segno + io->base_seg;\
- uint32_t fno = bseg / segments_per_file;\
- off_t base = fno ? 0 : io->base - (uint64_t)segment_size * io->base_seg;\
- off_t pos = (uint64_t)segment_size * (bseg % segments_per_file) + base;\
- fileinfo *fi = &io->fis[fno];\
- if (!grn_fileinfo_opened(fi)) {\
- char path[PATH_MAX];\
- gen_pathname(io->path, path, fno);\
- if (!grn_fileinfo_open(ctx, fi, path, O_RDWR|O_CREAT)) { \
- DO_MAP(io, &info->fmo, fi, pos, segment_size, segno, info->map);\
- }\
- } else {\
- DO_MAP(io, &info->fmo, fi, pos, segment_size, segno, info->map);\
- }\
- }\
-} while (0)
-
void
grn_io_seg_map_(grn_ctx *ctx, grn_io *io, uint32_t segno, grn_io_mapinfo *info)
{
- SEG_MAP(io, segno, info);
+ uint32_t segment_size = io->header->segment_size;
+ if ((io->flags & GRN_IO_TEMPORARY)) {
+ DO_MAP(io, &info->fmo, NULL, 0, segment_size, segno, info->map);
+ } else {
+ unsigned long file_size = grn_io_compute_file_size(io->header->version);
+ uint32_t segments_per_file = file_size / segment_size;
+ uint32_t bseg = segno + io->base_seg;
+ uint32_t fno = bseg / segments_per_file;
+ off_t base = fno ? 0 : io->base - (uint64_t)segment_size * io->base_seg;
+ off_t pos = (uint64_t)segment_size * (bseg % segments_per_file) + base;
+ fileinfo *fi = &io->fis[fno];
+ if (!grn_fileinfo_opened(fi)) {
+ char path[PATH_MAX];
+ gen_pathname(io->path, path, fno);
+ if (!grn_fileinfo_open(ctx, fi, path, O_RDWR|O_CREAT)) {
+ DO_MAP(io, &info->fmo, fi, pos, segment_size, segno, info->map);
+ }
+ } else {
+ DO_MAP(io, &info->fmo, fi, pos, segment_size, segno, info->map);
+ }
+ }
}
grn_rc
@@ -1311,6 +1341,49 @@ grn_io_is_locked(grn_io *io)
return io ? *io->lock : 0;
}
+grn_rc
+grn_io_flush(grn_ctx *ctx, grn_io *io)
+{
+ grn_rc rc = GRN_SUCCESS;
+ struct _grn_io_header *header;
+ uint32_t aligned_header_size;
+
+ if (!io->path) {
+ return GRN_SUCCESS;
+ }
+
+ header = io->header;
+ aligned_header_size = grn_io_compute_base(header->header_size);
+
+ if (grn_msync(ctx, header, aligned_header_size) != 0) {
+ return ctx->rc;
+ }
+
+ if (io->maps) {
+ uint32_t i;
+ uint32_t max_mapped_segment;
+ uint32_t segment_size;
+
+ max_mapped_segment = grn_io_max_segment(io);
+ segment_size = header->segment_size;
+ for (i = 0; i < max_mapped_segment; i++) {
+ grn_io_mapinfo *info = &(io->maps[i]);
+ if (!info) {
+ continue;
+ }
+ if (!info->map) {
+ continue;
+ }
+ if (grn_msync(ctx, info->map, segment_size) != 0) {
+ rc = ctx->rc;
+ break;
+ }
+ }
+ }
+
+ return rc;
+}
+
/** mmap abstraction **/
static size_t mmap_size = 0;
@@ -1341,7 +1414,15 @@ grn_mmap_v1(grn_ctx *ctx, HANDLE *fmo, fileinfo *fi, off_t offset, size_t length
/* CRITICAL_SECTION_ENTER(fi->cs); */
/* try to create fmo */
*fmo = CreateFileMapping(fi->fh, NULL, PAGE_READWRITE, 0, offset + length, NULL);
- if (!*fmo) { return NULL; }
+ if (!*fmo) {
+ SERR("CreateFileMapping");
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "CreateFileMapping(%lu + %" GRN_FMT_SIZE ") failed "
+ "<%" GRN_FMT_SIZE ">",
+ (DWORD)offset, length,
+ mmap_size);
+ return NULL;
+ }
res = MapViewOfFile(*fmo, FILE_MAP_WRITE, 0, (DWORD)offset, (SIZE_T)length);
if (!res) {
SERR("MapViewOfFile");
@@ -1486,16 +1567,22 @@ grn_fileinfo_open_common(grn_ctx *ctx, fileinfo *fi, const char *path, int flags
/* may be wrong if flags is just only O_RDWR */
if ((flags & O_CREAT)) {
DWORD dwCreationDisposition;
+ const char *flags_description;
if (flags & O_EXCL) {
dwCreationDisposition = CREATE_NEW;
+ flags_description = "O_RDWR|O_CREAT|O_EXCL";
} else {
dwCreationDisposition = OPEN_ALWAYS;
+ flags_description = "O_RDWR|O_CREAT";
}
fi->fh = CreateFile(path, GRN_IO_FILE_CREATE_MODE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
dwCreationDisposition, FILE_ATTRIBUTE_NORMAL, 0);
if (fi->fh == INVALID_HANDLE_VALUE) {
SERR("CreateFile");
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "CreateFile(<%s>, <%s>) failed",
+ path, flags_description);
goto exit;
}
goto exit;
@@ -1508,6 +1595,9 @@ grn_fileinfo_open_common(grn_ctx *ctx, fileinfo *fi, const char *path, int flags
TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (fi->fh == INVALID_HANDLE_VALUE) {
SERR("CreateFile");
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "CreateFile(<%s>, <O_RDWR|O_TRUNC>) failed",
+ path);
goto exit;
}
goto exit;
@@ -1518,6 +1608,9 @@ grn_fileinfo_open_common(grn_ctx *ctx, fileinfo *fi, const char *path, int flags
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (fi->fh == INVALID_HANDLE_VALUE) {
SERR("CreateFile");
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "CreateFile(<%s>, <O_RDWR>) failed",
+ path);
goto exit;
}
@@ -1636,8 +1729,18 @@ grn_fileinfo_opened(fileinfo *fi)
inline static int
grn_msync(grn_ctx *ctx, void *start, size_t length)
{
- /* return value may be wrong... */
- return FlushViewOfFile(start, length);
+ BOOL succeeded;
+
+ succeeded = FlushViewOfFile(start, length);
+ if (succeeded) {
+ return 0;
+ } else {
+ SERR("FlushViewOfFile");
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "FlushViewOfFile(<%p>, <%" GRN_FMT_SIZE ">) failed",
+ start, length);
+ return -1;
+ }
}
inline static grn_rc
@@ -1693,10 +1796,16 @@ grn_fileinfo_open(grn_ctx *ctx, fileinfo *fi, const char *path, int flags)
grn_open(fi->fd, path, flags);
if (fi->fd == -1) {
ERRNO_ERR(path);
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "failed to open file info path: <%s>",
+ path);
return ctx->rc;
}
if (fstat(fi->fd, &st) == -1) {
ERRNO_ERR(path);
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "failed to stat file info path: <%s>",
+ path);
return ctx->rc;
}
fi->dev = st.st_dev;
diff --git a/storage/mroonga/vendor/groonga/lib/logger.c b/storage/mroonga/vendor/groonga/lib/logger.c
index fc9fe71767e..5a85de3d43e 100644
--- a/storage/mroonga/vendor/groonga/lib/logger.c
+++ b/storage/mroonga/vendor/groonga/lib/logger.c
@@ -314,9 +314,6 @@ grn_logger_put(grn_ctx *ctx, grn_log_level level,
void
grn_logger_init(void)
{
- if (!default_logger_path) {
- default_logger_path = grn_strdup_raw(GRN_LOG_PATH);
- }
grn_memcpy(&current_logger, &default_logger, sizeof(grn_logger));
CRITICAL_SECTION_INIT(default_logger_lock);
}
@@ -572,6 +569,7 @@ grn_query_logger_fin(grn_ctx *ctx)
current_query_logger_fin(ctx);
if (default_query_logger_path) {
free(default_query_logger_path);
+ default_query_logger_path = NULL;
}
CRITICAL_SECTION_FIN(default_query_logger_lock);
}
diff --git a/storage/mroonga/vendor/groonga/lib/mrb.c b/storage/mroonga/vendor/groonga/lib/mrb.c
index 60d2172d520..d406c2d356a 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb.c
@@ -20,6 +20,8 @@
#include "grn_ctx_impl.h"
#include "grn_util.h"
+#include <string.h>
+
#ifdef GRN_WITH_MRUBY
# include <mruby/proc.h>
# include <mruby/compile.h>
@@ -35,6 +37,16 @@
#define BUFFER_SIZE 2048
#define E_LOAD_ERROR (mrb_class_get(mrb, "LoadError"))
+static char grn_mrb_ruby_scripts_dir[GRN_ENV_BUFFER_SIZE];
+
+void
+grn_mrb_init_from_env(void)
+{
+ grn_getenv("GRN_RUBY_SCRIPTS_DIR",
+ grn_mrb_ruby_scripts_dir,
+ GRN_ENV_BUFFER_SIZE);
+}
+
#ifdef GRN_WITH_MRUBY
# ifdef WIN32
static char *win32_ruby_scripts_dir = NULL;
@@ -68,13 +80,8 @@ grn_mrb_get_default_system_ruby_scripts_dir(void)
const char *
grn_mrb_get_system_ruby_scripts_dir(grn_ctx *ctx)
{
- static char ruby_scripts_dir[GRN_ENV_BUFFER_SIZE];
-
- grn_getenv("GRN_RUBY_SCRIPTS_DIR",
- ruby_scripts_dir,
- GRN_ENV_BUFFER_SIZE);
- if (ruby_scripts_dir[0]) {
- return ruby_scripts_dir;
+ if (grn_mrb_ruby_scripts_dir[0]) {
+ return grn_mrb_ruby_scripts_dir;
} else {
return grn_mrb_get_default_system_ruby_scripts_dir();
}
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_array.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_array.c
index f19bcfa9563..f90a7c6a639 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_array.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_array.c
@@ -23,6 +23,7 @@
#include <mruby/class.h>
#include <mruby/data.h>
+#include "mrb_ctx.h"
#include "mrb_array.h"
static struct mrb_data_type mrb_grn_array_type = {
@@ -31,6 +32,33 @@ static struct mrb_data_type mrb_grn_array_type = {
};
static mrb_value
+mrb_grn_array_singleton_create(mrb_state *mrb, mrb_value klass)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ char *name;
+ mrb_int name_length;
+ const char *path = NULL;
+ mrb_value mrb_value_type;
+ grn_obj *value_type = NULL;
+ grn_obj *array;
+
+ mrb_get_args(mrb, "so", &name, &name_length, &mrb_value_type);
+ if (!mrb_nil_p(mrb_value_type)) {
+ value_type = DATA_PTR(mrb_value_type);
+ }
+
+ array = grn_table_create(ctx,
+ name, name_length,
+ path,
+ GRN_TABLE_NO_KEY,
+ NULL,
+ value_type);
+ grn_mrb_ctx_check(mrb);
+
+ return mrb_funcall(mrb, klass, "new", 1, mrb_cptr_value(mrb, array));
+}
+
+static mrb_value
mrb_grn_array_initialize(mrb_state *mrb, mrb_value self)
{
mrb_value mrb_array_ptr;
@@ -54,6 +82,10 @@ grn_mrb_array_init(grn_ctx *ctx)
klass = mrb_define_class_under(mrb, module, "Array", table_class);
MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
+ mrb_define_singleton_method(mrb, (struct RObject *)klass, "create",
+ mrb_grn_array_singleton_create,
+ MRB_ARGS_REQ(2));
+
mrb_define_method(mrb, klass, "initialize",
mrb_grn_array_initialize, MRB_ARGS_REQ(1));
}
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_bulk.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_bulk.c
index eb57a016148..84cfb8dc204 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_bulk.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_bulk.c
@@ -28,6 +28,7 @@
#include "../grn_db.h"
#include "mrb_bulk.h"
+#include "mrb_object.h"
static struct mrb_data_type mrb_grn_bulk_type = {
"Groonga::Bulk",
@@ -136,27 +137,47 @@ grn_mrb_value_from_bulk(mrb_state *mrb, grn_obj *bulk)
break;
default :
{
-#define MESSAGE_SIZE 4096
- char message[MESSAGE_SIZE];
grn_obj *domain;
- char domain_name[GRN_TABLE_MAX_KEY_SIZE];
- int domain_name_size;
+ grn_bool is_record = GRN_FALSE;
domain = grn_ctx_at(ctx, bulk->header.domain);
if (domain) {
- domain_name_size = grn_obj_name(ctx, domain,
- domain_name, GRN_TABLE_MAX_KEY_SIZE);
+ switch (domain->header.type) {
+ case GRN_TABLE_HASH_KEY :
+ case GRN_TABLE_PAT_KEY :
+ case GRN_TABLE_DAT_KEY :
+ case GRN_TABLE_NO_KEY :
+ is_record = GRN_TRUE;
+ break;
+ default :
+ break;
+ }
+ }
+
+ if (is_record) {
+ mrb_value_ = mrb_fixnum_value(GRN_RECORD_VALUE(bulk));
grn_obj_unlink(ctx, domain);
} else {
- grn_strcpy(domain_name, GRN_TABLE_MAX_KEY_SIZE, "unknown");
- domain_name_size = strlen(domain_name);
+#define MESSAGE_SIZE 4096
+ char message[MESSAGE_SIZE];
+ char domain_name[GRN_TABLE_MAX_KEY_SIZE];
+ int domain_name_size;
+
+ if (domain) {
+ domain_name_size = grn_obj_name(ctx, domain,
+ domain_name, GRN_TABLE_MAX_KEY_SIZE);
+ grn_obj_unlink(ctx, domain);
+ } else {
+ grn_strcpy(domain_name, GRN_TABLE_MAX_KEY_SIZE, "unknown");
+ domain_name_size = strlen(domain_name);
+ }
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "unsupported bulk value type: <%d>(%.*s)",
+ bulk->header.domain,
+ domain_name_size,
+ domain_name);
+ mrb_raise(mrb, E_RANGE_ERROR, message);
}
- grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
- "unsupported bulk value type: <%d>(%.*s)",
- bulk->header.domain,
- domain_name_size,
- domain_name);
- mrb_raise(mrb, E_RANGE_ERROR, message);
#undef MESSAGE_SIZE
}
break;
@@ -234,5 +255,7 @@ grn_mrb_bulk_init(grn_ctx *ctx)
mrb_grn_bulk_get_value, MRB_ARGS_NONE());
mrb_define_method(mrb, klass, "==",
mrb_grn_bulk_equal, MRB_ARGS_REQ(1));
+ mrb_define_method(mrb, klass, "inspect",
+ grn_mrb_object_inspect, MRB_ARGS_NONE());
}
#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_column.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_column.c
index 1d3bbb69422..68aadce6658 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_column.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_column.c
@@ -25,9 +25,25 @@
#include "mrb_ctx.h"
#include "mrb_column.h"
+#include "mrb_bulk.h"
#include "mrb_converter.h"
static mrb_value
+mrb_grn_column_array_reference(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *column;
+ grn_id record_id;
+ grn_obj *column_value;
+
+ column = DATA_PTR(self);
+ mrb_get_args(mrb, "i", &record_id);
+
+ column_value = grn_obj_get_value(ctx, column, record_id, NULL);
+ return grn_mrb_value_from_grn_obj(mrb, column_value);
+}
+
+static mrb_value
mrb_grn_column_is_locked(mrb_state *mrb, mrb_value self)
{
grn_ctx *ctx = (grn_ctx *)mrb->ud;
@@ -65,6 +81,9 @@ grn_mrb_column_init(grn_ctx *ctx)
klass = mrb_define_class_under(mrb, module, "Column", object_class);
MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
+ mrb_define_method(mrb, klass, "[]",
+ mrb_grn_column_array_reference, MRB_ARGS_REQ(1));
+
mrb_define_method(mrb, klass, "locked?",
mrb_grn_column_is_locked, MRB_ARGS_NONE());
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_command_input.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_command_input.c
index f39202398d1..07c0a74dd31 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_command_input.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_command_input.c
@@ -27,6 +27,7 @@
#include <mruby/string.h>
#include "mrb_ctx.h"
+#include "mrb_converter.h"
#include "mrb_command_input.h"
static struct mrb_data_type mrb_grn_command_input_type = {
@@ -102,6 +103,19 @@ mrb_grn_command_input_array_reference(mrb_state *mrb, mrb_value self)
GRN_TEXT_LEN(argument));
}
+static mrb_value
+mrb_grn_command_input_get_arguments(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_command_input *input;
+ grn_obj *arguments;
+
+ input = DATA_PTR(self);
+ arguments = grn_command_input_get_arguments(ctx, input);
+
+ return grn_mrb_value_from_grn_obj(mrb, arguments);
+}
+
void
grn_mrb_command_input_init(grn_ctx *ctx)
{
@@ -118,5 +132,8 @@ grn_mrb_command_input_init(grn_ctx *ctx)
mrb_define_method(mrb, klass, "[]",
mrb_grn_command_input_array_reference, MRB_ARGS_REQ(1));
+
+ mrb_define_method(mrb, klass, "arguments",
+ mrb_grn_command_input_get_arguments, MRB_ARGS_NONE());
}
#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_converter.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_converter.c
index e4c3aceb435..387d921b6d0 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_converter.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_converter.c
@@ -130,7 +130,7 @@ grn_mrb_value_to_raw_data(mrb_state *mrb,
"%S: failed to convert to %S: %S",
mrb_str_new_static(mrb, context, strlen(context)),
mrb_str_new_static(mrb, domain_name, domain_name_size),
- mrb_value_);
+ mrb_funcall(mrb, mrb_value_, "inspect", 0));
}
*raw_value = GRN_BULK_HEAD(&(buffer->to));
*raw_value_size = GRN_BULK_VSIZE(&(buffer->to));
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_index_column.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_index_column.c
index eb85ff955fa..2af198c2fdb 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_index_column.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_index_column.c
@@ -24,6 +24,7 @@
#include <mruby/class.h>
#include <mruby/data.h>
+#include "mrb_ctx.h"
#include "mrb_converter.h"
#include "mrb_index_column.h"
#include "mrb_operator.h"
@@ -77,14 +78,22 @@ mrb_grn_index_column_estimate_size_for_query(mrb_state *mrb, mrb_value self)
{
grn_ctx *ctx = (grn_ctx *)mrb->ud;
grn_obj *index_column;
- char *query;
- mrb_int query_len;
+ grn_obj *lexicon;
+ mrb_value mrb_query;
+ void *query;
+ unsigned int query_size;
+ grn_mrb_value_to_raw_data_buffer buffer;
mrb_value mrb_options = mrb_nil_value();
grn_search_optarg optarg;
unsigned int size;
index_column = DATA_PTR(self);
- mrb_get_args(mrb, "s|H", &query, &query_len, &mrb_options);
+ mrb_get_args(mrb, "o|H", &mrb_query, &mrb_options);
+
+ lexicon = grn_ctx_at(ctx, index_column->header.domain);
+ grn_mrb_value_to_raw_data_buffer_init(mrb, &buffer);
+ grn_mrb_value_to_raw_data(mrb, "query", mrb_query, lexicon->header.domain,
+ &buffer, &query, &query_size);
memset(&optarg, 0, sizeof(grn_search_optarg));
optarg.mode = GRN_OP_EXACT;
@@ -99,7 +108,11 @@ mrb_grn_index_column_estimate_size_for_query(mrb_state *mrb, mrb_value self)
}
size = grn_ii_estimate_size_for_query(ctx, (grn_ii *)index_column,
- query, query_len, &optarg);
+ query, query_size, &optarg);
+ grn_mrb_value_to_raw_data_buffer_fin(mrb, &buffer);
+
+ grn_mrb_ctx_check(mrb);
+
return mrb_fixnum_value(size);
}
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_object.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_object.c
index 8efaa41e50d..77eb4ef3025 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_object.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_object.c
@@ -26,12 +26,13 @@
#include <mruby/data.h>
#include "../grn_mrb.h"
+#include "mrb_ctx.h"
#include "mrb_object.h"
#include "mrb_operator.h"
#include "mrb_converter.h"
-static mrb_value
-object_inspect(mrb_state *mrb, mrb_value self)
+mrb_value
+grn_mrb_object_inspect(mrb_state *mrb, mrb_value self)
{
grn_ctx *ctx = (grn_ctx *)mrb->ud;
grn_obj *object;
@@ -170,6 +171,21 @@ object_close(mrb_state *mrb, mrb_value self)
}
static mrb_value
+object_remove(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *object;
+
+ object = DATA_PTR(self);
+ grn_obj_remove(ctx, object);
+ grn_mrb_ctx_check(mrb);
+
+ DATA_PTR(self) = NULL;
+
+ return mrb_nil_value();
+}
+
+static mrb_value
object_get_domain_id(mrb_state *mrb, mrb_value self)
{
grn_obj *object;
@@ -237,7 +253,7 @@ grn_mrb_object_init(grn_ctx *ctx)
data->object_class = klass;
mrb_define_method(mrb, klass, "inspect",
- object_inspect, MRB_ARGS_NONE());
+ grn_mrb_object_inspect, MRB_ARGS_NONE());
mrb_define_method(mrb, klass, "id", object_get_id, MRB_ARGS_NONE());
mrb_define_method(mrb, klass, "name", object_get_name, MRB_ARGS_NONE());
@@ -247,6 +263,7 @@ grn_mrb_object_init(grn_ctx *ctx)
object_grn_inspect, MRB_ARGS_NONE());
mrb_define_method(mrb, klass, "==", object_equal, MRB_ARGS_REQ(1));
mrb_define_method(mrb, klass, "close", object_close, MRB_ARGS_NONE());
+ mrb_define_method(mrb, klass, "remove", object_remove, MRB_ARGS_NONE());
mrb_define_method(mrb, klass, "domain_id", object_get_domain_id,
MRB_ARGS_NONE());
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_object.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_object.h
index 97a586c0f11..82468bd0156 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_object.h
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_object.h
@@ -27,6 +27,8 @@ extern "C" {
void grn_mrb_object_init(grn_ctx *ctx);
+mrb_value grn_mrb_object_inspect(mrb_state *mrb, mrb_value self);
+
#ifdef __cplusplus
}
#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_table.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table.c
index 651a77e4549..2b9e00d8f04 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_table.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table.c
@@ -66,6 +66,25 @@ mrb_grn_table_array_reference(mrb_state *mrb, mrb_value self)
}
static mrb_value
+mrb_grn_table_find_column(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *table;
+ mrb_value mrb_column_name;
+ grn_obj *column;
+
+ mrb_get_args(mrb, "o", &mrb_column_name);
+
+ table = DATA_PTR(self);
+ column = grn_obj_column(ctx, table,
+ RSTRING_PTR(mrb_column_name),
+ RSTRING_LEN(mrb_column_name));
+ grn_mrb_ctx_check(mrb);
+
+ return grn_mrb_value_from_grn_obj(mrb, column);
+}
+
+static mrb_value
mrb_grn_table_is_locked(mrb_state *mrb, mrb_value self)
{
grn_ctx *ctx = (grn_ctx *)mrb->ud;
@@ -138,22 +157,21 @@ mrb_grn_table_select(mrb_state *mrb, mrb_value self)
return grn_mrb_value_from_grn_obj(mrb, result);
}
-/* TODO: Fix memory leak on error */
static mrb_value
-mrb_grn_table_sort(mrb_state *mrb, mrb_value self)
+mrb_grn_table_sort_raw(mrb_state *mrb, mrb_value self)
{
grn_ctx *ctx = (grn_ctx *)mrb->ud;
grn_obj *table;
- grn_obj *result = NULL;
+ mrb_value mrb_keys;
grn_table_sort_key *keys;
int i, n_keys;
- int offset = 0;
- int limit = -1;
- mrb_value mrb_keys;
- mrb_value mrb_options = mrb_nil_value();
+ mrb_int offset;
+ mrb_int limit;
+ mrb_value mrb_result;
+ grn_obj *result;
table = DATA_PTR(self);
- mrb_get_args(mrb, "o|H", &mrb_keys, &mrb_options);
+ mrb_get_args(mrb, "oiio", &mrb_keys, &offset, &limit, &mrb_result);
mrb_keys = mrb_convert_type(mrb, mrb_keys,
MRB_TT_ARRAY, "Array", "to_ary");
@@ -161,69 +179,118 @@ mrb_grn_table_sort(mrb_state *mrb, mrb_value self)
n_keys = RARRAY_LEN(mrb_keys);
keys = GRN_MALLOCN(grn_table_sort_key, n_keys);
for (i = 0; i < n_keys; i++) {
- mrb_value mrb_sort_options;
- mrb_value mrb_sort_key;
- mrb_value mrb_sort_order;
-
- mrb_sort_options = RARRAY_PTR(mrb_keys)[i];
- mrb_sort_key = grn_mrb_options_get_lit(mrb, mrb_sort_options, "key");
- switch (mrb_type(mrb_sort_key)) {
- case MRB_TT_STRING :
- keys[i].key = grn_obj_column(ctx, table,
- RSTRING_PTR(mrb_sort_key),
- RSTRING_LEN(mrb_sort_key));
- break;
- case MRB_TT_SYMBOL :
- {
- const char *name;
- mrb_int name_length;
- name = mrb_sym2name_len(mrb, mrb_symbol(mrb_sort_key), &name_length);
- keys[i].key = grn_obj_column(ctx, table, name, name_length);
- }
- break;
- default :
- /* TODO: free */
- mrb_raisef(mrb, E_ARGUMENT_ERROR,
- "sort key must be string or symbol: %S",
- mrb_sort_key);
- break;
- }
-
- keys[i].flags = 0;
- mrb_sort_order = grn_mrb_options_get_lit(mrb, mrb_sort_options, "order");
- if (mrb_nil_p(mrb_sort_order) ||
- (mrb_symbol(mrb_sort_order) == mrb_intern_lit(mrb, "ascending"))) {
- keys[i].flags |= GRN_TABLE_SORT_ASC;
- } else {
- keys[i].flags |= GRN_TABLE_SORT_DESC;
- }
+ memcpy(&(keys[i]),
+ DATA_PTR(RARRAY_PTR(mrb_keys)[i]),
+ sizeof(grn_table_sort_key));
}
+ result = DATA_PTR(mrb_result);
+ grn_table_sort(ctx, table, offset, limit, result, keys, n_keys);
+ GRN_FREE(keys);
+ grn_mrb_ctx_check(mrb);
- if (!mrb_nil_p(mrb_options)) {
- mrb_value mrb_offset;
- mrb_value mrb_limit;
+ return mrb_result;
+}
- mrb_offset = grn_mrb_options_get_lit(mrb, mrb_options, "offset");
- if (!mrb_nil_p(mrb_offset)) {
- offset = mrb_fixnum(mrb_offset);
- }
+static mrb_value
+mrb_grn_table_group_raw(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *table;
+ mrb_value mrb_keys;
+ grn_table_sort_key *keys;
+ int i, n_keys;
+ mrb_value mrb_result;
+ grn_table_group_result *result;
- mrb_limit = grn_mrb_options_get_lit(mrb, mrb_options, "limit");
- if (!mrb_nil_p(mrb_limit)) {
- limit = mrb_fixnum(mrb_limit);
- }
- }
+ table = DATA_PTR(self);
+ mrb_get_args(mrb, "oo", &mrb_keys, &mrb_result);
- result = grn_table_create(ctx, NULL, 0, NULL, GRN_TABLE_NO_KEY,
- NULL, table);
- grn_table_sort(ctx, table, offset, limit, result, keys, n_keys);
+ mrb_keys = mrb_convert_type(mrb, mrb_keys,
+ MRB_TT_ARRAY, "Array", "to_ary");
+
+ n_keys = RARRAY_LEN(mrb_keys);
+ keys = GRN_MALLOCN(grn_table_sort_key, n_keys);
for (i = 0; i < n_keys; i++) {
- grn_obj_unlink(ctx, keys[i].key);
+ memcpy(&(keys[i]),
+ DATA_PTR(RARRAY_PTR(mrb_keys)[i]),
+ sizeof(grn_table_sort_key));
}
+ result = DATA_PTR(mrb_result);
+ grn_table_group(ctx, table, keys, n_keys, result, 1);
GRN_FREE(keys);
grn_mrb_ctx_check(mrb);
- return grn_mrb_value_from_grn_obj(mrb, result);
+ return mrb_result;
+}
+
+static mrb_value
+mrb_grn_table_delete(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *table;
+ mrb_value mrb_options;
+ mrb_value mrb_id;
+ mrb_value mrb_key;
+ mrb_value mrb_expression;
+
+ table = DATA_PTR(self);
+ mrb_get_args(mrb, "H", &mrb_options);
+
+ mrb_id = grn_mrb_options_get_lit(mrb, mrb_options, "id");
+ if (!mrb_nil_p(mrb_id)) {
+ grn_table_delete_by_id(ctx, table, mrb_fixnum(mrb_id));
+ grn_mrb_ctx_check(mrb);
+ return mrb_nil_value();
+ }
+
+ mrb_key = grn_mrb_options_get_lit(mrb, mrb_options, "key");
+ if (!mrb_nil_p(mrb_key)) {
+ grn_id key_domain_id;
+ void *key;
+ unsigned int key_size;
+ grn_mrb_value_to_raw_data_buffer buffer;
+
+ key_domain_id = table->header.domain;
+ grn_mrb_value_to_raw_data_buffer_init(mrb, &buffer);
+ grn_mrb_value_to_raw_data(mrb, "key", mrb_key, key_domain_id,
+ &buffer, &key, &key_size);
+ grn_table_delete(ctx, table, key, key_size);
+ grn_mrb_value_to_raw_data_buffer_fin(mrb, &buffer);
+ grn_mrb_ctx_check(mrb);
+ return mrb_nil_value();
+ }
+
+ mrb_expression = grn_mrb_options_get_lit(mrb, mrb_options, "expression");
+ if (!mrb_nil_p(mrb_expression)) {
+ grn_obj *expression;
+ grn_obj *selected_records;
+ grn_table_cursor *cursor;
+
+ expression = DATA_PTR(mrb_expression);
+ selected_records = grn_table_select(ctx, table, expression, NULL, GRN_OP_OR);
+ grn_mrb_ctx_check(mrb);
+ cursor = grn_table_cursor_open(ctx, selected_records,
+ NULL, 0,
+ NULL, 0,
+ 0, -1, 0);
+ if (cursor) {
+ while (grn_table_cursor_next(ctx, cursor) != GRN_ID_NIL) {
+ grn_id *id;
+ grn_table_cursor_get_key(ctx, cursor, (void **)&id);
+ grn_table_delete_by_id(ctx, table, *id);
+ }
+ grn_table_cursor_close(ctx, cursor);
+ }
+ grn_mrb_ctx_check(mrb);
+
+ return mrb_nil_value();
+ }
+
+ mrb_raisef(mrb, E_ARGUMENT_ERROR,
+ "must have :id, :key or :expression: %S",
+ mrb_options);
+
+ return mrb_nil_value();
}
void
@@ -241,6 +308,9 @@ grn_mrb_table_init(grn_ctx *ctx)
mrb_define_method(mrb, klass, "[]",
mrb_grn_table_array_reference, MRB_ARGS_REQ(1));
+ mrb_define_method(mrb, klass, "find_column",
+ mrb_grn_table_find_column, MRB_ARGS_REQ(1));
+
mrb_define_method(mrb, klass, "locked?",
mrb_grn_table_is_locked, MRB_ARGS_NONE());
@@ -251,7 +321,13 @@ grn_mrb_table_init(grn_ctx *ctx)
mrb_define_method(mrb, klass, "select",
mrb_grn_table_select, MRB_ARGS_ARG(1, 1));
- mrb_define_method(mrb, klass, "sort",
- mrb_grn_table_sort, MRB_ARGS_ARG(1, 1));
+ mrb_define_method(mrb, klass, "sort_raw",
+ mrb_grn_table_sort_raw, MRB_ARGS_REQ(4));
+ mrb_define_method(mrb, klass, "group_raw",
+ mrb_grn_table_group_raw, MRB_ARGS_REQ(2));
+
+ mrb_define_method(mrb, klass, "delete",
+ mrb_grn_table_delete, MRB_ARGS_REQ(1));
+
}
#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_group_flags.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_group_flags.c
new file mode 100644
index 00000000000..9419f1b7939
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_group_flags.c
@@ -0,0 +1,48 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 Brazil
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License version 2.1 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "../grn_ctx_impl.h"
+
+#ifdef GRN_WITH_MRUBY
+#include <mruby.h>
+#include <mruby/class.h>
+
+#include "mrb_table_group_flags.h"
+
+void
+grn_mrb_table_group_flags_init(grn_ctx *ctx)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module = data->module;
+ struct RClass *flags_module;
+
+ flags_module = mrb_define_module_under(mrb, module, "TableGroupFlags");
+
+ mrb_define_const(mrb, flags_module, "CALC_COUNT",
+ mrb_fixnum_value(GRN_TABLE_GROUP_CALC_COUNT));
+ mrb_define_const(mrb, flags_module, "CALC_MAX",
+ mrb_fixnum_value(GRN_TABLE_GROUP_CALC_MAX));
+ mrb_define_const(mrb, flags_module, "CALC_MIN",
+ mrb_fixnum_value(GRN_TABLE_GROUP_CALC_MIN));
+ mrb_define_const(mrb, flags_module, "CALC_SUM",
+ mrb_fixnum_value(GRN_TABLE_GROUP_CALC_SUM));
+ mrb_define_const(mrb, flags_module, "CALC_AVG",
+ mrb_fixnum_value(GRN_TABLE_GROUP_CALC_AVG));
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_group_flags.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_group_flags.h
new file mode 100644
index 00000000000..fda2a9be82f
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_group_flags.h
@@ -0,0 +1,34 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 Brazil
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License version 2.1 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef GRN_MRB_TABLE_GROUP_FLAGS_H
+#define GRN_MRB_TABLE_GROUP_FLAGS_H
+
+#include "../grn_ctx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void grn_mrb_table_group_flags_init(grn_ctx *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_MRB_TABLE_GROUP_FLAGS_H */
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_group_result.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_group_result.c
new file mode 100644
index 00000000000..970ebd06220
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_group_result.c
@@ -0,0 +1,250 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 Brazil
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License version 2.1 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "../grn_ctx_impl.h"
+
+#ifdef GRN_WITH_MRUBY
+#include <mruby.h>
+#include <mruby/class.h>
+#include <mruby/data.h>
+#include <mruby/hash.h>
+#include <mruby/array.h>
+#include <mruby/string.h>
+
+#include "mrb_ctx.h"
+#include "mrb_converter.h"
+#include "mrb_operator.h"
+#include "mrb_table_group_result.h"
+
+static void
+mrb_grn_table_group_result_free(mrb_state *mrb, void *data)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_table_group_result *result = data;
+
+ if (!result) {
+ return;
+ }
+
+ if (result->calc_target) {
+ grn_obj_unlink(ctx, result->calc_target);
+ }
+ if (result->table) {
+ grn_obj_unlink(ctx, result->table);
+ }
+ mrb_free(mrb, result);
+}
+
+static struct mrb_data_type mrb_grn_table_group_result_type = {
+ "Groonga::TableGroupResult",
+ mrb_grn_table_group_result_free
+};
+
+static mrb_value
+mrb_grn_table_group_result_initialize(mrb_state *mrb, mrb_value self)
+{
+ grn_table_group_result *result;
+
+ DATA_TYPE(self) = &mrb_grn_table_group_result_type;
+
+ result = mrb_calloc(mrb, 1, sizeof(grn_table_group_result));
+ DATA_PTR(self) = result;
+
+ return self;
+}
+
+
+static mrb_value
+mrb_grn_table_group_result_close(mrb_state *mrb, mrb_value self)
+{
+ grn_table_group_result *result;
+
+ result = DATA_PTR(self);
+ if (result) {
+ mrb_grn_table_group_result_free(mrb, result);
+ DATA_PTR(self) = NULL;
+ }
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+mrb_grn_table_group_result_get_table(mrb_state *mrb, mrb_value self)
+{
+ grn_table_group_result *result;
+
+ result = DATA_PTR(self);
+
+ return grn_mrb_value_from_grn_obj(mrb, result->table);
+}
+
+static mrb_value
+mrb_grn_table_group_result_set_table(mrb_state *mrb, mrb_value self)
+{
+ grn_table_group_result *result;
+ mrb_value mrb_table;
+
+ result = DATA_PTR(self);
+ mrb_get_args(mrb, "o", &mrb_table);
+
+ if (mrb_nil_p(mrb_table)) {
+ result->table = NULL;
+ } else {
+ result->table = DATA_PTR(mrb_table);
+ }
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+mrb_grn_table_group_result_set_key_begin(mrb_state *mrb, mrb_value self)
+{
+ grn_table_group_result *result;
+ mrb_int key_begin;
+
+ result = DATA_PTR(self);
+ mrb_get_args(mrb, "i", &key_begin);
+
+ result->key_begin = key_begin;
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+mrb_grn_table_group_result_set_key_end(mrb_state *mrb, mrb_value self)
+{
+ grn_table_group_result *result;
+ mrb_int key_end;
+
+ result = DATA_PTR(self);
+ mrb_get_args(mrb, "i", &key_end);
+
+ result->key_end = key_end;
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+mrb_grn_table_group_result_set_limit(mrb_state *mrb, mrb_value self)
+{
+ grn_table_group_result *result;
+ mrb_int limit;
+
+ result = DATA_PTR(self);
+ mrb_get_args(mrb, "i", &limit);
+
+ result->limit = limit;
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+mrb_grn_table_group_result_set_flags(mrb_state *mrb, mrb_value self)
+{
+ grn_table_group_result *result;
+ mrb_int flags;
+
+ result = DATA_PTR(self);
+ mrb_get_args(mrb, "i", &flags);
+
+ result->flags = flags;
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+mrb_grn_table_group_result_set_operator(mrb_state *mrb, mrb_value self)
+{
+ grn_table_group_result *result;
+ mrb_value mrb_operator;
+
+ result = DATA_PTR(self);
+ mrb_get_args(mrb, "o", &mrb_operator);
+
+ result->op = grn_mrb_value_to_operator(mrb, mrb_operator);
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+mrb_grn_table_group_result_set_max_n_subrecs(mrb_state *mrb, mrb_value self)
+{
+ grn_table_group_result *result;
+ mrb_int max_n_subrecs;
+
+ result = DATA_PTR(self);
+ mrb_get_args(mrb, "i", &max_n_subrecs);
+
+ result->max_n_subrecs = max_n_subrecs;
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+mrb_grn_table_group_result_set_calc_target(mrb_state *mrb, mrb_value self)
+{
+ grn_table_group_result *result;
+ mrb_value mrb_calc_target;
+
+ result = DATA_PTR(self);
+ mrb_get_args(mrb, "o", &mrb_calc_target);
+
+ result->calc_target = DATA_PTR(mrb_calc_target);
+
+ return mrb_nil_value();
+}
+
+void
+grn_mrb_table_group_result_init(grn_ctx *ctx)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module = data->module;
+ struct RClass *klass;
+
+ klass = mrb_define_class_under(mrb, module, "TableGroupResult",
+ mrb->object_class);
+ MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
+
+ mrb_define_method(mrb, klass, "initialize",
+ mrb_grn_table_group_result_initialize, MRB_ARGS_NONE());
+
+ mrb_define_method(mrb, klass, "close",
+ mrb_grn_table_group_result_close, MRB_ARGS_NONE());
+
+ mrb_define_method(mrb, klass, "table",
+ mrb_grn_table_group_result_get_table, MRB_ARGS_NONE());
+ mrb_define_method(mrb, klass, "table=",
+ mrb_grn_table_group_result_set_table, MRB_ARGS_REQ(1));
+ mrb_define_method(mrb, klass, "key_begin=",
+ mrb_grn_table_group_result_set_key_begin, MRB_ARGS_REQ(1));
+ mrb_define_method(mrb, klass, "key_end=",
+ mrb_grn_table_group_result_set_key_end, MRB_ARGS_REQ(1));
+ mrb_define_method(mrb, klass, "limit=",
+ mrb_grn_table_group_result_set_limit, MRB_ARGS_REQ(1));
+ mrb_define_method(mrb, klass, "flags=",
+ mrb_grn_table_group_result_set_flags, MRB_ARGS_REQ(1));
+ mrb_define_method(mrb, klass, "operator=",
+ mrb_grn_table_group_result_set_operator, MRB_ARGS_REQ(1));
+ mrb_define_method(mrb, klass, "max_n_subrecs=",
+ mrb_grn_table_group_result_set_max_n_subrecs,
+ MRB_ARGS_REQ(1));
+ mrb_define_method(mrb, klass, "calc_target=",
+ mrb_grn_table_group_result_set_calc_target, MRB_ARGS_REQ(1));
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_group_result.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_group_result.h
new file mode 100644
index 00000000000..cc3c70ff3bb
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_group_result.h
@@ -0,0 +1,34 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 Brazil
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License version 2.1 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef GRN_MRB_TABLE_GROUP_RESULT_H
+#define GRN_MRB_TABLE_GROUP_RESULT_H
+
+#include "../grn_ctx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void grn_mrb_table_group_result_init(grn_ctx *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_MRB_TABLE_GROUP_RESULT_H */
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_sort_flags.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_sort_flags.c
new file mode 100644
index 00000000000..0c402591042
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_sort_flags.c
@@ -0,0 +1,42 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 Brazil
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License version 2.1 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "../grn_ctx_impl.h"
+
+#ifdef GRN_WITH_MRUBY
+#include <mruby.h>
+#include <mruby/class.h>
+
+#include "mrb_table_sort_flags.h"
+
+void
+grn_mrb_table_sort_flags_init(grn_ctx *ctx)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module = data->module;
+ struct RClass *flags_module;
+
+ flags_module = mrb_define_module_under(mrb, module, "TableSortFlags");
+
+ mrb_define_const(mrb, flags_module, "ASCENDING",
+ mrb_fixnum_value(GRN_TABLE_SORT_ASC));
+ mrb_define_const(mrb, flags_module, "DESCENDING",
+ mrb_fixnum_value(GRN_TABLE_SORT_DESC));
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_sort_flags.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_sort_flags.h
new file mode 100644
index 00000000000..0b5c40b9993
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_sort_flags.h
@@ -0,0 +1,34 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 Brazil
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License version 2.1 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef GRN_MRB_TABLE_SORT_FLAGS_H
+#define GRN_MRB_TABLE_SORT_FLAGS_H
+
+#include "../grn_ctx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void grn_mrb_table_sort_flags_init(grn_ctx *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_MRB_TABLE_SORT_FLAGS_H */
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_sort_key.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_sort_key.c
new file mode 100644
index 00000000000..3313cceebb6
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_sort_key.c
@@ -0,0 +1,157 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 Brazil
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License version 2.1 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "../grn_ctx_impl.h"
+
+#ifdef GRN_WITH_MRUBY
+#include <mruby.h>
+#include <mruby/class.h>
+#include <mruby/data.h>
+#include <mruby/hash.h>
+#include <mruby/array.h>
+#include <mruby/string.h>
+
+#include "mrb_ctx.h"
+#include "mrb_table_sort_key.h"
+
+static void
+mrb_grn_table_sort_key_free(mrb_state *mrb, void *data)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_table_sort_key *sort_key = data;
+
+ if (!sort_key) {
+ return;
+ }
+
+ if (sort_key->key) {
+ grn_obj_unlink(ctx, sort_key->key);
+ }
+ mrb_free(mrb, sort_key);
+}
+
+static struct mrb_data_type mrb_grn_table_sort_key_type = {
+ "Groonga::TableSortKey",
+ mrb_grn_table_sort_key_free
+};
+
+static mrb_value
+mrb_grn_table_sort_key_initialize(mrb_state *mrb, mrb_value self)
+{
+ grn_table_sort_key *result;
+
+ DATA_TYPE(self) = &mrb_grn_table_sort_key_type;
+
+ result = mrb_calloc(mrb, 1, sizeof(grn_table_sort_key));
+ DATA_PTR(self) = result;
+
+ return self;
+}
+
+
+static mrb_value
+mrb_grn_table_sort_key_close(mrb_state *mrb, mrb_value self)
+{
+ grn_table_sort_key *sort_key;
+
+ sort_key = DATA_PTR(self);
+ if (sort_key) {
+ mrb_grn_table_sort_key_free(mrb, sort_key);
+ DATA_PTR(self) = NULL;
+ }
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+mrb_grn_table_sort_key_set_key(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_table_sort_key *sort_key;
+ mrb_value mrb_key;
+
+ sort_key = DATA_PTR(self);
+ mrb_get_args(mrb, "o", &mrb_key);
+
+ if (sort_key->key) {
+ grn_obj_unlink(ctx, sort_key->key);
+ }
+
+ if (mrb_nil_p(mrb_key)) {
+ sort_key->key = NULL;
+ } else {
+ sort_key->key = DATA_PTR(mrb_key);
+ }
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+mrb_grn_table_sort_key_set_flags(mrb_state *mrb, mrb_value self)
+{
+ grn_table_sort_key *sort_key;
+ mrb_int flags;
+
+ sort_key = DATA_PTR(self);
+ mrb_get_args(mrb, "i", &flags);
+
+ sort_key->flags = flags;
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+mrb_grn_table_sort_key_set_offset(mrb_state *mrb, mrb_value self)
+{
+ grn_table_sort_key *sort_key;
+ mrb_int offset;
+
+ sort_key = DATA_PTR(self);
+ mrb_get_args(mrb, "i", &offset);
+
+ sort_key->offset = offset;
+
+ return mrb_nil_value();
+}
+
+void
+grn_mrb_table_sort_key_init(grn_ctx *ctx)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module = data->module;
+ struct RClass *klass;
+
+ klass = mrb_define_class_under(mrb, module, "TableSortKey",
+ mrb->object_class);
+ MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
+
+ mrb_define_method(mrb, klass, "initialize",
+ mrb_grn_table_sort_key_initialize, MRB_ARGS_NONE());
+
+ mrb_define_method(mrb, klass, "close",
+ mrb_grn_table_sort_key_close, MRB_ARGS_NONE());
+
+ mrb_define_method(mrb, klass, "key=",
+ mrb_grn_table_sort_key_set_key, MRB_ARGS_REQ(1));
+ mrb_define_method(mrb, klass, "flags=",
+ mrb_grn_table_sort_key_set_flags, MRB_ARGS_REQ(1));
+ mrb_define_method(mrb, klass, "offset=",
+ mrb_grn_table_sort_key_set_offset, MRB_ARGS_REQ(1));
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_sort_key.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_sort_key.h
new file mode 100644
index 00000000000..1d56bcd6313
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_sort_key.h
@@ -0,0 +1,34 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 Brazil
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License version 2.1 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef GRN_MRB_TABLE_SORT_KEY_H
+#define GRN_MRB_TABLE_SORT_KEY_H
+
+#include "../grn_ctx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void grn_mrb_table_sort_key_init(grn_ctx *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_MRB_TABLE_SORT_KEY_H */
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_size_estimator.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_size_estimator.rb
index 73b44cae3dd..28b80fc3de3 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_size_estimator.rb
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_size_estimator.rb
@@ -99,7 +99,12 @@ module Groonga
def estimate_equal(data, index_column)
lexicon = index_column.lexicon
- term_id = lexicon[data.query]
+ query = data.query
+ if query.domain == lexicon.id
+ term_id = query.value
+ else
+ term_id = lexicon[query]
+ end
return 0 if term_id.nil?
index_column.estimate_size(:term_id => term_id)
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/post.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/post.rb
index ea26a031e0a..ccd44758d07 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/post.rb
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/post.rb
@@ -6,6 +6,7 @@ require "writer"
require "object"
require "database"
+require "table"
require "index_column"
require "command"
require "table_cursor"
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/sources.am b/storage/mroonga/vendor/groonga/lib/mrb/scripts/sources.am
index 5ddcba18d4c..6fda01812b9 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/scripts/sources.am
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/sources.am
@@ -19,5 +19,6 @@ RUBY_SCRIPT_FILES = \
scan_info_builder.rb \
scan_info_data.rb \
scan_info_search_index.rb \
+ table.rb \
table_cursor.rb \
writer.rb
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/table.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/table.rb
new file mode 100644
index 00000000000..5a1b640c25f
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/table.rb
@@ -0,0 +1,90 @@
+module Groonga
+ class Table
+ def sort(keys, options={})
+ offset = options[:offset] || 0
+ limit = options[:limit] || -1
+ ensure_sort_keys(keys) do |sort_keys|
+ sorted = Array.create("", self)
+ begin
+ sort_raw(sort_keys, offset, limit, sorted)
+ rescue Exception
+ sorted.close
+ raise
+ end
+ sorted
+ end
+ end
+
+ def group(keys, result)
+ ensure_sort_keys(keys) do |sort_keys|
+ group_raw(sort_keys, result)
+ end
+ end
+
+ private
+ def ensure_sort_keys(keys)
+ if keys.is_a?(::Array) and keys.all? {|key| key.is_a?(TableSortKey)}
+ return yield(keys)
+ end
+
+ converted_keys = []
+
+ begin
+ keys = [keys] unless keys.is_a?(::Array)
+ sort_keys = keys.collect do |key|
+ ensure_sort_key(key, converted_keys)
+ end
+ yield(sort_keys)
+ ensure
+ converted_keys.each do |converted_key|
+ converted_key.close
+ end
+ end
+ end
+
+ def ensure_sort_key(key, converted_keys)
+ return key if key.is_a?(TableSortKey)
+
+ sort_key = TableSortKey.new
+ converted_keys << sort_key
+
+ key_name = nil
+ order = :ascending
+ offset = 0
+ if key.is_a?(::Hash)
+ key_name = key[:key]
+ order = key[:order] || order
+ offset = key[:offset] || offset
+ else
+ key_name = key
+ end
+
+ case key_name
+ when String
+ # Do nothing
+ when Symbol
+ key_name = key_name.to_s
+ else
+ message = "sort key name must be String or Symbol: " +
+ "#{key_name.inspect}: #{key.inspect}"
+ raise ArgumentError, message
+ end
+
+ if key_name.start_with?("-")
+ key_name[0] = ""
+ order = :descending
+ elsif key_name.start_with?("+")
+ key_name[0] = ""
+ end
+
+ sort_key.key = find_column(key_name)
+ if order == :ascending
+ sort_key.flags = Groonga::TableSortFlags::ASCENDING
+ else
+ sort_key.flags = Groonga::TableSortFlags::DESCENDING
+ end
+ sort_key.offset = offset
+ sort_key
+ end
+ end
+end
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/sources.am b/storage/mroonga/vendor/groonga/lib/mrb/sources.am
index 5cda570bc37..b27e3654af8 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/sources.am
+++ b/storage/mroonga/vendor/groonga/lib/mrb/sources.am
@@ -55,6 +55,14 @@ libgrnmrb_la_SOURCES = \
mrb_table_cursor.h \
mrb_table_cursor_flags.c \
mrb_table_cursor_flags.h \
+ mrb_table_group_flags.c \
+ mrb_table_group_flags.h \
+ mrb_table_group_result.c \
+ mrb_table_group_result.h \
+ mrb_table_sort_flags.c \
+ mrb_table_sort_flags.h \
+ mrb_table_sort_key.c \
+ mrb_table_sort_key.h \
mrb_type.c \
mrb_type.h \
mrb_variable_size_column.c \
diff --git a/storage/mroonga/vendor/groonga/lib/operator.c b/storage/mroonga/vendor/groonga/lib/operator.c
index 14a870cd885..e57408e0081 100644
--- a/storage/mroonga/vendor/groonga/lib/operator.c
+++ b/storage/mroonga/vendor/groonga/lib/operator.c
@@ -612,6 +612,60 @@ grn_operator_exec_greater_equal(grn_ctx *ctx, grn_obj *x, grn_obj *y)
}
static grn_bool
+exec_match_uvector_bulk(grn_ctx *ctx, grn_obj *uvector, grn_obj *query)
+{
+ grn_bool matched = GRN_FALSE;
+ unsigned int i, size;
+ grn_obj element;
+ unsigned int element_size;
+
+ size = grn_uvector_size(ctx, uvector);
+ element_size = grn_uvector_element_size(ctx, uvector);
+ GRN_VALUE_FIX_SIZE_INIT(&element, 0, uvector->header.domain);
+ for (i = 0; i < size; i++) {
+ GRN_BULK_REWIND(&element);
+ grn_bulk_write(ctx, &element,
+ GRN_BULK_HEAD(uvector) + (element_size * i),
+ element_size);
+ if (grn_operator_exec_equal(ctx, &element, query)) {
+ matched = GRN_TRUE;
+ break;
+ }
+ }
+ GRN_OBJ_FIN(ctx, &element);
+
+ return matched;
+}
+
+static grn_bool
+exec_match_vector_bulk(grn_ctx *ctx, grn_obj *vector, grn_obj *query)
+{
+ grn_bool matched = GRN_FALSE;
+ unsigned int i, size;
+ grn_obj element;
+
+ size = grn_vector_size(ctx, vector);
+ GRN_VOID_INIT(&element);
+ for (i = 0; i < size; i++) {
+ const char *content;
+ unsigned int content_size;
+ grn_id domain_id;
+
+ content_size = grn_vector_get_element(ctx, vector, i,
+ &content, NULL, &domain_id);
+ grn_obj_reinit(ctx, &element, domain_id, 0);
+ grn_bulk_write(ctx, &element, content, content_size);
+ if (grn_operator_exec_equal(ctx, &element, query)) {
+ matched = GRN_TRUE;
+ break;
+ }
+ }
+ GRN_OBJ_FIN(ctx, &element);
+
+ return matched;
+}
+
+static grn_bool
string_have_sub_text(grn_ctx *ctx,
const char *text, unsigned int text_len,
const char *sub_text, unsigned int sub_text_len)
@@ -905,7 +959,17 @@ grn_operator_exec_match(grn_ctx *ctx, grn_obj *target, grn_obj *sub_text)
{
grn_bool matched;
GRN_API_ENTER;
- matched = exec_text_operator_bulk_bulk(ctx, GRN_OP_MATCH, target, sub_text);
+ switch (target->header.type) {
+ case GRN_UVECTOR :
+ matched = exec_match_uvector_bulk(ctx, target, sub_text);
+ break;
+ case GRN_VECTOR :
+ matched = exec_match_vector_bulk(ctx, target, sub_text);
+ break;
+ default :
+ matched = exec_text_operator_bulk_bulk(ctx, GRN_OP_MATCH, target, sub_text);
+ break;
+ }
GRN_API_RETURN(matched);
}
diff --git a/storage/mroonga/vendor/groonga/lib/output.c b/storage/mroonga/vendor/groonga/lib/output.c
index 0036e9a8619..f78ef75a560 100644
--- a/storage/mroonga/vendor/groonga/lib/output.c
+++ b/storage/mroonga/vendor/groonga/lib/output.c
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2009-2014 Brazil
+/* Copyright(C) 2009-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,6 +20,7 @@
#include <string.h>
#include "grn_str.h"
#include "grn_db.h"
+#include "grn_expr_code.h"
#include "grn_util.h"
#include "grn_output.h"
@@ -1134,57 +1135,6 @@ count_n_elements_in_expression(grn_ctx *ctx, grn_obj *expression)
return n_elements;
}
-static inline int
-count_used_n_codes(grn_ctx *ctx, grn_expr_code *start, grn_expr_code *target)
-{
- int n_codes;
- int i, n_args;
- grn_bool have_proc_push_code = GRN_FALSE;
- grn_expr_code *sub_code;
-
- if (start == target) {
- return 0;
- }
-
- n_args = target->nargs;
- if (target->op == GRN_OP_CALL) {
- if (!target->value) {
- have_proc_push_code = GRN_TRUE;
- }
- } else {
- if (target->value) {
- n_args--;
- if (n_args == 0) {
- return 1;
- }
- }
- }
-
- n_codes = 1;
- sub_code = target - 1;
- for (i = 0; i < n_args; i++) {
- int sub_n_codes;
- sub_n_codes = count_used_n_codes(ctx, start, sub_code);
- n_codes += sub_n_codes;
- sub_code -= sub_n_codes;
- if (sub_code < start) {
- /* TODO: report error */
- return 0;
- }
- }
-
- if (have_proc_push_code) {
- n_codes++;
- sub_code--;
- if (sub_code < start) {
- /* TODO: report error */
- return 0;
- }
- }
-
- return n_codes;
-}
-
static grn_bool
is_score_accessor(grn_ctx *ctx, grn_obj *obj)
{
@@ -1305,10 +1255,10 @@ grn_output_table_columns_by_expression(grn_ctx *ctx, grn_obj *outbuf,
have_comma = GRN_TRUE;
if (is_first_comma) {
- int n_used_codes;
+ unsigned int n_used_codes;
int code_end_offset;
- n_used_codes = count_used_n_codes(ctx, expr->codes, code - 1);
+ n_used_codes = grn_expr_code_n_used_codes(ctx, expr->codes, code - 1);
code_end_offset = code - expr->codes - n_used_codes;
grn_output_table_column_by_expression(ctx, outbuf, output_type,
@@ -1417,13 +1367,13 @@ grn_output_table_records_by_expression(grn_ctx *ctx, grn_obj *outbuf,
have_comma = GRN_TRUE;
if (is_first_comma) {
int second_code_offset;
- int second_code_n_used_code;
+ unsigned int second_code_n_used_codes;
second_code_offset = code - expr->codes - 1;
- second_code_n_used_code =
- count_used_n_codes(ctx,
- expr->codes,
- expr->codes + second_code_offset);
- expr->codes_curr = second_code_offset - second_code_n_used_code + 1;
+ second_code_n_used_codes =
+ grn_expr_code_n_used_codes(ctx,
+ expr->codes,
+ expr->codes + second_code_offset);
+ expr->codes_curr = second_code_offset - second_code_n_used_codes + 1;
grn_output_table_record_by_expression(ctx, outbuf, output_type,
format->expression);
code_start_offset = expr->codes_curr;
diff --git a/storage/mroonga/vendor/groonga/lib/plugin.c b/storage/mroonga/vendor/groonga/lib/plugin.c
index 48ccded0b92..7db19c1a5a5 100644
--- a/storage/mroonga/vendor/groonga/lib/plugin.c
+++ b/storage/mroonga/vendor/groonga/lib/plugin.c
@@ -66,6 +66,16 @@ static grn_critical_section grn_plugins_lock;
#define GRN_PLUGIN_KEY_SIZE(filename) (strlen((filename)) + 1)
+static char grn_plugins_dir[GRN_ENV_BUFFER_SIZE];
+
+void
+grn_plugin_init_from_env(void)
+{
+ grn_getenv("GRN_PLUGINS_DIR",
+ grn_plugins_dir,
+ GRN_ENV_BUFFER_SIZE);
+}
+
static int
compute_name_size(const char *name, int name_size)
{
@@ -513,13 +523,8 @@ grn_plugin_get_default_system_plugins_dir(void)
const char *
grn_plugin_get_system_plugins_dir(void)
{
- static char plugins_dir[GRN_ENV_BUFFER_SIZE];
-
- grn_getenv("GRN_PLUGINS_DIR",
- plugins_dir,
- GRN_ENV_BUFFER_SIZE);
- if (plugins_dir[0]) {
- return plugins_dir;
+ if (grn_plugins_dir[0]) {
+ return grn_plugins_dir;
} else {
return grn_plugin_get_default_system_plugins_dir();
}
diff --git a/storage/mroonga/vendor/groonga/lib/proc.c b/storage/mroonga/vendor/groonga/lib/proc.c
index fc6aa690e74..86b0fd58c02 100644
--- a/storage/mroonga/vendor/groonga/lib/proc.c
+++ b/storage/mroonga/vendor/groonga/lib/proc.c
@@ -26,12 +26,17 @@
#include "grn_token_cursor.h"
#include "grn_expr.h"
+#ifdef GRN_WITH_EGN
+# include "grn_egn.h"
+#endif /* GRN_WITH_EGN */
+
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>
#ifdef WIN32
+# include <io.h>
# include <share.h>
#endif /* WIN32 */
@@ -57,6 +62,36 @@ const char *grn_document_root = NULL;
#define GRN_SELECT_INTERNAL_VAR_CONDITION "$condition"
#define GRN_SELECT_INTERNAL_VAR_MATCH_COLUMNS "$match_columns"
+
+static double grn_between_too_many_index_match_ratio = 0.01;
+static double grn_in_values_too_many_index_match_ratio = 0.01;
+
+void
+grn_proc_init_from_env(void)
+{
+ {
+ char grn_between_too_many_index_match_ratio_env[GRN_ENV_BUFFER_SIZE];
+ grn_getenv("GRN_BETWEEN_TOO_MANY_INDEX_MATCH_RATIO",
+ grn_between_too_many_index_match_ratio_env,
+ GRN_ENV_BUFFER_SIZE);
+ if (grn_between_too_many_index_match_ratio_env[0]) {
+ grn_between_too_many_index_match_ratio =
+ atof(grn_between_too_many_index_match_ratio_env);
+ }
+ }
+
+ {
+ char grn_in_values_too_many_index_match_ratio_env[GRN_ENV_BUFFER_SIZE];
+ grn_getenv("GRN_IN_VALUES_TOO_MANY_INDEX_MATCH_RATIO",
+ grn_in_values_too_many_index_match_ratio_env,
+ GRN_ENV_BUFFER_SIZE);
+ if (grn_in_values_too_many_index_match_ratio_env[0]) {
+ grn_in_values_too_many_index_match_ratio =
+ atof(grn_in_values_too_many_index_match_ratio_env);
+ }
+ }
+}
+
/* bulk must be initialized grn_bulk or grn_msg */
static int
grn_bulk_put_from_file(grn_ctx *ctx, grn_obj *bulk, const char *path)
@@ -871,6 +906,19 @@ grn_select(grn_ctx *ctx, const char *table, unsigned int table_len,
long long int threshold, original_threshold = 0;
grn_cache *cache_obj = grn_cache_current_get(ctx);
+ {
+ const char *query_end = query + query_len;
+ int space_len;
+ while (query < query_end) {
+ space_len = grn_isspace(query, ctx->encoding);
+ if (space_len == 0) {
+ break;
+ }
+ query += space_len;
+ query_len -= space_len;
+ }
+ }
+
cache_key_size = table_len + 1 + match_columns_len + 1 + query_len + 1 +
filter_len + 1 + scorer_len + 1 + sortby_len + 1 + output_columns_len + 1 +
match_escalation_threshold_len + 1 +
@@ -963,6 +1011,19 @@ grn_select(grn_ctx *ctx, const char *table, unsigned int table_len,
}
if ((table_ = grn_ctx_get(ctx, table, table_len))) {
// match_columns_ = grn_obj_column(ctx, table_, match_columns, match_columns_len);
+#ifdef GRN_WITH_EGN
+ if (filter_len && (filter[0] == '?') &&
+ (ctx->impl->output_type == GRN_CONTENT_JSON)) {
+ ctx->rc = grn_egn_select(ctx, table_, filter + 1, filter_len - 1,
+ output_columns, output_columns_len,
+ offset, limit);
+ if (!ctx->rc && cacheable && cache_key_size <= GRN_CACHE_MAX_KEY_SIZE &&
+ (!cache || cache_len != 2 || cache[0] != 'n' || cache[1] != 'o')) {
+ grn_cache_update(ctx, cache_obj, cache_key, cache_key_size, outbuf);
+ }
+ goto exit;
+ }
+#endif /* GRN_WITH_EGN */
if (query_len || filter_len) {
grn_obj *v;
GRN_EXPR_CREATE_FOR_QUERY(ctx, table_, cond, v);
@@ -973,6 +1034,9 @@ grn_select(grn_ctx *ctx, const char *table, unsigned int table_len,
grn_expr_parse(ctx, match_columns_, match_columns, match_columns_len,
NULL, GRN_OP_MATCH, GRN_OP_AND,
GRN_EXPR_SYNTAX_SCRIPT);
+ if (ctx->rc) {
+ goto exit;
+ }
} else {
/* todo */
}
@@ -980,16 +1044,16 @@ grn_select(grn_ctx *ctx, const char *table, unsigned int table_len,
if (query_len) {
grn_expr_flags flags;
grn_obj query_expander_buf;
- GRN_TEXT_INIT(&query_expander_buf, 0);
flags = GRN_EXPR_SYNTAX_QUERY;
if (query_flags_len) {
flags |= grn_parse_query_flags(ctx, query_flags, query_flags_len);
- } else {
- flags |= GRN_EXPR_ALLOW_PRAGMA|GRN_EXPR_ALLOW_COLUMN;
if (ctx->rc) {
goto exit;
}
+ } else {
+ flags |= GRN_EXPR_ALLOW_PRAGMA|GRN_EXPR_ALLOW_COLUMN;
}
+ GRN_TEXT_INIT(&query_expander_buf, 0);
if (query_expander_len) {
if (expand_query(ctx, query, query_len, flags,
query_expander, query_expander_len,
@@ -3953,6 +4017,7 @@ parse_tokenize_flags(grn_ctx *ctx, grn_obj *flag_names)
typedef struct {
grn_id id;
int32_t position;
+ grn_bool force_prefix;
} tokenize_token;
static void
@@ -3969,7 +4034,7 @@ output_tokens(grn_ctx *ctx, grn_obj *tokens, grn_obj *lexicon)
token = ((tokenize_token *)(GRN_BULK_HEAD(tokens))) + i;
- GRN_OUTPUT_MAP_OPEN("TOKEN", 2);
+ GRN_OUTPUT_MAP_OPEN("TOKEN", 3);
GRN_OUTPUT_CSTR("value");
value_size = grn_table_get_key(ctx, lexicon, token->id,
@@ -3979,6 +4044,9 @@ output_tokens(grn_ctx *ctx, grn_obj *tokens, grn_obj *lexicon)
GRN_OUTPUT_CSTR("position");
GRN_OUTPUT_INT32(token->position);
+ GRN_OUTPUT_CSTR("force_prefix");
+ GRN_OUTPUT_BOOL(token->force_prefix);
+
GRN_OUTPUT_MAP_CLOSE();
}
GRN_OUTPUT_ARRAY_CLOSE();
@@ -4088,6 +4156,7 @@ tokenize(grn_ctx *ctx, grn_obj *lexicon, grn_obj *string, grn_tokenize_mode mode
current_token = ((tokenize_token *)(GRN_BULK_CURR(tokens))) - 1;
current_token->id = token_id;
current_token->position = token_cursor->pos;
+ current_token->force_prefix = token_cursor->force_prefix;
}
grn_token_cursor_close(ctx, token_cursor);
}
@@ -5134,11 +5203,12 @@ run_sub_filter(grn_ctx *ctx, grn_obj *table,
case GRN_ACCESSOR :
case GRN_COLUMN_FIX_SIZE :
case GRN_COLUMN_VAR_SIZE :
+ case GRN_COLUMN_INDEX :
break;
default :
- /* TODO: put inspected the 1nd argument to message */
+ /* TODO: put inspected the 1st argument to message */
ERR(GRN_INVALID_ARGUMENT,
- "sub_filter(): the 1nd argument must be column or accessor");
+ "sub_filter(): the 1st argument must be column or accessor");
rc = ctx->rc;
goto exit;
break;
@@ -5712,21 +5782,9 @@ selector_between_sequential_search(grn_ctx *ctx,
between_data *data,
grn_obj *res, grn_operator op)
{
- double too_many_index_match_ratio = 0.01;
-
- {
- char too_many_index_match_ratio_env[GRN_ENV_BUFFER_SIZE];
- grn_getenv("GRN_BETWEEN_TOO_MANY_INDEX_MATCH_RATIO",
- too_many_index_match_ratio_env,
- GRN_ENV_BUFFER_SIZE);
- if (too_many_index_match_ratio_env[0]) {
- too_many_index_match_ratio = atof(too_many_index_match_ratio_env);
- }
- }
-
if (!selector_between_sequential_search_should_use(
ctx, table, index, index_table, data, res, op,
- too_many_index_match_ratio)) {
+ grn_between_too_many_index_match_ratio)) {
return GRN_FALSE;
}
@@ -6210,19 +6268,8 @@ selector_in_values_sequential_search(grn_ctx *ctx,
{
grn_obj *source;
int n_existing_records;
- double too_many_index_match_ratio = 0.01;
- {
- char too_many_index_match_ratio_env[GRN_ENV_BUFFER_SIZE];
- grn_getenv("GRN_IN_VALUES_TOO_MANY_INDEX_MATCH_RATIO",
- too_many_index_match_ratio_env,
- GRN_ENV_BUFFER_SIZE);
- if (too_many_index_match_ratio_env[0]) {
- too_many_index_match_ratio = atof(too_many_index_match_ratio_env);
- }
- }
-
- if (too_many_index_match_ratio < 0.0) {
+ if (grn_in_values_too_many_index_match_ratio < 0.0) {
return GRN_FALSE;
}
@@ -6288,9 +6335,11 @@ selector_in_values_sequential_search(grn_ctx *ctx,
/*
* Same as:
- * ((n_existing_record / n_indexed_records) > too_many_index_match_ratio)
+ * ((n_existing_record / n_indexed_records) >
+ * grn_in_values_too_many_index_match_ratio)
*/
- if (n_existing_records > (n_indexed_records * too_many_index_match_ratio)) {
+ if (n_existing_records >
+ (n_indexed_records * grn_in_values_too_many_index_match_ratio)) {
grn_obj_unlink(ctx, &value_ids);
grn_obj_unlink(ctx, source);
return GRN_FALSE;
@@ -6709,6 +6758,47 @@ proc_plugin_unregister(grn_ctx *ctx, int nargs, grn_obj **args,
return NULL;
}
+static grn_obj *
+proc_io_flush(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
+{
+ grn_obj *target_name;
+ grn_obj *recursive;
+ grn_obj *target;
+ grn_bool is_recursive;
+
+ target_name = VAR(0);
+ recursive = VAR(1);
+
+ if (GRN_TEXT_LEN(target_name) > 0) {
+ target = grn_ctx_get(ctx,
+ GRN_TEXT_VALUE(target_name),
+ GRN_TEXT_LEN(target_name));
+ if (!target) {
+ ERR(GRN_INVALID_ARGUMENT, "[io_flush] unknown target: <%.*s>",
+ (int)GRN_TEXT_LEN(target_name),
+ GRN_TEXT_VALUE(target_name));
+ GRN_OUTPUT_BOOL(GRN_FALSE);
+ return NULL;
+ }
+ } else {
+ target = grn_ctx_db(ctx);
+ }
+
+ is_recursive = bool_option_value(recursive, GRN_TRUE);
+ {
+ grn_rc rc;
+ if (is_recursive) {
+ rc = grn_obj_flush_recursive(ctx, target);
+ } else {
+ rc = grn_obj_flush(ctx, target);
+ }
+
+ GRN_OUTPUT_BOOL(rc == GRN_SUCCESS);
+ }
+
+ return NULL;
+}
+
#define DEF_VAR(v,name_str) do {\
(v).name = (name_str);\
(v).name_size = GRN_STRLEN(name_str);\
@@ -6987,4 +7077,8 @@ grn_db_init_builtin_query(grn_ctx *ctx)
DEF_VAR(vars[0], "name");
DEF_COMMAND("plugin_unregister", proc_plugin_unregister, 1, vars);
+
+ DEF_VAR(vars[0], "target_name");
+ DEF_VAR(vars[1], "recursive");
+ DEF_COMMAND("io_flush", proc_io_flush, 2, vars);
}
diff --git a/storage/mroonga/vendor/groonga/lib/sources.am b/storage/mroonga/vendor/groonga/lib/sources.am
index 459b73792ab..ab1ad3e81b5 100644
--- a/storage/mroonga/vendor/groonga/lib/sources.am
+++ b/storage/mroonga/vendor/groonga/lib/sources.am
@@ -11,10 +11,15 @@ libgroonga_la_SOURCES = \
grn_dat.h \
db.c \
grn_db.h \
+ egn.cpp \
+ grn_egn.h \
+ grn_egn.hpp \
error.c \
grn_error.h \
expr.c \
grn_expr.h \
+ expr_code.c \
+ grn_expr_code.h \
geo.c \
grn_geo.h \
grn.h \
diff --git a/storage/mroonga/vendor/groonga/lib/store.c b/storage/mroonga/vendor/groonga/lib/store.c
index 027f86baac8..d43ebb466e3 100644
--- a/storage/mroonga/vendor/groonga/lib/store.c
+++ b/storage/mroonga/vendor/groonga/lib/store.c
@@ -23,7 +23,8 @@
/* rectangular arrays */
-#define GRN_RA_SEGMENT_SIZE (1 << 22)
+#define GRN_RA_W_SEGMENT 22
+#define GRN_RA_SEGMENT_SIZE (1 << GRN_RA_W_SEGMENT)
static grn_ra *
_grn_ra_create(grn_ctx *ctx, grn_ra *ra, const char *path, unsigned int element_size)
@@ -46,7 +47,7 @@ _grn_ra_create(grn_ctx *ctx, grn_ra *ra, const char *path, unsigned int element_
grn_io_set_type(io, GRN_COLUMN_FIX_SIZE);
header->element_size = actual_size;
n_elm = GRN_RA_SEGMENT_SIZE / header->element_size;
- for (w_elm = 22; (1 << w_elm) > n_elm; w_elm--);
+ for (w_elm = GRN_RA_W_SEGMENT; (1 << w_elm) > n_elm; w_elm--);
ra->io = io;
ra->header = header;
ra->element_mask = n_elm - 1;
@@ -89,7 +90,7 @@ grn_ra_open(grn_ctx *ctx, const char *path)
return NULL;
}
n_elm = GRN_RA_SEGMENT_SIZE / header->element_size;
- for (w_elm = 22; (1 << w_elm) > n_elm; w_elm--);
+ for (w_elm = GRN_RA_W_SEGMENT; (1 << w_elm) > n_elm; w_elm--);
GRN_DB_OBJ_SET_TYPE(ra, GRN_COLUMN_FIX_SIZE);
ra->io = io;
ra->header = header;
diff --git a/storage/mroonga/vendor/groonga/lib/token_cursor.c b/storage/mroonga/vendor/groonga/lib/token_cursor.c
index d98d1d46342..ac1c936110b 100644
--- a/storage/mroonga/vendor/groonga/lib/token_cursor.c
+++ b/storage/mroonga/vendor/groonga/lib/token_cursor.c
@@ -245,7 +245,7 @@ grn_token_cursor_next(grn_ctx *ctx, grn_token_cursor *token_cursor)
continue;
}
} else {
- if (status & GRN_TOKEN_LAST) {
+ if (status & GRN_TOKEN_REACH_END) {
token_cursor->force_prefix = GRN_TRUE;
}
}
diff --git a/storage/mroonga/vendor/groonga/lib/tokenizers.c b/storage/mroonga/vendor/groonga/lib/tokenizers.c
index 8ed0b8c37fa..28fd13c33c4 100644
--- a/storage/mroonga/vendor/groonga/lib/tokenizers.c
+++ b/storage/mroonga/vendor/groonga/lib/tokenizers.c
@@ -473,23 +473,23 @@ typedef struct {
grn_tokenizer_token token;
grn_tokenizer_query *query;
struct {
- grn_bool have_begin;
- grn_bool have_end;
int32_t n_skip_tokens;
} get;
grn_bool is_begin;
grn_bool is_end;
- grn_bool is_first_token;
+ grn_bool is_start_token;
grn_bool is_overlapping;
const char *next;
const char *end;
+ unsigned int nth_char;
+ const uint_least8_t *char_types;
grn_obj buffer;
} grn_regexp_tokenizer;
static grn_obj *
regexp_init(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
{
- unsigned int normalize_flags = 0;
+ unsigned int normalize_flags = GRN_STRING_WITH_TYPES;
grn_tokenizer_query *query;
const char *normalized;
unsigned int normalized_length_in_bytes;
@@ -512,13 +512,11 @@ regexp_init(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
grn_tokenizer_token_init(ctx, &(tokenizer->token));
tokenizer->query = query;
- tokenizer->get.have_begin = GRN_FALSE;
- tokenizer->get.have_end = GRN_FALSE;
tokenizer->get.n_skip_tokens = 0;
tokenizer->is_begin = GRN_TRUE;
tokenizer->is_end = GRN_FALSE;
- tokenizer->is_first_token = GRN_TRUE;
+ tokenizer->is_start_token = GRN_TRUE;
tokenizer->is_overlapping = GRN_FALSE;
grn_string_get_normalized(ctx, tokenizer->query->normalized_query,
@@ -526,39 +524,9 @@ regexp_init(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
NULL);
tokenizer->next = normalized;
tokenizer->end = tokenizer->next + normalized_length_in_bytes;
-
- if (tokenizer->query->tokenize_mode == GRN_TOKEN_GET) {
- unsigned int query_length = tokenizer->query->length;
- if (query_length >= 2) {
- const char *query_string = tokenizer->query->ptr;
- grn_encoding encoding = tokenizer->query->encoding;
- if (query_string[0] == '\\' && query_string[1] == 'A') {
- tokenizer->get.have_begin = GRN_TRUE;
- /* TODO: It assumes that both "\\" and "A" are normalized to 1
- characters. Normalizer may omit character or expand to
- multiple characters. */
- tokenizer->next += grn_charlen_(ctx, tokenizer->next, tokenizer->end,
- encoding);
- tokenizer->next += grn_charlen_(ctx, tokenizer->next, tokenizer->end,
- encoding);
- }
- if (query_string[query_length - 2] == '\\' &&
- query_string[query_length - 1] == 'z') {
- tokenizer->get.have_end = GRN_TRUE;
- /* TODO: It assumes that both "\\" and "z" are normalized to 1
- byte characters. Normalizer may omit character or expand to
- multiple characters. */
- tokenizer->end -= grn_charlen_(ctx,
- tokenizer->end - 1,
- tokenizer->end,
- encoding);
- tokenizer->end -= grn_charlen_(ctx,
- tokenizer->end - 1,
- tokenizer->end,
- encoding);
- }
- }
- }
+ tokenizer->nth_char = 0;
+ tokenizer->char_types =
+ grn_string_get_types(ctx, tokenizer->query->normalized_query);
GRN_TEXT_INIT(&(tokenizer->buffer), 0);
@@ -576,23 +544,32 @@ regexp_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
grn_obj *buffer = &(tokenizer->buffer);
const char *current = tokenizer->next;
const char *end = tokenizer->end;
+ const const uint_least8_t *char_types = tokenizer->char_types;
grn_tokenize_mode mode = tokenizer->query->tokenize_mode;
- grn_bool escaping = GRN_FALSE;
+ grn_bool is_begin = tokenizer->is_begin;
+ grn_bool is_start_token = tokenizer->is_start_token;
+ grn_bool break_by_blank = GRN_FALSE;
+ grn_bool break_by_end_mark = GRN_FALSE;
GRN_BULK_REWIND(buffer);
+ tokenizer->is_begin = GRN_FALSE;
+ tokenizer->is_start_token = GRN_FALSE;
- if (mode == GRN_TOKEN_GET) {
- if (tokenizer->get.have_begin) {
+ if (char_types) {
+ char_types += tokenizer->nth_char;
+ }
+
+ if (mode != GRN_TOKEN_GET) {
+ if (is_begin) {
grn_tokenizer_token_push(ctx,
&(tokenizer->token),
GRN_TOKENIZER_BEGIN_MARK_UTF8,
GRN_TOKENIZER_BEGIN_MARK_UTF8_LEN,
status);
- tokenizer->get.have_begin = GRN_FALSE;
return NULL;
}
- if (tokenizer->is_end && tokenizer->get.have_end) {
+ if (tokenizer->is_end) {
status |= GRN_TOKEN_LAST | GRN_TOKEN_REACH_END;
grn_tokenizer_token_push(ctx,
&(tokenizer->token),
@@ -601,18 +578,45 @@ regexp_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
status);
return NULL;
}
- } else {
- if (tokenizer->is_begin) {
+ if (is_start_token) {
+ if (char_types && GRN_STR_ISBLANK(char_types[-1])) {
+ status |= GRN_TOKEN_SKIP;
+ grn_tokenizer_token_push(ctx, &(tokenizer->token), "", 0, status);
+ return NULL;
+ }
+ }
+ }
+
+ char_len = grn_charlen_(ctx, current, end, tokenizer->query->encoding);
+ if (char_len == 0) {
+ status |= GRN_TOKEN_LAST | GRN_TOKEN_REACH_END;
+ grn_tokenizer_token_push(ctx, &(tokenizer->token), "", 0, status);
+ return NULL;
+ }
+
+ if (mode == GRN_TOKEN_GET) {
+ if (is_begin &&
+ char_len == GRN_TOKENIZER_BEGIN_MARK_UTF8_LEN &&
+ memcmp(current, GRN_TOKENIZER_BEGIN_MARK_UTF8, char_len) == 0) {
+ n_characters++;
+ GRN_TEXT_PUT(ctx, buffer, current, char_len);
+ current += char_len;
+ tokenizer->next = current;
+ tokenizer->nth_char++;
+ if (current == end) {
+ status |= GRN_TOKEN_LAST | GRN_TOKEN_REACH_END;
+ }
grn_tokenizer_token_push(ctx,
&(tokenizer->token),
GRN_TOKENIZER_BEGIN_MARK_UTF8,
GRN_TOKENIZER_BEGIN_MARK_UTF8_LEN,
status);
- tokenizer->is_begin = GRN_FALSE;
return NULL;
}
- if (tokenizer->is_end) {
+ if (current + char_len == end &&
+ char_len == GRN_TOKENIZER_END_MARK_UTF8_LEN &&
+ memcmp(current, GRN_TOKENIZER_END_MARK_UTF8, char_len) == 0) {
status |= GRN_TOKEN_LAST | GRN_TOKEN_REACH_END;
grn_tokenizer_token_push(ctx,
&(tokenizer->token),
@@ -623,28 +627,21 @@ regexp_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
}
}
- char_len = grn_charlen_(ctx, current, end, tokenizer->query->encoding);
- if (char_len == 0) {
- status |= GRN_TOKEN_LAST | GRN_TOKEN_REACH_END;
- grn_tokenizer_token_push(ctx, &(tokenizer->token), "", 0, status);
- return NULL;
- }
-
while (GRN_TRUE) {
- if (!escaping && mode == GRN_TOKEN_GET &&
- char_len == 1 && current[0] == '\\') {
- current += char_len;
- escaping = GRN_TRUE;
- } else {
- n_characters++;
- GRN_TEXT_PUT(ctx, buffer, current, char_len);
- current += char_len;
- escaping = GRN_FALSE;
- if (n_characters == 1) {
- tokenizer->next = current;
- }
- if (n_characters == ngram_unit) {
- break;
+ n_characters++;
+ GRN_TEXT_PUT(ctx, buffer, current, char_len);
+ current += char_len;
+ if (n_characters == 1) {
+ tokenizer->next = current;
+ tokenizer->nth_char++;
+ }
+
+ if (char_types) {
+ uint_least8_t char_type;
+ char_type = char_types[0];
+ char_types++;
+ if (GRN_STR_ISBLANK(char_type)) {
+ break_by_blank = GRN_TRUE;
}
}
@@ -653,6 +650,21 @@ regexp_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
if (char_len == 0) {
break;
}
+
+ if (mode == GRN_TOKEN_GET &&
+ current + char_len == end &&
+ char_len == GRN_TOKENIZER_END_MARK_UTF8_LEN &&
+ memcmp(current, GRN_TOKENIZER_END_MARK_UTF8, char_len) == 0) {
+ break_by_end_mark = GRN_TRUE;
+ }
+
+ if (break_by_blank || break_by_end_mark) {
+ break;
+ }
+
+ if (n_characters == ngram_unit) {
+ break;
+ }
}
if (tokenizer->is_overlapping) {
@@ -664,27 +676,21 @@ regexp_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
tokenizer->is_overlapping = (n_characters > 1);
if (mode == GRN_TOKEN_GET) {
- if ((end - tokenizer->next) < ngram_unit) {
- if (tokenizer->get.have_end) {
- if (tokenizer->next == end) {
- tokenizer->is_end = GRN_TRUE;
- }
- if (status & GRN_TOKEN_UNMATURED) {
- if (tokenizer->is_first_token) {
- status |= GRN_TOKEN_FORCE_PREFIX;
- } else {
- status |= GRN_TOKEN_SKIP;
- }
- }
- } else {
- tokenizer->is_end = GRN_TRUE;
- status |= GRN_TOKEN_LAST | GRN_TOKEN_REACH_END;
- if (status & GRN_TOKEN_UNMATURED) {
- status |= GRN_TOKEN_FORCE_PREFIX;
- }
+ if (current == end) {
+ tokenizer->is_end = GRN_TRUE;
+ status |= GRN_TOKEN_LAST | GRN_TOKEN_REACH_END;
+ if (status & GRN_TOKEN_UNMATURED) {
+ status |= GRN_TOKEN_FORCE_PREFIX;
}
} else {
- if (tokenizer->get.n_skip_tokens > 0) {
+ if (break_by_blank) {
+ tokenizer->get.n_skip_tokens = 0;
+ tokenizer->is_start_token = GRN_TRUE;
+ } else if (break_by_end_mark) {
+ if (!is_start_token && (status & GRN_TOKEN_UNMATURED)) {
+ status |= GRN_TOKEN_SKIP;
+ }
+ } else if (tokenizer->get.n_skip_tokens > 0) {
tokenizer->get.n_skip_tokens--;
status |= GRN_TOKEN_SKIP;
} else {
@@ -695,6 +701,9 @@ regexp_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
if (tokenizer->next == end) {
tokenizer->is_end = GRN_TRUE;
}
+ if (break_by_blank) {
+ tokenizer->is_start_token = GRN_TRUE;
+ }
}
grn_tokenizer_token_push(ctx,
@@ -702,7 +711,6 @@ regexp_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
GRN_TEXT_VALUE(buffer),
GRN_TEXT_LEN(buffer),
status);
- tokenizer->is_first_token = GRN_FALSE;
return NULL;
}
@@ -751,6 +759,20 @@ grn_db_init_mecab_tokenizer(grn_ctx *ctx)
case GRN_ENC_EUC_JP :
case GRN_ENC_UTF8 :
case GRN_ENC_SJIS :
+#if defined(GRN_EMBEDDED) && defined(GRN_WITH_MECAB)
+ {
+ GRN_PLUGIN_DECLARE_FUNCTIONS(tokenizers_mecab);
+ grn_rc rc;
+ rc = GRN_PLUGIN_IMPL_NAME_TAGGED(init, tokenizers_mecab)(ctx);
+ if (rc == GRN_SUCCESS) {
+ rc = GRN_PLUGIN_IMPL_NAME_TAGGED(register, tokenizers_mecab)(ctx);
+ if (rc != GRN_SUCCESS) {
+ GRN_PLUGIN_IMPL_NAME_TAGGED(fin, tokenizers_mecab)(ctx);
+ }
+ }
+ return rc;
+ }
+#else /* defined(GRN_EMBEDDED) && defined(GRN_WITH_MECAB) */
{
const char *mecab_plugin_name = "tokenizers/mecab";
char *path;
@@ -762,6 +784,7 @@ grn_db_init_mecab_tokenizer(grn_ctx *ctx)
return GRN_NO_SUCH_FILE_OR_DIRECTORY;
}
}
+#endif /* defined(GRN_EMBEDDED) && defined(GRN_WITH_MECAB) */
break;
default :
return GRN_OPERATION_NOT_SUPPORTED;
diff --git a/storage/mroonga/vendor/groonga/plugins/CMakeLists.txt b/storage/mroonga/vendor/groonga/plugins/CMakeLists.txt
index 37f6127b0d2..6d6a8df5d5e 100644
--- a/storage/mroonga/vendor/groonga/plugins/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/plugins/CMakeLists.txt
@@ -22,8 +22,10 @@ add_subdirectory(token_filters)
add_subdirectory(sharding)
add_subdirectory(functions)
-if(GRN_WITH_MRUBY)
- read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/ruby_scripts.am RUBY_SCRIPTS)
- install(FILES ${RUBY_SCRIPTS}
- DESTINATION "${GRN_RELATIVE_PLUGINS_DIR}")
+if(NOT GRN_EMBED)
+ if(GRN_WITH_MRUBY)
+ read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/ruby_scripts.am RUBY_SCRIPTS)
+ install(FILES ${RUBY_SCRIPTS}
+ DESTINATION "${GRN_RELATIVE_PLUGINS_DIR}")
+ endif()
endif()
diff --git a/storage/mroonga/vendor/groonga/plugins/functions/CMakeLists.txt b/storage/mroonga/vendor/groonga/plugins/functions/CMakeLists.txt
index 28db8b42ef3..d831589b28b 100644
--- a/storage/mroonga/vendor/groonga/plugins/functions/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/plugins/functions/CMakeLists.txt
@@ -21,12 +21,20 @@ set(GRN_FUNCTIONS_PLUGIN_DIR "${GRN_RELATIVE_PLUGINS_DIR}/functions")
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/vector_sources.am
VECTOR_SOURCES)
-add_library(vector_functions MODULE ${VECTOR_SOURCES})
set_source_files_properties(${VECTOR_SOURCES}
PROPERTIES
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
-set_target_properties(vector_functions PROPERTIES
- PREFIX ""
- OUTPUT_NAME "vector")
+if(GRN_EMBED)
+ add_library(vector_functions STATIC ${VECTOR_SOURCES})
+ set_target_properties(
+ vector_functions
+ PROPERTIES
+ POSITION_INDEPENDENT_CODE ON)
+else()
+ add_library(vector_functions MODULE ${VECTOR_SOURCES})
+ set_target_properties(vector_functions PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME "vector")
+ install(TARGETS vector_functions DESTINATION "${GRN_FUNCTIONS_PLUGIN_DIR}")
+endif()
target_link_libraries(vector_functions libgroonga)
-install(TARGETS vector_functions DESTINATION "${GRN_FUNCTIONS_PLUGIN_DIR}")
diff --git a/storage/mroonga/vendor/groonga/plugins/functions/vector.c b/storage/mroonga/vendor/groonga/plugins/functions/vector.c
index 34f7a98fd27..a92fee9dbec 100644
--- a/storage/mroonga/vendor/groonga/plugins/functions/vector.c
+++ b/storage/mroonga/vendor/groonga/plugins/functions/vector.c
@@ -16,6 +16,10 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef GRN_EMBEDDED
+# define GRN_PLUGIN_FUNCTION_TAG functions_vector
+#endif
+
#include <groonga/plugin.h>
static grn_obj *
diff --git a/storage/mroonga/vendor/groonga/plugins/query_expanders/CMakeLists.txt b/storage/mroonga/vendor/groonga/plugins/query_expanders/CMakeLists.txt
index 57d11abfbcb..7f622608e4b 100644
--- a/storage/mroonga/vendor/groonga/plugins/query_expanders/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/plugins/query_expanders/CMakeLists.txt
@@ -22,9 +22,17 @@ read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/tsv_sources.am TSV_SOURCES)
set_source_files_properties(${TSV_SOURCES}
PROPERTIES
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
-add_library(tsv_query_expander MODULE ${TSV_SOURCES})
-set_target_properties(tsv_query_expander PROPERTIES
- PREFIX ""
- OUTPUT_NAME "tsv")
+if(GRN_EMBED)
+ add_library(tsv_query_expander STATIC ${TSV_SOURCES})
+ set_target_properties(
+ tsv_query_expander
+ PROPERTIES
+ POSITION_INDEPENDENT_CODE ON)
+else()
+ add_library(tsv_query_expander MODULE ${TSV_SOURCES})
+ set_target_properties(tsv_query_expander PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME "tsv")
+ install(TARGETS tsv_query_expander DESTINATION "${QUERY_EXPANDERS_DIR}")
+endif()
target_link_libraries(tsv_query_expander libgroonga)
-install(TARGETS tsv_query_expander DESTINATION "${QUERY_EXPANDERS_DIR}")
diff --git a/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c b/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c
index 06bb322acb2..00550f6822b 100644
--- a/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c
+++ b/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c
@@ -15,6 +15,10 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef GRN_EMBEDDED
+# define GRN_PLUGIN_FUNCTION_TAG query_expanders_tsv
+#endif
+
/* groonga's internal headers */
/* for grn_text_fgets(): We don't want to require stdio.h for groonga.h.
What should we do? Should we split header file such as groonga/stdio.h? */
diff --git a/storage/mroonga/vendor/groonga/plugins/ruby/CMakeLists.txt b/storage/mroonga/vendor/groonga/plugins/ruby/CMakeLists.txt
index ba7deafe0d3..63a79938552 100644
--- a/storage/mroonga/vendor/groonga/plugins/ruby/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/plugins/ruby/CMakeLists.txt
@@ -21,20 +21,40 @@ if(GRN_WITH_MRUBY)
set(GRN_RELATIVE_RUBY_PLUGINS_DIR "${GRN_RELATIVE_PLUGINS_DIR}/ruby")
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/eval_sources.am RUBY_EVAL_SOURCES)
- add_library(eval MODULE ${RUBY_EVAL_SOURCES})
set_source_files_properties(${RUBY_EVAL_SOURCES}
PROPERTIES
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
- set_target_properties(eval PROPERTIES PREFIX "")
- target_link_libraries(eval libgroonga)
- install(TARGETS eval DESTINATION "${GRN_RELATIVE_RUBY_PLUGINS_DIR}")
+ if(GRN_EMBED)
+ add_library(ruby_eval STATIC ${RUBY_EVAL_SOURCES})
+ set_target_properties(
+ ruby_eval
+ PROPERTIES
+ POSITION_INDEPENDENT_CODE ON)
+ else()
+ add_library(ruby_eval MODULE ${RUBY_EVAL_SOURCES})
+ set_target_properties(ruby_eval PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME "eval")
+ install(TARGETS ruby_eval DESTINATION "${GRN_RELATIVE_RUBY_PLUGINS_DIR}")
+ endif()
+ target_link_libraries(ruby_eval libgroonga)
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/load_sources.am RUBY_LOAD_SOURCES)
- add_library(load MODULE ${RUBY_LOAD_SOURCES})
set_source_files_properties(${RUBY_LOAD_SOURCES}
PROPERTIES
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
- set_target_properties(load PROPERTIES PREFIX "")
- target_link_libraries(load libgroonga)
- install(TARGETS load DESTINATION "${GRN_RELATIVE_RUBY_PLUGINS_DIR}")
+ if(GRN_EMBED)
+ add_library(ruby_load STATIC ${RUBY_LOAD_SOURCES})
+ set_target_properties(
+ ruby_load
+ PROPERTIES
+ POSITION_INDEPENDENT_CODE ON)
+ else()
+ add_library(ruby_load MODULE ${RUBY_LOAD_SOURCES})
+ set_target_properties(ruby_load PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME "load")
+ install(TARGETS ruby_load DESTINATION "${GRN_RELATIVE_RUBY_PLUGINS_DIR}")
+ endif()
+ target_link_libraries(ruby_load libgroonga)
endif()
diff --git a/storage/mroonga/vendor/groonga/plugins/ruby/eval.c b/storage/mroonga/vendor/groonga/plugins/ruby/eval.c
index ad1e7948249..bacd9011c12 100644
--- a/storage/mroonga/vendor/groonga/plugins/ruby/eval.c
+++ b/storage/mroonga/vendor/groonga/plugins/ruby/eval.c
@@ -16,6 +16,10 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef GRN_EMBEDDED
+# define GRN_PLUGIN_FUNCTION_TAG ruby_eval
+#endif
+
#include "ruby_plugin.h"
static grn_obj *
diff --git a/storage/mroonga/vendor/groonga/plugins/ruby/load.c b/storage/mroonga/vendor/groonga/plugins/ruby/load.c
index a4e60acc357..447882319a5 100644
--- a/storage/mroonga/vendor/groonga/plugins/ruby/load.c
+++ b/storage/mroonga/vendor/groonga/plugins/ruby/load.c
@@ -16,6 +16,10 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef GRN_EMBEDDED
+# define GRN_PLUGIN_FUNCTION_TAG ruby_load
+#endif
+
#include "ruby_plugin.h"
static grn_obj *
diff --git a/storage/mroonga/vendor/groonga/plugins/sharding.rb b/storage/mroonga/vendor/groonga/plugins/sharding.rb
index e369c3798da..4ebc9baf438 100644
--- a/storage/mroonga/vendor/groonga/plugins/sharding.rb
+++ b/storage/mroonga/vendor/groonga/plugins/sharding.rb
@@ -2,3 +2,5 @@ require "sharding/range_expression_builder"
require "sharding/logical_enumerator"
require "sharding/logical_count"
require "sharding/logical_range_filter"
+require "sharding/logical_select"
+require "sharding/logical_table_remove"
diff --git a/storage/mroonga/vendor/groonga/plugins/sharding/CMakeLists.txt b/storage/mroonga/vendor/groonga/plugins/sharding/CMakeLists.txt
index 8d0cdd976dc..588a434e0e0 100644
--- a/storage/mroonga/vendor/groonga/plugins/sharding/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/plugins/sharding/CMakeLists.txt
@@ -13,10 +13,12 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-if(GRN_WITH_MRUBY)
- set(GRN_RELATIVE_SHARDING_PLUGINS_DIR "${GRN_RELATIVE_PLUGINS_DIR}/sharding")
+if(NOT GRN_EMBED)
+ if(GRN_WITH_MRUBY)
+ set(GRN_RELATIVE_SHARDING_PLUGINS_DIR "${GRN_RELATIVE_PLUGINS_DIR}/sharding")
- read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/sources.am SHARDING_SCRIPTS)
- install(FILES ${SHARDING_SCRIPTS}
- DESTINATION "${GRN_RELATIVE_SHARDING_PLUGINS_DIR}")
+ read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/sources.am SHARDING_SCRIPTS)
+ install(FILES ${SHARDING_SCRIPTS}
+ DESTINATION "${GRN_RELATIVE_SHARDING_PLUGINS_DIR}")
+ endif()
endif()
diff --git a/storage/mroonga/vendor/groonga/plugins/sharding/logical_enumerator.rb b/storage/mroonga/vendor/groonga/plugins/sharding/logical_enumerator.rb
index 1aeafef5438..35934182591 100644
--- a/storage/mroonga/vendor/groonga/plugins/sharding/logical_enumerator.rb
+++ b/storage/mroonga/vendor/groonga/plugins/sharding/logical_enumerator.rb
@@ -20,15 +20,37 @@ module Groonga
private
def each_internal(order)
- prefix = "#{@logical_table}_"
context = Context.instance
- context.database.each_table(:prefix => prefix,
- :order_by => :key,
- :order => order) do |table|
- shard_range_raw = table.name[prefix.size..-1]
+ each_shard_with_around(order) do |prev_shard, current_shard, next_shard|
+ table = current_shard.table
+ shard_range_data = current_shard.range_data
+ shard_range = nil
- next unless /\A(\d{4})(\d{2})(\d{2})\z/ =~ shard_range_raw
- shard_range = ShardRange.new($1.to_i, $2.to_i, $3.to_i)
+ if shard_range_data.day.nil?
+ if order == :ascending
+ if next_shard
+ next_shard_range_data = next_shard.range_data
+ else
+ next_shard_range_data = nil
+ end
+ else
+ if prev_shard
+ next_shard_range_data = prev_shard.range_data
+ else
+ next_shard_range_data = nil
+ end
+ end
+ max_day = compute_month_shard_max_day(shard_range_data.year,
+ shard_range_data.month,
+ next_shard_range_data)
+ shard_range = MonthShardRange.new(shard_range_data.year,
+ shard_range_data.month,
+ max_day)
+ else
+ shard_range = DayShardRange.new(shard_range_data.year,
+ shard_range_data.month,
+ shard_range_data.day)
+ end
physical_shard_key_name = "#{table.name}.#{@shard_key_name}"
shard_key = context[physical_shard_key_name]
@@ -43,6 +65,36 @@ module Groonga
end
end
+ def each_shard_with_around(order)
+ context = Context.instance
+ prefix = "#{@logical_table}_"
+
+ shards = [nil]
+ context.database.each_table(:prefix => prefix,
+ :order_by => :key,
+ :order => order) do |table|
+ shard_range_raw = table.name[prefix.size..-1]
+
+ case shard_range_raw
+ when /\A(\d{4})(\d{2})\z/
+ shard_range_data = ShardRangeData.new($1.to_i, $2.to_i, nil)
+ when /\A(\d{4})(\d{2})(\d{2})\z/
+ shard_range_data = ShardRangeData.new($1.to_i, $2.to_i, $3.to_i)
+ else
+ next
+ end
+
+ shards << Shard.new(table, shard_range_data)
+ next if shards.size < 3
+ yield(*shards)
+ shards.shift
+ end
+
+ if shards.size == 2
+ yield(shards[0], shards[1], nil)
+ end
+ end
+
private
def initialize_parameters
@logical_table = @input[:logical_table]
@@ -58,13 +110,84 @@ module Groonga
@target_range = TargetRange.new(@command_name, @input)
end
- class ShardRange
+ def compute_month_shard_max_day(year, month, next_shard_range)
+ return nil if next_shard_range.nil?
+
+ return nil if month != next_shard_range.month
+
+ next_shard_range.day
+ end
+
+ class Shard
+ attr_reader :table, :range_data
+ def initialize(table, range_data)
+ @table = table
+ @range_data = range_data
+ end
+ end
+
+ class ShardRangeData
+ attr_reader :year, :month, :day
+ def initialize(year, month, day)
+ @year = year
+ @month = month
+ @day = day
+ end
+ end
+
+ class DayShardRange
attr_reader :year, :month, :day
def initialize(year, month, day)
@year = year
@month = month
@day = day
end
+
+ def least_over_time
+ Time.local(@year, @month, @day + 1)
+ end
+
+ def min_time
+ Time.local(@year, @month, @day)
+ end
+
+ def include?(time)
+ @year == time.year and
+ @month == time.month and
+ @day == time.day
+ end
+ end
+
+ class MonthShardRange
+ attr_reader :year, :month, :max_day
+ def initialize(year, month, max_day)
+ @year = year
+ @month = month
+ @max_day = max_day
+ end
+
+ def least_over_time
+ if @max_day.nil?
+ Time.local(@year, @month + 1, 1)
+ else
+ Time.local(@year, @month, @max_day + 1)
+ end
+ end
+
+ def min_time
+ Time.local(@year, @month, 1)
+ end
+
+ def include?(time)
+ return false unless @year == time.year
+ return false unless @month == time.month
+
+ if @max_day.nil?
+ true
+ else
+ time.day <= @max_day
+ end
+ end
end
class TargetRange
@@ -139,16 +262,11 @@ module Groonga
end
def in_min?(shard_range)
- base_time = Time.local(shard_range.year,
- shard_range.month,
- shard_range.day + 1)
- @min < base_time
+ @min < shard_range.least_over_time
end
def in_min_partial?(shard_range)
- return false unless @min.year == shard_range.year
- return false unless @min.month == shard_range.month
- return false unless @min.day == shard_range.day
+ return false unless shard_range.include?(@min)
return true if @min_border == :exclude
@@ -159,9 +277,7 @@ module Groonga
end
def in_max?(shard_range)
- max_base_time = Time.local(shard_range.year,
- shard_range.month,
- shard_range.day)
+ max_base_time = shard_range.min_time
if @max_border == :include
@max >= max_base_time
else
@@ -170,9 +286,7 @@ module Groonga
end
def in_max_partial?(shard_range)
- @max.year == shard_range.year and
- @max.month == shard_range.month and
- @max.day == shard_range.day
+ shard_range.include?(@max)
end
end
end
diff --git a/storage/mroonga/vendor/groonga/plugins/sharding/logical_select.rb b/storage/mroonga/vendor/groonga/plugins/sharding/logical_select.rb
new file mode 100644
index 00000000000..da6dbe5ae91
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/plugins/sharding/logical_select.rb
@@ -0,0 +1,332 @@
+module Groonga
+ module Sharding
+ class LogicalSelectCommand < Command
+ register("logical_select",
+ [
+ "logical_table",
+ "shard_key",
+ "min",
+ "min_border",
+ "max",
+ "max_border",
+ "filter",
+ "sortby",
+ "output_columns",
+ "offset",
+ "limit",
+ "drilldown",
+ "drilldown_sortby",
+ "drilldown_output_columns",
+ "drilldown_offset",
+ "drilldown_limit",
+ ])
+
+ def run_body(input)
+ enumerator = LogicalEnumerator.new("logical_select", input)
+
+ context = ExecuteContext.new(input)
+ begin
+ executor = Executor.new(context)
+ executor.execute
+
+ n_results = 1
+ drilldowns = context.drilldown.result_sets
+ n_results += drilldowns.size
+
+ writer.array("RESULT", n_results) do
+ write_records(writer, context)
+ write_drilldowns(writer, context, drilldowns)
+ end
+ ensure
+ context.close
+ end
+ end
+
+ private
+ def write_records(writer, context)
+ result_sets = context.result_sets
+
+ n_hits = 0
+ n_elements = 2 # for N hits and columns
+ result_sets.each do |result_set|
+ n_hits += result_set.size
+ n_elements += result_set.size
+ end
+
+ output_columns = context.output_columns
+
+ writer.array("RESULTSET", n_elements) do
+ writer.array("NHITS", 1) do
+ writer.write(n_hits)
+ end
+ first_result_set = result_sets.first
+ if first_result_set
+ writer.write_table_columns(first_result_set, output_columns)
+ end
+
+ current_offset = context.offset
+ current_offset += n_hits if current_offset < 0
+ current_limit = context.limit
+ current_limit += n_hits + 1 if current_limit < 0
+ options = {
+ :offset => current_offset,
+ :limit => current_limit,
+ }
+ result_sets.each do |result_set|
+ if result_set.size > current_offset
+ writer.write_table_records(result_set, output_columns, options)
+ end
+ if current_offset > 0
+ current_offset = [current_offset - result_set.size, 0].max
+ end
+ current_limit -= result_set.size
+ break if current_limit <= 0
+ options[:offset] = current_offset
+ options[:limit] = current_limit
+ end
+ end
+ end
+
+ def write_drilldowns(writer, context, drilldowns)
+ output_columns = context.drilldown.output_columns
+
+ options = {
+ :offset => context.drilldown.output_offset,
+ :limit => context.drilldown.limit,
+ }
+
+ drilldowns.each do |drilldown|
+ n_elements = 2 # for N hits and columns
+ n_elements += drilldown.size
+ writer.array("RESULTSET", n_elements) do
+ writer.array("NHITS", 1) do
+ writer.write(drilldown.size)
+ end
+ writer.write_table_columns(drilldown, output_columns)
+ writer.write_table_records(drilldown, output_columns,
+ options)
+ end
+ end
+ end
+
+ module KeysParsable
+ private
+ def parse_keys(raw_keys)
+ return [] if raw_keys.nil?
+
+ raw_keys.strip.split(/ *, */)
+ end
+ end
+
+ class ExecuteContext
+ include KeysParsable
+
+ attr_reader :enumerator
+ attr_reader :filter
+ attr_reader :offset
+ attr_reader :limit
+ attr_reader :sort_keys
+ attr_reader :output_columns
+ attr_reader :result_sets
+ attr_reader :drilldown
+ def initialize(input)
+ @input = input
+ @enumerator = LogicalEnumerator.new("logical_select", @input)
+ @filter = @input[:filter]
+ @offset = (@input[:offset] || 0).to_i
+ @limit = (@input[:limit] || 10).to_i
+ @sort_keys = parse_keys(@input[:sortby])
+ @output_columns = @input[:output_columns] || "_key, *"
+
+ @result_sets = []
+
+ @drilldown = DrilldownExecuteContext.new(@input)
+ end
+
+ def close
+ @result_sets.each do |result_set|
+ result_set.close if result_set.temporary?
+ end
+
+ @drilldown.close
+ end
+ end
+
+ class DrilldownExecuteContext
+ include KeysParsable
+
+ attr_reader :keys
+ attr_reader :offset
+ attr_reader :limit
+ attr_reader :sort_keys
+ attr_reader :output_columns
+ attr_reader :output_offset
+ attr_reader :result_sets
+ attr_reader :unsorted_result_sets
+ def initialize(input)
+ @input = input
+ @keys = parse_keys(@input[:drilldown])
+ @offset = (@input[:drilldown_offset] || 0).to_i
+ @limit = (@input[:drilldown_limit] || 10).to_i
+ @sort_keys = parse_keys(@input[:drilldown_sortby])
+ @output_columns = @input[:drilldown_output_columns]
+ @output_columns ||= "_key, _nsubrecs"
+
+ if @sort_keys.empty?
+ @output_offset = @offset
+ else
+ @output_offset = 0
+ end
+
+ @result_sets = []
+ @unsorted_result_sets = []
+ end
+
+ def close
+ @result_sets.each do |result_set|
+ result_set.close
+ end
+ @unsorted_result_sets.each do |result_set|
+ result_set.close
+ end
+ end
+ end
+
+ class Executor
+ def initialize(context)
+ @context = context
+ end
+
+ def execute
+ execute_search
+ execute_drilldown
+ end
+
+ private
+ def execute_search
+ first_table = nil
+ enumerator = @context.enumerator
+ enumerator.each do |table, shard_key, shard_range|
+ first_table ||= table
+ next if table.empty?
+
+ shard_executor = ShardExecutor.new(@context,
+ table, shard_key, shard_range)
+ shard_executor.execute
+ end
+ if first_table.nil?
+ message =
+ "[logical_select] no shard exists: " +
+ "logical_table: <#{enumerator.logical_table}>: " +
+ "shard_key: <#{enumerator.shard_key_name}>"
+ raise InvalidArgument, message
+ end
+ if @context.result_sets.empty?
+ result_set = HashTable.create(:flags => ObjectFlags::WITH_SUBREC,
+ :key_type => first_table)
+ @context.result_sets << result_set
+ end
+ end
+
+ def execute_drilldown
+ drilldown = @context.drilldown
+ group_result = TableGroupResult.new
+ sort_options = {
+ :offset => drilldown.offset,
+ :limit => drilldown.limit,
+ }
+ begin
+ group_result.key_begin = 0
+ group_result.key_end = 0
+ group_result.limit = 1
+ group_result.flags = TableGroupFlags::CALC_COUNT
+ drilldown.keys.each do |key|
+ @context.result_sets.each do |result_set|
+ result_set.group([key], group_result)
+ end
+ result_set = group_result.table
+ if drilldown.sort_keys.empty?
+ drilldown.result_sets << result_set
+ else
+ drilldown.result_sets << result_set.sort(drilldown.sort_keys,
+ sort_options)
+ drilldown.unsorted_result_sets << result_set
+ end
+ group_result.table = nil
+ end
+ ensure
+ group_result.close
+ end
+ end
+ end
+
+ class ShardExecutor
+ def initialize(context, table, shard_key, shard_range)
+ @context = context
+ @table = table
+ @shard_key = shard_key
+ @shard_range = shard_range
+
+ @filter = @context.filter
+ @result_sets = @context.result_sets
+
+ @target_range = @context.enumerator.target_range
+
+ @cover_type = @target_range.cover_type(@shard_range)
+
+ @expression_builder = RangeExpressionBuilder.new(@shard_key,
+ @target_range,
+ @filter)
+ end
+
+ def execute
+ return if @cover_type == :none
+
+ case @cover_type
+ when :all
+ filter_shard_all
+ when :partial_min
+ filter_table do |expression|
+ @expression_builder.build_partial_min(expression)
+ end
+ when :partial_max
+ filter_table do |expression|
+ @expression_builder.build_partial_max(expression)
+ end
+ when :partial_min_and_max
+ filter_table do |expression|
+ @expression_builder.build_partial_min_and_max(expression)
+ end
+ end
+ end
+
+ private
+ def filter_shard_all
+ if @filter.nil?
+ @result_sets << @table
+ else
+ filter_table do |expression|
+ @expression_builder.build_all(expression)
+ end
+ end
+ end
+
+ def create_expression(table)
+ expression = Expression.create(table)
+ begin
+ yield(expression)
+ ensure
+ expression.close
+ end
+ end
+
+ def filter_table
+ create_expression(@table) do |expression|
+ yield(expression)
+ @result_sets << @table.select(expression)
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/storage/mroonga/vendor/groonga/plugins/sharding/logical_table_remove.rb b/storage/mroonga/vendor/groonga/plugins/sharding/logical_table_remove.rb
new file mode 100644
index 00000000000..f5c31c72bb1
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/plugins/sharding/logical_table_remove.rb
@@ -0,0 +1,70 @@
+module Groonga
+ module Sharding
+ class LogicalTableRemoveCommand < Command
+ register("logical_table_remove",
+ [
+ "logical_table",
+ "shard_key",
+ "min",
+ "min_border",
+ "max",
+ "max_border",
+ ])
+
+ def run_body(input)
+ enumerator = LogicalEnumerator.new("logical_table_remove", input)
+
+ succeess = true
+ enumerator.each do |table, shard_key, shard_range|
+ remove_table(table,
+ shard_key,
+ shard_range,
+ enumerator.target_range)
+ end
+ writer.write(succeess)
+ end
+
+ private
+ def remove_table(table, shard_key, shard_range, target_range)
+ cover_type = target_range.cover_type(shard_range)
+ return if cover_type == :none
+
+ expression_builder = RangeExpressionBuilder.new(shard_key,
+ target_range,
+ nil)
+
+ case cover_type
+ when :all
+ table.remove
+ when :partial_min
+ remove_records(table) do |expression|
+ expression_builder.build_partial_min(expression)
+ end
+ table.remove if table.empty?
+ when :partial_max
+ remove_records(table) do |expression|
+ expression_builder.build_partial_max(expression)
+ end
+ table.remove if table.empty?
+ when :partial_min_and_max
+ remove_records(table) do |expression|
+ expression_builder.build_partial_min_and_max(expression)
+ end
+ table.remove if table.empty?
+ end
+ end
+
+ def remove_records(table)
+ expression = nil
+
+ begin
+ expression = Expression.create(table)
+ yield(expression)
+ table.delete(:expression => expression)
+ ensure
+ expression.close if expression
+ end
+ end
+ end
+ end
+end
diff --git a/storage/mroonga/vendor/groonga/plugins/sharding/sources.am b/storage/mroonga/vendor/groonga/plugins/sharding/sources.am
index 5defd4880f1..14e56609cae 100644
--- a/storage/mroonga/vendor/groonga/plugins/sharding/sources.am
+++ b/storage/mroonga/vendor/groonga/plugins/sharding/sources.am
@@ -2,4 +2,6 @@ sharding_scripts = \
logical_count.rb \
logical_enumerator.rb \
logical_range_filter.rb \
+ logical_select.rb \
+ logical_table_remove.rb \
range_expression_builder.rb
diff --git a/storage/mroonga/vendor/groonga/plugins/suggest/CMakeLists.txt b/storage/mroonga/vendor/groonga/plugins/suggest/CMakeLists.txt
index 519193918b4..03375f97adb 100644
--- a/storage/mroonga/vendor/groonga/plugins/suggest/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/plugins/suggest/CMakeLists.txt
@@ -18,10 +18,18 @@ include_directories(
${MRUBY_INCLUDE_DIRS})
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/sources.am SUGGEST_SOURCES)
-add_library(suggest MODULE ${SUGGEST_SOURCES})
set_source_files_properties(${SUGGEST_SOURCES}
PROPERTIES
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
-set_target_properties(suggest PROPERTIES PREFIX "")
+if(GRN_EMBED)
+ add_library(suggest STATIC ${SUGGEST_SOURCES})
+ set_target_properties(
+ suggest
+ PROPERTIES
+ POSITION_INDEPENDENT_CODE ON)
+else()
+ add_library(suggest MODULE ${SUGGEST_SOURCES})
+ set_target_properties(suggest PROPERTIES PREFIX "")
+ install(TARGETS suggest DESTINATION "${GRN_RELATIVE_PLUGINS_DIR}/suggest")
+endif()
target_link_libraries(suggest libgroonga)
-install(TARGETS suggest DESTINATION "${GRN_RELATIVE_PLUGINS_DIR}/suggest")
diff --git a/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c b/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c
index 863ffcf13e3..073f5e00103 100644
--- a/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c
+++ b/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c
@@ -15,6 +15,10 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef GRN_EMBEDDED
+# define GRN_PLUGIN_FUNCTION_TAG suggest_suggest
+#endif
+
#include <string.h>
#include "grn_ctx.h"
diff --git a/storage/mroonga/vendor/groonga/plugins/table/CMakeLists.txt b/storage/mroonga/vendor/groonga/plugins/table/CMakeLists.txt
index eada0395080..bd423a830b3 100644
--- a/storage/mroonga/vendor/groonga/plugins/table/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/plugins/table/CMakeLists.txt
@@ -18,10 +18,12 @@ include_directories(
${MRUBY_INCLUDE_DIRS})
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/sources.am TABLE_SOURCES)
-add_library(table MODULE ${TABLE_SOURCES})
-set_source_files_properties(${TABLE_SOURCES}
- PROPERTIES
- COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
-set_target_properties(table PROPERTIES PREFIX "")
-target_link_libraries(table libgroonga)
-install(TARGETS table DESTINATION "${GRN_RELATIVE_PLUGINS_DIR}/table")
+if(NOT GRN_EMBED)
+ add_library(table MODULE ${TABLE_SOURCES})
+ set_source_files_properties(${TABLE_SOURCES}
+ PROPERTIES
+ COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
+ set_target_properties(table PROPERTIES PREFIX "")
+ target_link_libraries(table libgroonga)
+ install(TARGETS table DESTINATION "${GRN_RELATIVE_PLUGINS_DIR}/table")
+endif()
diff --git a/storage/mroonga/vendor/groonga/plugins/token_filters/CMakeLists.txt b/storage/mroonga/vendor/groonga/plugins/token_filters/CMakeLists.txt
index a0b964fb659..55491b20bd7 100644
--- a/storage/mroonga/vendor/groonga/plugins/token_filters/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/plugins/token_filters/CMakeLists.txt
@@ -21,27 +21,43 @@ set(TOKEN_FILTERS_DIR "${GRN_RELATIVE_PLUGINS_DIR}/token_filters")
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/stop_word_sources.am
STOP_WORD_SOURCES)
-add_library(stop_word_token_filter MODULE ${STOP_WORD_SOURCES})
set_source_files_properties(${STOP_WORD_SOURCES}
PROPERTIES
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
-set_target_properties(stop_word_token_filter PROPERTIES
- PREFIX ""
- OUTPUT_NAME "stop_word")
+if(GRN_EMBED)
+ add_library(stop_word_token_filter STATIC ${STOP_WORD_SOURCES})
+ set_target_properties(
+ stop_word_token_filter
+ PROPERTIES
+ POSITION_INDEPENDENT_CODE ON)
+else()
+ add_library(stop_word_token_filter MODULE ${STOP_WORD_SOURCES})
+ set_target_properties(stop_word_token_filter PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME "stop_word")
+ install(TARGETS stop_word_token_filter DESTINATION "${TOKEN_FILTERS_DIR}")
+endif()
target_link_libraries(stop_word_token_filter libgroonga)
-install(TARGETS stop_word_token_filter DESTINATION "${TOKEN_FILTERS_DIR}")
if(GRN_WITH_LIBSTEMMER)
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/stem_sources.am STEM_SOURCES)
include_directories(${LIBSTEMMER_INCLUDE_DIRS})
link_directories(${LIBSTEMMER_LIBRARY_DIRS})
- add_library(stem_token_filter MODULE ${STEM_SOURCES})
set_source_files_properties(${STEM_SOURCES}
PROPERTIES
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
- set_target_properties(stem_token_filter PROPERTIES
- PREFIX ""
- OUTPUT_NAME "stem")
+ if(GRN_EMBED)
+ add_library(stem_token_filter STATIC ${STEM_SOURCES})
+ set_target_properties(
+ stem_token_filter
+ PROPERTIES
+ POSITION_INDEPENDENT_CODE ON)
+ else()
+ add_library(stem_token_filter MODULE ${STEM_SOURCES})
+ set_target_properties(stem_token_filter PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME "stem")
+ install(TARGETS stem_token_filter DESTINATION "${TOKEN_FILTERS_DIR}")
+ endif()
target_link_libraries(stem_token_filter libgroonga ${LIBSTEMMER_LIBRARIES})
- install(TARGETS stem_token_filter DESTINATION "${TOKEN_FILTERS_DIR}")
endif()
diff --git a/storage/mroonga/vendor/groonga/plugins/token_filters/stem.c b/storage/mroonga/vendor/groonga/plugins/token_filters/stem.c
index 010b8c91867..63e640d5ea2 100644
--- a/storage/mroonga/vendor/groonga/plugins/token_filters/stem.c
+++ b/storage/mroonga/vendor/groonga/plugins/token_filters/stem.c
@@ -16,6 +16,10 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef GRN_EMBEDDED
+# define GRN_PLUGIN_FUNCTION_TAG token_filters_stem
+#endif
+
#include <grn_str.h>
#include <groonga.h>
diff --git a/storage/mroonga/vendor/groonga/plugins/token_filters/stop_word.c b/storage/mroonga/vendor/groonga/plugins/token_filters/stop_word.c
index 054cd65aa37..e5a9a77de2e 100644
--- a/storage/mroonga/vendor/groonga/plugins/token_filters/stop_word.c
+++ b/storage/mroonga/vendor/groonga/plugins/token_filters/stop_word.c
@@ -16,6 +16,10 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef GRN_EMBEDDED
+# define GRN_PLUGIN_FUNCTION_TAG token_filters_stop_word
+#endif
+
#include <grn_str.h>
#include <groonga.h>
diff --git a/storage/mroonga/vendor/groonga/plugins/tokenizers/CMakeLists.txt b/storage/mroonga/vendor/groonga/plugins/tokenizers/CMakeLists.txt
index 5871e982211..9209b44d36f 100644
--- a/storage/mroonga/vendor/groonga/plugins/tokenizers/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/plugins/tokenizers/CMakeLists.txt
@@ -22,28 +22,44 @@ if(GRN_WITH_MECAB)
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/mecab_sources.am MECAB_SOURCES)
include_directories(${MECAB_INCLUDE_DIRS})
link_directories(${MECAB_LIBRARY_DIRS})
- add_library(mecab_tokenizer MODULE ${MECAB_SOURCES})
set_source_files_properties(${MECAB_SOURCES}
PROPERTIES
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
- set_target_properties(mecab_tokenizer PROPERTIES
- PREFIX ""
- OUTPUT_NAME "mecab")
+ if(GRN_EMBED)
+ add_library(mecab_tokenizer STATIC ${MECAB_SOURCES})
+ set_target_properties(
+ mecab_tokenizer
+ PROPERTIES
+ POSITION_INDEPENDENT_CODE ON)
+ else()
+ add_library(mecab_tokenizer MODULE ${MECAB_SOURCES})
+ set_target_properties(mecab_tokenizer PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME "mecab")
+ install(TARGETS mecab_tokenizer DESTINATION "${TOKENIZERS_DIR}")
+ endif()
target_link_libraries(mecab_tokenizer libgroonga ${MECAB_LIBRARIES})
- install(TARGETS mecab_tokenizer DESTINATION "${TOKENIZERS_DIR}")
endif()
if(GRN_WITH_KYTEA)
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/kytea_sources.am KYTEA_SOURCES)
include_directories(${KYTEA_INCLUDE_DIRS})
link_directories(${KYTEA_LIBRARY_DIRS})
- add_library(kytea_tokenizer MODULE ${KYTEA_SOURCES})
set_source_files_properties(${KYTEA_SOURCES}
PROPERTIES
COMPILE_FLAGS "${GRN_CXX_COMPILE_FLAGS}")
- set_target_properties(kytea_tokenizer PROPERTIES
- PREFIX ""
- OUTPUT_NAME "kytea")
+ if(GRN_EMBED)
+ add_library(kytea_tokenizer STATIC ${KYTEA_SOURCES})
+ set_target_properties(
+ kytea_tokenizer
+ PROPERTIES
+ POSITION_INDEPENDENT_CODE ON)
+ else()
+ add_library(kytea_tokenizer MODULE ${KYTEA_SOURCES})
+ set_target_properties(kytea_tokenizer PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME "kytea")
+ install(TARGETS kytea_tokenizer DESTINATION "${TOKENIZERS_DIR}")
+ endif()
target_link_libraries(kytea_tokenizer libgroonga ${KYTEA_LIBRARIES})
- install(TARGETS kytea_tokenizer DESTINATION "${TOKENIZERS_DIR}")
endif()
diff --git a/storage/mroonga/vendor/groonga/plugins/tokenizers/kytea.cpp b/storage/mroonga/vendor/groonga/plugins/tokenizers/kytea.cpp
index a7ee4104592..62ef0bb5845 100644
--- a/storage/mroonga/vendor/groonga/plugins/tokenizers/kytea.cpp
+++ b/storage/mroonga/vendor/groonga/plugins/tokenizers/kytea.cpp
@@ -15,6 +15,10 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef GRN_EMBEDDED
+# define GRN_PLUGIN_FUNCTION_TAG tokenizers_kytea
+#endif
+
#include <groonga/tokenizer.h>
#include <kytea/kytea.h>
diff --git a/storage/mroonga/vendor/groonga/plugins/tokenizers/mecab.c b/storage/mroonga/vendor/groonga/plugins/tokenizers/mecab.c
index 9207f94229e..bade2f9d3de 100644
--- a/storage/mroonga/vendor/groonga/plugins/tokenizers/mecab.c
+++ b/storage/mroonga/vendor/groonga/plugins/tokenizers/mecab.c
@@ -15,6 +15,10 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef GRN_EMBEDDED
+# define GRN_PLUGIN_FUNCTION_TAG tokenizers_mecab
+#endif
+
#include <grn_str.h>
#include <groonga.h>
@@ -509,17 +513,21 @@ grn_rc
GRN_PLUGIN_INIT(grn_ctx *ctx)
{
{
- const char *env;
+ char env[GRN_ENV_BUFFER_SIZE];
- env = getenv("GRN_MECAB_CHUNKED_TOKENIZE_ENABLED");
- grn_mecab_chunked_tokenize_enabled = (env && strcmp(env, "yes") == 0);
+ grn_getenv("GRN_MECAB_CHUNKED_TOKENIZE_ENABLED",
+ env,
+ GRN_ENV_BUFFER_SIZE);
+ grn_mecab_chunked_tokenize_enabled = (env[0] && strcmp(env, "yes") == 0);
}
{
- const char *env;
+ char env[GRN_ENV_BUFFER_SIZE];
- env = getenv("GRN_MECAB_CHUNK_SIZE_THRESHOLD");
- if (env) {
+ grn_getenv("GRN_MECAB_CHUNK_SIZE_THRESHOLD",
+ env,
+ GRN_ENV_BUFFER_SIZE);
+ if (env[0]) {
int threshold = -1;
const char *end;
const char *rest;
diff --git a/storage/mroonga/vendor/groonga/ra.rb b/storage/mroonga/vendor/groonga/ra.rb
new file mode 100755
index 00000000000..dbe493d7454
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/ra.rb
@@ -0,0 +1,12 @@
+#!/usr/bin/env ruby
+
+puts "table_create X TABLE_NO_KEY"
+puts "column_create X a COLUMN_SCALAR Int64"
+puts "load --table X"
+puts "["
+n_records = 2 ** 28
+(n_records - 1).times do |i|
+ puts "{\"a\": #{i}},"
+end
+puts "{\"a\": #{n_records - 1}}"
+puts "]"
diff --git a/storage/mroonga/vendor/groonga/src/grndb.c b/storage/mroonga/vendor/groonga/src/grndb.c
index d493338f57e..d5a353e229a 100644
--- a/storage/mroonga/vendor/groonga/src/grndb.c
+++ b/storage/mroonga/vendor/groonga/src/grndb.c
@@ -120,6 +120,8 @@ main(int argc, char **argv)
{
int exit_code = EXIT_SUCCESS;
+ grn_default_logger_set_path(GRN_LOG_PATH);
+
if (grn_init() != GRN_SUCCESS) {
return EXIT_FAILURE;
}
diff --git a/storage/mroonga/vendor/groonga/src/grnslap.c b/storage/mroonga/vendor/groonga/src/grnslap.c
index 2f5562fe6a9..f9eee1081fd 100644
--- a/storage/mroonga/vendor/groonga/src/grnslap.c
+++ b/storage/mroonga/vendor/groonga/src/grnslap.c
@@ -21,11 +21,11 @@
#include <string.h>
#include <stdio.h>
#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
+# include <sys/wait.h>
#endif /* HAVE_SYS_WAIT_H */
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif /* HAVE_NETINET_IN_H */
+#ifndef WIN32
+# include <netinet/in.h>
+#endif /* WIN32 */
#define DEFAULT_PORT 10041
#define DEFAULT_HOST "localhost"
@@ -362,6 +362,8 @@ main(int argc, char **argv)
flags |= flag_usage;
}
+ grn_default_logger_set_path(GRN_LOG_PATH);
+
if (grn_init()) { return -1; }
if (flags & flag_usage) {
usage(); r = -1;
diff --git a/storage/mroonga/vendor/groonga/src/groonga.c b/storage/mroonga/vendor/groonga/src/groonga.c
index 262c4de2e86..28c318664e0 100644
--- a/storage/mroonga/vendor/groonga/src/groonga.c
+++ b/storage/mroonga/vendor/groonga/src/groonga.c
@@ -39,9 +39,9 @@
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif /* HAVE_SYS_SOCKET_H */
-#ifdef HAVE_NETINET_IN_H
+#ifndef WIN32
# include <netinet/in.h>
-#endif /* HAVE_NETINET_IN_H */
+#endif /* WIN32 */
#ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
@@ -51,9 +51,12 @@
# include <sys/sysctl.h>
#endif /* HAVE_SYS_SYSCTL_H */
-#ifdef HAVE_IO_H
+#ifdef WIN32
# include <io.h>
-#endif /* HAVE_IO_H */
+# include <direct.h>
+#else /* WIN32 */
+# include <sys/uio.h>
+#endif /* WIN32 */
#ifdef HAVE__STRNICMP
# ifdef strncasecmp
@@ -2656,7 +2659,7 @@ main(int argc, char **argv)
const char *bind_address_arg = NULL;
const char *hostname_arg = NULL;
const char *protocol_arg = NULL;
- const char *log_path_arg = NULL;
+ const char *log_path_arg = GRN_LOG_PATH;
const char *log_rotate_threshold_size_arg = NULL;
const char *query_log_path_arg = NULL;
const char *query_log_rotate_threshold_size_arg = NULL;
diff --git a/storage/mroonga/vendor/groonga/src/groonga_benchmark.c b/storage/mroonga/vendor/groonga/src/groonga_benchmark.c
index 656984a7695..2ebca387232 100644
--- a/storage/mroonga/vendor/groonga/src/groonga_benchmark.c
+++ b/storage/mroonga/vendor/groonga/src/groonga_benchmark.c
@@ -28,14 +28,14 @@
#include <sys/stat.h>
#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
+# include <sys/wait.h>
#endif /* HAVE_SYS_WAIT_H */
#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
+# include <sys/socket.h>
#endif /* HAVE_SYS_SOCKET_H */
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif /* HAVE_NETINET_IN_H */
+#ifndef WIN32
+# include <netinet/in.h>
+#endif /* WIN32 */
#include <grn_str.h>
#include <grn_com.h>
@@ -3062,6 +3062,8 @@ main(int argc, char **argv)
grntest_outtype = OUT_TSV;
}
+ grn_default_logger_set_path(GRN_LOG_PATH);
+
grn_init();
CRITICAL_SECTION_INIT(grntest_cs);
diff --git a/storage/mroonga/vendor/groonga/src/groonga_mruby.c b/storage/mroonga/vendor/groonga/src/groonga_mruby.c
index 9978a002f18..2f442fbd126 100644
--- a/storage/mroonga/vendor/groonga/src/groonga_mruby.c
+++ b/storage/mroonga/vendor/groonga/src/groonga_mruby.c
@@ -67,6 +67,8 @@ main(int argc, char **argv)
return EXIT_FAILURE;
}
+ grn_default_logger_set_path(GRN_LOG_PATH);
+
if (grn_init() != GRN_SUCCESS) {
return EXIT_FAILURE;
}
diff --git a/storage/mroonga/vendor/groonga/src/httpd/nginx-module/config b/storage/mroonga/vendor/groonga/src/httpd/nginx-module/config
index fc1fe16fad7..b79eef6ba17 100644
--- a/storage/mroonga/vendor/groonga/src/httpd/nginx-module/config
+++ b/storage/mroonga/vendor/groonga/src/httpd/nginx-module/config
@@ -10,7 +10,11 @@ if [ "$GROONGA_HTTPD_IN_TREE" = yes ]; then
groonga_cflags="-I${GROONGA_HTTPD_IN_TREE_INCLUDE_PATH}"
groonga_cflags="${groonga_cflags} -DNGX_HTTP_GROONGA_LOG_PATH=\\\"\"${GROONGA_HTTPD_GROONGA_LOG_PATH}\"\\\""
groonga_cflags="${groonga_cflags} -DNGX_HTTP_GROONGA_QUERY_LOG_PATH=\\\"\"${GROONGA_HTTPD_GROONGA_QUERY_LOG_PATH}\"\\\""
- groonga_libs="-L${GROONGA_HTTPD_IN_TREE_LINK_PATH} -lgroonga"
+ groonga_libs="-L${GROONGA_HTTPD_IN_TREE_LINK_PATH}"
+ if [ "${GROONGA_HTTPD_WITH_ONIGMO}" = "yes" ]; then
+ groonga_libs="$groonga_libs -L${GROONGA_HTTPD_ONIGMO_IN_TREE_LINK_PATH}"
+ fi
+ groonga_libs="$groonga_libs -lgroonga"
if [ -n "${GROONGA_HTTPD_RPATH}" ]; then
groonga_libs="$groonga_libs -Wl,-rpath -Wl,${GROONGA_HTTPD_RPATH}"
fi
@@ -46,7 +50,7 @@ if [ $ngx_found = yes ]; then
CORE_LIBS="$CORE_LIBS $groonga_libs"
else
cat << END
-$0: error: the groonga module requires the groonga library.
+$0: error: the groonga module requires the Groonga library.
END
exit 1
fi
diff --git a/storage/mroonga/vendor/groonga/src/httpd/nginx-module/ngx_http_groonga_module.c b/storage/mroonga/vendor/groonga/src/httpd/nginx-module/ngx_http_groonga_module.c
index 6ba1df4a9e8..727e65fa468 100644
--- a/storage/mroonga/vendor/groonga/src/httpd/nginx-module/ngx_http_groonga_module.c
+++ b/storage/mroonga/vendor/groonga/src/httpd/nginx-module/ngx_http_groonga_module.c
@@ -134,6 +134,30 @@ ngx_str_is_custom_path(ngx_str_t *string)
}
static void
+ngx_http_groonga_write_fd(ngx_fd_t fd,
+ u_char *buffer, size_t buffer_size,
+ const char *message, size_t message_size)
+{
+ size_t rest_message_size = message_size;
+ const char *current_message = message;
+
+ while (rest_message_size > 0) {
+ size_t current_message_size;
+
+ if (rest_message_size > NGX_MAX_ERROR_STR) {
+ current_message_size = NGX_MAX_ERROR_STR;
+ } else {
+ current_message_size = rest_message_size;
+ }
+
+ grn_memcpy(buffer, current_message, current_message_size);
+ ngx_write_fd(fd, buffer, current_message_size);
+ rest_message_size -= current_message_size;
+ current_message += current_message_size;
+ }
+}
+
+static void
ngx_http_groonga_logger_log(grn_ctx *ctx, grn_log_level level,
const char *timestamp, const char *title,
const char *message, const char *location,
@@ -171,10 +195,14 @@ ngx_http_groonga_logger_log(grn_ctx *ctx, grn_log_level level,
LOG_PREFIX_FORMAT,
timestamp, *(level_marks + level), title);
ngx_write_fd(logger_data->file->fd, buffer, last - buffer);
- ngx_write_fd(logger_data->file->fd, (void *)message, message_size);
+ ngx_http_groonga_write_fd(logger_data->file->fd,
+ buffer, NGX_MAX_ERROR_STR,
+ message, message_size);
if (location_size > 0) {
ngx_write_fd(logger_data->file->fd, " ", 1);
- ngx_write_fd(logger_data->file->fd, (void *)location, location_size);
+ ngx_http_groonga_write_fd(logger_data->file->fd,
+ buffer, NGX_MAX_ERROR_STR,
+ location, location_size);
}
ngx_write_fd(logger_data->file->fd, "\n", 1);
} else {
diff --git a/storage/mroonga/vendor/groonga/tools/install/install-for-debian-jessie.sh b/storage/mroonga/vendor/groonga/tools/install/install-for-debian-jessie.sh
new file mode 100755
index 00000000000..d053d2d9caf
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/tools/install/install-for-debian-jessie.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+set -e
+
+sources_list_path=/etc/apt/sources.list.d/groonga.list
+
+if [ ! -f $sources_list_path ]; then
+ sudo cat <<SOURCES_LIST | sudo tee $sources_list_path
+deb http://packages.groonga.org/debian/ jessie main
+deb-src http://packages.groonga.org/debian/ jessie main
+SOURCES_LIST
+fi
+
+sudo apt-get update
+sudo apt-get install -y --allow-unauthenticated groonga-keyring
+sudo apt-get update
+sudo apt-get install -y -V groonga
diff --git a/storage/mroonga/vendor/groonga/vendor/mruby/CMakeLists.txt b/storage/mroonga/vendor/groonga/vendor/mruby/CMakeLists.txt
index c78fde5d258..f2b27aff7e8 100644
--- a/storage/mroonga/vendor/groonga/vendor/mruby/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/vendor/mruby/CMakeLists.txt
@@ -17,6 +17,7 @@ if(GRN_WITH_MRUBY)
include_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/../mruby-source/include"
"${CMAKE_CURRENT_SOURCE_DIR}/../mruby-source/src"
+ "${CMAKE_CURRENT_SOURCE_DIR}/../mruby-source/mrbgems/mruby-compiler/core"
"${CMAKE_CURRENT_SOURCE_DIR}/../onigmo-source"
)
diff --git a/storage/mroonga/vendor/groonga/vendor/mruby/Makefile.am b/storage/mroonga/vendor/groonga/vendor/mruby/Makefile.am
index d995ccfcce1..c4285c1c85c 100644
--- a/storage/mroonga/vendor/groonga/vendor/mruby/Makefile.am
+++ b/storage/mroonga/vendor/groonga/vendor/mruby/Makefile.am
@@ -3,10 +3,11 @@ EXTRA_DIST = \
mruby_build.rb \
mruby_build.timestamp
-DEFAULT_INCLUDES = \
- -I$(srcdir)/../mruby-source/include \
- -I$(srcdir)/../mruby-source/src \
- -Imruby-io/include \
+DEFAULT_INCLUDES = \
+ -I$(srcdir)/../mruby-source/include \
+ -I$(srcdir)/../mruby-source/src \
+ -I$(srcdir)/../mruby-source/mrbgems/mruby-compiler/core \
+ -Imruby-io/include \
-I$(srcdir)/mruby-io/include
CFLAGS += $(NO_FLOAT_EQUAL_CFLAGS)
@@ -27,9 +28,9 @@ include sources.am
include built_sources.am
libmruby_la_SOURCES += $(BUILT_SOURCES)
-parse.c: mruby_build.timestamp
mrblib.c: mruby_build.timestamp
mrbgems_init.c: mruby_build.timestamp
+mruby-compiler/core/parse.c: mruby_build.timestamp
mruby-onig-regexp/src/mruby_onig_regexp.c: mruby_build.timestamp
mruby-env/src/env.c: mruby_build.timestamp
mruby-io/include/mruby/ext/io.h: mruby_build.timestamp
diff --git a/storage/mroonga/vendor/groonga/vendor/mruby/build_config.rb b/storage/mroonga/vendor/groonga/vendor/mruby/build_config.rb
index 5a963f9c7e7..f487e08b808 100644
--- a/storage/mroonga/vendor/groonga/vendor/mruby/build_config.rb
+++ b/storage/mroonga/vendor/groonga/vendor/mruby/build_config.rb
@@ -12,6 +12,7 @@ MRuby::Build.new do |conf|
enable_debug
+ conf.gem :core => "mruby-compiler"
conf.gem :core => "mruby-sprintf"
conf.gem :core => "mruby-print"
conf.gem :core => "mruby-math"
diff --git a/storage/mroonga/vendor/groonga/vendor/mruby/built_sources.am b/storage/mroonga/vendor/groonga/vendor/mruby/built_sources.am
index 08c5e3a9453..73726cda58b 100644
--- a/storage/mroonga/vendor/groonga/vendor/mruby/built_sources.am
+++ b/storage/mroonga/vendor/groonga/vendor/mruby/built_sources.am
@@ -1,7 +1,7 @@
BUILT_SOURCES = \
- parse.c \
mrblib.c \
mrbgems_init.c \
+ mruby-compiler/core/parse.c \
mruby-onig-regexp/src/mruby_onig_regexp.c \
mruby-env/src/env.c \
mruby-io/include/mruby/ext/io.h \
diff --git a/storage/mroonga/vendor/groonga/vendor/mruby/mruby_build.rb b/storage/mroonga/vendor/groonga/vendor/mruby/mruby_build.rb
index f0db931ed38..e2e8d68e7cf 100755
--- a/storage/mroonga/vendor/groonga/vendor/mruby/mruby_build.rb
+++ b/storage/mroonga/vendor/groonga/vendor/mruby/mruby_build.rb
@@ -28,7 +28,6 @@ end
FileUtils.touch(timestamp_file)
-FileUtils.cp("#{mruby_build_dir}/host/src/y.tab.c", "parse.c")
FileUtils.cp("#{mruby_build_dir}/host/mrblib/mrblib.c", "./")
File.open("mrbgems_init.c", "w") do |mrbgems_init|
@@ -37,6 +36,11 @@ File.open("mrbgems_init.c", "w") do |mrbgems_init|
end
end
+mruby_compiler_dir = "#{mruby_build_dir}/host/mrbgems/mruby-compiler"
+FileUtils.mkdir_p("mruby-compiler/core/")
+FileUtils.cp("#{mruby_compiler_dir}/core/y.tab.c",
+ "mruby-compiler/core/parse.c")
+
mruby_onig_regexp_dir = "#{mruby_build_dir}/mrbgems/mruby-onig-regexp"
FileUtils.mkdir_p("mruby-onig-regexp/")
FileUtils.cp_r("#{mruby_onig_regexp_dir}/src/", "mruby-onig-regexp/")
diff --git a/storage/mroonga/vendor/groonga/vendor/mruby/sources.am b/storage/mroonga/vendor/groonga/vendor/mruby/sources.am
index 68f15c64571..78ecc9b85df 100644
--- a/storage/mroonga/vendor/groonga/vendor/mruby/sources.am
+++ b/storage/mroonga/vendor/groonga/vendor/mruby/sources.am
@@ -2,7 +2,7 @@ libmruby_la_SOURCES = \
../mruby-source/src/array.c \
../mruby-source/src/backtrace.c \
../mruby-source/src/class.c \
- ../mruby-source/src/codegen.c \
+ ../mruby-source/src/codedump.c \
../mruby-source/src/compar.c \
../mruby-source/src/crc.c \
../mruby-source/src/debug.c \
@@ -17,8 +17,6 @@ libmruby_la_SOURCES = \
../mruby-source/src/init.c \
../mruby-source/src/kernel.c \
../mruby-source/src/load.c \
- ../mruby-source/src/mrb_throw.h \
- ../mruby-source/src/node.h \
../mruby-source/src/numeric.c \
../mruby-source/src/object.c \
../mruby-source/src/opcode.h \
@@ -33,6 +31,8 @@ libmruby_la_SOURCES = \
../mruby-source/src/variable.c \
../mruby-source/src/version.c \
../mruby-source/src/vm.c \
+ ../mruby-source/mrbgems/mruby-compiler/core/codegen.c \
+ ../mruby-source/mrbgems/mruby-compiler/core/node.h \
../mruby-source/mrbgems/mruby-sprintf/src/kernel.c \
../mruby-source/mrbgems/mruby-sprintf/src/sprintf.c \
../mruby-source/mrbgems/mruby-print/src/print.c \
diff --git a/storage/mroonga/vendor/groonga/vendor/onigmo/CMakeLists.txt b/storage/mroonga/vendor/groonga/vendor/onigmo/CMakeLists.txt
index 0f79347aa73..e52bb1d195c 100644
--- a/storage/mroonga/vendor/groonga/vendor/onigmo/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/vendor/onigmo/CMakeLists.txt
@@ -34,12 +34,23 @@ if(GRN_WITH_ONIGMO)
ac_check_sizeof(int)
ac_check_sizeof(long)
+ add_definitions(-DHAVE_STDARG_H)
+ add_definitions(-DHAVE_STDINT_H)
+ add_definitions(-DHAVE_STDLIB_H)
+ add_definitions(-DHAVE_STRING_H)
+ add_definitions(-DHAVE_SYS_TYPES_H)
+
+ add_definitions(-DSTDC_HEADERS)
+
if(MSVC)
add_definitions(-Dinline=__inline)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+ else()
+ add_definitions(-DHAVE_INTTYPES_H)
endif()
include_directories(
+ BEFORE
${ONIGMO_BINARY_DIR}
${ONIGMO_SOURCE_DIR}
)
@@ -107,4 +118,6 @@ if(GRN_WITH_ONIGMO)
onigmo
PROPERTIES
POSITION_INDEPENDENT_CODE ON)
+
+ configure_file(config.h.cmake "${ONIGMO_BINARY_DIR}/config.h")
endif()
diff --git a/storage/mroonga/vendor/groonga/vendor/onigmo/Makefile.am b/storage/mroonga/vendor/groonga/vendor/onigmo/Makefile.am
index 73632ebd3bd..cbd419d6736 100644
--- a/storage/mroonga/vendor/groonga/vendor/onigmo/Makefile.am
+++ b/storage/mroonga/vendor/groonga/vendor/onigmo/Makefile.am
@@ -1,5 +1,6 @@
EXTRA_DIST = \
configure \
+ config.h.cmake \
CMakeLists.txt
CONFIGURE_DEPENDENCIES = \
diff --git a/storage/mroonga/vendor/groonga/vendor/onigmo/config.h.cmake b/storage/mroonga/vendor/groonga/vendor/onigmo/config.h.cmake
new file mode 100644
index 00000000000..2997587d820
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/vendor/onigmo/config.h.cmake
@@ -0,0 +1 @@
+/* dummy */
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/doc/text/news.md b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/doc/text/news.md
index 22a7fdb17cf..f66e285bc7d 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/doc/text/news.md
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/doc/text/news.md
@@ -1,5 +1,16 @@
# News
+## 1.1.0: 2015-05-29
+
+### Fixes
+
+ * Fixed a bug that full-width space isn't treated as blank character.
+ [groonga-dev,03215] [Reported by Shota Mitsui]
+
+### Thanks
+
+ * Shota Mitsui
+
## 1.0.9: 2015-03-29
### Improves
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/CMakeLists.txt b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/CMakeLists.txt
index db8ffedb082..bddda0a9295 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/CMakeLists.txt
@@ -18,9 +18,21 @@
set(NORMALIZERS_DIR "${GROONGA_PLUGINS_DIR}/normalizers")
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/mysql_sources.am MYSQL_SOURCES)
if(GROONGA_NORMALIZER_MYSQL_EMBED)
- add_convenience_library(mysql_normalizer ${MYSQL_SOURCES})
+ add_library(mysql_normalizer STATIC ${MYSQL_SOURCES})
set_property(TARGET mysql_normalizer APPEND PROPERTY
COMPILE_DEFINITIONS "GROONGA_NORMALIZER_MYSQL_EMBED")
+ set_target_properties(
+ mysql_normalizer
+ PROPERTIES
+ POSITION_INDEPENDENT_CODE ON)
+ if(NOT DEFINED CMAKE_C_COMPILE_OPTIONS_PIC)
+ # For old CMake
+ if(CMAKE_COMPILER_IS_GNUCXX)
+ set_source_files_properties(${MYSQL_SOURCES}
+ PROPERTIES
+ COMPILE_FLAGS "-fPIC")
+ endif()
+ endif()
else()
add_library(mysql_normalizer MODULE ${MYSQL_SOURCES})
set_target_properties(mysql_normalizer PROPERTIES
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql.c b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql.c
index c7eb102d0e1..e7961ee41f8 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql.c
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql.c
@@ -364,41 +364,50 @@ normalize(grn_ctx *ctx, grn_obj *string,
rest_length = original_length_in_bytes;
while (rest_length > 0) {
int character_length;
+ grn_bool custom_normalized = GRN_FALSE;
+ unsigned int normalized_character_length;
+ unsigned int previous_normalized_length_in_bytes =
+ normalized_length_in_bytes;
+ unsigned int previous_normalized_n_characters =
+ normalized_n_characters;
character_length = grn_plugin_charlen(ctx, rest, rest_length, encoding);
if (character_length == 0) {
break;
}
- if (remove_blank_p && character_length == 1 && rest[0] == ' ') {
+ if (custom_normalizer) {
+ custom_normalized = custom_normalizer(ctx,
+ rest,
+ &character_length,
+ rest_length - character_length,
+ normalize_table,
+ normalized,
+ &normalized_character_length,
+ &normalized_length_in_bytes,
+ &normalized_n_characters);
+ }
+ if (!custom_normalized) {
+ normalize_character(rest, character_length,
+ normalize_table, normalize_table_size,
+ normalized,
+ &normalized_character_length,
+ &normalized_length_in_bytes,
+ &normalized_n_characters);
+ }
+
+ if (remove_blank_p &&
+ normalized_character_length == 1 &&
+ normalized[previous_normalized_length_in_bytes] == ' ') {
if (current_type > types) {
current_type[-1] |= GRN_CHAR_BLANK;
}
if (current_check) {
current_check[0]++;
}
+ normalized_length_in_bytes = previous_normalized_length_in_bytes;
+ normalized_n_characters = previous_normalized_n_characters;
} else {
- grn_bool custom_normalized = GRN_FALSE;
- unsigned int normalized_character_length;
- if (custom_normalizer) {
- custom_normalized = custom_normalizer(ctx,
- rest,
- &character_length,
- rest_length - character_length,
- normalize_table,
- normalized,
- &normalized_character_length,
- &normalized_length_in_bytes,
- &normalized_n_characters);
- }
- if (!custom_normalized) {
- normalize_character(rest, character_length,
- normalize_table, normalize_table_size,
- normalized,
- &normalized_character_length,
- &normalized_length_in_bytes,
- &normalized_n_characters);
- }
if (current_type && normalized_character_length > 0) {
char *current_normalized;
current_normalized =
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/apt/build-deb.sh b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/apt/build-deb.sh
index fdfc8f52f03..a0a28b0d29b 100755
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/apt/build-deb.sh
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/apt/build-deb.sh
@@ -22,8 +22,8 @@ case "${distribution}" in
debian)
component=main
run cat <<EOF > /etc/apt/sources.list.d/groonga.list
-deb http://packages.groonga.org/debian/ wheezy main
-deb-src http://packages.groonga.org/debian/ wheezy main
+deb http://packages.groonga.org/debian/ ${code_name} main
+deb-src http://packages.groonga.org/debian/ ${code_name} main
EOF
run apt-get update
run apt-get install -y --allow-unauthenticated groonga-keyring
@@ -54,4 +54,4 @@ run cd -
package_initial=$(echo "${PACKAGE}" | sed -e 's/\(.\).*/\1/')
pool_dir="/vagrant/repositories/${distribution}/pool/${code_name}/${component}/${package_initial}/${PACKAGE}"
run mkdir -p "${pool_dir}/"
-run cp *.tar.gz *.dsc *.deb "${pool_dir}/"
+run cp *.tar.* *.dsc *.deb "${pool_dir}/"
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/changelog b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/changelog
index 7fa8d1e17f0..ea07d115215 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/changelog
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/changelog
@@ -1,3 +1,9 @@
+groonga-normalizer-mysql (1.1.0-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Kouhei Sutou <kou@clear-code.com> Fri, 29 May 2015 00:00:00 +0900
+
groonga-normalizer-mysql (1.0.9-1) unstable; urgency=low
* New upstream release.
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/centos/groonga-normalizer-mysql.spec.in b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/centos/groonga-normalizer-mysql.spec.in
index 4084576a704..f78794f1973 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/centos/groonga-normalizer-mysql.spec.in
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/centos/groonga-normalizer-mysql.spec.in
@@ -52,6 +52,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/groonga/plugins/*/*.la
%{_libdir}/pkgconfig/groonga-normalizer-mysql.pc
%changelog
+* Fri May 29 2015 Kouhei Sutou <kou@clear-code.com> - 1.1.0-1
+- new upstream release.
+
* Sun Mar 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 1.0.9-1
- new upstream release.
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/fedora/groonga-normalizer-mysql.spec.in b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/fedora/groonga-normalizer-mysql.spec.in
index 974b7c31649..8cf379086a6 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/fedora/groonga-normalizer-mysql.spec.in
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/fedora/groonga-normalizer-mysql.spec.in
@@ -51,6 +51,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/groonga/plugins/*/*.la
%{_libdir}/pkgconfig/groonga-normalizer-mysql.pc
%changelog
+* Fri May 29 2015 Kouhei Sutou <kou@clear-code.com> - 1.1.0-1
+- new upstream release.
+
* Sun Mar 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 1.0.9-1
- new upstream release.
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/version b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/version
index e5a4a5e7d84..1cc5f657e05 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/version
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/version
@@ -1 +1 @@
-1.0.9 \ No newline at end of file
+1.1.0 \ No newline at end of file
diff --git a/storage/mroonga/version b/storage/mroonga/version
index 760b908bf87..c22ec448710 100644
--- a/storage/mroonga/version
+++ b/storage/mroonga/version
@@ -1 +1 @@
-5.02 \ No newline at end of file
+5.04 \ No newline at end of file
diff --git a/storage/mroonga/version_in_hex b/storage/mroonga/version_in_hex
index 7716095f96c..b2bfc453d0e 100644
--- a/storage/mroonga/version_in_hex
+++ b/storage/mroonga/version_in_hex
@@ -1 +1 @@
-0x0502 \ No newline at end of file
+0x0504 \ No newline at end of file
diff --git a/storage/mroonga/version_micro b/storage/mroonga/version_micro
index d8263ee9860..bf0d87ab1b2 100644
--- a/storage/mroonga/version_micro
+++ b/storage/mroonga/version_micro
@@ -1 +1 @@
-2 \ No newline at end of file
+4 \ No newline at end of file
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index e1d6ed97374..3029909e79f 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -1012,6 +1012,7 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt)
param.testflag= ((check_opt->flags & ~(T_EXTEND)) |
T_SILENT | T_FORCE_CREATE | T_CALC_CHECKSUM |
(check_opt->flags & T_EXTEND ? T_REP : T_REP_BY_SORT));
+ param.tmpfile_createflag= O_RDWR | O_TRUNC;
param.sort_buffer_length= THDVAR(thd, sort_buffer_size);
param.backup_time= check_opt->start_time;
start_records=file->state->records;
@@ -1062,6 +1063,7 @@ int ha_myisam::optimize(THD* thd, HA_CHECK_OPT *check_opt)
param.op_name= "optimize";
param.testflag= (check_opt->flags | T_SILENT | T_FORCE_CREATE |
T_REP_BY_SORT | T_STATISTICS | T_SORT_INDEX);
+ param.tmpfile_createflag= O_RDWR | O_TRUNC;
param.sort_buffer_length= THDVAR(thd, sort_buffer_size);
if ((error= repair(thd,param,1)) && param.retry_repair)
{
@@ -1107,7 +1109,7 @@ int ha_myisam::repair(THD *thd, HA_CHECK &param, bool do_optimize)
locking= 1;
if (mi_lock_database(file, table->s->tmp_table ? F_EXTRA_LCK : F_WRLCK))
{
- mi_check_print_error(&param,ER(ER_CANT_LOCK),my_errno);
+ mi_check_print_error(&param, ER_THD(thd, ER_CANT_LOCK), my_errno);
DBUG_RETURN(HA_ADMIN_FAILED);
}
}
@@ -1117,9 +1119,9 @@ int ha_myisam::repair(THD *thd, HA_CHECK &param, bool do_optimize)
(!(param.testflag & T_QUICK) ||
!(share->state.changed & STATE_NOT_OPTIMIZED_KEYS))))
{
- ulonglong key_map= ((local_testflag & T_CREATE_MISSING_KEYS) ?
- mi_get_mask_all_keys_active(share->base.keys) :
- share->state.key_map);
+ ulonglong tmp_key_map= ((local_testflag & T_CREATE_MISSING_KEYS) ?
+ mi_get_mask_all_keys_active(share->base.keys) :
+ share->state.key_map);
ulonglong testflag= param.testflag;
#ifdef HAVE_MMAP
bool remap= MY_TEST(share->file_map);
@@ -1133,7 +1135,7 @@ int ha_myisam::repair(THD *thd, HA_CHECK &param, bool do_optimize)
if (remap)
mi_munmap_file(file);
#endif
- if (mi_test_if_sort_rep(file,file->state->records,key_map,0) &&
+ if (mi_test_if_sort_rep(file,file->state->records,tmp_key_map,0) &&
(local_testflag & T_REP_BY_SORT))
{
local_testflag|= T_STATISTICS;
@@ -1181,7 +1183,7 @@ int ha_myisam::repair(THD *thd, HA_CHECK &param, bool do_optimize)
thd_proc_info(thd, "Sorting index");
error=mi_sort_index(&param,file,fixed_name);
}
- if (!statistics_done && (local_testflag & T_STATISTICS))
+ if (!error && !statistics_done && (local_testflag & T_STATISTICS))
{
if (share->state.changed & STATE_NOT_ANALYZED)
{
@@ -2000,7 +2002,7 @@ int ha_myisam::create(const char *name, register TABLE *table_arg,
HA_CREATE_INFO *ha_create_info)
{
int error;
- uint create_flags= 0, records, i;
+ uint create_flags= 0, record_count, i;
char buff[FN_REFLEN];
MI_KEYDEF *keydef;
MI_COLUMNDEF *recinfo;
@@ -2016,7 +2018,7 @@ int ha_myisam::create(const char *name, register TABLE *table_arg,
break;
}
}
- if ((error= table2myisam(table_arg, &keydef, &recinfo, &records)))
+ if ((error= table2myisam(table_arg, &keydef, &recinfo, &record_count)))
DBUG_RETURN(error); /* purecov: inspected */
bzero((char*) &create_info, sizeof(create_info));
create_info.max_rows= share->max_rows;
@@ -2038,13 +2040,16 @@ int ha_myisam::create(const char *name, register TABLE *table_arg,
else
#endif /* HAVE_READLINK */
{
+ THD *thd= table_arg->in_use;
if (ha_create_info->data_file_name)
- push_warning_printf(table_arg->in_use, Sql_condition::WARN_LEVEL_WARN,
- WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ WARN_OPTION_IGNORED,
+ ER_THD(thd, WARN_OPTION_IGNORED),
"DATA DIRECTORY");
if (ha_create_info->index_file_name)
- push_warning_printf(table_arg->in_use, Sql_condition::WARN_LEVEL_WARN,
- WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ WARN_OPTION_IGNORED,
+ ER_THD(thd, WARN_OPTION_IGNORED),
"INDEX DIRECTORY");
}
@@ -2063,7 +2068,7 @@ int ha_myisam::create(const char *name, register TABLE *table_arg,
error= mi_create(fn_format(buff, name, "", "",
MY_UNPACK_FILENAME|MY_APPEND_EXT),
share->keys, keydef,
- records, recinfo,
+ record_count, recinfo,
0, (MI_UNIQUEDEF*) 0,
&create_info, create_flags);
my_free(recinfo);
@@ -2177,21 +2182,21 @@ uint ha_myisam::checksum() const
}
-bool ha_myisam::check_if_incompatible_data(HA_CREATE_INFO *info,
+bool ha_myisam::check_if_incompatible_data(HA_CREATE_INFO *create_info,
uint table_changes)
{
uint options= table->s->db_options_in_use;
- if (info->auto_increment_value != stats.auto_increment_value ||
- info->data_file_name != data_file_name ||
- info->index_file_name != index_file_name ||
+ if (create_info->auto_increment_value != stats.auto_increment_value ||
+ create_info->data_file_name != data_file_name ||
+ create_info->index_file_name != index_file_name ||
table_changes == IS_EQUAL_NO ||
table_changes & IS_EQUAL_PACK_LENGTH) // Not implemented yet
return COMPATIBLE_DATA_NO;
if ((options & (HA_OPTION_PACK_RECORD | HA_OPTION_CHECKSUM |
HA_OPTION_DELAY_KEY_WRITE)) !=
- (info->table_options & (HA_OPTION_PACK_RECORD | HA_OPTION_CHECKSUM |
+ (create_info->table_options & (HA_OPTION_PACK_RECORD | HA_OPTION_CHECKSUM |
HA_OPTION_DELAY_KEY_WRITE)))
return COMPATIBLE_DATA_NO;
return COMPATIBLE_DATA_YES;
@@ -2227,7 +2232,7 @@ int myisam_panic(handlerton *hton, ha_panic_function flag)
static int myisam_init(void *p)
{
- handlerton *myisam_hton;
+ handlerton *hton;
#ifdef HAVE_PSI_INTERFACE
init_myisam_psi_keys();
@@ -2241,13 +2246,13 @@ static int myisam_init(void *p)
myisam_block_size=(uint) 1 << my_bit_log2(opt_myisam_block_size);
- myisam_hton= (handlerton *)p;
- myisam_hton->state= SHOW_OPTION_YES;
- myisam_hton->db_type= DB_TYPE_MYISAM;
- myisam_hton->create= myisam_create_handler;
- myisam_hton->panic= myisam_panic;
- myisam_hton->flags= HTON_CAN_RECREATE | HTON_SUPPORT_LOG_TABLES;
- myisam_hton->tablefile_extensions= ha_myisam_exts;
+ hton= (handlerton *)p;
+ hton->state= SHOW_OPTION_YES;
+ hton->db_type= DB_TYPE_MYISAM;
+ hton->create= myisam_create_handler;
+ hton->panic= myisam_panic;
+ hton->flags= HTON_CAN_RECREATE | HTON_SUPPORT_LOG_TABLES;
+ hton->tablefile_extensions= ha_myisam_exts;
mi_killed= mi_killed_in_mariadb;
return 0;
diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c
index c38e7378015..9175f50fce7 100644
--- a/storage/myisam/mi_check.c
+++ b/storage/myisam/mi_check.c
@@ -1936,16 +1936,8 @@ int mi_sort_index(HA_CHECK *param, register MI_INFO *info, char * name)
for (key= 0,keyinfo= &share->keyinfo[0]; key < share->base.keys ;
key++,keyinfo++)
{
- if (! mi_is_key_active(info->s->state.key_map, key))
- {
- /* Since the key is not active, this should not be read, but we
- initialize it anyway to silence a Valgrind warn when passing that
- chunk of memory to pwrite(). */
- index_pos[key]= HA_OFFSET_ERROR;
- continue;
- }
-
- if (share->state.key_root[key] != HA_OFFSET_ERROR)
+ if (mi_is_key_active(info->s->state.key_map, key) &&
+ share->state.key_root[key] != HA_OFFSET_ERROR)
{
index_pos[key]=param->new_file_pos; /* Write first block here */
if (sort_one_index(param,info,keyinfo,share->state.key_root[key],
diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h
index 8ca052af4ac..8b48119390a 100644
--- a/storage/myisam/myisamdef.h
+++ b/storage/myisam/myisamdef.h
@@ -394,7 +394,7 @@ struct st_myisam_info
#define PACK_TYPE_SELECTED 1 /* Bits in field->pack_type */
#define PACK_TYPE_SPACE_FIELDS 2
#define PACK_TYPE_ZERO_FILL 4
-#define MI_FOUND_WRONG_KEY 32738 /* Impossible value from ha_key_cmp */
+#define MI_FOUND_WRONG_KEY 0x7FFFFFFF /* Impossible value from ha_key_cmp */
#define MI_MAX_KEY_BLOCK_SIZE (MI_MAX_KEY_BLOCK_LENGTH/MI_MIN_KEY_BLOCK_LENGTH)
#define MI_BLOCK_SIZE(key_length,data_pointer,key_pointer,block_size) (((((key_length)+(data_pointer)+(key_pointer))*4+(key_pointer)+2)/(block_size)+1)*(block_size))
diff --git a/storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff b/storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff
index 205e7314fda..cf24f2c3e61 100644
--- a/storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff
+++ b/storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff
@@ -56,7 +56,7 @@
+3 b
DROP TABLE t1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
-+# ERROR: Statement succeeded (expected results: ER_ROW_IS_REFERENCED)
++# ERROR: Statement succeeded (expected results: ER_ROW_IS_REFERENCED_2)
+# ------------ UNEXPECTED RESULT ------------
+# The statement|command succeeded unexpectedly.
+# Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
diff --git a/storage/myisam/rt_split.c b/storage/myisam/rt_split.c
index 9ab0bd99201..be61734e01c 100644
--- a/storage/myisam/rt_split.c
+++ b/storage/myisam/rt_split.c
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2002, 2010, Oracle and/or its affiliates
+ Copyright (c) 2002, 2015, Oracle and/or its affiliates
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -69,6 +69,10 @@ static double mbr_join_square(const double *a, const double *b, int n_dim)
b += 2;
}while (a != end);
+ /* Check for infinity or NaN */
+ if (my_isinf(square) || isnan(square))
+ square = DBL_MAX;
+
return square;
}
@@ -103,6 +107,9 @@ static void pick_seeds(SplitStruct *node, int n_entries,
double max_d = -DBL_MAX;
double d;
+ *seed_a = node;
+ *seed_b = node + 1;
+
for (cur1 = node; cur1 < lim1; ++cur1)
{
for (cur2=cur1 + 1; cur2 < lim2; ++cur2)
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc
index bb82e57427a..05d5ef1d6ca 100644
--- a/storage/myisammrg/ha_myisammrg.cc
+++ b/storage/myisammrg/ha_myisammrg.cc
@@ -1708,7 +1708,7 @@ my_bool ha_myisammrg::register_query_cache_dependant_tables(THD *thd
/*
There are not callback function for for MyISAM, and engine data
*/
- if (!cache->insert_table(key_length, key, (*block_table),
+ if (!cache->insert_table(thd, key_length, key, (*block_table),
db_length, 0,
table_cache_type(),
0, 0, TRUE))
diff --git a/storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff b/storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff
index 1fa6c184a6d..fc07ebc0e94 100644
--- a/storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff
@@ -57,7 +57,7 @@
+3 b
DROP TABLE t1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
-+# ERROR: Statement succeeded (expected results: ER_ROW_IS_REFERENCED)
++# ERROR: Statement succeeded (expected results: ER_ROW_IS_REFERENCED_2)
+# ------------ UNEXPECTED RESULT ------------
+# The statement|command succeeded unexpectedly.
+# Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
diff --git a/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff
index 52e9d9fdbe4..024c1646892 100644
--- a/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff
@@ -414,12 +414,12 @@
-Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
-FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
-first second w c o e d t i r
--120 120 1 1 0 1 0 1 1 0
+-120 120 1 1 0 1 0 0 1 0
-120 121 0 0 1 0 0 0 1 0
-120 122 NULL NULL NULL NULL NULL NULL NULL NULL
-120 123 NULL NULL NULL NULL NULL NULL NULL NULL
-121 120 0 0 1 0 0 0 1 0
--121 121 1 1 0 1 0 1 1 0
+-121 121 1 1 0 1 0 0 1 0
-121 122 NULL NULL NULL NULL NULL NULL NULL NULL
-121 123 NULL NULL NULL NULL NULL NULL NULL NULL
-122 120 NULL NULL NULL NULL NULL NULL NULL NULL
diff --git a/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff
index ecd0025c9d9..1caa6c3d5a8 100644
--- a/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff
@@ -414,12 +414,12 @@
-Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
-FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
-first second w c o e d t i r
--120 120 1 1 0 1 0 1 1 0
+-120 120 1 1 0 1 0 0 1 0
-120 121 0 0 1 0 0 0 1 0
-120 122 NULL NULL NULL NULL NULL NULL NULL NULL
-120 123 NULL NULL NULL NULL NULL NULL NULL NULL
-121 120 0 0 1 0 0 0 1 0
--121 121 1 1 0 1 0 1 1 0
+-121 121 1 1 0 1 0 0 1 0
-121 122 NULL NULL NULL NULL NULL NULL NULL NULL
-121 123 NULL NULL NULL NULL NULL NULL NULL NULL
-122 120 NULL NULL NULL NULL NULL NULL NULL NULL
@@ -1124,12 +1124,12 @@
-Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
-FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
-first second w c o e d t i r
--120 120 1 1 0 1 0 1 1 0
+-120 120 1 1 0 1 0 0 1 0
-120 121 0 0 1 0 0 0 1 0
-120 122 NULL NULL NULL NULL NULL NULL NULL NULL
-120 123 NULL NULL NULL NULL NULL NULL NULL NULL
-121 120 0 0 1 0 0 0 1 0
--121 121 1 1 0 1 0 1 1 0
+-121 121 1 1 0 1 0 0 1 0
-121 122 NULL NULL NULL NULL NULL NULL NULL NULL
-121 123 NULL NULL NULL NULL NULL NULL NULL NULL
-122 120 NULL NULL NULL NULL NULL NULL NULL NULL
diff --git a/storage/oqgraph/CMakeLists.txt b/storage/oqgraph/CMakeLists.txt
index 2c09a27a581..772a8f61bd5 100644
--- a/storage/oqgraph/CMakeLists.txt
+++ b/storage/oqgraph/CMakeLists.txt
@@ -5,6 +5,7 @@ MESSAGE(STATUS "Configuring OQGraph")
FIND_PACKAGE(Boost 1.40.0)
IF(NOT Boost_FOUND)
MESSAGE(STATUS "Boost not found. OQGraph will not be compiled")
+ SET(OQGRAPH_OK 0 CACHE INTERNAL "")
RETURN()
ENDIF()
INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS})
@@ -12,6 +13,7 @@ INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS})
FIND_PACKAGE(Judy)
IF(NOT Judy_FOUND)
MESSAGE(STATUS "Judy not found. OQGraph will not be compiled")
+ SET(OQGRAPH_OK 0 CACHE INTERNAL "")
RETURN()
ENDIF()
INCLUDE_DIRECTORIES(${Judy_INCLUDE_DIR})
@@ -19,12 +21,13 @@ INCLUDE_DIRECTORIES(${Judy_INCLUDE_DIR})
IF(MSVC)
# # lp:756966 OQGRAPH on Win64 does not compile
# IF (CMAKE_SIZEOF_VOID_P EQUAL 8)
-# SET(BOOST_OK 0)
+# SET(OQGRAPH_OK 0 CACHE INTERNAL "")
# ELSE()
- SET(BOOST_OK 1)
+ SET(OQGRAPH_OK 1 CACHE INTERNAL "")
# ENDIF()
ELSE()
# See if that works. On old gcc it'll fail because of -fno-rtti
+SET(CMAKE_REQUIRED_INCLUDES "${Boost_INCLUDE_DIRS}")
CHECK_CXX_SOURCE_COMPILES(
"
#define BOOST_NO_RTTI 1
@@ -32,10 +35,10 @@ CHECK_CXX_SOURCE_COMPILES(
#include <boost/config.hpp>
#include <boost/property_map/property_map.hpp>
int main() { return 0; }
-" BOOST_OK)
+" OQGRAPH_OK)
ENDIF()
-IF(BOOST_OK)
+IF(OQGRAPH_OK)
ADD_DEFINITIONS(-DHAVE_OQGRAPH)
IF(MSVC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc" PARENT_SCOPE)
@@ -49,7 +52,6 @@ IF(BOOST_OK)
ENDIF(MSVC)
ADD_DEFINITIONS(-DBOOST_NO_RTTI=1 -DBOOST_NO_TYPEID=1 -DBOOST_DISABLE_ASSERTS=1)
- MESSAGE(STATUS "OQGraph OK")
MYSQL_ADD_PLUGIN(oqgraph ha_oqgraph.cc graphcore.cc graphcore-graph.cc
oqgraph_shim.cc oqgraph_thunk.cc oqgraph_judy.cc
STORAGE_ENGINE
@@ -57,9 +59,11 @@ IF(BOOST_OK)
RECOMPILE_FOR_EMBEDDED
COMPONENT oqgraph-engine
LINK_LIBRARIES ${Judy_LIBRARIES})
-ELSE(BOOST_OK)
+ELSE(OQGRAPH_OK)
MESSAGE(STATUS "Requisites for OQGraph not met. OQGraph will not be compiled")
-ENDIF(BOOST_OK)
+ENDIF(OQGRAPH_OK)
ENDFUNCTION()
-CHECK_OQGRAPH()
+IF(NOT DEFINED OQGRAPH_OK)
+ CHECK_OQGRAPH()
+ENDIF()
diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc
index 2e1393ec591..29e74271670 100644
--- a/storage/perfschema/ha_perfschema.cc
+++ b/storage/perfschema/ha_perfschema.cc
@@ -225,7 +225,7 @@ maria_declare_plugin(perfschema)
0x0001,
pfs_status_vars,
NULL,
- "5.6.20",
+ "5.6.26",
MariaDB_PLUGIN_MATURITY_STABLE
}
maria_declare_plugin_end;
diff --git a/storage/perfschema/pfs_account.cc b/storage/perfschema/pfs_account.cc
index 3eff670f44d..4e3a6d8d1d3 100644
--- a/storage/perfschema/pfs_account.cc
+++ b/storage/perfschema/pfs_account.cc
@@ -69,8 +69,8 @@ int init_account(const PFS_global_param *param)
if (account_max > 0)
{
- account_array= PFS_MALLOC_ARRAY(account_max, PFS_account,
- MYF(MY_ZEROFILL));
+ account_array= PFS_MALLOC_ARRAY(account_max, sizeof(PFS_account), PFS_account,
+ MYF(MY_ZEROFILL));
if (unlikely(account_array == NULL))
return 1;
}
diff --git a/storage/perfschema/pfs_con_slice.cc b/storage/perfschema/pfs_con_slice.cc
index 263f25c1c08..bd449df0a4b 100644
--- a/storage/perfschema/pfs_con_slice.cc
+++ b/storage/perfschema/pfs_con_slice.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -39,7 +39,8 @@ PFS_connection_slice::alloc_waits_slice(uint sizing)
if (sizing > 0)
{
- slice= PFS_MALLOC_ARRAY(sizing, PFS_single_stat, MYF(MY_ZEROFILL));
+ slice= PFS_MALLOC_ARRAY(sizing, sizeof(PFS_single_stat), PFS_single_stat,
+ MYF(MY_ZEROFILL));
if (unlikely(slice == NULL))
return NULL;
@@ -58,7 +59,8 @@ PFS_connection_slice::alloc_stages_slice(uint sizing)
if (sizing > 0)
{
- slice= PFS_MALLOC_ARRAY(sizing, PFS_stage_stat, MYF(MY_ZEROFILL));
+ slice= PFS_MALLOC_ARRAY(sizing, sizeof(PFS_stage_stat), PFS_stage_stat,
+ MYF(MY_ZEROFILL));
if (unlikely(slice == NULL))
return NULL;
@@ -77,7 +79,8 @@ PFS_connection_slice::alloc_statements_slice(uint sizing)
if (sizing > 0)
{
- slice= PFS_MALLOC_ARRAY(sizing, PFS_statement_stat, MYF(MY_ZEROFILL));
+ slice= PFS_MALLOC_ARRAY(sizing, sizeof(PFS_statement_stat), PFS_statement_stat,
+ MYF(MY_ZEROFILL));
if (unlikely(slice == NULL))
return NULL;
diff --git a/storage/perfschema/pfs_digest.cc b/storage/perfschema/pfs_digest.cc
index 6c0b41908e1..0a01ee08993 100644
--- a/storage/perfschema/pfs_digest.cc
+++ b/storage/perfschema/pfs_digest.cc
@@ -35,7 +35,7 @@
#include "sql_string.h"
#include <string.h>
-ulong digest_max= 0;
+size_t digest_max= 0;
ulong digest_lost= 0;
/** EVENTS_STATEMENTS_HISTORY_LONG circular buffer. */
@@ -59,8 +59,6 @@ static bool digest_hash_inited= false;
*/
int init_digest(const PFS_global_param *param)
{
- unsigned int index;
-
/*
Allocate memory for statements_digest_stat_array based on
performance_schema_digests_size values
@@ -75,6 +73,7 @@ int init_digest(const PFS_global_param *param)
statements_digest_stat_array=
PFS_MALLOC_ARRAY(digest_max,
+ sizeof(PFS_statements_digest_stat),
PFS_statements_digest_stat,
MYF(MY_ZEROFILL));
@@ -86,8 +85,12 @@ int init_digest(const PFS_global_param *param)
if (pfs_max_digest_length > 0)
{
+ /* Size of each digest array. */
+ size_t digest_memory_size= pfs_max_digest_length * sizeof(unsigned char);
+
statements_digest_token_array=
- PFS_MALLOC_ARRAY(digest_max * pfs_max_digest_length,
+ PFS_MALLOC_ARRAY(digest_max,
+ digest_memory_size,
unsigned char,
MYF(MY_ZEROFILL));
@@ -98,7 +101,7 @@ int init_digest(const PFS_global_param *param)
}
}
- for (index= 0; index < digest_max; index++)
+ for (size_t index= 0; index < digest_max; index++)
{
statements_digest_stat_array[index].reset_data(statements_digest_token_array
+ index * pfs_max_digest_length, pfs_max_digest_length);
@@ -336,8 +339,6 @@ void PFS_statements_digest_stat::reset_index(PFS_thread *thread)
void reset_esms_by_digest()
{
- uint index;
-
if (statements_digest_stat_array == NULL)
return;
@@ -346,7 +347,7 @@ void reset_esms_by_digest()
return;
/* Reset statements_digest_stat_array. */
- for (index= 0; index < digest_max; index++)
+ for (size_t index= 0; index < digest_max; index++)
{
statements_digest_stat_array[index].reset_index(thread);
statements_digest_stat_array[index].reset_data(statements_digest_token_array + index * pfs_max_digest_length, pfs_max_digest_length);
diff --git a/storage/perfschema/pfs_digest.h b/storage/perfschema/pfs_digest.h
index 9d021737c44..76d6c33d984 100644
--- a/storage/perfschema/pfs_digest.h
+++ b/storage/perfschema/pfs_digest.h
@@ -27,7 +27,7 @@
#include "sql_digest.h"
extern bool flag_statements_digest;
-extern ulong digest_max;
+extern size_t digest_max;
extern ulong digest_lost;
struct PFS_thread;
diff --git a/storage/perfschema/pfs_events_stages.cc b/storage/perfschema/pfs_events_stages.cc
index 282071f830e..7351c95c9cb 100644
--- a/storage/perfschema/pfs_events_stages.cc
+++ b/storage/perfschema/pfs_events_stages.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -59,8 +59,8 @@ int init_events_stages_history_long(uint events_stages_history_long_sizing)
return 0;
events_stages_history_long_array=
- PFS_MALLOC_ARRAY(events_stages_history_long_size, PFS_events_stages,
- MYF(MY_ZEROFILL));
+ PFS_MALLOC_ARRAY(events_stages_history_long_size, sizeof(PFS_events_stages),
+ PFS_events_stages, MYF(MY_ZEROFILL));
return (events_stages_history_long_array ? 0 : 1);
}
diff --git a/storage/perfschema/pfs_events_statements.cc b/storage/perfschema/pfs_events_statements.cc
index dc34755d747..cecd0167c38 100644
--- a/storage/perfschema/pfs_events_statements.cc
+++ b/storage/perfschema/pfs_events_statements.cc
@@ -30,7 +30,7 @@
#include "pfs_atomic.h"
#include "m_string.h"
-ulong events_statements_history_long_size= 0;
+size_t events_statements_history_long_size= 0;
/** Consumer flag for table EVENTS_STATEMENTS_CURRENT. */
bool flag_events_statements_current= false;
/** Consumer flag for table EVENTS_STATEMENTS_HISTORY. */
@@ -50,9 +50,8 @@ static unsigned char *h_long_stmts_digest_token_array= NULL;
Initialize table EVENTS_STATEMENTS_HISTORY_LONG.
@param events_statements_history_long_sizing table sizing
*/
-int init_events_statements_history_long(uint events_statements_history_long_sizing)
+int init_events_statements_history_long(size_t events_statements_history_long_sizing)
{
- uint index;
events_statements_history_long_size= events_statements_history_long_sizing;
events_statements_history_long_full= false;
PFS_atomic::store_u32(&events_statements_history_long_index, 0);
@@ -61,8 +60,8 @@ int init_events_statements_history_long(uint events_statements_history_long_sizi
return 0;
events_statements_history_long_array=
- PFS_MALLOC_ARRAY(events_statements_history_long_size, PFS_events_statements,
- MYF(MY_ZEROFILL));
+ PFS_MALLOC_ARRAY(events_statements_history_long_size, sizeof(PFS_events_statements),
+ PFS_events_statements, MYF(MY_ZEROFILL));
if (events_statements_history_long_array == NULL)
{
@@ -72,8 +71,11 @@ int init_events_statements_history_long(uint events_statements_history_long_sizi
if (pfs_max_digest_length > 0)
{
+ /* Size of each digest token array. */
+ size_t digest_text_size= pfs_max_digest_length * sizeof(unsigned char);
+
h_long_stmts_digest_token_array=
- PFS_MALLOC_ARRAY(events_statements_history_long_size * pfs_max_digest_length,
+ PFS_MALLOC_ARRAY(events_statements_history_long_size, digest_text_size,
unsigned char, MYF(MY_ZEROFILL));
if (h_long_stmts_digest_token_array == NULL)
{
@@ -82,7 +84,7 @@ int init_events_statements_history_long(uint events_statements_history_long_sizi
}
}
- for (index= 0; index < events_statements_history_long_size; index++)
+ for (size_t index= 0; index < events_statements_history_long_size; index++)
{
events_statements_history_long_array[index].m_digest_storage.reset(h_long_stmts_digest_token_array
+ index * pfs_max_digest_length, pfs_max_digest_length);
diff --git a/storage/perfschema/pfs_events_statements.h b/storage/perfschema/pfs_events_statements.h
index 3637e4ca764..b1e303e7021 100644
--- a/storage/perfschema/pfs_events_statements.h
+++ b/storage/perfschema/pfs_events_statements.h
@@ -106,9 +106,9 @@ extern bool flag_events_statements_history_long;
extern bool events_statements_history_long_full;
extern volatile uint32 events_statements_history_long_index;
extern PFS_events_statements *events_statements_history_long_array;
-extern ulong events_statements_history_long_size;
+extern size_t events_statements_history_long_size;
-int init_events_statements_history_long(uint events_statements_history_long_sizing);
+int init_events_statements_history_long(size_t events_statements_history_long_sizing);
void cleanup_events_statements_history_long();
void reset_events_statements_current();
diff --git a/storage/perfschema/pfs_events_waits.cc b/storage/perfschema/pfs_events_waits.cc
index 2799550c81d..1120ac2a445 100644
--- a/storage/perfschema/pfs_events_waits.cc
+++ b/storage/perfschema/pfs_events_waits.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -63,8 +63,8 @@ int init_events_waits_history_long(uint events_waits_history_long_sizing)
return 0;
events_waits_history_long_array=
- PFS_MALLOC_ARRAY(events_waits_history_long_size, PFS_events_waits,
- MYF(MY_ZEROFILL));
+ PFS_MALLOC_ARRAY(events_waits_history_long_size, sizeof(PFS_events_waits),
+ PFS_events_waits, MYF(MY_ZEROFILL));
return (events_waits_history_long_array ? 0 : 1);
}
diff --git a/storage/perfschema/pfs_global.cc b/storage/perfschema/pfs_global.cc
index 0744bbab7d5..bd346f2b235 100644
--- a/storage/perfschema/pfs_global.cc
+++ b/storage/perfschema/pfs_global.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -52,7 +52,7 @@ void *pfs_malloc(size_t size, myf flags)
DBUG_ASSERT(! pfs_initialized);
DBUG_ASSERT(size > 0);
- void *ptr;
+ void *ptr= NULL;
#ifdef PFS_ALIGNEMENT
#ifdef HAVE_POSIX_MEMALIGN
@@ -128,6 +128,40 @@ void pfs_print_error(const char *format, ...)
fflush(stderr);
}
+/**
+ Array allocation for the performance schema.
+ Checks for overflow of n * size before allocating.
+ @param n number of array elements
+ @param size element size
+ @param flags malloc flags
+ @return pointer to memory on success, else NULL
+*/
+void *pfs_malloc_array(size_t n, size_t size, myf flags)
+{
+ DBUG_ASSERT(n > 0);
+ DBUG_ASSERT(size > 0);
+ size_t array_size= n * size;
+ /* Check for overflow before allocating. */
+ if (is_overflow(array_size, n, size))
+ return NULL;
+ return pfs_malloc(array_size, flags);
+}
+
+/**
+ Detect multiplication overflow.
+ @param product multiplication product
+ @param n1 operand
+ @param n2 operand
+ @return true if multiplication caused an overflow.
+*/
+bool is_overflow(size_t product, size_t n1, size_t n2)
+{
+ if (n1 != 0 && (product / n1 != n2))
+ return true;
+ else
+ return false;
+}
+
/** Convert raw ip address into readable format. Do not do a reverse DNS lookup. */
uint pfs_get_socket_address(char *host,
diff --git a/storage/perfschema/pfs_global.h b/storage/perfschema/pfs_global.h
index f9687524cd5..f3326c5589f 100644
--- a/storage/perfschema/pfs_global.h
+++ b/storage/perfschema/pfs_global.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -44,18 +44,24 @@ extern size_t pfs_allocated_memory;
void *pfs_malloc(size_t size, myf flags);
+/** Allocate an array of structures with overflow check. */
+void *pfs_malloc_array(size_t n, size_t size, myf flags);
+
/**
Helper, to allocate an array of structures.
- @param n number of elements in the array.
- @param T type of an element.
+ @param n number of elements in the array
+ @param s size of array element
+ @param T type of an element
@param f flags to use when allocating memory
*/
-#define PFS_MALLOC_ARRAY(n, T, f) \
- reinterpret_cast<T*> (pfs_malloc((n) * sizeof(T), (f)))
+#define PFS_MALLOC_ARRAY(n, s, T, f) \
+ reinterpret_cast<T*>(pfs_malloc_array((n), (s), (f)))
/** Free memory allocated with @sa pfs_malloc. */
void pfs_free(void *ptr);
+/** Detect multiplication overflow. */
+bool is_overflow(size_t product, size_t n1, size_t n2);
uint pfs_get_socket_address(char *host,
uint host_len,
@@ -107,7 +113,7 @@ inline uint randomized_index(const void *ptr, uint max_size)
value= (reinterpret_cast<intptr> (ptr)) >> 3;
value*= 1789;
value+= seed2 + seed1 + 1;
-
+
result= (static_cast<uint> (value)) % max_size;
seed2= seed1*seed1;
diff --git a/storage/perfschema/pfs_host.cc b/storage/perfschema/pfs_host.cc
index 80f3900275d..7da34a6d5f6 100644
--- a/storage/perfschema/pfs_host.cc
+++ b/storage/perfschema/pfs_host.cc
@@ -66,7 +66,7 @@ int init_host(const PFS_global_param *param)
if (host_max > 0)
{
- host_array= PFS_MALLOC_ARRAY(host_max, PFS_host,
+ host_array= PFS_MALLOC_ARRAY(host_max, sizeof(PFS_host), PFS_host,
MYF(MY_ZEROFILL));
if (unlikely(host_array == NULL))
return 1;
diff --git a/storage/perfschema/pfs_instr.cc b/storage/perfschema/pfs_instr.cc
index 5e75df4a16f..a9ea6faf212 100644
--- a/storage/perfschema/pfs_instr.cc
+++ b/storage/perfschema/pfs_instr.cc
@@ -94,7 +94,7 @@ ulong events_stages_history_per_thread;
/** Number of EVENTS_STATEMENTS_HISTORY records per thread. */
ulong events_statements_history_per_thread;
uint statement_stack_max;
-uint pfs_max_digest_length= 0;
+size_t pfs_max_digest_length= 0;
/** Number of locker lost. @sa LOCKER_STACK_SIZE. */
ulong locker_lost= 0;
/** Number of statement lost. @sa STATEMENT_STACK_SIZE. */
@@ -287,56 +287,56 @@ int init_instruments(const PFS_global_param *param)
if (mutex_max > 0)
{
- mutex_array= PFS_MALLOC_ARRAY(mutex_max, PFS_mutex, MYF(MY_ZEROFILL));
+ mutex_array= PFS_MALLOC_ARRAY(mutex_max, sizeof(PFS_mutex), PFS_mutex, MYF(MY_ZEROFILL));
if (unlikely(mutex_array == NULL))
return 1;
}
if (rwlock_max > 0)
{
- rwlock_array= PFS_MALLOC_ARRAY(rwlock_max, PFS_rwlock, MYF(MY_ZEROFILL));
+ rwlock_array= PFS_MALLOC_ARRAY(rwlock_max, sizeof(PFS_rwlock), PFS_rwlock, MYF(MY_ZEROFILL));
if (unlikely(rwlock_array == NULL))
return 1;
}
if (cond_max > 0)
{
- cond_array= PFS_MALLOC_ARRAY(cond_max, PFS_cond, MYF(MY_ZEROFILL));
+ cond_array= PFS_MALLOC_ARRAY(cond_max, sizeof(PFS_cond), PFS_cond, MYF(MY_ZEROFILL));
if (unlikely(cond_array == NULL))
return 1;
}
if (file_max > 0)
{
- file_array= PFS_MALLOC_ARRAY(file_max, PFS_file, MYF(MY_ZEROFILL));
+ file_array= PFS_MALLOC_ARRAY(file_max, sizeof(PFS_file), PFS_file, MYF(MY_ZEROFILL));
if (unlikely(file_array == NULL))
return 1;
}
if (file_handle_max > 0)
{
- file_handle_array= PFS_MALLOC_ARRAY(file_handle_max, PFS_file*, MYF(MY_ZEROFILL));
+ file_handle_array= PFS_MALLOC_ARRAY(file_handle_max, sizeof(PFS_file*), PFS_file*, MYF(MY_ZEROFILL));
if (unlikely(file_handle_array == NULL))
return 1;
}
if (table_max > 0)
{
- table_array= PFS_MALLOC_ARRAY(table_max, PFS_table, MYF(MY_ZEROFILL));
+ table_array= PFS_MALLOC_ARRAY(table_max, sizeof(PFS_table), PFS_table, MYF(MY_ZEROFILL));
if (unlikely(table_array == NULL))
return 1;
}
if (socket_max > 0)
{
- socket_array= PFS_MALLOC_ARRAY(socket_max, PFS_socket, MYF(MY_ZEROFILL));
+ socket_array= PFS_MALLOC_ARRAY(socket_max, sizeof(PFS_socket), PFS_socket, MYF(MY_ZEROFILL));
if (unlikely(socket_array == NULL))
return 1;
}
if (thread_max > 0)
{
- thread_array= PFS_MALLOC_ARRAY(thread_max, PFS_thread, MYF(MY_ZEROFILL));
+ thread_array= PFS_MALLOC_ARRAY(thread_max, sizeof(PFS_thread), PFS_thread, MYF(MY_ZEROFILL));
if (unlikely(thread_array == NULL))
return 1;
}
@@ -344,7 +344,7 @@ int init_instruments(const PFS_global_param *param)
if (thread_waits_history_sizing > 0)
{
thread_waits_history_array=
- PFS_MALLOC_ARRAY(thread_waits_history_sizing, PFS_events_waits,
+ PFS_MALLOC_ARRAY(thread_waits_history_sizing, sizeof(PFS_events_waits), PFS_events_waits,
MYF(MY_ZEROFILL));
if (unlikely(thread_waits_history_array == NULL))
return 1;
@@ -354,7 +354,7 @@ int init_instruments(const PFS_global_param *param)
{
thread_instr_class_waits_array=
PFS_MALLOC_ARRAY(thread_instr_class_waits_sizing,
- PFS_single_stat, MYF(MY_ZEROFILL));
+ sizeof(PFS_single_stat), PFS_single_stat, MYF(MY_ZEROFILL));
if (unlikely(thread_instr_class_waits_array == NULL))
return 1;
@@ -365,7 +365,7 @@ int init_instruments(const PFS_global_param *param)
if (thread_stages_history_sizing > 0)
{
thread_stages_history_array=
- PFS_MALLOC_ARRAY(thread_stages_history_sizing, PFS_events_stages,
+ PFS_MALLOC_ARRAY(thread_stages_history_sizing, sizeof(PFS_events_stages), PFS_events_stages,
MYF(MY_ZEROFILL));
if (unlikely(thread_stages_history_array == NULL))
return 1;
@@ -375,7 +375,7 @@ int init_instruments(const PFS_global_param *param)
{
thread_instr_class_stages_array=
PFS_MALLOC_ARRAY(thread_instr_class_stages_sizing,
- PFS_stage_stat, MYF(MY_ZEROFILL));
+ sizeof(PFS_stage_stat), PFS_stage_stat, MYF(MY_ZEROFILL));
if (unlikely(thread_instr_class_stages_array == NULL))
return 1;
@@ -386,8 +386,8 @@ int init_instruments(const PFS_global_param *param)
if (thread_statements_history_sizing > 0)
{
thread_statements_history_array=
- PFS_MALLOC_ARRAY(thread_statements_history_sizing, PFS_events_statements,
- MYF(MY_ZEROFILL));
+ PFS_MALLOC_ARRAY(thread_statements_history_sizing, sizeof(PFS_events_statements),
+ PFS_events_statements, MYF(MY_ZEROFILL));
if (unlikely(thread_statements_history_array == NULL))
return 1;
}
@@ -395,8 +395,8 @@ int init_instruments(const PFS_global_param *param)
if (thread_statements_stack_sizing > 0)
{
thread_statements_stack_array=
- PFS_MALLOC_ARRAY(thread_statements_stack_sizing, PFS_events_statements,
- MYF(MY_ZEROFILL));
+ PFS_MALLOC_ARRAY(thread_statements_stack_sizing, sizeof(PFS_events_statements),
+ PFS_events_statements, MYF(MY_ZEROFILL));
if (unlikely(thread_statements_stack_array == NULL))
return 1;
}
@@ -405,7 +405,7 @@ int init_instruments(const PFS_global_param *param)
{
thread_instr_class_statements_array=
PFS_MALLOC_ARRAY(thread_instr_class_statements_sizing,
- PFS_statement_stat, MYF(MY_ZEROFILL));
+ sizeof(PFS_statement_stat), PFS_statement_stat, MYF(MY_ZEROFILL));
if (unlikely(thread_instr_class_statements_array == NULL))
return 1;
@@ -477,7 +477,7 @@ int init_instruments(const PFS_global_param *param)
{
global_instr_class_stages_array=
PFS_MALLOC_ARRAY(stage_class_max,
- PFS_stage_stat, MYF(MY_ZEROFILL));
+ sizeof(PFS_stage_stat), PFS_stage_stat, MYF(MY_ZEROFILL));
if (unlikely(global_instr_class_stages_array == NULL))
return 1;
@@ -489,7 +489,7 @@ int init_instruments(const PFS_global_param *param)
{
global_instr_class_statements_array=
PFS_MALLOC_ARRAY(statement_class_max,
- PFS_statement_stat, MYF(MY_ZEROFILL));
+ sizeof(PFS_statement_stat), PFS_statement_stat, MYF(MY_ZEROFILL));
if (unlikely(global_instr_class_statements_array == NULL))
return 1;
diff --git a/storage/perfschema/pfs_instr.h b/storage/perfschema/pfs_instr.h
index a639f94fada..b25f5769b69 100644
--- a/storage/perfschema/pfs_instr.h
+++ b/storage/perfschema/pfs_instr.h
@@ -299,7 +299,7 @@ struct PFS_ALIGNED PFS_socket : public PFS_instr
/** Max size of the statements stack. */
extern uint statement_stack_max;
/** Max size of the digests token array. */
-extern uint pfs_max_digest_length;
+extern size_t pfs_max_digest_length;
/**
@def PFS_MAX_ALLOC_RETRY
diff --git a/storage/perfschema/pfs_instr_class.cc b/storage/perfschema/pfs_instr_class.cc
index 84e0a0357a0..c67c120283d 100644
--- a/storage/perfschema/pfs_instr_class.cc
+++ b/storage/perfschema/pfs_instr_class.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -255,24 +255,24 @@ int init_sync_class(uint mutex_class_sizing,
if (mutex_class_max > 0)
{
- mutex_class_array= PFS_MALLOC_ARRAY(mutex_class_max, PFS_mutex_class,
- MYF(MY_ZEROFILL));
+ mutex_class_array= PFS_MALLOC_ARRAY(mutex_class_max, sizeof(PFS_mutex_class),
+ PFS_mutex_class, MYF(MY_ZEROFILL));
if (unlikely(mutex_class_array == NULL))
return 1;
}
if (rwlock_class_max > 0)
{
- rwlock_class_array= PFS_MALLOC_ARRAY(rwlock_class_max, PFS_rwlock_class,
- MYF(MY_ZEROFILL));
+ rwlock_class_array= PFS_MALLOC_ARRAY(rwlock_class_max, sizeof(PFS_rwlock_class),
+ PFS_rwlock_class, MYF(MY_ZEROFILL));
if (unlikely(rwlock_class_array == NULL))
return 1;
}
if (cond_class_max > 0)
{
- cond_class_array= PFS_MALLOC_ARRAY(cond_class_max, PFS_cond_class,
- MYF(MY_ZEROFILL));
+ cond_class_array= PFS_MALLOC_ARRAY(cond_class_max, sizeof(PFS_cond_class),
+ PFS_cond_class, MYF(MY_ZEROFILL));
if (unlikely(cond_class_array == NULL))
return 1;
}
@@ -308,8 +308,8 @@ int init_thread_class(uint thread_class_sizing)
if (thread_class_max > 0)
{
- thread_class_array= PFS_MALLOC_ARRAY(thread_class_max, PFS_thread_class,
- MYF(MY_ZEROFILL));
+ thread_class_array= PFS_MALLOC_ARRAY(thread_class_max, sizeof(PFS_thread_class),
+ PFS_thread_class, MYF(MY_ZEROFILL));
if (unlikely(thread_class_array == NULL))
result= 1;
}
@@ -341,8 +341,8 @@ int init_table_share(uint table_share_sizing)
if (table_share_max > 0)
{
- table_share_array= PFS_MALLOC_ARRAY(table_share_max, PFS_table_share,
- MYF(MY_ZEROFILL));
+ table_share_array= PFS_MALLOC_ARRAY(table_share_max, sizeof(PFS_table_share),
+ PFS_table_share, MYF(MY_ZEROFILL));
if (unlikely(table_share_array == NULL))
result= 1;
}
@@ -481,8 +481,8 @@ int init_file_class(uint file_class_sizing)
if (file_class_max > 0)
{
- file_class_array= PFS_MALLOC_ARRAY(file_class_max, PFS_file_class,
- MYF(MY_ZEROFILL));
+ file_class_array= PFS_MALLOC_ARRAY(file_class_max, sizeof(PFS_file_class),
+ PFS_file_class, MYF(MY_ZEROFILL));
if (unlikely(file_class_array == NULL))
return 1;
}
@@ -515,8 +515,8 @@ int init_stage_class(uint stage_class_sizing)
if (stage_class_max > 0)
{
- stage_class_array= PFS_MALLOC_ARRAY(stage_class_max, PFS_stage_class,
- MYF(MY_ZEROFILL));
+ stage_class_array= PFS_MALLOC_ARRAY(stage_class_max, sizeof(PFS_stage_class),
+ PFS_stage_class, MYF(MY_ZEROFILL));
if (unlikely(stage_class_array == NULL))
return 1;
}
@@ -549,8 +549,8 @@ int init_statement_class(uint statement_class_sizing)
if (statement_class_max > 0)
{
- statement_class_array= PFS_MALLOC_ARRAY(statement_class_max, PFS_statement_class,
- MYF(MY_ZEROFILL));
+ statement_class_array= PFS_MALLOC_ARRAY(statement_class_max, sizeof(PFS_statement_class),
+ PFS_statement_class, MYF(MY_ZEROFILL));
if (unlikely(statement_class_array == NULL))
return 1;
}
@@ -583,8 +583,8 @@ int init_socket_class(uint socket_class_sizing)
if (socket_class_max > 0)
{
- socket_class_array= PFS_MALLOC_ARRAY(socket_class_max, PFS_socket_class,
- MYF(MY_ZEROFILL));
+ socket_class_array= PFS_MALLOC_ARRAY(socket_class_max, sizeof(PFS_socket_class),
+ PFS_socket_class, MYF(MY_ZEROFILL));
if (unlikely(socket_class_array == NULL))
return 1;
}
diff --git a/storage/perfschema/pfs_server.h b/storage/perfschema/pfs_server.h
index e0fe71bc8c5..bc0c69e86b9 100644
--- a/storage/perfschema/pfs_server.h
+++ b/storage/perfschema/pfs_server.h
@@ -200,7 +200,7 @@ struct PFS_global_param
/** Maximum number of session attribute strings per thread */
long m_session_connect_attrs_sizing;
- uint m_max_digest_length;
+ long m_max_digest_length;
/** Sizing hints, for auto tuning. */
PFS_sizing_hints m_hints;
diff --git a/storage/perfschema/pfs_setup_actor.cc b/storage/perfschema/pfs_setup_actor.cc
index ff45e4a0971..f12d70840c1 100644
--- a/storage/perfschema/pfs_setup_actor.cc
+++ b/storage/perfschema/pfs_setup_actor.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -60,8 +60,8 @@ int init_setup_actor(const PFS_global_param *param)
if (setup_actor_max > 0)
{
- setup_actor_array= PFS_MALLOC_ARRAY(setup_actor_max, PFS_setup_actor,
- MYF(MY_ZEROFILL));
+ setup_actor_array= PFS_MALLOC_ARRAY(setup_actor_max, sizeof(PFS_setup_actor),
+ PFS_setup_actor, MYF(MY_ZEROFILL));
if (unlikely(setup_actor_array == NULL))
return 1;
}
diff --git a/storage/perfschema/pfs_setup_object.cc b/storage/perfschema/pfs_setup_object.cc
index c77039663b2..809fe8edd24 100644
--- a/storage/perfschema/pfs_setup_object.cc
+++ b/storage/perfschema/pfs_setup_object.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -55,8 +55,8 @@ int init_setup_object(const PFS_global_param *param)
if (setup_object_max > 0)
{
- setup_object_array= PFS_MALLOC_ARRAY(setup_object_max, PFS_setup_object,
- MYF(MY_ZEROFILL));
+ setup_object_array= PFS_MALLOC_ARRAY(setup_object_max, sizeof(PFS_setup_object),
+ PFS_setup_object, MYF(MY_ZEROFILL));
if (unlikely(setup_object_array == NULL))
return 1;
}
diff --git a/storage/perfschema/pfs_user.cc b/storage/perfschema/pfs_user.cc
index a009e5d65ef..528457fe017 100644
--- a/storage/perfschema/pfs_user.cc
+++ b/storage/perfschema/pfs_user.cc
@@ -66,7 +66,7 @@ int init_user(const PFS_global_param *param)
if (user_max > 0)
{
- user_array= PFS_MALLOC_ARRAY(user_max, PFS_user,
+ user_array= PFS_MALLOC_ARRAY(user_max, sizeof(PFS_user), PFS_user,
MYF(MY_ZEROFILL));
if (unlikely(user_array == NULL))
return 1;
diff --git a/storage/perfschema/table_events_stages.cc b/storage/perfschema/table_events_stages.cc
index f98ff60d569..42761d92abf 100644
--- a/storage/perfschema/table_events_stages.cc
+++ b/storage/perfschema/table_events_stages.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -121,6 +121,7 @@ void table_events_stages_common::make_row(PFS_events_stages *stage)
{
const char *base;
const char *safe_source_file;
+ ulonglong timer_end;
m_row_exists= false;
@@ -135,7 +136,16 @@ void table_events_stages_common::make_row(PFS_events_stages *stage)
m_row.m_nesting_event_id= stage->m_nesting_event_id;
m_row.m_nesting_event_type= stage->m_nesting_event_type;
- m_normalizer->to_pico(stage->m_timer_start, stage->m_timer_end,
+ if (m_row.m_end_event_id == 0)
+ {
+ timer_end= get_timer_raw_value(stage_timer);
+ }
+ else
+ {
+ timer_end= stage->m_timer_end;
+ }
+
+ m_normalizer->to_pico(stage->m_timer_start, timer_end,
& m_row.m_timer_start, & m_row.m_timer_end, & m_row.m_timer_wait);
m_row.m_name= klass->m_name;
diff --git a/storage/perfschema/table_events_statements.cc b/storage/perfschema/table_events_statements.cc
index 16f048a0a7f..84f30ce000f 100644
--- a/storage/perfschema/table_events_statements.cc
+++ b/storage/perfschema/table_events_statements.cc
@@ -215,6 +215,7 @@ void table_events_statements_common::make_row_part_1(PFS_events_statements *stat
{
const char *base;
const char *safe_source_file;
+ ulonglong timer_end;
m_row_exists= false;
@@ -229,7 +230,16 @@ void table_events_statements_common::make_row_part_1(PFS_events_statements *stat
m_row.m_nesting_event_id= statement->m_nesting_event_id;
m_row.m_nesting_event_type= statement->m_nesting_event_type;
- m_normalizer->to_pico(statement->m_timer_start, statement->m_timer_end,
+ if (m_row.m_end_event_id == 0)
+ {
+ timer_end= get_timer_raw_value(statement_timer);
+ }
+ else
+ {
+ timer_end= statement->m_timer_end;
+ }
+
+ m_normalizer->to_pico(statement->m_timer_start, timer_end,
& m_row.m_timer_start, & m_row.m_timer_end, & m_row.m_timer_wait);
m_row.m_lock_time= statement->m_lock_time * MICROSEC_TO_PICOSEC;
@@ -249,8 +259,8 @@ void table_events_statements_common::make_row_part_1(PFS_events_statements *stat
return;
base= base_name(safe_source_file);
- m_row.m_source_length= my_snprintf(m_row.m_source, sizeof(m_row.m_source),
- "%s:%d", base, statement->m_source_line);
+ m_row.m_source_length= (uint)my_snprintf(m_row.m_source, sizeof(m_row.m_source),
+ "%s:%d", base, statement->m_source_line);
if (m_row.m_source_length > sizeof(m_row.m_source))
m_row.m_source_length= sizeof(m_row.m_source);
@@ -291,7 +301,7 @@ void table_events_statements_common::make_row_part_2(const sql_digest_storage *d
/*
Filling up statement digest information.
*/
- uint safe_byte_count= digest->m_byte_count;
+ size_t safe_byte_count= digest->m_byte_count;
if (safe_byte_count > 0 &&
safe_byte_count <= pfs_max_digest_length)
{
@@ -428,7 +438,7 @@ int table_events_statements_common::read_row_values(TABLE *table,
f->set_null();
break;
case 19: /* MESSAGE_TEXT */
- len= strlen(m_row.m_message_text);
+ len= (uint)strlen(m_row.m_message_text);
if (len)
set_field_varchar_utf8(f, m_row.m_message_text, len);
else
@@ -790,7 +800,7 @@ int table_events_statements_history_long::rnd_init(bool scan)
int table_events_statements_history_long::rnd_next(void)
{
PFS_events_statements *statement;
- uint limit;
+ size_t limit;
if (events_statements_history_long_size == 0)
return HA_ERR_END_OF_FILE;
@@ -819,7 +829,7 @@ int table_events_statements_history_long::rnd_next(void)
int table_events_statements_history_long::rnd_pos(const void *pos)
{
PFS_events_statements *statement;
- uint limit;
+ size_t limit;
if (events_statements_history_long_size == 0)
return HA_ERR_RECORD_DELETED;
diff --git a/storage/perfschema/table_events_waits.cc b/storage/perfschema/table_events_waits.cc
index 8e2d0064538..cd32d81519e 100644
--- a/storage/perfschema/table_events_waits.cc
+++ b/storage/perfschema/table_events_waits.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -318,6 +318,8 @@ void table_events_waits_common::make_row(bool thread_own_wait,
PFS_instr_class *safe_class;
const char *base;
const char *safe_source_file;
+ enum_timer_name timer_name= wait_timer;
+ ulonglong timer_end;
m_row_exists= false;
safe_thread= sanitize_thread(pfs_thread);
@@ -356,6 +358,7 @@ void table_events_waits_common::make_row(bool thread_own_wait,
case WAIT_CLASS_IDLE:
clear_object_columns();
safe_class= sanitize_idle_class(wait->m_class);
+ timer_name= idle_timer;
break;
case WAIT_CLASS_MUTEX:
clear_object_columns();
@@ -399,7 +402,17 @@ void table_events_waits_common::make_row(bool thread_own_wait,
m_row.m_nesting_event_type= wait->m_nesting_event_type;
get_normalizer(safe_class);
- m_normalizer->to_pico(wait->m_timer_start, wait->m_timer_end,
+
+ if (m_row.m_end_event_id == 0)
+ {
+ timer_end= get_timer_raw_value(timer_name);
+ }
+ else
+ {
+ timer_end= wait->m_timer_end;
+ }
+
+ m_normalizer->to_pico(wait->m_timer_start, timer_end,
& m_row.m_timer_start, & m_row.m_timer_end, & m_row.m_timer_wait);
m_row.m_name= safe_class->m_name;
diff --git a/storage/perfschema/table_helper.cc b/storage/perfschema/table_helper.cc
index c9def1bfc74..d064333dc7e 100644
--- a/storage/perfschema/table_helper.cc
+++ b/storage/perfschema/table_helper.cc
@@ -110,7 +110,7 @@ int PFS_digest_row::make_row(PFS_statements_digest_stat* pfs)
if (m_schema_name_length > 0)
memcpy(m_schema_name, pfs->m_digest_key.m_schema_name, m_schema_name_length);
- uint safe_byte_count= pfs->m_digest_storage.m_byte_count;
+ size_t safe_byte_count= pfs->m_digest_storage.m_byte_count;
if (safe_byte_count > pfs_max_digest_length)
safe_byte_count= 0;
diff --git a/storage/perfschema/unittest/CMakeLists.txt b/storage/perfschema/unittest/CMakeLists.txt
index e8b11e807bf..4c6b0b91021 100644
--- a/storage/perfschema/unittest/CMakeLists.txt
+++ b/storage/perfschema/unittest/CMakeLists.txt
@@ -28,5 +28,5 @@ ADD_CONVENIENCE_LIBRARY(pfs_server_stubs pfs_server_stubs.cc)
ADD_DEPENDENCIES(pfs_server_stubs GenError)
MY_ADD_TESTS(pfs_instr_class pfs_instr_class-oom pfs_instr pfs_instr-oom
- pfs_account-oom pfs_host-oom pfs_timer pfs_user-oom pfs
+ pfs_account-oom pfs_host-oom pfs_timer pfs_user-oom pfs pfs_misc
EXT "cc" LINK_LIBRARIES perfschema mysys pfs_server_stubs)
diff --git a/storage/perfschema/unittest/pfs_misc-t.cc b/storage/perfschema/unittest/pfs_misc-t.cc
new file mode 100644
index 00000000000..a4b11b9a727
--- /dev/null
+++ b/storage/perfschema/unittest/pfs_misc-t.cc
@@ -0,0 +1,72 @@
+/* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+#include <my_global.h>
+#include <pfs_instr.h>
+#include <pfs_stat.h>
+#include <pfs_global.h>
+#include <pfs_instr_class.h>
+#include <tap.h>
+
+#include <memory.h>
+
+void test_digest_length_overflow()
+{
+ if (sizeof(size_t) != 4)
+ {
+ skip(2, "digest length overflow requires a 32-bit environment");
+ return;
+ }
+
+ PFS_global_param param;
+ memset(&param, 0, sizeof(param));
+ param.m_enabled= true;
+ /*
+ Force 32-bit arithmetic overflow using the digest memory allocation
+ parameters. The Performance Schema should detect the overflow, free
+ allocated memory and abort initialization with a warning.
+ */
+
+ /* Max digest length, events_statements_history_long. */
+ param.m_events_statements_history_long_sizing= 10000;
+ param.m_digest_sizing= 1000;
+ param.m_max_digest_length= (1024 * 1024);
+ pfs_max_digest_length= param.m_max_digest_length;
+
+ int rc = init_events_statements_history_long(param.m_events_statements_history_long_sizing);
+ ok(rc == 1, "digest length overflow (init_events_statements_history_long");
+
+ /* Max digest length, events_statements_summary_by_digest. */
+ param.m_max_digest_length= (1024 * 1024);
+ param.m_digest_sizing= 10000;
+
+ rc = init_digest(&param);
+ ok(rc == 1, "digest length overflow (init_digest)");
+}
+
+void do_all_tests()
+{
+ test_digest_length_overflow();
+}
+
+int main(int, char **)
+{
+ plan(2);
+ MY_INIT("pfs_misc-t");
+ do_all_tests();
+ my_end(0);
+ return exit_status();
+}
+
diff --git a/storage/perfschema/unittest/pfs_server_stubs.cc b/storage/perfschema/unittest/pfs_server_stubs.cc
index a023414357a..7c0e275edc7 100644
--- a/storage/perfschema/unittest/pfs_server_stubs.cc
+++ b/storage/perfschema/unittest/pfs_server_stubs.cc
@@ -34,7 +34,11 @@ void compute_digest_md5(const sql_digest_storage *, unsigned char *)
}
class sys_var { public: enum where { AUTO }; };
-void mark_sys_var_value_origin(void *ptr, enum sys_var::where here)
+void set_sys_var_value_origin(void *ptr, enum sys_var::where here)
{
}
+enum sys_var::where get_sys_var_value_origin(void *ptr)
+{
+ return sys_var::AUTO;
+}
diff --git a/storage/perfschema/unittest/stub_pfs_global.h b/storage/perfschema/unittest/stub_pfs_global.h
index 34c52e18b5a..8f204006f48 100644
--- a/storage/perfschema/unittest/stub_pfs_global.h
+++ b/storage/perfschema/unittest/stub_pfs_global.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,6 +25,11 @@ int stub_alloc_fails_after_count= 0;
void *pfs_malloc(size_t size, myf)
{
+ /*
+ Catch non initialized sizing parameter in the unit tests.
+ */
+ DBUG_ASSERT(size <= 100*1024*1024);
+
if (stub_alloc_always_fails)
return NULL;
@@ -43,6 +48,23 @@ void pfs_free(void *ptr)
free(ptr);
}
+void *pfs_malloc_array(size_t n, size_t size, myf flags)
+{
+ size_t array_size= n * size;
+ /* Check for overflow before allocating. */
+ if (is_overflow(array_size, n, size))
+ return NULL;
+ return pfs_malloc(array_size, flags);
+}
+
+bool is_overflow(size_t product, size_t n1, size_t n2)
+{
+ if (n1 != 0 && (product / n1 != n2))
+ return true;
+ else
+ return false;
+}
+
void pfs_print_error(const char *format, ...)
{
}
diff --git a/storage/perfschema/unittest/stub_print_error.h b/storage/perfschema/unittest/stub_print_error.h
index caad24e5257..e9b8bc25548 100644
--- a/storage/perfschema/unittest/stub_print_error.h
+++ b/storage/perfschema/unittest/stub_print_error.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -33,6 +33,23 @@ void pfs_free(void *ptr)
free(ptr);
}
+void *pfs_malloc_array(size_t n, size_t size, myf flags)
+{
+ size_t array_size= n * size;
+ /* Check for overflow before allocating. */
+ if (is_overflow(array_size, n, size))
+ return NULL;
+ return pfs_malloc(array_size, flags);
+}
+
+bool is_overflow(size_t product, size_t n1, size_t n2)
+{
+ if (n1 != 0 && (product / n1 != n2))
+ return true;
+ else
+ return false;
+}
+
void pfs_print_error(const char *format, ...)
{
/* Do not pollute the unit test output with annoying messages. */
diff --git a/storage/sphinx/ha_sphinx.cc b/storage/sphinx/ha_sphinx.cc
index a54930ec331..568d3695781 100644
--- a/storage/sphinx/ha_sphinx.cc
+++ b/storage/sphinx/ha_sphinx.cc
@@ -855,9 +855,9 @@ bool sphinx_show_status ( THD * thd )
}
CSphTLS * pTls = (CSphTLS*) thd->ha_data[sphinx_hton.slot];
- field_list.push_back ( new Item_empty_string ( "Type", 10 ) );
- field_list.push_back ( new Item_empty_string ( "Name", FN_REFLEN ) );
- field_list.push_back ( new Item_empty_string ( "Status", 10 ) );
+ field_list.push_back ( new Item_empty_string ( thd, "Type", 10 ) );
+ field_list.push_back ( new Item_empty_string ( thd, "Name", FN_REFLEN ) );
+ field_list.push_back ( new Item_empty_string ( thd, "Status", 10 ) );
if ( protocol->send_fields ( &field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF ) )
SPH_RET(TRUE);
@@ -2335,10 +2335,11 @@ int ha_sphinx::write_row ( byte * )
} else
{
+ THD *thd= ha_thd();
if ( (*ppField)->type()==MYSQL_TYPE_TIMESTAMP )
{
- Item_field * pWrap = new Item_field ( *ppField ); // autofreed by query arena, I assume
- Item_func_unix_timestamp * pConv = new Item_func_unix_timestamp ( pWrap );
+ Item_field * pWrap = new (thd->mem_root) Item_field(thd, *ppField); // autofreed by query arena, I assume
+ Item_func_unix_timestamp * pConv = new (thd->mem_root) Item_func_unix_timestamp(thd, pWrap);
pConv->quick_fix_field();
unsigned int uTs = (unsigned int) pConv->val_int();
diff --git a/storage/sphinx/mysql-test/sphinx/my.cnf b/storage/sphinx/mysql-test/sphinx/my.cnf
index a3789a065bf..f60380b7171 100644
--- a/storage/sphinx/mysql-test/sphinx/my.cnf
+++ b/storage/sphinx/mysql-test/sphinx/my.cnf
@@ -16,7 +16,6 @@ mem_limit = 32M
[searchd]
read_timeout = 5
max_children = 30
-max_matches = 1000
seamless_rotate = 1
preopen_indexes = 0
unlink_old = 1
@@ -24,7 +23,7 @@ log = @ENV.MYSQLTEST_VARDIR/searchd/sphinx-searchd.log
query_log = @ENV.MYSQLTEST_VARDIR/searchd/sphinx-query.log
#log-error = @ENV.MYSQLTEST_VARDIR/searchd/sphinx.log
pid_file = @ENV.MYSQLTEST_VARDIR/run/searchd.pid
-port = @ENV.SPHINXSEARCH_PORT
+listen = @ENV.SPHINXSEARCH_PORT
[ENV]
SPHINXSEARCH_PORT = @OPT.port
diff --git a/storage/spider/CMakeLists.txt b/storage/spider/CMakeLists.txt
index 33786e2b85a..402c74b2cde 100644
--- a/storage/spider/CMakeLists.txt
+++ b/storage/spider/CMakeLists.txt
@@ -1,10 +1,7 @@
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_HANDLERSOCKET")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_HANDLERSOCKET")
-IF(HAVE_WVLA)
- SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-vla")
- SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wno-vla")
-ENDIF()
+MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-vla" DEBUG)
SET(SPIDER_SOURCES
spd_param.cc spd_sys_table.cc spd_trx.cc spd_db_conn.cc spd_conn.cc
diff --git a/storage/spider/spd_sys_table.cc b/storage/spider/spd_sys_table.cc
index 1ff3496d83e..15d0c43a176 100644
--- a/storage/spider/spd_sys_table.cc
+++ b/storage/spider/spd_sys_table.cc
@@ -2390,7 +2390,7 @@ TABLE *spider_mk_sys_tmp_table(
goto error_alloc_field;
field->init(table);
- if (!(i_field = new Item_field((Field *) field)))
+ if (!(i_field = new (thd->mem_root) Item_field(thd, (Field *) field)))
goto error_alloc_item_field;
if (i_list.push_back(i_field))
@@ -2443,29 +2443,29 @@ TABLE *spider_mk_sys_tmp_table_for_result(
goto error_alloc_field1;
field1->init(table);
- if (!(i_field1 = new Item_field((Field *) field1)))
+ if (!(i_field1 = new (thd->mem_root) Item_field(thd, (Field *) field1)))
goto error_alloc_item_field1;
if (i_list.push_back(i_field1))
goto error_push_item1;
- if (!(field2 = new Field_blob(
+ if (!(field2 = new (thd->mem_root) Field_blob(
4294967295U, FALSE, field_name2, cs, TRUE)))
goto error_alloc_field2;
field2->init(table);
- if (!(i_field2 = new Item_field((Field *) field2)))
+ if (!(i_field2 = new (thd->mem_root) Item_field(thd, (Field *) field2)))
goto error_alloc_item_field2;
if (i_list.push_back(i_field2))
goto error_push_item2;
- if (!(field3 = new Field_blob(
+ if (!(field3 = new (thd->mem_root) Field_blob(
4294967295U, FALSE, field_name3, cs, TRUE)))
goto error_alloc_field3;
field3->init(table);
- if (!(i_field3 = new Item_field((Field *) field3)))
+ if (!(i_field3 = new (thd->mem_root) Item_field(thd, (Field *) field3)))
goto error_alloc_item_field3;
if (i_list.push_back(i_field3))
diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt
index 08adb7355e4..7cbc8a119e4 100644
--- a/storage/tokudb/CMakeLists.txt
+++ b/storage/tokudb/CMakeLists.txt
@@ -17,16 +17,12 @@ IF(NOT LIBJEMALLOC)
MESSAGE(WARNING "TokuDB is enabled, but jemalloc is not. This configuration is not supported")
ENDIF()
-IF (HAVE_WVLA)
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-vla")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-vla")
- SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wno-vla")
- SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-vla")
-ENDIF()
+MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-vla")
+MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-vla" DEBUG)
############################################
-SET(TOKUDB_VERSION "tokudb-7.5.6")
SET(TOKUDB_DEB_FILES "usr/lib/mysql/plugin/ha_tokudb.so\netc/mysql/conf.d/tokudb.cnf\nusr/bin/tokuftdump\nusr/share/doc/mariadb-server-10.1/README-TOKUDB\nusr/share/doc/mariadb-server-10.1/README.md" PARENT_SCOPE)
+SET(TOKUDB_VERSION "tokudb-7.5.7")
SET(USE_BDB OFF CACHE BOOL "")
MARK_AS_ADVANCED(BUILDNAME)
MARK_AS_ADVANCED(BUILD_TESTING)
@@ -70,36 +66,7 @@ ENDIF()
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
-macro(set_cflags_if_supported)
- foreach(flag ${ARGN})
- string(REGEX REPLACE "-" "_" temp_flag ${flag})
- check_c_compiler_flag(${flag} HAVE_C_${temp_flag})
- if (HAVE_C_${temp_flag})
- set(CMAKE_C_FLAGS "${flag} ${CMAKE_C_FLAGS}")
- endif ()
- check_cxx_compiler_flag(${flag} HAVE_CXX_${temp_flag})
- if (HAVE_CXX_${temp_flag})
- set(CMAKE_CXX_FLAGS "${flag} ${CMAKE_CXX_FLAGS}")
- endif ()
- endforeach(flag)
-endmacro(set_cflags_if_supported)
-
-macro(append_cflags_if_supported)
- foreach(flag ${ARGN})
- string(REGEX REPLACE "-" "_" temp_flag ${flag})
- check_c_compiler_flag(${flag} HAVE_C_${temp_flag})
- if (HAVE_C_${temp_flag})
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
- endif ()
- check_cxx_compiler_flag(${flag} HAVE_CXX_${temp_flag})
- if (HAVE_CXX_${temp_flag})
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
- endif ()
- endforeach(flag)
-endmacro(append_cflags_if_supported)
-
-set_cflags_if_supported(-Wno-missing-field-initializers)
-append_cflags_if_supported(-Wno-vla)
+MY_CHECK_AND_SET_COMPILER_FLAG(-Wno-missing-field-initializers)
ADD_SUBDIRECTORY(ft-index)
diff --git a/storage/tokudb/ft-index/buildheader/make_tdb.cc b/storage/tokudb/ft-index/buildheader/make_tdb.cc
index 3f9a721d9aa..53706649231 100644
--- a/storage/tokudb/ft-index/buildheader/make_tdb.cc
+++ b/storage/tokudb/ft-index/buildheader/make_tdb.cc
@@ -587,6 +587,7 @@ static void print_db_txn_struct (void) {
"uint64_t (*get_client_id)(DB_TXN *)",
"bool (*is_prepared)(DB_TXN *)",
"DB_TXN *(*get_child)(DB_TXN *)",
+ "uint64_t (*get_start_time)(DB_TXN *)",
NULL};
sort_and_dump_fields("db_txn", false, extra);
}
@@ -786,7 +787,7 @@ int main (int argc, char *const argv[] __attribute__((__unused__))) {
printf("typedef void (*lock_timeout_callback)(DB *db, uint64_t requesting_txnid, const DBT *left_key, const DBT *right_key, uint64_t blocking_txnid);\n");
printf("typedef int (*iterate_row_locks_callback)(DB **db, DBT *left_key, DBT *right_key, void *extra);\n");
- printf("typedef int (*iterate_transactions_callback)(uint64_t txnid, uint64_t client_id, iterate_row_locks_callback cb, void *locks_extra, void *extra);\n");
+ printf("typedef int (*iterate_transactions_callback)(DB_TXN *dbtxn, iterate_row_locks_callback cb, void *locks_extra, void *extra);\n");
printf("typedef int (*iterate_requests_callback)(DB *db, uint64_t requesting_txnid, const DBT *left_key, const DBT *right_key, uint64_t blocking_txnid, uint64_t start_time, void *extra);\n");
print_db_env_struct();
print_db_key_range_struct();
diff --git a/storage/tokudb/ft-index/cmake_modules/TokuSetupCompiler.cmake b/storage/tokudb/ft-index/cmake_modules/TokuSetupCompiler.cmake
index 99629e40bdb..ee45e7cccf3 100644
--- a/storage/tokudb/ft-index/cmake_modules/TokuSetupCompiler.cmake
+++ b/storage/tokudb/ft-index/cmake_modules/TokuSetupCompiler.cmake
@@ -47,18 +47,6 @@ include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
## adds a compiler flag if the compiler supports it
-macro(set_cflags_if_supported_named flag flagname)
- check_c_compiler_flag("${flag}" HAVE_C_${flagname})
- if (HAVE_C_${flagname})
- set(CMAKE_C_FLAGS "${flag} ${CMAKE_C_FLAGS}")
- endif ()
- check_cxx_compiler_flag("${flag}" HAVE_CXX_${flagname})
- if (HAVE_CXX_${flagname})
- set(CMAKE_CXX_FLAGS "${flag} ${CMAKE_CXX_FLAGS}")
- endif ()
-endmacro(set_cflags_if_supported_named)
-
-## adds a compiler flag if the compiler supports it
macro(set_cflags_if_supported)
foreach(flag ${ARGN})
check_c_compiler_flag(${flag} HAVE_C_${flag})
@@ -84,21 +72,19 @@ macro(set_ldflags_if_supported)
endmacro(set_ldflags_if_supported)
## disable some warnings
-set_cflags_if_supported(
- -Wno-missing-field-initializers
- -Wstrict-null-sentinel
- -Winit-self
- -Wswitch
- -Wtrampolines
- -Wlogical-op
- -Wmissing-format-attribute
- -Wno-error=missing-format-attribute
- -Wno-error=address-of-array-temporary
- -Wno-error=tautological-constant-out-of-range-compare
- -Wno-ignored-attributes
- -fno-rtti
- -fno-exceptions
- )
+MY_CHECK_AND_SET_COMPILER_FLAG(-Wno-missing-field-initializers)
+MY_CHECK_AND_SET_COMPILER_FLAG(-Wstrict-null-sentinel)
+MY_CHECK_AND_SET_COMPILER_FLAG(-Winit-self)
+MY_CHECK_AND_SET_COMPILER_FLAG(-Wswitch)
+MY_CHECK_AND_SET_COMPILER_FLAG(-Wtrampolines)
+MY_CHECK_AND_SET_COMPILER_FLAG(-Wlogical-op)
+MY_CHECK_AND_SET_COMPILER_FLAG(-Wmissing-format-attribute)
+MY_CHECK_AND_SET_COMPILER_FLAG(-Wno-error=missing-format-attribute)
+MY_CHECK_AND_SET_COMPILER_FLAG(-Wno-error=address-of-array-temporary)
+MY_CHECK_AND_SET_COMPILER_FLAG(-Wno-error=tautological-constant-out-of-range-compare)
+MY_CHECK_AND_SET_COMPILER_FLAG(-Wno-ignored-attributes)
+MY_CHECK_AND_SET_COMPILER_FLAG(-fno-rtti)
+MY_CHECK_AND_SET_COMPILER_FLAG(-fno-exceptions)
## set_cflags_if_supported_named("-Weffc++" -Weffcpp)
if (CMAKE_CXX_FLAGS MATCHES -fno-implicit-templates)
@@ -111,19 +97,12 @@ endif()
## Clang has stricter POD checks. So, only enable this warning on our other builds (Linux + GCC)
if (NOT CMAKE_CXX_COMPILER_ID MATCHES Clang)
- set_cflags_if_supported(
- -Wpacked
- )
+ MY_CHECK_AND_SET_COMPILER_FLAG(-Wpacked)
endif ()
## this hits with optimized builds somewhere in ftleaf_split, we don't
## know why but we don't think it's a big deal
-set_cflags_if_supported(
- -Wno-error=strict-overflow
- )
-set_ldflags_if_supported(
- -Wno-error=strict-overflow
- )
+MY_CHECK_AND_SET_COMPILER_FLAG(-Wno-error=strict-overflow)
## set extra debugging flags and preprocessor definitions
set(CMAKE_C_FLAGS_DEBUG "-g3 -O0 ${CMAKE_C_FLAGS_DEBUG}")
@@ -154,16 +133,15 @@ else ()
endif ()
## set warnings
-set_cflags_if_supported(
- -Wextra
- -Wbad-function-cast
- -Wno-missing-noreturn
- -Wstrict-prototypes
- -Wmissing-prototypes
- -Wmissing-declarations
- -Wpointer-arith
- -Wmissing-format-attribute
- -Wshadow
+ MY_CHECK_AND_SET_COMPILER_FLAG(-Wextra)
+ MY_CHECK_AND_SET_COMPILER_FLAG(-Wbad-function-cast)
+ MY_CHECK_AND_SET_COMPILER_FLAG(-Wno-missing-noreturn)
+ MY_CHECK_AND_SET_COMPILER_FLAG(-Wstrict-prototypes)
+ MY_CHECK_AND_SET_COMPILER_FLAG(-Wmissing-prototypes)
+ MY_CHECK_AND_SET_COMPILER_FLAG(-Wmissing-declarations)
+ MY_CHECK_AND_SET_COMPILER_FLAG(-Wpointer-arith)
+ MY_CHECK_AND_SET_COMPILER_FLAG(-Wmissing-format-attribute)
+ MY_CHECK_AND_SET_COMPILER_FLAG(-Wshadow)
## other flags to try:
#-Wunsafe-loop-optimizations
#-Wpointer-arith
@@ -173,11 +151,10 @@ set_cflags_if_supported(
#-Wzero-as-null-pointer-constant
#-Wlogical-op
#-Wvector-optimization-performance
- )
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL Clang)
# Disabling -Wcast-align with clang. TODO: fix casting and re-enable it, someday.
- set_cflags_if_supported(-Wcast-align)
+ MY_CHECK_AND_SET_COMPILER_FLAG(-Wcast-align)
endif ()
## always want these
diff --git a/storage/tokudb/ft-index/ft/ft-verify.cc b/storage/tokudb/ft-index/ft/ft-verify.cc
index d9606f37604..0a85136816f 100644
--- a/storage/tokudb/ft-index/ft/ft-verify.cc
+++ b/storage/tokudb/ft-index/ft/ft-verify.cc
@@ -160,10 +160,14 @@ get_ith_key_dbt (BASEMENTNODE bn, int i) {
#define VERIFY_ASSERTION(predicate, i, string) ({ \
if(!(predicate)) { \
- (void) verbose; \
- if (true) { \
- fprintf(stderr, "%s:%d: Looking at child %d of block %" PRId64 ": %s\n", __FILE__, __LINE__, i, blocknum.b, string); \
- } \
+ fprintf(stderr, "%s:%d: Looking at child %d of block %" PRId64 ": %s\n", __FILE__, __LINE__, i, blocknum.b, string); \
+ result = TOKUDB_NEEDS_REPAIR; \
+ if (!keep_going_on_failure) goto done; \
+ }})
+
+#define VERIFY_ASSERTION_BASEMENT(predicate, bn, entry, string) ({ \
+ if(!(predicate)) { \
+ fprintf(stderr, "%s:%d: Looking at block %" PRId64 " bn %d entry %d: %s\n", __FILE__, __LINE__, blocknum.b, bn, entry, string); \
result = TOKUDB_NEEDS_REPAIR; \
if (!keep_going_on_failure) goto done; \
}})
@@ -201,7 +205,6 @@ struct verify_message_tree_extra {
int verify_message_tree(const int32_t &offset, const uint32_t UU(idx), struct verify_message_tree_extra *const e) __attribute__((nonnull(3)));
int verify_message_tree(const int32_t &offset, const uint32_t UU(idx), struct verify_message_tree_extra *const e)
{
- int verbose = e->verbose;
BLOCKNUM blocknum = e->blocknum;
int keep_going_on_failure = e->keep_going_on_failure;
int result = 0;
@@ -236,7 +239,6 @@ int error_on_iter(const int32_t &UU(offset), const uint32_t UU(idx), void *UU(e)
int verify_marked_messages(const int32_t &offset, const uint32_t UU(idx), struct verify_message_tree_extra *const e) __attribute__((nonnull(3)));
int verify_marked_messages(const int32_t &offset, const uint32_t UU(idx), struct verify_message_tree_extra *const e)
{
- int verbose = e->verbose;
BLOCKNUM blocknum = e->blocknum;
int keep_going_on_failure = e->keep_going_on_failure;
int result = 0;
@@ -462,16 +464,16 @@ toku_verify_ftnode_internal(FT_HANDLE ft_handle,
DBT kdbt = get_ith_key_dbt(bn, j);
if (curr_less_pivot) {
int compare = compare_pairs(ft_handle, curr_less_pivot, &kdbt);
- VERIFY_ASSERTION(compare < 0, j, "The leafentry is >= the lower-bound pivot");
+ VERIFY_ASSERTION_BASEMENT(compare < 0, i, j, "The leafentry is >= the lower-bound pivot");
}
if (curr_geq_pivot) {
int compare = compare_pairs(ft_handle, curr_geq_pivot, &kdbt);
- VERIFY_ASSERTION(compare >= 0, j, "The leafentry is < the upper-bound pivot");
+ VERIFY_ASSERTION_BASEMENT(compare >= 0, i, j, "The leafentry is < the upper-bound pivot");
}
if (0 < j) {
DBT prev_key_dbt = get_ith_key_dbt(bn, j-1);
int compare = compare_pairs(ft_handle, &prev_key_dbt, &kdbt);
- VERIFY_ASSERTION(compare < 0, j, "Adjacent leafentries are out of order");
+ VERIFY_ASSERTION_BASEMENT(compare < 0, i, j, "Adjacent leafentries are out of order");
}
}
}
diff --git a/storage/tokudb/ft-index/ft/logger/recover.cc b/storage/tokudb/ft-index/ft/logger/recover.cc
index cae7397651d..680485201da 100644
--- a/storage/tokudb/ft-index/ft/logger/recover.cc
+++ b/storage/tokudb/ft-index/ft/logger/recover.cc
@@ -111,7 +111,8 @@ int tokuft_recovery_trace = 0; // turn on recovery tracing, d
#endif
// time in seconds between recovery progress reports
-#define TOKUDB_RECOVERY_PROGRESS_TIME 15
+#define TOKUFT_RECOVERY_PROGRESS_TIME 15
+time_t tokuft_recovery_progress_time = TOKUFT_RECOVERY_PROGRESS_TIME;
enum ss {
BACKWARD_NEWER_CHECKPOINT_END = 1,
@@ -325,14 +326,12 @@ static int recover_env_init (RECOVER_ENV renv,
}
static void recover_env_cleanup (RECOVER_ENV renv) {
- int r;
-
invariant_zero(renv->fmap.filenums->size());
file_map_destroy(&renv->fmap);
if (renv->destroy_logger_at_end) {
toku_logger_close_rollback(renv->logger);
- r = toku_logger_close(&renv->logger);
+ int r = toku_logger_close(&renv->logger);
assert(r == 0);
} else {
toku_logger_write_log_files(renv->logger, true);
@@ -749,6 +748,36 @@ static int toku_recover_backward_xbegin (struct logtype_xbegin *UU(l), RECOVER_E
return 0;
}
+struct toku_txn_progress_extra {
+ time_t tlast;
+ LSN lsn;
+ const char *type;
+ TXNID_PAIR xid;
+ uint64_t last_total;
+};
+
+static void toku_recover_txn_progress(TOKU_TXN_PROGRESS txn_progress, void *extra) {
+ toku_txn_progress_extra *txn_progress_extra = static_cast<toku_txn_progress_extra *>(extra);
+ if (txn_progress_extra->last_total == 0)
+ txn_progress_extra->last_total = txn_progress->entries_total;
+ else
+ assert(txn_progress_extra->last_total == txn_progress->entries_total);
+ time_t tnow = time(NULL);
+ if (tnow - txn_progress_extra->tlast >= tokuft_recovery_progress_time) {
+ txn_progress_extra->tlast = tnow;
+ fprintf(stderr, "%.24s TokuFT ", ctime(&tnow));
+ if (txn_progress_extra->lsn.lsn != 0)
+ fprintf(stderr, "lsn %" PRIu64 " ", txn_progress_extra->lsn.lsn);
+ fprintf(stderr, "%s xid %" PRIu64 ":%" PRIu64 " ",
+ txn_progress_extra->type, txn_progress_extra->xid.parent_id64, txn_progress_extra->xid.child_id64);
+ fprintf(stderr, "%" PRIu64 "/%" PRIu64 " ",
+ txn_progress->entries_processed, txn_progress->entries_total);
+ if (txn_progress->entries_total > 0)
+ fprintf(stderr, "%.0f%% ", ((double) txn_progress->entries_processed / (double) txn_progress->entries_total) * 100.0);
+ fprintf(stderr, "\n");
+ }
+}
+
static int toku_recover_xcommit (struct logtype_xcommit *l, RECOVER_ENV renv) {
// find the transaction by transaction id
TOKUTXN txn = NULL;
@@ -756,8 +785,8 @@ static int toku_recover_xcommit (struct logtype_xcommit *l, RECOVER_ENV renv) {
assert(txn!=NULL);
// commit the transaction
- int r = toku_txn_commit_with_lsn(txn, true, l->lsn,
- NULL, NULL);
+ toku_txn_progress_extra extra = { time(NULL), l->lsn, "commit", l->xid };
+ int r = toku_txn_commit_with_lsn(txn, true, l->lsn, toku_recover_txn_progress, &extra);
assert(r == 0);
// close the transaction
@@ -799,7 +828,8 @@ static int toku_recover_xabort (struct logtype_xabort *l, RECOVER_ENV renv) {
assert(txn!=NULL);
// abort the transaction
- r = toku_txn_abort_with_lsn(txn, l->lsn, NULL, NULL);
+ toku_txn_progress_extra extra = { time(NULL), l->lsn, "abort", l->xid };
+ r = toku_txn_abort_with_lsn(txn, l->lsn, toku_recover_txn_progress, &extra);
assert(r == 0);
// close the transaction
@@ -1301,7 +1331,6 @@ static int is_txn_unprepared(TOKUTXN txn, void* extra) {
return 0;
}
-
static int find_an_unprepared_txn (RECOVER_ENV renv, TOKUTXN *txnp) {
TOKUTXN txn = nullptr;
int r = toku_txn_manager_iter_over_live_root_txns(
@@ -1326,6 +1355,7 @@ static int call_prepare_txn_callback_iter(TOKUTXN txn, void* extra) {
}
static void recover_abort_live_txn(TOKUTXN txn) {
+ fprintf(stderr, "%s %" PRIu64 "\n", __FUNCTION__, txn->txnid.parent_id64);
// recursively abort all children first
if (txn->child != NULL) {
recover_abort_live_txn(txn->child);
@@ -1333,7 +1363,8 @@ static void recover_abort_live_txn(TOKUTXN txn) {
// sanity check that the recursive call successfully NULLs out txn->child
invariant(txn->child == NULL);
// abort the transaction
- int r = toku_txn_abort_txn(txn, NULL, NULL);
+ toku_txn_progress_extra extra = { time(NULL), ZERO_LSN, "abort live", txn->txnid };
+ int r = toku_txn_abort_txn(txn, toku_recover_txn_progress, &extra);
assert(r == 0);
// close the transaction
@@ -1451,9 +1482,10 @@ static int do_recovery(RECOVER_ENV renv, const char *env_dir, const char *log_di
// trace progress
if ((i % 1000) == 0) {
tnow = time(NULL);
- if (tnow - tlast >= TOKUDB_RECOVERY_PROGRESS_TIME) {
+ if (tnow - tlast >= tokuft_recovery_progress_time) {
thislsn = toku_log_entry_get_lsn(le);
- fprintf(stderr, "%.24s TokuFT recovery scanning backward from %" PRIu64 " at %" PRIu64 " (%s)\n", ctime(&tnow), lastlsn.lsn, thislsn.lsn, recover_state(renv));
+ fprintf(stderr, "%.24s TokuFT recovery scanning backward from %" PRIu64 " at %" PRIu64 " (%s)\n",
+ ctime(&tnow), lastlsn.lsn, thislsn.lsn, recover_state(renv));
tlast = tnow;
}
}
@@ -1482,16 +1514,18 @@ static int do_recovery(RECOVER_ENV renv, const char *env_dir, const char *log_di
assert(le);
thislsn = toku_log_entry_get_lsn(le);
tnow = time(NULL);
- fprintf(stderr, "%.24s TokuFT recovery starts scanning forward to %" PRIu64 " from %" PRIu64 " left %" PRIu64 " (%s)\n", ctime(&tnow), lastlsn.lsn, thislsn.lsn, lastlsn.lsn - thislsn.lsn, recover_state(renv));
+ fprintf(stderr, "%.24s TokuFT recovery starts scanning forward to %" PRIu64 " from %" PRIu64 " left %" PRIu64 " (%s)\n",
+ ctime(&tnow), lastlsn.lsn, thislsn.lsn, lastlsn.lsn - thislsn.lsn, recover_state(renv));
for (unsigned i=0; 1; i++) {
// trace progress
if ((i % 1000) == 0) {
tnow = time(NULL);
- if (tnow - tlast >= TOKUDB_RECOVERY_PROGRESS_TIME) {
+ if (tnow - tlast >= tokuft_recovery_progress_time) {
thislsn = toku_log_entry_get_lsn(le);
- fprintf(stderr, "%.24s TokuFT recovery scanning forward to %" PRIu64 " at %" PRIu64 " left %" PRIu64 " (%s)\n", ctime(&tnow), lastlsn.lsn, thislsn.lsn, lastlsn.lsn - thislsn.lsn, recover_state(renv));
+ fprintf(stderr, "%.24s TokuFT recovery scanning forward to %" PRIu64 " at %" PRIu64 " left %" PRIu64 " (%s)\n",
+ ctime(&tnow), lastlsn.lsn, thislsn.lsn, lastlsn.lsn - thislsn.lsn, recover_state(renv));
tlast = tnow;
}
}
diff --git a/storage/tokudb/ft-index/ft/txn/txn.cc b/storage/tokudb/ft-index/ft/txn/txn.cc
index 18d5a6b67dd..922c955a6b5 100644
--- a/storage/tokudb/ft-index/ft/txn/txn.cc
+++ b/storage/tokudb/ft-index/ft/txn/txn.cc
@@ -344,6 +344,7 @@ static txn_child_manager tcm;
.state = TOKUTXN_LIVE,
.num_pin = 0,
.client_id = 0,
+ .start_time = time(NULL),
};
TOKUTXN result = NULL;
@@ -787,6 +788,10 @@ void toku_txn_set_client_id(TOKUTXN txn, uint64_t client_id) {
txn->client_id = client_id;
}
+time_t toku_txn_get_start_time(struct tokutxn *txn) {
+ return txn->start_time;
+}
+
int toku_txn_reads_txnid(TXNID txnid, TOKUTXN txn) {
int r = 0;
TXNID oldest_live_in_snapshot = toku_get_oldest_in_live_root_txn_list(txn);
diff --git a/storage/tokudb/ft-index/ft/txn/txn.h b/storage/tokudb/ft-index/ft/txn/txn.h
index 6381b5a7779..4f2778bf858 100644
--- a/storage/tokudb/ft-index/ft/txn/txn.h
+++ b/storage/tokudb/ft-index/ft/txn/txn.h
@@ -253,6 +253,7 @@ struct tokutxn {
uint32_t num_pin; // number of threads (all hot indexes) that want this
// txn to not transition to commit or abort
uint64_t client_id;
+ time_t start_time;
};
typedef struct tokutxn *TOKUTXN;
@@ -368,6 +369,8 @@ bool toku_txn_has_spilled_rollback(struct tokutxn *txn);
uint64_t toku_txn_get_client_id(struct tokutxn *txn);
void toku_txn_set_client_id(struct tokutxn *txn, uint64_t client_id);
+time_t toku_txn_get_start_time(struct tokutxn *txn);
+
//
// This function is used by the leafentry iterators.
// returns TOKUDB_ACCEPT if live transaction context is allowed to read a value
diff --git a/storage/tokudb/ft-index/src/tests/test_iterate_live_transactions.cc b/storage/tokudb/ft-index/src/tests/test_iterate_live_transactions.cc
index dd00ddeeb9a..c104c5c8541 100644
--- a/storage/tokudb/ft-index/src/tests/test_iterate_live_transactions.cc
+++ b/storage/tokudb/ft-index/src/tests/test_iterate_live_transactions.cc
@@ -104,9 +104,11 @@ struct iterate_extra {
bool visited_txn[3];
};
-static int iterate_callback(uint64_t txnid, uint64_t client_id,
+static int iterate_callback(DB_TXN *txn,
iterate_row_locks_callback iterate_locks,
void *locks_extra, void *extra) {
+ uint64_t txnid = txn->id64(txn);
+ uint64_t client_id = txn->get_client_id(txn);
iterate_extra *info = reinterpret_cast<iterate_extra *>(extra);
DB *db;
DBT left_key, right_key;
diff --git a/storage/tokudb/ft-index/src/tests/test_stress0.cc b/storage/tokudb/ft-index/src/tests/test_stress0.cc
index 5dbca08db48..26192d851aa 100644
--- a/storage/tokudb/ft-index/src/tests/test_stress0.cc
+++ b/storage/tokudb/ft-index/src/tests/test_stress0.cc
@@ -140,9 +140,11 @@ static int UU() iterate_pending_lock_requests_op(DB_TXN *UU(txn), ARG arg, void
return r;
}
-static int iterate_txns(uint64_t txnid, uint64_t client_id,
+static int iterate_txns(DB_TXN *txn,
iterate_row_locks_callback iterate_locks,
void *locks_extra, void *extra) {
+ uint64_t txnid = txn->id64(txn);
+ uint64_t client_id = txn->get_client_id(txn);
invariant_null(extra);
invariant(txnid > 0);
invariant(client_id == 0);
diff --git a/storage/tokudb/ft-index/src/ydb.cc b/storage/tokudb/ft-index/src/ydb.cc
index 85445a67eef..ab15a44489e 100644
--- a/storage/tokudb/ft-index/src/ydb.cc
+++ b/storage/tokudb/ft-index/src/ydb.cc
@@ -2492,24 +2492,21 @@ struct iter_txns_callback_extra {
};
static int iter_txns_callback(TOKUTXN txn, void *extra) {
+ int r = 0;
iter_txns_callback_extra *info =
reinterpret_cast<iter_txns_callback_extra *>(extra);
-
DB_TXN *dbtxn = toku_txn_get_container_db_txn(txn);
invariant_notnull(dbtxn);
+ if (db_txn_struct_i(dbtxn)->tokutxn == txn) { // make sure that the dbtxn is fully initialized
+ toku_mutex_lock(&db_txn_struct_i(dbtxn)->txn_mutex);
+ toku_pthread_rwlock_rdlock(&info->env->i->open_dbs_rwlock);
- toku_mutex_lock(&db_txn_struct_i(dbtxn)->txn_mutex);
- toku_pthread_rwlock_rdlock(&info->env->i->open_dbs_rwlock);
-
- iter_txn_row_locks_callback_extra e(info->env, &db_txn_struct_i(dbtxn)->lt_map);
- const int r = info->callback(toku_txn_get_txnid(txn).parent_id64,
- toku_txn_get_client_id(txn),
- iter_txn_row_locks_callback,
- &e,
- info->extra);
+ iter_txn_row_locks_callback_extra e(info->env, &db_txn_struct_i(dbtxn)->lt_map);
+ r = info->callback(dbtxn, iter_txn_row_locks_callback, &e, info->extra);
- toku_pthread_rwlock_rdunlock(&info->env->i->open_dbs_rwlock);
- toku_mutex_unlock(&db_txn_struct_i(dbtxn)->txn_mutex);
+ toku_pthread_rwlock_rdunlock(&info->env->i->open_dbs_rwlock);
+ toku_mutex_unlock(&db_txn_struct_i(dbtxn)->txn_mutex);
+ }
return r;
}
diff --git a/storage/tokudb/ft-index/src/ydb_txn.cc b/storage/tokudb/ft-index/src/ydb_txn.cc
index 82903849535..885c6b713b2 100644
--- a/storage/tokudb/ft-index/src/ydb_txn.cc
+++ b/storage/tokudb/ft-index/src/ydb_txn.cc
@@ -433,6 +433,11 @@ static DB_TXN *toku_txn_get_child(DB_TXN *txn) {
return db_txn_struct_i(txn)->child;
}
+static uint64_t toku_txn_get_start_time(DB_TXN *txn) {
+ TOKUTXN ttxn = db_txn_struct_i(txn)->tokutxn;
+ return toku_txn_get_start_time(ttxn);
+}
+
static inline void txn_func_init(DB_TXN *txn) {
#define STXN(name) txn->name = locked_txn_ ## name
STXN(abort);
@@ -451,6 +456,7 @@ static inline void txn_func_init(DB_TXN *txn) {
txn->id64 = toku_txn_id64;
txn->is_prepared = toku_txn_is_prepared;
txn->get_child = toku_txn_get_child;
+ txn->get_start_time = toku_txn_get_start_time;
}
//
diff --git a/storage/tokudb/ft-index/tools/CMakeLists.txt b/storage/tokudb/ft-index/tools/CMakeLists.txt
index 71c44df9acd..f745517d84e 100644
--- a/storage/tokudb/ft-index/tools/CMakeLists.txt
+++ b/storage/tokudb/ft-index/tools/CMakeLists.txt
@@ -1,6 +1,6 @@
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE DONT_DEPRECATE_ERRNO)
-set(tools tokudb_dump tokuftdump tdb_logprint tdb-recover ftverify ba_replay)
+set(tools tokudb_dump tokuftdump tokuft_logprint tdb-recover ftverify ba_replay)
foreach(tool ${tools})
add_executable(${tool} ${tool}.cc)
add_dependencies(${tool} install_tdb_h)
@@ -12,9 +12,6 @@ endforeach(tool)
# link in math.h library just for this tool.
target_link_libraries(ftverify m)
-install(
- TARGETS tokuftdump
- DESTINATION ${INSTALL_BINDIR}
- COMPONENT Server
- )
+install(TARGETS tokuftdump DESTINATION ${INSTALL_BINDIR} COMPONENT Server)
+install(TARGETS tokuft_logprint DESTINATION ${INSTALL_BINDIR} COMPONENT Server)
diff --git a/storage/tokudb/ft-index/tools/tdb_logprint.cc b/storage/tokudb/ft-index/tools/tokuft_logprint.cc
index 15a28632cfb..1dd7581b9f5 100644
--- a/storage/tokudb/ft-index/tools/tdb_logprint.cc
+++ b/storage/tokudb/ft-index/tools/tokuft_logprint.cc
@@ -91,8 +91,6 @@ PATENT RIGHTS GRANT:
/* Dump the log from stdin to stdout. */
-#include <config.h>
-
#include "ft/log_header.h"
#include "ft/logger/logger.h"
diff --git a/storage/tokudb/ft-index/tools/tokuftdump.cc b/storage/tokudb/ft-index/tools/tokuftdump.cc
index d680a3dd0d0..14c3c31a061 100644
--- a/storage/tokudb/ft-index/tools/tokuftdump.cc
+++ b/storage/tokudb/ft-index/tools/tokuftdump.cc
@@ -250,6 +250,8 @@ static int64_t getRootNode(FT ft) {
}
static int print_le(const void* key, const uint32_t keylen, const LEAFENTRY &le, const uint32_t idx UU(), void *const ai UU()) {
+ unsigned int *le_index = (unsigned int *) ai;
+ printf("%u: ", *le_index); *le_index += 1;
print_klpair(stdout, key, keylen, le);
printf("\n");
return 0;
@@ -539,7 +541,8 @@ ok:
printf(" n_bytes_in_buffer= %" PRIu64 "", BLB_DATA(n, i)->get_disk_size());
printf(" items_in_buffer=%u\n", BLB_DATA(n, i)->num_klpairs());
if (do_dump_data) {
- BLB_DATA(n, i)->iterate<void, print_le>(NULL);
+ unsigned int le_index = 0;
+ BLB_DATA(n, i)->iterate<void, print_le>(&le_index);
}
}
}
@@ -938,6 +941,7 @@ static void run_iteractive_loop(int fd, FT ft, CACHEFILE cf) {
} else if (strcmp(fields[0], "header") == 0) {
toku_ft_free(ft);
open_header(fd, &ft, cf);
+ dump_header(ft);
} else if (strcmp(fields[0], "rn") == 0||strcmp(fields[0], "rootNode")==0||strcmp(fields[0], "rootnode") == 0) {
printf("Root node :%d\n",root);
} else if (strcmp(fields[0], "block") == 0 && nfields == 2) {
diff --git a/storage/tokudb/ft-index/util/scoped_malloc.cc b/storage/tokudb/ft-index/util/scoped_malloc.cc
index 551bd944beb..15d4fb3e52e 100644
--- a/storage/tokudb/ft-index/util/scoped_malloc.cc
+++ b/storage/tokudb/ft-index/util/scoped_malloc.cc
@@ -145,6 +145,9 @@ namespace toku {
}
void destroy() {
+#if TOKU_SCOPED_MALLOC_DEBUG
+ printf("%s %p %p\n", __FUNCTION__, this, m_stack);
+#endif
if (m_stack != NULL) {
toku_free(m_stack);
m_stack = NULL;
@@ -167,13 +170,17 @@ namespace toku {
static void destroy_and_deregister(void *key) {
invariant_notnull(key);
tl_stack *st = reinterpret_cast<tl_stack *>(key);
- st->destroy();
+ size_t n = 0;
toku_mutex_lock(&global_stack_set_mutex);
- invariant_notnull(global_stack_set);
- size_t n = global_stack_set->erase(st);
- invariant(n == 1);
+ if (global_stack_set) {
+ n = global_stack_set->erase(st);
+ }
toku_mutex_unlock(&global_stack_set_mutex);
+
+ if (n == 1) {
+ st->destroy(); // destroy the stack if this function erased it from the set. otherwise, somebody else destroyed it.
+ }
}
// Allocate 'size' bytes and return a pointer to the first byte
@@ -244,6 +251,11 @@ void toku_scoped_malloc_init(void) {
}
void toku_scoped_malloc_destroy(void) {
+ toku_scoped_malloc_destroy_key();
+ toku_scoped_malloc_destroy_set();
+}
+
+void toku_scoped_malloc_destroy_set(void) {
toku_mutex_lock(&toku::global_stack_set_mutex);
invariant_notnull(toku::global_stack_set);
// Destroy any tl_stacks that were registered as thread locals but did not
@@ -254,10 +266,11 @@ void toku_scoped_malloc_destroy(void) {
(*i)->destroy();
}
delete toku::global_stack_set;
+ toku::global_stack_set = nullptr;
toku_mutex_unlock(&toku::global_stack_set_mutex);
+}
- // We're deregistering the destructor key here. When this thread exits,
- // the tl_stack destructor won't get called, so we need to do that first.
+void toku_scoped_malloc_destroy_key(void) {
int r = pthread_key_delete(toku::tl_stack_destroy_pthread_key);
invariant_zero(r);
}
diff --git a/storage/tokudb/ft-index/util/scoped_malloc.h b/storage/tokudb/ft-index/util/scoped_malloc.h
index dbd919d155e..0233b0f1aa5 100644
--- a/storage/tokudb/ft-index/util/scoped_malloc.h
+++ b/storage/tokudb/ft-index/util/scoped_malloc.h
@@ -151,3 +151,7 @@ void toku_scoped_malloc_init(void);
void toku_scoped_malloc_destroy(void);
+void toku_scoped_malloc_destroy_set(void);
+
+void toku_scoped_malloc_destroy_key(void);
+
diff --git a/storage/tokudb/ft-index/util/tests/sm-basic.cc b/storage/tokudb/ft-index/util/tests/sm-basic.cc
new file mode 100644
index 00000000000..5df64294721
--- /dev/null
+++ b/storage/tokudb/ft-index/util/tests/sm-basic.cc
@@ -0,0 +1,127 @@
+/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
+#ident "$Id$"
+/*
+COPYING CONDITIONS NOTICE:
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License as
+ published by the Free Software Foundation, and provided that the
+ following conditions are met:
+
+ * Redistributions of source code must retain this COPYING
+ CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the
+ DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the
+ PATENT MARKING NOTICE (below), and the PATENT RIGHTS
+ GRANT (below).
+
+ * Redistributions in binary form must reproduce this COPYING
+ CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the
+ DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the
+ PATENT MARKING NOTICE (below), and the PATENT RIGHTS
+ GRANT (below) in the documentation and/or other materials
+ provided with the distribution.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+COPYRIGHT NOTICE:
+
+ TokuFT, Tokutek Fractal Tree Indexing Library.
+ Copyright (C) 2007-2013 Tokutek, Inc.
+
+DISCLAIMER:
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+UNIVERSITY PATENT NOTICE:
+
+ The technology is licensed by the Massachusetts Institute of
+ Technology, Rutgers State University of New Jersey, and the Research
+ Foundation of State University of New York at Stony Brook under
+ United States of America Serial No. 11/760379 and to the patents
+ and/or patent applications resulting from it.
+
+PATENT MARKING NOTICE:
+
+ This software is covered by US Patent No. 8,185,551.
+ This software is covered by US Patent No. 8,489,638.
+
+PATENT RIGHTS GRANT:
+
+ "THIS IMPLEMENTATION" means the copyrightable works distributed by
+ Tokutek as part of the Fractal Tree project.
+
+ "PATENT CLAIMS" means the claims of patents that are owned or
+ licensable by Tokutek, both currently or in the future; and that in
+ the absence of this license would be infringed by THIS
+ IMPLEMENTATION or by using or running THIS IMPLEMENTATION.
+
+ "PATENT CHALLENGE" shall mean a challenge to the validity,
+ patentability, enforceability and/or non-infringement of any of the
+ PATENT CLAIMS or otherwise opposing any of the PATENT CLAIMS.
+
+ Tokutek hereby grants to you, for the term and geographical scope of
+ the PATENT CLAIMS, a non-exclusive, no-charge, royalty-free,
+ irrevocable (except as stated in this section) patent license to
+ make, have made, use, offer to sell, sell, import, transfer, and
+ otherwise run, modify, and propagate the contents of THIS
+ IMPLEMENTATION, where such license applies only to the PATENT
+ CLAIMS. This grant does not include claims that would be infringed
+ only as a consequence of further modifications of THIS
+ IMPLEMENTATION. If you or your agent or licensee institute or order
+ or agree to the institution of patent litigation against any entity
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
+ THIS IMPLEMENTATION constitutes direct or contributory patent
+ infringement, or inducement of patent infringement, then any rights
+ granted to you under this License shall terminate as of the date
+ such litigation is filed. If you or your agent or exclusive
+ licensee institute or order or agree to the institution of a PATENT
+ CHALLENGE, then Tokutek may terminate any rights granted to you
+ under this License.
+*/
+
+// test that basic scoped malloc works with a thread
+
+#ident "Copyright (c) 2015 Tokutek Inc. All rights reserved."
+#include <toku_portability.h>
+#include <toku_assert.h>
+#include <toku_pthread.h>
+#include <util/scoped_malloc.h>
+
+static void sm_test(void) {
+ toku::scoped_malloc a(1);
+ {
+ toku::scoped_malloc b(2);
+ {
+ toku::scoped_malloc c(3);
+ }
+ }
+}
+
+static void *sm_test_f(void *arg) {
+ sm_test();
+ return arg;
+}
+
+int main(void) {
+ toku_scoped_malloc_init();
+
+ // run the test
+ toku_pthread_t tid;
+ int r;
+ r = toku_pthread_create(&tid, NULL, sm_test_f, NULL);
+ assert_zero(r);
+ void *ret;
+ r = toku_pthread_join(tid, &ret);
+ assert_zero(r);
+
+ toku_scoped_malloc_destroy();
+
+ return 0;
+}
diff --git a/storage/tokudb/ft-index/util/tests/sm-crash-double-free.cc b/storage/tokudb/ft-index/util/tests/sm-crash-double-free.cc
new file mode 100644
index 00000000000..653d4148fd0
--- /dev/null
+++ b/storage/tokudb/ft-index/util/tests/sm-crash-double-free.cc
@@ -0,0 +1,128 @@
+/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
+#ident "$Id$"
+/*
+COPYING CONDITIONS NOTICE:
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License as
+ published by the Free Software Foundation, and provided that the
+ following conditions are met:
+
+ * Redistributions of source code must retain this COPYING
+ CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the
+ DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the
+ PATENT MARKING NOTICE (below), and the PATENT RIGHTS
+ GRANT (below).
+
+ * Redistributions in binary form must reproduce this COPYING
+ CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the
+ DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the
+ PATENT MARKING NOTICE (below), and the PATENT RIGHTS
+ GRANT (below) in the documentation and/or other materials
+ provided with the distribution.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+COPYRIGHT NOTICE:
+
+ TokuFT, Tokutek Fractal Tree Indexing Library.
+ Copyright (C) 2007-2013 Tokutek, Inc.
+
+DISCLAIMER:
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+UNIVERSITY PATENT NOTICE:
+
+ The technology is licensed by the Massachusetts Institute of
+ Technology, Rutgers State University of New Jersey, and the Research
+ Foundation of State University of New York at Stony Brook under
+ United States of America Serial No. 11/760379 and to the patents
+ and/or patent applications resulting from it.
+
+PATENT MARKING NOTICE:
+
+ This software is covered by US Patent No. 8,185,551.
+ This software is covered by US Patent No. 8,489,638.
+
+PATENT RIGHTS GRANT:
+
+ "THIS IMPLEMENTATION" means the copyrightable works distributed by
+ Tokutek as part of the Fractal Tree project.
+
+ "PATENT CLAIMS" means the claims of patents that are owned or
+ licensable by Tokutek, both currently or in the future; and that in
+ the absence of this license would be infringed by THIS
+ IMPLEMENTATION or by using or running THIS IMPLEMENTATION.
+
+ "PATENT CHALLENGE" shall mean a challenge to the validity,
+ patentability, enforceability and/or non-infringement of any of the
+ PATENT CLAIMS or otherwise opposing any of the PATENT CLAIMS.
+
+ Tokutek hereby grants to you, for the term and geographical scope of
+ the PATENT CLAIMS, a non-exclusive, no-charge, royalty-free,
+ irrevocable (except as stated in this section) patent license to
+ make, have made, use, offer to sell, sell, import, transfer, and
+ otherwise run, modify, and propagate the contents of THIS
+ IMPLEMENTATION, where such license applies only to the PATENT
+ CLAIMS. This grant does not include claims that would be infringed
+ only as a consequence of further modifications of THIS
+ IMPLEMENTATION. If you or your agent or licensee institute or order
+ or agree to the institution of patent litigation against any entity
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
+ THIS IMPLEMENTATION constitutes direct or contributory patent
+ infringement, or inducement of patent infringement, then any rights
+ granted to you under this License shall terminate as of the date
+ such litigation is filed. If you or your agent or exclusive
+ licensee institute or order or agree to the institution of a PATENT
+ CHALLENGE, then Tokutek may terminate any rights granted to you
+ under this License.
+*/
+
+// force a race between the scoped malloc global destructor and a thread variable destructor
+
+#ident "Copyright (c) 2015 Tokutek Inc. All rights reserved."
+#define TOKU_SCOPED_MALLOC_DEBUG 1
+#include <toku_portability.h>
+#include <toku_assert.h>
+#include <toku_pthread.h>
+#include <toku_race_tools.h>
+#include <util/scoped_malloc.h>
+
+volatile int state = 0;
+
+static void sm_test(void) {
+ toku::scoped_malloc a(1);
+}
+
+static void *sm_test_f(void *arg) {
+ sm_test();
+ state = 1;
+ while (state != 2) sleep(1);
+ return arg;
+}
+
+int main(void) {
+ TOKU_VALGRIND_HG_DISABLE_CHECKING(&state, sizeof state);
+ state = 0;
+ toku_scoped_malloc_init();
+ toku_pthread_t tid;
+ int r;
+ r = toku_pthread_create(&tid, NULL, sm_test_f, NULL);
+ assert_zero(r);
+ void *ret;
+ while (state != 1) sleep(1);
+ toku_scoped_malloc_destroy_set();
+ state = 2;
+ r = toku_pthread_join(tid, &ret);
+ assert_zero(r);
+ toku_scoped_malloc_destroy_key();
+ return 0;
+}
diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc
index 2aa2dcbda93..97fadae8b8e 100644
--- a/storage/tokudb/ha_tokudb.cc
+++ b/storage/tokudb/ha_tokudb.cc
@@ -172,6 +172,7 @@ static inline uint32_t get_len_of_offsets(KEY_AND_COL_INFO* kc_info, TABLE_SHARE
}
+#ifdef NOT_USED
static int get_thread_query_string(my_thread_id id, String &qs) {
mysql_mutex_lock(&LOCK_thread_count);
I_List_iterator<THD> it(threads);
@@ -196,6 +197,7 @@ static int get_thread_query_string(my_thread_id id, String &qs) {
mysql_mutex_unlock(&LOCK_thread_count);
return 0;
}
+#endif
static int allocate_key_and_col_info ( TABLE_SHARE* table_share, KEY_AND_COL_INFO* kc_info) {
int error;
@@ -6203,6 +6205,12 @@ int ha_tokudb::external_lock(THD * thd, int lock_type) {
if (error) { goto cleanup; }
thd_set_ha_data(thd, tokudb_hton, trx);
}
+
+ if (tokudb_debug & TOKUDB_DEBUG_TXN) {
+ TOKUDB_HANDLER_TRACE("trx %p %p %p %p %u %u", trx->all, trx->stmt, trx->sp_level, trx->sub_sp_level,
+ trx->tokudb_lock_count, trx->create_lock_count);
+ }
+
if (trx->all == NULL) {
trx->sp_level = NULL;
}
@@ -6211,22 +6219,16 @@ int ha_tokudb::external_lock(THD * thd, int lock_type) {
if (lock_type == F_WRLCK) {
use_write_locks = true;
}
- if (!trx->tokudb_lock_count++) {
- if (trx->stmt) {
- if (tokudb_debug & TOKUDB_DEBUG_TXN) {
- TOKUDB_HANDLER_TRACE("stmt already set %p %p %p %p", trx->all, trx->stmt, trx->sp_level, trx->sub_sp_level);
- }
- } else {
- assert(trx->stmt == 0);
- transaction = NULL; // Safety
- error = create_txn(thd, trx);
- if (error) {
- trx->tokudb_lock_count--; // We didn't get the lock
- goto cleanup;
- }
+ if (!trx->stmt) {
+ transaction = NULL; // Safety
+ error = create_txn(thd, trx);
+ if (error) {
+ goto cleanup;
}
+ trx->create_lock_count = trx->tokudb_lock_count;
}
transaction = trx->sub_sp_level;
+ trx->tokudb_lock_count++;
}
else {
tokudb_pthread_mutex_lock(&share->mutex);
@@ -6241,21 +6243,24 @@ int ha_tokudb::external_lock(THD * thd, int lock_type) {
added_rows = 0;
deleted_rows = 0;
share->rows_from_locked_table = 0;
- if (trx->tokudb_lock_count > 0 && !--trx->tokudb_lock_count) {
- if (trx->stmt) {
- /*
- F_UNLCK is done without a transaction commit / rollback.
- This happens if the thread didn't update any rows
- We must in this case commit the work to keep the row locks
- */
- DBUG_PRINT("trans", ("commiting non-updating transaction"));
- reset_stmt_progress(&trx->stmt_progress);
- commit_txn(trx->stmt, 0);
- trx->stmt = NULL;
- trx->sub_sp_level = NULL;
+ if (trx->tokudb_lock_count > 0) {
+ if (--trx->tokudb_lock_count <= trx->create_lock_count) {
+ trx->create_lock_count = 0;
+ if (trx->stmt) {
+ /*
+ F_UNLCK is done without a transaction commit / rollback.
+ This happens if the thread didn't update any rows
+ We must in this case commit the work to keep the row locks
+ */
+ DBUG_PRINT("trans", ("commiting non-updating transaction"));
+ reset_stmt_progress(&trx->stmt_progress);
+ commit_txn(trx->stmt, 0);
+ trx->stmt = NULL;
+ trx->sub_sp_level = NULL;
+ }
}
+ transaction = NULL;
}
- transaction = NULL;
}
cleanup:
if (tokudb_debug & TOKUDB_DEBUG_LOCK)
@@ -6270,8 +6275,9 @@ cleanup:
*/
int ha_tokudb::start_stmt(THD * thd, thr_lock_type lock_type) {
TOKUDB_HANDLER_DBUG_ENTER("cmd %d lock %d %s", thd_sql_command(thd), lock_type, share->table_name);
- if (0)
+ if (tokudb_debug & TOKUDB_DEBUG_LOCK) {
TOKUDB_HANDLER_TRACE("q %s", thd->query());
+ }
int error = 0;
tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);
@@ -6281,6 +6287,11 @@ int ha_tokudb::start_stmt(THD * thd, thr_lock_type lock_type) {
thd_set_ha_data(thd, tokudb_hton, trx);
}
+ if (tokudb_debug & TOKUDB_DEBUG_TXN) {
+ TOKUDB_HANDLER_TRACE("trx %p %p %p %p %u %u", trx->all, trx->stmt, trx->sp_level, trx->sub_sp_level,
+ trx->tokudb_lock_count, trx->create_lock_count);
+ }
+
/*
note that trx->stmt may have been already initialized as start_stmt()
is called for *each table* not for each storage engine,
@@ -6291,9 +6302,7 @@ int ha_tokudb::start_stmt(THD * thd, thr_lock_type lock_type) {
if (error) {
goto cleanup;
}
- if (tokudb_debug & TOKUDB_DEBUG_TXN) {
- TOKUDB_HANDLER_TRACE("%p %p %p %p %u", trx->all, trx->stmt, trx->sp_level, trx->sub_sp_level, trx->tokudb_lock_count);
- }
+ trx->create_lock_count = trx->tokudb_lock_count;
}
else {
if (tokudb_debug & TOKUDB_DEBUG_TXN) {
diff --git a/storage/tokudb/ha_tokudb_admin.cc b/storage/tokudb/ha_tokudb_admin.cc
index b109cd1b976..42205c6d6be 100644
--- a/storage/tokudb/ha_tokudb_admin.cc
+++ b/storage/tokudb/ha_tokudb_admin.cc
@@ -121,9 +121,10 @@ static int analyze_progress(void *v_extra, uint64_t rows) {
progress_time = (float) (t_now - t_start) / (float) t_limit;
char *write_status_msg = extra->write_status_msg;
TABLE_SHARE *table_share = extra->table_share;
- sprintf(write_status_msg, "%s.%s.%s %u of %u %.lf%% rows %.lf%% time",
- table_share->db.str, table_share->table_name.str, extra->key_name,
- extra->key_i, table_share->keys, progress_rows * 100.0, progress_time * 100.0);
+ sprintf(write_status_msg, "%.*s.%.*s.%s %u of %u %.lf%% rows %.lf%% time",
+ (int) table_share->db.length, table_share->db.str,
+ (int) table_share->table_name.length, table_share->table_name.str,
+ extra->key_name, extra->key_i, table_share->keys, progress_rows * 100.0, progress_time * 100.0);
thd_proc_info(thd, write_status_msg);
return 0;
}
@@ -338,8 +339,10 @@ static int ha_tokudb_check_progress(void *extra, float progress) {
static void ha_tokudb_check_info(THD *thd, TABLE *table, const char *msg) {
if (thd->vio_ok()) {
- char tablename[256];
- snprintf(tablename, sizeof tablename, "%s.%s", table->s->db.str, table->s->table_name.str);
+ char tablename[table->s->db.length + 1 + table->s->table_name.length + 1];
+ snprintf(tablename, sizeof tablename, "%.*s.%.*s",
+ (int) table->s->db.length, table->s->db.str,
+ (int) table->s->table_name.length, table->s->table_name.str);
thd->protocol->prepare_for_resend();
thd->protocol->store(tablename, strlen(tablename), system_charset_info);
thd->protocol->store("check", 5, system_charset_info);
@@ -388,6 +391,11 @@ int ha_tokudb::check(THD *thd, HA_CHECK_OPT *check_opt) {
}
struct check_context check_context = { thd };
r = db->verify_with_progress(db, ha_tokudb_check_progress, &check_context, (tokudb_debug & TOKUDB_DEBUG_CHECK) != 0, keep_going);
+ if (r != 0) {
+ char msg[32 + strlen(kname)];
+ sprintf(msg, "Corrupt %s", kname);
+ ha_tokudb_check_info(thd, table, msg);
+ }
snprintf(write_status_msg, sizeof write_status_msg, "%s key=%s %u result=%d", share->table_name, kname, i, r);
thd_proc_info(thd, write_status_msg);
if (tokudb_debug & TOKUDB_DEBUG_CHECK) {
diff --git a/storage/tokudb/ha_tokudb_alter_56.cc b/storage/tokudb/ha_tokudb_alter_56.cc
index d574bae9a33..28c0b4419c0 100644
--- a/storage/tokudb/ha_tokudb_alter_56.cc
+++ b/storage/tokudb/ha_tokudb_alter_56.cc
@@ -784,13 +784,16 @@ bool ha_tokudb::commit_inplace_alter_table(TABLE *altered_table, Alter_inplace_i
assert(trx->tokudb_lock_count > 0);
// for partitioned tables, we use a single transaction to do all of the partition changes. the tokudb_lock_count
// is a reference count for each of the handlers to the same transaction. obviously, we want to only abort once.
- if (!--trx->tokudb_lock_count) {
- abort_txn(ctx->alter_txn);
- ctx->alter_txn = NULL;
- trx->stmt = NULL;
- trx->sub_sp_level = NULL;
+ if (trx->tokudb_lock_count > 0) {
+ if (--trx->tokudb_lock_count <= trx->create_lock_count) {
+ trx->create_lock_count = 0;
+ abort_txn(ctx->alter_txn);
+ ctx->alter_txn = NULL;
+ trx->stmt = NULL;
+ trx->sub_sp_level = NULL;
+ }
+ transaction = NULL;
}
- transaction = NULL;
if (ctx->add_index_changed) {
restore_add_index(table, ha_alter_info->index_add_count, ctx->incremented_num_DBs, ctx->modified_DBs);
diff --git a/storage/tokudb/hatoku_defines.h b/storage/tokudb/hatoku_defines.h
index 69dbd6b7e5c..f93e07548e6 100644
--- a/storage/tokudb/hatoku_defines.h
+++ b/storage/tokudb/hatoku_defines.h
@@ -356,6 +356,7 @@ typedef struct st_tokudb_trx_data {
DB_TXN *sp_level;
DB_TXN *sub_sp_level;
uint tokudb_lock_count;
+ uint create_lock_count;
tokudb_stmt_progress stmt_progress;
bool checkpoint_lock_taken;
LIST *handlers;
diff --git a/storage/tokudb/hatoku_hton.cc b/storage/tokudb/hatoku_hton.cc
index d282d68acc1..1572c3652e0 100644
--- a/storage/tokudb/hatoku_hton.cc
+++ b/storage/tokudb/hatoku_hton.cc
@@ -1714,6 +1714,8 @@ static int tokudb_fractal_tree_info(TABLE *table, THD *thd) {
error = tmp_cursor->c_get(tmp_cursor, &curr_key, &curr_val, DB_NEXT);
if (!error) {
error = tokudb_report_fractal_tree_info_for_db(&curr_key, &curr_val, table, thd);
+ if (error)
+ error = 0; // ignore read uncommitted errors
}
if (!error && thd_killed(thd))
error = ER_QUERY_INTERRUPTED;
@@ -1992,7 +1994,9 @@ struct tokudb_search_txn_extra {
uint64_t match_client_id;
};
-static int tokudb_search_txn_callback(uint64_t txn_id, uint64_t client_id, iterate_row_locks_callback iterate_locks, void *locks_extra, void *extra) {
+static int tokudb_search_txn_callback(DB_TXN *txn, iterate_row_locks_callback iterate_locks, void *locks_extra, void *extra) {
+ uint64_t txn_id = txn->id64(txn);
+ uint64_t client_id = txn->get_client_id(txn);
struct tokudb_search_txn_extra *e = reinterpret_cast<struct tokudb_search_txn_extra *>(extra);
if (e->match_txn_id == txn_id) {
e->match_found = true;
@@ -2124,6 +2128,7 @@ static struct st_mysql_information_schema tokudb_trx_information_schema = { MYSQ
static ST_FIELD_INFO tokudb_trx_field_info[] = {
{"trx_id", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
{"trx_mysql_thread_id", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
+ {"trx_time", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
{NULL, 0, MYSQL_TYPE_NULL, 0, 0, NULL, SKIP_OPEN_TABLE}
};
@@ -2132,12 +2137,17 @@ struct tokudb_trx_extra {
TABLE *table;
};
-static int tokudb_trx_callback(uint64_t txn_id, uint64_t client_id, iterate_row_locks_callback iterate_locks, void *locks_extra, void *extra) {
+static int tokudb_trx_callback(DB_TXN *txn, iterate_row_locks_callback iterate_locks, void *locks_extra, void *extra) {
+ uint64_t txn_id = txn->id64(txn);
+ uint64_t client_id = txn->get_client_id(txn);
+ uint64_t start_time = txn->get_start_time(txn);
struct tokudb_trx_extra *e = reinterpret_cast<struct tokudb_trx_extra *>(extra);
THD *thd = e->thd;
TABLE *table = e->table;
table->field[0]->store(txn_id, false);
table->field[1]->store(client_id, false);
+ uint64_t tnow = (uint64_t) time(NULL);
+ table->field[2]->store(tnow >= start_time ? tnow - start_time : 0, false);
int error = schema_table_store_record(thd, table);
if (!error && thd_killed(thd))
error = ER_QUERY_INTERRUPTED;
@@ -2285,7 +2295,9 @@ struct tokudb_locks_extra {
TABLE *table;
};
-static int tokudb_locks_callback(uint64_t txn_id, uint64_t client_id, iterate_row_locks_callback iterate_locks, void *locks_extra, void *extra) {
+static int tokudb_locks_callback(DB_TXN *txn, iterate_row_locks_callback iterate_locks, void *locks_extra, void *extra) {
+ uint64_t txn_id = txn->id64(txn);
+ uint64_t client_id = txn->get_client_id(txn);
struct tokudb_locks_extra *e = reinterpret_cast<struct tokudb_locks_extra *>(extra);
THD *thd = e->thd;
TABLE *table = e->table;
diff --git a/storage/tokudb/mysql-test/tokudb/r/cluster_create_table.result b/storage/tokudb/mysql-test/tokudb/r/cluster_create_table.result
index 914c3edc6ac..02a90c66398 100644
--- a/storage/tokudb/mysql-test/tokudb/r/cluster_create_table.result
+++ b/storage/tokudb/mysql-test/tokudb/r/cluster_create_table.result
@@ -5,7 +5,7 @@ create table t1(a int, b int, c int, d int, primary key(a), key(b) clustering=ye
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
`d` int(11) DEFAULT NULL,
@@ -16,7 +16,7 @@ create index foo on t1(c,d) clustering=yes;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
`d` int(11) DEFAULT NULL,
@@ -30,10 +30,10 @@ alter table t1 add key bar(d,c,b,a) clustering=yes;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL DEFAULT '0',
- `b` int(11) NOT NULL DEFAULT '0',
- `c` int(11) NOT NULL DEFAULT '0',
- `d` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
+ `b` int(11) NOT NULL,
+ `c` int(11) NOT NULL,
+ `d` int(11) NOT NULL,
PRIMARY KEY (`a`,`b`,`c`,`d`),
KEY `b` (`b`) `clustering`=yes,
KEY `foo` (`c`,`d`) `clustering`=yes,
diff --git a/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_released.result b/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_released.result
index 018900c7b98..190581eddae 100644
--- a/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_released.result
+++ b/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_released.result
@@ -2,7 +2,7 @@ set default_storage_engine='tokudb';
set tokudb_prelock_empty=false;
drop table if exists t;
create table t (id int primary key);
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
select * from information_schema.tokudb_locks;
locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name
@@ -19,7 +19,7 @@ TRX_ID MYSQL_ID ./test/t-main 0001000000 0001000000 test t main
select * from information_schema.tokudb_lock_waits;
requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time lock_waits_table_schema lock_waits_table_name lock_waits_table_dictionary_name
REQUEST_TRX_ID BLOCK_TRX_ID ./test/t-main 0001000000 0001000000 LOCK_WAITS_START_TIME test t main
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
TRX_ID MYSQL_ID
TRX_ID MYSQL_ID
@@ -31,7 +31,7 @@ select * from information_schema.tokudb_lock_waits;
requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time lock_waits_table_schema lock_waits_table_name lock_waits_table_dictionary_name
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
commit;
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
select * from information_schema.tokudb_locks;
locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name
@@ -48,7 +48,7 @@ TRX_ID MYSQL_ID ./test/t-main 0001000000 0001000000 test t main
select * from information_schema.tokudb_lock_waits;
requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time lock_waits_table_schema lock_waits_table_name lock_waits_table_dictionary_name
REQUEST_TRX_ID BLOCK_TRX_ID ./test/t-main 0001000000 0001000000 LOCK_WAITS_START_TIME test t main
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
TRX_ID MYSQL_ID
TRX_ID MYSQL_ID
@@ -59,7 +59,7 @@ TRX_ID MYSQL_ID ./test/t-main 0001000000 0001000000 test t main
select * from information_schema.tokudb_lock_waits;
requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time lock_waits_table_schema lock_waits_table_name lock_waits_table_dictionary_name
commit;
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
select * from information_schema.tokudb_locks;
locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name
diff --git a/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_timeout.result b/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_timeout.result
index b9fca50b507..13cdad7a438 100644
--- a/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_timeout.result
+++ b/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_timeout.result
@@ -2,7 +2,7 @@ set default_storage_engine='tokudb';
set tokudb_prelock_empty=false;
drop table if exists t;
create table t (id int primary key);
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
select * from information_schema.tokudb_locks;
locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name
@@ -19,7 +19,7 @@ TRX_ID MYSQL_ID ./test/t-main 0001000000 0001000000 test t main
select * from information_schema.tokudb_lock_waits;
requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time lock_waits_table_schema lock_waits_table_name lock_waits_table_dictionary_name
REQUEST_TRX_ID BLOCK_TRX_ID ./test/t-main 0001000000 0001000000 LOCK_WAITS_START_TIME test t main
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
TRX_ID MYSQL_ID
TRX_ID MYSQL_ID
@@ -30,7 +30,7 @@ select * from information_schema.tokudb_lock_waits;
requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time lock_waits_table_schema lock_waits_table_name lock_waits_table_dictionary_name
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
commit;
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
select * from information_schema.tokudb_locks;
locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name
diff --git a/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_trx.result b/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_trx.result
index e4c1adcca19..63e4816e16e 100644
--- a/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_trx.result
+++ b/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_trx.result
@@ -1,23 +1,23 @@
set default_storage_engine='tokudb';
set tokudb_prelock_empty=false;
drop table if exists t;
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
set autocommit=0;
create table t (id int primary key);
insert into t values (1);
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
TXN_ID_DEFAULT CLIENT_ID_DEFAULT
commit;
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
set autocommit=0;
insert into t values (2);
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
TXN_ID_A CLIENT_ID_A
commit;
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
drop table t;
diff --git a/storage/tokudb/mysql-test/tokudb/r/mvcc-10.result b/storage/tokudb/mysql-test/tokudb/r/mvcc-10.result
index 319048cfd8b..6ebeb298d84 100644
--- a/storage/tokudb/mysql-test/tokudb/r/mvcc-10.result
+++ b/storage/tokudb/mysql-test/tokudb/r/mvcc-10.result
@@ -5,7 +5,7 @@ create table foo (a int, b varchar (100), primary key (a)) engine=TokuDB;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(100) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1
diff --git a/storage/tokudb/mysql-test/tokudb/r/mvcc-21.result b/storage/tokudb/mysql-test/tokudb/r/mvcc-21.result
index bee7c8b4549..ced1e5b045e 100644
--- a/storage/tokudb/mysql-test/tokudb/r/mvcc-21.result
+++ b/storage/tokudb/mysql-test/tokudb/r/mvcc-21.result
@@ -5,7 +5,7 @@ create table foo (a int, b varchar (100), primary key (a)) engine=TokuDB;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(100) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1
diff --git a/storage/tokudb/mysql-test/tokudb/r/mvcc-22.result b/storage/tokudb/mysql-test/tokudb/r/mvcc-22.result
index 5d986701785..412f5afb9e0 100644
--- a/storage/tokudb/mysql-test/tokudb/r/mvcc-22.result
+++ b/storage/tokudb/mysql-test/tokudb/r/mvcc-22.result
@@ -5,7 +5,7 @@ create table foo (a int, b varchar (100), primary key (a)) engine=TokuDB;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(100) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1
diff --git a/storage/tokudb/mysql-test/tokudb/r/mvcc-23.result b/storage/tokudb/mysql-test/tokudb/r/mvcc-23.result
index 9ea3c631d17..9af10709db6 100644
--- a/storage/tokudb/mysql-test/tokudb/r/mvcc-23.result
+++ b/storage/tokudb/mysql-test/tokudb/r/mvcc-23.result
@@ -5,7 +5,7 @@ create table foo (a int, b varchar (100), primary key (a)) engine=TokuDB;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(100) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1
diff --git a/storage/tokudb/mysql-test/tokudb/r/mvcc-25.result b/storage/tokudb/mysql-test/tokudb/r/mvcc-25.result
index 427d1ca5c3f..69183cf37d3 100644
--- a/storage/tokudb/mysql-test/tokudb/r/mvcc-25.result
+++ b/storage/tokudb/mysql-test/tokudb/r/mvcc-25.result
@@ -7,14 +7,14 @@ create table bar like foo;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(100) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1
show create table bar;
Table Create Table
bar CREATE TABLE `bar` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(100) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1
diff --git a/storage/tokudb/mysql-test/tokudb/r/mvcc-3.result b/storage/tokudb/mysql-test/tokudb/r/mvcc-3.result
index 684dd147b07..470771b968f 100644
--- a/storage/tokudb/mysql-test/tokudb/r/mvcc-3.result
+++ b/storage/tokudb/mysql-test/tokudb/r/mvcc-3.result
@@ -7,7 +7,7 @@ create table foo (a int, b int, primary key (a))engine=TokuDB;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1
diff --git a/storage/tokudb/mysql-test/tokudb/r/mvcc-33.result b/storage/tokudb/mysql-test/tokudb/r/mvcc-33.result
index 38acca99831..989cfeb43a1 100644
--- a/storage/tokudb/mysql-test/tokudb/r/mvcc-33.result
+++ b/storage/tokudb/mysql-test/tokudb/r/mvcc-33.result
@@ -6,7 +6,7 @@ create table foo (a int, b int, c int, primary key (a), key (b))engine=TokuDB;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
diff --git a/storage/tokudb/mysql-test/tokudb/r/mvcc-34.result b/storage/tokudb/mysql-test/tokudb/r/mvcc-34.result
index e1795bbc832..bf1d47f8eae 100644
--- a/storage/tokudb/mysql-test/tokudb/r/mvcc-34.result
+++ b/storage/tokudb/mysql-test/tokudb/r/mvcc-34.result
@@ -6,7 +6,7 @@ create table foo (a int, b int, c int, primary key (a), key (b))engine=TokuDB;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
diff --git a/storage/tokudb/mysql-test/tokudb/r/mvcc-35.result b/storage/tokudb/mysql-test/tokudb/r/mvcc-35.result
index 86fb9670fce..557609e0345 100644
--- a/storage/tokudb/mysql-test/tokudb/r/mvcc-35.result
+++ b/storage/tokudb/mysql-test/tokudb/r/mvcc-35.result
@@ -6,7 +6,7 @@ create table foo (a int, b int, c int, primary key (a), key (b))engine=TokuDB;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
diff --git a/storage/tokudb/mysql-test/tokudb/r/mvcc-36.result b/storage/tokudb/mysql-test/tokudb/r/mvcc-36.result
index d982ff3249d..b38f6d98f0e 100644
--- a/storage/tokudb/mysql-test/tokudb/r/mvcc-36.result
+++ b/storage/tokudb/mysql-test/tokudb/r/mvcc-36.result
@@ -6,7 +6,7 @@ create table foo (a int, b int, c int, primary key (a), key (b))engine=TokuDB;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
diff --git a/storage/tokudb/mysql-test/tokudb/r/mvcc-37.result b/storage/tokudb/mysql-test/tokudb/r/mvcc-37.result
index 3e1ad76dd3d..4319ef036fa 100644
--- a/storage/tokudb/mysql-test/tokudb/r/mvcc-37.result
+++ b/storage/tokudb/mysql-test/tokudb/r/mvcc-37.result
@@ -6,7 +6,7 @@ create table foo (a int, b int, c int, primary key (a), key (b))engine=TokuDB;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
diff --git a/storage/tokudb/mysql-test/tokudb/r/mvcc-38.result b/storage/tokudb/mysql-test/tokudb/r/mvcc-38.result
index 5ee3c72e91e..9e2996931c6 100644
--- a/storage/tokudb/mysql-test/tokudb/r/mvcc-38.result
+++ b/storage/tokudb/mysql-test/tokudb/r/mvcc-38.result
@@ -6,7 +6,7 @@ create table foo (a int, b int, c int, primary key (a), key (b))engine=TokUDB;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
diff --git a/storage/tokudb/mysql-test/tokudb/r/mvcc-4.result b/storage/tokudb/mysql-test/tokudb/r/mvcc-4.result
index ce8aa725f5b..5e13ce32a24 100644
--- a/storage/tokudb/mysql-test/tokudb/r/mvcc-4.result
+++ b/storage/tokudb/mysql-test/tokudb/r/mvcc-4.result
@@ -8,7 +8,7 @@ insert into foo values (1,1);
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1
diff --git a/storage/tokudb/mysql-test/tokudb/r/mvcc-5.result b/storage/tokudb/mysql-test/tokudb/r/mvcc-5.result
index 47204dcc7e1..3df8f211589 100644
--- a/storage/tokudb/mysql-test/tokudb/r/mvcc-5.result
+++ b/storage/tokudb/mysql-test/tokudb/r/mvcc-5.result
@@ -6,7 +6,7 @@ create table foo (a int, b int, primary key (a))engine=TokuDB;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1
diff --git a/storage/tokudb/mysql-test/tokudb/r/mvcc-6.result b/storage/tokudb/mysql-test/tokudb/r/mvcc-6.result
index a0c8185b1ab..b45faa49026 100644
--- a/storage/tokudb/mysql-test/tokudb/r/mvcc-6.result
+++ b/storage/tokudb/mysql-test/tokudb/r/mvcc-6.result
@@ -6,7 +6,7 @@ create table foo (a int, b int, primary key (a), key (b))engine=TokuDB;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `b` (`b`)
diff --git a/storage/tokudb/mysql-test/tokudb/r/mvcc-7.result b/storage/tokudb/mysql-test/tokudb/r/mvcc-7.result
index ba78f786c31..3baa212c490 100644
--- a/storage/tokudb/mysql-test/tokudb/r/mvcc-7.result
+++ b/storage/tokudb/mysql-test/tokudb/r/mvcc-7.result
@@ -6,7 +6,7 @@ create table foo (a int, b int, primary key (a))engine=TokuDB;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1
diff --git a/storage/tokudb/mysql-test/tokudb/r/mvcc-8.result b/storage/tokudb/mysql-test/tokudb/r/mvcc-8.result
index 4e310d2d001..450ad63fd42 100644
--- a/storage/tokudb/mysql-test/tokudb/r/mvcc-8.result
+++ b/storage/tokudb/mysql-test/tokudb/r/mvcc-8.result
@@ -6,7 +6,7 @@ create table foo ( a int, b int, c int, primary key (a), key (b))engine=TokuDB;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
diff --git a/storage/tokudb/mysql-test/tokudb/r/mvcc-9.result b/storage/tokudb/mysql-test/tokudb/r/mvcc-9.result
index b3b45d731f2..7dcae265518 100644
--- a/storage/tokudb/mysql-test/tokudb/r/mvcc-9.result
+++ b/storage/tokudb/mysql-test/tokudb/r/mvcc-9.result
@@ -5,7 +5,7 @@ create table foo (a int, b varchar (100), primary key (a)) engine=TokuDB;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(100) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1
diff --git a/storage/tokudb/mysql-test/tokudb/r/rows-32m-rand-insert.result b/storage/tokudb/mysql-test/tokudb/r/rows-32m-rand-insert.result
index 5c1c53946a4..b287c70469e 100644
--- a/storage/tokudb/mysql-test/tokudb/r/rows-32m-rand-insert.result
+++ b/storage/tokudb/mysql-test/tokudb/r/rows-32m-rand-insert.result
@@ -1009,6 +1009,7 @@ Table Op Msg_type Msg_text
test.t check status OK
optimize table t;
Table Op Msg_type Msg_text
+test.t optimize note Table does not support optimize, doing recreate + analyze instead
test.t optimize status OK
check table t;
Table Op Msg_type Msg_text
diff --git a/storage/tokudb/mysql-test/tokudb/r/rows-32m-seq-insert.result b/storage/tokudb/mysql-test/tokudb/r/rows-32m-seq-insert.result
index abbf5efdf07..a242cac98c2 100644
--- a/storage/tokudb/mysql-test/tokudb/r/rows-32m-seq-insert.result
+++ b/storage/tokudb/mysql-test/tokudb/r/rows-32m-seq-insert.result
@@ -1009,6 +1009,7 @@ Table Op Msg_type Msg_text
test.t check status OK
optimize table t;
Table Op Msg_type Msg_text
+test.t optimize note Table does not support optimize, doing recreate + analyze instead
test.t optimize status OK
check table t;
Table Op Msg_type Msg_text
diff --git a/storage/tokudb/mysql-test/tokudb/r/type_blob.result b/storage/tokudb/mysql-test/tokudb/r/type_blob.result
index 21d9f57770e..d6649a95419 100644
--- a/storage/tokudb/mysql-test/tokudb/r/type_blob.result
+++ b/storage/tokudb/mysql-test/tokudb/r/type_blob.result
@@ -665,10 +665,10 @@ alter table t1 add key (a,b,d,e);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL DEFAULT '0',
- `b` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
+ `b` int(11) NOT NULL,
`c` tinyblob NOT NULL,
- `d` int(11) NOT NULL DEFAULT '0',
+ `d` int(11) NOT NULL,
`e` int(11) DEFAULT NULL,
PRIMARY KEY (`a`,`b`,`c`(255),`d`),
KEY `a` (`a`,`b`,`d`,`e`)
diff --git a/storage/tokudb/mysql-test/tokudb/r/type_decimal.result b/storage/tokudb/mysql-test/tokudb/r/type_decimal.result
index 5d271bc73fa..faeba12736d 100644
--- a/storage/tokudb/mysql-test/tokudb/r/type_decimal.result
+++ b/storage/tokudb/mysql-test/tokudb/r/type_decimal.result
@@ -182,7 +182,7 @@ 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");
Warnings:
-Note 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 3
select * from t1;
a
@@ -247,7 +247,7 @@ 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");
Warnings:
-Note 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 3
select * from t1;
a
@@ -306,7 +306,7 @@ 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");
Warnings:
-Note 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 3
select * from t1;
a
@@ -359,6 +359,9 @@ insert into t1 values (123.4e0),(123.4e+2),(123.4e-2),(123e1),(123e+0);
Warnings:
Note 1265 Data truncated for column 'a' at row 3
insert into t1 values (MID("987",1,2)),("987 "),("987.6e+2 ");
+Warnings:
+Note 1265 Data truncated for column 'a' at row 2
+Note 1265 Data truncated for column 'a' at row 3
select * from t1;
a
0.00
diff --git a/storage/tokudb/mysql-test/tokudb/r/type_float.result b/storage/tokudb/mysql-test/tokudb/r/type_float.result
index e9abecc1dee..d87fd046fd8 100644
--- a/storage/tokudb/mysql-test/tokudb/r/type_float.result
+++ b/storage/tokudb/mysql-test/tokudb/r/type_float.result
@@ -246,22 +246,22 @@ show warnings;
Level Code Message
desc t1;
Field Type Null Key Default Extra
-x decimal(21,2) NO 0.00
+x decimal(21,2) NO NULL
drop table t1;
create table t1 select 0.0 x;
desc t1;
Field Type Null Key Default Extra
-x decimal(2,1) NO 0.0
+x decimal(2,1) NO NULL
create table t2 select 105213674794682365.00 y;
desc t2;
Field Type Null Key Default Extra
-y decimal(20,2) NO 0.00
+y decimal(20,2) NO NULL
create table t3 select x+y a from t1,t2;
show warnings;
Level Code Message
desc t3;
Field Type Null Key Default Extra
-a decimal(21,2) NO 0.00
+a decimal(21,2) NO NULL
drop table t1,t2,t3;
select 1e-308, 1.00000001e-300, 100000000e-300;
1e-308 1.00000001e-300 100000000e-300
diff --git a/storage/tokudb/mysql-test/tokudb/r/type_newdecimal.result b/storage/tokudb/mysql-test/tokudb/r/type_newdecimal.result
index 6ab94a1b10b..468c4ade35f 100644
--- a/storage/tokudb/mysql-test/tokudb/r/type_newdecimal.result
+++ b/storage/tokudb/mysql-test/tokudb/r/type_newdecimal.result
@@ -53,13 +53,13 @@ if(1, 1.1, 1.2) if(0, 1.1, 1.2) if(0.1, 1.1, 1.2) if(0, 1, 1.1) if(0, NULL, 1.2)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `if(1, 1.1, 1.2)` decimal(2,1) NOT NULL DEFAULT '0.0',
- `if(0, 1.1, 1.2)` decimal(2,1) NOT NULL DEFAULT '0.0',
- `if(0.1, 1.1, 1.2)` decimal(2,1) NOT NULL DEFAULT '0.0',
- `if(0, 1, 1.1)` decimal(2,1) NOT NULL DEFAULT '0.0',
+ `if(1, 1.1, 1.2)` decimal(2,1) NOT NULL,
+ `if(0, 1.1, 1.2)` decimal(2,1) NOT NULL,
+ `if(0.1, 1.1, 1.2)` decimal(2,1) NOT NULL,
+ `if(0, 1, 1.1)` decimal(2,1) NOT NULL,
`if(0, NULL, 1.2)` decimal(2,1) DEFAULT NULL,
- `if(1, 0.22e1, 1.1)` double NOT NULL DEFAULT '0',
- `if(1E0, 1.1, 1.2)` decimal(2,1) NOT NULL DEFAULT '0.0'
+ `if(1, 0.22e1, 1.1)` double NOT NULL,
+ `if(1E0, 1.1, 1.2)` decimal(2,1) NOT NULL
) ENGINE=TokuDB DEFAULT CHARSET=latin1
drop table t1;
create table t1 select nullif(1.1, 1.1), nullif(1.1, 1.2), nullif(1.1, 0.11e1), nullif(1.0, 1), nullif(1, 1.0), nullif(1, 1.1);
@@ -175,10 +175,10 @@ create table t1 select round(15.4,-1), truncate(-5678.123451,-3), abs(-1.1), -(-
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `round(15.4,-1)` decimal(3,0) NOT NULL DEFAULT '0',
- `truncate(-5678.123451,-3)` decimal(4,0) NOT NULL DEFAULT '0',
- `abs(-1.1)` decimal(3,1) NOT NULL DEFAULT '0.0',
- `-(-1.1)` decimal(2,1) NOT NULL DEFAULT '0.0'
+ `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,
+ `-(-1.1)` decimal(2,1) NOT NULL
) ENGINE=TokuDB DEFAULT CHARSET=latin1
drop table t1;
set session sql_mode='traditional';
@@ -772,7 +772,7 @@ create table t1 as select 0.5;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `0.5` decimal(2,1) NOT NULL DEFAULT '0.0'
+ `0.5` decimal(2,1) NOT NULL
) ENGINE=TokuDB DEFAULT CHARSET=latin1
drop table t1;
select round(1.5),round(2.5);
@@ -1510,7 +1510,7 @@ Warnings:
Note 1265 Data truncated for column 'f1' at row 1
DESC t1;
Field Type Null Key Default Extra
-f1 decimal(31,30) NO 0.000000000000000000000000000000
+f1 decimal(31,30) NO NULL
SELECT f1 FROM t1;
f1
0.123456789012345678901234567890
@@ -1520,7 +1520,7 @@ 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 0.000000000000000000000000000000
+f1 decimal(65,30) NO NULL
SELECT f1 FROM t1;
f1
99999999999999999999999999999999999.999999999999999999999999999999
@@ -1624,7 +1624,7 @@ 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 0.000000000000000000000000000000
+my_col decimal(30,30) NO NULL
SELECT my_col FROM t1;
my_col
0.123456789123456789123456789123
@@ -1634,7 +1634,7 @@ 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 0.000000000000000000000000000000
+my_col decimal(65,30) NO NULL
SELECT my_col FROM t1;
my_col
1.123456789123456789123456789123
@@ -1644,7 +1644,7 @@ 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 0.000000000000000000000000000000
+my_col decimal(65,30) NO NULL
SELECT my_col FROM t1;
my_col
0.123456789123456789123456789123
@@ -1680,7 +1680,7 @@ Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(65,0) NO 0
+c1 decimal(65,0) NO NULL
SELECT * FROM t1;
c1
99999999999999999999999999999999999999999999999999999999999999999
@@ -1692,7 +1692,7 @@ Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(65,0) NO 0
+c1 decimal(65,0) NO NULL
SELECT * FROM t1;
c1
99999999999999999999999999999999999999999999999999999999999999999
@@ -1704,7 +1704,7 @@ Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(65,0) NO 0
+c1 decimal(65,0) NO NULL
SELECT * FROM t1;
c1
99999999999999999999999999999999999999999999999999999999999999999
@@ -1716,7 +1716,7 @@ Warnings:
Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated.
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(65,0) NO 0
+c1 decimal(65,0) NO NULL
SELECT * FROM t1;
c1
99999999999999999999999999999999999999999999999999999999999999999
@@ -1728,7 +1728,7 @@ 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 0.000000000000000000000000000000
+c1 decimal(65,30) NO NULL
SELECT * FROM t1;
c1
99999999999999999999999999999999999.999999999999999999999999999999
@@ -1738,7 +1738,7 @@ CREATE TABLE t1 SELECT
AS c1;
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(31,30) NO 0.000000000000000000000000000000
+c1 decimal(31,30) NO NULL
SELECT * FROM t1;
c1
1.100000000000000000000000000000
@@ -1748,7 +1748,7 @@ CREATE TABLE t1 SELECT
AS c1;
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(31,30) NO 0.000000000000000000000000000000
+c1 decimal(31,30) NO NULL
SELECT * FROM t1;
c1
1.100000000000000000000000000000
@@ -1760,7 +1760,7 @@ Warnings:
Note 1265 Data truncated for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(30,30) NO 0.000000000000000000000000000000
+c1 decimal(30,30) NO NULL
SELECT * FROM t1;
c1
0.100000000000000000000000000000
@@ -1772,7 +1772,7 @@ 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 0.000000000000000000000000000000
+c1 decimal(65,30) NO NULL
SELECT * FROM t1;
c1
99999999999999999999999999999999999.999999999999999999999999999999
@@ -1784,7 +1784,7 @@ Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(65,1) NO 0.0
+c1 decimal(65,1) NO NULL
SELECT * FROM t1;
c1
9999999999999999999999999999999999999999999999999999999999999999.9
@@ -1796,7 +1796,7 @@ Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(65,1) NO 0.0
+c1 decimal(65,1) NO NULL
SELECT * FROM t1;
c1
9999999999999999999999999999999999999999999999999999999999999999.9
@@ -1808,7 +1808,7 @@ Warnings:
Note 1265 Data truncated for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(30,30) NO 0.000000000000000000000000000000
+c1 decimal(30,30) NO NULL
SELECT * FROM t1;
c1
0.123456789012345678901234567890
@@ -1818,7 +1818,7 @@ Warnings:
Note 1265 Data truncated for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(33,30) NO 0.000000000000000000000000000000
+c1 decimal(33,30) NO NULL
SELECT * FROM t1;
c1
123.123456789012345678901234567890
@@ -1826,7 +1826,7 @@ DROP TABLE t1;
CREATE TABLE t1 SELECT 1.1 + CAST(1 AS DECIMAL(65,30)) AS c1;
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(65,30) NO 0.000000000000000000000000000000
+c1 decimal(65,30) NO NULL
SELECT * FROM t1;
c1
2.100000000000000000000000000000
diff --git a/storage/tokudb/mysql-test/tokudb/r/type_varchar.result b/storage/tokudb/mysql-test/tokudb/r/type_varchar.result
index ad95b9a9908..4cd1b0abb87 100644
--- a/storage/tokudb/mysql-test/tokudb/r/type_varchar.result
+++ b/storage/tokudb/mysql-test/tokudb/r/type_varchar.result
@@ -469,6 +469,7 @@ SELECT 5 = a FROM t1;
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 's'
+Warning 1292 Truncated incorrect DOUBLE value: ''
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(16));
INSERT INTO t1 VALUES ('5'), ('s'), ('');
@@ -479,4 +480,5 @@ SELECT 5 = a FROM t1;
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 's '
+Warning 1292 Truncated incorrect DOUBLE value: ' '
DROP TABLE t1;
diff --git a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test
index c4f9ccefe5c..0f712000527 100644
--- a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test
+++ b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test
@@ -13,7 +13,7 @@ create table t (id int primary key);
# verify that txn_a insert (1) blocks txn_b insert (1) and txn_b gets a duplicate key error
# should be empty
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
select * from information_schema.tokudb_locks;
select * from information_schema.tokudb_lock_waits;
@@ -43,7 +43,7 @@ select * from information_schema.tokudb_lock_waits;
# should find the presence of two transactions
replace_column 1 TRX_ID 2 MYSQL_ID;
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
connection conn_a;
commit;
@@ -66,7 +66,7 @@ disconnect conn_b;
# verify that the lock on the 2nd transaction has been released
# should be be empty
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
select * from information_schema.tokudb_locks;
select * from information_schema.tokudb_lock_waits;
@@ -96,7 +96,7 @@ select * from information_schema.tokudb_lock_waits;
# should find the presence of two transactions
replace_column 1 TRX_ID 2 MYSQL_ID;
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
connection conn_a;
commit;
@@ -116,7 +116,7 @@ disconnect conn_b;
# verify that the lock on the 2nd transaction has been released
# should be be empty
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
select * from information_schema.tokudb_locks;
select * from information_schema.tokudb_lock_waits;
diff --git a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_timeout.test b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_timeout.test
index 75929fa3b3d..3011443fa04 100644
--- a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_timeout.test
+++ b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_timeout.test
@@ -10,7 +10,7 @@ enable_warnings;
create table t (id int primary key);
# should be empty
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
select * from information_schema.tokudb_locks;
select * from information_schema.tokudb_lock_waits;
@@ -40,7 +40,7 @@ select * from information_schema.tokudb_lock_waits;
# should find the presence of two transactions
replace_column 1 TRX_ID 2 MYSQL_ID;
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
connection conn_a;
sleep 5; # sleep longer than the lock timer to force a lock timeout on txn_b
@@ -61,7 +61,7 @@ disconnect conn_a;
disconnect conn_b;
# should be be empty
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
select * from information_schema.tokudb_locks;
select * from information_schema.tokudb_lock_waits;
diff --git a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_trx.test b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_trx.test
index b1d5c7e5009..d3c2636ba54 100644
--- a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_trx.test
+++ b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_trx.test
@@ -8,7 +8,7 @@ drop table if exists t;
enable_warnings;
# should be empty
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
# should have my txn
let $default_id=`select connection_id()`;
@@ -16,11 +16,11 @@ set autocommit=0;
create table t (id int primary key);
insert into t values (1);
replace_column 1 TXN_ID_DEFAULT 2 CLIENT_ID_DEFAULT;
-eval select * from information_schema.tokudb_trx;
+eval select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
# should be empty
commit;
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
connect(conn_a,localhost,root,,);
let a_id=`select connection_id()`;
@@ -29,13 +29,13 @@ insert into t values (2);
connection default;
replace_column 1 TXN_ID_A 2 CLIENT_ID_A;
-eval select * from information_schema.tokudb_trx;
+eval select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
connection conn_a;
commit;
connection default;
# should be empty
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
disconnect conn_a;
diff --git a/storage/tokudb/mysql-test/tokudb_alter_table/r/ai_part.result b/storage/tokudb/mysql-test/tokudb_alter_table/r/ai_part.result
index 38338f7f823..6bfe78bbef8 100644
--- a/storage/tokudb/mysql-test/tokudb_alter_table/r/ai_part.result
+++ b/storage/tokudb/mysql-test/tokudb_alter_table/r/ai_part.result
@@ -6,7 +6,7 @@ INSERT INTO foo VALUES (1,0),(2,0);
SHOW CREATE TABLE foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1
@@ -16,7 +16,7 @@ ALTER TABLE foo ADD KEY(b);
SHOW CREATE TABLE foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `b` (`b`)
diff --git a/storage/tokudb/mysql-test/tokudb_alter_table/r/hcad_part.result b/storage/tokudb/mysql-test/tokudb_alter_table/r/hcad_part.result
index 075ccad6065..1c7ee865451 100644
--- a/storage/tokudb/mysql-test/tokudb_alter_table/r/hcad_part.result
+++ b/storage/tokudb/mysql-test/tokudb_alter_table/r/hcad_part.result
@@ -5,7 +5,7 @@ CREATE TABLE foo (a INT, b INT, PRIMARY KEY (a)) PARTITION BY HASH(a) PARTITIONS
SHOW CREATE TABLE foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1
@@ -15,7 +15,7 @@ ALTER TABLE foo ADD COLUMN c INT;
SHOW CREATE TABLE foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
diff --git a/storage/tokudb/mysql-test/tokudb_alter_table/r/hcr3.result b/storage/tokudb/mysql-test/tokudb_alter_table/r/hcr3.result
index 834ddfbd2d3..4c700489b7f 100644
--- a/storage/tokudb/mysql-test/tokudb_alter_table/r/hcr3.result
+++ b/storage/tokudb/mysql-test/tokudb_alter_table/r/hcr3.result
@@ -10,7 +10,7 @@ alter table foo change a aa int;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `aa` int(11) NOT NULL DEFAULT '0',
+ `aa` int(11) NOT NULL,
`b` bigint(20) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
`d` varchar(10) DEFAULT NULL,
@@ -32,7 +32,7 @@ alter table foo change b bb bigint;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `aa` int(11) NOT NULL DEFAULT '0',
+ `aa` int(11) NOT NULL,
`bb` bigint(20) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
`d` varchar(10) DEFAULT NULL,
@@ -51,7 +51,7 @@ alter table foo change d dd varchar(10);
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `aa` int(11) NOT NULL DEFAULT '0',
+ `aa` int(11) NOT NULL,
`bb` bigint(20) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
`dd` varchar(10) DEFAULT NULL,
diff --git a/storage/tokudb/mysql-test/tokudb_alter_table/r/other_alter.result b/storage/tokudb/mysql-test/tokudb_alter_table/r/other_alter.result
index 7ec5ee47865..f458aee8cd5 100644
--- a/storage/tokudb/mysql-test/tokudb_alter_table/r/other_alter.result
+++ b/storage/tokudb/mysql-test/tokudb_alter_table/r/other_alter.result
@@ -58,7 +58,7 @@ foo CREATE TABLE `foo` (
`b` varchar(20) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
`d` int(11) DEFAULT NULL,
- `e` int(11) NOT NULL DEFAULT '0',
+ `e` int(11) NOT NULL,
PRIMARY KEY (`e`),
UNIQUE KEY `c` (`c`),
KEY `d` (`d`),
diff --git a/storage/tokudb/mysql-test/tokudb_alter_table/r/other_alter2.result b/storage/tokudb/mysql-test/tokudb_alter_table/r/other_alter2.result
index 7e552fbbfa1..69c3da7ae97 100644
--- a/storage/tokudb/mysql-test/tokudb_alter_table/r/other_alter2.result
+++ b/storage/tokudb/mysql-test/tokudb_alter_table/r/other_alter2.result
@@ -52,7 +52,7 @@ foo CREATE TABLE `foo` (
`cc` int(11),
`dd` int(11) DEFAULT NULL,
`ee` int(11) DEFAULT NULL,
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(20) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
`d` int(11) DEFAULT NULL,
@@ -70,7 +70,7 @@ foo_isam CREATE TABLE `foo_isam` (
`cc` int(11),
`dd` int(11) DEFAULT NULL,
`ee` int(11) DEFAULT NULL,
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` varchar(20) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
`d` int(11) DEFAULT NULL,
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db805.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db805.result
new file mode 100644
index 00000000000..1bc0372f1b8
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db805.result
@@ -0,0 +1,18 @@
+drop table if exists t1,t3;
+create table t3(a3 int,b3 decimal(0,0),c3 int,d3 int,primary key(a3,b3)) engine=TOKUDB;
+LOCK TABLES t3 WRITE;
+create temporary table t1(f1 int,index(f1)) engine=innodb;
+INSERT INTO t1 VALUES(1),(1),(1);
+select * from t1;
+f1
+1
+1
+1
+ALTER TABLE t1 engine=TOKUDB;
+select * from t1;
+f1
+1
+1
+1
+unlock tables;
+drop table t1,t3;
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db806.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db806.result
new file mode 100644
index 00000000000..ae87dbab281
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db806.result
@@ -0,0 +1,9 @@
+drop table if exists t1,t3;
+CREATE TABLE t3(a int,c int,d int)engine=TOKUDB;
+lock table t3 read;
+create temporary table t1 engine=tokudb as SELECT 1;
+select * from t1;
+1
+1
+unlock tables;
+drop table t1,t3;
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db811.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db811.result
new file mode 100644
index 00000000000..1d26f43c9dd
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db811.result
@@ -0,0 +1,14 @@
+drop table if exists t2,t3,t4;
+CREATE TABLE t3(a INT,b INT,UNIQUE KEY (a,b)) engine=TOKUDB;
+CREATE TABLE t4(c1 FLOAT ZEROFILL) engine=innodb;
+CREATE TABLE t2(a int KEY,b CHAR (1)) engine=TOKUDB PARTITION BY HASH (a) PARTITIONS 13;
+LOCK TABLES t4 WRITE,t3 WRITE,t2 WRITE;
+INSERT INTO t2(a)VALUES (REPEAT(0,1));
+ALTER TABLE t2 ADD COLUMN(c INT);
+alter table t4 add column c int;
+UPDATE t2 SET a=1;
+select * from t2;
+a b c
+1 NULL NULL
+unlock tables;
+drop table t2,t3,t4;
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db811s.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db811s.result
new file mode 100644
index 00000000000..0a50e63e037
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db811s.result
@@ -0,0 +1,14 @@
+drop table if exists t2,t3,t4;
+CREATE TABLE t3(a INT,b INT,UNIQUE KEY (a,b)) engine=TOKUDB;
+CREATE TABLE t4(c1 FLOAT ZEROFILL) engine=innodb;
+CREATE TABLE t2(a int KEY,b CHAR (1)) engine=TOKUDB PARTITION BY HASH (a) PARTITIONS 1;
+LOCK TABLES t4 WRITE,t3 WRITE,t2 WRITE;
+INSERT INTO t2(a)VALUES (REPEAT(0,1));
+ALTER TABLE t2 ADD COLUMN(c INT);
+alter table t4 add column c int;
+UPDATE t2 SET a=1;
+select * from t2;
+a b c
+1 NULL NULL
+unlock tables;
+drop table t2,t3,t4;
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db823.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db823.result
new file mode 100644
index 00000000000..d94da5c0673
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db823.result
@@ -0,0 +1,11 @@
+drop table if exists s,t;
+create table s (id int) engine=tokudb;
+lock tables s write;
+create temporary table t (id int, key(id)) engine=innodb;
+insert into t values (1);
+alter table t engine=tokudb;
+select * from t;
+id
+1
+unlock tables;
+drop table s, t;
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/dict_leak_3518.result b/storage/tokudb/mysql-test/tokudb_bugs/r/dict_leak_3518.result
index ae80daae14b..0513bb7f3e5 100644
--- a/storage/tokudb/mysql-test/tokudb_bugs/r/dict_leak_3518.result
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/dict_leak_3518.result
@@ -6,7 +6,7 @@ create table foo (a int, primary key (a)) engine=TokuDB;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1
insert into foo values(1);
@@ -18,7 +18,7 @@ create table foo (a int, primary key (a)) engine=TokuDB select * from bar;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1
select * from foo;
@@ -43,7 +43,7 @@ create table foo (a int, primary key (a)) engine=TokuDB select * from bar;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1
select * from foo;
@@ -65,7 +65,7 @@ create table foo (a int, primary key (a)) engine=TokuDB;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1
insert into foo values(1);
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/frm_store3.result b/storage/tokudb/mysql-test/tokudb_bugs/r/frm_store3.result
index 2b098d68705..08f157f5223 100644
--- a/storage/tokudb/mysql-test/tokudb_bugs/r/frm_store3.result
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/frm_store3.result
@@ -7,7 +7,7 @@ alter table bar add index (a);
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
- `a` int(11) NOT NULL DEFAULT '0',
+ `a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/tokudb718.result b/storage/tokudb/mysql-test/tokudb_bugs/r/tokudb718.result
index e63f73caf20..0cf75d40847 100644
--- a/storage/tokudb/mysql-test/tokudb_bugs/r/tokudb718.result
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/tokudb718.result
@@ -3,7 +3,8 @@ drop table if exists t;
create table t (id int primary key);
begin;
insert into t values (1),(2);
-select * from information_schema.tokudb_fractal_tree_info;
-ERROR HY000: Got error -30994 "Internal error < 0 (Not system error)" from storage engine TokuDB
+select dictionary_name from information_schema.tokudb_fractal_tree_info;
+dictionary_name
+./test/t-status
commit;
drop table t;
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/db805.test b/storage/tokudb/mysql-test/tokudb_bugs/t/db805.test
new file mode 100644
index 00000000000..1114de6b325
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/t/db805.test
@@ -0,0 +1,17 @@
+# DB-805 test that conversion of t1 from innodb to tokudb can write rows
+source include/have_tokudb.inc;
+source include/have_innodb.inc;
+disable_warnings;
+drop table if exists t1,t3;
+enable_warnings;
+
+create table t3(a3 int,b3 decimal(0,0),c3 int,d3 int,primary key(a3,b3)) engine=TOKUDB;
+LOCK TABLES t3 WRITE;
+create temporary table t1(f1 int,index(f1)) engine=innodb;
+INSERT INTO t1 VALUES(1),(1),(1);
+select * from t1;
+ALTER TABLE t1 engine=TOKUDB;
+select * from t1;
+unlock tables;
+
+drop table t1,t3;
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/db806.test b/storage/tokudb/mysql-test/tokudb_bugs/t/db806.test
new file mode 100644
index 00000000000..3815e59f78c
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/t/db806.test
@@ -0,0 +1,13 @@
+# DB-806 test that lock tables and create select can write rows to the new table
+source include/have_tokudb.inc;
+disable_warnings;
+drop table if exists t1,t3;
+enable_warnings;
+
+CREATE TABLE t3(a int,c int,d int)engine=TOKUDB;
+lock table t3 read;
+create temporary table t1 engine=tokudb as SELECT 1;
+select * from t1;
+unlock tables;
+
+drop table t1,t3; \ No newline at end of file
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/db811.test b/storage/tokudb/mysql-test/tokudb_bugs/t/db811.test
new file mode 100644
index 00000000000..509f482765e
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/t/db811.test
@@ -0,0 +1,22 @@
+# DB-811 test that alter table t2 updates both the schema (FRM) and the data (tokudb files)
+
+source include/have_tokudb.inc;
+source include/have_innodb.inc;
+source include/have_partition.inc;
+disable_warnings;
+drop table if exists t2,t3,t4;
+enable_warnings;
+
+CREATE TABLE t3(a INT,b INT,UNIQUE KEY (a,b)) engine=TOKUDB;
+CREATE TABLE t4(c1 FLOAT ZEROFILL) engine=innodb;
+CREATE TABLE t2(a int KEY,b CHAR (1)) engine=TOKUDB PARTITION BY HASH (a) PARTITIONS 13;
+LOCK TABLES t4 WRITE,t3 WRITE,t2 WRITE;
+INSERT INTO t2(a)VALUES (REPEAT(0,1));
+ALTER TABLE t2 ADD COLUMN(c INT);
+alter table t4 add column c int;
+UPDATE t2 SET a=1;
+select * from t2;
+unlock tables;
+
+drop table t2,t3,t4;
+
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/db811s.test b/storage/tokudb/mysql-test/tokudb_bugs/t/db811s.test
new file mode 100644
index 00000000000..5b8c6ed79d3
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/t/db811s.test
@@ -0,0 +1,22 @@
+# DB-811 test that alter table t2 updates both the schema (FRM) and the data (tokudb files)
+
+source include/have_tokudb.inc;
+source include/have_innodb.inc;
+source include/have_partition.inc;
+disable_warnings;
+drop table if exists t2,t3,t4;
+enable_warnings;
+
+CREATE TABLE t3(a INT,b INT,UNIQUE KEY (a,b)) engine=TOKUDB;
+CREATE TABLE t4(c1 FLOAT ZEROFILL) engine=innodb;
+CREATE TABLE t2(a int KEY,b CHAR (1)) engine=TOKUDB PARTITION BY HASH (a) PARTITIONS 1;
+LOCK TABLES t4 WRITE,t3 WRITE,t2 WRITE;
+INSERT INTO t2(a)VALUES (REPEAT(0,1));
+ALTER TABLE t2 ADD COLUMN(c INT);
+alter table t4 add column c int;
+UPDATE t2 SET a=1;
+select * from t2;
+unlock tables;
+
+drop table t2,t3,t4;
+
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/db823.test b/storage/tokudb/mysql-test/tokudb_bugs/t/db823.test
new file mode 100644
index 00000000000..2e01c0e5797
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/t/db823.test
@@ -0,0 +1,16 @@
+# test DB-823
+# test that the conversion of table t from innodb to tokudb succeeds.
+source include/have_tokudb.inc;
+source include/have_innodb.inc;
+disable_warnings;
+drop table if exists s,t;
+enable_warnings;
+create table s (id int) engine=tokudb;
+lock tables s write;
+create temporary table t (id int, key(id)) engine=innodb;
+insert into t values (1);
+alter table t engine=tokudb;
+select * from t;
+unlock tables;
+drop table s, t;
+
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/tokudb718.test b/storage/tokudb/mysql-test/tokudb_bugs/t/tokudb718.test
index 415bb7a2332..735a88afed8 100644
--- a/storage/tokudb/mysql-test/tokudb_bugs/t/tokudb718.test
+++ b/storage/tokudb/mysql-test/tokudb_bugs/t/tokudb718.test
@@ -7,7 +7,6 @@ enable_warnings;
create table t (id int primary key);
begin;
insert into t values (1),(2);
---error 1030
-select * from information_schema.tokudb_fractal_tree_info;
+select dictionary_name from information_schema.tokudb_fractal_tree_info;
commit;
drop table t;
diff --git a/storage/xtradb/CMakeLists.txt b/storage/xtradb/CMakeLists.txt
index a6e2014e679..0ae3528e512 100644
--- a/storage/xtradb/CMakeLists.txt
+++ b/storage/xtradb/CMakeLists.txt
@@ -462,14 +462,6 @@ SET(INNOBASE_SOURCES
ut/ut0wqueue.cc
ut/ut0timer.cc)
-# These files have unused result errors, so we skip Werror
-CHECK_C_COMPILER_FLAG("-Werror" HAVE_WERROR)
-IF(HAVE_WERROR)
- INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake)
- ADD_COMPILE_FLAGS(page/page0zip.c COMPILE_FLAGS "-Wno-error")
- ADD_COMPILE_FLAGS(ut/ut0ut.c COMPILE_FLAGS "-Wno-error")
-ENDIF()
-
IF(XTRADB_OK)
MYSQL_ADD_PLUGIN(xtradb ${INNOBASE_SOURCES} STORAGE_ENGINE
DEFAULT RECOMPILE_FOR_EMBEDDED
diff --git a/storage/xtradb/api/api0api.cc b/storage/xtradb/api/api0api.cc
index 3859fb84b81..0fe21423232 100644
--- a/storage/xtradb/api/api0api.cc
+++ b/storage/xtradb/api/api0api.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2008, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2008, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -318,35 +318,6 @@ ib_wake_master_thread(void)
}
}
-/*********************************************************************//**
-Calculate the max row size of the columns in a cluster index.
-@return max row length */
-UNIV_INLINE
-ulint
-ib_get_max_row_len(
-/*===============*/
- dict_index_t* cluster) /*!< in: cluster index */
-{
- ulint i;
- ulint max_len = 0;
- ulint n_fields = cluster->n_fields;
-
- /* Add the size of the ordering columns in the
- clustered index. */
- for (i = 0; i < n_fields; ++i) {
- const dict_col_t* col;
-
- col = dict_index_get_nth_col(cluster, i);
-
- /* Use the maximum output size of
- mach_write_compressed(), although the encoded
- length should always fit in 2 bytes. */
- max_len += dict_col_get_max_size(col);
- }
-
- return(max_len);
-}
-
/*****************************************************************//**
Read the columns from a rec into a tuple. */
static
@@ -624,6 +595,21 @@ ib_trx_begin(
return(static_cast<ib_trx_t>(trx));
}
+
+/*****************************************************************//**
+Check if transaction is read_only
+@return transaction read_only status */
+UNIV_INTERN
+ib_u32_t
+ib_trx_read_only(
+/*=============*/
+ ib_trx_t ib_trx) /*!< in: trx handle */
+{
+ trx_t* trx = (trx_t*) ib_trx;
+
+ return(trx->read_only);
+}
+
/*****************************************************************//**
Get the transaction's state.
@return transaction state */
@@ -710,120 +696,6 @@ ib_trx_rollback(
return(err);
}
-/*****************************************************************//**
-Find an index definition from the index vector using index name.
-@return index def. if found else NULL */
-UNIV_INLINE
-const ib_index_def_t*
-ib_table_find_index(
-/*================*/
- ib_vector_t* indexes, /*!< in: vector of indexes */
- const char* name) /*!< in: index name */
-{
- ulint i;
-
- for (i = 0; i < ib_vector_size(indexes); ++i) {
- const ib_index_def_t* index_def;
-
- index_def = (ib_index_def_t*) ib_vector_get(indexes, i);
-
- if (innobase_strcasecmp(name, index_def->name) == 0) {
- return(index_def);
- }
- }
-
- return(NULL);
-}
-
-/*****************************************************************//**
-Get the InnoDB internal precise type from the schema column definition.
-@return precise type in api format */
-UNIV_INLINE
-ulint
-ib_col_get_prtype(
-/*==============*/
- const ib_col_t* ib_col) /*!< in: column definition */
-{
- ulint prtype = 0;
-
- if (ib_col->ib_col_attr & IB_COL_UNSIGNED) {
- prtype |= DATA_UNSIGNED;
-
- ut_a(ib_col->ib_col_type == IB_INT);
- }
-
- if (ib_col->ib_col_attr & IB_COL_NOT_NULL) {
- prtype |= DATA_NOT_NULL;
- }
-
- return(prtype);
-}
-
-/*****************************************************************//**
-Get the InnoDB internal main type from the schema column definition.
-@return column main type */
-UNIV_INLINE
-ulint
-ib_col_get_mtype(
-/*==============*/
- const ib_col_t* ib_col) /*!< in: column definition */
-{
- /* Note: The api0api.h types should map directly to
- the internal numeric codes. */
- return(ib_col->ib_col_type);
-}
-
-/*****************************************************************//**
-Find a column in the the column vector with the same name.
-@return col. def. if found else NULL */
-UNIV_INLINE
-const ib_col_t*
-ib_table_find_col(
-/*==============*/
- const ib_vector_t* cols, /*!< in: column list head */
- const char* name) /*!< in: column name to find */
-{
- ulint i;
-
- for (i = 0; i < ib_vector_size(cols); ++i) {
- const ib_col_t* ib_col;
-
- ib_col = static_cast<const ib_col_t*>(
- ib_vector_get((ib_vector_t*) cols, i));
-
- if (innobase_strcasecmp(ib_col->name, name) == 0) {
- return(ib_col);
- }
- }
-
- return(NULL);
-}
-
-/*****************************************************************//**
-Find a column in the the column list with the same name.
-@return col. def. if found else NULL */
-UNIV_INLINE
-const ib_key_col_t*
-ib_index_find_col(
-/*==============*/
- ib_vector_t* cols, /*!< in: column list head */
- const char* name) /*!< in: column name to find */
-{
- ulint i;
-
- for (i = 0; i < ib_vector_size(cols); ++i) {
- const ib_key_col_t* ib_col;
-
- ib_col = static_cast<ib_key_col_t*>(ib_vector_get(cols, i));
-
- if (innobase_strcasecmp(ib_col->name, name) == 0) {
- return(ib_col);
- }
- }
-
- return(NULL);
-}
-
#ifdef __WIN__
/*****************************************************************//**
Convert a string to lower case. */
@@ -947,34 +819,6 @@ ib_table_name_check(
/*****************************************************************//**
-Get an index definition that is tagged as a clustered index.
-@return cluster index schema */
-UNIV_INLINE
-ib_index_def_t*
-ib_find_clustered_index(
-/*====================*/
- ib_vector_t* indexes) /*!< in: index defs. to search */
-{
- ulint i;
- ulint n_indexes;
-
- n_indexes = ib_vector_size(indexes);
-
- for (i = 0; i < n_indexes; ++i) {
- ib_index_def_t* ib_index_def;
-
- ib_index_def = static_cast<ib_index_def_t*>(
- ib_vector_get(indexes, i));
-
- if (ib_index_def->clustered) {
- return(ib_index_def);
- }
- }
-
- return(NULL);
-}
-
-/*****************************************************************//**
Get a table id. The caller must have acquired the dictionary mutex.
@return DB_SUCCESS if found */
static
@@ -3564,41 +3408,6 @@ ib_cursor_set_cluster_access(
prebuilt->need_to_access_clustered = TRUE;
}
-/*************************************************************//**
-Convert and write an INT column value to an InnoDB tuple.
-@return DB_SUCCESS or error */
-UNIV_INLINE
-ib_err_t
-ib_tuple_write_int(
-/*===============*/
- ib_tpl_t ib_tpl, /*!< in/out: tuple to write to */
- ulint col_no, /*!< in: column number */
- const void* value, /*!< in: integer value */
- ulint value_len) /*!< in: sizeof value type */
-{
- const dfield_t* dfield;
- ulint data_len;
- ulint type_len;
- ib_tuple_t* tuple = (ib_tuple_t*) ib_tpl;
-
- ut_a(col_no < ib_tuple_get_n_cols(ib_tpl));
-
- dfield = ib_col_get_dfield(tuple, col_no);
-
- data_len = dfield_get_len(dfield);
- type_len = dtype_get_len(dfield_get_type(dfield));
-
- if (dtype_get_mtype(dfield_get_type(dfield)) != DATA_INT
- || value_len != data_len) {
-
- return(DB_DATA_MISMATCH);
- }
-
- return(ib_col_set_value(
- ib_tpl, static_cast<ib_ulint_t>(col_no),
- value, static_cast<ib_ulint_t>(type_len), true));
-}
-
/*****************************************************************//**
Write an integer value to a column. Integers are stored in big-endian
format and will need to be converted from the host format.
diff --git a/storage/xtradb/btr/btr0btr.cc b/storage/xtradb/btr/btr0btr.cc
index 2f248c98651..c8018e6582b 100644
--- a/storage/xtradb/btr/btr0btr.cc
+++ b/storage/xtradb/btr/btr0btr.cc
@@ -2,6 +2,7 @@
Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
+Copyright (c) 2014, 2015, MariaDB Corporation
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -739,7 +740,20 @@ btr_root_block_get(
zip_size = dict_table_zip_size(index->table);
root_page_no = dict_index_get_page(index);
- block = btr_block_get(space, zip_size, root_page_no, mode, index, mtr);
+ block = btr_block_get(space, zip_size, root_page_no, mode, (dict_index_t*)index, mtr);
+
+ if (!block) {
+ index->table->is_encrypted = TRUE;
+ index->table->corrupted = FALSE;
+
+ ib_push_warning(index->table->thd, DB_DECRYPTION_FAILED,
+ "Table %s in tablespace %lu is encrypted but encryption service or"
+ " used key_id is not available. "
+ " Can't continue reading table.",
+ index->table->name, space);
+
+ return NULL;
+ }
SRV_CORRUPT_TABLE_CHECK(block, return(0););
@@ -779,8 +793,10 @@ btr_root_get(
const dict_index_t* index, /*!< in: index tree */
mtr_t* mtr) /*!< in: mtr */
{
- return(buf_block_get_frame(btr_root_block_get(index, RW_X_LATCH,
- mtr)));
+ buf_block_t* root = btr_root_block_get(index, RW_X_LATCH,
+ mtr);
+
+ return(root ? buf_block_get_frame(root) : NULL);
}
/**************************************************************//**
@@ -795,7 +811,7 @@ btr_height_get(
dict_index_t* index, /*!< in: index tree */
mtr_t* mtr) /*!< in/out: mini-transaction */
{
- ulint height;
+ ulint height=0;
buf_block_t* root_block;
ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
@@ -806,13 +822,16 @@ btr_height_get(
/* S latches the page */
root_block = btr_root_block_get(index, RW_S_LATCH, mtr);
- height = btr_page_get_level(buf_block_get_frame_fast(root_block), mtr);
+ if (root_block) {
+
+ height = btr_page_get_level(buf_block_get_frame_fast(root_block), mtr);
- /* Release the S latch on the root page. */
- mtr_memo_release(mtr, root_block, MTR_MEMO_PAGE_S_FIX);
+ /* Release the S latch on the root page. */
+ mtr_memo_release(mtr, root_block, MTR_MEMO_PAGE_S_FIX);
#ifdef UNIV_SYNC_DEBUG
- sync_thread_reset_level(&root_block->lock);
+ sync_thread_reset_level(&root_block->lock);
#endif /* UNIV_SYNC_DEBUG */
+ }
return(height);
}
@@ -877,7 +896,7 @@ btr_root_adjust_on_import(
return(DB_CORRUPTION););
block = btr_block_get(
- space_id, zip_size, root_page_no, RW_X_LATCH, index, &mtr);
+ space_id, zip_size, root_page_no, RW_X_LATCH, (dict_index_t*)index, &mtr);
page = buf_block_get_frame(block);
page_zip = buf_block_get_page_zip(block);
@@ -1260,7 +1279,7 @@ btr_get_size_and_reserved(
{
fseg_header_t* seg_header;
page_t* root;
- ulint n;
+ ulint n=ULINT_UNDEFINED;
ulint dummy;
ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
@@ -1274,17 +1293,21 @@ btr_get_size_and_reserved(
}
root = btr_root_get(index, mtr);
+ *used = 0;
- seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_LEAF;
+ if (root) {
- n = fseg_n_reserved_pages(seg_header, used, mtr);
+ seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_LEAF;
- if (flag == BTR_TOTAL_SIZE) {
- seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_TOP;
+ n = fseg_n_reserved_pages(seg_header, used, mtr);
- n += fseg_n_reserved_pages(seg_header, &dummy, mtr);
- *used += dummy;
+ if (flag == BTR_TOTAL_SIZE) {
+ seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_TOP;
+ n += fseg_n_reserved_pages(seg_header, &dummy, mtr);
+ *used += dummy;
+
+ }
}
return(n);
@@ -3513,9 +3536,7 @@ btr_level_list_remove_func(
ulint zip_size,/*!< in: compressed page size in bytes
or 0 for uncompressed pages */
page_t* page, /*!< in/out: page to remove */
-#ifdef UNIV_SYNC_DEBUG
- const dict_index_t* index, /*!< in: index tree */
-#endif /* UNIV_SYNC_DEBUG */
+ dict_index_t* index, /*!< in: index tree */
mtr_t* mtr) /*!< in/out: mini-transaction */
{
ulint prev_page_no;
@@ -5136,18 +5157,20 @@ node_ptr_fails:
/**************************************************************//**
Checks the consistency of an index tree.
-@return TRUE if ok */
+@return DB_SUCCESS if ok, error code if not */
UNIV_INTERN
-bool
+dberr_t
btr_validate_index(
/*===============*/
dict_index_t* index, /*!< in: index */
const trx_t* trx) /*!< in: transaction or NULL */
{
+ dberr_t err = DB_SUCCESS;
+
/* Full Text index are implemented by auxiliary tables,
not the B-tree */
if (dict_index_is_online_ddl(index) || (index->type & DICT_FTS)) {
- return(true);
+ return(err);
}
mtr_t mtr;
@@ -5156,13 +5179,18 @@ btr_validate_index(
mtr_x_lock(dict_index_get_lock(index), &mtr);
- bool ok = true;
page_t* root = btr_root_get(index, &mtr);
+ if (root == NULL && index->table->is_encrypted) {
+ err = DB_DECRYPTION_FAILED;
+ mtr_commit(&mtr);
+ return err;
+ }
+
SRV_CORRUPT_TABLE_CHECK(root,
{
mtr_commit(&mtr);
- return(FALSE);
+ return(DB_CORRUPTION);
});
ulint n = btr_page_get_level(root, &mtr);
@@ -5170,14 +5198,14 @@ btr_validate_index(
for (ulint i = 0; i <= n; ++i) {
if (!btr_validate_level(index, trx, n - i)) {
- ok = false;
+ err = DB_CORRUPTION;
break;
}
}
mtr_commit(&mtr);
- return(ok);
+ return(err);
}
/**************************************************************//**
diff --git a/storage/xtradb/btr/btr0cur.cc b/storage/xtradb/btr/btr0cur.cc
index 4e5e6a713ed..44b0e50fa0f 100644
--- a/storage/xtradb/btr/btr0cur.cc
+++ b/storage/xtradb/btr/btr0cur.cc
@@ -3,6 +3,7 @@
Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2012, Facebook Inc.
+Copyright (c) 2015, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -386,7 +387,7 @@ search tuple should be performed in the B-tree. InnoDB does an insert
immediately after the cursor. Thus, the cursor may end up on a user record,
or on a page infimum record. */
UNIV_INTERN
-void
+dberr_t
btr_cur_search_to_nth_level(
/*========================*/
dict_index_t* index, /*!< in: index */
@@ -436,6 +437,7 @@ btr_cur_search_to_nth_level(
page_cur_t* page_cursor;
btr_op_t btr_op;
ulint root_height = 0; /* remove warning */
+ dberr_t err = DB_SUCCESS;
#ifdef BTR_CUR_ADAPT
btr_search_t* info;
@@ -553,7 +555,7 @@ btr_cur_search_to_nth_level(
|| mode != PAGE_CUR_LE);
btr_cur_n_sea++;
- return;
+ return err;
}
# endif /* BTR_CUR_HASH_ADAPT */
#endif /* BTR_CUR_ADAPT */
@@ -649,7 +651,21 @@ search_loop:
retry_page_get:
block = buf_page_get_gen(
space, zip_size, page_no, rw_latch, guess, buf_mode,
- file, line, mtr);
+ file, line, mtr, &err);
+
+ if (err != DB_SUCCESS) {
+ if (err == DB_DECRYPTION_FAILED) {
+ ib_push_warning((void *)NULL,
+ DB_DECRYPTION_FAILED,
+ "Table %s is encrypted but encryption service or"
+ " used key_id is not available. "
+ " Can't continue reading table.",
+ index->table->name);
+ index->table->is_encrypted = true;
+ }
+
+ goto func_exit;
+ }
if (block == NULL) {
SRV_CORRUPT_TABLE_CHECK(buf_mode == BUF_GET_IF_IN_POOL ||
@@ -889,12 +905,14 @@ func_exit:
rw_lock_s_lock(btr_search_get_latch(cursor->index));
}
+
+ return err;
}
/*****************************************************************//**
Opens a cursor at either end of an index. */
UNIV_INTERN
-void
+dberr_t
btr_cur_open_at_index_side_func(
/*============================*/
bool from_left, /*!< in: true if open to the low end,
@@ -920,6 +938,8 @@ btr_cur_open_at_index_side_func(
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
+ dberr_t err = DB_SUCCESS;
+
rec_offs_init(offsets_);
estimate = latch_mode & BTR_ESTIMATE;
@@ -957,11 +977,26 @@ btr_cur_open_at_index_side_func(
height = ULINT_UNDEFINED;
for (;;) {
- buf_block_t* block;
- page_t* page;
+ buf_block_t* block=NULL;
+ page_t* page=NULL;
+
block = buf_page_get_gen(space, zip_size, page_no,
RW_NO_LATCH, NULL, BUF_GET,
- file, line, mtr);
+ file, line, mtr, &err);
+ if (err != DB_SUCCESS) {
+ if (err == DB_DECRYPTION_FAILED) {
+ ib_push_warning((void *)NULL,
+ DB_DECRYPTION_FAILED,
+ "Table %s is encrypted but encryption service or"
+ " used key_id is not available. "
+ " Can't continue reading table.",
+ index->table->name);
+ index->table->is_encrypted = true;
+ }
+
+ goto exit_loop;
+ }
+
page = buf_block_get_frame(block);
SRV_CORRUPT_TABLE_CHECK(page,
@@ -1066,6 +1101,8 @@ exit_loop:
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
+
+ return err;
}
/**********************************************************************//**
@@ -1113,10 +1150,25 @@ btr_cur_open_at_rnd_pos_func(
for (;;) {
buf_block_t* block;
page_t* page;
+ dberr_t err=DB_SUCCESS;
block = buf_page_get_gen(space, zip_size, page_no,
RW_NO_LATCH, NULL, BUF_GET,
- file, line, mtr);
+ file, line, mtr, &err);
+
+ if (err != DB_SUCCESS) {
+ if (err == DB_DECRYPTION_FAILED) {
+ ib_push_warning((void *)NULL,
+ DB_DECRYPTION_FAILED,
+ "Table %s is encrypted but encryption service or"
+ " used key_id is not available. "
+ " Can't continue reading table.",
+ index->table->name);
+ index->table->is_encrypted = true;
+ }
+ goto exit_loop;
+ }
+
page = buf_block_get_frame(block);
SRV_CORRUPT_TABLE_CHECK(page,
@@ -1743,15 +1795,24 @@ btr_cur_pessimistic_insert(
btr_cur_get_page_zip(cursor),
thr_get_trx(thr)->id, mtr);
}
- if (!page_rec_is_infimum(btr_cur_get_rec(cursor))
- || btr_page_get_prev(
- buf_block_get_frame(
- btr_cur_get_block(cursor)), mtr)
- == FIL_NULL) {
+
+ if (!page_rec_is_infimum(btr_cur_get_rec(cursor))) {
/* split and inserted need to call
lock_update_insert() always. */
inherit = TRUE;
}
+
+ buf_block_t* block = btr_cur_get_block(cursor);
+ buf_frame_t* frame = NULL;
+
+ if (block) {
+ frame = buf_block_get_frame(block);
+ }
+ /* split and inserted need to call
+ lock_update_insert() always. */
+ if (frame && btr_page_get_prev(frame, mtr) == FIL_NULL) {
+ inherit = TRUE;
+ }
}
#ifdef BTR_CUR_ADAPT
@@ -3749,6 +3810,7 @@ btr_estimate_n_rows_in_range_on_level(
mtr_t mtr;
page_t* page;
buf_block_t* block;
+ dberr_t err=DB_SUCCESS;
mtr_start(&mtr);
@@ -3759,7 +3821,23 @@ btr_estimate_n_rows_in_range_on_level(
silence a debug assertion about this. */
block = buf_page_get_gen(space, zip_size, page_no, RW_S_LATCH,
NULL, BUF_GET_POSSIBLY_FREED,
- __FILE__, __LINE__, &mtr);
+ __FILE__, __LINE__, &mtr, &err);
+
+ if (err != DB_SUCCESS) {
+ if (err == DB_DECRYPTION_FAILED) {
+ ib_push_warning((void *)NULL,
+ DB_DECRYPTION_FAILED,
+ "Table %s is encrypted but encryption service or"
+ " used key_id is not available. "
+ " Can't continue reading table.",
+ index->table->name);
+ index->table->is_encrypted = true;
+ }
+
+ mtr_commit(&mtr);
+ goto inexact;
+ }
+
page = buf_block_get_frame(block);
diff --git a/storage/xtradb/btr/btr0defragment.cc b/storage/xtradb/btr/btr0defragment.cc
index b4edda13b45..6e7a3fd2411 100644
--- a/storage/xtradb/btr/btr0defragment.cc
+++ b/storage/xtradb/btr/btr0defragment.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (C) 2012, 2014 Facebook, Inc. All Rights Reserved.
-Copyright (C) 2014, SkySQL Ab. All Rights Reserved.
+Copyright (C) 2014, 2015, MariaDB Corporation. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -22,7 +22,7 @@ Index defragmentation.
Created 05/29/2014 Rongrong Zhong
Modified 16/07/2014 Sunguck Lee
-Modified 30/07/2014 Jan Lindström jan.lindstrom@skysql.com
+Modified 30/07/2014 Jan Lindström jan.lindstrom@mariadb.com
*******************************************************/
#include "btr0defragment.h"
@@ -208,16 +208,31 @@ synchronized defragmentation. */
os_event_t
btr_defragment_add_index(
dict_index_t* index, /*!< index to be added */
- bool async) /*!< whether this is an async defragmentation */
+ bool async, /*!< whether this is an async
+ defragmentation */
+ dberr_t* err) /*!< out: error code */
{
mtr_t mtr;
ulint space = dict_index_get_space(index);
ulint zip_size = dict_table_zip_size(index->table);
ulint page_no = dict_index_get_page(index);
+ *err = DB_SUCCESS;
+
mtr_start(&mtr);
// Load index rood page.
- page_t* page = btr_page_get(space, zip_size, page_no,
- RW_NO_LATCH, index, &mtr);
+ buf_block_t* block = btr_block_get(space, zip_size, page_no, RW_NO_LATCH, index, &mtr);
+ page_t* page = NULL;
+
+ if (block) {
+ page = buf_block_get_frame(block);
+ }
+
+ if (page == NULL && index->table->is_encrypted) {
+ mtr_commit(&mtr);
+ *err = DB_DECRYPTION_FAILED;
+ return NULL;
+ }
+
if (btr_page_get_level(page, &mtr) == 0) {
// Index root is a leaf page, no need to defragment.
mtr_commit(&mtr);
diff --git a/storage/xtradb/btr/btr0scrub.cc b/storage/xtradb/btr/btr0scrub.cc
index d53b478e429..e6acb7802f1 100644
--- a/storage/xtradb/btr/btr0scrub.cc
+++ b/storage/xtradb/btr/btr0scrub.cc
@@ -750,9 +750,13 @@ btr_scrub_page(
mtr_t* mtr) /*!< in: mtr */
{
/* recheck if page needs scrubbing (knowing allocation status) */
- int needs_scrubbing = btr_page_needs_scrubbing(
- scrub_data, block, allocated);
- if (needs_scrubbing != BTR_SCRUB_PAGE) {
+ int needs_scrubbing = BTR_SCRUB_SKIP_PAGE_AND_CLOSE_TABLE;
+
+ if (block) {
+ btr_page_needs_scrubbing(scrub_data, block, allocated);
+ }
+
+ if (!block || needs_scrubbing != BTR_SCRUB_PAGE) {
mtr_commit(mtr);
return needs_scrubbing;
}
@@ -784,7 +788,12 @@ btr_scrub_page(
return BTR_SCRUB_SKIP_PAGE_AND_CLOSE_TABLE;
}
- if (btr_page_get_index_id(buf_block_get_frame(block)) !=
+ buf_frame_t* frame = NULL;
+
+ if (block) {
+ frame = buf_block_get_frame(block);
+ }
+ if (!frame || btr_page_get_index_id(frame) !=
scrub_data->current_index->id) {
/* page has been reallocated to new index */
mtr_commit(mtr);
diff --git a/storage/xtradb/buf/buf0buf.cc b/storage/xtradb/buf/buf0buf.cc
index fbd7aeb581a..85023be9402 100644
--- a/storage/xtradb/buf/buf0buf.cc
+++ b/storage/xtradb/buf/buf0buf.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2013, 2015, MariaDB Corporation. All Rights Reserved.
@@ -59,11 +59,24 @@ Created 11/5/1995 Heikki Tuuri
#include "srv0start.h"
#include "ut0byte.h"
#include "fil0pagecompress.h"
+#include "ha_prototypes.h"
/* prototypes for new functions added to ha_innodb.cc */
trx_t* innobase_get_trx();
+/********************************************************************//**
+Check if page is maybe compressed, encrypted or both when we encounter
+corrupted page. Note that we can't be 100% sure if page is corrupted
+or decrypt/decompress just failed.
+*/
+static
+ibool
+buf_page_check_corrupt(
+/*===================*/
+ buf_page_t* bpage); /*!< in/out: buffer page read from
+ disk */
+
static inline
void
_increment_page_get_statistics(buf_block_t* block, trx_t* trx)
@@ -99,10 +112,6 @@ _increment_page_get_statistics(buf_block_t* block, trx_t* trx)
#include "lzo/lzo1x.h"
#endif
-/* Number of temporary slots used for encryption/compression
-memory allocation before/after I/O operations */
-#define BUF_MAX_TMP_SLOTS 200
-
/*
IMPLEMENTATION OF THE BUFFER POOL
=================================
@@ -568,6 +577,79 @@ buf_page_is_zeroes(
return(true);
}
+/** Checks if the page is in crc32 checksum format.
+@param[in] read_buf database page
+@param[in] checksum_field1 new checksum field
+@param[in] checksum_field2 old checksum field
+@return true if the page is in crc32 checksum format */
+UNIV_INLINE
+bool
+buf_page_is_checksum_valid_crc32(
+ const byte* read_buf,
+ ulint checksum_field1,
+ ulint checksum_field2)
+{
+ ib_uint32_t crc32 = buf_calc_page_crc32(read_buf);
+
+ return(checksum_field1 == crc32 && checksum_field2 == crc32);
+}
+
+/** Checks if the page is in innodb checksum format.
+@param[in] read_buf database page
+@param[in] checksum_field1 new checksum field
+@param[in] checksum_field2 old checksum field
+@return true if the page is in innodb checksum format */
+UNIV_INLINE
+bool
+buf_page_is_checksum_valid_innodb(
+ const byte* read_buf,
+ ulint checksum_field1,
+ ulint checksum_field2)
+{
+ /* There are 2 valid formulas for
+ checksum_field2 (old checksum field) which algo=innodb could have
+ written to the page:
+
+ 1. Very old versions of InnoDB only stored 8 byte lsn to the
+ start and the end of the page.
+
+ 2. Newer InnoDB versions store the old formula checksum
+ (buf_calc_page_old_checksum()). */
+
+ if (checksum_field2 != mach_read_from_4(read_buf + FIL_PAGE_LSN)
+ && checksum_field2 != buf_calc_page_old_checksum(read_buf)) {
+ return(false);
+ }
+
+ /* old field is fine, check the new field */
+
+ /* InnoDB versions < 4.0.14 and < 4.1.1 stored the space id
+ (always equal to 0), to FIL_PAGE_SPACE_OR_CHKSUM */
+
+ if (checksum_field1 != 0
+ && checksum_field1 != buf_calc_page_new_checksum(read_buf)) {
+ return(false);
+ }
+
+ return(true);
+}
+
+/** Checks if the page is in none checksum format.
+@param[in] read_buf database page
+@param[in] checksum_field1 new checksum field
+@param[in] checksum_field2 old checksum field
+@return true if the page is in none checksum format */
+UNIV_INLINE
+bool
+buf_page_is_checksum_valid_none(
+ const byte* read_buf,
+ ulint checksum_field1,
+ ulint checksum_field2)
+{
+ return(checksum_field1 == checksum_field2
+ && checksum_field1 == BUF_NO_CHECKSUM_MAGIC);
+}
+
/********************************************************************//**
Checks if a page is corrupt.
@return TRUE if corrupted */
@@ -584,8 +666,6 @@ buf_page_is_corrupted(
ulint page_encrypted = fil_page_is_encrypted(read_buf);
ulint checksum_field1;
ulint checksum_field2;
- ibool crc32_inited = FALSE;
- ib_uint32_t crc32 = ULINT32_UNDEFINED;
if (!page_encrypted && !zip_size
&& memcmp(read_buf + FIL_PAGE_LSN + 4,
@@ -668,148 +748,121 @@ buf_page_is_corrupted(
return(FALSE);
}
- switch ((srv_checksum_algorithm_t) srv_checksum_algorithm) {
- case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
-
- crc32 = buf_calc_page_crc32(read_buf);
-
- return(checksum_field1 != crc32 || checksum_field2 != crc32);
-
- case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
-
- return(checksum_field1
- != buf_calc_page_new_checksum(read_buf)
- || checksum_field2
- != buf_calc_page_old_checksum(read_buf));
-
- case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
+ DBUG_EXECUTE_IF("buf_page_is_corrupt_failure", return(TRUE); );
- return(checksum_field1 != BUF_NO_CHECKSUM_MAGIC
- || checksum_field2 != BUF_NO_CHECKSUM_MAGIC);
+ ulint page_no = mach_read_from_4(read_buf + FIL_PAGE_OFFSET);
+ ulint space_id = mach_read_from_4(read_buf + FIL_PAGE_SPACE_ID);
+ const srv_checksum_algorithm_t curr_algo =
+ static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
+ switch (curr_algo) {
case SRV_CHECKSUM_ALGORITHM_CRC32:
- case SRV_CHECKSUM_ALGORITHM_INNODB:
- /* There are 3 valid formulas for
- checksum_field2 (old checksum field):
-
- 1. Very old versions of InnoDB only stored 8 byte lsn to the
- start and the end of the page.
-
- 2. InnoDB versions before MySQL 5.6.3 store the old formula
- checksum (buf_calc_page_old_checksum()).
-
- 3. InnoDB versions 5.6.3 and newer with
- innodb_checksum_algorithm=strict_crc32|crc32 store CRC32. */
-
- /* since innodb_checksum_algorithm is not strict_* allow
- any of the algos to match for the old field */
-
- if (checksum_field2
- != mach_read_from_4(read_buf + FIL_PAGE_LSN)
- && checksum_field2 != BUF_NO_CHECKSUM_MAGIC) {
-
- /* The checksum does not match any of the
- fast to check. First check the selected algorithm
- for writing checksums because we assume that the
- chance of it matching is higher. */
-
- if (srv_checksum_algorithm
- == SRV_CHECKSUM_ALGORITHM_CRC32) {
-
- crc32 = buf_calc_page_crc32(read_buf);
- crc32_inited = TRUE;
-
- if (checksum_field2 != crc32
- && checksum_field2
- != buf_calc_page_old_checksum(read_buf)) {
+ case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
- return(TRUE);
- }
- } else {
- ut_ad(srv_checksum_algorithm
- == SRV_CHECKSUM_ALGORITHM_INNODB);
+ if (buf_page_is_checksum_valid_crc32(read_buf,
+ checksum_field1, checksum_field2)) {
+ return(FALSE);
+ }
- if (checksum_field2
- != buf_calc_page_old_checksum(read_buf)) {
+ if (buf_page_is_checksum_valid_none(read_buf,
+ checksum_field1, checksum_field2)) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_NONE,
+ space_id, page_no);
+ }
- crc32 = buf_calc_page_crc32(read_buf);
- crc32_inited = TRUE;
+ return(FALSE);
+ }
- if (checksum_field2 != crc32) {
- return(TRUE);
- }
- }
+ if (buf_page_is_checksum_valid_innodb(read_buf,
+ checksum_field1, checksum_field2)) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_INNODB,
+ space_id, page_no);
}
- }
- /* old field is fine, check the new field */
+ return(FALSE);
+ }
- /* InnoDB versions < 4.0.14 and < 4.1.1 stored the space id
- (always equal to 0), to FIL_PAGE_SPACE_OR_CHKSUM */
+ return(TRUE);
- if (checksum_field1 != 0
- && checksum_field1 != BUF_NO_CHECKSUM_MAGIC) {
+ case SRV_CHECKSUM_ALGORITHM_INNODB:
+ case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
- /* The checksum does not match any of the
- fast to check. First check the selected algorithm
- for writing checksums because we assume that the
- chance of it matching is higher. */
+ if (buf_page_is_checksum_valid_innodb(read_buf,
+ checksum_field1, checksum_field2)) {
+ return(FALSE);
+ }
- if (srv_checksum_algorithm
- == SRV_CHECKSUM_ALGORITHM_CRC32) {
+ if (buf_page_is_checksum_valid_none(read_buf,
+ checksum_field1, checksum_field2)) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_NONE,
+ space_id, page_no);
+ }
- if (!crc32_inited) {
- crc32 = buf_calc_page_crc32(read_buf);
- crc32_inited = TRUE;
- }
+ return(FALSE);
+ }
- if (checksum_field1 != crc32
- && checksum_field1
- != buf_calc_page_new_checksum(read_buf)) {
+ if (buf_page_is_checksum_valid_crc32(read_buf,
+ checksum_field1, checksum_field2)) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_CRC32,
+ space_id, page_no);
+ }
- return(TRUE);
- }
- } else {
- ut_ad(srv_checksum_algorithm
- == SRV_CHECKSUM_ALGORITHM_INNODB);
+ return(FALSE);
+ }
- if (checksum_field1
- != buf_calc_page_new_checksum(read_buf)) {
+ return(TRUE);
- if (!crc32_inited) {
- crc32 = buf_calc_page_crc32(
- read_buf);
- crc32_inited = TRUE;
- }
+ case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
- if (checksum_field1 != crc32) {
- return(TRUE);
- }
- }
- }
+ if (buf_page_is_checksum_valid_none(read_buf,
+ checksum_field1, checksum_field2)) {
+ return(FALSE);
}
- /* If CRC32 is stored in at least one of the fields, then the
- other field must also be CRC32 */
- if (crc32_inited
- && ((checksum_field1 == crc32
- && checksum_field2 != crc32)
- || (checksum_field1 != crc32
- && checksum_field2 == crc32))) {
+ if (buf_page_is_checksum_valid_crc32(read_buf,
+ checksum_field1, checksum_field2)) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_CRC32,
+ space_id, page_no);
+ return(FALSE);
+ }
- return(TRUE);
+ if (buf_page_is_checksum_valid_innodb(read_buf,
+ checksum_field1, checksum_field2)) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_INNODB,
+ space_id, page_no);
+ return(FALSE);
}
- break;
+ return(TRUE);
+
case SRV_CHECKSUM_ALGORITHM_NONE:
/* should have returned FALSE earlier */
- ut_error;
+ break;
/* no default so the compiler will emit a warning if new enum
is added and not handled here */
}
- DBUG_EXECUTE_IF("buf_page_is_corrupt_failure", return(TRUE); );
-
+ ut_error;
return(FALSE);
}
@@ -1086,6 +1139,11 @@ buf_block_init(
block->page.buf_fix_count = 0;
block->page.io_fix = BUF_IO_NONE;
block->page.key_version = 0;
+ block->page.page_encrypted = false;
+ block->page.page_compressed = false;
+ block->page.encrypted = false;
+ block->page.stored_checksum = BUF_NO_CHECKSUM_MAGIC;
+ block->page.calculated_checksum = BUF_NO_CHECKSUM_MAGIC;
block->page.real_size = 0;
block->page.write_size = 0;
block->modify_clock = 0;
@@ -1444,8 +1502,9 @@ buf_pool_init_instance(
/* Initialize the temporal memory array and slots */
buf_pool->tmp_arr = (buf_tmp_array_t *)mem_zalloc(sizeof(buf_tmp_array_t));
- buf_pool->tmp_arr->n_slots = BUF_MAX_TMP_SLOTS;
- buf_pool->tmp_arr->slots = (buf_tmp_buffer_t*)mem_zalloc(sizeof(buf_tmp_buffer_t) * BUF_MAX_TMP_SLOTS);
+ ulint n_slots = srv_n_read_io_threads * srv_n_write_io_threads * (8 * OS_AIO_N_PENDING_IOS_PER_THREAD);
+ buf_pool->tmp_arr->n_slots = n_slots;
+ buf_pool->tmp_arr->slots = (buf_tmp_buffer_t*)mem_zalloc(sizeof(buf_tmp_buffer_t) * n_slots);
buf_pool->try_LRU_scan = TRUE;
@@ -1499,8 +1558,31 @@ buf_pool_free_instance(
hash_table_free(buf_pool->page_hash);
hash_table_free(buf_pool->zip_hash);
+ /* Free all used temporary slots */
+ if (buf_pool->tmp_arr) {
+ for(ulint i = 0; i < buf_pool->tmp_arr->n_slots; i++) {
+ buf_tmp_buffer_t* slot = &(buf_pool->tmp_arr->slots[i]);
+#ifdef HAVE_LZO
+ if (slot && slot->lzo_mem) {
+ ut_free(slot->lzo_mem);
+ slot->lzo_mem = NULL;
+ }
+#endif
+ if (slot && slot->crypt_buf_free) {
+ ut_free(slot->crypt_buf_free);
+ slot->crypt_buf_free = NULL;
+ }
+
+ if (slot && slot->comp_buf_free) {
+ ut_free(slot->comp_buf_free);
+ slot->comp_buf_free = NULL;
+ }
+ }
+ }
+
mem_free(buf_pool->tmp_arr->slots);
mem_free(buf_pool->tmp_arr);
+ buf_pool->tmp_arr = NULL;
}
/********************************************************************//**
@@ -1795,6 +1877,9 @@ page_found:
goto page_found;
}
+ /* The maximum number of purge threads should never exceed
+ BUF_POOL_WATCH_SIZE. So there is no way for purge thread
+ instance to hold a watch when setting another watch. */
for (i = 0; i < BUF_POOL_WATCH_SIZE; i++) {
bpage = &buf_pool->watch[i];
@@ -2165,7 +2250,7 @@ lookup:
/* Page not in buf_pool: needs to be read from file */
ut_ad(!hash_lock);
- buf_read_page(space, zip_size, offset, trx);
+ buf_read_page(space, zip_size, offset, trx, NULL);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(++buf_dbg_counter % 5771 || buf_validate());
@@ -2684,7 +2769,8 @@ buf_page_get_gen(
BUF_GET_IF_IN_POOL_OR_WATCH */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
- mtr_t* mtr) /*!< in: mini-transaction */
+ mtr_t* mtr, /*!< in: mini-transaction */
+ dberr_t* err) /*!< out: error code */
{
buf_block_t* block;
ulint fold;
@@ -2702,6 +2788,11 @@ buf_page_get_gen(
ut_ad((rw_latch == RW_S_LATCH)
|| (rw_latch == RW_X_LATCH)
|| (rw_latch == RW_NO_LATCH));
+
+ if (err) {
+ *err = DB_SUCCESS;
+ }
+
#ifdef UNIV_DEBUG
switch (mode) {
case BUF_GET_NO_LATCH:
@@ -2765,6 +2856,8 @@ loop:
}
if (block == NULL) {
+ buf_page_t* bpage=NULL;
+
/* Page not in buf_pool: needs to be read from file */
if (mode == BUF_GET_IF_IN_POOL_OR_WATCH) {
@@ -2799,35 +2892,83 @@ loop:
return(NULL);
}
- if (buf_read_page(space, zip_size, offset, trx)) {
+ if (buf_read_page(space, zip_size, offset, trx, &bpage)) {
buf_read_ahead_random(space, zip_size, offset,
ibuf_inside(mtr), trx);
retries = 0;
} else if (retries < BUF_PAGE_READ_MAX_RETRIES) {
++retries;
+
+ bool corrupted = true;
+
+ if (bpage) {
+ corrupted = buf_page_check_corrupt(bpage);
+ }
+
+ /* Do not try again for encrypted pages */
+ if (!corrupted) {
+ ib_mutex_t* pmutex = buf_page_get_mutex(bpage);
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ mutex_enter(pmutex);
+ buf_block_t* block = buf_page_get_block(bpage);
+ buf_page_set_io_fix(bpage, BUF_IO_NONE);
+ buf_block_set_state(block, BUF_BLOCK_NOT_USED);
+ buf_block_set_state(block, BUF_BLOCK_READY_FOR_USE);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ mutex_exit(pmutex);
+
+ if (err) {
+ *err = DB_DECRYPTION_FAILED;
+ }
+ return (NULL);
+ }
+
DBUG_EXECUTE_IF(
"innodb_page_corruption_retries",
retries = BUF_PAGE_READ_MAX_RETRIES;
);
} else {
- fprintf(stderr, "InnoDB: Error: Unable"
- " to read tablespace %lu page no"
- " %lu into the buffer pool after"
- " %lu attempts\n"
- "InnoDB: The most probable cause"
- " of this error may be that the"
- " table has been corrupted.\n"
- "InnoDB: You can try to fix this"
- " problem by using"
- " innodb_force_recovery.\n"
- "InnoDB: Please see reference manual"
- " for more details.\n"
- "InnoDB: Aborting...\n",
- space, offset,
- BUF_PAGE_READ_MAX_RETRIES);
+ bool corrupted = true;
- ut_error;
+ if (bpage) {
+ corrupted = buf_page_check_corrupt(bpage);
+ }
+
+ if (corrupted) {
+ fprintf(stderr, "InnoDB: Error: Unable"
+ " to read tablespace %lu page no"
+ " %lu into the buffer pool after"
+ " %lu attempts\n"
+ "InnoDB: The most probable cause"
+ " of this error may be that the"
+ " table has been corrupted.\n"
+ "InnoDB: You can try to fix this"
+ " problem by using"
+ " innodb_force_recovery.\n"
+ "InnoDB: Please see reference manual"
+ " for more details.\n"
+ "InnoDB: Aborting...\n",
+ space, offset,
+ BUF_PAGE_READ_MAX_RETRIES);
+
+ ut_error;
+ } else {
+ ib_mutex_t* pmutex = buf_page_get_mutex(bpage);
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ mutex_enter(pmutex);
+ buf_block_t* block = buf_page_get_block(bpage);
+ buf_page_set_io_fix(bpage, BUF_IO_NONE);
+ buf_block_set_state(block, BUF_BLOCK_NOT_USED);
+ buf_block_set_state(block, BUF_BLOCK_READY_FOR_USE);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ mutex_exit(pmutex);
+
+ if (err) {
+ *err = DB_DECRYPTION_FAILED;
+ }
+ return (NULL);
+ }
}
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
@@ -3600,6 +3741,11 @@ buf_page_init_low(
bpage->oldest_modification = 0;
bpage->write_size = 0;
bpage->key_version = 0;
+ bpage->stored_checksum = BUF_NO_CHECKSUM_MAGIC;
+ bpage->calculated_checksum = BUF_NO_CHECKSUM_MAGIC;
+ bpage->page_encrypted = false;
+ bpage->page_compressed = false;
+ bpage->encrypted = false;
bpage->real_size = 0;
HASH_INVALIDATE(bpage, hash);
@@ -4269,38 +4415,125 @@ buf_mark_space_corrupt(
/* First unfix and release lock on the bpage */
ut_ad(!mutex_own(&buf_pool->LRU_list_mutex));
- mutex_enter(&buf_pool->LRU_list_mutex);
- rw_lock_x_lock(hash_lock);
- mutex_enter(buf_page_get_mutex(bpage));
- ut_ad(buf_page_get_io_fix(bpage) == BUF_IO_READ);
- ut_ad(bpage->buf_fix_count == 0);
- /* Set BUF_IO_NONE before we remove the block from LRU list */
- buf_page_set_io_fix(bpage, BUF_IO_NONE);
+ if (!bpage->encrypted) {
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ rw_lock_x_lock(hash_lock);
+ mutex_enter(buf_page_get_mutex(bpage));
+ ut_ad(buf_page_get_io_fix(bpage) == BUF_IO_READ);
+ ut_ad(bpage->buf_fix_count == 0);
- if (uncompressed) {
- rw_lock_x_unlock_gen(
- &((buf_block_t*) bpage)->lock,
- BUF_IO_READ);
+ /* Set BUF_IO_NONE before we remove the block from LRU list */
+ buf_page_set_io_fix(bpage, BUF_IO_NONE);
+
+ if (uncompressed) {
+ rw_lock_x_unlock_gen(
+ &((buf_block_t*) bpage)->lock,
+ BUF_IO_READ);
+ }
}
/* Find the table with specified space id, and mark it corrupted */
if (dict_set_corrupted_by_space(space)) {
- buf_LRU_free_one_page(bpage);
+ if (!bpage->encrypted) {
+ buf_LRU_free_one_page(bpage);
+ }
} else {
- mutex_exit(buf_page_get_mutex(bpage));
+ if (!bpage->encrypted) {
+ mutex_exit(buf_page_get_mutex(bpage));
+ }
ret = FALSE;
}
- mutex_exit(&buf_pool->LRU_list_mutex);
-
- ut_ad(buf_pool->n_pend_reads > 0);
- os_atomic_decrement_ulint(&buf_pool->n_pend_reads, 1);
+ if(!bpage->encrypted) {
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ ut_ad(buf_pool->n_pend_reads > 0);
+ os_atomic_decrement_ulint(&buf_pool->n_pend_reads, 1);
+ }
return(ret);
}
/********************************************************************//**
+Check if page is maybe compressed, encrypted or both when we encounter
+corrupted page. Note that we can't be 100% sure if page is corrupted
+or decrypt/decompress just failed.
+*/
+static
+ibool
+buf_page_check_corrupt(
+/*===================*/
+ buf_page_t* bpage) /*!< in/out: buffer page read from disk */
+{
+ ulint zip_size = buf_page_get_zip_size(bpage);
+ byte* dst_frame = (zip_size) ? bpage->zip.data :
+ ((buf_block_t*) bpage)->frame;
+ unsigned key_version = bpage->key_version;
+ bool page_compressed = bpage->page_encrypted;
+ ulint stored_checksum = bpage->stored_checksum;
+ ulint calculated_checksum = bpage->stored_checksum;
+ bool page_compressed_encrypted = bpage->page_compressed;
+ ulint space_id = mach_read_from_4(
+ dst_frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
+ fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space_id);
+ fil_space_t* space = fil_space_found_by_id(space_id);
+ bool corrupted = true;
+
+ if (key_version != 0 || page_compressed_encrypted) {
+ bpage->encrypted = true;
+ }
+
+ if (key_version != 0 ||
+ (crypt_data && crypt_data->type != CRYPT_SCHEME_UNENCRYPTED) ||
+ page_compressed || page_compressed_encrypted) {
+
+ /* Page is really corrupted if post encryption stored
+ checksum does not match calculated checksum after page was
+ read. For pages compressed and then encrypted, there is no
+ checksum. */
+ corrupted = (!page_compressed_encrypted && stored_checksum != calculated_checksum);
+
+ if (corrupted) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "%s: Block in space_id %lu in file %s corrupted.",
+ page_compressed_encrypted ? "Maybe corruption" : "Corruption",
+ space_id, space ? space->name : "NULL");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Page based on contents %s encrypted.",
+ (key_version == 0 && page_compressed_encrypted == false) ? "not" : "maybe");
+ if (stored_checksum != BUF_NO_CHECKSUM_MAGIC || calculated_checksum != BUF_NO_CHECKSUM_MAGIC) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Page stored checksum %lu but calculated checksum %lu.",
+ stored_checksum, calculated_checksum);
+ }
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Reason could be that key_version %u in page "
+ "or in crypt_data %p could not be found.",
+ key_version, crypt_data);
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Reason could be also that key management plugin is not found or"
+ " used encryption algorithm or method does not match.");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Based on page page compressed %d, compressed and encrypted %d.",
+ page_compressed, page_compressed_encrypted);
+ } else {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Block in space_id %lu in file %s encrypted.",
+ space_id, space ? space->name : "NULL");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "However key management plugin or used key_id %u is not found or"
+ " used encryption algorithm or method does not match.",
+ key_version);
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Marking tablespace as missing. You may drop this table or"
+ " install correct key management plugin and key file.");
+ }
+ }
+
+ return corrupted;
+}
+
+/********************************************************************//**
Completes an asynchronous read or write request of a file page to or from
the buffer pool.
@return true if successful */
@@ -4418,47 +4651,46 @@ buf_page_io_complete(
;);
corrupt:
- fil_system_enter();
- space = fil_space_get_by_id(bpage->space);
- fil_system_exit();
- fprintf(stderr,
- "InnoDB: Database page corruption on disk"
- " or a failed\n"
- "InnoDB: space %lu file %s read of page %lu.\n"
- "InnoDB: You may have to recover"
- " from a backup.\n",
- (ulint)bpage->space,
- space ? space->name : "NULL",
- (ulong) bpage->offset);
-
- buf_page_print(frame, buf_page_get_zip_size(bpage),
- BUF_PAGE_PRINT_NO_CRASH);
- fprintf(stderr,
- "InnoDB: Database page corruption on disk"
- " or a failed\n"
- "InnoDB: file read of page %lu.\n"
- "InnoDB: You may have to recover"
- " from a backup.\n",
- (ulong) bpage->offset);
- fputs("InnoDB: It is also possible that"
- " your operating\n"
- "InnoDB: system has corrupted its"
- " own file cache\n"
- "InnoDB: and rebooting your computer"
- " removes the\n"
- "InnoDB: error.\n"
- "InnoDB: If the corrupt page is an index page\n"
- "InnoDB: you can also try to"
- " fix the corruption\n"
- "InnoDB: by dumping, dropping,"
- " and reimporting\n"
- "InnoDB: the corrupt table."
- " You can use CHECK\n"
- "InnoDB: TABLE to scan your"
- " table for corruption.\n"
- "InnoDB: See also "
- REFMAN "forcing-innodb-recovery.html\n"
- "InnoDB: about forcing recovery.\n", stderr);
+ bool corrupted = buf_page_check_corrupt(bpage);
+
+ if (corrupted) {
+ fil_system_enter();
+ space = fil_space_get_by_id(bpage->space);
+ fil_system_exit();
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Database page corruption on disk"
+ " or a failed");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Space %lu file %s read of page %lu.",
+ (ulint)bpage->space,
+ space ? space->name : "NULL",
+ (ulong) bpage->offset);
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "You may have to recover"
+ " from a backup.");
+
+
+ buf_page_print(frame, buf_page_get_zip_size(bpage),
+ BUF_PAGE_PRINT_NO_CRASH);
+
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "It is also possible that your operating"
+ "system has corrupted its own file cache.");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "and rebooting your computer removes the error.");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "If the corrupt page is an index page you can also try to");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "fix the corruption by dumping, dropping, and reimporting");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "the corrupt table. You can use CHECK");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "TABLE to scan your table for corruption.");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "See also "
+ REFMAN "forcing-innodb-recovery.html"
+ " about forcing recovery.");
+ }
if (srv_pass_corrupt_table && bpage->space != 0
&& bpage->space < SRV_LOG_SPACE_FIRST_ID) {
@@ -4476,7 +4708,8 @@ corrupt:
dict_table_set_corrupt_by_space(bpage->space, TRUE);
}
bpage->is_corrupt = TRUE;
- } else
+ }
+
if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {
/* If page space id is larger than TRX_SYS_SPACE
(0), we will attempt to mark the corresponding
@@ -4485,12 +4718,30 @@ corrupt:
&& buf_mark_space_corrupt(bpage)) {
return(false);
} else {
- fputs("InnoDB: Ending processing"
- " because of"
- " a corrupt database page.\n",
- stderr);
+ corrupted = buf_page_check_corrupt(bpage);
- ut_error;
+ if (corrupted) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Ending processing because of a corrupt database page.");
+
+ ut_error;
+ }
+
+ ib_push_warning(innobase_get_trx(), DB_DECRYPTION_FAILED,
+ "Table in tablespace %lu encrypted."
+ "However key management plugin or used key_id %lu is not found or"
+ " used encryption algorithm or method does not match."
+ " Can't continue opening the table.",
+ bpage->key_version);
+
+ if (bpage->space > TRX_SYS_SPACE) {
+ if (corrupted) {
+ buf_mark_space_corrupt(bpage);
+ }
+ } else {
+ ut_error;
+ }
+ return(false);
}
}
}
@@ -4668,11 +4919,13 @@ buf_all_freed_instance(
mutex_exit(&buf_pool->LRU_list_mutex);
if (UNIV_LIKELY_NULL(block)) {
- fprintf(stderr,
- "Page %lu %lu still fixed or dirty\n",
- (ulong) block->page.space,
- (ulong) block->page.offset);
- ut_error;
+ if (block->page.key_version == 0) {
+ fprintf(stderr,
+ "Page %lu %lu still fixed or dirty\n",
+ (ulong) block->page.space,
+ (ulong) block->page.offset);
+ ut_error;
+ }
}
}
@@ -5873,30 +6126,31 @@ Encrypts a buffer page right before it's flushed to disk
byte*
buf_page_encrypt_before_write(
/*==========================*/
- buf_page_t* bpage, /*!< in/out: buffer page to be flushed */
- const byte* src_frame, /*!< in: src frame */
- ulint space_id) /*!< in: space id */
+ buf_page_t* bpage, /*!< in/out: buffer page to be flushed */
+ byte* src_frame, /*!< in: src frame */
+ ulint space_id) /*!< in: space id */
{
fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space_id);
ulint zip_size = buf_page_get_zip_size(bpage);
ulint page_size = (zip_size) ? zip_size : UNIV_PAGE_SIZE;
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
bool page_compressed = fil_space_is_page_compressed(bpage->space);
- bpage->real_size = UNIV_PAGE_SIZE;
bool encrypted = true;
+ bpage->real_size = UNIV_PAGE_SIZE;
+
fil_page_type_validate(src_frame);
if (bpage->offset == 0) {
/* Page 0 of a tablespace is not encrypted/compressed */
ut_ad(bpage->key_version == 0);
- return const_cast<byte*>(src_frame);
+ return src_frame;
}
if (bpage->space == TRX_SYS_SPACE && bpage->offset == TRX_SYS_PAGE_NO) {
/* don't encrypt/compress page as it contains address to dblwr buffer */
bpage->key_version = 0;
- return const_cast<byte*>(src_frame);
+ return src_frame;
}
if (crypt_data != NULL && crypt_data->encryption == FIL_SPACE_ENCRYPTION_OFF) {
@@ -5918,31 +6172,35 @@ buf_page_encrypt_before_write(
if (!encrypted && !page_compressed) {
/* No need to encrypt or page compress the page */
- return const_cast<byte*>(src_frame);
+ return src_frame;
}
/* Find free slot from temporary memory array */
buf_tmp_buffer_t* slot = buf_pool_reserve_tmp_slot(buf_pool, page_compressed);
+ slot->out_buf = NULL;
bpage->slot = slot;
- byte *dst_frame = bpage->slot->out_buf = slot->crypt_buf;
+ byte *dst_frame = slot->crypt_buf;
if (!page_compressed) {
/* Encrypt page content */
- fil_space_encrypt(bpage->space,
- bpage->offset,
- bpage->newest_modification,
- src_frame,
- zip_size,
- dst_frame);
+ byte* tmp = fil_space_encrypt(bpage->space,
+ bpage->offset,
+ bpage->newest_modification,
+ src_frame,
+ zip_size,
+ dst_frame);
unsigned key_version =
mach_read_from_4(dst_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
ut_ad(key_version == 0 || key_version >= bpage->key_version);
bpage->key_version = key_version;
bpage->real_size = page_size;
+ slot->out_buf = dst_frame = tmp;
- fil_page_type_validate(dst_frame);
+#ifdef UNIV_DEBUG
+ fil_page_type_validate(tmp);
+#endif
} else {
/* First we compress the page content */
@@ -5962,22 +6220,27 @@ buf_page_encrypt_before_write(
bpage->real_size = out_len;
+#ifdef UNIV_DEBUG
fil_page_type_validate(tmp);
+#endif
+
if(encrypted) {
/* And then we encrypt the page content */
- fil_space_encrypt(bpage->space,
- bpage->offset,
- bpage->newest_modification,
- tmp,
- zip_size,
- dst_frame);
- } else {
- bpage->slot->out_buf = dst_frame = tmp;
+ tmp = fil_space_encrypt(bpage->space,
+ bpage->offset,
+ bpage->newest_modification,
+ tmp,
+ zip_size,
+ dst_frame);
}
+
+ slot->out_buf = dst_frame = tmp;
}
+#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
+#endif
// return dst_frame which will be written
return dst_frame;
@@ -5989,7 +6252,7 @@ Decrypt page after it has been read from disk
ibool
buf_page_decrypt_after_read(
/*========================*/
- buf_page_t* bpage) /*!< in/out: buffer page read from disk */
+ buf_page_t* bpage) /*!< in/out: buffer page read from disk */
{
ulint zip_size = buf_page_get_zip_size(bpage);
ulint size = (zip_size) ? zip_size : UNIV_PAGE_SIZE;
@@ -6002,6 +6265,11 @@ buf_page_decrypt_after_read(
bool page_compressed_encrypted = fil_page_is_compressed_encrypted(dst_frame);
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+ /* If page is encrypted read post-encryption checksum */
+ if (!page_compressed_encrypted && key_version != 0) {
+ bpage->stored_checksum = mach_read_from_4(dst_frame + + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4);
+ }
+
ut_ad(bpage->key_version == 0);
if (bpage->offset == 0) {
@@ -6009,13 +6277,21 @@ buf_page_decrypt_after_read(
return (TRUE);
}
+ /* Store these for corruption check */
+ bpage->key_version = key_version;
+ bpage->page_encrypted = page_compressed_encrypted;
+ bpage->page_compressed = page_compressed;
+
if (page_compressed) {
/* the page we read is unencrypted */
/* Find free slot from temporary memory array */
buf_tmp_buffer_t* slot = buf_pool_reserve_tmp_slot(buf_pool, page_compressed);
+#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
+#endif
+ /* decompress using comp_buf to dst_frame */
fil_decompress_page(slot->comp_buf,
dst_frame,
size,
@@ -6025,24 +6301,34 @@ buf_page_decrypt_after_read(
slot->reserved = false;
key_version = 0;
+#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
+#endif
} else {
buf_tmp_buffer_t* slot = NULL;
if (key_version) {
/* Find free slot from temporary memory array */
slot = buf_pool_reserve_tmp_slot(buf_pool, page_compressed);
- memcpy(slot->crypt_buf, dst_frame, size);
+#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
- fil_page_type_validate(slot->crypt_buf);
- /* decrypt from crypt_buf to dst_frame */
+#endif
+
+ /* Calculate checksum before decrypt, this will be
+ used later to find out if incorrect key was used. */
+ if (!page_compressed_encrypted) {
+ bpage->calculated_checksum = fil_crypt_calculate_checksum(zip_size, dst_frame);
+ }
+
+ /* decrypt using crypt_buf to dst_frame */
fil_space_decrypt(bpage->space,
- slot->crypt_buf,
- size,
- dst_frame);
+ slot->crypt_buf,
+ size,
+ dst_frame);
+#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
- fil_page_type_validate(slot->crypt_buf);
+#endif
}
if (page_compressed_encrypted) {
@@ -6053,13 +6339,16 @@ buf_page_decrypt_after_read(
#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
#endif
+ /* decompress using comp_buf to dst_frame */
fil_decompress_page(slot->comp_buf,
dst_frame,
size,
&bpage->write_size);
}
+#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
+#endif
/* Mark this slot as free */
if (slot) {
diff --git a/storage/xtradb/buf/buf0checksum.cc b/storage/xtradb/buf/buf0checksum.cc
index 451fef2f82e..01b646a78e0 100644
--- a/storage/xtradb/buf/buf0checksum.cc
+++ b/storage/xtradb/buf/buf0checksum.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -27,11 +27,13 @@ Created Aug 11, 2011 Vasil Dimov
#include "fil0fil.h" /* FIL_* */
#include "ut0crc32.h" /* ut_crc32() */
#include "ut0rnd.h" /* ut_fold_binary() */
+#include "buf0types.h"
#ifndef UNIV_INNOCHECKSUM
#include "srv0srv.h" /* SRV_CHECKSUM_* */
-#include "buf0types.h"
+
+#endif /* !UNIV_INNOCHECKSUM */
/** the macro MYSQL_SYSVAR_ENUM() requires "long unsigned int" and if we
use srv_checksum_algorithm_t here then we get a compiler error:
@@ -39,8 +41,6 @@ ha_innodb.cc:12251: error: cannot convert 'srv_checksum_algorithm_t*' to
'long unsigned int*' in initialization */
UNIV_INTERN ulong srv_checksum_algorithm = SRV_CHECKSUM_ALGORITHM_INNODB;
-#endif /* !UNIV_INNOCHECKSUM */
-
/********************************************************************//**
Calculates a page CRC32 which is stored to the page when it is written
to a file. Note that we must be careful to calculate the same value on
@@ -127,8 +127,6 @@ buf_calc_page_old_checksum(
return(checksum);
}
-#ifndef UNIV_INNOCHECKSUM
-
/********************************************************************//**
Return a printable string describing the checksum algorithm.
@return algorithm name */
@@ -140,18 +138,19 @@ buf_checksum_algorithm_name(
{
switch (algo) {
case SRV_CHECKSUM_ALGORITHM_CRC32:
- case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
return("crc32");
+ case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
+ return("strict_crc32");
case SRV_CHECKSUM_ALGORITHM_INNODB:
- case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
return("innodb");
+ case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
+ return("strict_innodb");
case SRV_CHECKSUM_ALGORITHM_NONE:
- case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
return("none");
+ case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
+ return("strict_none");
}
ut_error;
return(NULL);
}
-
-#endif /* !UNIV_INNOCHECKSUM */
diff --git a/storage/xtradb/buf/buf0dblwr.cc b/storage/xtradb/buf/buf0dblwr.cc
index 9323daf0076..7c7f28ddc2f 100644
--- a/storage/xtradb/buf/buf0dblwr.cc
+++ b/storage/xtradb/buf/buf0dblwr.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2014, SkySQL Ab. All Rights Reserved.
+Copyright (c) 2013, 2015, MariaDB Corporation. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -391,11 +391,11 @@ buf_dblwr_init_or_load_pages(
doublewrite = read_buf + TRX_SYS_DOUBLEWRITE;
if (mach_read_from_4(read_buf + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) != 0) {
- fil_space_decrypt((ulint)TRX_SYS_SPACE,
- read_buf,
- UNIV_PAGE_SIZE, /* page size */
- read_buf + UNIV_PAGE_SIZE);
- doublewrite = read_buf + UNIV_PAGE_SIZE + TRX_SYS_DOUBLEWRITE;
+ byte* tmp = fil_space_decrypt((ulint)TRX_SYS_SPACE,
+ read_buf + UNIV_PAGE_SIZE,
+ UNIV_PAGE_SIZE, /* page size */
+ read_buf);
+ doublewrite = tmp + TRX_SYS_DOUBLEWRITE;
}
if (mach_read_from_4(doublewrite + TRX_SYS_DOUBLEWRITE_MAGIC)
diff --git a/storage/xtradb/buf/buf0dump.cc b/storage/xtradb/buf/buf0dump.cc
index ee772124175..db3f5f9c207 100644
--- a/storage/xtradb/buf/buf0dump.cc
+++ b/storage/xtradb/buf/buf0dump.cc
@@ -211,6 +211,8 @@ buf_dump(
buf_dump_t* dump;
ulint n_pages;
ulint j;
+ ulint limit;
+ ulint counter;
buf_pool = buf_pool_from_array(i);
@@ -254,6 +256,9 @@ buf_dump(
mutex_exit(&buf_pool->LRU_list_mutex);
+ limit = (ulint)((double)n_pages * ((double)srv_buf_dump_status_frequency / (double)100));
+ counter = 0;
+
for (j = 0; j < n_pages && !SHOULD_QUIT(); j++) {
ret = fprintf(f, ULINTPF "," ULINTPF "\n",
BUF_DUMP_SPACE(dump[j]),
@@ -268,7 +273,14 @@ buf_dump(
return;
}
- if (j % 128 == 0) {
+ counter++;
+
+ /* Print buffer pool dump status only if
+ srv_buf_dump_status_frequency is > 0 and
+ we have processed that amount of pages. */
+ if (srv_buf_dump_status_frequency &&
+ counter == limit) {
+ counter = 0;
buf_dump_status(
STATUS_INFO,
"Dumping buffer pool "
@@ -578,8 +590,8 @@ DECLARE_THREAD(buf_dump_thread)(
srv_buf_dump_thread_active = TRUE;
- buf_dump_status(STATUS_INFO, "not started");
- buf_load_status(STATUS_INFO, "not started");
+ buf_dump_status(STATUS_INFO, "Dumping buffer pool(s) not yet started");
+ buf_load_status(STATUS_INFO, "Loading buffer pool(s) not yet started");
if (srv_buffer_pool_load_at_startup) {
buf_load();
diff --git a/storage/xtradb/buf/buf0flu.cc b/storage/xtradb/buf/buf0flu.cc
index 6443043310b..c891e53381a 100644
--- a/storage/xtradb/buf/buf0flu.cc
+++ b/storage/xtradb/buf/buf0flu.cc
@@ -1,8 +1,8 @@
/*****************************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2014, SkySQL Ab. All Rights Reserved.
-Copyright (c) 2013, 2014, Fusion-io. All Rights Reserved.
+Copyright (c) 1995, 2013, Oracle and/or its affiliates
+Copyright (c) 2013, 2015, SkySQL Ab
+Copyright (c) 2013, 2014, Fusion-io
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -932,11 +932,11 @@ buf_flush_write_block_low(
case BUF_BLOCK_ZIP_DIRTY:
frame = bpage->zip.data;
- ut_a(page_zip_verify_checksum(frame, zip_size));
-
mach_write_to_8(frame + FIL_PAGE_LSN,
bpage->newest_modification);
memset(frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, 0, 8);
+
+ ut_a(page_zip_verify_checksum(frame, zip_size));
break;
case BUF_BLOCK_FILE_PAGE:
frame = bpage->zip.data;
diff --git a/storage/xtradb/buf/buf0rea.cc b/storage/xtradb/buf/buf0rea.cc
index 6c74c30739e..15465699726 100644
--- a/storage/xtradb/buf/buf0rea.cc
+++ b/storage/xtradb/buf/buf0rea.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2014, SkySQL Ab. All Rights Reserved.
+Copyright (c) 2013, 2014, MariaDB Corporation. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -124,7 +124,8 @@ buf_read_page_low(
use to stop dangling page reads from a tablespace
which we have DISCARDed + IMPORTed back */
ulint offset, /*!< in: page number */
- trx_t* trx)
+ trx_t* trx, /*!< in: trx */
+ buf_page_t** rbpage) /*!< out: page */
{
buf_page_t* bpage;
ulint wake_later;
@@ -259,10 +260,17 @@ not_to_recover:
/* The i/o is already completed when we arrive from
fil_read */
if (!buf_page_io_complete(bpage)) {
+ if (rbpage) {
+ *rbpage = bpage;
+ }
return(0);
}
}
+ if (rbpage) {
+ *rbpage = bpage;
+ }
+
return(1);
}
@@ -398,7 +406,7 @@ read_ahead:
&err, false,
ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
space, zip_size, FALSE,
- tablespace_version, i, trx);
+ tablespace_version, i, trx, NULL);
if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr);
fprintf(stderr,
@@ -446,10 +454,11 @@ UNIV_INTERN
ibool
buf_read_page(
/*==========*/
- ulint space, /*!< in: space id */
- ulint zip_size,/*!< in: compressed page size in bytes, or 0 */
- ulint offset, /*!< in: page number */
- trx_t* trx)
+ ulint space, /*!< in: space id */
+ ulint zip_size, /*!< in: compressed page size in bytes, or 0 */
+ ulint offset, /*!< in: page number */
+ trx_t* trx, /*!< in: trx */
+ buf_page_t** bpage) /*!< out: page */
{
ib_int64_t tablespace_version;
ulint count;
@@ -462,7 +471,7 @@ buf_read_page(
count = buf_read_page_low(&err, true, BUF_READ_ANY_PAGE, space,
zip_size, FALSE,
- tablespace_version, offset, trx);
+ tablespace_version, offset, trx, bpage);
srv_stats.buf_pool_reads.add(count);
if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr);
@@ -510,7 +519,7 @@ buf_read_page_async(
| OS_AIO_SIMULATED_WAKE_LATER
| BUF_READ_IGNORE_NONEXISTENT_PAGES,
space, zip_size, FALSE,
- tablespace_version, offset, NULL);
+ tablespace_version, offset, NULL,NULL);
srv_stats.buf_pool_reads.add(count);
/* We do not increment number of I/O operations used for LRU policy
@@ -778,7 +787,7 @@ buf_read_ahead_linear(
count += buf_read_page_low(
&err, false,
ibuf_mode,
- space, zip_size, FALSE, tablespace_version, i, trx);
+ space, zip_size, FALSE, tablespace_version, i, trx, NULL);
if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr);
fprintf(stderr,
@@ -868,7 +877,7 @@ buf_read_ibuf_merge_pages(
buf_read_page_low(&err, sync && (i + 1 == n_stored),
BUF_READ_ANY_PAGE, space_ids[i],
zip_size, TRUE, space_versions[i],
- page_nos[i], NULL);
+ page_nos[i], NULL, NULL);
if (UNIV_UNLIKELY(err == DB_TABLESPACE_DELETED)) {
tablespace_deleted:
@@ -1008,12 +1017,12 @@ not_to_recover:
if ((i + 1 == n_stored) && sync) {
buf_read_page_low(&err, true, BUF_READ_ANY_PAGE, space,
zip_size, TRUE, tablespace_version,
- page_nos[i], NULL);
+ page_nos[i], NULL, NULL);
} else {
buf_read_page_low(&err, false, BUF_READ_ANY_PAGE
| OS_AIO_SIMULATED_WAKE_LATER,
space, zip_size, TRUE,
- tablespace_version, page_nos[i], NULL);
+ tablespace_version, page_nos[i], NULL, NULL);
}
}
diff --git a/storage/xtradb/dict/dict0boot.cc b/storage/xtradb/dict/dict0boot.cc
index b57a8873bd5..94a3af2852b 100644
--- a/storage/xtradb/dict/dict0boot.cc
+++ b/storage/xtradb/dict/dict0boot.cc
@@ -302,8 +302,7 @@ dict_boot(void)
/* Insert into the dictionary cache the descriptions of the basic
system tables */
/*-------------------------*/
- table = dict_mem_table_create("SYS_TABLES", DICT_HDR_SPACE, 8, 0, 0,
- false);
+ table = dict_mem_table_create("SYS_TABLES", DICT_HDR_SPACE, 8, 0, 0);
dict_mem_table_add_col(table, heap, "NAME", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, heap, "ID", DATA_BINARY, 0, 0);
@@ -357,8 +356,7 @@ dict_boot(void)
ut_a(error == DB_SUCCESS);
/*-------------------------*/
- table = dict_mem_table_create("SYS_COLUMNS", DICT_HDR_SPACE, 7, 0, 0,
- false);
+ table = dict_mem_table_create("SYS_COLUMNS", DICT_HDR_SPACE, 7, 0, 0);
dict_mem_table_add_col(table, heap, "TABLE_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, heap, "POS", DATA_INT, 0, 4);
@@ -391,8 +389,7 @@ dict_boot(void)
ut_a(error == DB_SUCCESS);
/*-------------------------*/
- table = dict_mem_table_create("SYS_INDEXES", DICT_HDR_SPACE, 7, 0, 0,
- false);
+ table = dict_mem_table_create("SYS_INDEXES", DICT_HDR_SPACE, 7, 0, 0);
dict_mem_table_add_col(table, heap, "TABLE_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, heap, "ID", DATA_BINARY, 0, 0);
@@ -425,8 +422,7 @@ dict_boot(void)
ut_a(error == DB_SUCCESS);
/*-------------------------*/
- table = dict_mem_table_create("SYS_FIELDS", DICT_HDR_SPACE, 3, 0, 0,
- false);
+ table = dict_mem_table_create("SYS_FIELDS", DICT_HDR_SPACE, 3, 0, 0);
dict_mem_table_add_col(table, heap, "INDEX_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, heap, "POS", DATA_INT, 0, 4);
diff --git a/storage/xtradb/dict/dict0crea.cc b/storage/xtradb/dict/dict0crea.cc
index 30523ff2af4..fec4e27f058 100644
--- a/storage/xtradb/dict/dict0crea.cc
+++ b/storage/xtradb/dict/dict0crea.cc
@@ -309,7 +309,8 @@ dict_build_table_def_step(
space, table->name, path,
dict_tf_to_fsp_flags(table->flags),
table->flags2,
- FIL_IBD_FILE_INITIAL_SIZE);
+ FIL_IBD_FILE_INITIAL_SIZE,
+ node->mode, node->key_id);
table->space = (unsigned int) space;
@@ -934,8 +935,10 @@ tab_create_graph_create(
dict_table_t* table, /*!< in: table to create, built as a memory data
structure */
mem_heap_t* heap, /*!< in: heap where created */
- bool commit) /*!< in: true if the commit node should be
+ bool commit, /*!< in: true if the commit node should be
added to the query graph */
+ fil_encryption_t mode, /*!< in: encryption mode */
+ ulint key_id) /*!< in: encryption key_id */
{
tab_node_t* node;
@@ -948,6 +951,8 @@ tab_create_graph_create(
node->state = TABLE_BUILD_TABLE_DEF;
node->heap = mem_heap_create(256);
+ node->mode = mode;
+ node->key_id = key_id;
node->tab_def = ins_node_create(INS_DIRECT, dict_sys->sys_tables,
heap);
@@ -1042,7 +1047,6 @@ dict_create_table_step(
/* DO THE CHECKS OF THE CONSISTENCY CONSTRAINTS HERE */
err = dict_build_table_def_step(thr, node);
-
if (err != DB_SUCCESS) {
goto function_exit;
@@ -1562,12 +1566,111 @@ dict_create_add_foreign_field_to_dictionary(
}
/********************************************************************//**
+Construct foreign key constraint defintion from data dictionary information.
+*/
+UNIV_INTERN
+char*
+dict_foreign_def_get(
+/*=================*/
+ dict_foreign_t* foreign,/*!< in: foreign */
+ trx_t* trx) /*!< in: trx */
+{
+ char* fk_def = (char *)mem_heap_alloc(foreign->heap, 4*1024);
+ const char* tbname;
+ char tablebuf[MAX_TABLE_NAME_LEN + 1] = "";
+ int i;
+ char* bufend;
+
+ tbname = dict_remove_db_name(foreign->id);
+ bufend = innobase_convert_name(tablebuf, MAX_TABLE_NAME_LEN,
+ tbname, strlen(tbname), trx->mysql_thd, FALSE);
+ tablebuf[bufend - tablebuf] = '\0';
+
+ sprintf(fk_def,
+ (char *)"CONSTRAINT %s FOREIGN KEY (", (char *)tablebuf);
+
+ for(i = 0; i < foreign->n_fields; i++) {
+ char buf[MAX_TABLE_NAME_LEN + 1] = "";
+ innobase_convert_name(buf, MAX_TABLE_NAME_LEN,
+ foreign->foreign_col_names[i],
+ strlen(foreign->foreign_col_names[i]),
+ trx->mysql_thd, FALSE);
+ strcat(fk_def, buf);
+ if (i < foreign->n_fields-1) {
+ strcat(fk_def, (char *)",");
+ }
+ }
+
+ strcat(fk_def,(char *)") REFERENCES ");
+
+ bufend = innobase_convert_name(tablebuf, MAX_TABLE_NAME_LEN,
+ foreign->referenced_table_name,
+ strlen(foreign->referenced_table_name),
+ trx->mysql_thd, TRUE);
+ tablebuf[bufend - tablebuf] = '\0';
+
+ strcat(fk_def, tablebuf);
+ strcat(fk_def, " (");
+
+ for(i = 0; i < foreign->n_fields; i++) {
+ char buf[MAX_TABLE_NAME_LEN + 1] = "";
+ bufend = innobase_convert_name(buf, MAX_TABLE_NAME_LEN,
+ foreign->referenced_col_names[i],
+ strlen(foreign->referenced_col_names[i]),
+ trx->mysql_thd, FALSE);
+ buf[bufend - buf] = '\0';
+ strcat(fk_def, buf);
+ if (i < foreign->n_fields-1) {
+ strcat(fk_def, (char *)",");
+ }
+ }
+ strcat(fk_def, (char *)")");
+
+ return fk_def;
+}
+
+/********************************************************************//**
+Convert foreign key column names from data dictionary to SQL-layer.
+*/
+static
+void
+dict_foreign_def_get_fields(
+/*========================*/
+ dict_foreign_t* foreign,/*!< in: foreign */
+ trx_t* trx, /*!< in: trx */
+ char** field, /*!< out: foreign column */
+ char** field2, /*!< out: referenced column */
+ int col_no) /*!< in: column number */
+{
+ char* bufend;
+ char* fieldbuf = (char *)mem_heap_alloc(foreign->heap, MAX_TABLE_NAME_LEN+1);
+ char* fieldbuf2 = (char *)mem_heap_alloc(foreign->heap, MAX_TABLE_NAME_LEN+1);
+
+ bufend = innobase_convert_name(fieldbuf, MAX_TABLE_NAME_LEN,
+ foreign->foreign_col_names[col_no],
+ strlen(foreign->foreign_col_names[col_no]),
+ trx->mysql_thd, FALSE);
+
+ fieldbuf[bufend - fieldbuf] = '\0';
+
+ bufend = innobase_convert_name(fieldbuf2, MAX_TABLE_NAME_LEN,
+ foreign->referenced_col_names[col_no],
+ strlen(foreign->referenced_col_names[col_no]),
+ trx->mysql_thd, FALSE);
+
+ fieldbuf2[bufend - fieldbuf2] = '\0';
+ *field = fieldbuf;
+ *field2 = fieldbuf2;
+}
+
+/********************************************************************//**
Add a foreign key definition to the data dictionary tables.
@return error code or DB_SUCCESS */
UNIV_INTERN
dberr_t
dict_create_add_foreign_to_dictionary(
/*==================================*/
+ dict_table_t* table,
const char* name, /*!< in: table name */
const dict_foreign_t* foreign,/*!< in: foreign key */
trx_t* trx) /*!< in/out: dictionary transaction */
@@ -1594,6 +1697,28 @@ dict_create_add_foreign_to_dictionary(
, name, foreign->id, trx);
if (error != DB_SUCCESS) {
+ if (error == DB_DUPLICATE_KEY) {
+ char buf[MAX_TABLE_NAME_LEN + 1] = "";
+ char tablename[MAX_TABLE_NAME_LEN + 1] = "";
+ char* fk_def;
+
+ innobase_convert_name(tablename, MAX_TABLE_NAME_LEN,
+ table->name, strlen(table->name),
+ trx->mysql_thd, TRUE);
+
+ innobase_convert_name(buf, MAX_TABLE_NAME_LEN,
+ foreign->id, strlen(foreign->id), trx->mysql_thd, FALSE);
+
+ fk_def = dict_foreign_def_get((dict_foreign_t*)foreign, trx);
+
+ ib_push_warning(trx, error,
+ "Create or Alter table %s with foreign key constraint"
+ " failed. Foreign key constraint %s"
+ " already exists on data dictionary."
+ " Foreign key constraint names need to be unique in database."
+ " Error in foreign key definition: %s.",
+ tablename, buf, fk_def);
+ }
return(error);
}
@@ -1603,6 +1728,26 @@ dict_create_add_foreign_to_dictionary(
i, name, foreign, trx);
if (error != DB_SUCCESS) {
+ char buf[MAX_TABLE_NAME_LEN + 1] = "";
+ char tablename[MAX_TABLE_NAME_LEN + 1] = "";
+ char* field=NULL;
+ char* field2=NULL;
+ char* fk_def;
+
+ innobase_convert_name(tablename, MAX_TABLE_NAME_LEN,
+ table->name, strlen(table->name),
+ trx->mysql_thd, TRUE);
+ innobase_convert_name(buf, MAX_TABLE_NAME_LEN,
+ foreign->id, strlen(foreign->id), trx->mysql_thd, FALSE);
+ fk_def = dict_foreign_def_get((dict_foreign_t*)foreign, trx);
+ dict_foreign_def_get_fields((dict_foreign_t*)foreign, trx, &field, &field2, i);
+
+ ib_push_warning(trx, error,
+ "Create or Alter table %s with foreign key constraint"
+ " failed. Error adding foreign key constraint name %s"
+ " fields %s or %s to the dictionary."
+ " Error in foreign key definition: %s.",
+ tablename, buf, i+1, fk_def);
return(error);
}
@@ -1649,7 +1794,7 @@ dict_create_add_foreigns_to_dictionary(
foreign = *it;
ut_ad(foreign->id != NULL);
- error = dict_create_add_foreign_to_dictionary(table->name,
+ error = dict_create_add_foreign_to_dictionary((dict_table_t*)table, table->name,
foreign, trx);
if (error != DB_SUCCESS) {
diff --git a/storage/xtradb/dict/dict0dict.cc b/storage/xtradb/dict/dict0dict.cc
index 3b044c74b52..8738e2bbf9e 100644
--- a/storage/xtradb/dict/dict0dict.cc
+++ b/storage/xtradb/dict/dict0dict.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, SkySQL Ab. All Rights Reserved.
@@ -684,6 +684,33 @@ dict_table_get_col_name_for_mysql(
return(s);
}
#ifndef UNIV_HOTBACKUP
+/** Allocate and init the autoinc latch of a given table.
+This function must not be called concurrently on the same table object.
+@param[in,out] table_void table whose autoinc latch to create */
+void
+dict_table_autoinc_alloc(
+ void* table_void)
+{
+ dict_table_t* table = static_cast<dict_table_t*>(table_void);
+ table->autoinc_mutex = new (std::nothrow) ib_mutex_t();
+ ut_a(table->autoinc_mutex != NULL);
+ mutex_create(autoinc_mutex_key,
+ table->autoinc_mutex, SYNC_DICT_AUTOINC_MUTEX);
+}
+
+/** Allocate and init the zip_pad_mutex of a given index.
+This function must not be called concurrently on the same index object.
+@param[in,out] index_void index whose zip_pad_mutex to create */
+void
+dict_index_zip_pad_alloc(
+ void* index_void)
+{
+ dict_index_t* index = static_cast<dict_index_t*>(index_void);
+ index->zip_pad.mutex = new (std::nothrow) os_fast_mutex_t;
+ ut_a(index->zip_pad.mutex != NULL);
+ os_fast_mutex_init(zip_pad_mutex_key, index->zip_pad.mutex);
+}
+
/********************************************************************//**
Acquire the autoinc lock. */
UNIV_INTERN
@@ -692,7 +719,32 @@ dict_table_autoinc_lock(
/*====================*/
dict_table_t* table) /*!< in/out: table */
{
- mutex_enter(&table->autoinc_mutex);
+#ifdef HAVE_ATOMIC_BUILTINS
+ os_once::do_or_wait_for_done(
+ &table->autoinc_mutex_created,
+ dict_table_autoinc_alloc, table);
+#else /* HAVE_ATOMIC_BUILTINS */
+ ut_ad(table->autoinc_mutex_created == os_once::DONE);
+#endif /* HAVE_ATOMIC_BUILTINS */
+
+ mutex_enter(table->autoinc_mutex);
+}
+
+/** Acquire the zip_pad_mutex latch.
+@param[in,out] index the index whose zip_pad_mutex to acquire.*/
+void
+dict_index_zip_pad_lock(
+ dict_index_t* index)
+{
+#ifdef HAVE_ATOMIC_BUILTINS
+ os_once::do_or_wait_for_done(
+ &index->zip_pad.mutex_created,
+ dict_index_zip_pad_alloc, index);
+#else /* HAVE_ATOMIC_BUILTINS */
+ ut_ad(index->zip_pad.mutex_created == os_once::DONE);
+#endif /* HAVE_ATOMIC_BUILTINS */
+
+ os_fast_mutex_lock(index->zip_pad.mutex);
}
/********************************************************************//**
@@ -704,7 +756,7 @@ dict_table_autoinc_initialize(
dict_table_t* table, /*!< in/out: table */
ib_uint64_t value) /*!< in: next value to assign to a row */
{
- ut_ad(mutex_own(&table->autoinc_mutex));
+ ut_ad(dict_table_autoinc_own(table));
table->autoinc = value;
}
@@ -746,7 +798,7 @@ dict_table_autoinc_read(
/*====================*/
const dict_table_t* table) /*!< in: table */
{
- ut_ad(mutex_own(&table->autoinc_mutex));
+ ut_ad(dict_table_autoinc_own(table));
return(table->autoinc);
}
@@ -762,7 +814,7 @@ dict_table_autoinc_update_if_greater(
dict_table_t* table, /*!< in/out: table */
ib_uint64_t value) /*!< in: value which was assigned to a row */
{
- ut_ad(mutex_own(&table->autoinc_mutex));
+ ut_ad(dict_table_autoinc_own(table));
if (value > table->autoinc) {
@@ -778,7 +830,7 @@ dict_table_autoinc_unlock(
/*======================*/
dict_table_t* table) /*!< in/out: table */
{
- mutex_exit(&table->autoinc_mutex);
+ mutex_exit(table->autoinc_mutex);
}
#endif /* !UNIV_HOTBACKUP */
@@ -1099,8 +1151,28 @@ dict_table_open_on_name(
if (table != NULL) {
- /* If table is corrupted, return NULL */
+ /* If table is encrypted return table */
if (ignore_err == DICT_ERR_IGNORE_NONE
+ && table->is_encrypted) {
+ /* Make life easy for drop table. */
+ if (table->can_be_evicted) {
+ dict_table_move_from_lru_to_non_lru(table);
+ }
+
+ if (table->can_be_evicted) {
+ dict_move_to_mru(table);
+ }
+
+ ++table->n_ref_count;
+
+ if (!dict_locked) {
+ mutex_exit(&dict_sys->mutex);
+ }
+
+ return (table);
+ }
+ /* If table is corrupted, return NULL */
+ else if (ignore_err == DICT_ERR_IGNORE_NONE
&& table->corrupted) {
/* Make life easy for drop table. */
@@ -1626,15 +1698,18 @@ dict_table_rename_in_cache(
} else if (table->space != TRX_SYS_SPACE) {
char* new_path = NULL;
- if (table->dir_path_of_temp_table != NULL) {
+ if (DICT_TF2_FLAG_IS_SET(table, DICT_TF2_TEMPORARY)) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Error: trying to rename a"
" TEMPORARY TABLE ", stderr);
ut_print_name(stderr, NULL, TRUE, old_name);
- fputs(" (", stderr);
- ut_print_filename(stderr,
- table->dir_path_of_temp_table);
- fputs(" )\n", stderr);
+ if (table->dir_path_of_temp_table != NULL) {
+ fputs(" (", stderr);
+ ut_print_filename(
+ stderr, table->dir_path_of_temp_table);
+ fputs(" )\n", stderr);
+ }
+
return(DB_ERROR);
} else if (DICT_TF_HAS_DATA_DIR(table->flags)) {
@@ -3225,6 +3300,11 @@ dict_index_build_internal_fts(
}
/*====================== FOREIGN KEY PROCESSING ========================*/
+#define DB_FOREIGN_KEY_IS_PREFIX_INDEX 200
+#define DB_FOREIGN_KEY_COL_NOT_NULL 201
+#define DB_FOREIGN_KEY_COLS_NOT_EQUAL 202
+#define DB_FOREIGN_KEY_INDEX_NOT_FOUND 203
+
/*********************************************************************//**
Checks if a table is referenced by foreign keys.
@return TRUE if table is referenced by a foreign key */
@@ -3379,15 +3459,26 @@ dict_foreign_find_index(
/*!< in: whether to check
charsets. only has an effect
if types_idx != NULL */
- ulint check_null)
+ ulint check_null,
/*!< in: nonzero if none of
the columns must be declared
NOT NULL */
+ ulint* error, /*!< out: error code */
+ ulint* err_col_no,
+ /*!< out: column number where
+ error happened */
+ dict_index_t** err_index)
+ /*!< out: index where error
+ happened */
{
dict_index_t* index;
ut_ad(mutex_own(&dict_sys->mutex));
+ if (error) {
+ *error = DB_FOREIGN_KEY_INDEX_NOT_FOUND;
+ }
+
index = dict_table_get_first_index(table);
while (index != NULL) {
@@ -3397,7 +3488,12 @@ dict_foreign_find_index(
&& dict_foreign_qualify_index(
table, col_names, columns, n_cols,
index, types_idx,
- check_charsets, check_null)) {
+ check_charsets, check_null,
+ error, err_col_no,err_index)) {
+ if (error) {
+ *error = DB_SUCCESS;
+ }
+
return(index);
}
@@ -3426,7 +3522,7 @@ wsrep_dict_foreign_find_index(
{
return dict_foreign_find_index(
table, col_names, columns, n_cols, types_idx, check_charsets,
- check_null);
+ check_null, NULL, NULL, NULL);
}
#endif /* WITH_WSREP */
/**********************************************************************//**
@@ -3528,7 +3624,7 @@ dict_foreign_add_to_cache(
ref_table, NULL,
for_in_cache->referenced_col_names,
for_in_cache->n_fields, for_in_cache->foreign_index,
- check_charsets, false);
+ check_charsets, false, NULL, NULL, NULL);
if (index == NULL
&& !(ignore_err & DICT_ERR_IGNORE_FK_NOKEY)) {
@@ -3560,6 +3656,10 @@ dict_foreign_add_to_cache(
}
if (for_table && !for_in_cache->foreign_table) {
+ ulint index_error;
+ ulint err_col;
+ dict_index_t *err_index=NULL;
+
index = dict_foreign_find_index(
for_table, col_names,
for_in_cache->foreign_col_names,
@@ -3567,7 +3667,8 @@ dict_foreign_add_to_cache(
for_in_cache->referenced_index, check_charsets,
for_in_cache->type
& (DICT_FOREIGN_ON_DELETE_SET_NULL
- | DICT_FOREIGN_ON_UPDATE_SET_NULL));
+ | DICT_FOREIGN_ON_UPDATE_SET_NULL),
+ &index_error, &err_col, &err_index);
if (index == NULL
&& !(ignore_err & DICT_ERR_IGNORE_FK_NOKEY)) {
@@ -4227,6 +4328,8 @@ static
void
dict_foreign_report_syntax_err(
/*===========================*/
+ const char* fmt, /*!< in: syntax err msg */
+ const char* oper, /*!< in: operation */
const char* name, /*!< in: table name */
const char* start_of_latest_foreign,
/*!< in: start of the foreign key clause
@@ -4239,12 +4342,102 @@ dict_foreign_report_syntax_err(
mutex_enter(&dict_foreign_err_mutex);
dict_foreign_error_report_low(ef, name);
- fprintf(ef, "%s:\nSyntax error close to:\n%s\n",
- start_of_latest_foreign, ptr);
+ fprintf(ef, fmt, oper, name, start_of_latest_foreign, ptr);
mutex_exit(&dict_foreign_err_mutex);
}
/*********************************************************************//**
+Push warning message to SQL-layer based on foreign key constraint
+index match error. */
+static
+void
+dict_foreign_push_index_error(
+/*==========================*/
+ trx_t* trx, /*!< in: trx */
+ const char* operation, /*!< in: operation create or alter
+ */
+ const char* create_name, /*!< in: table name in create or
+ alter table */
+ const char* latest_foreign, /*!< in: start of latest foreign key
+ constraint name */
+ const char** columns, /*!< in: foreign key columns */
+ ulint index_error, /*!< in: error code */
+ ulint err_col, /*!< in: column where error happened
+ */
+ dict_index_t* err_index, /*!< in: index where error happened
+ */
+ dict_table_t* table, /*!< in: table */
+ FILE* ef) /*!< in: output stream */
+{
+ switch (index_error) {
+ case DB_FOREIGN_KEY_INDEX_NOT_FOUND: {
+ fprintf(ef,
+ "%s table '%s' with foreign key constraint"
+ " failed. There is no index in the referenced"
+ " table where the referenced columns appear"
+ " as the first columns. Error close to %s.\n",
+ operation, create_name, latest_foreign);
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table '%s' with foreign key constraint"
+ " failed. There is no index in the referenced"
+ " table where the referenced columns appear"
+ " as the first columns. Error close to %s.",
+ operation, create_name, latest_foreign);
+ break;
+ }
+ case DB_FOREIGN_KEY_IS_PREFIX_INDEX: {
+ fprintf(ef,
+ "%s table '%s' with foreign key constraint"
+ " failed. There is only prefix index in the referenced"
+ " table where the referenced columns appear"
+ " as the first columns. Error close to %s.\n",
+ operation, create_name, latest_foreign);
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table '%s' with foreign key constraint"
+ " failed. There is only prefix index in the referenced"
+ " table where the referenced columns appear"
+ " as the first columns. Error close to %s.",
+ operation, create_name, latest_foreign);
+ break;
+ }
+ case DB_FOREIGN_KEY_COL_NOT_NULL: {
+ fprintf(ef,
+ "%s table %s with foreign key constraint"
+ " failed. You have defined a SET NULL condition but "
+ "field %s on index is defined as NOT NULL close to %s\n",
+ operation, create_name, columns[err_col], latest_foreign);
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. You have defined a SET NULL condition but "
+ "field %s on index is defined as NOT NULL close to %s",
+ operation, create_name, columns[err_col], latest_foreign);
+ break;
+ }
+ case DB_FOREIGN_KEY_COLS_NOT_EQUAL: {
+ dict_field_t* field;
+ const char* col_name;
+ field = dict_index_get_nth_field(err_index, err_col);
+
+ col_name = dict_table_get_col_name(
+ table, dict_col_get_no(field->col));
+ fprintf(ef,
+ "%s table %s with foreign key constraint"
+ " failed. Field type or character set for column %s "
+ "does not mach referenced column %s close to %s\n",
+ operation, create_name, columns[err_col], col_name, latest_foreign);
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Field type or character set for column %s "
+ "does not mach referenced column %s close to %s",
+ operation, create_name, columns[err_col], col_name, latest_foreign);
+ break;
+ }
+ default:
+ ut_error;
+ }
+}
+
+/*********************************************************************//**
Scans a table create SQL string and adds to the data dictionary the foreign
key constraints declared in the string. This function should be called after
the indexes for a table have been created. Each foreign key constraint must
@@ -4272,16 +4465,21 @@ dict_create_foreign_constraints_low(
DB_CANNOT_ADD_CONSTRAINT if any foreign
keys are found. */
{
- dict_table_t* table;
- dict_table_t* referenced_table;
- dict_table_t* table_to_alter;
+ dict_table_t* table = NULL;
+ dict_table_t* referenced_table = NULL;
+ dict_table_t* table_to_alter = NULL;
+ dict_table_t* table_to_create = NULL;
ulint highest_id_so_far = 0;
ulint number = 1;
- dict_index_t* index;
- dict_foreign_t* foreign;
+ dict_index_t* index = NULL;
+ dict_foreign_t* foreign = NULL;
const char* ptr = sql_string;
const char* start_of_latest_foreign = sql_string;
+ const char* start_of_latest_set = NULL;
FILE* ef = dict_foreign_err_file;
+ ulint index_error = DB_SUCCESS;
+ dict_index_t* err_index = NULL;
+ ulint err_col;
const char* constraint_name;
ibool success;
dberr_t error;
@@ -4294,37 +4492,80 @@ dict_create_foreign_constraints_low(
ulint n_on_updates;
const dict_col_t*columns[500];
const char* column_names[500];
+ const char* ref_column_names[500];
const char* referenced_table_name;
dict_foreign_set local_fk_set;
dict_foreign_set_free local_fk_set_free(local_fk_set);
+ const char* create_table_name;
+ const char* orig;
+ char create_name[MAX_TABLE_NAME_LEN + 1];
+ char operation[8];
ut_ad(!srv_read_only_mode);
ut_ad(mutex_own(&(dict_sys->mutex)));
table = dict_table_get_low(name);
+ /* First check if we are actually doing an ALTER TABLE, and in that
+ case look for the table being altered */
+ orig = ptr;
+ ptr = dict_accept(cs, ptr, "ALTER", &success);
+
+ strcpy((char *)operation, success ? "Alter " : "Create ");
+
+ if (!success) {
+ orig = ptr;
+ ptr = dict_scan_to(ptr, "CREATE");
+ ptr = dict_scan_to(ptr, "TABLE");
+ ptr = dict_accept(cs, ptr, "TABLE", &success);
+
+ if (success) {
+ ptr = dict_scan_table_name(cs, ptr, &table_to_create, name,
+ &success, heap, &create_table_name);
+ }
+
+ if (success) {
+ char *bufend;
+ bufend = innobase_convert_name((char *)create_name, MAX_TABLE_NAME_LEN,
+ create_table_name, strlen(create_table_name),
+ trx->mysql_thd, TRUE);
+ create_name[bufend-create_name]='\0';
+ ptr = orig;
+ } else {
+ char *bufend;
+ ptr = orig;
+ bufend = innobase_convert_name((char *)create_name, MAX_TABLE_NAME_LEN,
+ name, strlen(name), trx->mysql_thd, TRUE);
+ create_name[bufend-create_name]='\0';
+ }
+
+ goto loop;
+ }
if (table == NULL) {
mutex_enter(&dict_foreign_err_mutex);
- dict_foreign_error_report_low(ef, name);
- fprintf(ef,
- "Cannot find the table in the internal"
- " data dictionary of InnoDB.\n"
- "Create table statement:\n%s\n", sql_string);
+ dict_foreign_error_report_low(ef, create_name);
+ dict_foreign_error_report_low(ef, create_name);
+ fprintf(ef, "%s table %s with foreign key constraint"
+ " failed. Table %s not found from data dictionary."
+ " Error close to %s.\n",
+ operation, create_name, create_name, start_of_latest_foreign);
mutex_exit(&dict_foreign_err_mutex);
+ ib_push_warning(trx, DB_ERROR,
+ "%s table %s with foreign key constraint"
+ " failed. Table %s not found from data dictionary."
+ " Error close to %s.",
+ operation, create_name, create_name, start_of_latest_foreign);
return(DB_ERROR);
}
- /* First check if we are actually doing an ALTER TABLE, and in that
- case look for the table being altered */
-
- ptr = dict_accept(cs, ptr, "ALTER", &success);
-
+ /* If not alter table jump to loop */
if (!success) {
goto loop;
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, "TABLE", &success);
if (!success) {
@@ -4334,13 +4575,40 @@ dict_create_foreign_constraints_low(
/* We are doing an ALTER TABLE: scan the table name we are altering */
+ orig = ptr;
ptr = dict_scan_table_name(cs, ptr, &table_to_alter, name,
&success, heap, &referenced_table_name);
+
+ if (table_to_alter) {
+ char *bufend;
+ bufend = innobase_convert_name((char *)create_name, MAX_TABLE_NAME_LEN,
+ table_to_alter->name, strlen(table_to_alter->name),
+ trx->mysql_thd, TRUE);
+ create_name[bufend-create_name]='\0';
+ } else {
+ char *bufend;
+ bufend = innobase_convert_name((char *)create_name, MAX_TABLE_NAME_LEN,
+ referenced_table_name, strlen(referenced_table_name),
+ trx->mysql_thd, TRUE);
+ create_name[bufend-create_name]='\0';
+
+ }
+
if (!success) {
- fprintf(stderr,
- "InnoDB: Error: could not find"
- " the table being ALTERED in:\n%s\n",
- sql_string);
+ mutex_enter(&dict_foreign_err_mutex);
+ dict_foreign_error_report_low(ef, create_name);
+ fprintf(ef,
+ "%s table %s with foreign key constraint"
+ " failed. Table %s not found from data dictionary."
+ " Error close to %s.\n",
+ operation, create_name, create_name, orig);
+ mutex_exit(&dict_foreign_err_mutex);
+
+ ib_push_warning(trx, DB_ERROR,
+ "%s table %s with foreign key constraint"
+ " failed. Table %s not found from data dictionary."
+ " Error close to %s.",
+ operation, create_name, create_name, orig);
return(DB_ERROR);
}
@@ -4377,6 +4645,7 @@ loop:
of the constraint to system tables. */
ptr = ptr1;
+ orig = ptr;
ptr = dict_accept(cs, ptr, "CONSTRAINT", &success);
ut_a(success);
@@ -4407,6 +4676,19 @@ loop:
if so, immediately reject the command if the table is a
temporary one. For now, this kludge will work. */
if (reject_fks && !local_fk_set.empty()) {
+ mutex_enter(&dict_foreign_err_mutex);
+ dict_foreign_error_report_low(ef, create_name);
+ fprintf(ef, "%s table %s with foreign key constraint"
+ " failed. Temporary tables can't have foreign key constraints."
+ " Error close to %s.\n",
+ operation, create_name, start_of_latest_foreign);
+ mutex_exit(&dict_foreign_err_mutex);
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Temporary tables can't have foreign key constraints."
+ " Error close to %s.",
+ operation, create_name, start_of_latest_foreign);
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -4432,6 +4714,7 @@ loop:
start_of_latest_foreign = ptr;
+ orig = ptr;
ptr = dict_accept(cs, ptr, "FOREIGN", &success);
if (!success) {
@@ -4442,6 +4725,7 @@ loop:
goto loop;
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, "KEY", &success);
if (!success) {
@@ -4467,6 +4751,7 @@ loop:
}
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, "(", &success);
if (!success) {
@@ -4476,8 +4761,17 @@ loop:
ptr = dict_skip_word(cs, ptr, &success);
if (!success) {
dict_foreign_report_syntax_err(
- name, start_of_latest_foreign, ptr);
- return(DB_CANNOT_ADD_CONSTRAINT);
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.\n",
+ operation, create_name, start_of_latest_foreign, orig);
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.",
+ operation, create_name, start_of_latest_foreign, orig);
+ return(DB_CANNOT_ADD_CONSTRAINT);
}
}
else {
@@ -4504,15 +4798,26 @@ loop:
/* Scan the columns in the first list */
col_loop1:
ut_a(i < (sizeof column_names) / sizeof *column_names);
+ orig = ptr;
ptr = dict_scan_col(cs, ptr, &success, table, columns + i,
heap, column_names + i);
if (!success) {
mutex_enter(&dict_foreign_err_mutex);
- dict_foreign_error_report_low(ef, name);
- fprintf(ef, "%s:\nCannot resolve column name close to:\n%s\n",
- start_of_latest_foreign, ptr);
+ dict_foreign_error_report_low(ef, create_name);
+ fprintf(ef,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.\n",
+ operation, create_name, start_of_latest_foreign, orig);
+
mutex_exit(&dict_foreign_err_mutex);
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.",
+ operation, create_name, start_of_latest_foreign, orig);
+
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -4524,11 +4829,22 @@ col_loop1:
goto col_loop1;
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, ")", &success);
if (!success) {
dict_foreign_report_syntax_err(
- name, start_of_latest_foreign, ptr);
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.\n",
+ operation, create_name, start_of_latest_foreign, orig);
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.",
+ operation, create_name, start_of_latest_foreign, orig);
+
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -4539,27 +4855,41 @@ col_loop1:
set to 0 */
index = dict_foreign_find_index(
- table, NULL, column_names, i, NULL, TRUE, FALSE);
+ table, NULL, column_names, i,
+ NULL, TRUE, FALSE, &index_error, &err_col, &err_index);
if (!index) {
mutex_enter(&dict_foreign_err_mutex);
- dict_foreign_error_report_low(ef, name);
+ dict_foreign_error_report_low(ef, create_name);
fputs("There is no index in table ", ef);
- ut_print_name(ef, NULL, TRUE, name);
+ ut_print_name(ef, NULL, TRUE, create_name);
fprintf(ef, " where the columns appear\n"
"as the first columns. Constraint:\n%s\n"
"See " REFMAN "innodb-foreign-key-constraints.html\n"
"for correct foreign key definition.\n",
start_of_latest_foreign);
- mutex_exit(&dict_foreign_err_mutex);
+ dict_foreign_push_index_error(trx, operation, create_name, start_of_latest_foreign,
+ column_names, index_error, err_col, err_index, table, ef);
- return(DB_CHILD_NO_INDEX);
+ mutex_exit(&dict_foreign_err_mutex);
+ return(DB_CANNOT_ADD_CONSTRAINT);
}
+
+ orig = ptr;
ptr = dict_accept(cs, ptr, "REFERENCES", &success);
if (!success || !my_isspace(cs, *ptr)) {
dict_foreign_report_syntax_err(
- name, start_of_latest_foreign, ptr);
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.\n",
+ operation, create_name, start_of_latest_foreign, orig);
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.",
+ operation, create_name, start_of_latest_foreign, orig);
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -4628,21 +4958,46 @@ col_loop1:
checking of foreign key constraints! */
if (!success || (!referenced_table && trx->check_foreigns)) {
+ char buf[MAX_TABLE_NAME_LEN + 1] = "";
+ char* bufend;
+
+ bufend = innobase_convert_name(buf, MAX_TABLE_NAME_LEN,
+ referenced_table_name, strlen(referenced_table_name),
+ trx->mysql_thd, TRUE);
+ buf[bufend - buf] = '\0';
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint failed. Referenced table %s not found in the data dictionary "
+ "close to %s.",
+ operation, create_name, buf, start_of_latest_foreign);
mutex_enter(&dict_foreign_err_mutex);
- dict_foreign_error_report_low(ef, name);
- fprintf(ef, "%s:\nCannot resolve table name close to:\n"
- "%s\n",
- start_of_latest_foreign, ptr);
+ dict_foreign_error_report_low(ef, create_name);
+ fprintf(ef,
+ "%s table %s with foreign key constraint failed. Referenced table %s not found in the data dictionary "
+ "close to %s.\n",
+ operation, create_name, buf, start_of_latest_foreign);
+
mutex_exit(&dict_foreign_err_mutex);
return(DB_CANNOT_ADD_CONSTRAINT);
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, "(", &success);
if (!success) {
- dict_foreign_report_syntax_err(name, start_of_latest_foreign,
- ptr);
+ dict_foreign_report_syntax_err(
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.\n",
+ operation, create_name, start_of_latest_foreign, orig);
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.",
+ operation, create_name, start_of_latest_foreign, orig);
+
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -4650,34 +5005,54 @@ col_loop1:
i = 0;
col_loop2:
+ orig = ptr;
ptr = dict_scan_col(cs, ptr, &success, referenced_table, columns + i,
- heap, column_names + i);
+ heap, ref_column_names + i);
i++;
if (!success) {
mutex_enter(&dict_foreign_err_mutex);
- dict_foreign_error_report_low(ef, name);
- fprintf(ef, "%s:\nCannot resolve column name close to:\n"
- "%s\n",
- start_of_latest_foreign, ptr);
+ dict_foreign_error_report_low(ef, create_name);
+ fprintf(ef,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.\n",
+ operation, create_name, start_of_latest_foreign, orig);
mutex_exit(&dict_foreign_err_mutex);
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.",
+ operation, create_name, start_of_latest_foreign, orig);
return(DB_CANNOT_ADD_CONSTRAINT);
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, ",", &success);
if (success) {
goto col_loop2;
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, ")", &success);
if (!success || foreign->n_fields != i) {
- dict_foreign_report_syntax_err(name, start_of_latest_foreign,
- ptr);
+ dict_foreign_report_syntax_err(
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s. Too few referenced columns.\n",
+ operation, create_name, start_of_latest_foreign, orig);
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s. Too few referenced columns, you have %d when you should have %d.",
+ operation, create_name, start_of_latest_foreign, orig, i, foreign->n_fields);
+
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -4687,6 +5062,7 @@ col_loop2:
scan_on_conditions:
/* Loop here as long as we can find ON ... conditions */
+ start_of_latest_set = ptr;
ptr = dict_accept(cs, ptr, "ON", &success);
if (!success) {
@@ -4694,15 +5070,27 @@ scan_on_conditions:
goto try_find_index;
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, "DELETE", &success);
if (!success) {
+ orig = ptr;
ptr = dict_accept(cs, ptr, "UPDATE", &success);
if (!success) {
dict_foreign_report_syntax_err(
- name, start_of_latest_foreign, ptr);
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.\n",
+ operation, create_name, start_of_latest_foreign, start_of_latest_set);
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.",
+ operation, create_name, start_of_latest_foreign, start_of_latest_set);
+
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -4713,12 +5101,14 @@ scan_on_conditions:
n_on_deletes++;
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, "RESTRICT", &success);
if (success) {
goto scan_on_conditions;
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, "CASCADE", &success);
if (success) {
@@ -4731,14 +5121,25 @@ scan_on_conditions:
goto scan_on_conditions;
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, "NO", &success);
if (success) {
+ orig = ptr;
ptr = dict_accept(cs, ptr, "ACTION", &success);
if (!success) {
dict_foreign_report_syntax_err(
- name, start_of_latest_foreign, ptr);
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.\n",
+ operation, create_name, start_of_latest_foreign, start_of_latest_set);
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.",
+ operation, create_name, start_of_latest_foreign, start_of_latest_set);
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -4752,38 +5153,69 @@ scan_on_conditions:
goto scan_on_conditions;
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, "SET", &success);
if (!success) {
- dict_foreign_report_syntax_err(name, start_of_latest_foreign,
- ptr);
+ dict_foreign_report_syntax_err(
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.\n",
+ operation, create_name, start_of_latest_foreign, start_of_latest_set);
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.",
+ operation, create_name, start_of_latest_foreign, start_of_latest_set);
return(DB_CANNOT_ADD_CONSTRAINT);
}
+ orig = ptr;
ptr = dict_accept(cs, ptr, "NULL", &success);
if (!success) {
- dict_foreign_report_syntax_err(name, start_of_latest_foreign,
- ptr);
+ dict_foreign_report_syntax_err(
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.\n",
+ operation, create_name, start_of_latest_foreign, start_of_latest_set);
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. Foreign key constraint parse error in %s"
+ " close to %s.",
+ operation, create_name, start_of_latest_foreign, start_of_latest_set);
+
return(DB_CANNOT_ADD_CONSTRAINT);
}
for (j = 0; j < foreign->n_fields; j++) {
if ((dict_index_get_nth_col(foreign->foreign_index, j)->prtype)
& DATA_NOT_NULL) {
+ const dict_col_t* col
+ = dict_index_get_nth_col(foreign->foreign_index, j);
+ const char* col_name = dict_table_get_col_name(foreign->foreign_index->table,
+ dict_col_get_no(col));
/* It is not sensible to define SET NULL
if the column is not allowed to be NULL! */
mutex_enter(&dict_foreign_err_mutex);
- dict_foreign_error_report_low(ef, name);
- fprintf(ef, "%s:\n"
- "You have defined a SET NULL condition"
- " though some of the\n"
- "columns are defined as NOT NULL.\n",
- start_of_latest_foreign);
+ dict_foreign_error_report_low(ef, create_name);
+ fprintf(ef,
+ "%s table %s with foreign key constraint"
+ " failed. You have defined a SET NULL condition but column %s is defined as NOT NULL"
+ " in %s close to %s.\n",
+ operation, create_name, col_name, start_of_latest_foreign, start_of_latest_set);
mutex_exit(&dict_foreign_err_mutex);
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. You have defined a SET NULL condition but column %s is defined as NOT NULL"
+ " in %s close to %s.",
+ operation, create_name, col_name, start_of_latest_foreign, start_of_latest_set);
+
return(DB_CANNOT_ADD_CONSTRAINT);
}
}
@@ -4801,11 +5233,20 @@ try_find_index:
/* It is an error to define more than 1 action */
mutex_enter(&dict_foreign_err_mutex);
- dict_foreign_error_report_low(ef, name);
- fprintf(ef, "%s:\n"
- "You have twice an ON DELETE clause"
- " or twice an ON UPDATE clause.\n",
- start_of_latest_foreign);
+ dict_foreign_error_report_low(ef, create_name);
+ fprintf(ef,
+ "%s table %s with foreign key constraint"
+ " failed. You have more than one on delete or on update clause"
+ " in %s close to %s.\n",
+ operation, create_name, start_of_latest_foreign, start_of_latest_set);
+
+ ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
+ "%s table %s with foreign key constraint"
+ " failed. You have more than one on delete or on update clause"
+ " in %s close to %s.",
+ operation, create_name, start_of_latest_foreign, start_of_latest_set);
+
+ dict_foreign_free(foreign);
mutex_exit(&dict_foreign_err_mutex);
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4817,12 +5258,12 @@ try_find_index:
if (referenced_table) {
index = dict_foreign_find_index(referenced_table, NULL,
- column_names, i,
+ ref_column_names, i,
foreign->foreign_index,
- TRUE, FALSE);
+ TRUE, FALSE, &index_error, &err_col, &err_index);
if (!index) {
mutex_enter(&dict_foreign_err_mutex);
- dict_foreign_error_report_low(ef, name);
+ dict_foreign_error_report_low(ef, create_name);
fprintf(ef, "%s:\n"
"Cannot find an index in the"
" referenced table where the\n"
@@ -4840,9 +5281,13 @@ try_find_index:
"innodb-foreign-key-constraints.html\n"
"for correct foreign key definition.\n",
start_of_latest_foreign);
+
+ dict_foreign_push_index_error(trx, operation, create_name, start_of_latest_foreign,
+ column_names, index_error, err_col, err_index, referenced_table, ef);
+
mutex_exit(&dict_foreign_err_mutex);
- return(DB_PARENT_NO_INDEX);
+ return(DB_CANNOT_ADD_CONSTRAINT);
}
} else {
ut_a(trx->check_foreigns == FALSE);
@@ -4861,11 +5306,12 @@ try_find_index:
for (i = 0; i < foreign->n_fields; i++) {
foreign->referenced_col_names[i]
- = mem_heap_strdup(foreign->heap, column_names[i]);
+ = mem_heap_strdup(foreign->heap, ref_column_names[i]);
}
goto loop;
}
+
/**************************************************************************
Determines whether a string starts with the specified keyword.
@return TRUE if str starts with keyword */
@@ -5945,8 +6391,7 @@ dict_ind_init(void)
dict_table_t* table;
/* create dummy table and index for REDUNDANT infimum and supremum */
- table = dict_mem_table_create("SYS_DUMMY1", DICT_HDR_SPACE, 1, 0, 0,
- true);
+ table = dict_mem_table_create("SYS_DUMMY1", DICT_HDR_SPACE, 1, 0, 0);
dict_mem_table_add_col(table, NULL, NULL, DATA_CHAR,
DATA_ENGLISH | DATA_NOT_NULL, 8);
@@ -5959,7 +6404,7 @@ dict_ind_init(void)
/* create dummy table and index for COMPACT infimum and supremum */
table = dict_mem_table_create("SYS_DUMMY2",
DICT_HDR_SPACE, 1,
- DICT_TF_COMPACT, 0, true);
+ DICT_TF_COMPACT, 0);
dict_mem_table_add_col(table, NULL, NULL, DATA_CHAR,
DATA_ENGLISH | DATA_NOT_NULL, 8);
dict_ind_compact = dict_mem_index_create("SYS_DUMMY2", "SYS_DUMMY2",
@@ -6056,7 +6501,8 @@ dict_foreign_replace_index(
foreign->foreign_table, col_names,
foreign->foreign_col_names,
foreign->n_fields, index,
- /*check_charsets=*/TRUE, /*check_null=*/FALSE);
+ /*check_charsets=*/TRUE, /*check_null=*/FALSE,
+ NULL, NULL, NULL);
if (new_index) {
ut_ad(new_index->table == index->table);
ut_ad(!new_index->to_be_dropped);
@@ -6080,7 +6526,8 @@ dict_foreign_replace_index(
foreign->referenced_table, NULL,
foreign->referenced_col_names,
foreign->n_fields, index,
- /*check_charsets=*/TRUE, /*check_null=*/FALSE);
+ /*check_charsets=*/TRUE, /*check_null=*/FALSE,
+ NULL, NULL, NULL);
/* There must exist an alternative index,
since this must have been checked earlier. */
if (new_index) {
@@ -6641,10 +7088,15 @@ dict_foreign_qualify_index(
/*!< in: whether to check
charsets. only has an effect
if types_idx != NULL */
- ulint check_null)
+ ulint check_null,
/*!< in: nonzero if none of
the columns must be declared
NOT NULL */
+ ulint* error, /*!< out: error code */
+ ulint* err_col_no,
+ /*!< out: column number where error happened */
+ dict_index_t** err_index)
+ /*!< out: index where error happened */
{
if (dict_index_get_n_fields(index) < n_cols) {
return(false);
@@ -6661,11 +7113,21 @@ dict_foreign_qualify_index(
if (field->prefix_len != 0) {
/* We do not accept column prefix
indexes here */
+ if (error && err_col_no && err_index) {
+ *error = DB_FOREIGN_KEY_IS_PREFIX_INDEX;
+ *err_col_no = i;
+ *err_index = (dict_index_t*)index;
+ }
return(false);
}
if (check_null
&& (field->col->prtype & DATA_NOT_NULL)) {
+ if (error && err_col_no && err_index) {
+ *error = DB_FOREIGN_KEY_COL_NOT_NULL;
+ *err_col_no = i;
+ *err_index = (dict_index_t*)index;
+ }
return(false);
}
@@ -6681,6 +7143,12 @@ dict_foreign_qualify_index(
dict_index_get_nth_col(index, i),
dict_index_get_nth_col(types_idx, i),
check_charsets)) {
+ if (error && err_col_no && err_index) {
+ *error = DB_FOREIGN_KEY_COLS_NOT_EQUAL;
+ *err_col_no = i;
+ *err_index = (dict_index_t*)index;
+ }
+
return(false);
}
}
@@ -6795,10 +7263,10 @@ dict_index_zip_success(
return;
}
- os_fast_mutex_lock(&index->zip_pad.mutex);
+ dict_index_zip_pad_lock(index);
++index->zip_pad.success;
dict_index_zip_pad_update(&index->zip_pad, zip_threshold);
- os_fast_mutex_unlock(&index->zip_pad.mutex);
+ dict_index_zip_pad_unlock(index);
}
/*********************************************************************//**
@@ -6818,10 +7286,10 @@ dict_index_zip_failure(
return;
}
- os_fast_mutex_lock(&index->zip_pad.mutex);
+ dict_index_zip_pad_lock(index);
++index->zip_pad.failure;
dict_index_zip_pad_update(&index->zip_pad, zip_threshold);
- os_fast_mutex_unlock(&index->zip_pad.mutex);
+ dict_index_zip_pad_unlock(index);
}
@@ -6853,9 +7321,9 @@ dict_index_zip_pad_optimal_page_size(
#ifdef HAVE_ATOMIC_BUILTINS
pad = os_atomic_increment_ulint(&index->zip_pad.pad, 0);
#else /* HAVE_ATOMIC_BUILTINS */
- os_fast_mutex_lock(&index->zip_pad.mutex);
+ dict_index_zip_pad_lock(index);
pad = index->zip_pad.pad;
- os_fast_mutex_unlock(&index->zip_pad.mutex);
+ dict_index_zip_pad_unlock(index);
#endif /* HAVE_ATOMIC_BUILTINS */
ut_ad(pad < UNIV_PAGE_SIZE);
diff --git a/storage/xtradb/dict/dict0load.cc b/storage/xtradb/dict/dict0load.cc
index fb33c31ff92..d6ed8acb39e 100644
--- a/storage/xtradb/dict/dict0load.cc
+++ b/storage/xtradb/dict/dict0load.cc
@@ -1168,7 +1168,7 @@ loop:
dberr_t err = fil_open_single_table_tablespace(
read_page_0, srv_read_only_mode ? false : true,
space_id, dict_tf_to_fsp_flags(flags),
- name, filepath);
+ name, filepath, NULL);
if (err != DB_SUCCESS) {
ib_logf(IB_LOG_LEVEL_ERROR,
@@ -2182,8 +2182,7 @@ err_len:
/* See if the tablespace is available. */
*table = dict_mem_table_create(
- name, space, n_cols & ~DICT_N_COLS_COMPACT, flags, flags2,
- false);
+ name, space, n_cols & ~DICT_N_COLS_COMPACT, flags, flags2);
field = rec_get_nth_field_old(rec, DICT_FLD__SYS_TABLES__ID, &len);
ut_ad(len == 8); /* this was checked earlier */
@@ -2414,7 +2413,7 @@ err_exit:
err = fil_open_single_table_tablespace(
true, false, table->space,
dict_tf_to_fsp_flags(table->flags),
- name, filepath);
+ name, filepath, table);
if (err != DB_SUCCESS) {
/* We failed to find a sensible
diff --git a/storage/xtradb/dict/dict0mem.cc b/storage/xtradb/dict/dict0mem.cc
index 43ccbdd5fe7..a4f6cd6c91f 100644
--- a/storage/xtradb/dict/dict0mem.cc
+++ b/storage/xtradb/dict/dict0mem.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
This program is free software; you can redistribute it and/or modify it under
@@ -79,10 +79,7 @@ dict_mem_table_create(
the table is placed */
ulint n_cols, /*!< in: number of columns */
ulint flags, /*!< in: table flags */
- ulint flags2, /*!< in: table flags2 */
- bool nonshared)/*!< in: whether the table object is a dummy
- one that does not need the initialization of
- locking-related fields. */
+ ulint flags2) /*!< in: table flags2 */
{
dict_table_t* table;
mem_heap_t* heap;
@@ -118,18 +115,10 @@ dict_mem_table_create(
dict_table_stats_latch_create(table, true);
#ifndef UNIV_HOTBACKUP
+ table->autoinc_lock = static_cast<ib_lock_t*>(
+ mem_heap_alloc(heap, lock_get_size()));
- if (!nonshared) {
-
- table->autoinc_lock = static_cast<ib_lock_t*>(
- mem_heap_alloc(heap, lock_get_size()));
-
- mutex_create(autoinc_mutex_key,
- &table->autoinc_mutex, SYNC_DICT_AUTOINC_MUTEX);
- } else {
-
- table->autoinc_lock = NULL;
- }
+ dict_table_autoinc_create_lazy(table);
table->autoinc = 0;
@@ -212,10 +201,7 @@ dict_mem_table_free(
}
}
#ifndef UNIV_HOTBACKUP
- if (table->autoinc_lock) {
-
- mutex_free(&(table->autoinc_mutex));
- }
+ dict_table_autoinc_destroy(table);
#endif /* UNIV_HOTBACKUP */
dict_table_stats_latch_destroy(table);
@@ -434,7 +420,8 @@ dict_mem_table_col_rename_low(
dict_index_t* new_index = dict_foreign_find_index(
foreign->foreign_table, NULL,
foreign->foreign_col_names,
- foreign->n_fields, NULL, true, false);
+ foreign->n_fields, NULL, true, false,
+ NULL, NULL, NULL);
/* There must be an equivalent index in this case. */
ut_ad(new_index != NULL);
@@ -580,8 +567,7 @@ dict_mem_index_create(
dict_mem_fill_index_struct(index, heap, table_name, index_name,
space, type, n_fields);
- os_fast_mutex_init(zip_pad_mutex_key, &index->zip_pad.mutex);
-
+ dict_index_zip_pad_mutex_create_lazy(index);
return(index);
}
@@ -714,7 +700,7 @@ dict_mem_index_free(
}
#endif /* UNIV_BLOB_DEBUG */
- os_fast_mutex_free(&index->zip_pad.mutex);
+ dict_index_zip_pad_mutex_destroy(index);
mem_heap_free(index->heap);
}
diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc
index dcb71c2bf56..18f8983d79c 100644
--- a/storage/xtradb/fil/fil0crypt.cc
+++ b/storage/xtradb/fil/fil0crypt.cc
@@ -222,6 +222,7 @@ fil_space_create_crypt_data(
my_random_bytes(crypt_data->iv, sizeof(crypt_data->iv));
crypt_data->encryption = encrypt_mode;
crypt_data->key_id = key_id;
+ crypt_data->inited = true;
return crypt_data;
}
@@ -243,13 +244,11 @@ fil_space_merge_crypt_data(
ut_a(dst->type == CRYPT_SCHEME_UNENCRYPTED ||
dst->type == CRYPT_SCHEME_1);
- /* no support for changing iv (yet?) */
- ut_a(memcmp(src->iv, dst->iv, sizeof(src->iv)) == 0);
-
dst->encryption = src->encryption;
dst->type = src->type;
dst->min_key_version = src->min_key_version;
dst->keyserver_requests += src->keyserver_requests;
+ dst->inited = src->inited;
mutex_exit(&dst->mutex);
}
@@ -271,6 +270,7 @@ fil_space_read_crypt_data(
}
if (memcmp(page + offset, CRYPT_MAGIC, MAGIC_SZ) != 0) {
+#ifdef UNIV_DEBUG
ib_logf(IB_LOG_LEVEL_WARN,
"Found potentially bogus bytes on "
"page 0 offset %lu for space %lu : "
@@ -283,6 +283,7 @@ fil_space_read_crypt_data(
page[offset + 3],
page[offset + 4],
page[offset + 5]);
+#endif
/* Crypt data is not stored. */
return NULL;
}
@@ -345,6 +346,7 @@ fil_space_read_crypt_data(
mutex_create(fil_crypt_data_mutex_key,
&crypt_data->mutex, SYNC_NO_ORDER_CHECK);
crypt_data->locker = crypt_data_scheme_locker;
+ crypt_data->inited = true;
memcpy(crypt_data->iv, page + offset + MAGIC_SZ + 2, iv_length);
return crypt_data;
@@ -359,7 +361,14 @@ fil_space_destroy_crypt_data(
fil_space_crypt_t **crypt_data) /*!< out: crypt data */
{
if (crypt_data != NULL && (*crypt_data) != NULL) {
+ /* Make sure that this thread owns the crypt_data
+ and make it unawailable, this does not fully
+ avoid the race between drop table and crypt thread */
+ mutex_enter(&(*crypt_data)->mutex);
+ (*crypt_data)->inited = false;
+ mutex_exit(&(*crypt_data)->mutex);
mutex_free(& (*crypt_data)->mutex);
+ memset(*crypt_data, 0, sizeof(fil_space_crypt_t));
free(*crypt_data);
(*crypt_data) = NULL;
}
@@ -543,46 +552,22 @@ fil_space_clear_crypt_data(
}
/******************************************************************
-Encrypt a page */
+Encrypt a buffer */
UNIV_INTERN
-void
-fil_space_encrypt(
-/*==============*/
+byte*
+fil_encrypt_buf(
+/*============*/
+ fil_space_crypt_t* crypt_data, /*!< in: crypt data */
ulint space, /*!< in: Space id */
ulint offset, /*!< in: Page offset */
lsn_t lsn, /*!< in: lsn */
- const byte* src_frame, /*!< in: Source page to be encrypted */
+ byte* src_frame, /*!< in: Source page to be encrypted */
ulint zip_size, /*!< in: compressed size if
- row_format compressed */
+ row format compressed */
byte* dst_frame) /*!< in: outbut buffer */
{
- fil_space_crypt_t* crypt_data = NULL;
ulint page_size = (zip_size) ? zip_size : UNIV_PAGE_SIZE;
- uint key_version;
-
- ulint orig_page_type = mach_read_from_2(src_frame+FIL_PAGE_TYPE);
-
- if (orig_page_type==FIL_PAGE_TYPE_FSP_HDR
- || orig_page_type==FIL_PAGE_TYPE_XDES) {
- /* File space header or extent descriptor do not need to be
- encrypted. */
- //TODO: is this really needed ?
- memcpy(dst_frame, src_frame, page_size);
- return;
- }
-
- /* Get crypt data from file space */
- crypt_data = fil_space_get_crypt_data(space);
-
- if (crypt_data == NULL) {
- //TODO: Is this really needed ?
- memcpy(dst_frame, src_frame, page_size);
- return;
- }
-
- ut_ad(crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF);
-
- key_version = fil_crypt_get_latest_key_version(crypt_data);
+ uint key_version = fil_crypt_get_latest_key_version(crypt_data);
if (key_version == ENCRYPTION_KEY_VERSION_INVALID) {
ib_logf(IB_LOG_LEVEL_FATAL,
@@ -591,21 +576,31 @@ fil_space_encrypt(
ut_error;
}
+ ulint orig_page_type = mach_read_from_2(src_frame+FIL_PAGE_TYPE);
ibool page_compressed = (orig_page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
+ ulint header_len = FIL_PAGE_DATA;
+
+ if (page_compressed) {
+ header_len += (FIL_PAGE_COMPRESSED_SIZE + FIL_PAGE_COMPRESSION_METHOD_SIZE);
+ }
/* FIL page header is not encrypted */
- memcpy(dst_frame, src_frame, FIL_PAGE_DATA);
+ memcpy(dst_frame, src_frame, header_len);
/* Store key version */
mach_write_to_4(dst_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, key_version);
/* Calculate the start offset in a page */
- ulint unencrypted_bytes = FIL_PAGE_DATA + FIL_PAGE_DATA_END;
+ ulint unencrypted_bytes = header_len + FIL_PAGE_DATA_END;
ulint srclen = page_size - unencrypted_bytes;
- const byte* src = src_frame + FIL_PAGE_DATA;
- byte* dst = dst_frame + FIL_PAGE_DATA;
+ const byte* src = src_frame + header_len;
+ byte* dst = dst_frame + header_len;
uint32 dstlen = 0;
+ if (page_compressed) {
+ srclen = mach_read_from_2(src_frame + FIL_PAGE_DATA);
+ }
+
int rc = encryption_scheme_encrypt(src, srclen, dst, &dstlen,
crypt_data, key_version,
space, offset, lsn);
@@ -633,36 +628,54 @@ fil_space_encrypt(
/* handle post encryption checksum */
ib_uint32_t checksum = 0;
- srv_checksum_algorithm_t algorithm =
- static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
- if (zip_size == 0) {
- switch (algorithm) {
- case SRV_CHECKSUM_ALGORITHM_CRC32:
- case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
- checksum = buf_calc_page_crc32(dst_frame);
- break;
- case SRV_CHECKSUM_ALGORITHM_INNODB:
- case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
- checksum = (ib_uint32_t) buf_calc_page_new_checksum(
- dst_frame);
- break;
- case SRV_CHECKSUM_ALGORITHM_NONE:
- case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
- checksum = BUF_NO_CHECKSUM_MAGIC;
- break;
- /* no default so the compiler will emit a warning
- * if new enum is added and not handled here */
- }
- } else {
- checksum = page_zip_calc_checksum(dst_frame, zip_size,
- algorithm);
- }
+ checksum = fil_crypt_calculate_checksum(zip_size, dst_frame);
// store the post-encryption checksum after the key-version
mach_write_to_4(dst_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4, checksum);
srv_stats.pages_encrypted.inc();
+
+ return dst_frame;
+}
+
+/******************************************************************
+Encrypt a page */
+UNIV_INTERN
+byte*
+fil_space_encrypt(
+/*==============*/
+ ulint space, /*!< in: Space id */
+ ulint offset, /*!< in: Page offset */
+ lsn_t lsn, /*!< in: lsn */
+ byte* src_frame, /*!< in: Source page to be encrypted */
+ ulint zip_size, /*!< in: compressed size if
+ row_format compressed */
+ byte* dst_frame) /*!< in: outbut buffer */
+{
+ fil_space_crypt_t* crypt_data = NULL;
+
+ ulint orig_page_type = mach_read_from_2(src_frame+FIL_PAGE_TYPE);
+
+ if (orig_page_type==FIL_PAGE_TYPE_FSP_HDR
+ || orig_page_type==FIL_PAGE_TYPE_XDES) {
+ /* File space header or extent descriptor do not need to be
+ encrypted. */
+ return src_frame;
+ }
+
+ /* Get crypt data from file space */
+ crypt_data = fil_space_get_crypt_data(space);
+
+ if (crypt_data == NULL) {
+ return src_frame;
+ }
+
+ ut_ad(crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF);
+
+ byte* tmp = fil_encrypt_buf(crypt_data, space, offset, lsn, src_frame, zip_size, dst_frame);
+
+ return tmp;
}
/*********************************************************************
@@ -693,24 +706,26 @@ fil_space_check_encryption_read(
/******************************************************************
Decrypt a page
-@return true if page was encrypted */
+@return true if page decrypted, false if not.*/
UNIV_INTERN
bool
fil_space_decrypt(
/*==============*/
fil_space_crypt_t* crypt_data, /*!< in: crypt data */
- const byte* src_frame, /*!< in: input buffer */
+ byte* tmp_frame, /*!< in: temporary buffer */
ulint page_size, /*!< in: page size */
- byte* dst_frame) /*!< out: output buffer */
+ byte* src_frame, /*!< in: out: page buffer */
+ dberr_t* err) /*!< in: out: DB_SUCCESS or
+ error code */
{
ulint page_type = mach_read_from_2(src_frame+FIL_PAGE_TYPE);
uint key_version = mach_read_from_4(src_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
bool page_compressed = (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
+ *err = DB_SUCCESS;
+
if (key_version == ENCRYPTION_KEY_NOT_ENCRYPTED) {
- //TODO: is this really needed ?
- memcpy(dst_frame, src_frame, page_size);
- return false; /* page not decrypted */
+ return false;
}
ut_ad(crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF);
@@ -721,21 +736,36 @@ fil_space_decrypt(
ulint offset = mach_read_from_4(
src_frame + FIL_PAGE_OFFSET);
ib_uint64_t lsn = mach_read_from_8(src_frame + FIL_PAGE_LSN);
+ ulint header_len = FIL_PAGE_DATA;
+
+ if (page_compressed) {
+ header_len += (FIL_PAGE_COMPRESSED_SIZE + FIL_PAGE_COMPRESSION_METHOD_SIZE);
+ }
/* Copy FIL page header, it is not encrypted */
- memcpy(dst_frame, src_frame, FIL_PAGE_DATA);
+ memcpy(tmp_frame, src_frame, header_len);
/* Calculate the offset where decryption starts */
- const byte* src = src_frame + FIL_PAGE_DATA;
- byte* dst = dst_frame + FIL_PAGE_DATA;
+ const byte* src = src_frame + header_len;
+ byte* dst = tmp_frame + header_len;
uint32 dstlen = 0;
- ulint srclen = page_size - (FIL_PAGE_DATA + FIL_PAGE_DATA_END);
+ ulint srclen = page_size - (header_len + FIL_PAGE_DATA_END);
+
+ if (page_compressed) {
+ srclen = mach_read_from_2(src_frame + FIL_PAGE_DATA);
+ }
int rc = encryption_scheme_decrypt(src, srclen, dst, &dstlen,
crypt_data, key_version,
space, offset, lsn);
if (! ((rc == MY_AES_OK) && ((ulint) dstlen == srclen))) {
+
+ if (rc == -1) {
+ *err = DB_DECRYPTION_FAILED;
+ return false;
+ }
+
ib_logf(IB_LOG_LEVEL_FATAL,
"Unable to decrypt data-block "
" src: %p srclen: %ld buf: %p buflen: %d."
@@ -751,12 +781,12 @@ fil_space_decrypt(
to sector boundary is written. */
if (!page_compressed) {
/* Copy FIL trailer */
- memcpy(dst_frame + page_size - FIL_PAGE_DATA_END,
+ memcpy(tmp_frame + page_size - FIL_PAGE_DATA_END,
src_frame + page_size - FIL_PAGE_DATA_END,
FIL_PAGE_DATA_END);
// clear key-version & crypt-checksum from dst
- memset(dst_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, 0, 8);
+ memset(tmp_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, 0, 8);
}
srv_stats.pages_decrypted.inc();
@@ -765,18 +795,75 @@ fil_space_decrypt(
}
/******************************************************************
-Decrypt a page */
+Decrypt a page
+@return encrypted page, or original not encrypted page if encryption is
+not needed. */
UNIV_INTERN
-void
+byte*
fil_space_decrypt(
/*==============*/
ulint space, /*!< in: Fil space id */
- const byte* src_frame, /*!< in: input buffer */
+ byte* tmp_frame, /*!< in: temporary buffer */
ulint page_size, /*!< in: page size */
- byte* dst_frame) /*!< out: output buffer */
+ byte* src_frame) /*!< in/out: page buffer */
{
- fil_space_decrypt(fil_space_get_crypt_data(space),
- src_frame, page_size, dst_frame);
+ dberr_t err = DB_SUCCESS;
+
+ bool encrypted = fil_space_decrypt(
+ fil_space_get_crypt_data(space),
+ tmp_frame,
+ page_size,
+ src_frame,
+ &err);
+
+ if (encrypted) {
+ /* Copy the decrypted page back to page buffer, not
+ really any other options. */
+ memcpy(src_frame, tmp_frame, page_size);
+ }
+
+ return src_frame;
+}
+
+/******************************************************************
+Calculate post encryption checksum
+@return page checksum or BUF_NO_CHECKSUM_MAGIC
+not needed. */
+UNIV_INTERN
+ulint
+fil_crypt_calculate_checksum(
+/*=========================*/
+ ulint zip_size, /*!< in: zip_size or 0 */
+ byte* dst_frame) /*!< in: page where to calculate */
+{
+ ib_uint32_t checksum = 0;
+ srv_checksum_algorithm_t algorithm =
+ static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
+
+ if (zip_size == 0) {
+ switch (algorithm) {
+ case SRV_CHECKSUM_ALGORITHM_CRC32:
+ case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
+ checksum = buf_calc_page_crc32(dst_frame);
+ break;
+ case SRV_CHECKSUM_ALGORITHM_INNODB:
+ case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
+ checksum = (ib_uint32_t) buf_calc_page_new_checksum(
+ dst_frame);
+ break;
+ case SRV_CHECKSUM_ALGORITHM_NONE:
+ case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
+ checksum = BUF_NO_CHECKSUM_MAGIC;
+ break;
+ /* no default so the compiler will emit a warning
+ * if new enum is added and not handled here */
+ }
+ } else {
+ checksum = page_zip_calc_checksum(dst_frame, zip_size,
+ algorithm);
+ }
+
+ return checksum;
}
/*********************************************************************
@@ -2016,7 +2103,7 @@ fil_crypt_complete_rotate_space(
fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space);
/* Space might already be dropped */
- if (crypt_data) {
+ if (crypt_data != NULL && crypt_data->inited) {
mutex_enter(&crypt_data->mutex);
/**
@@ -2208,7 +2295,7 @@ fil_crypt_set_thread_cnt(
os_thread_id_t rotation_thread_id;
os_thread_create(fil_crypt_thread, NULL, &rotation_thread_id);
ib_logf(IB_LOG_LEVEL_INFO,
- "Creating #%d thread id %lu total threads %u\n",
+ "Creating #%d thread id %lu total threads %u.",
i+1, os_thread_pf(rotation_thread_id), new_cnt);
}
} else if (new_cnt < srv_n_fil_crypt_threads) {
@@ -2273,6 +2360,7 @@ fil_crypt_threads_init()
uint cnt = srv_n_fil_crypt_threads;
srv_n_fil_crypt_threads = 0;
fil_crypt_set_thread_cnt(cnt);
+ fil_crypt_threads_inited = true;
}
/*********************************************************************
@@ -2340,7 +2428,7 @@ fil_space_crypt_close_tablespace(
fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space);
- if (crypt_data == NULL) {
+ if (crypt_data == NULL || !crypt_data->inited) {
mutex_exit(&fil_crypt_threads_mutex);
return;
}
diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc
index 11fb999d529..dde309f4234 100644
--- a/storage/xtradb/fil/fil0fil.cc
+++ b/storage/xtradb/fil/fil0fil.cc
@@ -460,7 +460,7 @@ fil_space_get_latch(
/*******************************************************************//**
Returns the type of a file space.
-@return FIL_TABLESPACE or FIL_LOG */
+@return ULINT_UNDEFINED, or FIL_TABLESPACE or FIL_LOG */
UNIV_INTERN
ulint
fil_space_get_type(
@@ -468,6 +468,7 @@ fil_space_get_type(
ulint id) /*!< in: space id */
{
fil_space_t* space;
+ ulint type = ULINT_UNDEFINED;
ut_ad(fil_system);
@@ -475,11 +476,13 @@ fil_space_get_type(
space = fil_space_get_by_id(id);
- ut_a(space);
-
mutex_exit(&fil_system->mutex);
- return(space->purpose);
+ if (space) {
+ type = space->purpose;
+ }
+
+ return(type);
}
#endif /* !UNIV_HOTBACKUP */
@@ -2012,8 +2015,6 @@ fil_read_first_page(
lsn values in data files */
lsn_t* max_flushed_lsn, /*!< out: max of flushed
lsn values in data files */
- ulint orig_space_id, /*!< in: original file space
- id */
fil_space_crypt_t** crypt_data) /*< out: crypt data */
{
byte* buf;
@@ -2022,6 +2023,7 @@ fil_read_first_page(
const char* check_msg = NULL;
fil_space_crypt_t* cdata;
+
buf = static_cast<byte*>(ut_malloc(2 * UNIV_PAGE_SIZE));
/* Align the memory for a possible read from a raw device */
@@ -2052,6 +2054,10 @@ fil_read_first_page(
fsp_flags_get_zip_size(*flags), NULL);
cdata = fil_space_read_crypt_data(space, page, offset);
+ if (crypt_data) {
+ *crypt_data = cdata;
+ }
+
/* If file space is encrypted we need to have at least some
encryption service available where to get keys */
if ((cdata && cdata->encryption == FIL_SPACE_ENCRYPTION_ON) ||
@@ -2059,16 +2065,14 @@ fil_read_first_page(
cdata && cdata->encryption == FIL_SPACE_ENCRYPTION_DEFAULT)) {
if (!encryption_key_id_exists(cdata->key_id)) {
- ib_logf(IB_LOG_LEVEL_FATAL,
- "Tablespace id %ld encrypted but encryption service"
- " not available. Can't continue opening tablespace.\n",
- space);
- ut_error;
- }
- }
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Tablespace id %ld is encrypted but encryption service"
+ " or used key_id %u is not available. Can't continue opening tablespace.",
+ space, cdata->key_id);
- if (crypt_data) {
- *crypt_data = cdata;
+ return ("table encrypted but encryption service not available.");
+
+ }
}
ut_free(buf);
@@ -2425,7 +2429,9 @@ fil_op_log_parse_or_replay(
if (fil_create_new_single_table_tablespace(
space_id, name, path, flags,
DICT_TF2_USE_TABLESPACE,
- FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
+ FIL_IBD_FILE_INITIAL_SIZE,
+ FIL_SPACE_ENCRYPTION_DEFAULT,
+ FIL_DEFAULT_ENCRYPTION_KEY) != DB_SUCCESS) {
ut_error;
}
}
@@ -3364,9 +3370,11 @@ fil_create_new_single_table_tablespace(
const char* dir_path, /*!< in: NULL or a dir path */
ulint flags, /*!< in: tablespace flags */
ulint flags2, /*!< in: table flags2 */
- ulint size) /*!< in: the initial size of the
+ ulint size, /*!< in: the initial size of the
tablespace file in pages,
must be >= FIL_IBD_FILE_INITIAL_SIZE */
+ fil_encryption_t mode, /*!< in: encryption mode */
+ ulint key_id) /*!< in: encryption key_id */
{
os_file_t file;
ibool ret;
@@ -3533,7 +3541,7 @@ fil_create_new_single_table_tablespace(
}
success = fil_space_create(tablename, space_id, flags, FIL_TABLESPACE,
- fil_space_create_crypt_data(FIL_SPACE_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY));
+ fil_space_create_crypt_data(mode, key_id));
if (!success || !fil_node_create(path, size, space_id, FALSE)) {
err = DB_ERROR;
@@ -3650,7 +3658,8 @@ fil_open_single_table_tablespace(
ulint flags, /*!< in: tablespace flags */
const char* tablename, /*!< in: table name in the
databasename/tablename format */
- const char* path_in) /*!< in: tablespace filepath */
+ const char* path_in, /*!< in: tablespace filepath */
+ dict_table_t* table) /*!< in: table */
{
dberr_t err = DB_SUCCESS;
bool dict_filepath_same_as_default = false;
@@ -3761,9 +3770,13 @@ fil_open_single_table_tablespace(
if (def.success) {
def.check_msg = fil_read_first_page(
def.file, FALSE, &def.flags, &def.id,
- &def.lsn, &def.lsn, id, &def.crypt_data);
+ &def.lsn, &def.lsn, &def.crypt_data);
def.valid = !def.check_msg;
+ if (table) {
+ table->crypt_data = def.crypt_data;
+ }
+
/* Validate this single-table-tablespace with SYS_TABLES,
but do not compare the DATA_DIR flag, in case the
tablespace was relocated. */
@@ -3783,9 +3796,13 @@ fil_open_single_table_tablespace(
if (remote.success) {
remote.check_msg = fil_read_first_page(
remote.file, FALSE, &remote.flags, &remote.id,
- &remote.lsn, &remote.lsn, id, &remote.crypt_data);
+ &remote.lsn, &remote.lsn, &remote.crypt_data);
remote.valid = !remote.check_msg;
+ if (table) {
+ table->crypt_data = remote.crypt_data;
+ }
+
/* Validate this single-table-tablespace with SYS_TABLES,
but do not compare the DATA_DIR flag, in case the
tablespace was relocated. */
@@ -3806,9 +3823,13 @@ fil_open_single_table_tablespace(
if (dict.success) {
dict.check_msg = fil_read_first_page(
dict.file, FALSE, &dict.flags, &dict.id,
- &dict.lsn, &dict.lsn, id, &dict.crypt_data);
+ &dict.lsn, &dict.lsn, &dict.crypt_data);
dict.valid = !dict.check_msg;
+ if (table) {
+ table->crypt_data = dict.crypt_data;
+ }
+
/* Validate this single-table-tablespace with SYS_TABLES,
but do not compare the DATA_DIR flag, in case the
tablespace was relocated. */
@@ -3990,7 +4011,9 @@ cleanup_and_exit:
mem_free(remote.filepath);
}
if (remote.crypt_data && remote.crypt_data != crypt_data) {
- fil_space_destroy_crypt_data(&remote.crypt_data);
+ if (err == DB_SUCCESS) {
+ fil_space_destroy_crypt_data(&remote.crypt_data);
+ }
}
if (dict.success) {
os_file_close(dict.file);
@@ -4005,7 +4028,9 @@ cleanup_and_exit:
os_file_close(def.file);
}
if (def.crypt_data && def.crypt_data != crypt_data) {
- fil_space_destroy_crypt_data(&def.crypt_data);
+ if (err == DB_SUCCESS) {
+ fil_space_destroy_crypt_data(&def.crypt_data);
+ }
}
mem_free(def.filepath);
@@ -4225,7 +4250,7 @@ check_first_page:
fsp->success = TRUE;
if (const char* check_msg = fil_read_first_page(
fsp->file, FALSE, &fsp->flags, &fsp->id,
- &fsp->lsn, &fsp->lsn, ULINT_UNDEFINED, &fsp->crypt_data)) {
+ &fsp->lsn, &fsp->lsn, &fsp->crypt_data)) {
ib_logf(IB_LOG_LEVEL_ERROR,
"%s in tablespace %s (table %s)",
check_msg, fsp->filepath, tablename);
@@ -5923,9 +5948,9 @@ _fil_io(
if (!ret) {
return(DB_OUT_OF_FILE_SPACE);
- } else {
- return(DB_SUCCESS);
}
+
+ return(DB_SUCCESS);
}
#ifndef UNIV_HOTBACKUP
@@ -6450,8 +6475,17 @@ fil_iterate(
ut_ad(!(n_bytes % iter.page_size));
byte* readptr = io_buffer;
- if (iter.crypt_data != NULL) {
+ byte* writeptr = io_buffer;
+ bool encrypted = false;
+
+ /* Use additional crypt io buffer if tablespace is encrypted */
+ if ((iter.crypt_data != NULL && iter.crypt_data->encryption == FIL_SPACE_ENCRYPTION_ON) ||
+ (srv_encrypt_tables &&
+ iter.crypt_data && iter.crypt_data->encryption == FIL_SPACE_ENCRYPTION_DEFAULT)) {
+
+ encrypted = true;
readptr = iter.crypt_io_buffer;
+ writeptr = iter.crypt_io_buffer;
}
if (!os_file_read(iter.file, readptr, offset, (ulint) n_bytes)) {
@@ -6464,24 +6498,36 @@ fil_iterate(
bool updated = false;
os_offset_t page_off = offset;
ulint n_pages_read = (ulint) n_bytes / iter.page_size;
+ bool decrypted = false;
for (ulint i = 0; i < n_pages_read; ++i) {
+ ulint size = iter.page_size;
+ dberr_t err = DB_SUCCESS;
+
+ /* If tablespace is encrypted, we need to decrypt
+ the page. */
+ if (encrypted) {
+ decrypted = fil_space_decrypt(
+ iter.crypt_data,
+ io_buffer + i * size, //dst
+ iter.page_size,
+ readptr + i * size, // src
+ &err); // src
+
+ if (err != DB_SUCCESS) {
+ return(err);
+ }
- if (iter.crypt_data != NULL) {
- bool decrypted = fil_space_decrypt(
- iter.crypt_data,
- readptr + i * iter.page_size, // src
- iter.page_size,
- io_buffer + i * iter.page_size); // dst
if (decrypted) {
- /* write back unencrypted page */
updated = true;
+ } else {
+ /* TODO: remove unnecessary memcpy's */
+ memcpy(io_buffer + i * size, readptr + i * size, size);
}
}
buf_block_set_file_page(block, space_id, page_no++);
- dberr_t err;
if ((err = callback(page_off, block)) != DB_SUCCESS) {
@@ -6495,6 +6541,32 @@ fil_iterate(
buf_block_set_state(block, BUF_BLOCK_NOT_USED);
buf_block_set_state(block, BUF_BLOCK_READY_FOR_USE);
+ /* If tablespace is encrypted, encrypt page before we
+ write it back. Note that we should not encrypt the
+ buffer that is in buffer pool. */
+ if (decrypted && encrypted) {
+ unsigned char *src = io_buffer + (i * size);
+ unsigned char *dst = writeptr + (i * size);
+ ulint space = mach_read_from_4(
+ src + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
+ ulint offset = mach_read_from_4(src + FIL_PAGE_OFFSET);
+ ib_uint64_t lsn = mach_read_from_8(src + FIL_PAGE_LSN);
+
+ byte* tmp = fil_encrypt_buf(
+ iter.crypt_data,
+ space,
+ offset,
+ lsn,
+ src,
+ iter.page_size == UNIV_PAGE_SIZE ? 0 : iter.page_size,
+ dst);
+
+ if (tmp == src) {
+ /* TODO: remove unnecessary memcpy's */
+ memcpy(writeptr, src, size);
+ }
+ }
+
page_off += iter.page_size;
block->frame += iter.page_size;
}
@@ -6502,7 +6574,7 @@ fil_iterate(
/* A page was updated in the set, write back to disk. */
if (updated
&& !os_file_write(
- iter.filepath, iter.file, io_buffer,
+ iter.filepath, iter.file, writeptr,
offset, (ulint) n_bytes)) {
ib_logf(IB_LOG_LEVEL_ERROR, "os_file_write() failed");
@@ -6664,28 +6736,6 @@ fil_tablespace_iterate(
mem_free(io_buffer);
if (iter.crypt_data != NULL) {
- /* clear crypt data from page 0 and write it back */
- os_file_read(file, page, 0, UNIV_PAGE_SIZE);
- fil_space_clear_crypt_data(page, crypt_data_offset);
- lsn_t lsn = mach_read_from_8(page + FIL_PAGE_LSN);
- if (callback.get_zip_size() == 0) {
- buf_flush_init_for_writing(
- page, 0, lsn);
- } else {
- buf_flush_update_zip_checksum(
- page, callback.get_zip_size(), lsn);
- }
-
- if (!os_file_write(
- iter.filepath, iter.file, page,
- 0, iter.page_size)) {
-
- ib_logf(IB_LOG_LEVEL_ERROR,
- "os_file_write() failed");
-
- return(DB_IO_ERROR);
- }
-
mem_free(crypt_io_buffer);
iter.crypt_io_buffer = NULL;
fil_space_destroy_crypt_data(&iter.crypt_data);
diff --git a/storage/xtradb/fil/fil0pagecompress.cc b/storage/xtradb/fil/fil0pagecompress.cc
index e508d4733db..e544981fa2e 100644
--- a/storage/xtradb/fil/fil0pagecompress.cc
+++ b/storage/xtradb/fil/fil0pagecompress.cc
@@ -355,11 +355,16 @@ fil_compress_page(
write_size+=header_len;
+ if (block_size <= 0) {
+ block_size = 512;
+ }
+
+ ut_ad(write_size > 0 && block_size > 0);
+
/* Actual write needs to be alligned on block size */
if (write_size % block_size) {
- size_t tmp = write_size;
#ifdef UNIV_DEBUG
- ut_a(block_size > 0);
+ size_t tmp = write_size;
#endif
write_size = (size_t)ut_uint64_align_up((ib_uint64_t)write_size, block_size);
#ifdef UNIV_DEBUG
diff --git a/storage/xtradb/fsp/fsp0fsp.cc b/storage/xtradb/fsp/fsp0fsp.cc
index 34acab04241..1358fab90ea 100644
--- a/storage/xtradb/fsp/fsp0fsp.cc
+++ b/storage/xtradb/fsp/fsp0fsp.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -305,44 +305,6 @@ xdes_find_bit(
}
/**********************************************************************//**
-Looks for a descriptor bit having the desired value. Scans the extent in
-a direction opposite to xdes_find_bit.
-@return bit index of the bit, ULINT_UNDEFINED if not found */
-UNIV_INLINE
-ulint
-xdes_find_bit_downward(
-/*===================*/
- xdes_t* descr, /*!< in: descriptor */
- ulint bit, /*!< in: XDES_FREE_BIT or XDES_CLEAN_BIT */
- ibool val, /*!< in: desired bit value */
- ulint hint, /*!< in: hint of which bit position would
- be desirable */
- mtr_t* mtr) /*!< in/out: mini-transaction */
-{
- ulint i;
-
- ut_ad(descr && mtr);
- ut_ad(val <= TRUE);
- ut_ad(hint < FSP_EXTENT_SIZE);
- ut_ad(mtr_memo_contains_page(mtr, descr, MTR_MEMO_PAGE_X_FIX));
- for (i = hint + 1; i > 0; i--) {
- if (val == xdes_mtr_get_bit(descr, bit, i - 1, mtr)) {
-
- return(i - 1);
- }
- }
-
- for (i = FSP_EXTENT_SIZE - 1; i > hint; i--) {
- if (val == xdes_mtr_get_bit(descr, bit, i, mtr)) {
-
- return(i);
- }
- }
-
- return(ULINT_UNDEFINED);
-}
-
-/**********************************************************************//**
Returns the number of used pages in a descriptor.
@return number of pages used */
UNIV_INLINE
@@ -2768,6 +2730,8 @@ fsp_reserve_free_extents(
ulint reserve;
ibool success;
ulint n_pages_added;
+ size_t total_reserved = 0;
+ ulint rounds = 0;
ut_ad(mtr);
*n_reserved = n_ext;
@@ -2781,7 +2745,7 @@ fsp_reserve_free_extents(
try_again:
size = mtr_read_ulint(space_header + FSP_SIZE, MLOG_4BYTES, mtr);
- if (size < FSP_EXTENT_SIZE) {
+ if (size < FSP_EXTENT_SIZE / 2) {
/* Use different rules for small single-table tablespaces */
*n_reserved = 0;
return(fsp_reserve_free_pages(space, space_header, size, mtr));
@@ -2796,7 +2760,6 @@ try_again:
some of them will contain extent descriptor pages, and therefore
will not be free extents */
- ut_ad(size >= free_limit);
n_free_up = (size - free_limit) / FSP_EXTENT_SIZE;
if (n_free_up > 0) {
@@ -2837,6 +2800,7 @@ try_again:
}
success = fil_space_reserve_free_extents(space, n_free, n_ext);
+ *n_reserved = n_ext;
if (success) {
return(TRUE);
@@ -2846,6 +2810,16 @@ try_to_extend:
space_header, mtr);
if (success && n_pages_added > 0) {
+ rounds++;
+ total_reserved += n_pages_added;
+
+ if (rounds > 50) {
+ ib_logf(IB_LOG_LEVEL_INFO,
+ "Space id %lu trying to reserve %lu extents actually reserved %lu "
+ " reserve %lu free %lu size %lu rounds %lu total_reserved %lu",
+ space, n_ext, n_pages_added, reserve, n_free, size, rounds, total_reserved);
+ }
+
goto try_again;
}
diff --git a/storage/xtradb/fts/fts0fts.cc b/storage/xtradb/fts/fts0fts.cc
index 37e742bf938..7a381f4ca05 100644
--- a/storage/xtradb/fts/fts0fts.cc
+++ b/storage/xtradb/fts/fts0fts.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2011, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -81,11 +81,13 @@ ulint n_nodes = 0;
/** Error condition reported by fts_utf8_decode() */
const ulint UTF8_ERROR = 0xFFFFFFFF;
+#ifdef FTS_CACHE_SIZE_DEBUG
/** The cache size permissible lower limit (1K) */
static const ulint FTS_CACHE_SIZE_LOWER_LIMIT_IN_MB = 1;
/** The cache size permissible upper limit (1G) */
static const ulint FTS_CACHE_SIZE_UPPER_LIMIT_IN_MB = 1024;
+#endif /* FTS_CACHE_SIZE_DEBUG */
/** Time to sleep after DEADLOCK error before retrying operation. */
static const ulint FTS_DEADLOCK_RETRY_WAIT = 100000;
@@ -191,7 +193,7 @@ static const char* fts_create_common_tables_sql = {
""
"CREATE TABLE \"%s_CONFIG\" (\n"
" key CHAR(50),\n"
- " value CHAR(50) NOT NULL\n"
+ " value CHAR(200) NOT NULL\n"
") COMPACT;\n"
"CREATE UNIQUE CLUSTERED INDEX IND ON \"%s_CONFIG\"(key);\n"
};
@@ -329,27 +331,6 @@ fts_update_sync_doc_id(
doc_id_t doc_id, /*!< in: last document id */
trx_t* trx) /*!< in: update trx, or NULL */
__attribute__((nonnull(1)));
-/********************************************************************
-Check if we should stop. */
-UNIV_INLINE
-ibool
-fts_is_stop_signalled(
-/*==================*/
- fts_t* fts) /*!< in: fts instance */
-{
- ibool stop_signalled = FALSE;
-
- mutex_enter(&fts->bg_threads_mutex);
-
- if (fts->fts_status & BG_THREAD_STOP) {
-
- stop_signalled = TRUE;
- }
-
- mutex_exit(&fts->bg_threads_mutex);
-
- return(stop_signalled);
-}
/****************************************************************//**
This function loads the default InnoDB stopword list */
@@ -1971,7 +1952,7 @@ fts_create_one_index_table(
flags2 = DICT_TF2_USE_TABLESPACE;
}
- new_table = dict_mem_table_create(table_name, 0, 5, 1, flags2, false);
+ new_table = dict_mem_table_create(table_name, 0, 5, 1, flags2);
field = dict_index_get_nth_field(index, 0);
charset = innobase_get_fts_charset(
@@ -2000,7 +1981,7 @@ fts_create_one_index_table(
dict_mem_table_add_col(new_table, heap, "ilist", DATA_BLOB,
4130048, 0);
- error = row_create_table_for_mysql(new_table, trx, false);
+ error = row_create_table_for_mysql(new_table, trx, false, FIL_SPACE_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
if (error != DB_SUCCESS) {
trx->error_state = error;
@@ -3409,7 +3390,7 @@ fts_fetch_doc_from_rec(
doc->charset = get_doc->index_cache->charset;
/* Null Field */
- if (doc->text.f_len == UNIV_SQL_NULL) {
+ if (doc->text.f_len == UNIV_SQL_NULL || doc->text.f_len == 0) {
continue;
}
@@ -5545,7 +5526,7 @@ fts_savepoint_lookup(
/*********************************************************************//**
Release the savepoint data identified by name. All savepoints created
-after the named savepoint are also released.
+after the named savepoint are kept.
@return DB_SUCCESS or error code */
UNIV_INTERN
void
@@ -5554,81 +5535,37 @@ fts_savepoint_release(
trx_t* trx, /*!< in: transaction */
const char* name) /*!< in: savepoint name */
{
- ulint i;
- ib_vector_t* savepoints;
- ulint top_of_stack = 0;
-
ut_a(name != NULL);
- savepoints = trx->fts_trx->savepoints;
+ ib_vector_t* savepoints = trx->fts_trx->savepoints;
ut_a(ib_vector_size(savepoints) > 0);
- /* Skip the implied savepoint (first element). */
- for (i = 1; i < ib_vector_size(savepoints); ++i) {
- fts_savepoint_t* savepoint;
+ ulint i = fts_savepoint_lookup(savepoints, name);
+ if (i != ULINT_UNDEFINED) {
+ ut_a(i >= 1);
+ fts_savepoint_t* savepoint;
savepoint = static_cast<fts_savepoint_t*>(
ib_vector_get(savepoints, i));
- /* Even though we release the resources that are part
- of the savepoint, we don't (always) actually delete the
- entry. We simply set the savepoint name to NULL. Therefore
- we have to skip deleted/released entries. */
- if (savepoint->name != NULL
- && strcmp(name, savepoint->name) == 0) {
- break;
+ if (i == ib_vector_size(savepoints) - 1) {
+ /* If the savepoint is the last, we save its
+ tables to the previous savepoint. */
+ fts_savepoint_t* prev_savepoint;
+ prev_savepoint = static_cast<fts_savepoint_t*>(
+ ib_vector_get(savepoints, i - 1));
- /* Track the previous savepoint instance that will
- be at the top of the stack after the release. */
- } else if (savepoint->name != NULL) {
- /* We need to delete all entries
- greater than this element. */
- top_of_stack = i;
+ ib_rbt_t* tables = savepoint->tables;
+ savepoint->tables = prev_savepoint->tables;
+ prev_savepoint->tables = tables;
}
- }
-
- /* Only if we found and element to release. */
- if (i < ib_vector_size(savepoints)) {
- fts_savepoint_t* last_savepoint;
- fts_savepoint_t* top_savepoint;
- ib_rbt_t* tables;
-
- ut_a(top_of_stack < ib_vector_size(savepoints));
- /* Exchange tables between last savepoint and top savepoint */
- last_savepoint = static_cast<fts_savepoint_t*>(
- ib_vector_last(trx->fts_trx->savepoints));
- top_savepoint = static_cast<fts_savepoint_t*>(
- ib_vector_get(savepoints, top_of_stack));
- tables = top_savepoint->tables;
- top_savepoint->tables = last_savepoint->tables;
- last_savepoint->tables = tables;
-
- /* Skip the implied savepoint. */
- for (i = ib_vector_size(savepoints) - 1;
- i > top_of_stack;
- --i) {
-
- fts_savepoint_t* savepoint;
-
- savepoint = static_cast<fts_savepoint_t*>(
- ib_vector_get(savepoints, i));
-
- /* Skip savepoints that were released earlier. */
- if (savepoint->name != NULL) {
- savepoint->name = NULL;
- fts_savepoint_free(savepoint);
- }
-
- ib_vector_pop(savepoints);
- }
+ fts_savepoint_free(savepoint);
+ ib_vector_remove(savepoints, *(void**)savepoint);
/* Make sure we don't delete the implied savepoint. */
ut_a(ib_vector_size(savepoints) > 0);
-
- /* This must hold. */
- ut_a(ib_vector_size(savepoints) == (top_of_stack + 1));
}
}
@@ -6330,7 +6267,7 @@ fts_fake_hex_to_dec(
{
ib_id_t dec_id = 0;
char tmp_id[FTS_AUX_MIN_TABLE_ID_LENGTH];
- int ret;
+ int ret __attribute__((unused));
ret = sprintf(tmp_id, UINT64PFx, id);
ut_ad(ret == 16);
diff --git a/storage/xtradb/fts/fts0opt.cc b/storage/xtradb/fts/fts0opt.cc
index 5891b53a6e2..e096b8bf6d6 100644
--- a/storage/xtradb/fts/fts0opt.cc
+++ b/storage/xtradb/fts/fts0opt.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2007, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2007, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -42,9 +42,6 @@ Completed 2011/7/10 Sunny and Jimmy Yang
/** The FTS optimize thread's work queue. */
static ib_wqueue_t* fts_optimize_wq;
-/** The number of document ids to delete in one statement. */
-static const ulint FTS_MAX_DELETE_DOC_IDS = 1000;
-
/** Time to wait for a message. */
static const ulint FTS_QUEUE_WAIT_IN_USECS = 5000000;
@@ -1154,6 +1151,7 @@ fts_optimize_encode_node(
}
/* Calculate the space required to store the ilist. */
+ ut_ad(doc_id > node->last_doc_id);
doc_id_delta = doc_id - node->last_doc_id;
enc_len = fts_get_encoded_len(static_cast<ulint>(doc_id_delta));
@@ -1396,7 +1394,8 @@ fts_optimize_word(
src_node = (fts_node_t*) ib_vector_get(word->nodes, i);
- if (!dst_node) {
+ if (dst_node == NULL
+ || dst_node->last_doc_id > src_node->first_doc_id) {
dst_node = static_cast<fts_node_t*>(
ib_vector_push(nodes, NULL));
diff --git a/storage/xtradb/fts/fts0que.cc b/storage/xtradb/fts/fts0que.cc
index 9d8e7aec9ab..66060439215 100644
--- a/storage/xtradb/fts/fts0que.cc
+++ b/storage/xtradb/fts/fts0que.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2007, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2007, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -57,9 +57,6 @@ Completed 2011/7/10 Sunny and Jimmy Yang
/*Initial byte length for 'words' in fts_ranking_t */
#define RANKING_WORDS_INIT_LEN 4
-/* Coeffecient to use for normalize relevance ranking. */
-static const double FTS_NORMALIZE_COEFF = 0.0115F;
-
// FIXME: Need to have a generic iterator that traverses the ilist.
typedef std::vector<fts_string_t> word_vector_t;
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 91f1ac3ab8f..2f48bf06736 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -1,10 +1,10 @@
/*****************************************************************************
-Copyright (c) 2000, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2000, 2015, Oracle and/or its affiliates.
+Copyright (c) 2013, 2015, MariaDB Corporation.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2015, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -108,7 +108,6 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include "page0zip.h"
#include "fil0pagecompress.h"
-
#define thd_get_trx_isolation(X) ((enum_tx_isolation)thd_tx_isolation(X))
#ifdef MYSQL_DYNAMIC_PLUGIN
@@ -130,10 +129,8 @@ this program; if not, write to the Free Software Foundation, Inc.,
#ifdef WITH_WSREP
#include "dict0priv.h"
#include "../storage/innobase/include/ut0byte.h"
-#include <wsrep_mysqld.h>
#include <mysql/service_md5.h>
-extern my_bool wsrep_certify_nonPK;
class binlog_trx_data;
extern handlerton *binlog_hton;
@@ -157,6 +154,7 @@ wsrep_fake_trx_id(handlerton* hton, THD *thd);
static int innobase_wsrep_set_checkpoint(handlerton* hton, const XID* xid);
static int innobase_wsrep_get_checkpoint(handlerton* hton, XID* xid);
#endif /* WITH_WSREP */
+
/** to protect innobase_open_files */
static mysql_mutex_t innobase_share_mutex;
/** to force correct commit order in binlog */
@@ -609,7 +607,8 @@ ib_cb_t innodb_api_cb[] = {
(ib_cb_t) ib_get_idx_field_name,
(ib_cb_t) ib_trx_get_start_time,
(ib_cb_t) ib_cfg_bk_commit_interval,
- (ib_cb_t) ib_cursor_stmt_begin
+ (ib_cb_t) ib_cursor_stmt_begin,
+ (ib_cb_t) ib_trx_read_only
};
@@ -2009,6 +2008,9 @@ convert_error_code_to_mysql(
case DB_TABLE_NOT_FOUND:
return(HA_ERR_NO_SUCH_TABLE);
+ case DB_DECRYPTION_FAILED:
+ return(HA_ERR_DECRYPTION_FAILED);
+
case DB_TABLESPACE_NOT_FOUND:
return(HA_ERR_NO_SUCH_TABLE);
@@ -2638,6 +2640,7 @@ check_trx_exists(
if (trx == NULL) {
trx = innobase_trx_allocate(thd);
+ thd_set_ha_data(thd, innodb_hton_ptr, trx);
} else if (UNIV_UNLIKELY(trx->magic_n != TRX_MAGIC_N)) {
mem_analyze_corruption(trx);
ut_error;
@@ -3356,19 +3359,6 @@ trx_is_strict(
return(trx && trx->mysql_thd && THDVAR(trx->mysql_thd, strict_mode));
}
-/**********************************************************************//**
-Determines if the current MySQL thread is running in strict mode.
-If thd==NULL, THDVAR returns the global value of innodb-strict-mode.
-@return TRUE if strict */
-UNIV_INLINE
-ibool
-thd_is_strict(
-/*==========*/
- THD* thd) /*!< in: MySQL thread descriptor */
-{
- return(THDVAR(thd, strict_mode));
-}
-
/**************************************************************//**
Resets some fields of a prebuilt struct. The template is used in fast
retrieval of just those column values MySQL needs in its processing. */
@@ -4240,7 +4230,6 @@ innobase_flush_logs(
Synchronously read and parse the redo log up to the last
checkpoint to write the changed page bitmap.
@return 0 to indicate success. Current implementation cannot fail. */
-static
my_bool
innobase_flush_changed_page_bitmaps()
/*=================================*/
@@ -5114,9 +5103,9 @@ innobase_kill_connection(
trx_mutex_enter(trx);
/* Cancel a pending lock request. */
- if (trx->lock.wait_lock)
+ if (trx->lock.wait_lock) {
lock_cancel_waiting_and_release(trx->lock.wait_lock);
-
+ }
trx_mutex_exit(trx);
if (!owner || owner != cur) {
lock_mutex_exit();
@@ -6057,7 +6046,14 @@ table_opened:
innobase_copy_frm_flags_from_table_share(ib_table, table->s);
- dict_stats_init(ib_table);
+ ib_table->thd = (void*)thd;
+
+ /* No point to init any statistics if tablespace is still encrypted. */
+ if (!ib_table->is_encrypted) {
+ dict_stats_init(ib_table);
+ } else {
+ ib_table->stat_initialized = 1;
+ }
MONITOR_INC(MONITOR_TABLE_OPEN);
@@ -6086,6 +6082,11 @@ table_opened:
file, best to play it safe. */
no_tablespace = true;
+ } else if (ib_table->is_encrypted) {
+ /* This means that tablespace was found but we could not
+ decrypt encrypted page. */
+ no_tablespace = true;
+ ib_table->ibd_file_missing = true;
} else {
no_tablespace = false;
}
@@ -6093,10 +6094,40 @@ table_opened:
if (!thd_tablespace_op(thd) && no_tablespace) {
free_share(share);
my_errno = ENOENT;
+ int ret_err = HA_ERR_NO_SUCH_TABLE;
+
+ /* If table has no talespace but it has crypt data, check
+ is tablespace made unaccessible because encryption service
+ or used key_id is not available. */
+ if (ib_table) {
+ fil_space_crypt_t* crypt_data = ib_table->crypt_data;
+ if ((crypt_data && crypt_data->encryption == FIL_SPACE_ENCRYPTION_ON) ||
+ (srv_encrypt_tables &&
+ crypt_data && crypt_data->encryption == FIL_SPACE_ENCRYPTION_DEFAULT)) {
+
+ if (!encryption_key_id_exists(crypt_data->key_id)) {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ HA_ERR_DECRYPTION_FAILED,
+ "Table %s is encrypted but encryption service or"
+ " used key_id %u is not available. "
+ " Can't continue reading table.",
+ ib_table->name, crypt_data->key_id);
+ ret_err = HA_ERR_DECRYPTION_FAILED;
+ }
+ } else if (ib_table->is_encrypted) {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ HA_ERR_DECRYPTION_FAILED,
+ "Table %s is encrypted but encryption service or"
+ " used key_id is not available. "
+ " Can't continue reading table.",
+ ib_table->name);
+ ret_err = HA_ERR_DECRYPTION_FAILED;
+ }
+ }
dict_table_close(ib_table, FALSE, FALSE);
- DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
+ DBUG_RETURN(ret_err);
}
prebuilt = row_create_prebuilt(ib_table, table->s->stored_rec_length);
@@ -6964,10 +6995,10 @@ innobase_read_from_2_little_endian(
return((uint) ((ulint)(buf[0]) + 256 * ((ulint)(buf[1]))));
}
+#ifdef WITH_WSREP
/*******************************************************************//**
Stores a key value for a row to a buffer.
@return key value length as stored in buff */
-#ifdef WITH_WSREP
UNIV_INTERN
uint
wsrep_store_key_val_for_row(
@@ -8137,11 +8168,11 @@ ha_innobase::write_row(
dberr_t error;
int error_result= 0;
ibool auto_inc_used= FALSE;
- ulint sql_command;
- trx_t* trx = thd_to_trx(user_thd);
#ifdef WITH_WSREP
ibool auto_inc_inserted= FALSE; /* if NULL was inserted */
#endif
+ ulint sql_command;
+ trx_t* trx = thd_to_trx(user_thd);
DBUG_ENTER("ha_innobase::write_row");
@@ -8179,7 +8210,9 @@ ha_innobase::write_row(
|| sql_command == SQLCOM_CREATE_INDEX
#ifdef WITH_WSREP
|| (wsrep_on(user_thd) && wsrep_load_data_splitting &&
- sql_command == SQLCOM_LOAD)
+ sql_command == SQLCOM_LOAD &&
+ !thd_test_options(
+ user_thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
#endif /* WITH_WSREP */
|| sql_command == SQLCOM_DROP_INDEX)
&& num_write_row >= 10000) {
@@ -8223,15 +8256,20 @@ no_commit:
;
} else if (src_table == prebuilt->table) {
#ifdef WITH_WSREP
- if (wsrep_on(user_thd)) {
+ if (wsrep_on(user_thd) &&
+ wsrep_load_data_splitting &&
+ sql_command == SQLCOM_LOAD &&
+ !thd_test_options(user_thd,
+ OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
+ {
switch (wsrep_run_wsrep_commit(user_thd, 1))
{
case WSREP_TRX_OK:
- break;
+ break;
case WSREP_TRX_SIZE_EXCEEDED:
case WSREP_TRX_CERT_FAIL:
case WSREP_TRX_ERROR:
- DBUG_RETURN(1);
+ DBUG_RETURN(1);
}
if (binlog_hton->commit(binlog_hton, user_thd, 1))
@@ -8250,15 +8288,20 @@ no_commit:
prebuilt->sql_stat_start = TRUE;
} else {
#ifdef WITH_WSREP
- if (wsrep_on(user_thd)) {
+ if (wsrep_on(user_thd) &&
+ wsrep_load_data_splitting &&
+ sql_command == SQLCOM_LOAD &&
+ !thd_test_options(user_thd,
+ OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
+ {
switch (wsrep_run_wsrep_commit(user_thd, 1))
{
case WSREP_TRX_OK:
- break;
+ break;
case WSREP_TRX_SIZE_EXCEEDED:
case WSREP_TRX_CERT_FAIL:
case WSREP_TRX_ERROR:
- DBUG_RETURN(1);
+ DBUG_RETURN(1);
}
if (binlog_hton->commit(binlog_hton, user_thd, 1))
@@ -8480,14 +8523,15 @@ report_error:
user_thd);
#ifdef WITH_WSREP
- if (!error_result && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
- wsrep_on(user_thd) && !wsrep_consistency_check(user_thd) &&
- (sql_command != SQLCOM_LOAD ||
- thd_binlog_format(user_thd) == BINLOG_FORMAT_ROW)) {
-
- if (wsrep_append_keys(user_thd, false, record, NULL)) {
- DBUG_PRINT("wsrep", ("row key failed"));
- error_result = HA_ERR_INTERNAL_ERROR;
+ if (!error_result &&
+ wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
+ wsrep_on(user_thd) &&
+ !wsrep_consistency_check(user_thd))
+ {
+ if (wsrep_append_keys(user_thd, false, record, NULL))
+ {
+ DBUG_PRINT("wsrep", ("row key failed"));
+ error_result = HA_ERR_INTERNAL_ERROR;
goto wsrep_error;
}
}
@@ -8696,7 +8740,8 @@ calc_row_difference(
}
}
}
- innodb_idx++;
+ if (field->stored_in_db)
+ innodb_idx++;
}
/* If the update changes a column with an FTS index on it, we
@@ -9091,12 +9136,13 @@ ha_innobase::delete_row(
innobase_active_small();
#ifdef WITH_WSREP
- if (error == DB_SUCCESS && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
- wsrep_on(user_thd)) {
+ if (error == DB_SUCCESS &&
+ wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
+ wsrep_on(user_thd)) {
if (wsrep_append_keys(user_thd, false, record, NULL)) {
DBUG_PRINT("wsrep", ("delete fail"));
- error = DB_ERROR;
+ error = (dberr_t) HA_ERR_INTERNAL_ERROR;
goto wsrep_error;
}
}
@@ -9723,6 +9769,11 @@ ha_innobase::general_fetch(
DBUG_ENTER("general_fetch");
+ /* If transaction is not startted do not continue, instead return a error code. */
+ if(!(prebuilt->sql_stat_start || (prebuilt->trx && prebuilt->trx->state == 1))) {
+ DBUG_RETURN(HA_ERR_END_OF_FILE);
+ }
+
if (UNIV_UNLIKELY(srv_pass_corrupt_table <= 1 && share
&& share->ib_table && share->ib_table->is_corrupt)) {
DBUG_RETURN(HA_ERR_CRASHED);
@@ -10489,6 +10540,7 @@ wsrep_append_foreign_key(
wsrep_thd_query(thd) : "void");
return DB_ERROR;
}
+ wsrep_t *wsrep= get_wsrep();
rcode = (int)wsrep->append_key(
wsrep,
wsrep_ws_handle(thd, trx),
@@ -10545,6 +10597,7 @@ wsrep_append_key(
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
}
+ wsrep_t *wsrep= get_wsrep();
int rcode = (int)wsrep->append_key(
wsrep,
wsrep_ws_handle(thd, trx),
@@ -10562,9 +10615,6 @@ wsrep_append_key(
DBUG_RETURN(0);
}
-extern void compute_md5_hash(char *digest, const char *buf, int len);
-#define MD5_HASH compute_md5_hash
-
int
ha_innobase::wsrep_append_keys(
/*==================*/
@@ -10832,7 +10882,9 @@ create_table_def(
is a zero length-string */
const char* remote_path, /*!< in: Remote path or zero length-string */
ulint flags, /*!< in: table flags */
- ulint flags2) /*!< in: table flags2 */
+ ulint flags2, /*!< in: table flags2 */
+ fil_encryption_t mode, /*!< in: encryption mode */
+ ulint key_id) /*!< in: encryption key_id */
{
THD* thd = trx->mysql_thd;
dict_table_t* table;
@@ -10890,18 +10942,18 @@ create_table_def(
/* Adjust for the FTS hidden field */
if (!has_doc_id_col) {
table = dict_mem_table_create(table_name, 0, s_cols + 1,
- flags, flags2, false);
+ flags, flags2);
/* Set the hidden doc_id column. */
table->fts->doc_col = s_cols;
} else {
table = dict_mem_table_create(table_name, 0, s_cols,
- flags, flags2, false);
+ flags, flags2);
table->fts->doc_col = doc_id_col;
}
} else {
table = dict_mem_table_create(table_name, 0, s_cols,
- flags, flags2, false);
+ flags, flags2);
}
if (flags2 & DICT_TF2_TEMPORARY) {
@@ -11013,7 +11065,7 @@ err_col:
fts_add_doc_id_column(table, heap);
}
- err = row_create_table_for_mysql(table, trx, false);
+ err = row_create_table_for_mysql(table, trx, false, mode, key_id);
mem_heap_free(heap);
@@ -11923,12 +11975,12 @@ ha_innobase::check_table_options(
if (encrypt == FIL_SPACE_ENCRYPTION_ON ||
(encrypt == FIL_SPACE_ENCRYPTION_DEFAULT && srv_encrypt_tables)) {
- if (!encryption_key_id_exists(options->encryption_key_id)) {
+ if (!encryption_key_id_exists((unsigned int)options->encryption_key_id)) {
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN,
HA_WRONG_CREATE_OPTION,
- "InnoDB: ENCRYPTION_KEY_ID %lu not available",
- options->encryption_key_id
+ "InnoDB: ENCRYPTION_KEY_ID %u not available",
+ (uint)options->encryption_key_id
);
return "ENCRYPTION_KEY_ID";
@@ -11995,14 +12047,14 @@ ha_innobase::create(
/* Cache table options */
ha_table_option_struct *options= form->s->option_struct;
fil_encryption_t encrypt = (fil_encryption_t)options->encryption;
- ulint key_id = options->encryption_key_id;
+ uint key_id = (uint)options->encryption_key_id;
DBUG_ENTER("ha_innobase::create");
DBUG_ASSERT(thd != NULL);
DBUG_ASSERT(create_info != NULL);
- if (form->s->fields > REC_MAX_N_USER_FIELDS) {
+ if (form->s->stored_fields > REC_MAX_N_USER_FIELDS) {
DBUG_RETURN(HA_ERR_TOO_MANY_FIELDS);
} else if (srv_read_only_mode) {
DBUG_RETURN(HA_ERR_TABLE_READONLY);
@@ -12094,7 +12146,7 @@ ha_innobase::create(
row_mysql_lock_data_dictionary(trx);
error = create_table_def(trx, form, norm_name, temp_path,
- remote_path, flags, flags2);
+ remote_path, flags, flags2, encrypt, key_id);
if (error) {
goto cleanup;
}
@@ -12254,48 +12306,6 @@ ha_innobase::create(
DBUG_ASSERT(innobase_table != 0);
- /* If user has requested that table should be encrypted or table
- should remain as unencrypted store crypt data */
- if (encrypt != FIL_SPACE_ENCRYPTION_DEFAULT) {
- ulint maxsize=0;
- ulint zip_size = fil_space_get_zip_size(innobase_table->space);
- fil_space_crypt_t* old_crypt_data = fil_space_get_crypt_data(innobase_table->space);
- fil_space_crypt_t* crypt_data;
-
- crypt_data = fil_space_create_crypt_data(encrypt, key_id);
- crypt_data->page0_offset = fsp_header_get_crypt_offset(zip_size, &maxsize);
- crypt_data->encryption = encrypt;
-
- /* If there is old crypt data, copy IV */
- if (old_crypt_data) {
- memcpy(crypt_data->iv, old_crypt_data->iv, sizeof(crypt_data->iv));
- }
-
- mtr_t mtr;
- mtr_start(&mtr);
- /* Get page 0*/
- ulint offset = 0;
- buf_block_t* block = buf_page_get_gen(innobase_table->space,
- zip_size,
- offset,
- RW_X_LATCH,
- NULL,
- BUF_GET,
- __FILE__, __LINE__,
- &mtr);
-
- /* Set up new crypt data */
- crypt_data = fil_space_set_crypt_data(innobase_table->space, crypt_data);
-
- /* Compute location to store crypt data */
- byte* frame = buf_block_get_frame(block);
-
- /* Write crypt data to page 0 */
- fil_space_write_crypt_data(innobase_table->space, frame, crypt_data->page0_offset, maxsize, &mtr);
-
- mtr_commit(&mtr);
- }
-
innobase_copy_frm_flags_from_create_info(innobase_table, create_info);
dict_stats_update(innobase_table, DICT_STATS_EMPTY_TABLE);
@@ -12460,6 +12470,8 @@ ha_innobase::discard_or_import_tablespace(
| HA_STATUS_CONST
| HA_STATUS_VARIABLE
| HA_STATUS_AUTO);
+
+ fil_crypt_set_encrypt_tables(srv_encrypt_tables);
}
}
@@ -12664,21 +12676,29 @@ ha_innobase::defragment_table(
const char* index_name, /*!< in: index name */
bool async) /*!< in: whether to wait until finish */
{
- char norm_name[FN_REFLEN];
- dict_table_t* table;
- dict_index_t* index;
+ char norm_name[FN_REFLEN];
+ dict_table_t* table = NULL;
+ dict_index_t* index = NULL;
ibool one_index = (index_name != 0);
int ret = 0;
+ dberr_t err = DB_SUCCESS;
+
if (!srv_defragment) {
return ER_FEATURE_DISABLED;
}
+
normalize_table_name(norm_name, name);
+
table = dict_table_open_on_name(norm_name, FALSE,
FALSE, DICT_ERR_IGNORE_NONE);
+
for (index = dict_table_get_first_index(table); index;
index = dict_table_get_next_index(index)) {
- if (one_index && strcasecmp(index_name, index->name) != 0)
+
+ if (one_index && strcasecmp(index_name, index->name) != 0) {
continue;
+ }
+
if (btr_defragment_find_index(index)) {
// We borrow this error code. When the same index is
// already in the defragmentation queue, issue another
@@ -12693,7 +12713,23 @@ ha_innobase::defragment_table(
ret = ER_SP_ALREADY_EXISTS;
break;
}
- os_event_t event = btr_defragment_add_index(index, async);
+
+ os_event_t event = btr_defragment_add_index(index, async, &err);
+
+ if (err != DB_SUCCESS) {
+ push_warning_printf(
+ current_thd,
+ Sql_condition::WARN_LEVEL_WARN,
+ ER_NO_SUCH_TABLE,
+ "Table %s is encrypted but encryption service or"
+ " used key_id is not available. "
+ " Can't continue checking table.",
+ index->table->name);
+
+ ret = convert_error_code_to_mysql(err, 0, current_thd);
+ break;
+ }
+
if (!async && event) {
while(os_event_wait_time(event, 1000000)) {
if (thd_killed(current_thd)) {
@@ -12704,18 +12740,23 @@ ha_innobase::defragment_table(
}
os_event_free(event);
}
+
if (ret) {
break;
}
+
if (one_index) {
one_index = FALSE;
break;
}
}
+
dict_table_close(table, FALSE, FALSE);
+
if (ret == 0 && one_index) {
ret = ER_NO_SUCH_INDEX;
}
+
return ret;
}
@@ -13175,6 +13216,13 @@ ha_innobase::estimate_rows_upper_bound()
prebuilt->trx->op_info = "";
+ /* Set num_rows less than MERGEBUFF to simulate the case where we do
+ not have enough space to merge the externally sorted file blocks. */
+ DBUG_EXECUTE_IF("set_num_rows_lt_MERGEBUFF",
+ estimate = 2;
+ DBUG_SET("-d,set_num_rows_lt_MERGEBUFF");
+ );
+
DBUG_RETURN((ha_rows) estimate);
}
@@ -13440,7 +13488,6 @@ ha_innobase::info_low(
dict_table_t* ib_table;
ha_rows rec_per_key;
ib_uint64_t n_rows;
- char path[FN_REFLEN];
os_file_stat_t stat_info;
DBUG_ENTER("info");
@@ -13498,17 +13545,6 @@ ha_innobase::info_low(
"returning various info to MySQL";
}
- my_snprintf(path, sizeof(path), "%s/%s%s",
- mysql_data_home, ib_table->name, reg_ext);
-
- unpack_filename(path,path);
-
- /* Note that we do not know the access time of the table,
- nor the CHECK TABLE time, nor the UPDATE or INSERT time. */
-
- if (os_file_get_status(path, &stat_info, false) == DB_SUCCESS) {
- stats.create_time = (ulong) stat_info.ctime;
- }
}
if (flag & HA_STATUS_VARIABLE) {
@@ -13640,6 +13676,7 @@ ha_innobase::info_low(
if (flag & HA_STATUS_CONST) {
ulong i;
+ char path[FN_REFLEN];
/* Verify the number of index in InnoDB and MySQL
matches up. If prebuilt->clust_index_was_generated
holds, InnoDB defines GEN_CLUST_INDEX internally */
@@ -13794,6 +13831,20 @@ ha_innobase::info_low(
if (!(flag & HA_STATUS_NO_LOCK)) {
dict_table_stats_unlock(ib_table, RW_S_LATCH);
}
+
+ my_snprintf(path, sizeof(path), "%s/%s%s",
+ mysql_data_home,
+ table->s->normalized_path.str,
+ reg_ext);
+
+ unpack_filename(path,path);
+
+ /* Note that we do not know the access time of the table,
+ nor the CHECK TABLE time, nor the UPDATE or INSERT time. */
+
+ if (os_file_get_status(path, &stat_info, false) == DB_SUCCESS) {
+ stats.create_time = (ulong) stat_info.ctime;
+ }
}
if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
@@ -14019,7 +14070,7 @@ ha_innobase::check(
server_mutex,
srv_fatal_semaphore_wait_threshold,
SRV_SEMAPHORE_WAIT_EXTENSION);
- bool valid = btr_validate_index(index, prebuilt->trx);
+ dberr_t err = btr_validate_index(index, prebuilt->trx);
/* Restore the fatal lock wait timeout after
CHECK TABLE. */
@@ -14028,19 +14079,32 @@ ha_innobase::check(
srv_fatal_semaphore_wait_threshold,
SRV_SEMAPHORE_WAIT_EXTENSION);
- if (!valid) {
+ if (err != DB_SUCCESS) {
is_ok = false;
innobase_format_name(
index_name, sizeof index_name,
index->name, TRUE);
- push_warning_printf(
- thd,
- Sql_condition::WARN_LEVEL_WARN,
- ER_NOT_KEYFILE,
- "InnoDB: The B-tree of"
- " index %s is corrupted.",
- index_name);
+
+ if (err == DB_DECRYPTION_FAILED) {
+ push_warning_printf(
+ thd,
+ Sql_condition::WARN_LEVEL_WARN,
+ ER_NO_SUCH_TABLE,
+ "Table %s is encrypted but encryption service or"
+ " used key_id is not available. "
+ " Can't continue checking table.",
+ index->table->name);
+ } else {
+ push_warning_printf(
+ thd,
+ Sql_condition::WARN_LEVEL_WARN,
+ ER_NOT_KEYFILE,
+ "InnoDB: The B-tree of"
+ " index %s is corrupted.",
+ index_name);
+ }
+
continue;
}
}
@@ -14838,8 +14902,8 @@ ha_innobase::external_lock(
DBUG_EXECUTE_IF("no_innodb_binlog_errors", skip = true;);
if (!skip) {
#ifdef WITH_WSREP
- if (!wsrep_on(thd)
- || wsrep_thd_exec_mode(thd) == LOCAL_STATE) {
+ if (!wsrep_on(thd) || wsrep_thd_exec_mode(thd) == LOCAL_STATE)
+ {
#endif /* WITH_WSREP */
my_error(ER_BINLOG_STMT_MODE_AND_ROW_ENGINE, MYF(0),
" InnoDB is limited to row-logging when "
@@ -15960,7 +16024,7 @@ ha_innobase::get_auto_increment(
if (prebuilt->autoinc_increment > increment) {
WSREP_DEBUG("autoinc decrease: %llu -> %llu\n"
- "THD: %ld, current: %llu, autoinc: %llu",
+ "THD: %ld, current: %llu, autoinc: %llu",
prebuilt->autoinc_increment,
increment,
thd_get_thread_id(ha_thd()),
@@ -16054,8 +16118,13 @@ ha_innobase::get_error_message(
{
trx_t* trx = check_trx_exists(ha_thd());
- buf->copy(trx->detailed_error, (uint) strlen(trx->detailed_error),
- system_charset_info);
+ if (error == HA_ERR_DECRYPTION_FAILED) {
+ const char *msg = "Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.";
+ buf->copy(msg, (uint)strlen(msg), system_charset_info);
+ } else {
+ buf->copy(trx->detailed_error, (uint) strlen(trx->detailed_error),
+ system_charset_info);
+ }
return(FALSE);
}
@@ -18829,7 +18898,7 @@ innodb_encrypt_tables_update(
const void* save) /*!< in: immediate result
from check function */
{
- fil_crypt_set_encrypt_tables(*static_cast<const uint*>(save));
+ fil_crypt_set_encrypt_tables(*static_cast<const ulong*>(save));
}
static SHOW_VAR innodb_status_variables_export[]= {
@@ -18939,6 +19008,7 @@ wsrep_innobase_kill_one_trx(void * const bf_thd_ptr,
wsrep_abort_slave_trx(bf_seqno,
wsrep_thd_trx_seqno(thd));
} else {
+ wsrep_t *wsrep= get_wsrep();
rcode = wsrep->abort_pre_commit(
wsrep, bf_seqno,
(wsrep_trx_id_t)victim_trx->id
@@ -19009,9 +19079,6 @@ wsrep_innobase_kill_one_trx(void * const bf_thd_ptr,
break;
case QUERY_IDLE:
{
- bool skip_abort= false;
- wsrep_aborting_thd_t abortees;
-
WSREP_DEBUG("kill IDLE for %lu", victim_trx->id);
if (wsrep_thd_exec_mode(thd) == REPL_RECV) {
@@ -19025,35 +19092,22 @@ wsrep_innobase_kill_one_trx(void * const bf_thd_ptr,
/* This will lock thd from proceeding after net_read() */
wsrep_thd_set_conflict_state(thd, ABORTING);
- mysql_mutex_lock(&LOCK_wsrep_rollback);
+ wsrep_lock_rollback();
- abortees = wsrep_aborting_thd;
- while (abortees && !skip_abort) {
- /* check if we have a kill message for this already */
- if (abortees->aborting_thd == thd) {
- skip_abort = true;
- WSREP_WARN("duplicate thd aborter %lu",
- thd_get_thread_id(thd));
- }
- abortees = abortees->next;
- }
- if (!skip_abort) {
- wsrep_aborting_thd_t aborting = (wsrep_aborting_thd_t)
- my_malloc(sizeof(struct wsrep_aborting_thd),
- MYF(0));
- aborting->aborting_thd = thd;
- aborting->next = wsrep_aborting_thd;
- wsrep_aborting_thd = aborting;
+ if (wsrep_aborting_thd_contains(thd)) {
+ WSREP_WARN("duplicate thd aborter %lu",
+ thd_get_thread_id(thd));
+ } else {
+ wsrep_aborting_thd_enqueue(thd);
DBUG_PRINT("wsrep",("enqueuing trx abort for %lu",
- thd_get_thread_id(thd)));
+ thd_get_thread_id(thd)));
WSREP_DEBUG("enqueuing trx abort for (%lu)",
- thd_get_thread_id(thd));
+ thd_get_thread_id(thd));
}
DBUG_PRINT("wsrep",("signalling wsrep rollbacker"));
WSREP_DEBUG("signaling aborter");
- mysql_cond_signal(&COND_wsrep_rollback);
- mysql_mutex_unlock(&LOCK_wsrep_rollback);
+ wsrep_unlock_rollback();
wsrep_thd_UNLOCK(thd);
break;
@@ -19067,6 +19121,7 @@ wsrep_innobase_kill_one_trx(void * const bf_thd_ptr,
DBUG_RETURN(0);
}
+
static int
wsrep_abort_transaction(handlerton* hton, THD *bf_thd, THD *victim_thd,
my_bool signal)
@@ -19074,7 +19129,7 @@ wsrep_abort_transaction(handlerton* hton, THD *bf_thd, THD *victim_thd,
DBUG_ENTER("wsrep_innobase_abort_thd");
trx_t* victim_trx = thd_to_trx(victim_thd);
trx_t* bf_trx = (bf_thd) ? thd_to_trx(bf_thd) : NULL;
- WSREP_DEBUG("abort transaction: BF: %s victim: %s",
+ WSREP_DEBUG("abort transaction: BF: %s victim: %s",
wsrep_thd_query(bf_thd),
wsrep_thd_query(victim_thd));
@@ -20151,6 +20206,14 @@ static MYSQL_SYSVAR_BOOL(disable_background_merge,
NULL, NULL, FALSE);
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
+static MYSQL_SYSVAR_ULONG(buf_dump_status_frequency, srv_buf_dump_status_frequency,
+ PLUGIN_VAR_RQCMDARG,
+ "A number between [0, 100] that tells how oftern buffer pool dump status "
+ "in percentages should be printed. E.g. 10 means that buffer pool dump "
+ "status is printed when every 10% of number of buffer pool pages are "
+ "dumped. Default is 0 (only start and end status is printed).",
+ NULL, NULL, 0, 0, 100, 0);
+
#ifdef WITH_INNODB_DISALLOW_WRITES
/*******************************************************
* innobase_disallow_writes variable definition *
@@ -20728,6 +20791,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(debug_force_scrubbing),
#endif
MYSQL_SYSVAR(instrument_semaphores),
+ MYSQL_SYSVAR(buf_dump_status_frequency),
NULL
};
@@ -20782,7 +20846,8 @@ i_s_innodb_changed_pages,
i_s_innodb_mutexes,
i_s_innodb_sys_semaphore_waits,
i_s_innodb_tablespaces_encryption,
-i_s_innodb_tablespaces_scrubbing
+i_s_innodb_tablespaces_scrubbing,
+i_s_innodb_changed_page_bitmaps
maria_declare_plugin_end;
/** @brief Initialize the default value of innodb_commit_concurrency.
@@ -21366,7 +21431,7 @@ innodb_encrypt_tables_validate(
if (check_sysvar_enum(thd, var, save, value))
return 1;
- long encrypt_tables = *(long*)save;
+ ulong encrypt_tables = *(ulong*)save;
if (encrypt_tables
&& !encryption_key_id_exists(FIL_DEFAULT_ENCRYPTION_KEY)) {
@@ -21385,3 +21450,59 @@ static void innodb_remember_check_sysvar_funcs()
ut_ad((MYSQL_SYSVAR_NAME(checksum_algorithm).flags & 0x1FF) == PLUGIN_VAR_ENUM);
check_sysvar_enum = MYSQL_SYSVAR_NAME(checksum_algorithm).check;
}
+
+/********************************************************************//**
+Helper function to push warnings from InnoDB internals to SQL-layer. */
+UNIV_INTERN
+void
+ib_push_warning(
+ trx_t* trx, /*!< in: trx */
+ ulint error, /*!< in: error code to push as warning */
+ const char *format,/*!< in: warning message */
+ ...)
+{
+ va_list args;
+ THD *thd = (THD *)trx->mysql_thd;
+ char *buf;
+#define MAX_BUF_SIZE 4*1024
+
+ va_start(args, format);
+ buf = (char *)my_malloc(MAX_BUF_SIZE, MYF(MY_WME));
+ vsprintf(buf,format, args);
+
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ convert_error_code_to_mysql((dberr_t)error, 0, thd),
+ buf);
+ my_free(buf);
+ va_end(args);
+}
+
+/********************************************************************//**
+Helper function to push warnings from InnoDB internals to SQL-layer. */
+UNIV_INTERN
+void
+ib_push_warning(
+ void* ithd, /*!< in: thd */
+ ulint error, /*!< in: error code to push as warning */
+ const char *format,/*!< in: warning message */
+ ...)
+{
+ va_list args;
+ THD *thd = (THD *)ithd;
+ char *buf;
+#define MAX_BUF_SIZE 4*1024
+
+ if (ithd == NULL) {
+ thd = current_thd;
+ }
+
+ va_start(args, format);
+ buf = (char *)my_malloc(MAX_BUF_SIZE, MYF(MY_WME));
+ vsprintf(buf,format, args);
+
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ convert_error_code_to_mysql((dberr_t)error, 0, thd),
+ buf);
+ my_free(buf);
+ va_end(args);
+}
diff --git a/storage/xtradb/handler/ha_innodb.h b/storage/xtradb/handler/ha_innodb.h
index aadd2fc5bb8..2027a593140 100644
--- a/storage/xtradb/handler/ha_innodb.h
+++ b/storage/xtradb/handler/ha_innodb.h
@@ -61,18 +61,18 @@ struct row_prebuilt_t;
/** Engine specific table options are defined using this struct */
struct ha_table_option_struct
{
- bool page_compressed; /*!< Table is using page compression
- if this option is true. */
- int page_compression_level; /*!< Table page compression level
- or UNIV_UNSPECIFIED. */
- uint atomic_writes; /*!< Use atomic writes for this
- table if this options is ON or
- in DEFAULT if
- srv_use_atomic_writes=1.
- Atomic writes are not used if
- value OFF.*/
- uint encryption; /*!< DEFAULT, ON, OFF */
- int encryption_key_id; /*!< encryption key id */
+ bool page_compressed; /*!< Table is using page compression
+ if this option is true. */
+ ulonglong page_compression_level; /*!< Table page compression level
+ 0-9. */
+ uint atomic_writes; /*!< Use atomic writes for this
+ table if this options is ON or
+ in DEFAULT if
+ srv_use_atomic_writes=1.
+ Atomic writes are not used if
+ value OFF.*/
+ uint encryption; /*!< DEFAULT, ON, OFF */
+ ulonglong encryption_key_id; /*!< encryption key id */
};
/** The class defining a handle to an Innodb table */
diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc
index 4b09820d400..c47b0f499de 100644
--- a/storage/xtradb/handler/handler0alter.cc
+++ b/storage/xtradb/handler/handler0alter.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2005, 2014, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2014, SkySQL Ab. All Rights Reserved.
+Copyright (c) 2013, 2015, MariaDB Corporation. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -400,6 +400,35 @@ ha_innobase::check_if_supported_inplace_alter(
}
}
+ /* If we have column that has changed from NULL -> NOT NULL
+ and column default has changed we need to do additional
+ check. */
+ if ((ha_alter_info->handler_flags
+ & Alter_inplace_info::ALTER_COLUMN_NOT_NULLABLE) &&
+ (ha_alter_info->handler_flags
+ & Alter_inplace_info::ALTER_COLUMN_DEFAULT)) {
+ Alter_info *alter_info = ha_alter_info->alter_info;
+ List_iterator<Create_field> def_it(alter_info->create_list);
+ Create_field *def;
+ while ((def=def_it++)) {
+
+ /* If this is first column definition whose SQL type
+ is TIMESTAMP and it is defined as NOT NULL and
+ it has either constant default or function default
+ we must use "Copy" method. */
+ if (is_timestamp_type(def->sql_type)) {
+ if ((def->flags & NOT_NULL_FLAG) != 0 && // NOT NULL
+ (def->def != NULL || // constant default ?
+ def->unireg_check != Field::NONE)) { // function default
+ ha_alter_info->unsupported_reason = innobase_get_err_msg(
+ ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOT_NULL);
+ DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
+ }
+ break;
+ }
+ }
+ }
+
/* We should be able to do the operation in-place.
See if we can do it online (LOCK=NONE). */
bool online = true;
@@ -824,7 +853,7 @@ innobase_find_fk_index(
if (!(index->type & DICT_FTS)
&& dict_foreign_qualify_index(
table, col_names, columns, n_cols,
- index, NULL, true, 0)) {
+ index, NULL, true, 0, NULL, NULL, NULL)) {
for (ulint i = 0; i < n_drop_index; i++) {
if (index == drop_index[i]) {
/* Skip to-be-dropped indexes. */
@@ -1014,7 +1043,7 @@ innobase_get_foreign_key_info(
referenced_table, 0,
referenced_column_names,
i, index,
- TRUE, FALSE);
+ TRUE, FALSE, NULL, NULL, NULL);
DBUG_EXECUTE_IF(
"innodb_test_no_reference_idx",
@@ -2803,6 +2832,7 @@ prepare_inplace_alter_table_dict(
to rebuild the table with a temporary name. */
if (new_clustered) {
+ fil_space_crypt_t* crypt_data;
const char* new_table_name
= dict_mem_create_temporary_tablename(
ctx->heap,
@@ -2810,6 +2840,15 @@ prepare_inplace_alter_table_dict(
ctx->new_table->id);
ulint n_cols;
dtuple_t* add_cols;
+ ulint key_id = FIL_DEFAULT_ENCRYPTION_KEY;
+ fil_encryption_t mode = FIL_SPACE_ENCRYPTION_DEFAULT;
+
+ crypt_data = fil_space_get_crypt_data(ctx->prebuilt->table->space);
+
+ if (crypt_data) {
+ key_id = crypt_data->key_id;
+ mode = crypt_data->encryption;
+ }
if (innobase_check_foreigns(
ha_alter_info, altered_table, old_table,
@@ -2841,7 +2880,7 @@ prepare_inplace_alter_table_dict(
/* The initial space id 0 may be overridden later. */
ctx->new_table = dict_mem_table_create(
- new_table_name, 0, n_cols, flags, flags2, false);
+ new_table_name, 0, n_cols, flags, flags2);
/* The rebuilt indexed_table will use the renamed
column names. */
ctx->col_names = NULL;
@@ -2941,7 +2980,7 @@ prepare_inplace_alter_table_dict(
}
error = row_create_table_for_mysql(
- ctx->new_table, ctx->trx, false);
+ ctx->new_table, ctx->trx, false, mode, key_id);
switch (error) {
dict_table_t* temp_table;
@@ -3331,7 +3370,7 @@ innobase_check_foreign_key_index(
foreign->referenced_col_names,
foreign->n_fields, index,
/*check_charsets=*/TRUE,
- /*check_null=*/FALSE)
+ /*check_null=*/FALSE, NULL, NULL, NULL)
&& !innobase_find_equiv_index(
foreign->referenced_col_names,
foreign->n_fields,
@@ -3359,7 +3398,7 @@ innobase_check_foreign_key_index(
foreign->foreign_col_names,
foreign->n_fields, index,
/*check_charsets=*/TRUE,
- /*check_null=*/FALSE)
+ /*check_null=*/FALSE, NULL,NULL, NULL)
&& !innobase_find_equiv_index(
foreign->foreign_col_names,
foreign->n_fields,
@@ -4129,6 +4168,13 @@ oom:
: ha_alter_info->key_info_buffer[
prebuilt->trx->error_key_num].name);
break;
+ case DB_DECRYPTION_FAILED: {
+ String str;
+ const char* engine= table_type();
+ get_error_message(HA_ERR_DECRYPTION_FAILED, &str);
+ my_error(ER_GET_ERRMSG, MYF(0), HA_ERR_DECRYPTION_FAILED, str.c_ptr(), engine);
+ break;
+ }
default:
my_error_innodb(error,
table_share->table_name.str,
@@ -4828,7 +4874,8 @@ innobase_update_foreign_try(
fk->n_fields, fk->referenced_index, TRUE,
fk->type
& (DICT_FOREIGN_ON_DELETE_SET_NULL
- | DICT_FOREIGN_ON_UPDATE_SET_NULL));
+ | DICT_FOREIGN_ON_UPDATE_SET_NULL),
+ NULL, NULL, NULL);
if (!fk->foreign_index) {
my_error(ER_FK_INCORRECT_OPTION,
MYF(0), table_name, fk->id);
@@ -4840,7 +4887,7 @@ innobase_update_foreign_try(
names, while the columns in ctx->old_table have not
been renamed yet. */
error = dict_create_add_foreign_to_dictionary(
- ctx->old_table->name, fk, trx);
+ (dict_table_t*)ctx->old_table, ctx->old_table->name, fk, trx);
DBUG_EXECUTE_IF(
"innodb_test_cannot_add_fk_system",
diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc
index edc9e0a4f8f..e124cb98f99 100644
--- a/storage/xtradb/handler/i_s.cc
+++ b/storage/xtradb/handler/i_s.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2007, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2007, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyrigth (c) 2014, 2015, MariaDB Corporation
This program is free software; you can redistribute it and/or modify it under
@@ -3233,8 +3233,6 @@ i_s_fts_index_cache_fill_one_index(
for (rbt_node = rbt_first(index_cache->words);
rbt_node;
rbt_node = rbt_next(index_cache->words, rbt_node)) {
- doc_id_t doc_id = 0;
-
fts_tokenizer_word_t* word;
word = rbt_value(fts_tokenizer_word_t, rbt_node);
@@ -3260,6 +3258,7 @@ i_s_fts_index_cache_fill_one_index(
fts_node_t* node;
byte* ptr;
ulint decoded = 0;
+ doc_id_t doc_id = 0;
node = static_cast<fts_node_t*> (ib_vector_get(
word->nodes, i));
@@ -3931,10 +3930,14 @@ i_s_fts_config_fill(
if (!user_table) {
DBUG_RETURN(0);
+ } else if (!dict_table_has_fts_index(user_table)) {
+ dict_table_close(user_table, FALSE, FALSE);
+
+ DBUG_RETURN(0);
}
trx = trx_allocate_for_background();
- trx->op_info = "Select for FTS DELETE TABLE";
+ trx->op_info = "Select for FTS CONFIG TABLE";
FTS_INIT_FTS_TABLE(&fts_table, "CONFIG", FTS_COMMON_TABLE, user_table);
@@ -9459,3 +9462,128 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_semaphore_waits =
STRUCT_FLD(version_info, INNODB_VERSION_STR),
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
};
+
+static ST_FIELD_INFO innodb_changed_page_bitmaps_fields_info[] =
+{
+ {STRUCT_FLD(field_name, "dummy"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ END_OF_ST_FIELD_INFO
+};
+
+/*******************************************************************//**
+Function to populate INFORMATION_SCHEMA.CHANGED_PAGE_BITMAPS
+@return 0 on success */
+static
+int
+fill_changed_page_bitmaps_table(
+/*============================*/
+ THD* thd, /*!< in: thread */
+ TABLE_LIST* tables, /*!< in/out: tables to fill */
+ Item* ) /*!< in: condition (not used) */
+{
+ Field** fields = tables->table->field;
+ DBUG_ENTER("fill_changed_page_bitmaps");
+ RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
+
+ /* deny access to user without PROCESS_ACL privilege */
+ if (check_global_access(thd, PROCESS_ACL)) {
+ DBUG_RETURN(0);
+ }
+ OK(field_store_ulint(fields[0], 0));
+ OK(schema_table_store_record(thd, tables->table));
+
+ DBUG_RETURN(0);
+}
+
+/*******************************************************************//**
+Flush support for changed_page_bitmaps table.
+@return 0 on success */
+static
+int
+flush_changed_page_bitmaps()
+/*========================*/
+{
+ DBUG_ENTER("flush_changed_page_bitmaps");
+ if (srv_track_changed_pages) {
+ os_event_reset(srv_checkpoint_completed_event);
+ log_online_follow_redo_log();
+ }
+ DBUG_RETURN(0);
+}
+
+/*******************************************************************//**
+Bind the dynamic table INFORMATION_SCHEMA.CHANGED_PAGE_BITMAP
+@return 0 on success */
+static
+int
+innodb_changed_page_bitmaps_init(
+/*=============================*/
+ void* p) /*!< in/out: table schema object */
+{
+ ST_SCHEMA_TABLE* schema;
+
+ DBUG_ENTER("innodb_changed_page_bitmaps_init");
+
+ schema = (ST_SCHEMA_TABLE*) p;
+
+ schema->fields_info = innodb_changed_page_bitmaps_fields_info;
+ schema->fill_table = fill_changed_page_bitmaps_table;
+ schema->reset_table= flush_changed_page_bitmaps;
+
+ DBUG_RETURN(0);
+}
+
+UNIV_INTERN struct st_mysql_plugin i_s_innodb_changed_page_bitmaps =
+{
+ /* the plugin type (a MYSQL_XXX_PLUGIN value) */
+ /* int */
+ STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
+
+ /* pointer to type-specific plugin descriptor */
+ /* void* */
+ STRUCT_FLD(info, &i_s_info),
+
+ /* plugin name */
+ /* const char* */
+ STRUCT_FLD(name, "CHANGED_PAGE_BITMAPS"),
+
+ /* plugin author (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(author, maria_plugin_author),
+
+ /* general descriptive text (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(descr, "XtraDB dummy changed_page_bitmaps table"),
+
+ /* the plugin license (PLUGIN_LICENSE_XXX) */
+ /* int */
+ STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
+
+ /* the function to invoke when plugin is loaded */
+ /* int (*)(void*); */
+ STRUCT_FLD(init, innodb_changed_page_bitmaps_init),
+
+ /* the function to invoke when plugin is unloaded */
+ /* int (*)(void*); */
+ STRUCT_FLD(deinit, i_s_common_deinit),
+
+ /* plugin version (for SHOW PLUGINS) */
+ /* unsigned int */
+ STRUCT_FLD(version, INNODB_VERSION_SHORT),
+
+ /* struct st_mysql_show_var* */
+ STRUCT_FLD(status_vars, NULL),
+
+ /* struct st_mysql_sys_var** */
+ STRUCT_FLD(system_vars, NULL),
+
+ /* Maria extension */
+ STRUCT_FLD(version_info, INNODB_VERSION_STR),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+};
+
diff --git a/storage/xtradb/handler/i_s.h b/storage/xtradb/handler/i_s.h
index e6e342e4357..55ef6e7ea42 100644
--- a/storage/xtradb/handler/i_s.h
+++ b/storage/xtradb/handler/i_s.h
@@ -67,6 +67,7 @@ extern struct st_mysql_plugin i_s_innodb_mutexes;
extern struct st_maria_plugin i_s_innodb_tablespaces_encryption;
extern struct st_maria_plugin i_s_innodb_tablespaces_scrubbing;
extern struct st_mysql_plugin i_s_innodb_sys_semaphore_waits;
+extern struct st_mysql_plugin i_s_innodb_changed_page_bitmaps;
/** maximum number of buffer page info we would cache. */
#define MAX_BUF_INFO_CACHED 10000
diff --git a/storage/xtradb/ibuf/ibuf0ibuf.cc b/storage/xtradb/ibuf/ibuf0ibuf.cc
index 068a9fc9334..972208c51bd 100644
--- a/storage/xtradb/ibuf/ibuf0ibuf.cc
+++ b/storage/xtradb/ibuf/ibuf0ibuf.cc
@@ -611,8 +611,7 @@ ibuf_init_at_db_start(void)
heap = mem_heap_create(450);
/* Use old-style record format for the insert buffer. */
- table = dict_mem_table_create(IBUF_TABLE_NAME, IBUF_SPACE_ID, 1, 0, 0,
- false);
+ table = dict_mem_table_create(IBUF_TABLE_NAME, IBUF_SPACE_ID, 1, 0, 0);
dict_mem_table_add_col(table, heap, "DUMMY_COLUMN", DATA_BINARY, 0, 0);
@@ -1573,7 +1572,7 @@ ibuf_dummy_index_create(
table = dict_mem_table_create("IBUF_DUMMY",
DICT_HDR_SPACE, n,
- comp ? DICT_TF_COMPACT : 0, 0, true);
+ comp ? DICT_TF_COMPACT : 0, 0);
index = dict_mem_index_create("IBUF_DUMMY", "IBUF_DUMMY",
DICT_HDR_SPACE, 0, n);
diff --git a/storage/xtradb/include/api0api.h b/storage/xtradb/include/api0api.h
index d77d691becc..e4c9c941de5 100644
--- a/storage/xtradb/include/api0api.h
+++ b/storage/xtradb/include/api0api.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2011, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -494,6 +494,14 @@ ib_trx_state(
/*=========*/
ib_trx_t ib_trx); /*!< in: trx handle */
+
+/*****************************************************************//**
+Check if the transaction is read_only */
+ib_u32_t
+ib_trx_read_only(
+/*=============*/
+ ib_trx_t ib_trx); /*!< in: trx handle */
+
/*****************************************************************//**
Release the resources of the transaction. If the transaction was
selected as a victim by InnoDB and rolled back then use this function
diff --git a/storage/xtradb/include/btr0btr.h b/storage/xtradb/include/btr0btr.h
index d701e82cf83..36aaf676ccf 100644
--- a/storage/xtradb/include/btr0btr.h
+++ b/storage/xtradb/include/btr0btr.h
@@ -2,7 +2,7 @@
Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2014, SkySQL Ab. All Rights Reserved.
+Copyright (c) 2014, 2015, MariaDB Corporation. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -262,10 +262,8 @@ btr_block_get_func(
ulint mode, /*!< in: latch mode */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
-# ifdef UNIV_SYNC_DEBUG
- const dict_index_t* index, /*!< in: index tree, may be NULL
+ dict_index_t* index, /*!< in: index tree, may be NULL
if it is not an insert buffer tree */
-# endif /* UNIV_SYNC_DEBUG */
mtr_t* mtr); /*!< in/out: mini-transaction */
# ifdef UNIV_SYNC_DEBUG
/** Gets a buffer page and declares its latching order level.
@@ -289,7 +287,8 @@ btr_block_get_func(
@param mtr mini-transaction handle
@return the block descriptor */
# define btr_block_get(space,zip_size,page_no,mode,idx,mtr) \
- btr_block_get_func(space,zip_size,page_no,mode,__FILE__,__LINE__,mtr)
+ btr_block_get_func(space,zip_size,page_no,mode, \
+ __FILE__,__LINE__,idx,mtr)
# endif /* UNIV_SYNC_DEBUG */
/** Gets a buffer page and declares its latching order level.
@param space tablespace identifier
@@ -300,7 +299,8 @@ btr_block_get_func(
@param mtr mini-transaction handle
@return the uncompressed page frame */
# define btr_page_get(space,zip_size,page_no,mode,idx,mtr) \
- buf_block_get_frame(btr_block_get(space,zip_size,page_no,mode,idx,mtr))
+ buf_block_get_frame(btr_block_get(space,zip_size,page_no, \
+ mode,idx,mtr))
#endif /* !UNIV_HOTBACKUP */
/**************************************************************//**
Gets the index id field of a page.
@@ -800,9 +800,9 @@ btr_index_rec_validate(
__attribute__((nonnull, warn_unused_result));
/**************************************************************//**
Checks the consistency of an index tree.
-@return TRUE if ok */
+@return DB_SUCCESS if ok, error code if not */
UNIV_INTERN
-bool
+dberr_t
btr_validate_index(
/*===============*/
dict_index_t* index, /*!< in: index */
@@ -828,7 +828,7 @@ Removes a page from the level list of pages.
@param index in: index tree
@param mtr in/out: mini-transaction */
# define btr_level_list_remove(space,zip_size,page,index,mtr) \
- btr_level_list_remove_func(space,zip_size,page,mtr)
+ btr_level_list_remove_func(space,zip_size,page,index,mtr)
#endif /* UNIV_SYNC_DEBUG */
/*************************************************************//**
@@ -841,11 +841,8 @@ btr_level_list_remove_func(
ulint zip_size,/*!< in: compressed page size in bytes
or 0 for uncompressed pages */
page_t* page, /*!< in/out: page to remove */
-#ifdef UNIV_SYNC_DEBUG
- const dict_index_t* index, /*!< in: index tree */
-#endif /* UNIV_SYNC_DEBUG */
- mtr_t* mtr) /*!< in/out: mini-transaction */
- __attribute__((nonnull));
+ dict_index_t* index, /*!< in: index tree */
+ mtr_t* mtr); /*!< in/out: mini-transaction */
/*************************************************************//**
If page is the only on its level, this function moves its records to the
diff --git a/storage/xtradb/include/btr0btr.ic b/storage/xtradb/include/btr0btr.ic
index 40b468b200a..5fc621f469d 100644
--- a/storage/xtradb/include/btr0btr.ic
+++ b/storage/xtradb/include/btr0btr.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -48,22 +49,27 @@ btr_block_get_func(
ulint mode, /*!< in: latch mode */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
-#ifdef UNIV_SYNC_DEBUG
- const dict_index_t* index, /*!< in: index tree, may be NULL
+ dict_index_t* index, /*!< in: index tree, may be NULL
if it is not an insert buffer tree */
-#endif /* UNIV_SYNC_DEBUG */
mtr_t* mtr) /*!< in/out: mtr */
{
buf_block_t* block;
+ dberr_t err;
block = buf_page_get_gen(space, zip_size, page_no, mode,
- NULL, BUF_GET, file, line, mtr);
+ NULL, BUF_GET, file, line, mtr, &err);
- if (mode != RW_NO_LATCH) {
+ if (err == DB_DECRYPTION_FAILED) {
+ index->table->is_encrypted = true;
+ }
+
+ if (block) {
+ if (mode != RW_NO_LATCH) {
- buf_block_dbg_add_level(
- block, index != NULL && dict_index_is_ibuf(index)
- ? SYNC_IBUF_TREE_NODE : SYNC_TREE_NODE);
+ buf_block_dbg_add_level(
+ block, index != NULL && dict_index_is_ibuf(index)
+ ? SYNC_IBUF_TREE_NODE : SYNC_TREE_NODE);
+ }
}
return(block);
diff --git a/storage/xtradb/include/btr0cur.h b/storage/xtradb/include/btr0cur.h
index f4b91b08fc5..2c60f3ad64c 100644
--- a/storage/xtradb/include/btr0cur.h
+++ b/storage/xtradb/include/btr0cur.h
@@ -136,7 +136,7 @@ Note that if mode is PAGE_CUR_LE, which is used in inserts, then
cursor->up_match and cursor->low_match both will have sensible values.
If mode is PAGE_CUR_GE, then up_match will a have a sensible value. */
UNIV_INTERN
-void
+dberr_t
btr_cur_search_to_nth_level(
/*========================*/
dict_index_t* index, /*!< in: index */
@@ -173,7 +173,7 @@ btr_cur_search_to_nth_level(
/*****************************************************************//**
Opens a cursor at either end of an index. */
UNIV_INTERN
-void
+dberr_t
btr_cur_open_at_index_side_func(
/*============================*/
bool from_left, /*!< in: true if open to the low end,
diff --git a/storage/xtradb/include/btr0defragment.h b/storage/xtradb/include/btr0defragment.h
index 99beb0a24ba..5c54b898e37 100644
--- a/storage/xtradb/include/btr0defragment.h
+++ b/storage/xtradb/include/btr0defragment.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (C) 2013, 2014 Facebook, Inc. All Rights Reserved.
+Copyright (C) 2014, 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -67,7 +68,9 @@ is a synchronized defragmentation. */
os_event_t
btr_defragment_add_index(
dict_index_t* index, /*!< index to be added */
- bool async); /*!< whether this is an async defragmentation */
+ bool async, /*!< whether this is an async
+ defragmentation */
+ dberr_t* err); /*!< out: error code */
/******************************************************************//**
When table is dropped, this function is called to mark a table as removed in
btr_efragment_wq. The difference between this function and the remove_index
diff --git a/storage/xtradb/include/btr0pcur.h b/storage/xtradb/include/btr0pcur.h
index cfbaacf4de3..d8e7cf6b283 100644
--- a/storage/xtradb/include/btr0pcur.h
+++ b/storage/xtradb/include/btr0pcur.h
@@ -114,7 +114,7 @@ btr_pcur_open_low(
Opens an persistent cursor to an index tree without initializing the
cursor. */
UNIV_INLINE
-void
+dberr_t
btr_pcur_open_with_no_init_func(
/*============================*/
dict_index_t* index, /*!< in: index */
@@ -143,7 +143,7 @@ btr_pcur_open_with_no_init_func(
/*****************************************************************//**
Opens a persistent cursor at either end of an index. */
UNIV_INLINE
-void
+dberr_t
btr_pcur_open_at_index_side(
/*========================*/
bool from_left, /*!< in: true if open to the low end,
diff --git a/storage/xtradb/include/btr0pcur.ic b/storage/xtradb/include/btr0pcur.ic
index 7e355d3709d..1cd13824542 100644
--- a/storage/xtradb/include/btr0pcur.ic
+++ b/storage/xtradb/include/btr0pcur.ic
@@ -447,7 +447,7 @@ btr_pcur_open_low(
Opens an persistent cursor to an index tree without initializing the
cursor. */
UNIV_INLINE
-void
+dberr_t
btr_pcur_open_with_no_init_func(
/*============================*/
dict_index_t* index, /*!< in: index */
@@ -472,6 +472,7 @@ btr_pcur_open_with_no_init_func(
mtr_t* mtr) /*!< in: mtr */
{
btr_cur_t* btr_cursor;
+ dberr_t err = DB_SUCCESS;
cursor->latch_mode = latch_mode;
cursor->search_mode = mode;
@@ -480,20 +481,21 @@ btr_pcur_open_with_no_init_func(
btr_cursor = btr_pcur_get_btr_cur(cursor);
- btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode,
- btr_cursor, has_search_latch,
- file, line, mtr);
+ err = btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode,
+ btr_cursor, has_search_latch,
+ file, line, mtr);
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
cursor->trx_if_known = NULL;
+ return err;
}
/*****************************************************************//**
Opens a persistent cursor at either end of an index. */
UNIV_INLINE
-void
+dberr_t
btr_pcur_open_at_index_side(
/*========================*/
bool from_left, /*!< in: true if open to the low end,
@@ -506,6 +508,8 @@ btr_pcur_open_at_index_side(
(0=leaf) */
mtr_t* mtr) /*!< in/out: mini-transaction */
{
+ dberr_t err = DB_SUCCESS;
+
pcur->latch_mode = BTR_LATCH_MODE_WITHOUT_FLAGS(latch_mode);
pcur->search_mode = from_left ? PAGE_CUR_G : PAGE_CUR_L;
@@ -514,13 +518,15 @@ btr_pcur_open_at_index_side(
btr_pcur_init(pcur);
}
- btr_cur_open_at_index_side(from_left, index, latch_mode,
- btr_pcur_get_btr_cur(pcur), level, mtr);
+ err = btr_cur_open_at_index_side(from_left, index, latch_mode,
+ btr_pcur_get_btr_cur(pcur), level, mtr);
pcur->pos_state = BTR_PCUR_IS_POSITIONED;
pcur->old_stored = BTR_PCUR_OLD_NOT_STORED;
pcur->trx_if_known = NULL;
+
+ return (err);
}
/**********************************************************************//**
diff --git a/storage/xtradb/include/buf0buf.h b/storage/xtradb/include/buf0buf.h
index 3179fb07031..b35ab9df338 100644
--- a/storage/xtradb/include/buf0buf.h
+++ b/storage/xtradb/include/buf0buf.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2014, SkySQL Ab. All Rights Reserved.
+Copyright (c) 2013, 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -97,9 +97,6 @@ extern buf_block_t* back_block1; /*!< first block, for --apply-log */
extern buf_block_t* back_block2; /*!< second block, for page reorganize */
#endif /* !UNIV_HOTBACKUP */
-/** Magic value to use instead of checksums when they are disabled */
-#define BUF_NO_CHECKSUM_MAGIC 0xDEADBEEFUL
-
/** @brief States of a control block
@see buf_page_t
@@ -431,7 +428,8 @@ buf_page_get_gen(
BUF_GET_IF_IN_POOL_OR_WATCH */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
- mtr_t* mtr); /*!< in: mini-transaction */
+ mtr_t* mtr, /*!< in: mini-transaction */
+ dberr_t* err = NULL); /*!< out: error code */
/********************************************************************//**
Initializes a page to the buffer buf_pool. The page is usually not read
from a file even if it cannot be found in the buffer buf_pool. This is one
@@ -1477,9 +1475,9 @@ UNIV_INTERN
byte*
buf_page_encrypt_before_write(
/*==========================*/
- buf_page_t* page, /*!< in/out: buffer page to be flushed */
- const byte* frame,
- ulint space_id);
+ buf_page_t* page, /*!< in/out: buffer page to be flushed */
+ byte* frame, /*!< in: src frame */
+ ulint space_id); /*!< in: space id */
/**********************************************************************
The hook that is called after page is written to disk.
@@ -1614,6 +1612,14 @@ struct buf_page_t{
operation needed. */
unsigned key_version; /*!< key version for this block */
+ bool page_encrypted; /*!< page is page encrypted */
+ bool page_compressed;/*!< page is page compressed */
+ ulint stored_checksum;/*!< stored page checksum if page
+ encrypted */
+ bool encrypted; /*!< page is still encrypted */
+ ulint calculated_checksum;
+ /*!< calculated checksum if page
+ encrypted */
ulint real_size; /*!< Real size of the page
Normal pages == UNIV_PAGE_SIZE
diff --git a/storage/xtradb/include/buf0buf.ic b/storage/xtradb/include/buf0buf.ic
index 89c35caa815..8c8a3c9f975 100644
--- a/storage/xtradb/include/buf0buf.ic
+++ b/storage/xtradb/include/buf0buf.ic
@@ -689,6 +689,10 @@ buf_block_get_frame(
/*================*/
const buf_block_t* block) /*!< in: pointer to the control block */
{
+ if (!block) {
+ return NULL;
+ }
+
SRV_CORRUPT_TABLE_CHECK(block, return(0););
switch (buf_block_get_state(block)) {
@@ -696,6 +700,9 @@ buf_block_get_frame(
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
case BUF_BLOCK_NOT_USED:
+ if (block->page.encrypted) {
+ goto ok;
+ }
ut_error;
break;
case BUF_BLOCK_FILE_PAGE:
diff --git a/storage/xtradb/include/buf0checksum.h b/storage/xtradb/include/buf0checksum.h
index cd21781dc6e..6818345f965 100644
--- a/storage/xtradb/include/buf0checksum.h
+++ b/storage/xtradb/include/buf0checksum.h
@@ -28,11 +28,10 @@ Created Aug 11, 2011 Vasil Dimov
#include "univ.i"
-#ifndef UNIV_INNOCHECKSUM
-
#include "buf0types.h"
-#endif /* !UNIV_INNOCHECKSUM */
+/** Magic value to use instead of checksums when they are disabled */
+#define BUF_NO_CHECKSUM_MAGIC 0xDEADBEEFUL
/********************************************************************//**
Calculates a page CRC32 which is stored to the page when it is written
@@ -70,8 +69,6 @@ buf_calc_page_old_checksum(
/*=======================*/
const byte* page); /*!< in: buffer page */
-#ifndef UNIV_INNOCHECKSUM
-
/********************************************************************//**
Return a printable string describing the checksum algorithm.
@return algorithm name */
@@ -83,6 +80,4 @@ buf_checksum_algorithm_name(
extern ulong srv_checksum_algorithm;
-#endif /* !UNIV_INNOCHECKSUM */
-
#endif /* buf0checksum_h */
diff --git a/storage/xtradb/include/buf0lru.h b/storage/xtradb/include/buf0lru.h
index 6415540178c..f421e329bf0 100644
--- a/storage/xtradb/include/buf0lru.h
+++ b/storage/xtradb/include/buf0lru.h
@@ -28,7 +28,9 @@ Created 11/5/1995 Heikki Tuuri
#include "univ.i"
#ifndef UNIV_HOTBACKUP
+#ifndef UNIV_INNOCHECKSUM
#include "ut0byte.h"
+#endif
#include "buf0types.h"
// Forward declaration
diff --git a/storage/xtradb/include/buf0rea.h b/storage/xtradb/include/buf0rea.h
index 9adeaa7455a..f0652b5d2cd 100644
--- a/storage/xtradb/include/buf0rea.h
+++ b/storage/xtradb/include/buf0rea.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -39,10 +40,12 @@ UNIV_INTERN
ibool
buf_read_page(
/*==========*/
- ulint space, /*!< in: space id */
- ulint zip_size,/*!< in: compressed page size in bytes, or 0 */
- ulint offset, /*!< in: page number */
- trx_t* trx);
+ ulint space, /*!< in: space id */
+ ulint zip_size, /*!< in: compressed page size in bytes, or 0 */
+ ulint offset, /*!< in: page number */
+ trx_t* trx, /*!< in: trx */
+ buf_page_t** bpage /*!< out: page */
+);
/********************************************************************//**
High-level function which reads a page asynchronously from a file to the
buffer buf_pool if it is not already there. Sets the io_fix flag and sets
diff --git a/storage/xtradb/include/db0err.h b/storage/xtradb/include/db0err.h
index dab917e18db..b11c5f4ea1a 100644
--- a/storage/xtradb/include/db0err.h
+++ b/storage/xtradb/include/db0err.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -132,6 +133,11 @@ enum dberr_t {
/*< Too many words in a phrase */
DB_TOO_BIG_FOR_REDO, /* Record length greater than 10%
of redo log */
+ DB_DECRYPTION_FAILED, /* Tablespace encrypted and
+ decrypt operation failed because
+ of missing key management plugin,
+ or missing or incorrect key or
+ incorret AES method or algorithm. */
/* The following are partial failure codes */
DB_FAIL = 1000,
DB_OVERFLOW,
diff --git a/storage/xtradb/include/dict0crea.h b/storage/xtradb/include/dict0crea.h
index 67eab9058da..3b746fcf83c 100644
--- a/storage/xtradb/include/dict0crea.h
+++ b/storage/xtradb/include/dict0crea.h
@@ -32,6 +32,7 @@ Created 1/8/1996 Heikki Tuuri
#include "que0types.h"
#include "row0types.h"
#include "mtr0mtr.h"
+#include "fil0crypt.h"
/*********************************************************************//**
Creates a table create graph.
@@ -43,8 +44,10 @@ tab_create_graph_create(
dict_table_t* table, /*!< in: table to create, built as a memory data
structure */
mem_heap_t* heap, /*!< in: heap where created */
- bool commit);/*!< in: true if the commit node should be
+ bool commit, /*!< in: true if the commit node should be
added to the query graph */
+ fil_encryption_t mode, /*!< in: encryption mode */
+ ulint key_id);/*!< in: encryption key_id */
/*********************************************************************//**
Creates an index create graph.
@return own: index create node */
@@ -110,6 +113,17 @@ UNIV_INTERN
dberr_t
dict_create_or_check_foreign_constraint_tables(void);
/*================================================*/
+
+/********************************************************************//**
+Construct foreign key constraint defintion from data dictionary information.
+*/
+UNIV_INTERN
+char*
+dict_foreign_def_get(
+/*=================*/
+ dict_foreign_t* foreign,/*!< in: foreign */
+ trx_t* trx); /*!< in: trx */
+
/********************************************************************//**
Generate a foreign key constraint name when it was not named by the user.
A generated constraint has a name of the format dbname/tablename_ibfk_NUMBER,
@@ -174,6 +188,7 @@ UNIV_INTERN
dberr_t
dict_create_add_foreign_to_dictionary(
/*==================================*/
+ dict_table_t* table, /*!< in: table */
const char* name, /*!< in: table name */
const dict_foreign_t* foreign,/*!< in: foreign key */
trx_t* trx) /*!< in/out: dictionary transaction */
@@ -197,6 +212,8 @@ struct tab_node_t{
/* Local storage for this graph node */
ulint state; /*!< node execution state */
ulint col_no; /*!< next column definition to insert */
+ ulint key_id; /*!< encryption key_id */
+ fil_encryption_t mode; /*!< encryption mode */
mem_heap_t* heap; /*!< memory heap used as auxiliary storage */
};
diff --git a/storage/xtradb/include/dict0dict.h b/storage/xtradb/include/dict0dict.h
index 09b43fe0e71..5dfdba54f29 100644
--- a/storage/xtradb/include/dict0dict.h
+++ b/storage/xtradb/include/dict0dict.h
@@ -596,10 +596,17 @@ dict_foreign_find_index(
/*!< in: whether to check
charsets. only has an effect
if types_idx != NULL */
- ulint check_null)
+ ulint check_null,
/*!< in: nonzero if none of
the columns must be declared
NOT NULL */
+ ulint* error, /*!< out: error code */
+ ulint* err_col_no,
+ /*!< out: column number where
+ error happened */
+ dict_index_t** err_index)
+ /*!< out: index where error
+ happened */
__attribute__((nonnull(1,3), warn_unused_result));
/**********************************************************************//**
Returns a column's name.
@@ -691,10 +698,18 @@ dict_foreign_qualify_index(
/*!< in: whether to check
charsets. only has an effect
if types_idx != NULL */
- ulint check_null)
+ ulint check_null,
/*!< in: nonzero if none of
the columns must be declared
NOT NULL */
+ ulint* error, /*!< out: error code */
+ ulint* err_col_no,
+ /*!< out: column number where
+ error happened */
+ dict_index_t** err_index)
+ /*!< out: index where error
+ happened */
+
__attribute__((nonnull(1,3), warn_unused_result));
#ifdef UNIV_DEBUG
/********************************************************************//**
diff --git a/storage/xtradb/include/dict0mem.h b/storage/xtradb/include/dict0mem.h
index deea392f9fd..9c43829cecf 100644
--- a/storage/xtradb/include/dict0mem.h
+++ b/storage/xtradb/include/dict0mem.h
@@ -1,8 +1,8 @@
/*****************************************************************************
-Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, SkySQL Ab. All Rights Reserved.
+Copyright (c) 2013, 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -51,6 +51,9 @@ Created 1/8/1996 Heikki Tuuri
#include "trx0types.h"
#include "fts0fts.h"
#include "os0once.h"
+#include "fil0fil.h"
+#include <my_crypt.h>
+#include "fil0crypt.h"
#include <set>
#include <algorithm>
#include <iterator>
@@ -348,10 +351,7 @@ dict_mem_table_create(
of the table is placed */
ulint n_cols, /*!< in: number of columns */
ulint flags, /*!< in: table flags */
- ulint flags2, /*!< in: table flags2 */
- bool nonshared);/*!< in: whether the table object is a dummy
- one that does not need the initialization of
- locking-related fields. */
+ ulint flags2); /*!< in: table flags2 */
/**********************************************************************//**
Determines if a table belongs to a system database
@return true if table belong to a system database */
@@ -646,11 +646,12 @@ extern ulong zip_failure_threshold_pct;
compression failures */
extern ulong zip_pad_max;
-/** Data structure to hold information about about how much space in
+/** Data structure to hold information about how much space in
an uncompressed page should be left as padding to avoid compression
failures. This estimate is based on a self-adapting heuristic. */
struct zip_pad_info_t {
- os_fast_mutex_t mutex; /*!< mutex protecting the info */
+ os_fast_mutex_t*
+ mutex; /*!< mutex protecting the info */
ulint pad; /*!< number of bytes used as pad */
ulint success;/*!< successful compression ops during
current round */
@@ -658,6 +659,9 @@ struct zip_pad_info_t {
current round */
ulint n_rounds;/*!< number of currently successful
rounds */
+ volatile os_once::state_t
+ mutex_created;
+ /*!< Creation state of mutex member */
};
/** Number of samples of data size kept when page compression fails for
@@ -1029,6 +1033,8 @@ struct dict_table_t{
table_id_t id; /*!< id of the table */
mem_heap_t* heap; /*!< memory heap */
char* name; /*!< table name */
+ void* thd; /*!< thd */
+ fil_space_crypt_t *crypt_data; /*!< crypt data if present */
const char* dir_path_of_temp_table;/*!< NULL or the directory path
where a TEMPORARY table that was explicitly
created by a user should be placed if
@@ -1157,8 +1163,7 @@ struct dict_table_t{
dict_table_t::indexes*::stat_index_size
dict_table_t::indexes*::stat_n_leaf_pages
(*) those are not always protected for
- performance reasons. NULL for dumy table
- objects. */
+ performance reasons. */
unsigned stat_initialized:1; /*!< TRUE if statistics have
been calculated the first time
after database startup or table creation */
@@ -1292,12 +1297,15 @@ struct dict_table_t{
and release it without a need to allocate
space from the lock heap of the trx:
otherwise the lock heap would grow rapidly
- if we do a large insert from a select. NULL
- for dummy table objects. */
- ib_mutex_t autoinc_mutex;
+ if we do a large insert from a select */
+ ib_mutex_t* autoinc_mutex;
/*!< mutex protecting the autoincrement
- counter. Not initialized for dummy table
- objects */
+ counter */
+
+ /** Creation state of autoinc_mutex member */
+ volatile os_once::state_t
+ autoinc_mutex_created;
+
ib_uint64_t autoinc;/*!< autoinc counter value to give to the
next inserted row */
ulong n_waiting_or_granted_auto_inc_locks;
@@ -1339,6 +1347,7 @@ struct dict_table_t{
locks; /*!< list of locks on the table; protected
by lock_sys->mutex */
ibool is_corrupt;
+ ibool is_encrypted;
#endif /* !UNIV_HOTBACKUP */
#ifdef UNIV_DEBUG
@@ -1361,6 +1370,111 @@ struct dict_foreign_add_to_referenced_table {
}
};
+/** Destroy the autoinc latch of the given table.
+This function is only called from either single threaded environment
+or from a thread that has not shared the table object with other threads.
+@param[in,out] table table whose stats latch to destroy */
+inline
+void
+dict_table_autoinc_destroy(
+ dict_table_t* table)
+{
+ if (table->autoinc_mutex_created == os_once::DONE
+ && table->autoinc_mutex != NULL) {
+ mutex_free(table->autoinc_mutex);
+ delete table->autoinc_mutex;
+ }
+}
+
+/** Allocate and init the autoinc latch of a given table.
+This function must not be called concurrently on the same table object.
+@param[in,out] table_void table whose autoinc latch to create */
+void
+dict_table_autoinc_alloc(
+ void* table_void);
+
+/** Allocate and init the zip_pad_mutex of a given index.
+This function must not be called concurrently on the same index object.
+@param[in,out] index_void index whose zip_pad_mutex to create */
+void
+dict_index_zip_pad_alloc(
+ void* index_void);
+
+/** Request for lazy creation of the autoinc latch of a given table.
+This function is only called from either single threaded environment
+or from a thread that has not shared the table object with other threads.
+@param[in,out] table table whose autoinc latch is to be created. */
+inline
+void
+dict_table_autoinc_create_lazy(
+ dict_table_t* table)
+{
+#ifdef HAVE_ATOMIC_BUILTINS
+ table->autoinc_mutex = NULL;
+ table->autoinc_mutex_created = os_once::NEVER_DONE;
+#else /* HAVE_ATOMIC_BUILTINS */
+ dict_table_autoinc_alloc(table);
+ table->autoinc_mutex_created = os_once::DONE;
+#endif /* HAVE_ATOMIC_BUILTINS */
+}
+
+/** Request a lazy creation of dict_index_t::zip_pad::mutex.
+This function is only called from either single threaded environment
+or from a thread that has not shared the table object with other threads.
+@param[in,out] index index whose zip_pad mutex is to be created */
+inline
+void
+dict_index_zip_pad_mutex_create_lazy(
+ dict_index_t* index)
+{
+#ifdef HAVE_ATOMIC_BUILTINS
+ index->zip_pad.mutex = NULL;
+ index->zip_pad.mutex_created = os_once::NEVER_DONE;
+#else /* HAVE_ATOMIC_BUILTINS */
+ dict_index_zip_pad_alloc(index);
+ index->zip_pad.mutex_created = os_once::DONE;
+#endif /* HAVE_ATOMIC_BUILTINS */
+}
+
+/** Destroy the zip_pad_mutex of the given index.
+This function is only called from either single threaded environment
+or from a thread that has not shared the table object with other threads.
+@param[in,out] table table whose stats latch to destroy */
+inline
+void
+dict_index_zip_pad_mutex_destroy(
+ dict_index_t* index)
+{
+ if (index->zip_pad.mutex_created == os_once::DONE
+ && index->zip_pad.mutex != NULL) {
+ os_fast_mutex_free(index->zip_pad.mutex);
+ delete index->zip_pad.mutex;
+ }
+}
+
+/** Release the zip_pad_mutex of a given index.
+@param[in,out] index index whose zip_pad_mutex is to be released */
+inline
+void
+dict_index_zip_pad_unlock(
+ dict_index_t* index)
+{
+ os_fast_mutex_unlock(index->zip_pad.mutex);
+}
+
+#ifdef UNIV_DEBUG
+/** Check if the current thread owns the autoinc_mutex of a given table.
+@param[in] table the autoinc_mutex belongs to this table
+@return true, if the current thread owns the autoinc_mutex, false otherwise.*/
+inline
+bool
+dict_table_autoinc_own(
+ const dict_table_t* table)
+{
+ return(mutex_own(table->autoinc_mutex));
+}
+#endif /* UNIV_DEBUG */
+
#ifndef UNIV_NONINL
#include "dict0mem.ic"
#endif
diff --git a/storage/xtradb/include/fil0crypt.h b/storage/xtradb/include/fil0crypt.h
index d36cb14b8cc..760dec98869 100644
--- a/storage/xtradb/include/fil0crypt.h
+++ b/storage/xtradb/include/fil0crypt.h
@@ -1,5 +1,5 @@
/*****************************************************************************
-
+Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
Copyright (c) 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
@@ -66,17 +66,20 @@ struct key_struct
struct fil_space_rotate_state_t
{
- time_t start_time; // time when rotation started
- ulint active_threads; // active threads in space
- ulint next_offset; // next "free" offset
- ulint max_offset; // max offset needing to be rotated
- uint min_key_version_found; // min key version found but not rotated
- lsn_t end_lsn; // max lsn created when rotating this space
- bool starting; // initial write of IV
- bool flushing; // space is being flushed at end of rotate
+ time_t start_time; /*!< time when rotation started */
+ ulint active_threads; /*!< active threads in space */
+ ulint next_offset; /*!< next "free" offset */
+ ulint max_offset; /*!< max offset needing to be rotated */
+ uint min_key_version_found; /*!< min key version found but not
+ rotated */
+ lsn_t end_lsn; /*!< max lsn created when rotating this
+ space */
+ bool starting; /*!< initial write of IV */
+ bool flushing; /*!< space is being flushed at end of rotate */
struct {
- bool is_active; // is scrubbing active in this space
- time_t last_scrub_completed; // when was last scrub completed
+ bool is_active; /*!< is scrubbing active in this space */
+ time_t last_scrub_completed; /*!< when was last scrub
+ completed */
} scrubbing;
};
@@ -88,6 +91,7 @@ struct fil_space_crypt_struct : st_encryption_scheme
ib_mutex_t mutex; // mutex protecting following variables
bool closing; // is tablespace being closed
+ bool inited;
fil_space_rotate_state_t rotate_state;
};
@@ -197,43 +201,48 @@ bool
fil_space_check_encryption_read(
/*============================*/
ulint space); /*!< in: tablespace id */
-
-/*********************************************************************
-Encrypt buffer page */
+/******************************************************************
+Decrypt a page
+@return true if page is decrypted, false if not. */
UNIV_INTERN
-void
-fil_space_encrypt(
+bool
+fil_space_decrypt(
/*==============*/
- ulint space, /*!< in: tablespace id */
- ulint offset, /*!< in: page no */
- lsn_t lsn, /*!< in: page lsn */
- const byte* src_frame,/*!< in: page frame */
- ulint size, /*!< in: size of data to encrypt */
- byte* dst_frame); /*!< in: where to encrypt to */
+ fil_space_crypt_t* crypt_data, /*!< in: crypt data */
+ byte* tmp_frame, /*!< in: temporary buffer */
+ ulint page_size, /*!< in: page size */
+ byte* src_frame, /*!< in:out: page buffer */
+ dberr_t* err); /*!< in: out: DB_SUCCESS or
+ error code */
+
/*********************************************************************
-Decrypt buffer page */
+Encrypt buffer page
+@return encrypted page, or original not encrypted page if encrypt
+is not needed. */
UNIV_INTERN
-void
-fil_space_decrypt(
+byte*
+fil_space_encrypt(
/*==============*/
- ulint space, /*!< in: tablespace id */
- const byte* src_frame,/*!< in: page frame */
- ulint page_size, /*!< in: size of data to encrypt */
- byte* dst_frame); /*!< in: where to decrypt to */
-
+ ulint space, /*!< in: tablespace id */
+ ulint offset, /*!< in: page no */
+ lsn_t lsn, /*!< in: page lsn */
+ byte* src_frame, /*!< in: page frame */
+ ulint size, /*!< in: size of data to encrypt */
+ byte* dst_frame); /*!< in: where to encrypt to */
/*********************************************************************
Decrypt buffer page
-@return true if page was encrypted */
+@return decrypted page, or original not encrypted page if decrypt is
+not needed.*/
UNIV_INTERN
-bool
+byte*
fil_space_decrypt(
/*==============*/
- fil_space_crypt_t* crypt_data, /*!< in: crypt data */
- const byte* src_frame,/*!< in: page frame */
- ulint page_size, /*!< in: page size */
- byte* dst_frame); /*!< in: where to decrypt to */
+ ulint space, /*!< in: tablespace id */
+ byte* src_frame, /*!< in: page frame */
+ ulint page_size, /*!< in: size of data to encrypt */
+ byte* dst_frame); /*!< in: where to decrypt to */
/*********************************************************************
fil_space_verify_crypt_checksum
@@ -375,6 +384,33 @@ fil_crypt_set_encrypt_tables(
/*=========================*/
uint val); /*!< in: New srv_encrypt_tables setting */
+/******************************************************************
+Encrypt a buffer */
+UNIV_INTERN
+byte*
+fil_encrypt_buf(
+/*============*/
+ fil_space_crypt_t* crypt_data, /*!< in: crypt data */
+ ulint space, /*!< in: Space id */
+ ulint offset, /*!< in: Page offset */
+ lsn_t lsn, /*!< in: lsn */
+ byte* src_frame, /*!< in: Source page to be encrypted */
+ ulint zip_size, /*!< in: compressed size if
+ row_format compressed */
+ byte* dst_frame); /*!< in: outbut buffer */
+
+/******************************************************************
+Calculate post encryption checksum
+@return page checksum or BUF_NO_CHECKSUM_MAGIC
+not needed. */
+UNIV_INTERN
+ulint
+fil_crypt_calculate_checksum(
+/*=========================*/
+ ulint zip_size, /*!< in: zip_size or 0 */
+ byte* dst_frame); /*!< in: page where to calculate */
+
+
#ifndef UNIV_NONINL
#include "fil0crypt.ic"
#endif
diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h
index 29265c53f6b..2a3995519a7 100644
--- a/storage/xtradb/include/fil0fil.h
+++ b/storage/xtradb/include/fil0fil.h
@@ -207,6 +207,7 @@ struct fsp_open_info {
ulint flags; /*!< Tablespace flags */
ulint encryption_error; /*!< if an encryption error occurs */
fil_space_crypt_t* crypt_data; /*!< crypt data */
+ dict_table_t* table; /*!< table */
};
struct fil_space_t;
@@ -606,8 +607,6 @@ fil_read_first_page(
lsn values in data files */
lsn_t* max_flushed_lsn, /*!< out: max of flushed
lsn values in data files */
- ulint orig_space_id, /*!< in: file space id or
- ULINT_UNDEFINED */
fil_space_crypt_t** crypt_data) /*!< out: crypt data */
__attribute__((warn_unused_result));
@@ -771,6 +770,9 @@ char*
fil_read_link_file(
/*===============*/
const char* name); /*!< in: tablespace name */
+
+#include "fil0crypt.h"
+
/*******************************************************************//**
Creates a new single-table tablespace to a database directory of MySQL.
Database directories are under the 'datadir' of MySQL. The datadir is the
@@ -789,9 +791,11 @@ fil_create_new_single_table_tablespace(
const char* dir_path, /*!< in: NULL or a dir path */
ulint flags, /*!< in: tablespace flags */
ulint flags2, /*!< in: table flags2 */
- ulint size) /*!< in: the initial size of the
+ ulint size, /*!< in: the initial size of the
tablespace file in pages,
must be >= FIL_IBD_FILE_INITIAL_SIZE */
+ fil_encryption_t mode, /*!< in: encryption mode */
+ ulint key_id) /*!< in: encryption key_id */
__attribute__((nonnull, warn_unused_result));
#ifndef UNIV_HOTBACKUP
/********************************************************************//**
@@ -825,7 +829,8 @@ fil_open_single_table_tablespace(
ulint flags, /*!< in: tablespace flags */
const char* tablename, /*!< in: table name in the
databasename/tablename format */
- const char* filepath) /*!< in: tablespace filepath */
+ const char* filepath, /*!< in: tablespace filepath */
+ dict_table_t* table) /*!< in: table */
__attribute__((nonnull(5), warn_unused_result));
#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/xtradb/include/ha_prototypes.h b/storage/xtradb/include/ha_prototypes.h
index 22cb3eed42d..724453cb4f6 100644
--- a/storage/xtradb/include/ha_prototypes.h
+++ b/storage/xtradb/include/ha_prototypes.h
@@ -28,14 +28,17 @@ Created 5/11/2006 Osku Salerma
#define HA_INNODB_PROTOTYPES_H
#include "my_dbug.h"
-#include "mysqld_error.h"
#include "my_compare.h"
#include "my_sys.h"
#include "m_string.h"
-#include "debug_sync.h"
#include "my_base.h"
+#ifndef UNIV_INNOCHECKSUM
+#include "mysqld_error.h"
+#include "debug_sync.h"
#include "trx0types.h"
+#endif
+
#include "m_ctype.h" /* CHARSET_INFO */
// Forward declarations
@@ -81,6 +84,8 @@ innobase_raw_format(
ulint buf_size); /*!< in: output buffer size
in bytes */
+#ifndef UNIV_INNOCHECKSUM
+
/*****************************************************************//**
Invalidates the MySQL query cache for the table. */
UNIV_INTERN
@@ -97,6 +102,8 @@ innobase_invalidate_query_cache(
ulint full_name_len); /*!< in: full name length where
also the null chars count */
+#endif /* #ifndef UNIV_INNOCHECKSUM */
+
/*****************************************************************//**
Convert a table or index name to the MySQL system_charset_info (UTF-8)
and quote it if needed.
@@ -620,5 +627,22 @@ innobase_convert_to_filename_charset(
const char* from, /* in: identifier to convert */
ulint len); /* in: length of 'to', in bytes */
-
+/********************************************************************//**
+Helper function to push warnings from InnoDB internals to SQL-layer. */
+UNIV_INTERN
+void
+ib_push_warning(
+ trx_t* trx, /*!< in: trx */
+ ulint error, /*!< in: error code to push as warning */
+ const char *format,/*!< in: warning message */
+ ...);
+/********************************************************************//**
+Helper function to push warnings from InnoDB internals to SQL-layer. */
+UNIV_INTERN
+void
+ib_push_warning(
+ void* ithd, /*!< in: thd */
+ ulint error, /*!< in: error code to push as warning */
+ const char *format,/*!< in: warning message */
+ ...);
#endif /* HA_INNODB_PROTOTYPES_H */
diff --git a/storage/xtradb/include/log0crypt.h b/storage/xtradb/include/log0crypt.h
index 8d82a6c637a..7e737853465 100644
--- a/storage/xtradb/include/log0crypt.h
+++ b/storage/xtradb/include/log0crypt.h
@@ -1,8 +1,27 @@
+/*****************************************************************************
+
+Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
+Copyright (C) 2014, 2015, MariaDB Corporation. All Rights Reserved.
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation; version 2 of the License.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+*****************************************************************************/
/**************************************************//**
@file include/log0crypt.h
Innodb log encrypt/decrypt
Created 11/25/2013 Minli Zhu
+Modified Jan Lindström jan.lindstrom@mariadb.com
*******************************************************/
#ifndef log0crypt_h
#define log0crypt_h
@@ -22,7 +41,7 @@ UNIV_INTERN
void
log_crypt_set_ver_and_key(
/*======================*/
- ib_uint64_t next_checkpoint_no);
+ ib_uint64_t next_checkpoint_no);/*!< in: next checkpoint no */
/*********************************************************************//**
@@ -40,20 +59,20 @@ Read the crypto (version, msg and iv) info, which has been used for
log blocks with lsn <= this checkpoint's lsn, from a log header's
checkpoint buf. */
UNIV_INTERN
-void
+bool
log_crypt_read_checkpoint_buf(
/*===========================*/
- const byte* buf); /*!< in: checkpoint buffer */
+ const byte* buf); /*!< in: checkpoint buffer */
/********************************************************
Encrypt one or more log block before it is flushed to disk */
UNIV_INTERN
void
log_encrypt_before_write(
-/*===========================*/
- ib_uint64_t next_checkpoint_no, /*!< in: log group to be flushed */
- byte* block, /*!< in/out: pointer to a log block */
- const ulint size); /*!< in: size of log blocks */
+/*=====================*/
+ ib_uint64_t next_checkpoint_no, /*!< in: log group to be flushed */
+ byte* block, /*!< in/out: pointer to a log block */
+ const ulint size); /*!< in: size of log blocks */
/********************************************************
Decrypt a specified log segment after they are read from a log file to a buffer.
@@ -61,8 +80,41 @@ Decrypt a specified log segment after they are read from a log file to a buffer.
UNIV_INTERN
void
log_decrypt_after_read(
-/*==========================*/
- byte* frame, /*!< in/out: log segment */
- const ulint size); /*!< in: log segment size */
+/*===================*/
+ byte* frame, /*!< in/out: log segment */
+ const ulint size); /*!< in: log segment size */
+
+/* Error codes for crypt info */
+typedef enum {
+ LOG_UNENCRYPTED = 0,
+ LOG_CRYPT_KEY_NOT_FOUND = 1,
+ LOG_DECRYPT_MAYBE_FAILED = 2
+} log_crypt_err_t;
+
+/********************************************************
+Check is the checkpoint information encrypted. This check
+is based on fact has log group crypt info and based
+on this crypt info was the key version different from
+unencrypted key version. There is no realible way to
+distinguish encrypted log block from corrupted log block,
+but if log block corruption is found this function is
+used to find out if log block is maybe encrypted but
+encryption key, key management plugin or encryption
+algorithm does not match.
+@return TRUE, if log block may be encrypted */
+UNIV_INTERN
+ibool
+log_crypt_block_maybe_encrypted(
+/*============================*/
+ const byte* log_block, /*!< in: log block */
+ log_crypt_err_t* err_info); /*!< out: error info */
+
+/********************************************************
+Print crypt error message to error log */
+UNIV_INTERN
+void
+log_crypt_print_error(
+/*==================*/
+ log_crypt_err_t err_info); /*!< out: error info */
#endif // log0crypt.h
diff --git a/storage/xtradb/include/os0file.h b/storage/xtradb/include/os0file.h
index 88ba7e18ac3..e9faac0d945 100644
--- a/storage/xtradb/include/os0file.h
+++ b/storage/xtradb/include/os0file.h
@@ -1,6 +1,6 @@
/***********************************************************************
-Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2015, MariaDB Corporation.
@@ -405,10 +405,10 @@ to original un-instrumented file I/O APIs */
enum os_file_type_t {
OS_FILE_TYPE_UNKNOWN = 0,
- OS_FILE_TYPE_FILE, /* regular file */
+ OS_FILE_TYPE_FILE, /* regular file
+ (or a character/block device) */
OS_FILE_TYPE_DIR, /* directory */
- OS_FILE_TYPE_LINK, /* symbolic link */
- OS_FILE_TYPE_BLOCK /* block device */
+ OS_FILE_TYPE_LINK /* symbolic link */
};
/* Maximum path string length in bytes when referring to tables with in the
diff --git a/storage/xtradb/include/os0sync.h b/storage/xtradb/include/os0sync.h
index bd37287f1a0..3a7707ee130 100644
--- a/storage/xtradb/include/os0sync.h
+++ b/storage/xtradb/include/os0sync.h
@@ -452,7 +452,7 @@ Returns the old value of *ptr, atomically sets *ptr to new_val */
# define os_atomic_test_and_set_ulint(ptr, new_val) \
__sync_lock_test_and_set(ptr, new_val)
-#ifdef __powerpc__
+#if defined(__powerpc__) || defined(__aarch64__)
/*
os_atomic_test_and_set_byte_release() should imply a release barrier before
setting, and a full barrier after. But __sync_lock_test_and_set() is only
diff --git a/storage/xtradb/include/page0cur.ic b/storage/xtradb/include/page0cur.ic
index 028d33b17aa..6e068d9f739 100644
--- a/storage/xtradb/include/page0cur.ic
+++ b/storage/xtradb/include/page0cur.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -39,7 +40,10 @@ page_cur_get_page(
page_cur_t* cur) /*!< in: page cursor */
{
ut_ad(cur);
- ut_ad(page_align(cur->rec) == cur->block->frame);
+
+ if (cur->rec) {
+ ut_ad(page_align(cur->rec) == cur->block->frame);
+ }
return(page_align(cur->rec));
}
@@ -54,7 +58,11 @@ page_cur_get_block(
page_cur_t* cur) /*!< in: page cursor */
{
ut_ad(cur);
- ut_ad(page_align(cur->rec) == cur->block->frame);
+
+ if (cur->rec) {
+ ut_ad(page_align(cur->rec) == cur->block->frame);
+ }
+
return(cur->block);
}
@@ -80,7 +88,10 @@ page_cur_get_rec(
page_cur_t* cur) /*!< in: page cursor */
{
ut_ad(cur);
- ut_ad(page_align(cur->rec) == cur->block->frame);
+
+ if (cur->rec) {
+ ut_ad(page_align(cur->rec) == cur->block->frame);
+ }
return(cur->rec);
}
diff --git a/storage/xtradb/include/page0page.h b/storage/xtradb/include/page0page.h
index 6940040a130..2da5d793fa9 100644
--- a/storage/xtradb/include/page0page.h
+++ b/storage/xtradb/include/page0page.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -28,6 +28,10 @@ Created 2/2/1994 Heikki Tuuri
#include "univ.i"
+#include "buf0types.h"
+
+#ifndef UNIV_INNOCHECKSUM
+
#include "page0types.h"
#include "fil0fil.h"
#include "buf0buf.h"
@@ -1110,6 +1114,24 @@ page_find_rec_with_heap_no(
const rec_t*
page_find_rec_max_not_deleted(
const page_t* page);
+
+#endif /* #ifndef UNIV_INNOCHECKSUM */
+
+/** Issue a warning when the checksum that is stored in the page is valid,
+but different than the global setting innodb_checksum_algorithm.
+@param[in] current_algo current checksum algorithm
+@param[in] page_checksum page valid checksum
+@param[in] space_id tablespace id
+@param[in] page_no page number */
+void
+page_warn_strict_checksum(
+ srv_checksum_algorithm_t curr_algo,
+ srv_checksum_algorithm_t page_checksum,
+ ulint space_id,
+ ulint page_no);
+
+#ifndef UNIV_INNOCHECKSUM
+
#ifdef UNIV_MATERIALIZE
#undef UNIV_INLINE
#define UNIV_INLINE UNIV_INLINE_ORIGINAL
@@ -1119,4 +1141,6 @@ page_find_rec_max_not_deleted(
#include "page0page.ic"
#endif
+#endif /* #ifndef UNIV_INNOCHECKSUM */
+
#endif
diff --git a/storage/xtradb/include/page0types.h b/storage/xtradb/include/page0types.h
index 95143a4bb44..74ad6f72f7e 100644
--- a/storage/xtradb/include/page0types.h
+++ b/storage/xtradb/include/page0types.h
@@ -107,6 +107,8 @@ struct page_zip_stat_t {
{ }
};
+#ifndef UNIV_INNOCHECKSUM
+
/** Compression statistics types */
typedef map<index_id_t, page_zip_stat_t> page_zip_stat_per_index_t;
@@ -119,6 +121,8 @@ extern ib_mutex_t page_zip_stat_per_index_mutex;
extern mysql_pfs_key_t page_zip_stat_per_index_mutex_key;
#endif /* HAVE_PSI_INTERFACE */
+#endif /* !UNIV_INNOCHECKSUM */
+
/**********************************************************************//**
Write the "deleted" flag of a record on a compressed page. The flag must
already have been written on the uncompressed page. */
diff --git a/storage/xtradb/include/page0zip.h b/storage/xtradb/include/page0zip.h
index 2f9efc4a40c..41eb1e35d78 100644
--- a/storage/xtradb/include/page0zip.h
+++ b/storage/xtradb/include/page0zip.h
@@ -32,13 +32,17 @@ Created June 2005 by Marko Makela
# define UNIV_INLINE
#endif
-#include "mtr0types.h"
+#ifndef UNIV_INNOCHECKSUM
#include "page0types.h"
-#include "buf0types.h"
+#include "mtr0types.h"
#include "dict0types.h"
#include "srv0srv.h"
#include "trx0types.h"
#include "mem0mem.h"
+#else
+#include "univ.i"
+#endif /* !UNIV_INNOCHECKSUM */
+#include "buf0types.h"
/* Compression level to be used by zlib. Settable by user. */
extern uint page_zip_level;
@@ -50,6 +54,7 @@ extern uint page_zip_level;
compression algorithm changes in zlib. */
extern my_bool page_zip_log_pages;
+#ifndef UNIV_INNOCHECKSUM
/**********************************************************************//**
Determine the size of a compressed page in bytes.
@return size in bytes */
@@ -159,6 +164,8 @@ page_zip_simple_validate(
descriptor */
#endif /* UNIV_DEBUG */
+#endif /* !UNIV_INNOCHECKSUM */
+
#ifdef UNIV_ZIP_DEBUG
/**********************************************************************//**
Check that the compressed and decompressed pages match.
@@ -185,6 +192,7 @@ page_zip_validate(
__attribute__((nonnull(1,2)));
#endif /* UNIV_ZIP_DEBUG */
+#ifndef UNIV_INNOCHECKSUM
/**********************************************************************//**
Determine how big record can be inserted without recompressing the page.
@return a positive number indicating the maximum size of a record
@@ -452,6 +460,8 @@ page_zip_parse_compress(
page_zip_des_t* page_zip)/*!< out: compressed page */
__attribute__((nonnull(1,2)));
+#endif /* !UNIV_INNOCHECKSUM */
+
/**********************************************************************//**
Calculate the compressed page checksum.
@return page checksum */
@@ -474,6 +484,9 @@ page_zip_verify_checksum(
/*=====================*/
const void* data, /*!< in: compressed page */
ulint size); /*!< in: size of compressed page */
+
+#ifndef UNIV_INNOCHECKSUM
+
/**********************************************************************//**
Write a log record of compressing an index page without the data on the page. */
UNIV_INLINE
@@ -506,6 +519,8 @@ void
page_zip_reset_stat_per_index();
/*===========================*/
+#endif /* !UNIV_INNOCHECKSUM */
+
#ifndef UNIV_HOTBACKUP
/** Check if a pointer to an uncompressed page matches a compressed page.
When we IMPORT a tablespace the blocks and accompanying frames are allocted
@@ -531,8 +546,10 @@ from outside the buffer pool.
# define UNIV_INLINE UNIV_INLINE_ORIGINAL
#endif
+#ifndef UNIV_INNOCHECKSUM
#ifndef UNIV_NONINL
# include "page0zip.ic"
#endif
+#endif /* !UNIV_INNOCHECKSUM */
#endif /* page0zip_h */
diff --git a/storage/xtradb/include/row0ftsort.h b/storage/xtradb/include/row0ftsort.h
index 4e04a099140..eeef10f3397 100644
--- a/storage/xtradb/include/row0ftsort.h
+++ b/storage/xtradb/include/row0ftsort.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2010, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -71,6 +72,7 @@ struct fts_psort_common_t {
store Doc ID during sort, if
Doc ID will not be big enough
to use 8 bytes value */
+ fil_space_crypt_t* crypt_data; /*!< crypt data or NULL */
};
struct fts_psort_t {
@@ -83,6 +85,10 @@ struct fts_psort_t {
/*!< buffer to write to file */
row_merge_block_t* block_alloc[FTS_NUM_AUX_INDEX];
/*!< buffer to allocated */
+ row_merge_block_t* crypt_block[FTS_NUM_AUX_INDEX];
+ /*!< buffer to crypt data */
+ row_merge_block_t* crypt_alloc[FTS_NUM_AUX_INDEX];
+ /*!< buffer to allocated */
ulint child_status; /*!< child thread status */
ulint state; /*!< parent thread state */
fts_doc_list_t fts_doc_list; /*!< doc list to process */
diff --git a/storage/xtradb/include/row0merge.h b/storage/xtradb/include/row0merge.h
index f280644de70..fa00700b225 100644
--- a/storage/xtradb/include/row0merge.h
+++ b/storage/xtradb/include/row0merge.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2005, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -351,7 +352,11 @@ row_merge_write(
int fd, /*!< in: file descriptor */
ulint offset, /*!< in: offset where to write,
in number of row_merge_block_t elements */
- const void* buf); /*!< in: data */
+ const void* buf, /*!< in: data */
+ fil_space_crypt_t* crypt_data, /*!< in: table crypt data */
+ void* crypt_buf, /*!< in: crypt buf or NULL */
+ ulint space); /*!< in: space id */
+
/********************************************************************//**
Empty a sort buffer.
@return sort buffer */
@@ -386,8 +391,11 @@ row_merge_sort(
int* tmpfd, /*!< in/out: temporary file handle */
const bool update_progress, /*!< in: update progress status variable or not */
const float pct_progress, /*!< in: total progress percent until now */
- const float pct_cost) /*!< in: current progress percent */
- __attribute__((nonnull));
+ const float pct_cost, /*!< in: current progress percent */
+ fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
+ row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
+ ulint space) /*!< in: space id */
+ __attribute__((nonnull(1,2,3,4,5)));
/*********************************************************************//**
Allocate a sort buffer.
@return own: sort buffer */
@@ -424,7 +432,11 @@ row_merge_read(
ulint offset, /*!< in: offset where to read
in number of row_merge_block_t
elements */
- row_merge_block_t* buf); /*!< out: data */
+ row_merge_block_t* buf, /*!< out: data */
+ fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
+ row_merge_block_t* crypt_buf, /*!< in: crypt buf or NULL */
+ ulint space); /*!< in: space id */
+
/********************************************************************//**
Read a merge record.
@return pointer to next record, or NULL on I/O error or end of list */
@@ -441,6 +453,9 @@ row_merge_read_rec(
const mrec_t** mrec, /*!< out: pointer to merge record,
or NULL on end of list
(non-NULL on I/O error) */
- ulint* offsets)/*!< out: offsets of mrec */
- __attribute__((nonnull, warn_unused_result));
+ ulint* offsets,/*!< out: offsets of mrec */
+ fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
+ row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
+ ulint space) /*!< in: space id */
+ __attribute__((nonnull(1,2,3,4,6,7,8), warn_unused_result));
#endif /* row0merge.h */
diff --git a/storage/xtradb/include/row0mysql.h b/storage/xtradb/include/row0mysql.h
index ab61459cae7..a0ff6cdad15 100644
--- a/storage/xtradb/include/row0mysql.h
+++ b/storage/xtradb/include/row0mysql.h
@@ -35,6 +35,7 @@ Created 9/17/2000 Heikki Tuuri
#include "row0types.h"
#include "btr0pcur.h"
#include "trx0types.h"
+#include "fil0crypt.h"
// Forward declaration
struct SysIndexCallback;
@@ -386,7 +387,9 @@ row_create_table_for_mysql(
(will be freed, or on DB_SUCCESS
added to the data dictionary cache) */
trx_t* trx, /*!< in/out: transaction */
- bool commit) /*!< in: if true, commit the transaction */
+ bool commit, /*!< in: if true, commit the transaction */
+ fil_encryption_t mode, /*!< in: encryption mode */
+ ulint key_id) /*!< in: encryption key_id */
__attribute__((nonnull, warn_unused_result));
/*********************************************************************//**
Does an index creation operation for MySQL. TODO: currently failure
diff --git a/storage/xtradb/include/srv0mon.h b/storage/xtradb/include/srv0mon.h
index 094eb0de610..37d14734c71 100644
--- a/storage/xtradb/include/srv0mon.h
+++ b/storage/xtradb/include/srv0mon.h
@@ -379,6 +379,8 @@ enum monitor_id_t {
MONITOR_SRV_MEM_VALIDATE_MICROSECOND,
MONITOR_SRV_PURGE_MICROSECOND,
MONITOR_SRV_DICT_LRU_MICROSECOND,
+ MONITOR_SRV_DICT_LRU_EVICT_COUNT_ACTIVE,
+ MONITOR_SRV_DICT_LRU_EVICT_COUNT_IDLE,
MONITOR_SRV_CHECKPOINT_MICROSECOND,
MONITOR_OVLD_SRV_DBLWR_WRITES,
MONITOR_OVLD_SRV_DBLWR_PAGES_WRITTEN,
diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h
index b8a57098f40..45300bc2ded 100644
--- a/storage/xtradb/include/srv0srv.h
+++ b/storage/xtradb/include/srv0srv.h
@@ -514,7 +514,6 @@ extern my_bool srv_stats_sample_traditional;
extern ibool srv_use_doublewrite_buf;
extern ulong srv_doublewrite_batch_size;
-extern ulong srv_checksum_algorithm;
extern ulong srv_log_arch_expire_sec;
@@ -706,6 +705,9 @@ extern ulong srv_fatal_semaphore_wait_threshold;
/** Enable semaphore request instrumentation */
extern my_bool srv_instrument_semaphores;
+/** Buffer pool dump status frequence in percentages */
+extern ulong srv_buf_dump_status_frequency;
+
# ifdef UNIV_PFS_THREAD
/* Keys to register InnoDB threads with performance schema */
extern mysql_pfs_key_t buf_page_cleaner_thread_key;
diff --git a/storage/xtradb/include/sync0rw.h b/storage/xtradb/include/sync0rw.h
index 1df6a793637..d59613e0abb 100644
--- a/storage/xtradb/include/sync0rw.h
+++ b/storage/xtradb/include/sync0rw.h
@@ -163,7 +163,7 @@ defined, the rwlock are instrumented with performance schema probes. */
# endif/* UNIV_SYNC_DEBUG */
# else /* UNIV_DEBUG */
# define rw_lock_create(K, L, level) \
- rw_lock_create_func((L), __FILE__, __LINE__)
+ rw_lock_create_func((L), #L, __FILE__, __LINE__)
# endif /* UNIV_DEBUG */
/**************************************************************//**
diff --git a/storage/xtradb/include/sync0sync.h b/storage/xtradb/include/sync0sync.h
index 0d36a8e7bd8..ce338acd7e1 100644
--- a/storage/xtradb/include/sync0sync.h
+++ b/storage/xtradb/include/sync0sync.h
@@ -224,7 +224,7 @@ original non-instrumented functions */
# endif /* UNIV_SYNC_DEBUG */
# else /* UNIV_DEBUG */
# define mutex_create(K, M, level) \
- mutex_create_func((M), #M)
+ mutex_create_func((M), __FILE__, __LINE__, #M)
# endif /* UNIV_DEBUG */
# define mutex_enter(M) mutex_enter_func((M), __FILE__, __LINE__)
diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i
index 11f9d7876f4..8105d1f318b 100644
--- a/storage/xtradb/include/univ.i
+++ b/storage/xtradb/include/univ.i
@@ -45,10 +45,10 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 5
#define INNODB_VERSION_MINOR 6
-#define INNODB_VERSION_BUGFIX 23
+#define INNODB_VERSION_BUGFIX 25
#ifndef PERCONA_INNODB_VERSION
-#define PERCONA_INNODB_VERSION 72.1
+#define PERCONA_INNODB_VERSION 73.1
#endif
/* Enable UNIV_LOG_ARCHIVE in XtraDB */
diff --git a/storage/xtradb/lock/lock0lock.cc b/storage/xtradb/lock/lock0lock.cc
index 59168fb741b..26d868ca94d 100644
--- a/storage/xtradb/lock/lock0lock.cc
+++ b/storage/xtradb/lock/lock0lock.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2014, 2015, MariaDB Corporation
This program is free software; you can redistribute it and/or modify it under
@@ -387,8 +387,10 @@ because there is no parallel deadlock check. This stack is protected by
the lock_sys_t::mutex. */
static lock_stack_t* lock_stack;
+#ifdef UNIV_DEBUG
/** The count of the types of locks. */
static const ulint lock_types = UT_ARR_SIZE(lock_compatibility_matrix);
+#endif /* UNIV_DEBUG */
#ifdef UNIV_PFS_MUTEX
/* Key to register mutex with performance schema */
@@ -1065,12 +1067,13 @@ lock_rec_has_to_wait(
#ifdef WITH_WSREP
/* if BF thread is locking and has conflict with another BF
thread, we need to look at trx ordering and lock types */
- if (for_locking &&
- wsrep_thd_is_BF(trx->mysql_thd, FALSE) &&
+ if (wsrep_thd_is_BF(trx->mysql_thd, FALSE) &&
wsrep_thd_is_BF(lock2->trx->mysql_thd, TRUE)) {
if (wsrep_debug) {
- fprintf(stderr, "\n BF-BF lock conflict \n");
+ fprintf(stderr,
+ "BF-BF lock conflict, locking: %lu\n",
+ for_locking);
lock_rec_print(stderr, lock2);
}
@@ -1079,16 +1082,21 @@ lock_rec_has_to_wait(
(type_mode & LOCK_MODE_MASK) == LOCK_X &&
(lock2->type_mode & LOCK_MODE_MASK) == LOCK_X)
{
- /* exclusive lock conflicts are not accepted */
- fprintf(stderr, "BF-BF X lock conflict,"
- "type_mode: %lu supremum: %lu\n",
- type_mode, lock_is_on_supremum);
- fprintf(stderr, "conflicts states: my %d locked %d\n",
- wsrep_thd_conflict_state(trx->mysql_thd, FALSE),
- wsrep_thd_conflict_state(lock2->trx->mysql_thd, FALSE) );
- lock_rec_print(stderr, lock2);
- return FALSE;
- //abort();
+ if (for_locking || wsrep_debug) {
+ /* exclusive lock conflicts are not
+ accepted */
+ fprintf(stderr,
+ "BF-BF X lock conflict,"
+ "mode: %lu supremum: %lu\n",
+ type_mode, lock_is_on_supremum);
+ fprintf(stderr,
+ "conflicts states: my %d locked %d\n",
+ wsrep_thd_conflict_state(trx->mysql_thd, FALSE),
+ wsrep_thd_conflict_state(lock2->trx->mysql_thd, FALSE) );
+ lock_rec_print(stderr, lock2);
+ if (for_locking) return FALSE;
+ //abort();
+ }
} else {
/* if lock2->index->n_uniq <=
lock2->index->n_user_defined_cols
@@ -3019,7 +3027,8 @@ lock_rec_inherit_to_gap(
&& !((srv_locks_unsafe_for_binlog
|| lock->trx->isolation_level
<= TRX_ISO_READ_COMMITTED)
- && lock_get_mode(lock) == LOCK_X)) {
+ && lock_get_mode(lock) ==
+ (lock->trx->duplicates ? LOCK_S : LOCK_X))) {
lock_rec_add_to_queue(
LOCK_REC | LOCK_GAP | lock_get_mode(lock),
diff --git a/storage/xtradb/log/log0crypt.cc b/storage/xtradb/log/log0crypt.cc
index dd99d930e61..8c4fd623fc6 100644
--- a/storage/xtradb/log/log0crypt.cc
+++ b/storage/xtradb/log/log0crypt.cc
@@ -86,6 +86,9 @@ log_block_get_start_lsn(
return start_lsn;
}
+/*********************************************************************//**
+Get crypt info from checkpoint.
+@return a crypt info or NULL if not present. */
static
const crypt_info_t*
get_crypt_info(
@@ -107,6 +110,9 @@ get_crypt_info(
return NULL;
}
+/*********************************************************************//**
+Get crypt info from log block
+@return a crypt info or NULL if not present. */
static
const crypt_info_t*
get_crypt_info(
@@ -125,12 +131,13 @@ log_blocks_crypt(
const byte* block, /*!< in: blocks before encrypt/decrypt*/
ulint size, /*!< in: size of block */
byte* dst_block, /*!< out: blocks after encrypt/decrypt */
- bool is_encrypt) /*!< in: encrypt or decrypt*/
+ int what) /*!< in: encrypt or decrypt*/
{
byte *log_block = (byte*)block;
Crypt_result rc = MY_AES_OK;
uint dst_len;
byte aes_ctr_counter[MY_AES_BLOCK_SIZE];
+ byte is_encrypt= what == ENCRYPTION_FLAG_ENCRYPT;
lsn_t lsn = is_encrypt ? log_sys->lsn : srv_start_lsn;
const uint src_len = OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_HDR_SIZE;
@@ -168,21 +175,13 @@ log_blocks_crypt(
bzero(aes_ctr_counter + 15, 1);
int rc;
- if (is_encrypt) {
- rc = encryption_encrypt(log_block + LOG_BLOCK_HDR_SIZE, src_len,
- dst_block + LOG_BLOCK_HDR_SIZE, &dst_len,
- (unsigned char*)(info->crypt_key), 16,
- aes_ctr_counter, MY_AES_BLOCK_SIZE, 1,
- LOG_DEFAULT_ENCRYPTION_KEY,
- info->key_version);
- } else {
- rc = encryption_decrypt(log_block + LOG_BLOCK_HDR_SIZE, src_len,
- dst_block + LOG_BLOCK_HDR_SIZE, &dst_len,
- (unsigned char*)(info->crypt_key), 16,
- aes_ctr_counter, MY_AES_BLOCK_SIZE, 1,
- LOG_DEFAULT_ENCRYPTION_KEY,
- info->key_version);
- }
+ rc = encryption_crypt(log_block + LOG_BLOCK_HDR_SIZE, src_len,
+ dst_block + LOG_BLOCK_HDR_SIZE, &dst_len,
+ (unsigned char*)(info->crypt_key), 16,
+ aes_ctr_counter, MY_AES_BLOCK_SIZE,
+ what | ENCRYPTION_FLAG_NOPAD,
+ LOG_DEFAULT_ENCRYPTION_KEY,
+ info->key_version);
ut_a(rc == MY_AES_OK);
ut_a(dst_len == src_len);
@@ -195,9 +194,10 @@ next:
}
/*********************************************************************//**
-Generate crypt key from crypt msg. */
+Generate crypt key from crypt msg.
+@return true if successfull, false if not. */
static
-void
+bool
init_crypt_key(
/*===========*/
crypt_info_t* info) /*< in/out: crypt info */
@@ -206,7 +206,7 @@ init_crypt_key(
memset(info->crypt_key, 0, sizeof(info->crypt_key));
memset(info->crypt_msg, 0, sizeof(info->crypt_msg));
memset(info->crypt_nonce, 0, sizeof(info->crypt_nonce));
- return;
+ return true;
}
byte mysqld_key[MY_AES_BLOCK_SIZE] = {0};
@@ -216,42 +216,59 @@ init_crypt_key(
{
ib_logf(IB_LOG_LEVEL_ERROR,
"Redo log crypto: getting mysqld crypto key "
- "from key version failed.");
- ut_error;
+ "from key version failed. Reason could be that requested"
+ " key_version %u is not found or required encryption "
+ " key management is not found.", info->key_version);
+ return false;
}
uint dst_len;
- int rc= my_aes_encrypt_ecb(info->crypt_msg, sizeof(info->crypt_msg), //src, srclen
- info->crypt_key, &dst_len, //dst, &dstlen
- (unsigned char*)&mysqld_key, sizeof(mysqld_key),
- NULL, 0, 1);
+ int rc= my_aes_crypt(MY_AES_ECB, ENCRYPTION_FLAG_NOPAD|ENCRYPTION_FLAG_ENCRYPT,
+ info->crypt_msg, sizeof(info->crypt_msg), //src, srclen
+ info->crypt_key, &dst_len, //dst, &dstlen
+ (unsigned char*)&mysqld_key, sizeof(mysqld_key),
+ NULL, 0);
if (rc != MY_AES_OK || dst_len != MY_AES_BLOCK_SIZE) {
fprintf(stderr,
"\nInnodb redo log crypto: getting redo log crypto key "
"failed.\n");
- ut_error;
+ return false;
}
+
+ return true;
}
-static bool mysort(const crypt_info_t& i,
- const crypt_info_t& j)
+/*********************************************************************//**
+Compare function for checkpoint numbers
+@return true if first checkpoint is larger than second one */
+static
+bool
+mysort(const crypt_info_t& i,
+ const crypt_info_t& j)
{
return i.checkpoint_no > j.checkpoint_no;
}
+/*********************************************************************//**
+Add crypt info to set if it is not already present
+@return true if successfull, false if not- */
static
-bool add_crypt_info(crypt_info_t* info)
+bool
+add_crypt_info(crypt_info_t* info)
{
/* so that no one is searching array while we modify it */
ut_ad(mutex_own(&(log_sys->mutex)));
if (get_crypt_info(info->checkpoint_no) != NULL) {
// already present...
+ return true;
+ }
+
+ if (!init_crypt_key(info)) {
return false;
}
- init_crypt_key(info);
crypt_info.push_back(*info);
/* a log block only stores 4-bytes of checkpoint no */
@@ -273,7 +290,7 @@ log_blocks_encrypt(
const ulint size, /*!< in: size of blocks, must be multiple of a log block */
byte* dst_block) /*!< out: blocks after encryption */
{
- return log_blocks_crypt(block, size, dst_block, true);
+ return log_blocks_crypt(block, size, dst_block, ENCRYPTION_FLAG_ENCRYPT);
}
/*********************************************************************//**
@@ -324,7 +341,7 @@ Encrypt one or more log block before it is flushed to disk */
UNIV_INTERN
void
log_encrypt_before_write(
-/*===========================*/
+/*=====================*/
ib_uint64_t next_checkpoint_no, /*!< in: log group to be flushed */
byte* block, /*!< in/out: pointer to a log block */
const ulint size) /*!< in: size of log blocks */
@@ -343,7 +360,7 @@ log_encrypt_before_write(
byte* dst_frame = (byte*)malloc(size);
//encrypt log blocks content
- Crypt_result result = log_blocks_crypt(block, size, dst_frame, true);
+ Crypt_result result = log_blocks_crypt(block, size, dst_frame, ENCRYPTION_FLAG_ENCRYPT);
if (result == MY_AES_OK) {
ut_ad(block[0] == dst_frame[0]);
@@ -361,7 +378,7 @@ Decrypt a specified log segment after they are read from a log file to a buffer.
*/
void
log_decrypt_after_read(
-/*==========================*/
+/*===================*/
byte* frame, /*!< in/out: log segment */
const ulint size) /*!< in: log segment size */
{
@@ -369,7 +386,7 @@ log_decrypt_after_read(
byte* dst_frame = (byte*)malloc(size);
// decrypt log blocks content
- Crypt_result result = log_blocks_crypt(frame, size, dst_frame, false);
+ Crypt_result result = log_blocks_crypt(frame, size, dst_frame, ENCRYPTION_FLAG_DECRYPT);
if (result == MY_AES_OK) {
memcpy(frame, dst_frame, size);
@@ -450,7 +467,7 @@ Read the crypto (version, msg and iv) info, which has been used for
log blocks with lsn <= this checkpoint's lsn, from a log header's
checkpoint buf. */
UNIV_INTERN
-void
+bool
log_crypt_read_checkpoint_buf(
/*===========================*/
const byte* buf) { /*!< in: checkpoint buffer */
@@ -459,7 +476,7 @@ log_crypt_read_checkpoint_buf(
byte scheme = buf[0];
if (scheme != redo_log_purpose_byte) {
- return;
+ return true;
}
buf++;
size_t n = buf[0];
@@ -471,7 +488,10 @@ log_crypt_read_checkpoint_buf(
info.key_version = mach_read_from_4(buf + 4);
memcpy(info.crypt_msg, buf + 8, MY_AES_BLOCK_SIZE);
memcpy(info.crypt_nonce, buf + 24, MY_AES_BLOCK_SIZE);
- add_crypt_info(&info);
+
+ if (!add_crypt_info(&info)) {
+ return false;
+ }
buf += LOG_CRYPT_ENTRY_SIZE;
}
@@ -485,5 +505,77 @@ log_crypt_read_checkpoint_buf(
}
fprintf(stderr, "\n");
#endif
+ return true;
}
+/********************************************************
+Check is the checkpoint information encrypted. This check
+is based on fact has log group crypt info and based
+on this crypt info was the key version different from
+unencrypted key version. There is no realible way to
+distinguish encrypted log block from corrupted log block,
+but if log block corruption is found this function is
+used to find out if log block is maybe encrypted but
+encryption key, key management plugin or encryption
+algorithm does not match.
+@return TRUE, if log block may be encrypted */
+UNIV_INTERN
+ibool
+log_crypt_block_maybe_encrypted(
+/*============================*/
+ const byte* log_block, /*!< in: log block */
+ log_crypt_err_t* err_info) /*!< out: error info */
+{
+ ibool maybe_encrypted = FALSE;
+ const crypt_info_t* crypt_info;
+
+ *err_info = LOG_UNENCRYPTED;
+ crypt_info = get_crypt_info(log_block);
+
+ if (crypt_info &&
+ crypt_info->key_version != UNENCRYPTED_KEY_VER) {
+ byte mysqld_key[MY_AES_BLOCK_SIZE] = {0};
+ uint keylen= sizeof(mysqld_key);
+
+ /* Log block contains crypt info and based on key
+ version block could be encrypted. */
+ *err_info = LOG_DECRYPT_MAYBE_FAILED;
+ maybe_encrypted = TRUE;
+
+ if (encryption_key_get(LOG_DEFAULT_ENCRYPTION_KEY,
+ crypt_info->key_version, mysqld_key, &keylen)) {
+ *err_info = LOG_CRYPT_KEY_NOT_FOUND;
+ }
+ }
+
+ return (maybe_encrypted);
+}
+
+/********************************************************
+Print crypt error message to error log */
+UNIV_INTERN
+void
+log_crypt_print_error(
+/*==================*/
+ log_crypt_err_t err_info) /*!< out: error info */
+{
+ switch(err_info) {
+ case LOG_CRYPT_KEY_NOT_FOUND:
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Redo log crypto: getting mysqld crypto key "
+ "from key version failed. Reason could be that "
+ "requested key version is not found or required "
+ "encryption key management plugin is not found.");
+ break;
+ case LOG_DECRYPT_MAYBE_FAILED:
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Redo log crypto: failed to decrypt log block. "
+ "Reason could be that requested key version is "
+ "not found, required encryption key management "
+ "plugin is not found or configured encryption "
+ "algorithm and/or method does not match.");
+ break;
+ default:
+ ut_error; /* Real bug */
+ }
+}
diff --git a/storage/xtradb/log/log0log.cc b/storage/xtradb/log/log0log.cc
index 9a1eb1b1b28..64459b9c2c7 100644
--- a/storage/xtradb/log/log0log.cc
+++ b/storage/xtradb/log/log0log.cc
@@ -2581,8 +2581,16 @@ loop:
(ulint) (source_offset % UNIV_PAGE_SIZE),
len, buf, (type == LOG_ARCHIVE) ? &log_archive_io : NULL, 0);
+ if (release_mutex) {
+ mutex_enter(&log_sys->mutex);
+ }
+
log_decrypt_after_read(buf, len);
+ if (release_mutex) {
+ mutex_exit(&log_sys->mutex);
+ }
+
start_lsn += len;
buf += len;
diff --git a/storage/xtradb/log/log0recv.cc b/storage/xtradb/log/log0recv.cc
index efe3fffbfe8..08a9b2b3863 100644
--- a/storage/xtradb/log/log0recv.cc
+++ b/storage/xtradb/log/log0recv.cc
@@ -1,8 +1,8 @@
/*****************************************************************************
-Copyright (c) 1997, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, SkySQL Ab. All Rights Reserved.
+Copyright (c) 2013, 2015, MariaDB Corporation. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -36,6 +36,8 @@ Created 9/20/1997 Heikki Tuuri
#include "log0recv.ic"
#endif
+#include "log0crypt.h"
+
#include "config.h"
#ifdef HAVE_ALLOCA_H
#include "alloca.h"
@@ -810,7 +812,10 @@ recv_find_max_checkpoint(
buf + LOG_CHECKPOINT_OFFSET_HIGH32)) << 32;
checkpoint_no = mach_read_from_8(
buf + LOG_CHECKPOINT_NO);
- log_crypt_read_checkpoint_buf(buf);
+
+ if (!log_crypt_read_checkpoint_buf(buf)) {
+ return DB_ERROR;
+ }
#ifdef UNIV_DEBUG
if (log_debug_writes) {
@@ -1948,7 +1953,7 @@ loop:
goto loop;
}
- ut_ad(!allow_ibuf == mutex_own(&log_sys->mutex));
+ ut_ad((!allow_ibuf) == mutex_own(&log_sys->mutex));
if (!allow_ibuf) {
recv_no_ibuf_operations = TRUE;
@@ -2771,8 +2776,9 @@ recv_scan_log_recs(
lsn_t* contiguous_lsn, /*!< in/out: it is known that all log
groups contain contiguous log data up
to this lsn */
- lsn_t* group_scanned_lsn)/*!< out: scanning succeeded up to
+ lsn_t* group_scanned_lsn,/*!< out: scanning succeeded up to
this lsn */
+ dberr_t* err) /*!< out: error code or DB_SUCCESS */
{
const byte* log_block;
ulint no;
@@ -2791,6 +2797,7 @@ recv_scan_log_recs(
log_block = buf;
scanned_lsn = start_lsn;
more_data = FALSE;
+ *err = DB_SUCCESS;
do {
no = log_block_get_hdr_no(log_block);
@@ -2802,6 +2809,7 @@ recv_scan_log_recs(
*/
if (no != log_block_convert_lsn_to_no(scanned_lsn)
|| !log_block_checksum_is_ok_or_old_format(log_block)) {
+ log_crypt_err_t log_crypt_err;
if (no == log_block_convert_lsn_to_no(scanned_lsn)
&& !log_block_checksum_is_ok_or_old_format(
@@ -2823,6 +2831,14 @@ recv_scan_log_recs(
finished = TRUE;
+ if (log_crypt_block_maybe_encrypted(log_block,
+ &log_crypt_err)) {
+ /* Log block maybe encrypted */
+ log_crypt_print_error(log_crypt_err);
+ *err = DB_ERROR;
+ return (TRUE);
+ }
+
/* Crash if we encounter a garbage log block */
if (!srv_force_recovery) {
fputs("InnoDB: Set innodb_force_recovery"
@@ -3011,14 +3027,16 @@ recv_group_scan_log_recs(
lsn_t* contiguous_lsn, /*!< in/out: it is known that all log
groups contain contiguous log data up
to this lsn */
- lsn_t* group_scanned_lsn)/*!< out: scanning succeeded up to
+ lsn_t* group_scanned_lsn,/*!< out: scanning succeeded up to
this lsn */
+ dberr_t* err) /*!< out: error code or DB_SUCCESS */
{
ibool finished;
lsn_t start_lsn;
lsn_t end_lsn;
finished = FALSE;
+ *err = DB_SUCCESS;
start_lsn = *contiguous_lsn;
@@ -3033,7 +3051,13 @@ recv_group_scan_log_recs(
- (recv_n_pool_free_frames * srv_buf_pool_instances))
* UNIV_PAGE_SIZE,
TRUE, log_sys->buf, RECV_SCAN_SIZE,
- start_lsn, contiguous_lsn, group_scanned_lsn);
+ start_lsn, contiguous_lsn, group_scanned_lsn,
+ err);
+
+ if (*err != DB_SUCCESS) {
+ break;
+ }
+
start_lsn = end_lsn;
}
@@ -3264,6 +3288,7 @@ recv_recovery_from_checkpoint_start_func(
up_to_date_group = max_cp_group;
} else {
ulint capacity;
+ dberr_t err;
/* Try to recover the remaining part from logs: first from
the logs of the archived group */
@@ -3283,8 +3308,9 @@ recv_recovery_from_checkpoint_start_func(
}
recv_group_scan_log_recs(group, &contiguous_lsn,
- &group_scanned_lsn);
- if (recv_sys->scanned_lsn < checkpoint_lsn) {
+ &group_scanned_lsn, &err);
+
+ if (err != DB_SUCCESS || recv_sys->scanned_lsn < checkpoint_lsn) {
mutex_exit(&(log_sys->mutex));
@@ -3316,9 +3342,15 @@ recv_recovery_from_checkpoint_start_func(
#ifdef UNIV_LOG_ARCHIVE
lsn_t old_scanned_lsn = recv_sys->scanned_lsn;
#endif /* UNIV_LOG_ARCHIVE */
+ dberr_t err;
recv_group_scan_log_recs(group, &contiguous_lsn,
- &group_scanned_lsn);
+ &group_scanned_lsn, &err);
+
+ if (err != DB_SUCCESS) {
+ return (err);
+ }
+
group->scanned_lsn = group_scanned_lsn;
#ifdef UNIV_LOG_ARCHIVE
@@ -3798,6 +3830,7 @@ log_group_recover_from_archive_file(
os_offset_t file_size;
int input_char;
char name[OS_FILE_MAX_PATH];
+ dberr_t err;
ut_a(0);
@@ -3943,7 +3976,11 @@ ask_again:
(buf_pool_get_n_pages()
- (recv_n_pool_free_frames * srv_buf_pool_instances))
* UNIV_PAGE_SIZE, TRUE, buf, len, start_lsn,
- &dummy_lsn, &scanned_lsn);
+ &dummy_lsn, &scanned_lsn, &err);
+
+ if (err != DB_SUCCESS) {
+ return(FALSE);
+ }
if (scanned_lsn == file_end_lsn) {
diff --git a/storage/xtradb/mtr/mtr0log.cc b/storage/xtradb/mtr/mtr0log.cc
index db39ebeafa4..82df1df63d4 100644
--- a/storage/xtradb/mtr/mtr0log.cc
+++ b/storage/xtradb/mtr/mtr0log.cc
@@ -571,7 +571,7 @@ mlog_parse_index(
n = n_uniq = 1;
}
table = dict_mem_table_create("LOG_DUMMY", DICT_HDR_SPACE, n,
- comp ? DICT_TF_COMPACT : 0, 0, true);
+ comp ? DICT_TF_COMPACT : 0, 0);
ind = dict_mem_index_create("LOG_DUMMY", "LOG_DUMMY",
DICT_HDR_SPACE, 0, n);
ind->table = table;
diff --git a/storage/xtradb/mysql-test/storage_engine/type_spatial_indexes.rdiff b/storage/xtradb/mysql-test/storage_engine/type_spatial_indexes.rdiff
index d3fb59e6ce3..154116b748c 100644
--- a/storage/xtradb/mysql-test/storage_engine/type_spatial_indexes.rdiff
+++ b/storage/xtradb/mysql-test/storage_engine/type_spatial_indexes.rdiff
@@ -414,12 +414,12 @@
-Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
-FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
-first second w c o e d t i r
--120 120 1 1 0 1 0 1 1 0
+-120 120 1 1 0 1 0 0 1 0
-120 121 0 0 1 0 0 0 1 0
-120 122 NULL NULL NULL NULL NULL NULL NULL NULL
-120 123 NULL NULL NULL NULL NULL NULL NULL NULL
-121 120 0 0 1 0 0 0 1 0
--121 121 1 1 0 1 0 1 1 0
+-121 121 1 1 0 1 0 0 1 0
-121 122 NULL NULL NULL NULL NULL NULL NULL NULL
-121 123 NULL NULL NULL NULL NULL NULL NULL NULL
-122 120 NULL NULL NULL NULL NULL NULL NULL NULL
diff --git a/storage/xtradb/os/os0file.cc b/storage/xtradb/os/os0file.cc
index 4c19b4a9922..06549bc9b1d 100644
--- a/storage/xtradb/os/os0file.cc
+++ b/storage/xtradb/os/os0file.cc
@@ -1,6 +1,6 @@
/***********************************************************************
-Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2015, MariaDB Corporation.
@@ -3605,8 +3605,9 @@ os_file_get_status(
stat_info->type = OS_FILE_TYPE_LINK;
break;
case S_IFBLK:
- stat_info->type = OS_FILE_TYPE_BLOCK;
- break;
+ /* Handle block device as regular file. */
+ case S_IFCHR:
+ /* Handle character device as regular file. */
case S_IFREG:
stat_info->type = OS_FILE_TYPE_FILE;
break;
@@ -3615,8 +3616,8 @@ os_file_get_status(
}
- if (check_rw_perm && (stat_info->type == OS_FILE_TYPE_FILE
- || stat_info->type == OS_FILE_TYPE_BLOCK)) {
+ if (check_rw_perm && stat_info->type == OS_FILE_TYPE_FILE) {
+
int fh;
int access;
diff --git a/storage/xtradb/os/os0sync.cc b/storage/xtradb/os/os0sync.cc
index 451ba5285e3..03c53848832 100644
--- a/storage/xtradb/os/os0sync.cc
+++ b/storage/xtradb/os/os0sync.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -234,24 +234,6 @@ os_cond_broadcast(
}
/*********************************************************//**
-Wakes one thread waiting for condition variable */
-UNIV_INLINE
-void
-os_cond_signal(
-/*==========*/
- os_cond_t* cond) /*!< in: condition variable. */
-{
- ut_a(cond);
-
-#ifdef __WIN__
- ut_a(wake_condition_variable != NULL);
- wake_condition_variable(cond);
-#else
- ut_a(pthread_cond_signal(cond) == 0);
-#endif
-}
-
-/*********************************************************//**
Destroys condition variable */
UNIV_INLINE
void
diff --git a/storage/xtradb/page/page0page.cc b/storage/xtradb/page/page0page.cc
index 4aff88818bb..6adbdeb95a4 100644
--- a/storage/xtradb/page/page0page.cc
+++ b/storage/xtradb/page/page0page.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
This program is free software; you can redistribute it and/or modify it under
@@ -31,6 +31,11 @@ Created 2/2/1994 Heikki Tuuri
#endif
#undef THIS_MODULE
+#include "ha_prototypes.h"
+#include "buf0checksum.h"
+
+#ifndef UNIV_INNOCHECKSUM
+
#include "page0cur.h"
#include "page0zip.h"
#include "buf0buf.h"
@@ -2819,3 +2824,51 @@ page_find_rec_max_not_deleted(
}
return(prev_rec);
}
+
+#endif /* #ifndef UNIV_INNOCHECKSUM */
+
+/** Issue a warning when the checksum that is stored in the page is valid,
+but different than the global setting innodb_checksum_algorithm.
+@param[in] current_algo current checksum algorithm
+@param[in] page_checksum page valid checksum
+@param[in] space_id tablespace id
+@param[in] page_no page number */
+void
+page_warn_strict_checksum(
+ srv_checksum_algorithm_t curr_algo,
+ srv_checksum_algorithm_t page_checksum,
+ ulint space_id,
+ ulint page_no)
+{
+ srv_checksum_algorithm_t curr_algo_nonstrict;
+ switch (curr_algo) {
+ case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
+ curr_algo_nonstrict = SRV_CHECKSUM_ALGORITHM_CRC32;
+ break;
+ case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
+ curr_algo_nonstrict = SRV_CHECKSUM_ALGORITHM_INNODB;
+ break;
+ case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
+ curr_algo_nonstrict = SRV_CHECKSUM_ALGORITHM_NONE;
+ break;
+ default:
+ ut_error;
+ }
+
+#ifdef UNIV_INNOCHECKSUM
+ fprintf(stderr,
+#else
+ ib_logf(IB_LOG_LEVEL_WARN,
+#endif
+ "innodb_checksum_algorithm is set to \"%s\""
+ " but the page [page id: space=" ULINTPF ","
+ " page number=" ULINTPF "] contains a valid checksum \"%s\"."
+ " Accepting the page as valid. Change innodb_checksum_algorithm"
+ " to \"%s\" to silently accept such pages or rewrite all pages"
+ " so that they contain \"%s\" checksum.",
+ buf_checksum_algorithm_name(curr_algo),
+ space_id, page_no,
+ buf_checksum_algorithm_name(page_checksum),
+ buf_checksum_algorithm_name(curr_algo_nonstrict),
+ buf_checksum_algorithm_name(curr_algo_nonstrict));
+}
diff --git a/storage/xtradb/page/page0zip.cc b/storage/xtradb/page/page0zip.cc
index 86c33ab5efb..42ffd3668d8 100644
--- a/storage/xtradb/page/page0zip.cc
+++ b/storage/xtradb/page/page0zip.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2005, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2005, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2014, SkySQL Ab. All Rights Reserved.
@@ -37,30 +37,40 @@ using namespace std;
# include "page0zip.ic"
#endif
#undef THIS_MODULE
+#include "buf0checksum.h"
#include "page0page.h"
+#ifndef UNIV_INNOCHECKSUM
#include "mtr0log.h"
-#include "ut0sort.h"
#include "dict0dict.h"
#include "btr0cur.h"
-#include "page0types.h"
#include "log0recv.h"
+#endif /* !UNIV_INNOCHECKSUM */
#include "zlib.h"
+#include "fil0fil.h"
+#include "ut0sort.h"
+#include "page0types.h"
#ifndef UNIV_HOTBACKUP
+#ifndef UNIV_INNOCHECKSUM
# include "buf0buf.h"
-# include "buf0lru.h"
# include "btr0sea.h"
# include "dict0boot.h"
# include "lock0lock.h"
# include "srv0mon.h"
# include "srv0srv.h"
+#endif /* !UNIV_INNOCHECKSUM */
+# include "buf0lru.h"
# include "ut0crc32.h"
#else /* !UNIV_HOTBACKUP */
-# include "buf0checksum.h"
# define lock_move_reorganize_page(block, temp_block) ((void) 0)
# define buf_LRU_stat_inc_unzip() ((void) 0)
#endif /* !UNIV_HOTBACKUP */
+#ifdef UNIV_INNOCHECKSUM
+#include "mach0data.h"
+#endif /* UNIV_INNOCHECKSUM */
+
#ifndef UNIV_HOTBACKUP
+#ifndef UNIV_INNOCHECKSUM
/** Statistics on compression, indexed by page_zip_des_t::ssize - 1 */
UNIV_INTERN page_zip_stat_t page_zip_stat[PAGE_ZIP_SSIZE_MAX];
/** Statistics on compression, indexed by index->id */
@@ -70,6 +80,7 @@ UNIV_INTERN ib_mutex_t page_zip_stat_per_index_mutex;
#ifdef HAVE_PSI_INTERFACE
UNIV_INTERN mysql_pfs_key_t page_zip_stat_per_index_mutex_key;
#endif /* HAVE_PSI_INTERFACE */
+#endif /* !UNIV_INNOCHECKSUM */
#endif /* !UNIV_HOTBACKUP */
/* Compression level to be used by zlib. Settable by user. */
@@ -82,6 +93,8 @@ UNIV_INTERN my_bool page_zip_log_pages = false;
/* Please refer to ../include/page0zip.ic for a description of the
compressed page format. */
+#ifndef UNIV_INNOCHECKSUM
+
/* The infimum and supremum records are omitted from the compressed page.
On compress, we compare that the records are there, and on uncompress we
restore the records. */
@@ -105,6 +118,8 @@ static const byte supremum_extra_data[] = {
0x65, 0x6d, 0x75, 0x6d /* "supremum" */
};
+#endif /* !UNIV_INNOCHECKSUM */
+
/** Assert that a block of memory is filled with zero bytes.
Compare at most sizeof(field_ref_zero) bytes.
@param b in: memory block
@@ -151,6 +166,7 @@ page_zip_fail_func(
# define page_zip_fail(fmt_args) /* empty */
#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
+#ifndef UNIV_INNOCHECKSUM
#ifndef UNIV_HOTBACKUP
/**********************************************************************//**
Determine the guaranteed free space on an empty page.
@@ -1601,7 +1617,7 @@ page_zip_fields_free(
{
if (index) {
dict_table_t* table = index->table;
- os_fast_mutex_free(&index->zip_pad.mutex);
+ dict_index_zip_pad_mutex_destroy(index);
mem_heap_free(index->heap);
dict_mem_table_free(table);
@@ -1652,7 +1668,7 @@ page_zip_fields_decode(
}
table = dict_mem_table_create("ZIP_DUMMY", DICT_HDR_SPACE, n,
- DICT_TF_COMPACT, 0, true);
+ DICT_TF_COMPACT, 0);
index = dict_mem_index_create("ZIP_DUMMY", "ZIP_DUMMY",
DICT_HDR_SPACE, 0, n);
index->table = table;
@@ -4843,6 +4859,7 @@ corrupt:
return(ptr + 8 + size + trailer_size);
}
+#endif /* !UNIV_INNOCHECKSUM */
/**********************************************************************//**
Calculate the compressed page checksum.
@@ -4918,6 +4935,10 @@ page_zip_verify_checksum(
stored = static_cast<ib_uint32_t>(mach_read_from_4(
static_cast<const unsigned char*>(data) + FIL_PAGE_SPACE_OR_CHKSUM));
+ ulint page_no = mach_read_from_4(static_cast<const unsigned char*> (data) + FIL_PAGE_OFFSET);
+ ulint space_id = mach_read_from_4(static_cast<const unsigned char*>
+ (data) + FIL_PAGE_SPACE_ID);
+
#if FIL_PAGE_LSN % 8
#error "FIL_PAGE_LSN must be 64 bit aligned"
#endif
@@ -4938,40 +4959,113 @@ page_zip_verify_checksum(
return(TRUE);
}
+ const srv_checksum_algorithm_t curr_algo =
+ static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
+
+ if (curr_algo == SRV_CHECKSUM_ALGORITHM_NONE) {
+ return(TRUE);
+ }
+
calc = static_cast<ib_uint32_t>(page_zip_calc_checksum(
- data, size, static_cast<srv_checksum_algorithm_t>(
- srv_checksum_algorithm)));
+ data, size, curr_algo));
if (stored == calc) {
return(TRUE);
}
- switch ((srv_checksum_algorithm_t) srv_checksum_algorithm) {
+ switch (curr_algo) {
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
- case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
- case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
- return(stored == calc);
case SRV_CHECKSUM_ALGORITHM_CRC32:
+
if (stored == BUF_NO_CHECKSUM_MAGIC) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_NONE,
+ space_id, page_no);
+ }
+
return(TRUE);
}
- crc32 = calc;
+
innodb = static_cast<ib_uint32_t>(page_zip_calc_checksum(
data, size, SRV_CHECKSUM_ALGORITHM_INNODB));
+
+ if (stored == innodb) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_INNODB,
+ space_id, page_no);
+ }
+
+ return(TRUE);
+ }
+
break;
+ case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
case SRV_CHECKSUM_ALGORITHM_INNODB:
+
if (stored == BUF_NO_CHECKSUM_MAGIC) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_NONE,
+ space_id, page_no);
+ }
+
return(TRUE);
}
+
crc32 = static_cast<ib_uint32_t>(page_zip_calc_checksum(
data, size, SRV_CHECKSUM_ALGORITHM_CRC32));
- innodb = calc;
+
+ if (stored == crc32) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_CRC32,
+ space_id, page_no);
+ }
+
+ return(TRUE);
+ }
+
+ break;
+ case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
+
+ crc32 = static_cast<ib_uint32_t>(page_zip_calc_checksum(
+ data, size, SRV_CHECKSUM_ALGORITHM_CRC32));
+
+ if (stored == crc32) {
+ page_warn_strict_checksum(
+ curr_algo, SRV_CHECKSUM_ALGORITHM_CRC32,
+ space_id, page_no);
+
+ return(TRUE);
+ }
+
+ innodb = static_cast<ib_uint32_t>(page_zip_calc_checksum(
+ data, size, SRV_CHECKSUM_ALGORITHM_INNODB));
+
+ if (stored == innodb) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_INNODB,
+ space_id, page_no);
+ return(TRUE);
+ }
+
break;
case SRV_CHECKSUM_ALGORITHM_NONE:
- return(TRUE);
+ ut_error;
/* no default so the compiler will emit a warning if new enum
is added and not handled here */
}
- return(stored == crc32 || stored == innodb);
+ return(FALSE);
}
diff --git a/storage/xtradb/pars/pars0pars.cc b/storage/xtradb/pars/pars0pars.cc
index 18feb9407c7..da08939d78a 100644
--- a/storage/xtradb/pars/pars0pars.cc
+++ b/storage/xtradb/pars/pars0pars.cc
@@ -1998,7 +1998,7 @@ pars_create_table(
n_cols = que_node_list_get_len(column_defs);
table = dict_mem_table_create(
- table_sym->name, 0, n_cols, flags, flags2, false);
+ table_sym->name, 0, n_cols, flags, flags2);
#ifdef UNIV_DEBUG
if (not_fit_in_memory != NULL) {
@@ -2019,7 +2019,8 @@ pars_create_table(
column = static_cast<sym_node_t*>(que_node_get_next(column));
}
- node = tab_create_graph_create(table, pars_sym_tab_global->heap, true);
+ node = tab_create_graph_create(table, pars_sym_tab_global->heap, true,
+ FIL_SPACE_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
table_sym->resolved = TRUE;
table_sym->token_type = SYM_TABLE;
diff --git a/storage/xtradb/que/que0que.cc b/storage/xtradb/que/que0que.cc
index 8d9b8fac776..e2dc0239e13 100644
--- a/storage/xtradb/que/que0que.cc
+++ b/storage/xtradb/que/que0que.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -390,32 +390,6 @@ que_fork_start_command(
return(thr);
}
-/****************************************************************//**
-Tests if all the query threads in the same fork have a given state.
-@return TRUE if all the query threads in the same fork were in the
-given state */
-UNIV_INLINE
-ibool
-que_fork_all_thrs_in_state(
-/*=======================*/
- que_fork_t* fork, /*!< in: query fork */
- ulint state) /*!< in: state */
-{
- que_thr_t* thr_node;
-
- for (thr_node = UT_LIST_GET_FIRST(fork->thrs);
- thr_node != NULL;
- thr_node = UT_LIST_GET_NEXT(thrs, thr_node)) {
-
- if (thr_node->state != state) {
-
- return(FALSE);
- }
- }
-
- return(TRUE);
-}
-
/**********************************************************************//**
Calls que_graph_free_recursive for statements in a statement list. */
static
diff --git a/storage/xtradb/row/row0ftsort.cc b/storage/xtradb/row/row0ftsort.cc
index 3f7bc7c8e98..fad276c5196 100644
--- a/storage/xtradb/row/row0ftsort.cc
+++ b/storage/xtradb/row/row0ftsort.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2010, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -38,7 +39,8 @@ Created 10/13/2010 Jimmy Yang
do { \
b[N] = row_merge_read_rec( \
block[N], buf[N], b[N], index, \
- fd[N], &foffs[N], &mrec[N], offsets[N]); \
+ fd[N], &foffs[N], &mrec[N], offsets[N], \
+ crypt_data, crypt_block[N], space); \
if (UNIV_UNLIKELY(!b[N])) { \
if (mrec[N]) { \
goto exit; \
@@ -194,6 +196,8 @@ row_fts_psort_info_init(
fts_psort_t* merge_info = NULL;
ulint block_size;
ibool ret = TRUE;
+ fil_space_crypt_t* crypt_data = NULL;
+ bool encrypted = false;
block_size = 3 * srv_sort_buf_size;
@@ -222,6 +226,19 @@ row_fts_psort_info_init(
common_info->sort_event = os_event_create();
common_info->merge_event = os_event_create();
common_info->opt_doc_id_size = opt_doc_id_size;
+ crypt_data = fil_space_get_crypt_data(new_table->space);
+
+ if ((crypt_data && crypt_data->encryption == FIL_SPACE_ENCRYPTION_ON) ||
+ (srv_encrypt_tables &&
+ crypt_data && crypt_data->encryption == FIL_SPACE_ENCRYPTION_DEFAULT)) {
+
+ common_info->crypt_data = crypt_data;
+ encrypted = true;
+ } else {
+ /* Not needed */
+ common_info->crypt_data = NULL;
+ crypt_data = NULL;
+ }
/* There will be FTS_NUM_AUX_INDEX number of "sort buckets" for
each parallel sort thread. Each "sort bucket" holds records for
@@ -259,6 +276,29 @@ row_fts_psort_info_init(
ut_align(
psort_info[j].block_alloc[i], 1024));
+ /* If tablespace is encrypted, allocate additional buffer for
+ encryption/decryption. */
+ if (encrypted) {
+
+ /* Need to align memory for O_DIRECT write */
+ psort_info[j].crypt_alloc[i] =
+ static_cast<row_merge_block_t*>(ut_malloc(
+ block_size + 1024));
+
+ psort_info[j].crypt_block[i] =
+ static_cast<row_merge_block_t*>(
+ ut_align(
+ psort_info[j].crypt_alloc[i], 1024));
+
+ if (!psort_info[j].crypt_block[i]) {
+ ret = FALSE;
+ goto func_exit;
+ }
+ } else {
+ psort_info[j].crypt_alloc[i] = NULL;
+ psort_info[j].crypt_block[i] = NULL;
+ }
+
if (!psort_info[j].merge_block[i]) {
ret = FALSE;
goto func_exit;
@@ -316,6 +356,11 @@ row_fts_psort_info_destroy(
if (psort_info[j].block_alloc[i]) {
ut_free(psort_info[j].block_alloc[i]);
}
+
+ if (psort_info[j].crypt_alloc[i]) {
+ ut_free(psort_info[j].crypt_alloc[i]);
+ }
+
mem_free(psort_info[j].merge_file[i]);
}
@@ -598,6 +643,7 @@ fts_parallel_tokenization(
ibool processed = FALSE;
merge_file_t** merge_file;
row_merge_block_t** block;
+ row_merge_block_t** crypt_block;
int tmpfd[FTS_NUM_AUX_INDEX];
ulint mycount[FTS_NUM_AUX_INDEX];
ib_uint64_t total_rec = 0;
@@ -612,6 +658,7 @@ fts_parallel_tokenization(
fts_tokenize_ctx_t t_ctx;
ulint retried = 0;
dberr_t error = DB_SUCCESS;
+ fil_space_crypt_t* crypt_data = NULL;
ut_ad(psort_info);
@@ -633,6 +680,8 @@ fts_parallel_tokenization(
? DATA_VARCHAR : DATA_VARMYSQL;
block = psort_info->merge_block;
+ crypt_block = psort_info->crypt_block;
+ crypt_data = psort_info->psort_common->crypt_data;
zip_size = dict_table_zip_size(table);
row_merge_fts_get_next_doc_item(psort_info, &doc_item);
@@ -727,7 +776,10 @@ loop:
if (!row_merge_write(merge_file[t_ctx.buf_used]->fd,
merge_file[t_ctx.buf_used]->offset++,
- block[t_ctx.buf_used])) {
+ block[t_ctx.buf_used],
+ crypt_data,
+ crypt_block[t_ctx.buf_used],
+ table->space)) {
error = DB_TEMP_FILE_WRITE_FAILURE;
goto func_exit;
}
@@ -820,13 +872,21 @@ exit:
if (merge_file[i]->offset != 0) {
if (!row_merge_write(merge_file[i]->fd,
merge_file[i]->offset++,
- block[i])) {
+ block[i],
+ crypt_data,
+ crypt_block[i],
+ table->space)) {
error = DB_TEMP_FILE_WRITE_FAILURE;
goto func_exit;
}
UNIV_MEM_INVALID(block[i][0],
srv_sort_buf_size);
+
+ if (crypt_block[i]) {
+ UNIV_MEM_INVALID(crypt_block[i][0],
+ srv_sort_buf_size);
+ }
}
buf[i] = row_merge_buf_empty(buf[i]);
@@ -851,7 +911,10 @@ exit:
error = row_merge_sort(psort_info->psort_common->trx,
psort_info->psort_common->dup,
- merge_file[i], block[i], &tmpfd[i], false, 0.0/* pct_progress */, 0.0/* pct_cost */);
+ merge_file[i], block[i], &tmpfd[i],
+ false, 0.0/* pct_progress */, 0.0/* pct_cost */,
+ crypt_data, crypt_block[i], table->space);
+
if (error != DB_SUCCESS) {
close(tmpfd[i]);
goto func_exit;
@@ -1355,6 +1418,7 @@ row_fts_merge_insert(
mrec_buf_t** buf;
int* fd;
byte** block;
+ byte** crypt_block;
const mrec_t** mrec;
ulint count = 0;
int* sel_tree;
@@ -1362,6 +1426,8 @@ row_fts_merge_insert(
ulint start;
fts_psort_insert_t ins_ctx;
ulint count_diag = 0;
+ fil_space_crypt_t* crypt_data = NULL;
+ ulint space;
ut_ad(index);
ut_ad(table);
@@ -1374,6 +1440,7 @@ row_fts_merge_insert(
ins_ctx.trx->op_info = "inserting index entries";
ins_ctx.opt_doc_id_size = psort_info[0].psort_common->opt_doc_id_size;
+ crypt_data = psort_info[0].psort_common->crypt_data;
heap = mem_heap_create(500 + sizeof(mrec_buf_t));
@@ -1388,6 +1455,8 @@ row_fts_merge_insert(
fd = (int*) mem_heap_alloc(heap, sizeof(*fd) * fts_sort_pll_degree);
block = (byte**) mem_heap_alloc(
heap, sizeof(*block) * fts_sort_pll_degree);
+ crypt_block = (byte**) mem_heap_alloc(
+ heap, sizeof(*block) * fts_sort_pll_degree);
mrec = (const mrec_t**) mem_heap_alloc(
heap, sizeof(*mrec) * fts_sort_pll_degree);
sel_tree = (int*) mem_heap_alloc(
@@ -1408,6 +1477,7 @@ row_fts_merge_insert(
offsets[i][0] = num;
offsets[i][1] = dict_index_get_n_fields(index);
block[i] = psort_info[i].merge_block[id];
+ crypt_block[i] = psort_info[i].crypt_block[id];
b[i] = psort_info[i].merge_block[id];
fd[i] = psort_info[i].merge_file[id]->fd;
foffs[i] = 0;
@@ -1450,6 +1520,7 @@ row_fts_merge_insert(
ins_ctx.fts_table.table_id = table->id;
ins_ctx.fts_table.parent = index->table->name;
ins_ctx.fts_table.table = index->table;
+ space = table->space;
for (i = 0; i < fts_sort_pll_degree; i++) {
if (psort_info[i].merge_file[id]->n_rec == 0) {
@@ -1462,7 +1533,10 @@ row_fts_merge_insert(
if (psort_info[i].merge_file[id]->offset > 0
&& (!row_merge_read(
fd[i], foffs[i],
- (row_merge_block_t*) block[i]))) {
+ (row_merge_block_t*) block[i],
+ crypt_data,
+ (row_merge_block_t*) crypt_block[i],
+ space))) {
error = DB_CORRUPTION;
goto exit;
}
diff --git a/storage/xtradb/row/row0import.cc b/storage/xtradb/row/row0import.cc
index d5f766ef51b..cbcbb705857 100644
--- a/storage/xtradb/row/row0import.cc
+++ b/storage/xtradb/row/row0import.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2012, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -3620,10 +3621,13 @@ row_import_for_mysql(
innobase_format_name(
table_name, sizeof(table_name), table->name, FALSE);
- ib_errf(trx->mysql_thd, IB_LOG_LEVEL_ERROR,
- ER_INTERNAL_ERROR,
- "Cannot reset LSNs in table '%s' : %s",
- table_name, ut_strerr(err));
+ if (err != DB_DECRYPTION_FAILED) {
+
+ ib_errf(trx->mysql_thd, IB_LOG_LEVEL_ERROR,
+ ER_INTERNAL_ERROR,
+ "Cannot reset LSNs in table '%s' : %s",
+ table_name, ut_strerr(err));
+ }
return(row_import_cleanup(prebuilt, trx, err));
}
@@ -3651,7 +3655,7 @@ row_import_for_mysql(
err = fil_open_single_table_tablespace(
true, true, table->space,
dict_tf_to_fsp_flags(table->flags),
- table->name, filepath);
+ table->name, filepath, table);
DBUG_EXECUTE_IF("ib_import_open_tablespace_failure",
err = DB_TABLESPACE_NOT_FOUND;);
diff --git a/storage/xtradb/row/row0ins.cc b/storage/xtradb/row/row0ins.cc
index fb719266a16..ae63f0c323b 100644
--- a/storage/xtradb/row/row0ins.cc
+++ b/storage/xtradb/row/row0ins.cc
@@ -2350,7 +2350,7 @@ row_ins_clust_index_entry_low(
{
btr_cur_t cursor;
ulint* offsets = NULL;
- dberr_t err;
+ dberr_t err = DB_SUCCESS;
big_rec_t* big_rec = NULL;
mtr_t mtr;
mem_heap_t* offsets_heap = NULL;
@@ -2380,9 +2380,16 @@ row_ins_clust_index_entry_low(
the function will return in both low_match and up_match of the
cursor sensible values */
- btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE, mode,
+ err = btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE, mode,
&cursor, 0, __FILE__, __LINE__, &mtr);
+ if (err != DB_SUCCESS) {
+ index->table->is_encrypted = true;
+ index->table->ibd_file_missing = true;
+ mtr_commit(&mtr);
+ goto func_exit;
+ }
+
#ifdef UNIV_DEBUG
{
page_t* page = btr_cur_get_page(&cursor);
@@ -2696,9 +2703,22 @@ row_ins_sec_index_entry_low(
search_mode |= BTR_IGNORE_SEC_UNIQUE;
}
- btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
- search_mode,
- &cursor, 0, __FILE__, __LINE__, &mtr);
+ err = btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
+ search_mode,
+ &cursor, 0, __FILE__, __LINE__, &mtr);
+
+ if (err != DB_SUCCESS) {
+ if (err == DB_DECRYPTION_FAILED) {
+ ib_push_warning(trx->mysql_thd,
+ DB_DECRYPTION_FAILED,
+ "Table %s is encrypted but encryption service or"
+ " used key_id is not available. "
+ " Can't continue reading table.",
+ index->table->name);
+ index->table->is_encrypted = true;
+ }
+ goto func_exit;
+ }
if (cursor.flag == BTR_CUR_INSERT_TO_IBUF) {
/* The insert was buffered during the search: we are done */
@@ -2765,6 +2785,8 @@ row_ins_sec_index_entry_low(
goto func_exit;
}
+ DEBUG_SYNC_C("row_ins_sec_index_entry_dup_locks_created");
+
/* We did not find a duplicate and we have now
locked with s-locks the necessary records to
prevent any insertion of a duplicate by another
diff --git a/storage/xtradb/row/row0log.cc b/storage/xtradb/row/row0log.cc
index ac0e75929a4..9d403e64fd0 100644
--- a/storage/xtradb/row/row0log.cc
+++ b/storage/xtradb/row/row0log.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2011, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -1390,6 +1390,27 @@ blob_done:
dfield_set_data(dfield, data, len);
}
+ if (len != UNIV_SQL_NULL && col->mtype == DATA_MYSQL
+ && col->len != len && !dict_table_is_comp(log->table)) {
+
+ ut_ad(col->len >= len);
+ if (dict_table_is_comp(index->table)) {
+ byte* buf = (byte*) mem_heap_alloc(heap,
+ col->len);
+ memcpy(buf, dfield->data, len);
+ memset(buf + len, 0x20, col->len - len);
+
+ dfield_set_data(dfield, buf, col->len);
+ } else {
+ /* field length mismatch should not happen
+ when rebuilding the redundant row format
+ table. */
+ ut_ad(0);
+ *error = DB_CORRUPTION;
+ return(NULL);
+ }
+ }
+
/* See if any columns were changed to NULL or NOT NULL. */
const dict_col_t* new_col
= dict_table_get_nth_col(log->table, col_no);
diff --git a/storage/xtradb/row/row0merge.cc b/storage/xtradb/row/row0merge.cc
index bdcbd00ac80..7b8787808d9 100644
--- a/storage/xtradb/row/row0merge.cc
+++ b/storage/xtradb/row/row0merge.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
-Copyright (c) 2005, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2005, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -41,6 +42,7 @@ Completed by Sunny Bains and Marko Makela
#include "handler0alter.h"
#include "ha_prototypes.h"
#include "math.h" /* log2() */
+#include "fil0crypt.h"
float my_log2f(float n)
{
@@ -76,6 +78,92 @@ UNIV_INTERN char srv_disable_sort_file_cache;
/* Maximum pending doc memory limit in bytes for a fts tokenization thread */
#define FTS_PENDING_DOC_MEMORY_LIMIT 1000000
+/* Reserve free space from every block for key_version */
+#define ROW_MERGE_RESERVE_SIZE 4
+
+/******************************************************//**
+Encrypt a merge block. */
+static
+void
+row_merge_encrypt_buf(
+/*==================*/
+ fil_space_crypt_t* crypt_data, /*!< in: table crypt data */
+ ulint offset, /*!< in: offset where to
+ write */
+ ulint space, /*!< in: tablespace id */
+ const byte* input_buf, /*!< in: input buffer */
+ byte* crypted_buf) /*!< out: crypted buffer */
+{
+ uint key_version;
+ uint dstlen=0;
+ os_offset_t ofs = (os_offset_t)srv_sort_buf_size * (os_offset_t)offset;
+
+ key_version = encryption_key_get_latest_version(crypt_data->key_id);
+
+ /* Store key_version at the begining of the input buffer */
+ mach_write_to_4((byte *)crypted_buf, key_version);
+
+ int rc = encryption_scheme_encrypt(input_buf+ROW_MERGE_RESERVE_SIZE,
+ srv_sort_buf_size-ROW_MERGE_RESERVE_SIZE,
+ crypted_buf+ROW_MERGE_RESERVE_SIZE, &dstlen,
+ crypt_data, key_version,
+ space, ofs, 0);
+
+ if (! ((rc == MY_AES_OK) && ((ulint)dstlen == srv_sort_buf_size-ROW_MERGE_RESERVE_SIZE))) {
+ ib_logf(IB_LOG_LEVEL_FATAL,
+ "Unable to encrypt data-block "
+ " src: %p srclen: %lu buf: %p buflen: %d."
+ " return-code: %d. Can't continue!\n",
+ input_buf, (size_t)srv_sort_buf_size,
+ crypted_buf, dstlen, rc);
+ ut_error;
+ }
+}
+
+/******************************************************//**
+Decrypt a merge block. */
+static
+bool
+row_merge_decrypt_buf(
+/*==================*/
+ fil_space_crypt_t* crypt_data, /*!< in: table crypt data */
+ ulint offset, /*!< in: offset where to
+ write */
+ ulint space, /*!< in: tablespace id */
+ const byte* input_buf, /*!< in: input buffer */
+ byte* crypted_buf) /*!< out: crypted buffer */
+{
+ uint key_version;
+ uint dstlen=0;
+ os_offset_t ofs = (os_offset_t)srv_sort_buf_size * (os_offset_t)offset;
+
+ /* Read key_version from begining of the buffer */
+ key_version = mach_read_from_4((byte *)input_buf);
+
+ if (key_version == 0) {
+ /* block not encrypted */
+ return false;
+ }
+
+ int rc = encryption_scheme_decrypt(input_buf+ROW_MERGE_RESERVE_SIZE,
+ srv_sort_buf_size-ROW_MERGE_RESERVE_SIZE,
+ crypted_buf+ROW_MERGE_RESERVE_SIZE, &dstlen,
+ crypt_data, key_version,
+ space, ofs, 0);
+
+ if (! ((rc == MY_AES_OK) && ((ulint)dstlen == srv_sort_buf_size-ROW_MERGE_RESERVE_SIZE))) {
+ ib_logf(IB_LOG_LEVEL_FATAL,
+ "Unable to encrypt data-block "
+ " src: %p srclen: %lu buf: %p buflen: %d."
+ " return-code: %d. Can't continue!\n",
+ input_buf, (size_t)srv_sort_buf_size,
+ crypted_buf, dstlen, rc);
+ ut_error;
+ }
+
+ return (true);
+}
+
#ifdef UNIV_DEBUG
/******************************************************//**
Display a merge tuple. */
@@ -193,7 +281,7 @@ row_merge_buf_create(
ulint buf_size;
mem_heap_t* heap;
- max_tuples = srv_sort_buf_size
+ max_tuples = (srv_sort_buf_size - ROW_MERGE_RESERVE_SIZE)
/ ut_max(1, dict_index_get_min_size(index));
buf_size = (sizeof *buf);
@@ -244,22 +332,88 @@ row_merge_buf_free(
mem_heap_free(buf->heap);
}
-/******************************************************//**
-Insert a data tuple into a sort buffer.
-@return number of rows added, 0 if out of space */
+/** Convert the field data from compact to redundant format.
+@param[in] row_field field to copy from
+@param[out] field field to copy to
+@param[in] len length of the field data
+@param[in] zip_size compressed BLOB page size,
+ zero for uncompressed BLOBs
+@param[in,out] heap memory heap where to allocate data when
+ converting to ROW_FORMAT=REDUNDANT, or NULL
+ when not to invoke
+ row_merge_buf_redundant_convert(). */
+static
+void
+row_merge_buf_redundant_convert(
+ const dfield_t* row_field,
+ dfield_t* field,
+ ulint len,
+ ulint zip_size,
+ mem_heap_t* heap,
+ trx_t* trx)
+{
+ ut_ad(DATA_MBMINLEN(field->type.mbminmaxlen) == 1);
+ ut_ad(DATA_MBMAXLEN(field->type.mbminmaxlen) > 1);
+
+ byte* buf = (byte*) mem_heap_alloc(heap, len);
+ ulint field_len = row_field->len;
+ ut_ad(field_len <= len);
+
+ if (row_field->ext) {
+ const byte* field_data = static_cast<byte*>(
+ dfield_get_data(row_field));
+ ulint ext_len;
+
+ ut_a(field_len >= BTR_EXTERN_FIELD_REF_SIZE);
+ ut_a(memcmp(field_data + field_len - BTR_EXTERN_FIELD_REF_SIZE,
+ field_ref_zero, BTR_EXTERN_FIELD_REF_SIZE));
+
+ byte* data = btr_copy_externally_stored_field(
+ &ext_len, field_data, zip_size, field_len, heap, trx);
+
+ ut_ad(ext_len < len);
+
+ memcpy(buf, data, ext_len);
+ field_len = ext_len;
+ } else {
+ memcpy(buf, row_field->data, field_len);
+ }
+
+ memset(buf + field_len, 0x20, len - field_len);
+
+ dfield_set_data(field, buf, len);
+}
+
+/** Insert a data tuple into a sort buffer.
+@param[in,out] buf sort buffer
+@param[in] fts_index fts index to be created
+@param[in] old_table original table
+@param[in,out] psort_info parallel sort info
+@param[in] row table row
+@param[in] ext cache of externally stored
+ column prefixes, or NULL
+@param[in,out] doc_id Doc ID if we are creating
+ FTS index
+@param[in,out] conv_heap memory heap where to allocate data when
+ converting to ROW_FORMAT=REDUNDANT, or NULL
+ when not to invoke
+ row_merge_buf_redundant_convert()
+@param[in,out] exceed_page set if the record size exceeds the page size
+ when converting to ROW_FORMAT=REDUNDANT
+@return number of rows added, 0 if out of space */
static
ulint
row_merge_buf_add(
-/*==============*/
- row_merge_buf_t* buf, /*!< in/out: sort buffer */
- dict_index_t* fts_index,/*!< in: fts index to be created */
- const dict_table_t* old_table,/*!< in: original table */
- fts_psort_t* psort_info, /*!< in: parallel sort info */
- const dtuple_t* row, /*!< in: table row */
- const row_ext_t* ext, /*!< in: cache of externally stored
- column prefixes, or NULL */
- doc_id_t* doc_id) /*!< in/out: Doc ID if we are
- creating FTS index */
+ row_merge_buf_t* buf,
+ dict_index_t* fts_index,
+ const dict_table_t* old_table,
+ fts_psort_t* psort_info,
+ const dtuple_t* row,
+ const row_ext_t* ext,
+ doc_id_t* doc_id,
+ mem_heap_t* conv_heap,
+ bool* exceed_page,
+ trx_t* trx)
{
ulint i;
const dict_index_t* index;
@@ -409,6 +563,23 @@ row_merge_buf_add(
n_row_added = 1;
continue;
}
+
+ if (field->len != UNIV_SQL_NULL
+ && col->mtype == DATA_MYSQL
+ && col->len != field->len) {
+
+ if (conv_heap != NULL) {
+ row_merge_buf_redundant_convert(
+ row_field, field, col->len,
+ dict_table_zip_size(old_table),
+ conv_heap, trx);
+ } else {
+ /* Field length mismatch should not
+ happen when rebuilding redundant row
+ format table. */
+ ut_ad(dict_table_is_comp(index->table));
+ }
+ }
}
len = dfield_get_len(field);
@@ -517,10 +688,18 @@ row_merge_buf_add(
of extra_size. */
data_size += (extra_size + 1) + ((extra_size + 1) >= 0x80);
+ /* Record size can exceed page size while converting to
+ redundant row format. But there is assert
+ ut_ad(size < UNIV_PAGE_SIZE) in rec_offs_data_size().
+ It may hit the assert before attempting to insert the row. */
+ if (conv_heap != NULL && data_size > UNIV_PAGE_SIZE) {
+ *exceed_page = true;
+ }
+
ut_ad(data_size < srv_sort_buf_size);
- /* Reserve one byte for the end marker of row_merge_block_t. */
- if (buf->total_size + data_size >= srv_sort_buf_size - 1) {
+ /* Reserve bytes for the end marker of row_merge_block_t. */
+ if (buf->total_size + data_size >= (srv_sort_buf_size - ROW_MERGE_RESERVE_SIZE)) {
DBUG_RETURN(0);
}
@@ -536,6 +715,10 @@ row_merge_buf_add(
dfield_dup(field++, buf->heap);
} while (--n_fields);
+ if (conv_heap != NULL) {
+ mem_heap_empty(conv_heap);
+ }
+
DBUG_RETURN(n_row_added);
}
@@ -688,7 +871,7 @@ row_merge_buf_write(
{
const dict_index_t* index = buf->index;
ulint n_fields= dict_index_get_n_fields(index);
- byte* b = &block[0];
+ byte* b = &block[ROW_MERGE_RESERVE_SIZE];
for (ulint i = 0; i < buf->n_tuples; i++) {
const mtuple_t* entry = &buf->tuples[i];
@@ -707,7 +890,7 @@ row_merge_buf_write(
/* Write an "end-of-chunk" marker. */
ut_a(b < &block[srv_sort_buf_size]);
- ut_a(b == &block[0] + buf->total_size);
+ ut_a(b == &block[0] + buf->total_size + ROW_MERGE_RESERVE_SIZE);
*b++ = 0;
#ifdef UNIV_DEBUG_VALGRIND
/* The rest of the block is uninitialized. Initialize it
@@ -764,7 +947,10 @@ row_merge_read(
ulint offset, /*!< in: offset where to read
in number of row_merge_block_t
elements */
- row_merge_block_t* buf) /*!< out: data */
+ row_merge_block_t* buf, /*!< out: data */
+ fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
+ row_merge_block_t* crypt_buf, /*!< in: crypt buf or NULL */
+ ulint space) /*!< in: space id */
{
os_offset_t ofs = ((os_offset_t) offset) * srv_sort_buf_size;
ibool success;
@@ -788,6 +974,13 @@ row_merge_read(
success = os_file_read_no_error_handling(OS_FILE_FROM_FD(fd), buf,
ofs, srv_sort_buf_size);
+ /* For encrypted tables, decrypt data after reading and copy data */
+ if (crypt_data && crypt_buf) {
+ if( row_merge_decrypt_buf(crypt_data, offset, space, buf, crypt_buf)) {
+ memcpy(buf, crypt_buf, srv_sort_buf_size);
+ }
+ }
+
#ifdef POSIX_FADV_DONTNEED
/* Each block is read exactly once. Free up the file cache. */
posix_fadvise(fd, ofs, srv_sort_buf_size, POSIX_FADV_DONTNEED);
@@ -810,18 +1003,32 @@ UNIV_INTERN
ibool
row_merge_write(
/*============*/
- int fd, /*!< in: file descriptor */
- ulint offset, /*!< in: offset where to write,
- in number of row_merge_block_t elements */
- const void* buf) /*!< in: data */
+ int fd, /*!< in: file descriptor */
+ ulint offset, /*!< in: offset where to write,
+ in number of row_merge_block_t elements */
+ const void* buf, /*!< in: data */
+ fil_space_crypt_t* crypt_data, /*!< in: table crypt data */
+ void* crypt_buf, /*!< in: crypt buf or NULL */
+ ulint space) /*!< in: space id */
{
size_t buf_len = srv_sort_buf_size;
os_offset_t ofs = buf_len * (os_offset_t) offset;
ibool ret;
+ void* out_buf = (void *)buf;
DBUG_EXECUTE_IF("row_merge_write_failure", return(FALSE););
- ret = os_file_write("(merge)", OS_FILE_FROM_FD(fd), buf, ofs, buf_len);
+ /* For encrypted tables, encrypt data before writing */
+ if (crypt_data && crypt_buf) {
+ row_merge_encrypt_buf(crypt_data, offset, space, (const byte *)buf, (byte *)crypt_buf);
+ out_buf = crypt_buf;
+ } else {
+ /* Mark block unencrypted */
+ mach_write_to_4((byte *)out_buf, 0);
+ }
+
+ ret = os_file_write("(merge)", OS_FILE_FROM_FD(fd), out_buf, ofs, buf_len);
+
#ifdef UNIV_DEBUG
if (row_merge_print_block_write) {
@@ -855,7 +1062,10 @@ row_merge_read_rec(
const mrec_t** mrec, /*!< out: pointer to merge record,
or NULL on end of list
(non-NULL on I/O error) */
- ulint* offsets)/*!< out: offsets of mrec */
+ ulint* offsets,/*!< out: offsets of mrec */
+ fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
+ row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
+ ulint space) /*!< in: space id */
{
ulint extra_size;
ulint data_size;
@@ -873,6 +1083,10 @@ row_merge_read_rec(
ut_ad(*offsets == 1 + REC_OFFS_HEADER_SIZE
+ dict_index_get_n_fields(index));
+ if (b == &block[0]) {
+ b+= ROW_MERGE_RESERVE_SIZE;
+ }
+
extra_size = *b++;
if (UNIV_UNLIKELY(!extra_size)) {
@@ -892,7 +1106,8 @@ row_merge_read_rec(
/* Read another byte of extra_size. */
if (UNIV_UNLIKELY(b >= &block[srv_sort_buf_size])) {
- if (!row_merge_read(fd, ++(*foffs), block)) {
+ if (!row_merge_read(fd, ++(*foffs), block,
+ crypt_data, crypt_block, space)) {
err_exit:
/* Signal I/O error. */
*mrec = b;
@@ -900,7 +1115,7 @@ err_exit:
}
/* Wrap around to the beginning of the buffer. */
- b = &block[0];
+ b = &block[ROW_MERGE_RESERVE_SIZE];
}
extra_size = (extra_size & 0x7f) << 8;
@@ -921,13 +1136,14 @@ err_exit:
ut_ad(avail_size < sizeof *buf);
memcpy(*buf, b, avail_size);
- if (!row_merge_read(fd, ++(*foffs), block)) {
+ if (!row_merge_read(fd, ++(*foffs), block,
+ crypt_data, crypt_block, space)) {
goto err_exit;
}
/* Wrap around to the beginning of the buffer. */
- b = &block[0];
+ b = &block[ROW_MERGE_RESERVE_SIZE];
/* Copy the record. */
memcpy(*buf + avail_size, b, extra_size - avail_size);
@@ -982,13 +1198,14 @@ err_exit:
offsets[3] = (ulint) index;
#endif /* UNIV_DEBUG */
- if (!row_merge_read(fd, ++(*foffs), block)) {
+ if (!row_merge_read(fd, ++(*foffs), block,
+ crypt_data, crypt_block, space)) {
goto err_exit;
}
/* Wrap around to the beginning of the buffer. */
- b = &block[0];
+ b = &block[ROW_MERGE_RESERVE_SIZE];
/* Copy the rest of the record. */
memcpy(*buf + avail_size, b, extra_size + data_size - avail_size);
@@ -1064,7 +1281,10 @@ row_merge_write_rec(
int fd, /*!< in: file descriptor */
ulint* foffs, /*!< in/out: file offset */
const mrec_t* mrec, /*!< in: record to write */
- const ulint* offsets)/*!< in: offsets of mrec */
+ const ulint* offsets,/*!< in: offsets of mrec */
+ fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
+ row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
+ ulint space) /*!< in: space id */
{
ulint extra_size;
ulint size;
@@ -1085,6 +1305,10 @@ row_merge_write_rec(
size = extra_size + (extra_size >= 0x80)
+ rec_offs_data_size(offsets);
+ if (b == &block[0]) {
+ b+= ROW_MERGE_RESERVE_SIZE;
+ }
+
if (UNIV_UNLIKELY(b + size >= &block[srv_sort_buf_size])) {
/* The record spans two blocks.
Copy it to the temporary buffer first. */
@@ -1099,14 +1323,15 @@ row_merge_write_rec(
record to the head of the new block. */
memcpy(b, buf[0], avail_size);
- if (!row_merge_write(fd, (*foffs)++, block)) {
+ if (!row_merge_write(fd, (*foffs)++, block,
+ crypt_data, crypt_block, space)) {
return(NULL);
}
UNIV_MEM_INVALID(&block[0], srv_sort_buf_size);
/* Copy the rest. */
- b = &block[0];
+ b = &block[ROW_MERGE_RESERVE_SIZE];
memcpy(b, buf[0] + avail_size, size - avail_size);
b += size - avail_size;
} else {
@@ -1125,10 +1350,13 @@ static
byte*
row_merge_write_eof(
/*================*/
- row_merge_block_t* block, /*!< in/out: file buffer */
- byte* b, /*!< in: pointer to end of block */
- int fd, /*!< in: file descriptor */
- ulint* foffs) /*!< in/out: file offset */
+ row_merge_block_t* block, /*!< in/out: file buffer */
+ byte* b, /*!< in: pointer to end of block */
+ int fd, /*!< in: file descriptor */
+ ulint* foffs, /*!< in/out: file offset */
+ fil_space_crypt_t* crypt_data, /*!< in: table crypt data */
+ row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
+ ulint space) /*!< in: space id */
{
ut_ad(block);
ut_ad(b >= &block[0]);
@@ -1141,20 +1369,27 @@ row_merge_write_eof(
}
#endif /* UNIV_DEBUG */
+ if (b == &block[0]) {
+ b+= ROW_MERGE_RESERVE_SIZE;
+ }
+
*b++ = 0;
UNIV_MEM_ASSERT_RW(&block[0], b - &block[0]);
UNIV_MEM_ASSERT_W(&block[0], srv_sort_buf_size);
+
#ifdef UNIV_DEBUG_VALGRIND
/* The rest of the block is uninitialized. Initialize it
to avoid bogus warnings. */
memset(b, 0xff, &block[srv_sort_buf_size] - b);
#endif /* UNIV_DEBUG_VALGRIND */
- if (!row_merge_write(fd, (*foffs)++, block)) {
+ if (!row_merge_write(fd, (*foffs)++, block,
+ crypt_data, crypt_block, space)) {
return(NULL);
}
UNIV_MEM_INVALID(&block[0], srv_sort_buf_size);
+
return(&block[0]);
}
@@ -1199,7 +1434,11 @@ row_merge_read_clustered_index(
ULINT_UNDEFINED if none is added */
ib_sequence_t& sequence,/*!< in/out: autoinc sequence */
row_merge_block_t* block, /*!< in/out: file buffer */
- float pct_cost) /*!< in: percent of task weight out of total alter job */
+ float pct_cost, /*!< in: percent of task weight
+ out of total alter job */
+ fil_space_crypt_t* crypt_data,/*!< in: crypt data or NULL */
+ row_merge_block_t* crypt_block)/*!< in: in/out: crypted file
+ buffer */
{
dict_index_t* clust_index; /* Clustered index */
mem_heap_t* row_heap; /* Heap memory to create
@@ -1219,10 +1458,12 @@ row_merge_read_clustered_index(
os_event_t fts_parallel_sort_event = NULL;
ibool fts_pll_sort = FALSE;
ib_int64_t sig_count = 0;
+ mem_heap_t* conv_heap = NULL;
- float curr_progress;
+ float curr_progress = 0.0;
ib_int64_t read_rows = 0;
- ib_int64_t table_total_rows;
+ ib_int64_t table_total_rows = 0;
+
DBUG_ENTER("row_merge_read_clustered_index");
ut_ad((old_table == new_table) == !col_map);
@@ -1324,6 +1565,11 @@ row_merge_read_clustered_index(
row_heap = mem_heap_create(sizeof(mrec_buf_t));
+ if (dict_table_is_comp(old_table)
+ && !dict_table_is_comp(new_table)) {
+ conv_heap = mem_heap_create(sizeof(mrec_buf_t));
+ }
+
/* Scan the clustered index. */
for (;;) {
const rec_t* rec;
@@ -1332,6 +1578,13 @@ row_merge_read_clustered_index(
row_ext_t* ext;
page_cur_t* cur = btr_pcur_get_page_cur(&pcur);
+ /* Do not continue if table pages are still encrypted */
+ if (old_table->is_encrypted || new_table->is_encrypted) {
+ err = DB_DECRYPTION_FAILED;
+ trx->error_key_num = 0;
+ goto func_exit;
+ }
+
page_cur_move_to_next(cur);
if (page_cur_is_after_last(cur)) {
@@ -1608,16 +1861,24 @@ write_buffers:
row_merge_buf_t* buf = merge_buf[i];
merge_file_t* file = &files[i];
ulint rows_added = 0;
+ bool exceed_page = false;
if (UNIV_LIKELY
(row && (rows_added = row_merge_buf_add(
buf, fts_index, old_table,
- psort_info, row, ext, &doc_id)))) {
+ psort_info, row, ext, &doc_id,
+ conv_heap, &exceed_page, trx)))) {
/* If we are creating FTS index,
a single row can generate more
records for tokenized word */
file->n_rec += rows_added;
+
+ if (exceed_page) {
+ err = DB_TOO_BIG_RECORD;
+ break;
+ }
+
if (doc_id > max_doc_id) {
max_doc_id = doc_id;
}
@@ -1699,14 +1960,15 @@ write_buffers:
row_merge_buf_write(buf, file, block);
- if (!row_merge_write(file->fd, file->offset++,
- block)) {
+ if (!row_merge_write(file->fd, file->offset++, block,
+ crypt_data, crypt_block, new_table->space)) {
err = DB_TEMP_FILE_WRITE_FAILURE;
trx->error_key_num = i;
break;
}
UNIV_MEM_INVALID(&block[0], srv_sort_buf_size);
+
merge_buf[i] = row_merge_buf_empty(buf);
if (UNIV_LIKELY(row != NULL)) {
@@ -1718,12 +1980,18 @@ write_buffers:
(!(rows_added = row_merge_buf_add(
buf, fts_index, old_table,
psort_info, row, ext,
- &doc_id)))) {
+ &doc_id, conv_heap,
+ &exceed_page, trx)))) {
/* An empty buffer should have enough
room for at least one record. */
ut_error;
}
+ if (exceed_page) {
+ err = DB_TOO_BIG_RECORD;
+ break;
+ }
+
file->n_rec += rows_added;
}
}
@@ -1759,6 +2027,10 @@ func_exit:
}
all_done:
+ if (conv_heap != NULL) {
+ mem_heap_free(conv_heap);
+ }
+
#ifdef FTS_INTERNAL_DIAG_PRINT
DEBUG_FTS_SORT_PRINT("FTS_SORT: Complete Scan Table\n");
#endif
@@ -1865,14 +2137,21 @@ wait_again:
b2 = row_merge_write_rec(&block[2 * srv_sort_buf_size], \
&buf[2], b2, \
of->fd, &of->offset, \
- mrec##N, offsets##N); \
+ mrec##N, offsets##N, \
+ crypt_data, \
+ crypt_block ? &crypt_block[2 * srv_sort_buf_size] : NULL , \
+ space); \
if (UNIV_UNLIKELY(!b2 || ++of->n_rec > file->n_rec)) { \
goto corrupt; \
} \
b##N = row_merge_read_rec(&block[N * srv_sort_buf_size],\
&buf[N], b##N, INDEX, \
file->fd, foffs##N, \
- &mrec##N, offsets##N); \
+ &mrec##N, offsets##N, \
+ crypt_data, \
+ crypt_block ? &crypt_block[N * srv_sort_buf_size] : NULL, \
+ space); \
+ \
if (UNIV_UNLIKELY(!b##N)) { \
if (mrec##N) { \
goto corrupt; \
@@ -1884,7 +2163,7 @@ wait_again:
/*************************************************************//**
Merge two blocks of records on disk and write a bigger block.
@return DB_SUCCESS or error code */
-static __attribute__((nonnull, warn_unused_result))
+static __attribute__((nonnull(1,2,3,4,5,6), warn_unused_result))
dberr_t
row_merge_blocks(
/*=============*/
@@ -1897,7 +2176,11 @@ row_merge_blocks(
source list in the file */
ulint* foffs1, /*!< in/out: offset of second
source list in the file */
- merge_file_t* of) /*!< in/out: output file */
+ merge_file_t* of, /*!< in/out: output file */
+ fil_space_crypt_t* crypt_data,/*!< in: crypt data or NULL */
+ row_merge_block_t* crypt_block,/*!< in: in/out: crypted file
+ buffer */
+ ulint space) /*!< in: space id */
{
mem_heap_t* heap; /*!< memory heap for offsets0, offsets1 */
@@ -1928,8 +2211,10 @@ row_merge_blocks(
/* Write a record and read the next record. Split the output
file in two halves, which can be merged on the following pass. */
- if (!row_merge_read(file->fd, *foffs0, &block[0])
- || !row_merge_read(file->fd, *foffs1, &block[srv_sort_buf_size])) {
+ if (!row_merge_read(file->fd, *foffs0, &block[0],
+ crypt_data, crypt_block ? &crypt_block[0] : NULL, space)
+ || !row_merge_read(file->fd, *foffs1, &block[srv_sort_buf_size],
+ crypt_data, crypt_block ? &crypt_block[srv_sort_buf_size] : NULL, space)) {
corrupt:
mem_heap_free(heap);
return(DB_CORRUPTION);
@@ -1941,11 +2226,15 @@ corrupt:
b0 = row_merge_read_rec(
&block[0], &buf[0], b0, dup->index,
- file->fd, foffs0, &mrec0, offsets0);
+ file->fd, foffs0, &mrec0, offsets0,
+ crypt_data, crypt_block ? &crypt_block[0] : NULL, space);
+
b1 = row_merge_read_rec(
&block[srv_sort_buf_size],
&buf[srv_sort_buf_size], b1, dup->index,
- file->fd, foffs1, &mrec1, offsets1);
+ file->fd, foffs1, &mrec1, offsets1,
+ crypt_data, crypt_block ? &crypt_block[srv_sort_buf_size] : NULL, space);
+
if (UNIV_UNLIKELY(!b0 && mrec0)
|| UNIV_UNLIKELY(!b1 && mrec1)) {
@@ -1987,15 +2276,18 @@ done0:
done1:
mem_heap_free(heap);
+
b2 = row_merge_write_eof(&block[2 * srv_sort_buf_size],
- b2, of->fd, &of->offset);
+ b2, of->fd, &of->offset,
+ crypt_data, crypt_block ? &crypt_block[2 * srv_sort_buf_size] : NULL, space);
+
return(b2 ? DB_SUCCESS : DB_CORRUPTION);
}
/*************************************************************//**
Copy a block of index entries.
@return TRUE on success, FALSE on failure */
-static __attribute__((nonnull, warn_unused_result))
+static __attribute__((nonnull(1,2,3,4,5), warn_unused_result))
ibool
row_merge_blocks_copy(
/*==================*/
@@ -2003,7 +2295,10 @@ row_merge_blocks_copy(
const merge_file_t* file, /*!< in: input file */
row_merge_block_t* block, /*!< in/out: 3 buffers */
ulint* foffs0, /*!< in/out: input file offset */
- merge_file_t* of) /*!< in/out: output file */
+ merge_file_t* of, /*!< in/out: output file */
+ fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
+ row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
+ ulint space) /*!< in: space id */
{
mem_heap_t* heap; /*!< memory heap for offsets0, offsets1 */
@@ -2030,7 +2325,8 @@ row_merge_blocks_copy(
/* Write a record and read the next record. Split the output
file in two halves, which can be merged on the following pass. */
- if (!row_merge_read(file->fd, *foffs0, &block[0])) {
+ if (!row_merge_read(file->fd, *foffs0, &block[0],
+ crypt_data, crypt_block ? &crypt_block[0] : NULL, space)) {
corrupt:
mem_heap_free(heap);
return(FALSE);
@@ -2041,7 +2337,9 @@ corrupt:
b2 = &block[2 * srv_sort_buf_size];
b0 = row_merge_read_rec(&block[0], &buf[0], b0, index,
- file->fd, foffs0, &mrec0, offsets0);
+ file->fd, foffs0, &mrec0, offsets0,
+ crypt_data, crypt_block ? &crypt_block[0] : NULL, space);
+
if (UNIV_UNLIKELY(!b0 && mrec0)) {
goto corrupt;
@@ -2060,15 +2358,18 @@ done0:
(*foffs0)++;
mem_heap_free(heap);
+
return(row_merge_write_eof(&block[2 * srv_sort_buf_size],
- b2, of->fd, &of->offset)
+ b2, of->fd, &of->offset,
+ crypt_data,
+ crypt_block ? &crypt_block[2 * srv_sort_buf_size] : NULL, space)
!= NULL);
}
/*************************************************************//**
Merge disk files.
@return DB_SUCCESS or error code */
-static __attribute__((nonnull))
+static __attribute__((nonnull(1,2,3,4,5,6,7)))
dberr_t
row_merge(
/*======*/
@@ -2081,9 +2382,12 @@ row_merge(
int* tmpfd, /*!< in/out: temporary file handle */
ulint* num_run,/*!< in/out: Number of runs remain
to be merged */
- ulint* run_offset) /*!< in/out: Array contains the
+ ulint* run_offset, /*!< in/out: Array contains the
first offset number for each merge
run */
+ fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
+ row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
+ ulint space) /*!< in: space id */
{
ulint foffs0; /*!< first input offset */
ulint foffs1; /*!< second input offset */
@@ -2096,6 +2400,10 @@ row_merge(
UNIV_MEM_ASSERT_W(&block[0], 3 * srv_sort_buf_size);
+ if (crypt_block) {
+ UNIV_MEM_ASSERT_W(&crypt_block[0], 3 * srv_sort_buf_size);
+ }
+
ut_ad(ihalf < file->offset);
of.fd = *tmpfd;
@@ -2126,7 +2434,8 @@ row_merge(
run_offset[n_run++] = of.offset;
error = row_merge_blocks(dup, file, block,
- &foffs0, &foffs1, &of);
+ &foffs0, &foffs1, &of,
+ crypt_data, crypt_block, space);
if (error != DB_SUCCESS) {
return(error);
@@ -2146,7 +2455,8 @@ row_merge(
run_offset[n_run++] = of.offset;
if (!row_merge_blocks_copy(dup->index, file, block,
- &foffs0, &of)) {
+ &foffs0, &of,
+ crypt_data, crypt_block, space)) {
return(DB_CORRUPTION);
}
}
@@ -2163,7 +2473,8 @@ row_merge(
run_offset[n_run++] = of.offset;
if (!row_merge_blocks_copy(dup->index, file, block,
- &foffs1, &of)) {
+ &foffs1, &of,
+ crypt_data, crypt_block, space)) {
return(DB_CORRUPTION);
}
}
@@ -2218,7 +2529,10 @@ row_merge_sort(
const float pct_progress,
/*!< in: total progress percent
until now */
- const float pct_cost) /*!< in: current progress percent */
+ const float pct_cost, /*!< in: current progress percent */
+ fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
+ row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
+ ulint space) /*!< in: space id */
{
const ulint half = file->offset / 2;
ulint num_runs;
@@ -2270,7 +2584,8 @@ row_merge_sort(
sql_print_information("InnoDB: Online DDL : merge-sorting current run %lu estimated %lu runs", cur_run, num_runs);
error = row_merge(trx, dup, file, block, tmpfd,
- &num_runs, run_offset);
+ &num_runs, run_offset,
+ crypt_data, crypt_block, space);
if(update_progress) {
merge_count++;
@@ -2342,7 +2657,7 @@ row_merge_copy_blobs(
Read sorted file containing index data tuples and insert these data
tuples to the index
@return DB_SUCCESS or error number */
-static __attribute__((nonnull, warn_unused_result))
+static __attribute__((nonnull(2,3,5), warn_unused_result))
dberr_t
row_merge_insert_index_tuples(
/*==========================*/
@@ -2353,7 +2668,11 @@ row_merge_insert_index_tuples(
row_merge_block_t* block, /*!< in/out: file buffer */
const ib_int64_t table_total_rows, /*!< in: total rows of old table */
const float pct_progress, /*!< in: total progress percent until now */
- const float pct_cost) /*!< in: current progress percent */
+ const float pct_cost, /*!< in: current progress percent
+ */
+ fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
+ row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
+ ulint space) /*!< in: space id */
{
const byte* b;
mem_heap_t* heap;
@@ -2384,9 +2703,10 @@ row_merge_insert_index_tuples(
offsets[1] = dict_index_get_n_fields(index);
}
- b = block;
+ b = &block[0];
- if (!row_merge_read(fd, foffs, block)) {
+ if (!row_merge_read(fd, foffs, block,
+ crypt_data, crypt_block, space)) {
error = DB_CORRUPTION;
} else {
buf = static_cast<mrec_buf_t*>(
@@ -2402,7 +2722,8 @@ row_merge_insert_index_tuples(
mtr_t mtr;
b = row_merge_read_rec(block, buf, b, index,
- fd, &foffs, &mrec, offsets);
+ fd, &foffs, &mrec, offsets,
+ crypt_data, crypt_block, space);
if (UNIV_UNLIKELY(!b)) {
/* End of list, or I/O error */
if (mrec) {
@@ -3543,6 +3864,7 @@ row_merge_build_indexes(
{
merge_file_t* merge_files;
row_merge_block_t* block;
+ row_merge_block_t* crypt_block;
ulint block_size;
ulint i;
ulint j;
@@ -3553,6 +3875,7 @@ row_merge_build_indexes(
fts_psort_t* merge_info = NULL;
ib_int64_t sig_count = 0;
bool fts_psort_initiated = false;
+ fil_space_crypt_t * crypt_data = NULL;
float total_static_cost = 0;
float total_dynamic_cost = 0;
@@ -3577,6 +3900,27 @@ row_merge_build_indexes(
DBUG_RETURN(DB_OUT_OF_MEMORY);
}
+ /* Get crypt data from tablespace if present. */
+ crypt_data = fil_space_get_crypt_data(new_table->space);
+ crypt_block = NULL;
+
+ /* If tablespace is encrypted, allocate additional buffer for
+ encryption/decryption. */
+ if ((crypt_data && crypt_data->encryption == FIL_SPACE_ENCRYPTION_ON) ||
+ (srv_encrypt_tables &&
+ crypt_data && crypt_data->encryption == FIL_SPACE_ENCRYPTION_DEFAULT)) {
+
+ crypt_block = static_cast<row_merge_block_t*>(
+ os_mem_alloc_large(&block_size, FALSE));
+
+ if (crypt_block == NULL) {
+ DBUG_RETURN(DB_OUT_OF_MEMORY);
+ }
+ } else {
+ /* Not needed */
+ crypt_data = NULL;
+ }
+
trx_start_if_not_started_xa(trx);
merge_files = static_cast<merge_file_t*>(
@@ -3643,14 +3987,26 @@ row_merge_build_indexes(
pct_cost = COST_READ_CLUSTERED_INDEX * 100 / (total_static_cost + total_dynamic_cost);
+ /* Do not continue if we can't encrypt table pages */
+ if (old_table->is_encrypted || new_table->is_encrypted) {
+ error = DB_DECRYPTION_FAILED;
+ ib_push_warning(trx->mysql_thd, DB_DECRYPTION_FAILED,
+ "Table %s is encrypted but encryption service or"
+ " used key_id is not available. "
+ " Can't continue reading table.",
+ old_table->is_encrypted ? old_table->name : new_table->name);
+ goto func_exit;
+ }
+
/* Read clustered index of the table and create files for
secondary index entries for merge sort */
error = row_merge_read_clustered_index(
- trx, table, old_table, new_table, online, indexes,
- fts_sort_idx, psort_info, merge_files, key_numbers,
- n_indexes, add_cols, col_map,
- add_autoinc, sequence, block, pct_cost);
+ trx, table, old_table, new_table, online, indexes,
+ fts_sort_idx, psort_info, merge_files, key_numbers,
+ n_indexes, add_cols, col_map,
+ add_autoinc, sequence, block, pct_cost,
+ crypt_data, crypt_block);
pct_progress += pct_cost;
@@ -3670,6 +4026,10 @@ row_merge_build_indexes(
/* Now we have files containing index entries ready for
sorting and inserting. */
+ DBUG_EXECUTE_IF(
+ "ib_merge_wait_after_read",
+ os_thread_sleep(20000000);); /* 20 sec */
+
for (i = 0; i < n_indexes; i++) {
dict_index_t* sort_idx = indexes[i];
@@ -3763,8 +4123,10 @@ wait_again:
buf, (i+1), n_indexes, pct_cost);
error = row_merge_sort(
- trx, &dup, &merge_files[i],
- block, &tmpfd, true, pct_progress, pct_cost);
+ trx, &dup, &merge_files[i],
+ block, &tmpfd, true,
+ pct_progress, pct_cost,
+ crypt_data, crypt_block, new_table->space);
pct_progress += pct_cost;
@@ -3772,6 +4134,10 @@ wait_again:
" merge-sorting index %s (%lu / %lu)",
buf, (i+1), n_indexes);
+ DBUG_EXECUTE_IF(
+ "ib_merge_wait_after_sort",
+ os_thread_sleep(20000000);); /* 20 sec */
+
if (error == DB_SUCCESS) {
pct_cost = (COST_BUILD_INDEX_STATIC +
(total_dynamic_cost * merge_files[i].offset /
@@ -3787,7 +4153,8 @@ wait_again:
error = row_merge_insert_index_tuples(
trx->id, sort_idx, old_table,
merge_files[i].fd, block,
- merge_files[i].n_rec, pct_progress, pct_cost);
+ merge_files[i].n_rec, pct_progress, pct_cost,
+ crypt_data, crypt_block, new_table->space);
pct_progress += pct_cost;
sql_print_information("InnoDB: Online DDL : "
@@ -3861,6 +4228,10 @@ func_exit:
mem_free(merge_files);
os_mem_free_large(block, block_size);
+ if (crypt_block) {
+ os_mem_free_large(crypt_block, block_size);
+ }
+
DICT_TF2_FLAG_UNSET(new_table, DICT_TF2_FTS_ADD_DOC_ID);
if (online && old_table == new_table && error != DB_SUCCESS) {
diff --git a/storage/xtradb/row/row0mysql.cc b/storage/xtradb/row/row0mysql.cc
index d0f1b1d1b89..592c0baf552 100644
--- a/storage/xtradb/row/row0mysql.cc
+++ b/storage/xtradb/row/row0mysql.cc
@@ -622,6 +622,8 @@ handle_new_error:
case DB_FTS_INVALID_DOCID:
case DB_INTERRUPTED:
case DB_DICT_CHANGED:
+ case DB_TABLE_NOT_FOUND:
+ case DB_DECRYPTION_FAILED:
if (savept) {
/* Roll back the latest, possibly incomplete insertion
or update */
@@ -1314,7 +1316,13 @@ row_insert_for_mysql(
prebuilt->table->name);
return(DB_TABLESPACE_NOT_FOUND);
-
+ } else if (prebuilt->table->is_encrypted) {
+ ib_push_warning(trx, DB_DECRYPTION_FAILED,
+ "Table %s in tablespace %lu encrypted."
+ "However key management plugin or used key_id is not found or"
+ " used encryption algorithm or method does not match.",
+ prebuilt->table->name, prebuilt->table->space);
+ return(DB_DECRYPTION_FAILED);
} else if (prebuilt->magic_n != ROW_PREBUILT_ALLOCATED) {
fprintf(stderr,
"InnoDB: Error: trying to free a corrupt\n"
@@ -1326,18 +1334,14 @@ row_insert_for_mysql(
mem_analyze_corruption(prebuilt);
ut_error;
- } else if (srv_created_new_raw || srv_force_recovery) {
- fputs("InnoDB: A new raw disk partition was initialized or\n"
- "InnoDB: innodb_force_recovery is on: we do not allow\n"
+ } else if (srv_force_recovery) {
+ fputs("InnoDB: innodb_force_recovery is on: we do not allow\n"
"InnoDB: database modifications by the user. Shut down\n"
"InnoDB: mysqld and edit my.cnf so that"
- " newraw is replaced\n"
- "InnoDB: with raw, and innodb_force_... is removed.\n",
+ "InnoDB: innodb_force_... is removed.\n",
stderr);
- if(srv_force_recovery) {
- return(DB_READ_ONLY);
- }
- return(DB_ERROR);
+
+ return(DB_READ_ONLY);
}
trx->op_info = "inserting";
@@ -1717,6 +1721,13 @@ row_update_for_mysql(
"InnoDB: how you can resolve the problem.\n",
prebuilt->table->name);
return(DB_ERROR);
+ } else if (prebuilt->table->is_encrypted) {
+ ib_push_warning(trx, DB_DECRYPTION_FAILED,
+ "Table %s in tablespace %lu encrypted."
+ "However key management plugin or used key_id is not found or"
+ " used encryption algorithm or method does not match.",
+ prebuilt->table->name, prebuilt->table->space);
+ return (DB_TABLE_NOT_FOUND);
}
if (UNIV_UNLIKELY(prebuilt->magic_n != ROW_PREBUILT_ALLOCATED)) {
@@ -1732,18 +1743,14 @@ row_update_for_mysql(
ut_error;
}
- if (UNIV_UNLIKELY(srv_created_new_raw || srv_force_recovery)) {
- fputs("InnoDB: A new raw disk partition was initialized or\n"
- "InnoDB: innodb_force_recovery is on: we do not allow\n"
+ if (UNIV_UNLIKELY(srv_force_recovery)) {
+ fputs("InnoDB: innodb_force_recovery is on: we do not allow\n"
"InnoDB: database modifications by the user. Shut down\n"
- "InnoDB: mysqld and edit my.cnf so that newraw"
- " is replaced\n"
- "InnoDB: with raw, and innodb_force_... is removed.\n",
+ "InnoDB: mysqld and edit my.cnf so that"
+ "InnoDB: innodb_force_... is removed.\n",
stderr);
- if(srv_force_recovery) {
- return(DB_READ_ONLY);
- }
- return(DB_ERROR);
+
+ return(DB_READ_ONLY);
}
DEBUG_SYNC_C("innodb_row_update_for_mysql_begin");
@@ -2232,7 +2239,9 @@ row_create_table_for_mysql(
(will be freed, or on DB_SUCCESS
added to the data dictionary cache) */
trx_t* trx, /*!< in/out: transaction */
- bool commit) /*!< in: if true, commit the transaction */
+ bool commit, /*!< in: if true, commit the transaction */
+ fil_encryption_t mode, /*!< in: encryption mode */
+ ulint key_id) /*!< in: encryption key_id */
{
tab_node_t* node;
mem_heap_t* heap;
@@ -2252,22 +2261,6 @@ row_create_table_for_mysql(
goto err_exit;
);
- if (srv_created_new_raw) {
- fputs("InnoDB: A new raw disk partition was initialized:\n"
- "InnoDB: we do not allow database modifications"
- " by the user.\n"
- "InnoDB: Shut down mysqld and edit my.cnf so that newraw"
- " is replaced with raw.\n", stderr);
-err_exit:
- dict_mem_table_free(table);
-
- if (commit) {
- trx_commit_for_mysql(trx);
- }
-
- return(DB_ERROR);
- }
-
trx->op_info = "creating table";
if (row_mysql_is_system_table(table->name)) {
@@ -2278,7 +2271,19 @@ err_exit:
"InnoDB: MySQL system tables must be"
" of the MyISAM type!\n",
table->name);
- goto err_exit;
+
+#ifndef DBUG_OFF
+err_exit:
+#endif /* !DBUG_OFF */
+ dict_mem_table_free(table);
+
+ if (commit) {
+ trx_commit_for_mysql(trx);
+ }
+
+ trx->op_info = "";
+
+ return(DB_ERROR);
}
trx_start_if_not_started_xa(trx);
@@ -2349,7 +2354,7 @@ err_exit:
ut_ad(strstr(table->name, "/FTS_") != NULL);
}
- node = tab_create_graph_create(table, heap, commit);
+ node = tab_create_graph_create(table, heap, commit, mode, key_id);
thr = pars_complete_graph_for_exec(node, trx, heap);
@@ -3147,6 +3152,8 @@ row_discard_tablespace_for_mysql(
if (table == 0) {
err = DB_TABLE_NOT_FOUND;
+ } else if (table->is_encrypted) {
+ err = DB_DECRYPTION_FAILED;
} else if (table->space == TRX_SYS_SPACE) {
char table_name[MAX_FULL_NAME_LEN + 1];
@@ -3363,18 +3370,10 @@ row_truncate_table_for_mysql(
ut_ad(table);
- if (srv_created_new_raw) {
- fputs("InnoDB: A new raw disk partition was initialized:\n"
- "InnoDB: we do not allow database modifications"
- " by the user.\n"
- "InnoDB: Shut down mysqld and edit my.cnf so that newraw"
- " is replaced with raw.\n", stderr);
-
- return(DB_ERROR);
- }
-
if (dict_table_is_discarded(table)) {
return(DB_TABLESPACE_DELETED);
+ } else if (table->is_encrypted) {
+ return(DB_DECRYPTION_FAILED);
} else if (table->ibd_file_missing) {
return(DB_TABLESPACE_NOT_FOUND);
}
@@ -3494,14 +3493,21 @@ row_truncate_table_for_mysql(
goto funct_exit;
}
- if (table->space && !table->dir_path_of_temp_table) {
+ if (table->space && !DICT_TF2_FLAG_IS_SET(table, DICT_TF2_TEMPORARY)) {
/* Discard and create the single-table tablespace. */
+ fil_space_crypt_t* crypt_data;
ulint space = table->space;
ulint flags = fil_space_get_flags(space);
-
- ut_a(!DICT_TF2_FLAG_IS_SET(table, DICT_TF2_TEMPORARY));
+ ulint key_id = FIL_DEFAULT_ENCRYPTION_KEY;
+ fil_encryption_t mode = FIL_SPACE_ENCRYPTION_DEFAULT;
dict_get_and_save_data_dir_path(table, true);
+ crypt_data = fil_space_get_crypt_data(space);
+
+ if (crypt_data) {
+ key_id = crypt_data->key_id;
+ mode = crypt_data->encryption;
+ }
if (flags != ULINT_UNDEFINED
&& fil_discard_tablespace(space) == DB_SUCCESS) {
@@ -3520,7 +3526,8 @@ row_truncate_table_for_mysql(
space, table->name,
table->data_dir_path,
flags, table->flags2,
- FIL_IBD_FILE_INITIAL_SIZE)
+ FIL_IBD_FILE_INITIAL_SIZE,
+ mode, key_id)
!= DB_SUCCESS) {
dict_table_x_unlock_indexes(table);
@@ -3854,16 +3861,6 @@ row_drop_table_for_mysql(
ut_a(name != NULL);
- if (srv_created_new_raw) {
- fputs("InnoDB: A new raw disk partition was initialized:\n"
- "InnoDB: we do not allow database modifications"
- " by the user.\n"
- "InnoDB: Shut down mysqld and edit my.cnf so that newraw"
- " is replaced with raw.\n", stderr);
-
- DBUG_RETURN(DB_ERROR);
- }
-
/* The table name is prefixed with the database name and a '/'.
Certain table names starting with 'innodb_' have their special
meaning regardless of the database name. Thus, we need to
@@ -3954,6 +3951,19 @@ row_drop_table_for_mysql(
goto funct_exit;
}
+ /* If table is encrypted and table page encryption failed
+ return error. */
+ if (table->is_encrypted) {
+
+ if (table->can_be_evicted) {
+ dict_table_move_from_lru_to_non_lru(table);
+ }
+
+ dict_table_close(table, TRUE, FALSE);
+ err = DB_DECRYPTION_FAILED;
+ goto funct_exit;
+ }
+
/* Turn on this drop bit before we could release the dictionary
latch */
table->to_be_dropped = true;
@@ -4305,8 +4315,9 @@ row_drop_table_for_mysql(
is_temp = DICT_TF2_FLAG_IS_SET(table, DICT_TF2_TEMPORARY);
/* If there is a temp path then the temp flag is set.
- However, during recovery, we might have a temp flag but
- not know the temp path */
+ However, during recovery or reloading the table object
+ after eviction from data dictionary cache, we might
+ have a temp flag but not know the temp path */
ut_a(table->dir_path_of_temp_table == NULL || is_temp);
if (dict_table_is_discarded(table)
|| table->ibd_file_missing) {
@@ -4875,24 +4886,22 @@ row_rename_table_for_mysql(
ibool old_is_tmp, new_is_tmp;
pars_info_t* info = NULL;
int retry;
+ bool aux_fts_rename = false;
ut_a(old_name != NULL);
ut_a(new_name != NULL);
ut_ad(trx->state == TRX_STATE_ACTIVE);
- if (srv_created_new_raw || srv_force_recovery) {
- fputs("InnoDB: A new raw disk partition was initialized or\n"
- "InnoDB: innodb_force_recovery is on: we do not allow\n"
+ if (srv_force_recovery) {
+ fputs("InnoDB: innodb_force_recovery is on: we do not allow\n"
"InnoDB: database modifications by the user. Shut down\n"
- "InnoDB: mysqld and edit my.cnf so that newraw"
- " is replaced\n"
- "InnoDB: with raw, and innodb_force_... is removed.\n",
+ "InnoDB: mysqld and edit my.cnf so that"
+ "InnoDB: innodb_force_... is removed.\n",
stderr);
- if(srv_force_recovery) {
- err = DB_READ_ONLY;
- }
+ err = DB_READ_ONLY;
goto funct_exit;
+
} else if (row_mysql_is_system_table(new_name)) {
fprintf(stderr,
@@ -5161,34 +5170,8 @@ row_rename_table_for_mysql(
if (dict_table_has_fts_index(table)
&& !dict_tables_have_same_db(old_name, new_name)) {
err = fts_rename_aux_tables(table, new_name, trx);
-
- if (err != DB_SUCCESS && (table->space != 0)) {
- char* orig_name = table->name;
- trx_t* trx_bg = trx_allocate_for_background();
-
- /* If the first fts_rename fails, the trx would
- be rolled back and committed, we can't use it any more,
- so we have to start a new background trx here. */
- ut_a(trx_state_eq(trx, TRX_STATE_NOT_STARTED));
- trx_bg->op_info = "Revert the failing rename "
- "for fts aux tables";
- trx_bg->dict_operation_lock_mode = RW_X_LATCH;
- trx_start_for_ddl(trx_bg, TRX_DICT_OP_TABLE);
-
- /* If rename fails and table has its own tablespace,
- we need to call fts_rename_aux_tables again to
- revert the ibd file rename, which is not under the
- control of trx. Also notice the parent table name
- in cache is not changed yet. If the reverting fails,
- the ibd data may be left in the new database, which
- can be fixed only manually. */
- table->name = const_cast<char*>(new_name);
- fts_rename_aux_tables(table, old_name, trx_bg);
- table->name = orig_name;
-
- trx_bg->dict_operation_lock_mode = 0;
- trx_commit_for_mysql(trx_bg);
- trx_free_for_background(trx_bg);
+ if (err != DB_TABLE_NOT_FOUND) {
+ aux_fts_rename = true;
}
}
@@ -5289,6 +5272,37 @@ end:
}
funct_exit:
+ if (aux_fts_rename && err != DB_SUCCESS
+ && table != NULL && (table->space != 0)) {
+
+ char* orig_name = table->name;
+ trx_t* trx_bg = trx_allocate_for_background();
+
+ /* If the first fts_rename fails, the trx would
+ be rolled back and committed, we can't use it any more,
+ so we have to start a new background trx here. */
+ ut_a(trx_state_eq(trx_bg, TRX_STATE_NOT_STARTED));
+ trx_bg->op_info = "Revert the failing rename "
+ "for fts aux tables";
+ trx_bg->dict_operation_lock_mode = RW_X_LATCH;
+ trx_start_for_ddl(trx_bg, TRX_DICT_OP_TABLE);
+
+ /* If rename fails and table has its own tablespace,
+ we need to call fts_rename_aux_tables again to
+ revert the ibd file rename, which is not under the
+ control of trx. Also notice the parent table name
+ in cache is not changed yet. If the reverting fails,
+ the ibd data may be left in the new database, which
+ can be fixed only manually. */
+ table->name = const_cast<char*>(new_name);
+ fts_rename_aux_tables(table, old_name, trx_bg);
+ table->name = orig_name;
+
+ trx_bg->dict_operation_lock_mode = 0;
+ trx_commit_for_mysql(trx_bg);
+ trx_free_for_background(trx_bg);
+ }
+
if (table != NULL) {
dict_table_close(table, dict_locked, FALSE);
}
diff --git a/storage/xtradb/row/row0sel.cc b/storage/xtradb/row/row0sel.cc
index b1d64c16c60..0be97e12e0a 100644
--- a/storage/xtradb/row/row0sel.cc
+++ b/storage/xtradb/row/row0sel.cc
@@ -2,6 +2,7 @@
Copyright (c) 1997, 2013, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
+Copyright (c) 2015, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -3726,6 +3727,9 @@ row_search_for_mysql(
return(DB_TABLESPACE_NOT_FOUND);
+ } else if (prebuilt->table->is_encrypted) {
+
+ return(DB_DECRYPTION_FAILED);
} else if (!prebuilt->index_usable) {
return(DB_MISSING_HISTORY);
@@ -4137,9 +4141,14 @@ wait_table_again:
} else if (dtuple_get_n_fields(search_tuple) > 0) {
- btr_pcur_open_with_no_init(index, search_tuple, mode,
- BTR_SEARCH_LEAF,
- pcur, 0, &mtr);
+ err = btr_pcur_open_with_no_init(index, search_tuple, mode,
+ BTR_SEARCH_LEAF,
+ pcur, 0, &mtr);
+
+ if (err != DB_SUCCESS) {
+ rec = NULL;
+ goto lock_wait_or_error;
+ }
pcur->trx_if_known = trx;
@@ -4173,9 +4182,23 @@ wait_table_again:
}
}
} else if (mode == PAGE_CUR_G || mode == PAGE_CUR_L) {
- btr_pcur_open_at_index_side(
+ err = btr_pcur_open_at_index_side(
mode == PAGE_CUR_G, index, BTR_SEARCH_LEAF,
pcur, false, 0, &mtr);
+
+ if (err != DB_SUCCESS) {
+ if (err == DB_DECRYPTION_FAILED) {
+ ib_push_warning(trx->mysql_thd,
+ DB_DECRYPTION_FAILED,
+ "Table %s is encrypted but encryption service or"
+ " used key_id is not available. "
+ " Can't continue reading table.",
+ prebuilt->table->name);
+ index->table->is_encrypted = true;
+ }
+ rec = NULL;
+ goto lock_wait_or_error;
+ }
}
rec_loop:
@@ -4191,6 +4214,11 @@ rec_loop:
rec = btr_pcur_get_rec(pcur);
+ if (!rec) {
+ err = DB_DECRYPTION_FAILED;
+ goto lock_wait_or_error;
+ }
+
SRV_CORRUPT_TABLE_CHECK(rec,
{
err = DB_CORRUPTION;
@@ -5132,7 +5160,9 @@ lock_wait_or_error:
/*-------------------------------------------------------------*/
- btr_pcur_store_position(pcur, &mtr);
+ if (rec) {
+ btr_pcur_store_position(pcur, &mtr);
+ }
lock_table_wait:
mtr_commit(&mtr);
diff --git a/storage/xtradb/srv/srv0mon.cc b/storage/xtradb/srv/srv0mon.cc
index 547d6c8c90b..0b2e29e5f68 100644
--- a/storage/xtradb/srv/srv0mon.cc
+++ b/storage/xtradb/srv/srv0mon.cc
@@ -1196,6 +1196,16 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_NONE,
MONITOR_DEFAULT_START, MONITOR_SRV_DICT_LRU_MICROSECOND},
+ {"innodb_dict_lru_count_active", "server",
+ "Number of tables evicted from DICT LRU list in the active loop",
+ MONITOR_NONE,
+ MONITOR_DEFAULT_START, MONITOR_SRV_DICT_LRU_EVICT_COUNT_ACTIVE},
+
+ {"innodb_dict_lru_count_idle", "server",
+ "Number of tables evicted from DICT LRU list in the idle loop",
+ MONITOR_NONE,
+ MONITOR_DEFAULT_START, MONITOR_SRV_DICT_LRU_EVICT_COUNT_IDLE},
+
{"innodb_checkpoint_usec", "server",
"Time (in microseconds) spent by master thread to do checkpoint",
MONITOR_NONE,
diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc
index 7f0150f9f77..abe47e91339 100644
--- a/storage/xtradb/srv/srv0srv.cc
+++ b/storage/xtradb/srv/srv0srv.cc
@@ -688,6 +688,9 @@ current_time % 5 != 0. */
#endif /* MEM_PERIODIC_CHECK */
# define SRV_MASTER_DICT_LRU_INTERVAL (47)
+/** Buffer pool dump status frequence in percentages */
+UNIV_INTERN ulong srv_buf_dump_status_frequency = 0;
+
/** Acquire the system_mutex. */
#define srv_sys_mutex_enter() do { \
mutex_enter(&srv_sys->mutex); \
@@ -2878,6 +2881,7 @@ srv_master_do_active_tasks(void)
{
ib_time_t cur_time = ut_time();
ullint counter_time = ut_time_us(NULL);
+ ulint n_evicted = 0;
/* First do the tasks that we are suppose to do at each
invocation of this function. */
@@ -2938,7 +2942,9 @@ srv_master_do_active_tasks(void)
if (cur_time % SRV_MASTER_DICT_LRU_INTERVAL == 0) {
srv_main_thread_op_info = "enforcing dict cache limit";
- srv_master_evict_from_table_cache(50);
+ n_evicted = srv_master_evict_from_table_cache(50);
+ MONITOR_INC_VALUE(
+ MONITOR_SRV_DICT_LRU_EVICT_COUNT_ACTIVE, n_evicted);
MONITOR_INC_TIME_IN_MICRO_SECS(
MONITOR_SRV_DICT_LRU_MICROSECOND, counter_time);
}
@@ -2970,6 +2976,7 @@ srv_master_do_idle_tasks(void)
/*==========================*/
{
ullint counter_time;
+ ulint n_evicted = 0;
++srv_main_idle_loops;
@@ -3007,7 +3014,9 @@ srv_master_do_idle_tasks(void)
}
srv_main_thread_op_info = "enforcing dict cache limit";
- srv_master_evict_from_table_cache(100);
+ n_evicted = srv_master_evict_from_table_cache(100);
+ MONITOR_INC_VALUE(
+ MONITOR_SRV_DICT_LRU_EVICT_COUNT_IDLE, n_evicted);
MONITOR_INC_TIME_IN_MICRO_SECS(
MONITOR_SRV_DICT_LRU_MICROSECOND, counter_time);
diff --git a/storage/xtradb/srv/srv0start.cc b/storage/xtradb/srv/srv0start.cc
index ef4547ed06f..54ac04e7248 100644
--- a/storage/xtradb/srv/srv0start.cc
+++ b/storage/xtradb/srv/srv0start.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2015, MariaDB Corporation
@@ -74,6 +74,8 @@ Created 2/16/1996 Heikki Tuuri
#include "ut0timer.h"
#include "btr0scrub.h"
+#include <mysql/service_wsrep.h>
+
#ifndef UNIV_HOTBACKUP
# include "trx0rseg.h"
# include "os0proc.h"
@@ -262,8 +264,8 @@ srv_file_check_mode(
/* Note: stat.rw_perm is only valid of files */
- if (stat.type == OS_FILE_TYPE_FILE
- || stat.type == OS_FILE_TYPE_BLOCK) {
+ if (stat.type == OS_FILE_TYPE_FILE) {
+
if (!stat.rw_perm) {
ib_logf(IB_LOG_LEVEL_ERROR,
@@ -460,14 +462,18 @@ srv_parse_data_file_paths_and_sizes(
&& *(str + 1) == 'e'
&& *(str + 2) == 'w') {
str += 3;
- (srv_data_file_is_raw_partition)[i] = SRV_NEW_RAW;
+ /* Initialize new raw device only during bootstrap */
+ (srv_data_file_is_raw_partition)[i] =
+ opt_bootstrap ? SRV_NEW_RAW : SRV_OLD_RAW;
}
if (*str == 'r' && *(str + 1) == 'a' && *(str + 2) == 'w') {
str += 3;
+ /* Initialize new raw device only during bootstrap */
if ((srv_data_file_is_raw_partition)[i] == 0) {
- (srv_data_file_is_raw_partition)[i] = SRV_OLD_RAW;
+ (srv_data_file_is_raw_partition)[i] =
+ opt_bootstrap ? SRV_NEW_RAW : SRV_OLD_RAW;
}
}
@@ -943,6 +949,21 @@ open_or_create_data_files(
return(DB_ERROR);
}
+
+ const char* check_msg;
+ check_msg = fil_read_first_page(
+ files[i], FALSE, &flags, &space,
+ min_flushed_lsn, max_flushed_lsn, NULL);
+
+ /* If first page is valid, don't overwrite DB.
+ It prevents overwriting DB when mysql_install_db
+ starts mysqld multiple times during bootstrap. */
+ if (check_msg == NULL) {
+
+ srv_created_new_raw = FALSE;
+ ret = FALSE;
+ }
+
} else if (srv_data_file_is_raw_partition[i] == SRV_OLD_RAW) {
srv_start_raw_disk_in_use = TRUE;
@@ -1060,7 +1081,7 @@ skip_size_check:
check_first_page:
check_msg = fil_read_first_page(
files[i], one_opened, &flags, &space,
- min_flushed_lsn, max_flushed_lsn, ULINT_UNDEFINED, &crypt_data);
+ min_flushed_lsn, max_flushed_lsn, &crypt_data);
if (check_msg) {
@@ -3025,9 +3046,24 @@ files_checked:
}
if (!srv_read_only_mode) {
+#ifdef WITH_WSREP
+ /*
+ Create the dump/load thread only when not running with
+ --wsrep-recover.
+ */
+ if (!wsrep_recovery) {
+#endif /* WITH_WSREP */
/* Create the buffer pool dump/load thread */
- buf_dump_thread_handle = os_thread_create(buf_dump_thread, NULL, NULL);
+ buf_dump_thread_handle=
+ os_thread_create(buf_dump_thread, NULL, NULL);
buf_dump_thread_started = true;
+#ifdef WITH_WSREP
+ } else {
+ ib_logf(IB_LOG_LEVEL_WARN,
+ "Skipping buffer pool dump/restore during "
+ "wsrep recovery.");
+ }
+#endif /* WITH_WSREP */
/* Create the dict stats gathering thread */
dict_stats_thread_handle = os_thread_create(dict_stats_thread, NULL, NULL);
@@ -3277,9 +3313,9 @@ innobase_shutdown_for_mysql(void)
ibuf_close();
log_shutdown();
- lock_sys_close();
trx_sys_file_format_close();
trx_sys_close();
+ lock_sys_close();
/* We don't create these mutexes in RO mode because we don't create
the temp files that the cover. */
diff --git a/storage/xtradb/sync/sync0arr.cc b/storage/xtradb/sync/sync0arr.cc
index 01cae70a8ce..d881c5de2f5 100644
--- a/storage/xtradb/sync/sync0arr.cc
+++ b/storage/xtradb/sync/sync0arr.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2013, 2015, MariaDB Corporation. All Rights Reserved.
@@ -1206,8 +1206,8 @@ sync_array_print_info_low(
ulint count = 0;
fprintf(file,
- "OS WAIT ARRAY INFO: reservation count %ld\n",
- (long) arr->res_count);
+ "OS WAIT ARRAY INFO: reservation count " ULINTPF "\n",
+ arr->res_count);
for (i = 0; count < arr->n_reserved; ++i) {
sync_cell_t* cell;
@@ -1303,7 +1303,7 @@ sync_array_print(
}
fprintf(file,
- "OS WAIT ARRAY INFO: signal count %ld\n", (long) sg_count);
+ "OS WAIT ARRAY INFO: signal count " ULINTPF "\n", sg_count);
}
diff --git a/storage/xtradb/sync/sync0sync.cc b/storage/xtradb/sync/sync0sync.cc
index dabf70fd041..14b332a2185 100644
--- a/storage/xtradb/sync/sync0sync.cc
+++ b/storage/xtradb/sync/sync0sync.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
diff --git a/storage/xtradb/trx/trx0sys.cc b/storage/xtradb/trx/trx0sys.cc
index 32948d6847c..bebd28b0df3 100644
--- a/storage/xtradb/trx/trx0sys.cc
+++ b/storage/xtradb/trx/trx0sys.cc
@@ -1332,8 +1332,6 @@ trx_sys_close(void)
/* Free the double write data structures. */
buf_dblwr_free();
- mutex_enter(&trx_sys->mutex);
-
ut_a(UT_LIST_GET_LEN(trx_sys->ro_trx_list) == 0);
/* Only prepared transactions may be left in the system. Free them. */
@@ -1373,8 +1371,6 @@ trx_sys_close(void)
ut_a(UT_LIST_GET_LEN(trx_sys->rw_trx_list) == 0);
ut_a(UT_LIST_GET_LEN(trx_sys->mysql_trx_list) == 0);
- mutex_exit(&trx_sys->mutex);
-
mutex_free(&trx_sys->mutex);
ut_ad(trx_sys->descr_n_used == 0);
diff --git a/storage/xtradb/trx/trx0trx.cc b/storage/xtradb/trx/trx0trx.cc
index 17986c293e9..9bca6de9c26 100644
--- a/storage/xtradb/trx/trx0trx.cc
+++ b/storage/xtradb/trx/trx0trx.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -478,11 +478,10 @@ trx_free_prepared(
/*==============*/
trx_t* trx) /*!< in, own: trx object */
{
- ut_ad(mutex_own(&trx_sys->mutex));
-
ut_a(trx_state_eq(trx, TRX_STATE_PREPARED));
ut_a(trx->magic_n == TRX_MAGIC_N);
+ lock_trx_release_locks(trx);
trx_undo_free_prepared(trx);
assert_trx_in_rw_list(trx);
@@ -492,7 +491,9 @@ trx_free_prepared(
UT_LIST_REMOVE(trx_list, trx_sys->rw_trx_list, trx);
ut_d(trx->in_rw_trx_list = FALSE);
+ mutex_enter(&trx_sys->mutex);
trx_release_descriptor(trx);
+ mutex_exit(&trx_sys->mutex);
/* Undo trx_resurrect_table_locks(). */
UT_LIST_INIT(trx->lock.trx_locks);
diff --git a/storage/xtradb/ut/ut0ut.cc b/storage/xtradb/ut/ut0ut.cc
index 121cbdb7bc0..7a8c0b053d4 100644
--- a/storage/xtradb/ut/ut0ut.cc
+++ b/storage/xtradb/ut/ut0ut.cc
@@ -827,6 +827,8 @@ ut_strerr(
return("Too many words in a FTS phrase or proximity search");
case DB_TOO_BIG_FOR_REDO:
return("BLOB record length is greater than 10%% of redo log");
+ case DB_DECRYPTION_FAILED:
+ return("Table is encrypted but decrypt failed.");
/* do not add default: in order to produce a warning if new code
is added to the enum but not added here */
diff --git a/strings/CMakeLists.txt b/strings/CMakeLists.txt
index 6291d107d90..1e364bc951b 100644
--- a/strings/CMakeLists.txt
+++ b/strings/CMakeLists.txt
@@ -26,7 +26,7 @@ SET(STRINGS_SOURCES bchange.c bmove_upp.c ctype-big5.c ctype-bin.c ctype-cp932.c
my_strchr.c strcont.c strappend.c)
IF(NOT HAVE_STRNLEN)
- # OSX does not have strnlen
+ # OSX below 10.7 did not have strnlen
SET(STRINGS_SOURCES ${STRINGS_SOURCES} strnlen.c)
ENDIF()
# Avoid dependencies on perschema data defined in mysys
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index eda81c0c4d3..d6a9695afbf 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -49,6 +49,7 @@
#define big5tail(e) ((uchar)(e&0xff))
#define MY_FUNCTION_NAME(x) my_ ## x ## _big5
+#define IS_MB1_CHAR(x) ((uchar) (x) < 0x80)
#define IS_MB2_CHAR(x,y) (isbig5head(x) && isbig5tail(y))
#define DEFINE_ASIAN_ROUTINES
#include "ctype-mb.ic"
@@ -849,89 +850,6 @@ static uint16 big5strokexfrm(uint16 i)
}
-
-static int my_strnncoll_big5_internal(const uchar **a_res,
- const uchar **b_res, size_t length)
-{
- const uchar *a= *a_res, *b= *b_res;
-
- while (length--)
- {
- if ((length > 0) && isbig5code(*a,*(a+1)) && isbig5code(*b, *(b+1)))
- {
- if (*a != *b || *(a+1) != *(b+1))
- return ((int) big5code(*a,*(a+1)) -
- (int) big5code(*b,*(b+1)));
- a+= 2;
- b+= 2;
- length--;
- }
- else if (sort_order_big5[*a++] !=
- sort_order_big5[*b++])
- return ((int) sort_order_big5[a[-1]] -
- (int) sort_order_big5[b[-1]]);
- }
- *a_res= a;
- *b_res= b;
- return 0;
-}
-
-
-/* Compare strings */
-
-static int my_strnncoll_big5(CHARSET_INFO *cs __attribute__((unused)),
- const uchar *a, size_t a_length,
- const uchar *b, size_t b_length,
- my_bool b_is_prefix)
-{
- size_t length= MY_MIN(a_length, b_length);
- int res= my_strnncoll_big5_internal(&a, &b, length);
- return res ? res : (int)((b_is_prefix ? length : a_length) - b_length);
-}
-
-
-/* compare strings, ignore end space */
-
-static int my_strnncollsp_big5(CHARSET_INFO * cs __attribute__((unused)),
- const uchar *a, size_t a_length,
- const uchar *b, size_t b_length,
- my_bool diff_if_only_endspace_difference)
-{
- size_t length= MY_MIN(a_length, b_length);
- int res= my_strnncoll_big5_internal(&a, &b, length);
-
-#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
- diff_if_only_endspace_difference= 0;
-#endif
-
- if (!res && a_length != b_length)
- {
- const uchar *end;
- int swap= 1;
- if (diff_if_only_endspace_difference)
- res= 1; /* Assume 'a' is bigger */
- /*
- Check the next not space character of the longer key. If it's < ' ',
- then it's smaller than the other key.
- */
- if (a_length < b_length)
- {
- /* put longer key in a */
- a_length= b_length;
- a= b;
- swap= -1; /* swap sign of result */
- res= -res;
- }
- for (end= a + a_length-length; a < end ; a++)
- {
- if (*a != ' ')
- return (*a < ' ') ? -swap : swap;
- }
- }
- return res;
-}
-
-
static size_t
my_strnxfrm_big5(CHARSET_INFO *cs,
uchar *dst, size_t dstlen, uint nweights,
@@ -6853,11 +6771,23 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)),
}
-static MY_COLLATION_HANDLER my_collation_big5_chinese_ci_handler =
+#define MY_FUNCTION_NAME(x) my_ ## x ## _big5_chinese_ci
+#define WEIGHT_MB1(x) (sort_order_big5[(uchar) (x)])
+#define WEIGHT_MB2(x,y) (big5code(x, y))
+#include "strcoll.ic"
+
+
+#define MY_FUNCTION_NAME(x) my_ ## x ## _big5_bin
+#define WEIGHT_MB1(x) ((uchar) (x))
+#define WEIGHT_MB2(x,y) (big5code(x, y))
+#include "strcoll.ic"
+
+
+static MY_COLLATION_HANDLER my_collation_handler_big5_chinese_ci=
{
NULL, /* init */
- my_strnncoll_big5,
- my_strnncollsp_big5,
+ my_strnncoll_big5_chinese_ci,
+ my_strnncollsp_big5_chinese_ci,
my_strnxfrm_big5,
my_strnxfrmlen_simple,
my_like_range_mb,
@@ -6868,6 +6798,23 @@ static MY_COLLATION_HANDLER my_collation_big5_chinese_ci_handler =
my_propagate_simple
};
+
+static MY_COLLATION_HANDLER my_collation_handler_big5_bin=
+{
+ NULL, /* init */
+ my_strnncoll_big5_bin,
+ my_strnncollsp_big5_bin,
+ my_strnxfrm_mb,
+ my_strnxfrmlen_simple,
+ my_like_range_mb,
+ my_wildcmp_mb_bin,
+ my_strcasecmp_mb_bin,
+ my_instr_mb,
+ my_hash_sort_mb_bin,
+ my_propagate_simple
+};
+
+
static MY_CHARSET_HANDLER my_charset_big5_handler=
{
NULL, /* init */
@@ -6900,6 +6847,7 @@ static MY_CHARSET_HANDLER my_charset_big5_handler=
my_charlen_big5,
my_well_formed_char_length_big5,
my_copy_fix_mb,
+ my_native_to_mb_big5,
};
struct charset_info_st my_charset_big5_chinese_ci=
@@ -6931,7 +6879,7 @@ struct charset_info_st my_charset_big5_chinese_ci=
1, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
&my_charset_big5_handler,
- &my_collation_big5_chinese_ci_handler
+ &my_collation_handler_big5_chinese_ci
};
@@ -6964,7 +6912,7 @@ struct charset_info_st my_charset_big5_bin=
1, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
&my_charset_big5_handler,
- &my_collation_mb_bin_handler
+ &my_collation_handler_big5_bin
};
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c
index 95f31038ee6..0be6ae95577 100644
--- a/strings/ctype-bin.c
+++ b/strings/ctype-bin.c
@@ -256,10 +256,8 @@ static int my_mb_wc_bin(CHARSET_INFO *cs __attribute__((unused)),
}
-static int my_wc_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
- my_wc_t wc,
- uchar *s,
- uchar *e __attribute__((unused)))
+int my_wc_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
+ my_wc_t wc, uchar *s, uchar *e)
{
if (s >= e)
return MY_CS_TOOSMALL;
@@ -552,13 +550,14 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_charlen_8bit,
my_well_formed_char_length_8bit,
my_copy_8bit,
+ my_wc_mb_bin,
};
struct charset_info_st my_charset_bin =
{
63,0,0, /* number */
- MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_PRIMARY,/* state */
+ MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_PRIMARY|MY_CS_NOPAD,/* state */
"binary", /* cs name */
"binary", /* name */
"", /* comment */
diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c
index 2e26a98bf05..9bf206f1de7 100644
--- a/strings/ctype-cp932.c
+++ b/strings/ctype-cp932.c
@@ -185,6 +185,7 @@ static const uchar sort_order_cp932[]=
#define MY_FUNCTION_NAME(x) my_ ## x ## _cp932
#define IS_8BIT_CHAR(x) iscp932kata(x)
+#define IS_MB1_CHAR(x) ((uchar) (x) < 0x80 || iscp932kata(x))
#define IS_MB2_CHAR(x,y) (iscp932head(x) && iscp932tail(y))
#define DEFINE_ASIAN_ROUTINES
#include "ctype-mb.ic"
@@ -1717,90 +1718,6 @@ MY_UNICASE_INFO my_caseinfo_cp932=
my_caseinfo_pages_cp932
};
-static int my_strnncoll_cp932_internal(CHARSET_INFO *cs,
- const uchar **a_res, size_t a_length,
- const uchar **b_res, size_t b_length)
-{
- const uchar *a= *a_res, *b= *b_res;
- const uchar *a_end= a + a_length;
- const uchar *b_end= b + b_length;
- while (a < a_end && b < b_end)
- {
- if (ismbchar_cp932(cs,(char*) a, (char*) a_end) &&
- ismbchar_cp932(cs,(char*) b, (char*) b_end))
- {
- uint a_char= cp932code(*a, *(a+1));
- uint b_char= cp932code(*b, *(b+1));
- if (a_char != b_char)
- return a_char - b_char;
- a += 2;
- b += 2;
- } else
- {
- if (sort_order_cp932[(uchar)*a] != sort_order_cp932[(uchar)*b])
- return sort_order_cp932[(uchar)*a] - sort_order_cp932[(uchar)*b];
- a++;
- b++;
- }
- }
- *a_res= a;
- *b_res= b;
- return 0;
-}
-
-
-static int my_strnncoll_cp932(CHARSET_INFO *cs __attribute__((unused)),
- const uchar *a, size_t a_length,
- const uchar *b, size_t b_length,
- my_bool b_is_prefix)
-{
- int res= my_strnncoll_cp932_internal(cs, &a, a_length, &b, b_length);
- if (b_is_prefix && a_length > b_length)
- a_length= b_length;
- return res ? res : (int) (a_length - b_length);
-}
-
-
-static int my_strnncollsp_cp932(CHARSET_INFO *cs __attribute__((unused)),
- const uchar *a, size_t a_length,
- const uchar *b, size_t b_length,
- my_bool diff_if_only_endspace_difference
- __attribute__((unused)))
-{
- const uchar *a_end= a + a_length;
- const uchar *b_end= b + b_length;
- int res= my_strnncoll_cp932_internal(cs, &a, a_length, &b, b_length);
-
-#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
- diff_if_only_endspace_difference= 0;
-#endif
-
- if (!res && (a != a_end || b != b_end))
- {
- int swap= 1;
- if (diff_if_only_endspace_difference)
- res= 1; /* Assume 'a' is bigger */
- /*
- Check the next not space character of the longer key. If it's < ' ',
- then it's smaller than the other key.
- */
- if (a == a_end)
- {
- /* put shorter key in a */
- a_end= b_end;
- a= b;
- swap= -1; /* swap sign of result */
- res= -res;
- }
- for (; a < a_end ; a++)
- {
- if (*a != (uchar) ' ')
- return (*a < (uchar) ' ') ? -swap : swap;
- }
- }
- return res;
-}
-
static const uint16 cp932_to_unicode[65536]=
{
@@ -34720,15 +34637,36 @@ size_t my_numcells_cp932(CHARSET_INFO *cs __attribute__((unused)),
}
-static MY_COLLATION_HANDLER my_collation_ci_handler =
+/*
+ cp932_chinese_ci and cp932_bin sort character blocks in this order:
+ 1. [00..7F] - 7BIT characters (ASCII)
+ 2. [81..9F][40..7E,80..FC] - MB2 characters, part1
+ 3. [A1..DF] - 8BIT characters (Kana)
+ 4. [E0..FC][40..7E,80..FC] - MB2 characters, part2
+*/
+#define MY_FUNCTION_NAME(x) my_ ## x ## _cp932_japanese_ci
+#define WEIGHT_PAD_SPACE (256 * (int) ' ')
+#define WEIGHT_MB1(x) (256 * (int) sort_order_cp932[(uchar) (x)])
+#define WEIGHT_MB2(x,y) (cp932code(x, y))
+#include "strcoll.ic"
+
+
+#define MY_FUNCTION_NAME(x) my_ ## x ## _cp932_bin
+#define WEIGHT_PAD_SPACE (256 * (int) ' ')
+#define WEIGHT_MB1(x) (256 * (int) (uchar) (x))
+#define WEIGHT_MB2(x,y) (cp932code(x, y))
+#include "strcoll.ic"
+
+
+static MY_COLLATION_HANDLER my_collation_handler_cp932_japanese_ci=
{
- NULL, /* init */
- my_strnncoll_cp932,
- my_strnncollsp_cp932,
+ NULL, /* init */
+ my_strnncoll_cp932_japanese_ci,
+ my_strnncollsp_cp932_japanese_ci,
my_strnxfrm_mb,
my_strnxfrmlen_simple,
my_like_range_mb,
- my_wildcmp_mb, /* wildcmp */
+ my_wildcmp_mb,
my_strcasecmp_8bit,
my_instr_mb,
my_hash_sort_simple,
@@ -34736,6 +34674,22 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
};
+static MY_COLLATION_HANDLER my_collation_handler_cp932_bin=
+{
+ NULL, /* init */
+ my_strnncoll_cp932_bin,
+ my_strnncollsp_cp932_bin,
+ my_strnxfrm_mb,
+ my_strnxfrmlen_simple,
+ my_like_range_mb,
+ my_wildcmp_mb_bin,
+ my_strcasecmp_mb_bin,
+ my_instr_mb,
+ my_hash_sort_mb_bin,
+ my_propagate_simple
+};
+
+
static MY_CHARSET_HANDLER my_charset_handler=
{
NULL, /* init */
@@ -34768,6 +34722,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_charlen_cp932,
my_well_formed_char_length_cp932,
my_copy_fix_mb,
+ my_native_to_mb_cp932,
};
@@ -34800,7 +34755,7 @@ struct charset_info_st my_charset_cp932_japanese_ci=
1, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
&my_charset_handler,
- &my_collation_ci_handler
+ &my_collation_handler_cp932_japanese_ci
};
struct charset_info_st my_charset_cp932_bin=
@@ -34832,7 +34787,7 @@ struct charset_info_st my_charset_cp932_bin=
1, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
&my_charset_handler,
- &my_collation_mb_bin_handler
+ &my_collation_handler_cp932_bin
};
#endif
diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c
index 6603bc7d3e5..e3abebad91d 100644
--- a/strings/ctype-czech.c
+++ b/strings/ctype-czech.c
@@ -625,7 +625,8 @@ static MY_COLLATION_HANDLER my_collation_latin2_czech_ci_handler =
struct charset_info_st my_charset_latin2_czech_ci =
{
2,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_CSSORT|MY_CS_STRNXFRM_BAD_NWEIGHTS, /* state */
+ MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_CSSORT|
+ MY_CS_STRNXFRM_BAD_NWEIGHTS|MY_CS_NON1TO1, /* state */
"latin2", /* cs name */
"latin2_czech_cs", /* name */
"", /* comment */
diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c
index a2c95bf77c8..1f13ab66284 100644
--- a/strings/ctype-euc_kr.c
+++ b/strings/ctype-euc_kr.c
@@ -201,8 +201,10 @@ static const uchar sort_order_euc_kr[]=
iseuc_kr_tail2(c) || \
iseuc_kr_tail3(c))
+#define euckrcode(c,d) (((uchar)(c) <<8) | (uchar)(d))
#define MY_FUNCTION_NAME(x) my_ ## x ## _euckr
+#define IS_MB1_CHAR(x) ((uchar) (x) < 0x80)
#define IS_MB2_CHAR(x,y) (iseuc_kr_head(x) && iseuc_kr_tail(y))
#define DEFINE_ASIAN_ROUTINES
#include "ctype-mb.ic"
@@ -9938,21 +9940,50 @@ my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
}
-static MY_COLLATION_HANDLER my_collation_ci_handler =
+#define MY_FUNCTION_NAME(x) my_ ## x ## _euckr_korean_ci
+#define WEIGHT_MB1(x) (sort_order_euc_kr[(uchar) (x)])
+#define WEIGHT_MB2(x,y) (euckrcode(x, y))
+#include "strcoll.ic"
+
+
+#define MY_FUNCTION_NAME(x) my_ ## x ## _euckr_bin
+#define WEIGHT_MB1(x) ((uchar) (x))
+#define WEIGHT_MB2(x,y) (euckrcode(x, y))
+#include "strcoll.ic"
+
+
+static MY_COLLATION_HANDLER my_collation_handler_euckr_korean_ci=
{
- NULL, /* init */
- my_strnncoll_simple, /* strnncoll */
- my_strnncollsp_simple,
- my_strnxfrm_mb, /* strnxfrm */
+ NULL, /* init */
+ my_strnncoll_euckr_korean_ci,
+ my_strnncollsp_euckr_korean_ci,
+ my_strnxfrm_mb,
my_strnxfrmlen_simple,
- my_like_range_mb, /* like_range */
- my_wildcmp_mb, /* wildcmp */
+ my_like_range_mb,
+ my_wildcmp_mb,
my_strcasecmp_mb,
my_instr_mb,
my_hash_sort_simple,
my_propagate_simple
};
+
+static MY_COLLATION_HANDLER my_collation_handler_euckr_bin=
+{
+ NULL, /* init */
+ my_strnncoll_euckr_bin,
+ my_strnncollsp_euckr_bin,
+ my_strnxfrm_mb,
+ my_strnxfrmlen_simple,
+ my_like_range_mb,
+ my_wildcmp_mb_bin,
+ my_strcasecmp_mb_bin,
+ my_instr_mb,
+ my_hash_sort_mb_bin,
+ my_propagate_simple
+};
+
+
static MY_CHARSET_HANDLER my_charset_handler=
{
NULL, /* init */
@@ -9985,6 +10016,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_charlen_euckr,
my_well_formed_char_length_euckr,
my_copy_fix_mb,
+ my_native_to_mb_euckr,
};
@@ -10017,7 +10049,7 @@ struct charset_info_st my_charset_euckr_korean_ci=
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
&my_charset_handler,
- &my_collation_ci_handler
+ &my_collation_handler_euckr_korean_ci
};
@@ -10050,7 +10082,7 @@ struct charset_info_st my_charset_euckr_bin=
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
&my_charset_handler,
- &my_collation_mb_bin_handler
+ &my_collation_handler_euckr_bin
};
#endif
diff --git a/strings/ctype-eucjpms.c b/strings/ctype-eucjpms.c
index 827feda927b..82c4bb5a4e8 100644
--- a/strings/ctype-eucjpms.c
+++ b/strings/ctype-eucjpms.c
@@ -194,6 +194,7 @@ static const uchar sort_order_eucjpms[]=
#define MY_FUNCTION_NAME(x) my_ ## x ## _eucjpms
+#define IS_MB1_CHAR(x) ((uchar) (x) < 0x80)
#define IS_MB2_JIS(x,y) (iseucjpms(x) && iseucjpms(y))
#define IS_MB2_KATA(x,y) (iseucjpms_ss2(x) && iskata(y))
#define IS_MB2_CHAR(x,y) (IS_MB2_KATA(x,y) || IS_MB2_JIS(x,y))
@@ -201,6 +202,23 @@ static const uchar sort_order_eucjpms[]=
#define DEFINE_ASIAN_ROUTINES
#include "ctype-mb.ic"
+#define MY_FUNCTION_NAME(x) my_ ## x ## _eucjpms_japanese_ci
+#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x))
+#define WEIGHT_MB1(x) ((int) sort_order_eucjpms[(uchar) (x)])
+#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \
+ (((uint) (uchar) (y)) << 8))
+#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z))
+#include "strcoll.ic"
+
+
+#define MY_FUNCTION_NAME(x) my_ ## x ## _eucjpms_bin
+#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x))
+#define WEIGHT_MB1(x) ((int) (uchar) (x))
+#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \
+ (((uint) (uchar) (y)) << 8))
+#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z))
+#include "strcoll.ic"
+
static uint ismbchar_eucjpms(CHARSET_INFO *cs __attribute__((unused)),
const char* p, const char *e)
@@ -67467,11 +67485,11 @@ size_t my_numcells_eucjpms(CHARSET_INFO *cs __attribute__((unused)),
}
-static MY_COLLATION_HANDLER my_collation_ci_handler =
+static MY_COLLATION_HANDLER my_collation_eucjpms_japanese_ci_handler =
{
NULL, /* init */
- my_strnncoll_simple,/* strnncoll */
- my_strnncollsp_simple,
+ my_strnncoll_eucjpms_japanese_ci,
+ my_strnncollsp_eucjpms_japanese_ci,
my_strnxfrm_mb, /* strnxfrm */
my_strnxfrmlen_simple,
my_like_range_mb, /* like_range */
@@ -67482,6 +67500,23 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_propagate_simple
};
+
+static MY_COLLATION_HANDLER my_collation_eucjpms_bin_handler =
+{
+ NULL, /* init */
+ my_strnncoll_eucjpms_bin,
+ my_strnncollsp_eucjpms_bin,
+ my_strnxfrm_mb,
+ my_strnxfrmlen_simple,
+ my_like_range_mb,
+ my_wildcmp_mb_bin,
+ my_strcasecmp_mb_bin,
+ my_instr_mb,
+ my_hash_sort_mb_bin,
+ my_propagate_simple
+};
+
+
static MY_CHARSET_HANDLER my_charset_handler=
{
NULL, /* init */
@@ -67514,6 +67549,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_charlen_eucjpms,
my_well_formed_char_length_eucjpms,
my_copy_fix_mb,
+ my_native_to_mb_eucjpms,
};
@@ -67547,7 +67583,7 @@ struct charset_info_st my_charset_eucjpms_japanese_ci=
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
&my_charset_handler,
- &my_collation_ci_handler
+ &my_collation_eucjpms_japanese_ci_handler
};
@@ -67580,7 +67616,7 @@ struct charset_info_st my_charset_eucjpms_bin=
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
&my_charset_handler,
- &my_collation_mb_bin_handler
+ &my_collation_eucjpms_bin_handler
};
diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c
index 129e8edb966..b0e275fe93d 100644
--- a/strings/ctype-gb2312.c
+++ b/strings/ctype-gb2312.c
@@ -163,9 +163,11 @@ static const uchar sort_order_gb2312[]=
#define isgb2312head(c) (0xa1<=(uchar)(c) && (uchar)(c)<=0xf7)
#define isgb2312tail(c) (0xa1<=(uchar)(c) && (uchar)(c)<=0xfe)
+#define gb2312code(c,d) (((uchar)(c) <<8) | (uchar)(d))
#define MY_FUNCTION_NAME(x) my_ ## x ## _gb2312
+#define IS_MB1_CHAR(x) ((uchar) (x) < 0x80)
#define IS_MB2_CHAR(x,y) (isgb2312head(x) && isgb2312tail(y))
#define DEFINE_ASIAN_ROUTINES
#include "ctype-mb.ic"
@@ -6341,11 +6343,23 @@ my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)),
}
-static MY_COLLATION_HANDLER my_collation_ci_handler =
+#define MY_FUNCTION_NAME(x) my_ ## x ## _gb2312_chinese_ci
+#define WEIGHT_MB1(x) (sort_order_gb2312[(uchar) (x)])
+#define WEIGHT_MB2(x,y) (gb2312code(x, y))
+#include "strcoll.ic"
+
+
+#define MY_FUNCTION_NAME(x) my_ ## x ## _gb2312_bin
+#define WEIGHT_MB1(x) ((uchar) (x))
+#define WEIGHT_MB2(x,y) (gb2312code(x, y))
+#include "strcoll.ic"
+
+
+static MY_COLLATION_HANDLER my_collation_handler_gb2312_chinese_ci=
{
- NULL, /* init */
- my_strnncoll_simple, /* strnncoll */
- my_strnncollsp_simple,
+ NULL, /* init */
+ my_strnncoll_gb2312_chinese_ci,
+ my_strnncollsp_gb2312_chinese_ci,
my_strnxfrm_mb, /* strnxfrm */
my_strnxfrmlen_simple,
my_like_range_mb, /* like_range */
@@ -6356,6 +6370,24 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_propagate_simple
};
+
+static MY_COLLATION_HANDLER my_collation_handler_gb2312_bin=
+{
+ NULL, /* init */
+ my_strnncoll_gb2312_bin,
+ my_strnncollsp_gb2312_bin,
+ my_strnxfrm_mb,
+ my_strnxfrmlen_simple,
+ my_like_range_mb,
+ my_wildcmp_mb_bin,
+ my_strcasecmp_mb_bin,
+ my_instr_mb,
+ my_hash_sort_mb_bin,
+ my_propagate_simple
+};
+
+
+
static MY_CHARSET_HANDLER my_charset_handler=
{
NULL, /* init */
@@ -6388,6 +6420,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_charlen_gb2312,
my_well_formed_char_length_gb2312,
my_copy_fix_mb,
+ my_native_to_mb_gb2312,
};
@@ -6420,9 +6453,10 @@ struct charset_info_st my_charset_gb2312_chinese_ci=
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
&my_charset_handler,
- &my_collation_ci_handler
+ &my_collation_handler_gb2312_chinese_ci
};
+
struct charset_info_st my_charset_gb2312_bin=
{
86,0,0, /* number */
@@ -6452,7 +6486,7 @@ struct charset_info_st my_charset_gb2312_bin=
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
&my_charset_handler,
- &my_collation_mb_bin_handler
+ &my_collation_handler_gb2312_bin
};
#endif
diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c
index b3bd1efb6c4..37b003f1899 100644
--- a/strings/ctype-gbk.c
+++ b/strings/ctype-gbk.c
@@ -44,6 +44,7 @@
#define gbktail(e) ((uchar)(e&0xff))
#define MY_FUNCTION_NAME(x) my_ ## x ## _gbk
+#define IS_MB1_CHAR(x) ((uchar) (x) < 0x80)
#define IS_MB2_CHAR(x,y) (isgbkhead(x) && isgbktail(y))
#define DEFINE_ASIAN_ROUTINES
#include "ctype-mb.ic"
@@ -3450,87 +3451,6 @@ static uint16 gbksortorder(uint16 i)
}
-int my_strnncoll_gbk_internal(const uchar **a_res, const uchar **b_res,
- size_t length)
-{
- const uchar *a= *a_res, *b= *b_res;
- uint a_char,b_char;
-
- while (length--)
- {
- if ((length > 0) && isgbkcode(*a,*(a+1)) && isgbkcode(*b, *(b+1)))
- {
- a_char= gbkcode(*a,*(a+1));
- b_char= gbkcode(*b,*(b+1));
- if (a_char != b_char)
- return ((int) gbksortorder((uint16) a_char) -
- (int) gbksortorder((uint16) b_char));
- a+= 2;
- b+= 2;
- length--;
- }
- else if (sort_order_gbk[*a++] != sort_order_gbk[*b++])
- return ((int) sort_order_gbk[a[-1]] -
- (int) sort_order_gbk[b[-1]]);
- }
- *a_res= a;
- *b_res= b;
- return 0;
-}
-
-
-
-int my_strnncoll_gbk(CHARSET_INFO *cs __attribute__((unused)),
- const uchar *a, size_t a_length,
- const uchar *b, size_t b_length,
- my_bool b_is_prefix)
-{
- size_t length= MY_MIN(a_length, b_length);
- int res= my_strnncoll_gbk_internal(&a, &b, length);
- return res ? res : (int) ((b_is_prefix ? length : a_length) - b_length);
-}
-
-
-static int my_strnncollsp_gbk(CHARSET_INFO * cs __attribute__((unused)),
- const uchar *a, size_t a_length,
- const uchar *b, size_t b_length,
- my_bool diff_if_only_endspace_difference)
-{
- size_t length= MY_MIN(a_length, b_length);
- int res= my_strnncoll_gbk_internal(&a, &b, length);
-
-#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
- diff_if_only_endspace_difference= 0;
-#endif
-
- if (!res && a_length != b_length)
- {
- const uchar *end;
- int swap= 1;
- if (diff_if_only_endspace_difference)
- res= 1; /* Assume 'a' is bigger */
- /*
- Check the next not space character of the longer key. If it's < ' ',
- then it's smaller than the other key.
- */
- if (a_length < b_length)
- {
- /* put shorter key in a */
- a_length= b_length;
- a= b;
- swap= -1; /* swap sign of result */
- res= -res;
- }
- for (end= a + a_length-length; a < end ; a++)
- {
- if (*a != ' ')
- return (*a < ' ') ? -swap : swap;
- }
- }
- return res;
-}
-
-
static size_t
my_strnxfrm_gbk(CHARSET_INFO *cs,
uchar *dst, size_t dstlen, uint nweights,
@@ -10735,11 +10655,23 @@ my_mb_wc_gbk(CHARSET_INFO *cs __attribute__((unused)),
}
-static MY_COLLATION_HANDLER my_collation_ci_handler =
+#define MY_FUNCTION_NAME(x) my_ ## x ## _gbk_chinese_ci
+#define WEIGHT_MB1(x) (sort_order_gbk[(uchar) (x)])
+#define WEIGHT_MB2(x,y) (gbksortorder(gbkcode(x,y)))
+#include "strcoll.ic"
+
+
+#define MY_FUNCTION_NAME(x) my_ ## x ## _gbk_bin
+#define WEIGHT_MB1(x) ((uchar) (x))
+#define WEIGHT_MB2(x,y) (gbkcode(x,y))
+#include "strcoll.ic"
+
+
+static MY_COLLATION_HANDLER my_collation_handler_gbk_chinese_ci=
{
- NULL, /* init */
- my_strnncoll_gbk,
- my_strnncollsp_gbk,
+ NULL, /* init */
+ my_strnncoll_gbk_chinese_ci,
+ my_strnncollsp_gbk_chinese_ci,
my_strnxfrm_gbk,
my_strnxfrmlen_simple,
my_like_range_mb,
@@ -10750,6 +10682,24 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_propagate_simple
};
+
+static MY_COLLATION_HANDLER my_collation_handler_gbk_bin=
+{
+ NULL, /* init */
+ my_strnncoll_gbk_bin,
+ my_strnncollsp_gbk_bin,
+ my_strnxfrm_mb,
+ my_strnxfrmlen_simple,
+ my_like_range_mb,
+ my_wildcmp_mb_bin,
+ my_strcasecmp_mb_bin,
+ my_instr_mb,
+ my_hash_sort_mb_bin,
+ my_propagate_simple
+};
+
+
+
static MY_CHARSET_HANDLER my_charset_handler=
{
NULL, /* init */
@@ -10782,6 +10732,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_charlen_gbk,
my_well_formed_char_length_gbk,
my_copy_fix_mb,
+ my_native_to_mb_gbk,
};
@@ -10814,7 +10765,7 @@ struct charset_info_st my_charset_gbk_chinese_ci=
1, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
&my_charset_handler,
- &my_collation_ci_handler
+ &my_collation_handler_gbk_chinese_ci
};
struct charset_info_st my_charset_gbk_bin=
@@ -10846,7 +10797,7 @@ struct charset_info_st my_charset_gbk_bin=
1, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
&my_charset_handler,
- &my_collation_mb_bin_handler
+ &my_collation_handler_gbk_bin
};
diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c
index bc51911dceb..26c66d60071 100644
--- a/strings/ctype-latin1.c
+++ b/strings/ctype-latin1.c
@@ -425,6 +425,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_charlen_8bit,
my_well_formed_char_length_8bit,
my_copy_8bit,
+ my_wc_mb_bin, /* native_to_mb */
};
@@ -735,7 +736,7 @@ static MY_COLLATION_HANDLER my_collation_german2_ci_handler=
struct charset_info_st my_charset_latin1_german2_ci=
{
31,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM, /* state */
+ MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_NON1TO1, /* state */
"latin1", /* cs name */
"latin1_german2_ci", /* name */
"", /* comment */
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index 5947c3d4f4a..eef283d2925 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -811,25 +811,8 @@ my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
static void pad_max_char(CHARSET_INFO *cs, char *str, char *end)
{
char buf[10];
- char buflen;
-
- if (!(cs->state & MY_CS_UNICODE))
- {
- if (cs->max_sort_char <= 255)
- {
- bfill(str, end - str, cs->max_sort_char);
- return;
- }
- buf[0]= cs->max_sort_char >> 8;
- buf[1]= cs->max_sort_char & 0xFF;
- buflen= 2;
- }
- else
- {
- buflen= cs->cset->wc_mb(cs, cs->max_sort_char, (uchar*) buf,
- (uchar*) buf + sizeof(buf));
- }
-
+ char buflen= cs->cset->native_to_mb(cs, cs->max_sort_char, (uchar*) buf,
+ (uchar*) buf + sizeof(buf));
DBUG_ASSERT(buflen > 0);
do
{
@@ -1560,20 +1543,4 @@ int my_mb_ctype_mb(CHARSET_INFO *cs, int *ctype,
}
-MY_COLLATION_HANDLER my_collation_mb_bin_handler =
-{
- NULL, /* init */
- my_strnncoll_mb_bin,
- my_strnncollsp_mb_bin,
- my_strnxfrm_mb,
- my_strnxfrmlen_simple,
- my_like_range_mb,
- my_wildcmp_mb_bin,
- my_strcasecmp_mb_bin,
- my_instr_mb,
- my_hash_sort_mb_bin,
- my_propagate_simple
-};
-
-
#endif
diff --git a/strings/ctype-mb.ic b/strings/ctype-mb.ic
index 55094535d5e..0ad945b685d 100644
--- a/strings/ctype-mb.ic
+++ b/strings/ctype-mb.ic
@@ -33,6 +33,7 @@
#define DEFINE_WELL_FORMED_LEN
#define DEFINE_WELL_FORMED_CHAR_LENGTH
#define DEFINE_CHARLEN
+#define DEFINE_NATIVE_TO_MB_VARLEN
#endif
@@ -256,3 +257,68 @@ MY_FUNCTION_NAME(well_formed_char_length)(CHARSET_INFO *cs __attribute__((unused
return nchars0 - nchars;
}
#endif /* DEFINE_WELL_FORMED_CHAR_LENGTH_USING_CHARLEN */
+
+
+#ifdef DEFINE_NATIVE_TO_MB_VARLEN
+/*
+ Write a native 2-byte character.
+ If the full character does not fit, only the first byte is written.
+*/
+static inline int
+my_native_to_mb_fixed2(my_wc_t wc, uchar *s, uchar *e)
+{
+ /* The caller must insure there is a space for at least one byte */
+ DBUG_ASSERT(s < e);
+ s[0]= wc >> 8;
+ if (s + 2 > e)
+ return MY_CS_TOOSMALL2;
+ s[1]= wc & 0xFF;
+ return 2;
+}
+
+
+/*
+ Write a native 3-byte character.
+ If the full character does not fit, only the leading bytes are written.
+*/
+static inline int
+my_native_to_mb_fixed3(my_wc_t wc, uchar *s, uchar *e)
+{
+ /* The caller must insure there is a space for at least one byte */
+ DBUG_ASSERT(s < e);
+ s[0]= wc >> 16;
+ if (s + 2 > e)
+ return MY_CS_TOOSMALL2;
+ s[1]= (wc >> 8) & 0xFF;
+ if (s + 3 > e)
+ return MY_CS_TOOSMALL3;
+ s[2]= wc & 0xFF;
+ return 3;
+}
+
+
+/*
+ Write a native 1-byte or 2-byte or 3-byte character.
+*/
+
+static int
+MY_FUNCTION_NAME(native_to_mb)(CHARSET_INFO *cs __attribute__((unused)),
+ my_wc_t wc, uchar *s, uchar *e)
+{
+ if (s >= e)
+ return MY_CS_TOOSMALL;
+ if ((int) wc <= 0xFF)
+ {
+ s[0]= (uchar) wc;
+ return 1;
+ }
+#ifdef IS_MB3_HEAD
+ if (wc > 0xFFFF)
+ return my_native_to_mb_fixed3(wc, s, e);
+#endif
+ return my_native_to_mb_fixed2(wc, s, e);
+}
+#endif /* DEFINE_NATIVE_TO_MB_VARLEN */
+
+
+#undef MY_FUNCTION_NAME
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index d7a1b3f33b4..288f5fdd49d 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -1303,7 +1303,28 @@ create_fromuni(struct charset_info_st *cs,
if (wc >= idx[i].uidx.from && wc <= idx[i].uidx.to && wc)
{
int ofs= wc - idx[i].uidx.from;
- tab[ofs]= ch;
+ if (!tab[ofs] || tab[ofs] > 0x7F) /* Prefer ASCII*/
+ {
+ /*
+ Some character sets can have double encoding. For example,
+ in ARMSCII8, the following characters are encoded twice:
+
+ Encoding#1 Encoding#2 Unicode Character Name
+ ---------- ---------- ------- --------------
+ 0x27 0xFF U+0027 APOSTROPHE
+ 0x28 0xA5 U+0028 LEFT PARENTHESIS
+ 0x29 0xA4 U+0029 RIGHT PARENTHESIS
+ 0x2C 0xAB U+002C COMMA
+ 0x2D 0xAC U+002D HYPHEN-MINUS
+ 0x2E 0xA9 U+002E FULL STOP
+
+ That is, both 0x27 and 0xFF convert to Unicode U+0027.
+ When converting back from Unicode to ARMSCII,
+ we prefer the ASCII range, that is we want U+0027
+ to convert to 0x27 rather than to 0xFF.
+ */
+ tab[ofs]= ch;
+ }
}
}
}
@@ -1598,7 +1619,10 @@ exp: /* [ E [ <sign> ] <unsigned integer> ] */
if ((negative_exp= (*str == '-')) || *str=='+')
{
if (++str == end)
+ {
+ str-= 2; /* 'e-' or 'e+' not followed by digits */
goto ret_sign;
+ }
}
for (exponent= 0 ;
str < end && (ch= (uchar) (*str - '0')) < 10;
@@ -1608,6 +1632,8 @@ exp: /* [ E [ <sign> ] <unsigned integer> ] */
}
shift+= negative_exp ? -exponent : exponent;
}
+ else
+ str--; /* 'e' not followed by digits */
}
if (shift == 0) /* No shift, check addon digit */
@@ -1929,6 +1955,7 @@ MY_CHARSET_HANDLER my_charset_8bit_handler=
my_charlen_8bit,
my_well_formed_char_length_8bit,
my_copy_8bit,
+ my_wc_mb_bin, /* native_to_mb */
};
MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler =
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index bbf0026cf2b..629e1cd8309 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -186,6 +186,7 @@ static const uchar sort_order_sjis[]=
#define MY_FUNCTION_NAME(x) my_ ## x ## _sjis
#define IS_8BIT_CHAR(x) issjiskata(x)
+#define IS_MB1_CHAR(x) ((uchar) (x) < 0x80 || issjiskata(x))
#define IS_MB2_CHAR(x,y) (issjishead(x) && issjistail(y))
#define DEFINE_ASIAN_ROUTINES
#include "ctype-mb.ic"
@@ -1088,90 +1089,6 @@ static MY_UNICASE_INFO my_caseinfo_sjis=
};
-static int my_strnncoll_sjis_internal(CHARSET_INFO *cs,
- const uchar **a_res, size_t a_length,
- const uchar **b_res, size_t b_length)
-{
- const uchar *a= *a_res, *b= *b_res;
- const uchar *a_end= a + a_length;
- const uchar *b_end= b + b_length;
- while (a < a_end && b < b_end)
- {
- if (ismbchar_sjis(cs,(char*) a, (char*) a_end) &&
- ismbchar_sjis(cs,(char*) b, (char*) b_end))
- {
- uint a_char= sjiscode(*a, *(a+1));
- uint b_char= sjiscode(*b, *(b+1));
- if (a_char != b_char)
- return (int) a_char - (int) b_char;
- a += 2;
- b += 2;
- } else
- {
- if (sort_order_sjis[(uchar)*a] != sort_order_sjis[(uchar)*b])
- return sort_order_sjis[(uchar)*a] - sort_order_sjis[(uchar)*b];
- a++;
- b++;
- }
- }
- *a_res= a;
- *b_res= b;
- return 0;
-}
-
-
-static int my_strnncoll_sjis(CHARSET_INFO *cs __attribute__((unused)),
- const uchar *a, size_t a_length,
- const uchar *b, size_t b_length,
- my_bool b_is_prefix)
-{
- int res= my_strnncoll_sjis_internal(cs, &a, a_length, &b, b_length);
- if (b_is_prefix && a_length > b_length)
- a_length= b_length;
- return res ? res : (int) (a_length - b_length);
-}
-
-
-static int my_strnncollsp_sjis(CHARSET_INFO *cs __attribute__((unused)),
- const uchar *a, size_t a_length,
- const uchar *b, size_t b_length,
- my_bool diff_if_only_endspace_difference)
-{
- const uchar *a_end= a + a_length, *b_end= b + b_length;
- int res= my_strnncoll_sjis_internal(cs, &a, a_length, &b, b_length);
-
-#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
- diff_if_only_endspace_difference= 0;
-#endif
-
- if (!res && (a != a_end || b != b_end))
- {
- int swap= 1;
- if (diff_if_only_endspace_difference)
- res= 1; /* Assume 'a' is bigger */
- /*
- Check the next not space character of the longer key. If it's < ' ',
- then it's smaller than the other key.
- */
- if (a == a_end)
- {
- /* put shorter key in a */
- a_end= b_end;
- a= b;
- swap= -1; /* swap sign of result */
- res= -res;
- }
- for (; a < a_end ; a++)
- {
- if (*a != ' ')
- return (*a < ' ') ? -swap : swap;
- }
- }
- return res;
-}
-
-
-
/* SJIS->Unicode conversion table */
static uint16 sjis_to_unicode[65536]=
{
@@ -34099,15 +34016,36 @@ size_t my_numcells_sjis(CHARSET_INFO *cs __attribute__((unused)),
}
-static MY_COLLATION_HANDLER my_collation_ci_handler =
+/*
+ sjis_chinese_ci and sjis_bin sort character blocks in this order:
+ 1. [00..7F] - 7BIT characters (ASCII)
+ 2. [81..9F][40..7E,80..FC] - MB2 characters, part1
+ 3. [A1..DF] - 8BIT characters (Kana)
+ 4. [E0..FC][40..7E,80..FC] - MB2 characters, part2
+*/
+#define MY_FUNCTION_NAME(x) my_ ## x ## _sjis_japanese_ci
+#define WEIGHT_PAD_SPACE (256 * (int) ' ')
+#define WEIGHT_MB1(x) (256 * (int) sort_order_sjis[(uchar) (x)])
+#define WEIGHT_MB2(x,y) (sjiscode(x, y))
+#include "strcoll.ic"
+
+
+#define MY_FUNCTION_NAME(x) my_ ## x ## _sjis_bin
+#define WEIGHT_PAD_SPACE (256 * (int) ' ')
+#define WEIGHT_MB1(x) (256 * (int) (uchar) (x))
+#define WEIGHT_MB2(x,y) (sjiscode(x, y))
+#include "strcoll.ic"
+
+
+static MY_COLLATION_HANDLER my_collation_handler_sjis_japanese_ci=
{
- NULL, /* init */
- my_strnncoll_sjis,
- my_strnncollsp_sjis,
+ NULL, /* init */
+ my_strnncoll_sjis_japanese_ci,
+ my_strnncollsp_sjis_japanese_ci,
my_strnxfrm_mb,
my_strnxfrmlen_simple,
my_like_range_mb,
- my_wildcmp_mb, /* wildcmp */
+ my_wildcmp_mb,
my_strcasecmp_8bit,
my_instr_mb,
my_hash_sort_simple,
@@ -34115,6 +34053,22 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
};
+static MY_COLLATION_HANDLER my_collation_handler_sjis_bin=
+{
+ NULL, /* init */
+ my_strnncoll_sjis_bin,
+ my_strnncollsp_sjis_bin,
+ my_strnxfrm_mb,
+ my_strnxfrmlen_simple,
+ my_like_range_mb,
+ my_wildcmp_mb_bin,
+ my_strcasecmp_mb_bin,
+ my_instr_mb,
+ my_hash_sort_mb_bin,
+ my_propagate_simple
+};
+
+
static MY_CHARSET_HANDLER my_charset_handler=
{
NULL, /* init */
@@ -34147,6 +34101,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_charlen_sjis,
my_well_formed_char_length_sjis,
my_copy_fix_mb,
+ my_native_to_mb_sjis,
};
@@ -34179,7 +34134,7 @@ struct charset_info_st my_charset_sjis_japanese_ci=
1, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
&my_charset_handler,
- &my_collation_ci_handler
+ &my_collation_handler_sjis_japanese_ci
};
struct charset_info_st my_charset_sjis_bin=
@@ -34211,7 +34166,7 @@ struct charset_info_st my_charset_sjis_bin=
1, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
&my_charset_handler,
- &my_collation_mb_bin_handler
+ &my_collation_handler_sjis_bin
};
#endif
diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c
index 6537b380ab3..a1ca320835d 100644
--- a/strings/ctype-tis620.c
+++ b/strings/ctype-tis620.c
@@ -889,6 +889,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_charlen_8bit,
my_well_formed_char_length_8bit,
my_copy_8bit,
+ my_wc_mb_bin, /* native_to_mb */
};
@@ -896,7 +897,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
struct charset_info_st my_charset_tis620_thai_ci=
{
18,0,0, /* number */
- MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */
+ MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM|MY_CS_NON1TO1, /* state */
"tis620", /* cs name */
"tis620_thai_ci", /* name */
"", /* comment */
diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c
index 60bd96e499d..b0728978e71 100644
--- a/strings/ctype-uca.c
+++ b/strings/ctype-uca.c
@@ -35,6 +35,8 @@
#include "strings_def.h"
#include <m_ctype.h>
+#define MY_CS_COMMON_UCA_FLAGS (MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NON1TO1)
+
#define MY_UCA_CNT_FLAG_SIZE 4096
#define MY_UCA_CNT_FLAG_MASK 4095
#define MY_UCA_CNT_HEAD 1
@@ -22926,10 +22928,12 @@ MY_COLLATION_HANDLER my_collation_ucs2_uca_handler =
my_propagate_complex
};
+#define MY_CS_UCS2_UCA_FLAGS (MY_CS_COMMON_UCA_FLAGS|MY_CS_NONASCII)
+
struct charset_info_st my_charset_ucs2_unicode_ci=
{
128,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* cs name */
"ucs2_unicode_ci", /* name */
"", /* comment */
@@ -22961,7 +22965,7 @@ struct charset_info_st my_charset_ucs2_unicode_ci=
struct charset_info_st my_charset_ucs2_icelandic_uca_ci=
{
129,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* cs name */
"ucs2_icelandic_ci",/* name */
"", /* comment */
@@ -22993,7 +22997,7 @@ struct charset_info_st my_charset_ucs2_icelandic_uca_ci=
struct charset_info_st my_charset_ucs2_latvian_uca_ci=
{
130,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* cs name */
"ucs2_latvian_ci", /* name */
"", /* comment */
@@ -23025,7 +23029,7 @@ struct charset_info_st my_charset_ucs2_latvian_uca_ci=
struct charset_info_st my_charset_ucs2_romanian_uca_ci=
{
131,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* cs name */
"ucs2_romanian_ci", /* name */
"", /* comment */
@@ -23057,7 +23061,7 @@ struct charset_info_st my_charset_ucs2_romanian_uca_ci=
struct charset_info_st my_charset_ucs2_slovenian_uca_ci=
{
132,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* cs name */
"ucs2_slovenian_ci",/* name */
"", /* comment */
@@ -23089,7 +23093,7 @@ struct charset_info_st my_charset_ucs2_slovenian_uca_ci=
struct charset_info_st my_charset_ucs2_polish_uca_ci=
{
133,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* cs name */
"ucs2_polish_ci", /* name */
"", /* comment */
@@ -23121,7 +23125,7 @@ struct charset_info_st my_charset_ucs2_polish_uca_ci=
struct charset_info_st my_charset_ucs2_estonian_uca_ci=
{
134,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* cs name */
"ucs2_estonian_ci", /* name */
"", /* comment */
@@ -23153,7 +23157,7 @@ struct charset_info_st my_charset_ucs2_estonian_uca_ci=
struct charset_info_st my_charset_ucs2_spanish_uca_ci=
{
135,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* cs name */
"ucs2_spanish_ci", /* name */
"", /* comment */
@@ -23185,7 +23189,7 @@ struct charset_info_st my_charset_ucs2_spanish_uca_ci=
struct charset_info_st my_charset_ucs2_swedish_uca_ci=
{
136,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* cs name */
"ucs2_swedish_ci", /* name */
"", /* comment */
@@ -23217,7 +23221,7 @@ struct charset_info_st my_charset_ucs2_swedish_uca_ci=
struct charset_info_st my_charset_ucs2_turkish_uca_ci=
{
137,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* cs name */
"ucs2_turkish_ci", /* name */
"", /* comment */
@@ -23249,7 +23253,7 @@ struct charset_info_st my_charset_ucs2_turkish_uca_ci=
struct charset_info_st my_charset_ucs2_czech_uca_ci=
{
138,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* cs name */
"ucs2_czech_ci", /* name */
"", /* comment */
@@ -23282,7 +23286,7 @@ struct charset_info_st my_charset_ucs2_czech_uca_ci=
struct charset_info_st my_charset_ucs2_danish_uca_ci=
{
139,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* cs name */
"ucs2_danish_ci", /* name */
"", /* comment */
@@ -23314,7 +23318,7 @@ struct charset_info_st my_charset_ucs2_danish_uca_ci=
struct charset_info_st my_charset_ucs2_lithuanian_uca_ci=
{
140,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* cs name */
"ucs2_lithuanian_ci",/* name */
"", /* comment */
@@ -23346,7 +23350,7 @@ struct charset_info_st my_charset_ucs2_lithuanian_uca_ci=
struct charset_info_st my_charset_ucs2_slovak_uca_ci=
{
141,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* cs name */
"ucs2_slovak_ci", /* name */
"", /* comment */
@@ -23378,7 +23382,7 @@ struct charset_info_st my_charset_ucs2_slovak_uca_ci=
struct charset_info_st my_charset_ucs2_spanish2_uca_ci=
{
142,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* cs name */
"ucs2_spanish2_ci", /* name */
"", /* comment */
@@ -23411,7 +23415,7 @@ struct charset_info_st my_charset_ucs2_spanish2_uca_ci=
struct charset_info_st my_charset_ucs2_roman_uca_ci=
{
143,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* cs name */
"ucs2_roman_ci", /* name */
"", /* comment */
@@ -23444,7 +23448,7 @@ struct charset_info_st my_charset_ucs2_roman_uca_ci=
struct charset_info_st my_charset_ucs2_persian_uca_ci=
{
144,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* cs name */
"ucs2_persian_ci", /* name */
"", /* comment */
@@ -23477,7 +23481,7 @@ struct charset_info_st my_charset_ucs2_persian_uca_ci=
struct charset_info_st my_charset_ucs2_esperanto_uca_ci=
{
145,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* cs name */
"ucs2_esperanto_ci",/* name */
"", /* comment */
@@ -23510,7 +23514,7 @@ struct charset_info_st my_charset_ucs2_esperanto_uca_ci=
struct charset_info_st my_charset_ucs2_hungarian_uca_ci=
{
146,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* cs name */
"ucs2_hungarian_ci",/* name */
"", /* comment */
@@ -23542,7 +23546,7 @@ struct charset_info_st my_charset_ucs2_hungarian_uca_ci=
struct charset_info_st my_charset_ucs2_sinhala_uca_ci=
{
147,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* csname */
"ucs2_sinhala_ci", /* name */
"", /* comment */
@@ -23576,7 +23580,7 @@ struct charset_info_st my_charset_ucs2_sinhala_uca_ci=
struct charset_info_st my_charset_ucs2_german2_uca_ci=
{
148,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* csname */
"ucs2_german2_ci", /* name */
"", /* comment */
@@ -23608,7 +23612,7 @@ struct charset_info_st my_charset_ucs2_german2_uca_ci=
struct charset_info_st my_charset_ucs2_croatian_mysql561_uca_ci=
{
149,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* cs name */
"ucs2_croatian_mysql561_ci", /* name */
"", /* comment */
@@ -23641,7 +23645,7 @@ struct charset_info_st my_charset_ucs2_croatian_mysql561_uca_ci=
struct charset_info_st my_charset_ucs2_croatian_uca_ci=
{
MY_PAGE2_COLLATION_ID_UCS2,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* cs name */
"ucs2_croatian_ci", /* name */
"", /* comment */
@@ -23674,7 +23678,7 @@ struct charset_info_st my_charset_ucs2_croatian_uca_ci=
struct charset_info_st my_charset_ucs2_myanmar_uca_ci=
{
MY_PAGE2_COLLATION_ID_UCS2+1,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* cs name */
"ucs2_myanmar_ci", /* name */
"", /* comment */
@@ -23707,7 +23711,7 @@ struct charset_info_st my_charset_ucs2_myanmar_uca_ci=
struct charset_info_st my_charset_ucs2_unicode_520_ci=
{
150,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* cs name */
"ucs2_unicode_520_ci",/* name */
"", /* comment */
@@ -23740,7 +23744,7 @@ struct charset_info_st my_charset_ucs2_unicode_520_ci=
struct charset_info_st my_charset_ucs2_vietnamese_ci=
{
151,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* csname */
"ucs2_vietnamese_ci",/* name */
"", /* comment */
@@ -23817,7 +23821,7 @@ static uchar ctype_utf8[] = {
extern MY_CHARSET_HANDLER my_charset_utf8_handler;
-#define MY_CS_UTF8MB3_UCA_FLAGS (MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE)
+#define MY_CS_UTF8MB3_UCA_FLAGS MY_CS_COMMON_UCA_FLAGS
struct charset_info_st my_charset_utf8_unicode_ci=
{
@@ -24666,7 +24670,7 @@ struct charset_info_st my_charset_utf8_vietnamese_ci=
extern MY_CHARSET_HANDLER my_charset_utf8mb4_handler;
-#define MY_CS_UTF8MB4_UCA_FLAGS (MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_UNICODE_SUPPLEMENT)
+#define MY_CS_UTF8MB4_UCA_FLAGS (MY_CS_COMMON_UCA_FLAGS|MY_CS_UNICODE_SUPPLEMENT)
struct charset_info_st my_charset_utf8mb4_unicode_ci=
{
@@ -25529,7 +25533,7 @@ MY_COLLATION_HANDLER my_collation_utf32_uca_handler =
extern MY_CHARSET_HANDLER my_charset_utf32_handler;
-#define MY_CS_UTF32_UCA_FLAGS (MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII)
+#define MY_CS_UTF32_UCA_FLAGS (MY_CS_COMMON_UCA_FLAGS|MY_CS_NONASCII)
struct charset_info_st my_charset_utf32_unicode_ci=
{
@@ -26392,7 +26396,7 @@ MY_COLLATION_HANDLER my_collation_utf16_uca_handler =
extern MY_CHARSET_HANDLER my_charset_utf16_handler;
-#define MY_CS_UTF16_UCA_FLAGS (MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII)
+#define MY_CS_UTF16_UCA_FLAGS (MY_CS_COMMON_UCA_FLAGS|MY_CS_NONASCII)
struct charset_info_st my_charset_utf16_unicode_ci=
{
@@ -27171,7 +27175,7 @@ struct charset_info_st my_charset_utf16_myanmar_uca_ci=
struct charset_info_st my_charset_utf16_unicode_520_ci=
{
123,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII,
+ MY_CS_UTF16_UCA_FLAGS,/* state */
"utf16", /* csname */
"utf16_unicode_520_ci",/* name */
"", /* comment */
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index d1441a4d3a5..e7ba5cbc3c3 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -1186,11 +1186,14 @@ my_lengthsp_mb2(CHARSET_INFO *cs __attribute__((unused)),
#define MY_UTF16_SURROGATE_LOW_FIRST 0xDC00
#define MY_UTF16_SURROGATE_LOW_LAST 0xDFFF
-#define MY_UTF16_HIGH_HEAD(x) ((((uchar) (x)) & 0xFC) == 0xD8)
-#define MY_UTF16_LOW_HEAD(x) ((((uchar) (x)) & 0xFC) == 0xDC)
-#define MY_UTF16_SURROGATE(x) (((x) & 0xF800) == 0xD800)
+#define MY_UTF16_HIGH_HEAD(x) ((((uchar) (x)) & 0xFC) == 0xD8)
+#define MY_UTF16_LOW_HEAD(x) ((((uchar) (x)) & 0xFC) == 0xDC)
+/* Test if a byte is a leading byte of a high or low surrogate head: */
+#define MY_UTF16_SURROGATE_HEAD(x) ((((uchar) (x)) & 0xF8) == 0xD8)
+/* Test if a Unicode code point is a high or low surrogate head */
+#define MY_UTF16_SURROGATE(x) (((x) & 0xF800) == 0xD800)
-#define MY_UTF16_WC2(a, b) ((a << 8) + b)
+#define MY_UTF16_WC2(a, b) ((a << 8) + b)
/*
a= 110110?? (<< 18)
@@ -1201,6 +1204,30 @@ my_lengthsp_mb2(CHARSET_INFO *cs __attribute__((unused)),
#define MY_UTF16_WC4(a, b, c, d) (((a & 3) << 18) + (b << 10) + \
((c & 3) << 8) + d + 0x10000)
+#define IS_MB2_CHAR(b0,b1) (!MY_UTF16_SURROGATE_HEAD(b0))
+#define IS_MB4_CHAR(b0,b1,b2,b3) (MY_UTF16_HIGH_HEAD(b0) && MY_UTF16_LOW_HEAD(b2))
+
+static inline int my_weight_mb2_utf16mb2_general_ci(uchar b0, uchar b1)
+{
+ my_wc_t wc= MY_UTF16_WC2(b0, b1);
+ MY_UNICASE_CHARACTER *page= my_unicase_default.page[wc >> 8];
+ return (int) (page ? page[wc & 0xFF].sort : wc);
+}
+#define MY_FUNCTION_NAME(x) my_ ## x ## _utf16_general_ci
+#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x))
+#define WEIGHT_MB2(b0,b1) my_weight_mb2_utf16mb2_general_ci(b0,b1)
+#define WEIGHT_MB4(b0,b1,b2,b3) MY_CS_REPLACEMENT_CHARACTER
+#include "strcoll.ic"
+
+#define MY_FUNCTION_NAME(x) my_ ## x ## _utf16_bin
+#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x))
+#define WEIGHT_MB2(b0,b1) ((int) MY_UTF16_WC2(b0, b1))
+#define WEIGHT_MB4(b0,b1,b2,b3) ((int) MY_UTF16_WC4(b0, b1, b2, b3))
+#include "strcoll.ic"
+
+#undef IS_MB2_CHAR
+#undef IS_MB4_CHAR
+
static int
my_utf16_uni(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc, const uchar *s, const uchar *e)
@@ -1371,146 +1398,6 @@ my_casedn_utf16(CHARSET_INFO *cs, char *src, size_t srclen,
}
-static int
-my_strnncoll_utf16(CHARSET_INFO *cs,
- const uchar *s, size_t slen,
- const uchar *t, size_t tlen,
- my_bool t_is_prefix)
-{
- int s_res, t_res;
- my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
- my_charset_conv_mb_wc mb_wc= cs->cset->mb_wc;
- const uchar *se= s + slen;
- const uchar *te= t + tlen;
- MY_UNICASE_INFO *uni_plane= cs->caseinfo;
-
- while (s < se && t < te)
- {
- s_res= mb_wc(cs, &s_wc, s, se);
- t_res= mb_wc(cs, &t_wc, t, te);
-
- if (s_res <= 0 || t_res <= 0)
- {
- /* Incorrect string, compare by char value */
- return my_bincmp(s, se, t, te);
- }
-
- my_tosort_utf16(uni_plane, &s_wc);
- my_tosort_utf16(uni_plane, &t_wc);
-
- if (s_wc != t_wc)
- {
- return s_wc > t_wc ? 1 : -1;
- }
-
- s+= s_res;
- t+= t_res;
- }
- return (int) (t_is_prefix ? (t - te) : ((se - s) - (te - t)));
-}
-
-
-/**
- Compare strings, discarding end space
-
- If one string is shorter as the other, then we space extend the other
- so that the strings have equal length.
-
- This will ensure that the following things hold:
-
- "a" == "a "
- "a\0" < "a"
- "a\0" < "a "
-
- @param cs Character set pinter.
- @param a First string to compare.
- @param a_length Length of 'a'.
- @param b Second string to compare.
- @param b_length Length of 'b'.
-
- IMPLEMENTATION
-
- @return Comparison result.
- @retval Negative number, if a less than b.
- @retval 0, if a is equal to b
- @retval Positive number, if a > b
-*/
-
-static int
-my_strnncollsp_utf16(CHARSET_INFO *cs,
- const uchar *s, size_t slen,
- const uchar *t, size_t tlen,
- my_bool diff_if_only_endspace_difference)
-{
- int res;
- my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
- my_charset_conv_mb_wc mb_wc= cs->cset->mb_wc;
- const uchar *se= s + slen, *te= t + tlen;
- MY_UNICASE_INFO *uni_plane= cs->caseinfo;
-
- DBUG_ASSERT((slen % 2) == 0);
- DBUG_ASSERT((tlen % 2) == 0);
-
-#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
- diff_if_only_endspace_difference= FALSE;
-#endif
-
- while (s < se && t < te)
- {
- int s_res= mb_wc(cs, &s_wc, s, se);
- int t_res= mb_wc(cs, &t_wc, t, te);
-
- if (s_res <= 0 || t_res <= 0)
- {
- /* Incorrect string, compare bytewise */
- return my_bincmp(s, se, t, te);
- }
-
- my_tosort_utf16(uni_plane, &s_wc);
- my_tosort_utf16(uni_plane, &t_wc);
-
- if (s_wc != t_wc)
- {
- return s_wc > t_wc ? 1 : -1;
- }
-
- s+= s_res;
- t+= t_res;
- }
-
- slen= (size_t) (se - s);
- tlen= (size_t) (te - t);
- res= 0;
-
- if (slen != tlen)
- {
- int s_res, swap= 1;
- if (diff_if_only_endspace_difference)
- res= 1; /* Assume 's' is bigger */
- if (slen < tlen)
- {
- slen= tlen;
- s= t;
- se= te;
- swap= -1;
- res= -res;
- }
-
- for ( ; s < se; s+= s_res)
- {
- if ((s_res= mb_wc(cs, &s_wc, s, se)) < 0)
- {
- DBUG_ASSERT(0);
- return 0;
- }
- if (s_wc != ' ')
- return (s_wc < ' ') ? -swap : swap;
- }
- }
- return res;
-}
-
-
static uint
my_ismbchar_utf16(CHARSET_INFO *cs, const char *b, const char *e)
{
@@ -1623,111 +1510,6 @@ my_wildcmp_utf16_bin(CHARSET_INFO *cs,
}
-static int
-my_strnncoll_utf16_bin(CHARSET_INFO *cs,
- const uchar *s, size_t slen,
- const uchar *t, size_t tlen,
- my_bool t_is_prefix)
-{
- int s_res,t_res;
- my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
- my_charset_conv_mb_wc mb_wc= cs->cset->mb_wc;
- const uchar *se=s+slen;
- const uchar *te=t+tlen;
-
- while ( s < se && t < te )
- {
- s_res= mb_wc(cs, &s_wc, s, se);
- t_res= mb_wc(cs, &t_wc, t, te);
-
- if (s_res <= 0 || t_res <= 0)
- {
- /* Incorrect string, compare by char value */
- return my_bincmp(s, se, t, te);
- }
- if (s_wc != t_wc)
- {
- return s_wc > t_wc ? 1 : -1;
- }
-
- s+= s_res;
- t+= t_res;
- }
- return (int) (t_is_prefix ? (t - te) : ((se - s) - (te - t)));
-}
-
-
-static int
-my_strnncollsp_utf16_bin(CHARSET_INFO *cs,
- const uchar *s, size_t slen,
- const uchar *t, size_t tlen,
- my_bool diff_if_only_endspace_difference)
-{
- int res;
- my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
- my_charset_conv_mb_wc mb_wc= cs->cset->mb_wc;
- const uchar *se= s + slen, *te= t + tlen;
-
- DBUG_ASSERT((slen % 2) == 0);
- DBUG_ASSERT((tlen % 2) == 0);
-
-#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
- diff_if_only_endspace_difference= FALSE;
-#endif
-
- while (s < se && t < te)
- {
- int s_res= mb_wc(cs, &s_wc, s, se);
- int t_res= mb_wc(cs, &t_wc, t, te);
-
- if (s_res <= 0 || t_res <= 0)
- {
- /* Incorrect string, compare bytewise */
- return my_bincmp(s, se, t, te);
- }
-
- if (s_wc != t_wc)
- {
- return s_wc > t_wc ? 1 : -1;
- }
-
- s+= s_res;
- t+= t_res;
- }
-
- slen= (size_t) (se - s);
- tlen= (size_t) (te - t);
- res= 0;
-
- if (slen != tlen)
- {
- int s_res, swap= 1;
- if (diff_if_only_endspace_difference)
- res= 1; /* Assume 's' is bigger */
- if (slen < tlen)
- {
- slen= tlen;
- s= t;
- se= te;
- swap= -1;
- res= -res;
- }
-
- for ( ; s < se; s+= s_res)
- {
- if ((s_res= mb_wc(cs, &s_wc, s, se)) < 0)
- {
- DBUG_ASSERT(0);
- return 0;
- }
- if (s_wc != ' ')
- return (s_wc < ' ') ? -swap : swap;
- }
- }
- return res;
-}
-
-
static void
my_hash_sort_utf16_bin(CHARSET_INFO *cs,
const uchar *pos, size_t len, ulong *nr1, ulong *nr2)
@@ -1747,8 +1529,8 @@ my_hash_sort_utf16_bin(CHARSET_INFO *cs,
static MY_COLLATION_HANDLER my_collation_utf16_general_ci_handler =
{
NULL, /* init */
- my_strnncoll_utf16,
- my_strnncollsp_utf16,
+ my_strnncoll_utf16_general_ci,
+ my_strnncollsp_utf16_general_ci,
my_strnxfrm_unicode,
my_strnxfrmlen_unicode,
my_like_range_generic,
@@ -1808,6 +1590,7 @@ MY_CHARSET_HANDLER my_charset_utf16_handler=
my_charlen_utf16,
my_well_formed_char_length_utf16,
my_copy_fix_mb2_or_mb4,
+ my_uni_utf16,
};
@@ -1877,6 +1660,24 @@ struct charset_info_st my_charset_utf16_bin=
};
+#define IS_MB2_CHAR(b0,b1) (!MY_UTF16_SURROGATE_HEAD(b1))
+#define IS_MB4_CHAR(b0,b1,b2,b3) (MY_UTF16_HIGH_HEAD(b1) && MY_UTF16_LOW_HEAD(b3))
+
+#define MY_FUNCTION_NAME(x) my_ ## x ## _utf16le_general_ci
+#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x))
+#define WEIGHT_MB2(b0,b1) my_weight_mb2_utf16mb2_general_ci(b1,b0)
+#define WEIGHT_MB4(b0,b1,b2,b3) MY_CS_REPLACEMENT_CHARACTER
+#include "strcoll.ic"
+
+#define MY_FUNCTION_NAME(x) my_ ## x ## _utf16le_bin
+#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x))
+#define WEIGHT_MB2(b0,b1) ((int) MY_UTF16_WC2(b1, b0))
+#define WEIGHT_MB4(b0,b1,b2,b3) ((int) MY_UTF16_WC4(b1, b0, b3, b2))
+#include "strcoll.ic"
+
+#undef IS_MB2_CHAR
+#undef IS_MB4_CHAR
+
static int
my_utf16le_uni(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc, const uchar *s, const uchar *e)
@@ -1948,6 +1749,38 @@ my_lengthsp_utf16le(CHARSET_INFO *cs __attribute__((unused)),
}
+static MY_COLLATION_HANDLER my_collation_utf16le_general_ci_handler =
+{
+ NULL, /* init */
+ my_strnncoll_utf16le_general_ci,
+ my_strnncollsp_utf16le_general_ci,
+ my_strnxfrm_unicode,
+ my_strnxfrmlen_unicode,
+ my_like_range_generic,
+ my_wildcmp_utf16_ci,
+ my_strcasecmp_mb2_or_mb4,
+ my_instr_mb,
+ my_hash_sort_utf16,
+ my_propagate_simple
+};
+
+
+static MY_COLLATION_HANDLER my_collation_utf16le_bin_handler =
+{
+ NULL, /* init */
+ my_strnncoll_utf16le_bin,
+ my_strnncollsp_utf16le_bin,
+ my_strnxfrm_unicode_full_bin,
+ my_strnxfrmlen_unicode_full_bin,
+ my_like_range_generic,
+ my_wildcmp_utf16_bin,
+ my_strcasecmp_mb2_or_mb4,
+ my_instr_mb,
+ my_hash_sort_utf16_bin,
+ my_propagate_simple
+};
+
+
static MY_CHARSET_HANDLER my_charset_utf16le_handler=
{
NULL, /* init */
@@ -1980,6 +1813,7 @@ static MY_CHARSET_HANDLER my_charset_utf16le_handler=
my_charlen_utf16,
my_well_formed_char_length_utf16,
my_copy_fix_mb2_or_mb4,
+ my_uni_utf16le,
};
@@ -2012,7 +1846,7 @@ struct charset_info_st my_charset_utf16le_general_ci=
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
&my_charset_utf16le_handler,
- &my_collation_utf16_general_ci_handler
+ &my_collation_utf16le_general_ci_handler
};
@@ -2045,7 +1879,7 @@ struct charset_info_st my_charset_utf16le_bin=
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
&my_charset_utf16le_handler,
- &my_collation_utf16_bin_handler
+ &my_collation_utf16le_bin_handler
};
@@ -2060,6 +1894,34 @@ struct charset_info_st my_charset_utf16le_bin=
*/
#define IS_UTF32_MBHEAD4(b0,b1) (!(b0) && ((uchar) (b1) <= 0x10))
+#define IS_MB4_CHAR(b0,b1,b2,b3) (IS_UTF32_MBHEAD4(b0,b1))
+
+#define MY_UTF32_WC4(b0,b1,b2,b3) ((b0 << 24) + (b1 << 16) + (b2 << 8) + (b3))
+
+static inline int my_weight_utf32_general_ci(uchar b0, uchar b1,
+ uchar b2, uchar b3)
+{
+ my_wc_t wc= MY_UTF32_WC4(b0, b1, b2, b3);
+ if (wc <= 0xFFFF)
+ {
+ MY_UNICASE_CHARACTER *page= my_unicase_default.page[wc >> 8];
+ return (int) (page ? page[wc & 0xFF].sort : wc);
+ }
+ return MY_CS_REPLACEMENT_CHARACTER;
+}
+#define MY_FUNCTION_NAME(x) my_ ## x ## _utf32_general_ci
+#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x))
+#define WEIGHT_MB4(b0,b1,b2,b3) my_weight_utf32_general_ci(b0, b1, b2, b3)
+#include "strcoll.ic"
+
+#define MY_FUNCTION_NAME(x) my_ ## x ## _utf32_bin
+#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x))
+#define WEIGHT_MB4(b0,b1,b2,b3) ((int) MY_UTF32_WC4(b0, b1, b2, b3))
+#include "strcoll.ic"
+
+#undef IS_MB2_CHAR
+#undef IS_MB4_CHAR
+
static int
my_utf32_uni(CHARSET_INFO *cs __attribute__((unused)),
@@ -2067,7 +1929,7 @@ my_utf32_uni(CHARSET_INFO *cs __attribute__((unused)),
{
if (s + 4 > e)
return MY_CS_TOOSMALL4;
- *pwc= (s[0] << 24) + (s[1] << 16) + (s[2] << 8) + (s[3]);
+ *pwc= MY_UTF32_WC4(s[0], s[1], s[2], s[3]);
return *pwc > 0x10FFFF ? MY_CS_ILSEQ : 4;
}
@@ -2197,144 +2059,6 @@ my_casedn_utf32(CHARSET_INFO *cs, char *src, size_t srclen,
}
-static int
-my_strnncoll_utf32(CHARSET_INFO *cs,
- const uchar *s, size_t slen,
- const uchar *t, size_t tlen,
- my_bool t_is_prefix)
-{
- my_wc_t UNINIT_VAR(s_wc),UNINIT_VAR(t_wc);
- const uchar *se= s + slen;
- const uchar *te= t + tlen;
- MY_UNICASE_INFO *uni_plane= cs->caseinfo;
-
- while (s < se && t < te)
- {
- int s_res= my_utf32_uni(cs, &s_wc, s, se);
- int t_res= my_utf32_uni(cs, &t_wc, t, te);
-
- if ( s_res <= 0 || t_res <= 0)
- {
- /* Incorrect string, compare by char value */
- return my_bincmp(s, se, t, te);
- }
-
- my_tosort_utf32(uni_plane, &s_wc);
- my_tosort_utf32(uni_plane, &t_wc);
-
- if (s_wc != t_wc)
- {
- return s_wc > t_wc ? 1 : -1;
- }
-
- s+= s_res;
- t+= t_res;
- }
- return (int) (t_is_prefix ? (t - te) : ((se - s) - (te - t)));
-}
-
-
-/**
- Compare strings, discarding end space
-
- If one string is shorter as the other, then we space extend the other
- so that the strings have equal length.
-
- This will ensure that the following things hold:
-
- "a" == "a "
- "a\0" < "a"
- "a\0" < "a "
-
- @param cs Character set pinter.
- @param a First string to compare.
- @param a_length Length of 'a'.
- @param b Second string to compare.
- @param b_length Length of 'b'.
-
- IMPLEMENTATION
-
- @return Comparison result.
- @retval Negative number, if a less than b.
- @retval 0, if a is equal to b
- @retval Positive number, if a > b
-*/
-
-
-static int
-my_strnncollsp_utf32(CHARSET_INFO *cs,
- const uchar *s, size_t slen,
- const uchar *t, size_t tlen,
- my_bool diff_if_only_endspace_difference)
-{
- int res;
- my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
- const uchar *se= s + slen, *te= t + tlen;
- MY_UNICASE_INFO *uni_plane= cs->caseinfo;
-
- DBUG_ASSERT((slen % 4) == 0);
- DBUG_ASSERT((tlen % 4) == 0);
-
-#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
- diff_if_only_endspace_difference= FALSE;
-#endif
-
- while ( s < se && t < te )
- {
- int s_res= my_utf32_uni(cs, &s_wc, s, se);
- int t_res= my_utf32_uni(cs, &t_wc, t, te);
-
- if ( s_res <= 0 || t_res <= 0 )
- {
- /* Incorrect string, compare bytewise */
- return my_bincmp(s, se, t, te);
- }
-
- my_tosort_utf32(uni_plane, &s_wc);
- my_tosort_utf32(uni_plane, &t_wc);
-
- if ( s_wc != t_wc )
- {
- return s_wc > t_wc ? 1 : -1;
- }
-
- s+= s_res;
- t+= t_res;
- }
-
- slen= (size_t) (se - s);
- tlen= (size_t) (te - t);
- res= 0;
-
- if (slen != tlen)
- {
- int s_res, swap= 1;
- if (diff_if_only_endspace_difference)
- res= 1; /* Assume 's' is bigger */
- if (slen < tlen)
- {
- slen= tlen;
- s= t;
- se= te;
- swap= -1;
- res= -res;
- }
-
- for ( ; s < se; s+= s_res)
- {
- if ((s_res= my_utf32_uni(cs, &s_wc, s, se)) < 0)
- {
- DBUG_ASSERT(0);
- return 0;
- }
- if (s_wc != ' ')
- return (s_wc < ' ') ? -swap : swap;
- }
- }
- return res;
-}
-
-
static uint
my_ismbchar_utf32(CHARSET_INFO *cs __attribute__((unused)),
const char *b,
@@ -2746,97 +2470,6 @@ my_wildcmp_utf32_bin(CHARSET_INFO *cs,
}
-static int
-my_strnncoll_utf32_bin(CHARSET_INFO *cs,
- const uchar *s, size_t slen,
- const uchar *t, size_t tlen,
- my_bool t_is_prefix)
-{
- my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
- const uchar *se= s + slen;
- const uchar *te= t + tlen;
-
- while (s < se && t < te)
- {
- int s_res= my_utf32_uni(cs, &s_wc, s, se);
- int t_res= my_utf32_uni(cs, &t_wc, t, te);
-
- if (s_res <= 0 || t_res <= 0)
- {
- /* Incorrect string, compare by char value */
- return my_bincmp(s, se, t, te);
- }
- if (s_wc != t_wc)
- {
- return s_wc > t_wc ? 1 : -1;
- }
-
- s+= s_res;
- t+= t_res;
- }
- return (int) (t_is_prefix ? (t-te) : ((se - s) - (te - t)));
-}
-
-
-static inline my_wc_t
-my_utf32_get(const uchar *s)
-{
- return
- ((my_wc_t) s[0] << 24) +
- ((my_wc_t) s[1] << 16) +
- ((my_wc_t) s[2] << 8) +
- s[3];
-}
-
-
-static int
-my_strnncollsp_utf32_bin(CHARSET_INFO *cs __attribute__((unused)),
- const uchar *s, size_t slen,
- const uchar *t, size_t tlen,
- my_bool diff_if_only_endspace_difference
- __attribute__((unused)))
-{
- const uchar *se, *te;
- size_t minlen;
-
- DBUG_ASSERT((slen % 4) == 0);
- DBUG_ASSERT((tlen % 4) == 0);
-
- se= s + slen;
- te= t + tlen;
-
- for (minlen= MY_MIN(slen, tlen); minlen; minlen-= 4)
- {
- my_wc_t s_wc= my_utf32_get(s);
- my_wc_t t_wc= my_utf32_get(t);
- if (s_wc != t_wc)
- return s_wc > t_wc ? 1 : -1;
-
- s+= 4;
- t+= 4;
- }
-
- if (slen != tlen)
- {
- int swap= 1;
- if (slen < tlen)
- {
- s= t;
- se= te;
- swap= -1;
- }
-
- for ( ; s < se ; s+= 4)
- {
- my_wc_t s_wc= my_utf32_get(s);
- if (s_wc != ' ')
- return (s_wc < ' ') ? -swap : swap;
- }
- }
- return 0;
-}
-
-
static size_t
my_scan_utf32(CHARSET_INFO *cs,
const char *str, const char *end, int sequence_type)
@@ -2864,8 +2497,8 @@ my_scan_utf32(CHARSET_INFO *cs,
static MY_COLLATION_HANDLER my_collation_utf32_general_ci_handler =
{
NULL, /* init */
- my_strnncoll_utf32,
- my_strnncollsp_utf32,
+ my_strnncoll_utf32_general_ci,
+ my_strnncollsp_utf32_general_ci,
my_strnxfrm_unicode,
my_strnxfrmlen_unicode,
my_like_range_generic,
@@ -2925,6 +2558,7 @@ MY_CHARSET_HANDLER my_charset_utf32_handler=
my_charlen_utf32,
my_well_formed_char_length_utf32,
my_copy_fix_mb2_or_mb4,
+ my_uni_utf32,
};
@@ -3058,6 +2692,31 @@ static const uchar to_upper_ucs2[] = {
};
+/* Definitions for strcoll.ic */
+#define IS_MB2_CHAR(x,y) (1)
+#define UCS2_CODE(b0,b1) (((uchar) b0) << 8 | ((uchar) b1))
+
+
+static inline int my_weight_mb2_ucs2_general_ci(uchar b0, uchar b1)
+{
+ my_wc_t wc= UCS2_CODE(b0, b1);
+ MY_UNICASE_CHARACTER *page= my_unicase_default.page[wc >> 8];
+ return (int) (page ? page[wc & 0xFF].sort : wc);
+}
+
+
+#define MY_FUNCTION_NAME(x) my_ ## x ## _ucs2_general_ci
+#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x))
+#define WEIGHT_MB2(b0,b1) my_weight_mb2_ucs2_general_ci(b0,b1)
+#include "strcoll.ic"
+
+
+#define MY_FUNCTION_NAME(x) my_ ## x ## _ucs2_bin
+#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x))
+#define WEIGHT_MB2(b0,b1) UCS2_CODE(b0,b1)
+#include "strcoll.ic"
+
+
static int
my_charlen_ucs2(CHARSET_INFO *cs __attribute__((unused)),
const uchar *s, const uchar *e)
@@ -3208,120 +2867,6 @@ my_fill_ucs2(CHARSET_INFO *cs __attribute__((unused)),
}
-static int my_strnncoll_ucs2(CHARSET_INFO *cs,
- const uchar *s, size_t slen,
- const uchar *t, size_t tlen,
- my_bool t_is_prefix)
-{
- int s_res,t_res;
- my_wc_t UNINIT_VAR(s_wc),UNINIT_VAR(t_wc);
- const uchar *se=s+slen;
- const uchar *te=t+tlen;
- MY_UNICASE_INFO *uni_plane= cs->caseinfo;
-
- while ( s < se && t < te )
- {
- s_res=my_ucs2_uni(cs,&s_wc, s, se);
- t_res=my_ucs2_uni(cs,&t_wc, t, te);
-
- if ( s_res <= 0 || t_res <= 0 )
- {
- /* Incorrect string, compare by char value */
- return ((int)s[0]-(int)t[0]);
- }
-
- my_tosort_ucs2(uni_plane, &s_wc);
- my_tosort_ucs2(uni_plane, &t_wc);
-
- if ( s_wc != t_wc )
- {
- return s_wc > t_wc ? 1 : -1;
- }
-
- s+=s_res;
- t+=t_res;
- }
- return (int) (t_is_prefix ? t-te : ((se-s) - (te-t)));
-}
-
-/*
- Compare strings, discarding end space
-
- SYNOPSIS
- my_strnncollsp_ucs2()
- cs character set handler
- a First string to compare
- a_length Length of 'a'
- b Second string to compare
- b_length Length of 'b'
-
- IMPLEMENTATION
- If one string is shorter as the other, then we space extend the other
- so that the strings have equal length.
-
- This will ensure that the following things hold:
-
- "a" == "a "
- "a\0" < "a"
- "a\0" < "a "
-
- RETURN
- < 0 a < b
- = 0 a == b
- > 0 a > b
-*/
-
-static int my_strnncollsp_ucs2(CHARSET_INFO *cs __attribute__((unused)),
- const uchar *s, size_t slen,
- const uchar *t, size_t tlen,
- my_bool diff_if_only_endspace_difference
- __attribute__((unused)))
-{
- const uchar *se, *te;
- size_t minlen;
- MY_UNICASE_INFO *uni_plane= cs->caseinfo;
-
- /* extra safety to make sure the lengths are even numbers */
- slen&= ~1;
- tlen&= ~1;
-
- se= s + slen;
- te= t + tlen;
-
- for (minlen= MY_MIN(slen, tlen); minlen; minlen-= 2)
- {
- int s_wc = uni_plane->page[s[0]] ? (int) uni_plane->page[s[0]][s[1]].sort :
- (((int) s[0]) << 8) + (int) s[1];
-
- int t_wc = uni_plane->page[t[0]] ? (int) uni_plane->page[t[0]][t[1]].sort :
- (((int) t[0]) << 8) + (int) t[1];
- if ( s_wc != t_wc )
- return s_wc > t_wc ? 1 : -1;
-
- s+= 2;
- t+= 2;
- }
-
- if (slen != tlen)
- {
- int swap= 1;
- if (slen < tlen)
- {
- s= t;
- se= te;
- swap= -1;
- }
-
- for ( ; s < se ; s+= 2)
- {
- if (s[0] || s[1] != ' ')
- return (s[0] == 0 && s[1] < ' ') ? -swap : swap;
- }
- }
- return 0;
-}
-
-
static uint my_ismbchar_ucs2(CHARSET_INFO *cs __attribute__((unused)),
const char *b,
const char *e)
@@ -3418,85 +2963,6 @@ int my_wildcmp_ucs2_bin(CHARSET_INFO *cs,
static
-int my_strnncoll_ucs2_bin(CHARSET_INFO *cs,
- const uchar *s, size_t slen,
- const uchar *t, size_t tlen,
- my_bool t_is_prefix)
-{
- int s_res,t_res;
- my_wc_t UNINIT_VAR(s_wc),UNINIT_VAR(t_wc);
- const uchar *se=s+slen;
- const uchar *te=t+tlen;
-
- while ( s < se && t < te )
- {
- s_res=my_ucs2_uni(cs,&s_wc, s, se);
- t_res=my_ucs2_uni(cs,&t_wc, t, te);
-
- if ( s_res <= 0 || t_res <= 0 )
- {
- /* Incorrect string, compare by char value */
- return ((int)s[0]-(int)t[0]);
- }
- if ( s_wc != t_wc )
- {
- return s_wc > t_wc ? 1 : -1;
- }
-
- s+=s_res;
- t+=t_res;
- }
- return (int) (t_is_prefix ? t-te : ((se-s) - (te-t)));
-}
-
-static int my_strnncollsp_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)),
- const uchar *s, size_t slen,
- const uchar *t, size_t tlen,
- my_bool diff_if_only_endspace_difference
- __attribute__((unused)))
-{
- const uchar *se, *te;
- size_t minlen;
-
- /* extra safety to make sure the lengths are even numbers */
- slen= (slen >> 1) << 1;
- tlen= (tlen >> 1) << 1;
-
- se= s + slen;
- te= t + tlen;
-
- for (minlen= MY_MIN(slen, tlen); minlen; minlen-= 2)
- {
- int s_wc= s[0] * 256 + s[1];
- int t_wc= t[0] * 256 + t[1];
- if ( s_wc != t_wc )
- return s_wc > t_wc ? 1 : -1;
-
- s+= 2;
- t+= 2;
- }
-
- if (slen != tlen)
- {
- int swap= 1;
- if (slen < tlen)
- {
- s= t;
- se= te;
- swap= -1;
- }
-
- for ( ; s < se ; s+= 2)
- {
- if (s[0] || s[1] != ' ')
- return (s[0] == 0 && s[1] < ' ') ? -swap : swap;
- }
- }
- return 0;
-}
-
-
-static
void my_hash_sort_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)),
const uchar *key, size_t len,ulong *nr1, ulong *nr2)
{
@@ -3518,8 +2984,8 @@ void my_hash_sort_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)),
static MY_COLLATION_HANDLER my_collation_ucs2_general_ci_handler =
{
NULL, /* init */
- my_strnncoll_ucs2,
- my_strnncollsp_ucs2,
+ my_strnncoll_ucs2_general_ci,
+ my_strnncollsp_ucs2_general_ci,
my_strnxfrm_unicode,
my_strnxfrmlen_unicode,
my_like_range_generic,
@@ -3579,6 +3045,7 @@ MY_CHARSET_HANDLER my_charset_ucs2_handler=
my_charlen_ucs2,
my_well_formed_char_length_ucs2,
my_copy_fix_mb2_or_mb4,
+ my_uni_ucs2,
};
diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c
index cb000a2afa0..308f5f0f7d1 100644
--- a/strings/ctype-ujis.c
+++ b/strings/ctype-ujis.c
@@ -193,6 +193,7 @@ static const uchar sort_order_ujis[]=
#define isujis_ss3(c) ((uchar) (c) == 0x8f)
#define MY_FUNCTION_NAME(x) my_ ## x ## _ujis
+#define IS_MB1_CHAR(x) ((uchar) (x) < 0x80)
#define IS_MB2_JIS(x,y) (isujis(x) && isujis(y))
#define IS_MB2_KATA(x,y) (isujis_ss2(x) && iskata(y))
#define IS_MB2_CHAR(x, y) (IS_MB2_KATA(x,y) || IS_MB2_JIS(x,y))
@@ -200,6 +201,23 @@ static const uchar sort_order_ujis[]=
#define DEFINE_ASIAN_ROUTINES
#include "ctype-mb.ic"
+#define MY_FUNCTION_NAME(x) my_ ## x ## _ujis_japanese_ci
+#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x))
+#define WEIGHT_MB1(x) ((int) sort_order_ujis[(uchar) (x)])
+#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \
+ (((uint) (uchar) (y)) << 8))
+#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z))
+#include "strcoll.ic"
+
+
+#define MY_FUNCTION_NAME(x) my_ ## x ## _ujis_bin
+#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x))
+#define WEIGHT_MB1(x) ((int) (uchar) (x))
+#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \
+ (((uint) (uchar) (y)) << 8))
+#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z))
+#include "strcoll.ic"
+
static uint ismbchar_ujis(CHARSET_INFO *cs __attribute__((unused)),
const char* p, const char *e)
@@ -67211,11 +67229,11 @@ my_caseup_ujis(CHARSET_INFO * cs, char *src, size_t srclen,
#ifdef HAVE_CHARSET_ujis
-static MY_COLLATION_HANDLER my_collation_ci_handler =
+static MY_COLLATION_HANDLER my_collation_ujis_japanese_ci_handler =
{
NULL, /* init */
- my_strnncoll_simple,/* strnncoll */
- my_strnncollsp_simple,
+ my_strnncoll_ujis_japanese_ci,
+ my_strnncollsp_ujis_japanese_ci,
my_strnxfrm_mb, /* strnxfrm */
my_strnxfrmlen_simple,
my_like_range_mb, /* like_range */
@@ -67226,6 +67244,23 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_propagate_simple
};
+
+static MY_COLLATION_HANDLER my_collation_ujis_bin_handler =
+{
+ NULL, /* init */
+ my_strnncoll_ujis_bin,
+ my_strnncollsp_ujis_bin,
+ my_strnxfrm_mb,
+ my_strnxfrmlen_simple,
+ my_like_range_mb,
+ my_wildcmp_mb_bin,
+ my_strcasecmp_mb_bin,
+ my_instr_mb,
+ my_hash_sort_mb_bin,
+ my_propagate_simple
+};
+
+
static MY_CHARSET_HANDLER my_charset_handler=
{
NULL, /* init */
@@ -67258,6 +67293,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_charlen_ujis,
my_well_formed_char_length_ujis,
my_copy_fix_mb,
+ my_native_to_mb_ujis,
};
@@ -67291,7 +67327,7 @@ struct charset_info_st my_charset_ujis_japanese_ci=
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
&my_charset_handler,
- &my_collation_ci_handler
+ &my_collation_ujis_japanese_ci_handler
};
@@ -67324,7 +67360,7 @@ struct charset_info_st my_charset_ujis_bin=
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
&my_charset_handler,
- &my_collation_mb_bin_handler
+ &my_collation_ujis_bin_handler
};
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index b7fb7e49cab..3c2c812a004 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -26,8 +26,86 @@
#define EILSEQ ENOENT
#endif
-#define IS_CONTINUATION_BYTE(c) (((c) ^ 0x80) < 0x40)
+/* Detect special bytes and sequences */
+#define IS_CONTINUATION_BYTE(c) (((uchar) (c) ^ 0x80) < 0x40)
+/*
+ Check MB2 character assuming that b0 is alredy known to be >= 0xC2.
+ Use this macro if the caller already checked b0 for:
+ - an MB1 character
+ - an unused gap between MB1 and MB2HEAD
+*/
+#define IS_UTF8MB2_STEP2(b0,b1) (((uchar) (b0) < 0xE0) && \
+ IS_CONTINUATION_BYTE((uchar) b1))
+
+/*
+ Check MB3 character assuming that b0 is already known to be
+ in the valid MB3HEAD range [0xE0..0xEF].
+*/
+#define IS_UTF8MB3_STEP2(b0,b1,b2) (IS_CONTINUATION_BYTE(b1) && \
+ IS_CONTINUATION_BYTE(b2) && \
+ ((uchar) b0 >= 0xe1 || (uchar) b1 >= 0xa0))
+
+/*
+ Check MB3 character assuming that b0 is already known to be >= 0xE0,
+ but is not checked for the high end 0xF0 yet.
+ Use this macro if the caller already checked b0 for:
+ - an MB1 character
+ - an unused gap between MB1 and MB2HEAD
+ - an MB2HEAD
+*/
+#define IS_UTF8MB3_STEP3(b0,b1,b2) (((uchar) (b0) < 0xF0) && \
+ IS_UTF8MB3_STEP2(b0,b1,b2))
+
+/*
+ UTF-8 quick four-byte mask:
+ 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+ Encoding allows to encode U+00010000..U+001FFFFF
+
+ The maximum character defined in the Unicode standard is U+0010FFFF.
+ Higher characters U+00110000..U+001FFFFF are not used.
+
+ 11110000.10010000.10xxxxxx.10xxxxxx == F0.90.80.80 == U+00010000 (min)
+ 11110100.10001111.10111111.10111111 == F4.8F.BF.BF == U+0010FFFF (max)
+
+ Valid codes:
+ [F0][90..BF][80..BF][80..BF]
+ [F1][80..BF][80..BF][80..BF]
+ [F2][80..BF][80..BF][80..BF]
+ [F3][80..BF][80..BF][80..BF]
+ [F4][80..8F][80..BF][80..BF]
+*/
+
+/*
+ Check MB4 character assuming that b0 is already
+ known to be in the range [0xF0..0xF4]
+*/
+#define IS_UTF8MB4_STEP2(b0,b1,b2,b3) (IS_CONTINUATION_BYTE(b1) && \
+ IS_CONTINUATION_BYTE(b2) && \
+ IS_CONTINUATION_BYTE(b3) && \
+ (b0 >= 0xf1 || b1 >= 0x90) && \
+ (b0 <= 0xf3 || b1 <= 0x8F))
+#define IS_UTF8MB4_STEP3(b0,b1,b2,b3) (((uchar) (b0) < 0xF5) && \
+ IS_UTF8MB4_STEP2(b0,b1,b2,b3))
+
+/* Convert individual bytes to Unicode code points */
+#define UTF8MB2_CODE(b0,b1) (((my_wc_t) ((uchar) b0 & 0x1f) << 6) |\
+ ((my_wc_t) ((uchar) b1 ^ 0x80)))
+#define UTF8MB3_CODE(b0,b1,b2) (((my_wc_t) ((uchar) b0 & 0x0f) << 12) |\
+ ((my_wc_t) ((uchar) b1 ^ 0x80) << 6) |\
+ ((my_wc_t) ((uchar) b2 ^ 0x80)))
+#define UTF8MB4_CODE(b0,b1,b2,b3) (((my_wc_t) ((uchar) b0 & 0x07) << 18) |\
+ ((my_wc_t) ((uchar) b1 ^ 0x80) << 12) |\
+ ((my_wc_t) ((uchar) b2 ^ 0x80) << 6) |\
+ (my_wc_t) ((uchar) b3 ^ 0x80))
+
+/* Definitions for strcoll.ic */
+#define IS_MB1_CHAR(x) ((uchar) (x) < 0x80)
+#define IS_MB1_MBHEAD_UNUSED_GAP(x) ((uchar) (x) < 0xC2)
+#define IS_MB2_CHAR(x,y) IS_UTF8MB2_STEP2(x,y)
+#define IS_MB3_CHAR(x,y,z) IS_UTF8MB3_STEP3(x,y,z)
+
+/* Collation names */
#define MY_UTF8MB3_GENERAL_CI MY_UTF8MB3 "_general_ci"
#define MY_UTF8MB3_GENERAL_CS MY_UTF8MB3 "_general_cs"
#define MY_UTF8MB3_BIN MY_UTF8MB3 "_bin"
@@ -88,8 +166,7 @@ int my_valid_mbcharlen_utf8mb3(const uchar *s, const uchar *e)
if (s+3 > e) /* We need 3 characters */
return MY_CS_TOOSMALL3;
- if (!(IS_CONTINUATION_BYTE(s[1]) && IS_CONTINUATION_BYTE(s[2]) &&
- (c >= 0xe1 || s[1] >= 0xa0)))
+ if (!IS_UTF8MB3_STEP2(c, s[1], s[2]))
return MY_CS_ILSEQ;
return 3;
@@ -4848,7 +4925,7 @@ static int my_utf8_uni(CHARSET_INFO *cs __attribute__((unused)),
if (!(IS_CONTINUATION_BYTE(s[1])))
return MY_CS_ILSEQ;
- *pwc = ((my_wc_t) (c & 0x1f) << 6) | (my_wc_t) (s[1] ^ 0x80);
+ *pwc= UTF8MB2_CODE(c, s[1]);
return 2;
}
else if (c < 0xf0)
@@ -4856,76 +4933,12 @@ static int my_utf8_uni(CHARSET_INFO *cs __attribute__((unused)),
if (s+3 > e) /* We need 3 characters */
return MY_CS_TOOSMALL3;
- if (!(IS_CONTINUATION_BYTE(s[1]) && IS_CONTINUATION_BYTE(s[2]) &&
- (c >= 0xe1 || s[1] >= 0xa0)))
+ if (!IS_UTF8MB3_STEP2(c, s[1], s[2]))
return MY_CS_ILSEQ;
- *pwc = ((my_wc_t) (c & 0x0f) << 12) |
- ((my_wc_t) (s[1] ^ 0x80) << 6) |
- (my_wc_t) (s[2] ^ 0x80);
-
+ *pwc= UTF8MB3_CODE(c, s[1], s[2]);
return 3;
}
-#ifdef UNICODE_32BIT
- else if (c < 0xf8 && sizeof(my_wc_t)*8 >= 32)
- {
- if (s+4 > e) /* We need 4 characters */
- return MY_CS_TOOSMALL4;
-
- if (!(IS_CONTINUATION_BYTE(s[1]) &&
- IS_CONTINUATION_BYTE(s[2]) &&
- IS_CONTINUATION_BYTE(s[3]) &&
- (c >= 0xf1 || s[1] >= 0x90)))
- return MY_CS_ILSEQ;
-
- *pwc = ((my_wc_t) (c & 0x07) << 18) |
- ((my_wc_t) (s[1] ^ 0x80) << 12) |
- ((my_wc_t) (s[2] ^ 0x80) << 6) |
- (my_wc_t) (s[3] ^ 0x80);
-
- return 4;
- }
- else if (c < 0xfc && sizeof(my_wc_t)*8 >= 32)
- {
- if (s+5 >e) /* We need 5 characters */
- return MY_CS_TOOSMALL5;
-
- if (!(IS_CONTINUATION_BYTE(s[1]) &&
- IS_CONTINUATION_BYTE(s[2]) &&
- IS_CONTINUATION_BYTE(s[3]) &&
- IS_CONTINUATION_BYTE(s[4]) &&
- (c >= 0xf9 || s[1] >= 0x88)))
- return MY_CS_ILSEQ;
-
- *pwc = ((my_wc_t) (c & 0x03) << 24) |
- ((my_wc_t) (s[1] ^ 0x80) << 18) |
- ((my_wc_t) (s[2] ^ 0x80) << 12) |
- ((my_wc_t) (s[3] ^ 0x80) << 6) |
- (my_wc_t) (s[4] ^ 0x80);
- return 5;
- }
- else if (c < 0xfe && sizeof(my_wc_t)*8 >= 32)
- {
- if ( s+6 >e ) /* We need 6 characters */
- return MY_CS_TOOSMALL6;
-
- if (!(IS_CONTINUATION_BYTE(s[1]) &&
- IS_CONTINUATION_BYTE(s[2]) &&
- IS_CONTINUATION_BYTE(s[3]) &&
- IS_CONTINUATION_BYTE(s[4]) &&
- IS_CONTINUATION_BYTE(s[5]) &&
- (c >= 0xfd || s[1] >= 0x84)))
- return MY_CS_ILSEQ;
-
- *pwc = ((my_wc_t) (c & 0x01) << 30)
- | ((my_wc_t) (s[1] ^ 0x80) << 24)
- | ((my_wc_t) (s[2] ^ 0x80) << 18)
- | ((my_wc_t) (s[3] ^ 0x80) << 12)
- | ((my_wc_t) (s[4] ^ 0x80) << 6)
- | (my_wc_t) (s[5] ^ 0x80);
- return 6;
- }
-#endif
return MY_CS_ILSEQ;
}
@@ -4954,21 +4967,16 @@ static int my_utf8_uni_no_range(CHARSET_INFO *cs __attribute__((unused)),
if (!((s[1] ^ 0x80) < 0x40))
return MY_CS_ILSEQ;
- *pwc = ((my_wc_t) (c & 0x1f) << 6) | (my_wc_t) (s[1] ^ 0x80);
+ *pwc= UTF8MB2_CODE(c, s[1]);
return 2;
}
if (c < 0xf0)
{
- if (!(IS_CONTINUATION_BYTE(s[1]) &&
- IS_CONTINUATION_BYTE(s[2]) &&
- (c >= 0xe1 || s[1] >= 0xa0)))
+ if (!IS_UTF8MB3_STEP2(c, s[1], s[2]))
return MY_CS_ILSEQ;
- *pwc= ((my_wc_t) (c & 0x0f) << 12) |
- ((my_wc_t) (s[1] ^ 0x80) << 6) |
- (my_wc_t) (s[2] ^ 0x80);
-
+ *pwc= UTF8MB3_CODE(c, s[1], s[2]);
return 3;
}
return MY_CS_ILSEQ;
@@ -5193,148 +5201,6 @@ static size_t my_casedn_str_utf8(CHARSET_INFO *cs, char *src)
}
-static int my_strnncoll_utf8(CHARSET_INFO *cs,
- const uchar *s, size_t slen,
- const uchar *t, size_t tlen,
- my_bool t_is_prefix)
-{
- int s_res,t_res;
- my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
- const uchar *se=s+slen;
- const uchar *te=t+tlen;
- MY_UNICASE_INFO *uni_plane= cs->caseinfo;
-
- while ( s < se && t < te )
- {
- s_res=my_utf8_uni(cs,&s_wc, s, se);
- t_res=my_utf8_uni(cs,&t_wc, t, te);
-
- if ( s_res <= 0 || t_res <= 0 )
- {
- /* Incorrect string, compare byte by byte value */
- return bincmp(s, se, t, te);
- }
-
- my_tosort_unicode(uni_plane, &s_wc, cs->state);
- my_tosort_unicode(uni_plane, &t_wc, cs->state);
-
- if ( s_wc != t_wc )
- {
- return s_wc > t_wc ? 1 : -1;
- }
-
- s+=s_res;
- t+=t_res;
- }
- return (int) (t_is_prefix ? t-te : ((se-s) - (te-t)));
-}
-
-
-
-/*
- Compare strings, discarding end space
-
- SYNOPSIS
- my_strnncollsp_utf8()
- cs character set handler
- a First string to compare
- a_length Length of 'a'
- b Second string to compare
- b_length Length of 'b'
- diff_if_only_endspace_difference
- Set to 1 if the strings should be regarded as different
- if they only difference in end space
-
- IMPLEMENTATION
- If one string is shorter as the other, then we space extend the other
- so that the strings have equal length.
-
- This will ensure that the following things hold:
-
- "a" == "a "
- "a\0" < "a"
- "a\0" < "a "
-
- RETURN
- < 0 a < b
- = 0 a == b
- > 0 a > b
-*/
-
-static int my_strnncollsp_utf8(CHARSET_INFO *cs,
- const uchar *s, size_t slen,
- const uchar *t, size_t tlen,
- my_bool diff_if_only_endspace_difference)
-{
- int s_res, t_res, res;
- my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
- const uchar *se= s+slen, *te= t+tlen;
- MY_UNICASE_INFO *uni_plane= cs->caseinfo;
-
-#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
- diff_if_only_endspace_difference= 0;
-#endif
-
- while ( s < se && t < te )
- {
- s_res=my_utf8_uni(cs,&s_wc, s, se);
- t_res=my_utf8_uni(cs,&t_wc, t, te);
-
- if ( s_res <= 0 || t_res <= 0 )
- {
- /* Incorrect string, compare byte by byte value */
- return bincmp(s, se, t, te);
- }
-
- my_tosort_unicode(uni_plane, &s_wc, cs->state);
- my_tosort_unicode(uni_plane, &t_wc, cs->state);
-
- if ( s_wc != t_wc )
- {
- return s_wc > t_wc ? 1 : -1;
- }
-
- s+=s_res;
- t+=t_res;
- }
-
- slen= (size_t) (se-s);
- tlen= (size_t) (te-t);
- res= 0;
-
- if (slen != tlen)
- {
- int swap= 1;
- if (diff_if_only_endspace_difference)
- res= 1; /* Assume 'a' is bigger */
- if (slen < tlen)
- {
- slen= tlen;
- s= t;
- se= te;
- swap= -1;
- res= -res;
- }
- /*
- This following loop uses the fact that in UTF-8
- all multibyte characters are greater than space,
- and all multibyte head characters are greater than
- space. It means if we meet a character greater
- than space, it always means that the longer string
- is greater. So we can reuse the same loop from the
- 8bit version, without having to process full multibute
- sequences.
- */
- for ( ; s < se; s++)
- {
- if (*s != ' ')
- return (*s < ' ') ? -swap : swap;
- }
- }
- return res;
-}
-
-
/*
Compare 0-terminated UTF8 strings.
@@ -5456,50 +5322,6 @@ int my_charlen_utf8(CHARSET_INFO *cs __attribute__((unused)),
if (c < 0xf0)
return my_valid_mbcharlen_utf8mb3(s, e);
-#ifdef UNICODE_32BIT
- if (c < 0xf8 && sizeof(my_wc_t)*8 >= 32)
- {
- if (s+4 > e) /* We need 4 characters */
- return MY_CS_TOOSMALL4;
-
- if (!(IS_CONTINUATION_BYTE(s[1]) &&
- IS_CONTINUATION_BYTE(s[2]) &&
- IS_CONTINUATION_BYTE(s[3]) &&
- (c >= 0xf1 || s[1] >= 0x90)))
- return MY_CS_ILSEQ;
-
- return 4;
- }
- if (c < 0xfc && sizeof(my_wc_t)*8 >= 32)
- {
- if (s+5 >e) /* We need 5 characters */
- return MY_CS_TOOSMALL5;
-
- if (!(IS_CONTINUATION_BYTE(s[1]) &&
- IS_CONTINUATION_BYTE(s[2]) &&
- IS_CONTINUATION_BYTE(s[3]) &&
- IS_CONTINUATION_BYTE(s[4]) &&
- (c >= 0xf9 || s[1] >= 0x88)))
- return MY_CS_ILSEQ;
-
- return 5;
- }
- if (c < 0xfe && sizeof(my_wc_t)*8 >= 32)
- {
- if ( s+6 >e ) /* We need 6 characters */
- return MY_CS_TOOSMALL6;
-
- if (!(IS_CONTINUATION_BYTE(s[1]) &&
- IS_CONTINUATION_BYTE(s[2]) &&
- IS_CONTINUATION_BYTE(s[3]) &&
- IS_CONTINUATION_BYTE(s[4]) &&
- IS_CONTINUATION_BYTE(s[5]) &&
- (c >= 0xfd || s[1] >= 0x84)))
- return MY_CS_ILSEQ;
-
- return 6;
- }
-#endif
return MY_CS_ILSEQ;
}
@@ -5535,6 +5357,75 @@ my_well_formed_len_utf8(CHARSET_INFO *cs, const char *b, const char *e,
/* my_well_formed_char_length_utf8 */
+static inline int my_weight_mb1_utf8_general_ci(uchar b)
+{
+ return (int) plane00[b & 0xFF].sort;
+}
+
+
+static inline int my_weight_mb2_utf8_general_ci(uchar b0, uchar b1)
+{
+ my_wc_t wc= UTF8MB2_CODE(b0, b1);
+ MY_UNICASE_CHARACTER *page= my_unicase_pages_default[wc >> 8];
+ return (int) (page ? page[wc & 0xFF].sort : wc);
+}
+
+
+static inline int my_weight_mb3_utf8_general_ci(uchar b0, uchar b1, uchar b2)
+{
+ my_wc_t wc= UTF8MB3_CODE(b0, b1, b2);
+ MY_UNICASE_CHARACTER *page= my_unicase_pages_default[wc >> 8];
+ return (int) (page ? page[wc & 0xFF].sort : wc);
+}
+
+
+#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8_general_ci
+#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x))
+#define WEIGHT_MB1(x) my_weight_mb1_utf8_general_ci(x)
+#define WEIGHT_MB2(x,y) my_weight_mb2_utf8_general_ci(x,y)
+#define WEIGHT_MB3(x,y,z) my_weight_mb3_utf8_general_ci(x,y,z)
+#include "strcoll.ic"
+
+
+static inline int my_weight_mb1_utf8_general_mysql500_ci(uchar b)
+{
+ return (int) plane00_mysql500[b & 0xFF].sort;
+}
+
+
+static inline int my_weight_mb2_utf8_general_mysql500_ci(uchar b0, uchar b1)
+{
+ my_wc_t wc= UTF8MB2_CODE(b0, b1);
+ MY_UNICASE_CHARACTER *page= my_unicase_pages_mysql500[wc >> 8];
+ return (int) (page ? page[wc & 0xFF].sort : wc);
+}
+
+
+static inline int
+my_weight_mb3_utf8_general_mysql500_ci(uchar b0, uchar b1, uchar b2)
+{
+ my_wc_t wc= UTF8MB3_CODE(b0, b1, b2);
+ MY_UNICASE_CHARACTER *page= my_unicase_pages_mysql500[wc >> 8];
+ return (int) (page ? page[wc & 0xFF].sort : wc);
+}
+
+
+#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8_general_mysql500_ci
+#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x))
+#define WEIGHT_MB1(x) my_weight_mb1_utf8_general_mysql500_ci(x)
+#define WEIGHT_MB2(x,y) my_weight_mb2_utf8_general_mysql500_ci(x,y)
+#define WEIGHT_MB3(x,y,z) my_weight_mb3_utf8_general_mysql500_ci(x,y,z)
+#include "strcoll.ic"
+
+
+#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8_bin
+#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x))
+#define WEIGHT_MB1(x) ((int) (uchar) (x))
+#define WEIGHT_MB2(x,y) ((int) UTF8MB2_CODE(x,y))
+#define WEIGHT_MB3(x,y,z) ((int) UTF8MB3_CODE(x,y,z))
+#include "strcoll.ic"
+
+
static uint my_ismbchar_utf8(CHARSET_INFO *cs,const char *b, const char *e)
{
int res= my_charlen_utf8(cs, (const uchar*) b, (const uchar*) e);
@@ -5552,14 +5443,6 @@ static uint my_mbcharlen_utf8(CHARSET_INFO *cs __attribute__((unused)),
return 2;
else if (c < 0xf0)
return 3;
-#ifdef UNICODE_32BIT
- else if (c < 0xf8)
- return 4;
- else if (c < 0xfc)
- return 5;
- else if (c < 0xfe)
- return 6;
-#endif
return 0; /* Illegal mb head */;
}
@@ -5567,8 +5450,24 @@ static uint my_mbcharlen_utf8(CHARSET_INFO *cs __attribute__((unused)),
static MY_COLLATION_HANDLER my_collation_utf8_general_ci_handler =
{
NULL, /* init */
- my_strnncoll_utf8,
- my_strnncollsp_utf8,
+ my_strnncoll_utf8_general_ci,
+ my_strnncollsp_utf8_general_ci,
+ my_strnxfrm_unicode,
+ my_strnxfrmlen_unicode,
+ my_like_range_mb,
+ my_wildcmp_utf8,
+ my_strcasecmp_utf8,
+ my_instr_mb,
+ my_hash_sort_utf8,
+ my_propagate_complex
+};
+
+
+static MY_COLLATION_HANDLER my_collation_utf8_general_mysql500_ci_handler =
+{
+ NULL, /* init */
+ my_strnncoll_utf8_general_mysql500_ci,
+ my_strnncollsp_utf8_general_mysql500_ci,
my_strnxfrm_unicode,
my_strnxfrmlen_unicode,
my_like_range_mb,
@@ -5583,8 +5482,8 @@ static MY_COLLATION_HANDLER my_collation_utf8_general_ci_handler =
static MY_COLLATION_HANDLER my_collation_utf8_bin_handler =
{
NULL, /* init */
- my_strnncoll_mb_bin,
- my_strnncollsp_mb_bin,
+ my_strnncoll_utf8_bin,
+ my_strnncollsp_utf8_bin,
my_strnxfrm_unicode,
my_strnxfrmlen_unicode,
my_like_range_mb,
@@ -5627,6 +5526,7 @@ MY_CHARSET_HANDLER my_charset_utf8_handler=
my_charlen_utf8,
my_well_formed_char_length_utf8,
my_copy_fix_mb,
+ my_uni_utf8,
};
@@ -5693,7 +5593,7 @@ struct charset_info_st my_charset_utf8_general_mysql500_ci=
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
&my_charset_utf8_handler,
- &my_collation_utf8_general_ci_handler
+ &my_collation_utf8_general_mysql500_ci_handler
};
@@ -7166,8 +7066,8 @@ my_ismbchar_filename(CHARSET_INFO *cs, const char *str, const char *end)
static MY_COLLATION_HANDLER my_collation_filename_handler =
{
NULL, /* init */
- my_strnncoll_utf8,
- my_strnncollsp_utf8,
+ my_strnncoll_simple,
+ my_strnncollsp_simple,
my_strnxfrm_unicode,
my_strnxfrmlen_unicode,
my_like_range_mb,
@@ -7210,6 +7110,7 @@ static MY_CHARSET_HANDLER my_charset_filename_handler=
my_charlen_filename,
my_well_formed_char_length_filename,
my_copy_fix_mb,
+ my_wc_mb_filename,
};
@@ -7410,7 +7311,7 @@ my_mb_wc_utf8mb4(CHARSET_INFO *cs __attribute__((unused)),
if (!(IS_CONTINUATION_BYTE(s[1])))
return MY_CS_ILSEQ;
- *pwc= ((my_wc_t) (c & 0x1f) << 6) | (my_wc_t) (s[1] ^ 0x80);
+ *pwc= UTF8MB2_CODE(c, s[1]);
return 2;
}
else if (c < 0xf0)
@@ -7418,13 +7319,10 @@ my_mb_wc_utf8mb4(CHARSET_INFO *cs __attribute__((unused)),
if (s + 3 > e) /* We need 3 characters */
return MY_CS_TOOSMALL3;
- if (!(IS_CONTINUATION_BYTE(s[1]) && IS_CONTINUATION_BYTE(s[2]) &&
- (c >= 0xe1 || s[1] >= 0xa0)))
+ if (!IS_UTF8MB3_STEP2(c, s[1], s[2]))
return MY_CS_ILSEQ;
- *pwc= ((my_wc_t) (c & 0x0f) << 12) |
- ((my_wc_t) (s[1] ^ 0x80) << 6) |
- (my_wc_t) (s[2] ^ 0x80);
+ *pwc= UTF8MB3_CODE(c, s[1], s[2]);
return 3;
}
else if (c < 0xf5)
@@ -7432,35 +7330,9 @@ my_mb_wc_utf8mb4(CHARSET_INFO *cs __attribute__((unused)),
if (s + 4 > e) /* We need 4 characters */
return MY_CS_TOOSMALL4;
- /*
- UTF-8 quick four-byte mask:
- 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
- Encoding allows to encode U+00010000..U+001FFFFF
-
- The maximum character defined in the Unicode standard is U+0010FFFF.
- Higher characters U+00110000..U+001FFFFF are not used.
-
- 11110000.10010000.10xxxxxx.10xxxxxx == F0.90.80.80 == U+00010000 (min)
- 11110100.10001111.10111111.10111111 == F4.8F.BF.BF == U+0010FFFF (max)
-
- Valid codes:
- [F0][90..BF][80..BF][80..BF]
- [F1][80..BF][80..BF][80..BF]
- [F2][80..BF][80..BF][80..BF]
- [F3][80..BF][80..BF][80..BF]
- [F4][80..8F][80..BF][80..BF]
- */
-
- if (!(IS_CONTINUATION_BYTE(s[1]) &&
- IS_CONTINUATION_BYTE(s[2]) &&
- IS_CONTINUATION_BYTE(s[3]) &&
- (c >= 0xf1 || s[1] >= 0x90) &&
- (c <= 0xf3 || s[1] <= 0x8F)))
+ if (!IS_UTF8MB4_STEP2(c, s[1], s[2], s[3]))
return MY_CS_ILSEQ;
- *pwc = ((my_wc_t) (c & 0x07) << 18) |
- ((my_wc_t) (s[1] ^ 0x80) << 12) |
- ((my_wc_t) (s[2] ^ 0x80) << 6) |
- (my_wc_t) (s[3] ^ 0x80);
+ *pwc= UTF8MB4_CODE(c, s[1], s[2], s[3]);
return 4;
}
return MY_CS_ILSEQ;
@@ -7492,34 +7364,22 @@ my_mb_wc_utf8mb4_no_range(CHARSET_INFO *cs __attribute__((unused)),
if (!IS_CONTINUATION_BYTE(s[1]))
return MY_CS_ILSEQ;
- *pwc = ((my_wc_t) (c & 0x1f) << 6) | (my_wc_t) (s[1] ^ 0x80);
+ *pwc= UTF8MB2_CODE(c, s[1]);
return 2;
}
if (c < 0xf0)
{
- if (!(IS_CONTINUATION_BYTE(s[1]) &&
- IS_CONTINUATION_BYTE(s[2]) &&
- (c >= 0xe1 || s[1] >= 0xa0)))
+ if (!IS_UTF8MB3_STEP2(c, s[1], s[2]))
return MY_CS_ILSEQ;
- *pwc= ((my_wc_t) (c & 0x0f) << 12) |
- ((my_wc_t) (s[1] ^ 0x80) << 6) |
- (my_wc_t) (s[2] ^ 0x80);
-
+ *pwc= UTF8MB3_CODE(c, s[1], s[2]);
return 3;
}
else if (c < 0xf5)
{
- if (!(IS_CONTINUATION_BYTE(s[1]) &&
- IS_CONTINUATION_BYTE(s[2]) &&
- IS_CONTINUATION_BYTE(s[3]) &&
- (c >= 0xf1 || s[1] >= 0x90) &&
- (c <= 0xf3 || s[1] <= 0x8F)))
+ if (!IS_UTF8MB4_STEP2(c, s[1], s[2], s[3]))
return MY_CS_ILSEQ;
- *pwc = ((my_wc_t) (c & 0x07) << 18) |
- ((my_wc_t) (s[1] ^ 0x80) << 12) |
- ((my_wc_t) (s[2] ^ 0x80) << 6) |
- (my_wc_t) (s[3] ^ 0x80);
+ *pwc= UTF8MB4_CODE(c, s[1], s[2], s[3]);
return 4;
}
return MY_CS_ILSEQ;
@@ -7765,146 +7625,6 @@ my_casedn_str_utf8mb4(CHARSET_INFO *cs, char *src)
}
-static int
-my_strnncoll_utf8mb4(CHARSET_INFO *cs,
- const uchar *s, size_t slen,
- const uchar *t, size_t tlen,
- my_bool t_is_prefix)
-{
- my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
- const uchar *se= s + slen;
- const uchar *te= t + tlen;
- MY_UNICASE_INFO *uni_plane= cs->caseinfo;
-
- while ( s < se && t < te )
- {
- int s_res= my_mb_wc_utf8mb4(cs, &s_wc, s, se);
- int t_res= my_mb_wc_utf8mb4(cs, &t_wc, t, te);
-
- if ( s_res <= 0 || t_res <= 0 )
- {
- /* Incorrect string, compare bytewise */
- return bincmp_utf8mb4(s, se, t, te);
- }
-
- my_tosort_unicode(uni_plane, &s_wc, cs->state);
- my_tosort_unicode(uni_plane, &t_wc, cs->state);
-
- if ( s_wc != t_wc )
- {
- return s_wc > t_wc ? 1 : -1;
- }
-
- s+= s_res;
- t+= t_res;
- }
- return (int) (t_is_prefix ? (t - te) : ((se - s) - (te - t)));
-}
-
-
-/**
-
- Compare strings, discarding end space
-
- If one string is shorter as the other, then we space extend the other
- so that the strings have equal length.
-
- This will ensure that the following things hold:
-
- "a" == "a "
- "a\0" < "a"
- "a\0" < "a "
-
- @param cs Character set pinter.
- @param a First string to compare.
- @param a_length Length of 'a'.
- @param b Second string to compare.
- @param b_length Length of 'b'.
- @param diff_if_only_endspace_difference
- Set to 1 if the strings should be regarded as different
- if they only difference in end space
-
- @return Comparison result.
- @retval Negative number, if a less than b.
- @retval 0, if a is equal to b
- @retval Positive number, if a > b
-*/
-
-static int
-my_strnncollsp_utf8mb4(CHARSET_INFO *cs,
- const uchar *s, size_t slen,
- const uchar *t, size_t tlen,
- my_bool diff_if_only_endspace_difference)
-{
- int res;
- my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
- const uchar *se= s + slen, *te= t + tlen;
- MY_UNICASE_INFO *uni_plane= cs->caseinfo;
-
-#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
- diff_if_only_endspace_difference= FALSE;
-#endif
-
- while ( s < se && t < te )
- {
- int s_res= my_mb_wc_utf8mb4(cs, &s_wc, s, se);
- int t_res= my_mb_wc_utf8mb4(cs, &t_wc, t, te);
-
- if ( s_res <= 0 || t_res <= 0 )
- {
- /* Incorrect string, compare bytewise */
- return bincmp_utf8mb4(s, se, t, te);
- }
-
- my_tosort_unicode(uni_plane, &s_wc, cs->state);
- my_tosort_unicode(uni_plane, &t_wc, cs->state);
-
- if ( s_wc != t_wc )
- {
- return s_wc > t_wc ? 1 : -1;
- }
-
- s+=s_res;
- t+=t_res;
- }
-
- slen= (size_t) (se-s);
- tlen= (size_t) (te-t);
- res= 0;
-
- if (slen != tlen)
- {
- int swap= 1;
- if (diff_if_only_endspace_difference)
- res= 1; /* Assume 'a' is bigger */
- if (slen < tlen)
- {
- slen= tlen;
- s= t;
- se= te;
- swap= -1;
- res= -res;
- }
- /*
- This following loop uses the fact that in UTF-8
- all multibyte characters are greater than space,
- and all multibyte head characters are greater than
- space. It means if we meet a character greater
- than space, it always means that the longer string
- is greater. So we can reuse the same loop from the
- 8bit version, without having to process full multibute
- sequences.
- */
- for ( ; s < se; s++)
- {
- if (*s != ' ')
- return (*s < ' ') ? -swap : swap;
- }
- }
- return res;
-}
-
-
/**
Compare 0-terminated UTF8 strings.
@@ -8007,30 +7727,7 @@ my_charlen_utf8mb4(CHARSET_INFO *cs __attribute__((unused)),
if (s + 4 > e) /* We need 4 characters */
return MY_CS_TOOSMALL4;
- /*
- UTF-8 quick four-byte mask:
- 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
- Encoding allows to encode U+00010000..U+001FFFFF
-
- The maximum character defined in the Unicode standard is U+0010FFFF.
- Higher characters U+00110000..U+001FFFFF are not used.
-
- 11110000.10010000.10xxxxxx.10xxxxxx == F0.90.80.80 == U+00010000 (min)
- 11110100.10001111.10111111.10111111 == F4.8F.BF.BF == U+0010FFFF (max)
-
- Valid codes:
- [F0][90..BF][80..BF][80..BF]
- [F1][80..BF][80..BF][80..BF]
- [F2][80..BF][80..BF][80..BF]
- [F3][80..BF][80..BF][80..BF]
- [F4][80..8F][80..BF][80..BF]
- */
-
- if (!(IS_CONTINUATION_BYTE(s[1]) &&
- IS_CONTINUATION_BYTE(s[2]) &&
- IS_CONTINUATION_BYTE(s[3]) &&
- (c >= 0xf1 || s[1] >= 0x90) &&
- (c <= 0xf3 || s[1] <= 0x8F)))
+ if (!IS_UTF8MB4_STEP2(c, s[1], s[2], s[3]))
return MY_CS_ILSEQ;
return 4;
@@ -8072,6 +7769,29 @@ size_t my_well_formed_len_utf8mb4(CHARSET_INFO *cs,
#undef DEFINE_WELL_FORMED_CHAR_LENGTH_USING_CHARLEN
/* my_well_formed_char_length_utf8mb4 */
+
+#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8mb4_general_ci
+#define IS_MB4_CHAR(b0,b1,b2,b3) IS_UTF8MB4_STEP3(b0,b1,b2,b3)
+#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x))
+#define WEIGHT_MB1(b0) my_weight_mb1_utf8_general_ci(b0)
+#define WEIGHT_MB2(b0,b1) my_weight_mb2_utf8_general_ci(b0,b1)
+#define WEIGHT_MB3(b0,b1,b2) my_weight_mb3_utf8_general_ci(b0,b1,b2)
+/*
+ All non-BMP characters have the same weight.
+*/
+#define WEIGHT_MB4(b0,b1,b2,b3) MY_CS_REPLACEMENT_CHARACTER
+#include "strcoll.ic"
+
+
+#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8mb4_bin
+#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x))
+#define WEIGHT_MB1(b0) ((int) (uchar) (b0))
+#define WEIGHT_MB2(b0,b1) ((int) UTF8MB2_CODE(b0,b1))
+#define WEIGHT_MB3(b0,b1,b2) ((int) UTF8MB3_CODE(b0,b1,b2))
+#define WEIGHT_MB4(b0,b1,b2,b3) ((int) UTF8MB4_CODE(b0,b1,b2,b3))
+#include "strcoll.ic"
+
+
static uint
my_ismbchar_utf8mb4(CHARSET_INFO *cs, const char *b, const char *e)
{
@@ -8100,8 +7820,8 @@ my_mbcharlen_utf8mb4(CHARSET_INFO *cs __attribute__((unused)), uint c)
static MY_COLLATION_HANDLER my_collation_utf8mb4_general_ci_handler=
{
NULL, /* init */
- my_strnncoll_utf8mb4,
- my_strnncollsp_utf8mb4,
+ my_strnncoll_utf8mb4_general_ci,
+ my_strnncollsp_utf8mb4_general_ci,
my_strnxfrm_unicode,
my_strnxfrmlen_unicode,
my_like_range_mb,
@@ -8116,8 +7836,8 @@ static MY_COLLATION_HANDLER my_collation_utf8mb4_general_ci_handler=
static MY_COLLATION_HANDLER my_collation_utf8mb4_bin_handler =
{
NULL, /* init */
- my_strnncoll_mb_bin,
- my_strnncollsp_mb_bin,
+ my_strnncoll_utf8mb4_bin,
+ my_strnncollsp_utf8mb4_bin,
my_strnxfrm_unicode_full_bin,
my_strnxfrmlen_unicode_full_bin,
my_like_range_mb,
@@ -8161,6 +7881,7 @@ MY_CHARSET_HANDLER my_charset_utf8mb4_handler=
my_charlen_utf8mb4,
my_well_formed_char_length_utf8mb4,
my_copy_fix_mb,
+ my_wc_mb_utf8mb4,
};
diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c
index 27e6a94f67b..8e3527f9ff1 100644
--- a/strings/ctype-win1250ch.c
+++ b/strings/ctype-win1250ch.c
@@ -690,7 +690,8 @@ static MY_COLLATION_HANDLER my_collation_czech_ci_handler =
struct charset_info_st my_charset_cp1250_czech_ci =
{
34,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_CSSORT|MY_CS_STRNXFRM_BAD_NWEIGHTS, /* state */
+ MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_CSSORT|
+ MY_CS_STRNXFRM_BAD_NWEIGHTS|MY_CS_NON1TO1, /* state */
"cp1250", /* cs name */
"cp1250_czech_cs", /* name */
"", /* comment */
diff --git a/strings/strcoll.ic b/strings/strcoll.ic
new file mode 100644
index 00000000000..4bced593a23
--- /dev/null
+++ b/strings/strcoll.ic
@@ -0,0 +1,275 @@
+/*
+ Copyright (c) 2015, MariaDB Foundation
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+
+#ifndef MY_FUNCTION_NAME
+#error MY_FUNCTION_NAME is not defined
+#endif
+
+
+/*
+ The weight for automatically padded spaces when comparing strings with
+ the PAD SPACE property.
+ Should normally be equal to the weight of a regular space.
+*/
+#ifndef WEIGHT_PAD_SPACE
+#define WEIGHT_PAD_SPACE (' ')
+#endif
+
+
+/*
+ Weight of an illegal byte, must follow these rules:
+ 1. Must be greater than weight of any normal character in the collation.
+ 2. Two different bad bytes must have different weights and must be
+ compared in their binary order.
+
+ Depends on mbmaxlen of the character set, as well as how the collation
+ sorts various single-byte and multi-byte character blocks.
+
+ The macro below is the default definition, it is suitable for mbmaxlen=2
+ character sets that sort all multi-byte characters after all single-byte
+ characters: big5, euckr, gb2312, gbk.
+
+ All mbmaxlen>2 character sets must provide their own definitions.
+ All collations that have a more complex order (than just MB1 followed by MB2)
+ must also provide their own definitions (see definitions for
+ cp932_japanese_ci and sjis_japanese_ci as examples of a more complex order).
+*/
+#ifndef WEIGHT_ILSEQ
+#define WEIGHT_ILSEQ(x) (0xFF00 + (x))
+#endif
+
+
+/**
+ Scan a valid character, or a bad byte, or an auto-padded space
+ from a string and calculate the weight of the scanned sequence.
+
+ @param [OUT] weight - the weight is returned here
+ @param str - the string
+ @param end - the end of the string
+ @return - the number of bytes scanned
+
+ The including source file must define the following macros:
+ IS_MB1_CHAR(b0) - for character sets that have MB1 characters
+ IS_MB1_MB2HEAD_GAP(b0) - optional, for better performance
+ IS_MB2_CHAR(b0,b1) - for character sets that have MB2 characters
+ IS_MB3_CHAR(b0,b1,b2) - for character sets that have MB3 characters
+ IS_MB4_CHAR(b0,b1,b2,b3) - for character sets with have MB4 characters
+ WEIGHT_PAD_SPACE
+ WEIGHT_MB1(b0) - for character sets that have MB1 characters
+ WEIGHT_MB2(b0,b1) - for character sets that have MB2 characters
+ WEIGHT_MB3(b0,b1,b2) - for character sets that have MB3 characters
+ WEIGHT_MB4(b0,b1,b2,b3) - for character sets that have MB4 characters
+ WEIGHT_ILSEQ(x)
+*/
+static inline uint
+MY_FUNCTION_NAME(scan_weight)(int *weight, const uchar *str, const uchar *end)
+{
+ if (str >= end)
+ {
+ *weight= WEIGHT_PAD_SPACE;
+ return 0;
+ }
+
+#ifdef IS_MB1_CHAR
+ if (IS_MB1_CHAR(*str))
+ {
+ *weight= WEIGHT_MB1(*str); /* A valid single byte character*/
+ return 1;
+ }
+#endif
+
+#ifdef IS_MB1_MBHEAD_UNUSED_GAP
+ /*
+ Quickly filter out unused bytes that are neither MB1 nor MBHEAD.
+ E.g. [0x80..0xC1] in utf8. This allows using simplified conditions
+ in IS_MB2_CHAR(), IS_MB3_CHAR(), etc.
+ */
+ if (IS_MB1_MBHEAD_UNUSED_GAP(*str))
+ goto bad;
+#endif
+
+#ifdef IS_MB2_CHAR
+ if (str + 2 > end) /* The string ended unexpectedly */
+ goto bad; /* Treat as a bad byte */
+
+ if (IS_MB2_CHAR(str[0], str[1]))
+ {
+ *weight= WEIGHT_MB2(str[0], str[1]);
+ return 2; /* A valid two-byte character */
+ }
+#endif
+
+#ifdef IS_MB3_CHAR
+ if (str + 3 > end) /* Incomplete three-byte character */
+ goto bad;
+
+ if (IS_MB3_CHAR(str[0], str[1], str[2]))
+ {
+ *weight= WEIGHT_MB3(str[0], str[1], str[2]);
+ return 3; /* A valid three-byte character */
+ }
+#endif
+
+#ifdef IS_MB4_CHAR
+ if (str + 4 > end) /* Incomplete four-byte character */
+ goto bad;
+
+ if (IS_MB4_CHAR(str[0], str[1], str[2], str[3]))
+ {
+ *weight= WEIGHT_MB4(str[0], str[1], str[2], str[3]);
+ return 4; /* A valid four-byte character */
+ }
+
+#endif
+
+bad:
+ *weight= WEIGHT_ILSEQ(str[0]); /* Bad byte */
+ return 1;
+}
+
+
+/**
+ Compare two strings according to the collation,
+ without handling the PAD SPACE property.
+
+ Note, cs->coll->strnncoll() is usually used to compare identifiers.
+ Perhaps we should eventually (in 10.2?) create a new collation
+ my_charset_utf8_general_ci_no_pad and have only one comparison function
+ in MY_COLLATION_HANDLER.
+
+ @param cs - the character set and collation
+ @param a - the left string
+ @param a_length - the length of the left string
+ @param b - the right string
+ @param b_length - the length of the right string
+ @param b_is_prefix - if the caller wants to check if "b" is a prefix of "a"
+ @return - the comparison result
+*/
+static int
+MY_FUNCTION_NAME(strnncoll)(CHARSET_INFO *cs __attribute__((unused)),
+ const uchar *a, size_t a_length,
+ const uchar *b, size_t b_length,
+ my_bool b_is_prefix)
+{
+ const uchar *a_end= a + a_length;
+ const uchar *b_end= b + b_length;
+ for ( ; ; )
+ {
+ int a_weight, b_weight, res;
+ uint a_wlen= MY_FUNCTION_NAME(scan_weight)(&a_weight, a, a_end);
+ uint b_wlen= MY_FUNCTION_NAME(scan_weight)(&b_weight, b, b_end);
+ /*
+ a_wlen b_wlen Comment
+ ------ ------ -------
+ 0 0 Strings ended simultaneously, "a" and "b" are equal.
+ 0 >0 "a" is a prefix of "b", so "a" is smaller.
+ >0 0 "b" is a prefix of "a", check b_is_prefix.
+ >0 >0 Two weights were scanned, check weight difference.
+ */
+ if (!a_wlen)
+ return b_wlen ? -b_weight : 0;
+
+ if (!b_wlen)
+ return b_is_prefix ? 0 : a_weight;
+
+ if ((res= (a_weight - b_weight)))
+ return res;
+ /*
+ None of the strings has ended yet.
+ */
+ DBUG_ASSERT(a < a_end);
+ DBUG_ASSERT(b < b_end);
+ a+= a_wlen;
+ b+= b_wlen;
+ }
+ DBUG_ASSERT(0);
+ return 0;
+}
+
+
+/**
+ Compare two strings according to the collation, with PAD SPACE handling.
+
+ @param cs - the character set and collation
+ @param a - the left string
+ @param a_length - the length of the left string
+ @param b - the right string
+ @param b_length - the length of the right string
+ @param diff_if_only_endspace_difference - not used in the code.
+ TODO: this should be eventually removed (in 10.2?)
+ @return - the comparison result
+*/
+
+static int
+MY_FUNCTION_NAME(strnncollsp)(CHARSET_INFO *cs __attribute__((unused)),
+ const uchar *a, size_t a_length,
+ const uchar *b, size_t b_length,
+ my_bool diff_if_only_endspace_difference
+ __attribute__((unused)))
+{
+ const uchar *a_end= a + a_length;
+ const uchar *b_end= b + b_length;
+ for ( ; ; )
+ {
+ int a_weight, b_weight, res;
+ uint a_wlen= MY_FUNCTION_NAME(scan_weight)(&a_weight, a, a_end);
+ uint b_wlen= MY_FUNCTION_NAME(scan_weight)(&b_weight, b, b_end);
+ if ((res= (a_weight - b_weight)))
+ {
+ /*
+ Got two different weights. Each weight can be generated by either of:
+ - a real character
+ - a bad byte sequence or an incomplete byte sequence
+ - an auto-generated trailing space (PAD SPACE)
+ It does not matter how exactly each weight was generated.
+ Just return the weight difference.
+ */
+ return res;
+ }
+ if (!a_wlen && !b_wlen)
+ {
+ /*
+ Got two auto-generated trailing spaces, i.e.
+ both strings have now ended, so they are equal.
+ */
+ DBUG_ASSERT(a == a_end);
+ DBUG_ASSERT(b == b_end);
+ return 0;
+ }
+ /*
+ At least one of the strings has not ended yet, continue comparison.
+ */
+ DBUG_ASSERT(a < a_end || b < b_end);
+ a+= a_wlen;
+ b+= b_wlen;
+ }
+ DBUG_ASSERT(0);
+ return 0;
+}
+
+/*
+ We usually include this file at least two times from the same source file,
+ for the _ci and the _bin collations. Prepare for the second inclusion.
+*/
+#undef MY_FUNCTION_NAME
+#undef WEIGHT_ILSEQ
+#undef WEIGHT_MB1
+#undef WEIGHT_MB2
+#undef WEIGHT_MB3
+#undef WEIGHT_MB4
+#undef WEIGHT_PAD_SPACE
diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt
index 75ebd4af3cd..c45e5e49747 100644
--- a/support-files/CMakeLists.txt
+++ b/support-files/CMakeLists.txt
@@ -58,7 +58,7 @@ IF(UNIX)
ENDFOREACH()
IF(INSTALL_SUPPORTFILESDIR)
INSTALL(FILES magic DESTINATION ${inst_location} COMPONENT SupportFiles)
- INSTALL(DIRECTORY RHEL4-SElinux/ DESTINATION ${inst_location}/SELinux/RHEL4 COMPONENT SupportFiles)
+ INSTALL(DIRECTORY policy DESTINATION ${inst_location}/policy COMPONENT SupportFiles)
ENDIF()
CONFIGURE_FILE(mariadb.pc.in ${CMAKE_CURRENT_BINARY_DIR}/mariadb.pc @ONLY)
@@ -93,6 +93,8 @@ IF(UNIX)
COMPONENT Client)
INSTALL(FILES rpm/server.cnf DESTINATION ${INSTALL_SYSCONF2DIR}
COMPONENT IniFiles)
+ INSTALL(FILES rpm/enable_encryption.preset DESTINATION ${INSTALL_SYSCONF2DIR}
+ COMPONENT IniFiles)
ENDIF()
# This is for SuSE:
diff --git a/support-files/RHEL4-SElinux/mysql.fc b/support-files/RHEL4-SElinux/mysql.fc
deleted file mode 100644
index aa0fced4bbc..00000000000
--- a/support-files/RHEL4-SElinux/mysql.fc
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (C) 2007 MySQL AB
-# Use is subject to license terms
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-
-# MySQL Database Server
-
-#
-# /etc
-#
-/etc/my\.cnf -- gen_context(system_u:object_r:mysqld_etc_t,s0)
-/etc/mysql(/.*)? gen_context(system_u:object_r:mysqld_etc_t,s0)
-
-#
-# /usr
-# Red Hat compatibility
-/usr/libexec/mysqld -- gen_context(system_u:object_r:mysqld_exec_t,s0)
-
-# MySQL AB compatibility
-/usr/sbin/mysqld(-max)? -- gen_context(system_u:object_r:mysqld_exec_t,s0)
-
-#
-# /var
-#
-/var/lib/mysql(/.*)? gen_context(system_u:object_r:mysqld_db_t,s0)
-/var/lib/mysql/mysql\.sock -s gen_context(system_u:object_r:mysqld_var_run_t,s0)
-
-/var/log/mysql.* -- gen_context(system_u:object_r:mysqld_log_t,s0)
-
-/var/run/mysqld(/.*)? gen_context(system_u:object_r:mysqld_var_run_t,s0)
diff --git a/support-files/RHEL4-SElinux/mysql.te b/support-files/RHEL4-SElinux/mysql.te
deleted file mode 100644
index d2609244640..00000000000
--- a/support-files/RHEL4-SElinux/mysql.te
+++ /dev/null
@@ -1,147 +0,0 @@
-# Copyright (C) 2007 MySQL AB
-# Use is subject to license terms
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-
-policy_module(mysql,1.0.0)
-
-########################################
-#
-# Declarations
-#
-
-type mysqld_t;
-type mysqld_exec_t;
-init_daemon_domain(mysqld_t,mysqld_exec_t)
-
-type mysqld_var_run_t;
-files_pid_file(mysqld_var_run_t)
-
-type mysqld_db_t;
-files_type(mysqld_db_t)
-
-type mysqld_etc_t alias etc_mysqld_t;
-files_config_file(mysqld_etc_t)
-
-type mysqld_log_t;
-logging_log_file(mysqld_log_t)
-
-type mysqld_tmp_t;
-files_tmp_file(mysqld_tmp_t)
-
-########################################
-#
-# Local policy
-#
-
-allow mysqld_t self:capability { dac_override setgid setuid sys_resource net_bind_service };
-dontaudit mysqld_t self:capability sys_tty_config;
-allow mysqld_t self:process { setsched getsched setrlimit signal_perms rlimitinh };
-allow mysqld_t self:fifo_file { read write };
-allow mysqld_t self:unix_stream_socket create_stream_socket_perms;
-allow mysqld_t self:tcp_socket create_stream_socket_perms;
-allow mysqld_t self:udp_socket create_socket_perms;
-
-allow mysqld_t mysqld_db_t:dir create_dir_perms;
-allow mysqld_t mysqld_db_t:file create_file_perms;
-allow mysqld_t mysqld_db_t:lnk_file create_lnk_perms;
-files_var_lib_filetrans(mysqld_t,mysqld_db_t,{ dir file })
-
-allow mysqld_t mysqld_etc_t:file { getattr read };
-allow mysqld_t mysqld_etc_t:lnk_file { getattr read };
-allow mysqld_t mysqld_etc_t:dir list_dir_perms;
-
-allow mysqld_t mysqld_log_t:file create_file_perms;
-logging_log_filetrans(mysqld_t,mysqld_log_t,file)
-
-allow mysqld_t mysqld_tmp_t:dir create_dir_perms;
-allow mysqld_t mysqld_tmp_t:file create_file_perms;
-files_tmp_filetrans(mysqld_t, mysqld_tmp_t, { file dir })
-
-allow mysqld_t mysqld_var_run_t:dir rw_dir_perms;
-allow mysqld_t mysqld_var_run_t:sock_file create_file_perms;
-allow mysqld_t mysqld_var_run_t:file create_file_perms;
-files_pid_filetrans(mysqld_t,mysqld_var_run_t,file)
-
-kernel_read_system_state(mysqld_t)
-kernel_read_kernel_sysctls(mysqld_t)
-
-corenet_non_ipsec_sendrecv(mysqld_t)
-corenet_tcp_sendrecv_all_if(mysqld_t)
-corenet_udp_sendrecv_all_if(mysqld_t)
-corenet_tcp_sendrecv_all_nodes(mysqld_t)
-corenet_udp_sendrecv_all_nodes(mysqld_t)
-corenet_tcp_sendrecv_all_ports(mysqld_t)
-corenet_udp_sendrecv_all_ports(mysqld_t)
-corenet_tcp_bind_all_nodes(mysqld_t)
-corenet_tcp_bind_mysqld_port(mysqld_t)
-corenet_tcp_connect_mysqld_port(mysqld_t)
-corenet_sendrecv_mysqld_client_packets(mysqld_t)
-corenet_sendrecv_mysqld_server_packets(mysqld_t)
-
-dev_read_sysfs(mysqld_t)
-
-fs_getattr_all_fs(mysqld_t)
-fs_search_auto_mountpoints(mysqld_t)
-
-term_dontaudit_use_console(mysqld_t)
-
-domain_use_interactive_fds(mysqld_t)
-
-files_getattr_var_lib_dirs(mysqld_t)
-files_read_etc_runtime_files(mysqld_t)
-files_read_etc_files(mysqld_t)
-files_read_usr_files(mysqld_t)
-files_search_var_lib(mysqld_t)
-
-auth_use_nsswitch(mysqld_t)
-
-init_use_fds(mysqld_t)
-init_use_script_ptys(mysqld_t)
-
-libs_use_ld_so(mysqld_t)
-libs_use_shared_libs(mysqld_t)
-
-logging_send_syslog_msg(mysqld_t)
-
-miscfiles_read_localization(mysqld_t)
-
-sysnet_read_config(mysqld_t)
-
-userdom_dontaudit_use_unpriv_user_fds(mysqld_t)
-# for /root/.my.cnf - should not be needed:
-userdom_read_sysadm_home_content_files(mysqld_t)
-
-ifdef(`distro_redhat',`
- # because Fedora has the sock_file in the database directory
- type_transition mysqld_t mysqld_db_t:sock_file mysqld_var_run_t;
-')
-
-ifdef(`targeted_policy',`
- term_dontaudit_use_unallocated_ttys(mysqld_t)
- term_dontaudit_use_generic_ptys(mysqld_t)
- files_dontaudit_read_root_files(mysqld_t)
-')
-
-optional_policy(`
- daemontools_service_domain(mysqld_t, mysqld_exec_t)
-')
-
-optional_policy(`
- seutil_sigchld_newrole(mysqld_t)
-')
-
-optional_policy(`
- udev_read_db(mysqld_t)
-')
diff --git a/support-files/compiler_warnings.supp b/support-files/compiler_warnings.supp
index ddbfd1bbee9..5e0df670dae 100644
--- a/support-files/compiler_warnings.supp
+++ b/support-files/compiler_warnings.supp
@@ -56,6 +56,8 @@ buf/buf0buf\.c : label.*loop2.* defined but not used
#
storage/xtradb/handler/ha_innodb\.cc: ignoring return value of
storage/xtradb/row/row0log\.cc: ignoring return value of
+storage/xtradb/btr/btr0cur\.cc : null argument where non-null required
+storage/xtradb/btr/btr0scrub\.cc : null argument where non-null required
#
# bdb is not critical to keep up to date
@@ -176,22 +178,29 @@ jemalloc/src/jemalloc\.c: set but not used
#
# Connect engine
#
-storage/connect/connect\.cc: might be clobbered by ~longjmp~
+storage/connect/ha_connect\.cc: might be clobbered by
+storage/connect/connect\.cc: might be clobbered by
storage/connect/filamvct\.cpp: ignoring return value of
-storage/connect/filamvct\.cpp: might be clobbered by ~longjmp~
+storage/connect/filamvct\.cpp: might be clobbered by
storage/connect/xindex\.cpp: ignoring return value of
#
+# Mroonga
+#
+groonga/lib/expr\.c : const/copy propagation disabled
+
+#
# Unexplanable (?) stuff
#
-listener.cc : .*conversion from 'SOCKET' to 'int'.*
-net_serv.cc : .*conversion from 'SOCKET' to 'int'.*
+listener\.cc : .*conversion from 'SOCKET' to 'int'.*
+net_serv\.cc : .*conversion from 'SOCKET' to 'int'.*
#
# Ignorable warnings from header files
#
backward_warning\.h : This file includes at least one
/usr/include/i386-linux-gnu/bits/string3\.h: memset used with constant zero length parameter
+bits/string3.h : might overflow destination buffer
# allow a little moving space for the warning below
mi_packrec\.c : .*result of 32-bit shift implicitly converted to 64 bits.* : 560-600
diff --git a/support-files/policy/apparmor/README b/support-files/policy/apparmor/README
new file mode 100644
index 00000000000..271655f1e37
--- /dev/null
+++ b/support-files/policy/apparmor/README
@@ -0,0 +1,5 @@
+Note: The included AppArmor profiles can be used for MariaDB Galera cluster.
+However, since these profiles had been tested for a limited set of scenarios,
+it is highly recommended to run them in "complain" mode and report any denials
+on mariadb.org/jira.
+
diff --git a/support-files/policy/apparmor/usr.sbin.mysqld b/support-files/policy/apparmor/usr.sbin.mysqld
new file mode 100644
index 00000000000..307872c0fff
--- /dev/null
+++ b/support-files/policy/apparmor/usr.sbin.mysqld
@@ -0,0 +1,150 @@
+# Last Modified: Fri Mar 1 18:55:47 2013
+# Based on usr.sbin.mysqld packaged in mysql-server in Ubuntu.
+# This AppArmor profile has been copied under BSD License from
+# Percona XtraDB Cluster, along with some additions.
+
+#include <tunables/global>
+
+/usr/sbin/mysqld flags=(complain) {
+ #include <abstractions/base>
+ #include <abstractions/mysql>
+ #include <abstractions/nameservice>
+ #include <abstractions/user-tmp>
+ #include <abstractions/winbind>
+
+ capability chown,
+ capability dac_override,
+ capability setgid,
+ capability setuid,
+ capability sys_rawio,
+ capability sys_resource,
+
+ network tcp,
+
+ /bin/dash rcx,
+ /dev/dm-0 r,
+ /etc/gai.conf r,
+ /etc/group r,
+ /etc/hosts.allow r,
+ /etc/hosts.deny r,
+ /etc/ld.so.cache r,
+ /etc/mtab r,
+ /etc/my.cnf r,
+ /etc/mysql/*.cnf r,
+ /etc/mysql/*.pem r,
+ /etc/mysql/conf.d/ r,
+ /etc/mysql/conf.d/* r,
+ /etc/nsswitch.conf r,
+ /etc/passwd r,
+ /etc/services r,
+ /run/mysqld/mysqld.pid w,
+ /run/mysqld/mysqld.sock w,
+ /sys/devices/system/cpu/ r,
+ owner /tmp/** lk,
+ /tmp/** rw,
+ /usr/lib/mysql/plugin/ r,
+ /usr/lib/mysql/plugin/*.so* mr,
+ /usr/sbin/mysqld mr,
+ /usr/share/mysql/** r,
+ /var/lib/mysql/ r,
+ /var/lib/mysql/** rwk,
+ /var/log/mysql.err rw,
+ /var/log/mysql.log rw,
+ /var/log/mysql/ r,
+ /var/log/mysql/* rw,
+ /var/run/mysqld/mysqld.pid w,
+ /var/run/mysqld/mysqld.sock w,
+
+
+ profile /bin/dash flags=(complain) {
+ #include <abstractions/base>
+ #include <abstractions/bash>
+ #include <abstractions/mysql>
+ #include <abstractions/nameservice>
+ #include <abstractions/perl>
+
+
+
+ /bin/cat rix,
+ /bin/dash rix,
+ /bin/date rix,
+ /bin/grep rix,
+ /bin/nc.openbsd rix,
+ /bin/netstat rix,
+ /bin/ps rix,
+ /bin/rm rix,
+ /bin/sed rix,
+ /bin/sleep rix,
+ /bin/tar rix,
+ /bin/which rix,
+ /dev/tty rw,
+ /etc/ld.so.cache r,
+ /etc/my.cnf r,
+ /proc/ r,
+ /proc/*/cmdline r,
+ /proc/*/fd/ r,
+ /proc/*/net/dev r,
+ /proc/*/net/if_inet6 r,
+ /proc/*/net/tcp r,
+ /proc/*/net/tcp6 r,
+ /proc/*/stat r,
+ /proc/*/status r,
+ /proc/sys/kernel/pid_max r,
+ /proc/tty/drivers r,
+ /proc/uptime r,
+ /proc/version r,
+ /sbin/ifconfig rix,
+ /sys/devices/system/cpu/ r,
+ /tmp/** rw,
+ /usr/bin/cut rix,
+ /usr/bin/dirname rix,
+ /usr/bin/gawk rix,
+ /usr/bin/innobackupex rix,
+ /usr/bin/mysql rix,
+ /usr/bin/perl rix,
+ /usr/bin/seq rix,
+ /usr/bin/wsrep_sst* rix,
+ /usr/bin/wsrep_sst_common r,
+ /usr/bin/xtrabackup* rix,
+ /var/lib/mysql/ r,
+ /var/lib/mysql/** rw,
+ /var/lib/mysql/*.log w,
+ /var/lib/mysql/*.err w,
+
+# MariaDB additions
+ ptrace peer=@{profile_name},
+
+ /bin/hostname rix,
+ /bin/ip rix,
+ /bin/mktemp rix,
+ /bin/ss rix,
+ /bin/sync rix,
+ /bin/touch rix,
+ /bin/uname rix,
+ /etc/mysql/*.cnf r,
+ /etc/mysql/conf.d/ r,
+ /etc/mysql/conf.d/* r,
+ /proc/*/attr/current r,
+ /proc/*/fdinfo/* r,
+ /proc/*/net/* r,
+ /proc/locks r,
+ /proc/sys/net/ipv4/ip_local_port_range r,
+ /run/mysqld/mysqld.sock rw,
+ /sbin/ip rix,
+ /usr/bin/basename rix,
+ /usr/bin/du rix,
+ /usr/bin/find rix,
+ /usr/bin/lsof rix,
+ /usr/bin/my_print_defaults rix,
+ /usr/bin/mysqldump rix,
+ /usr/bin/pv rix,
+ /usr/bin/rsync rix,
+ /usr/bin/socat rix,
+ /usr/bin/tail rix,
+ /usr/bin/timeout rix,
+ /usr/bin/xargs rix,
+ /usr/bin/xbstream rix,
+ }
+ # Site-specific additions and overrides. See local/README for details.
+ #include <local/usr.sbin.mysqld>
+}
diff --git a/support-files/policy/apparmor/usr.sbin.mysqld.local b/support-files/policy/apparmor/usr.sbin.mysqld.local
new file mode 100644
index 00000000000..a0b8a0279de
--- /dev/null
+++ b/support-files/policy/apparmor/usr.sbin.mysqld.local
@@ -0,0 +1,4 @@
+# Site-specific additions and overrides for usr.sbin.mysqld..
+# For more details, please see /etc/apparmor.d/local/README.
+# This AppArmor profile has been copied under BSD License from
+# Percona XtraDB Cluster, along with some additions.
diff --git a/support-files/policy/selinux/README b/support-files/policy/selinux/README
new file mode 100644
index 00000000000..3f695dc27a3
--- /dev/null
+++ b/support-files/policy/selinux/README
@@ -0,0 +1,20 @@
+Note: The included SELinux policy files can be used for MariaDB Galera cluster.
+However, since these policies had been tested for a limited set of scenarios,
+it is highly recommended that you run mysqld in "permissive" mode even with
+these policies installed and report any denials on mariadb.org/jira.
+
+
+How to generate and load the policy module of MariaDB Galera cluster ?
+ * Generate the SELinux policy module.
+ # cd <source>/policy/selinux/
+ # make -f /usr/share/selinux/devel/Makefile mariadb-server.pp
+
+ * Load the generated policy module.
+ # semodule -i /path/to/mariadb-server.pp
+
+ * Lastly, run the following command to allow tcp/4568 and udp/4567.
+ # semanage port -a -t mysqld_port_t -p tcp 4568
+ # semanage port -a -t mysqld_port_t -p udp 4567
+
+How to run mysqld in permissve mode ?
+ # semanage permissive -a mysqld_t
diff --git a/support-files/policy/selinux/mariadb-server.fc b/support-files/policy/selinux/mariadb-server.fc
new file mode 100644
index 00000000000..1a69ecc2c40
--- /dev/null
+++ b/support-files/policy/selinux/mariadb-server.fc
@@ -0,0 +1,10 @@
+# This SELinux file contexts (.fc) file has been copied under BSD License from
+# Percona XtraDB Cluster.
+
+/etc/init\.d/rc\.d/mysql -- gen_context(system_u:object_r:mysqld_initrc_exec_t,s0)
+/var/lib/mysql/.*\.log -- gen_context(system_u:object_r:mysqld_log_t,s0)
+/var/lib/mysql/.*\.err -- gen_context(system_u:object_r:mysqld_log_t,s0)
+/var/lib/mysql/.*\.pid -- gen_context(system_u:object_r:mysqld_var_run_t,s0)
+/var/lib/mysql/.*\.cnf -- gen_context(system_u:object_r:mysqld_etc_t,s0)
+/usr/bin/xtrabackup.* -- gen_context(system_u:object_r:mysqld_exec_t,s0)
+/usr/bin/wsrep.* -- gen_context(system_u:object_r:mysqld_safe_exec_t,s0)
diff --git a/support-files/policy/selinux/mariadb-server.te b/support-files/policy/selinux/mariadb-server.te
new file mode 100644
index 00000000000..34d79326b10
--- /dev/null
+++ b/support-files/policy/selinux/mariadb-server.te
@@ -0,0 +1,99 @@
+# This SELinux type enforcement (.te) file has been copied under BSD License
+# from Percona XtraDB Cluster, along with some additions.
+
+module mariadb-server 1.0;
+
+require {
+ type user_tmp_t;
+ #type kerberos_master_port_t;
+ type mysqld_safe_t;
+ type tmp_t;
+ type tmpfs_t;
+ type hostname_exec_t;
+ type ifconfig_exec_t;
+ type sysctl_net_t;
+ type proc_net_t;
+ type port_t;
+ type mysqld_t;
+ type var_lib_t;
+ type rsync_exec_t;
+ type bin_t;
+ type shell_exec_t;
+ type anon_inodefs_t;
+ type fixed_disk_device_t;
+ class lnk_file read;
+ class process { getattr signull };
+ class unix_stream_socket connectto;
+ class capability { sys_resource sys_nice };
+ class tcp_socket { name_bind name_connect };
+ class file { execute setattr read create getattr execute_no_trans write ioctl open append unlink };
+ class sock_file { create unlink getattr };
+ class blk_file { read write open };
+ class dir { write search getattr add_name read remove_name open };
+
+# MariaDB additions
+ type kerberos_port_t;
+ type tram_port_t;
+ type mysqld_port_t;
+ class udp_socket name_bind;
+ class process setpgid;
+ class netlink_tcpdiag_socket { create nlmsg_read };
+}
+
+
+#============= mysqld_safe_t ==============
+allow mysqld_safe_t mysqld_t:process signull;
+allow mysqld_safe_t self:capability { sys_resource sys_nice };
+allow mysqld_safe_t tmp_t:file { create read write open getattr unlink ioctl setattr };
+allow mysqld_safe_t tmp_t:dir { write remove_name add_name };
+allow mysqld_safe_t tmp_t:sock_file { getattr unlink };
+allow mysqld_safe_t user_tmp_t:sock_file { getattr unlink };
+allow mysqld_safe_t var_lib_t:dir { write add_name };
+allow mysqld_safe_t var_lib_t:file { write ioctl setattr create open getattr append unlink };
+
+#============= mysqld_t ==============
+allow mysqld_t anon_inodefs_t:file write;
+allow mysqld_t tmp_t:sock_file { create unlink };
+allow mysqld_t tmpfs_t:dir { write search read remove_name open add_name };
+allow mysqld_t tmpfs_t:file { write getattr read create unlink open };
+allow mysqld_t fixed_disk_device_t:blk_file { read write open };
+allow mysqld_t ifconfig_exec_t:file { read execute open execute_no_trans getattr };
+
+#This rule allows connecting on 4444/4567/4568
+#allow mysqld_t kerberos_master_port_t:tcp_socket { name_bind name_connect };
+
+allow mysqld_t mysqld_safe_t:dir { getattr search };
+allow mysqld_t mysqld_safe_t:file { read open };
+allow mysqld_t self:unix_stream_socket connectto;
+allow mysqld_t port_t:tcp_socket { name_bind name_connect };
+allow mysqld_t proc_net_t:file { read getattr open };
+allow mysqld_t sysctl_net_t:dir search;
+allow mysqld_t var_lib_t:file { getattr open append };
+allow mysqld_t var_lib_t:sock_file { create unlink getattr };
+allow mysqld_t rsync_exec_t:file { read getattr open execute execute_no_trans };
+allow mysqld_t self:process getattr;
+allow mysqld_t hostname_exec_t:file { read getattr execute open execute_no_trans };
+allow mysqld_t user_tmp_t:dir { write add_name };
+allow mysqld_t user_tmp_t:file create;
+allow mysqld_t bin_t:lnk_file read;
+allow mysqld_t tmp_t:file { append create read write open getattr unlink setattr };
+
+# Allows too much leeway - the xtrabackup/wsrep rules in fc should fix it, but
+# keep for the moment.
+allow mysqld_t shell_exec_t:file { execute_no_trans getattr read execute open };
+allow mysqld_t bin_t:file { getattr read execute open execute_no_trans ioctl };
+
+# MariaDB additions
+allow mysqld_t self:process setpgid;
+# This rule allows port tcp/4444
+allow mysqld_t kerberos_port_t:tcp_socket { name_bind name_connect };
+# This rule allows port tcp/4567 (tram_port_t may not be available on
+# older versions)
+allow mysqld_t tram_port_t:tcp_socket name_bind;
+# This rule allows port udp/4567 (see README)
+allow mysqld_t mysqld_port_t:udp_socket name_bind;
+
+# Rules related to XtraBackup
+allow mysqld_t self:netlink_tcpdiag_socket { create nlmsg_read };
+allow mysqld_t sysctl_net_t:file { read getattr open };
+
diff --git a/support-files/rpm/enable_encryption.preset b/support-files/rpm/enable_encryption.preset
new file mode 100644
index 00000000000..103572be489
--- /dev/null
+++ b/support-files/rpm/enable_encryption.preset
@@ -0,0 +1,16 @@
+#
+# !include this file into your my.cnf (or any of *.cnf files in /etc/my.cnf.d)
+# and it will enable data at rest encryption. This is a simple way to
+# ensure that everything that can be encrypted will be and your
+# data will not leak unencrypted.
+#
+# If in the future more encryption related options will be implemented,
+# this file will enable them too.
+#
+[mariadb]
+aria-encrypt-tables
+encrypt-binlog
+encrypt-tmp-disk-tables
+encrypt-tmp-files
+loose-innodb-encrypt-log
+loose-innodb-encrypt-tables
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 51e549d9d1b..98f42ff8c26 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -2277,6 +2277,11 @@ static void test_ps_query_cache()
"(2, 'hh', 'hh'), (1, 'ii', 'ii'), (2, 'ii', 'ii')");
myquery(rc);
+ rc= mysql_query(lmysql, "set global query_cache_type=ON");
+ myquery(rc);
+ rc= mysql_query(lmysql, "set local query_cache_type=ON");
+ myquery(rc);
+
for (iteration= TEST_QCACHE_ON; iteration <= TEST_QCACHE_ON_OFF; iteration++)
{
@@ -2426,7 +2431,9 @@ static void test_ps_query_cache()
if (lmysql != mysql)
mysql_close(lmysql);
- rc= mysql_query(mysql, "set global query_cache_size=0");
+ rc= mysql_query(mysql, "set global query_cache_size=default");
+ myquery(rc);
+ rc= mysql_query(mysql, "set global query_cache_type=default");
myquery(rc);
}
@@ -13167,6 +13174,10 @@ static void test_open_cursor_prepared_statement_query_cache()
return;
}
+ rc= mysql_query(mysql, "set global query_cache_type=ON");
+ myquery(rc);
+ rc= mysql_query(mysql, "set local query_cache_type=ON");
+ myquery(rc);
rc= mysql_query(mysql, "set global query_cache_size=1000000");
myquery(rc);
@@ -13189,7 +13200,9 @@ static void test_open_cursor_prepared_statement_query_cache()
check_execute(stmt, rc);
mysql_stmt_close(stmt);
- rc= mysql_query(mysql, "set global query_cache_size=1000000");
+ rc= mysql_query(mysql, "set global query_cache_type=default");
+ myquery(rc);
+ rc= mysql_query(mysql, "set global query_cache_size=default");
myquery(rc);
}
@@ -17959,6 +17972,8 @@ static void test_bug36326()
myquery(rc);
rc= mysql_query(mysql, "SET GLOBAL query_cache_type = 1");
myquery(rc);
+ rc= mysql_query(mysql, "SET LOCAL query_cache_type = 1");
+ myquery(rc);
rc= mysql_query(mysql, "SET GLOBAL query_cache_size = 1048576");
myquery(rc);
DIE_UNLESS(!(mysql->server_status & SERVER_STATUS_IN_TRANS));
@@ -17982,7 +17997,8 @@ static void test_bug36326()
DIE_UNLESS(rc == 1);
rc= mysql_query(mysql, "DROP TABLE t1");
myquery(rc);
- rc= mysql_query(mysql, "SET GLOBAL query_cache_size = 0");
+ rc= mysql_query(mysql, "SET GLOBAL query_cache_size = default");
+ rc= mysql_query(mysql, "SET GLOBAL query_cache_type = default");
myquery(rc);
DBUG_VOID_RETURN;
diff --git a/unittest/mysys/CMakeLists.txt b/unittest/mysys/CMakeLists.txt
index 8c09a466451..9455ad83849 100644
--- a/unittest/mysys/CMakeLists.txt
+++ b/unittest/mysys/CMakeLists.txt
@@ -13,9 +13,12 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-MY_ADD_TESTS(bitmap base64 my_vsnprintf my_atomic my_rdtsc lf my_malloc
+MY_ADD_TESTS(bitmap base64 my_vsnprintf my_atomic my_rdtsc lf my_malloc aes
+ my_getopt
LINK_LIBRARIES mysys)
+ADD_DEFINITIONS(${SSL_DEFINES})
+
MY_ADD_TESTS(ma_dyncol
LINK_LIBRARIES mysqlclient)
diff --git a/unittest/mysys/aes-t.c b/unittest/mysys/aes-t.c
new file mode 100644
index 00000000000..2d65b434cc3
--- /dev/null
+++ b/unittest/mysys/aes-t.c
@@ -0,0 +1,99 @@
+/* Copyright (c) 2003, 2006, 2007 MySQL AB, 2009 Sun Microsystems, Inc.
+ Use is subject to license terms.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include <my_global.h>
+#include <my_sys.h>
+#include <my_crypt.h>
+#include <tap.h>
+#include <string.h>
+#include <ctype.h>
+
+#define DO_TEST(mode, nopad, slen, fill, dlen, hash) \
+ SKIP_BLOCK_IF(mode == 0xDEADBEAF, nopad ? 4 : 5, #mode " not supported") \
+ { \
+ memset(src, fill, src_len= slen); \
+ ok(my_aes_crypt(mode, nopad | ENCRYPTION_FLAG_ENCRYPT, \
+ src, src_len, dst, &dst_len, \
+ key, sizeof(key), iv, sizeof(iv)) == MY_AES_OK, \
+ "encrypt " #mode " %u %s", src_len, nopad ? "nopad" : "pad"); \
+ if (!nopad) \
+ ok (dst_len == my_aes_get_size(mode, src_len), "my_aes_get_size");\
+ my_md5(md5, (char*)dst, dst_len); \
+ ok(dst_len == dlen && memcmp(md5, hash, sizeof(md5)) == 0, "md5"); \
+ ok(my_aes_crypt(mode, nopad | ENCRYPTION_FLAG_DECRYPT, \
+ dst, dst_len, ddst, &ddst_len, \
+ key, sizeof(key), iv, sizeof(iv)) == MY_AES_OK, \
+ "decrypt " #mode " %u", dst_len); \
+ ok(ddst_len == src_len && memcmp(src, ddst, src_len) == 0, "memcmp"); \
+ }
+
+#define DO_TEST_P(M,S,F,D,H) DO_TEST(M,0,S,F,D,H)
+#define DO_TEST_N(M,S,F,D,H) DO_TEST(M,ENCRYPTION_FLAG_NOPAD,S,F,D,H)
+
+/* useful macro for debugging */
+#define PRINT_MD5() \
+ do { \
+ uint i; \
+ printf("\""); \
+ for (i=0; i < sizeof(md5); i++) \
+ printf("\\x%02x", md5[i]); \
+ printf("\"\n"); \
+ } while(0);
+
+#ifndef HAVE_EncryptAes128Ctr
+const uint MY_AES_CTR=0xDEADBEAF;
+#endif
+#ifndef HAVE_EncryptAes128Gcm
+const uint MY_AES_GCM=0xDEADBEAF;
+#endif
+
+int
+main(int argc __attribute__((unused)),char *argv[])
+{
+ uchar key[16]= {1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6};
+ uchar iv[16]= {2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7};
+ uchar src[1000], dst[1100], ddst[1000];
+ uchar md5[MY_MD5_HASH_SIZE];
+ uint src_len, dst_len, ddst_len;
+
+ MY_INIT(argv[0]);
+
+ plan(87);
+ DO_TEST_P(MY_AES_ECB, 200, '.', 208, "\xd8\x73\x8e\x3a\xbc\x66\x99\x13\x7f\x90\x23\x52\xee\x97\x6f\x9a");
+ DO_TEST_P(MY_AES_ECB, 128, '?', 144, "\x19\x58\x33\x85\x4c\xaa\x7f\x06\xd1\xb2\xec\xd7\xb7\x6a\xa9\x5b");
+ DO_TEST_P(MY_AES_CBC, 159, '%', 160, "\x4b\x03\x18\x3d\xf1\xa7\xcd\xa1\x46\xb3\xc6\x8a\x92\xc0\x0f\xc9");
+ DO_TEST_P(MY_AES_CBC, 192, '@', 208, "\x54\xc4\x75\x1d\xff\xe0\xf6\x80\xf0\x85\xbb\x8b\xda\x07\x21\x17");
+ DO_TEST_N(MY_AES_ECB, 200, '.', 200, "\xbf\xec\x43\xd1\x66\x8d\x01\xad\x3a\x25\xee\xa6\x3d\xc6\xc4\x68");
+ DO_TEST_N(MY_AES_ECB, 128, '?', 128, "\x5b\x44\x20\xf3\xd9\xb4\x9d\x74\x5e\xb7\x5a\x0a\xe7\x32\x35\xc3");
+ DO_TEST_N(MY_AES_CBC, 159, '%', 159, "\xf3\x6e\x40\x00\x3c\x08\xa0\xb1\x2d\x1f\xcf\xce\x54\xc9\x73\x83");
+ DO_TEST_N(MY_AES_CBC, 192, '@', 192, "\x30\xe5\x28\x8c\x4a\x3b\x02\xd7\x56\x40\x59\x25\xac\x58\x09\x22");
+ DO_TEST_P(MY_AES_CTR, 200, '.', 200, "\x5a\x77\x19\xea\x67\x50\xe3\xab\x7f\x39\x6f\xc4\xa8\x09\xc5\x88");
+ DO_TEST_P(MY_AES_GCM, 128, '?', 144, "\x54\x6a\x7c\xa2\x04\xdc\x6e\x80\x1c\xcd\x5f\x7a\x7b\x08\x9e\x9d");
+
+ /* test short inputs (less that one block) */
+ DO_TEST_P(MY_AES_ECB, 1, '.', 16, "\x6c\xd7\x66\x5b\x1b\x1e\x3a\x04\xfd\xb1\x91\x8d\x0e\xfd\xf1\x86");
+ DO_TEST_P(MY_AES_ECB, 2, '?', 16, "\xdb\x84\x9e\xaf\x5f\xcc\xdb\x6b\xf2\x1c\xeb\x53\x75\xa3\x53\x5e");
+ DO_TEST_P(MY_AES_CBC, 3, '%', 16, "\x60\x8e\x45\x9a\x07\x39\x63\xce\x02\x19\xdd\x52\xe3\x09\x2a\x66");
+ DO_TEST_P(MY_AES_CBC, 4, '@', 16, "\x90\xc2\x6b\xf8\x84\x79\x83\xbd\xc1\x60\x71\x04\x55\x6a\xce\x9e");
+ DO_TEST_N(MY_AES_ECB, 5, '.', 5, "\x6b\x60\xdc\xa4\x24\x9b\x02\xbb\x24\x41\x9b\xb0\xd1\x01\xcd\xba");
+ DO_TEST_N(MY_AES_ECB, 6, '?', 6, "\x35\x8f\xb7\x9d\xd9\x61\x21\xcf\x25\x66\xd5\x9e\x91\xc1\x42\x7e");
+ DO_TEST_N(MY_AES_CBC, 7, '%', 7, "\x94\x5e\x80\x71\x41\x7a\x64\x5d\x6f\x2e\x5b\x66\x9b\x5a\x3d\xda");
+ DO_TEST_N(MY_AES_CBC, 8, '@', 8, "\xb8\x53\x97\xb9\x40\xa6\x98\xaf\x0c\x7b\x9a\xac\xad\x7e\x3c\xe0");
+ DO_TEST_P(MY_AES_GCM, 9, '?', 25, "\x5e\x05\xfd\xb2\x8e\x17\x04\x1e\xff\x6d\x71\x81\xcd\x85\x8d\xb5");
+
+ my_end(0);
+ return exit_status();
+}
diff --git a/unittest/mysys/my_getopt-t.c b/unittest/mysys/my_getopt-t.c
new file mode 100644
index 00000000000..c4c26e88624
--- /dev/null
+++ b/unittest/mysys/my_getopt-t.c
@@ -0,0 +1,356 @@
+/* Copyright (c) 2015, MariaDB Corporation
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND ANY
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+*/
+
+#include <my_global.h>
+#include <my_getopt.h>
+#include <mysys_err.h>
+#include <tap.h>
+
+ulong mopts_num;
+char *mopts_str;
+my_bool mopts_bool;
+static struct my_option mopts_options[]=
+{
+ {"str", 0,
+ "Something numeric.",
+ &mopts_str, &mopts_str, 0, GET_STR,
+ REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"bool", 0,
+ "Something true or false",
+ &mopts_bool, &mopts_bool, 0, GET_BOOL,
+ OPT_ARG, FALSE, 0, 0, 0, 0, 0},
+ {"num", 0,
+ "Something numeric.",
+ &mopts_num, &mopts_num, 0, GET_ULONG,
+ REQUIRED_ARG, 1000000L, 1, ULONG_MAX, 0, 2, 0},
+ { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
+};
+
+int mopts1_argc= 4;
+const char *mopts1_argv[]= {"mopts1", "--num=123", "--str=str", "--bool"};
+void test_mopts1()
+{
+ int rc;
+ char **av= (char **)mopts1_argv;
+
+ rc= handle_options(&mopts1_argc, &av, mopts_options, NULL);
+ ok( (rc == 0), "%s", "test_mopts1 call");
+ ok( (mopts_num == 122), "%s", "test_mopts1 num");
+ ok( (strncmp(mopts_str, "str", 4) == 0), "%s", "test_mopts1 str");
+ ok( (mopts_bool == 1), "%s", "test_mopts1 bool");
+}
+
+int mopts2_argc= 4;
+const char *mopts2_argv[]= {"mopts2", "--num=123", "--num=124", "--bool=0"};
+void test_mopts2()
+{
+ int rc;
+ char **av= (char **)mopts2_argv;
+
+ rc= handle_options(&mopts2_argc, &av, mopts_options, NULL);
+ ok( (rc == 0), "%s", "test_mopts2 call");
+ ok( (mopts_num == 124), "%s", "test_mopts2 num");
+ ok( (strncmp(mopts_str, "ddd", 4) == 0), "%s", "test_mopts2 str");
+ ok( (mopts_bool == 0), "%s", "test_mopts2 bool");
+}
+
+int mopts3_argc= 4;
+const char *mopts3_argv[]= {"mopts3", "--loose-foo", "--loose-loose-foo", "--enable-bool"};
+void test_mopts3()
+{
+ int rc;
+ char **av= (char **)mopts3_argv;
+
+ rc= handle_options(&mopts3_argc, &av, mopts_options, NULL);
+ ok( (rc == 0), "%s", "test_mopts3 call");
+ ok( (mopts_num == 1000000L), "%s", "test_mopts3 num");
+ ok( (strncmp(mopts_str, "ddd", 4) == 0), "%s", "test_mopts3 str");
+ ok( (mopts_bool == 1), "%s", "test_mopts3 bool");
+}
+
+int mopts4_argc= 3;
+const char *mopts4_argv[]= {"mopts4", "--loose-str=aa", "--skip-bool"};
+void test_mopts4()
+{
+ int rc;
+ char **av= (char **)mopts4_argv;
+
+ rc= handle_options(&mopts4_argc, &av, mopts_options, NULL);
+ ok( (rc == 0), "%s", "test_mopts4 call");
+ ok( (mopts_num == 1000000L), "%s", "test_mopts4 num");
+ ok( (strncmp(mopts_str, "aa", 3) == 0), "%s", "test_mopts4 str");
+ ok( (mopts_bool == 0), "%s", "test_mopts4 bool");
+}
+
+int mopts5_argc= 2;
+const char *mopts5_argv[]= {"mopts5", "--loose-skip-bool"};
+void test_mopts5()
+{
+ int rc;
+ char **av= (char **)mopts5_argv;
+
+ rc= handle_options(&mopts5_argc, &av, mopts_options, NULL);
+ ok( (rc == 0), "%s", "test_mopts5 call");
+ ok( (mopts_num == 1000000L), "%s", "test_mopts5 num");
+ ok( (strncmp(mopts_str, "ddd", 4) == 0), "%s", "test_mopts5 str");
+ ok( (mopts_bool == 0), "%s", "test_mopts5 bool");
+}
+
+int mopts6_argc= 2;
+const char *mopts6_argv[]= {"mopts6", "--loose-skip-skip-bool"};
+void test_mopts6()
+{
+ int rc;
+ char **av= (char **)mopts6_argv;
+
+ rc= handle_options(&mopts6_argc, &av, mopts_options, NULL);
+ ok( (rc == 0), "%s", "test_mopts6 call");
+ ok( (mopts_num == 1000000L), "%s", "test_mopts6 num");
+ ok( (strncmp(mopts_str, "ddd", 4) == 0), "%s", "test_mopts6 str");
+ ok( (mopts_bool == 0), "%s", "test_mopts6 bool");
+}
+
+int mopts7_argc= 2;
+const char *mopts7_argv[]= {"mopts7", "--loose-disable-skip-bool"};
+void test_mopts7()
+{
+ int rc;
+ char **av= (char **)mopts7_argv;
+
+ rc= handle_options(&mopts7_argc, &av, mopts_options, NULL);
+ ok( (rc == 0), "%s", "test_mopts7 call");
+ ok( (mopts_num == 1000000L), "%s", "test_mopts7 num");
+ ok( (strncmp(mopts_str, "ddd", 4) == 0), "%s", "test_mopts7 str");
+ ok( (mopts_bool == 0), "%s", "test_mopts7 bool");
+}
+
+int mopts8_argc= 2;
+const char *mopts8_argv[]= {"mopts8", "--loose-disable-enable-bool"};
+void test_mopts8()
+{
+ int rc;
+ char **av= (char **)mopts8_argv;
+
+ rc= handle_options(&mopts8_argc, &av, mopts_options, NULL);
+ ok( (rc == 0), "%s", "test_mopts8 call");
+ ok( (mopts_num == 1000000L), "%s", "test_mopts7 num");
+ ok( (strncmp(mopts_str, "ddd", 4) == 0), "%s", "test_mopts7 str");
+ ok( (mopts_bool == 1), "%s", "test_mopts7 bool");
+}
+
+int mopts9_argc= 2;
+const char *mopts9_argv[]= {"mopts9", "--foo"};
+void test_mopts9()
+{
+ int rc;
+ char **av= (char **)mopts9_argv;
+
+ rc= handle_options(&mopts9_argc, &av, mopts_options, NULL);
+ ok( (rc != 0), "%s", "test_mopts9 call");
+}
+
+int mopts10_argc= 2;
+const char *mopts10_argv[]= {"mopts10", "--skip-foo"};
+void test_mopts10()
+{
+ int rc;
+ char **av= (char **)mopts10_argv;
+
+ rc= handle_options(&mopts10_argc, &av, mopts_options, NULL);
+ ok( (rc != 0), "%s", "test_mopts10 call");
+}
+
+ulong auto_num;
+static struct my_option auto_options[]=
+{
+ {"anum", 0,
+ "Something numeric.",
+ &auto_num, &auto_num, 0, GET_ULONG | GET_AUTO,
+ REQUIRED_ARG, 1000000L, 1, ULONG_MAX, 0, 1, 0},
+ {"num", 0,
+ "Something numeric.",
+ &mopts_num, &mopts_num, 0, GET_ULONG,
+ REQUIRED_ARG, 1000000L, 1, ULONG_MAX, 0, 1, 0},
+ { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
+};
+
+
+
+my_bool auto_get_one_option(int optid __attribute__((unused)),
+ const struct my_option *opt,
+ char *argument)
+{
+ if (argument == autoset_my_option)
+ {
+ *((ulong*)opt->value)= 111;
+ }
+ return FALSE;
+}
+
+int auto1_argc= 3;
+const char *auto1_argv[]= {"auto1", "--anum=123", "--autoset-anum"};
+void test_auto1()
+{
+ int rc;
+ char **av= (char **)auto1_argv;
+
+ rc= handle_options(&auto1_argc, &av, auto_options, NULL);
+ ok( (rc == EXIT_ARGUMENT_INVALID), "%s", "test_auto1 call");
+}
+
+int auto2_argc= 3;
+const char *auto2_argv[]= {"auto2", "--num=123", "--autoset-num"};
+void test_auto2()
+{
+ int rc;
+ char **av= (char **)auto2_argv;
+
+ rc= handle_options(&auto2_argc, &av, auto_options, &auto_get_one_option);
+ ok( (rc == EXIT_ARGUMENT_INVALID), "%s", "test_auto2 call");
+}
+
+int auto3_argc= 3;
+const char *auto3_argv[]= {"auto3", "--anum=123", "--autoset-anum"};
+void test_auto3()
+{
+ int rc;
+ char **av= (char **)auto3_argv;
+
+ rc= handle_options(&auto3_argc, &av, auto_options, &auto_get_one_option);
+ ok( (rc == 0), "%s", "test_auto3 call");
+ ok( (mopts_num == 1000000L), "%s", "test_auto3 num");
+ ok( (auto_num == 111), "%s", "test_auto3 anum");
+}
+
+int auto4_argc= 3;
+const char *auto4_argv[]= {"auto4", "--loose-autoset-num", "--loose-autoset-anum"};
+void test_auto4()
+{
+ int rc;
+ char **av= (char **)auto4_argv;
+
+ rc= handle_options(&auto4_argc, &av, auto_options, &auto_get_one_option);
+ ok( (rc == 0), "%s", "test_auto4 call");
+ ok( (mopts_num == 1000000L), "%s", "test_auto4 num");
+ ok( (auto_num == 111), "%s", "test_auto4 anum");
+}
+
+int auto5_argc= 3;
+const char *auto5_argv[]= {"auto5", "--autoset-loose-num", "--autoset-loose-anum"};
+void test_auto5()
+{
+ int rc;
+ char **av= (char **)auto5_argv;
+
+ rc= handle_options(&auto5_argc, &av, auto_options, &auto_get_one_option);
+ ok( (rc == 0), "%s", "test_auto5 call");
+ ok( (mopts_num == 1000000L), "%s", "test_auto5 num");
+ ok( (auto_num == 111), "%s", "test_auto5 anum");
+}
+
+int auto6_argc= 3;
+const char *auto6_argv[]= {"auto6", "--autoset-anum", "--anum=123"};
+void test_auto6()
+{
+ int rc;
+ char **av= (char **)auto6_argv;
+
+ rc= handle_options(&auto6_argc, &av, auto_options, &auto_get_one_option);
+ ok( (rc == 0), "%s", "test_auto6 call");
+ ok( (mopts_num == 1000000L), "%s", "test_auto6 num");
+ ok( (auto_num == 123), "%s", "test_auto6 anum");
+}
+
+
+ulong max_num= ULONG_MAX;
+static struct my_option max_options[]=
+{
+ {"num", 0,
+ "Something numeric.",
+ &mopts_num, &max_num, 0, GET_ULONG,
+ REQUIRED_ARG, 1000000L, 1, 1000001L, 0, 1, 0},
+ { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
+};
+
+int max1_argc= 3;
+const char *max1_argv[]= {"max1", "--num=100", "--num=200"};
+void test_max1()
+{
+ int rc;
+ char **av= (char **)max1_argv;
+
+ rc= handle_options(&max1_argc, &av, max_options, NULL);
+ ok( (rc == 0), "%s", "test_max1 call");
+ ok( (mopts_num == 200), "%s", "test_max1 num");
+ ok( (max_num == 1000001L), "%s", "test_max1 max_num");
+}
+int max2_argc= 3;
+const char *max2_argv[]= {"max2", "--maximum-num=100", "--num=200"};
+void test_max2()
+{
+ int rc;
+ char **av= (char **)max2_argv;
+
+ rc= handle_options(&max2_argc, &av, max_options, NULL);
+ ok( (rc == 0), "%s", "test_max2 call");
+ ok( (mopts_num == 200), "%s", "test_max2 num");
+ ok( (max_num == 100), "%s", "test_max2 max_num");
+}
+
+int main(int argc __attribute__((unused)), char **argv)
+{
+ MY_INIT(argv[0]);
+ plan(4*8 + 1*4 + 3*4 + 3*2);
+
+ /* gcc 4.1.2 doesn't want it in the initializer, we have to do it run-time */
+ mopts_options[0].def_value= (intptr)"ddd";
+
+ test_mopts1();
+ test_mopts2();
+ test_mopts3();
+ test_mopts4();
+ test_mopts5();
+ test_mopts6();
+ test_mopts7();
+ test_mopts8();
+
+ test_mopts9();
+ test_mopts10();
+ test_auto1();
+ test_auto2();
+
+ test_auto3();
+ test_auto4();
+ test_auto5();
+ test_auto6();
+
+ test_max1();
+ test_max2();
+
+ my_end(0);
+ return exit_status();
+}
diff --git a/unittest/sql/CMakeLists.txt b/unittest/sql/CMakeLists.txt
index 7cc05e8cea2..cd2ba9b3d2f 100644
--- a/unittest/sql/CMakeLists.txt
+++ b/unittest/sql/CMakeLists.txt
@@ -28,5 +28,9 @@ ELSE()
ENDIF()
TARGET_LINK_LIBRARIES(explain_filename-t sql mytap)
-ADD_TEST(explain_filename explain_filename-t)
+MY_ADD_TEST(explain_filename)
+ADD_EXECUTABLE(mf_iocache-t mf_iocache-t.cc ../../sql/mf_iocache_encr.cc)
+TARGET_LINK_LIBRARIES(mf_iocache-t mysys mytap)
+ADD_DEPENDENCIES(mf_iocache-t GenError)
+MY_ADD_TEST(mf_iocache)
diff --git a/unittest/sql/mf_iocache-t.cc b/unittest/sql/mf_iocache-t.cc
new file mode 100644
index 00000000000..590684ea3cc
--- /dev/null
+++ b/unittest/sql/mf_iocache-t.cc
@@ -0,0 +1,166 @@
+/* Copyright (C) 2015 MariaDB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include <my_sys.h>
+#include <my_crypt.h>
+#include <tap.h>
+
+/*** tweaks and stubs for encryption code to compile ***************/
+#define KEY_SIZE (128/8)
+
+my_bool encrypt_tmp_files;
+int init_io_cache_encryption();
+
+uint encryption_key_get_latest_version_func(uint)
+{
+ return 1;
+}
+
+uint encryption_key_id_exists_func(uint)
+{
+ return 1;
+}
+
+uint encryption_key_version_exists_func(uint, uint)
+{
+ return 1;
+}
+
+uint encryption_key_get_func(uint, uint, uchar* key, uint* size)
+{
+ if (*size < KEY_SIZE)
+ {
+ *size= KEY_SIZE;
+ return ENCRYPTION_KEY_BUFFER_TOO_SMALL;
+ }
+ memset(key, KEY_SIZE, *size= KEY_SIZE);
+ return 0;
+}
+
+#ifdef HAVE_EncryptAes128Gcm
+enum my_aes_mode aes_mode= MY_AES_GCM;
+#else
+enum my_aes_mode aes_mode= MY_AES_CBC;
+#endif
+
+int encryption_ctx_init_func(void *ctx, const unsigned char* key, unsigned int klen,
+ const unsigned char* iv, unsigned int ivlen,
+ int flags, unsigned int key_id,
+ unsigned int key_version)
+{
+ return my_aes_crypt_init(ctx, aes_mode, flags, key, klen, iv, ivlen);
+}
+
+uint encryption_encrypted_length_func(unsigned int slen, unsigned int key_id, unsigned int key_version)
+{
+ return my_aes_get_size(aes_mode, slen);
+}
+
+struct encryption_service_st encryption_handler=
+{
+ encryption_key_get_latest_version_func,
+ encryption_key_get_func,
+ (uint (*)(unsigned int, unsigned int))my_aes_ctx_size,
+ encryption_ctx_init_func,
+ my_aes_crypt_update,
+ my_aes_crypt_finish,
+ encryption_encrypted_length_func
+};
+
+void sql_print_information(const char *format, ...)
+{
+}
+
+void sql_print_error(const char *format, ...)
+{
+}
+
+/*** end of encryption tweaks and stubs ****************************/
+
+IO_CACHE info;
+#define CACHE_SIZE 16384
+
+#define INFO_TAIL ", pos_in_file = %llu, pos_in_mem = %lu", \
+ info.pos_in_file, (*info.current_pos - info.request_pos)
+
+#define FILL 0x5A
+
+int data_bad(const uchar *buf, size_t len)
+{
+ const uchar *end= buf + len;
+ while (buf < end)
+ if (*buf++ != FILL)
+ return 1;
+ return 0;
+}
+
+void temp_io_cache()
+{
+ int res;
+ uchar buf[CACHE_SIZE + 200];
+ memset(buf, FILL, sizeof(buf));
+
+ init_io_cache_encryption();
+
+ res= open_cached_file(&info, 0, 0, CACHE_SIZE, 0);
+ ok(res == 0, "open_cached_file" INFO_TAIL);
+
+ res= my_b_write(&info, buf, 100);
+ ok(res == 0 && info.pos_in_file == 0, "small write" INFO_TAIL );
+
+ res= my_b_write(&info, buf, sizeof(buf));
+ ok(res == 0 && info.pos_in_file == CACHE_SIZE, "large write" INFO_TAIL);
+
+ res= reinit_io_cache(&info, WRITE_CACHE, 250, 0, 0);
+ ok(res == 0, "reinit with rewind" INFO_TAIL);
+
+ res= my_b_write(&info, buf, sizeof(buf));
+ ok(res == 0, "large write" INFO_TAIL);
+
+ res= my_b_flush_io_cache(&info, 1);
+ ok(res == 0, "flush" INFO_TAIL);
+
+ res= reinit_io_cache(&info, READ_CACHE, 0, 0, 0);
+ ok(res == 0, "reinit READ_CACHE" INFO_TAIL);
+
+ res= my_pread(info.file, buf, 50, 50, MYF(MY_NABP));
+ ok(res == 0 && data_bad(buf, 50) == encrypt_tmp_files,
+ "check encryption, file must be %sreadable", encrypt_tmp_files ?"un":"");
+
+ res= my_b_read(&info, buf, 50) || data_bad(buf, 50);
+ ok(res == 0 && info.pos_in_file == 0, "small read" INFO_TAIL);
+
+ res= my_b_read(&info, buf, sizeof(buf)) || data_bad(buf, sizeof(buf));
+ ok(res == 0 && info.pos_in_file == CACHE_SIZE, "large read" INFO_TAIL);
+
+ close_cached_file(&info);
+}
+
+int main(int argc __attribute__((unused)),char *argv[])
+{
+ MY_INIT(argv[0]);
+ plan(20);
+
+ /* temp files */
+ encrypt_tmp_files= 0;
+ temp_io_cache();
+
+ encrypt_tmp_files= 1;
+ temp_io_cache();
+
+ my_end(0);
+ return exit_status();
+}
+
diff --git a/unittest/strings/strings-t.c b/unittest/strings/strings-t.c
index 6baef0417a8..fe595a5c303 100644
--- a/unittest/strings/strings-t.c
+++ b/unittest/strings/strings-t.c
@@ -95,11 +95,674 @@ static CHARSET_INFO *charset_list[]=
};
+typedef struct
+{
+ const char *a;
+ size_t alen;
+ const char *b;
+ size_t blen;
+ int res;
+} STRNNCOLL_PARAM;
+
+
+#define CSTR(x) (x),(sizeof(x)-1)
+
+/*
+ Byte sequence types used in the tests:
+ 8BIT - a 8 bit byte (>=00x80) which makes a single byte characters
+ MB2 - two bytes that make a valid character
+ H2 - a byte which is a valid MB2 head byte
+ T2 - a byte which is a valid MB2 tail byte
+ ILSEQ - a byte which makes an illegal sequence
+ H2+ILSEQ - a sequence that starts with a valid H2 byte,
+ but not followed by a valid T2 byte.
+
+ Charset H2 T2 8BIT
+ ------- ---------------- --------------- --------
+ big5 [A1..F9] [40..7E,A1..FE]
+ euckr [81..FE] [41..5A,61..7A,81..FE]
+ gb2312 [A1..F7] [A1..FE]
+ gbk [81..FE] [40..7E,80..FE]
+
+ cp932 [81..9F,E0..FC] [40..7E,80..FC] [A1..DF]
+ sjis [81..9F,E0..FC] [40..7E,80..FC] [A1..DF]
+
+
+ Essential byte sequences in various character sets:
+
+ Sequence big5 cp932 euckr gb2312 gbk sjis
+ -------- ---- ----- ----- ------ --- ----
+ 80 ILSEQ ILSEQ ILSEQ ILSEQ ILSEQ ILSEQ
+ 81 ILSEQ H2 H2 ILSEQ H2 H2
+ A1 H2 8BIT H2 H2 H2 8BIT
+ A1A1 MB2 8BIT+8BIT MB2 MB2 MB2 8BIT+8BIT
+ E0E0 MB2 MB2 MB2 MB2 MB2 MB2
+ F9FE MB2 H2+ILSEQ MB2 ILSEQ+T2 MB2 H2+ILSEQ
+*/
+
+
+/*
+ For character sets that have the following byte sequences:
+ 80 - ILSEQ
+ 81 - ILSEQ or H2
+ F9 - ILSEQ or H2
+ A1A1 - MB2 or 8BIT+8BIT
+ E0E0 - MB2
+*/
+static STRNNCOLL_PARAM strcoll_mb2_common[]=
+{
+ /* Compare two good sequences */
+ {CSTR(""), CSTR(""), 0},
+ {CSTR(""), CSTR(" "), 0},
+ {CSTR(""), CSTR("A"), -1},
+ {CSTR(""), CSTR("a"), -1},
+ {CSTR(""), CSTR("\xA1\xA1"), -1},
+ {CSTR(""), CSTR("\xE0\xE0"), -1},
+
+ {CSTR(" "), CSTR(""), 0},
+ {CSTR(" "), CSTR(" "), 0},
+ {CSTR(" "), CSTR("A"), -1},
+ {CSTR(" "), CSTR("a"), -1},
+ {CSTR(" "), CSTR("\xA1\xA1"), -1},
+ {CSTR(" "), CSTR("\xE0\xE0"), -1},
+
+ {CSTR("a"), CSTR(""), 1},
+ {CSTR("a"), CSTR(" "), 1},
+ {CSTR("a"), CSTR("a"), 0},
+ {CSTR("a"), CSTR("\xA1\xA1"), -1},
+ {CSTR("a"), CSTR("\xE0\xE0"), -1},
+
+ {CSTR("\xA1\xA1"), CSTR("\xA1\xA1"), 0},
+ {CSTR("\xA1\xA1"), CSTR("\xE0\xE0"), -1},
+
+ /* Compare a good character to an illegal or an incomplete sequence */
+ {CSTR(""), CSTR("\x80"), -1},
+ {CSTR(""), CSTR("\x81"), -1},
+ {CSTR(""), CSTR("\xF9"), -1},
+
+ {CSTR(" "), CSTR("\x80"), -1},
+ {CSTR(" "), CSTR("\x81"), -1},
+ {CSTR(" "), CSTR("\xF9"), -1},
+
+ {CSTR("a"), CSTR("\x80"), -1},
+ {CSTR("a"), CSTR("\x81"), -1},
+ {CSTR("a"), CSTR("\xF9"), -1},
+
+ {CSTR("\xA1\xA1"), CSTR("\x80"), -1},
+ {CSTR("\xA1\xA1"), CSTR("\x81"), -1},
+ {CSTR("\xA1\xA1"), CSTR("\xF9"), -1},
+
+ {CSTR("\xE0\xE0"), CSTR("\x80"), -1},
+ {CSTR("\xE0\xE0"), CSTR("\x81"), -1},
+ {CSTR("\xE0\xE0"), CSTR("\xF9"), -1},
+
+ /* Compare two bad/incomplete sequences */
+ {CSTR("\x80"), CSTR("\x80"), 0},
+ {CSTR("\x80"), CSTR("\x81"), -1},
+ {CSTR("\x80"), CSTR("\xF9"), -1},
+ {CSTR("\x81"), CSTR("\x81"), 0},
+ {CSTR("\x81"), CSTR("\xF9"), -1},
+
+ {NULL, 0, NULL, 0, 0}
+};
+
+
+/*
+ For character sets that have good mb2 characters A1A1 and F9FE
+*/
+static STRNNCOLL_PARAM strcoll_mb2_A1A1_mb2_F9FE[]=
+{
+ /* Compare two good characters */
+ {CSTR(""), CSTR("\xF9\xFE"), -1},
+ {CSTR(" "), CSTR("\xF9\xFE"), -1},
+ {CSTR("a") , CSTR("\xF9\xFE"), -1},
+ {CSTR("\xA1\xA1"), CSTR("\xF9\xFE"), -1},
+ {CSTR("\xF9\xFE"), CSTR("\xF9\xFE"), 0},
+
+ /* Compare a good character to an illegal or an incomplete sequence */
+ {CSTR(""), CSTR("\xA1"), -1},
+ {CSTR(""), CSTR("\xF9"), -1},
+ {CSTR("a"), CSTR("\xA1"), -1},
+ {CSTR("a"), CSTR("\xF9"), -1},
+
+ {CSTR("\xA1\xA1"), CSTR("\xA1"), -1},
+ {CSTR("\xA1\xA1"), CSTR("\xF9"), -1},
+
+ {CSTR("\xF9\xFE"), CSTR("\x80"), -1},
+ {CSTR("\xF9\xFE"), CSTR("\x81"), -1},
+ {CSTR("\xF9\xFE"), CSTR("\xA1"), -1},
+ {CSTR("\xF9\xFE"), CSTR("\xF9"), -1},
+
+ /* Compare two bad/incomplete sequences */
+ {CSTR("\x80"), CSTR("\xA1"), -1},
+ {CSTR("\x80"), CSTR("\xF9"), -1},
+
+ {NULL, 0, NULL, 0, 0}
+};
+
+
+/*
+ For character sets that have:
+ A1A1 - a good mb2 character
+ F9FE - a bad sequence
+*/
+static STRNNCOLL_PARAM strcoll_mb2_A1A1_bad_F9FE[]=
+{
+ /* Compare a good character to an illegal or an incomplete sequence */
+ {CSTR(""), CSTR("\xF9\xFE"), -1},
+ {CSTR(" "), CSTR("\xF9\xFE"), -1},
+ {CSTR("a") , CSTR("\xF9\xFE"), -1},
+ {CSTR("\xA1\xA1"), CSTR("\xF9\xFE"), -1},
+
+ {CSTR(""), CSTR("\xA1"), -1},
+ {CSTR(""), CSTR("\xF9"), -1},
+ {CSTR("a"), CSTR("\xA1"), -1},
+ {CSTR("a"), CSTR("\xF9"), -1},
+
+ {CSTR("\xA1\xA1"), CSTR("\xA1"), -1},
+ {CSTR("\xA1\xA1"), CSTR("\xF9"), -1},
+
+ /* Compare two bad/incomplete sequences */
+ {CSTR("\xF9\xFE"), CSTR("\x80"), 1},
+ {CSTR("\xF9\xFE"), CSTR("\x81"), 1},
+ {CSTR("\xF9\xFE"), CSTR("\xA1"), 1},
+ {CSTR("\xF9\xFE"), CSTR("\xF9"), 1},
+ {CSTR("\x80"), CSTR("\xA1"), -1},
+ {CSTR("\x80"), CSTR("\xF9"), -1},
+ {CSTR("\xF9\xFE"), CSTR("\xF9\xFE"), 0},
+
+ {NULL, 0, NULL, 0, 0}
+};
+
+
+/*
+ For character sets that have:
+ 80 - ILSEQ or H2
+ 81 - ILSEQ or H2
+ A1 - 8BIT
+ F9 - ILSEQ or H2
+ F9FE - a bad sequence (ILSEQ+XX or H2+ILSEQ)
+*/
+static STRNNCOLL_PARAM strcoll_mb1_A1_bad_F9FE[]=
+{
+ /* Compare two good characters */
+ {CSTR(""), CSTR("\xA1"), -1},
+ {CSTR("\xA1\xA1"), CSTR("\xA1"), 1},
+
+ /* Compare a good character to an illegal or an incomplete sequence */
+ {CSTR(""), CSTR("\xF9"), -1},
+ {CSTR(""), CSTR("\xF9\xFE"), -1},
+ {CSTR(" "), CSTR("\xF9\xFE"), -1},
+ {CSTR("a"), CSTR("\xF9\xFE"), -1},
+ {CSTR("a"), CSTR("\xA1"), -1},
+ {CSTR("a"), CSTR("\xF9"), -1},
+
+ {CSTR("\xA1\xA1"), CSTR("\xF9"), -1},
+ {CSTR("\xA1\xA1"), CSTR("\xF9\xFE"), -1},
+
+ {CSTR("\xF9\xFE"), CSTR("\x80"), 1},
+ {CSTR("\xF9\xFE"), CSTR("\x81"), 1},
+ {CSTR("\xF9\xFE"), CSTR("\xA1"), 1},
+ {CSTR("\xF9\xFE"), CSTR("\xF9"), 1},
+
+ {CSTR("\x80"), CSTR("\xA1"), 1},
+
+ /* Compare two bad/incomplete sequences */
+ {CSTR("\x80"), CSTR("\xF9"), -1},
+ {CSTR("\xF9\xFE"), CSTR("\xF9\xFE"), 0},
+
+ {NULL, 0, NULL, 0, 0}
+};
+
+
+/*
+ For character sets (e.g. cp932 and sjis) that have:
+ 8181 - a valid MB2 character
+ A1 - a valid 8BIT character
+ E0E0 - a valid MB2 character
+ and sort in this order:
+ 8181 < A1 < E0E0
+*/
+static STRNNCOLL_PARAM strcoll_8181_A1_E0E0[]=
+{
+ {CSTR("\x81\x81"), CSTR("\xA1"), -1},
+ {CSTR("\x81\x81"), CSTR("\xE0\xE0"), -1},
+ {CSTR("\xA1"), CSTR("\xE0\xE0"), -1},
+
+ {NULL, 0, NULL, 0, 0}
+};
+
+
+/*
+ A shared test for eucjpms and ujis.
+*/
+static STRNNCOLL_PARAM strcoll_ujis[]=
+{
+ {CSTR("\x8E\xA1"), CSTR("\x8E"), -1}, /* Good MB2 vs incomplete MB2 */
+ {CSTR("\x8E\xA1"), CSTR("\x8F\xA1"), -1}, /* Good MB2 vs incomplete MB3 */
+ {CSTR("\x8E\xA1"), CSTR("\x8F\xA1\xA1"), -1}, /* Good MB2 vs good MB3 */
+ {CSTR("\xA1\xA1"), CSTR("\x8F\xA1\xA1"), 1}, /* Good MB2 vs good MB3 */
+ {CSTR("\x8E"), CSTR("\x8F\xA1"), -1}, /* Incomplete MB2 vs incomplete MB3 */
+ {NULL, 0, NULL, 0, 0}
+};
+
+
+static STRNNCOLL_PARAM strcoll_utf8mb3_common[]=
+{
+ {CSTR("\xC0"), CSTR("\xC1"), -1}, /* Unused byte vs unused byte */
+ {CSTR("\xC0"), CSTR("\xFF"), -1}, /* Unused byte vs unused byte */
+ {CSTR("\xC2\xA1"), CSTR("\xC0"), -1}, /* MB2 vs unused byte */
+ {CSTR("\xC2\xA1"), CSTR("\xC2"), -1}, /* MB2 vs incomplete MB2 */
+ {CSTR("\xC2\xA1"), CSTR("\xC2\xA2"), -1}, /* MB2 vs MB2 */
+ {CSTR("\xC2\xA1"), CSTR("\xE0\xA0\x7F"),-1}, /* MB2 vs broken MB3 */
+ {CSTR("\xC2\xA1"), CSTR("\xE0\xA0\x80"),-1}, /* MB2 vs MB3 */
+ {CSTR("\xC2\xA1"), CSTR("\xE0\xA0\xBF"),-1}, /* MB2 vs MB3 */
+ {CSTR("\xC2\xA1"), CSTR("\xE0\xA0\xC0"),-1}, /* MB2 vs broken MB3 */
+ {CSTR("\xC2\xA1"), CSTR("\xE0\xA0"), -1}, /* MB2 vs incomplete MB3 */
+ {CSTR("\xE0\xA0\x7E"), CSTR("\xE0\xA0\x7F"),-1},/* Broken MB3 vs broken MB3 */
+ {CSTR("\xE0\xA0\x80"), CSTR("\xE0\xA0"), -1},/* MB3 vs incomplete MB3 */
+ {CSTR("\xE0\xA0\x80"), CSTR("\xE0\xA0\x7F"),-1},/* MB3 vs broken MB3 */
+ {CSTR("\xE0\xA0\x80"), CSTR("\xE0\xA0\xBF"),-1},/* MB3 vs MB3 */
+ {CSTR("\xE0\xA0\x80"), CSTR("\xE0\xA0\xC0"),-1},/* MB3 vs broken MB3 */
+ {CSTR("\xE0\xA0\xC0"), CSTR("\xE0\xA0\xC1"),-1},/* Broken MB3 vs broken MB3 */
+ {NULL, 0, NULL, 0, 0}
+};
+
+
+static STRNNCOLL_PARAM strcoll_utf8mb4_common[]=
+{
+ /* Minimum four-byte character: U+10000 == _utf8 0xF0908080 */
+ {CSTR("\xF0\x90\x80\x80"), CSTR("\xC0"), -1}, /* MB4 vs unused byte */
+ {CSTR("\xF0\x90\x80\x80"), CSTR("\xC2"), -1}, /* MB4 vs incomplete MB2 */
+ {CSTR("\xF0\x90\x80\x80"), CSTR("\xE0\xA0\x7F"),-1}, /* MB4 vs broken MB3 */
+ {CSTR("\xF0\x90\x80\x80"), CSTR("\xE0\xA0\xC0"),-1}, /* MB4 vs broken MB3 */
+ {CSTR("\xF0\x90\x80\x80"), CSTR("\xE0\xA0"), -1}, /* MB4 vs incomplete MB3 */
+ {CSTR("\xF0\x90\x80\x80"), CSTR("\xF0\x90\x80"),-1}, /* MB4 vs incomplete MB4 */
+ {CSTR("\xF0\x90\x80\x80"), CSTR("\xF0\x90\x80\x7F"),-1},/* MB4 vs broken MB4 */
+ {CSTR("\xF0\x90\x80\x80"), CSTR("\xF0\x90\x80\xC0"),-1},/* MB4 vs broken MB4 */
+
+ /* Maximum four-byte character: U+10FFFF == _utf8 0xF48FBFBF */
+ {CSTR("\xF4\x8F\xBF\xBF"), CSTR("\xC0"), -1}, /* MB4 vs unused byte */
+ {CSTR("\xF4\x8F\xBF\xBF"), CSTR("\xC2"), -1}, /* MB4 vs incomplete MB2 */
+ {CSTR("\xF4\x8F\xBF\xBF"), CSTR("\xE0\xA0\x7F"),-1}, /* MB4 vs broken MB3 */
+ {CSTR("\xF4\x8F\xBF\xBF"), CSTR("\xE0\xA0\xC0"),-1}, /* MB4 vs broken MB3 */
+ {CSTR("\xF4\x8F\xBF\xBF"), CSTR("\xE0\xA0"), -1}, /* MB4 vs incomplete MB3 */
+ {CSTR("\xF4\x8F\xBF\xBF"), CSTR("\xF0\x90\x80"),-1}, /* MB4 vs incomplete MB4 */
+ {CSTR("\xF4\x8F\xBF\xBF"), CSTR("\xF0\x90\x80\x7F"),-1},/* MB4 vs broken MB4 */
+ {CSTR("\xF4\x8F\xBF\xBF"), CSTR("\xF0\x90\x80\xC0"),-1},/* MB4 vs broken MB4 */
+
+ /* Broken MB4 vs incomplete/broken MB3 */
+ {CSTR("\xF0\x90\x80\x7F"), CSTR("\xE0\xA0"), 1}, /* Broken MB4 vs incomplete MB3 */
+ {CSTR("\xF0\x90\x80\x7F"), CSTR("\xE0\xA0\x7F"),1}, /* Broken MB4 vs broken MB3 */
+ {CSTR("\xF0\x90\x80\x7F"), CSTR("\xE0\xA0\xC0"),1}, /* Broken MB4 vs broken MB3 */
+
+ /*
+ Broken MB4 vs incomplete MB4:
+ The three leftmost bytes are compared binary, the fourth byte is compared
+ to auto-padded space.
+ */
+ {CSTR("\xF0\x90\x80\x1F"), CSTR("\xF0\x90\x80"),-1}, /* Broken MB4 vs incomplete MB4 */
+ {CSTR("\xF0\x90\x80\x7E"), CSTR("\xF0\x90\x80"),1}, /* Broken MB4 vs incomplete MB4 */
+
+ /* Broken MB4 vs broken MB4 */
+ {CSTR("\xF0\x90\x80\x7E"), CSTR("\xF0\x90\x80\x7F"),-1},/* Broken MB4 vs broken MB4 */
+ {CSTR("\xF0\x90\x80\x7E"), CSTR("\xF0\x90\x80\xC0"),-1},/* Broken MB4 vs broken MB4 */
+
+ {NULL, 0, NULL, 0, 0}
+};
+
+
+static STRNNCOLL_PARAM strcoll_utf8mb4_general_ci[]=
+{
+ /* All non-BMP characters are equal in utf8mb4_general_ci */
+ {CSTR("\xF0\x90\x80\x80"), CSTR("\xF0\x90\x80\x81"),0},/* Non-BMB MB4 vs non-BMP MB4 */
+ {CSTR("\xF0\x90\x80\x80"), CSTR("\xF4\x8F\xBF\xBF"),0},/* Non-BMB MB4 vs non-BMP MB4 */
+ {CSTR("\x00"), CSTR("\xF0\x90\x80\x80"),-1},/* U+0000 vs non-BMP MB4 */
+ {CSTR("\x00"), CSTR("\xF0\x90\x80\x81"),-1},/* U+0000 vs non-BMP MB4 */
+ {CSTR("\x00"), CSTR("\xF4\x8F\xBF\xBF"),-1},/* U+0000 vs non-BMP MB4 */
+ {NULL, 0, NULL, 0, 0}
+};
+
+
+static STRNNCOLL_PARAM strcoll_ucs2_common[]=
+{
+ {CSTR("\xC0"), CSTR("\xC1"), -1}, /* Incomlete MB2 vs incomplete MB2 */
+ {CSTR("\xC0"), CSTR("\xFF"), -1}, /* Incomlete MB2 vs incomplete MB2 */
+ {CSTR("\xC2\xA1"), CSTR("\xC0"), -1}, /* MB2 vs incomplete MB2 */
+ {CSTR("\xC2\xA1"), CSTR("\xC2"), -1}, /* MB2 vs incomplete MB2 */
+ {CSTR("\xC2\xA0"), CSTR("\xC2\xA1"), -1}, /* MB2 vs MB2 */
+ {CSTR("\xC2\xA1"), CSTR("\xC2\xA2"), -1}, /* MB2 vs MB2 */
+
+ {CSTR("\xFF\xFF"), CSTR("\x00"),-1}, /* MB2 vs incomplete */
+ {CSTR("\xFF\xFF\xFF\xFF"), CSTR("\x00"),-1}, /* MB2+MB2 vs incomplete */
+ {CSTR("\xFF\xFF\xFF\xFF"), CSTR("\x00\x00\x00"), 1},/* MB2+MB2 vs MB2+incomplete */
+
+ {NULL, 0, NULL, 0, 0}
+};
+
+
+/* Tests that involve comparison to SPACE (explicit, or padded) */
+static STRNNCOLL_PARAM strcoll_ucs2_space[]=
+{
+ {CSTR("\x00\x1F"), CSTR("\x00\x20"), -1}, /* MB2 vs MB2 */
+ {CSTR("\x00\x20"), CSTR("\x00\x21"), -1}, /* MB2 vs MB2 */
+ {CSTR("\x00\x1F"), CSTR(""), -1}, /* MB2 vs empty */
+ {CSTR("\x00\x20"), CSTR(""), 0}, /* MB2 vs empty */
+ {CSTR("\x00\x21"), CSTR(""), 1}, /* MB2 vs empty */
+
+ {NULL, 0, NULL, 0, 0}
+};
+
+
+/* Tests that involve comparison to SPACE (explicit, or padded) */
+static STRNNCOLL_PARAM strcoll_utf16le_space[]=
+{
+ {CSTR("\x1F\x00"), CSTR("\x20\x00"), -1}, /* MB2 vs MB2 */
+ {CSTR("\x20\x00"), CSTR("\x21\x00"), -1}, /* MB2 vs MB2 */
+ {CSTR("\x1F\x00"), CSTR(""), -1}, /* MB2 vs empty */
+ {CSTR("\x20\x00"), CSTR(""), 0}, /* MB2 vs empty */
+ {CSTR("\x21\x00"), CSTR(""), 1}, /* MB2 vs empty */
+
+ {NULL, 0, NULL, 0, 0}
+};
+
+
+static STRNNCOLL_PARAM strcoll_utf16_common[]=
+{
+ /* Minimum four-byte character: U+10000 == _utf16 0xD800DC00 */
+ {CSTR("\xD8\x00\xDC\x00"), CSTR("\xC0"), -1},/* MB4 vs incomplete MB2 */
+ {CSTR("\xD8\x00\xDC\x00"), CSTR("\xC2"), -1},/* MB4 vs incomplete MB2 */
+ {CSTR("\xD8\x00\xDC\x00"), CSTR("\xD8\x00\xDB\x00"),-1},/* MB4 vs broken MB4 */
+ {CSTR("\xD8\x00\xDC\x00"), CSTR("\xD8\x00\xE0\x00"),-1},/* MB4 vs broken MB4 */
+ {CSTR("\xD8\x00\xDC\x00"), CSTR("\xDC\x00"), -1},/* MB4 vs broken MB2 */
+ {CSTR("\xD8\x00\xDC\x00"), CSTR("\xD8\x00\xDC"), -1},/* MB4 vs incomplete MB4 */
+
+ /* Maximum four-byte character: U+10FFFF == _utf8 0xF48FBFBF */
+ {CSTR("\xDB\xFF\xDF\xFF"), CSTR("\xC0"), -1},/* MB4 vs incomplete MB2 */
+ {CSTR("\xDB\xFF\xDF\xFF"), CSTR("\xC2"), -1},/* MB4 vs incomplete MB2 */
+ {CSTR("\xDB\xFF\xDF\xFF"), CSTR("\xD8\x00\xDB\x00"),-1},/* MB4 vs broken MB4 */
+ {CSTR("\xDB\xFF\xDF\xFF"), CSTR("\xD8\x00\xE0\x00"),-1},/* MB4 vs broken MB4 */
+ {CSTR("\xDB\xFF\xDF\xFF"), CSTR("\xDC\x00"), -1},/* MB4 vs broken MB2 */
+ {CSTR("\xDB\xFF\xDF\xFF"), CSTR("\xDC\xFF\xDF"), -1},/* MB4 vs incomplete MB4 */
+
+ /* Broken MB4 vs broken MB4 */
+ {CSTR("\xD8\x00\xDC\x00"), CSTR("\xD8\x00\xDB\x01"),-1},/* Broken MB4 vs broken MB4 */
+ {CSTR("\xDB\xFF\xE0\xFE"), CSTR("\xDB\xFF\xE0\xFF"),-1},/* Broken MB4 vs broken MB4 */
+
+ {NULL, 0, NULL, 0, 0}
+};
+
+
+static STRNNCOLL_PARAM strcoll_utf16_general_ci[]=
+{
+ /* All non-BMP characters are compared as equal */
+ {CSTR("\xD8\x00\xDC\x00"), CSTR("\xD8\x00\xDC\x01"), 0},/* Non-BMP MB4 vs non-BMP MB4 */
+ {CSTR("\xD8\x00\xDC\x00"), CSTR("\xDB\xFF\xDF\xFF"), 0},/* Non-BMP MB4 vs non-BMP MB4 */
+ {CSTR("\x00\x00"), CSTR("\xD8\x00\xDC\x01"),-1},/* U+0000 vs non-BMP MB4 */
+ {CSTR("\x00\x00"), CSTR("\xDB\xFF\xDF\xFF"),-1},/* U+0000 vs non-BMP MB4 */
+ {NULL, 0, NULL, 0, 0}
+};
+
+
+static STRNNCOLL_PARAM strcoll_utf16le_common[]=
+{
+ /* Minimum four-byte character: U+10000 == _utf16 0xD800DC00 */
+ {CSTR("\x00\xD8\x00\xDC"), CSTR("\xC0"), -1},/* MB4 vs incomplete MB2 */
+ {CSTR("\x00\xD8\x00\xDC"), CSTR("\xC2"), -1},/* MB4 vs incomplete MB2 */
+ {CSTR("\x00\xD8\x00\xDC"), CSTR("\x00\xD8\x00\xDB"),-1},/* MB4 vs broken MB4 */
+ {CSTR("\x00\xD8\x00\xDC"), CSTR("\x00\xD8\x00\xD0"),-1},/* MB4 vs broken MB4 */
+ {CSTR("\x00\xD8\x00\xDC"), CSTR("\x00\xDC"), -1},/* MB4 vs broken MB2 */
+ {CSTR("\x00\xD8\x00\xDC"), CSTR("\x00\xD8\x00"), -1},/* MB4 vs incomplete MB4 */
+
+ /* Maximum four-byte character: U+10FFFF == _utf8 0xF48FBFBF */
+ {CSTR("\xFF\xDB\xFF\xDF"), CSTR("\xC0"), -1},/* MB4 vs incomplete MB2 */
+ {CSTR("\xFF\xDB\xFF\xDF"), CSTR("\xC2"), -1},/* MB4 vs incomplete MB2 */
+ {CSTR("\xFF\xDB\xFF\xDF"), CSTR("\x00\xD8\x00\xDB"),-1},/* MB4 vs broken MB4 */
+ {CSTR("\xFF\xDB\xFF\xDF"), CSTR("\x00\xD8\x00\xE0"),-1},/* MB4 vs broken MB4 */
+ {CSTR("\xFF\xDB\xFF\xDF"), CSTR("\x00\xDC"), -1},/* MB4 vs broken MB2 */
+ {CSTR("\xFF\xDB\xFF\xDF"), CSTR("\xFF\xDC\x00"), -1},/* MB4 vs incomplete MB4 */
+
+ /* Broken MB4 vs broken MB4 */
+ {CSTR("\x00\xD8\x00\xDC"), CSTR("\x00\xD8\x01\xDB"),-1},/* Broken MB4 vs broken MB4 */
+ {CSTR("\xFF\xDB\xFE\xE0"), CSTR("\xFF\xDB\xFF\xE0"),-1},/* Broken MB4 vs broken MB4 */
+
+ {NULL, 0, NULL, 0, 0}
+};
+
+
+static STRNNCOLL_PARAM strcoll_utf16le_general_ci[]=
+{
+ /* All non-BMP characters are compared as equal */
+ {CSTR("\x00\xD8\x00\xDC"), CSTR("\x00\xD8\x01\xDC"), 0},/* Non-BMP MB4 vs non-BMP MB4 */
+ {CSTR("\x00\xD8\x00\xDC"), CSTR("\xFF\xDB\xFF\xDF"), 0},/* Non-BMP MB4 vs non-BMP MB4 */
+ {CSTR("\x00\x00"), CSTR("\x00\xD8\x01\xDC"), -1},/* U+0000 vs non-BMP MB4 */
+ {CSTR("\x00\x00"), CSTR("\xFF\xDB\xFF\xDF"), -1},/* U+0000 vs non-BMP MB4 */
+
+ {NULL, 0, NULL, 0, 0}
+};
+
+
+static STRNNCOLL_PARAM strcoll_utf32_common[]=
+{
+ /* Minimum character: U+0000 == _utf32 0x00000000 */
+ {CSTR("\x00\x00\x00\x00"), CSTR("\x00"), -1}, /* MB4 vs incomplete MB4 */
+ {CSTR("\x00\x00\x00\x00"), CSTR("\xFF"), -1}, /* MB4 vs incomplete MB4 */
+ {CSTR("\x00\x00\x00\x00"), CSTR("\x00\x00"), -1}, /* MB4 vs incomplete MB4 */
+ {CSTR("\x00\x00\x00\x00"), CSTR("\x00\x00\x00"),-1}, /* MB4 vs incomplete MB4 */
+ {CSTR("\x00\x00\x00\x00"), CSTR("\x00\x20\x00\x00"),-1},/* MB4 vs broken MB4 */
+ {CSTR("\x00\x00\x00\x00"), CSTR("\xFF\xFF\xFF\xFF"),-1},/* MB4 vs broken MB4 */
+
+ /* Minimum non-BMP character: U+10000 == _utf32 0x00010000 */
+ {CSTR("\x00\x01\x00\x00"), CSTR("\x00"), -1}, /* MB4 vs incomplete MB4 */
+ {CSTR("\x00\x01\x00\x00"), CSTR("\xFF"), -1}, /* MB4 vs incomplete MB4 */
+ {CSTR("\x00\x01\x00\x00"), CSTR("\x00\x00"), -1}, /* MB4 vs incomplete MB4 */
+ {CSTR("\x00\x01\x00\x00"), CSTR("\x00\x00\x00"),-1}, /* MB4 vs incomplete MB4 */
+ {CSTR("\x00\x01\x00\x00"), CSTR("\x00\x20\x00\x00"),-1},/* MB4 vs broken MB4 */
+ {CSTR("\x00\x01\x00\x00"), CSTR("\xFF\xFF\xFF\xFF"),-1},/* MB4 vs broken MB4 */
+
+ /* Maximum character: U+10FFFF == _utf32 0x0010FFFF */
+ {CSTR("\x00\x10\xFF\xFF"), CSTR("\x00"), -1}, /* MB4 vs incomplete MB4 */
+ {CSTR("\x00\x10\xFF\xFF"), CSTR("\xFF"), -1}, /* MB4 vs incomplete MB4 */
+ {CSTR("\x00\x10\xFF\xFF"), CSTR("\x00\x00"), -1}, /* MB4 vs incomplete MB4 */
+ {CSTR("\x00\x10\xFF\xFF"), CSTR("\x00\x00\x00"), -1}, /* MB4 vs incomplete MB4 */
+ {CSTR("\x00\x10\xFF\xFF"), CSTR("\x20\x00\x00\x00"),-1},/* MB4 vs broken MB3 */
+ {CSTR("\x00\x10\xFF\xFF"), CSTR("\xFF\xFF\xFF\xFF"),-1},/* MB4 vs broken MB4 */
+
+
+ /* Broken MB4 vs incomplete/broken MB3 */
+ {CSTR("\x00\x20\x00\x00"), CSTR("\x00"), 1}, /* Broken MB4 vs incomplete MB4 */
+ {CSTR("\x00\x20\x00\x00"), CSTR("\x00\x00"), 1}, /* Broken MB4 vs incomplete MB4 */
+ {CSTR("\x00\x20\x00\x00"), CSTR("\x00\x00\x00"), 1}, /* Broken MB4 vs incomplete MB4 */
+ {CSTR("\x00\x20\x00\x00"), CSTR("\x00\x20\x00\x01"),-1},/* Broken MB4 vs broken MB4 */
+
+ {NULL, 0, NULL, 0, 0}
+};
+
+
+static STRNNCOLL_PARAM strcoll_utf32_general_ci[]=
+{
+ /* Two non-BMP characters are compared as equal */
+ {CSTR("\x00\x01\x00\x00"), CSTR("\x00\x01\x00\x01"), 0}, /* non-BMP MB4 vs non-BMP MB4 */
+ {CSTR("\x00\x00\x00\x00"), CSTR("\x00\x01\x00\x00"), -1}, /* U+0000 vs non-BMP MB4 */
+ {CSTR("\x00\x00\x00\x00"), CSTR("\x00\x01\x00\x01"), -1}, /* U+0000 vs non-BMP MB4 */
+
+ {NULL, 0, NULL, 0, 0}
+};
+
+
+static void
+str2hex(char *dst, size_t dstlen, const char *src, size_t srclen)
+{
+ char *dstend= dst + dstlen;
+ const char *srcend= src + srclen;
+ for (*dst= '\0' ; dst + 3 < dstend && src < srcend; )
+ {
+ sprintf(dst, "%02X", (unsigned char) src[0]);
+ dst+=2;
+ src++;
+ }
+}
+
+
+/*
+ Check if the two comparison result are semantically equal:
+ both are negative, both are positive, or both are zero.
+*/
+static int
+eqres(int ares, int bres)
+{
+ return (ares < 0 && bres < 0) ||
+ (ares > 0 && bres > 0) ||
+ (ares == 0 && bres == 0);
+}
+
+
+static int
+strcollsp(CHARSET_INFO *cs, const STRNNCOLL_PARAM *param)
+{
+ int failed= 0;
+ const STRNNCOLL_PARAM *p;
+ diag("%-20s %-10s %-10s %10s %10s", "Collation", "a", "b", "ExpectSign", "Actual");
+ for (p= param; p->a; p++)
+ {
+ char ahex[64], bhex[64];
+ int res= cs->coll->strnncollsp(cs, (uchar *) p->a, p->alen,
+ (uchar *) p->b, p->blen, 0);
+ str2hex(ahex, sizeof(ahex), p->a, p->alen);
+ str2hex(bhex, sizeof(bhex), p->b, p->blen);
+ diag("%-20s %-10s %-10s %10d %10d%s",
+ cs->name, ahex, bhex, p->res, res,
+ eqres(res, p->res) ? "" : " FAILED");
+ if (!eqres(res, p->res))
+ {
+ failed++;
+ }
+ else
+ {
+ /* Test in reverse order */
+ res= cs->coll->strnncollsp(cs, (uchar *) p->b, p->blen,
+ (uchar *) p->a, p->alen, 0);
+ if (!eqres(res, -p->res))
+ {
+ diag("Comparison in reverse order failed. Expected %d, got %d",
+ -p->res, res);
+ failed++;
+ }
+ }
+ }
+ return failed;
+}
+
+
+static int
+test_strcollsp()
+{
+ int failed= 0;
+#ifdef HAVE_CHARSET_big5
+ failed+= strcollsp(&my_charset_big5_chinese_ci, strcoll_mb2_common);
+ failed+= strcollsp(&my_charset_big5_chinese_ci, strcoll_mb2_A1A1_mb2_F9FE);
+ failed+= strcollsp(&my_charset_big5_bin, strcoll_mb2_common);
+ failed+= strcollsp(&my_charset_big5_bin, strcoll_mb2_A1A1_mb2_F9FE);
+#endif
+#ifdef HAVE_CHARSET_cp932
+ failed+= strcollsp(&my_charset_cp932_japanese_ci, strcoll_mb2_common);
+ failed+= strcollsp(&my_charset_cp932_japanese_ci, strcoll_mb1_A1_bad_F9FE);
+ failed+= strcollsp(&my_charset_cp932_bin, strcoll_mb2_common);
+ failed+= strcollsp(&my_charset_cp932_bin, strcoll_mb1_A1_bad_F9FE);
+ failed+= strcollsp(&my_charset_cp932_japanese_ci, strcoll_8181_A1_E0E0);
+ failed+= strcollsp(&my_charset_cp932_bin, strcoll_8181_A1_E0E0);
+#endif
+#ifdef HAVE_CHARSET_eucjpms
+ failed+= strcollsp(&my_charset_eucjpms_japanese_ci, strcoll_mb2_common);
+ failed+= strcollsp(&my_charset_eucjpms_bin, strcoll_mb2_common);
+ failed+= strcollsp(&my_charset_eucjpms_japanese_ci, strcoll_mb2_A1A1_mb2_F9FE);
+ failed+= strcollsp(&my_charset_eucjpms_bin, strcoll_mb2_A1A1_mb2_F9FE);
+ failed+= strcollsp(&my_charset_eucjpms_japanese_ci, strcoll_ujis);
+ failed+= strcollsp(&my_charset_eucjpms_bin, strcoll_ujis);
+#endif
+#ifdef HAVE_CHARSET_euckr
+ failed+= strcollsp(&my_charset_euckr_korean_ci, strcoll_mb2_common);
+ failed+= strcollsp(&my_charset_euckr_korean_ci, strcoll_mb2_A1A1_mb2_F9FE);
+ failed+= strcollsp(&my_charset_euckr_bin, strcoll_mb2_common);
+ failed+= strcollsp(&my_charset_euckr_bin, strcoll_mb2_A1A1_mb2_F9FE);
+#endif
+#ifdef HAVE_CHARSET_gb2312
+ failed+= strcollsp(&my_charset_gb2312_chinese_ci, strcoll_mb2_common);
+ failed+= strcollsp(&my_charset_gb2312_chinese_ci, strcoll_mb2_A1A1_bad_F9FE);
+ failed+= strcollsp(&my_charset_gb2312_bin, strcoll_mb2_common);
+ failed+= strcollsp(&my_charset_gb2312_bin, strcoll_mb2_A1A1_bad_F9FE);
+#endif
+#ifdef HAVE_CHARSET_gbk
+ failed+= strcollsp(&my_charset_gbk_chinese_ci, strcoll_mb2_common);
+ failed+= strcollsp(&my_charset_gbk_chinese_ci, strcoll_mb2_A1A1_mb2_F9FE);
+ failed+= strcollsp(&my_charset_gbk_bin, strcoll_mb2_common);
+ failed+= strcollsp(&my_charset_gbk_bin, strcoll_mb2_A1A1_mb2_F9FE);
+#endif
+#ifdef HAVE_CHARSET_sjis
+ failed+= strcollsp(&my_charset_sjis_japanese_ci, strcoll_mb2_common);
+ failed+= strcollsp(&my_charset_sjis_bin, strcoll_mb2_common);
+ failed+= strcollsp(&my_charset_sjis_japanese_ci, strcoll_mb1_A1_bad_F9FE);
+ failed+= strcollsp(&my_charset_sjis_bin, strcoll_mb1_A1_bad_F9FE);
+ failed+= strcollsp(&my_charset_sjis_japanese_ci, strcoll_8181_A1_E0E0);
+ failed+= strcollsp(&my_charset_sjis_bin, strcoll_8181_A1_E0E0);
+#endif
+#ifdef HAVE_CHARSET_ucs2
+ failed+= strcollsp(&my_charset_ucs2_general_ci, strcoll_ucs2_common);
+ failed+= strcollsp(&my_charset_ucs2_general_ci, strcoll_ucs2_space);
+ failed+= strcollsp(&my_charset_ucs2_bin, strcoll_ucs2_common);
+ failed+= strcollsp(&my_charset_ucs2_bin, strcoll_ucs2_space);
+#endif
+#ifdef HAVE_CHARSET_ujis
+ failed+= strcollsp(&my_charset_ujis_japanese_ci, strcoll_mb2_common);
+ failed+= strcollsp(&my_charset_ujis_bin, strcoll_mb2_common);
+ failed+= strcollsp(&my_charset_ujis_japanese_ci, strcoll_mb2_A1A1_mb2_F9FE);
+ failed+= strcollsp(&my_charset_ujis_bin, strcoll_mb2_A1A1_mb2_F9FE);
+ failed+= strcollsp(&my_charset_ujis_japanese_ci, strcoll_ujis);
+ failed+= strcollsp(&my_charset_ujis_bin, strcoll_ujis);
+#endif
+#ifdef HAVE_CHARSET_utf16
+ failed+= strcollsp(&my_charset_utf16_general_ci, strcoll_ucs2_common);
+ failed+= strcollsp(&my_charset_utf16_general_ci, strcoll_ucs2_space);
+ failed+= strcollsp(&my_charset_utf16_general_ci, strcoll_utf16_common);
+ failed+= strcollsp(&my_charset_utf16_general_ci, strcoll_utf16_general_ci);
+ failed+= strcollsp(&my_charset_utf16_bin, strcoll_ucs2_common);
+ failed+= strcollsp(&my_charset_utf16_bin, strcoll_ucs2_space);
+ failed+= strcollsp(&my_charset_utf16_bin, strcoll_utf16_common);
+
+ failed+= strcollsp(&my_charset_utf16le_general_ci,strcoll_ucs2_common);
+ failed+= strcollsp(&my_charset_utf16le_general_ci,strcoll_utf16le_space);
+ failed+= strcollsp(&my_charset_utf16le_general_ci,strcoll_utf16le_common);
+ failed+= strcollsp(&my_charset_utf16le_general_ci,strcoll_utf16le_general_ci);
+ failed+= strcollsp(&my_charset_utf16le_bin, strcoll_ucs2_common);
+ failed+= strcollsp(&my_charset_utf16le_bin, strcoll_utf16le_space);
+ failed+= strcollsp(&my_charset_utf16le_bin, strcoll_utf16le_common);
+#endif
+#ifdef HAVE_CHARSET_utf32
+ failed+= strcollsp(&my_charset_utf32_general_ci, strcoll_utf32_common);
+ failed+= strcollsp(&my_charset_utf32_general_ci, strcoll_utf32_general_ci);
+ failed+= strcollsp(&my_charset_utf32_bin, strcoll_utf32_common);
+#endif
+#ifdef HAVE_CHARSET_utf8
+ failed+= strcollsp(&my_charset_utf8_general_ci, strcoll_utf8mb3_common);
+ failed+= strcollsp(&my_charset_utf8_general_mysql500_ci, strcoll_utf8mb3_common);
+ failed+= strcollsp(&my_charset_utf8_bin, strcoll_utf8mb3_common);
+#endif
+#ifdef HAVE_CHARSET_utf8mb4
+ failed+= strcollsp(&my_charset_utf8mb4_general_ci, strcoll_utf8mb3_common);
+ failed+= strcollsp(&my_charset_utf8mb4_bin, strcoll_utf8mb3_common);
+ failed+= strcollsp(&my_charset_utf8mb4_general_ci, strcoll_utf8mb4_common);
+ failed+= strcollsp(&my_charset_utf8mb4_general_ci, strcoll_utf8mb4_general_ci);
+ failed+= strcollsp(&my_charset_utf8mb4_bin, strcoll_utf8mb4_common);
+#endif
+ return failed;
+}
+
+
int main()
{
size_t i, failed= 0;
- plan(1);
+ plan(2);
diag("Testing my_like_range_xxx() functions");
for (i= 0; i < array_elements(charset_list); i++)
@@ -112,5 +775,10 @@ int main()
}
}
ok(failed == 0, "Testing my_like_range_xxx() functions");
+
+ diag("Testing cs->coll->strnncollsp()");
+ failed= test_strcollsp();
+ ok(failed == 0, "Testing cs->coll->strnncollsp()");
+
return exit_status();
}
diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c
index 9a476eace71..96275b95f68 100644
--- a/vio/viosslfactories.c
+++ b/vio/viosslfactories.c
@@ -21,31 +21,42 @@
static my_bool ssl_algorithms_added = FALSE;
static my_bool ssl_error_strings_loaded= FALSE;
-/* the function below was generated with "openssl dhparam -2 -C 1024" */
+/* the function below was generated with "openssl dhparam -2 -C 2048" */
static
-DH *get_dh1024()
+DH *get_dh2048()
{
- static unsigned char dh1024_p[]={
- 0xEC,0x46,0x7E,0xF9,0x4E,0x10,0x29,0xDC,0x44,0x97,0x71,0xFD,
- 0x71,0xC6,0x9F,0x0D,0xD1,0x09,0xF6,0x58,0x6F,0xAD,0xCA,0xF4,
- 0x37,0xD5,0xC3,0xBD,0xC3,0x9A,0x51,0x66,0x2C,0x58,0xBD,0x02,
- 0xBD,0xBA,0xBA,0xFC,0xE7,0x0E,0x5A,0xE5,0x97,0x81,0xC3,0xF3,
- 0x28,0x2D,0xAD,0x00,0x91,0xEF,0xF8,0xF0,0x5D,0xE9,0xE7,0x18,
- 0xE2,0xAD,0xC4,0x70,0xC5,0x3C,0x12,0x8A,0x80,0x6A,0x9F,0x3B,
- 0x00,0xA2,0x8F,0xA9,0x26,0xB0,0x0E,0x7F,0xED,0xF6,0xC2,0x03,
- 0x81,0xB5,0xC5,0x41,0xD0,0x00,0x2B,0x21,0xD4,0x4B,0x74,0xA6,
- 0xD7,0x1A,0x0E,0x82,0xC8,0xEE,0xD4,0xB1,0x6F,0xB4,0x79,0x01,
- 0x8A,0xF1,0x12,0xD7,0x3C,0xFD,0xCB,0x9B,0xAE,0x1C,0xA9,0x0F,
- 0x3D,0x0F,0xF8,0xD6,0x7D,0xDE,0xD6,0x0B,
+ static unsigned char dh2048_p[]={
+ 0xA1,0xBB,0x7C,0x20,0xC5,0x5B,0xC0,0x7B,0x21,0x8B,0xD6,0xA8,
+ 0x15,0xFC,0x3B,0xBA,0xAB,0x9F,0xDF,0x68,0xC4,0x79,0x78,0x0D,
+ 0xC1,0x12,0x64,0xE4,0x15,0xC9,0x66,0xDB,0xF6,0xCB,0xB3,0x39,
+ 0x02,0x5B,0x78,0x62,0xFB,0x09,0xAE,0x09,0x6B,0xDD,0xD4,0x5D,
+ 0x97,0xBC,0xDC,0x7F,0xE6,0xD6,0xF1,0xCB,0xF5,0xEB,0xDA,0xA7,
+ 0x2E,0x5A,0x43,0x2B,0xE9,0x40,0xE2,0x85,0x00,0x1C,0xC0,0x0A,
+ 0x98,0x77,0xA9,0x31,0xDE,0x0B,0x75,0x4D,0x1E,0x1F,0x16,0x83,
+ 0xCA,0xDE,0xBD,0x21,0xFC,0xC1,0x82,0x37,0x36,0x33,0x0B,0x66,
+ 0x06,0x3C,0xF3,0xAF,0x21,0x57,0x57,0x80,0xF6,0x94,0x1B,0xA9,
+ 0xD4,0xF6,0x8F,0x18,0x62,0x0E,0xC4,0x22,0xF9,0x5B,0x62,0xCC,
+ 0x3F,0x19,0x95,0xCF,0x4B,0x00,0xA6,0x6C,0x0B,0xAF,0x9F,0xD5,
+ 0xFA,0x3D,0x6D,0xDA,0x30,0x83,0x07,0x91,0xAC,0x15,0xFF,0x8F,
+ 0x59,0x54,0xEA,0x25,0xBC,0x4E,0xEB,0x6A,0x54,0xDF,0x75,0x09,
+ 0x72,0x0F,0xEF,0x23,0x70,0xE0,0xA8,0x04,0xEA,0xFF,0x90,0x54,
+ 0xCD,0x84,0x18,0xC0,0x75,0x91,0x99,0x0F,0xA1,0x78,0x0C,0x07,
+ 0xB7,0xC5,0xDE,0x55,0x06,0x7B,0x95,0x68,0x2C,0x33,0x39,0xBC,
+ 0x2C,0xD0,0x6D,0xDD,0xFA,0xDC,0xB5,0x8F,0x82,0x39,0xF8,0x67,
+ 0x44,0xF1,0xD8,0xF7,0x78,0x11,0x9A,0x77,0x9B,0x53,0x47,0xD6,
+ 0x2B,0x5D,0x67,0xB8,0xB7,0xBC,0xC1,0xD7,0x79,0x62,0x15,0xC2,
+ 0xC5,0x83,0x97,0xA7,0xF8,0xB4,0x9C,0xF6,0x8F,0x9A,0xC7,0xDA,
+ 0x1B,0xBB,0x87,0x07,0xA7,0x71,0xAD,0xB2,0x8A,0x50,0xF8,0x26,
+ 0x12,0xB7,0x3E,0x0B,
};
- static unsigned char dh1024_g[]={
+ static unsigned char dh2048_g[]={
0x02,
};
DH *dh;
if ((dh=DH_new()) == NULL) return(NULL);
- dh->p=BN_bin2bn(dh1024_p,sizeof(dh1024_p),NULL);
- dh->g=BN_bin2bn(dh1024_g,sizeof(dh1024_g),NULL);
+ dh->p=BN_bin2bn(dh2048_p,sizeof(dh2048_p),NULL);
+ dh->g=BN_bin2bn(dh2048_g,sizeof(dh2048_g),NULL);
if ((dh->p == NULL) || (dh->g == NULL))
{ DH_free(dh); return(NULL); }
return(dh);
@@ -248,7 +259,7 @@ new_VioSSLFd(const char *key_file, const char *cert_file,
}
/* DH stuff */
- dh=get_dh1024();
+ dh=get_dh2048();
if (!SSL_CTX_set_tmp_dh(ssl_fd->ssl_context, dh))
{
*error= SSL_INITERR_DH;
diff --git a/win/packaging/CMakeLists.txt b/win/packaging/CMakeLists.txt
index 9d25f70c61a..33c6cffe323 100644
--- a/win/packaging/CMakeLists.txt
+++ b/win/packaging/CMakeLists.txt
@@ -24,6 +24,7 @@ FIND_PATH(WIX_DIR heat.exe
"$ENV{ProgramFiles}/Windows Installer XML v3/bin"
"$ENV{ProgramFiles}/Windows Installer XML v3.5/bin"
"$ENV{ProgramFiles}/Windows Installer XML v3.6/bin"
+ "$ENV{ProgramFiles}/WiX Toolset v3.9/bin"
"$ENV{WIX}/bin"
)
diff --git a/win/packaging/CPackWixConfig.cmake b/win/packaging/CPackWixConfig.cmake
index 474c207891c..58a2ef44eef 100644
--- a/win/packaging/CPackWixConfig.cmake
+++ b/win/packaging/CPackWixConfig.cmake
@@ -68,7 +68,6 @@ SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DESCRIPTION "Install server")
SET(CPACK_COMPONENT_CONNECT-ENGINE_DESCRIPTION "Server data files" )
SET(CPACK_COMPONENT_CONNECT-ENGINE_HIDDEN 1)
-
#Feature "Devel"
SET(CPACK_COMPONENT_GROUP_DEVEL_DISPLAY_NAME "Development Components")
SET(CPACK_COMPONENT_GROUP_DEVEL_DESCRIPTION "Installs C/C++ header files and libraries")
diff --git a/win/packaging/ca/CMakeLists.txt b/win/packaging/ca/CMakeLists.txt
index 0da1e5d67b1..ccd03130d69 100644
--- a/win/packaging/ca/CMakeLists.txt
+++ b/win/packaging/ca/CMakeLists.txt
@@ -36,6 +36,9 @@ ELSEIF(MSVC_VERSION EQUAL 1500)
ELSEIF(MSVC_VERSION EQUAL 1600 OR MSVC_VERSION EQUAL 1700 )
SET(WIX35_MSVC_SUFFIX "_2010")
SET(WIX36_MSVC_SUFFIX "VS2010")
+ELSEIF(MSVC_VERSION EQUAL 1800 OR MSVC_VERSION EQUAL 1900 )
+ SET(WIX35_MSVC_SUFFIX "_2013")
+ SET(WIX36_MSVC_SUFFIX "VS2013")
ELSE()
# When next VS is out, add the correct version here
MESSAGE(FATAL_ERROR "Unknown VS version")
@@ -47,7 +50,8 @@ FIND_LIBRARY(WIX_WCAUTIL_LIBRARY
wcautil
PATHS
${WIX_DIR}/../SDK/lib
- ${WIX_DIR}/../SDK/${WIX36_MSVC_SUFFIX}/lib/${WIX36_ARCH_SUFFIX})
+ ${WIX_DIR}/../SDK/${WIX36_MSVC_SUFFIX}/lib/${WIX36_ARCH_SUFFIX}
+ )
FIND_LIBRARY(WIX_DUTIL_LIBRARY
NAMES dutil${WIX_ARCH_SUFFIX} dutil${WIX35_MSVC_SUFFIX}${WIX_ARCH_SUFFIX}